From aacb33dc286d0e1e695e923bef88207f7822420a Mon Sep 17 00:00:00 2001 From: Imani Manyara Date: Thu, 5 Nov 2026 06:16:01 -0500 Subject: [PATCH 1/4] Open on the installed packs, chunk Inertia pages, pin shared scripts - browserConfig passes the page's packages (core's registered packs) as defaults.packages (Q42). - Inertia pages load lazily, chunk names carry their hash (F-12). - check:config-drift compares eslint.base.js and the .dev/tools scripts with js-ui-kernel (F-18). --- .dev/tools/check-config-drift.mjs | 112 ++++++++++++++++++++++++++++ .github/workflows/tests.yml | 5 ++ package.json | 3 +- resources/js/app.tsx | 12 +-- resources/js/core/appConfig.test.ts | 18 +++++ resources/js/core/appConfig.ts | 16 +++- vite.inertia.config.ts | 4 +- 7 files changed, 161 insertions(+), 9 deletions(-) create mode 100644 .dev/tools/check-config-drift.mjs diff --git a/.dev/tools/check-config-drift.mjs b/.dev/tools/check-config-drift.mjs new file mode 100644 index 0000000..3182490 --- /dev/null +++ b/.dev/tools/check-config-drift.mjs @@ -0,0 +1,112 @@ +#!/usr/bin/env node +// Canonical: ichava/js-ui-kernel config/check-config-drift.mjs. Copies must be +// byte-identical, and this script checks its own copy too: list it as one of the pairs. +// +// Usage: node scripts/check-config-drift.mjs = [= ...] +// +// path in this repository, relative to the working directory +// path inside ichava/js-ui-kernel, e.g. config/tsconfig.base.json +// +// Each canonical file is fetched from raw.githubusercontent.com and compared byte for byte. +// It fails on a mismatch, on a non-200 response, on an empty body and on an empty pair +// list, so it cannot pass by comparing nothing. +// +// ICHAVA_KERNEL_REF git ref to compare against (default: main) +// ICHAVA_KERNEL_RAW raw base URL (default: https://raw.githubusercontent.com/ichava/js-ui-kernel) +import { readFile } from 'node:fs/promises'; +import { pathToFileURL } from 'node:url'; + +export const DEFAULT_RAW = 'https://raw.githubusercontent.com/ichava/js-ui-kernel'; + +/** Parses `local=canonical` arguments. Throws on a malformed one. */ +export function parsePairs(args) { + return args.map((arg) => { + const eq = arg.indexOf('='); + if (eq <= 0 || eq === arg.length - 1) { + throw new Error(`expected =, got "${arg}"`); + } + return { local: arg.slice(0, eq), canonical: arg.slice(eq + 1) }; + }); +} + +/** + * Compares each pair. Returns { checked, failures }, where failures is a list of + * human-readable reasons. `fetchImpl` and `readImpl` are injectable for tests. + */ +export async function checkDrift({ + pairs, + ref = 'main', + raw = DEFAULT_RAW, + fetchImpl = globalThis.fetch, + readImpl = (path) => readFile(path), +}) { + const failures = []; + if (pairs.length === 0) { + failures.push('no files to compare: pass at least one = pair'); + return { checked: 0, failures }; + } + + let checked = 0; + for (const { local, canonical } of pairs) { + const url = `${raw}/${ref}/${canonical}`; + let localBytes; + try { + localBytes = Buffer.from(await readImpl(local)); + } catch (error) { + failures.push(`${local}: cannot read the local copy (${error.message})`); + continue; + } + + let response; + try { + response = await fetchImpl(url); + } catch (error) { + failures.push(`${local}: cannot fetch ${url} (${error.message})`); + continue; + } + if (response.status !== 200) { + failures.push(`${local}: ${url} answered ${response.status}, expected 200`); + continue; + } + const remoteBytes = Buffer.from(await response.arrayBuffer()); + if (remoteBytes.length === 0) { + failures.push(`${local}: ${url} returned an empty body`); + continue; + } + + checked += 1; + if (!localBytes.equals(remoteBytes)) { + failures.push( + `${local}: differs from ${canonical} at ${ref} ` + + `(${localBytes.length} bytes here, ${remoteBytes.length} canonical). ` + + `Copy the canonical file over it; change the canonical in ichava/js-ui-kernel first.`, + ); + } + } + return { checked, failures }; +} + +async function main() { + let pairs; + try { + pairs = parsePairs(process.argv.slice(2)); + } catch (error) { + console.error(`check-config-drift: ${error.message}`); + return 2; + } + const ref = process.env.ICHAVA_KERNEL_REF || 'main'; + const raw = process.env.ICHAVA_KERNEL_RAW || DEFAULT_RAW; + const { checked, failures } = await checkDrift({ pairs, ref, raw }); + + for (const failure of failures) console.error(`check-config-drift: ${failure}`); + if (failures.length > 0 || checked !== pairs.length) { + console.error(`check-config-drift: FAILED, ${checked} of ${pairs.length} file(s) compared`); + return 1; + } + console.log(`check-config-drift: ${checked} file(s) identical to ichava/js-ui-kernel@${ref}`); + return 0; +} + +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { + process.exitCode = await main(); +} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cc0b05a..25e41a9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,6 +47,11 @@ jobs: - name: Vitest run: npm run test:js + # eslint.base.js and .dev/tools/{sync-vendored-library,check-config-drift}.mjs are copies of + # ichava/js-ui-kernel's config/; this fails when one stops matching (re-audit F-18). + - name: Shared config matches the kernel + run: npm run check:config-drift + # The committed bundle is what hosts receive, so it must at least build from this tree. # The vendored react-icon-browser build is checked against its manifest by Vitest above. - name: Build the browser bundle diff --git a/package.json b/package.json index 268b765..65f8e8a 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,9 @@ }, "type": "module", "scripts": { + "check:config-drift": "node .dev/tools/check-config-drift.mjs eslint.base.js=config/eslint.base.js .dev/tools/sync-vendored-library.mjs=config/tools/sync-vendored-library.mjs .dev/tools/check-config-drift.mjs=config/check-config-drift.mjs", "// clean": "Narrow on purpose. inertia-app.js/.css are CHECKED IN and no npm script or CI job rebuilds them -- only build does. rm -rf public/* destroyed them, and a failing vite build destroyed them for nothing. Delete only what the build re-emits. See issue #26.", - "clean": "rm -rf public/assets/js/inertia-app.js public/assets/css/inertia-app.css public/.vite 2>/dev/null || true", + "clean": "rm -rf public/assets/js/inertia-app*.js public/assets/css/inertia-app.css public/.vite 2>/dev/null || true", "build": "npm run clean && echo '' && echo '🔨 Building Ichava (dev)...' && NODE_ENV=development vite build --config vite.inertia.config.ts", "build:prod": "npm run clean && echo '' && echo '🚀 Building Ichava (production)...' && NODE_ENV=production vite build --config vite.inertia.config.ts", "watch": "echo '' && echo '👀 Watching Ichava for changes...' && vite build --watch --config vite.inertia.config.ts", diff --git a/resources/js/app.tsx b/resources/js/app.tsx index b9a3537..d1dc413 100644 --- a/resources/js/app.tsx +++ b/resources/js/app.tsx @@ -20,18 +20,20 @@ void createInertiaApp({ title: (title) => (title ? `${title} - Ichava` : 'Ichava'), resolve: (name) => { - const pages = import.meta.glob(['./pages/**/*.tsx', '!./pages/**/*.test.tsx', '!./pages/**/__tests__/**'], { eager: true }) as Record< + // Each page is its own chunk, loaded when Inertia visits it (re-audit F-12): the first + // load no longer carries every page's code. + const pages = import.meta.glob(['./pages/**/*.tsx', '!./pages/**/*.test.tsx', '!./pages/**/__tests__/**']) as Record< string, - { default: React.ComponentType } + () => Promise<{ default: React.ComponentType }> >; - const page = pages[`./pages/${name}.tsx`]; + const load = pages[`./pages/${name}.tsx`]; - if (!page) { + if (!load) { throw new Error(`Unknown Inertia page component: ${name}`); } - return page; + return load().then((m) => m.default); }, setup({ el, App, props }) { diff --git a/resources/js/core/appConfig.test.ts b/resources/js/core/appConfig.test.ts index 9a018fd..78cefa4 100644 --- a/resources/js/core/appConfig.test.ts +++ b/resources/js/core/appConfig.test.ts @@ -55,3 +55,21 @@ describe('browserConfig', () => { expect(resolveConfig(browserConfig(null)).host).toBeNull(); }); }); + +/** + * Q42: the browser opens on every pack the host has installed. The page's `packages` prop is the + * packs ichava/core registered (`IconBrowserService::getFilters()`), so it becomes the library's + * `defaults.packages`; no pack name is written in this package or the library. + */ +describe('browserConfig opening packs', () => { + const packages = [{ name: 'ichava/icon-sets-tabler' }, { name: 'ichava/icon-sets-lucide' }]; + + it("passes the page's installed packs as the opening selection", () => { + expect(resolveConfig(browserConfig({ packages })).defaults.packages).toEqual(['ichava/icon-sets-tabler', 'ichava/icon-sets-lucide']); + }); + + it('passes none when the page carries no packages, so the library opens on every pack its API reports', () => { + expect(browserConfig({}).defaults).toBeUndefined(); + expect(browserConfig({ packages: [] }).defaults).toBeUndefined(); + }); +}); diff --git a/resources/js/core/appConfig.ts b/resources/js/core/appConfig.ts index edd4a6f..4039a9b 100644 --- a/resources/js/core/appConfig.ts +++ b/resources/js/core/appConfig.ts @@ -8,12 +8,24 @@ import type { AuthUser, IchavaShared } from '@/types'; * `features.*` flag), sign-in and sign-out links, storage tier, theme, page size and locale. * Props with no features manifest add nothing, so the browser keeps its defaults. */ -export function browserConfig(page: { auth?: AuthUser | null; ichava?: Partial | null } | null | undefined): PartialConfig { +export function browserConfig( + page: { auth?: AuthUser | null; ichava?: Partial | null; packages?: ReadonlyArray<{ name: string }> | null } | null | undefined, +): PartialConfig { const ichava = page?.ichava ?? null; // The server's props are the schema's shapes (`UserData`, the `ichava` prop); this // package's own types for them are looser, so they are passed as the library's. const host = hostConfigFromProps({ auth: (page?.auth ?? null) as HostUser | null, ichava: ichava as Partial | null }); - return mergeConfig(appConfig(ichava), host); + return mergeConfig(mergeConfig(appConfig(ichava), openingPacks(page?.packages)), host); +} + +/** + * The packs the browser opens on (Q42): every pack the host has installed, which is the page's + * `packages` prop (the packs ichava/core registered). Nothing when the page sends none: the + * library then opens on every installed pack its packages API reports. + */ +function openingPacks(packages: ReadonlyArray<{ name: string }> | null | undefined): PartialConfig { + const names = (packages ?? []).map((p) => p.name).filter((n) => typeof n === 'string' && n !== ''); + return names.length ? { defaults: { packages: names } } : {}; } /** diff --git a/vite.inertia.config.ts b/vite.inertia.config.ts index 1296eaf..aef33b1 100644 --- a/vite.inertia.config.ts +++ b/vite.inertia.config.ts @@ -59,7 +59,9 @@ export default defineConfig({ input: 'resources/js/app.tsx', output: { entryFileNames: 'assets/js/inertia-app.js', - chunkFileNames: 'assets/js/inertia-app-[name].js', + // Content-addressed: the entry is versioned by `?v=` in app.blade.php, but a chunk it + // imports is fetched by name, so the name carries the hash. + chunkFileNames: 'assets/js/inertia-app-[name]-[hash].js', assetFileNames: (info) => { if (info.names?.some((n) => n.endsWith('.css'))) return 'assets/css/inertia-app.css'; if (info.names?.some((n) => /\.(woff2?|ttf|otf)$/.test(n))) return 'assets/fonts/[name][extname]'; From b23ef9096fea9640754dd95727e72eb78eb14d62 Mon Sep 17 00:00:00 2001 From: Imani Manyara Date: Thu, 5 Nov 2026 06:16:01 -0500 Subject: [PATCH 2/4] Move package detail into a query service; FormRequests, injection, vendor-named middleware - F-08: PackageDetails + PackageDetailsData serve both controllers; IconTables names core's tables once. - F-09: four FormRequests with toData() DTOs replace six inline rule sets. - F-10: SecurityNonce, AuditLogger, HostUser, IconSnippets and the Translator are injected. - F-11: middleware aliases and groups are ichava-icon-browser.*, forward only. HttpLayerConventionsTest guards all four. --- CHANGELOG.md | 7 + config/icon-browser.php | 2 +- docs/architecture.md | 2 +- docs/environment.md | 4 +- docs/installation.md | 2 +- docs/tools/host-integration.md | 2 +- routes/api.php | 22 +-- routes/inertia.php | 6 +- routes/web.php | 4 +- src/Actions/Library/CreateCollection.php | 15 -- src/Data/CreateCollectionData.php | 16 +++ src/Data/PackageDetailsData.php | 46 ++++++ src/Data/RecordCommandData.php | 16 +++ src/Data/RecordHistoryData.php | 14 ++ src/Data/UpdateCollectionData.php | 15 ++ .../Api/CollectionsApiController.php | 28 +--- .../Api/CommandHistoryApiController.php | 26 +--- .../Controllers/Api/HistoryApiController.php | 24 +--- .../Api/IconBrowserApiController.php | 135 +++++------------- .../Controllers/Web/CollectionController.php | 23 +-- .../Web/CommandHistoryController.php | 17 +-- .../Controllers/Web/HistoryController.php | 16 +-- .../Web/InertiaBrowserController.php | 22 +-- .../Controllers/Web/PackageController.php | 79 +--------- src/Http/Middleware/AuthorizeAdmin.php | 2 +- src/Http/Middleware/AuthorizeCacheAdmin.php | 4 +- src/Http/Middleware/IchavaApiSecurity.php | 28 ++-- src/Http/Middleware/ThrottleRoute.php | 2 +- src/Http/Requests/IchavaFormRequest.php | 35 +++++ src/Http/Requests/RecordCommandRequest.php | 29 ++++ src/Http/Requests/RecordHistoryRequest.php | 28 ++++ src/Http/Requests/StoreCollectionRequest.php | 30 ++++ src/Http/Requests/UpdateCollectionRequest.php | 27 ++++ src/Http/Resources/IconCollection.php | 19 +++ src/Http/Resources/IconResource.php | 18 ++- src/Providers/IconBrowserServiceProvider.php | 48 +++---- src/Support/BrowserBootstrap.php | 4 +- src/Support/CacheAdminGate.php | 12 +- src/Support/FeaturesManifest.php | 3 +- src/Support/Helpers.php | 6 +- src/Support/IconTables.php | 23 +++ src/Support/PackageDetails.php | 118 +++++++++++++++ tests/Configured/ConfiguredHostTest.php | 2 +- tests/ConfiguredHostTestCase.php | 2 +- tests/Feature/AssetPublishTagTest.php | 2 +- tests/Feature/CacheStatsExposureTest.php | 2 +- tests/Feature/HostUserTest.php | 2 +- tests/Feature/HttpLayerConventionsTest.php | 85 +++++++++++ .../Middleware/IchavaApiSecurityTest.php | 8 +- 49 files changed, 703 insertions(+), 379 deletions(-) create mode 100644 src/Data/CreateCollectionData.php create mode 100644 src/Data/PackageDetailsData.php create mode 100644 src/Data/RecordCommandData.php create mode 100644 src/Data/RecordHistoryData.php create mode 100644 src/Data/UpdateCollectionData.php create mode 100644 src/Http/Requests/IchavaFormRequest.php create mode 100644 src/Http/Requests/RecordCommandRequest.php create mode 100644 src/Http/Requests/RecordHistoryRequest.php create mode 100644 src/Http/Requests/StoreCollectionRequest.php create mode 100644 src/Http/Requests/UpdateCollectionRequest.php create mode 100644 src/Support/IconTables.php create mode 100644 src/Support/PackageDetails.php create mode 100644 tests/Feature/HttpLayerConventionsTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index bd9d0ee..39cb6ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to `ichava/icon-browser` follow [Keep a Changelog](https://k ### Removed +- `CreateCollection::rules()`: its two callers now use `StoreCollectionRequest`, which owns the rules (forward only). - **The vendored-library test reads only `vendored.json`.** The fallback to the old `VENDORED.json` name is removed (forward only, owner 2026-11-05); every consumer writes the lowercase name since #124. - **Payload schema 1.8.0: the `android-vd` (Android VectorDrawable XML) asset export is dropped**, by owner rule (Sim, 2026-11-04): the ichava icon ecosystem is strictly `*.svg`. `$defs/format` and `x-ichava-formats` lose `android-vd` (25 formats), `PayloadSchema::VERSION` is `1.8.0`, and `FormatRegistryTest` now fails if the id returns or if any asset export other than the SVG-carrying `css-mask`, `data-uri`, `flutter` and `swiftui` appears. 1.7.0 was never released, so no published payload named it. - **Payload schema 1.7.0: the `png-zip` asset export is dropped**, by owner decision (Sim, 2026-11-04). `$defs/format` and `x-ichava-formats` lose `png-zip` (26 formats), `PayloadSchema::VERSION` is `1.7.0`, and `FormatRegistryTest` now fails if the id comes back. 1.6.0 was never released, so no published payload named it. @@ -46,6 +47,12 @@ All notable changes to `ichava/icon-browser` follow [Keep a Changelog](https://k ### Changed +- **Middleware aliases and groups carry the package name** (re-audit F-11, forward only): `ichava-icon-browser.session`, `.security`, `.json`, `.log`, `.validate`, `.guard`, `.cache-admin`, `.admin`, `.throttle`, `.handle-inertia`, and the groups `ichava-icon-browser.api`, `.web` and `.inertia`. The bare `ichava.*` names are gone, with no forwarding alias. A host route guarded with `->middleware('ichava.admin')` changes to `ichava-icon-browser.admin`. The `ichava.admin` *ability* (a Gate) keeps its name. `HttpLayerConventionsTest` reads the router's live map. +- **One query service for package detail** (F-08): `Support\PackageDetails` returns a `Data\PackageDetailsData` that the API's `package()` and the Inertia `PackageController::show()` both render; neither controller queries. Table names come from `Support\IconTables` (`ICONS` is core's `Icon::TABLE`; the term table and pivot are held to `IconTerm` by a test). +- **FormRequests with `toData()` at the edge** (F-09): `RecordCommandRequest`, `RecordHistoryRequest`, `StoreCollectionRequest` and `UpdateCollectionRequest` replace the six inline rule sets, each with a `final readonly` DTO in `src/Data/`. `IchavaFormRequest` keeps the API's validation body (`success: false`, `error`, `errors`) for JSON callers and Laravel's redirect for pages. +- **Collaborators are injected, not reached for** (F-10): `IchavaApiSecurity` takes core's `SecurityNonce` and `AuditLogger`; `CacheAdminGate` is an injectable service taking `HostUser` (its static `refusal()`/`allows()` are instance methods now); `IconResource`/`IconCollection` take `IconSnippets` through `withSnippets()`; `BrowserBootstrap` reads the locale from the `Translator`. +- **The browser opens on every pack the host has installed** (Q42): the Inertia page's `packages` (what core registered) becomes the library's `defaults.packages`, and the re-vendored react-icon-browser names no pack. +- **Each Inertia page is its own chunk** (F-12): `import.meta.glob` is no longer eager; chunks are content-addressed (`inertia-app-[name]-[hash].js`) since only the entry carries `?v=`, and `npm run clean` removes them. - **The payload schema's `$id` resolves to the file**: `https://raw.githubusercontent.com/ichava/icon-browser/main/resources/schema/icon-browser.schema.json` (it named a github.com path that answers 404). No field changes, so the version stays 1.8.0. `docs/tools/payload-schema.md` says how react-icon-browser and js-icon-components pin their copies. - **The vendored manifest is `resources/vendor/react-icon-browser/vendored.json`, no longer `VENDORED.json`** (owner rule: file names are lower-case slugs). `.dev/tools/sync-vendored-library.mjs` writes only the new name, and `vendoredLibrary.test.ts` reads it first, falls back to the old one until after v0.1.0, and fails if the old name returns. Re-synced from react-icon-browser `7188f57`, the commit already vendored: the manifest's bytes and every bundle file are unchanged, and `npm run build:prod` leaves `public/assets` as committed. - **Documentation links point at each repository's own `docs/`** (Sim, 2026-11-03: "all ichava repos have docs in their respective repos. thats by design"). Links to `opensource.simtabi.com/documentation/ichava/...` and the `opensource.simtabi.com/products/ichava/...` homepage, which answer 404 for every ichava page, now go to the matching `docs/*.md` on GitHub, or to the repository itself. Each target was checked to exist on that repository's `main`. The manifest's `homepage` and `support.docs` follow. diff --git a/config/icon-browser.php b/config/icon-browser.php index 22c320e..d2f8a63 100644 --- a/config/icon-browser.php +++ b/config/icon-browser.php @@ -269,7 +269,7 @@ 'enabled' => env('ICHAVA_RATE_LIMITING_ENABLED', false), 'browser' => env('ICHAVA_BROWSER_RATE_LIMIT', 300), 'api' => env('ICHAVA_API_RATE_LIMIT', 600), - // Global floor applied to the `ichava.api` middleware group on top of + // Global floor applied to the `ichava-icon-browser.api` middleware group on top of // per-endpoint limits. Acts as a safety net regardless of `enabled`. 'api_floor' => env('ICHAVA_API_FLOOR', 300), ], diff --git a/docs/architecture.md b/docs/architecture.md index d3faeb6..0bc069c 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -12,7 +12,7 @@ Relocated from the README, which is now a slim pointer. |---|---| | Visual browser | `@ichava/react-icon-browser`, served as Inertia pages at `/{prefix}/icons`. Search, filter by pack/variant/category, copy and export, collections, theme and appearance. See *The browser UI* below. | | REST API | Endpoints for icons, packages, terms, preferences, command history, cache and statistics. | -| Middleware | The `ichava.api` and `ichava.web` groups, plus per-middleware aliases: `ichava.guard`, `ichava.security`, `ichava.json`, `ichava.log`, `ichava.session`, `ichava.validate`. | +| Middleware | The `ichava-icon-browser.api` and `ichava-icon-browser.web` groups, plus per-middleware aliases: `ichava-icon-browser.guard`, `ichava-icon-browser.security`, `ichava-icon-browser.json`, `ichava-icon-browser.log`, `ichava-icon-browser.session`, `ichava-icon-browser.validate`. | | Hybrid auth | `HostCapabilities` detects Sanctum and sessions, then adapts the stack. | | Blade views | `` and ``, plus the `` and `` demo components. | | `ui-icons` pack | The bundled icon set the browser pages use. | diff --git a/docs/environment.md b/docs/environment.md index dcc9b1d..7a6e4e1 100644 --- a/docs/environment.md +++ b/docs/environment.md @@ -54,7 +54,7 @@ The guard the user is read from is core's `ICHAVA_AUTH_GUARD` (`ichava.ichava-co | Key | Default | Effect | Config | |---|---|---|---| | `ICHAVA_API_PRETTY_PRINT` | `true` | Indented JSON responses | `ichava.icon-browser.api.pretty_print` | -| `ICHAVA_API_CORS_ENABLED` | `true` | Apply CORS headers from the `ichava.api` middleware group | `ichava.icon-browser.api.cors.enabled` | +| `ICHAVA_API_CORS_ENABLED` | `true` | Apply CORS headers from the `ichava-icon-browser.api` middleware group | `ichava.icon-browser.api.cors.enabled` | | `ICHAVA_API_CORS_ORIGINS` | `APP_URL` | Allowed origins: one, or a comma-separated list. One is sent as is; with several the request's `Origin` is echoed when listed. Never `*` unless you set it | `ichava.icon-browser.api.cors.allowed_origins` | ## HTTP request size guard @@ -70,7 +70,7 @@ The guard the user is read from is core's `ICHAVA_AUTH_GUARD` (`ichava.ichava-co | `ICHAVA_RATE_LIMITING_ENABLED` | `false` | Master switch for per-route throttle middleware | `ichava.icon-browser.rate_limiting.enabled` | | `ICHAVA_BROWSER_RATE_LIMIT` | `300` | Browser-route limit figure (requests per minute) | `ichava.icon-browser.rate_limiting.browser` | | `ICHAVA_API_RATE_LIMIT` | `600` | Ceiling for every API route's own limit (requests per minute); it can lower a route's declared limit, never raise it | `ichava.icon-browser.rate_limiting.api` | -| `ICHAVA_API_FLOOR` | `300` | Global throttle floor on the `ichava.api` middleware group, applied regardless of the master switch | `ichava.icon-browser.rate_limiting.api_floor` | +| `ICHAVA_API_FLOOR` | `300` | Global throttle floor on the `ichava-icon-browser.api` middleware group, applied regardless of the master switch | `ichava.icon-browser.rate_limiting.api_floor` | ## See also diff --git a/docs/installation.md b/docs/installation.md index 7b9571c..9690b44 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -88,7 +88,7 @@ GitHub's public `ichava/js-ui-kernel`. - The React + Inertia.js icon browser at `/{prefix}/icons` - The REST API at `/{prefix}/api/v1/...` (icons, packages, terms, preferences, cache) -- All Ichava middleware (`ichava.api`, `ichava.web`, hybrid Sanctum/session detection) +- All Ichava middleware (`ichava-icon-browser.api`, `ichava-icon-browser.web`, hybrid Sanctum/session detection) - The `` and `` demo Blade components - The `ui-icons` icon set the browser pages use - The `ichava::icon-browser.inject-scripts` Artisan command diff --git a/docs/tools/host-integration.md b/docs/tools/host-integration.md index d979c25..fb0e283 100644 --- a/docs/tools/host-integration.md +++ b/docs/tools/host-integration.md @@ -34,7 +34,7 @@ Email, passwords and tokens never leave the server. Extra attributes appear only | `ichava.admin` | `GET {prefix}/api/v1/status`, the `status` prop on the Stats page, the `status` feature | denied (core defines it when the host has not) | | `ichava.manage-cache` | cache stats, clear and rebuild | undefined, so refused; falls back to `ichava.admin` when the host defines only that | -Grant both with one Gate; see [Grant admin access](../recipes/grant-admin-access.md). The `ichava.admin` middleware alias guards any route of your own the same way. +Grant both with one Gate; see [Grant admin access](../recipes/grant-admin-access.md). The `ichava-icon-browser.admin` middleware alias guards any route of your own the same way. ## The library, kept by owner diff --git a/routes/api.php b/routes/api.php index d208890..69d609b 100644 --- a/routes/api.php +++ b/routes/api.php @@ -29,13 +29,13 @@ */ // Ichava API Routes -// Uses 'ichava.api' middleware group which includes: +// Uses 'ichava-icon-browser.api' middleware group which includes: // - web (session, CSRF, cookies) -// - ichava.session (ensure session started) -// - ichava.security (XSS, SQL injection protection) -// - ichava.json (force JSON responses) -// - ichava.log (request logging in debug mode) -Route::group(Helpers::routeGroup(Helpers::routePrefix() . '/api/v1', ['ichava.api'], 'ichava.api.v1.'), function () { +// - ichava-icon-browser.session (ensure session started) +// - ichava-icon-browser.security (XSS, SQL injection protection) +// - ichava-icon-browser.json (force JSON responses) +// - ichava-icon-browser.log (request logging in debug mode) +Route::group(Helpers::routeGroup(Helpers::routePrefix() . '/api/v1', ['ichava-icon-browser.api'], 'ichava.api.v1.'), function () { // ===================================================================== // SESSION: the host's signed-in user and where the library is kept @@ -51,7 +51,7 @@ // Core's StatusData, for administrators only (`ichava.admin`, default deny). Route::get('/status', [HostApiController::class, 'status']) - ->middleware('ichava.admin') + ->middleware('ichava-icon-browser.admin') ->middleware(Helpers::getRateLimit('api', 30)) ->name('status'); @@ -174,19 +174,19 @@ // ===================================================================== // Get cache statistics. Read-only, but it describes the server's cache // configuration and watched directories, so it answers to the same - // fail-closed `ichava.cache-admin` decision as the write routes below. + // fail-closed `ichava-icon-browser.cache-admin` decision as the write routes below. Route::get('/cache/stats', [IconBrowserApiController::class, 'cacheStats']) - ->middleware('ichava.cache-admin') + ->middleware('ichava-icon-browser.cache-admin') ->middleware(Helpers::getRateLimit('api', 60)) ->name('cache.stats'); // Cache write operations // Destructive: `clear` flushes the icon cache and `rebuild` additionally resets // every stored preference. A rate limit slows repetition; it does not decide who - // is allowed. `ichava.cache-admin` fails closed unless the host grants the ability. + // is allowed. `ichava-icon-browser.cache-admin` fails closed unless the host grants the ability. Route::prefix('cache') ->name('cache.') - ->middleware(['ichava.cache-admin', ...Helpers::getRateLimit('api', 10)]) + ->middleware(['ichava-icon-browser.cache-admin', ...Helpers::getRateLimit('api', 10)]) ->group(function () { Route::post('/clear', [IconBrowserApiController::class, 'clearCache']) ->name('clear'); diff --git a/routes/inertia.php b/routes/inertia.php index cb90173..10497d1 100644 --- a/routes/inertia.php +++ b/routes/inertia.php @@ -28,12 +28,12 @@ | flash data. Validation failures redirect back with errors via the | shared `errors` prop automatically. | -| Middleware: 'ichava.inertia' (web + shared props + prefix validation) +| Middleware: 'ichava-icon-browser.inertia' (web + shared props + prefix validation) | Prefix: /ichava | */ -Route::group(Helpers::routeGroup(Helpers::routePrefix(), ['ichava.inertia'], 'ichava.inertia.'), function () { +Route::group(Helpers::routeGroup(Helpers::routePrefix(), ['ichava-icon-browser.inertia'], 'ichava.inertia.'), function () { // Browser: filtered icon listing + detail + stats dashboard. Route::get('/icons', [InertiaBrowserController::class, 'index']) @@ -127,7 +127,7 @@ // pair: destructive, fails closed unless the host grants the ability. Route::prefix('cache') ->name('cache.') - ->middleware('ichava.cache-admin') + ->middleware('ichava-icon-browser.cache-admin') ->group(function () { Route::post('/clear', [CacheController::class, 'clear']) ->name('clear'); diff --git a/routes/web.php b/routes/web.php index 2760943..dfa68d2 100644 --- a/routes/web.php +++ b/routes/web.php @@ -16,7 +16,7 @@ | the same URLs. The Vue views and controllers remain on disk until | Phase 6 removes them; they are simply unreachable over HTTP now. | -| Middleware: 'ichava.web' (includes web + validation) +| Middleware: 'ichava-icon-browser.web' (includes web + validation) | Prefix: /ichava | */ @@ -24,7 +24,7 @@ // The redirect points at the Inertia browser, so it exists only when those // pages do: with ICHAVA_INERTIA_ENABLED=false, /{prefix} redirected to a 404. if (filter_var(config('ichava.icon-browser.inertia.enabled', true), FILTER_VALIDATE_BOOL)) { - Route::group(Helpers::routeGroup(Helpers::routePrefix(), ['ichava.web'], 'ichava.'), function () { + Route::group(Helpers::routeGroup(Helpers::routePrefix(), ['ichava-icon-browser.web'], 'ichava.'), function () { // Redirect bare /{prefix} to the canonical (Inertia) browser URL. Route::redirect('/', '/' . Helpers::routePrefix() . '/icons') ->name('home'); diff --git a/src/Actions/Library/CreateCollection.php b/src/Actions/Library/CreateCollection.php index cbbab7a..32b9f87 100644 --- a/src/Actions/Library/CreateCollection.php +++ b/src/Actions/Library/CreateCollection.php @@ -20,21 +20,6 @@ public function __construct(private IconPreferenceService $preferences) {} - /** - * The validation both create routes (Inertia and `/api/v1`) apply. - * - * @return array> - */ - public static function rules(): array - { - return [ - 'name' => 'required|string|max:100', - 'color' => 'nullable|string|regex:/^#[a-fA-F0-9]{6}$/', - 'icon_ids' => ['sometimes', 'array', 'max:' . self::MAX_ICONS], - 'icon_ids.*' => ['integer', 'min:1'], - ]; - } - /** * @param list $iconIds The icons the collection starts with, in order. An id no * icon has is skipped, as adding it on its own would refuse it. diff --git a/src/Data/CreateCollectionData.php b/src/Data/CreateCollectionData.php new file mode 100644 index 0000000..c50886f --- /dev/null +++ b/src/Data/CreateCollectionData.php @@ -0,0 +1,16 @@ + $iconIds the icons it starts with, in order */ + public function __construct( + public string $name, + public ?string $color = null, + public array $iconIds = [], + ) {} +} diff --git a/src/Data/PackageDetailsData.php b/src/Data/PackageDetailsData.php new file mode 100644 index 0000000..7933be6 --- /dev/null +++ b/src/Data/PackageDetailsData.php @@ -0,0 +1,46 @@ + $categories + * @param list $variants + * @param array $labels + * @param array $registryData the pack's registry entry, for callers that publish part of it + */ + public function __construct( + public string $name, + public string $label, + public string $description, + public string $vendor, + public int $iconCount, + public array $categories, + public array $variants, + public array $labels, + public array $registryData, + ) {} + + /** @return array{name: string, label: string, description: string, vendor: string, icon_count: int, categories: list, variants: list, labels: array} */ + public function toArray(): array + { + return [ + 'name' => $this->name, + 'label' => $this->label, + 'description' => $this->description, + 'vendor' => $this->vendor, + 'icon_count' => $this->iconCount, + 'categories' => $this->categories, + 'variants' => $this->variants, + 'labels' => $this->labels, + ]; + } +} diff --git a/src/Data/RecordCommandData.php b/src/Data/RecordCommandData.php new file mode 100644 index 0000000..b700a51 --- /dev/null +++ b/src/Data/RecordCommandData.php @@ -0,0 +1,16 @@ + $metadata */ + public function __construct( + public string $command, + public string $type, + public array $metadata = [], + ) {} +} diff --git a/src/Data/RecordHistoryData.php b/src/Data/RecordHistoryData.php new file mode 100644 index 0000000..4d23714 --- /dev/null +++ b/src/Data/RecordHistoryData.php @@ -0,0 +1,14 @@ +validate(CreateCollection::rules()); - /** @var array{name: string, color?: string|null, icon_ids?: list} $validated */ - $collection = $this->createCollection->handle( - $validated['name'], - $validated['color'] ?? null, - array_map(intval(...), $validated['icon_ids'] ?? []), - ); + $data = $request->toData(); + $collection = $this->createCollection->handle($data->name, $data->color, $data->iconIds); $this->logDebug('Collection created', ['collection_id' => $collection['id']]); return $this->createdResponse($collection, 'Collection created successfully'); - } catch (ValidationException $e) { - return $this->handleValidationException($e); } catch (Exception $e) { return $this->handleException($e, 'Failed to create collection'); } @@ -131,27 +124,20 @@ public function store(Request $request): JsonResponse /** * Update collection */ - public function update(Request $request, string $id): JsonResponse + public function update(UpdateCollectionRequest $request, string $id): JsonResponse { try { if (! $this->preferenceService->getCollection($id)) { return $this->notFoundResponse('Collection', $id); } - $validated = $request->validate([ - 'name' => 'sometimes|required|string|max:100', - 'color' => 'nullable|string|regex:/^#[a-fA-F0-9]{6}$/', - ]); - /** @var array{name?: string, color?: string|null} $validated */ - $updated = $this->updateCollection->handle($id, $validated); + $updated = $this->updateCollection->handle($id, $request->toData()->changes); $this->logDebug('Collection updated', ['collection_id' => $id]); return $this->updatedResponse($updated, 'Collection updated successfully'); } catch (CollectionNotFound $e) { return $this->notFoundResponse('Collection', $e->collectionId); - } catch (ValidationException $e) { - return $this->handleValidationException($e); } catch (Exception $e) { return $this->handleException($e, 'Failed to update collection'); } diff --git a/src/Http/Controllers/Api/CommandHistoryApiController.php b/src/Http/Controllers/Api/CommandHistoryApiController.php index 1217e50..d26793f 100644 --- a/src/Http/Controllers/Api/CommandHistoryApiController.php +++ b/src/Http/Controllers/Api/CommandHistoryApiController.php @@ -5,12 +5,11 @@ namespace Simtabi\Laranail\Ichava\IconBrowser\Http\Controllers\Api; use Exception; -use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; -use Illuminate\Validation\ValidationException; use Simtabi\Laranail\Ichava\Services\IchavaLogger; use Simtabi\Laranail\Ichava\Services\IconPreferenceService; use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\RecordCommand; +use Simtabi\Laranail\Ichava\IconBrowser\Http\Requests\RecordCommandRequest; use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\ClearCommandHistory; /** @@ -58,32 +57,21 @@ public function index(): JsonResponse /** * Log command execution */ - public function store(Request $request): JsonResponse + public function store(RecordCommandRequest $request): JsonResponse { try { - $validated = $request->validate([ - 'command' => 'required|string|max:255', - 'type' => 'required|string|in:' . implode(',', RecordCommand::TYPES), - 'metadata' => 'sometimes|array', - ]); - /** @var array{command: string, type: string, metadata?: array} $validated */ - $this->recordCommand->handle( - $validated['command'], - $validated['type'], - $validated['metadata'] ?? [], - ); + $data = $request->toData(); + $this->recordCommand->handle($data->command, $data->type, $data->metadata); $this->logDebug('Command history entry added', [ - 'command' => $validated['command'], - 'type' => $validated['type'], + 'command' => $data->command, + 'type' => $data->type, ]); return $this->createdResponse( - ['command' => $validated['command'], 'type' => $validated['type']], + ['command' => $data->command, 'type' => $data->type], 'Command logged successfully', ); - } catch (ValidationException $e) { - return $this->handleValidationException($e); } catch (Exception $e) { return $this->handleException($e, 'Failed to log command'); } diff --git a/src/Http/Controllers/Api/HistoryApiController.php b/src/Http/Controllers/Api/HistoryApiController.php index eea159a..d573078 100644 --- a/src/Http/Controllers/Api/HistoryApiController.php +++ b/src/Http/Controllers/Api/HistoryApiController.php @@ -5,15 +5,14 @@ namespace Simtabi\Laranail\Ichava\IconBrowser\Http\Controllers\Api; use Exception; -use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; use Simtabi\Laranail\Ichava\Models\Icon; -use Illuminate\Validation\ValidationException; use Simtabi\Laranail\Ichava\Services\IchavaLogger; use Illuminate\Database\Eloquent\ModelNotFoundException; use Simtabi\Laranail\Ichava\Services\IconPreferenceService; use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\ClearHistory; use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\RecordHistory; +use Simtabi\Laranail\Ichava\IconBrowser\Http\Requests\RecordHistoryRequest; /** * HistoryApiController - RESTful API for Icon Activity History @@ -60,30 +59,21 @@ public function index(): JsonResponse /** * Log icon action (view, copy, download) */ - public function store(Request $request): JsonResponse + public function store(RecordHistoryRequest $request): JsonResponse { try { - $validated = $request->validate([ - 'icon_id' => 'required|integer', - 'action' => 'required|string|in:' . implode(',', RecordHistory::ACTIONS), - ]); - /** @var array{icon_id: int|string, action: string} $validated */ - $this->recordHistory->handle( - $this->findIconOrFail((int) $validated['icon_id']), - $validated['action'], - ); + $data = $request->toData(); + $this->recordHistory->handle($this->findIconOrFail($data->iconId), $data->action); $this->logDebug('History entry added', [ - 'icon_id' => $validated['icon_id'], - 'action' => $validated['action'], + 'icon_id' => $data->iconId, + 'action' => $data->action, ]); return $this->createdResponse( - ['icon_id' => $validated['icon_id'], 'action' => $validated['action']], + ['icon_id' => $data->iconId, 'action' => $data->action], 'History entry logged', ); - } catch (ValidationException $e) { - return $this->handleValidationException($e); } catch (ModelNotFoundException $e) { return $this->handleNotFoundException($e, 'Icon'); } catch (Exception $e) { diff --git a/src/Http/Controllers/Api/IconBrowserApiController.php b/src/Http/Controllers/Api/IconBrowserApiController.php index 4fd1da5..a95cf65 100644 --- a/src/Http/Controllers/Api/IconBrowserApiController.php +++ b/src/Http/Controllers/Api/IconBrowserApiController.php @@ -12,15 +12,17 @@ use Illuminate\Database\Query\JoinClause; use Symfony\Component\HttpFoundation\Response; use Simtabi\Laranail\Ichava\Services\IchavaLogger; -use Simtabi\Laranail\Ichava\Services\IconRegistry; use Simtabi\Laranail\Ichava\Actions\UpdatePreferences; use Simtabi\Laranail\Ichava\Services\IconCacheService; use Simtabi\Laranail\Ichava\Exceptions\IchavaException; use Illuminate\Database\Eloquent\ModelNotFoundException; use Simtabi\Laranail\Ichava\IconBrowser\Support\Helpers; use Simtabi\Laranail\Ichava\Services\IconBrowserService; +use Simtabi\Laranail\Ichava\IconBrowser\Support\IconTables; use Simtabi\Laranail\Ichava\Services\IconPreferenceService; +use Simtabi\Laranail\Ichava\IconBrowser\Support\IconSnippets; use Simtabi\Laranail\Ichava\IconBrowser\Support\ThemeVariants; +use Simtabi\Laranail\Ichava\IconBrowser\Support\PackageDetails; use Simtabi\Laranail\Ichava\IconBrowser\Support\CacheStatsPayload; use Simtabi\Laranail\Ichava\IconBrowser\Http\Resources\IconResource; use Simtabi\Laranail\Ichava\IconBrowser\Http\Resources\IconCollection; @@ -46,6 +48,8 @@ public function __construct( protected IconPreferenceService $preferenceService, private readonly UpdatePreferences $writePreferences, private readonly ResetPreferences $resetToDefaults, + private readonly PackageDetails $packageDetails, + private readonly IconSnippets $snippets, ) { parent::__construct($logger); } @@ -77,7 +81,7 @@ public function index(IconFilterRequest $request): JsonResponse // Transform using IconCollection with grouping support $groupBy = $request->getSortBy(); - $collection = new IconCollection($paginator); + $collection = (new IconCollection($paginator))->withSnippets($this->snippets); if ($groupBy) { $collection->groupBy($groupBy); @@ -188,7 +192,7 @@ public function show(int $id): JsonResponse // Eager load relationships to prevent N+1 queries $icon = Icon::with([ 'terms' => function ($q) { - $q->select('ichava_icon_terms.id', 'type', 'slug', 'name', 'package', 'parent_id'); + $q->select(IconTables::TERMS . '.id', 'type', 'slug', 'name', 'package', 'parent_id'); }, 'categories', 'variants', @@ -202,7 +206,7 @@ public function show(int $id): JsonResponse return response()->json([ 'success' => true, - 'data' => new IconResource($icon), + 'data' => (new IconResource($icon))->withSnippets($this->snippets), ]); } catch (ModelNotFoundException $e) { $this->logWarning('Icon not found', ['icon_id' => $id]); @@ -350,93 +354,26 @@ public function package(string $package): JsonResponse try { $this->logDebug('Fetching package details', ['package' => $package]); - // Validate package name format - if (! preg_match('/^[a-z0-9\-]+\/[a-z0-9\-]+$/i', $package)) { + if (! PackageDetails::isValidName($package)) { return $this->validationErrorResponse( ['package' => ['Invalid package name format. Expected: vendor/package-name']], 'Invalid package name format', ); } - // Get package info from registry (may throw IchavaException if not found) - $registry = app(IconRegistry::class); + $details = $this->packageDetails->find($package); - try { - $packageData = $registry->get($package); - } catch (IchavaException $e) { - // Package not registered + if ($details === null) { $this->logWarning('Package not found', ['package' => $package]); return $this->notFoundResponse('Package', $package); } - if (! $packageData) { - return $this->notFoundResponse('Package', $package); - } - - // OPTIMIZED: Get icon count and all term data in minimal queries - $iconCount = Icon::where('package', $package)->count(); - - // Get the morph alias for the join condition (registered as 'icon' in morphMap) - $iconMorphAlias = (new Icon)->getMorphClass(); - - // OPTIMIZED: Single query to get all term icon counts for this package - $termIconCounts = DB::table('ichava_icon_termables') - ->join('ichava_icons', function (JoinClause $join) use ($package, $iconMorphAlias) { - $join->on('ichava_icon_termables.termable_id', '=', 'ichava_icons.id') - ->where('ichava_icon_termables.termable_type', '=', $iconMorphAlias) - ->where('ichava_icons.package', '=', $package); - }) - ->select('ichava_icon_termables.term_id') - ->selectRaw('COUNT(DISTINCT ichava_icons.id) as icon_count') - ->groupBy('ichava_icon_termables.term_id') - ->pluck('icon_count', 'term_id'); - - // Get categories for this package with counts - $categories = DB::table('ichava_icon_terms') - ->where('type', 'category') - ->where('package', $package) - ->select('id', 'name', 'slug', 'parent_id') - ->orderBy('name') - ->get() - ->map(function ($term) use ($termIconCounts) { - return [ - 'id' => $term->id, - 'name' => $term->name, - 'slug' => $term->slug, - 'parent_id' => $term->parent_id, - 'icon_count' => $termIconCounts[$term->id] ?? 0, - ]; - }); - - // Get variants for this package with counts - $variants = DB::table('ichava_icon_terms') - ->where('type', 'variant') - ->where('package', $package) - ->select('id', 'name', 'slug') - ->orderBy('name') - ->get() - ->map(function ($term) use ($termIconCounts) { - return [ - 'id' => $term->id, - 'name' => $term->name, - 'slug' => $term->slug, - 'icon_count' => $termIconCounts[$term->id] ?? 0, - ]; - }); - return response()->json([ 'success' => true, 'data' => [ - 'name' => $package, - 'label' => $packageData['name'] ?? $package, - 'description' => $packageData['description'] ?? '', - 'vendor' => $packageData['vendor'] ?? '', - 'icon_count' => $iconCount, - 'categories' => $categories, - 'variants' => $variants, - 'labels' => $packageData['labels'] ?? [], - 'metadata' => $this->publicMetadata($packageData), + ...$details->toArray(), + 'metadata' => $this->publicMetadata($details->registryData), ], ]); } catch (Exception $e) { @@ -461,15 +398,15 @@ public function categories(): JsonResponse $iconMorphAlias = (new Icon)->getMorphClass(); // Get ALL categories from terms table with icon counts - $iconCounts = DB::table('ichava_icon_termables') - ->join('ichava_icon_terms', 'ichava_icon_termables.term_id', '=', 'ichava_icon_terms.id') - ->where('ichava_icon_terms.type', 'category') - ->where('ichava_icon_termables.termable_type', $iconMorphAlias) - ->selectRaw('ichava_icon_terms.id, COUNT(*) as count') - ->groupBy('ichava_icon_terms.id') + $iconCounts = DB::table(IconTables::TERMABLES) + ->join(IconTables::TERMS, IconTables::TERMABLES . '.term_id', '=', IconTables::TERMS . '.id') + ->where(IconTables::TERMS . '.type', 'category') + ->where(IconTables::TERMABLES . '.termable_type', $iconMorphAlias) + ->selectRaw(IconTables::TERMS . '.id, COUNT(*) as count') + ->groupBy(IconTables::TERMS . '.id') ->pluck('count', 'id'); - $categories = DB::table('ichava_icon_terms') + $categories = DB::table(IconTables::TERMS) ->where('type', 'category') ->select('id', 'slug', 'name', 'package') ->orderBy('name') @@ -513,15 +450,15 @@ public function variants(): JsonResponse $iconMorphAlias = (new Icon)->getMorphClass(); // Get ALL variants from terms table with icon counts - $iconCounts = DB::table('ichava_icon_termables') - ->join('ichava_icon_terms', 'ichava_icon_termables.term_id', '=', 'ichava_icon_terms.id') - ->where('ichava_icon_terms.type', 'variant') - ->where('ichava_icon_termables.termable_type', $iconMorphAlias) - ->selectRaw('ichava_icon_terms.id, COUNT(*) as count') - ->groupBy('ichava_icon_terms.id') + $iconCounts = DB::table(IconTables::TERMABLES) + ->join(IconTables::TERMS, IconTables::TERMABLES . '.term_id', '=', IconTables::TERMS . '.id') + ->where(IconTables::TERMS . '.type', 'variant') + ->where(IconTables::TERMABLES . '.termable_type', $iconMorphAlias) + ->selectRaw(IconTables::TERMS . '.id, COUNT(*) as count') + ->groupBy(IconTables::TERMS . '.id') ->pluck('count', 'id'); - $variants = DB::table('ichava_icon_terms') + $variants = DB::table(IconTables::TERMS) ->where('type', 'variant') ->select('id', 'slug', 'name', 'package') ->orderBy('name') @@ -563,18 +500,18 @@ public function termsHierarchy(): JsonResponse $iconMorphType = 'icon'; // OPTIMIZED: Get all term icon counts in a single query - $termIconCounts = DB::table('ichava_icon_termables') - ->join('ichava_icons', function (JoinClause $join) use ($iconMorphType) { - $join->on('ichava_icon_termables.termable_id', '=', 'ichava_icons.id') - ->where('ichava_icon_termables.termable_type', '=', $iconMorphType); + $termIconCounts = DB::table(IconTables::TERMABLES) + ->join(IconTables::ICONS, function (JoinClause $join) use ($iconMorphType) { + $join->on(IconTables::TERMABLES . '.termable_id', '=', IconTables::ICONS . '.id') + ->where(IconTables::TERMABLES . '.termable_type', '=', $iconMorphType); }) - ->select('ichava_icon_termables.term_id') - ->selectRaw('COUNT(DISTINCT ichava_icons.id) as icon_count') - ->groupBy('ichava_icon_termables.term_id') + ->select(IconTables::TERMABLES . '.term_id') + ->selectRaw('COUNT(DISTINCT ' . IconTables::ICONS . '.id) as icon_count') + ->groupBy(IconTables::TERMABLES . '.term_id') ->pluck('icon_count', 'term_id'); // Get all categories with hierarchy - $categories = DB::table('ichava_icon_terms') + $categories = DB::table(IconTables::TERMS) ->where('type', 'category') ->select('id', 'name', 'slug', 'package', 'parent_id') ->orderBy('package') @@ -593,7 +530,7 @@ public function termsHierarchy(): JsonResponse }); // Get all variants - $variants = DB::table('ichava_icon_terms') + $variants = DB::table(IconTables::TERMS) ->where('type', 'variant') ->select('id', 'name', 'slug', 'package') ->orderBy('package') diff --git a/src/Http/Controllers/Web/CollectionController.php b/src/Http/Controllers/Web/CollectionController.php index c48f061..68928cf 100644 --- a/src/Http/Controllers/Web/CollectionController.php +++ b/src/Http/Controllers/Web/CollectionController.php @@ -7,7 +7,6 @@ use Exception; use Inertia\Inertia; use Inertia\Response; -use Illuminate\Http\Request; use Illuminate\Http\RedirectResponse; use Simtabi\Laranail\Ichava\Models\Icon; use Simtabi\Laranail\Ichava\Services\IchavaLogger; @@ -19,6 +18,8 @@ use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\DeleteCollection; use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\UpdateCollection; use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\AddIconToCollection; +use Simtabi\Laranail\Ichava\IconBrowser\Http\Requests\StoreCollectionRequest; +use Simtabi\Laranail\Ichava\IconBrowser\Http\Requests\UpdateCollectionRequest; use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\RemoveIconFromCollection; use Simtabi\Laranail\Ichava\IconBrowser\Http\Controllers\Web\Concerns\ResolvesIconsForPages; @@ -74,15 +75,10 @@ public function show(string $id): Response|RedirectResponse ]); } - public function store(Request $request): RedirectResponse + public function store(StoreCollectionRequest $request): RedirectResponse { - $validated = $request->validate(CreateCollection::rules()); - /** @var array{name: string, color?: string|null, icon_ids?: list} $validated */ - $collection = $this->createCollection->handle( - $validated['name'], - $validated['color'] ?? null, - array_map(intval(...), $validated['icon_ids'] ?? []), - ); + $data = $request->toData(); + $collection = $this->createCollection->handle($data->name, $data->color, $data->iconIds); $this->logger->debug('Collection created from web', ['collection_id' => $collection['id']]); @@ -97,7 +93,7 @@ public function store(Request $request): RedirectResponse ->with('success', 'Collection created successfully.'); } - public function update(Request $request, string $id): RedirectResponse + public function update(UpdateCollectionRequest $request, string $id): RedirectResponse { if (! $this->preferenceService->getCollection($id)) { return redirect() @@ -105,13 +101,8 @@ public function update(Request $request, string $id): RedirectResponse ->with('error', "Collection [{$id}] not found."); } - $validated = $request->validate([ - 'name' => 'sometimes|required|string|max:100', - 'color' => 'nullable|string|regex:/^#[a-fA-F0-9]{6}$/', - ]); - /** @var array{name?: string, color?: string|null} $validated */ try { - $this->updateCollection->handle($id, $validated); + $this->updateCollection->handle($id, $request->toData()->changes); } catch (CollectionNotFound $e) { return $this->collectionMissing($e); } diff --git a/src/Http/Controllers/Web/CommandHistoryController.php b/src/Http/Controllers/Web/CommandHistoryController.php index dcd0dbd..e1666e3 100644 --- a/src/Http/Controllers/Web/CommandHistoryController.php +++ b/src/Http/Controllers/Web/CommandHistoryController.php @@ -7,11 +7,11 @@ use Exception; use Inertia\Inertia; use Inertia\Response; -use Illuminate\Http\Request; use Illuminate\Http\RedirectResponse; use Simtabi\Laranail\Ichava\Services\IchavaLogger; use Simtabi\Laranail\Ichava\Services\IconPreferenceService; use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\RecordCommand; +use Simtabi\Laranail\Ichava\IconBrowser\Http\Requests\RecordCommandRequest; use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\ClearCommandHistory; final class CommandHistoryController extends BaseInertiaController @@ -49,19 +49,10 @@ public function index(): Response return Inertia::render('CommandHistory/Index', $props); } - public function store(Request $request): RedirectResponse + public function store(RecordCommandRequest $request): RedirectResponse { - $validated = $request->validate([ - 'command' => 'required|string|max:255', - 'type' => 'required|string|in:' . implode(',', RecordCommand::TYPES), - 'metadata' => 'sometimes|array', - ]); - /** @var array{command: string, type: string, metadata?: array} $validated */ - $this->recordCommand->handle( - $validated['command'], - $validated['type'], - $validated['metadata'] ?? [], - ); + $data = $request->toData(); + $this->recordCommand->handle($data->command, $data->type, $data->metadata); return redirect()->back(); } diff --git a/src/Http/Controllers/Web/HistoryController.php b/src/Http/Controllers/Web/HistoryController.php index ea34412..689510b 100644 --- a/src/Http/Controllers/Web/HistoryController.php +++ b/src/Http/Controllers/Web/HistoryController.php @@ -7,7 +7,6 @@ use Exception; use Inertia\Inertia; use Inertia\Response; -use Illuminate\Http\Request; use Illuminate\Http\RedirectResponse; use Simtabi\Laranail\Ichava\Models\Icon; use Simtabi\Laranail\Ichava\Services\IchavaLogger; @@ -16,6 +15,7 @@ use Simtabi\Laranail\Ichava\IconBrowser\Support\IconSnippets; use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\ClearHistory; use Simtabi\Laranail\Ichava\IconBrowser\Actions\Library\RecordHistory; +use Simtabi\Laranail\Ichava\IconBrowser\Http\Requests\RecordHistoryRequest; use Simtabi\Laranail\Ichava\IconBrowser\Http\Controllers\Web\Concerns\ResolvesIconsForPages; final class HistoryController extends BaseInertiaController @@ -64,20 +64,16 @@ public function index(): Response return Inertia::render('History/Index', $props); } - public function store(Request $request): RedirectResponse + public function store(RecordHistoryRequest $request): RedirectResponse { - $validated = $request->validate([ - 'icon_id' => 'required|integer', - 'action' => 'required|string|in:' . implode(',', RecordHistory::ACTIONS), - ]); - /** @var array{icon_id: int|string, action: string} $validated */ - $icon = Icon::find((int) $validated['icon_id']); + $data = $request->toData(); + $icon = Icon::find($data->iconId); if (! $icon instanceof Icon) { - return redirect()->back()->with('error', "Icon [{$validated['icon_id']}] not found."); + return redirect()->back()->with('error', "Icon [{$data->iconId}] not found."); } - $this->recordHistory->handle($icon, $validated['action']); + $this->recordHistory->handle($icon, $data->action); return redirect()->back(); } diff --git a/src/Http/Controllers/Web/InertiaBrowserController.php b/src/Http/Controllers/Web/InertiaBrowserController.php index 4413c5c..fd37ac8 100644 --- a/src/Http/Controllers/Web/InertiaBrowserController.php +++ b/src/Http/Controllers/Web/InertiaBrowserController.php @@ -21,6 +21,7 @@ use Simtabi\Laranail\Ichava\Services\IconCacheService; use Simtabi\Laranail\Ichava\Services\IconBrowserService; use Simtabi\Laranail\Ichava\Services\InformationService; +use Simtabi\Laranail\Ichava\IconBrowser\Support\IconTables; use Simtabi\Laranail\Ichava\Services\IconPackUpdateChecker; use Simtabi\Laranail\Ichava\Services\IconPreferenceService; use Simtabi\Laranail\Ichava\IconBrowser\Support\IconSnippets; @@ -40,6 +41,7 @@ public function __construct( protected IconPackUpdateChecker $updateChecker, IchavaLogger $logger, private readonly DatabaseOperationsService $databaseOperations, + private readonly CacheAdminGate $cacheAdmin, private readonly InformationService $information, private readonly HostUser $users, ) { @@ -144,7 +146,7 @@ public function show(int $id): Response|RedirectResponse $icon = Icon::with([ 'terms' => function ($q) { - $q->select('ichava_icon_terms.id', 'type', 'slug', 'name', 'package', 'parent_id'); + $q->select(IconTables::TERMS . '.id', 'type', 'slug', 'name', 'package', 'parent_id'); }, 'categories', 'variants', @@ -212,16 +214,16 @@ public function stats(): Response } $iconMorphAlias = (new Icon)->getMorphClass(); - $topCategories = DB::table('ichava_icon_termables') - ->join('ichava_icon_terms', 'ichava_icon_termables.term_id', '=', 'ichava_icon_terms.id') - ->join('ichava_icons', function (JoinClause $join) use ($iconMorphAlias) { - $join->on('ichava_icon_termables.termable_id', '=', 'ichava_icons.id') - ->where('ichava_icon_termables.termable_type', '=', $iconMorphAlias); + $topCategories = DB::table(IconTables::TERMABLES) + ->join(IconTables::TERMS, IconTables::TERMABLES . '.term_id', '=', IconTables::TERMS . '.id') + ->join(IconTables::ICONS, function (JoinClause $join) use ($iconMorphAlias) { + $join->on(IconTables::TERMABLES . '.termable_id', '=', IconTables::ICONS . '.id') + ->where(IconTables::TERMABLES . '.termable_type', '=', $iconMorphAlias); }) - ->where('ichava_icon_terms.type', 'category') - ->select('ichava_icon_terms.name', 'ichava_icon_terms.slug', 'ichava_icons.package') + ->where(IconTables::TERMS . '.type', 'category') + ->select(IconTables::TERMS . '.name', IconTables::TERMS . '.slug', IconTables::ICONS . '.package') ->selectRaw('COUNT(*) as icon_count') - ->groupBy('ichava_icon_terms.id', 'ichava_icon_terms.name', 'ichava_icon_terms.slug', 'ichava_icons.package') + ->groupBy(IconTables::TERMS . '.id', IconTables::TERMS . '.name', IconTables::TERMS . '.slug', IconTables::ICONS . '.package') ->orderByDesc('icon_count') ->limit(10) ->get(); @@ -232,7 +234,7 @@ public function stats(): Response 'topCategories' => $topCategories, // Cache statistics describe the server, so only a cache administrator // gets them; everyone else sees the health flag alone. - 'cacheStats' => CacheAdminGate::allows() + 'cacheStats' => $this->cacheAdmin->allows() ? CacheStatsPayload::withoutAbsolutePaths($this->cacheService->getStats()) : [], 'cacheHealthy' => $this->cacheService->isHealthy(), diff --git a/src/Http/Controllers/Web/PackageController.php b/src/Http/Controllers/Web/PackageController.php index 56111a3..e2fd59a 100644 --- a/src/Http/Controllers/Web/PackageController.php +++ b/src/Http/Controllers/Web/PackageController.php @@ -7,20 +7,16 @@ use Exception; use Inertia\Inertia; use Inertia\Response; -use Illuminate\Support\Facades\DB; use Illuminate\Http\RedirectResponse; -use Simtabi\Laranail\Ichava\Models\Icon; -use Illuminate\Database\Query\JoinClause; use Simtabi\Laranail\Ichava\Services\IchavaLogger; -use Simtabi\Laranail\Ichava\Services\IconRegistry; -use Simtabi\Laranail\Ichava\Exceptions\IchavaException; use Simtabi\Laranail\Ichava\Services\IconBrowserService; +use Simtabi\Laranail\Ichava\IconBrowser\Support\PackageDetails; final class PackageController extends BaseInertiaController { public function __construct( protected IconBrowserService $browserService, - protected IconRegistry $registry, + private readonly PackageDetails $packageDetails, IchavaLogger $logger, ) { parent::__construct($logger); @@ -49,85 +45,24 @@ public function show(string $package): Response|RedirectResponse 'package' => $package, ]); - if (! preg_match('/^[a-z0-9\-]+\/[a-z0-9\-]+$/i', $package)) { + if (! PackageDetails::isValidName($package)) { return redirect() ->route('ichava.inertia.packages.index') ->with('error', 'Invalid package name format. Expected: vendor/package-name.'); } - try { - $packageData = $this->registry->get($package); - } catch (IchavaException $e) { - $this->logger->warning('Package not found', ['package' => $package]); + $details = $this->packageDetails->find($package); - return redirect() - ->route('ichava.inertia.packages.index') - ->with('error', "Package [{$package}] not found."); - } + if ($details === null) { + $this->logger->warning('Package not found', ['package' => $package]); - if (! $packageData) { return redirect() ->route('ichava.inertia.packages.index') ->with('error', "Package [{$package}] not found."); } - $iconCount = Icon::where('package', $package)->count(); - - $iconMorphAlias = (new Icon)->getMorphClass(); - - $termIconCounts = DB::table('ichava_icon_termables') - ->join('ichava_icons', function (JoinClause $join) use ($package, $iconMorphAlias) { - $join->on('ichava_icon_termables.termable_id', '=', 'ichava_icons.id') - ->where('ichava_icon_termables.termable_type', '=', $iconMorphAlias) - ->where('ichava_icons.package', '=', $package); - }) - ->select('ichava_icon_termables.term_id') - ->selectRaw('COUNT(DISTINCT ichava_icons.id) as icon_count') - ->groupBy('ichava_icon_termables.term_id') - ->pluck('icon_count', 'term_id'); - - $categories = DB::table('ichava_icon_terms') - ->where('type', 'category') - ->where('package', $package) - ->select('id', 'name', 'slug', 'parent_id') - ->orderBy('name') - ->get() - ->map(function ($term) use ($termIconCounts) { - return [ - 'id' => $term->id, - 'name' => $term->name, - 'slug' => $term->slug, - 'parent_id' => $term->parent_id, - 'icon_count' => $termIconCounts[$term->id] ?? 0, - ]; - }); - - $variants = DB::table('ichava_icon_terms') - ->where('type', 'variant') - ->where('package', $package) - ->select('id', 'name', 'slug') - ->orderBy('name') - ->get() - ->map(function ($term) use ($termIconCounts) { - return [ - 'id' => $term->id, - 'name' => $term->name, - 'slug' => $term->slug, - 'icon_count' => $termIconCounts[$term->id] ?? 0, - ]; - }); - return Inertia::render('Packages/Show', [ - 'package' => [ - 'name' => $package, - 'label' => $packageData['name'] ?? $package, - 'description' => $packageData['description'] ?? '', - 'vendor' => $packageData['vendor'] ?? '', - 'icon_count' => $iconCount, - 'categories' => $categories, - 'variants' => $variants, - 'labels' => $packageData['labels'] ?? [], - ], + 'package' => $details->toArray(), ]); } } diff --git a/src/Http/Middleware/AuthorizeAdmin.php b/src/Http/Middleware/AuthorizeAdmin.php index 6e5c7d6..d087753 100644 --- a/src/Http/Middleware/AuthorizeAdmin.php +++ b/src/Http/Middleware/AuthorizeAdmin.php @@ -12,7 +12,7 @@ use Simtabi\Laranail\Ichava\Support\Auth\IchavaGates; /** - * `ichava.admin`: let a request through only when the host grants the + * `ichava-icon-browser.admin`: let a request through only when the host grants the * `ichava.admin` ability to its signed-in user. * * Fails closed. Core defines `ichava.admin` as a denial when the host has not diff --git a/src/Http/Middleware/AuthorizeCacheAdmin.php b/src/Http/Middleware/AuthorizeCacheAdmin.php index e1e3a79..e42bfb8 100644 --- a/src/Http/Middleware/AuthorizeCacheAdmin.php +++ b/src/Http/Middleware/AuthorizeCacheAdmin.php @@ -36,12 +36,14 @@ */ final class AuthorizeCacheAdmin { + public function __construct(private readonly CacheAdminGate $gate) {} + /** * @param Closure(Request): Response $next */ public function handle(Request $request, Closure $next): Response { - $refusal = CacheAdminGate::refusal(); + $refusal = $this->gate->refusal(); if ($refusal !== null) { abort(403, $refusal); diff --git a/src/Http/Middleware/IchavaApiSecurity.php b/src/Http/Middleware/IchavaApiSecurity.php index 2dd6ebe..6832081 100644 --- a/src/Http/Middleware/IchavaApiSecurity.php +++ b/src/Http/Middleware/IchavaApiSecurity.php @@ -5,7 +5,6 @@ namespace Simtabi\Laranail\Ichava\IconBrowser\Http\Middleware; use Closure; -use Throwable; use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; @@ -86,6 +85,12 @@ final class IchavaApiSecurity '/expression\s*\(/i', ]; + /** Core's per-request nonce and its audit log, injected (re-audit F-10), both bound by ichava/core. */ + public function __construct( + private readonly SecurityNonce $nonce, + private readonly AuditLogger $auditLogger, + ) {} + /** * Declare that this response owns the given headers. * @@ -482,8 +487,7 @@ private function buildCspHeader(): array */ private function cspNonceDirectives(): array { - $nonce = $this->resolveNonce(); - $token = $nonce !== null ? "'nonce-{$nonce}'" : "'self'"; + $token = "'nonce-{$this->resolveNonce()}'"; return [ 'default-src' => "'self'", @@ -521,15 +525,9 @@ private function cspHashDirectives(): array ]; } - private function resolveNonce(): ?string + private function resolveNonce(): string { - try { - $nonce = app(SecurityNonce::class); - } catch (Throwable) { - return null; - } - - return $nonce instanceof SecurityNonce ? $nonce->value() : null; + return $this->nonce->value(); } private function buildHstsHeader(): ?string @@ -556,13 +554,7 @@ private function buildHstsHeader(): ?string */ private function audit(string $event, int $severity, array $context = []): void { - try { - $logger = app(AuditLogger::class); - } catch (Throwable) { - return; - } - - $logger->record($event, $severity, $context); + $this->auditLogger->record($event, $severity, $context); } /** diff --git a/src/Http/Middleware/ThrottleRoute.php b/src/Http/Middleware/ThrottleRoute.php index 4c86088..2050e36 100644 --- a/src/Http/Middleware/ThrottleRoute.php +++ b/src/Http/Middleware/ThrottleRoute.php @@ -9,7 +9,7 @@ use Simtabi\Laranail\Ichava\IconBrowser\Support\Helpers; /** - * The per-route throttle: `ichava.throttle:,1,`. + * The per-route throttle: `ichava-icon-browser.throttle:,1,`. * * Laravel's `throttle:N,1` has two properties that made this package's * per-route limits decorative (S3). It keys the counter on domain and IP alone, diff --git a/src/Http/Requests/IchavaFormRequest.php b/src/Http/Requests/IchavaFormRequest.php new file mode 100644 index 0000000..027d067 --- /dev/null +++ b/src/Http/Requests/IchavaFormRequest.php @@ -0,0 +1,35 @@ +expectsJson()) { + throw new HttpResponseException($this->validationErrorResponse($validator->errors()->toArray(), 'Validation failed')); + } + + parent::failedValidation($validator); + } +} diff --git a/src/Http/Requests/RecordCommandRequest.php b/src/Http/Requests/RecordCommandRequest.php new file mode 100644 index 0000000..c7e3df5 --- /dev/null +++ b/src/Http/Requests/RecordCommandRequest.php @@ -0,0 +1,29 @@ + */ + public function rules(): array + { + return [ + 'command' => 'required|string|max:255', + 'type' => 'required|string|in:' . implode(',', RecordCommand::TYPES), + 'metadata' => 'sometimes|array', + ]; + } + + public function toData(): RecordCommandData + { + /** @var array{command: string, type: string, metadata?: array} $v */ + $v = $this->validated(); + + return new RecordCommandData($v['command'], $v['type'], $v['metadata'] ?? []); + } +} diff --git a/src/Http/Requests/RecordHistoryRequest.php b/src/Http/Requests/RecordHistoryRequest.php new file mode 100644 index 0000000..2844c5d --- /dev/null +++ b/src/Http/Requests/RecordHistoryRequest.php @@ -0,0 +1,28 @@ + */ + public function rules(): array + { + return [ + 'icon_id' => 'required|integer', + 'action' => 'required|string|in:' . implode(',', RecordHistory::ACTIONS), + ]; + } + + public function toData(): RecordHistoryData + { + /** @var array{icon_id: int|string, action: string} $v */ + $v = $this->validated(); + + return new RecordHistoryData((int) $v['icon_id'], $v['action']); + } +} diff --git a/src/Http/Requests/StoreCollectionRequest.php b/src/Http/Requests/StoreCollectionRequest.php new file mode 100644 index 0000000..d44f447 --- /dev/null +++ b/src/Http/Requests/StoreCollectionRequest.php @@ -0,0 +1,30 @@ + */ + public function rules(): array + { + return [ + 'name' => 'required|string|max:100', + 'color' => 'nullable|string|regex:/^#[a-fA-F0-9]{6}$/', + 'icon_ids' => ['sometimes', 'array', 'max:' . CreateCollection::MAX_ICONS], + 'icon_ids.*' => ['integer', 'min:1'], + ]; + } + + public function toData(): CreateCollectionData + { + /** @var array{name: string, color?: string|null, icon_ids?: list} $v */ + $v = $this->validated(); + + return new CreateCollectionData($v['name'], $v['color'] ?? null, array_values(array_map(intval(...), $v['icon_ids'] ?? []))); + } +} diff --git a/src/Http/Requests/UpdateCollectionRequest.php b/src/Http/Requests/UpdateCollectionRequest.php new file mode 100644 index 0000000..0fd46c2 --- /dev/null +++ b/src/Http/Requests/UpdateCollectionRequest.php @@ -0,0 +1,27 @@ + */ + public function rules(): array + { + return [ + 'name' => 'sometimes|required|string|max:100', + 'color' => 'nullable|string|regex:/^#[a-fA-F0-9]{6}$/', + ]; + } + + public function toData(): UpdateCollectionData + { + /** @var array{name?: string, color?: string|null} $v */ + $v = $this->validated(); + + return new UpdateCollectionData($v); + } +} diff --git a/src/Http/Resources/IconCollection.php b/src/Http/Resources/IconCollection.php index 5ab49f6..6030e4d 100644 --- a/src/Http/Resources/IconCollection.php +++ b/src/Http/Resources/IconCollection.php @@ -7,6 +7,7 @@ use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\ResourceCollection; use Simtabi\Laranail\Ichava\IconBrowser\Support\Helpers; +use Simtabi\Laranail\Ichava\IconBrowser\Support\IconSnippets; /** * IconCollection - Transform Icon collections with metadata @@ -27,6 +28,16 @@ class IconCollection extends ResourceCollection */ protected ?string $groupBy = null; + private ?IconSnippets $snippets = null; + + /** Hands the snippet builder to every icon this collection renders (re-audit F-10). */ + public function withSnippets(IconSnippets $snippets): static + { + $this->snippets = $snippets; + + return $this; + } + /** * Set the grouping key */ @@ -44,6 +55,14 @@ public function groupBy(?string $key): self */ public function toArray(Request $request): array { + if ($this->snippets !== null) { + foreach ($this->collection ?? [] as $resource) { + if ($resource instanceof IconResource) { + $resource->withSnippets($this->snippets); + } + } + } + // A resource collection always transforms to an array. $data = parent::toArray($request); $data = is_array($data) ? $data : []; diff --git a/src/Http/Resources/IconResource.php b/src/Http/Resources/IconResource.php index f79245c..e6715ca 100644 --- a/src/Http/Resources/IconResource.php +++ b/src/Http/Resources/IconResource.php @@ -4,6 +4,7 @@ namespace Simtabi\Laranail\Ichava\IconBrowser\Http\Resources; +use LogicException; use Illuminate\Http\Request; use Simtabi\Laranail\Ichava\Models\Icon; use Illuminate\Http\Resources\Json\JsonResource; @@ -20,6 +21,16 @@ */ class IconResource extends JsonResource { + /** The snippet builder, handed in by whoever renders this (re-audit F-10: never reached for). */ + private ?IconSnippets $snippets = null; + + public function withSnippets(IconSnippets $snippets): static + { + $this->snippets = $snippets; + + return $this; + } + /** * Transform the resource into an array. * @@ -75,7 +86,7 @@ public function toArray(Request $request): array // Snippet strings: blade_clean, blade_generic, helper, and the host // resolver's `snippets` map when one is configured (IconSnippets). - ...app(IconSnippets::class)->forIcon($icon), + ...$this->snippetsOrFail()->forIcon($icon), // Metadata 'set' => $icon->package, @@ -87,4 +98,9 @@ public function toArray(Request $request): array 'updated_at' => $icon->updated_at?->toIso8601String(), ]; } + + private function snippetsOrFail(): IconSnippets + { + return $this->snippets ?? throw new LogicException('IconResource needs withSnippets() before it renders: the snippet strings are part of its shape.'); + } } diff --git a/src/Providers/IconBrowserServiceProvider.php b/src/Providers/IconBrowserServiceProvider.php index 07de725..ed9be62 100644 --- a/src/Providers/IconBrowserServiceProvider.php +++ b/src/Providers/IconBrowserServiceProvider.php @@ -116,7 +116,7 @@ public function registeringPackage(): void public function bootingPackage(): void { - // Register HTTP middleware aliases + the ichava.api / ichava.web groups. + // Register HTTP middleware aliases + the ichava-icon-browser.api / ichava-icon-browser.web groups. // This is the entire HTTP layer for the Ichava ecosystem, core ships // none of it. $this->registerMiddleware(); @@ -173,8 +173,8 @@ public function bootingPackage(): void * * Hybrid architecture (via core's `HostCapabilities`): * • Sanctum + sessions → full `web` middleware stack with CSRF. - * • Sessions only → `StartSession` + ichava.* middleware, no CSRF. - * • Stateless host → ichava.* only (treat as public JSON API). + * • Sessions only → `StartSession` + ichava-icon-browser.* middleware, no CSRF. + * • Stateless host → ichava-icon-browser.* only (treat as public JSON API). * * Always works, never fails, gracefully degrades to the simplest mode. */ @@ -183,16 +183,16 @@ protected function registerMiddleware(): void $router = $this->app->make(Router::class); // Per-middleware aliases. - $router->aliasMiddleware('ichava.session', EnsureSession::class); - $router->aliasMiddleware('ichava.security', IchavaApiSecurity::class); - $router->aliasMiddleware('ichava.json', ForceJsonResponse::class); - $router->aliasMiddleware('ichava.log', LogRequests::class); - $router->aliasMiddleware('ichava.validate', ValidateIchavaRoute::class); - $router->aliasMiddleware('ichava.guard', IchavaStatefulGuard::class); - $router->aliasMiddleware('ichava.cache-admin', AuthorizeCacheAdmin::class); - $router->aliasMiddleware('ichava.admin', AuthorizeAdmin::class); - $router->aliasMiddleware('ichava.throttle', ThrottleRoute::class); - $router->aliasMiddleware('ichava.handle-inertia', HandleInertiaRequests::class); + $router->aliasMiddleware('ichava-icon-browser.session', EnsureSession::class); + $router->aliasMiddleware('ichava-icon-browser.security', IchavaApiSecurity::class); + $router->aliasMiddleware('ichava-icon-browser.json', ForceJsonResponse::class); + $router->aliasMiddleware('ichava-icon-browser.log', LogRequests::class); + $router->aliasMiddleware('ichava-icon-browser.validate', ValidateIchavaRoute::class); + $router->aliasMiddleware('ichava-icon-browser.guard', IchavaStatefulGuard::class); + $router->aliasMiddleware('ichava-icon-browser.cache-admin', AuthorizeCacheAdmin::class); + $router->aliasMiddleware('ichava-icon-browser.admin', AuthorizeAdmin::class); + $router->aliasMiddleware('ichava-icon-browser.throttle', ThrottleRoute::class); + $router->aliasMiddleware('ichava-icon-browser.handle-inertia', HandleInertiaRequests::class); // Detect host capabilities (Sanctum / session availability). $capabilities = HostCapabilities::getInstance(); @@ -216,28 +216,28 @@ protected function registerMiddleware(): void // Ichava-specific middleware (always included). $apiMiddleware = array_merge($apiMiddleware, [ - 'ichava.guard', - 'ichava.session', - 'ichava.security', - 'ichava.json', - 'ichava.log', + 'ichava-icon-browser.guard', + 'ichava-icon-browser.session', + 'ichava-icon-browser.security', + 'ichava-icon-browser.json', + 'ichava-icon-browser.log', 'throttle:' . Helpers::configInt('ichava.icon-browser.rate_limiting.api_floor', 300) . ',1', ]); - $router->middlewareGroup('ichava.api', $apiMiddleware); + $router->middlewareGroup('ichava-icon-browser.api', $apiMiddleware); // Web routes (the SPA + cache UI), standard Laravel `web` stack. - $router->middlewareGroup('ichava.web', [ + $router->middlewareGroup('ichava-icon-browser.web', [ 'web', - 'ichava.validate', + 'ichava-icon-browser.validate', ]); // Inertia routes (React pages via Inertia.js). Same `web` foundation // plus the shared-props middleware; validation keeps the prefix check. - $router->middlewareGroup('ichava.inertia', [ + $router->middlewareGroup('ichava-icon-browser.inertia', [ 'web', - 'ichava.handle-inertia', - 'ichava.validate', + 'ichava-icon-browser.handle-inertia', + 'ichava-icon-browser.validate', ]); } diff --git a/src/Support/BrowserBootstrap.php b/src/Support/BrowserBootstrap.php index 9b8bd0c..1e729f1 100644 --- a/src/Support/BrowserBootstrap.php +++ b/src/Support/BrowserBootstrap.php @@ -5,6 +5,7 @@ namespace Simtabi\Laranail\Ichava\IconBrowser\Support; use Simtabi\Laranail\Ichava\Enums\IconKind; +use Illuminate\Contracts\Translation\Translator; use Simtabi\Laranail\Ichava\Constants\IchavaConstants; use Simtabi\Laranail\Ichava\Services\IconBrowserService; @@ -18,6 +19,7 @@ public function __construct( private HostSession $session, private FeaturesManifest $features, private IconBrowserService $browser, + private Translator $translator, ) {} /** @@ -77,7 +79,7 @@ public function toArray(): array return [ 'schemaVersion' => PayloadSchema::VERSION, // The host's locale: the browser follows it rather than guessing. - 'locale' => app()->getLocale(), + 'locale' => $this->translator->getLocale(), 'modes' => self::modes(), 'session' => $this->session->toArray(), 'features' => $features = $this->features->toArray(), diff --git a/src/Support/CacheAdminGate.php b/src/Support/CacheAdminGate.php index e90f926..e1ecaff 100644 --- a/src/Support/CacheAdminGate.php +++ b/src/Support/CacheAdminGate.php @@ -8,7 +8,7 @@ use Simtabi\Laranail\Ichava\Support\Auth\HostUser; /** - * The cache-administration decision, shared by the `ichava.cache-admin` + * The cache-administration decision, shared by the `ichava-icon-browser.cache-admin` * middleware and any handler that has to make the same call without aborting. * * It fails closed: with no ability defined the answer is a refusal, unless @@ -21,11 +21,13 @@ */ final class CacheAdminGate { + public function __construct(private readonly HostUser $users) {} + /** * Null when the current request may administer the icon cache; otherwise * the reason it may not, worded for a 403. */ - public static function refusal(): ?string + public function refusal(): ?string { $config = config('ichava.icon-browser.security.cache_admin', []); $config = is_array($config) ? $config : []; @@ -50,7 +52,7 @@ public static function refusal(): ?string ); } - if (Gate::forUser(app(HostUser::class)->user())->denies($ability)) { + if (Gate::forUser($this->users->user())->denies($ability)) { return 'You are not authorised to administer the Ichava icon cache.'; } @@ -58,8 +60,8 @@ public static function refusal(): ?string } /** Whether the current request may administer the icon cache. */ - public static function allows(): bool + public function allows(): bool { - return self::refusal() === null; + return $this->refusal() === null; } } diff --git a/src/Support/FeaturesManifest.php b/src/Support/FeaturesManifest.php index 2f77922..028c371 100644 --- a/src/Support/FeaturesManifest.php +++ b/src/Support/FeaturesManifest.php @@ -136,6 +136,7 @@ public function __construct( private HostUser $users, + private CacheAdminGate $cacheAdmin, ) {} /** Whether the host turned a feature on in `ichava.icon-browser.features`. */ @@ -193,7 +194,7 @@ public function toArray(): array $features['status'] = $this->gated('status', IchavaGates::ADMIN, self::STATUS); $features['cacheAdmin'] = self::configured('cache_admin') - ? self::feature(CacheAdminGate::allows(), 'gate', self::CACHE_ADMIN) + ? self::feature($this->cacheAdmin->allows(), 'gate', self::CACHE_ADMIN) : self::feature(false, 'config', []); $features['illustrations'] = self::configured('illustrations') diff --git a/src/Support/Helpers.php b/src/Support/Helpers.php index 34eb220..0b3c3db 100644 --- a/src/Support/Helpers.php +++ b/src/Support/Helpers.php @@ -42,7 +42,7 @@ public static function routePrefix(): string * * Reads `ichava.icon-browser.rate_limiting.enabled`. When it is off, returns * an empty array (the caller spreads it into ->middleware([...])). When on, - * returns one `ichava.throttle:,1,` entry: the route's own + * returns one `ichava-icon-browser.throttle:,1,` entry: the route's own * `$default` per minute, which `rate_limiting.{type}` may lower per request * but never raise (S3: it used to replace the default, so the figure each * route declared was never used). See {@see ThrottleRoute}. @@ -50,7 +50,7 @@ public static function routePrefix(): string * @param string $type Rate limit bucket (e.g. 'api'). * @param int $default The route's own per-minute limit. * - * @return array One `ichava.throttle:N,1,bucket` entry, or empty. + * @return array One `ichava-icon-browser.throttle:N,1,bucket` entry, or empty. */ public static function getRateLimit(string $type, int $default): array { @@ -58,7 +58,7 @@ public static function getRateLimit(string $type, int $default): array return []; } - return ["ichava.throttle:{$default},1,{$type}"]; + return ["ichava-icon-browser.throttle:{$default},1,{$type}"]; } /** diff --git a/src/Support/IconTables.php b/src/Support/IconTables.php new file mode 100644 index 0000000..cd26566 --- /dev/null +++ b/src/Support/IconTables.php @@ -0,0 +1,23 @@ +registry->get($package); + } catch (IchavaException) { + return null; + } + + if (! $packageData) { + return null; + } + + $counts = $this->termIconCounts($package); + + return new PackageDetailsData( + name: $package, + label: self::text($packageData, 'name', $package), + description: self::text($packageData, 'description', ''), + vendor: self::text($packageData, 'vendor', ''), + iconCount: Icon::where('package', $package)->count(), + categories: $this->terms($package, 'category', $counts, withParent: true), + variants: $this->terms($package, 'variant', $counts, withParent: false), + labels: is_array($packageData['labels'] ?? null) ? $packageData['labels'] : [], + registryData: $packageData, + ); + } + + /** @param array $data */ + private static function text(array $data, string $key, string $default): string + { + return is_string($data[$key] ?? null) ? $data[$key] : $default; + } + + /** + * Icons per term in the pack, in one query. + * + * @return array + */ + private function termIconCounts(string $package): array + { + $morph = (new Icon)->getMorphClass(); + $counts = []; + + $rows = DB::table(IconTables::TERMABLES) + ->join(IconTables::ICONS, function (JoinClause $join) use ($package, $morph) { + $join->on(IconTables::TERMABLES . '.termable_id', '=', IconTables::ICONS . '.id') + ->where(IconTables::TERMABLES . '.termable_type', '=', $morph) + ->where(IconTables::ICONS . '.package', '=', $package); + }) + ->select(IconTables::TERMABLES . '.term_id') + ->selectRaw('COUNT(DISTINCT ' . IconTables::ICONS . '.id) as icon_count') + ->groupBy(IconTables::TERMABLES . '.term_id') + ->get(); + + foreach ($rows as $row) { + /** @var object{term_id: int|string, icon_count: int|string} $row */ + $counts[$row->term_id] = (int) $row->icon_count; + } + + return $counts; + } + + /** + * @param array $counts + * + * @return list + */ + private function terms(string $package, string $type, array $counts, bool $withParent): array + { + $columns = $withParent ? ['id', 'name', 'slug', 'parent_id'] : ['id', 'name', 'slug']; + + return array_values(DB::table(IconTables::TERMS) + ->where('type', $type) + ->where('package', $package) + ->select($columns) + ->orderBy('name') + ->get() + ->map(function (object $term) use ($counts, $withParent): array { + /** @var object{id: int|string, name: string, slug: string, parent_id?: int|string|null} $term */ + return [ + 'id' => $term->id, + 'name' => $term->name, + 'slug' => $term->slug, + ...($withParent ? ['parent_id' => $term->parent_id ?? null] : []), + 'icon_count' => $counts[$term->id] ?? 0, + ]; + }) + ->all()); + } +} diff --git a/tests/Configured/ConfiguredHostTest.php b/tests/Configured/ConfiguredHostTest.php index eb79ad1..89d4331 100644 --- a/tests/Configured/ConfiguredHostTest.php +++ b/tests/Configured/ConfiguredHostTest.php @@ -26,7 +26,7 @@ it('appends the host middleware to every browser route group', function (string $name) { $middleware = Route::getRoutes()->getByName($name)?->gatherMiddleware() ?? []; - expect($middleware)->toContain('throttle:1000,1')->toContain('ichava.log'); + expect($middleware)->toContain('throttle:1000,1')->toContain('ichava-icon-browser.log'); })->with(['ichava.api.v1.icons.index', 'ichava.inertia.browser', 'ichava.home']); it('mounts the browser on the configured domain only', function () { diff --git a/tests/ConfiguredHostTestCase.php b/tests/ConfiguredHostTestCase.php index 441658c..5179567 100644 --- a/tests/ConfiguredHostTestCase.php +++ b/tests/ConfiguredHostTestCase.php @@ -24,7 +24,7 @@ protected function defineEnvironment($app): void $app['config']->set('ichava.icon-browser.features.favorites', false); $app['config']->set('ichava.icon-browser.features.library', false); - $app['config']->set('ichava.icon-browser.routes.middleware', 'throttle:1000,1| ichava.log'); + $app['config']->set('ichava.icon-browser.routes.middleware', 'throttle:1000,1| ichava-icon-browser.log'); $app['config']->set('ichava.icon-browser.routes.domain', self::DOMAIN); $app['config']->set('ichava.icon-browser.test_component_enabled', false); } diff --git a/tests/Feature/AssetPublishTagTest.php b/tests/Feature/AssetPublishTagTest.php index dc0582f..469c0dd 100644 --- a/tests/Feature/AssetPublishTagTest.php +++ b/tests/Feature/AssetPublishTagTest.php @@ -30,7 +30,7 @@ it('no longer registers the ichava.api.security middleware alias', function (): void { $aliases = app('router')->getMiddleware(); - $this->assertArrayHasKey('ichava.security', $aliases); + $this->assertArrayHasKey('ichava-icon-browser.security', $aliases); $this->assertArrayNotHasKey('ichava.api.security', $aliases); }); diff --git a/tests/Feature/CacheStatsExposureTest.php b/tests/Feature/CacheStatsExposureTest.php index e9a468c..eac5e00 100644 --- a/tests/Feature/CacheStatsExposureTest.php +++ b/tests/Feature/CacheStatsExposureTest.php @@ -10,7 +10,7 @@ * `GET ichava/api/v1/cache/stats` had a rate limit and nothing else, and its payload * listed every watched icon directory as an absolute path on the server. The * Inertia stats page put the same payload in its props for any visitor. Both now - * answer to the `ichava.cache-admin` decision the cache write routes use, and the + * answer to the `ichava-icon-browser.cache-admin` decision the cache write routes use, and the * payload names directories relative to the application root, or not at all. */ const WATCHED_FINGERPRINTS_KEY = 'ichava.directory.fingerprints'; diff --git a/tests/Feature/HostUserTest.php b/tests/Feature/HostUserTest.php index c62bb7f..b9fa7d4 100644 --- a/tests/Feature/HostUserTest.php +++ b/tests/Feature/HostUserTest.php @@ -122,7 +122,7 @@ function hostUser(array $attributes = []): GenericUser $this->actingAs(hostUser()); $seen = null; - Route::middleware('ichava.api')->get('/probe-guard', function (Request $request) use (&$seen) { + Route::middleware('ichava-icon-browser.api')->get('/probe-guard', function (Request $request) use (&$seen) { $seen = [ IchavaStatefulGuard::isAuthenticated($request), IchavaStatefulGuard::getUserId($request), diff --git a/tests/Feature/HttpLayerConventionsTest.php b/tests/Feature/HttpLayerConventionsTest.php new file mode 100644 index 0000000..6a0667c --- /dev/null +++ b/tests/Feature/HttpLayerConventionsTest.php @@ -0,0 +1,85 @@ + */ +function httpLayerFiles(string $dir): array +{ + $root = dirname(__DIR__, 2) . '/src/' . $dir; + $files = []; + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS)) as $file) { + if ($file->getExtension() === 'php') { + $files[] = $file->getPathname(); + } + } + sort($files); + + return $files; +} + +it('names no ichava table in a controller: the query service and the models own them (F-08)', function () { + $files = httpLayerFiles('Http/Controllers'); + expect(count($files))->toBeGreaterThanOrEqual(15); + $hits = array_values(array_filter($files, fn (string $f) => str_contains((string) file_get_contents($f), "'ichava_icon"))); + expect(array_map('basename', $hits))->toBe([]); +}); + +it('serves both package-detail pages from one query service (F-08)', function () { + foreach (['Api/IconBrowserApiController.php' => 'package', 'Web/PackageController.php' => 'show'] as $file => $method) { + $source = (string) file_get_contents(dirname(__DIR__, 2) . '/src/Http/Controllers/' . $file); + expect(preg_match('/public function ' . $method . '\(string \$package\).*?\n }\n/s', $source, $m))->toBe(1, "{$file} has no {$method}()"); + expect($m[0])->toContain('$this->packageDetails->find(')->not->toContain('DB::table(')->not->toContain('preg_match('); + } + expect(class_exists(PackageDetails::class))->toBeTrue(); +}); + +it('validates no request inline in a controller: FormRequests do (F-09)', function () { + $files = httpLayerFiles('Http/Controllers'); + $hits = array_values(array_filter($files, fn (string $f) => str_contains((string) file_get_contents($f), '$request->validate('))); + expect(array_map('basename', $hits))->toBe([]); +}); + +it('reaches for no collaborator through the container in the HTTP layer or Support (F-10)', function () { + $files = [...httpLayerFiles('Http'), ...httpLayerFiles('Support')]; + expect(count($files))->toBeGreaterThanOrEqual(30); + $hits = []; + foreach ($files as $f) { + foreach (preg_split('/\R/', (string) file_get_contents($f)) ?: [] as $n => $line) { + if (preg_match('/^\s*(\*|\/\/)/', $line)) { + continue; + } + if (preg_match('/\bapp\(\s*[A-Z][A-Za-z]*::class|\bresolve\(|App::make\(/', $line)) { + $hits[] = basename($f) . ':' . ($n + 1); + } + } + } + expect($hits)->toBe([]); +}); + +it('registers every middleware alias and group under the package name, and no bare ichava.* one (F-11)', function () { + $router = app(Router::class); + $names = [...array_keys($router->getMiddleware()), ...array_keys($router->getMiddlewareGroups())]; + $ours = array_values(array_filter($names, fn (string $n) => str_starts_with($n, 'ichava'))); + expect(count($ours))->toBeGreaterThanOrEqual(13); + foreach ($ours as $name) { + expect($name)->toStartWith('ichava-icon-browser.'); + } + foreach (['session', 'security', 'json', 'log', 'validate', 'guard', 'cache-admin', 'admin', 'throttle', 'handle-inertia', 'api', 'web', 'inertia'] as $short) { + expect($names)->toContain("ichava-icon-browser.{$short}"); + } +}); + +it('names the tables core\'s models name (F-08)', function () { + expect(Simtabi\Laranail\Ichava\IconBrowser\Support\IconTables::ICONS)->toBe((new Simtabi\Laranail\Ichava\Models\Icon)->getTable()) + ->and(Simtabi\Laranail\Ichava\IconBrowser\Support\IconTables::TERMS)->toBe((new Simtabi\Laranail\Ichava\Models\IconTerm)->getTable()) + ->and(Simtabi\Laranail\Ichava\IconBrowser\Support\IconTables::TERMABLES)->toBe((new Simtabi\Laranail\Ichava\Models\IconTerm)->icons()->getTable()); +}); diff --git a/tests/Feature/Middleware/IchavaApiSecurityTest.php b/tests/Feature/Middleware/IchavaApiSecurityTest.php index e73484f..e195574 100644 --- a/tests/Feature/Middleware/IchavaApiSecurityTest.php +++ b/tests/Feature/Middleware/IchavaApiSecurityTest.php @@ -10,7 +10,7 @@ /** * IchavaApiSecurity middleware coverage. * - * Hits real API routes (which sit behind the middleware via `ichava.api`) with + * Hits real API routes (which sit behind the middleware via `ichava-icon-browser.api`) with * malicious payloads and verifies the middleware blocks them. Also verifies * that the security response headers (CSP, X-Frame-Options, etc.) are emitted * on the happy path. @@ -142,7 +142,7 @@ ]); IchavaApiSecurity::claimHeaders($response, 'Cache-Control'); - $out = (new IchavaApiSecurity)->handle(Request::create('/ichava/api/v1/icons/1/svg'), fn () => $response); + $out = app(IchavaApiSecurity::class)->handle(Request::create('/ichava/api/v1/icons/1/svg'), fn () => $response); expect($out->headers->get('Cache-Control'))->toContain('immutable'); expect($out->headers->has('X-Ichava-Own-Headers'))->toBeFalse(); @@ -153,7 +153,7 @@ 'Cache-Control' => 'public, max-age=31536000, immutable', ]); - $out = (new IchavaApiSecurity)->handle(Request::create('/ichava/api/v1/packages'), fn () => $response); + $out = app(IchavaApiSecurity::class)->handle(Request::create('/ichava/api/v1/packages'), fn () => $response); expect($out->headers->get('Cache-Control'))->toContain('no-store'); }); @@ -176,7 +176,7 @@ $response = new SymfonyResponse('{}', 200); IchavaApiSecurity::claimHeaders($response, 'X-Frame-Options', 'X-Content-Type-Options'); - $out = (new IchavaApiSecurity)->handle(Request::create('/ichava/api/v1/packages'), fn () => $response); + $out = app(IchavaApiSecurity::class)->handle(Request::create('/ichava/api/v1/packages'), fn () => $response); expect($out->headers->get('X-Content-Type-Options'))->toBe('nosniff'); expect($out->headers->get('X-Frame-Options'))->not->toBeNull(); From fd4d7fb723877ac55f436913374b1bb5789582f8 Mon Sep 17 00:00:00 2001 From: Imani Manyara Date: Thu, 5 Nov 2026 06:51:37 -0500 Subject: [PATCH 3/4] Vendor react-icon-browser at 959b07c and rebuild the page bundle The library names no pack and opens on the installed ones (Q42), loads its on-demand layers as chunks, and links the generator's docs for the native exports. The page bundle splits per Inertia page. --- ...ertia-app-AboutDialog-5L60Q_S4-HMO9tyE_.js | 1 + ...ia-app-CommandPalette-BPpEv8-B-DhAiNcdi.js | 1 + ...tia-app-DevToolsPanel-DtuDuVnJ-BMTZWRpg.js | 1 + .../js/inertia-app-FlashBanner-rWYabYjl.js | 1 + .../js/inertia-app-IconGrid-DDgKzP68.js | 1 + .../js/inertia-app-IconImage-DrJ-WGz6.js | 1 + .../assets/js/inertia-app-Index-9ZaPeB2l.js | 1 + .../assets/js/inertia-app-Index-CPQuKRdb.js | 1 + .../assets/js/inertia-app-Index-DExngZR3.js | 1 + .../assets/js/inertia-app-Index-DMAKzwsZ.js | 1 + .../assets/js/inertia-app-Index-DMnnMnUN.js | 1 + .../assets/js/inertia-app-Index-DQn8r5k7.js | 1 + .../assets/js/inertia-app-Index-kr7MdfMI.js | 1 + .../assets/js/inertia-app-Index-n51e0Xvm.js | 1 + ...ertia-app-InviteModal-B5hC9CGd-D5knyl0e.js | 1 + ...tia-app-LibraryDialog-DAWIobNZ-b_Zk9GGC.js | 2 + ...app-ManageAccessModal-BW7R-s6Z-C2pA8CxK.js | 1 + ...rtia-app-ProfileModal-B8a6ztxV-K8ptuE1T.js | 1 + ...ia-app-SettingsDialog-Bdn2ml85-Ds0n1eul.js | 1 + ...haredCollectionsModal-DbRvVtxZ-f-CZfZK8.js | 2 + public/assets/js/inertia-app-Show-CM_WdFs5.js | 1 + public/assets/js/inertia-app-Show-Cqx-Li8V.js | 1 + public/assets/js/inertia-app-Show-tjb19Sx4.js | 1 + ...inertia-app-TourModal-pXzD1rw4-tkBN3CVN.js | 1 + .../js/inertia-app-jsx-runtime-CS4hA3mQ.js | 9 +++ .../js/inertia-app-propsToCatalog-BMfZFXhT.js | 1 + ...nertia-app-useInertiaMutations-ByVkwCnP.js | 1 + public/assets/js/inertia-app.js | 81 +++++++++---------- resources/js/core/docsUrl.test.ts | 8 +- .../AboutDialog-5L60Q_S4.js | 3 + .../CommandPalette-BPpEv8-B.js | 3 + .../DevToolsPanel-DtuDuVnJ.js | 3 + .../react-icon-browser/Glyph-BfvACzue.js | 3 + .../react-icon-browser/IconAsset-DYr34LrA.js | 3 + .../InviteModal-B5hC9CGd.js | 3 + .../LibraryDialog-DAWIobNZ.js | 4 + .../ManageAccessModal-BW7R-s6Z.js | 3 + .../ProfileModal-B8a6ztxV.js | 3 + .../SettingsDialog-Bdn2ml85.js | 3 + .../SharedCollectionsModal-DbRvVtxZ.js | 4 + .../react-icon-browser/TourModal-pXzD1rw4.js | 3 + .../TreatmentEngine-TwbTAFNA.js | 13 +++ .../react-icon-browser/avatar-BbiBv3-X.js | 3 + .../chromeIcons-6q27ZUTH.js | 3 + .../vendor/react-icon-browser/cx-B63ov-ZV.js | 3 + .../featured-icon-CzZVq73R.js | 3 + .../react-icon-browser/glyphIcon-sG4ZObeZ.js | 3 + resources/vendor/react-icon-browser/index.js | 34 ++------ .../is-react-component-BskCHdxR.js | 3 + .../react-icon-browser/label-DomHrZMf.js | 3 + .../react-icon-browser/snippets-9cBNzQxe.js | 13 +++ .../react-icon-browser/tooltip-Dya0yQP2.js | 3 + .../types/hooks/useRestRepoState.d.ts | 10 ++- .../vendor/react-icon-browser/vendored.json | 28 ++++++- 54 files changed, 203 insertions(+), 83 deletions(-) create mode 100644 public/assets/js/inertia-app-AboutDialog-5L60Q_S4-HMO9tyE_.js create mode 100644 public/assets/js/inertia-app-CommandPalette-BPpEv8-B-DhAiNcdi.js create mode 100644 public/assets/js/inertia-app-DevToolsPanel-DtuDuVnJ-BMTZWRpg.js create mode 100644 public/assets/js/inertia-app-FlashBanner-rWYabYjl.js create mode 100644 public/assets/js/inertia-app-IconGrid-DDgKzP68.js create mode 100644 public/assets/js/inertia-app-IconImage-DrJ-WGz6.js create mode 100644 public/assets/js/inertia-app-Index-9ZaPeB2l.js create mode 100644 public/assets/js/inertia-app-Index-CPQuKRdb.js create mode 100644 public/assets/js/inertia-app-Index-DExngZR3.js create mode 100644 public/assets/js/inertia-app-Index-DMAKzwsZ.js create mode 100644 public/assets/js/inertia-app-Index-DMnnMnUN.js create mode 100644 public/assets/js/inertia-app-Index-DQn8r5k7.js create mode 100644 public/assets/js/inertia-app-Index-kr7MdfMI.js create mode 100644 public/assets/js/inertia-app-Index-n51e0Xvm.js create mode 100644 public/assets/js/inertia-app-InviteModal-B5hC9CGd-D5knyl0e.js create mode 100644 public/assets/js/inertia-app-LibraryDialog-DAWIobNZ-b_Zk9GGC.js create mode 100644 public/assets/js/inertia-app-ManageAccessModal-BW7R-s6Z-C2pA8CxK.js create mode 100644 public/assets/js/inertia-app-ProfileModal-B8a6ztxV-K8ptuE1T.js create mode 100644 public/assets/js/inertia-app-SettingsDialog-Bdn2ml85-Ds0n1eul.js create mode 100644 public/assets/js/inertia-app-SharedCollectionsModal-DbRvVtxZ-f-CZfZK8.js create mode 100644 public/assets/js/inertia-app-Show-CM_WdFs5.js create mode 100644 public/assets/js/inertia-app-Show-Cqx-Li8V.js create mode 100644 public/assets/js/inertia-app-Show-tjb19Sx4.js create mode 100644 public/assets/js/inertia-app-TourModal-pXzD1rw4-tkBN3CVN.js create mode 100644 public/assets/js/inertia-app-jsx-runtime-CS4hA3mQ.js create mode 100644 public/assets/js/inertia-app-propsToCatalog-BMfZFXhT.js create mode 100644 public/assets/js/inertia-app-useInertiaMutations-ByVkwCnP.js create mode 100644 resources/vendor/react-icon-browser/AboutDialog-5L60Q_S4.js create mode 100644 resources/vendor/react-icon-browser/CommandPalette-BPpEv8-B.js create mode 100644 resources/vendor/react-icon-browser/DevToolsPanel-DtuDuVnJ.js create mode 100644 resources/vendor/react-icon-browser/Glyph-BfvACzue.js create mode 100644 resources/vendor/react-icon-browser/IconAsset-DYr34LrA.js create mode 100644 resources/vendor/react-icon-browser/InviteModal-B5hC9CGd.js create mode 100644 resources/vendor/react-icon-browser/LibraryDialog-DAWIobNZ.js create mode 100644 resources/vendor/react-icon-browser/ManageAccessModal-BW7R-s6Z.js create mode 100644 resources/vendor/react-icon-browser/ProfileModal-B8a6ztxV.js create mode 100644 resources/vendor/react-icon-browser/SettingsDialog-Bdn2ml85.js create mode 100644 resources/vendor/react-icon-browser/SharedCollectionsModal-DbRvVtxZ.js create mode 100644 resources/vendor/react-icon-browser/TourModal-pXzD1rw4.js create mode 100644 resources/vendor/react-icon-browser/TreatmentEngine-TwbTAFNA.js create mode 100644 resources/vendor/react-icon-browser/avatar-BbiBv3-X.js create mode 100644 resources/vendor/react-icon-browser/chromeIcons-6q27ZUTH.js create mode 100644 resources/vendor/react-icon-browser/cx-B63ov-ZV.js create mode 100644 resources/vendor/react-icon-browser/featured-icon-CzZVq73R.js create mode 100644 resources/vendor/react-icon-browser/glyphIcon-sG4ZObeZ.js create mode 100644 resources/vendor/react-icon-browser/is-react-component-BskCHdxR.js create mode 100644 resources/vendor/react-icon-browser/label-DomHrZMf.js create mode 100644 resources/vendor/react-icon-browser/snippets-9cBNzQxe.js create mode 100644 resources/vendor/react-icon-browser/tooltip-Dya0yQP2.js diff --git a/public/assets/js/inertia-app-AboutDialog-5L60Q_S4-HMO9tyE_.js b/public/assets/js/inertia-app-AboutDialog-5L60Q_S4-HMO9tyE_.js new file mode 100644 index 0000000..3af329c --- /dev/null +++ b/public/assets/js/inertia-app-AboutDialog-5L60Q_S4-HMO9tyE_.js @@ -0,0 +1 @@ +import{It as e,Rt as t,ct as n,jt as r,t as i,w as a}from"./inertia-app.js";import{i as o,o as s,t as c}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var l=s(o(),1),u=c();function d({children:e,direction:t=`vertical`,durationSec:n=16,gap:r=0,style:i,fade:a=!0,fadeColor:o=`var(--muted2)`}){return(0,u.jsx)(t===`horizontal`?m:p,{durationSec:n,gap:r,style:i,fade:a,fadeColor:o,children:e})}function f(e,t){return{position:`absolute`,inset:0,pointerEvents:`none`,background:e?`linear-gradient(${t}, transparent 16px, transparent calc(100% - 16px), ${t})`:`linear-gradient(90deg, ${t}, transparent 24px, transparent calc(100% - 24px), ${t})`}}function p({children:e,durationSec:t,gap:n,style:r,fade:i,fadeColor:a}){let o=(0,l.useRef)(null),s=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{let e=o.current;if(!e)return;let n=0,r=performance.now(),i=e.scrollTop,a=o=>{let c=o-r;r=o;let l=document.documentElement.hasAttribute(`data-reduce-motion`),u=e.scrollHeight/2;s.current||l?(i=e.scrollTop,u>0&&i>=u&&(i-=u,e.scrollTop=i)):u>0&&(i+=u/(t*1e3)*c,i>=u&&(i-=u),e.scrollTop=i),n=requestAnimationFrame(a)};return n=requestAnimationFrame(a),()=>cancelAnimationFrame(n)},[t]),(0,u.jsxs)(`div`,{onMouseEnter:()=>s.current=!0,onMouseLeave:()=>s.current=!1,style:{position:`relative`,overflow:`hidden`,...r},children:[(0,u.jsxs)(`div`,{ref:o,className:`ich-marquee-scroll`,style:{height:`100%`,overflowY:`auto`,overscrollBehavior:`contain`},children:[(0,u.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:n},children:e}),(0,u.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:n},"aria-hidden":!0,children:e})]}),i&&(0,u.jsx)(`div`,{style:f(!0,a)})]})}function m({children:e,durationSec:t,gap:n,style:r,fade:i,fadeColor:a}){let[o,s]=(0,l.useState)(!1);return(0,u.jsxs)(`div`,{onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),style:{position:`relative`,overflow:`hidden`,...r},children:[(0,u.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,gap:n,animation:`ichMarqueeX ${t}s linear infinite`,animationPlayState:o?`paused`:`running`,willChange:`transform`},children:[(0,u.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,gap:n},children:e}),(0,u.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,gap:n},"aria-hidden":!0,children:e})]}),i&&(0,u.jsx)(`div`,{style:f(!1,a)})]})}function h(){let o=t(),s=r(e=>e.closeLayer),c=r(e=>e.config),l=r(e=>e.catalog),f=c?.about??e.about,p=f.credits,m=f.links,h=c?.crossLinks?.landing,_=typeof h==`string`&&/^https?:\/\//i.test(h)?h:null;return(0,u.jsxs)(i,{showClose:!1,onClose:s,width:400,panelStyle:{overflow:`hidden`},children:[(0,u.jsxs)(`div`,{className:`relative`,children:[(0,u.jsx)(`button`,{onClick:s,title:`${o(`common.close`)} — Esc`,className:`absolute top-2.5 end-2.5 z-2 w-[26px] h-[26px] border border-[var(--border)] bg-[var(--pop)] shadow-[var(--shadow)] rounded-[6px] cursor-pointer flex items-center justify-center text-[var(--muted-fg)]`,children:(0,u.jsx)(n,{name:`close`,size:12,color:`currentColor`})}),(0,u.jsxs)(`div`,{className:`flex flex-col items-center gap-2.5 pt-[26px] px-5 pb-[18px] bg-[var(--accent-soft)]`,children:[(0,u.jsx)(`div`,{className:`w-[46px] h-[46px] rounded-[12px] bg-[var(--accent)] flex items-center justify-center shadow-[var(--shadow-elevated)]`,children:(0,u.jsx)(n,{name:`layers`,size:25,color:`var(--accent-fg)`})}),(0,u.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,u.jsx)(`span`,{className:`font-bold text-[16px] tracking-[-.02em]`,children:c?.brand.name??`Ichava`}),(0,u.jsx)(`span`,{className:`text-[var(--muted-fg)] text-[14px]`,children:c?.brand.suffix??o(`about.browser`)}),(0,u.jsxs)(`span`,{className:`font-[family-name:'Geist_Mono',monospace] text-[11px] text-[var(--accent-text)]`,children:[`v`,c?.meta.version??`0.1.0`]})]}),(0,u.jsx)(`div`,{className:`text-[12px] text-[var(--muted-fg)] text-center leading-[1.55] max-w-[40ch]`,children:f.description}),(0,u.jsxs)(`div`,{className:`text-[11px] text-[var(--faint-fg)]`,children:[o(`about.craftedBy`),` `,(0,u.jsx)(`b`,{className:`text-[var(--fg)] font-semibold`,children:c?.meta.author??`Simtabi LLC`})]})]})]}),(0,u.jsxs)(`div`,{className:`flex border-t border-t-[var(--border)] border-b border-b-[var(--border)]`,children:[(0,u.jsx)(g,{value:a(l?.meta.total_ecosystem??0),label:f.stats[0]?.label??o(`about.statIcons`),border:!0}),(0,u.jsx)(g,{value:String(c?.meta.sets??70),label:f.stats[1]?.label??o(`about.statSets`),border:!0}),(0,u.jsx)(g,{value:c?.meta.license??e.meta.license,label:f.stats[2]?.label??o(`about.statLicense`)})]}),(0,u.jsx)(`div`,{className:`text-[9.5px] font-bold tracking-[.08em] text-[var(--faint-fg)] text-center pt-2 px-0 pb-1.5 bg-[var(--muted2)] border-b border-b-[var(--border)]`,children:f.creditsTitle}),(0,u.jsx)(d,{durationSec:f.creditsMarqueeSec,style:{height:126,background:`var(--muted2)`},fadeColor:`var(--muted2)`,children:p.map(e=>(0,u.jsxs)(`div`,{className:`flex items-baseline justify-center gap-2 py-[5px] px-4`,children:[(0,u.jsx)(`span`,{className:`text-[11.5px] font-[600]`,children:e.name}),(0,u.jsx)(`span`,{className:`text-[10px] text-[var(--muted-fg)]`,children:e.author}),(0,u.jsx)(`span`,{className:`font-[family-name:'Geist_Mono',monospace] text-[9.5px] text-[var(--accent-text)] bg-[var(--accent-soft)] rounded-[3px] py-0 px-[5px]`,children:e.license})]},e.name))}),(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-3 px-4 flex-wrap`,children:[(0,u.jsx)(`span`,{className:`text-[11px] text-[var(--muted-fg)]`,children:f.copyright}),(0,u.jsx)(`span`,{className:`flex-1`}),(0,u.jsxs)(`div`,{className:`flex items-center gap-3`,children:[_&&(0,u.jsx)(`a`,{href:_,target:`_blank`,rel:`noopener noreferrer`,className:`text-[12px]`,"data-ichava-landing":``,children:o(`about.landing`)}),m.map(e=>(0,u.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`text-[12px]`,children:e.label},e.label))]})]})]})}function g({value:e,label:t,border:n}){return(0,u.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:2,padding:10,borderRight:n?`1px solid var(--border)`:void 0},children:[(0,u.jsx)(`span`,{className:`font-[family-name:'Geist_Mono',monospace] text-[14px] font-semibold`,children:e}),(0,u.jsx)(`span`,{className:`text-[10px] text-[var(--muted-fg)]`,children:t})]})}export{h as AboutDialog}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-CommandPalette-BPpEv8-B-DhAiNcdi.js b/public/assets/js/inertia-app-CommandPalette-BPpEv8-B-DhAiNcdi.js new file mode 100644 index 0000000..9e6342e --- /dev/null +++ b/public/assets/js/inertia-app-CommandPalette-BPpEv8-B-DhAiNcdi.js @@ -0,0 +1 @@ +import{$ as e,B as t,Bt as n,E as r,F as i,G as a,H as o,I as s,It as c,J as l,K as u,L as d,Lt as f,Mt as p,N as m,P as h,Q as g,R as _,Rt as v,S as y,St as b,T as x,Tt as S,U as C,V as w,W as T,X as E,Y as ee,Z as D,_ as O,_t as k,at as A,ct as j,dt as M,it as N,jt as P,m as F,nt as I,q as te,rt as ne,tt as L,ut as R,yt as z,z as B}from"./inertia-app.js";import{i as V,o as H,t as U}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var W=H(V(),1),G=U(),K=({keys:e,withThen:t,className:n,size:r=`md`})=>(0,G.jsx)(`div`,{className:L(`flex items-center gap-x-1`,n),children:e.map((e,n)=>(0,G.jsxs)(W.Fragment,{children:[n!==0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-x-1 text-quaternary`,children:[t&&(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`then`}),(0,G.jsx)(k,{size:16,strokeWidth:2.2})]}),(0,G.jsx)(`kbd`,{className:L(`min-w-6 rounded-[4px] bg-secondary_alt px-1 py-0.5 text-center font-medium text-tertiary ring-1 ring-secondary ring-inset`,r===`sm`?`font-mono text-[10.5px]`:`text-sm`),children:e.toUpperCase()})]},n))}),q=({placeholder:e,shortcutKeys:t,tooltip:n,className:r,...i})=>(0,G.jsxs)(E,{className:({isFocusWithin:e})=>L(`flex items-center gap-x-2 rounded-xl bg-primary p-4`,e&&`outline-2 outline-focus-ring`,r),children:[(0,G.jsx)(`div`,{className:`pointer-events-none absolute`,children:(0,G.jsx)(p,{className:`size-5 text-fg-quaternary`})}),(0,G.jsx)(ee,{placeholder:e,className:`m-0 w-full bg-transparent pl-7 text-md text-primary ring-0 outline-hidden placeholder:text-placeholder autofill:rounded-lg autofill:text-primary`,...i}),n&&(0,G.jsx)(_,{title:n,placement:`top`,children:(0,G.jsx)(d,{className:`cursor-pointer text-fg-quaternary transition duration-200 hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover`,children:(0,G.jsx)(S,{className:`size-4 stroke-[2.25px]`})})}),t&&(0,G.jsx)(K,{keys:t})]}),J=e=>(0,G.jsxs)(`div`,{className:`flex h-7 min-w-7 items-center justify-between rounded-lg bg-primary p-1.5 ring-1 ring-secondary ring-inset`,children:[e.type===`icon`&&(0,G.jsx)(e.icon,{strokeWidth:2.4,className:`size-4 text-fg-quaternary`}),e.type===`text`&&(0,G.jsx)(`span`,{className:`text-sm font-semibold text-fg-quaternary`,children:e.label})]}),Y=({className:e})=>(0,G.jsxs)(`footer`,{className:L(`absolute inset-x-0 bottom-0 flex items-center justify-between gap-x-3 bg-alpha-white/80 p-2 pl-4.5 ring-1 ring-secondary_alt backdrop-blur-lg max-md:hidden`,e),children:[(0,G.jsxs)(`div`,{className:`flex gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,G.jsx)(J,{type:`icon`,icon:z}),(0,G.jsx)(J,{type:`icon`,icon:M})]}),(0,G.jsx)(`span`,{className:`text-sm font-semibold text-quaternary`,children:`to navigate`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(J,{type:`icon`,icon:b}),(0,G.jsx)(`span`,{className:`text-sm font-semibold text-quaternary`,children:`to select`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(J,{type:`text`,label:`esc`}),(0,G.jsx)(`span`,{className:`text-sm font-semibold text-quaternary`,children:`to close`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(J,{type:`icon`,icon:f}),(0,G.jsx)(`span`,{className:`text-sm font-semibold text-quaternary`,children:`return to parent`})]})]}),(0,G.jsx)(x,{size:`sm`,color:`tertiary`,iconLeading:R})]}),X=({children:e,className:t})=>(0,G.jsx)(l,{className:L(`flex px-4.5 pt-2 text-xs font-semibold text-tertiary`,t),children:e});function re(e,t){let n=new Set(t);return Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)))}var ie=({label:e,children:t,description:n,stacked:r,shortcutKeys:i,className:a,size:o=`md`,...c})=>{let l=o===`sm`;return(0,G.jsx)(u,{...re(c,[`type`,`icon`,`alt`,`src`]),textValue:e,className:e=>L(`group block cursor-pointer px-2 py-0.5 outline-hidden`,typeof a==`function`?a(e):a),children:a=>(0,G.jsxs)(`div`,{className:L(`relative flex min-h-10 items-center justify-between rounded-lg px-2.5 py-2 pl-2.5 outline-focus-ring transition duration-100 ease-linear hover:bg-primary_hover`,l&&`min-h-8 rounded-md px-2 py-1 pl-2`,a.isSelected&&`bg-primary_hover`,a.isFocusVisible&&`outline-2 outline-offset-2`,r&&`items-start p-2.5 pl-3.5`),children:[c.type===`icon`&&!r&&(0,G.jsx)(c.icon,{className:L(`mr-2 text-fg-quaternary`,l?`size-4`:`size-5`)}),c.type===`icon`&&r&&(0,G.jsx)(h,{color:`gray`,size:`md`,theme:`modern`,icon:c.icon,className:`mr-2`}),c.type===`avatar`&&(0,G.jsx)(s,{alt:c.alt,src:c.src,size:r?`md`:`xs`,className:`mr-2`}),c.type===`dot`&&(0,G.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,className:L(`mr-2 shrink-0 text-fg-success-secondary`,r&&`mt-2 self-start`),children:(0,G.jsx)(`circle`,{cx:`5`,cy:`5`,r:`4`,fill:`currentColor`})}),(0,G.jsxs)(`div`,{className:L(`flex flex-1 gap-x-1.5`,r&&`flex-col`),children:[(0,G.jsxs)(D,{slot:`label`,className:L(`font-medium text-primary`,l?`text-[12.5px]`:`text-sm`,i&&`flex flex-1 items-center justify-between gap-2`),children:[(0,G.jsx)(`span`,{children:typeof t==`function`?t(a):t||e}),i&&` `,i&&(0,G.jsx)(K,{keys:i,size:o})]}),n&&(0,G.jsx)(D,{slot:`description`,className:L(`text-tertiary`,l?`font-mono text-[10.5px]`:`text-sm`),children:n})]})]})})},Z=(0,W.createContext)({hasFooter:!1,flatItems:[],selectedKeys:new Set,setSelectedKeys:()=>{}}),ae=({items:t,children:n,dialogClassName:r,overlayClassName:i,filter:a,inputValue:s,defaultItems:c,onInputChange:l,onSelectionChange:u,sensitivity:d=`base`,placeholder:f=`Search`,defaultSelectedKeys:p,shortcut:m=`⌘/`,dialogLabel:h=`Command menu`,inputLabel:g=`Search`,listLabel:_=`Command menu results`,...v})=>{let y=(0,W.useRef)(null),{contains:b}=o({sensitivity:d}),[x,S]=(0,W.useState)(p??new Set),C=t??c,w=(C??[]).reduce((e,t)=>[...e,...t.items],[]),T=(0,W.useMemo)(()=>{let e=!1;return W.Children.forEach(n,t=>{t&&typeof t==`object`&&`type`in t&&t.type===Y&&(e=!0)}),e},[n]);return(0,G.jsx)(Z.Provider,{value:{hasFooter:T,flatItems:w,selectedKeys:x,setSelectedKeys:S,onSelectionChange:u,items:C,listLabel:_,...v},children:(0,G.jsx)(oe,{"aria-label":h,isOpen:v.isOpen,onOpenChange:v.onOpenChange,className:i,dialogClassName:r,children:(0,G.jsxs)(e,{inputValue:s,onInputChange:l,filter:a===!1?void 0:a||b,children:[(0,G.jsx)(B,{"aria-label":g,children:(0,G.jsx)(q,{autoFocus:!0,role:`combobox`,"aria-expanded":!0,shortcutKeys:m?[m]:void 0,placeholder:f,ref:y,className:`relative outline-hidden! after:absolute after:bottom-0 after:left-0 after:h-px after:w-full after:bg-border-secondary`})}),n]})})})},oe=({className:e,dialogClassName:n,children:r,"aria-label":i=`Command menu`,...a})=>(0,G.jsx)(w,{...a,isDismissable:!0,className:t=>L(`fixed inset-0 z-50 flex min-h-full items-start justify-center overflow-y-auto bg-overlay/70 p-4 text-center md:pt-16 xl:pt-[clamp(64px,10vh,243px)]`,t.isEntering&&`duration-300 ease-out animate-in fade-in`,t.isExiting&&`duration-200 ease-in animate-out fade-out`,typeof e==`function`?e(t):e),children:e=>(0,G.jsx)(t,{className:e=>L(`flex max-h-full w-160 flex-col overflow-hidden rounded-xl bg-primary text-left align-middle shadow-xl`,e.isEntering&&`duration-300 ease-out animate-in zoom-in-95`,e.isExiting&&`duration-200 ease-in animate-out zoom-out-95`,typeof n==`function`?n(e):n),children:(0,G.jsx)(T,{"aria-label":i,className:`relative flex min-h-0 flex-1 flex-col outline-hidden`,children:typeof r==`function`?r(e):r})})}),se=({className:e,selectionMode:t=`single`,...n})=>{let{hasFooter:r,emptyState:i,listLabel:o,...s}=(0,W.useContext)(Z);return(0,G.jsx)(a,{"aria-label":o,...n,...s,renderEmptyState:()=>i,selectionMode:t,onSelectionChange:e=>{s.onSelectionChange?.(e),s.setSelectedKeys(e)},className:t=>L(`flex max-h-106 flex-1 scroll-py-10 flex-col gap-2 overflow-auto focus:outline-hidden`,r&&`scroll-pb-22 pb-13`,!t.isEmpty&&`pt-2`,typeof e==`function`?e(t):e)})},ce=({title:e,children:t,items:n,...r})=>(0,G.jsxs)(te,{...r,className:L(`border-b border-secondary pb-2 last:border-transparent`,r.className),children:[e&&(0,G.jsx)(X,{className:`pb-1`,children:e},e),(0,G.jsx)(g,{items:n,children:t})]}),le=({children:e,asChild:t,...n})=>{let{selectedKeys:r}=(0,W.useContext)(Z),i=Array.from(r);if(!i.length)return null;let a=i.at(0);return t?(0,G.jsx)(W.Fragment,{children:typeof e==`function`?e({selectedId:a}):e}):(0,G.jsx)(`div`,{...n,children:typeof e==`function`?e({selectedId:a}):e})},ue=({className:e,...t})=>(0,G.jsx)(`div`,{...t,className:L(`min-h-0 flex-1`,e)}),Q=ae;Q.Item=ie,Q.List=se,Q.Group=ue,Q.Footer=Y,Q.Preview=le,Q.Section=ce,Q.Trigger=C,Q.Collection=g;function de(){let e=n(),t=ne(),{catalog:a,page:o}=A(),s=P(e=>e.closeLayer),[l,u]=(0,W.useState)(``),d=P(e=>e.config?.features.commands===!1?fe:e.recentCommands),f=r(),p=v(),h=P(e=>e.config?.limits)??c.limits,g=e.getState(),_=(0,W.useMemo)(()=>[{id:`theme`,label:p(`palette.toggleTheme`),icon:`moon`,kbd:`${f}T`,run:()=>g.toggleTheme()},{id:`settings`,label:p(`palette.openSettings`),icon:`settings`,kbd:`${f},`,run:()=>g.openLayer(`settings`)},{id:`favorites`,label:p(`palette.openFavorites`),icon:`heart`,kbd:`${f}1`,run:()=>g.openLibrary(`favorites`)},{id:`history`,label:p(`palette.openHistory`),icon:`clock`,kbd:`${f}2`,run:()=>g.openLibrary(`history`)},{id:`collections`,label:p(`palette.openCollections`),icon:`folder`,kbd:`${f}3`,run:()=>g.openLibrary(`collections`)},{id:`view`,label:g.view===`grid`?p(`palette.switchListView`):p(`palette.switchGridView`),icon:g.view===`grid`?`list`:`grid`,kbd:``,run:()=>g.setView(g.view===`grid`?`list`:`grid`)},{id:`reset`,label:p(`palette.resetFilters`),icon:`refresh`,kbd:O(f),run:()=>g.openConfirm({title:p(`toolbar.resetTitle`),body:p(`toolbar.resetBody`),confirmLabel:p(`toolbar.resetConfirm`),danger:!0,onConfirm:()=>{g.resetFilters(),g.showToast(p(`toolbar.resetToast`),`refresh`)}})},{id:`selectAll`,label:p(`palette.selectAll`),icon:`check`,kbd:`${f}A`,run:()=>F(e,t)},...g.config?.features.devtools===!1?[]:[{id:`devtools`,label:p(`palette.openDevtools`),icon:`zap`,kbd:y(f),run:()=>g.toggleDevtools()}]].filter(e=>{let t=g.config?.features;return e.id===`theme`?t?.themeToggle!==!1:e.id===`favorites`||e.id===`history`||e.id===`collections`?t?.[e.id]!==!1:!0}),[f,g,p,e,t]),b=l.trim().toLowerCase(),x=b?_.filter(e=>e.label.toLowerCase().includes(b)):[..._].sort((e,t)=>$(d,e.id)-$(d,t.id)),S=(0,W.useMemo)(()=>b?(a?a.icons:o.items).filter(e=>`${e.name} ${e.id} ${(e.tags??[]).join(` `)}`.toLowerCase().includes(b)).slice(0,h.paletteIconResults):[],[b,a,o,h.paletteIconResults]),C=new Map(x.map(e=>[`a:${e.id}`,e])),w=new Map(S.map(e=>[`i:${e.id}`,e])),T=(0,W.useMemo)(()=>S.map(e=>{let t=({className:t})=>(0,G.jsx)(`span`,{className:L(`inline-flex items-center justify-center`,t),children:(0,G.jsx)(pe,{icon:e})}),n=(0,G.jsxs)(G.Fragment,{children:[e.name,` `,(0,G.jsx)(`span`,{className:`ms-1 font-mono text-[10.5px] font-normal text-tertiary`,children:m(e)})]});return{id:`i:${e.id}`,type:`icon`,icon:t,label:e.name,children:n,size:`sm`}}),[S]),E=[];return x.length&&E.push({id:`actions`,title:!b&&d.length?p(`palette.recent`):p(`palette.actions`),items:x.map(e=>({id:`a:${e.id}`,type:`icon`,icon:i(e.icon),label:e.label,shortcutKeys:e.kbd?[e.kbd]:void 0,size:`sm`}))}),T.length&&E.push({id:`icons`,title:p(`palette.icons`),items:T}),(0,G.jsxs)(Q,{isOpen:!0,onOpenChange:e=>!e&&s(),items:E,filter:!1,inputValue:l,onInputChange:u,onAction:t=>{let n=w.get(String(t));if(n){g.openDetail(n.id);return}let r=C.get(String(t));r&&(e.getState().config?.features.commands!==!1&&g.logCommand(r.id,`action`),r.run(),e.getState().layer===`palette`&&s())},shortcut:null,placeholder:p(`palette.placeholder`),inputLabel:p(`palette.placeholder`),dialogLabel:p(`header.commandPalette`),listLabel:p(`palette.results`),overlayClassName:`z-(--z-overlay)`,dialogClassName:`w-[560px] max-w-[94vw] bg-[var(--surface)] text-[length:var(--app-font,13.5px)]`,emptyState:(0,G.jsx)(`div`,{className:`p-6 text-center text-[12px] text-[var(--muted-fg)]`,children:p(`palette.noMatches`,{q:l})}),children:[(0,G.jsx)(Q.Group,{children:(0,G.jsx)(Q.List,{selectionMode:`none`,children:e=>(0,G.jsx)(Q.Section,{...e,children:e=>(0,G.jsx)(Q.Item,{...e},e.id)})})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 border-t border-secondary px-3.5 py-2 text-[10.5px] text-[var(--muted-fg)]`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`b`,{children:`↑↓`}),` `,p(`palette.navigate`)]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`b`,{children:`↵`}),` `,p(`palette.select`)]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`b`,{children:`esc`}),` `,p(`palette.close`)]})]})]})}var fe=[];function $(e,t){let n=e.indexOf(t);return n<0?99:n}function pe({icon:e}){let t=!!(e.svgUrl||e.svgContent),n=I(e);return!t||n?.body===``?(0,G.jsx)(`span`,{"data-role":`preview-fallback`,className:`inline-flex`,children:(0,G.jsx)(j,{name:`cube`,size:16,color:`var(--muted-fg)`})}):(0,G.jsx)(N,{icon:e,size:16,inline:!0})}export{de as CommandPalette}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-DevToolsPanel-DtuDuVnJ-BMTZWRpg.js b/public/assets/js/inertia-app-DevToolsPanel-DtuDuVnJ-BMTZWRpg.js new file mode 100644 index 0000000..ee7f1c9 --- /dev/null +++ b/public/assets/js/inertia-app-DevToolsPanel-DtuDuVnJ-BMTZWRpg.js @@ -0,0 +1 @@ +import{At as e,Bt as t,Ct as n,Et as r,Nt as i,Ot as a,Pt as o,ct as s,f as c,ft as l,ht as u,jt as d,l as f,mt as p,o as m,pt as h,vt as g,wt as _,xt as v,zt as y}from"./inertia-app.js";import{i as b,o as x,t as S}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var C=x(b(),1),w=S();function T(){return a(t())??i}var E=[{id:`events`,label:`Events`},{id:`state`,label:`State`},{id:`storage`,label:`Storage`},{id:`tests`,label:`Tests`},{id:`logs`,label:`Logs`},{id:`boot`,label:`Boot`},{id:`status`,label:`Status`}],D=[{id:`bottom`,label:`Dock to bottom`,Icon:u},{id:`right`,label:`Dock to right`,Icon:h},{id:`left`,label:`Dock to left`,Icon:y},{id:`top`,label:`Dock to top`,Icon:e}];function O(e){if(typeof window>`u`)return r.max;let t=e===`left`||e===`right`?window.innerWidth:window.innerHeight;return Math.max(r.min,Math.min(r.max,Math.floor(t*.85)))}var k={bottom:e=>({left:0,right:0,bottom:0,height:e,borderTop:`1px solid var(--border)`,boxShadow:`0 -8px 24px -12px rgba(0,0,0,.3)`}),top:e=>({left:0,right:0,top:0,height:e,borderBottom:`1px solid var(--border)`,boxShadow:`0 8px 24px -12px rgba(0,0,0,.3)`}),left:e=>({top:0,bottom:0,left:0,width:e,borderRight:`1px solid var(--border)`,boxShadow:`8px 0 24px -12px rgba(0,0,0,.3)`}),right:e=>({top:0,bottom:0,right:0,width:e,borderLeft:`1px solid var(--border)`,boxShadow:`-8px 0 24px -12px rgba(0,0,0,.3)`})};function A(){let e=t(),n=d(e=>e.devtools.tab),i=d(e=>e.setDevToolsTab),a=d(e=>{let t=e.config?.host;return!t||!_(t,`status`)?null:l(t,`status`)??o(t,`status`,`status`)}),c=d(e=>e.toggleDevtools),{dock:u,size:f}=d(e=>e.devtoolsLayout),p=d(e=>e.setDevtoolsDock),m=d(e=>e.setDevtoolsSize),h=T();(0,C.useEffect)(()=>h.on(t=>e.getState().pushDevEvent(t)),[h,e]);let[,g]=(0,C.useState)(0);(0,C.useEffect)(()=>{let e=()=>g(e=>e+1);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let v=O(u),y=Math.min(f,v),b=u===`top`||u===`bottom`,x=e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId);let n=e=>u===`bottom`?window.innerHeight-e.clientY:u===`top`?e.clientY:u===`left`?e.clientX:window.innerWidth-e.clientX,r=e=>m(Math.min(O(u),n(e))),i=e=>{t.releasePointerCapture(e.pointerId),t.removeEventListener(`pointermove`,r),t.removeEventListener(`pointerup`,i)};t.addEventListener(`pointermove`,r),t.addEventListener(`pointerup`,i)},S=e=>{let t={bottom:`ArrowUp`,top:`ArrowDown`,left:`ArrowRight`,right:`ArrowLeft`}[u],n={bottom:`ArrowDown`,top:`ArrowUp`,left:`ArrowLeft`,right:`ArrowRight`}[u],i=e.shiftKey?64:16,a=null;e.key===t?a=y+i:e.key===n?a=y-i:e.key===`Home`?a=r.min:e.key===`End`&&(a=v),a!==null&&(e.preventDefault(),m(Math.min(v,a)))},A=u===`bottom`?{top:-3,left:0,right:0,height:6,cursor:`ns-resize`}:u===`top`?{bottom:-3,left:0,right:0,height:6,cursor:`ns-resize`}:u===`left`?{right:-3,top:0,bottom:0,width:6,cursor:`ew-resize`}:{left:-3,top:0,bottom:0,width:6,cursor:`ew-resize`};return(0,w.jsxs)(`div`,{role:`region`,"aria-label":`Ichava DevTools`,"data-dock":u,className:`fixed z-55 bg-[var(--pop)] flex flex-col text-[12px]`,style:k[u](y),children:[(0,w.jsx)(`div`,{role:`separator`,"aria-orientation":b?`horizontal`:`vertical`,"aria-label":`Resize DevTools`,"aria-valuemin":r.min,"aria-valuemax":v,"aria-valuenow":y,tabIndex:0,onPointerDown:x,onKeyDown:S,className:`absolute z-1 touch-none outline-focus-ring hover:bg-[var(--accent-soft)] focus-visible:bg-[var(--accent-soft)]`,style:A}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 min-h-[34px] py-1 px-2.5 border-b border-b-[var(--border)] flex-none`,children:[(0,w.jsx)(s,{name:`zap`,size:13,color:`var(--accent-text)`}),(0,w.jsx)(`span`,{className:`text-[12px] font-[600] mr-1.5`,children:`Ichava DevTools`}),E.filter(e=>e.id!==`status`||a).map(e=>(0,w.jsx)(`button`,{onClick:()=>i(e.id),style:{height:24,padding:`0 9px`,border:`none`,backgroundColor:n===e.id?`var(--muted)`:`transparent`,color:n===e.id?`var(--fg)`:`var(--muted-fg)`,borderRadius:5,fontSize:11.5,fontWeight:n===e.id?600:500,cursor:`pointer`},children:e.label},e.id)),(0,w.jsx)(`span`,{className:`flex-1`}),b&&(0,w.jsx)(`span`,{className:`font-[family-name:'Geist_Mono',monospace] text-[10px] text-[var(--faint-fg)]`,children:`window.dispatchEvent → ichava:*`}),(0,w.jsx)(`div`,{role:`radiogroup`,"aria-label":`DevTools position`,className:`ml-2 flex items-center gap-0.5 rounded-[6px] border border-[var(--border)] p-0.5`,children:D.map(({id:e,label:t,Icon:n})=>(0,w.jsx)(`button`,{role:`radio`,"aria-checked":u===e,"aria-label":t,title:t,onClick:()=>p(e),className:`flex h-5 w-5 items-center justify-center rounded-[4px] border-0 cursor-pointer ${u===e?`bg-[var(--muted)] text-[var(--fg)]`:`bg-transparent text-[var(--muted-fg)]`}`,children:(0,w.jsx)(n,{"aria-hidden":`true`,className:`size-3.5`})},e))}),(0,w.jsx)(`button`,{onClick:c,title:`Close — ⇧⌘D / Esc`,className:`ml-2 w-6 h-6 border border-[var(--border)] bg-[var(--bg)] rounded-[5px] cursor-pointer flex items-center justify-center text-[var(--muted-fg)]`,children:(0,w.jsx)(s,{name:`close`,size:11,color:`currentColor`})})]}),(0,w.jsxs)(`div`,{className:`flex-1 overflow-auto p-3 font-[family-name:'Geist_Mono',monospace]`,children:[n===`events`&&(0,w.jsx)(M,{}),n===`state`&&(0,w.jsx)(N,{}),n===`storage`&&(0,w.jsx)(P,{}),n===`tests`&&(0,w.jsx)(F,{}),n===`logs`&&(0,w.jsx)(I,{}),n===`boot`&&(0,w.jsx)(L,{}),n===`status`&&a&&(0,w.jsx)(H,{url:a})]})]})}function j(e){try{return new Date(e).toLocaleTimeString()}catch{return String(e)}}function M(){let e=d(e=>e.devtools.events),t=d(e=>e.devtools.capturing),n=d(e=>e.setCapturing),r=d(e=>e.clearDevEvents);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(R,{children:[(0,w.jsxs)(z,{onClick:()=>n(!t),children:[t?`Pause`:`Resume`,` capture`]}),(0,w.jsx)(z,{onClick:r,children:`Clear log`}),(0,w.jsxs)(`span`,{className:`text-[var(--faint-fg)]`,children:[e.length,` events`]})]}),e.length===0?(0,w.jsx)(V,{children:`No events yet — interact with the app (sign in, share, toggle theme…).`}):e.map((e,t)=>(0,w.jsxs)(B,{children:[(0,w.jsx)(`span`,{className:`text-[var(--faint-fg)]`,children:j(e.ts)}),(0,w.jsx)(`span`,{className:`text-[var(--faint-fg)]`,children:e.source??`page`}),(0,w.jsx)(`span`,{className:`text-[var(--accent-text)] font-semibold`,children:e.label}),e.payload!=null&&(0,w.jsx)(`span`,{className:`text-[var(--muted-fg)]`,children:JSON.stringify(e.payload)})]},t))]})}function N(){let e=d(e=>e),t={theme:e.theme,view:e.view,accent:e.accent,size:e.size,sizeUnit:e.sizeUnit,gridStroke:e.gridStroke,color:e.color,treatment:e.treatment,filters:e.filters,auth:{status:e.auth.status,plan:e.auth.user?.plan??null},favorites:e.favorites.length,collections:e.collections.length,storageDriver:e.storageDriver,consent:e.consent};return(0,w.jsx)(`pre`,{className:`m-0 whitespace-pre-wrap text-[var(--fg)] text-[11.5px] leading-[1.55]`,children:JSON.stringify(t,null,2)})}function P(){let e=t(),r=f(),i=d(e=>e.storageDriver),a=d(e=>e.setStorageDriver),o=d(e=>e.factoryReset),s=d(e=>e.openConfirm);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`font-[600] mb-1.5`,children:`Frontend storage driver`}),(0,w.jsx)(`div`,{className:`inline-flex gap-0.5 border border-[var(--border)] rounded-[6px] p-0.5 mb-2.5`,children:[`local`,`session`].map(e=>(0,w.jsx)(`button`,{onClick:()=>a(e),style:{height:24,padding:`0 12px`,border:`none`,borderRadius:4,backgroundColor:i===e?`var(--accent-soft)`:`transparent`,color:i===e?`var(--color-text-brand-secondary)`:`var(--muted-fg)`,fontSize:11.5,fontWeight:600,cursor:`pointer`},children:e===`local`?`localStorage`:`sessionStorage`},e))}),(0,w.jsxs)(`div`,{className:`text-[11px] text-[var(--muted-fg)] leading-[1.5] mb-2.5 font-[family-name:'Geist',system-ui]`,children:[`State key `,(0,w.jsx)(`b`,{children:g}),` — appearance, filters, view, favorites, collections, auth, notifications, consent. Active driver: `,(0,w.jsx)(`b`,{children:v()}),`.`]}),(0,w.jsxs)(R,{children:[(0,w.jsx)(z,{onClick:()=>r(JSON.stringify(e.getState(),(e,t)=>e===`catalog`||e===`filtersData`?void 0:t),`State JSON copied`),children:`Copy state JSON`}),(0,w.jsx)(z,{onClick:()=>s({title:`Reset stored state?`,body:`Clears the persisted snapshot from the active storage driver and restores factory defaults.`,confirmLabel:`Reset state`,danger:!0,onConfirm:()=>{n(),o()}}),children:`Reset stored state…`})]})]})}function F(){let e=t(),n=d(e=>e.catalog),r=d(e=>e.config),[i,a]=(0,C.useState)(null),o=i?.filter(e=>e.pass).length??0,l=i?.length??0;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(R,{children:[(0,w.jsx)(z,{onClick:()=>a(c(n,r,e)),primary:!0,children:`Run full regression`}),i&&(0,w.jsxs)(`span`,{style:{color:o===l?`var(--success)`:`var(--danger)`,fontWeight:600},children:[o,` passed · `,l-o,` failed`]}),(0,w.jsx)(`span`,{className:`text-[var(--faint-fg)] font-[family-name:'Geist',system-ui]`,children:`Covers catalog, pagination, snippets, treatments, config, store invariants`})]}),i?.map((e,t)=>(0,w.jsxs)(B,{children:[(0,w.jsx)(s,{name:e.pass?`check`:`close`,size:12,color:e.pass?`var(--success)`:`var(--danger)`}),(0,w.jsx)(`span`,{className:`text-[var(--fg)]`,children:e.name}),e.detail&&!e.pass&&(0,w.jsx)(`span`,{className:`text-[var(--danger)]`,children:e.detail})]},t))]})}function I(){let e=m(),[t,n]=(0,C.useState)(0),r=(0,C.useRef)(`all`);(0,C.useEffect)(()=>e.subscribe(()=>n(e=>e+1)),[e]);let i=(0,C.useMemo)(()=>e.buffer(),[e,t]),a=f();return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(R,{children:[(0,w.jsx)(z,{onClick:()=>{e.clear(),n(e=>e+1)},children:`Clear`}),(0,w.jsx)(z,{onClick:()=>a(JSON.stringify(i,null,2),`Logs copied`),children:`Export JSON`}),(0,w.jsxs)(`span`,{className:`text-[var(--faint-fg)]`,children:[i.length,` entries · level `,e.getLevel()]})]}),i.length===0?(0,w.jsx)(V,{children:`No log entries.`}):i.slice().reverse().map((e,t)=>(0,w.jsxs)(B,{children:[(0,w.jsx)(`span`,{className:`text-[var(--faint-fg)]`,children:j(e.ts)}),(0,w.jsx)(`span`,{style:{color:e.level===`error`?`var(--danger)`:e.level===`warn`?`var(--warning)`:`var(--muted-fg)`,fontWeight:600,minWidth:40},children:e.level}),(0,w.jsx)(`span`,{className:`text-[var(--faint-fg)]`,children:e.source??`page`}),(0,w.jsx)(`span`,{className:`text-[var(--accent-text)]`,children:e.channel}),(0,w.jsx)(`span`,{className:`text-[var(--fg)]`,children:e.message})]},t)),(0,w.jsx)(`button`,{hidden:!0,onClick:()=>r.current=`all`})]})}function L(){let e=d(e=>e.boot),t=()=>{let e=window.ichavaBoot;e&&e.retry()},n=e=>{window.ichavaBoot?.[e]?.(!0)};return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(R,{children:[(0,w.jsx)(z,{onClick:t,children:`Replay boot`}),(0,w.jsx)(z,{onClick:()=>n(`simSlow`),children:`Sim slow`}),(0,w.jsx)(z,{onClick:()=>n(`simOffline`),children:`Sim offline`})]}),(0,w.jsxs)(B,{children:[(0,w.jsx)(`span`,{className:`text-[var(--faint-fg)]`,children:`phase`}),(0,w.jsx)(`span`,{className:`text-[var(--accent-text)] font-semibold`,children:e.phase})]}),(0,w.jsxs)(B,{children:[(0,w.jsx)(`span`,{className:`text-[var(--faint-fg)]`,children:`progress`}),(0,w.jsxs)(`span`,{className:`text-[var(--fg)]`,children:[e.progress,`%`]})]}),(0,w.jsxs)(B,{children:[(0,w.jsx)(`span`,{className:`text-[var(--faint-fg)]`,children:`label`}),(0,w.jsx)(`span`,{className:`text-[var(--fg)]`,children:e.label||`—`})]}),(0,w.jsxs)(B,{children:[(0,w.jsx)(`span`,{className:`text-[var(--faint-fg)]`,children:`done`}),(0,w.jsx)(`span`,{className:`text-[var(--fg)]`,children:String(e.done)})]})]})}function R({children:e}){return(0,w.jsx)(`div`,{className:`flex items-center gap-2 mb-2.5`,children:e})}function z({children:e,onClick:t,primary:n}){return(0,w.jsx)(`button`,{onClick:t,style:{height:26,padding:`0 10px`,border:n?`none`:`1px solid var(--border)`,borderRadius:5,backgroundColor:n?`var(--accent)`:`var(--bg)`,color:n?`var(--accent-fg)`:`var(--fg)`,fontSize:11.5,fontWeight:600,cursor:`pointer`,fontFamily:`'Geist',system-ui`},children:e})}function B({children:e}){return(0,w.jsx)(`div`,{className:`flex items-center gap-2 py-0.5 px-0 text-[11.5px]`,children:e})}function V({children:e}){return(0,w.jsx)(`div`,{className:`text-[var(--faint-fg)] font-[family-name:'Geist',system-ui] py-2 px-0`,children:e})}function H({url:e}){let[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(0);if((0,C.useEffect)(()=>{let t=!0;return p().request(e,{baseUrl:``}).then(e=>{t&&(n(e.data),i(null))}).catch(e=>{t&&i(String(e))}),()=>{t=!1}},[e,a]),r)return(0,w.jsxs)(`div`,{className:`text-[var(--danger)] text-[11.5px]`,children:[`Status unavailable: `,r]});if(!t)return(0,w.jsx)(`div`,{className:`text-[var(--muted-fg)] text-[11.5px]`,children:`Loading status…`});let s=[[`Packs registered`,String(t.registry.packages)],[`Conflicts`,String(t.registry.conflicts.length)],[`Orphaned packs`,String(t.orphans.length)],[`Watcher last scan`,t.watcher.lastScan??`never`],[`Render optimisation`,t.render.optimizationLevel]];return(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsx)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 m-0 text-[11.5px]`,children:s.map(([e,t])=>(0,w.jsxs)(`div`,{className:`contents`,children:[(0,w.jsx)(`dt`,{className:`text-[var(--muted-fg)]`,children:e}),(0,w.jsx)(`dd`,{className:`m-0 font-[family-name:'Geist_Mono',monospace]`,children:t})]},e))}),(0,w.jsx)(`div`,{children:(0,w.jsx)(z,{onClick:()=>o(e=>e+1),children:`Refresh`})}),(0,w.jsx)(`pre`,{className:`m-0 whitespace-pre-wrap text-[var(--fg)] text-[11px] leading-[1.5]`,children:JSON.stringify(t,null,2)})]})}export{A as DevToolsPanel}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-FlashBanner-rWYabYjl.js b/public/assets/js/inertia-app-FlashBanner-rWYabYjl.js new file mode 100644 index 0000000..26e163b --- /dev/null +++ b/public/assets/js/inertia-app-FlashBanner-rWYabYjl.js @@ -0,0 +1 @@ +import{Wt as e}from"./inertia-app.js";import{t}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var n=t();function r(){let{flash:t}=e().props;return!t?.success&&!t?.error?null:(0,n.jsxs)(`div`,{className:`mb-4 space-y-2`,children:[t.success&&(0,n.jsx)(`div`,{className:`rounded-lg border border-green-500/30 bg-green-500/10 px-4 py-2 text-sm text-green-400`,children:t.success}),t.error&&(0,n.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-sm text-red-400`,children:t.error})]})}export{r as t}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-IconGrid-DDgKzP68.js b/public/assets/js/inertia-app-IconGrid-DDgKzP68.js new file mode 100644 index 0000000..89e8a5d --- /dev/null +++ b/public/assets/js/inertia-app-IconGrid-DDgKzP68.js @@ -0,0 +1 @@ +import{Ht as e}from"./inertia-app.js";import{t}from"./inertia-app-IconImage-DrJ-WGz6.js";import{t as n}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var r=n();function i({icons:n,showBase:i,emptyHint:a}){return n.length===0?(0,r.jsx)(`p`,{className:`theme-text-muted mt-8 text-sm`,children:a}):(0,r.jsx)(`div`,{className:`mt-6 grid grid-cols-4 gap-3 sm:grid-cols-6 md:grid-cols-8`,children:n.map(n=>(0,r.jsxs)(e,{href:`${i}/${n.id}`,className:`theme-bg-card theme-bg-card-hover rounded-lg border theme-border flex flex-col items-center gap-1 p-3 theme-transition`,children:[(0,r.jsx)(t,{icon:n,size:32}),(0,r.jsx)(`span`,{className:`theme-text-muted w-full truncate text-center text-[11px]`,children:n.name})]},n.id))})}export{i as t}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-IconImage-DrJ-WGz6.js b/public/assets/js/inertia-app-IconImage-DrJ-WGz6.js new file mode 100644 index 0000000..57149d9 --- /dev/null +++ b/public/assets/js/inertia-app-IconImage-DrJ-WGz6.js @@ -0,0 +1 @@ +import{lt as e}from"./inertia-app.js";import{t}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var n=t();function r({icon:t,size:r,label:i}){let a=e.toStyle(e.resolve(t,null),r);return(0,n.jsx)(`span`,{role:i?`img`:void 0,"aria-label":i,"aria-hidden":!i||void 0,style:{display:`inline-block`,flex:`none`,...a}})}export{r as t}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-Index-9ZaPeB2l.js b/public/assets/js/inertia-app-Index-9ZaPeB2l.js new file mode 100644 index 0000000..b271184 --- /dev/null +++ b/public/assets/js/inertia-app-Index-9ZaPeB2l.js @@ -0,0 +1 @@ +import{Wt as e}from"./inertia-app.js";import{t}from"./inertia-app-FlashBanner-rWYabYjl.js";import{t as n}from"./inertia-app-useInertiaMutations-ByVkwCnP.js";import{t as r}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var i=r();function a(){let{props:r}=e(),{clearCache:a,rebuildCache:o}=n(),s=r.statistics,c=Array.isArray(r.updateStatus)?r.updateStatus:r.updateStatus?.rows??[],l=[[`Icons`,s?.total_icons??`—`],[`Packages`,s?.total_packages??`—`],[`Categories`,s?.total_categories??`—`],[`Variants`,s?.total_variants??`—`]];return(0,i.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,i.jsxs)(`div`,{className:`mx-auto max-w-5xl`,children:[(0,i.jsx)(`p`,{className:`theme-text-muted text-xs uppercase`,children:`Dashboard`}),(0,i.jsx)(`h1`,{className:`mt-1 text-2xl font-semibold`,children:`Statistics`}),(0,i.jsx)(t,{}),(0,i.jsx)(`dl`,{className:`mt-6 grid grid-cols-2 gap-4 lg:grid-cols-4`,children:l.map(([e,t])=>(0,i.jsxs)(`div`,{className:`theme-bg-card rounded-lg border theme-border p-4`,children:[(0,i.jsx)(`dt`,{className:`theme-text-muted text-xs uppercase`,children:e}),(0,i.jsx)(`dd`,{className:`text-xl font-semibold`,children:t})]},e))}),(0,i.jsxs)(`div`,{className:`mt-8 grid gap-8 lg:grid-cols-2`,children:[(0,i.jsxs)(`section`,{children:[(0,i.jsxs)(`h2`,{className:`text-lg font-semibold`,children:[`Packages (`,r.packageStats.length,`)`]}),(0,i.jsx)(`ul`,{className:`mt-3 space-y-2`,children:r.packageStats.map(e=>(0,i.jsxs)(`li`,{className:`theme-bg-card rounded-lg border theme-border px-4 py-3`,children:[(0,i.jsx)(`p`,{className:`font-medium text-sm`,children:e.label||e.name}),(0,i.jsxs)(`p`,{className:`theme-text-muted mt-0.5 font-mono text-[11px]`,children:[e.icon_count,` icons · `,e.category_count,` categories · `,e.variant_count,` variants`]})]},e.name))})]}),(0,i.jsxs)(`div`,{className:`space-y-8`,children:[(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Top categories`}),(0,i.jsx)(`ul`,{className:`mt-3 space-y-1.5`,children:r.topCategories.map(e=>(0,i.jsxs)(`li`,{className:`theme-text-secondary flex items-center justify-between text-sm`,children:[(0,i.jsx)(`span`,{children:e.name}),(0,i.jsx)(`span`,{className:`theme-text-muted font-mono text-xs`,children:e.icon_count})]},`${e.package}/${e.slug}`))}),r.topCategories.length===0&&(0,i.jsx)(`p`,{className:`theme-text-muted text-sm`,children:`None yet.`})]}),(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Cache`}),(0,i.jsx)(`p`,{className:`mt-2 text-sm`,children:(0,i.jsx)(`span`,{className:`font-medium ${r.cacheHealthy?`text-green-400`:`text-red-400`}`,children:r.cacheHealthy?`Healthy`:`Unhealthy`})}),(0,i.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,i.jsx)(`button`,{onClick:a,className:`theme-bg-muted theme-text-secondary rounded-md px-3 py-1.5 text-xs font-medium`,children:`Clear cache`}),(0,i.jsx)(`button`,{onClick:()=>{window.confirm(`Rebuild the icon cache? Stored preferences will be reset.`)&&o()},className:`rounded-md border border-red-500/40 px-3 py-1.5 text-xs font-medium text-red-400`,children:`Rebuild cache`})]})]}),c.length>0&&(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Pack updates`}),(0,i.jsx)(`ul`,{className:`mt-3 space-y-1.5`,children:c.map((e,t)=>(0,i.jsxs)(`li`,{className:`theme-text-secondary flex items-center justify-between text-sm`,children:[(0,i.jsx)(`span`,{className:`font-mono text-xs`,children:e.package??`unknown`}),(0,i.jsxs)(`span`,{className:`theme-text-muted font-mono text-xs`,children:[e.current??`?`,` → `,e.latest??`?`,` · `,e.status??`?`]})]},`${e.package??`pack`}-${t}`))})]})]})]})]})})}export{a as default}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-Index-CPQuKRdb.js b/public/assets/js/inertia-app-Index-CPQuKRdb.js new file mode 100644 index 0000000..394e3d0 --- /dev/null +++ b/public/assets/js/inertia-app-Index-CPQuKRdb.js @@ -0,0 +1 @@ +import{Wt as e}from"./inertia-app.js";import{t}from"./inertia-app-FlashBanner-rWYabYjl.js";import{t as n}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var r=n();function i(){let{props:n}=e();return(0,r.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,r.jsxs)(`div`,{className:`mx-auto max-w-3xl`,children:[(0,r.jsx)(`p`,{className:`theme-text-muted text-xs uppercase`,children:`Activity`}),(0,r.jsxs)(`h1`,{className:`mt-1 text-2xl font-semibold`,children:[`Command history (`,n.count,`)`]}),(0,r.jsx)(t,{}),n.commands.length===0?(0,r.jsx)(`p`,{className:`theme-text-muted mt-8 text-sm`,children:`Nothing here yet. Command palette runs land here.`}):(0,r.jsx)(`ul`,{className:`mt-6 space-y-2`,children:n.commands.map((e,t)=>(0,r.jsxs)(`li`,{className:`theme-bg-card rounded-lg border theme-border flex items-center gap-3 px-4 py-2.5`,children:[(0,r.jsx)(`span`,{className:`theme-text-primary font-mono text-sm`,children:e.command}),(0,r.jsx)(`span`,{className:`theme-bg-muted theme-text-secondary rounded px-2 py-0.5 font-mono text-[11px]`,children:e.type}),(0,r.jsx)(`span`,{className:`flex-1`}),(0,r.jsx)(`span`,{className:`theme-text-muted text-xs`,children:e.formatted_time??e.timestamp??``})]},`${e.command}-${t}`))})]})})}export{i as default}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-Index-DExngZR3.js b/public/assets/js/inertia-app-Index-DExngZR3.js new file mode 100644 index 0000000..8962995 --- /dev/null +++ b/public/assets/js/inertia-app-Index-DExngZR3.js @@ -0,0 +1 @@ +import{i as e,o as t,t as n}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";import{Ht as r,Wt as i,ot as a}from"./inertia-app.js";import{t as o}from"./inertia-app-IconImage-DrJ-WGz6.js";import{t as s}from"./inertia-app-FlashBanner-rWYabYjl.js";import{t as c}from"./inertia-app-propsToCatalog-BMfZFXhT.js";var l=t(e(),1),u=n();function d(){let{props:e}=i(),t=`/${e.ichava.prefix}/icons`,n=(0,l.useMemo)(()=>e.history.map(e=>({...e,icon:e.icon?a(c(e.icon)):null})),[e.history]);return(0,u.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,u.jsxs)(`div`,{className:`mx-auto max-w-3xl`,children:[(0,u.jsx)(`p`,{className:`theme-text-muted text-xs uppercase`,children:`Activity`}),(0,u.jsxs)(`h1`,{className:`mt-1 text-2xl font-semibold`,children:[`History (`,e.count,`)`]}),(0,u.jsx)(s,{}),n.length===0?(0,u.jsx)(`p`,{className:`theme-text-muted mt-8 text-sm`,children:`Nothing here yet. Viewed, copied and downloaded icons land here.`}):(0,u.jsx)(`ul`,{className:`mt-6 space-y-2`,children:n.map((e,n)=>(0,u.jsxs)(`li`,{className:`theme-bg-card rounded-lg border theme-border flex items-center gap-3 px-4 py-2.5`,children:[e.icon?(0,u.jsx)(r,{href:`${t}/${e.icon_id}`,className:`flex-shrink-0`,"aria-label":e.icon?.name??`#${e.icon_id}`,children:(0,u.jsx)(o,{icon:e.icon,size:24})}):(0,u.jsxs)(`span`,{className:`theme-text-muted font-mono text-xs`,children:[`#`,e.icon_id]}),(0,u.jsx)(`span`,{className:`theme-text-secondary text-sm capitalize`,children:e.action}),(0,u.jsx)(`span`,{className:`flex-1`}),(0,u.jsx)(`span`,{className:`theme-text-muted text-xs`,children:e.formatted_time??e.timestamp??``})]},`${e.icon_id}-${e.action}-${n}`))})]})})}export{d as default}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-Index-DMAKzwsZ.js b/public/assets/js/inertia-app-Index-DMAKzwsZ.js new file mode 100644 index 0000000..be8003c --- /dev/null +++ b/public/assets/js/inertia-app-Index-DMAKzwsZ.js @@ -0,0 +1 @@ +import{Ht as e,Ut as t,Wt as n}from"./inertia-app.js";import{t as r}from"./inertia-app-FlashBanner-rWYabYjl.js";import{t as i}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var a=i(),o=`theme-bg-input rounded-md border theme-border px-2.5 py-1.5 text-sm theme-text-primary w-full`,s=`theme-text-muted text-xs font-medium uppercase`;function c(){let{props:i}=n(),c=i.preferences??{},{data:l,setData:u,put:d,processing:f,errors:p,recentlySuccessful:m}=t({preferences:{view_mode:c.preferences?.view_mode??`grid`,icon_size:c.preferences?.icon_size??48,per_page:c.preferences?.per_page??60},sorting:{sort_by:c.sorting?.sort_by??`name`,sort_direction:c.sorting?.sort_direction??`asc`}}),h=e=>{e.preventDefault(),d(i.ichava.routes.settings,{preserveState:!0})},g=p,_=e=>g[e]?(0,a.jsx)(`p`,{className:`mt-1 text-xs text-red-400`,children:g[e]}):null;return(0,a.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,a.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,a.jsx)(`p`,{className:`theme-text-muted text-xs uppercase`,children:`Configuration`}),(0,a.jsx)(`h1`,{className:`mt-1 text-2xl font-semibold`,children:`Settings`}),(0,a.jsx)(r,{}),(0,a.jsxs)(`form`,{onSubmit:h,className:`theme-bg-card mt-6 rounded-xl border theme-border space-y-5 p-6`,children:[(0,a.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`label`,{className:s,htmlFor:`view-mode`,children:`View mode`}),(0,a.jsxs)(`select`,{id:`view-mode`,className:`${o} mt-1.5`,value:l.preferences.view_mode,onChange:e=>u(`preferences.view_mode`,e.target.value),children:[(0,a.jsx)(`option`,{value:`grid`,children:`Grid`}),(0,a.jsx)(`option`,{value:`list`,children:`List`})]}),_(`preferences.view_mode`)]}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`label`,{className:s,htmlFor:`icon-size`,children:`Icon size (px)`}),(0,a.jsx)(`input`,{id:`icon-size`,type:`number`,min:24,max:640,className:`${o} mt-1.5`,value:l.preferences.icon_size,onChange:e=>u(`preferences.icon_size`,Number(e.target.value))}),_(`preferences.icon_size`)]}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`label`,{className:s,htmlFor:`per-page`,children:`Results per page`}),(0,a.jsx)(`input`,{id:`per-page`,type:`number`,min:12,max:120,className:`${o} mt-1.5`,value:l.preferences.per_page,onChange:e=>u(`preferences.per_page`,Number(e.target.value))}),_(`preferences.per_page`)]}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`label`,{className:s,htmlFor:`sort-by`,children:`Sort by`}),(0,a.jsxs)(`select`,{id:`sort-by`,className:`${o} mt-1.5`,value:l.sorting.sort_by,onChange:e=>u(`sorting.sort_by`,e.target.value),children:[(0,a.jsx)(`option`,{value:`name`,children:`Name`}),(0,a.jsx)(`option`,{value:`package`,children:`Package`}),(0,a.jsx)(`option`,{value:`category`,children:`Category`}),(0,a.jsx)(`option`,{value:`created_at`,children:`Newest`})]}),_(`sorting.sort_by`)]}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`label`,{className:s,htmlFor:`sort-direction`,children:`Direction`}),(0,a.jsxs)(`select`,{id:`sort-direction`,className:`${o} mt-1.5`,value:l.sorting.sort_direction,onChange:e=>u(`sorting.sort_direction`,e.target.value),children:[(0,a.jsx)(`option`,{value:`asc`,children:`Ascending`}),(0,a.jsx)(`option`,{value:`desc`,children:`Descending`})]}),_(`sorting.sort_direction`)]})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,a.jsx)(`button`,{type:`submit`,disabled:f,className:`theme-bg-accent theme-text-inverse rounded-md px-4 py-2 text-sm font-semibold disabled:opacity-50`,children:f?`Saving…`:`Save settings`}),m&&(0,a.jsx)(`span`,{className:`text-sm text-green-400`,children:`Saved.`}),(0,a.jsx)(`span`,{className:`flex-1`}),(0,a.jsx)(e,{href:i.ichava.routes.browser,className:`theme-text-accent theme-link text-sm`,children:`← Back to browser`})]})]})]})})}export{c as default}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-Index-DMnnMnUN.js b/public/assets/js/inertia-app-Index-DMnnMnUN.js new file mode 100644 index 0000000..d4f0e99 --- /dev/null +++ b/public/assets/js/inertia-app-Index-DMnnMnUN.js @@ -0,0 +1 @@ +import{Ht as e,Wt as t}from"./inertia-app.js";import{t as n}from"./inertia-app-FlashBanner-rWYabYjl.js";import{t as r}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var i=r();function a(){let{props:r}=t();return(0,i.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,i.jsxs)(`div`,{className:`mx-auto max-w-5xl`,children:[(0,i.jsx)(`p`,{className:`theme-text-muted text-xs uppercase`,children:`Icon packages`}),(0,i.jsxs)(`h1`,{className:`mt-1 text-2xl font-semibold`,children:[`Packages (`,r.packages.length,`)`]}),(0,i.jsx)(n,{}),(0,i.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:r.packages.map(t=>(0,i.jsxs)(e,{href:`${r.ichava.routes.packages}/${t.name}`,className:`theme-bg-card theme-bg-card-hover rounded-xl border theme-border p-5 theme-transition`,children:[(0,i.jsx)(`h2`,{className:`font-semibold`,children:t.label||t.name}),(0,i.jsx)(`p`,{className:`theme-text-muted mt-0.5 font-mono text-xs`,children:t.name}),t.description&&(0,i.jsx)(`p`,{className:`theme-text-secondary mt-2 text-sm`,children:t.description}),(0,i.jsxs)(`p`,{className:`theme-text-accent mt-3 text-sm font-medium`,children:[t.count,` icons`]})]},t.name))}),r.packages.length===0&&(0,i.jsx)(`p`,{className:`theme-text-muted mt-8 text-sm`,children:`No icon packages registered.`})]})})}export{a as default}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-Index-DQn8r5k7.js b/public/assets/js/inertia-app-Index-DQn8r5k7.js new file mode 100644 index 0000000..6df5328 --- /dev/null +++ b/public/assets/js/inertia-app-Index-DQn8r5k7.js @@ -0,0 +1 @@ +import{Ht as e,Wt as t}from"./inertia-app.js";import{t as n}from"./inertia-app-FlashBanner-rWYabYjl.js";import{t as r}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var i=r();function a(){let{props:r}=t();return(0,i.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,i.jsxs)(`div`,{className:`mx-auto max-w-5xl`,children:[(0,i.jsx)(`p`,{className:`theme-text-muted text-xs uppercase`,children:`Library`}),(0,i.jsxs)(`h1`,{className:`mt-1 text-2xl font-semibold`,children:[`Collections (`,r.collections.length,`)`]}),(0,i.jsx)(n,{}),(0,i.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:r.collections.map(t=>(0,i.jsxs)(e,{href:`${r.ichava.routes.collections}/${t.id}`,className:`theme-bg-card theme-bg-card-hover rounded-xl border theme-border p-5 theme-transition`,children:[(0,i.jsx)(`h2`,{className:`font-semibold`,children:t.name}),(0,i.jsxs)(`p`,{className:`theme-text-accent mt-2 text-sm font-medium`,children:[t.icons.length,` icon`,t.icons.length===1?``:`s`]})]},t.id))}),r.collections.length===0&&(0,i.jsx)(`p`,{className:`theme-text-muted mt-8 text-sm`,children:`No collections yet. Group icons into named sets from the browser.`})]})})}export{a as default}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-Index-kr7MdfMI.js b/public/assets/js/inertia-app-Index-kr7MdfMI.js new file mode 100644 index 0000000..cea3991 --- /dev/null +++ b/public/assets/js/inertia-app-Index-kr7MdfMI.js @@ -0,0 +1 @@ +import{i as e,o as t,t as n}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";import{A as r,Ft as i,Gt as a,It as o,Vt as s,Wt as c,gt as l,kt as u,ot as d,y as f}from"./inertia-app.js";import{n as p,r as m,t as h}from"./inertia-app-propsToCatalog-BMfZFXhT.js";import{n as g,t as _}from"./inertia-app-useInertiaMutations-ByVkwCnP.js";var v=t(e(),1);function y({store:e}){let{flash:t}=c().props,n=(0,v.useRef)(new Set);return(0,v.useEffect)(()=>{for(let[r,i]of Object.entries(t??{})){if(typeof i!=`string`||!i)continue;let t=`${r}:${i}`;n.current.has(t)||(n.current.add(t),e.getState().showToast(i,r===`error`?`alert-circle`:`check`))}},[t,e]),null}var b=[`name`,`package`,`category`],x=10,S=120;function C(e){let t=e.search.trim();return{search:t.length>=2?t:void 0,packages:e.packages.length?e.packages:void 0,categories:e.categories.length?e.categories:void 0,variants:e.variant?[e.variant]:void 0,sort_by:e.sortBy,sort_direction:e.sortOrder,page:e.page,per_page:Math.max(x,Math.min(e.perPage,S))}}function w(e){let t=(e.search??``).trim();return{search:t.length>=2?t:void 0,packages:e.packages?.length?e.packages:void 0,categories:e.categories?.length?e.categories:void 0,variants:e.variants?.length?e.variants:void 0,sort_by:e.sortBy??`name`,sort_direction:e.sortDirection??`asc`,page:e.page??1,per_page:Math.max(x,Math.min(e.perPage??60,S))}}function T(e){return!e||Object.keys(e).length===0?null:{search:e.search||void 0,packages:e.packages?.length?e.packages:void 0,categories:e.categories?.length?e.categories:void 0,variants:e.variants?.length?e.variants:void 0,sort_by:e.sort_by,sort_direction:e.sort_direction,page:e.page,per_page:e.per_page}}function E(e){return e?JSON.stringify(e):``}function D(e){let t=b.includes(e.sort_by)?e.sort_by:`name`;return{search:e.search??``,packages:e.packages??[],categories:e.categories??[],variant:e.variants?.[0]??null,sortBy:t,sortOrder:e.sort_direction===`desc`?`desc`:`asc`,page:e.page??1,perPage:e.per_page??60}}function O(e,t){if(!t||Object.keys(t).length===0)return;let n=D(t);e.setState(e=>({filters:{...e.filters,...n}}))}function k(e,t){let n=E(T(t)),r=(0,v.useRef)(n),i=(0,v.useMemo)(()=>t,[n]);(0,v.useEffect)(()=>{n!==r.current&&(r.current=n,n!==E(C(e.getState().filters))&&O(e,i))},[n,i,e])}var A=[`icons`,`pagination`,`appliedFilters`,`tree`,`favorites`,`collections`,`history`,`commandHistory`],j=()=>new DOMException(`The visit was cancelled.`,`AbortError`),M=(e,t,n)=>new Promise((r,i)=>{if(n?.aborted){i(j());return}let o=!1,s=null,c=()=>s?.();n?.addEventListener(`abort`,c,{once:!0});let l=e=>{o||(o=!0,n?.removeEventListener(`abort`,c),e())};a.get(e,t,{preserveState:!0,preserveScroll:!0,replace:!0,only:A,onCancelToken:e=>{s=()=>e.cancel()},onSuccess:e=>l(()=>r(e.props)),onError:e=>l(()=>i(Error(Object.values(e).join(` `)||`The server rejected the filters.`))),onCancel:()=>l(()=>i(j())),onFinish:()=>l(()=>i(j()))})});function N(e){let t=e.pagination;return{items:e.icons.map(e=>d(h(e))),total:t.total,page:t.current_page,perPage:t.per_page,lastPage:t.last_page,rangeStart:t.from??0,rangeEnd:t.to??0}}function P(e){if(!e)return``;let{categories:t,subs:n,page:r,per_page:i,sort_by:a,sort_direction:o,...s}=e;return E(s)}function F(e){return{...m(e),...e.kind===`icon`||e.kind===`illustration`?{kind:e.kind}:{},...e.default===!0?{default:!0}:{}}}function I(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))Array.isArray(r)&&(t[n]=r.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.slug==`string`?[{slug:t.slug,label:typeof t.label==`string`&&t.label?t.label:t.slug,description:typeof t.description==`string`?t.description:``,default:t.default===!0}]:[]}));return t}function L(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e,n=typeof t.name==`string`?t.name:typeof t.slug==`string`?t.slug:null;return n?[{id:typeof t.id==`number`||typeof t.id==`string`?t.id:n,name:n,label:typeof t.label==`string`?t.label:n,count:typeof t.count==`number`?t.count:typeof t.icon_count==`number`?t.icon_count:0,...typeof t.package==`string`?{package:t.package}:{}}]:[]}):[]}var R=class{#e;#t;#n;#r=new Map;#i=null;constructor(e,t){this.#e=t.url,this.#t=t.visit??M,this.#n=e,this.#a(e)}update(e){let t={...this.#n,...e};Array.isArray(t.icons)&&t.pagination&&(this.#n=t,this.#a(t))}#a(e){for(let t of e.icons??[]){let e=d(h(t));this.#r.set(e.id,e)}}#o(){let e=this.#n.appliedFilters;return E(Array.isArray(e)?null:T(e))}async#s(e,t){let n=E(e);if(n===this.#o())return;let r=this.#i;if(r?.key===n){try{await r.promise}catch(e){if(t?.aborted)throw e}if(n===this.#o())return}let i=this.#t(this.#e,e,t).then(e=>this.update(e));this.#i={key:n,promise:i};try{await i}finally{this.#i?.promise===i&&(this.#i=null)}}async listIcons(e,t){if(await this.#s(w(e),t),t?.aborted)throw j();return N(this.#n)}async getIcon(e){return this.#r.get(e)??null}async getSvg(e,t){if(e.svgContent)return e.svgContent;if(!e.svgUrl)return``;let n=await fetch(e.svgUrl,{credentials:`same-origin`,signal:t});return n.ok?n.text():``}async getFilters(){let e=this.#n.filterOptions??{};return{packages:(Array.isArray(e.packages)?e.packages:this.#n.packages??[]).filter(e=>e&&typeof e.name==`string`).map(m),categories:L(e.categories),variants:L(e.variants)}}async getStatistics(){let e=this.#n.statistics;return e&&typeof e==`object`?e:{}}async getTree(){return p(this.#n.tree)}async getTreeFor(e,t){let n=w(e),r=this.#n.appliedFilters;if(P(n)!==P(Array.isArray(r)?null:T(r))&&await this.#s(n,t),t?.aborted)throw j();return p(this.#n.tree)}async getCatalogMeta(){let e=this.#n.filterOptions??{};return{packages:(this.#n.packages??(Array.isArray(e.packages)?e.packages:[])).filter(e=>e&&typeof e.name==`string`).map(F),variantsByPackage:I(e.variants_by_package)}}async getRelated(e,t=6){let n=[];for(let r of this.#r.values())if(r.id!==e.id&&r.category===e.category&&n.push(r),n.length>=t)break;return n}async getVariantCounts(){let e=await this.getFilters();return new Map(e.variants.map(e=>[e.name,e.count]))}};function z(e){let t=e?.ichava??null,n=s({auth:e?.auth??null,ichava:t});return l(l(V(t),B(e?.packages)),n)}function B(e){let t=(e??[]).map(e=>e.name).filter(e=>typeof e==`string`&&e!==``);return t.length?{defaults:{packages:t}}:{}}function V(e){let t=e?.snippets&&Object.keys(e.snippets).length?{snippets:e.snippets}:{},n=e?.ui;if(!n)return t;let r=[...n.links];return n.docsUrl&&!r.some(e=>e.label.toLowerCase()===`docs`)&&r.push({label:`Docs`,href:n.docsUrl}),{meta:{license:n.license,...n.version?{version:n.version}:{}},about:{links:r},...t}}var H=new WeakSet;function U(e){return H.has(e)}function W(e,t){let n={};if(t.favorites&&(n.favorites=t.favorites.map(Number)),t.collections&&(n.collections=t.collections.map(e=>({id:String(e.id),name:String(e.name??``),icons:(e.icon_ids??[]).map(Number)}))),t.history&&(n.history=t.history.map(e=>{let t=String(e.action??`view`);return{id:Number(e.icon_id),action:g[t]??t,ts:e.timestamp&&Date.parse(e.timestamp)||Date.now()}})),Object.keys(n).length!==0){H.add(e);try{e.setState(n)}finally{H.delete(e)}}}function G(e,t){let n=new R({icons:e.icons??[],pagination:e.pagination,appliedFilters:e.appliedFilters,tree:e.tree,packages:e.packages,filterOptions:e.filterOptions,statistics:e.statistics},t),a=r().rest(n).config(i(z(e))).persist(o.storageKeys.persist).toProps(),s=a.store;if(!s)throw Error(`createBrowserMount: browser().persist() returned no store.`);let c=Array.isArray(e.appliedFilters)?null:e.appliedFilters;O(s,c),W(s,e);let l=s.subscribe((e,t)=>{e.config&&!t.config&&(l(),O(s,c))});return{client:n,store:s,props:{...a,manageDocument:!0}}}function K(e,t){let{icons:n,pagination:r,appliedFilters:i,tree:a,favorites:o,collections:s,history:c}=t;(0,v.useEffect)(()=>{e.client.update({icons:n,pagination:r,appliedFilters:i,tree:a})},[e,n,r,i,a]),(0,v.useEffect)(()=>{W(e.store,{favorites:o,collections:s,history:c})},[e,o,s,c])}function q(e,t){switch(t.kind){case`favorite.add`:e.addFavorite(t.iconId);return;case`favorite.remove`:e.removeFavorite(t.iconId);return;case`history.record`:e.pushHistory(t.iconId,t.action);return;case`history.clear`:e.clearHistory();return;case`collection.create`:e.createCollection(t.name,t.icons);return;case`collection.rename`:e.updateCollection(t.id,{name:t.name});return;case`collection.delete`:e.deleteCollection(t.id);return;case`collection.add`:e.addToCollection(t.id,t.iconId);return;case`collection.remove`:e.removeFromCollection(t.id,t.iconId);return;case`command.log`:e.logCommand(t.command,`action`);return;case`command.clear`:e.clearCommands();return;case`library.delete`:e.deleteLibrary();return}}function J(e,t){let n=u(e,t),r=new Set(n.flatMap(e=>e.kind===`collection.create`?[e.id]:[]));return r.size?n.filter(e=>e.kind!==`collection.add`&&e.kind!==`collection.remove`||!r.has(e.id)):n}function Y(e,t){let n=(0,v.useRef)(t);(0,v.useLayoutEffect)(()=>{n.current=t}),(0,v.useEffect)(()=>e.subscribe((t,r)=>{if(!U(e))for(let e of J(r,t))q(n.current,e)}),[e])}var X=n();function Z(){let{props:e}=c(),[t]=(0,v.useState)(()=>G(e,{url:window.location.pathname}));return K(t,e),k(t.store,Array.isArray(e.appliedFilters)?null:e.appliedFilters),Y(t.store,_()),(0,X.jsxs)(`div`,{"data-ichava-page":`browser`,style:{height:`100dvh`,display:`flex`,flexDirection:`column`},children:[(0,X.jsx)(y,{store:t.store}),(0,X.jsx)(f,{...t.props})]})}export{Z as default}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-Index-n51e0Xvm.js b/public/assets/js/inertia-app-Index-n51e0Xvm.js new file mode 100644 index 0000000..13fbe8c --- /dev/null +++ b/public/assets/js/inertia-app-Index-n51e0Xvm.js @@ -0,0 +1 @@ +import{i as e,o as t,t as n}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";import{Wt as r,ot as i}from"./inertia-app.js";import{t as a}from"./inertia-app-IconGrid-DDgKzP68.js";import{t as o}from"./inertia-app-FlashBanner-rWYabYjl.js";import{t as s}from"./inertia-app-propsToCatalog-BMfZFXhT.js";var c=t(e(),1),l=n();function u(){let{props:e}=r(),t=(0,c.useMemo)(()=>e.icons.map(e=>i(s(e))),[e.icons]),n=`/${e.ichava.prefix}/icons`;return(0,l.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,l.jsxs)(`div`,{className:`mx-auto max-w-5xl`,children:[(0,l.jsx)(`p`,{className:`theme-text-muted text-xs uppercase`,children:`Library`}),(0,l.jsxs)(`h1`,{className:`mt-1 text-2xl font-semibold`,children:[`Favorites (`,e.count,`)`]}),(0,l.jsx)(o,{}),(0,l.jsx)(a,{icons:t,showBase:n,emptyHint:`No favorites yet. Star icons from the browser to pin them here.`})]})})}export{u as default}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-InviteModal-B5hC9CGd-D5knyl0e.js b/public/assets/js/inertia-app-InviteModal-B5hC9CGd-D5knyl0e.js new file mode 100644 index 0000000..e0dbd4e --- /dev/null +++ b/public/assets/js/inertia-app-InviteModal-B5hC9CGd-D5knyl0e.js @@ -0,0 +1 @@ +import{Rt as e,T as t,c as n,d as r,jt as i,k as a,l as o,n as s,r as c,t as l,x as u}from"./inertia-app.js";import{i as d,o as f,t as p}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var m=f(d(),1),h=p(),g=[{v:`24h`,k:`invite.exp24h`},{v:`7 days`,k:`invite.exp7d`},{v:`30 days`,k:`invite.exp30d`},{v:`Never`,k:`invite.expNever`}];function _(){let d=i(e=>e.closeInvite),f=i(e=>e.pushNotification),p=i(e=>e.showToast),_=i(e=>{let t=e.config?.user.workspaces??[];return t.find(t=>t.id===e.activeWorkspaceId)??t[0]}),v=o(),y=e(),[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(`editor`),[w,T]=(0,m.useState)(`7 days`),E=(0,m.useId)(),D=_?.name??y(`invite.workspace`),O=`${location.origin}/ichava/invite/${_?.id??`team`}-${S}-${w.replace(/\s/g,``)}`;return(0,h.jsxs)(l,{onClose:d,width:520,label:y(`invite.title`),children:[(0,h.jsx)(a,{title:y(`invite.title`),description:(0,h.jsx)(`span`,{className:`font-mono text-xs`,children:_?.id??D})}),(0,h.jsxs)(r,{children:[(0,h.jsx)(u,{size:`md`,type:`email`,value:b,onChange:x,placeholder:y(`invite.emailPlaceholder`),"aria-label":y(`invite.emailPlaceholder`)}),(0,h.jsxs)(n,{size:`sm`,"aria-label":y(`invite.role`),selectedKeys:[S],disallowEmptySelection:!0,onSelectionChange:e=>{let t=[...e][0];(t===`editor`||t===`viewer`)&&C(t)},children:[(0,h.jsx)(s,{id:`editor`,children:y(`invite.roleEditor`)}),(0,h.jsx)(s,{id:`viewer`,children:y(`invite.roleViewer`)})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(`span`,{id:E,className:`text-sm font-medium text-secondary`,children:y(`invite.linkExpires`)}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(n,{size:`sm`,"aria-labelledby":E,selectedKeys:[w],disallowEmptySelection:!0,onSelectionChange:e=>{let t=[...e][0];t!==void 0&&T(String(t))},children:g.map(e=>(0,h.jsx)(s,{id:e.v,children:y(e.k)},e.v))})]}),(0,h.jsx)(`div`,{className:`text-sm text-tertiary`,children:y(`invite.blurb`)})]}),(0,h.jsxs)(c,{layout:`row`,children:[(0,h.jsx)(t,{color:`secondary`,size:`md`,onClick:()=>v(O,y(`invite.linkCopied`)),children:y(`invite.generateLink`)}),(0,h.jsx)(t,{color:`primary`,size:`md`,onClick:()=>{let e=b.trim()||y(`invite.yourTeammate`);f({icon:`info`,text:y(`invite.sentNotification`,{to:e,role:S})}),p(y(`invite.sent`),`check`),d()},children:y(`invite.sendInvite`)})]})]})}export{_ as InviteModal}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-LibraryDialog-DAWIobNZ-b_Zk9GGC.js b/public/assets/js/inertia-app-LibraryDialog-DAWIobNZ-b_Zk9GGC.js new file mode 100644 index 0000000..23d90b5 --- /dev/null +++ b/public/assets/js/inertia-app-LibraryDialog-DAWIobNZ-b_Zk9GGC.js @@ -0,0 +1,2 @@ +import{Bt as e,C as t,D as n,O as r,Rt as i,b as a,ct as o,et as s,i as c,it as l,jt as u,l as d,s as f,st as p,t as m,v as h,x as g}from"./inertia-app.js";import{i as _,o as v,t as y}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var b=v(_(),1),x=y(),S=[{id:`favorites`,key:`library.favorites`},{id:`history`,key:`library.history`},{id:`collections`,key:`library.collections`}];function C(){let n=e(),r=i(),c=u(e=>e.closeLayer),l=u(e=>e.libTab),d=u(e=>e.locale),f=e=>n.setState({libTab:e}),p=u(e=>e.config?.features),g=S.filter(e=>p?.[e.id]!==!1),_=g.some(e=>e.id===l)?l:g[0]?.id??l;return(0,x.jsx)(m,{showClose:!1,onClose:c,width:620,panelStyle:{height:460},children:(0,x.jsx)(s,{locale:d,children:(0,x.jsxs)(t,{selectedKey:_,onSelectionChange:e=>f(e),keyboardActivation:`automatic`,className:`min-h-0 flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 py-2.5 px-3.5 border-b border-b-[var(--border)]`,children:[(0,x.jsx)(t.List,{type:`button-border`,size:`sm`,className:a,children:g.map(e=>(0,x.jsx)(t.Item,{id:e.id,className:`${h} px-3 text-[11.5px]`,children:r(e.key)},e.id))}),(0,x.jsx)(`span`,{className:`flex-1`}),(0,x.jsx)(`button`,{onClick:c,title:`${r(`common.close`)} — Esc`,"aria-label":r(`common.close`),className:`w-[26px] h-[26px] border border-[var(--border)] bg-[var(--bg)] shadow-[var(--shadow)] rounded-[6px] cursor-pointer flex items-center justify-center text-[var(--muted-fg)]`,children:(0,x.jsx)(o,{name:`close`,size:12,color:`currentColor`})})]}),p?.favorites!==!1&&(0,x.jsx)(t.Panel,{id:`favorites`,className:`flex-1 overflow-y-auto p-3`,children:(0,x.jsx)(E,{})}),p?.history!==!1&&(0,x.jsx)(t.Panel,{id:`history`,className:`flex-1 overflow-y-auto p-3`,children:(0,x.jsx)(D,{})}),p?.collections!==!1&&(0,x.jsx)(t.Panel,{id:`collections`,className:`flex-1 overflow-y-auto p-3`,children:(0,x.jsx)(O,{})})]})})})}function w({icon:e,text:t}){return(0,x.jsx)(n,{icon:e,title:t,className:`h-full`})}var T={height:24,padding:`0 8px`,border:`1px solid var(--border)`,borderRadius:`calc(var(--radius) - 3px)`,backgroundColor:`var(--bg)`,color:`var(--fg)`,fontSize:11,cursor:`pointer`};function E(){let e=u(e=>e.favorites),t=u(e=>e.toggleFavorite),n=u(e=>e.openDetail),r=i(),{icons:a}=c(e);return a.length?(0,x.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(84px,1fr))] gap-2`,children:a.map(e=>e&&(0,x.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":e.name,onClick:()=>n(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e.id))},className:`relative flex flex-col items-center justify-center gap-1.5 aspect-[1_/_0.9] border border-[var(--border)] rounded-[var(--radius)] cursor-pointer`,children:[(0,x.jsx)(`button`,{onClick:n=>{n.stopPropagation(),t(e.id)},title:r(`common.remove`),className:`absolute top-1 end-1 w-[22px] h-[22px] border border-[var(--border)] bg-[var(--pop)] rounded-[6px] cursor-pointer flex items-center justify-center text-[var(--muted-fg)]`,children:(0,x.jsx)(o,{name:`close`,size:11,color:`currentColor`})}),(0,x.jsx)(l,{icon:e,size:24}),(0,x.jsx)(`span`,{className:`text-[10px] text-[var(--muted-fg)] max-w-[90%] whitespace-nowrap overflow-hidden text-ellipsis`,children:e.name})]},e.id))}):(0,x.jsx)(w,{icon:`heart`,text:r(`library.emptyFavorites`)})}function D(){let e=u(e=>e.history),t=u(e=>e.clearHistory),n=u(e=>e.openDetail),a=i(),{icons:o}=c(e.map(e=>e.id)),s=new Map(o.map(e=>[e.id,e]));return e.length?(0,x.jsxs)(`div`,{className:`flex flex-col`,children:[e.map((e,t)=>{let i=s.get(e.id);return(0,x.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${i?.name??e.id}, ${e.action}`,onClick:()=>n(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e.id))},className:`flex items-center gap-2.5 h-[38px] border-b border-b-[var(--border)] cursor-pointer`,children:[i&&(0,x.jsx)(l,{icon:i,size:16}),(0,x.jsx)(`span`,{className:`text-[12.5px] font-medium min-w-[120px]`,children:i?.name??e.id}),(0,x.jsx)(`span`,{className:`text-[11px] text-[var(--accent-text)] bg-[var(--accent-soft)] rounded-[4px] py-[1px] px-1.5`,children:e.action}),(0,x.jsx)(`span`,{className:`flex-1`}),(0,x.jsx)(`span`,{className:`font-[family-name:'Geist_Mono',monospace] text-[10.5px] text-[var(--faint-fg)]`,children:r(e.ts)})]},`${e.id}-${e.action}-${t}`)}),(0,x.jsx)(`button`,{onClick:t,className:`self-start mt-2.5 h-[26px] py-0 px-2.5 border border-[var(--border)] rounded-[calc(var(--radius)_-_3px)] bg-transparent text-[var(--muted-fg)] text-[11.5px] cursor-pointer`,children:a(`library.clearHistory`)})]}):(0,x.jsx)(w,{icon:`clock`,text:a(`library.emptyHistory`)})}function O(){let t=u(e=>e.collections),n=u(e=>e.createCollection),r=u(e=>e.librarySeed),a=e(),o=u(e=>e.openAccess),s=u(e=>e.config?.features.sharing!==!1),c=i(),[l,d]=(0,b.useState)(``);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(f,{onSubmit:e=>{e.preventDefault(),l.trim()&&(n(l,r),a.setState({librarySeed:[]}),d(``))},style:{display:`flex`,gap:6,marginBottom:12},children:[(0,x.jsx)(g,{size:`sm`,value:l,onChange:d,placeholder:c(`library.newCollectionPlaceholder`),"aria-label":c(`library.newCollectionPlaceholder`),className:`flex-1`}),(0,x.jsx)(`button`,{type:`submit`,className:`flex-none py-0 px-3 border-0 rounded-[calc(var(--radius)_-_2px)] bg-[var(--accent)] text-[var(--accent-fg)] text-[12px] font-semibold cursor-pointer`,children:c(`common.create`)})]}),r.length>0&&(0,x.jsx)(`p`,{className:`text-[11px] text-[var(--muted-fg)]`,style:{margin:`-6px 0 12px`},children:c(`library.seededWith`,{n:r.length})}),t.length===0&&(0,x.jsx)(w,{icon:`folder`,text:c(`library.emptyCollections`)}),(0,x.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,x.jsx)(k,{c:e,onManageAccess:s?()=>o(e.id):void 0},e.id))})]})}function k({c:e,onManageAccess:t}){let n=u(e=>e.removeCollection),r=u(e=>e.removeFromCollection),a=u(e=>e.openDetail),s=d(),f=i(),{icons:m}=c(e.icons),h=new Map(m.map(e=>[e.id,e]));return(0,x.jsxs)(`div`,{className:`border border-[var(--border)] rounded-[var(--radius)] overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 py-2.5 px-3`,children:[(0,x.jsx)(o,{name:`folder`,size:14,color:`var(--accent-text)`}),(0,x.jsx)(`span`,{className:`text-[12.5px] font-[550]`,children:e.name}),(0,x.jsx)(`span`,{className:`font-[family-name:'Geist_Mono',monospace] text-[10.5px] text-[var(--muted-fg)]`,children:f(`library.iconCount`,{n:e.icons.length})}),e.shared&&(0,x.jsx)(`span`,{className:`text-[9px] font-bold text-[var(--accent-text)] bg-[var(--accent-soft)] rounded-[4px] py-[1px] px-[5px]`,children:f(`library.teamBadge`)}),e.shared&&e.role===`viewer`&&(0,x.jsx)(`span`,{className:`text-[9px] font-semibold text-[var(--faint-fg)] border border-[var(--border)] rounded-[4px] py-[1px] px-[5px]`,children:f(`library.viewerBadge`)}),e.shared&&(e.sharedWith??[]).length>0&&(0,x.jsx)(`div`,{className:`flex`,children:(e.sharedWith??[]).slice(0,3).map((e,t)=>(0,x.jsx)(`div`,{style:{width:18,height:18,borderRadius:`50%`,marginLeft:t===0?0:-6,border:`2px solid var(--pop)`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:7.5,fontWeight:600,color:`#fff`,background:[`#7c3aed`,`#0891b2`,`#059669`][t%3]},children:e.initials},e.initials))}),(0,x.jsx)(`span`,{className:`flex-1`}),t&&(0,x.jsx)(`button`,{onClick:t,title:f(`shared.manageAccess`),style:T,children:f(`shared.manageAccess`)}),(0,x.jsx)(`button`,{onClick:()=>{s(m.map(p).join(` +`),f(`toolbar.namesCopied`,{n:e.icons.length}))},title:f(`library.copyNamesTitle`),style:T,children:f(`toolbar.copyNames`)}),(0,x.jsx)(`button`,{onClick:()=>n(e.id),title:f(`library.deleteCollection`),className:`w-[26px] h-[26px] border border-[var(--border)] bg-[var(--pop)] rounded-[6px] cursor-pointer flex items-center justify-center text-[var(--muted-fg)]`,children:(0,x.jsx)(o,{name:`trash`,size:13,color:`currentColor`})})]}),e.icons.length>0&&(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1.5 border-t border-t-[var(--border)] py-2.5 px-3 mt-0 mx-3 mb-2.5`,children:e.icons.map(t=>{let n=h.get(t);return n?(0,x.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":n.name,onClick:()=>a(t),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a(t))},title:n.name,className:`relative w-[38px] h-[38px] border border-[var(--border)] rounded-[6px] bg-[var(--card)] flex items-center justify-center cursor-pointer`,children:[(0,x.jsx)(l,{icon:n,size:18}),(0,x.jsx)(`button`,{onClick:n=>{n.stopPropagation(),r(e.id,t)},title:f(`common.remove`),className:`absolute -top-[5px] -end-[5px] w-[15px] h-[15px] border border-[var(--border)] bg-[var(--pop)] rounded-full flex items-center justify-center cursor-pointer text-[var(--muted-fg)]`,children:(0,x.jsx)(o,{name:`close`,size:7,color:`currentColor`})})]},t):null})})]})}export{C as LibraryDialog}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-ManageAccessModal-BW7R-s6Z-C2pA8CxK.js b/public/assets/js/inertia-app-ManageAccessModal-BW7R-s6Z-C2pA8CxK.js new file mode 100644 index 0000000..54f35d4 --- /dev/null +++ b/public/assets/js/inertia-app-ManageAccessModal-BW7R-s6Z-C2pA8CxK.js @@ -0,0 +1 @@ +import{F as e,Rt as t,T as n,bt as r,d as i,jt as a,k as o,l as s,r as c,t as l,x as u}from"./inertia-app.js";import{i as d,o as f,t as p}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var m=f(d(),1),h=p(),g=[`#7c3aed`,`#0891b2`,`#059669`,`#e11d48`,`#ea580c`];function _(){let d=a(e=>e.accessCollectionId),f=a(e=>e.closeAccess),p=a(e=>e.collections.find(t=>t.id===e.accessCollectionId)),g=a(e=>e.config?.team??[]),_=a(e=>e.shareCollection),y=s(),b=t(),[x,S]=(0,m.useState)(``),[C,w]=(0,m.useState)(p?.sharedWith??[]);if(!d||!p)return null;let T=g.filter(e=>!C.some(t=>t.initials===e.initials)&&(e.name.toLowerCase().includes(x.toLowerCase())||x===``)),E=e=>w(t=>[...t,{initials:e.initials,name:e.name}]);return(0,h.jsxs)(l,{onClose:f,width:480,label:b(`shared.manageAccess`),children:[(0,h.jsx)(o,{title:b(`shared.manageAccess`),description:p.name}),(0,h.jsxs)(i,{children:[(0,h.jsx)(u,{size:`md`,icon:r,label:b(`access.addPeople`),value:x,onChange:S,placeholder:b(`access.searchTeammates`)}),x!==``&&T.length>0&&(0,h.jsx)(`div`,{className:`overflow-hidden rounded-lg ring-1 ring-secondary ring-inset`,children:T.map((e,t)=>(0,h.jsxs)(`button`,{onClick:()=>{E(e),S(``)},className:`flex w-full cursor-pointer items-center gap-2 border-0 bg-transparent px-2.5 py-2 text-primary hover:bg-primary_hover`,children:[(0,h.jsx)(v,{m:e,i:t}),(0,h.jsx)(`span`,{className:`text-sm`,children:e.name})]},e.initials))}),C.length===0?(0,h.jsx)(`div`,{className:`text-sm text-tertiary`,children:b(`access.onlyYou`)}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[C.map((t,r)=>(0,h.jsxs)(`div`,{className:`flex items-center gap-[9px]`,children:[(0,h.jsx)(v,{m:t,i:r}),(0,h.jsx)(`span`,{className:`flex-1 text-sm text-primary`,children:t.name}),(0,h.jsx)(n,{color:`tertiary`,size:`sm`,"aria-label":`${b(`common.remove`)} ${t.name}`,iconLeading:e(`close`),onClick:()=>w(e=>e.filter(e=>e.initials!==t.initials))})]},t.initials)),(0,h.jsx)(n,{color:`primary`,size:`sm`,className:`self-start`,onClick:()=>{_(d,{role:`editor`,sharedWith:C}),f()},children:b(`access.saveAccess`)})]})]}),(0,h.jsxs)(c,{layout:`row`,children:[(0,h.jsx)(n,{color:`link-gray`,size:`md`,className:`sm:mr-auto`,onClick:()=>y(`${location.origin}/ichava/c/${p.id}`,b(`access.shareLinkCopied`)),children:b(`access.copyLinkInstead`)}),(0,h.jsx)(n,{color:`primary`,size:`md`,onClick:()=>{_(d,{role:`editor`,sharedWith:g.map(e=>({initials:e.initials,name:e.name}))}),f()},children:b(`access.shareEntireTeam`)})]})]})}function v({m:e,i:t}){return(0,h.jsx)(`div`,{style:{width:24,height:24,borderRadius:`50%`,flex:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:9,fontWeight:600,color:`#fff`,background:g[t%g.length]},children:e.initials})}export{_ as ManageAccessModal}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-ProfileModal-B8a6ztxV-K8ptuE1T.js b/public/assets/js/inertia-app-ProfileModal-B8a6ztxV-K8ptuE1T.js new file mode 100644 index 0000000..9818b62 --- /dev/null +++ b/public/assets/js/inertia-app-ProfileModal-B8a6ztxV-K8ptuE1T.js @@ -0,0 +1 @@ +import{Rt as e,T as t,a as n,d as r,h as i,jt as a,k as o,p as s,r as c,t as l,u}from"./inertia-app.js";import{i as d,o as f,t as p}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var m=f(d(),1),h=p(),g={fontSize:10.5,fontWeight:600,color:`var(--muted-fg)`,textTransform:`uppercase`,letterSpacing:`.04em`};function _(){let d=a(e=>e.closeLayer),f=a(e=>e.openLayer),p=a(e=>e.openConfirm),_=a(e=>e.signOut),v=a(e=>e.showToast),y=a(e=>e.config),b=a(e=>e.activeWorkspaceId),x=a(e=>e.setActiveWorkspace),S=e(),C=(0,m.useId)(),w=i();if(!w)return null;let T=y?.features.workspaces===!1?[]:y?.user.workspaces??[],E=!y?.host||!!y.host.links.logout,D=()=>p({title:S(`profile.signOutTitle`),body:S(`profile.signOutBody`),confirmLabel:S(`common.signOut`),danger:!0,onConfirm:()=>{_(),v(S(`profile.signedOut`),`check`)}});return(0,h.jsxs)(l,{onClose:d,width:440,label:S(`profile.title`),children:[(0,h.jsx)(o,{title:S(`profile.title`)}),(0,h.jsxs)(r,{children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,h.jsx)(u,{name:w.name,initials:w.initials,avatarUrl:w.avatarUrl,size:44}),(0,h.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:w.name}),w.plan&&(0,h.jsx)(`span`,{className:`text-[9.5px] font-bold text-[var(--accent-text)] bg-[var(--accent-soft)] rounded-[5px] py-0.5 px-1.5`,children:w.plan})]}),w.email&&(0,h.jsx)(`div`,{className:`text-sm text-tertiary truncate`,children:w.email})]})]}),T.length>0&&(0,h.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,h.jsx)(`span`,{id:C,style:g,children:S(`account.workspace`)}),(0,h.jsx)(n,{"aria-labelledby":C,value:b??null,onChange:e=>{let t=T.find(t=>t.id===e);t&&(x(t.id),v(S(`profile.switched`,{name:t.name}),`check`))},className:`gap-1.5`,children:T.map(e=>(0,h.jsx)(s,{value:e.id,label:e.name,hint:e.plan,className:`rounded-lg p-2.5 ring-1 ring-secondary ring-inset selected:bg-[var(--accent-soft)] selected:ring-[var(--accent)]`},e.id))})]})]}),(0,h.jsxs)(c,{layout:`row`,children:[E&&(0,h.jsxs)(t,{color:`secondary-destructive`,size:`md`,className:`sm:mr-auto`,onClick:()=>{d(),D()},children:[S(`common.signOut`),`…`]}),(0,h.jsx)(t,{color:`secondary`,size:`md`,onClick:()=>f(`settings`),children:S(`profile.appSettings`)})]})]})}export{_ as ProfileModal}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-SettingsDialog-Bdn2ml85-Ds0n1eul.js b/public/assets/js/inertia-app-SettingsDialog-Bdn2ml85-Ds0n1eul.js new file mode 100644 index 0000000..94f4415 --- /dev/null +++ b/public/assets/js/inertia-app-SettingsDialog-Bdn2ml85-Ds0n1eul.js @@ -0,0 +1 @@ +import{Dt as e,It as t,Rt as n,T as r,c as i,ct as a,d as o,g as s,h as c,jt as l,k as u,n as d,t as f,u as p}from"./inertia-app.js";import{t as m}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var h=m();function g(){let m=n(),g=l(e=>e.closeLayer),b=l(e=>e.filters.perPage),x=l(e=>e.setPerPage),S=l(e=>e.copyFormat),C=l(e=>e.setCopyFormat),w=l(e=>e.factoryReset),T=l(e=>e.showToast),E=l(e=>e.openLayer),D=l(e=>e.openConfirm),O=l(e=>e.config),k=l(e=>e.storageDriver),A=l(e=>e.setStorageDriver),j=l(e=>e.startTour),M=l(e=>e.auth.status===`authed`),N=l(e=>e.openAuth),P=l(e=>e.deleteLibrary),F=l(e=>e.clearHistory),I=l(e=>e.clearRecentCommands),L=l(e=>e.config?.features.history!==!1||e.config?.features.commands!==!1),R=O?.ui.perPageOptions??t.ui.perPageOptions,z=O?.toolbar.copyFormats??t.toolbar.copyFormats,B=c(),V=O?.host??null,H=V?.storage.tier===`database`?m(`settings.syncAccount`):V?.storage.tier===`session`?m(`settings.syncSession`):m(`settings.syncNote`),U=!V||!!V.links.login,W=!!V&&O?.features.library!==!1;return(0,h.jsxs)(f,{onClose:g,width:480,label:m(`header.settings`),panelStyle:{overflowY:`auto`},children:[(0,h.jsx)(u,{title:m(`header.settings`)}),(0,h.jsxs)(o,{className:`gap-3.5 pb-4`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2.5 py-2.5 px-3 border border-[var(--border)] rounded-[var(--radius)] bg-[var(--muted2)]`,children:[(0,h.jsx)(`div`,{className:`w-[26px] h-[26px] flex-none rounded-[7px] bg-[var(--accent-soft)] flex items-center justify-center`,children:(0,h.jsx)(a,{name:`palette`,size:13,color:`var(--accent-text)`})}),(0,h.jsxs)(`div`,{className:`flex-1 text-[11.5px] text-[var(--muted-fg)] leading-[1.5]`,children:[m(`settings.appearanceHintPre`),(0,h.jsx)(`b`,{className:`text-[var(--fg)]`,children:m(`appearance.title`)}),m(`settings.appearanceHintPost`)]})]}),(0,h.jsx)(v,{children:m(`settings.behavior`)}),(0,h.jsx)(y,{title:m(`settings.perPageTitle`),desc:m(`settings.perPageDesc`),children:(0,h.jsx)(s,{size:`sm`,"aria-label":m(`settings.perPageTitle`),items:R.map(e=>({id:e,label:String(e)})),selectedKey:b,onSelectionChange:e=>x(Number(e)),className:`w-28`,children:e=>(0,h.jsx)(s.Item,{...e})})}),(0,h.jsx)(y,{title:m(`settings.copyFormatTitle`),desc:m(`settings.copyFormatDesc`),children:(0,h.jsx)(s,{size:`sm`,"aria-label":m(`settings.copyFormatTitle`),items:z.map(n=>({id:n.id,label:t.toolbar.copyFormats.some(e=>e.id===n.id&&e.label===n.label)?m(e(`format.${n.id}`)):n.label})),selectedKey:S,onSelectionChange:e=>C(e),className:`w-40`,children:e=>(0,h.jsx)(s.Item,{...e})})}),(0,h.jsx)(y,{title:m(`settings.storageTitle`),desc:m(`settings.storageDesc`),children:(0,h.jsxs)(i,{size:`sm`,"aria-label":m(`settings.storageTitle`),selectedKeys:[k],disallowEmptySelection:!0,onSelectionChange:e=>{let t=[...e][0];(t===`local`||t===`session`)&&A(t)},children:[(0,h.jsx)(d,{id:`local`,className:`h-8 px-2.5 py-0 text-xs`,children:m(`settings.storageLocal`)}),(0,h.jsx)(d,{id:`session`,className:`h-8 px-2.5 py-0 text-xs`,children:m(`settings.storageSession`)})]})}),(0,h.jsx)(y,{title:m(`settings.tourTitle`),desc:m(`settings.tourDesc`),children:(0,h.jsx)(r,{color:`secondary`,size:`xs`,onClick:()=>{j(),g()},children:m(`settings.replayTour`)})}),L&&(0,h.jsx)(y,{title:m(`settings.clearHistoryTitle`),desc:m(`settings.clearHistoryDesc`),children:(0,h.jsx)(r,{color:`secondary`,size:`xs`,onClick:()=>{F(),I(),T(m(`settings.clearHistoryToast`),`check`)},children:m(`settings.clearHistoryButton`)})}),(0,h.jsx)(y,{title:m(`settings.factoryTitle`),desc:m(V?`settings.factoryDescHost`:`settings.factoryDesc`),children:(0,h.jsx)(r,{color:`secondary-destructive`,size:`xs`,onClick:()=>D({title:m(`settings.factoryConfirmTitle`),body:m(V?`settings.factoryConfirmBodyHost`:`settings.factoryConfirmBody`),confirmLabel:m(`settings.factoryConfirmLabel`),danger:!0,onConfirm:()=>{w(),T(m(`settings.factoryToast`),`refresh`)}}),children:m(`settings.resetEverything`)})}),W&&(0,h.jsx)(y,{title:m(`settings.deleteLibraryTitle`),desc:m(`settings.deleteLibraryDesc`),children:(0,h.jsx)(r,{color:`secondary-destructive`,size:`xs`,onClick:()=>D({title:m(`settings.deleteLibraryConfirmTitle`),body:m(`settings.deleteLibraryConfirmBody`),confirmLabel:m(`settings.deleteLibraryConfirmLabel`),danger:!0,onConfirm:()=>{P(),T(m(`settings.deleteLibraryToast`),`check`)}}),children:m(`settings.deleteLibraryButton`)})}),(0,h.jsx)(`div`,{className:`h-[1px] bg-[var(--border)]`}),(0,h.jsx)(v,{children:m(`settings.account`)}),M&&B?(0,h.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,h.jsx)(p,{name:B.name,initials:B.initials,avatarUrl:B.avatarUrl,size:32}),(0,h.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,h.jsxs)(`div`,{className:`text-[12.5px] font-[600]`,children:[B.name,` `,B.plan&&(0,h.jsx)(`span`,{className:`text-[9px] font-semibold text-[var(--accent-text)] bg-[var(--accent-soft)] rounded-[4px] py-[1px] px-[5px]`,children:B.plan})]}),(0,h.jsxs)(`div`,{className:`text-[11px] text-[var(--muted-fg)]`,children:[B.email?`${B.email} · `:``,H]})]})]}):(0,h.jsxs)(`div`,{className:`flex items-center gap-2.5 py-3 px-3.5 border border-dashed border-[var(--border)] rounded-[var(--radius)]`,children:[(0,h.jsx)(a,{name:`info`,size:15,color:`var(--muted-fg)`}),(0,h.jsxs)(`div`,{className:`flex-1 text-[11.5px] text-[var(--muted-fg)] leading-[1.5]`,children:[V?.storage.tier===`session`?_(m(`settings.syncSession`)):m(`settings.guestNote`),V&&U?` ${m(`settings.guestSignIn`)}`:``]}),U&&(0,h.jsx)(r,{size:`xs`,className:`flex-none`,onClick:()=>{N(`signin`),g()},children:m(`common.signIn`)})]})]}),(0,h.jsxs)(`div`,{className:`py-2.5 px-4 border-t border-t-[var(--border)] flex items-center text-[10.5px] text-[var(--faint-fg)]`,children:[(0,h.jsxs)(`span`,{children:[`© 2026 Simtabi LLC · ichava/icon-browser v`,(O??t).meta.version,` · `,(O??t).meta.license]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(`button`,{onClick:()=>E(`about`),className:`border-0 bg-transparent text-brand-secondary text-[10.5px] cursor-pointer p-0.5 font-semibold`,children:m(`settings.aboutLink`)})]})]})}var _=e=>`${e.charAt(0).toLocaleUpperCase()}${e.slice(1)}.`,v=({children:e})=>(0,h.jsx)(`div`,{className:`text-[10.5px] font-semibold text-[var(--faint-fg)]`,children:e});function y({title:e,desc:t,children:n}){return(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsxs)(`div`,{className:`flex-1`,children:[(0,h.jsx)(`div`,{className:`text-[12.5px] font-[550]`,children:e}),(0,h.jsx)(`div`,{className:`text-[11px] text-[var(--muted-fg)]`,children:t})]}),n]})}export{g as SettingsDialog}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-SharedCollectionsModal-DbRvVtxZ-f-CZfZK8.js b/public/assets/js/inertia-app-SharedCollectionsModal-DbRvVtxZ-f-CZfZK8.js new file mode 100644 index 0000000..2141227 --- /dev/null +++ b/public/assets/js/inertia-app-SharedCollectionsModal-DbRvVtxZ-f-CZfZK8.js @@ -0,0 +1,2 @@ +import{It as e,Rt as t,T as n,ct as r,d as i,i as a,it as o,jt as s,k as c,l,st as u,t as d}from"./inertia-app.js";import{t as f}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var p=f();function m(){let a=s(e=>e.closeShared),o=s(e=>e.collections),l=s(e=>e.activeWorkspaceId),u=s(e=>e.config),f=s(e=>e.openDetail),m=s(e=>e.openAccess),g=s(e=>e.openInvite),_=t(),v=u?.ui.avatarPalette?.length?u.ui.avatarPalette:e.ui.avatarPalette,y=u?.user.workspaces.find(e=>e.id===l)??u?.user.workspaces[0],b=o.filter(e=>e.shared||(e.sharedWith??[]).length>0);return(0,p.jsxs)(d,{onClose:a,width:620,label:_(`shared.title`),panelStyle:{maxHeight:`80vh`,display:`flex`,flexDirection:`column`},children:[(0,p.jsx)(c,{className:`flex-none`,title:_(`shared.title`),description:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{className:`font-mono text-xs`,children:y?.name??_(`team.title`)}),` · `,_(`shared.count`,{n:b.length})]})}),(0,p.jsx)(i,{className:`min-h-0 flex-1 gap-2.5 overflow-y-auto pb-6`,children:b.length===0?(0,p.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-tertiary`,children:[(0,p.jsx)(r,{name:`folder`,size:22,color:`var(--faint-fg)`}),(0,p.jsx)(`span`,{className:`text-center text-sm`,children:_(`shared.empty`)}),(0,p.jsx)(n,{color:`primary`,size:`sm`,onClick:()=>{a(),g()},children:_(`shared.inviteTeam`)})]}):b.map(e=>(0,p.jsx)(h,{c:e,palette:v,onManageAccess:()=>m(e.id),onOpenDetail:f},e.id))})]})}function h({c:e,palette:i,onManageAccess:s,onOpenDetail:c}){let d=l(),f=t(),{icons:m}=a(e.icons),h=new Map(m.map(e=>[e.id,e]));return(0,p.jsxs)(`div`,{className:`border border-[var(--border)] rounded-[var(--radius)] overflow-hidden`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 py-2.5 px-3`,children:[(0,p.jsx)(r,{name:`folder`,size:14,color:`var(--accent-text)`}),(0,p.jsx)(`span`,{className:`text-[12.5px] font-[550]`,children:e.name}),(0,p.jsx)(`span`,{className:`font-[family-name:'Geist_Mono',monospace] text-[10.5px] text-[var(--muted-fg)]`,children:f(`library.iconCount`,{n:e.icons.length})}),(0,p.jsx)(`span`,{className:`text-[9px] font-bold text-[var(--accent-text)] bg-[var(--accent-soft)] rounded-[4px] py-[1px] px-[5px]`,children:e.role===`viewer`?f(`shared.viewer`):f(`shared.editor`)}),(e.sharedWith??[]).length>0&&(0,p.jsx)(`div`,{className:`flex`,children:(e.sharedWith??[]).slice(0,3).map((e,t)=>(0,p.jsx)(`div`,{style:{width:18,height:18,borderRadius:`50%`,marginInlineStart:t===0?0:-6,border:`2px solid var(--pop)`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:7.5,fontWeight:600,color:`var(--accent-fg)`,background:i[t%i.length]},children:e.initials},e.initials))}),(0,p.jsx)(`span`,{className:`flex-1`}),(0,p.jsx)(n,{color:`secondary`,size:`xs`,onClick:s,children:f(`shared.manageAccess`)}),(0,p.jsx)(n,{color:`secondary`,size:`xs`,onClick:()=>{d(m.map(u).join(` +`),f(`toolbar.namesCopied`,{n:e.icons.length}))},children:f(`toolbar.copyNames`)})]}),e.icons.length>0&&(0,p.jsx)(`div`,{className:`flex flex-wrap gap-1.5 border-t border-t-[var(--border)] py-2.5 px-3`,children:e.icons.map(e=>{let t=h.get(e);return t?(0,p.jsx)(`div`,{role:`button`,tabIndex:0,"aria-label":t.name,onClick:()=>c(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),c(e))},title:t.name,className:`w-[38px] h-[38px] border border-[var(--border)] rounded-[6px] bg-[var(--card)] flex items-center justify-center cursor-pointer`,children:(0,p.jsx)(o,{icon:t,size:18})},e):null})})]})}export{m as SharedCollectionsModal}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-Show-CM_WdFs5.js b/public/assets/js/inertia-app-Show-CM_WdFs5.js new file mode 100644 index 0000000..27841fd --- /dev/null +++ b/public/assets/js/inertia-app-Show-CM_WdFs5.js @@ -0,0 +1 @@ +import{i as e,o as t,t as n}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";import{Ht as r,Wt as i,ot as a}from"./inertia-app.js";import{t as o}from"./inertia-app-IconGrid-DDgKzP68.js";import{t as s}from"./inertia-app-FlashBanner-rWYabYjl.js";import{t as c}from"./inertia-app-propsToCatalog-BMfZFXhT.js";var l=t(e(),1),u=n();function d(){let{props:e}=i(),t=e.collection,n=(0,l.useMemo)(()=>(t?.icons??[]).map(e=>a(c(e))),[t]),d=`/${e.ichava.prefix}/icons`;return t?(0,u.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,u.jsxs)(`div`,{className:`mx-auto max-w-5xl`,children:[(0,u.jsx)(r,{href:e.ichava.routes.collections,className:`theme-text-accent theme-link text-sm`,children:`← All collections`}),(0,u.jsx)(s,{}),(0,u.jsx)(`h1`,{className:`mt-2 text-2xl font-semibold`,children:t.name}),(0,u.jsxs)(`p`,{className:`theme-text-secondary mt-1 text-sm`,children:[n.length,` icon`,n.length===1?``:`s`]}),(0,u.jsx)(o,{icons:n,showBase:d,emptyHint:`This collection is empty.`})]})}):(0,u.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,u.jsx)(`p`,{className:`theme-text-muted text-sm`,children:`Collection not found.`})})}export{d as default}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-Show-Cqx-Li8V.js b/public/assets/js/inertia-app-Show-Cqx-Li8V.js new file mode 100644 index 0000000..33e7fe6 --- /dev/null +++ b/public/assets/js/inertia-app-Show-Cqx-Li8V.js @@ -0,0 +1 @@ +import{i as e,o as t,t as n}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";import{Gt as r,Ht as i,M as a,Wt as o,j as s,ot as c}from"./inertia-app.js";import{t as l}from"./inertia-app-IconImage-DrJ-WGz6.js";import{t as u}from"./inertia-app-FlashBanner-rWYabYjl.js";import{t as d}from"./inertia-app-propsToCatalog-BMfZFXhT.js";var f=t(e(),1),p=n();function m(e){return(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:(0,p.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.993 5.136c-2-2.338-5.333-2.966-7.838-.826s-2.858 5.719-.89 8.25c1.635 2.105 6.585 6.544 8.207 7.98.182.162.272.242.378.274a.504.504 0 0 0 .286 0c.106-.032.197-.112.378-.273 1.623-1.437 6.573-5.876 8.208-7.98 1.967-2.532 1.658-6.133-.89-8.251-2.549-2.118-5.84-1.512-7.839.826Z`})})}function h(){let{props:e}=o(),[t,n]=(0,f.useState)(`svg`),[h,g]=(0,f.useState)(!1),_=(0,f.useMemo)(()=>e.icon?c(d(e.icon)):null,[e.icon]),v=(0,f.useMemo)(()=>e.related.map(e=>c(d(e))),[e.related]),y=(0,f.useMemo)(()=>_?a.build(t,_,{size:24,unit:`px`,color:null,strokeWidth:2}):``,[_,t]);if(!_)return(0,p.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,p.jsx)(`p`,{className:`theme-text-muted text-sm`,children:`Icon not found.`})});let b=`/${e.ichava.prefix}/icons`;return(0,p.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,p.jsxs)(`div`,{className:`mx-auto max-w-5xl`,children:[(0,p.jsx)(i,{href:e.ichava.routes.browser,className:`theme-text-accent theme-link text-sm`,children:`← Back to browser`}),(0,p.jsx)(u,{}),(0,p.jsxs)(`div`,{className:`mt-4 grid gap-6 md:grid-cols-[280px_1fr]`,children:[(0,p.jsx)(`div`,{className:`theme-bg-card rounded-xl border theme-border flex items-center justify-center p-10`,children:(0,p.jsx)(l,{icon:_,size:160,label:_.name})}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h1`,{className:`text-2xl font-semibold`,children:_.name}),(0,p.jsxs)(`p`,{className:`theme-text-secondary mt-1 text-sm`,children:[_.package,_.category?` · ${_.category}`:``,` · `,_.variant]}),(0,p.jsxs)(`button`,{onClick:()=>r.post(`${e.ichava.routes.favorites}/${_.id}/toggle`,{},{preserveState:!0}),className:`theme-bg-muted theme-text-secondary mt-3 flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium`,children:[(0,p.jsx)(m,{"aria-hidden":!0,className:`size-[13px]`}),`Toggle favorite`]}),_.tags.length>0&&(0,p.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:_.tags.map(e=>(0,p.jsx)(`span`,{className:`theme-bg-muted rounded px-2 py-0.5 text-xs theme-text-secondary`,children:e},e))}),(0,p.jsxs)(`div`,{className:`mt-6`,children:[(0,p.jsx)(`div`,{className:`flex gap-1`,children:s.map(e=>(0,p.jsx)(`button`,{onClick:()=>n(e.id),className:`rounded-md px-3 py-1.5 text-xs font-medium theme-transition ${t===e.id?`theme-bg-accent theme-text-inverse`:`theme-bg-muted theme-text-secondary`}`,children:e.label},e.id))}),(0,p.jsx)(`pre`,{className:`theme-bg-card mt-2 overflow-x-auto rounded-lg border theme-border p-4 text-xs`,children:y}),(0,p.jsx)(`button`,{onClick:async()=>{try{await navigator.clipboard.writeText(y)}catch{return}g(!0),window.setTimeout(()=>g(!1),1500)},className:`theme-bg-muted mt-2 rounded-md px-3 py-1.5 text-xs font-medium theme-text-secondary`,children:h?`Copied!`:`Copy snippet`})]})]})]}),v.length>0&&(0,p.jsxs)(`section`,{className:`mt-10`,children:[(0,p.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Related`}),(0,p.jsx)(`div`,{className:`mt-3 grid grid-cols-4 gap-3 sm:grid-cols-6 md:grid-cols-8`,children:v.map(e=>(0,p.jsxs)(i,{href:`${b}/${e.id}`,className:`theme-bg-card theme-bg-card-hover rounded-lg border theme-border flex flex-col items-center gap-1 p-3 theme-transition`,children:[(0,p.jsx)(l,{icon:e,size:32}),(0,p.jsx)(`span`,{className:`theme-text-muted w-full truncate text-center text-[11px]`,children:e.name})]},e.id))})]})]})})}export{h as default}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-Show-tjb19Sx4.js b/public/assets/js/inertia-app-Show-tjb19Sx4.js new file mode 100644 index 0000000..341f119 --- /dev/null +++ b/public/assets/js/inertia-app-Show-tjb19Sx4.js @@ -0,0 +1 @@ +import{Ht as e,Wt as t}from"./inertia-app.js";import{t as n}from"./inertia-app-FlashBanner-rWYabYjl.js";import{t as r}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var i=r();function a(){let{props:r}=t(),a=r.package;if(!a)return(0,i.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,i.jsx)(`p`,{className:`theme-text-muted text-sm`,children:`Package not found.`})});let o=`${r.ichava.routes.browser}?packages[]=${encodeURIComponent(a.name)}`;return(0,i.jsx)(`div`,{className:`theme-bg-page theme-text-primary min-h-screen p-8`,children:(0,i.jsxs)(`div`,{className:`mx-auto max-w-5xl`,children:[(0,i.jsx)(e,{href:r.ichava.routes.packages,className:`theme-text-accent theme-link text-sm`,children:`← All packages`}),(0,i.jsx)(n,{}),(0,i.jsx)(`h1`,{className:`mt-2 text-2xl font-semibold`,children:a.label||a.name}),(0,i.jsx)(`p`,{className:`theme-text-muted mt-0.5 font-mono text-xs`,children:a.name}),a.description&&(0,i.jsx)(`p`,{className:`theme-text-secondary mt-2 text-sm`,children:a.description}),(0,i.jsxs)(`p`,{className:`mt-2 text-sm`,children:[(0,i.jsxs)(`span`,{className:`theme-text-accent font-medium`,children:[a.icon_count,` icons`]}),` · `,(0,i.jsx)(`a`,{href:o,className:`theme-text-accent theme-link`,children:`Browse this package →`})]}),(0,i.jsxs)(`div`,{className:`mt-8 grid gap-8 md:grid-cols-2`,children:[(0,i.jsxs)(`section`,{children:[(0,i.jsxs)(`h2`,{className:`text-lg font-semibold`,children:[`Categories (`,a.categories.length,`)`]}),(0,i.jsx)(`ul`,{className:`mt-3 space-y-1.5`,children:a.categories.map(e=>(0,i.jsxs)(`li`,{className:`theme-text-secondary flex items-center justify-between text-sm`,children:[(0,i.jsx)(`span`,{children:e.name}),(0,i.jsx)(`span`,{className:`theme-text-muted font-mono text-xs`,children:e.icon_count})]},e.id))}),a.categories.length===0&&(0,i.jsx)(`p`,{className:`theme-text-muted text-sm`,children:`No categories.`})]}),(0,i.jsxs)(`section`,{children:[(0,i.jsxs)(`h2`,{className:`text-lg font-semibold`,children:[`Variants (`,a.variants.length,`)`]}),(0,i.jsx)(`ul`,{className:`mt-3 space-y-1.5`,children:a.variants.map(e=>(0,i.jsxs)(`li`,{className:`theme-text-secondary flex items-center justify-between text-sm`,children:[(0,i.jsx)(`span`,{children:e.name}),(0,i.jsx)(`span`,{className:`theme-text-muted font-mono text-xs`,children:e.icon_count})]},e.id))}),a.variants.length===0&&(0,i.jsx)(`p`,{className:`theme-text-muted text-sm`,children:`No variants.`})]})]})]})})}export{a as default}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-TourModal-pXzD1rw4-tkBN3CVN.js b/public/assets/js/inertia-app-TourModal-pXzD1rw4-tkBN3CVN.js new file mode 100644 index 0000000..ab254a0 --- /dev/null +++ b/public/assets/js/inertia-app-TourModal-pXzD1rw4-tkBN3CVN.js @@ -0,0 +1 @@ +import{F as e,P as t,Rt as n,T as r,jt as i,k as a,r as o,t as s,tt as c}from"./inertia-app.js";import{t as l}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var u=l(),d=[{icon:`sparkles`,titleKey:`tour.s1Title`,bodyKey:`tour.s1Body`},{icon:`search`,titleKey:`tour.s2Title`,bodyKey:`tour.s2Body`},{icon:`palette`,titleKey:`tour.s3Title`,bodyKey:`tour.s3Body`},{icon:`copy`,titleKey:`tour.s4Title`,bodyKey:`tour.s4Body`},{icon:`folder`,titleKey:`tour.s5Title`,bodyKey:`tour.s5Body`}];function f(){let l=i(e=>e.tour.step),f=i(e=>e.nextTourStep),p=i(e=>e.prevTourStep),m=i(e=>e.skipTour),h=i(e=>e.endTour),g=n(),_=d.length,v=Math.min(l,_-1),y=d[v],b=v>=_-1;return(0,u.jsxs)(s,{onClose:m,width:400,label:g(`settings.tourTitle`),children:[(0,u.jsx)(`div`,{className:`px-4 pt-4 sm:px-6 sm:pt-6`,children:(0,u.jsx)(`div`,{className:`flex h-32 items-center justify-center rounded-lg bg-tertiary`,children:(0,u.jsx)(t,{color:`brand`,size:`xl`,theme:`modern`,icon:e(y.icon)})})}),(0,u.jsx)(a,{align:`center`,title:g(y.titleKey),description:g(y.bodyKey)}),(0,u.jsxs)(`div`,{className:`flex flex-col items-center gap-2 pt-5`,children:[(0,u.jsx)(`div`,{"aria-hidden":!0,className:`flex gap-4`,children:d.map((e,t)=>(0,u.jsx)(`span`,{className:c(`size-2.5 rounded-full transition-colors`,t===v?`bg-fg-brand-primary_alt`:`bg-quaternary`)},t))}),(0,u.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:g(`tour.stepOf`,{n:v+1,total:_})})]}),(0,u.jsxs)(o,{layout:`grid`,children:[v===0?(0,u.jsx)(r,{color:`secondary`,size:`md`,onClick:m,children:g(`tour.skip`)}):(0,u.jsx)(r,{color:`secondary`,size:`md`,onClick:p,children:g(`tour.back`)}),(0,u.jsx)(r,{color:`primary`,size:`md`,onClick:()=>b?h():f(),children:g(b?`tour.getStarted`:`tour.next`)})]})]})}export{f as TourModal}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-jsx-runtime-CS4hA3mQ.js b/public/assets/js/inertia-app-jsx-runtime-CS4hA3mQ.js new file mode 100644 index 0000000..3975887 --- /dev/null +++ b/public/assets/js/inertia-app-jsx-runtime-CS4hA3mQ.js @@ -0,0 +1,9 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),l=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,te||(te=!0,ae());else{var t=n(l);t!==null&&ce(ee,t.startTime-e)}}}var te=!1,ne=-1,re=5,x=-1;function ie(){return g?!0:!(e.unstable_now()-xt&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(ee,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():te=!1}}}var ae;if(typeof y==`function`)ae=function(){y(S)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=S,ae=function(){se.postMessage(null)}}else ae=function(){_(S,0)};function ce(t,n){ne=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(ne),ne=-1):h=!0,ce(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,te||(te=!0,ae()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function ee(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var te=ee.prototype=new b;te.constructor=ee,_(te,y.prototype),te.isPureReactComponent=!0;var ne=Array.isArray;function re(){}var x={H:null,A:null,T:null,S:null},ie=Object.prototype.hasOwnProperty;function S(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ae(e,t){return S(e.type,t,e.props)}function oe(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function se(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ce=/\/+/g;function le(e,t){return typeof e==`object`&&e&&e.key!=null?se(``+e.key):t.toString(36)}function ue(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(re,re):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function de(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,de(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+le(e,0):a,ne(o)?(i=``,c!=null&&(i=c.replace(ce,`$&/`)+`/`),de(o,r,i,``,function(e){return e})):o!=null&&(oe(o)&&(o=ae(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ce,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ne(e))for(var u=0;u{t.exports=d()})),p=o((e=>{var t=f();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=u(),n=f(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1Ae||(e.current=ke[Ae],ke[Ae]=null,Ae--)}function T(e,t){Ae++,ke[Ae]=e.current,e.current=t}var Ne=je(null),Pe=je(null),Fe=je(null),Ie=je(null);function Le(e,t){switch(T(Fe,t),T(Pe,e),T(Ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}Me(Ne),T(Ne,e)}function Re(){Me(Ne),Me(Pe),Me(Fe)}function ze(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,T(Ie,e)),t=Ne.current;var n=dp(t,e.type);t!==n&&(T(Pe,e),T(Ne,n))}function Be(e){Pe.current===e&&(Me(Ne),Me(Pe)),Ie.current===e&&(Me(Ie),sh._currentValue=Oe)}var Ve,He;function Ue(e){if(Ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ve=t&&t[1]||``,He=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{We=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ue(n):``}function Ke(e,t){switch(e.tag){case 26:case 27:case 5:return Ue(e.type);case 16:return Ue(`Lazy`);case 13:return e.child!==t&&t!==null?Ue(`Suspense Fallback`):Ue(`Suspense`);case 19:return Ue(`SuspenseList`);case 0:case 15:return Ge(e.type,!1);case 11:return Ge(e.type.render,!1);case 1:return Ge(e.type,!0);case 31:return Ue(`Activity`);case 30:return Ue(`ViewTransition`);default:return``}}function qe(e){try{var t=``,n=null;do t+=Ke(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var Je=Object.prototype.hasOwnProperty,Ye=t.unstable_scheduleCallback,Xe=t.unstable_cancelCallback,Ze=t.unstable_shouldYield,Qe=t.unstable_requestPaint,$e=t.unstable_now,et=t.unstable_getCurrentPriorityLevel,tt=t.unstable_ImmediatePriority,nt=t.unstable_UserBlockingPriority,rt=t.unstable_NormalPriority,it=t.unstable_LowPriority,at=t.unstable_IdlePriority,ot=t.log,st=t.unstable_setDisableYieldValue,ct=null,lt=null;function ut(e){if(typeof ot==`function`&&st(e),lt&&typeof lt.setStrictMode==`function`)try{lt.setStrictMode(ct,e)}catch{}}var dt=Math.clz32?Math.clz32:mt,ft=Math.log,pt=Math.LN2;function mt(e){return e>>>=0,e===0?32:31-(ft(e)/pt|0)|0}var ht=256,gt=262144,_t=4194304;function vt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function yt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=vt(n))):i=vt(o):i=vt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=vt(n))):i=vt(o)):i=vt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function bt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function xt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0n;n++)t.push(e);return t}function Tt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Et(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0=wr),Dr=` `,Or=!1;function kr(e,t){switch(e){case`keyup`:return Sr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Ar(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var jr=!1;function Mr(e,t){switch(e){case`compositionend`:return Ar(t);case`keypress`:return t.which===32?(Or=!0,Dr):null;case`textInput`:return e=t.data,e===Dr&&Or?null:e;default:return null}}function Nr(e,t){if(jr)return e===`compositionend`||!Cr&&kr(e,t)?(e=Gn(),Wn=Un=Hn=null,jr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=ni(n)}}function ii(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ii(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ai(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ti(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ti(e.document)}return t}function oi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var si=zn&&`documentMode`in document&&11>=document.documentMode,ci=null,li=null,ui=null,di=!1;function fi(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;di||ci==null||ci!==ti(r)||(r=ci,`selectionStart`in r&&oi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ui&&ei(ui,r)||(ui=r,r=Jf(li,`onSelect`),0>=o,i-=o,ca=1<<32-dt(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),A&&ua(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),A&&ua(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return A&&ua(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),A&&ua(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===ce&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case oe:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===ce){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),vo(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===_e&&uo(l)===r.type){n(e,r.sibling),c=a(r,o.props),vo(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===ce?(c=Yi(o.props.children,e.mode,c,o.key),vo(c,o),c.return=e,e=c):(c=Ji(o.type,o.key,o.props,null,e.mode,c),vo(c,o),c.return=e,e=c)}return s(e);case se:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Qi(o,e.mode,c),c.return=e,e=c}return s(e);case _e:return o=uo(o),_(e,r,o,c)}if(De(o))return h(e,r,o,c);if(we(o)){if(l=we(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,_o(o),c);if(o.$$typeof===fe)return _(e,r,Ia(e,o),c);yo(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Xi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{go=0;var i=_(e,t,n,r);return ho=null,i}catch(t){if(t===io||t===oo)throw t;var a=Wi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var xo=bo(!0),So=bo(!1),Co=!1;function wo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function To(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Eo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Do(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,W&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Vi(e),Bi(e,null,n),t}return Li(e,r,t,n),Vi(e)}function Oo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ot(e,n)}}function ko(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ao=!1;function jo(){if(Ao){var e=Ya;if(e!==null)throw e}}function Mo(e,t,n,r){Ao=!1;var i=e.updateQueue;Co=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(q&f)===f:(r&f)===f){f!==0&&f===Ja&&(Ao=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=S({},d,f);break a;case 2:Co=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),sd|=o,e.lanes=o,e.memoizedState=d}}function No(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Po(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=C.T,s={};s.types=o===null?null:o.types,C.T=s,_c(e,!1,t,n);try{var c=i(),l=C.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?gc(e,t,Qa(c,r),jd(e)):gc(e,t,r,jd(e))}catch(n){gc(e,t,{then:function(){},status:`rejected`,reason:n},jd())}finally{w.p=a,o!==null&&s.types!==null&&(o.types=s.types),C.T=o}}function oc(){}function sc(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=cc(e).queue;ac(e,a,t,Oe,n===null?oc:function(){return lc(e),n(r)})}function cc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Oe,baseState:Oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:Oe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function lc(e){var t=cc(e);t.next===null&&(t=e.alternate.memoizedState),gc(e,t.next.queue,{},jd())}function uc(){return Fa(sh)}function dc(){return I().memoizedState}function fc(){return I().memoizedState}function pc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=jd();e=Eo(n);var r=Do(t,e,n);r!==null&&(Pd(r,t,n),Oo(r,t,n)),t={cache:Va()},e.payload=t;return}t=t.return}}function mc(e,t,n){var r=jd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},vc(e)?yc(t,n):(n=Ri(e,t,n,r),n!==null&&(Pd(n,e,r),bc(n,t,r)))}function hc(e,t,n){gc(e,t,n,jd())}function gc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(vc(e))yc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,$r(s,o))return Li(e,t,i,0),G===null&&Ii(),!1}catch{}if(n=Ri(e,t,i,r),n!==null)return Pd(n,e,r),bc(n,t,r),!0}return!1}function _c(e,t,n,r){if(r={lane:2,revertLane:Pf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},vc(e)){if(t)throw Error(i(479))}else t=Ri(e,n,r,2),t!==null&&Pd(t,e,2)}function vc(e){var t=e.alternate;return e===M||t!==null&&t===M}function yc(e,t){$o=Qo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function bc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ot(e,n)}}var xc={readContext:Fa,use:gs,useCallback:F,useContext:F,useEffect:F,useImperativeHandle:F,useLayoutEffect:F,useInsertionEffect:F,useMemo:F,useReducer:F,useRef:F,useState:F,useDebugValue:F,useDeferredValue:F,useTransition:F,useSyncExternalStore:F,useId:F,useHostTransitionStatus:F,useFormState:F,useActionState:F,useOptimistic:F,useMemoCache:F,useCacheRefresh:F,useEffectEvent:F},Sc={readContext:Fa,use:gs,useCallback:function(e,t){return ps().memoizedState=[e,t===void 0?null:t],e},useContext:Fa,useEffect:Ks,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Ws(4194308,4,Qs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ws(4194308,4,e,t)},useInsertionEffect:function(e,t){Ws(4,2,e,t)},useMemo:function(e,t){var n=ps();t=t===void 0?null:t;var r=e();if(es){ut(!0);try{e()}finally{ut(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ps();if(n!==void 0){var i=n(t);if(es){ut(!0);try{n(t)}finally{ut(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=mc.bind(null,M,e),[r.memoizedState,e]},useRef:function(e){var t=ps();return e={current:e},t.memoizedState=e},useState:function(e){e=Os(e);var t=e.queue,n=hc.bind(null,M,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ec,useDeferredValue:function(e,t){return rc(ps(),e,t)},useTransition:function(){var e=Os(!1);return e=ac.bind(null,M,e.queue,!0,!1),ps().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=M,a=ps();if(A){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),G===null)throw Error(i(349));q&127||Cs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Ks(Ts.bind(null,r,o,e),[e]),r.flags|=2048,Hs(9,{destroy:void 0},ws.bind(null,r,o,n,t),null),n},useId:function(){var e=ps(),t=G.identifierPrefix;if(A){var n=la,r=ca;n=(r&~(1<<32-dt(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=ts++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[Ft]=t,o[It]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(np(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&vl(t)}}return z(t),t.subtreeFlags&=-33554433,yl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&vl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=Fe.current,xa(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=O,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Ft]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ep(e.nodeValue,n)),e||va(t,!0)}else e=lp(e).createTextNode(r),e[Ft]=t,t.stateNode=e}return z(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=xa(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[Ft]=t}else Sa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;z(t),e=!1}else n=Ca(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ko(t),t):(Ko(t),null);if(t.flags&128)throw Error(i(558))}return z(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=xa(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[Ft]=t}else Sa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;z(t),a=!1}else a=Ca(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Ko(t),t):(Ko(t),null)}return Ko(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),xl(t,t.updateQueue),z(t),null);case 4:return Re(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,z(t),null;case 10:return ka(t.type),z(t),null;case 19:if(Yo(t),r=t.memoizedState,r===null)return z(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Sl(r,!1);else{if(Y!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Xo(e),o!==null){for(t.flags|=128,Sl(r,!1),e=o.updateQueue,t.updateQueue=e,xl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)qi(n,e),n=n.sibling;return Jo(t,qo.current&1|2),A&&ua(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&$e()>_d&&(t.flags|=128,a=!0,Sl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Xo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,xl(t,e),Sl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!A)return z(t),null}else 2*$e()-r.renderingStartTime>_d&&n!==536870912&&(t.flags|=128,a=!0,Sl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=$e(),e.sibling=null,o=qo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||A?Jo(t,o):(n=o,T(Bo,t),T(qo,n),Vo===null&&(Vo=t)),A&&ua(t,r.treeForkCount),e}return z(t),null;case 22:case 23:return Ko(t),zo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(z(t),t.subtreeFlags&6&&(t.flags|=8192)):z(t),n=t.updateQueue,n!==null&&xl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&Me(eo),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ka(j),z(t),null;case 25:return null;case 30:return t.flags|=33554432,z(t),null}throw Error(i(156,t.tag))}function wl(e,t){switch(pa(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ka(j),Re(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Be(t),null;case 31:if(t.memoizedState!==null){if(Ko(t),t.alternate===null)throw Error(i(340));Sa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ko(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Sa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Yo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Re(),null;case 10:return ka(t.type),null;case 22:case 23:return Ko(t),zo(),e!==null&&Me(eo),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ka(j),null;case 25:return null;default:return null}}function Tl(e,t){switch(pa(t),t.tag){case 3:ka(j),Re();break;case 26:case 27:case 5:Be(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&Ko(t);break;case 13:Ko(t);break;case 19:Yo(t);break;case 10:ka(t.type);break;case 22:case 23:Ko(t),zo(),e!==null&&Me(eo);break;case 24:ka(j)}}function El(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Dl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function Ol(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Po(t,n)}catch(t){Z(e,e.return,t)}}}function kl(e,t,n){n.props=kc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Al(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=ki(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);h(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function jl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function Ml(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n title`))),np(r,t,n),r[Ft]=e,E(r),t=r;break a;case`link`:if(o=Gm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;sg&&(o=g,g=h,h=o);var _=ri(s,h),v=ri(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,C.T=null,n=wd,wd=null;var o=bd,s=Sd;if(X=0,xd=bd=null,Sd=0,W&6)throw Error(i(331));var c=W;if(W|=4,Zu(o.current),Uu(o,o.current,s,n),W=c,Df(0,!1),lt&&typeof lt.onPostCommitFiberRoot==`function`)try{lt.onPostCommitFiberRoot(ct,o)}catch{}return!0}finally{w.p=a,C.T=r,uf(e,t)}}function pf(e,t,n){t=ea(n,t),t=Fc(e.stateNode,t,2),e=Do(e,t,2),e!==null&&(Tt(e,2),Ef(e))}function Z(e,t,n){if(e.tag===3)pf(e,e,n);else for(;t!==null;){if(t.tag===3){pf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(yd===null||!yd.has(r))){e=ea(n,e),n=Ic(2),r=Do(t,n,2),r!==null&&(Lc(n,r,t,e),Tt(r,2),Ef(r));break}}t=t.return}}function mf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new td;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ad=!0,i.add(n),e=hf.bind(null,e,t,n),t.then(e,e))}function hf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,G===e&&(q&n)===n&&(Y===4||Y===3&&(q&62914560)===q&&300>$e()-hd?W&2?ld|=n:Vd(e,0):ld|=n,dd===q&&(dd=0)),Ef(e)}function gf(e,t){t===0&&(t=Ct()),e=zi(e,t),e!==null&&(Tt(e,t),Ef(e))}function _f(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gf(e,n)}function vf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),gf(e,n)}function yf(e,t){return Ye(e,t)}var bf=null,xf=null,Sf=!1,Cf=!1,wf=!1,Tf=0;function Ef(e){e!==xf&&e.next===null&&(xf===null?bf=xf=e:xf=xf.next=e),Cf=!0,Sf||(Sf=!0,Nf())}function Df(e,t){if(!wf&&Cf){wf=!0;do for(var n=!1,r=bf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-dt(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Mf(r,a))}else a=q,a=yt(r,r===G?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||bt(r,a)||(n=!0,Mf(r,a))}r=r.next}while(n);wf=!1}}function Of(){kf()}function kf(){Cf=Sf=!1;var e=0;Tf!==0&&hp()&&(e=Tf);for(var t=$e(),n=null,r=bf;r!==null;){var i=r.next,a=Af(r,t);a===0?(r.next=null,n===null?bf=i:n.next=i,i===null&&(xf=n)):(n=r,(e!==0||a&3)&&(Cf=!0)),r=i}X!==0&&X!==5||Df(e,!1),Tf!==0&&(Tf=0)}function Af(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=hn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),E(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+hn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+hn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+hn(n.imageSizes)+`"]`)):i+=`[href="`+hn(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=S({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[Ut]=!0,o.onload=o.onerror=function(){Yt(o)}),E(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+hn(r)+`"][href="`+hn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=S({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),E(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=Jt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=S({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);E(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=Jt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=S({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),E(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=Jt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=S({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),E(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=Fe.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=Jt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=Jt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=Jt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pm(e){return`href="`+hn(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Ut]){r.loading=1;return}}else t=e.createElement(`link`),t[Ut]=!0,t.onload=t.onerror=Yt.bind(null,t),np(t,`link`,n),E(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+hn(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+hn(n.href)+`"]`);if(r)return t.instance=r,E(r),r;var a=S({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),E(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,E(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),E(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,E(a),a):(r=n,(a=vm.get(o))&&(r=S({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),E(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,E(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),E(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),v=o(((e,t)=>{t.exports=_()}));export{o as a,f as i,g as n,c as o,m as r,v as t}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-propsToCatalog-BMfZFXhT.js b/public/assets/js/inertia-app-propsToCatalog-BMfZFXhT.js new file mode 100644 index 0000000..22420a6 --- /dev/null +++ b/public/assets/js/inertia-app-propsToCatalog-BMfZFXhT.js @@ -0,0 +1 @@ +function e(e){return{...e,category:e.category??``,variant:e.variant??`outline`}}function t(e){return{id:e.name,label:e.label??e.name,description:e.description??``,count:e.count??0,installed:!0,loaded:!0}}function n(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;if(Array.isArray(t.cats)){let e=t.cats.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;if(typeof t.name!=`string`)return[];let n=Array.isArray(t.sub)?t.sub.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.slug==`string`?[{slug:t.slug,name:typeof t.name==`string`?t.name:t.slug,count:typeof t.count==`number`?t.count:0}]:[]}):void 0;return[{name:t.name,count:typeof t.count==`number`?t.count:0,...n?{sub:n}:{}}]}),n=typeof t.pack==`string`?t.pack:typeof t.id==`string`?t.id:null;return n?[{pack:n,label:typeof t.label==`string`?t.label:typeof t.title==`string`?t.title:n,count:typeof t.count==`number`?t.count:e.length,cats:e}]:[]}let n=Array.isArray(t.children)?t.children:[],r=typeof t.id==`string`?t.id:typeof t.pack==`string`?t.pack:null;if(!r)return[];let i=n.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;if(typeof t.name!=`string`)return[];let n=(Array.isArray(t.children)?t.children:[]).flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.name==`string`?[{slug:t.name,name:typeof t.label==`string`?t.label:t.name,count:typeof t.icon_count==`number`?t.icon_count:0}]:[]});return[{name:t.name,count:typeof t.icon_count==`number`?t.icon_count:0,...n.length?{sub:n}:{}}]});return[{pack:r,label:typeof t.title==`string`?t.title:typeof t.label==`string`?t.label:typeof t.name==`string`?t.name:r,count:typeof t.icon_count==`number`?t.icon_count:i.length,cats:i}]}):[]}export{n,t as r,e as t}; \ No newline at end of file diff --git a/public/assets/js/inertia-app-useInertiaMutations-ByVkwCnP.js b/public/assets/js/inertia-app-useInertiaMutations-ByVkwCnP.js new file mode 100644 index 0000000..b63387b --- /dev/null +++ b/public/assets/js/inertia-app-useInertiaMutations-ByVkwCnP.js @@ -0,0 +1 @@ +import{Gt as e,Wt as t}from"./inertia-app.js";var n={viewed:`view`,copied:`copy`,downloaded:`download`},r={view:`viewed`,copy:`copied`,download:`downloaded`},i=[`favorites`,`collections`,`history`,`commandHistory`],a=[`flash`,`errors`],o={preserveState:!0,preserveScroll:!0,async:!0};function s(){let{props:r}=t(),s=r.ichava.routes,c=r.ichava.features?.library?.enabled?r.ichava.features.library.endpoints.destroy??null:null;return{toggleFavorite:t=>e.post(`${s.favorites}/${t}/toggle`,{},{...o,only:[...i,...a]}),addFavorite:t=>e.post(`${s.favorites}/${t}`,{},{...o,only:[`favorites`,...a]}),removeFavorite:t=>e.delete(`${s.favorites}/${t}`,{...o,only:[`favorites`,...a]}),pushHistory:(t,r)=>e.post(s.history,{icon_id:t,action:n[r]??r},{...o,only:[`history`,...a]}),logCommand:(t,n,r={})=>e.post(s.commands,{command:t,type:n,metadata:r},{preserveState:!0,only:[`commandHistory`,...a]}),clearCommands:()=>e.delete(s.commands,{...o,only:[`commandHistory`,...a]}),deleteLibrary:()=>{c&&e.delete(c,{...o,only:[`favorites`,`collections`,...a]})},createCollection:(t,n=[])=>e.post(s.collections,n.length?{name:t,icon_ids:[...n]}:{name:t},{...o,only:[`collections`,...a]}),updateCollection:(t,n)=>e.put(`${s.collections}/${t}`,n,{...o,only:[`collections`,...a]}),deleteCollection:t=>e.delete(`${s.collections}/${t}`,{...o,only:[`collections`,...a]}),addToCollection:(t,n)=>e.post(`${s.collections}/${t}/icons/${n}`,{},{...o,only:[`collections`,...a]}),removeFromCollection:(t,n)=>e.delete(`${s.collections}/${t}/icons/${n}`,{...o,only:[`collections`,...a]}),clearHistory:()=>e.delete(s.history,{...o,only:[`history`,...a]}),clearCache:()=>e.post(s.cache.clear,{},{preserveState:!0,only:[`cacheStats`,`cacheHealthy`,...a]}),rebuildCache:()=>e.post(s.cache.rebuild,{},{preserveState:!0,only:[`cacheStats`,`cacheHealthy`,...a]})}}export{r as n,s as t}; \ No newline at end of file diff --git a/public/assets/js/inertia-app.js b/public/assets/js/inertia-app.js index b03a868..e78c31b 100644 --- a/public/assets/js/inertia-app.js +++ b/public/assets/js/inertia-app.js @@ -1,5 +1,6 @@ -var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function N(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function P(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,P(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),P(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u{t.exports=u()})),f=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function p(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function m(){}function h(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function g(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function _(e){return f.Buffer!==void 0&&f.Buffer.isBuffer(e)}function v(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function y(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var b=`[object RegExp]`,x=`[object String]`,S=`[object Number]`,C=`[object Boolean]`,w=`[object Arguments]`,T=`[object Symbol]`,E=`[object Date]`,D=`[object Map]`,O=`[object Set]`,k=`[object Array]`,A=`[object Function]`,j=`[object ArrayBuffer]`,M=`[object Object]`,N=`[object Error]`,P=`[object DataView]`,F=`[object Uint8Array]`,I=`[object Uint8ClampedArray]`,L=`[object Uint16Array]`,R=`[object Uint32Array]`,ee=`[object BigUint64Array]`,z=`[object Int8Array]`,B=`[object Int16Array]`,V=`[object Int32Array]`,te=`[object BigInt64Array]`,ne=`[object Float32Array]`,re=`[object Float64Array]`;function ie(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(h(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;ade(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case k:case F:case I:case L:case R:case ee:case z:case B:case V:case te:case ne:case re:if(_(e)!==_(t)||e.length!==t.length)return!1;for(let i=0;i=0}function he(e){return e!=null&&typeof e!=`function`&&me(e.length)}function ge(e){return typeof e==`symbol`||e instanceof Symbol}function _e(e){if(typeof e==`string`)return e;if(Array.isArray(e)){let t=``;for(let n=0;n0&&(t+=`,`),t+=_e(e[n]);return t}if(ge(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function ve(e){return e==null?``:_e(e)}function ye(e){var t;return typeof e==`string`||typeof e==`symbol`?e:Object.is(e==null||(t=e.valueOf)==null?void 0:t.call(e),-0)?`-0`:String(e)}function be(e){if(Array.isArray(e))return e.map(ye);if(typeof e==`symbol`)return[e];e=ve(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r{t.set(a,je(e,a,n,r,i))}),t}if(e instanceof Set){let t=new Set;return r.set(e,t),e.forEach(e=>{t.add(je(e,void 0,n,r,i))}),t}if(Oe(e))return e.subarray();if(ke(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a=0&&e{let r=e[t];(!(Se(e,t)&&le(r,n))||n===void 0&&!(t in e))&&(e[t]=n)};function Ke(e,t,n,r){if(e==null&&!De(e))return e;let i;i=Ue(t,e)?[t]:Array.isArray(t)?t:be(t);let a=n(Te(e,i)),o=e;for(let t=0;tn,()=>void 0)}function Je(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=p(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function Ye(e){if(h(e))return e;if(Array.isArray(e)||g(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e);if(t==null)return Object.assign(Object.create(t),e);let n=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new n(e);if(e instanceof RegExp){let t=new n(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new n(e.buffer.slice(0));if(e instanceof Error){let t;return t=typeof AggregateError<`u`&&e instanceof AggregateError?new n(e.errors,e.message,{cause:e.cause}):new n(e.message,{cause:e.cause}),t.stack=e.stack,Object.assign(t,e),t}if(typeof File<`u`&&e instanceof File)return new n([e],e.name,{type:e.type,lastModified:e.lastModified});if(typeof e==`object`){let n=Object.create(t);return Object.assign(n,e)}return e}function Xe(e,...t){let n=t.slice(0,-1),r=t[t.length-1],i=e;for(let e=0;etypeof File<`u`&&e instanceof File||e instanceof Blob||typeof FileList<`u`&&e instanceof FileList&&e.length>0,et=e=>e instanceof FormData||$e(e)||typeof e==`object`&&!!e&&Object.values(e).some(e=>et(e)),tt=class extends Error{response;constructor(e){super(`HTTP error ${e.status}`),this.name=`HttpResponseError`,this.response=e}},nt=class extends Error{constructor(e=`Request was cancelled`){super(e),this.name=`HttpCancelledError`}},rt=class extends Error{constructor(e=`Network error`){super(e),this.name=`HttpNetworkError`}};function it(e){let t=new URLSearchParams;return Object.entries(e).forEach(([e,n])=>{n!=null&&(Array.isArray(n)?n.forEach(n=>t.append(`${e}[]`,String(n))):typeof n==`object`?t.append(e,JSON.stringify(n)):t.append(e,String(n)))}),t.toString()}function at(e,t,n){if(t&&!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&(e=t.replace(/\/$/,``)+`/`+e.replace(/^\//,``)),n&&Object.keys(n).length>0){let t=it(n);t&&(e+=(e.includes(`?`)?`&`:`?`)+t)}return e}function ot(){return typeof window>`u`?null:window.axios?.defaults?.headers?.common?.[`X-Requested-With`]??null}function st(e,t=new FormData,n=null){for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&ct(t,n?`${n}[${r}]`:r,e[r]);return t}function ct(e,t,n){if(Array.isArray(n))return n.forEach((n,r)=>ct(e,`${t}[${r}]`,n));if(n instanceof Date)return e.append(t,n.toISOString());if(typeof File<`u`&&n instanceof File)return e.append(t,n,n.name);if(n instanceof Blob)return e.append(t,n);if(typeof n==`boolean`)return e.append(t,n?`1`:`0`);if(typeof n==`string`)return e.append(t,n);if(typeof n==`number`)return e.append(t,`${n}`);if(typeof n==`bigint`)return e.append(t,n.toString());if(n==null)return e.append(t,``);st(n,e,t)}function lt(e,t,n){if(e!=null)return e instanceof FormData?e:typeof e==`object`&&et(e)?st(e):typeof e==`object`||t[`Content-Type`]?.includes(`application/json`)?n(e):String(e)}function ut(e){let t={};return e.forEach((e,n)=>{t[n.toLowerCase()]=e}),t}function dt(e={}){let t=e.xsrfCookieName??`XSRF-TOKEN`,n=e.xsrfHeaderName??`X-XSRF-TOKEN`,r=e.serializer??JSON.stringify;function i(){if(typeof document>`u`)return null;let e=document.cookie.match(RegExp(`(^|;\\s*)`+t+`=([^;]*)`));return e?decodeURIComponent(e[2]):null}return{setXsrfCookieName(e){t=e},setXsrfHeaderName(e){n=e},setSerializer(e){r=e},async request(e){let t=at(e.url,e.baseURL,e.params),a=e.method.toUpperCase(),o={},s=ot();s&&(o[`X-Requested-With`]=s),e.data===void 0||[`GET`,`DELETE`].includes(a)||e.data instanceof FormData||et(e.data)||(o[`Content-Type`]=`application/json`),e.headers&&Object.entries(e.headers).forEach(([e,t])=>{t!==void 0&&(o[e]=String(t))});let c=i();c&&![`GET`,`HEAD`,`OPTIONS`].includes(a)&&(o[n]=c);let l=e.signal,u,d=e.timeout??3e4;if(d>0&&!l){let e=new AbortController;l=e.signal,u=setTimeout(()=>e.abort(),d)}let f=[`GET`,`DELETE`].includes(a)?void 0:lt(e.data,o,r);f instanceof FormData&&delete o[`Content-Type`];try{let n=await fetch(t,{method:a,headers:o,body:f,signal:l,credentials:e.credentials??`same-origin`});u&&clearTimeout(u);let r;r=n.headers.get(`content-type`)?.includes(`application/json`)?await n.json():await n.text();let i={status:n.status,data:r,headers:ut(n.headers)};if(!n.ok)throw new tt(i);return i}catch(e){throw u&&clearTimeout(u),e instanceof tt?e:e instanceof DOMException&&e.name===`AbortError`?new nt:e instanceof TypeError?new rt(e.message):e}}}}var ft=dt(),pt=ft,mt=void 0,ht=void 0,gt=`same-origin`,_t=e=>`${e.method}:${e.baseURL??mt??``}${e.url}`,vt=e=>e.status===204&&e.headers[`precognition-success`]===`true`,yt={},bt={get:(e,t={},n={})=>St(xt(`get`,e,t,n)),post:(e,t={},n={})=>St(xt(`post`,e,t,n)),patch:(e,t={},n={})=>St(xt(`patch`,e,t,n)),put:(e,t={},n={})=>St(xt(`put`,e,t,n)),delete:(e,t={},n={})=>St(xt(`delete`,e,t,n)),query:(e,t={},n={})=>St(xt(`query`,e,t,n)),useHttpClient(e){return pt=e,bt},withBaseURL(e){return mt=e,bt},withTimeout(e){return ht=e,bt},withCredentials(e){return gt=typeof e==`string`?e:e?`include`:`omit`,bt},fingerprintRequestsUsing(e){return _t=e===null?()=>null:e,bt},determineSuccessUsing(e){return vt=e,bt},withXsrfCookieName(e){return ft.setXsrfCookieName(e),bt},withXsrfHeaderName(e){return ft.setXsrfHeaderName(e),bt},withSerializer(e){return ft.setSerializer(e),bt}},xt=(e,t,n,r)=>({url:t,method:e,...r,...[`get`,`delete`].includes(e)?{params:Qe({},n,r?.params)}:{data:Qe({},n,r?.data)}}),St=(e={})=>{let t=[Ct,Tt,Et].reduce((e,t)=>t(e),e);return(t.onBefore??(()=>!0))()===!1?Promise.resolve(null):((t.onStart??(()=>null))(),pt.request({method:t.method,url:t.url,baseURL:t.baseURL??mt,data:t.data,params:t.params,headers:t.headers,signal:t.signal,timeout:t.timeout,credentials:gt}).then(async e=>{t.precognitive&&Dt(e);let n=e.status,r=e;return t.precognitive&&t.onPrecognitionSuccess&&vt(e)&&(r=await Promise.resolve(t.onPrecognitionSuccess(e)??r)),t.onSuccess&&wt(n)&&(r=await Promise.resolve(t.onSuccess(r)??r)),(kt(t,n)??(e=>e))(r)??r},e=>{if(Ot(e))return Promise.reject(e);let n=e;return t.precognitive&&Dt(n.response),(kt(t,n.response.status)??((e,t)=>Promise.reject(t)))(n.response,n)}).finally(t.onFinish??(()=>null)))},Ct=e=>{let t=e.only??e.validate;return{...e,timeout:e.timeout??ht,precognitive:e.precognitive!==!1,fingerprint:e.fingerprint===void 0?_t(e,pt):e.fingerprint,headers:{...e.headers,Accept:`application/json`,"Content-Type":At(e),...e.precognitive===!1?{}:{Precognition:!0},...t?{"Precognition-Validate-Only":Array.from(t).join()}:{}}}},wt=e=>e>=200&&e<300,Tt=e=>(typeof e.fingerprint==`string`&&(yt[e.fingerprint]?.abort(),delete yt[e.fingerprint]),e),Et=e=>typeof e.fingerprint!=`string`||e.signal||!e.precognitive?e:(yt[e.fingerprint]=new AbortController,{...e,signal:yt[e.fingerprint].signal}),Dt=e=>{if(e.headers?.precognition!==`true`)throw Error(`Did not receive a Precognition response. Ensure you have the Precognition middleware in place for the route.`)},Ot=e=>!(e instanceof tt)||typeof e.response?.status!=`number`,kt=(e,t)=>({401:e.onUnauthorized,403:e.onForbidden,404:e.onNotFound,409:e.onConflict,422:e.onValidationError,423:e.onLocked})[t],At=e=>e.headers?.[`Content-Type`]??e.headers?.[`Content-type`]??e.headers?.[`content-type`]??(et(e.data)?`multipart/form-data`:`application/json`),jt=(e,t)=>{if(!e.includes(`*`))return[e];let n=e.split(`.`),r=[``];for(let e of n)if(e===`*`){let e=[];for(let n of r){let r=n?Te(t,n):t;if(Array.isArray(r))for(let t=0;tt?`${t}.${e}`:e);return r},Mt=(e,t)=>t.includes(`*`)?RegExp(`^`+t.replace(/\./g,`\\.`).replace(/\*/g,`[^.]+`)+`$`).test(e):e===t,Nt=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>!t.some(t=>Mt(e,t)))),Pt=(e,t={})=>{let n={errorsChanged:[],touchedChanged:[],validatingChanged:[],validatedChanged:[]},r=!1,i=!1,a=e=>e===i?[]:(i=e,n.validatingChanged),o=[],s=e=>{let t=[...new Set(e)];return o.length!==t.length||!t.every(e=>o.includes(e))?(o=t,n.validatedChanged):[]},c=()=>o.filter(e=>d[e]===void 0),l=[],u=e=>{let t=[...new Set(e)];return l.length!==t.length||!t.every(e=>l.includes(e))?(l=t,n.touchedChanged):[]},d={},f=e=>{let t=It(e);return pe(d,t)?[]:(d=t,n.errorsChanged)},p=e=>{let t={...d};return delete t[Lt(e)],f(t)},m=()=>Object.keys(d).length>0,h=1500,g=e=>{h=e,S.cancel(),S=x()},_=t,v=null,y=[],b=null,x=()=>Je(t=>{e({get:(e,n={},r={})=>bt.get(e,T(n),C(r,t,n)),post:(e,n={},r={})=>bt.post(e,T(n),C(r,t,n)),patch:(e,n={},r={})=>bt.patch(e,T(n),C(r,t,n)),put:(e,n={},r={})=>bt.put(e,T(n),C(r,t,n)),delete:(e,n={},r={})=>bt.delete(e,T(n),C(r,t,n)),query:(e,n={},r={})=>bt.query(e,T(n),C(r,t,n))}).catch(e=>e instanceof nt||e instanceof tt&&e.response?.status===422?null:Promise.reject(e))},h,{leading:!0,trailing:!0}),S=x(),C=(e,t,n={})=>{let r={...e,...t},i=Array.from(r.only??r.validate??l);return{...t,...Qe({},e,t),only:i,timeout:r.timeout??5e3,onValidationError:(e,t)=>([...s([...o,...i]),...f(Qe(Nt({...d},i),e.data.errors))].forEach(e=>e()),r.onValidationError?r.onValidationError(e,t):Promise.reject(t)),onSuccess:e=>(s([...o,...i]).forEach(e=>e()),r.onSuccess?r.onSuccess(e):e),onPrecognitionSuccess:e=>([...s([...o,...i]),...f(Nt({...d},i))].forEach(e=>e()),r.onPrecognitionSuccess?r.onPrecognitionSuccess(e):e),onBefore:()=>{let e=l.some(e=>e.includes(`*`)),t=e?[...new Set(l.flatMap(e=>jt(e,n)))]:l;return r.onBeforeValidation&&r.onBeforeValidation({data:n,touched:t},{data:_,touched:y})===!1||(r.onBefore||(()=>!0))()===!1?!1:(e&&u(t).forEach(e=>e()),b=l,v=n,!0)},onStart:()=>{a(!0).forEach(e=>e()),(r.onStart??(()=>null))()},onFinish:()=>{a(!1).forEach(e=>e()),y=b,_=v,b=v=null,(r.onFinish??(()=>null))()}}},w=(e,t,n)=>{if(e===void 0){let e=Array.from(n?.only??n?.validate??[]);u([...l,...e]).forEach(e=>e()),S(n??{})}else $e(t)&&!r?console.warn(`Precognition file validation is not active. Call the "validateFiles" function on your form to enable it.`):(e=Lt(e),(e.includes(`*`)||Te(_,e)!==t)&&(u([e,...l]).forEach(e=>e()),S(n??{})))},T=e=>r===!1?Rt(e):e,E={touched:()=>l,validate(e,t,n){return typeof e==`object`&&!(`target`in e)&&(n=e,e=t=void 0),w(e,t,n),E},touch(e){let t=Array.isArray(e)?e:[Lt(e)];return u([...l,...t]).forEach(e=>e()),E},validating:()=>i,valid:c,errors:()=>d,hasErrors:m,setErrors(e){return f(e).forEach(e=>e()),E},forgetError(e){return p(e).forEach(e=>e()),E},defaults(e){return t=e,_=e,E},reset(...e){if(e.length===0)u([]).forEach(e=>e());else{let n=[...l];e.forEach(e=>{n.includes(e)&&n.splice(n.indexOf(e),1),qe(_,e,Te(t,e))}),u(n).forEach(e=>e())}return E},setTimeout(e){return g(e),E},on(e,t){return n[e].push(t),E},validateFiles(){return r=!0,E},withoutFileValidation(){return r=!1,E}};return E},Ft=e=>Object.keys(e).reduce((t,n)=>({...t,[n]:Array.isArray(e[n])?e[n][0]:e[n]}),{}),It=e=>Object.keys(e).reduce((t,n)=>({...t,[n]:typeof e[n]==`string`?[e[n]]:e[n]}),{}),Lt=e=>typeof e==`string`?e:e.target.name,Rt=e=>{let t={...e};return Object.keys(t).forEach(e=>{let n=t[e];n!==null&&($e(n)?delete t[e]:Array.isArray(n)?t[e]=Object.values(Rt({...n})):typeof n==`object`&&(t[e]=Rt(t[e])))}),t},zt=new class{config={};defaults;constructor(e){this.defaults=e}extend(e){return e&&(this.defaults={...this.defaults,...e}),this}replace(e){this.config=e}get(e){return Re(this.config,e)?Te(this.config,e):Te(this.defaults,e)}set(e,t){typeof e==`string`?qe(this.config,e,t):Object.entries(e).forEach(([e,t])=>{qe(this.config,e,t)})}}({form:{recentlySuccessfulDuration:2e3,forceIndicesArrayFormatInFormData:!0,withAllErrors:!1},prefetch:{cacheFor:3e4,hoverDelay:75}});function Bt(e,t){let n,r=function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)};return r.cancel=()=>clearTimeout(n),r}function Vt(e,t){return document.dispatchEvent(new CustomEvent(`inertia:${e}`,t))}var Ht=e=>Vt(`before`,{cancelable:!0,detail:{visit:e}}),Ut=(e,{page:t,visitId:n}={})=>Vt(`error`,{detail:{errors:e,page:t,visitId:n}}),Wt=e=>Vt(`networkError`,{cancelable:!0,detail:{error:e}}),Gt=e=>Vt(`finish`,{detail:{visit:e}}),Kt=e=>Vt(`httpException`,{cancelable:!0,detail:{response:e}}),qt=e=>Vt(`beforeUpdate`,{detail:{page:e}}),Jt=(e,{type:t,cached:n=!1,visitId:r})=>Vt(`navigate`,{detail:{page:e,type:t,cached:n,visitId:r}}),Yt=(e,{replace:t,visitId:n})=>Vt(`clientVisit`,{detail:{page:e,replace:t,visitId:n}}),Xt=e=>Vt(`progress`,{detail:{progress:e}}),Zt=e=>Vt(`start`,{detail:{visit:e}}),Qt=(e,{visitId:t}={})=>Vt(`success`,{detail:{page:e,visitId:t}}),$t=(e,t)=>Vt(`prefetched`,{detail:{fetchedAt:Date.now(),response:e,visit:t}}),en=e=>Vt(`prefetching`,{detail:{visit:e}}),tn=e=>Vt(`flash`,{detail:{flash:e}}),nn=(e,t)=>Vt(`location`,{cancelable:!0,detail:{url:e,versionChange:t}}),rn=e=>Vt(`live`,{cancelable:!0,detail:e}),an=`$bigint`,on=(e,t)=>typeof t==`bigint`?{[an]:t.toString()}:t,sn=(e,t)=>typeof t==`bigint`?t.toString():t;function cn(e){let t=JSON.parse(e);return t?.preserveBigIntegers===!0&&e.includes(`"${an}"`)&&ln(t),t}function ln(e){if(Array.isArray(e))for(let t=0;t({...e,preserveBigIntegers:!0}),on)}function fn(e){return pn(e,()=>e,sn)}function pn(e,t,n){try{return JSON.stringify(e)}catch(e){try{return JSON.stringify(t(),n)}catch{throw e}}}function mn(e,t=new WeakSet){return typeof e==`bigint`?!0:typeof e!=`object`||!e||t.has(e)?!1:(t.add(e),(Array.isArray(e)?e:Object.values(e)).some(e=>mn(e,t)))}var hn=class{static locationVisitKey=`inertiaLocationVisit`;static set(e,t){typeof window<`u`&&window.sessionStorage.setItem(e,JSON.stringify(t))}static get(e){if(typeof window<`u`)return JSON.parse(window.sessionStorage.getItem(e)||`null`)}static merge(e,t){let n=this.get(e);n===null?this.set(e,t):this.set(e,{...n,...t})}static remove(e){typeof window<`u`&&window.sessionStorage.removeItem(e)}static removeNested(e,t){let n=this.get(e);n!==null&&(delete n[t],this.set(e,n))}static exists(e){try{return this.get(e)!==null}catch{return!1}}static clear(){typeof window<`u`&&window.sessionStorage.clear()}},gn=12,_n=async e=>{if(typeof window>`u`)throw Error(`Unable to encrypt history`);hn.exists(vn.iv)&&(hn.remove(vn.key),hn.remove(vn.iv));let t=await wn(await Tn());if(!t)throw Error(`Unable to encrypt history`);let n=window.crypto.getRandomValues(new Uint8Array(gn)),r=new Uint8Array(await bn(n,t,e)),i=new Uint8Array(n.length+r.length);return i.set(n),i.set(r,n.length),i.buffer},vn={key:`historyKey`,iv:`historyIv`},yn=async e=>{let t=await Tn();if(!t)throw Error(`Unable to decrypt history`);let n=new Uint8Array(e);return await xn(n.subarray(0,gn),t,n.subarray(gn))},bn=async(e,t,n)=>{if(typeof window>`u`)throw Error(`Unable to encrypt history`);if(window.crypto.subtle===void 0)return console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve(n);let r=new TextEncoder,i=dn(n),a=new Uint8Array(i.length*3),o=r.encodeInto(i,a);return window.crypto.subtle.encrypt({name:`AES-GCM`,iv:e},t,a.subarray(0,o.written))},xn=async(e,t,n)=>{if(window.crypto.subtle===void 0)return console.warn(`Decryption is not supported in this environment. SSL is required.`),Promise.resolve(n);let r=await window.crypto.subtle.decrypt({name:`AES-GCM`,iv:e},t,n);return cn(new TextDecoder().decode(r))},Sn=async()=>window.crypto.subtle===void 0?(console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve(null)):window.crypto.subtle.generateKey({name:`AES-GCM`,length:256},!0,[`encrypt`,`decrypt`]),Cn=async e=>{if(window.crypto.subtle===void 0)return console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve();let t=await window.crypto.subtle.exportKey(`raw`,e);hn.set(vn.key,Array.from(new Uint8Array(t)))},wn=async e=>{if(e)return e;let t=await Sn();return t?(await Cn(t),t):null},Tn=async()=>{let e=hn.get(vn.key);return e?await window.crypto.subtle.importKey(`raw`,new Uint8Array(e),{name:`AES-GCM`,length:256},!0,[`encrypt`,`decrypt`]):null},En=class extends Error{code;url;constructor(e,t,n){super(n?`${e} (${n})`:e),this.name=`HttpError`,this.code=t,this.url=n}},Dn=class extends En{response;constructor(e,t,n){super(e,`ERR_HTTP_RESPONSE`,n),this.name=`HttpResponseError`,this.response=t}},On=class extends En{constructor(e=`Request was cancelled`,t){super(e,`ERR_CANCELLED`,t),this.name=`HttpCancelledError`}},kn=class extends En{cause;constructor(e,t,n){super(e,`ERR_NETWORK`,t),this.name=`HttpNetworkError`,this.cause=n}},An=e=>e instanceof FormData;function jn(e,t=new FormData,n=null,r=`brackets`){e||={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&Nn(t,Mn(n,i,`indices`),e[i],r);return t}function Mn(e,t,n){return e?n===`brackets`?`${e}[]`:`${e}[${t}]`:t}function Nn(e,t,n,r){if(Array.isArray(n))return Array.from(n.keys()).forEach(i=>Nn(e,Mn(t,i.toString(),r),n[i],r));if(n instanceof Date)return e.append(t,n.toISOString());if(n instanceof File)return e.append(t,n,n.name);if(n instanceof Blob)return e.append(t,n);if(typeof n==`boolean`)return e.append(t,n?`1`:`0`);if(typeof n==`string`)return e.append(t,n);if(typeof n==`number`)return e.append(t,`${n}`);if(typeof n==`bigint`)return e.append(t,n.toString());if(n==null)return e.append(t,``);jn(n,e,t,r)}var Pn=e=>{let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t},Fn=(e,t,n)=>{if(e===t)return!0;for(let r in e)if(!n.includes(r)&&e[r]!==t[r]&&!Ln(e[r],t[r]))return!1;for(let r in t)if(!n.includes(r)&&!(r in e))return!1;return!0},In=(e,t)=>{let n=Array.from(e.entries()),r=Array.from(t.entries());return n.length===r.length&&n.every(([e,t],n)=>e===r[n][0]&&t===r[n][1])},Ln=(e,t)=>{if(An(e)||An(t))return An(e)&&An(t)&&In(e,t);if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime();if(e===null||t===null||Array.isArray(e)!==Array.isArray(t))return e===t;switch(typeof e){case`object`:return Fn(e,t,[]);case`function`:return e.toString()===t.toString();default:return e===t}},Rn=(e,t,n)=>{let r=be(t);if(r.length===0)return e;let i=(e,t)=>{if(t===r.length)return n;let a=r[t],o=Array.isArray(e)?[...e]:e&&typeof e==`object`?{...e}:/^(?:0|[1-9]\d*)$/.test(a)?[]:{};return o[a]=i(e?.[a],t+1),o};return i(e,0)},zn=(e,t)=>e===t||e.startsWith(`${t}.`),Bn=(e,t)=>{let{only:n,except:r}=e;return!(n.length===0&&r.length===0||n.length>0&&!n.some(e=>zn(t,e))||r.length>0&&r.some(e=>zn(t,e)))},Vn=(e,t)=>{let n=e.only.concat(e.reset),{except:r}=e;return n.length===0&&r.length===0||!(n.length>0&&!n.some(e=>Hn(t,e))||r.length>0&&r.some(e=>zn(t,e)))},Hn=(e,t)=>zn(e,t)||zn(t,e),Un=e=>typeof File<`u`&&e instanceof File||e instanceof Blob||typeof FileList<`u`&&e instanceof FileList&&e.length>0;function Wn(e){return Un(e)||e instanceof FormData&&Array.from(e.values()).some(e=>Wn(e))||typeof e==`object`&&!!e&&Object.values(e).some(e=>Wn(e))}function Gn(e){return/\[\d+\]/.test(decodeURIComponent(e.search))}function Kn(e){if(!e||e===`?`)return{};let t={};return e.replace(/^\?/,``).split(`&`).filter(Boolean).forEach(e=>{let[n,r]=Jn(e);Xn(t,Yn(n),Yn(r))}),t}function qn(e,t){let n=[];return Qn(e,``,n,t),n.length?`?`+n.join(`&`):``}function Jn(e){let t=e.indexOf(`=`);return t===-1?[e,``]:[e.substring(0,t),e.substring(t+1)]}function Yn(e){return decodeURIComponent(e.replace(/\+/g,` `))}function Xn(e,t,n){let r=Zn(t);if(r.some(e=>e===`__proto__`))return;let i=e;for(;r.length>1;){let e=r.shift(),t=r[0]===``;(typeof i[e]!=`object`||i[e]===null)&&(i[e]=t?[]:{}),i=i[e]}let a=r.shift();a===``&&Array.isArray(i)?i.push(n):i[a]=n}function Zn(e){let t=[],n=e.split(`[`)[0];n&&t.push(n);let r,i=/\[([^\]]*)\]/g;for(;(r=i.exec(e))!==null;)t.push(r[1]);return t}function Qn(e,t,n,r){e!==void 0&&(e===null?n.push(`${t}=`):Array.isArray(e)?e.forEach((e,i)=>{Qn(e,r===`indices`?`${t}[${i}]`:`${t}[]`,n,r)}):typeof e==`object`?Object.keys(e).forEach(i=>{Qn(e[i],t?`${t}[${i}]`:i,n,r)}):n.push(`${t}=${encodeURIComponent(String(e))}`))}function $n(e){return new URL(e.toString(),typeof window>`u`?void 0:window.location.toString())}var er=(e,t,n,r,i)=>{let a=typeof e==`string`?$n(e):e;if((Wn(t)||r)&&!An(t)&&(zt.get(`form.forceIndicesArrayFormatInFormData`)&&(i=`indices`),t=jn(t,new FormData,null,i)),An(t))return[a,t];let[o,s]=tr(n,a,t,i);return[$n(o),s]};function tr(e,t,n,r=`brackets`){let i=e===`get`&&!An(n)&&Object.keys(n).length>0,a=lr(t.toString()),o=a||t.toString().startsWith(`/`)||t.toString()===``,s=!o&&!t.toString().startsWith(`#`)&&!t.toString().startsWith(`?`),c=/^[.]{1,2}([/]|$)/.test(t.toString()),l=t.toString().includes(`?`)||i,u=t.toString().includes(`#`),d=typeof window>`u`,f=new URL(t.toString(),d?`http://localhost`:window.location.toString());if(i){let e=Gn(f)?`indices`:r;f.search=qn({...Kn(f.search),...n},e)}return[[a?`${f.protocol}//${f.host}`:``,o?f.pathname:``,s?f.pathname.substring(d&&!c?1:0):``,l?f.search:``,u?f.hash:``].join(``),i?{}:n]}function nr(e){return e=new URL(e.href),e.hash=``,e}var rr=(e,t)=>{e.hash&&!t.hash&&nr(e).href===t.href&&(t.hash=e.hash)},ir=(e,t)=>nr(e).href===nr(t).href,ar=(e,t)=>e.origin===t.origin&&e.pathname===t.pathname;function or(e){return typeof e==`object`&&!!e&&e!==void 0&&`url`in e&&`method`in e}function sr(e){return e.component?typeof e.component==`string`?e.component:(console.error(`The "component" property on the URL method pair received multiple components (${Object.keys(e.component).join(`, `)}), but only a single component string is supported for instant visits. Use the withComponent() method to specify which component to use.`),null):null}function cr(e){return new URL(e,window.location.href).origin===window.location.origin}function lr(e){return/^([a-z][a-z0-9+.-]*:)?\/\/[^/]/i.test(e)}function ur(e,t){let n=typeof e==`string`?$n(e):e;return t?`${n.protocol}//${n.host}${n.pathname}${n.search}${n.hash}`:`${n.pathname}${n.search}${n.hash}`}var dr=new Map,fr=new Set,pr=null,mr=()=>{fr.forEach(e=>e())},hr=e=>{typeof window>`u`||e.prefetch||ar(e.url,window.location)&&(dr.set(e.id,{only:e.only,except:e.except,reset:e.reset}),mr())},gr=(e,t)=>{if(typeof window>`u`)return;let n=Object.values(t??{}).flat().filter(t=>Te(e,t)===void 0);n.length===0?_r():(pr={only:n,except:[],reset:[]},mr())},_r=()=>{pr!==null&&(pr=null,mr())},vr=e=>{dr.delete(e.id)&&mr()},yr={isRefreshing(e){for(let t of dr.values())if(Vn(t,e))return!0;return pr!==null&&Vn(pr,e)},onChange(e){return fr.add(e),()=>{fr.delete(e)}}},br={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},xr=e=>{if(typeof e==`number`)return e;for(let[t,n]of Object.entries(br))if(e.endsWith(t))return parseFloat(e)*n;return parseInt(e)},Sr=new class{cached=[];inFlightRequests=[];removalTimers=[];currentUse=null;add(e,t,{cacheFor:n,cacheTags:r}){if(this.findInFlight(e))return Promise.resolve();let i=this.findCached(e);if(!e.fresh&&i&&i.staleTimestamp>Date.now())return Promise.resolve();let[a,o]=this.extractStaleValues(n),s=!1,c=new Promise((n,r)=>{t({...e,onCancel:()=>{s=!0,this.remove(e),this.removeFromInFlight(e.id),e.onCancel(),r(new On)},onError:t=>{this.remove(e),e.onError(t),r(t)},onPrefetching(t){e.onPrefetching(t)},onPrefetched(t,n){e.onPrefetched(t,n)},onPrefetchResponse(e){n(e)},onPrefetchError:t=>{this.removeFromInFlight(e.id),r(t)}})}).then(t=>{if(!this.isInFlight(e.id))return t;this.remove(e);let n=t.getPageResponse();G.mergeOncePropsIntoResponse(n),this.cached.push({params:{...e},staleTimestamp:Date.now()+a,expiresAt:Date.now()+o,response:c,singleUse:o===0,timestamp:Date.now(),inFlight:!1,tags:Array.isArray(r)?r:[r]});let i=this.getShortestOncePropTtl(n);return this.scheduleForRemoval(e,i?Math.min(o,i):o),this.removeFromInFlight(e.id),t.handlePrefetch(),t});return s||this.inFlightRequests.push({params:{...e},response:c,staleTimestamp:null,inFlight:!0}),c.catch(t=>{if(this.removeFromInFlight(e.id),!(t instanceof On))throw t})}removeAll(){this.cached=[],this.inFlightRequests=[],this.removalTimers.forEach(e=>{clearTimeout(e.timer)}),this.removalTimers=[]}removeByTags(e){this.cached=this.cached.filter(t=>!t.tags.some(t=>e.includes(t)))}remove(e){this.cached=this.cached.filter(t=>!this.paramsAreEqual(t.params,e)),this.clearTimer(e)}isInFlight(e){return this.inFlightRequests.some(t=>t.params.id===e)}removeFromInFlight(e){this.inFlightRequests=this.inFlightRequests.filter(t=>t.params.id!==e)}extractStaleValues(e){let[t,n]=this.cacheForToStaleAndExpires(e);return[xr(t),xr(n)]}cacheForToStaleAndExpires(e){if(!Array.isArray(e))return[e,e];switch(e.length){case 0:return[0,0];case 1:return[e[0],e[0]];default:return[e[0],e[1]]}}clearTimer(e){let t=this.removalTimers.find(t=>this.paramsAreEqual(t.params,e));t&&(clearTimeout(t.timer),this.removalTimers=this.removalTimers.filter(e=>e!==t))}scheduleForRemoval(e,t){if(typeof window<`u`&&(this.clearTimer(e),t>0)){let n=window.setTimeout(()=>this.remove(e),t);this.removalTimers.push({params:e,timer:n})}}get(e){return this.findCached(e)||this.findInFlight(e)}use(e,t){let n=`${t.url.pathname}-${Date.now()}-${Math.random().toString(36).substring(7)}`,r={...t,cached:!0};return this.currentUse={id:n,async:t.async,params:r,response:null},hr(r),e.response.then(e=>{if(this.currentUse?.id===n)return e.mergeParams({...r,onPrefetched:()=>{}}),this.removeSingleUseItems(t),this.currentUse.response=e,e.handle().finally(()=>{this.currentUse?.id===n&&(this.currentUse=null)})},e=>{if(!(e instanceof On))throw e;this.currentUse?.id===n&&(this.currentUse=null),this.cancelUse(r)}).finally(()=>vr(r))}interruptInFlight({async:e}){let t=this.currentUse;t?.async===e&&(this.currentUse=null,t.response?t.response.interrupt():this.cancelUse(t.params))}cancelUse(e){e.cancelled||(e.cancelled=!0,vr(e),e.onCancel(),e.onFinish(e))}removeSingleUseItems(e){this.cached=this.cached.filter(t=>!this.paramsAreEqual(t.params,e)||!t.singleUse)}findCached(e){return this.cached.find(t=>this.paramsAreEqual(t.params,e))||null}findInFlight(e){return this.inFlightRequests.find(t=>this.paramsAreEqual(t.params,e))||null}withoutPurposePrefetchHeader(e){let t=H(e);return t.headers.Purpose===`prefetch`&&delete t.headers.Purpose,t}paramsAreEqual(e,t){return Fn(this.withoutPurposePrefetchHeader(e),this.withoutPurposePrefetchHeader(t),`id.showProgress.replace.prefetch.preserveScroll.preserveState.onBefore.onBeforeUpdate.onStart.onProgress.onFinish.onCancel.onSuccess.onError.onHttpException.onNetworkError.onFlash.onPrefetched.onCancelToken.onPrefetching.async.viewTransition.optimistic.component.pageProps.cached`.split(`.`))}updateCachedOncePropsFromCurrentPage(){this.cached.forEach(e=>{e.response.then(t=>{let n=t.getPageResponse();G.mergeOncePropsIntoResponse(n,{force:!0});for(let[e,t]of Object.entries(n.deferredProps??{})){let r=t.filter(e=>Te(n.props,e)===void 0);r.length>0?n.deferredProps[e]=r:delete n.deferredProps[e]}let r=this.getShortestOncePropTtl(n);if(r===null)return;let i=e.expiresAt-Date.now(),a=Math.min(i,r);a>0?this.scheduleForRemoval(e.params,a):this.remove(e.params)})})}getShortestOncePropTtl(e){let t=Object.values(e.onceProps??{}).map(e=>e.expiresAt).filter(e=>!!e);return t.length===0?null:Math.min(...t)-Date.now()}},Cr=e=>{if(e.offsetParent===null)return!1;let t=e.getBoundingClientRect(),n=t.top=0,r=t.left=0;return n&&r},wr=e=>{let t=e=>{let t=window.getComputedStyle(e);return t.overflowY===`scroll`?!0:t.overflowY===`auto`?[`visible`,`clip`].includes(t.overflowX)?!0:r(t.maxHeight,e.style.height)||i(e,`height`):!1},n=e=>{let t=window.getComputedStyle(e);return t.overflowX===`scroll`?!0:t.overflowX===`auto`?[`visible`,`clip`].includes(t.overflowY)?!0:r(t.maxWidth,e.style.width)||i(e,`width`):!1},r=(e,t)=>!!(e&&e!==`none`&&e!==`0px`||t&&t!==`auto`&&t!==`0`),i=(e,t)=>{let n=e.parentElement;if(!n)return!1;let r=window.getComputedStyle(n);if([`flex`,`inline-flex`].includes(r.display)){let e=[`column`,`column-reverse`].includes(r.flexDirection);return t===`height`?e:!e}return[`grid`,`inline-grid`].includes(r.display)},a=e?.parentElement;for(;a;){let e=t(a)||n(a);if(window.getComputedStyle(a).display!==`contents`&&e)return a;a=a.parentElement}return null},Tr=(e,t)=>{if(!t)return e.filter(e=>Cr(e));let n=e.indexOf(t),r=[],i=[];for(let t=n;t>=0;t--){let n=e[t];if(Cr(n))r.push(n);else break}for(let t=n+1;t{window.requestAnimationFrame(()=>{t>1?Er(e,t-1):e()})},Dr=e=>{if(typeof window>`u`)return null;let t=document.querySelector(`script[data-page="${e}"][type="application/json"]`);return t?.textContent?cn(t.textContent):null},Or=typeof window>`u`,kr=!Or&&/Firefox/i.test(window.navigator.userAgent),Ar=class{static save(){Ir.saveScrollPositions(this.getScrollRegions())}static getScrollRegions(){return Array.from(this.regions()).map(e=>({top:e.scrollTop,left:e.scrollLeft}))}static regions(){return document.querySelectorAll(`[scroll-region]`)}static scrollToTop(){if(kr&&getComputedStyle(document.documentElement).scrollBehavior===`smooth`)return Er(()=>window.scrollTo(0,0),2);window.scrollTo(0,0)}static reset(){(Or||!window.location.hash)&&this.scrollToTop(),this.regions().forEach(e=>{typeof e.scrollTo==`function`?e.scrollTo(0,0):(e.scrollTop=0,e.scrollLeft=0)}),this.save(),this.scrollToAnchor()}static scrollToAnchor(){let e=Or?null:window.location.hash;e&&setTimeout(()=>{let t=document.getElementById(e.slice(1));t?t.scrollIntoView():this.scrollToTop()})}static restore(e){Or||window.requestAnimationFrame(()=>{this.restoreDocument(),this.restoreScrollRegions(e)})}static restoreScrollRegions(e){Or||this.regions().forEach((t,n)=>{let r=e[n];r&&(typeof t.scrollTo==`function`?t.scrollTo(r.left,r.top):(t.scrollTop=r.top,t.scrollLeft=r.left))})}static restoreDocument(){let e=Ir.getDocumentScrollPosition();window.scrollTo(e.left,e.top)}static onScroll(e){let t=e.target;typeof t.hasAttribute==`function`&&t.hasAttribute(`scroll-region`)&&this.save()}static onWindowScroll(){Ir.saveDocumentScrollPosition({top:window.scrollY,left:window.scrollX})}},G=new class{page;swapComponent;resolveComponent;onFlashCallback;componentId={};listeners=[];isFirstPageLoad=!0;cleared=!1;pendingDeferredProps=null;historyQuotaExceeded=!1;optimisticBaseline={};pendingOptimistics=[];optimisticCounter=0;confirmedOptimisticId=0;init({initialPage:e,swapComponent:t,resolveComponent:n,onFlash:r}){return this.assignPage({...e,flash:e.flash??{},rescuedProps:e.rescuedProps??[]},e.deferredProps),this.swapComponent=t,this.resolveComponent=n,this.onFlashCallback=r,Lr.on(`historyQuotaExceeded`,()=>{this.historyQuotaExceeded=!0}),this}set(e,{replace:t=!1,preserveScroll:n=!1,preserveState:r=!1,viewTransition:i=!1,cached:a=!1,initialRender:o=!1,clientSide:s=!1,visitId:c,isCancelled:l=()=>!1,onCommit:u=()=>{}}={}){let d=this.pendingDeferredProps;!(s&&this.isTheSame(e)&&e.url===this.page.url)&&Object.keys(e.deferredProps||{}).length&&(this.pendingDeferredProps={deferredProps:e.deferredProps,component:e.component,url:e.url},e.initialDeferredProps===void 0&&(e.initialDeferredProps=e.deferredProps));let f=this.pendingDeferredProps;this.componentId={};let p=this.componentId;return e.clearHistory&&(Ir.clear(),Sr.removeAll()),this.resolve(e.component,e).then(s=>{if(p!==this.componentId||l()){l()&&this.pendingDeferredProps===f&&(this.pendingDeferredProps=d);return}u(),e.rememberedState??={};let m=typeof window>`u`,h=m?new URL(e.url):window.location,g=!m&&n?Ar.getScrollRegions():[];t||=ir($n(e.url),h);let _={...e,flash:{}};return Ir.clearInitialState(Ir.rememberedState),new Promise(e=>t?Ir.replaceState(_,e):Ir.pushState(_,e)).then(()=>{let l=!this.isTheSame(e);if(!l&&Object.keys(e.props.errors||{}).length>0&&(i=!1),this.cleared=!1,this.assignPage(e,this.pendingDeferredPropsFor(e)),this.hasOnceProps()&&Sr.updateCachedOncePropsFromCurrentPage(),l&&this.fireEventsFor(`newComponent`),this.isFirstPageLoad&&this.fireEventsFor(`firstLoad`),this.isFirstPageLoad=!1,this.historyQuotaExceeded)this.historyQuotaExceeded=!1;else return this.swap({component:s,page:e,preserveState:r,viewTransition:i,initialRender:o}).then(()=>{n?window.requestAnimationFrame(()=>Ar.restoreScrollRegions(g)):Ar.reset();let r=this.pendingDeferredPropsFor(e);r&&Lr.fireInternalEvent(`loadDeferredProps`,r),this.pendingDeferredProps=null,t||Jt(e,{type:`visit`,cached:a,visitId:c})})})})}setQuietly(e,{preserveState:t=!1}={}){return this.componentId={},this.resolve(e.component,e).then(n=>(this.cleared=!1,this.assignPage(e),Ir.setCurrent(e),this.swap({component:n,page:e,preserveState:t,viewTransition:!1})))}clear(){this.cleared=!0}isCleared(){return this.cleared}get(){return this.page}getWithoutFlashData(){return{...this.page,flash:{}}}hasOnceProps(){return Object.keys(this.page.onceProps??{}).length>0}assignPage(e,t){this.page=e,gr(e.props,t),Lr.fireInternalEvent(`pageUpdated`,e)}pendingDeferredPropsFor(e){let t=this.pendingDeferredProps;if(t&&t.component===e.component&&t.url===e.url)return t.deferredProps}merge(e){this.page={...this.page,...e}}setPropsQuietly(e){return this.page={...this.page,props:e},this.resolve(this.page.component,this.page).then(e=>this.swap({component:e,page:this.page,preserveState:!0,viewTransition:!1}))}setFlash(e){this.page={...this.page,flash:e},this.onFlashCallback?.(e)}setUrlHash(e){this.page.url.includes(e)||(this.page.url+=e)}remember(e){this.page.rememberedState=e}swap({component:e,page:t,preserveState:n,viewTransition:r,initialRender:i=!1}){let a=()=>this.swapComponent({component:e,page:t,preserveState:n,initialRender:i});if(!r||!document?.startViewTransition||document.visibilityState===`hidden`)return a();let o=typeof r==`boolean`?()=>null:r,s=e=>{e.catch(e=>{if(!(e instanceof DOMException))throw e})};return new Promise(e=>{let t=document.startViewTransition(()=>a().then(e));s(t.ready),s(t.finished),s(t.updateCallbackDone),o(t)})}resolve(e,t){return Promise.resolve(this.resolveComponent(e,t))}nextOptimisticId(){return++this.optimisticCounter}markOptimisticConfirmed(e){this.confirmedOptimisticId=Math.max(this.confirmedOptimisticId,e)}hasConfirmedOptimisticAfter(e){return this.confirmedOptimisticId>e}setBaseline(e,t){e in this.optimisticBaseline||(this.optimisticBaseline[e]=t)}updateBaseline(e,t){e in this.optimisticBaseline&&(this.optimisticBaseline[e]=t)}hasBaseline(e){return e in this.optimisticBaseline}registerOptimistic(e,t){this.pendingOptimistics.push({id:e,callback:t})}unregisterOptimistic(e){this.pendingOptimistics=this.pendingOptimistics.filter(t=>t.id!==e)}replayOptimistics(){let e=Object.keys(this.optimisticBaseline);if(e.length===0)return{};let t=H(this.page.props);for(let n of e)t[n]=H(this.optimisticBaseline[n]);for(let{callback:e}of this.pendingOptimistics){let n=e(H(t));n&&Object.assign(t,n)}let n={};for(let r of e)n[r]=t[r];return n}pendingOptimisticCount(){return this.pendingOptimistics.length}clearOptimisticState(){this.optimisticBaseline={},this.pendingOptimistics=[],this.confirmedOptimisticId=0}isTheSame(e){return this.page.component===e.component}on(e,t){return this.listeners.push({event:e,callback:t}),()=>{this.listeners=this.listeners.filter(n=>n.event!==e&&n.callback!==t)}}fireEventsFor(e){this.listeners.filter(t=>t.event===e).forEach(e=>e.callback())}mergeOncePropsIntoResponse(e,{force:t=!1}={}){Object.entries(e.onceProps??{}).forEach(([n,r])=>{let i=this.page.onceProps?.[n];i!==void 0&&(t||Te(e.props,r.prop)===void 0)&&(qe(e.props,r.prop,Te(this.page.props,i.prop)),e.onceProps[n].expiresAt=i.expiresAt)})}},jr=class{items=[];processingPromise=null;add(e){return this.items.push(e),this.process()}process(){return this.processingPromise??=this.processNext().then(()=>{if(this.processingPromise=null,this.items.length>0)return this.process()},e=>{throw this.processingPromise=null,e}),this.processingPromise}processNext(){let e=this.items.shift();return e?Promise.resolve(e()).then(()=>this.processNext()):Promise.resolve()}},Mr=typeof window>`u`,Nr=new jr,Pr=!Mr&&/CriOS/.test(window.navigator.userAgent),Fr=class{rememberedState=`rememberedState`;scrollRegions=`scrollRegions`;preserveUrl=!1;current={};initialState=null;remember(e,t){this.replaceState({...G.getWithoutFlashData(),rememberedState:{...G.get()?.rememberedState??{},[t]:e}})}restore(e){if(!Mr)return this.current[this.rememberedState]?.[e]===void 0?this.initialState?.[this.rememberedState]?.[e]:this.current[this.rememberedState]?.[e]}pushState(e,t=null){Mr||(this.preserveUrl?t&&t():(this.current=e,Nr.add(()=>this.getPageData(e).then(n=>{let r=()=>this.doPushState({page:n},e.url).then(()=>t?.());return Pr?new Promise(e=>{setTimeout(()=>r().then(e))}):r()}))))}clonePageProps(e){try{return structuredClone(e.props),e}catch{return{...e,props:H(e.props)}}}getPageData(e){let t=this.clonePageProps(e);return new Promise(n=>e.encryptHistory?_n(t).then(n):n(t))}processQueue(){return Nr.process()}decrypt(e=null){if(Mr)return Promise.resolve(e??G.get());let t=e??window.history.state?.page;return this.decryptPageData(t).then(e=>{if(!e)throw Error(`Unable to decrypt history`);return this.initialState===null?this.initialState=e??void 0:this.current=e??{},e})}decryptPageData(e){return e instanceof ArrayBuffer?yn(e):Promise.resolve(e)}saveScrollPositions(e){Nr.add(()=>Promise.resolve().then(()=>{if(window.history.state?.page&&!pe(this.getScrollRegions(),e))return this.doReplaceState({page:window.history.state.page,scrollRegions:e})}))}saveDocumentScrollPosition(e){Nr.add(()=>Promise.resolve().then(()=>{if(window.history.state?.page&&!pe(this.getDocumentScrollPosition(),e))return this.doReplaceState({page:window.history.state.page,documentScrollPosition:e})}))}getScrollRegions(){return window.history.state?.scrollRegions||[]}getDocumentScrollPosition(){return window.history.state?.documentScrollPosition||{top:0,left:0}}replaceState(e,t=null){if(pe(this.current,e)){t&&t();return}let{flash:n,...r}=e;G.merge(r),Mr||(this.preserveUrl?t&&t():(this.current=e,Nr.add(()=>this.getPageData(e).then(n=>{let r=()=>this.doReplaceState({page:n},e.url).then(()=>t?.());return Pr?new Promise(e=>{setTimeout(()=>r().then(e))}):r()}))))}isHistoryThrottleError(e){return e instanceof Error&&e.name===`SecurityError`&&(e.message.includes(`history.pushState`)||e.message.includes(`history.replaceState`))}isQuotaExceededError(e){return e instanceof Error&&e.name===`QuotaExceededError`}withThrottleProtection(e){return Promise.resolve().then(()=>{try{return e()}catch(e){if(!this.isHistoryThrottleError(e))throw e;console.error(e.message)}})}doReplaceState(e,t){return this.withThrottleProtection(()=>{try{window.history.replaceState({...e,scrollRegions:e.scrollRegions??window.history.state?.scrollRegions,documentScrollPosition:e.documentScrollPosition??window.history.state?.documentScrollPosition},``,t)}catch(e){if(!this.isQuotaExceededError(e))throw e;console.error(e.message)}})}doPushState(e,t){return this.withThrottleProtection(()=>{try{window.history.pushState(e,``,t)}catch(e){if(!this.isQuotaExceededError(e))throw e;Lr.fireInternalEvent(`historyQuotaExceeded`,t)}})}getState(e,t){return this.current?.[e]??t}deleteState(e){this.current[e]!==void 0&&(delete this.current[e],this.replaceState(this.current))}clearInitialState(e){this.initialState&&this.initialState[e]!==void 0&&(this.initialState={...this.initialState,[e]:void 0})}browserHasHistoryEntry(){return!Mr&&!!window.history.state?.page}clear(){hn.remove(vn.key),hn.remove(vn.iv)}setCurrent(e){this.current=e}isValidState(e){return!!e.page}getAllState(){return this.current}};typeof window<`u`&&window.history.scrollRestoration&&(window.history.scrollRestoration=`manual`);var Ir=new Fr,Lr=new class{internalListeners=[];onWindowScroll=Bt(()=>Ar.onWindowScroll(),100);onScroll=Bt(e=>Ar.onScroll(e),100);init(){typeof window<`u`&&(window.addEventListener(`popstate`,this.handlePopstateEvent.bind(this)),window.addEventListener(`pageshow`,this.handlePageshowEvent.bind(this)),window.addEventListener(`scroll`,this.onWindowScroll,!0)),typeof document<`u`&&document.addEventListener(`scroll`,this.onScroll,!0)}onGlobalEvent(e,t){return this.registerListener(`inertia:${e}`,(e=>{let n=t(e);e.cancelable&&!e.defaultPrevented&&n===!1&&e.preventDefault()}))}on(e,t){return this.internalListeners.push({event:e,listener:t}),()=>{this.internalListeners=this.internalListeners.filter(e=>e.listener!==t)}}onMissingHistoryItem(){G.clear(),this.fireInternalEvent(`missingHistoryItem`)}fireInternalEvent(e,...t){this.internalListeners.filter(t=>t.event===e).forEach(e=>e.listener(...t))}registerListener(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)}handlePageshowEvent(e){e.persisted&&Ir.decrypt().catch(()=>this.onMissingHistoryItem())}handlePopstateEvent(e){this.onWindowScroll.cancel(),this.onScroll.cancel();let t=e.state||null;if(t===null){let e=$n(G.get().url);e.hash=window.location.hash,Ir.replaceState({...G.getWithoutFlashData(),url:e.href}),Ar.reset()}else{if(!Ir.isValidState(t))return this.onMissingHistoryItem();Za.cancelAll({prefetch:!1}),Ir.decrypt(t.page).then(e=>{G.get().version===e.version?G.setQuietly(e,{preserveState:!1}).then(()=>{Ar.restore(Ir.getScrollRegions()),Jt(G.get(),{type:`history`});let t={},n=G.get().props;for(let[r,i]of Object.entries(e.initialDeferredProps??e.deferredProps??{})){let e=i.filter(e=>Te(n,e)===void 0);e.length>0&&(t[r]=e)}Object.keys(t).length>0&&this.fireInternalEvent(`loadDeferredProps`,t)}):this.onMissingHistoryItem()}).catch(()=>{this.onMissingHistoryItem()})}}},Rr=new class{type;constructor(){this.type=this.resolveType()}resolveType(){return typeof window>`u`?`navigate`:window.performance?.getEntriesByType(`navigation`)[0]?.type??`navigate`}get(){return this.type}isBackForward(){return this.type===`back_forward`}isReload(){return this.type===`reload`}};function zr(){let e=typeof window<`u`?window.crypto:void 0;if(e?.randomUUID)return e.randomUUID();let t=()=>e?.getRandomValues?e.getRandomValues(new Uint8Array(1))[0]:Math.floor(Math.random()*256);return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(+e^t()&15>>e/4).toString(16))}var Br=class{static handle(){this.clearRememberedStateOnReload(),[this.handleBackForward,this.handleLocation,this.handleDefault].find(e=>e.bind(this)())}static clearRememberedStateOnReload(){Rr.isReload()&&(Ir.deleteState(Ir.rememberedState),Ir.clearInitialState(Ir.rememberedState))}static handleBackForward(){if(!Rr.isBackForward()||!Ir.browserHasHistoryEntry())return!1;let e=Ir.getScrollRegions();return Ir.decrypt().then(t=>{if(G.get().version!==t.version){this.handleDefault();return}let n=zr();G.set(t,{preserveScroll:!0,preserveState:!0,visitId:n}).then(()=>{Ar.restore(e),Jt(G.get(),{type:`history`,visitId:n})})}).catch(()=>{Lr.onMissingHistoryItem()}),!0}static handleLocation(){if(!hn.exists(hn.locationVisitKey))return!1;let e=hn.get(hn.locationVisitKey)||{};return hn.remove(hn.locationVisitKey),typeof window<`u`&&G.setUrlHash(window.location.hash),Ir.decrypt(G.get()).then(()=>{let t=zr(),n=Ir.getState(Ir.rememberedState,{}),r=Ir.getScrollRegions();G.remember(n),G.set(G.get(),{preserveScroll:e.preserveScroll,preserveState:!0,initialRender:!0,visitId:t}).then(()=>{e.preserveScroll&&Ar.restore(r),this.fireInitialEvents(t)})}).catch(()=>{Lr.onMissingHistoryItem()}),!0}static handleDefault(){typeof window<`u`&&G.setUrlHash(window.location.hash);let e=zr();G.set(G.get(),{preserveScroll:!0,preserveState:!0,initialRender:!0,visitId:e}).then(()=>{Rr.isReload()?Ar.restore(Ir.getScrollRegions()):Ar.scrollToAnchor(),this.fireInitialEvents(e)})}static fireInitialEvents(e){let t=G.get();Jt(t,{type:`initial`,visitId:e}),Object.keys(t.flash).length>0&&queueMicrotask(()=>tn(t.flash))}},Vr=class{intervalId=null;timeoutId=null;hidden=!1;background;cb;interval;cbCount=0;mode;inFlight=!1;currentCancel=null;stopped=!0;instanceId=0;lastPolledAt=0;constructor(e,t,n){this.background=n.background??(n.keepAlive?`continue`:`throttle`),this.hidden=typeof document<`u`&&document.hidden,this.mode=n.mode??`overlap`,this.cb=t,this.interval=e,(n.autoStart??!0)&&this.start()}stop(){this.stopped=!0,this.instanceId++,this.inFlight=!1,this.currentCancel=null,this.clearTimers()}start(){typeof window<`u`&&(this.stop(),this.stopped=!1,this.lastPolledAt=Date.now(),this.isPaused()||(this.mode===`rest`?this.scheduleNext():this.startInterval()))}isInBackground(e){e!==this.hidden&&(this.hidden=e,this.isThrottled()&&(this.cbCount=0),this.background===`pause`&&(e?this.clearTimers():this.resume()))}isThrottled(){return this.hidden&&this.background===`throttle`}isPaused(){return this.hidden&&this.background===`pause`}resume(){if(this.stopped||this.mode===`rest`&&this.inFlight)return;let e=this.interval-(Date.now()-this.lastPolledAt);e>0?this.timeoutId=window.setTimeout(()=>{this.timeoutId=null,this.resume()},e):(this.fire(),this.mode!==`rest`&&this.startInterval())}startInterval(){this.intervalId=window.setInterval(()=>this.tick(),this.interval)}clearTimers(){this.intervalId&&=(clearInterval(this.intervalId),null),this.timeoutId&&=(clearTimeout(this.timeoutId),null)}scheduleNext(){this.stopped||this.isPaused()||(this.timeoutId=window.setTimeout(()=>{this.timeoutId=null,this.tick()},this.interval))}tick(){let e=this.isThrottled();!e||this.cbCount%10==0?this.fire():this.mode===`rest`&&this.scheduleNext(),e&&this.cbCount++}fire(){this.inFlight&&this.mode===`cancel`&&this.currentCancel?.(),this.lastPolledAt=Date.now();let e=this.instanceId;this.cb({onStart:t=>{e===this.instanceId&&(this.inFlight=!0,this.currentCancel=t)},onFinish:()=>{e===this.instanceId&&(this.inFlight=!1,this.currentCancel=null,this.mode===`rest`&&(this.lastPolledAt=Date.now(),this.scheduleNext()))}})}},Hr=new Set,Ur=!1,Wr=()=>{Ur||typeof document>`u`||(Ur=!0,document.addEventListener(`visibilitychange`,()=>{Hr.forEach(e=>e(document.hidden))},!1))},Gr={isHidden(){return typeof document<`u`&&document.hidden},onChange(e){return Wr(),Hr.add(e),()=>{Hr.delete(e)}}},Kr=new class{polls=[];constructor(){this.setupVisibilityListener()}get count(){return this.polls.length}add(e,t,n){let r=new Vr(e,t,n);return r.isInBackground(Gr.isHidden()),this.polls.push(r),{stop:()=>r.stop(),start:()=>r.start(),destroy:()=>{r.stop(),this.polls=this.polls.filter(e=>e!==r)}}}clear(){this.polls.forEach(e=>e.stop()),this.polls=[]}setupVisibilityListener(){Gr.onChange(e=>{this.polls.forEach(t=>t.isInBackground(e))})}},qr=new class{requestHandlers=[];responseHandlers=[];errorHandlers=[];onRequest(e){return this.requestHandlers.push(e),()=>{this.requestHandlers=this.requestHandlers.filter(t=>t!==e)}}onResponse(e){return this.responseHandlers.push(e),()=>{this.responseHandlers=this.responseHandlers.filter(t=>t!==e)}}onError(e){return this.errorHandlers.push(e),()=>{this.errorHandlers=this.errorHandlers.filter(t=>t!==e)}}async processRequest(e){let t=e;for(let e of this.requestHandlers)t=await e(t);return t}async processResponse(e){let t=e;for(let e of this.responseHandlers)t=await e(t);return t}async processError(e){for(let t of this.errorHandlers)await t(e)}};function Jr(e){let t=document.cookie.match(RegExp(`(^|;\\s*)(`+e+`)=([^;]*)`));return t?decodeURIComponent(t[3]):null}function Yr(e){let t={};return e.getAllResponseHeaders().split(`\r -`).forEach(e=>{let n=e.indexOf(`:`);n>0&&(t[e.slice(0,n).toLowerCase().trim()]=e.slice(n+1).trim())}),t}function Xr(e){return typeof FormData<`u`&&e instanceof FormData}function Zr(e){return typeof e==`string`||Xr(e)||typeof Blob<`u`&&e instanceof Blob||typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer||typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e)||typeof URLSearchParams<`u`&&e instanceof URLSearchParams}function Qr(e,t){if(!t.headers)return;let n=Xr(t.data);Object.entries(t.headers).forEach(([t,r])=>{t.toLowerCase()===`content-type`&&n||e.setRequestHeader(t,String(r))})}function $r(e,t){if(!t||Object.keys(t).length===0)return e;let[n]=tr(`get`,e,t);return n}var ei=class{xsrfCookieName;xsrfHeaderName;constructor(e={}){this.xsrfCookieName=e.xsrfCookieName??`XSRF-TOKEN`,this.xsrfHeaderName=e.xsrfHeaderName??`X-XSRF-TOKEN`}async request(e){let t=await qr.processRequest(e);try{let e=await this.doRequest(t);return await qr.processResponse(e)}catch(e){throw(e instanceof Dn||e instanceof kn||e instanceof On)&&await qr.processError(e),e}}doRequest(e){return new Promise((t,n)=>{if(e.signal?.aborted){n(new On(`Request was cancelled`,e.url));return}let r=new XMLHttpRequest,i=$r(e.url,e.params);r.open(e.method.toUpperCase(),i,!0);let a=cr(i)?Jr(this.xsrfCookieName):null;a&&r.setRequestHeader(this.xsrfHeaderName,a),Object.keys(e.headers??{}).some(e=>e.toLowerCase()===`x-requested-with`)||r.setRequestHeader(`X-Requested-With`,`XMLHttpRequest`);let o=null;e.data!==null&&e.data!==void 0&&(Zr(e.data)?o=e.data:typeof e.data==`object`?(o=JSON.stringify(e.data),!e.headers?.[`Content-Type`]&&!e.headers?.[`content-type`]&&r.setRequestHeader(`Content-Type`,`application/json`)):o=String(e.data)),Qr(r,e),e.onUploadProgress&&(r.upload.onprogress=t=>{let n=t.lengthComputable?t.loaded/t.total:void 0;e.onUploadProgress({progress:n,percentage:n?Math.round(n*100):0,loaded:t.loaded,total:t.lengthComputable?t.total:void 0})}),e.signal&&e.signal.addEventListener(`abort`,()=>r.abort()),r.onabort=()=>n(new On(`Request was cancelled`,e.url)),r.onerror=()=>n(new kn(`Network error`,e.url)),r.onload=()=>{let i={status:r.status,data:r.responseText,headers:Yr(r)};r.status>=400?n(new Dn(`Request failed with status ${r.status}`,i,e.url)):t(i)},r.send(o)})}},ti=new ei;bt.withSerializer(fn);var ni=ti;function ri(e){return!(`request`in e)}var ii={getClient(){return ni},setClient(e){ri(e)?(ni=new ei(e),e.xsrfCookieName&&bt.withXsrfCookieName(e.xsrfCookieName),e.xsrfHeaderName&&bt.withXsrfHeaderName(e.xsrfHeaderName)):ni=e},onRequest:qr.onRequest.bind(qr),onResponse:qr.onResponse.bind(qr),onError:qr.onError.bind(qr),processRequest:qr.processRequest.bind(qr),processResponse:qr.processResponse.bind(qr),processError:qr.processError.bind(qr)},ai=new class{requestHandlers=[];responseHandlers=[];onVisitRequest(e){return this.requestHandlers.push(e),()=>{this.requestHandlers=this.requestHandlers.filter(t=>t!==e)}}onVisitResponse(e){return this.responseHandlers.push(e),()=>{this.responseHandlers=this.responseHandlers.filter(t=>t!==e)}}async processRequest(e,t){let n=t;for(let t of this.requestHandlers)n=await t(e,n);return n}async processResponse(e,t){let n=t;for(let t of this.responseHandlers)n=await t(e,n);return n}};function oi(){typeof window<`u`&&(window.__inertia_interceptors__=ai)}var si=class e{callbacks=[];params;constructor(e){if(!e.prefetch)this.params=e;else{let t={onBefore:this.wrapCallback(e,`onBefore`),onBeforeUpdate:this.wrapCallback(e,`onBeforeUpdate`),onStart:this.wrapCallback(e,`onStart`),onProgress:this.wrapCallback(e,`onProgress`),onFinish:this.wrapCallback(e,`onFinish`),onCancel:this.wrapCallback(e,`onCancel`),onSuccess:this.wrapCallback(e,`onSuccess`),onError:this.wrapCallback(e,`onError`),onHttpException:this.wrapCallback(e,`onHttpException`),onNetworkError:this.wrapCallback(e,`onNetworkError`),onFlash:this.wrapCallback(e,`onFlash`),onCancelToken:this.wrapCallback(e,`onCancelToken`),onPrefetched:this.wrapCallback(e,`onPrefetched`),onPrefetching:this.wrapCallback(e,`onPrefetching`)};this.params={...e,...t,onPrefetchResponse:e.onPrefetchResponse||(()=>{}),onPrefetchError:e.onPrefetchError||(()=>{})}}}static create(t){return new e(t)}data(){return this.params.method===`get`?null:this.params.data}queryParams(){return this.params.method===`get`?this.params.data:{}}isPartial(){return this.params.only.length>0||this.params.except.length>0||this.params.reset.length>0}isPrefetch(){return this.params.prefetch===!0}isDeferredPropsRequest(){return this.params.deferredProps===!0}isPollRequest(){return this.params.poll===!0}isQueryMethodReload(){return this.params.queryMethodReload===!0}onCancelToken(e){this.params.onCancelToken({cancel:e})}markAsFinished(){this.params.completed=!0,this.params.cancelled=!1,this.params.interrupted=!1}markAsCancelled({cancelled:e=!0,interrupted:t=!1}){this.params.onCancel(),this.params.completed=!1,this.params.cancelled=e,this.params.interrupted=t}wasCancelledAtAll(){return this.params.cancelled||this.params.interrupted}onFinish(){this.params.onFinish(this.params)}onStart(){this.params.onStart(this.params)}onPrefetching(){this.params.onPrefetching(this.params)}onPrefetchResponse(e){this.params.onPrefetchResponse&&this.params.onPrefetchResponse(e)}onPrefetchError(e){this.params.onPrefetchError&&this.params.onPrefetchError(e)}all(){return this.params}headers(){let e={...this.params.headers};this.isPartial()&&(e[`X-Inertia-Partial-Component`]=G.get().component);let t=this.params.only.concat(this.params.reset);return t.length>0&&(e[`X-Inertia-Partial-Data`]=t.join(`,`)),this.params.except.length>0&&(e[`X-Inertia-Partial-Except`]=this.params.except.join(`,`)),this.params.reset.length>0&&(e[`X-Inertia-Reset`]=this.params.reset.join(`,`)),this.params.errorBag&&this.params.errorBag.length>0&&(e[`X-Inertia-Error-Bag`]=this.params.errorBag),e}setPreserveOptions(t){this.params.preserveScroll=e.resolvePreserveOption(this.params.preserveScroll,t),this.params.preserveState=e.resolvePreserveOption(this.params.preserveState,t)}runCallbacks(){this.callbacks.forEach(({name:e,args:t})=>{this.params[e](...t)})}merge(e){this.params={...this.params,...e}}wrapCallback(e,t){return(...n)=>{this.recordCallback(t,n),e[t](...n)}}recordCallback(e,t){this.callbacks.push({name:e,args:t})}static resolvePreserveOption(e,t){return typeof e==`function`?e(t):e===`errors`?Object.keys(t.props.errors||{}).length>0:e}leavesPage(e,t){return this.params.async?!1:this.isPartial()?!ar(t,e):this.params.method===`query`||!ir(t,e)}},ci={createIframeAndPage(e){typeof e==`object`&&(e=`All Inertia requests must receive a valid Inertia response, however a plain JSON response was received.
${JSON.stringify(e)}`);let t=document.createElement(`html`);t.innerHTML=e,t.querySelectorAll(`a`).forEach(e=>e.setAttribute(`target`,`_top`));let n=document.createElement(`iframe`);return n.style.backgroundColor=`white`,n.style.borderRadius=`5px`,n.style.width=`100%`,n.style.height=`100%`,n.setAttribute(`sandbox`,`allow-scripts`),{iframe:n,page:t}},show(e){let{iframe:t,page:n}=this.createIframeAndPage(e);t.style.boxSizing=`border-box`,t.style.display=`block`;let r=document.createElement(`dialog`);r.id=`inertia-error-dialog`,Object.assign(r.style,{width:`calc(100vw - 100px)`,height:`calc(100vh - 100px)`,padding:`0`,margin:`auto`,border:`none`,backgroundColor:`transparent`});let i=document.createElement(`style`);i.textContent=` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./inertia-app-CommandPalette-BPpEv8-B-DhAiNcdi.js","./inertia-app-jsx-runtime-CS4hA3mQ.js","./inertia-app-LibraryDialog-DAWIobNZ-b_Zk9GGC.js","./inertia-app-SettingsDialog-Bdn2ml85-Ds0n1eul.js","./inertia-app-AboutDialog-5L60Q_S4-HMO9tyE_.js","./inertia-app-ProfileModal-B8a6ztxV-K8ptuE1T.js","./inertia-app-TourModal-pXzD1rw4-tkBN3CVN.js","./inertia-app-InviteModal-B5hC9CGd-D5knyl0e.js","./inertia-app-ManageAccessModal-BW7R-s6Z-C2pA8CxK.js","./inertia-app-SharedCollectionsModal-DbRvVtxZ-f-CZfZK8.js","./inertia-app-DevToolsPanel-DtuDuVnJ-BMTZWRpg.js","./inertia-app-Index-kr7MdfMI.js","./inertia-app-propsToCatalog-BMfZFXhT.js","./inertia-app-useInertiaMutations-ByVkwCnP.js","./inertia-app-Show-Cqx-Li8V.js","./inertia-app-IconImage-DrJ-WGz6.js","./inertia-app-FlashBanner-rWYabYjl.js","./inertia-app-Index-DQn8r5k7.js","./inertia-app-Show-CM_WdFs5.js","./inertia-app-IconGrid-DDgKzP68.js","./inertia-app-Index-CPQuKRdb.js","./inertia-app-Index-n51e0Xvm.js","./inertia-app-Index-DExngZR3.js","./inertia-app-Index-DMnnMnUN.js","./inertia-app-Show-tjb19Sx4.js","./inertia-app-Index-DMAKzwsZ.js","./inertia-app-Index-9ZaPeB2l.js"])))=>i.map(i=>d[i]); +import{a as e,i as t,n,o as r,r as i,t as a}from"./inertia-app-jsx-runtime-CS4hA3mQ.js";var o=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function s(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function c(){}function l(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function u(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function d(e){return o.Buffer!==void 0&&o.Buffer.isBuffer(e)}function f(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function p(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var m=`[object RegExp]`,h=`[object String]`,g=`[object Number]`,_=`[object Boolean]`,v=`[object Arguments]`,y=`[object Symbol]`,b=`[object Date]`,x=`[object Map]`,S=`[object Set]`,C=`[object Array]`,w=`[object Function]`,T=`[object ArrayBuffer]`,E=`[object Object]`,D=`[object Error]`,O=`[object DataView]`,k=`[object Uint8Array]`,A=`[object Uint8ClampedArray]`,j=`[object Uint16Array]`,M=`[object Uint32Array]`,N=`[object BigUint64Array]`,ee=`[object Int8Array]`,P=`[object Int16Array]`,F=`[object Int32Array]`,I=`[object BigInt64Array]`,L=`[object Float32Array]`,R=`[object Float64Array]`;function z(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(l(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;aoe(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case C:case k:case A:case j:case M:case N:case ee:case P:case F:case I:case L:case R:if(d(e)!==d(t)||e.length!==t.length)return!1;for(let i=0;i=0}function le(e){return e!=null&&typeof e!=`function`&&ce(e.length)}function ue(e){return typeof e==`symbol`||e instanceof Symbol}function de(e){if(typeof e==`string`)return e;if(Array.isArray(e)){let t=``;for(let n=0;n0&&(t+=`,`),t+=de(e[n]);return t}if(ue(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function fe(e){return e==null?``:de(e)}function pe(e){var t;return typeof e==`string`||typeof e==`symbol`?e:Object.is(e==null||(t=e.valueOf)==null?void 0:t.call(e),-0)?`-0`:String(e)}function me(e){if(Array.isArray(e))return e.map(pe);if(typeof e==`symbol`)return[e];e=fe(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r{t.set(a,Te(e,a,n,r,i))}),t}if(e instanceof Set){let t=new Set;return r.set(e,t),e.forEach(e=>{t.add(Te(e,void 0,n,r,i))}),t}if(Se(e))return e.subarray();if(Ce(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a=0&&e{let r=e[t];(!(ge(e,t)&&ie(r,n))||n===void 0&&!(t in e))&&(e[t]=n)};function Be(e,t,n,r){if(e==null&&!xe(e))return e;let i;i=Le(t,e)?[t]:Array.isArray(t)?t:me(t);let a=n(ye(e,i)),o=e;for(let t=0;tn,()=>void 0)}function He(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let c,l=null,u=s(function(...t){c=e.apply(this,t),l=null},t,{edges:o}),d=function(...t){return a!=null&&(l===null&&(l=Date.now()),Date.now()-l>=a)?((r||i)&&(c=e.apply(this,t)),l=Date.now(),u.cancel(),u.schedule(),c):(u.apply(this,t),c)};return d.cancel=u.cancel,d.flush=()=>(u.flush(),c),d}function Ue(e){if(l(e))return e;if(Array.isArray(e)||u(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e);if(t==null)return Object.assign(Object.create(t),e);let n=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new n(e);if(e instanceof RegExp){let t=new n(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new n(e.buffer.slice(0));if(e instanceof Error){let t;return t=typeof AggregateError<`u`&&e instanceof AggregateError?new n(e.errors,e.message,{cause:e.cause}):new n(e.message,{cause:e.cause}),t.stack=e.stack,Object.assign(t,e),t}if(typeof File<`u`&&e instanceof File)return new n([e],e.name,{type:e.type,lastModified:e.lastModified});if(typeof e==`object`){let n=Object.create(t);return Object.assign(n,e)}return e}function We(e,...t){let n=t.slice(0,-1),r=t[t.length-1],i=e;for(let e=0;etypeof File<`u`&&e instanceof File||e instanceof Blob||typeof FileList<`u`&&e instanceof FileList&&e.length>0,Ye=e=>e instanceof FormData||Je(e)||typeof e==`object`&&!!e&&Object.values(e).some(e=>Ye(e)),Xe=class extends Error{response;constructor(e){super(`HTTP error ${e.status}`),this.name=`HttpResponseError`,this.response=e}},Ze=class extends Error{constructor(e=`Request was cancelled`){super(e),this.name=`HttpCancelledError`}},Qe=class extends Error{constructor(e=`Network error`){super(e),this.name=`HttpNetworkError`}};function $e(e){let t=new URLSearchParams;return Object.entries(e).forEach(([e,n])=>{n!=null&&(Array.isArray(n)?n.forEach(n=>t.append(`${e}[]`,String(n))):typeof n==`object`?t.append(e,JSON.stringify(n)):t.append(e,String(n)))}),t.toString()}function et(e,t,n){if(t&&!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&(e=t.replace(/\/$/,``)+`/`+e.replace(/^\//,``)),n&&Object.keys(n).length>0){let t=$e(n);t&&(e+=(e.includes(`?`)?`&`:`?`)+t)}return e}function tt(){return typeof window>`u`?null:window.axios?.defaults?.headers?.common?.[`X-Requested-With`]??null}function nt(e,t=new FormData,n=null){for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&rt(t,n?`${n}[${r}]`:r,e[r]);return t}function rt(e,t,n){if(Array.isArray(n))return n.forEach((n,r)=>rt(e,`${t}[${r}]`,n));if(n instanceof Date)return e.append(t,n.toISOString());if(typeof File<`u`&&n instanceof File)return e.append(t,n,n.name);if(n instanceof Blob)return e.append(t,n);if(typeof n==`boolean`)return e.append(t,n?`1`:`0`);if(typeof n==`string`)return e.append(t,n);if(typeof n==`number`)return e.append(t,`${n}`);if(typeof n==`bigint`)return e.append(t,n.toString());if(n==null)return e.append(t,``);nt(n,e,t)}function it(e,t,n){if(e!=null)return e instanceof FormData?e:typeof e==`object`&&Ye(e)?nt(e):typeof e==`object`||t[`Content-Type`]?.includes(`application/json`)?n(e):String(e)}function at(e){let t={};return e.forEach((e,n)=>{t[n.toLowerCase()]=e}),t}function ot(e={}){let t=e.xsrfCookieName??`XSRF-TOKEN`,n=e.xsrfHeaderName??`X-XSRF-TOKEN`,r=e.serializer??JSON.stringify;function i(){if(typeof document>`u`)return null;let e=document.cookie.match(RegExp(`(^|;\\s*)`+t+`=([^;]*)`));return e?decodeURIComponent(e[2]):null}return{setXsrfCookieName(e){t=e},setXsrfHeaderName(e){n=e},setSerializer(e){r=e},async request(e){let t=et(e.url,e.baseURL,e.params),a=e.method.toUpperCase(),o={},s=tt();s&&(o[`X-Requested-With`]=s),e.data===void 0||[`GET`,`DELETE`].includes(a)||e.data instanceof FormData||Ye(e.data)||(o[`Content-Type`]=`application/json`),e.headers&&Object.entries(e.headers).forEach(([e,t])=>{t!==void 0&&(o[e]=String(t))});let c=i();c&&![`GET`,`HEAD`,`OPTIONS`].includes(a)&&(o[n]=c);let l=e.signal,u,d=e.timeout??3e4;if(d>0&&!l){let e=new AbortController;l=e.signal,u=setTimeout(()=>e.abort(),d)}let f=[`GET`,`DELETE`].includes(a)?void 0:it(e.data,o,r);f instanceof FormData&&delete o[`Content-Type`];try{let n=await fetch(t,{method:a,headers:o,body:f,signal:l,credentials:e.credentials??`same-origin`});u&&clearTimeout(u);let r;r=n.headers.get(`content-type`)?.includes(`application/json`)?await n.json():await n.text();let i={status:n.status,data:r,headers:at(n.headers)};if(!n.ok)throw new Xe(i);return i}catch(e){throw u&&clearTimeout(u),e instanceof Xe?e:e instanceof DOMException&&e.name===`AbortError`?new Ze:e instanceof TypeError?new Qe(e.message):e}}}}var st=ot(),ct=st,lt=void 0,ut=void 0,dt=`same-origin`,ft=e=>`${e.method}:${e.baseURL??lt??``}${e.url}`,pt=e=>e.status===204&&e.headers[`precognition-success`]===`true`,mt={},ht={get:(e,t={},n={})=>_t(gt(`get`,e,t,n)),post:(e,t={},n={})=>_t(gt(`post`,e,t,n)),patch:(e,t={},n={})=>_t(gt(`patch`,e,t,n)),put:(e,t={},n={})=>_t(gt(`put`,e,t,n)),delete:(e,t={},n={})=>_t(gt(`delete`,e,t,n)),query:(e,t={},n={})=>_t(gt(`query`,e,t,n)),useHttpClient(e){return ct=e,ht},withBaseURL(e){return lt=e,ht},withTimeout(e){return ut=e,ht},withCredentials(e){return dt=typeof e==`string`?e:e?`include`:`omit`,ht},fingerprintRequestsUsing(e){return ft=e===null?()=>null:e,ht},determineSuccessUsing(e){return pt=e,ht},withXsrfCookieName(e){return st.setXsrfCookieName(e),ht},withXsrfHeaderName(e){return st.setXsrfHeaderName(e),ht},withSerializer(e){return st.setSerializer(e),ht}},gt=(e,t,n,r)=>({url:t,method:e,...r,...[`get`,`delete`].includes(e)?{params:Ke({},n,r?.params)}:{data:Ke({},n,r?.data)}}),_t=(e={})=>{let t=[vt,bt,xt].reduce((e,t)=>t(e),e);return(t.onBefore??(()=>!0))()===!1?Promise.resolve(null):((t.onStart??(()=>null))(),ct.request({method:t.method,url:t.url,baseURL:t.baseURL??lt,data:t.data,params:t.params,headers:t.headers,signal:t.signal,timeout:t.timeout,credentials:dt}).then(async e=>{t.precognitive&&St(e);let n=e.status,r=e;return t.precognitive&&t.onPrecognitionSuccess&&pt(e)&&(r=await Promise.resolve(t.onPrecognitionSuccess(e)??r)),t.onSuccess&&yt(n)&&(r=await Promise.resolve(t.onSuccess(r)??r)),(wt(t,n)??(e=>e))(r)??r},e=>{if(Ct(e))return Promise.reject(e);let n=e;return t.precognitive&&St(n.response),(wt(t,n.response.status)??((e,t)=>Promise.reject(t)))(n.response,n)}).finally(t.onFinish??(()=>null)))},vt=e=>{let t=e.only??e.validate;return{...e,timeout:e.timeout??ut,precognitive:e.precognitive!==!1,fingerprint:e.fingerprint===void 0?ft(e,ct):e.fingerprint,headers:{...e.headers,Accept:`application/json`,"Content-Type":Tt(e),...e.precognitive===!1?{}:{Precognition:!0},...t?{"Precognition-Validate-Only":Array.from(t).join()}:{}}}},yt=e=>e>=200&&e<300,bt=e=>(typeof e.fingerprint==`string`&&(mt[e.fingerprint]?.abort(),delete mt[e.fingerprint]),e),xt=e=>typeof e.fingerprint!=`string`||e.signal||!e.precognitive?e:(mt[e.fingerprint]=new AbortController,{...e,signal:mt[e.fingerprint].signal}),St=e=>{if(e.headers?.precognition!==`true`)throw Error(`Did not receive a Precognition response. Ensure you have the Precognition middleware in place for the route.`)},Ct=e=>!(e instanceof Xe)||typeof e.response?.status!=`number`,wt=(e,t)=>({401:e.onUnauthorized,403:e.onForbidden,404:e.onNotFound,409:e.onConflict,422:e.onValidationError,423:e.onLocked})[t],Tt=e=>e.headers?.[`Content-Type`]??e.headers?.[`Content-type`]??e.headers?.[`content-type`]??(Ye(e.data)?`multipart/form-data`:`application/json`),Et=(e,t)=>{if(!e.includes(`*`))return[e];let n=e.split(`.`),r=[``];for(let e of n)if(e===`*`){let e=[];for(let n of r){let r=n?ye(t,n):t;if(Array.isArray(r))for(let t=0;tt?`${t}.${e}`:e);return r},Dt=(e,t)=>t.includes(`*`)?RegExp(`^`+t.replace(/\./g,`\\.`).replace(/\*/g,`[^.]+`)+`$`).test(e):e===t,Ot=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>!t.some(t=>Dt(e,t)))),kt=(e,t={})=>{let n={errorsChanged:[],touchedChanged:[],validatingChanged:[],validatedChanged:[]},r=!1,i=!1,a=e=>e===i?[]:(i=e,n.validatingChanged),o=[],s=e=>{let t=[...new Set(e)];return o.length!==t.length||!t.every(e=>o.includes(e))?(o=t,n.validatedChanged):[]},c=()=>o.filter(e=>d[e]===void 0),l=[],u=e=>{let t=[...new Set(e)];return l.length!==t.length||!t.every(e=>l.includes(e))?(l=t,n.touchedChanged):[]},d={},f=e=>{let t=jt(e);return U(d,t)?[]:(d=t,n.errorsChanged)},p=e=>{let t={...d};return delete t[Mt(e)],f(t)},m=()=>Object.keys(d).length>0,h=1500,g=e=>{h=e,S.cancel(),S=x()},_=t,v=null,y=[],b=null,x=()=>He(t=>{e({get:(e,n={},r={})=>ht.get(e,T(n),C(r,t,n)),post:(e,n={},r={})=>ht.post(e,T(n),C(r,t,n)),patch:(e,n={},r={})=>ht.patch(e,T(n),C(r,t,n)),put:(e,n={},r={})=>ht.put(e,T(n),C(r,t,n)),delete:(e,n={},r={})=>ht.delete(e,T(n),C(r,t,n)),query:(e,n={},r={})=>ht.query(e,T(n),C(r,t,n))}).catch(e=>e instanceof Ze||e instanceof Xe&&e.response?.status===422?null:Promise.reject(e))},h,{leading:!0,trailing:!0}),S=x(),C=(e,t,n={})=>{let r={...e,...t},i=Array.from(r.only??r.validate??l);return{...t,...Ke({},e,t),only:i,timeout:r.timeout??5e3,onValidationError:(e,t)=>([...s([...o,...i]),...f(Ke(Ot({...d},i),e.data.errors))].forEach(e=>e()),r.onValidationError?r.onValidationError(e,t):Promise.reject(t)),onSuccess:e=>(s([...o,...i]).forEach(e=>e()),r.onSuccess?r.onSuccess(e):e),onPrecognitionSuccess:e=>([...s([...o,...i]),...f(Ot({...d},i))].forEach(e=>e()),r.onPrecognitionSuccess?r.onPrecognitionSuccess(e):e),onBefore:()=>{let e=l.some(e=>e.includes(`*`)),t=e?[...new Set(l.flatMap(e=>Et(e,n)))]:l;return r.onBeforeValidation&&r.onBeforeValidation({data:n,touched:t},{data:_,touched:y})===!1||(r.onBefore||(()=>!0))()===!1?!1:(e&&u(t).forEach(e=>e()),b=l,v=n,!0)},onStart:()=>{a(!0).forEach(e=>e()),(r.onStart??(()=>null))()},onFinish:()=>{a(!1).forEach(e=>e()),y=b,_=v,b=v=null,(r.onFinish??(()=>null))()}}},w=(e,t,n)=>{if(e===void 0){let e=Array.from(n?.only??n?.validate??[]);u([...l,...e]).forEach(e=>e()),S(n??{})}else Je(t)&&!r?console.warn(`Precognition file validation is not active. Call the "validateFiles" function on your form to enable it.`):(e=Mt(e),(e.includes(`*`)||ye(_,e)!==t)&&(u([e,...l]).forEach(e=>e()),S(n??{})))},T=e=>r===!1?Nt(e):e,E={touched:()=>l,validate(e,t,n){return typeof e==`object`&&!(`target`in e)&&(n=e,e=t=void 0),w(e,t,n),E},touch(e){let t=Array.isArray(e)?e:[Mt(e)];return u([...l,...t]).forEach(e=>e()),E},validating:()=>i,valid:c,errors:()=>d,hasErrors:m,setErrors(e){return f(e).forEach(e=>e()),E},forgetError(e){return p(e).forEach(e=>e()),E},defaults(e){return t=e,_=e,E},reset(...e){if(e.length===0)u([]).forEach(e=>e());else{let n=[...l];e.forEach(e=>{n.includes(e)&&n.splice(n.indexOf(e),1),Ve(_,e,ye(t,e))}),u(n).forEach(e=>e())}return E},setTimeout(e){return g(e),E},on(e,t){return n[e].push(t),E},validateFiles(){return r=!0,E},withoutFileValidation(){return r=!1,E}};return E},At=e=>Object.keys(e).reduce((t,n)=>({...t,[n]:Array.isArray(e[n])?e[n][0]:e[n]}),{}),jt=e=>Object.keys(e).reduce((t,n)=>({...t,[n]:typeof e[n]==`string`?[e[n]]:e[n]}),{}),Mt=e=>typeof e==`string`?e:e.target.name,Nt=e=>{let t={...e};return Object.keys(t).forEach(e=>{let n=t[e];n!==null&&(Je(n)?delete t[e]:Array.isArray(n)?t[e]=Object.values(Nt({...n})):typeof n==`object`&&(t[e]=Nt(t[e])))}),t},Pt=`modulepreload`,Ft=function(e,t){return new URL(e,t).href},It={},Lt=function(e){return e.pathname.endsWith(`.css`)},Rt=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},zt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Ft(t,n);let r=s(t),i=Lt(r);return Rt(It,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Pt,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Bt=new class{config={};defaults;constructor(e){this.defaults=e}extend(e){return e&&(this.defaults={...this.defaults,...e}),this}replace(e){this.config=e}get(e){return Me(this.config,e)?ye(this.config,e):ye(this.defaults,e)}set(e,t){typeof e==`string`?Ve(this.config,e,t):Object.entries(e).forEach(([e,t])=>{Ve(this.config,e,t)})}}({form:{recentlySuccessfulDuration:2e3,forceIndicesArrayFormatInFormData:!0,withAllErrors:!1},prefetch:{cacheFor:3e4,hoverDelay:75}});function Vt(e,t){let n,r=function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)};return r.cancel=()=>clearTimeout(n),r}function Ht(e,t){return document.dispatchEvent(new CustomEvent(`inertia:${e}`,t))}var Ut=e=>Ht(`before`,{cancelable:!0,detail:{visit:e}}),Wt=(e,{page:t,visitId:n}={})=>Ht(`error`,{detail:{errors:e,page:t,visitId:n}}),Gt=e=>Ht(`networkError`,{cancelable:!0,detail:{error:e}}),Kt=e=>Ht(`finish`,{detail:{visit:e}}),qt=e=>Ht(`httpException`,{cancelable:!0,detail:{response:e}}),Jt=e=>Ht(`beforeUpdate`,{detail:{page:e}}),Yt=(e,{type:t,cached:n=!1,visitId:r})=>Ht(`navigate`,{detail:{page:e,type:t,cached:n,visitId:r}}),Xt=(e,{replace:t,visitId:n})=>Ht(`clientVisit`,{detail:{page:e,replace:t,visitId:n}}),Zt=e=>Ht(`progress`,{detail:{progress:e}}),Qt=e=>Ht(`start`,{detail:{visit:e}}),$t=(e,{visitId:t}={})=>Ht(`success`,{detail:{page:e,visitId:t}}),en=(e,t)=>Ht(`prefetched`,{detail:{fetchedAt:Date.now(),response:e,visit:t}}),tn=e=>Ht(`prefetching`,{detail:{visit:e}}),nn=e=>Ht(`flash`,{detail:{flash:e}}),rn=(e,t)=>Ht(`location`,{cancelable:!0,detail:{url:e,versionChange:t}}),an=e=>Ht(`live`,{cancelable:!0,detail:e}),on=`$bigint`,sn=(e,t)=>typeof t==`bigint`?{[on]:t.toString()}:t,cn=(e,t)=>typeof t==`bigint`?t.toString():t;function ln(e){let t=JSON.parse(e);return t?.preserveBigIntegers===!0&&e.includes(`"${on}"`)&&un(t),t}function un(e){if(Array.isArray(e))for(let t=0;t({...e,preserveBigIntegers:!0}),sn)}function pn(e){return mn(e,()=>e,cn)}function mn(e,t,n){try{return JSON.stringify(e)}catch(e){try{return JSON.stringify(t(),n)}catch{throw e}}}function hn(e,t=new WeakSet){return typeof e==`bigint`?!0:typeof e!=`object`||!e||t.has(e)?!1:(t.add(e),(Array.isArray(e)?e:Object.values(e)).some(e=>hn(e,t)))}var gn=class{static locationVisitKey=`inertiaLocationVisit`;static set(e,t){typeof window<`u`&&window.sessionStorage.setItem(e,JSON.stringify(t))}static get(e){if(typeof window<`u`)return JSON.parse(window.sessionStorage.getItem(e)||`null`)}static merge(e,t){let n=this.get(e);n===null?this.set(e,t):this.set(e,{...n,...t})}static remove(e){typeof window<`u`&&window.sessionStorage.removeItem(e)}static removeNested(e,t){let n=this.get(e);n!==null&&(delete n[t],this.set(e,n))}static exists(e){try{return this.get(e)!==null}catch{return!1}}static clear(){typeof window<`u`&&window.sessionStorage.clear()}},_n=12,vn=async e=>{if(typeof window>`u`)throw Error(`Unable to encrypt history`);gn.exists(yn.iv)&&(gn.remove(yn.key),gn.remove(yn.iv));let t=await Tn(await En());if(!t)throw Error(`Unable to encrypt history`);let n=window.crypto.getRandomValues(new Uint8Array(_n)),r=new Uint8Array(await xn(n,t,e)),i=new Uint8Array(n.length+r.length);return i.set(n),i.set(r,n.length),i.buffer},yn={key:`historyKey`,iv:`historyIv`},bn=async e=>{let t=await En();if(!t)throw Error(`Unable to decrypt history`);let n=new Uint8Array(e);return await Sn(n.subarray(0,_n),t,n.subarray(_n))},xn=async(e,t,n)=>{if(typeof window>`u`)throw Error(`Unable to encrypt history`);if(window.crypto.subtle===void 0)return console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve(n);let r=new TextEncoder,i=fn(n),a=new Uint8Array(i.length*3),o=r.encodeInto(i,a);return window.crypto.subtle.encrypt({name:`AES-GCM`,iv:e},t,a.subarray(0,o.written))},Sn=async(e,t,n)=>{if(window.crypto.subtle===void 0)return console.warn(`Decryption is not supported in this environment. SSL is required.`),Promise.resolve(n);let r=await window.crypto.subtle.decrypt({name:`AES-GCM`,iv:e},t,n);return ln(new TextDecoder().decode(r))},Cn=async()=>window.crypto.subtle===void 0?(console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve(null)):window.crypto.subtle.generateKey({name:`AES-GCM`,length:256},!0,[`encrypt`,`decrypt`]),wn=async e=>{if(window.crypto.subtle===void 0)return console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve();let t=await window.crypto.subtle.exportKey(`raw`,e);gn.set(yn.key,Array.from(new Uint8Array(t)))},Tn=async e=>{if(e)return e;let t=await Cn();return t?(await wn(t),t):null},En=async()=>{let e=gn.get(yn.key);return e?await window.crypto.subtle.importKey(`raw`,new Uint8Array(e),{name:`AES-GCM`,length:256},!0,[`encrypt`,`decrypt`]):null},Dn=class extends Error{code;url;constructor(e,t,n){super(n?`${e} (${n})`:e),this.name=`HttpError`,this.code=t,this.url=n}},On=class extends Dn{response;constructor(e,t,n){super(e,`ERR_HTTP_RESPONSE`,n),this.name=`HttpResponseError`,this.response=t}},kn=class extends Dn{constructor(e=`Request was cancelled`,t){super(e,`ERR_CANCELLED`,t),this.name=`HttpCancelledError`}},An=class extends Dn{cause;constructor(e,t,n){super(e,`ERR_NETWORK`,t),this.name=`HttpNetworkError`,this.cause=n}},jn=e=>e instanceof FormData;function Mn(e,t=new FormData,n=null,r=`brackets`){e||={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&Pn(t,Nn(n,i,`indices`),e[i],r);return t}function Nn(e,t,n){return e?n===`brackets`?`${e}[]`:`${e}[${t}]`:t}function Pn(e,t,n,r){if(Array.isArray(n))return Array.from(n.keys()).forEach(i=>Pn(e,Nn(t,i.toString(),r),n[i],r));if(n instanceof Date)return e.append(t,n.toISOString());if(n instanceof File)return e.append(t,n,n.name);if(n instanceof Blob)return e.append(t,n);if(typeof n==`boolean`)return e.append(t,n?`1`:`0`);if(typeof n==`string`)return e.append(t,n);if(typeof n==`number`)return e.append(t,`${n}`);if(typeof n==`bigint`)return e.append(t,n.toString());if(n==null)return e.append(t,``);Mn(n,e,t,r)}var Fn=e=>{let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t},In=(e,t,n)=>{if(e===t)return!0;for(let r in e)if(!n.includes(r)&&e[r]!==t[r]&&!Rn(e[r],t[r]))return!1;for(let r in t)if(!n.includes(r)&&!(r in e))return!1;return!0},Ln=(e,t)=>{let n=Array.from(e.entries()),r=Array.from(t.entries());return n.length===r.length&&n.every(([e,t],n)=>e===r[n][0]&&t===r[n][1])},Rn=(e,t)=>{if(jn(e)||jn(t))return jn(e)&&jn(t)&&Ln(e,t);if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime();if(e===null||t===null||Array.isArray(e)!==Array.isArray(t))return e===t;switch(typeof e){case`object`:return In(e,t,[]);case`function`:return e.toString()===t.toString();default:return e===t}},zn=(e,t,n)=>{let r=me(t);if(r.length===0)return e;let i=(e,t)=>{if(t===r.length)return n;let a=r[t],o=Array.isArray(e)?[...e]:e&&typeof e==`object`?{...e}:/^(?:0|[1-9]\d*)$/.test(a)?[]:{};return o[a]=i(e?.[a],t+1),o};return i(e,0)},Bn=(e,t)=>e===t||e.startsWith(`${t}.`),Vn=(e,t)=>{let{only:n,except:r}=e;return!(n.length===0&&r.length===0||n.length>0&&!n.some(e=>Bn(t,e))||r.length>0&&r.some(e=>Bn(t,e)))},Hn=(e,t)=>{let n=e.only.concat(e.reset),{except:r}=e;return n.length===0&&r.length===0||!(n.length>0&&!n.some(e=>Un(t,e))||r.length>0&&r.some(e=>Bn(t,e)))},Un=(e,t)=>Bn(e,t)||Bn(t,e),Wn=e=>typeof File<`u`&&e instanceof File||e instanceof Blob||typeof FileList<`u`&&e instanceof FileList&&e.length>0;function Gn(e){return Wn(e)||e instanceof FormData&&Array.from(e.values()).some(e=>Gn(e))||typeof e==`object`&&!!e&&Object.values(e).some(e=>Gn(e))}function Kn(e){return/\[\d+\]/.test(decodeURIComponent(e.search))}function qn(e){if(!e||e===`?`)return{};let t={};return e.replace(/^\?/,``).split(`&`).filter(Boolean).forEach(e=>{let[n,r]=Yn(e);Zn(t,Xn(n),Xn(r))}),t}function Jn(e,t){let n=[];return $n(e,``,n,t),n.length?`?`+n.join(`&`):``}function Yn(e){let t=e.indexOf(`=`);return t===-1?[e,``]:[e.substring(0,t),e.substring(t+1)]}function Xn(e){return decodeURIComponent(e.replace(/\+/g,` `))}function Zn(e,t,n){let r=Qn(t);if(r.some(e=>e===`__proto__`))return;let i=e;for(;r.length>1;){let e=r.shift(),t=r[0]===``;(typeof i[e]!=`object`||i[e]===null)&&(i[e]=t?[]:{}),i=i[e]}let a=r.shift();a===``&&Array.isArray(i)?i.push(n):i[a]=n}function Qn(e){let t=[],n=e.split(`[`)[0];n&&t.push(n);let r,i=/\[([^\]]*)\]/g;for(;(r=i.exec(e))!==null;)t.push(r[1]);return t}function $n(e,t,n,r){e!==void 0&&(e===null?n.push(`${t}=`):Array.isArray(e)?e.forEach((e,i)=>{$n(e,r===`indices`?`${t}[${i}]`:`${t}[]`,n,r)}):typeof e==`object`?Object.keys(e).forEach(i=>{$n(e[i],t?`${t}[${i}]`:i,n,r)}):n.push(`${t}=${encodeURIComponent(String(e))}`))}function er(e){return new URL(e.toString(),typeof window>`u`?void 0:window.location.toString())}var tr=(e,t,n,r,i)=>{let a=typeof e==`string`?er(e):e;if((Gn(t)||r)&&!jn(t)&&(Bt.get(`form.forceIndicesArrayFormatInFormData`)&&(i=`indices`),t=Mn(t,new FormData,null,i)),jn(t))return[a,t];let[o,s]=nr(n,a,t,i);return[er(o),s]};function nr(e,t,n,r=`brackets`){let i=e===`get`&&!jn(n)&&Object.keys(n).length>0,a=ur(t.toString()),o=a||t.toString().startsWith(`/`)||t.toString()===``,s=!o&&!t.toString().startsWith(`#`)&&!t.toString().startsWith(`?`),c=/^[.]{1,2}([/]|$)/.test(t.toString()),l=t.toString().includes(`?`)||i,u=t.toString().includes(`#`),d=typeof window>`u`,f=new URL(t.toString(),d?`http://localhost`:window.location.toString());if(i){let e=Kn(f)?`indices`:r;f.search=Jn({...qn(f.search),...n},e)}return[[a?`${f.protocol}//${f.host}`:``,o?f.pathname:``,s?f.pathname.substring(d&&!c?1:0):``,l?f.search:``,u?f.hash:``].join(``),i?{}:n]}function rr(e){return e=new URL(e.href),e.hash=``,e}var ir=(e,t)=>{e.hash&&!t.hash&&rr(e).href===t.href&&(t.hash=e.hash)},ar=(e,t)=>rr(e).href===rr(t).href,or=(e,t)=>e.origin===t.origin&&e.pathname===t.pathname;function sr(e){return typeof e==`object`&&!!e&&e!==void 0&&`url`in e&&`method`in e}function cr(e){return e.component?typeof e.component==`string`?e.component:(console.error(`The "component" property on the URL method pair received multiple components (${Object.keys(e.component).join(`, `)}), but only a single component string is supported for instant visits. Use the withComponent() method to specify which component to use.`),null):null}function lr(e){return new URL(e,window.location.href).origin===window.location.origin}function ur(e){return/^([a-z][a-z0-9+.-]*:)?\/\/[^/]/i.test(e)}function dr(e,t){let n=typeof e==`string`?er(e):e;return t?`${n.protocol}//${n.host}${n.pathname}${n.search}${n.hash}`:`${n.pathname}${n.search}${n.hash}`}var fr=new Map,pr=new Set,mr=null,hr=()=>{pr.forEach(e=>e())},gr=e=>{typeof window>`u`||e.prefetch||or(e.url,window.location)&&(fr.set(e.id,{only:e.only,except:e.except,reset:e.reset}),hr())},_r=(e,t)=>{if(typeof window>`u`)return;let n=Object.values(t??{}).flat().filter(t=>ye(e,t)===void 0);n.length===0?vr():(mr={only:n,except:[],reset:[]},hr())},vr=()=>{mr!==null&&(mr=null,hr())},yr=e=>{fr.delete(e.id)&&hr()},br={isRefreshing(e){for(let t of fr.values())if(Hn(t,e))return!0;return mr!==null&&Hn(mr,e)},onChange(e){return pr.add(e),()=>{pr.delete(e)}}},xr={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},Sr=e=>{if(typeof e==`number`)return e;for(let[t,n]of Object.entries(xr))if(e.endsWith(t))return parseFloat(e)*n;return parseInt(e)},Cr=new class{cached=[];inFlightRequests=[];removalTimers=[];currentUse=null;add(e,t,{cacheFor:n,cacheTags:r}){if(this.findInFlight(e))return Promise.resolve();let i=this.findCached(e);if(!e.fresh&&i&&i.staleTimestamp>Date.now())return Promise.resolve();let[a,o]=this.extractStaleValues(n),s=!1,c=new Promise((n,r)=>{t({...e,onCancel:()=>{s=!0,this.remove(e),this.removeFromInFlight(e.id),e.onCancel(),r(new kn)},onError:t=>{this.remove(e),e.onError(t),r(t)},onPrefetching(t){e.onPrefetching(t)},onPrefetched(t,n){e.onPrefetched(t,n)},onPrefetchResponse(e){n(e)},onPrefetchError:t=>{this.removeFromInFlight(e.id),r(t)}})}).then(t=>{if(!this.isInFlight(e.id))return t;this.remove(e);let n=t.getPageResponse();W.mergeOncePropsIntoResponse(n),this.cached.push({params:{...e},staleTimestamp:Date.now()+a,expiresAt:Date.now()+o,response:c,singleUse:o===0,timestamp:Date.now(),inFlight:!1,tags:Array.isArray(r)?r:[r]});let i=this.getShortestOncePropTtl(n);return this.scheduleForRemoval(e,i?Math.min(o,i):o),this.removeFromInFlight(e.id),t.handlePrefetch(),t});return s||this.inFlightRequests.push({params:{...e},response:c,staleTimestamp:null,inFlight:!0}),c.catch(t=>{if(this.removeFromInFlight(e.id),!(t instanceof kn))throw t})}removeAll(){this.cached=[],this.inFlightRequests=[],this.removalTimers.forEach(e=>{clearTimeout(e.timer)}),this.removalTimers=[]}removeByTags(e){this.cached=this.cached.filter(t=>!t.tags.some(t=>e.includes(t)))}remove(e){this.cached=this.cached.filter(t=>!this.paramsAreEqual(t.params,e)),this.clearTimer(e)}isInFlight(e){return this.inFlightRequests.some(t=>t.params.id===e)}removeFromInFlight(e){this.inFlightRequests=this.inFlightRequests.filter(t=>t.params.id!==e)}extractStaleValues(e){let[t,n]=this.cacheForToStaleAndExpires(e);return[Sr(t),Sr(n)]}cacheForToStaleAndExpires(e){if(!Array.isArray(e))return[e,e];switch(e.length){case 0:return[0,0];case 1:return[e[0],e[0]];default:return[e[0],e[1]]}}clearTimer(e){let t=this.removalTimers.find(t=>this.paramsAreEqual(t.params,e));t&&(clearTimeout(t.timer),this.removalTimers=this.removalTimers.filter(e=>e!==t))}scheduleForRemoval(e,t){if(typeof window<`u`&&(this.clearTimer(e),t>0)){let n=window.setTimeout(()=>this.remove(e),t);this.removalTimers.push({params:e,timer:n})}}get(e){return this.findCached(e)||this.findInFlight(e)}use(e,t){let n=`${t.url.pathname}-${Date.now()}-${Math.random().toString(36).substring(7)}`,r={...t,cached:!0};return this.currentUse={id:n,async:t.async,params:r,response:null},gr(r),e.response.then(e=>{if(this.currentUse?.id===n)return e.mergeParams({...r,onPrefetched:()=>{}}),this.removeSingleUseItems(t),this.currentUse.response=e,e.handle().finally(()=>{this.currentUse?.id===n&&(this.currentUse=null)})},e=>{if(!(e instanceof kn))throw e;this.currentUse?.id===n&&(this.currentUse=null),this.cancelUse(r)}).finally(()=>yr(r))}interruptInFlight({async:e}){let t=this.currentUse;t?.async===e&&(this.currentUse=null,t.response?t.response.interrupt():this.cancelUse(t.params))}cancelUse(e){e.cancelled||(e.cancelled=!0,yr(e),e.onCancel(),e.onFinish(e))}removeSingleUseItems(e){this.cached=this.cached.filter(t=>!this.paramsAreEqual(t.params,e)||!t.singleUse)}findCached(e){return this.cached.find(t=>this.paramsAreEqual(t.params,e))||null}findInFlight(e){return this.inFlightRequests.find(t=>this.paramsAreEqual(t.params,e))||null}withoutPurposePrefetchHeader(e){let t=H(e);return t.headers.Purpose===`prefetch`&&delete t.headers.Purpose,t}paramsAreEqual(e,t){return In(this.withoutPurposePrefetchHeader(e),this.withoutPurposePrefetchHeader(t),`id.showProgress.replace.prefetch.preserveScroll.preserveState.onBefore.onBeforeUpdate.onStart.onProgress.onFinish.onCancel.onSuccess.onError.onHttpException.onNetworkError.onFlash.onPrefetched.onCancelToken.onPrefetching.async.viewTransition.optimistic.component.pageProps.cached`.split(`.`))}updateCachedOncePropsFromCurrentPage(){this.cached.forEach(e=>{e.response.then(t=>{let n=t.getPageResponse();W.mergeOncePropsIntoResponse(n,{force:!0});for(let[e,t]of Object.entries(n.deferredProps??{})){let r=t.filter(e=>ye(n.props,e)===void 0);r.length>0?n.deferredProps[e]=r:delete n.deferredProps[e]}let r=this.getShortestOncePropTtl(n);if(r===null)return;let i=e.expiresAt-Date.now(),a=Math.min(i,r);a>0?this.scheduleForRemoval(e.params,a):this.remove(e.params)})})}getShortestOncePropTtl(e){let t=Object.values(e.onceProps??{}).map(e=>e.expiresAt).filter(e=>!!e);return t.length===0?null:Math.min(...t)-Date.now()}},wr=e=>{if(e.offsetParent===null)return!1;let t=e.getBoundingClientRect(),n=t.top=0,r=t.left=0;return n&&r},Tr=e=>{let t=e=>{let t=window.getComputedStyle(e);return t.overflowY===`scroll`?!0:t.overflowY===`auto`?[`visible`,`clip`].includes(t.overflowX)?!0:r(t.maxHeight,e.style.height)||i(e,`height`):!1},n=e=>{let t=window.getComputedStyle(e);return t.overflowX===`scroll`?!0:t.overflowX===`auto`?[`visible`,`clip`].includes(t.overflowY)?!0:r(t.maxWidth,e.style.width)||i(e,`width`):!1},r=(e,t)=>!!(e&&e!==`none`&&e!==`0px`||t&&t!==`auto`&&t!==`0`),i=(e,t)=>{let n=e.parentElement;if(!n)return!1;let r=window.getComputedStyle(n);if([`flex`,`inline-flex`].includes(r.display)){let e=[`column`,`column-reverse`].includes(r.flexDirection);return t===`height`?e:!e}return[`grid`,`inline-grid`].includes(r.display)},a=e?.parentElement;for(;a;){let e=t(a)||n(a);if(window.getComputedStyle(a).display!==`contents`&&e)return a;a=a.parentElement}return null},Er=(e,t)=>{if(!t)return e.filter(e=>wr(e));let n=e.indexOf(t),r=[],i=[];for(let t=n;t>=0;t--){let n=e[t];if(wr(n))r.push(n);else break}for(let t=n+1;t{window.requestAnimationFrame(()=>{t>1?Dr(e,t-1):e()})},Or=e=>{if(typeof window>`u`)return null;let t=document.querySelector(`script[data-page="${e}"][type="application/json"]`);return t?.textContent?ln(t.textContent):null},kr=typeof window>`u`,Ar=!kr&&/Firefox/i.test(window.navigator.userAgent),jr=class{static save(){Lr.saveScrollPositions(this.getScrollRegions())}static getScrollRegions(){return Array.from(this.regions()).map(e=>({top:e.scrollTop,left:e.scrollLeft}))}static regions(){return document.querySelectorAll(`[scroll-region]`)}static scrollToTop(){if(Ar&&getComputedStyle(document.documentElement).scrollBehavior===`smooth`)return Dr(()=>window.scrollTo(0,0),2);window.scrollTo(0,0)}static reset(){(kr||!window.location.hash)&&this.scrollToTop(),this.regions().forEach(e=>{typeof e.scrollTo==`function`?e.scrollTo(0,0):(e.scrollTop=0,e.scrollLeft=0)}),this.save(),this.scrollToAnchor()}static scrollToAnchor(){let e=kr?null:window.location.hash;e&&setTimeout(()=>{let t=document.getElementById(e.slice(1));t?t.scrollIntoView():this.scrollToTop()})}static restore(e){kr||window.requestAnimationFrame(()=>{this.restoreDocument(),this.restoreScrollRegions(e)})}static restoreScrollRegions(e){kr||this.regions().forEach((t,n)=>{let r=e[n];r&&(typeof t.scrollTo==`function`?t.scrollTo(r.left,r.top):(t.scrollTop=r.top,t.scrollLeft=r.left))})}static restoreDocument(){let e=Lr.getDocumentScrollPosition();window.scrollTo(e.left,e.top)}static onScroll(e){let t=e.target;typeof t.hasAttribute==`function`&&t.hasAttribute(`scroll-region`)&&this.save()}static onWindowScroll(){Lr.saveDocumentScrollPosition({top:window.scrollY,left:window.scrollX})}},W=new class{page;swapComponent;resolveComponent;onFlashCallback;componentId={};listeners=[];isFirstPageLoad=!0;cleared=!1;pendingDeferredProps=null;historyQuotaExceeded=!1;optimisticBaseline={};pendingOptimistics=[];optimisticCounter=0;confirmedOptimisticId=0;init({initialPage:e,swapComponent:t,resolveComponent:n,onFlash:r}){return this.assignPage({...e,flash:e.flash??{},rescuedProps:e.rescuedProps??[]},e.deferredProps),this.swapComponent=t,this.resolveComponent=n,this.onFlashCallback=r,Rr.on(`historyQuotaExceeded`,()=>{this.historyQuotaExceeded=!0}),this}set(e,{replace:t=!1,preserveScroll:n=!1,preserveState:r=!1,viewTransition:i=!1,cached:a=!1,initialRender:o=!1,clientSide:s=!1,visitId:c,isCancelled:l=()=>!1,onCommit:u=()=>{}}={}){let d=this.pendingDeferredProps;!(s&&this.isTheSame(e)&&e.url===this.page.url)&&Object.keys(e.deferredProps||{}).length&&(this.pendingDeferredProps={deferredProps:e.deferredProps,component:e.component,url:e.url},e.initialDeferredProps===void 0&&(e.initialDeferredProps=e.deferredProps));let f=this.pendingDeferredProps;this.componentId={};let p=this.componentId;return e.clearHistory&&(Lr.clear(),Cr.removeAll()),this.resolve(e.component,e).then(s=>{if(p!==this.componentId||l()){l()&&this.pendingDeferredProps===f&&(this.pendingDeferredProps=d);return}u(),e.rememberedState??={};let m=typeof window>`u`,h=m?new URL(e.url):window.location,g=!m&&n?jr.getScrollRegions():[];t||=ar(er(e.url),h);let _={...e,flash:{}};return Lr.clearInitialState(Lr.rememberedState),new Promise(e=>t?Lr.replaceState(_,e):Lr.pushState(_,e)).then(()=>{let l=!this.isTheSame(e);if(!l&&Object.keys(e.props.errors||{}).length>0&&(i=!1),this.cleared=!1,this.assignPage(e,this.pendingDeferredPropsFor(e)),this.hasOnceProps()&&Cr.updateCachedOncePropsFromCurrentPage(),l&&this.fireEventsFor(`newComponent`),this.isFirstPageLoad&&this.fireEventsFor(`firstLoad`),this.isFirstPageLoad=!1,this.historyQuotaExceeded)this.historyQuotaExceeded=!1;else return this.swap({component:s,page:e,preserveState:r,viewTransition:i,initialRender:o}).then(()=>{n?window.requestAnimationFrame(()=>jr.restoreScrollRegions(g)):jr.reset();let r=this.pendingDeferredPropsFor(e);r&&Rr.fireInternalEvent(`loadDeferredProps`,r),this.pendingDeferredProps=null,t||Yt(e,{type:`visit`,cached:a,visitId:c})})})})}setQuietly(e,{preserveState:t=!1}={}){return this.componentId={},this.resolve(e.component,e).then(n=>(this.cleared=!1,this.assignPage(e),Lr.setCurrent(e),this.swap({component:n,page:e,preserveState:t,viewTransition:!1})))}clear(){this.cleared=!0}isCleared(){return this.cleared}get(){return this.page}getWithoutFlashData(){return{...this.page,flash:{}}}hasOnceProps(){return Object.keys(this.page.onceProps??{}).length>0}assignPage(e,t){this.page=e,_r(e.props,t),Rr.fireInternalEvent(`pageUpdated`,e)}pendingDeferredPropsFor(e){let t=this.pendingDeferredProps;if(t&&t.component===e.component&&t.url===e.url)return t.deferredProps}merge(e){this.page={...this.page,...e}}setPropsQuietly(e){return this.page={...this.page,props:e},this.resolve(this.page.component,this.page).then(e=>this.swap({component:e,page:this.page,preserveState:!0,viewTransition:!1}))}setFlash(e){this.page={...this.page,flash:e},this.onFlashCallback?.(e)}setUrlHash(e){this.page.url.includes(e)||(this.page.url+=e)}remember(e){this.page.rememberedState=e}swap({component:e,page:t,preserveState:n,viewTransition:r,initialRender:i=!1}){let a=()=>this.swapComponent({component:e,page:t,preserveState:n,initialRender:i});if(!r||!document?.startViewTransition||document.visibilityState===`hidden`)return a();let o=typeof r==`boolean`?()=>null:r,s=e=>{e.catch(e=>{if(!(e instanceof DOMException))throw e})};return new Promise(e=>{let t=document.startViewTransition(()=>a().then(e));s(t.ready),s(t.finished),s(t.updateCallbackDone),o(t)})}resolve(e,t){return Promise.resolve(this.resolveComponent(e,t))}nextOptimisticId(){return++this.optimisticCounter}markOptimisticConfirmed(e){this.confirmedOptimisticId=Math.max(this.confirmedOptimisticId,e)}hasConfirmedOptimisticAfter(e){return this.confirmedOptimisticId>e}setBaseline(e,t){e in this.optimisticBaseline||(this.optimisticBaseline[e]=t)}updateBaseline(e,t){e in this.optimisticBaseline&&(this.optimisticBaseline[e]=t)}hasBaseline(e){return e in this.optimisticBaseline}registerOptimistic(e,t){this.pendingOptimistics.push({id:e,callback:t})}unregisterOptimistic(e){this.pendingOptimistics=this.pendingOptimistics.filter(t=>t.id!==e)}replayOptimistics(){let e=Object.keys(this.optimisticBaseline);if(e.length===0)return{};let t=H(this.page.props);for(let n of e)t[n]=H(this.optimisticBaseline[n]);for(let{callback:e}of this.pendingOptimistics){let n=e(H(t));n&&Object.assign(t,n)}let n={};for(let r of e)n[r]=t[r];return n}pendingOptimisticCount(){return this.pendingOptimistics.length}clearOptimisticState(){this.optimisticBaseline={},this.pendingOptimistics=[],this.confirmedOptimisticId=0}isTheSame(e){return this.page.component===e.component}on(e,t){return this.listeners.push({event:e,callback:t}),()=>{this.listeners=this.listeners.filter(n=>n.event!==e&&n.callback!==t)}}fireEventsFor(e){this.listeners.filter(t=>t.event===e).forEach(e=>e.callback())}mergeOncePropsIntoResponse(e,{force:t=!1}={}){Object.entries(e.onceProps??{}).forEach(([n,r])=>{let i=this.page.onceProps?.[n];i!==void 0&&(t||ye(e.props,r.prop)===void 0)&&(Ve(e.props,r.prop,ye(this.page.props,i.prop)),e.onceProps[n].expiresAt=i.expiresAt)})}},Mr=class{items=[];processingPromise=null;add(e){return this.items.push(e),this.process()}process(){return this.processingPromise??=this.processNext().then(()=>{if(this.processingPromise=null,this.items.length>0)return this.process()},e=>{throw this.processingPromise=null,e}),this.processingPromise}processNext(){let e=this.items.shift();return e?Promise.resolve(e()).then(()=>this.processNext()):Promise.resolve()}},Nr=typeof window>`u`,Pr=new Mr,Fr=!Nr&&/CriOS/.test(window.navigator.userAgent),Ir=class{rememberedState=`rememberedState`;scrollRegions=`scrollRegions`;preserveUrl=!1;current={};initialState=null;remember(e,t){this.replaceState({...W.getWithoutFlashData(),rememberedState:{...W.get()?.rememberedState??{},[t]:e}})}restore(e){if(!Nr)return this.current[this.rememberedState]?.[e]===void 0?this.initialState?.[this.rememberedState]?.[e]:this.current[this.rememberedState]?.[e]}pushState(e,t=null){Nr||(this.preserveUrl?t&&t():(this.current=e,Pr.add(()=>this.getPageData(e).then(n=>{let r=()=>this.doPushState({page:n},e.url).then(()=>t?.());return Fr?new Promise(e=>{setTimeout(()=>r().then(e))}):r()}))))}clonePageProps(e){try{return structuredClone(e.props),e}catch{return{...e,props:H(e.props)}}}getPageData(e){let t=this.clonePageProps(e);return new Promise(n=>e.encryptHistory?vn(t).then(n):n(t))}processQueue(){return Pr.process()}decrypt(e=null){if(Nr)return Promise.resolve(e??W.get());let t=e??window.history.state?.page;return this.decryptPageData(t).then(e=>{if(!e)throw Error(`Unable to decrypt history`);return this.initialState===null?this.initialState=e??void 0:this.current=e??{},e})}decryptPageData(e){return e instanceof ArrayBuffer?bn(e):Promise.resolve(e)}saveScrollPositions(e){Pr.add(()=>Promise.resolve().then(()=>{if(window.history.state?.page&&!U(this.getScrollRegions(),e))return this.doReplaceState({page:window.history.state.page,scrollRegions:e})}))}saveDocumentScrollPosition(e){Pr.add(()=>Promise.resolve().then(()=>{if(window.history.state?.page&&!U(this.getDocumentScrollPosition(),e))return this.doReplaceState({page:window.history.state.page,documentScrollPosition:e})}))}getScrollRegions(){return window.history.state?.scrollRegions||[]}getDocumentScrollPosition(){return window.history.state?.documentScrollPosition||{top:0,left:0}}replaceState(e,t=null){if(U(this.current,e)){t&&t();return}let{flash:n,...r}=e;W.merge(r),Nr||(this.preserveUrl?t&&t():(this.current=e,Pr.add(()=>this.getPageData(e).then(n=>{let r=()=>this.doReplaceState({page:n},e.url).then(()=>t?.());return Fr?new Promise(e=>{setTimeout(()=>r().then(e))}):r()}))))}isHistoryThrottleError(e){return e instanceof Error&&e.name===`SecurityError`&&(e.message.includes(`history.pushState`)||e.message.includes(`history.replaceState`))}isQuotaExceededError(e){return e instanceof Error&&e.name===`QuotaExceededError`}withThrottleProtection(e){return Promise.resolve().then(()=>{try{return e()}catch(e){if(!this.isHistoryThrottleError(e))throw e;console.error(e.message)}})}doReplaceState(e,t){return this.withThrottleProtection(()=>{try{window.history.replaceState({...e,scrollRegions:e.scrollRegions??window.history.state?.scrollRegions,documentScrollPosition:e.documentScrollPosition??window.history.state?.documentScrollPosition},``,t)}catch(e){if(!this.isQuotaExceededError(e))throw e;console.error(e.message)}})}doPushState(e,t){return this.withThrottleProtection(()=>{try{window.history.pushState(e,``,t)}catch(e){if(!this.isQuotaExceededError(e))throw e;Rr.fireInternalEvent(`historyQuotaExceeded`,t)}})}getState(e,t){return this.current?.[e]??t}deleteState(e){this.current[e]!==void 0&&(delete this.current[e],this.replaceState(this.current))}clearInitialState(e){this.initialState&&this.initialState[e]!==void 0&&(this.initialState={...this.initialState,[e]:void 0})}browserHasHistoryEntry(){return!Nr&&!!window.history.state?.page}clear(){gn.remove(yn.key),gn.remove(yn.iv)}setCurrent(e){this.current=e}isValidState(e){return!!e.page}getAllState(){return this.current}};typeof window<`u`&&window.history.scrollRestoration&&(window.history.scrollRestoration=`manual`);var Lr=new Ir,Rr=new class{internalListeners=[];onWindowScroll=Vt(()=>jr.onWindowScroll(),100);onScroll=Vt(e=>jr.onScroll(e),100);init(){typeof window<`u`&&(window.addEventListener(`popstate`,this.handlePopstateEvent.bind(this)),window.addEventListener(`pageshow`,this.handlePageshowEvent.bind(this)),window.addEventListener(`scroll`,this.onWindowScroll,!0)),typeof document<`u`&&document.addEventListener(`scroll`,this.onScroll,!0)}onGlobalEvent(e,t){return this.registerListener(`inertia:${e}`,(e=>{let n=t(e);e.cancelable&&!e.defaultPrevented&&n===!1&&e.preventDefault()}))}on(e,t){return this.internalListeners.push({event:e,listener:t}),()=>{this.internalListeners=this.internalListeners.filter(e=>e.listener!==t)}}onMissingHistoryItem(){W.clear(),this.fireInternalEvent(`missingHistoryItem`)}fireInternalEvent(e,...t){this.internalListeners.filter(t=>t.event===e).forEach(e=>e.listener(...t))}registerListener(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)}handlePageshowEvent(e){e.persisted&&Lr.decrypt().catch(()=>this.onMissingHistoryItem())}handlePopstateEvent(e){this.onWindowScroll.cancel(),this.onScroll.cancel();let t=e.state||null;if(t===null){let e=er(W.get().url);e.hash=window.location.hash,Lr.replaceState({...W.getWithoutFlashData(),url:e.href}),jr.reset()}else{if(!Lr.isValidState(t))return this.onMissingHistoryItem();Qa.cancelAll({prefetch:!1}),Lr.decrypt(t.page).then(e=>{W.get().version===e.version?W.setQuietly(e,{preserveState:!1}).then(()=>{jr.restore(Lr.getScrollRegions()),Yt(W.get(),{type:`history`});let t={},n=W.get().props;for(let[r,i]of Object.entries(e.initialDeferredProps??e.deferredProps??{})){let e=i.filter(e=>ye(n,e)===void 0);e.length>0&&(t[r]=e)}Object.keys(t).length>0&&this.fireInternalEvent(`loadDeferredProps`,t)}):this.onMissingHistoryItem()}).catch(()=>{this.onMissingHistoryItem()})}}},zr=new class{type;constructor(){this.type=this.resolveType()}resolveType(){return typeof window>`u`?`navigate`:window.performance?.getEntriesByType(`navigation`)[0]?.type??`navigate`}get(){return this.type}isBackForward(){return this.type===`back_forward`}isReload(){return this.type===`reload`}};function Br(){let e=typeof window<`u`?window.crypto:void 0;if(e?.randomUUID)return e.randomUUID();let t=()=>e?.getRandomValues?e.getRandomValues(new Uint8Array(1))[0]:Math.floor(Math.random()*256);return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(+e^t()&15>>e/4).toString(16))}var Vr=class{static handle(){this.clearRememberedStateOnReload(),[this.handleBackForward,this.handleLocation,this.handleDefault].find(e=>e.bind(this)())}static clearRememberedStateOnReload(){zr.isReload()&&(Lr.deleteState(Lr.rememberedState),Lr.clearInitialState(Lr.rememberedState))}static handleBackForward(){if(!zr.isBackForward()||!Lr.browserHasHistoryEntry())return!1;let e=Lr.getScrollRegions();return Lr.decrypt().then(t=>{if(W.get().version!==t.version){this.handleDefault();return}let n=Br();W.set(t,{preserveScroll:!0,preserveState:!0,visitId:n}).then(()=>{jr.restore(e),Yt(W.get(),{type:`history`,visitId:n})})}).catch(()=>{Rr.onMissingHistoryItem()}),!0}static handleLocation(){if(!gn.exists(gn.locationVisitKey))return!1;let e=gn.get(gn.locationVisitKey)||{};return gn.remove(gn.locationVisitKey),typeof window<`u`&&W.setUrlHash(window.location.hash),Lr.decrypt(W.get()).then(()=>{let t=Br(),n=Lr.getState(Lr.rememberedState,{}),r=Lr.getScrollRegions();W.remember(n),W.set(W.get(),{preserveScroll:e.preserveScroll,preserveState:!0,initialRender:!0,visitId:t}).then(()=>{e.preserveScroll&&jr.restore(r),this.fireInitialEvents(t)})}).catch(()=>{Rr.onMissingHistoryItem()}),!0}static handleDefault(){typeof window<`u`&&W.setUrlHash(window.location.hash);let e=Br();W.set(W.get(),{preserveScroll:!0,preserveState:!0,initialRender:!0,visitId:e}).then(()=>{zr.isReload()?jr.restore(Lr.getScrollRegions()):jr.scrollToAnchor(),this.fireInitialEvents(e)})}static fireInitialEvents(e){let t=W.get();Yt(t,{type:`initial`,visitId:e}),Object.keys(t.flash).length>0&&queueMicrotask(()=>nn(t.flash))}},Hr=class{intervalId=null;timeoutId=null;hidden=!1;background;cb;interval;cbCount=0;mode;inFlight=!1;currentCancel=null;stopped=!0;instanceId=0;lastPolledAt=0;constructor(e,t,n){this.background=n.background??(n.keepAlive?`continue`:`throttle`),this.hidden=typeof document<`u`&&document.hidden,this.mode=n.mode??`overlap`,this.cb=t,this.interval=e,(n.autoStart??!0)&&this.start()}stop(){this.stopped=!0,this.instanceId++,this.inFlight=!1,this.currentCancel=null,this.clearTimers()}start(){typeof window<`u`&&(this.stop(),this.stopped=!1,this.lastPolledAt=Date.now(),this.isPaused()||(this.mode===`rest`?this.scheduleNext():this.startInterval()))}isInBackground(e){e!==this.hidden&&(this.hidden=e,this.isThrottled()&&(this.cbCount=0),this.background===`pause`&&(e?this.clearTimers():this.resume()))}isThrottled(){return this.hidden&&this.background===`throttle`}isPaused(){return this.hidden&&this.background===`pause`}resume(){if(this.stopped||this.mode===`rest`&&this.inFlight)return;let e=this.interval-(Date.now()-this.lastPolledAt);e>0?this.timeoutId=window.setTimeout(()=>{this.timeoutId=null,this.resume()},e):(this.fire(),this.mode!==`rest`&&this.startInterval())}startInterval(){this.intervalId=window.setInterval(()=>this.tick(),this.interval)}clearTimers(){this.intervalId&&=(clearInterval(this.intervalId),null),this.timeoutId&&=(clearTimeout(this.timeoutId),null)}scheduleNext(){this.stopped||this.isPaused()||(this.timeoutId=window.setTimeout(()=>{this.timeoutId=null,this.tick()},this.interval))}tick(){let e=this.isThrottled();!e||this.cbCount%10==0?this.fire():this.mode===`rest`&&this.scheduleNext(),e&&this.cbCount++}fire(){this.inFlight&&this.mode===`cancel`&&this.currentCancel?.(),this.lastPolledAt=Date.now();let e=this.instanceId;this.cb({onStart:t=>{e===this.instanceId&&(this.inFlight=!0,this.currentCancel=t)},onFinish:()=>{e===this.instanceId&&(this.inFlight=!1,this.currentCancel=null,this.mode===`rest`&&(this.lastPolledAt=Date.now(),this.scheduleNext()))}})}},Ur=new Set,Wr=!1,Gr=()=>{Wr||typeof document>`u`||(Wr=!0,document.addEventListener(`visibilitychange`,()=>{Ur.forEach(e=>e(document.hidden))},!1))},Kr={isHidden(){return typeof document<`u`&&document.hidden},onChange(e){return Gr(),Ur.add(e),()=>{Ur.delete(e)}}},qr=new class{polls=[];constructor(){this.setupVisibilityListener()}get count(){return this.polls.length}add(e,t,n){let r=new Hr(e,t,n);return r.isInBackground(Kr.isHidden()),this.polls.push(r),{stop:()=>r.stop(),start:()=>r.start(),destroy:()=>{r.stop(),this.polls=this.polls.filter(e=>e!==r)}}}clear(){this.polls.forEach(e=>e.stop()),this.polls=[]}setupVisibilityListener(){Kr.onChange(e=>{this.polls.forEach(t=>t.isInBackground(e))})}},Jr=new class{requestHandlers=[];responseHandlers=[];errorHandlers=[];onRequest(e){return this.requestHandlers.push(e),()=>{this.requestHandlers=this.requestHandlers.filter(t=>t!==e)}}onResponse(e){return this.responseHandlers.push(e),()=>{this.responseHandlers=this.responseHandlers.filter(t=>t!==e)}}onError(e){return this.errorHandlers.push(e),()=>{this.errorHandlers=this.errorHandlers.filter(t=>t!==e)}}async processRequest(e){let t=e;for(let e of this.requestHandlers)t=await e(t);return t}async processResponse(e){let t=e;for(let e of this.responseHandlers)t=await e(t);return t}async processError(e){for(let t of this.errorHandlers)await t(e)}};function Yr(e){let t=document.cookie.match(RegExp(`(^|;\\s*)(`+e+`)=([^;]*)`));return t?decodeURIComponent(t[3]):null}function Xr(e){let t={};return e.getAllResponseHeaders().split(`\r +`).forEach(e=>{let n=e.indexOf(`:`);n>0&&(t[e.slice(0,n).toLowerCase().trim()]=e.slice(n+1).trim())}),t}function Zr(e){return typeof FormData<`u`&&e instanceof FormData}function Qr(e){return typeof e==`string`||Zr(e)||typeof Blob<`u`&&e instanceof Blob||typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer||typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e)||typeof URLSearchParams<`u`&&e instanceof URLSearchParams}function $r(e,t){if(!t.headers)return;let n=Zr(t.data);Object.entries(t.headers).forEach(([t,r])=>{t.toLowerCase()===`content-type`&&n||e.setRequestHeader(t,String(r))})}function ei(e,t){if(!t||Object.keys(t).length===0)return e;let[n]=nr(`get`,e,t);return n}var ti=class{xsrfCookieName;xsrfHeaderName;constructor(e={}){this.xsrfCookieName=e.xsrfCookieName??`XSRF-TOKEN`,this.xsrfHeaderName=e.xsrfHeaderName??`X-XSRF-TOKEN`}async request(e){let t=await Jr.processRequest(e);try{let e=await this.doRequest(t);return await Jr.processResponse(e)}catch(e){throw(e instanceof On||e instanceof An||e instanceof kn)&&await Jr.processError(e),e}}doRequest(e){return new Promise((t,n)=>{if(e.signal?.aborted){n(new kn(`Request was cancelled`,e.url));return}let r=new XMLHttpRequest,i=ei(e.url,e.params);r.open(e.method.toUpperCase(),i,!0);let a=lr(i)?Yr(this.xsrfCookieName):null;a&&r.setRequestHeader(this.xsrfHeaderName,a),Object.keys(e.headers??{}).some(e=>e.toLowerCase()===`x-requested-with`)||r.setRequestHeader(`X-Requested-With`,`XMLHttpRequest`);let o=null;e.data!==null&&e.data!==void 0&&(Qr(e.data)?o=e.data:typeof e.data==`object`?(o=JSON.stringify(e.data),!e.headers?.[`Content-Type`]&&!e.headers?.[`content-type`]&&r.setRequestHeader(`Content-Type`,`application/json`)):o=String(e.data)),$r(r,e),e.onUploadProgress&&(r.upload.onprogress=t=>{let n=t.lengthComputable?t.loaded/t.total:void 0;e.onUploadProgress({progress:n,percentage:n?Math.round(n*100):0,loaded:t.loaded,total:t.lengthComputable?t.total:void 0})}),e.signal&&e.signal.addEventListener(`abort`,()=>r.abort()),r.onabort=()=>n(new kn(`Request was cancelled`,e.url)),r.onerror=()=>n(new An(`Network error`,e.url)),r.onload=()=>{let i={status:r.status,data:r.responseText,headers:Xr(r)};r.status>=400?n(new On(`Request failed with status ${r.status}`,i,e.url)):t(i)},r.send(o)})}},ni=new ti;ht.withSerializer(pn);var ri=ni;function ii(e){return!(`request`in e)}var ai={getClient(){return ri},setClient(e){ii(e)?(ri=new ti(e),e.xsrfCookieName&&ht.withXsrfCookieName(e.xsrfCookieName),e.xsrfHeaderName&&ht.withXsrfHeaderName(e.xsrfHeaderName)):ri=e},onRequest:Jr.onRequest.bind(Jr),onResponse:Jr.onResponse.bind(Jr),onError:Jr.onError.bind(Jr),processRequest:Jr.processRequest.bind(Jr),processResponse:Jr.processResponse.bind(Jr),processError:Jr.processError.bind(Jr)},oi=new class{requestHandlers=[];responseHandlers=[];onVisitRequest(e){return this.requestHandlers.push(e),()=>{this.requestHandlers=this.requestHandlers.filter(t=>t!==e)}}onVisitResponse(e){return this.responseHandlers.push(e),()=>{this.responseHandlers=this.responseHandlers.filter(t=>t!==e)}}async processRequest(e,t){let n=t;for(let t of this.requestHandlers)n=await t(e,n);return n}async processResponse(e,t){let n=t;for(let t of this.responseHandlers)n=await t(e,n);return n}};function si(){typeof window<`u`&&(window.__inertia_interceptors__=oi)}var ci=class e{callbacks=[];params;constructor(e){if(!e.prefetch)this.params=e;else{let t={onBefore:this.wrapCallback(e,`onBefore`),onBeforeUpdate:this.wrapCallback(e,`onBeforeUpdate`),onStart:this.wrapCallback(e,`onStart`),onProgress:this.wrapCallback(e,`onProgress`),onFinish:this.wrapCallback(e,`onFinish`),onCancel:this.wrapCallback(e,`onCancel`),onSuccess:this.wrapCallback(e,`onSuccess`),onError:this.wrapCallback(e,`onError`),onHttpException:this.wrapCallback(e,`onHttpException`),onNetworkError:this.wrapCallback(e,`onNetworkError`),onFlash:this.wrapCallback(e,`onFlash`),onCancelToken:this.wrapCallback(e,`onCancelToken`),onPrefetched:this.wrapCallback(e,`onPrefetched`),onPrefetching:this.wrapCallback(e,`onPrefetching`)};this.params={...e,...t,onPrefetchResponse:e.onPrefetchResponse||(()=>{}),onPrefetchError:e.onPrefetchError||(()=>{})}}}static create(t){return new e(t)}data(){return this.params.method===`get`?null:this.params.data}queryParams(){return this.params.method===`get`?this.params.data:{}}isPartial(){return this.params.only.length>0||this.params.except.length>0||this.params.reset.length>0}isPrefetch(){return this.params.prefetch===!0}isDeferredPropsRequest(){return this.params.deferredProps===!0}isPollRequest(){return this.params.poll===!0}isQueryMethodReload(){return this.params.queryMethodReload===!0}onCancelToken(e){this.params.onCancelToken({cancel:e})}markAsFinished(){this.params.completed=!0,this.params.cancelled=!1,this.params.interrupted=!1}markAsCancelled({cancelled:e=!0,interrupted:t=!1}){this.params.onCancel(),this.params.completed=!1,this.params.cancelled=e,this.params.interrupted=t}wasCancelledAtAll(){return this.params.cancelled||this.params.interrupted}onFinish(){this.params.onFinish(this.params)}onStart(){this.params.onStart(this.params)}onPrefetching(){this.params.onPrefetching(this.params)}onPrefetchResponse(e){this.params.onPrefetchResponse&&this.params.onPrefetchResponse(e)}onPrefetchError(e){this.params.onPrefetchError&&this.params.onPrefetchError(e)}all(){return this.params}headers(){let e={...this.params.headers};this.isPartial()&&(e[`X-Inertia-Partial-Component`]=W.get().component);let t=this.params.only.concat(this.params.reset);return t.length>0&&(e[`X-Inertia-Partial-Data`]=t.join(`,`)),this.params.except.length>0&&(e[`X-Inertia-Partial-Except`]=this.params.except.join(`,`)),this.params.reset.length>0&&(e[`X-Inertia-Reset`]=this.params.reset.join(`,`)),this.params.errorBag&&this.params.errorBag.length>0&&(e[`X-Inertia-Error-Bag`]=this.params.errorBag),e}setPreserveOptions(t){this.params.preserveScroll=e.resolvePreserveOption(this.params.preserveScroll,t),this.params.preserveState=e.resolvePreserveOption(this.params.preserveState,t)}runCallbacks(){this.callbacks.forEach(({name:e,args:t})=>{this.params[e](...t)})}merge(e){this.params={...this.params,...e}}wrapCallback(e,t){return(...n)=>{this.recordCallback(t,n),e[t](...n)}}recordCallback(e,t){this.callbacks.push({name:e,args:t})}static resolvePreserveOption(e,t){return typeof e==`function`?e(t):e===`errors`?Object.keys(t.props.errors||{}).length>0:e}leavesPage(e,t){return this.params.async?!1:this.isPartial()?!or(t,e):this.params.method===`query`||!ar(t,e)}},li={createIframeAndPage(e){typeof e==`object`&&(e=`All Inertia requests must receive a valid Inertia response, however a plain JSON response was received.
${JSON.stringify(e)}`);let t=document.createElement(`html`);t.innerHTML=e,t.querySelectorAll(`a`).forEach(e=>e.setAttribute(`target`,`_top`));let n=document.createElement(`iframe`);return n.style.backgroundColor=`white`,n.style.borderRadius=`5px`,n.style.width=`100%`,n.style.height=`100%`,n.setAttribute(`sandbox`,`allow-scripts`),{iframe:n,page:t}},show(e){let{iframe:t,page:n}=this.createIframeAndPage(e);t.style.boxSizing=`border-box`,t.style.display=`block`;let r=document.createElement(`dialog`);r.id=`inertia-error-dialog`,Object.assign(r.style,{width:`calc(100vw - 100px)`,height:`calc(100vh - 100px)`,padding:`0`,margin:`auto`,border:`none`,backgroundColor:`transparent`});let i=document.createElement(`style`);i.textContent=` dialog#inertia-error-dialog::backdrop { background-color: rgba(0, 0, 0, 0.6); } @@ -7,8 +8,8 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r= dialog#inertia-error-dialog:focus { outline: none; } - `;let a=zt.get(`nonce`);a&&(i.nonce=a),document.head.appendChild(i),r.addEventListener(`click`,e=>{e.target===r&&r.close()}),r.addEventListener(`close`,()=>{i.remove(),r.remove()}),r.appendChild(t),document.body.prepend(r),r.showModal(),r.focus(),t.srcdoc=n.outerHTML}},li=new jr,ui=class e{constructor(e,t,n,r=null){this.requestParams=e,this.response=t,this.originatingPage=n,this.optimisticId=r}requestParams;response;originatingPage;optimisticId;wasPrefetched=!1;processed=!1;pageApplied=!1;static create(t,n,r,i=null){return new e(t,n,r,i)}isProcessed(){return this.processed}async handlePrefetch(){let{method:e,url:t}=this.requestParams.all();e!==`query`&&ir(t,window.location)&&this.handle()}async handle(){return li.add(()=>this.process())}async process(){if(this.pageApplied=!1,this.requestParams.all().prefetch)return this.wasPrefetched=!0,this.requestParams.all().prefetch=!1,this.requestParams.all().onPrefetched(this.response,this.requestParams.all()),$t(this.response,this.requestParams.all()),Promise.resolve();if(this.requestParams.runCallbacks(),this.processed=!0,!this.requestParams.wasCancelledAtAll()){if(!this.isInertiaResponse())return this.handleNonInertiaResponse();if(this.isHttpException()){let e={...this.response,data:this.getDataFromResponse(this.response.data)};if(this.requestParams.all().onHttpException(e)===!1||!Kt(e))return}await Ir.processQueue(),Ir.preserveUrl=this.requestParams.all().preserveUrl;try{if(await this.setPage(),this.requestParams.wasCancelledAtAll()&&!this.pageApplied)return;let{flash:e}=G.get();Object.keys(e).length>0&&!this.requestParams.isDeferredPropsRequest()&&(tn(e),this.requestParams.all().onFlash(e));let t=G.get().props.errors||{};if(Object.keys(t).length>0){let e=this.getScopedErrors(t);return Ut(e,{page:G.get(),visitId:this.requestParams.all().id}),this.requestParams.all().onError(e)}Za.flushByCacheTags(this.requestParams.all().invalidateCacheTags||[]),this.wasPrefetched||Za.flush(G.get().url),Qt(G.get(),{visitId:this.requestParams.all().id}),await this.requestParams.all().onSuccess(G.get())}finally{Ir.preserveUrl=!1}}}mergeParams(e){this.requestParams.merge(e)}interrupt(){this.requestParams.wasCancelledAtAll()||this.requestParams.markAsCancelled({cancelled:!1,interrupted:!0})}getPageResponse(){let e=this.getDataFromResponse(this.response.data);return typeof e==`object`?this.response.data={...e,flash:e.flash??{},rescuedProps:e.rescuedProps??[]}:this.response.data=e}async handleNonInertiaResponse(){if(this.isInertiaRedirect()){Za.visit(this.getHeader(`x-inertia-redirect`),{...this.requestParams.all(),method:`get`,data:{}});return}if(this.isLocationVisit()){let e=$n(this.getHeader(`x-inertia-location`));return rr(this.requestParams.all().url,e),this.locationVisit(e)}let e={...this.response,data:this.getDataFromResponse(this.response.data)};if(this.requestParams.all().onHttpException(e)!==!1&&Kt(e))return ci.show(e.data)}isInertiaResponse(){return this.hasHeader(`x-inertia`)}isHttpException(){return this.response.status>=400}hasStatus(e){return this.response.status===e}getHeader(e){return this.response.headers[e]}hasHeader(e){return this.getHeader(e)!==void 0}isInertiaRedirect(){return this.hasStatus(409)&&this.hasHeader(`x-inertia-redirect`)}isLocationVisit(){return this.hasStatus(409)&&this.hasHeader(`x-inertia-location`)}locationVisit(e){try{if(typeof window>`u`)return;let t=this.getHeader(`x-inertia-version`),n=!!t&&t!==G.get().version;if(!nn(e,n)||n&&this.requestParams.all().async)return;hn.set(hn.locationVisitKey,{preserveScroll:this.requestParams.all().preserveScroll===!0}),ir(window.location,e)?window.location.reload():window.location.href=e.href}catch{return!1}}async setPage(){let e=this.getPageResponse();if(!this.shouldSetPage(e))return Promise.resolve();if(this.response=await ai.processResponse(this.requestParams.all(),this.response),this.mergeProps(e),G.mergeOncePropsIntoResponse(e),this.preserveOptimisticProps(e),this.preserveEqualProps(e),await this.setRememberedState(e),this.requestParams.wasCancelledAtAll())return;let t=$n(G.get().url),n=$n(e.url),r=this.requestParams.leavesPage(t,n),i=this.keepsCurrentUrl(t,n);this.requestParams.setPreserveOptions(e);let a=this.queryMethodData(e);a&&(e.queryMethodData=a),e.url=Ir.preserveUrl||i?G.get().url:this.pageUrl(e),this.requestParams.all().onBeforeUpdate(e),qt(e);let o=this.requestParams.all();return G.set(e,{replace:o.replace,preserveScroll:o.preserveScroll,preserveState:o.preserveState,viewTransition:o.viewTransition,cached:o.cached,visitId:o.id,isCancelled:()=>this.requestParams.wasCancelledAtAll(),onCommit:()=>{this.pageApplied=!0,r&&Lr.fireInternalEvent(`leavePage`,t)}})}queryMethodData(e){let{method:t,data:n,url:r,preserveUrl:i}=this.requestParams.all();if(t===`query`&&!An(n)&&ir($n(e.url),r)&&Object.keys(e.props.errors??{}).length===0)return this.requestParams.isQueryMethodReload()&&i?G.get().queryMethodData:n}getDataFromResponse(e){if(typeof e!=`string`)return e;try{return cn(e)}catch{return e}}shouldSetPage(e){if(!this.requestParams.all().async||this.originatingPage.component!==e.component)return!0;if(this.originatingPage.component!==G.get().component)return!1;let t=$n(this.originatingPage.url),n=$n(G.get().url);return t.origin===n.origin&&t.pathname===n.pathname}keepsCurrentUrl(e,t){let n=this.requestParams.all();if(!n.async)return!1;let r=$n(this.originatingPage.url),i=ir(n.url,r),a=!ir(e,r),o=ar(t,e);return i&&a&&o}pageUrl(e){let t=$n(e.url);return e.preserveFragment?t.hash=this.requestParams.all().url.hash:rr(this.requestParams.all().url,t),t.pathname+t.search+t.hash}preserveOptimisticProps(e){if(Za.hasPendingOptimistic()||this.isStaleOptimisticResponse())for(let t of Object.keys(e.props))G.hasBaseline(t)&&(G.updateBaseline(t,e.props[t]),e.props[t]=G.get().props[t])}isStaleOptimisticResponse(){return this.optimisticId!==null&&G.hasConfirmedOptimisticAfter(this.optimisticId)}preserveEqualProps(e){if(e.component!==G.get().component)return;let t=G.get().props;Object.entries(e.props).forEach(([n,r])=>{pe(r,t[n])&&(e.props[n]=t[n])})}mergeProps(e){if(!this.requestParams.isPartial()||e.component!==G.get().component)return;let t=e.mergeProps||[],n=e.prependProps||[],r=e.deepMergeProps||[],i=e.matchPropsOn||[],a=(t,n)=>{let r=Te(G.get().props,t),a=Te(e.props,t);if(Array.isArray(a)){let o=this.mergeOrMatchItems(r||[],a,t,i,n);qe(e.props,t,o)}else if(typeof a==`object`&&a){let n={...r||{},...a};qe(e.props,t,n)}};t.forEach(e=>a(e,!0)),n.forEach(e=>a(e,!1)),r.forEach(t=>{let n=Te(G.get().props,t),r=Te(e.props,t),a=(e,t,n)=>Array.isArray(t)?this.mergeOrMatchItems(e,t,n,i):typeof t==`object`&&t?Object.keys(t).reduce((r,i)=>(r[i]=a(e?e[i]:void 0,t[i],`${n}.${i}`),r),{...e}):t;qe(e.props,t,a(n,r,t))});let o=new Set([...this.requestParams.all().only,...this.requestParams.all().except].filter(e=>e.includes(`.`)).map(e=>e.split(`.`)[0]));for(let t of o){let n=G.get().props[t];this.isObject(n)&&this.isObject(e.props[t])&&(e.props[t]=this.deepMergeObjects(n,e.props[t]))}e.props={...G.get().props,...e.props},this.shouldPreserveErrors(e)&&(e.props.errors=G.get().props.errors),G.get().scrollProps&&(e.scrollProps={...G.get().scrollProps||{},...e.scrollProps||{}}),G.get().liveProps&&(e.liveProps={...G.get().liveProps||{},...e.liveProps||{}}),G.hasOnceProps()&&(e.onceProps={...G.get().onceProps||{},...e.onceProps||{}}),this.requestParams.isDeferredPropsRequest()&&(e.flash={...G.get().flash});let s=G.get().initialDeferredProps;s&&Object.keys(s).length>0&&(e.initialDeferredProps=s),e.rescuedProps=this.mergeRescuedProps(e)}mergeRescuedProps(e){let t=G.get().rescuedProps??[],n=e.rescuedProps??[],r=new Set(t.filter(e=>!Bn(this.requestParams.all(),e)));return n.forEach(e=>r.add(e)),Array.from(r)}shouldPreserveErrors(e){if(!this.requestParams.all().preserveErrors)return!1;let t=G.get().props.errors;if(!t||Object.keys(t).length===0)return!1;let n=e.props.errors;return!(n&&Object.keys(n).length>0)}isObject(e){return e&&typeof e==`object`&&!Array.isArray(e)}deepMergeObjects(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];n[r]=this.isObject(i)&&this.isObject(a)?this.deepMergeObjects(i,a):a}return n}mergeOrMatchItems(e,t,n,r,i=!0){let a=Array.isArray(e)?e:[],o=r.find(e=>e.split(`.`).slice(0,-1).join(`.`)===n);if(!o)return i?[...a,...t]:[...t,...a];let s=o.split(`.`).pop()||``,c=new Map;return t.forEach(e=>{this.hasUniqueProperty(e,s)&&c.set(e[s],e)}),i?this.appendWithMatching(a,t,c,s):this.prependWithMatching(a,t,c,s)}appendWithMatching(e,t,n,r){let i=e.map(e=>this.hasUniqueProperty(e,r)&&n.has(e[r])?n.get(e[r]):e),a=t.filter(t=>!this.hasUniqueProperty(t,r)||!e.some(e=>this.hasUniqueProperty(e,r)&&e[r]===t[r]));return[...i,...a]}prependWithMatching(e,t,n,r){let i=e.filter(e=>!this.hasUniqueProperty(e,r)||!n.has(e[r]));return[...t,...i]}hasUniqueProperty(e,t){return e&&typeof e==`object`&&t in e}async setRememberedState(e){let t=await Ir.getState(Ir.rememberedState,{});this.requestParams.all().preserveState&&t&&e.component===G.get().component&&(e.rememberedState=t)}getScopedErrors(e){return this.requestParams.all().errorBag?e[this.requestParams.all().errorBag||``]||{}:e}},di=class e{constructor(e,t,{optimisticId:n=null}={}){this.page=t,this.requestParams=si.create(e),this.cancelToken=new AbortController,this.optimisticId=n}page;response;cancelToken;requestParams;requestHasFinished=!1;optimisticId;static create(t,n,r){return new e(t,n,r)}isPrefetch(){return this.requestParams.isPrefetch()}getUrl(){return this.requestParams.all().url}isOptimistic(){return this.optimisticId!==null}isPendingOptimistic(){return this.isOptimistic()&&(!this.response||!this.response.isProcessed())}async send(){hr(this.requestParams.all()),this.requestParams.onCancelToken(()=>{this.response||this.cancel({cancelled:!0})});let e=!1,t;try{Zt(this.requestParams.all()),this.requestParams.onStart(),this.requestParams.all().prefetch&&(this.requestParams.onPrefetching(),en(this.requestParams.all())),e=this.requestParams.all().prefetch;let n={method:this.requestParams.all().method,url:nr(this.requestParams.all().url).href,data:this.requestParams.data(),signal:this.cancelToken.signal,headers:this.getHeaders(),onUploadProgress:this.onProgress.bind(this)};mn(n.data)&&(n.data=fn(n.data),n.headers={"Content-Type":`application/json`,...n.headers}),t=await ai.processRequest(this.requestParams.all(),n)}catch(e){throw vr(this.requestParams.all()),e}return ii.getClient().request(t).then(e=>(this.response=ui.create(this.requestParams,e,this.page,this.optimisticId),this.response.handle())).catch(e=>e instanceof Dn?(this.response=ui.create(this.requestParams,e.response,this.page,this.optimisticId),this.response.handle()):Promise.reject(e)).catch(t=>{if(!(t instanceof On)&&this.requestParams.all().onNetworkError(t)!==!1&&Wt(t))return e&&this.requestParams.onPrefetchError(t),Promise.reject(t)}).finally(()=>{this.finish(),e&&this.response&&this.requestParams.onPrefetchResponse(this.response)})}finish(){this.requestParams.wasCancelledAtAll()||(this.requestParams.markAsFinished(),this.fireFinishEvents())}fireFinishEvents(){this.requestHasFinished||(this.requestHasFinished=!0,vr(this.requestParams.all()),Gt(this.requestParams.all()),this.requestParams.onFinish())}cancel({cancelled:e=!1,interrupted:t=!1}){this.requestHasFinished||(this.cancelToken.abort(),this.requestParams.markAsCancelled({cancelled:e,interrupted:t}),this.fireFinishEvents())}onProgress(e){this.requestParams.data()instanceof FormData&&(Xt(e),this.requestParams.all().onProgress(e))}getHeaders(){let e={...this.requestParams.headers(),Accept:`text/html, application/xhtml+xml`,"X-Requested-With":`XMLHttpRequest`,"X-Inertia":!0},t=G.get();t.version&&(e[`X-Inertia-Version`]=t.version);let n=Object.entries(t.onceProps||{}).filter(([,e])=>Te(t.props,e.prop)===void 0?!1:!e.expiresAt||e.expiresAt>Date.now()).map(([e])=>e);return n.length>0&&(e[`X-Inertia-Except-Once-Props`]=n.join(`,`)),e}},fi=class{requests=[];maxConcurrent;interruptible;constructor({maxConcurrent:e,interruptible:t}){this.maxConcurrent=e,this.interruptible=t}send(e){this.requests.push(e),e.send().finally(()=>{this.requests=this.requests.filter(t=>t!==e)})}interruptInFlight(){this.cancel({interrupted:!0},!1)}cancelInFlight(e={}){let t=typeof e==`function`?e:t=>{let{prefetch:n=!0,optimistic:r=!0}=e;return(n||!t.isPrefetch())&&(r||!t.isOptimistic())};this.requests.filter(t).forEach(e=>e.cancel({cancelled:!0}))}cancel({cancelled:e=!1,interrupted:t=!1}={},n=!1){(n||this.shouldCancel())&&this.requests.shift()?.cancel({cancelled:e,interrupted:t})}shouldCancel(){return this.interruptible&&this.requests.length>=this.maxConcurrent}hasPendingOptimistic(){return this.requests.some(e=>e.isPendingOptimistic())}},pi=()=>{},mi=class{syncRequestStream=new fi({maxConcurrent:1,interruptible:!0});asyncRequestStream=new fi({maxConcurrent:1/0,interruptible:!1});clientVisitQueue=new jr;pendingOptimisticCallback=void 0;init({initialPage:e,resolveComponent:t,swapComponent:n,onFlash:r}){G.init({initialPage:e,resolveComponent:t,swapComponent:n,onFlash:r}),Br.handle(),Lr.init(),Lr.on(`missingHistoryItem`,()=>{typeof window<`u`&&this.visit(window.location.href,{preserveState:!0,preserveScroll:!0,replace:!0})}),Lr.on(`loadDeferredProps`,e=>{this.loadDeferredProps(e)}),Lr.on(`leavePage`,e=>{this.cancelAsyncRequestsFor(e)}),Lr.on(`historyQuotaExceeded`,e=>{window.location.href=e})}optimistic(e){return this.pendingOptimisticCallback=e,this}get(e,t={},n={}){return this.visit(e,{...n,method:`get`,data:t})}post(e,t={},n={}){return this.visit(e,{preserveState:!0,...n,method:`post`,data:t})}put(e,t={},n={}){return this.visit(e,{preserveState:!0,...n,method:`put`,data:t})}patch(e,t={},n={}){return this.visit(e,{preserveState:!0,...n,method:`patch`,data:t})}delete(e,t={}){return this.visit(e,{preserveState:!0,...t,method:`delete`})}query(e,t={},n={}){return this.visit(e,{preserveState:!0,...n,method:`query`,data:t})}reload(e={}){return this.doReload(e)}doReload(e={}){if(typeof window>`u`)return;let t=e.method||An(e.data)?void 0:G.get().queryMethodData,n=t?{method:`query`,data:{...t,...e.data},queryMethodReload:!0}:{};return this.visit(window.location.href,{...e,...n,preserveScroll:!0,preserveState:!0,async:!0,headers:{...e.headers||{},"Cache-Control":`no-cache`}})}remember(e,t=`default`){Ir.remember(e,t)}restore(e=`default`){return Ir.restore(e)}on(e,t){return typeof window>`u`?()=>{}:Lr.onGlobalEvent(e,t)}once(e,t){if(typeof window>`u`)return()=>{};let n=this.on(e,e=>(n(),t(e)));return n}hasPendingOptimistic(){return this.asyncRequestStream.hasPendingOptimistic()}get activePolls(){return Kr.count}cancelAll({async:e=!0,prefetch:t=!0,sync:n=!0}={}){e&&(this.asyncRequestStream.cancelInFlight({prefetch:t}),Sr.interruptInFlight({async:!0})),n&&(this.syncRequestStream.cancelInFlight(),Sr.interruptInFlight({async:!1}))}cancelAsyncRequestsFor(e){this.asyncRequestStream.cancelInFlight(t=>!t.isPrefetch()&&!t.isOptimistic()&&ar(t.getUrl(),e))}poll(e,t={},n={}){return Kr.add(e,({onStart:e,onFinish:n})=>{let r=typeof t==`function`?t():t;this.doReload({poll:!0,preserveErrors:!0,...r,onCancelToken:t=>{e(t.cancel),r.onCancelToken?.(t)},onFinish:e=>{n(),r.onFinish?.(e)}})},{autoStart:n.autoStart??!0,background:n.background,keepAlive:n.keepAlive??!1,mode:n.mode})}visit(e,t={}){t.optimistic=t.optimistic??this.pendingOptimisticCallback,this.pendingOptimisticCallback=void 0,t.optimistic&&(t.async=t.async??!0);let n=this.getPendingVisit(e,{...t,showProgress:t.showProgress??(!t.async||!!t.optimistic)}),r=this.getVisitEvents(t);if(r.onBefore(n)===!1||!Ht(n))return;n.async||(this.syncRequestStream.interruptInFlight(),Sr.interruptInFlight({async:!1}));let i=null;t.optimistic&&(i=G.nextOptimisticId(),this.applyOptimisticUpdate(t.optimistic,r,i)),!G.isCleared()&&!n.preserveUrl&&Ar.save();let a={...n,...r},o=()=>{let e=Sr.get(a);e?(La.reveal(e.inFlight),Sr.use(e,a)):(La.reveal(!0),(n.async?this.asyncRequestStream:this.syncRequestStream).send(di.create(a,G.get(),{optimisticId:i})))};Array.isArray(n.component)&&(console.error(`The "component" prop received an array of components (${n.component.join(`, `)}), but only a single component string is supported for instant visits. Pass an explicit component name instead.`),n.component=null),n.component?Ir.processQueue().then(()=>{this.performInstantSwap(n).then(()=>{a.preserveScroll=!0,a.preserveState=!0,a.replace=!0,a.viewTransition=!1,o()})}):o()}getCached(e,t={}){return Sr.findCached(this.getPrefetchParams(e,t))}flush(e,t={}){Sr.remove(this.getPrefetchParams(e,t))}flushAll(){Sr.removeAll()}flushByCacheTags(e){Sr.removeByTags(Array.isArray(e)?e:[e])}getPrefetching(e,t={}){return Sr.findInFlight(this.getPrefetchParams(e,t))}prefetch(e,t={},n={}){let r=this.getPendingVisit(e,{...t,async:!0,showProgress:!1,prefetch:!0,viewTransition:!1});if(r.method!==`get`&&r.method!==`query`)throw Error(`Prefetch requests must use the GET or QUERY method`);let i=r.url.origin+r.url.pathname+r.url.search,a=window.location.origin+window.location.pathname+window.location.search;if(r.method===`get`&&i===a)return;let o=this.getVisitEvents(t);if(o.onBefore(r)===!1||!Ht(r))return;La.hide(),this.asyncRequestStream.interruptInFlight();let s={...r,...o};new Promise(e=>{let t=()=>{G.get()?e():setTimeout(t,50)};t()}).then(()=>{Sr.add(s,e=>{this.asyncRequestStream.send(di.create(e,G.get()))},{cacheFor:zt.get(`prefetch.cacheFor`),cacheTags:[],...n})})}clearHistory(){Ir.clear(),Sr.removeAll()}decryptHistory(){return Ir.decrypt()}resolveComponent(e,t){return G.resolve(e,t)}replace(e){this.clientVisit(e,{replace:!0})}replaceProp(e,t,n){this.replace({preserveScroll:!0,preserveState:!0,props(n){return Rn(n,e,typeof t==`function`?t(Te(n,e),n):t)},...n||{}})}appendToProp(e,t,n){this.replaceProp(e,(e,n)=>{let r=typeof t==`function`?t(e,n):t;return Array.isArray(e)||(e=e===void 0?[]:[e]),[...e,r]},n)}prependToProp(e,t,n){this.replaceProp(e,(e,n)=>{let r=typeof t==`function`?t(e,n):t;return Array.isArray(e)||(e=e===void 0?[]:[e]),[r,...e]},n)}push(e){this.clientVisit(e)}flash(e,t){let n=G.get().flash,r;if(typeof e==`function`)r=e(n);else if(typeof e==`string`)r={...n,[e]:t};else if(e&&Object.keys(e).length)r={...n,...e};else return;G.setFlash(r),Object.keys(r).length&&tn(r)}clientVisit(e,{replace:t=!1}={}){this.clientVisitQueue.add(()=>this.performClientVisit(e,{replace:t}))}performClientVisit(e,{replace:t=!1}={}){let n=G.get(),r=typeof e.props==`function`?Object.fromEntries(Object.values(n.onceProps??{}).map(e=>[e.prop,Te(n.props,e.prop)])):{},i=typeof e.props==`function`?e.props(n.props,r):e.props??n.props,a=typeof e.flash==`function`?e.flash(n.flash):e.flash,{viewTransition:o,preserveFlash:s,onError:c,onFinish:l,onFlash:u,onSuccess:d,...f}=e,p={...n,clearHistory:!1,...f,flash:s?n.flash:a??{},props:i};p.component===n.component&&ar($n(p.url),$n(n.url))||delete p.queryMethodData;let m=si.resolvePreserveOption(e.preserveScroll??!1,p),h=si.resolvePreserveOption(e.preserveState??!1,p),g=this.createVisitId(),_=$n(n.url);return ar($n(p.url),_)||this.cancelAsyncRequestsFor(_),G.set(p,{replace:t,preserveScroll:m,preserveState:h,viewTransition:o,clientSide:!0,visitId:g}).then(()=>{Yt(G.get(),{replace:t,visitId:g});let n=G.get().flash;!s&&Object.keys(n).length>0&&(tn(n),u?.(n));let r=G.get().props.errors||{};if(Object.keys(r).length===0){d?.(G.get());return}let i=e.errorBag?r[e.errorBag||``]||{}:r;c?.(i)}).finally(()=>l?.(e))}performInstantSwap(e){let t=G.get(),n=Object.fromEntries((t.sharedProps??[]).filter(e=>e in t.props).map(e=>[e,t.props[e]])),r=typeof e.pageProps==`function`?e.pageProps(H(t.props),H(n)):e.pageProps,i=r===null?{...n}:{...r},a=this.preserveOncePropsOnInstantVisit(t,i),o={component:e.component,url:e.url.pathname+e.url.search+e.url.hash,version:t.version,props:{...i,errors:{}},flash:{},rescuedProps:[],clearHistory:!1,encryptHistory:t.encryptHistory,sharedProps:t.sharedProps,onceProps:a,rememberedState:{}};return G.set(o,{replace:e.replace,preserveScroll:si.resolvePreserveOption(e.preserveScroll,o),preserveState:!1,viewTransition:e.viewTransition,visitId:e.id})}preserveOncePropsOnInstantVisit(e,t){let n={};return Object.entries(e.onceProps??{}).forEach(([r,i])=>{let a=Te(e.props,i.prop);if(a===void 0)return;let o=Te(t,i.prop);(o===void 0||pe(o,a))&&(qe(t,i.prop,a),n[r]=i)}),n}getPrefetchParams(e,t){return{...this.getPendingVisit(e,{...t,async:!0,showProgress:!1,prefetch:!0,viewTransition:!1}),...this.getVisitEvents(t)}}createVisitId(){return zr()}getPendingVisit(e,t){if(or(e)){let n=e;e=n.url,t.method=t.method??n.method}let n=zt.get(`visitOptions`),r=n&&n(e.toString(),H(t))||{},i={method:`get`,data:{},replace:!1,preserveScroll:!1,preserveState:!1,only:[],except:[],headers:{},errorBag:``,forceFormData:!1,queryStringArrayFormat:`brackets`,async:!1,showProgress:!0,fresh:!1,reset:[],preserveUrl:!1,preserveErrors:!1,prefetch:!1,invalidateCacheTags:[],viewTransition:!1,component:null,pageProps:null,cached:!1,...Pn(t),...Pn(r)},[a,o]=er(e,i.data,i.method,i.forceFormData,i.queryStringArrayFormat),s={id:this.createVisitId(),cancelled:!1,completed:!1,interrupted:!1,...i,url:a,data:o};return s.prefetch&&(s.headers.Purpose=`prefetch`),s}getVisitEvents(e){return{onCancelToken:e.onCancelToken||pi,onBefore:e.onBefore||pi,onBeforeUpdate:e.onBeforeUpdate||pi,onStart:e.onStart||pi,onProgress:e.onProgress||pi,onFinish:e.onFinish||pi,onCancel:e.onCancel||pi,onSuccess:e.onSuccess||pi,onError:e.onError||pi,onHttpException:e.onHttpException||pi,onNetworkError:e.onNetworkError||pi,onFlash:e.onFlash||pi,onPrefetched:e.onPrefetched||pi,onPrefetching:e.onPrefetching||pi}}applyOptimisticUpdate(e,t,n){let r=G.get().props,i=e(H(r));if(!i)return;let a=[];for(let e of Object.keys(i))pe(r[e],i[e])||a.push(e);if(a.length===0)return;let o=G.get().component;for(let e of a)G.setBaseline(e,H(r[e]));G.registerOptimistic(n,e),G.setPropsQuietly({...r,...i});let s=!0,c=t.onSuccess;t.onSuccess=e=>(s=!1,G.markOptimisticConfirmed(n),c(e));let l=t.onFinish;t.onFinish=e=>{if(G.unregisterOptimistic(n),s&&G.get().component===o){let e=G.replayOptimistics();Object.keys(e).length>0&&G.setPropsQuietly({...G.get().props,...e})}return G.pendingOptimisticCount()===0&&G.clearOptimisticState(),l(e)}}loadDeferredProps(e){e&&Object.values(e).forEach(e=>{this.doReload({only:e,deferredProps:!0,preserveErrors:!0})}),_r()}},hi=class{static createWayfinderCallback(...e){return()=>e.length===1?or(e[0])?e[0]:e[0]():{method:typeof e[0]==`function`?e[0]():e[0],url:typeof e[1]==`function`?e[1]():e[1]}}static parseUseFormArguments(...e){return e.length===0?{rememberKey:null,data:{},precognitionEndpoint:null}:e.length===1?{rememberKey:null,data:e[0],precognitionEndpoint:null}:e.length===2?typeof e[0]==`string`||e[0]===null||e[0]===void 0?{rememberKey:e[0]??null,data:e[1],precognitionEndpoint:null}:{rememberKey:null,data:e[1],precognitionEndpoint:this.createWayfinderCallback(e[0])}:{rememberKey:null,data:e[2],precognitionEndpoint:this.createWayfinderCallback(e[0],e[1])}}static parseSubmitArguments(e,t){return e.length===3||e.length===2&&typeof e[0]==`string`?{method:e[0],url:e[1],options:e[2]??{}}:or(e[0])?{...e[0],options:e[1]??{}}:{...t(),options:e[0]??{}}}static mergeHeadersForValidation(e,t,n){let r=e=>(e.headers={...n??{},...e.headers??{}},e);return e&&typeof e==`object`&&!(`target`in e)?e=r(e):t&&typeof t==`object`?t=r(t):typeof e==`string`?t=r(t??{}):e=r(e??{}),[e,t]}};function gi(e){return e.includes(`.`)?e.replace(/\\\./g,`__ESCAPED_DOT__`).split(/(\[[^\]]*\])/).filter(Boolean).map(e=>e.startsWith(`[`)&&e.endsWith(`]`)?e:e.split(`.`).reduce((e,t,n)=>n===0?t:`${e}[${t}]`)).join(``).replace(/__ESCAPED_DOT__/g,`.`):e}function _i(e){let t=[],n=/([^\[\]]+)|\[(\d*)\]/g,r;for(;(r=n.exec(e))!==null;)r[1]===void 0?r[2]!==void 0&&t.push(r[2]===``?``:Number(r[2])):t.push(r[1]);return t}function vi(e,t,n){let r=e;for(let e=0;e/^\d+$/.test(e)).map(Number).sort((e,t)=>e-t);return t.length===n.length&&n.length>0&&n[0]===0&&n.every((e,t)=>e===t)}function bi(e){if(Array.isArray(e))return e.map(bi);if(typeof e!=`object`||!e||Un(e))return e;if(yi(e)){let t=[];for(let n=0;n/^\d+$/.test(e)).map(Number).sort((e,t)=>e-t);qe(t,n,e.length>0?[...e.map(e=>i[e]),r]:[r])}else qe(t,n,[r])}else vi(t,e.map(String),r)}return bi(t)}var Si=`server`;function Ci(e,t){return e.match(/\sdata-inertia(=|\s|>)/)?e:e.replace(/^<([a-zA-Z][^\s/>]*)/,`<$1 data-inertia="server-head-${t}"`)}function wi(e,t){if(!t)return[];let n=typeof t==`function`?t(e):e.props[t===!0?`head`:t];return Array.isArray(n)?n.map(e=>typeof e==`string`?e.trim():e).filter(e=>typeof e==`string`&&e.length>0).map(Ci):[]}var Ti={buildDOMElement(e){let t=document.createElement(`template`);t.innerHTML=e;let n=t.content.firstChild;if(!e.startsWith(`