From 351667abaff5379c710763b70f130acfdecba78a Mon Sep 17 00:00:00 2001 From: Matthijs Iriks Date: Fri, 4 Dec 2026 03:58:19 +0100 Subject: [PATCH] Add built-in screens (login, profile, menu, posts), per-user and site themes --- .gitattributes | 1 + .gitea/workflows/pr-ci.yml | 30 +- README.md | 15 + TOKENS.md | 1 + config/manager.php | 23 +- ...05_000001_create_manager_user_settings.php | 25 + resources/dist/manager.css | 1 + resources/dist/manager.js | 2 + resources/views/shell.blade.php | 17 + routes/guest.php | 10 + routes/manager.php | 5 + src/Console/DoctorCommand.php | 17 +- src/Console/MakeThemeCommand.php | 95 + src/Http/Controllers/AssetController.php | 22 + src/Http/Controllers/DashboardController.php | 7 + src/Http/Controllers/LoginController.php | 38 + src/Http/Controllers/ProfileController.php | 58 + src/Http/Middleware/Authenticate.php | 20 + src/Http/Middleware/ServeShell.php | 31 + src/ManagerServiceProvider.php | 22 +- src/Models/UserSetting.php | 16 + src/Support/ModuleRegistry.php | 4 +- src/Support/Shell.php | 54 + src/Support/Themes.php | 128 + tests/Feature/AuditTest.php | 3 +- tests/Feature/DoctorTest.php | 4 + tests/Feature/ScreensTest.php | 127 + ui/.gitignore | 1 + ui/package-lock.json | 2232 +++++++++++++++++ ui/package.json | 20 + ui/src/App.vue | 23 + ui/src/api.ts | 88 + ui/src/components/Layout.vue | 67 + ui/src/components/Link.vue | 18 + ui/src/i18n.ts | 29 + ui/src/main.ts | 10 + ui/src/pages/Dashboard.vue | 17 + ui/src/pages/Fallback.vue | 12 + ui/src/pages/Login.vue | 43 + ui/src/pages/PostForm.vue | 85 + ui/src/pages/PostsIndex.vue | 55 + ui/src/pages/Profile.vue | 93 + ui/src/state.ts | 91 + ui/src/style.css | 34 + ui/tsconfig.json | 14 + ui/vite.config.ts | 24 + 46 files changed, 3720 insertions(+), 12 deletions(-) create mode 100644 database/migrations/2026_12_05_000001_create_manager_user_settings.php create mode 100644 resources/dist/manager.css create mode 100644 resources/dist/manager.js create mode 100644 resources/views/shell.blade.php create mode 100644 routes/guest.php create mode 100644 src/Console/MakeThemeCommand.php create mode 100644 src/Http/Controllers/AssetController.php create mode 100644 src/Http/Controllers/LoginController.php create mode 100644 src/Http/Controllers/ProfileController.php create mode 100644 src/Http/Middleware/Authenticate.php create mode 100644 src/Http/Middleware/ServeShell.php create mode 100644 src/Models/UserSetting.php create mode 100644 src/Support/Shell.php create mode 100644 src/Support/Themes.php create mode 100644 tests/Feature/ScreensTest.php create mode 100644 ui/.gitignore create mode 100644 ui/package-lock.json create mode 100644 ui/package.json create mode 100644 ui/src/App.vue create mode 100644 ui/src/api.ts create mode 100644 ui/src/components/Layout.vue create mode 100644 ui/src/components/Link.vue create mode 100644 ui/src/i18n.ts create mode 100644 ui/src/main.ts create mode 100644 ui/src/pages/Dashboard.vue create mode 100644 ui/src/pages/Fallback.vue create mode 100644 ui/src/pages/Login.vue create mode 100644 ui/src/pages/PostForm.vue create mode 100644 ui/src/pages/PostsIndex.vue create mode 100644 ui/src/pages/Profile.vue create mode 100644 ui/src/state.ts create mode 100644 ui/src/style.css create mode 100644 ui/tsconfig.json create mode 100644 ui/vite.config.ts diff --git a/.gitattributes b/.gitattributes index 389aaea..bdf6db8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,5 +14,6 @@ /AGENTS.md export-ignore /CLAUDE.md export-ignore /tests export-ignore +/ui export-ignore /phpunit.xml export-ignore /pint.json export-ignore diff --git a/.gitea/workflows/pr-ci.yml b/.gitea/workflows/pr-ci.yml index 12de92d..b8d77c8 100644 --- a/.gitea/workflows/pr-ci.yml +++ b/.gitea/workflows/pr-ci.yml @@ -96,6 +96,30 @@ jobs: - name: pest tests run: vendor/bin/pest + # The screens (ui/) are built into resources/dist, which is committed so a site needs no Node. Check that the + # sources type-check and that the committed bundle is what the sources build to. The node image has git (see below). + ui: + runs-on: docker + container: + image: node:22-bookworm + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: install + run: cd ui && npm ci --no-audit --no-fund + + - name: type check + run: cd ui && npm run typecheck + + - name: build + run: cd ui && npm run build + + - name: the committed bundle is up to date + run: | + git config --global --add safe.directory "$(pwd)" + git diff --exit-code -- resources/dist || { echo "resources/dist is out of date: run 'npm run build' in ui/ and commit it" >&2; exit 1; } + # Known vulnerabilities in the dependencies, and secrets or bad settings in the repository. security: runs-on: docker @@ -162,12 +186,12 @@ jobs: # every job above is. Do not rename it without changing the protection rule. pr-ci: runs-on: docker - needs: [flow, ledger, test, security] + needs: [flow, ledger, test, ui, security] if: always() container: image: alpine:3.20 steps: - name: all checks green run: | - echo "flow=${{ needs.flow.result }} ledger=${{ needs.ledger.result }} test=${{ needs.test.result }} security=${{ needs.security.result }}" - [ "${{ needs.flow.result }}" = "success" ] && [ "${{ needs.ledger.result }}" = "success" ] && [ "${{ needs.test.result }}" = "success" ] && [ "${{ needs.security.result }}" = "success" ] + echo "flow=${{ needs.flow.result }} ledger=${{ needs.ledger.result }} test=${{ needs.test.result }} ui=${{ needs.ui.result }} security=${{ needs.security.result }}" + [ "${{ needs.flow.result }}" = "success" ] && [ "${{ needs.ledger.result }}" = "success" ] && [ "${{ needs.test.result }}" = "success" ] && [ "${{ needs.ui.result }}" = "success" ] && [ "${{ needs.security.result }}" = "success" ] diff --git a/README.md b/README.md index 45017c1..e2bab97 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,21 @@ php artisan manager:doctor --json # non-zero exit when something is wrong; eac `resources/ai/INTEGRATION.md` is a step-by-step guide for an agent; `resources/boost/guidelines/core.blade.php` is picked up by Laravel Boost. +## Screens and themes + +The package brings its own screens (a small Vue app on the JSON routes, already built: your app needs no Node). They also +give an app without a login a login and a profile. `MANAGER_UI=none` turns them off, for an app that builds its own screens +on the JSON routes. A browser that opens a manager address gets the page; anything that asks for JSON gets the data. + +- **Looks.** Built in are `dark` and `light`. `MANAGER_THEME` is what everyone sees until they choose; with + `MANAGER_USER_THEMES=true` (default) each account picks its own in its profile. +- **The house style of the site.** `php artisan manager:make-theme acme --brand=#e4002b --name="Acme" --logo=/img/logo.svg --font="Inter, sans-serif"` + writes `resources/manager-themes/acme.json`; set `MANAGER_THEME=acme`. A theme is colours, a radius, fonts, a name and a logo, and every + value is checked, so a theme file can never put CSS or markup in the page. Themes can also be listed in `manager.themes`. +- **Not built yet:** screens for the other modules (they show a notice for now) and a theme editor in the manager. +- **Working on the screens:** the sources are in `ui/`; `npm ci && npm run build` there writes `resources/dist`, which is committed + (PR CI fails when it is out of date). + ## Modules | Key | What | Default | diff --git a/TOKENS.md b/TOKENS.md index fb86de7..af738cd 100644 --- a/TOKENS.md +++ b/TOKENS.md @@ -24,3 +24,4 @@ Per stuk werk een rij; zie `dev/token-usage.py`. | 2026-12-04 | De Packagist-stap meldt het pakket zelf aan als Packagist het nog niet kent | - | claude-sonnet-5-5 | 13 | 7.095 | 30 | 11.993 | 4.256.820 | 0,06 | | 2026-12-04 | Installatie en gezondheidscheck voor AI (manager:install en manager:doctor) met een stappengids voor agents | - | claude-sonnet-5-5 | 12 | 12.112 | 28 | 64.789 | 2.344.181 | 0,04 | | 2026-12-04 | Installatie en gezondheidscheck voor AI (manager:install en manager:doctor) met een stappengids voor agents | - | claude-fable-5-2 | 1 | 17.440 | 362.597 | 0 | 0 | 0,00 | +| 2026-12-04 | Schermen in het pakket: eigen login, profiel, menu en berichten, thema's per gebruiker en voor de huisstijl van de site | - | claude-sonnet-5-5 | 51 | 60.198 | 102 | 94.747 | 7.947.787 | 0,19 | diff --git a/config/manager.php b/config/manager.php index e2351e0..9fcd393 100644 --- a/config/manager.php +++ b/config/manager.php @@ -13,7 +13,28 @@ return [ | Middleware around every manager route. Authentication of the manager itself | is left to the host app: use the guard it already has. */ - 'middleware' => ['web', 'auth'], + 'middleware' => ['web', 'manager.auth'], + + /* + | The screens. `package`: the manager brings its own (a Vue app, built, served by the package; it also gives a login and + | a profile when the app has none). `none`: only the JSON API, for an app that builds its own screens. + */ + 'ui' => env('MANAGER_UI', 'package'), + + /* + | The name in the menu and on the login screen. + */ + 'name' => env('MANAGER_NAME'), + + /* + | Looks. `theme` is what everyone gets until they choose; `user_themes` lets each account pick its own (profile). + | A theme is a set of colours, a radius and fonts: built in are `dark` and `light`; the site's own live as JSON files in + | `themes_path` (make one with `php artisan manager:make-theme`) or here in `themes`, by key. + */ + 'theme' => env('MANAGER_THEME', 'dark'), + 'user_themes' => (bool) env('MANAGER_USER_THEMES', true), + 'themes_path' => null, // default: resources/manager-themes of the app + 'themes' => [], /* | The Eloquent model of the people who log in. Must use IriksIT\Manager\Concerns\HasManagerAccess. diff --git a/database/migrations/2026_12_05_000001_create_manager_user_settings.php b/database/migrations/2026_12_05_000001_create_manager_user_settings.php new file mode 100644 index 0000000..5b5ba25 --- /dev/null +++ b/database/migrations/2026_12_05_000001_create_manager_user_settings.php @@ -0,0 +1,25 @@ +getTable(); + + Schema::create(config('manager.table_prefix').'user_settings', function (Blueprint $table) use ($users) { + $table->id(); + $table->foreignId('user_id')->unique()->constrained($users)->cascadeOnDelete(); + $table->string('theme', 60)->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists(config('manager.table_prefix').'user_settings'); + } +}; diff --git a/resources/dist/manager.css b/resources/dist/manager.css new file mode 100644 index 0000000..4085d18 --- /dev/null +++ b/resources/dist/manager.css @@ -0,0 +1 @@ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:var(--m-font,ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif);--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500:oklch(63.7% .237 25.331);--color-emerald-500:oklch(69.6% .17 162.48);--color-black:#000;--spacing:.25rem;--container-sm:24rem;--container-xl:36rem;--container-3xl:48rem;--container-5xl:64rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--m-font,ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components{.m-card{background:var(--m-panel);border:1px solid var(--m-line);border-radius:var(--m-radius,.5rem)}.m-btn{border-radius:var(--m-radius,.5rem);cursor:pointer;border:1px solid #0000;align-items:center;gap:.4rem;padding:.5rem .9rem;font-size:.875rem;font-weight:600;transition:filter .15s;display:inline-flex}.m-btn:disabled{opacity:.5;cursor:not-allowed}.m-btn-primary{background:var(--m-brand);color:#fff}.m-btn-primary:hover:not(:disabled){filter:brightness(1.1)}.m-btn-secondary{background:var(--m-panel-2);border-color:var(--m-line);color:var(--m-text)}.m-btn-secondary:hover:not(:disabled){filter:brightness(1.15)}.m-btn-danger{color:#ef4444;background:0 0;border-color:#ef444466}.m-label{color:var(--m-muted);margin-bottom:.25rem;font-size:.8rem;font-weight:600;display:block}.m-input{border-radius:var(--m-radius,.5rem);border:1px solid var(--m-line);background:var(--m-ink);width:100%;color:var(--m-text);padding:.5rem .7rem;font-size:.9rem}.m-input:focus{outline:2px solid var(--m-brand);outline-offset:1px}.m-error{color:#ef4444;margin-top:.25rem;font-size:.8rem}.m-help{color:var(--m-muted);margin-top:.25rem;font-size:.75rem}.m-badge{background:var(--m-panel-2);border:1px solid var(--m-line);border-radius:999px;padding:.1rem .55rem;font-size:.7rem;font-weight:600;display:inline-block}}@layer utilities{.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.fixed{position:fixed}.inset-0{inset:0}.inset-x-0{inset-inline:0}.inset-y-0{inset-block:0}.top-0{top:0}.right-5{right:calc(var(--spacing) * 5)}.bottom-5{bottom:calc(var(--spacing) * 5)}.left-0{left:0}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.mx-auto{margin-inline:auto}.mt-1{margin-top:var(--spacing)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-4{height:calc(var(--spacing) * 4)}.h-7{height:calc(var(--spacing) * 7)}.h-9{height:calc(var(--spacing) * 9)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.min-h-screen{min-height:100vh}.w-4{width:calc(var(--spacing) * 4)}.w-60{width:calc(var(--spacing) * 60)}.w-auto{width:auto}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:0}.flex-1{flex:1}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-line>:not(:last-child)){border-color:var(--m-line)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-brand{border-color:var(--m-brand)}.border-line{border-color:var(--m-line)}.border-l-emerald-500{border-left-color:var(--color-emerald-500)}.border-l-red-500{border-left-color:var(--color-red-500)}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-brand\/15{background-color:var(--m-brand)}@supports (color:color-mix(in lab,red,red)){.bg-brand\/15{background-color:color-mix(in oklab,var(--m-brand) 15%,transparent)}}.bg-panel{background-color:var(--m-panel)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-7{padding:calc(var(--spacing) * 7)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.pt-14{padding-top:calc(var(--spacing) * 14)}.pt-20{padding-top:calc(var(--spacing) * 20)}.pb-16{padding-bottom:calc(var(--spacing) * 16)}.font-display{font-family:var(--m-font-display,var(--m-font,ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif))}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-muted{color:var(--m-muted)}.text-text{color:var(--m-text)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){:is(:where(.group):hover .group-hover\:text-brand){color:var(--m-brand)}.hover\:border-brand:hover{border-color:var(--m-brand)}.hover\:bg-text\/5:hover{background-color:var(--m-text)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-text\/5:hover{background-color:color-mix(in oklab,var(--m-text) 5%,transparent)}}.hover\:text-text:hover{color:var(--m-text)}}@media(min-width:40rem){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(min-width:48rem){.md\:ml-60{margin-left:calc(var(--spacing) * 60)}.md\:flex{display:flex}.md\:hidden{display:none}.md\:translate-x-0{--tw-translate-x:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.md\:px-8{padding-inline:calc(var(--spacing) * 8)}.md\:pt-0{padding-top:0}.md\:pt-8{padding-top:calc(var(--spacing) * 8)}}@media(min-width:64rem){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}}html,body{background:var(--m-ink);color:var(--m-text);font-family:var(--font-sans)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000} diff --git a/resources/dist/manager.js b/resources/dist/manager.js new file mode 100644 index 0000000..c83ebff --- /dev/null +++ b/resources/dist/manager.js @@ -0,0 +1,2 @@ +function pn(e){const t=Object.create(null);for(const s of e.split(","))t[s]=1;return s=>s in t}const G={},xt=[],We=()=>{},Sr=()=>!1,$s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Os=e=>e.startsWith("onUpdate:"),le=Object.assign,hn=(e,t)=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)},Vi=Object.prototype.hasOwnProperty,U=(e,t)=>Vi.call(e,t),R=Array.isArray,at=e=>It(e)==="[object Map]",Ot=e=>It(e)==="[object Set]",Ln=e=>It(e)==="[object Date]",j=e=>typeof e=="function",te=e=>typeof e=="string",Ne=e=>typeof e=="symbol",q=e=>e!==null&&typeof e=="object",Cr=e=>(q(e)||j(e))&&j(e.then)&&j(e.catch),Tr=Object.prototype.toString,It=e=>Tr.call(e),Ui=e=>It(e).slice(8,-1),Er=e=>It(e)==="[object Object]",gn=e=>te(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Vt=pn(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Hi=1e4,As=e=>{let t=Object.create(null),s=0;return(n=>{const r=t[n];return r!==void 0?r:(++s>Hi&&(t=Object.create(null),s=1),t[n]=e(n))})},Ki=/-\w/g,ye=As(e=>e.replace(Ki,t=>t.slice(1).toUpperCase())),Bi=/\B([A-Z])/g,St=As(e=>e.replace(Bi,"-$1").toLowerCase()),Ps=As(e=>e.charAt(0).toUpperCase()+e.slice(1)),Us=As(e=>e?`on${Ps(e)}`:""),Ke=(e,t)=>!Object.is(e,t),hs=(e,...t)=>{for(let s=0;s{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:n,value:s})},mn=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let Vn;const Ms=()=>Vn||(Vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function es(e){if(R(e)){const t={};for(let s=0;ss.startsWith("/*")?"":s).split(Wi).forEach(s=>{if(s){const n=s.split(qi);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function ft(e){let t="";if(te(e))t=e;else if(R(e))for(let s=0;sdt(s,t))}function Kn(e){return Object.getPrototypeOf(e)===null&&e[Symbol.toPrimitive]==null&&typeof e.toString!="function"&&typeof e.valueOf!="function"?It(e):String(e)}const Pr=e=>!!(e&&e.__v_isRef===!0),E=e=>te(e)?e:e==null?"":R(e)||q(e)&&(e.toString===Tr||!j(e.toString))?Pr(e)?E(e.value):JSON.stringify(e,Mr,2):String(e),Mr=(e,t)=>Pr(t)?Mr(e,t.value):at(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((s,[n,r],i)=>(s[Hs(n,i)+" =>"]=r,s),{})}:Ot(t)?{[`Set(${t.size})`]:[...t.values()].map(s=>Hs(s))}:Ne(t)?Hs(t):q(t)&&!R(t)&&!Er(t)?String(t):t,Hs=(e,t="")=>{var s;return Ne(e)?`Symbol(${(s=e.description)!=null?s:t})`:e};let oe;class Ir{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&oe&&(oe.active?(this.parent=oe,this.index=(oe.scopes||(oe.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,s;if(this.scopes){const n=this.scopes.slice();for(t=0,s=n.length;t0&&--this._on===0){if(oe===this)oe=this.prevScope;else{let t=oe;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s0)return;if(Ht){let t=Ht;for(Ht=void 0;t;){const s=t.next;t.next=void 0,t.flags&=-9,t=s}}let e;for(;Ut;){let t=Ut;for(Ut=void 0;t;){const s=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(n){e||(e=n)}t=s}}if(e)throw e}function Dr(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function kr(e){let t,s=e.depsTail,n=s;for(;n;){const r=n.prevDep;n.version===-1?(n===s&&(s=r),yn(n),to(n)):t=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=r}e.deps=t,e.depsTail=s}function en(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Lr(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Lr(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===zt)||(e.globalVersion=zt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!en(e))))return;e.flags|=2;const t=e.dep,s=Y,n=Ie;Y=e,Ie=!0;try{Dr(e);const r=e.fn(e._value);(t.version===0||Ke(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{Y=s,Ie=n,kr(e),e.flags&=-3}}function yn(e,t=!1){const{dep:s,prevSub:n,nextSub:r}=e;if(n&&(n.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=n,e.nextSub=void 0),s.subs===e&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let i=s.computed.deps;i;i=i.nextDep)yn(i,!0)}!t&&!--s.sc&&s.map&&s.map.delete(s.key)}function to(e){const{prevDep:t,nextDep:s}=e;t&&(t.nextDep=s,e.prevDep=void 0),s&&(s.prevDep=t,e.nextDep=void 0)}let Ie=!0;const Vr=[];function ze(){Vr.push(Ie),Ie=!1}function Ge(){const e=Vr.pop();Ie=e===void 0?!0:e}function Bn(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const s=Y;Y=void 0;try{t()}finally{Y=s}}}let zt=0;class so{constructor(t,s){this.sub=t,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class xn{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Y||!Ie||Y===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==Y)s=this.activeLink=new so(Y,this),Y.deps?(s.prevDep=Y.depsTail,Y.depsTail.nextDep=s,Y.depsTail=s):Y.deps=Y.depsTail=s,Ur(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=Y.depsTail,s.nextDep=void 0,Y.depsTail.nextDep=s,Y.depsTail=s,Y.deps===s&&(Y.deps=n)}return s}trigger(t){this.version++,zt++,this.notify(t)}notify(t){_n();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{bn()}}}function Ur(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let n=t.deps;n;n=n.nextDep)Ur(n)}const s=e.dep.subs;s!==e&&(e.prevSub=s,s&&(s.nextSub=e)),e.dep.subs=e}}const tn=new WeakMap,vt=Symbol(""),sn=Symbol(""),At=Symbol("");function de(e,t,s){if(Ie&&Y){let n=tn.get(e);n||tn.set(e,n=new Map);let r=n.get(s);r||(n.set(s,r=new xn),r.map=n,r.key=s),r.track()}}function tt(e,t,s,n,r,i){const o=tn.get(e);if(!o){zt++;return}const l=c=>{c&&c.trigger()};if(_n(),t==="clear")o.forEach(l);else{const c=R(e),d=c&&gn(s);if(c&&s==="length"){const f=Number(n);o.forEach((g,T)=>{(T==="length"||T===At||!Ne(T)&&T>=f)&&l(g)})}else switch((s!==void 0||o.has(void 0))&&l(o.get(s)),d&&l(o.get(At)),t){case"add":c?d&&l(o.get("length")):(l(o.get(vt)),at(e)&&l(o.get(sn)));break;case"delete":c||(l(o.get(vt)),at(e)&&l(o.get(sn)));break;case"set":at(e)&&l(o.get(vt));break}}bn()}function Ct(e){const t=H(e);return t===e||(de(t,"iterate",At),Ce(e))?t:Fe(e)?st(e)?t.map(s=>pt(Ee(s))):t.map(pt):t.map(Ee)}function Is(e){return de(e=H(e),"iterate",At),e}const no=e=>pt(Ee(e));function Qe(e){return Fe(e)?st(e)?no:pt:Ee}const ro={__proto__:null,[Symbol.iterator](){return Bs(this,Symbol.iterator,Qe(this))},concat(...e){return Ct(this).concat(...e.map(t=>R(t)?Ct(t):t))},entries(){const e=Qe(this);return Bs(this,"entries",t=>(t[1]=e(t[1]),t))},every(e,t){return Xe(this,"every",e,t,void 0,arguments)},filter(e,t){return Xe(this,"filter",e,t,s=>s.map(Qe(this)),arguments)},find(e,t){return Xe(this,"find",e,t,s=>Qe(this)(s),arguments)},findIndex(e,t){return Xe(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Xe(this,"findLast",e,t,s=>Qe(this)(s),arguments)},findLastIndex(e,t){return Xe(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Xe(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ws(this,"includes",e)},indexOf(...e){return Ws(this,"indexOf",e)},join(e){return Ct(this).join(e)},lastIndexOf(...e){return Ws(this,"lastIndexOf",e)},map(e,t){return Xe(this,"map",e,t,void 0,arguments)},pop(){return jt(this,"pop")},push(...e){return jt(this,"push",e)},reduce(e,...t){return qn(this,"reduce",e,t)},reduceRight(e,...t){return qn(this,"reduceRight",e,t)},shift(){return jt(this,"shift")},some(e,t){return Xe(this,"some",e,t,void 0,arguments)},splice(...e){return jt(this,"splice",e)},toReversed(){return Ct(this).toReversed()},toSorted(e){return Ct(this).toSorted(e)},toSpliced(...e){return Ct(this).toSpliced(...e)},unshift(...e){return jt(this,"unshift",e)},values(){return Bs(this,"values",Qe(this))}};function Bs(e,t,s){const n=Is(e),r=n[t],i=r.call(n);if(n!==e&&!Ce(e)){if(i[Symbol.toStringTag]==="Array Iterator"){const o=Object.create(Object.getPrototypeOf(i));return o.next=()=>Wn(i.next(),s),r!==Hr[t]&&Object.defineProperties(o,{return:{get(){const l=i.return;return typeof l=="function"?l.bind(i):l}},throw:{get(){const l=i.throw;return typeof l=="function"?l.bind(i):l}}}),o}i._next=i.next,i.next=()=>Wn(i._next(),s)}return i}function Wn(e,t){return e.done||(e.value=t(e.value)),e}const Hr=Array.prototype;function Xe(e,t,s,n,r,i){const o=Is(e),l=o!==e&&!Ce(e),c=o[t];if(c!==Hr[t]){const g=c.apply(e,i);return l?Ee(g):g}let d=s;if(o!==e)if(l){const g=Qe(e);d=function(T,D){return s.call(this,g(T),D,e)}}else s.length>2&&(d=function(g,T){return s.call(this,g,T,e)});const f=c.call(o,d,n);return l&&r?r(f):f}function qn(e,t,s,n){const r=Is(e),i=r!==e&&!Ce(e);let o=s,l=!1;if(r!==e)if(i){const d=Qe(e);l=n.length===0,o=function(f,g,T){return l&&(l=!1,f=d(f)),s.call(this,f,d(g),T,e)}}else s.length>3&&(o=function(d,f,g){return s.call(this,d,f,g,e)});const c=r[t](o,...n);return l?Qe(e)(c):c}function Ws(e,t,s){const n=H(e);de(n,"iterate",At);const r=n[t](...s);return(r===-1||r===!1)&&Sn(s[0])?(s[0]=H(s[0]),n[t](...s)):r}function jt(e,t,s=[]){ze(),_n();const n=H(e)[t].apply(e,s);return bn(),Ge(),n}const io=pn("__proto__,__v_isRef,__isVue"),Kr=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ne));function oo(e){Ne(e)||(e=String(e));const t=H(this);return de(t,"has",e),t.hasOwnProperty(e)}class Br{constructor(t=!1,s=!1){this._isReadonly=t,this._isShallow=s}get(t,s,n){if(s==="__v_skip")return t.__v_skip;const r=this._isReadonly,i=this._isShallow;if(s==="__v_isReactive")return!r;if(s==="__v_isReadonly")return r;if(s==="__v_isShallow")return i;if(s==="__v_raw")return n===(r?i?_o:Gr:i?zr:qr).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(n)?t:void 0;const o=R(t);if(!r){let c;if(o&&(c=ro[s]))return c;if(s==="hasOwnProperty")return oo}const l=Reflect.get(t,s,ae(t)?t:n);if((Ne(s)?Kr.has(s):io(s))||(r||de(t,"get",s),i))return l;if(ae(l)){const c=o&&gn(s)?l:l.value;return r&&q(c)?rn(c):c}return q(l)?r?rn(l):ts(l):l}}class Wr extends Br{constructor(t=!1){super(!1,t)}set(t,s,n,r){let i=t[s];const o=R(t)&&gn(s);if(!this._isShallow){const d=Fe(i);if(!Ce(n)&&!Fe(n)&&(i=H(i),n=H(n)),!o&&ae(i)&&!ae(n))return d||(i.value=n),!0}const l=o?Number(s)e,cs=e=>Reflect.getPrototypeOf(e);function fo(e,t,s){return function(...n){const r=this.__v_raw,i=H(r),o=at(i),l=e==="entries"||e===Symbol.iterator&&o,c=e==="keys"&&o,d=r[e](...n),f=s?nn:t?pt:Ee;return!t&&de(i,"iterate",c?sn:vt),le(Object.create(d),{next(){const{value:g,done:T}=d.next();return T?{value:g,done:T}:{value:l?[f(g[0]),f(g[1])]:f(g),done:T}}})}}function as(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function po(e,t){const s={get(r){const i=this.__v_raw,o=H(i),l=H(r);e||(Ke(r,l)&&de(o,"get",r),de(o,"get",l));const{has:c}=cs(o),d=t?nn:e?pt:Ee;if(c.call(o,r))return d(i.get(r));if(c.call(o,l))return d(i.get(l));i!==o&&i.get(r)},get size(){const r=this.__v_raw;return!e&&de(H(r),"iterate",vt),r.size},has(r){const i=this.__v_raw,o=H(i),l=H(r);return e||(Ke(r,l)&&de(o,"has",r),de(o,"has",l)),r===l?i.has(r):i.has(r)||i.has(l)},forEach(r,i){const o=this,l=o.__v_raw,c=H(l),d=t?nn:e?pt:Ee;return!e&&de(c,"iterate",vt),l.forEach((f,g)=>r.call(i,d(f),d(g),o))}};return le(s,e?{add:as("add"),set:as("set"),delete:as("delete"),clear:as("clear")}:{add(r){const i=H(this),o=cs(i),l=H(r),c=!t&&!Ce(r)&&!Fe(r)?l:r;return o.has.call(i,c)||Ke(r,c)&&o.has.call(i,r)||Ke(l,c)&&o.has.call(i,l)||(i.add(c),tt(i,"add",c,c)),this},set(r,i){!t&&!Ce(i)&&!Fe(i)&&(i=H(i));const o=H(this),{has:l,get:c}=cs(o);let d=l.call(o,r);d||(r=H(r),d=l.call(o,r));const f=c.call(o,r);return o.set(r,i),d?Ke(i,f)&&tt(o,"set",r,i):tt(o,"add",r,i),this},delete(r){const i=H(this),{has:o,get:l}=cs(i);let c=o.call(i,r);c||(r=H(r),c=o.call(i,r)),l&&l.call(i,r);const d=i.delete(r);return c&&tt(i,"delete",r,void 0),d},clear(){const r=H(this),i=r.size!==0,o=r.clear();return i&&tt(r,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(r=>{s[r]=fo(r,e,t)}),s}function vn(e,t){const s=po(e,t);return(n,r,i)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_isShallow"?t:r==="__v_raw"?n:Reflect.get(U(s,r)&&r in n?s:n,r,i)}const ho={get:vn(!1,!1)},go={get:vn(!1,!0)},mo={get:vn(!0,!1)};const qr=new WeakMap,zr=new WeakMap,Gr=new WeakMap,_o=new WeakMap;function bo(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ts(e){return Fe(e)?e:wn(e,!1,co,ho,qr)}function yo(e){return wn(e,!1,uo,go,zr)}function rn(e){return wn(e,!0,ao,mo,Gr)}function wn(e,t,s,n,r){if(!q(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const i=r.get(e);if(i)return i;const o=bo(Ui(e));if(o===0)return e;const l=new Proxy(e,o===2?n:s);return r.set(e,l),l}function st(e){return Fe(e)?st(e.__v_raw):!!(e&&e.__v_isReactive)}function Fe(e){return!!(e&&e.__v_isReadonly)}function Ce(e){return!!(e&&e.__v_isShallow)}function Sn(e){return e?!!e.__v_raw:!1}function H(e){const t=e&&e.__v_raw;return t?H(t):e}function xo(e){return!U(e,"__v_skip")&&Object.isExtensible(e)&&$r(e,"__v_skip",!0),e}const Ee=e=>q(e)?ts(e):e,pt=e=>q(e)?rn(e):e;function ae(e){return e?e.__v_isRef===!0:!1}function vo(e){return wo(e,!1)}function wo(e,t){return ae(e)?e:new So(e,t)}class So{constructor(t,s){this.dep=new xn,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?t:H(t),this._value=s?t:Ee(t),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(t){const s=this._rawValue,n=this.__v_isShallow||Ce(t)||Fe(t);t=n?t:H(t),Ke(t,s)&&(this._rawValue=t,this._value=n?t:Ee(t),this.dep.trigger())}}function p(e){return ae(e)?e.value:e}const Co={get:(e,t,s)=>t==="__v_raw"?e:p(Reflect.get(e,t,s)),set:(e,t,s,n)=>{const r=e[t];return ae(r)&&!ae(s)?(r.value=s,!0):Reflect.set(e,t,s,n)}};function Jr(e){return st(e)?e:new Proxy(e,Co)}class To{constructor(t,s,n){this.fn=t,this.setter=s,this._value=void 0,this.dep=new xn(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=zt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Y!==this)return jr(this,!0),!0}get value(){const t=this.dep.track();return Lr(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function Eo(e,t,s=!1){let n,r;return j(e)?n=e:(n=e.get,r=e.set),new To(n,r,s)}const us={},bs=new WeakMap;let yt;function $o(e,t=!1,s=yt){if(s){let n=bs.get(s);n||bs.set(s,n=[]),n.push(e)}}function Oo(e,t,s=G){const{immediate:n,deep:r,once:i,scheduler:o,augmentJob:l,call:c,onStop:d}=s,f=L=>r?L:Ce(L)||r===!1||r===0?Ve(L,1):Ve(L);let g,T,D,M,F=!1,Q=!1;if(ae(e)?(T=()=>e.value,F=Ce(e)):st(e)?(T=()=>f(e),F=!0):R(e)?(Q=!0,F=e.some(L=>st(L)||Ce(L)),T=()=>e.map(L=>{if(ae(L))return L.value;if(st(L))return f(L);if(j(L))return c?c(L,2):L()})):j(e)?t?T=c?()=>c(e,2):e:T=()=>{if(D){ze();try{D()}finally{Ge()}}const L=yt;yt=g;try{return c?c(e,3,[M]):e(M)}finally{yt=L}}:T=We,t&&r){const L=T,ue=r===!0?1/0:r;T=()=>Ve(L(),Q?ue+1:ue)}const re=Rr(),K=()=>{g.stop(),re&&re.active&&hn(re.effects,g)};let X=!1;if(i&&t){const L=t;t=(...ue)=>{X=!0;try{return L(...ue)}finally{K()}}}let Z=Q?new Array(e.length).fill(us):us;const xe=L=>{if(!(X||!(g.flags&1)||!g.dirty&&!L))if(t){const ue=g.run();if(L||r||F||(Q?ue.some(($e,Je)=>Ke($e,Z[Je])):Ke(ue,Z))){const $e=yt;ze();try{D&&D(),yt=g;const Je=[ue,Z===us?void 0:Q&&Z[0]===us?[]:Z,M];Z=ue,c?c(t,3,Je):t(...Je)}finally{yt=$e,Ge()}}}else g.run()};return l&&l(xe),g=new Nr(T),g.scheduler=o?()=>o(xe,!1):xe,M=L=>$o(L,!1,g),D=g.onStop=()=>{const L=bs.get(g);if(L){if(c)c(L,4);else for(const ue of L)ue();bs.delete(g)}},d&&(g.onStop=()=>{D(),d()}),t?n?xe(!0):Z=g.run():o?o(xe.bind(null,!0),!0):g.run(),K.pause=g.pause.bind(g),K.resume=g.resume.bind(g),K.stop=K,K}function Ve(e,t=1/0,s){if(t<=0||!q(e)||e.__v_skip||(s=s||new Map,(s.get(e)||0)>=t))return e;if(s.set(e,t),t--,ae(e))Ve(e.value,t,s);else if(R(e))if(st(e)&&!Fe(e)&&!Ce(e)){const n=H(e);de(n,"iterate",At);for(let r=0;r{Ve(n,t,s)});else if(Er(e)){for(const r in e)Ve(e[r],t,s);const n=H(e);for(const r of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,r)&&Ve(e[r],t,s)}return e}function ss(e,t,s,n){try{return n?e(...n):e()}catch(r){Rs(r,t,s)}}function je(e,t,s,n){if(j(e)){const r=ss(e,t,s,n);return r&&Cr(r)&&r.catch(i=>{Rs(i,t,s,void 0,!0)}),r}if(R(e)){const r=[];for(let i=0;i>>1,r=be[n],i=Gt(r);i=Gt(s)?be.push(e):be.splice(Mo(t),0,e),e.flags|=1,Xr()}}function Xr(){ys||(ys=Yr.then(ei))}function Io(e){if(!R(e))lt&&e.id===-1?lt.splice(Tt+1,0,e):e.flags&1||(Ue.push(e),e.flags|=1);else for(let t=0;t=t))continue;be.splice(n,1),n=e?n-1:Me,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Qr(e,t,s=0){if(Ue.length){let n=Ue,r=0;if(t){n=[];for(let o=0;oGt(o)-Gt(l));if(Ue.length=r,lt){for(let o=0;oe.id==null?e.flags&2?-1:1/0:e.id;function ei(e){try{for(Me=0;Me{n._d&&ir(-1);const i=xs(t),o=nt.length;let l;try{l=e(...r)}finally{for(let c=nt.length;c>o;c--)On();xs(i),n._d&&ir(1)}return l};return n._n=!0,n._c=!0,n._d=!0,n}function ce(e,t){if(pe===null)return e;const s=ks(pe),n=e.dirs||(e.dirs=[]);for(let r=0;r1)return s&&j(t)?t.call(n&&n.proxy):t}}const Fo=Symbol.for("v-scx"),jo=()=>gs(Fo);function ms(e,t,s){return si(e,t,s)}function si(e,t,s=G){const{immediate:n,deep:r,flush:i,once:o}=s,l=le({},s),c=t&&n||!t&&i!=="post";let d;if(Zt){if(i==="sync"){const M=jo();d=M.__watcherHandles||(M.__watcherHandles=[])}else if(!c){const M=()=>{};return M.stop=We,M.resume=We,M.pause=We,M}}let f=he,g;if(f&&Rr()!==f.scope)if(f.scope.active){const M=f.scope.run(()=>new Ir);M.run(()=>eo(()=>Promise.resolve().then(()=>{f=null,g&&(g.i=null)}))),l.onStop=()=>M.stop()}else f=null;l.call=(M,F,Q)=>je(M,f,F,Q);let T=!1;i==="post"?l.scheduler=M=>{M.i=f,_e(M,f&&f.suspense)}:i!=="sync"&&(T=!0,l.scheduler=(M,F)=>{F?M():Cn(M)}),l.augmentJob=M=>{g=M,t&&(M.flags|=4),T&&(M.flags|=2,f&&(M.id=f.uid,M.i=f))};const D=Oo(e,t,l);return Zt&&(d?d.push(D):c&&D()),D}function Do(e,t,s){const n=this.proxy,r=te(e)?e.includes(".")?ni(n,e):()=>n[e]:e.bind(n,n);let i;j(t)?i=t:(i=t.handler,s=t);const o=ns(this),l=si(r,i.bind(n),s);return o(),l}function ni(e,t){const s=t.split(".");return()=>{let n=e;for(let r=0;re.__isTeleport,zs=Symbol("_leaveCb");function Lo(e){let t=e[0];if(e.length>1){for(const s of e)if(s.type!==Oe){t=s;break}}return t}function ri(e){if(!Tn(e))return Ns(e.type)&&e.children?Lo(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:s}=e;if(s){if(t&16)return s[0];if(t&32&&j(s.default))return s.default()}}function Kt(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;const s=e.component.subTree;Kt(Ns(s.type)&&ri(s)||s,t)}else if(e.shapeFlag&128){const s=e.suspense;if(s){const n=s.isHydrating?s.pendingBranch:s.activeBranch;n&&Kt(n,t.clone(n))}else e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)}else if(e.transition=t,e.type===W&&R(e.children)){const s=hi(e.children,!1);s&&Kt(s,t)}}function on(e){if(e.component)return on(e.component.subTree);if(e.type===W){const t=R(e.children)&&hi(e.children,!1);return t?on(t):void 0}if(e.type!==Oe)return e}function it(e,t){return j(e)?le({name:e.name},t,{setup:e}):e}function ii(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function zn(e,t){let s;return!!((s=Object.getOwnPropertyDescriptor(e,t))&&!s.configurable)}const vs=new WeakMap;function Bt(e,t,s,n,r=!1){if(R(e)){e.forEach((F,Q)=>Bt(F,t&&(R(t)?t[Q]:t),s,n,r));return}if(Et(n)&&!r){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&Bt(e,t,s,n.component.subTree);return}const i=n.shapeFlag&4?ks(n.component):n.el,o=r?null:i,{i:l,r:c}=e,d=t&&t.r,f=l.refs===G?l.refs={}:l.refs,g=l.setupState,T=H(g),D=g===G?Sr:F=>zn(f,F)?!1:U(T,F),M=(F,Q)=>!(Q&&zn(f,Q));if(d!=null&&d!==c){if(Gn(t),te(d))f[d]=null,D(d)&&(g[d]=null);else if(ae(d)){const F=t;M(d,F.k)&&(d.value=null),F.k&&(f[F.k]=null)}}if(j(c))ss(c,l,12,[o,f]);else{const F=te(c),Q=ae(c);if(F||Q){const re=()=>{if(e.f){const K=F?D(c)?g[c]:f[c]:M()||!e.k?c.value:f[e.k];if(r)R(K)&&hn(K,i);else if(R(K))K.includes(i)||K.push(i);else if(F)f[c]=[i],D(c)&&(g[c]=f[c]);else{const X=[i];M(c,e.k)&&(c.value=X),e.k&&(f[e.k]=X)}}else F?(f[c]=o,D(c)&&(g[c]=o)):Q&&(M(c,e.k)&&(c.value=o),e.k&&(f[e.k]=o))};if(o){const K=()=>{re(),vs.delete(e)};K.id=-1,vs.set(e,K),_e(K,s)}else Gn(e),re()}}}function Gn(e){const t=vs.get(e);t&&(t.flags|=8,vs.delete(e))}Ms().requestIdleCallback;Ms().cancelIdleCallback;const Et=e=>!!e.type.__asyncLoader,Tn=e=>e.type.__isKeepAlive;function Vo(e,t){oi(e,"a",t)}function Uo(e,t){oi(e,"da",t)}function oi(e,t,s=he){const n=e.__wdc||(e.__wdc=()=>{let r=s;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(Jt(t,n,s),s){let r=s.parent;for(;r&&r.parent;)Tn(r.parent.vnode)&&Ho(n,t,s,r),r=r.parent}}function Ho(e,t,s,n){const r=Jt(t,e,n,!0),i=Jt("um",()=>hn(n[t],r),s);i.flags=16}function Jt(e,t,s=he,n=!1){if(s){const r=s[e]||(s[e]=[]),i=t.__weh||(t.__weh=(...o)=>{ze();const l=ns(s),c=je(t,s,e,o);return l(),Ge(),c});return n?r.unshift(i):r.push(i),i}}const ot=e=>(t,s=he)=>{(!Zt||e==="sp")&&Jt(e,(...n)=>t(...n),s)},Ko=ot("bm"),Bo=ot("m"),Wo=ot("bu"),qo=ot("u"),zo=ot("bum"),Go=ot("um"),Jo=ot("sp"),Yo=ot("rtg"),Xo=ot("rtc");function Zo(e,t=he){Jt("ec",e,t)}const Qo="components",li=Symbol.for("v-ndc");function Jn(e){return te(e)?el(Qo,e,!1)||e:e||li}function el(e,t,s=!0,n=!1){const r=pe||he;if(r){const i=r.type;{const l=kl(i,!1);if(l&&(l===t||l===ye(t)||l===Ps(ye(t))))return i}const o=Yn(r[e]||i[e],t)||Yn(r.appContext[e],t);return!o&&n?i:o}}function Yn(e,t){return e&&(e[t]||e[ye(t)]||e[Ps(ye(t))])}function ut(e,t,s,n){let r;const i=s,o=R(e);if(o||te(e)){const l=o&&st(e);let c=!1,d=!1;l&&(c=!Ce(e),d=Fe(e),e=Is(e)),r=new Array(e.length);for(let f=0,g=e.length;ft(l,c,void 0,i));else{const l=Object.keys(e);r=new Array(l.length);for(let c=0,d=l.length;c0;return $(),qe(W,null,[Te("slot",d,n)],f?-2:64)}let o=e[t];o&&o._c&&(o._d=!1);const l=nt.length;$();let c;try{const d=o&&ai(o(s)),f=s.key||i||d&&d.key;c=qe(W,{key:(f&&!Ne(f)?f:`_${t}`)+(!d&&n?"_fb":"")},d||(n?n():[]),d&&e._===1?64:-2)}catch(d){for(let f=nt.length;f>l;f--)On();throw d}finally{o&&o._c&&(o._d=!0)}return c.scopeId&&(c.slotScopeIds=[c.scopeId+"-s"]),c}function ai(e){return e.some(t=>Ds(t)?!(t.type===Oe||t.type===W&&!ai(t.children)):!0)?e:null}const ln=e=>e?Mi(e)?ks(e):ln(e.parent):null,Wt=le(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>ln(e.parent),$root:e=>ln(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>fi(e),$forceUpdate:e=>e.f||(e.f=()=>{Cn(e.update)}),$nextTick:e=>e.n||(e.n=Po.bind(e.proxy)),$watch:e=>Do.bind(e)}),Gs=(e,t)=>e!==G&&!e.__isScriptSetup&&U(e,t),tl={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:s,setupState:n,data:r,props:i,accessCache:o,type:l,appContext:c}=e;if(t[0]!=="$"){const T=o[t];if(T!==void 0)switch(T){case 1:return n[t];case 2:return r[t];case 4:return s[t];case 3:return i[t]}else{if(Gs(n,t))return o[t]=1,n[t];if(r!==G&&U(r,t))return o[t]=2,r[t];if(U(i,t))return o[t]=3,i[t];if(s!==G&&U(s,t))return o[t]=4,s[t];cn&&(o[t]=0)}}const d=Wt[t];let f,g;if(d)return t==="$attrs"&&de(e.attrs,"get",""),d(e);if((f=l.__cssModules)&&(f=f[t]))return f;if(s!==G&&U(s,t))return o[t]=4,s[t];if(g=c.config.globalProperties,U(g,t))return g[t]},set({_:e},t,s){const{data:n,setupState:r,ctx:i}=e;return Gs(r,t)?(r[t]=s,!0):n!==G&&U(n,t)?(n[t]=s,!0):U(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=s,!0)},has({_:{data:e,setupState:t,accessCache:s,ctx:n,appContext:r,props:i,type:o}},l){let c;return!!(s[l]||e!==G&&l[0]!=="$"&&U(e,l)||Gs(t,l)||U(i,l)||U(n,l)||U(Wt,l)||U(r.config.globalProperties,l)||(c=o.__cssModules)&&c[l])},defineProperty(e,t,s){return s.get!=null?e._.accessCache[t]=0:U(s,"value")&&this.set(e,t,s.value,null),Reflect.defineProperty(e,t,s)}};function Xn(e){return R(e)?e.reduce((t,s)=>(t[s]=null,t),{}):e}let cn=!0;function sl(e){const t=fi(e),s=e.proxy,n=e.ctx;cn=!1,t.beforeCreate&&Zn(t.beforeCreate,e,"bc");const{data:r,computed:i,methods:o,watch:l,provide:c,inject:d,created:f,beforeMount:g,mounted:T,beforeUpdate:D,updated:M,activated:F,deactivated:Q,beforeDestroy:re,beforeUnmount:K,destroyed:X,unmounted:Z,render:xe,renderTracked:L,renderTriggered:ue,errorCaptured:$e,serverPrefetch:Je,expose:ht,inheritAttrs:Rt,components:rs,directives:is,filters:Vs}=t;if(d&&nl(d,n,null),o)for(const se in o){const J=o[se];j(J)&&(n[se]=J.bind(s))}if(r){const se=r.call(s,s);q(se)&&(e.data=ts(se))}if(cn=!0,i)for(const se in i){const J=i[se],gt=j(J)?J.bind(s,s):j(J.get)?J.get.bind(s,s):We,os=!j(J)&&j(J.set)?J.set.bind(s):We,mt=Ni({get:gt,set:os});Object.defineProperty(n,se,{enumerable:!0,configurable:!0,get:()=>mt.value,set:Ae=>mt.value=Ae})}if(l)for(const se in l)ui(l[se],n,s,se);if(c){const se=j(c)?c.call(s):c;Reflect.ownKeys(se).forEach(J=>{No(J,se[J])})}f&&Zn(f,e,"c");function ge(se,J){R(J)?J.forEach(gt=>se(gt.bind(s))):J&&se(J.bind(s))}if(ge(Ko,g),ge(Bo,T),ge(Wo,D),ge(qo,M),ge(Vo,F),ge(Uo,Q),ge(Zo,$e),ge(Xo,L),ge(Yo,ue),ge(zo,K),ge(Go,Z),ge(Jo,Je),R(ht))if(ht.length){const se=e.exposed||(e.exposed={});ht.forEach(J=>{Object.defineProperty(se,J,{get:()=>s[J],set:gt=>s[J]=gt,enumerable:!0})})}else e.exposed||(e.exposed={});xe&&e.render===We&&(e.render=xe),Rt!=null&&(e.inheritAttrs=Rt),rs&&(e.components=rs),is&&(e.directives=is),Je&&ii(e)}function nl(e,t,s=We){R(e)&&(e=an(e));for(const n in e){const r=e[n];let i;q(r)?"default"in r?i=gs(r.from||n,r.default,!0):i=gs(r.from||n):i=gs(r),ae(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):t[n]=i}}function Zn(e,t,s){je(R(e)?e.map(n=>n.bind(t.proxy)):e.bind(t.proxy),t,s)}function ui(e,t,s,n){let r=n.includes(".")?ni(s,n):()=>s[n];if(te(e)){const i=t[e];j(i)&&ms(r,i)}else if(j(e))ms(r,e.bind(s));else if(q(e))if(R(e))e.forEach(i=>ui(i,t,s,n));else{const i=j(e.handler)?e.handler.bind(s):t[e.handler];j(i)&&ms(r,i,e)}}function fi(e){const t=e.type,{mixins:s,extends:n}=t,{mixins:r,optionsCache:i,config:{optionMergeStrategies:o}}=e.appContext,l=i.get(t);let c;return l?c=l:!r.length&&!s&&!n?c=t:(c={},r.length&&r.forEach(d=>ws(c,d,o,!0)),ws(c,t,o)),q(t)&&i.set(t,c),c}function ws(e,t,s,n=!1){const{mixins:r,extends:i}=t;i&&ws(e,i,s,!0),r&&r.forEach(o=>ws(e,o,s,!0));for(const o in t)if(!(n&&o==="expose")){const l=rl[o]||s&&s[o];e[o]=l?l(e[o],t[o]):t[o]}return e}const rl={data:Qn,props:er,emits:er,methods:kt,computed:kt,beforeCreate:me,created:me,beforeMount:me,mounted:me,beforeUpdate:me,updated:me,beforeDestroy:me,beforeUnmount:me,destroyed:me,unmounted:me,activated:me,deactivated:me,errorCaptured:me,serverPrefetch:me,components:kt,directives:kt,watch:ol,provide:Qn,inject:il};function Qn(e,t){return t?e?function(){return le(j(e)?e.call(this,this):e,j(t)?t.call(this,this):t)}:t:e}function il(e,t){return kt(an(e),an(t))}function an(e){if(R(e)){const t={};for(let s=0;st==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${ye(t)}Modifiers`]||e[`${St(t)}Modifiers`];function ul(e,t,...s){if(e.isUnmounted)return;const n=e.vnode.props||G;let r=s;const i=t.startsWith("update:"),o=i&&al(n,t.slice(7));o&&(o.trim&&(r=s.map(f=>te(f)?f.trim():f)),o.number&&(r=r.map(mn)));let l,c=n[l=Us(t)]||n[l=Us(ye(t))];!c&&i&&(c=n[l=Us(St(t))]),c&&je(c,e,6,r);const d=n[l+"Once"];if(d){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,je(d,e,6,r)}}const fl=new WeakMap;function pi(e,t,s=!1){const n=s?fl:t.emitsCache,r=n.get(e);if(r!==void 0)return r;const i=e.emits;let o={},l=!1;if(!j(e)){const c=d=>{const f=pi(d,t,!0);f&&(l=!0,le(o,f))};!s&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!i&&!l?(q(e)&&n.set(e,null),null):(R(i)?i.forEach(c=>o[c]=null):le(o,i),q(e)&&n.set(e,o),o)}function Fs(e,t){return!e||!$s(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),U(e,t[0].toLowerCase()+t.slice(1))||U(e,St(t))||U(e,t))}function tr(e){const{type:t,vnode:s,proxy:n,withProxy:r,propsOptions:[i],slots:o,attrs:l,emit:c,render:d,renderCache:f,props:g,data:T,setupState:D,ctx:M,inheritAttrs:F}=e,Q=xs(e);let re,K;try{if(s.shapeFlag&4){const Z=r||n,xe=Z;re=He(d.call(xe,Z,f,g,D,T,M)),K=l}else{const Z=t;re=He(Z.length>1?Z(g,{attrs:l,slots:o,emit:c}):Z(g,null)),K=t.props?l:dl(l)}}catch(Z){nt.length=0,Rs(Z,e,1),re=Te(Oe)}let X=re;if(K&&F!==!1){const Z=Object.keys(K),{shapeFlag:xe}=X;Z.length&&xe&7&&(i&&Z.some(Os)&&(K=pl(K,i)),X=Pt(X,K,!1,!0))}if(s.dirs&&(X=Pt(X,null,!1,!0),X.dirs=X.dirs?X.dirs.concat(s.dirs):s.dirs),s.transition){const Z=Ns(X.type)&&ri(X)||X;Kt(Z,s.transition)}return re=X,xs(Q),re}function hi(e,t=!0){let s;for(let n=0;n{let t;for(const s in e)(s==="class"||s==="style"||$s(s))&&((t||(t={}))[s]=e[s]);return t},pl=(e,t)=>{const s={};for(const n in e)(!Os(n)||!(n.slice(9)in t))&&(s[n]=e[n]);return s};function hl(e,t,s){const{props:n,children:r,component:i}=e,{props:o,children:l,patchFlag:c}=t,d=i.emitsOptions;if(t.dirs||t.transition)return!0;if(s&&c>=0){if(c&1024)return!0;if(c&16)return n?sr(n,o,d):!!o;if(c&8){const f=t.dynamicProps;for(let g=0;gObject.create(mi),bi=e=>Object.getPrototypeOf(e)===mi;function ml(e,t,s,n=!1){const r={},i=_i();e.propsDefaults=Object.create(null),yi(e,t,r,i);for(const o in e.propsOptions[0])o in r||(r[o]=void 0);s?e.props=n?r:yo(r):e.type.props?e.props=r:e.props=i,e.attrs=i}function _l(e,t,s,n){const{props:r,attrs:i,vnode:{patchFlag:o}}=e,l=H(r),[c]=e.propsOptions;let d=!1;if((n||o>0)&&!(o&16)){if(o&8){const f=e.vnode.dynamicProps;for(let g=0;g{c=!0;const[T,D]=xi(g,t,!0);le(o,T),D&&l.push(...D)};!s&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}if(!i&&!c)return q(e)&&n.set(e,xt),xt;if(R(i))for(let f=0;fe==="_"||e==="_ctx"||e==="$stable",$n=e=>R(e)?e.map(He):[He(e)],yl=(e,t,s)=>{if(t._n)return t;const n=rt((...r)=>$n(t(...r)),s);return n._c=!1,n},vi=(e,t,s)=>{const n=e._ctx;for(const r in e){if(En(r))continue;const i=e[r];if(j(i))t[r]=yl(r,i,n);else if(i!=null){const o=$n(i);t[r]=()=>o}}},wi=(e,t)=>{const s=$n(t);e.slots.default=()=>s},Si=(e,t,s)=>{for(const n in t)(s||!En(n))&&(e[n]=t[n])},xl=(e,t,s)=>{const n=e.slots=_i();if(e.vnode.shapeFlag&32){const r=t._;r?(Si(n,t,s),s&&$r(n,"_",r,!0)):vi(t,n)}else t&&wi(e,t)},vl=(e,t,s)=>{const{vnode:n,slots:r}=e;let i=!0,o=G;if(n.shapeFlag&32){const l=t._;l?s&&l===1?i=!1:Si(r,t,s):(i=!t.$stable,vi(t,r)),o=t}else t&&(wi(e,t),o={default:1});if(i)for(const l in r)!En(l)&&o[l]==null&&delete r[l]},_e=$l;function wl(e){return Sl(e)}function Sl(e,t){const s=Ms();s.__VUE__=!0;const{insert:n,remove:r,patchProp:i,createElement:o,createText:l,createComment:c,setText:d,setElementText:f,parentNode:g,nextSibling:T,setScopeId:D=We,insertStaticContent:M}=e,F=(a,u,h,x=null,m=null,b=null,S=void 0,w=null,v=!!u.dynamicChildren)=>{if(a===u)return;a&&!Dt(a,u)&&(x=ls(a),Ae(a,m,b,!0),a=null),u.patchFlag===-2&&(v=!1,u.dynamicChildren=null),u.dynamicChildren&&a&&a.dynamicChildren&&a.dynamicChildren.hasOnce&&(u.dynamicChildren===xt&&(u.dynamicChildren=[]),u.dynamicChildren.hasOnce=!0);const{type:_,ref:O,shapeFlag:C}=u;switch(_){case js:Q(a,u,h,x);break;case Oe:re(a,u,h,x);break;case Ys:a==null&&K(u,h,x,S);break;case W:rs(a,u,h,x,m,b,S,w,v);break;default:C&1?xe(a,u,h,x,m,b,S,w,v):C&6?is(a,u,h,x,m,b,S,w,v):(C&64||C&128)&&_.process(a,u,h,x,m,b,S,w,v,Ft)}O!=null&&m?Bt(O,a&&a.ref,b,u||a,!u):O==null&&a&&a.ref!=null&&Bt(a.ref,null,b,a,!0)},Q=(a,u,h,x)=>{if(a==null)n(u.el=l(u.children),h,x);else{const m=u.el=a.el;u.children!==a.children&&d(m,u.children)}},re=(a,u,h,x)=>{a==null?n(u.el=c(u.children||""),h,x):u.el=a.el},K=(a,u,h,x)=>{[a.el,a.anchor]=M(a.children,u,h,x,a.el,a.anchor)},X=({el:a,anchor:u},h,x)=>{let m;for(;a&&a!==u;)m=T(a),n(a,h,x),a=m;n(u,h,x)},Z=({el:a,anchor:u})=>{let h;for(;a&&a!==u;)h=T(a),r(a),a=h;r(u)},xe=(a,u,h,x,m,b,S,w,v)=>{if(u.type==="svg"?S="svg":u.type==="math"&&(S="mathml"),a==null)L(u,h,x,m,b,S,w,v);else{const _=a.el&&a.el._isVueCE?a.el:null;try{_&&_._beginPatch(),Je(a,u,m,b,S,w,v)}finally{_&&_._endPatch()}}},L=(a,u,h,x,m,b,S,w)=>{let v,_;const{props:O,shapeFlag:C,transition:P,dirs:N}=a;if(v=a.el=o(a.type,b,O&&O.is,O),C&8?f(v,a.children):C&16&&$e(a.children,v,null,x,m,Js(a,b),S,w),N&&_t(a,null,x,"created"),ue(v,a,a.scopeId,S,x),O){for(const z in O)z!=="value"&&!Vt(z)&&i(v,z,null,O[z],b,x);"value"in O&&i(v,"value",null,O.value,b),(_=O.onVnodeBeforeMount)&&Le(_,x,a)}N&&_t(a,null,x,"beforeMount");const V=Cl(m,P);V?P.beforeEnter(v):P&&!P.persisted&&(v[El]=!0),n(v,u,h),((_=O&&O.onVnodeMounted)||V||N)&&_e(()=>{_&&Le(_,x,a),V&&P.enter(v),N&&_t(a,null,x,"mounted")},m)},ue=(a,u,h,x,m)=>{if(h&&D(a,h),x)for(let b=0;b{for(let _=v;_{const w=u.el=a.el;let{patchFlag:v,dynamicChildren:_,dirs:O}=u;v|=a.patchFlag&16;const C=a.props||G,P=u.props||G;let N;if(h&&bt(h,!1),(N=P.onVnodeBeforeUpdate)&&Le(N,h,u,a),O&&_t(u,a,h,"beforeUpdate"),h&&bt(h,!0),_&&(!a.dynamicChildren||a.dynamicChildren.length!==_.length)&&(v=0,S=!1,_=null),(C.innerHTML&&P.innerHTML==null||C.textContent&&P.textContent==null)&&f(w,""),_?ht(a.dynamicChildren,_,w,h,x,Js(u,m),b):S||J(a,u,w,null,h,x,Js(u,m),b,!1),v>0){if(v&16)Rt(w,C,P,h,m);else if(v&2&&C.class!==P.class&&i(w,"class",null,P.class,m),v&4&&i(w,"style",C.style,P.style,m),v&8){const V=u.dynamicProps;for(let z=0;z{N&&Le(N,h,u,a),O&&_t(u,a,h,"updated")},x)},ht=(a,u,h,x,m,b,S)=>{for(let w=0;w{if(u!==h){if(u!==G)for(const b in u)!Vt(b)&&!(b in h)&&i(a,b,u[b],null,m,x);for(const b in h){if(Vt(b))continue;const S=h[b],w=u[b];S!==w&&b!=="value"&&i(a,b,w,S,m,x)}"value"in h&&i(a,"value",u.value,h.value,m)}},rs=(a,u,h,x,m,b,S,w,v)=>{const _=u.el=a?a.el:l(""),O=u.anchor=a?a.anchor:l("");let{patchFlag:C,dynamicChildren:P,slotScopeIds:N}=u;N&&(w=w?w.concat(N):N),a==null?(n(_,h,x),n(O,h,x),$e(u.children||[],h,O,m,b,S,w,v)):C>0&&C&64&&P&&a.dynamicChildren&&a.dynamicChildren.length===P.length?(ht(a.dynamicChildren,P,h,m,b,S,w),(u.key!=null||m&&u===m.subTree)&&Ci(a,u,!0)):J(a,u,h,O,m,b,S,w,v)},is=(a,u,h,x,m,b,S,w,v)=>{u.slotScopeIds=w,a==null?u.shapeFlag&512?m.ctx.activate(u,h,x,S,v):Vs(u,h,x,m,b,S,v):In(a,u,v)},Vs=(a,u,h,x,m,b,S)=>{const w=a.component=Il(a,x,m);if(Tn(a)&&(w.ctx.renderer=Ft),Nl(w,!1,S),w.asyncDep){if(m&&m.registerDep(w,ge,S,b),!a.el){const v=w.subTree=Te(Oe);re(null,v,u,h),a.placeholder=v.el}}else ge(w,a,u,h,m,b,S)},In=(a,u,h)=>{const x=u.component=a.component;if(hl(a,u,h))if(x.asyncDep&&!x.asyncResolved){u.el=a.el,u.placeholder=a.placeholder,se(x,u,h);return}else x.next=u,x.update();else u.el=a.el,u.placeholder=a.placeholder,x.vnode=u},ge=(a,u,h,x,m,b,S)=>{const w=()=>{if(a.isMounted){let{next:C,bu:P,u:N,parent:V,vnode:z}=a;{const De=Ti(a);if(De){C&&(C.el=z.el,se(a,C,S)),De.asyncDep.then(()=>{const Ye=()=>{a.job.flags&8||(m&&m.pendingBranch?_e(Ye,m):_())};Ye.flags=48,_e(Ye,m)});return}}let B=C,ie;bt(a,!1),C?(C.el=z.el,se(a,C,S)):C=z,P&&hs(P),(ie=C.props&&C.props.onVnodeBeforeUpdate)&&Le(ie,V,C,z),bt(a,!0);const fe=tr(a),Pe=a.subTree;a.subTree=fe,F(Pe,fe,g(Pe.el||qt(Pe)),ls(Pe),a,m,b),C.el=fe.el,B===null&&gl(a,fe.el),N&&_e(N,m),(ie=C.props&&C.props.onVnodeUpdated)&&_e(()=>Le(ie,V,C,z),m)}else{let C;const{el:P,props:N}=u,{bm:V,m:z,parent:B,root:ie,type:fe}=a,Pe=Et(u);bt(a,!1),V&&hs(V),!Pe&&(C=N&&N.onVnodeBeforeMount)&&Le(C,B,u),bt(a,!0);{ie.ce&&ie.ce._hasShadowRoot()&&ie.ce._injectChildStyle(fe,a.parent?a.parent.type:void 0);const De=a.subTree=tr(a);F(null,De,h,x,a,m,b),u.el=De.el}if(z&&_e(z,m),!Pe&&(C=N&&N.onVnodeMounted)){const De=u;_e(()=>Le(C,B,De),m)}(u.shapeFlag&256||B&&Et(B.vnode)&&B.vnode.shapeFlag&256)&&a.a&&_e(a.a,m),a.isMounted=!0,u=h=x=null}};a.scope.on();const v=a.effect=new Nr(w);a.scope.off();const _=a.update=v.run.bind(v),O=a.job=v.runIfDirty.bind(v);O.i=a,O.id=a.uid,v.scheduler=()=>Cn(O),bt(a,!0),_()},se=(a,u,h)=>{u.component=a;const x=a.vnode.props;a.vnode=u,a.next=null,_l(a,u.props,x,h),vl(a,u.children,h),ze(),Zr(a),Ge()},J=(a,u,h,x,m,b,S,w,v=!1)=>{const _=a&&a.children,O=a?a.shapeFlag:0,C=u.children,{patchFlag:P,shapeFlag:N}=u;if(P>0){if(P&128){os(_,C,h,x,m,b,S,w,v);return}else if(P&256){gt(_,C,h,x,m,b,S,w,v);return}}N&8?(O&16&&Nt(_,m,b),C!==_&&f(h,C)):O&16?N&16?os(_,C,h,x,m,b,S,w,v):Nt(_,m,b,!0):(O&8&&f(h,""),N&16&&$e(C,h,x,m,b,S,w,v))},gt=(a,u,h,x,m,b,S,w,v)=>{a=a||xt,u=u||xt;const _=a.length,O=u.length,C=Math.min(_,O);let P;for(P=0;PO?Nt(a,m,b,!0,!1,C):$e(u,h,x,m,b,S,w,v,C)},os=(a,u,h,x,m,b,S,w,v)=>{let _=0;const O=u.length;let C=a.length-1,P=O-1;for(;_<=C&&_<=P;){const N=a[_],V=u[_]=v?et(u[_]):He(u[_]);if(Dt(N,V))F(N,V,h,null,m,b,S,w,v);else break;_++}for(;_<=C&&_<=P;){const N=a[C],V=u[P]=v?et(u[P]):He(u[P]);if(Dt(N,V))F(N,V,h,null,m,b,S,w,v);else break;C--,P--}if(_>C){if(_<=P){const N=P+1,V=NP)for(;_<=C;)Ae(a[_],m,b,!0),_++;else{const N=_,V=_,z=new Map;for(_=V;_<=P;_++){const we=u[_]=v?et(u[_]):He(u[_]);we.key!=null&&z.set(we.key,_)}let B,ie=0;const fe=P-V+1;let Pe=!1,De=0;const Ye=new Array(fe);for(_=0;_=fe){Ae(we,m,b,!0);continue}let ke;if(we.key!=null)ke=z.get(we.key);else for(B=V;B<=P;B++)if(Ye[B-V]===0&&Dt(we,u[B])){ke=B;break}ke===void 0?Ae(we,m,b,!0):(Ye[ke-V]=_+1,ke>=De?De=ke:Pe=!0,F(we,u[ke],h,null,m,b,S,w,v),ie++)}const jn=Pe?Tl(Ye):xt;for(B=jn.length-1,_=fe-1;_>=0;_--){const we=V+_,ke=u[we],Dn=u[we+1],kn=we+1{const{el:b,type:S,transition:w,children:v,shapeFlag:_}=a;if(_&6){mt(a.component.subTree,u,h,x);return}if(_&128){a.suspense.move(u,h,x);return}if(_&64){S.move(a,u,h,Ft);return}if(S===W){n(b,u,h);for(let C=0;Cw.enter(b),m));else{const{leave:C,delayLeave:P,afterLeave:N}=w,V=()=>{a.ctx.isUnmounted?r(b):n(b,u,h)},z=()=>{const B=b._isLeaving||!!b[zs];b._isLeaving&&b[zs](!0),w.persisted&&!B?V():C(b,()=>{V(),N&&N()})};P?P(b,V,z):z()}else n(b,u,h)},Ae=(a,u,h,x=!1,m=!1)=>{const{type:b,props:S,ref:w,children:v,dynamicChildren:_,shapeFlag:O,patchFlag:C,dirs:P,cacheIndex:N,memo:V}=a;if((C===-2||_&&_.hasOnce)&&(m=!1),w!=null&&(ze(),Bt(w,null,h,a,!0),Ge()),N!=null&&(!a.ctx||a.ctx===u)&&(u.renderCache[N]=void 0),O&256&&u.ctx.deactivate(a))return;const z=O&1&&P,B=!Et(a);let ie;if(B&&(ie=S&&S.onVnodeBeforeUnmount)&&Le(ie,u,a),O&6)Li(a.component,h,x);else{if(O&128){a.suspense.unmount(h,x);return}z&&_t(a,null,u,"beforeUnmount"),O&64?a.type.remove(a,u,h,Ft,x):_&&!_.hasOnce&&(b!==W||C>0&&C&64)?Nt(_,u,h,!1,!0):(b===W&&C&384||!m&&O&16)&&Nt(v,u,h),x&&Rn(a)}const fe=V!=null&&N==null;(B&&(ie=S&&S.onVnodeUnmounted)||z||fe)&&_e(()=>{ie&&Le(ie,u,a),z&&_t(a,null,u,"unmounted"),fe&&(a.el=null)},h)},Rn=a=>{const{type:u,el:h,anchor:x,transition:m}=a,b=u===W;if(b&&!m){Nn(h,x);return}if(u===Ys){Z(a),m&&!m.persisted&&m.afterLeave&&m.afterLeave();return}const S=b?on(a):a,w=()=>{b?g(h)&&Nn(h,x):r(h),m&&!m.persisted&&m.afterLeave&&m.afterLeave()};if(S&&S.shapeFlag&1&&m&&!m.persisted){const{leave:v,delayLeave:_}=m,O=S.el,C=()=>v(O,w);_?_(O,w,C):C()}else w()},Nn=(a,u)=>{let h;for(;a!==u;)h=T(a),r(a),a=h;r(u)},Li=(a,u,h)=>{const{bum:x,scope:m,job:b,subTree:S,um:w,m:v,a:_}=a;rr(v),rr(_),x&&hs(x),m.stop(),b?(b.flags|=8,Ae(S,a,u,h)):S&&(S.transition=a.vnode.transition,Ae(S,a,u,h)),w&&_e(w,u);const O=()=>{a.isUnmounted=!0};O.flags=16,_e(O,u)},Nt=(a,u,h,x=!1,m=!1,b=0)=>{for(let S=b;S{if(a.shapeFlag&6)return ls(a.component.subTree);if(a.shapeFlag&128)return a.suspense.next();const u=T(a.anchor||a.el),h=u&&u[ko];return h?T(h):u},Fn=(a,u,h)=>{const x=a&&u._vnode?void 0:a&&a.component?a.component.uid:Ml();Ro(()=>{a==null?u._vnode&&Ae(u._vnode,null,null,!0):F(u._vnode||null,a,u,null,null,null,h),u._vnode=a},x)},Ft={p:F,um:Ae,m:mt,r:Rn,mt:Vs,mc:$e,pc:J,pbc:ht,n:ls,o:e};return{render:Fn,hydrate:void 0,createApp:cl(Fn)}}function Js({type:e,props:t},s){return s==="svg"&&e==="foreignObject"||s==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:s}function bt({effect:e,job:t},s){s?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Cl(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ci(e,t,s=!1){const n=e.children,r=t.children;if(R(n)&&R(r))for(let i=0;i>1,e[s[l]]0&&(t[n]=s[i-1]),s[i]=n)}}for(i=s.length,o=s[i-1];i-- >0;)s[i]=o,o=t[o];return s}function Ti(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Ti(t)}function rr(e){if(e)for(let t=0;te.__isSuspense,El=Symbol("_deferredEnter");function $l(e,t){t&&t.pendingBranch?R(e)?t.effects.push(...e):t.effects.push(e):Io(e)}const W=Symbol.for("v-fgt"),js=Symbol.for("v-txt"),Oe=Symbol.for("v-cmt"),Ys=Symbol.for("v-stc"),nt=[];let Se=null;function $(e=!1){nt.push(Se=e?null:[])}function On(){nt.pop(),Se=nt[nt.length-1]||null}let Yt=1;function ir(e,t=!1){Yt+=e,e<0&&Se&&t&&(Se.hasOnce=!0)}function $i(e){return e.dynamicChildren=Yt>0?Se||xt:null,On(),Yt>0&&Se&&Se.push(e),e}function I(e,t,s,n,r,i){return $i(y(e,t,s,n,r,i,!0))}function qe(e,t,s,n,r){return $i(Te(e,t,s,n,r,!0))}function Ds(e){return e?e.__v_isVNode===!0:!1}function Dt(e,t){return e.type===t.type&&e.key===t.key}const Oi=({key:e})=>e??null,_s=({ref:e,ref_key:t,ref_for:s})=>(typeof e=="number"&&(e=""+e),e!=null?te(e)||ae(e)||j(e)?{i:pe,r:e,k:t,f:!!s}:e:null);function y(e,t=null,s=null,n=0,r=null,i=e===W?0:1,o=!1,l=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Oi(t),ref:t&&_s(t),scopeId:ti,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:n,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:pe};return l?(Ss(c,s),i&128&&e.normalize(c)):s&&(c.shapeFlag|=te(s)?8:16),Yt>0&&!o&&Se&&(c.patchFlag>0||i&6)&&c.patchFlag!==32&&Se.push(c),c}const Te=Ol;function Ol(e,t=null,s=null,n=0,r=null,i=!1){if((!e||e===li)&&(e=Oe),Ds(e)){const l=Pt(e,t,!0);return s&&Ss(l,s),Yt>0&&!i&&Se&&(l.shapeFlag&6?Se[Se.indexOf(e)]=l:Se.push(l)),l.patchFlag=-2,l}if(Ll(e)&&(e=e.__vccOpts),t){t=Al(t);let{class:l,style:c}=t;l&&!te(l)&&(t.class=ft(l)),q(c)&&(Sn(c)&&!R(c)&&(c=le({},c)),t.style=es(c))}const o=te(e)?1:Ei(e)?128:Ns(e)?64:q(e)?4:j(e)?2:0;return y(e,t,s,n,r,o,i,!0)}function Al(e){return e?Sn(e)?le({},e):bi(e)?le({},e[Ri]||e):e:null}function Pt(e,t,s=!1,n=!1){const{props:r,ref:i,patchFlag:o,children:l,transition:c}=e,d=t?Ai(r||{},t):r,f={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&Oi(d),ref:t&&t.ref?s&&i?R(i)?i.concat(_s(t)):[i,_s(t)]:_s(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==W?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Pt(e.ssContent),ssFallback:e.ssFallback&&Pt(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return c&&n&&Kt(f,c.clone(f)),f}function Re(e=" ",t=0){return Te(js,null,e,t)}function ee(e="",t=!1){return t?($(),qe(Oe,null,e)):Te(Oe,null,e)}function He(e){return e==null||typeof e=="boolean"?Te(Oe):R(e)?Te(W,null,e.slice()):Ds(e)?et(e):Te(js,null,String(e))}function et(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Pt(e)}function Ss(e,t){let s=0;const{shapeFlag:n}=e;if(t==null)t=null;else if(R(t))s=16;else if(typeof t=="object")if(n&65){const r=t.default;r&&(r._c&&(r._d=!1),Ss(e,r()),r._c&&(r._d=!0));return}else{s=32;const r=t._;!r&&!bi(t)?t._ctx=pe:r===3&&pe&&(pe.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(j(t)){if(n&65){Ss(e,{default:t});return}t={default:t,_ctx:pe},s=32}else t=String(t),n&64?(s=16,t=[Re(t)]):s=8;e.children=t,e.shapeFlag|=s}function Ai(...e){const t={};for(let s=0;she||pe;let Cs,Xt;{const e=Ms(),t=(s,n)=>{let r;return(r=e[s])||(r=e[s]=[]),r.push(n),i=>{r.length>1?r.forEach(o=>o(i)):r[0](i)}};Cs=t("__VUE_INSTANCE_SETTERS__",s=>he=s),Xt=t("__VUE_SSR_SETTERS__",s=>Zt=s)}const ns=e=>{const t=he;return Cs(e),e.scope.on(),()=>{e.scope.off(),Cs(t)}},or=()=>{he&&he.scope.off(),Cs(null)};function Mi(e){return e.vnode.shapeFlag&4}let Zt=!1;function Nl(e,t=!1,s=!1){t&&Xt(t);const{props:n,children:r}=e.vnode,i=Mi(e);ml(e,n,i,t),xl(e,r,s||t);const o=i?Fl(e,t):void 0;return t&&Xt(!1),o}function Fl(e,t){const s=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,tl);const{setup:n}=s;if(n){ze();const r=e.setupContext=n.length>1?Dl(e):null,i=ns(e),o=ss(n,e,0,[e.props,r]),l=Cr(o);if(Ge(),i(),(l||e.sp)&&!Et(e)&&ii(e),l){if(o.then(or,or),t)return o.then(c=>{Xt(!0);try{lr(e,c,t)}finally{Xt(!1)}}).catch(c=>{Rs(c,e,0,void 0,!0),e.ssrRender=(d,f)=>f("")});e.asyncDep=o}else lr(e,o)}else Ii(e)}function lr(e,t,s){j(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:q(t)&&(e.setupState=Jr(t)),Ii(e)}function Ii(e,t,s){const n=e.type;e.render||(e.render=n.render||We);{const r=ns(e);ze();try{sl(e)}finally{Ge(),r()}}}const Ri=Symbol(),jl={get(e,t){return de(e,"get",""),t===Ri?e:e[t]}};function Dl(e){const t=s=>{e.exposed=s||{}};return{attrs:new Proxy(e.attrs,jl),slots:e.slots,emit:e.emit,expose:t}}function ks(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Jr(xo(e.exposed)),{get(t,s){if(s in t)return t[s];if(s in Wt)return Wt[s](e)},has(t,s){return s in t||s in Wt}})):e.proxy}function kl(e,t=!0){return j(e)?e.displayName||e.name:e.name||t&&e.__name}function Ll(e){return j(e)&&"__vccOpts"in e}const Ni=(e,t)=>Eo(e,t,Zt),Vl="3.5.47";let fn;const cr=typeof window<"u"&&window.trustedTypes;if(cr)try{fn=cr.createPolicy("vue",{createHTML:e=>e})}catch{}const Fi=fn?e=>fn.createHTML(e):e=>e,Ul="http://www.w3.org/2000/svg",Hl="http://www.w3.org/1998/Math/MathML",Ze=typeof document<"u"?document:null,ar=Ze&&Ze.createElement("template"),Kl={insert:(e,t,s)=>{t.insertBefore(e,s||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,s,n)=>{const r=t==="svg"?Ze.createElementNS(Ul,e):t==="mathml"?Ze.createElementNS(Hl,e):s?Ze.createElement(e,{is:s}):Ze.createElement(e);return e==="select"&&n&&n.multiple!=null&&r.setAttribute("multiple",n.multiple),r},createText:e=>Ze.createTextNode(e),createComment:e=>Ze.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ze.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,s,n,r,i){const o=s?s.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),s),!(r===i||!(r=r.nextSibling)););else{ar.innerHTML=Fi(n==="svg"?`${e}`:n==="mathml"?`${e}`:e);const l=ar.content;if(n==="svg"||n==="mathml"){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}t.insertBefore(l,s)}return[o?o.nextSibling:t.firstChild,s?s.previousSibling:t.lastChild]}},Bl=Symbol("_vtc");function Wl(e,t,s){const n=e[Bl];n&&(t=(t?[t,...n]:[...n]).join(" ")),t==null?e.removeAttribute("class"):s?e.setAttribute("class",t):e.className=t}const ur=Symbol("_vod"),ql=Symbol("_vsh"),zl=Symbol(""),Gl=/(?:^|;)\s*display\s*:/;function Jl(e,t,s){const n=e.style,r=te(s);let i=!1;if(s&&!r){if(t)if(te(t))for(const o of t.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&Lt(n,l,"")}else for(const o in t)s[o]==null&&Lt(n,o,"");for(const o in s){o==="display"&&(i=!0);const l=s[o];l!=null?Xl(e,o,!te(t)&&t?t[o]:void 0,l)||Lt(n,o,l):Lt(n,o,"")}}else if(r){if(t!==s){const o=n[zl];o&&(s+=";"+o),n.cssText=s,i=Gl.test(s)}}else t&&e.removeAttribute("style");ur in e&&((!r||t!==s)&&(e[ur]=i?n.display:""),e[ql]&&(n.display="none"))}const fs=/\s*!important$/;function Lt(e,t,s){if(R(s))s.forEach(n=>Lt(e,t,n));else if(s==null&&(s=""),t.startsWith("--"))fs.test(s)?e.setProperty(t,s.replace(fs,""),"important"):e.setProperty(t,s);else{const n=Yl(e,t);fs.test(s)?e.setProperty(St(n),s.replace(fs,""),"important"):e[n]=s}}const fr=["Webkit","Moz","ms"],Xs={};function Yl(e,t){const s=Xs[t];if(s)return s;let n=ye(t);if(n!=="filter"&&n in e)return Xs[t]=n;n=Ps(n);for(let r=0;rZs||(nc.then(()=>Zs=0),Zs=Date.now());function ic(e,t){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;const r=s.value;if(R(r)){const i=n.stopImmediatePropagation;n.stopImmediatePropagation=()=>{i.call(n),n._stopped=!0};const o=r.slice(),l=[n];for(let c=0;ce.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,oc=(e,t,s,n,r,i)=>{const o=r==="svg";t==="class"?Wl(e,n,o):t==="style"?Jl(e,s,n):$s(t)?Os(t)||Ql(e,t,s,n,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):lc(e,t,n,o))?(hr(e,t,n),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&pr(e,t,n,o,i,t!=="value")):e._isVueCE&&(cc(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!te(n)))?hr(e,ye(t),n,i,t):(t==="true-value"?e._trueValue=n:t==="false-value"&&(e._falseValue=n),pr(e,t,n,o))};function lc(e,t,s,n){if(n)return!!(t==="innerHTML"||t==="textContent"||t in e&&mr(t)&&j(s));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return mr(t)&&te(s)?!1:t in e}function cc(e,t){const s=e._def.props;if(!s)return!1;const n=ye(t);return Array.isArray(s)?s.some(r=>ye(r)===n):Object.keys(s).some(r=>ye(r)===n)}const Mt=e=>{const t=e.props["onUpdate:modelValue"]||!1;return R(t)?s=>hs(t,s):t};function ac(e){e.target.composing=!0}function _r(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Be=Symbol("_assign"),ds=Symbol("_initialValue");function Qs(e,t,s){return t&&(e=e.trim()),s&&(e=mn(e)),e}const ve={created(e,{modifiers:{lazy:t,trim:s,number:n}},r){e.parentNode&&(e.type==="text"?e[ds]=e.defaultValue.replace(/[\r\n]/g,""):e.type==="textarea"&&(e[ds]=e.defaultValue.replace(/\r\n?/g,` +`))),e[Be]=Mt(r);const i=n||r.props&&r.props.type==="number";ct(e,t?"change":"input",o=>{o.target.composing||e[Be](Qs(e.value,s,i))}),(s||i)&&ct(e,"change",()=>{e.value=Qs(e.value,s,i)}),t||(ct(e,"compositionstart",ac),ct(e,"compositionend",_r),ct(e,"change",_r))},mounted(e,{value:t,modifiers:{trim:s,number:n}}){const r=t??"",i=e[ds];delete e[ds],i!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==i?e[Be](Qs(e.value,s,n)):e.value=r},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:n,trim:r,number:i}},o){if(e[Be]=Mt(o),e.composing)return;const l=(i||e.type==="number")&&!/^0\d/.test(e.value)?mn(e.value):e.value,c=t??"";if(l===c)return;const d=e.getRootNode();(d instanceof Document||d instanceof ShadowRoot)&&d.activeElement===e&&e.type!=="range"&&(n&&t===s||r&&e.value.trim()===c)||(e.value=c)}},dn={deep:!0,created(e,t,s){e[Be]=Mt(s),ct(e,"change",()=>{const n=e._modelValue,r=ji(e),i=e.checked,o=e[Be];if(R(n)){const l=Ar(n,r),c=l!==-1;if(i&&!c)o(n.concat(r));else if(!i&&c){const d=[...n];d.splice(l,1),o(d)}}else if(Ot(n)){const l=new Set(n);i?l.add(r):l.delete(r),o(l)}else o(Di(e,i))})},mounted:br,beforeUpdate(e,t,s){e[Be]=Mt(s),br(e,t,s)}};function br(e,{value:t,oldValue:s},n){e._modelValue=t;let r;if(R(t))r=Ar(t,n.props.value)>-1;else if(Ot(t))r=t.has(n.props.value);else{if(t===s)return;r=dt(t,Di(e,!0))}e.checked!==r&&(e.checked=r)}const uc={created(e,{value:t},s){e.checked=dt(t,s.props.value),e[Be]=Mt(s),ct(e,"change",()=>{e[Be](ji(e))})},beforeUpdate(e,{value:t,oldValue:s},n){e[Be]=Mt(n),t!==s&&(e.checked=dt(t,n.props.value))}};function ji(e){return"_value"in e?e._value:e.value}function Di(e,t){const s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}const fc=["ctrl","shift","alt","meta"],dc={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>fc.some(s=>e[`${s}Key`]&&!t.includes(s))},An=(e,t)=>{if(!e)return e;const s=e._withMods||(e._withMods={}),n=t.join(".");return s[n]||(s[n]=((r,...i)=>{for(let o=0;o{const t=hc().createApp(...e),{mount:s}=t;return t.mount=n=>{const r=_c(n);if(!r)return;const i=t._component;!j(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=s(r,!1,mc(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},t});function mc(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function _c(e){return te(e)?document.querySelector(e):e}class Ts extends Error{constructor(t,s){super(s?.message??`HTTP ${t}`),this.status=t,this.body=s}status;body;get errors(){return Object.fromEntries(Object.entries(this.body?.errors??{}).map(([t,s])=>[t,s[0]]))}}const k=JSON.parse(document.getElementById("manager-boot").textContent);function bc(){const e=document.cookie.match(/(?:^|; )XSRF-TOKEN=([^;]+)/);return e?decodeURIComponent(e[1]):""}async function ps(e,t,s){const n=await fetch(t,{method:e,credentials:"same-origin",headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest","X-XSRF-TOKEN":bc(),...s===void 0?{}:{"Content-Type":"application/json"}},body:s===void 0?void 0:JSON.stringify(s)}),r=n.status===204?null:await n.json().catch(()=>null);if(!n.ok)throw new Ts(n.status,r);return r}const Qt={get:e=>ps("GET",e),post:(e,t={})=>ps("POST",e,t),put:(e,t={})=>ps("PUT",e,t),delete:e=>ps("DELETE",e)};function Pn(e){const t=ts({values:{...e},errors:{},busy:!1,async send(s,n){t.busy=!0,t.errors={};try{return await Qt[s](n,t.values)}catch(r){if(r instanceof Ts&&r.status===422)return t.errors=r.errors,null;throw r}finally{t.busy=!1}}});return t}const yc={Dashboard:"Dashboard","Log in":"Inloggen","Log out":"Uitloggen",Email:"E-mailadres",Password:"Wachtwoord","Keep me logged in":"Ingelogd blijven","Logging in…":"Bezig met inloggen…","Log in to manage the site.":"Log in om de site te beheren.","My account":"Mijn account",Name:"Naam","Email address":"E-mailadres","What you may do":"Wat je mag","Super admin: everything":"Super admin: alles","Not in a group yet":"Nog in geen groep","New password":"Nieuw wachtwoord","Leave empty to keep the password you have.":"Laat leeg om je wachtwoord te houden.","Current password":"Huidig wachtwoord","At least 12 characters.":"Minstens 12 tekens.","New password, once more":"Nieuw wachtwoord, nogmaals",Save:"Opslaan","Saving…":"Bezig met opslaan…","Saved.":"Opgeslagen.",Look:"Uiterlijk",Theme:"Thema",Posts:"Berichten","New post":"Nieuw bericht",Title:"Titel",Status:"Status",Category:"Categorie",Edit:"Bewerken",Delete:"Verwijderen","Put online":"Online zetten","Take offline":"Offline halen",Draft:"Concept",Scheduled:"Ingepland",Published:"Gepubliceerd","Are you sure?":"Weet je het zeker?","No posts yet.":"Nog geen berichten.","Address (slug)":"Adres (slug)",Summary:"Samenvatting","Text (Markdown)":"Tekst (Markdown)","Cover image":"Omslagafbeelding","Tags (comma separated)":"Tags (met komma's)",Featured:"Uitgelicht",Publish:"Publiceren","Publish at":"Publiceren op",Menu:"Menu","Loading…":"Laden…","You may not open this page.":"Je mag deze pagina niet openen.","Something went wrong. Try again.":"Er ging iets mis. Probeer het opnieuw.","This page has no screen in the manager yet.":"Deze pagina heeft nog geen scherm in de manager.","Go to the dashboard":"Naar het dashboard","The page expired. Reload it and try again.":"De pagina is verlopen. Laad hem opnieuw en probeer het nog eens.",Back:"Terug",Open:"Openen","Created.":"Aangemaakt.","Deleted.":"Verwijderd."};let ki={};function xc(e){ki=e.toLowerCase().startsWith("nl")?yc:{}}function A(e){return ki[e]??e}const vc=["href"],wt=it({__name:"Link",props:{href:{}},setup(e){function t(s,n){s.metaKey||s.ctrlKey||s.shiftKey||s.button!==0||(s.preventDefault(),Mn(n))}return(s,n)=>($(),I("a",{href:e.href,onClick:n[0]||(n[0]=r=>t(r,e.href))},[ci(s.$slots,"default")],8,vc))}}),wc={class:"font-display mb-6 text-2xl font-bold"},Sc={class:"mb-4 text-muted"},Cc={class:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3"},Tc=it({__name:"Dashboard",props:{navigation:{}},setup(e){return(t,s)=>($(),I(W,null,[y("h1",wc,E(p(A)("Dashboard")),1),y("p",Sc,E(p(k).user?.name),1),y("div",Cc,[($(!0),I(W,null,ut(e.navigation,n=>($(),qe(wt,{key:n.href,href:n.href,class:"m-card block p-5 font-semibold transition hover:border-brand"},{default:rt(()=>[Re(E(p(A)(n.label)),1)]),_:2},1032,["href"]))),128))])],64))}}),Ec={class:"m-card max-w-xl p-6"},$c={class:"text-sm"},Oc=it({__name:"Fallback",setup(e){return(t,s)=>($(),I("div",Ec,[y("p",$c,E(p(A)("This page has no screen in the manager yet.")),1),Te(wt,{href:p(k).base,class:"m-btn m-btn-secondary mt-4"},{default:rt(()=>[Re(E(p(A)("Go to the dashboard")),1)]),_:1},8,["href"])]))}}),Ac={class:"grid min-h-screen place-items-center px-4"},Pc=["src"],Mc={class:"font-display text-2xl font-bold"},Ic={class:"mt-1 text-sm text-muted"},Rc={class:"mt-6"},Nc={for:"email",class:"m-label"},Fc={key:0,class:"m-error"},jc={class:"mt-4"},Dc={for:"password",class:"m-label"},kc={key:0,class:"m-error"},Lc={class:"mt-4 flex items-center gap-2 text-sm text-muted"},Vc=["disabled"],Uc=it({__name:"Login",setup(e){const t=Pn({email:"",password:"",remember:!1});async function s(){const n=await t.send("post",k.base+"/login");n?window.location.assign(n.redirect):t.values.password=""}return(n,r)=>($(),I("div",Ac,[y("form",{class:"m-card w-full max-w-sm p-7",onSubmit:An(s,["prevent"])},[p(k).logo?($(),I("img",{key:0,src:p(k).logo,alt:"",class:"mb-4 h-9 w-auto"},null,8,Pc)):ee("",!0),y("h1",Mc,E(p(k).name),1),y("p",Ic,E(p(A)("Log in to manage the site.")),1),y("div",Rc,[y("label",Nc,E(p(A)("Email")),1),ce(y("input",{id:"email","onUpdate:modelValue":r[0]||(r[0]=i=>p(t).values.email=i),type:"email",autocomplete:"username",required:"",autofocus:"",class:"m-input"},null,512),[[ve,p(t).values.email]]),p(t).errors.email?($(),I("p",Fc,E(p(t).errors.email),1)):ee("",!0)]),y("div",jc,[y("label",Dc,E(p(A)("Password")),1),ce(y("input",{id:"password","onUpdate:modelValue":r[1]||(r[1]=i=>p(t).values.password=i),type:"password",autocomplete:"current-password",required:"",class:"m-input"},null,512),[[ve,p(t).values.password]]),p(t).errors.password?($(),I("p",kc,E(p(t).errors.password),1)):ee("",!0)]),y("label",Lc,[ce(y("input",{"onUpdate:modelValue":r[2]||(r[2]=i=>p(t).values.remember=i),type:"checkbox"},null,512),[[dn,p(t).values.remember]]),Re(" "+E(p(A)("Keep me logged in")),1)]),y("button",{type:"submit",class:"m-btn m-btn-primary mt-6 w-full justify-center",disabled:p(t).busy},E(p(t).busy?p(A)("Logging in…"):p(A)("Log in")),9,Vc)],32)]))}}),Hc={class:"mb-6 flex items-center justify-between gap-3"},Kc={class:"font-display text-2xl font-bold"},Bc={for:"title",class:"m-label"},Wc={key:0,class:"m-error"},qc={class:"grid gap-5 sm:grid-cols-2"},zc={for:"slug",class:"m-label"},Gc={key:0,class:"m-error"},Jc={for:"category",class:"m-label"},Yc={id:"categories"},Xc=["value"],Zc={for:"excerpt",class:"m-label"},Qc={key:0,class:"m-error"},ea={for:"body",class:"m-label"},ta={key:0,class:"m-error"},sa={class:"grid gap-5 sm:grid-cols-2"},na={for:"cover",class:"m-label"},ra={for:"tags",class:"m-label"},ia={id:"known-tags"},oa=["value"],la={class:"flex flex-wrap items-center gap-6"},ca={class:"flex items-center gap-2 text-sm"},aa={key:0,class:"flex items-center gap-2 text-sm"},ua={key:1},fa={for:"at",class:"m-label"},da=["disabled"],xr=it({__name:"PostForm",props:{post:{},categories:{},known_tags:{}},setup(e){const s=e.post,n=Pn({title:s?.title??"",slug:s?.slug??"",excerpt:s?.excerpt??"",body:s?.body??"",cover_image:s?.cover_image??"",category:s?.category??"",tags:s?.tags??[],is_featured:s?.is_featured??!1,is_published:s?.is_published??!1,published_at:s?.published_at??""});let r=(s?.tags??[]).join(", ");async function i(){n.values.tags=r.split(",").map(l=>l.trim()).filter(Boolean),(s?await n.send("put",`${k.base}/posts/${s.id}`):await n.send("post",`${k.base}/posts`))&&(Ls(A(s?"Saved.":"Created.")),Mn(`${k.base}/posts`))}return(o,l)=>($(),I(W,null,[y("div",Hc,[y("h1",Kc,E(p(s)?p(s).title:p(A)("New post")),1),Te(wt,{href:p(k).base+"/posts",class:"m-btn m-btn-secondary"},{default:rt(()=>[Re(E(p(A)("Back")),1)]),_:1},8,["href"])]),y("form",{class:"m-card max-w-3xl space-y-5 p-5",onSubmit:An(i,["prevent"])},[y("div",null,[y("label",Bc,E(p(A)("Title")),1),ce(y("input",{id:"title","onUpdate:modelValue":l[0]||(l[0]=c=>p(n).values.title=c),required:"",maxlength:"255",class:"m-input"},null,512),[[ve,p(n).values.title]]),p(n).errors.title?($(),I("p",Wc,E(p(n).errors.title),1)):ee("",!0)]),y("div",qc,[y("div",null,[y("label",zc,E(p(A)("Address (slug)")),1),ce(y("input",{id:"slug","onUpdate:modelValue":l[1]||(l[1]=c=>p(n).values.slug=c),maxlength:"255",class:"m-input"},null,512),[[ve,p(n).values.slug]]),p(n).errors.slug?($(),I("p",Gc,E(p(n).errors.slug),1)):ee("",!0)]),y("div",null,[y("label",Jc,E(p(A)("Category")),1),ce(y("input",{id:"category","onUpdate:modelValue":l[2]||(l[2]=c=>p(n).values.category=c),list:"categories",maxlength:"60",class:"m-input"},null,512),[[ve,p(n).values.category]]),y("datalist",Yc,[($(!0),I(W,null,ut(e.categories,c=>($(),I("option",{key:c,value:c},null,8,Xc))),128))])])]),y("div",null,[y("label",Zc,E(p(A)("Summary")),1),ce(y("textarea",{id:"excerpt","onUpdate:modelValue":l[3]||(l[3]=c=>p(n).values.excerpt=c),rows:"2",maxlength:"500",class:"m-input"},null,512),[[ve,p(n).values.excerpt]]),p(n).errors.excerpt?($(),I("p",Qc,E(p(n).errors.excerpt),1)):ee("",!0)]),y("div",null,[y("label",ea,E(p(A)("Text (Markdown)")),1),ce(y("textarea",{id:"body","onUpdate:modelValue":l[4]||(l[4]=c=>p(n).values.body=c),rows:"14",required:"",class:"m-input font-mono"},null,512),[[ve,p(n).values.body]]),p(n).errors.body?($(),I("p",ta,E(p(n).errors.body),1)):ee("",!0)]),y("div",sa,[y("div",null,[y("label",na,E(p(A)("Cover image")),1),ce(y("input",{id:"cover","onUpdate:modelValue":l[5]||(l[5]=c=>p(n).values.cover_image=c),maxlength:"2048",class:"m-input"},null,512),[[ve,p(n).values.cover_image]])]),y("div",null,[y("label",ra,E(p(A)("Tags (comma separated)")),1),ce(y("input",{id:"tags","onUpdate:modelValue":l[6]||(l[6]=c=>ae(r)?r.value=c:r=c),list:"known-tags",class:"m-input"},null,512),[[ve,p(r)]]),y("datalist",ia,[($(!0),I(W,null,ut(e.known_tags,c=>($(),I("option",{key:c,value:c},null,8,oa))),128))])])]),y("div",la,[y("label",ca,[ce(y("input",{"onUpdate:modelValue":l[7]||(l[7]=c=>p(n).values.is_featured=c),type:"checkbox"},null,512),[[dn,p(n).values.is_featured]]),Re(" "+E(p(A)("Featured")),1)]),p(k).permissions.includes("posts.publish")?($(),I("label",aa,[ce(y("input",{"onUpdate:modelValue":l[8]||(l[8]=c=>p(n).values.is_published=c),type:"checkbox"},null,512),[[dn,p(n).values.is_published]]),Re(" "+E(p(A)("Publish")),1)])):ee("",!0),p(n).values.is_published?($(),I("div",ua,[y("label",fa,E(p(A)("Publish at")),1),ce(y("input",{id:"at","onUpdate:modelValue":l[9]||(l[9]=c=>p(n).values.published_at=c),type:"datetime-local",class:"m-input"},null,512),[[ve,p(n).values.published_at]])])):ee("",!0)]),y("button",{type:"submit",class:"m-btn m-btn-primary",disabled:p(n).busy},E(p(n).busy?p(A)("Saving…"):p(A)("Save")),9,da)],32)],64))}}),pa={class:"mb-6 flex flex-wrap items-center justify-between gap-3"},ha={class:"font-display text-2xl font-bold"},ga={key:0,class:"m-card p-5 text-sm text-muted"},ma={key:1,class:"m-card divide-y divide-line"},_a={class:"min-w-0"},ba={class:"truncate font-semibold"},ya={class:"mt-1 flex items-center gap-2 text-xs text-muted"},xa={class:"m-badge"},va={key:0},wa={class:"flex gap-2"},Sa=["onClick"],Ca=["onClick"],Ta=it({__name:"PostsIndex",props:{posts:{}},setup(e){const t={draft:"Draft",scheduled:"Scheduled",published:"Published"};async function s(r){await Qt.put(`${k.base}/posts/${r.id}/online`,{online:r.status!=="published"}),await wr()}async function n(r){window.confirm(A("Are you sure?"))&&(await Qt.delete(`${k.base}/posts/${r.id}`),Ls(A("Deleted.")),await wr())}return(r,i)=>($(),I(W,null,[y("div",pa,[y("h1",ha,E(p(A)("Posts")),1),p(k).permissions.includes("posts.write")?($(),qe(wt,{key:0,href:p(k).base+"/posts/create",class:"m-btn m-btn-primary"},{default:rt(()=>[Re(E(p(A)("New post")),1)]),_:1},8,["href"])):ee("",!0)]),e.posts.length?($(),I("ul",ma,[($(!0),I(W,null,ut(e.posts,o=>($(),I("li",{key:o.id,class:"flex flex-wrap items-center justify-between gap-3 p-4"},[y("div",_a,[y("p",ba,E(o.title),1),y("p",ya,[y("span",xa,E(p(A)(t[o.status])),1),o.category?($(),I("span",va,E(o.category),1)):ee("",!0)])]),y("div",wa,[p(k).permissions.includes("posts.publish")&&o.can_change?($(),I("button",{key:0,type:"button",class:"m-btn m-btn-secondary",onClick:l=>s(o)},E(o.status==="published"?p(A)("Take offline"):p(A)("Put online")),9,Sa)):ee("",!0),o.can_change?($(),qe(wt,{key:1,href:`${p(k).base}/posts/${o.id}/edit`,class:"m-btn m-btn-secondary"},{default:rt(()=>[Re(E(p(A)("Edit")),1)]),_:1},8,["href"])):ee("",!0),o.can_delete?($(),I("button",{key:2,type:"button",class:"m-btn m-btn-danger",onClick:l=>n(o)},E(p(A)("Delete")),9,Ca)):ee("",!0)])]))),128))])):($(),I("p",ga,E(p(A)("No posts yet.")),1))],64))}}),Ea={class:"font-display mb-6 text-2xl font-bold"},$a={for:"name",class:"m-label"},Oa={key:0,class:"m-error"},Aa={class:"m-label"},Pa={class:"text-sm"},Ma={class:"m-label"},Ia={class:"flex flex-wrap gap-1.5"},Ra={key:0,class:"m-badge"},Na={key:0,class:"m-badge"},Fa={key:0,class:"rounded-lg border border-line p-4"},ja={class:"px-1.5 text-sm font-semibold"},Da={class:"mt-1 flex flex-wrap gap-3"},ka=["onUpdate:modelValue","value"],La={class:"flex"},Va={key:0,class:"m-error"},Ua={class:"space-y-4 rounded-lg border border-line p-4"},Ha={class:"px-1.5 text-sm font-semibold"},Ka={class:"m-help"},Ba={for:"current_password",class:"m-label"},Wa={key:0,class:"m-error"},qa={for:"password",class:"m-label"},za={class:"m-help"},Ga={key:0,class:"m-error"},Ja={for:"password_confirmation",class:"m-label"},Ya=["disabled"],Xa=it({__name:"Profile",props:{profile:{}},setup(e){const t=e,s=Pn({name:t.profile.name,theme:t.profile.theme,current_password:"",password:"",password_confirmation:""});async function n(){await s.send("put",k.base+"/profile")&&(Ls(A("Saved.")),s.values.theme!==k.theme&&window.location.reload(),s.values.current_password=s.values.password=s.values.password_confirmation="")}return(r,i)=>($(),I(W,null,[y("h1",Ea,E(p(A)("My account")),1),y("form",{class:"m-card max-w-xl space-y-5 p-5",onSubmit:An(n,["prevent"])},[y("div",null,[y("label",$a,E(p(A)("Name")),1),ce(y("input",{id:"name","onUpdate:modelValue":i[0]||(i[0]=o=>p(s).values.name=o),type:"text",required:"",maxlength:"255",class:"m-input",autocomplete:"name"},null,512),[[ve,p(s).values.name]]),p(s).errors.name?($(),I("p",Oa,E(p(s).errors.name),1)):ee("",!0)]),y("div",null,[y("span",Aa,E(p(A)("Email address")),1),y("p",Pa,E(e.profile.email),1)]),y("div",null,[y("span",Ma,E(p(A)("What you may do")),1),y("p",Ia,[e.profile.is_super_admin?($(),I("span",Ra,E(p(A)("Super admin: everything")),1)):($(),I(W,{key:1},[($(!0),I(W,null,ut(e.profile.groups,o=>($(),I("span",{key:o,class:"m-badge"},E(o),1))),128)),e.profile.groups.length?ee("",!0):($(),I("span",Na,E(p(A)("Not in a group yet")),1))],64))])]),e.profile.themes.length?($(),I("fieldset",Fa,[y("legend",ja,E(p(A)("Look")),1),y("div",Da,[($(!0),I(W,null,ut(e.profile.themes,o=>($(),I("label",{key:o.key,class:ft(["flex cursor-pointer items-center gap-2 rounded-lg border px-3 py-2 text-sm",p(s).values.theme===o.key?"border-brand":"border-line"])},[ce(y("input",{"onUpdate:modelValue":l=>p(s).values.theme=l,type:"radio",name:"theme",value:o.key,class:"sr-only"},null,8,ka),[[uc,p(s).values.theme]]),y("span",La,[($(),I(W,null,ut(["ink","panel","brand"],l=>y("span",{key:l,class:"h-4 w-4 border border-line",style:es({background:o.colors[l]})},null,4)),64))]),Re(" "+E(o.label),1)],2))),128))]),p(s).errors.theme?($(),I("p",Va,E(p(s).errors.theme),1)):ee("",!0)])):ee("",!0),y("fieldset",Ua,[y("legend",Ha,E(p(A)("New password")),1),y("p",Ka,E(p(A)("Leave empty to keep the password you have.")),1),y("div",null,[y("label",Ba,E(p(A)("Current password")),1),ce(y("input",{id:"current_password","onUpdate:modelValue":i[1]||(i[1]=o=>p(s).values.current_password=o),type:"password",class:"m-input",autocomplete:"current-password"},null,512),[[ve,p(s).values.current_password]]),p(s).errors.current_password?($(),I("p",Wa,E(p(s).errors.current_password),1)):ee("",!0)]),y("div",null,[y("label",qa,E(p(A)("New password")),1),ce(y("input",{id:"password","onUpdate:modelValue":i[2]||(i[2]=o=>p(s).values.password=o),type:"password",minlength:"12",maxlength:"200",class:"m-input",autocomplete:"new-password"},null,512),[[ve,p(s).values.password]]),y("p",za,E(p(A)("At least 12 characters.")),1),p(s).errors.password?($(),I("p",Ga,E(p(s).errors.password),1)):ee("",!0)]),y("div",null,[y("label",Ja,E(p(A)("New password, once more")),1),ce(y("input",{id:"password_confirmation","onUpdate:modelValue":i[3]||(i[3]=o=>p(s).values.password_confirmation=o),type:"password",maxlength:"200",class:"m-input",autocomplete:"new-password"},null,512),[[ve,p(s).values.password_confirmation]])])]),y("button",{type:"submit",class:"m-btn m-btn-primary",disabled:p(s).busy},E(p(s).busy?p(A)("Saving…"):p(A)("Save")),9,Ya)],32)],64))}}),Za=[{pattern:/^\/?$/,component:Tc,data:!0},{pattern:/^\/login$/,component:Uc,guest:!0},{pattern:/^\/profile$/,component:Xa,data:!0},{pattern:/^\/posts$/,component:Ta,data:!0},{pattern:/^\/posts\/create$/,component:xr,data:!0},{pattern:/^\/posts\/\d+\/edit$/,component:xr,data:!0}],ne=ts({path:"",component:null,props:{},loading:!0,forbidden:!1,toast:null});let vr;function Ls(e,t=!1){ne.toast={text:e,error:t},window.clearTimeout(vr),vr=window.setTimeout(()=>ne.toast=null,4e3)}function Qa(e){return e.split("?")[0].slice(k.base.length)||"/"}async function Es(e){const t=Za.find(s=>s.pattern.test(Qa(e)));if(!k.user&&!t?.guest){window.location.assign(k.base+"/login");return}if(k.user&&t?.guest)return Mn(k.base,!0);ne.loading=!0,ne.forbidden=!1,ne.path=e,ne.component=t?.component??Oc,ne.props={};try{ne.props=t?.data?await Qt.get(e):{}}catch(s){s instanceof Ts&&s.status===401?window.location.assign(k.base+"/login"):s instanceof Ts&&s.status===403?ne.forbidden=!0:Ls(A("Something went wrong. Try again."),!0)}finally{ne.loading=!1}}function Mn(e,t=!1){return window.history[t?"replaceState":"pushState"]({},"",e),window.scrollTo(0,0),Es(e)}function wr(){return Es(ne.path)}function eu(){window.addEventListener("popstate",()=>Es(window.location.pathname+window.location.search)),Es(window.location.pathname+window.location.search)}const tu={class:"min-h-screen"},su={class:"fixed inset-x-0 top-0 z-40 flex h-14 items-center justify-between border-b border-line bg-panel px-4 md:hidden"},nu={class:"font-display font-bold"},ru=["aria-expanded"],iu={class:"hidden h-16 items-center gap-2 px-5 md:flex"},ou=["src"],lu={class:"font-display text-lg font-bold"},cu={class:"flex-1 space-y-0.5 overflow-y-auto px-3 py-3","aria-label":"Manager"},au={class:"border-t border-line p-4"},uu={class:"truncate text-sm font-semibold group-hover:text-brand"},fu={class:"truncate text-xs text-muted"},du={class:"px-4 pb-16 pt-20 md:ml-60 md:px-8 md:pt-8"},pu={class:"mx-auto max-w-5xl"},hu=it({__name:"Layout",setup(e){const t=vo(!1),s=Ni(()=>[{label:"Dashboard",href:k.base},...k.navigation]);function n(i){const o=ne.path.split("?")[0];return i===k.base?o===i:o===i||o.startsWith(i+"/")}async function r(){const{redirect:i}=await Qt.post(k.base+"/logout");window.location.assign(i)}return ms(()=>ne.path,()=>t.value=!1),(i,o)=>($(),I("div",tu,[y("header",su,[y("span",nu,E(p(k).name),1),y("button",{type:"button",class:"m-btn m-btn-secondary","aria-expanded":t.value,onClick:o[0]||(o[0]=l=>t.value=!t.value)},E(p(A)("Menu")),9,ru)]),y("aside",{class:ft(["fixed inset-y-0 left-0 z-30 flex w-60 flex-col border-r border-line bg-panel pt-14 transition-transform md:translate-x-0 md:pt-0",t.value?"translate-x-0":"-translate-x-full"])},[y("div",iu,[p(k).logo?($(),I("img",{key:0,src:p(k).logo,alt:"",class:"h-7 w-auto"},null,8,ou)):ee("",!0),y("span",lu,E(p(k).name),1)]),y("nav",cu,[($(!0),I(W,null,ut(s.value,l=>($(),qe(wt,{key:l.href,href:l.href,class:ft(["block rounded-lg px-3 py-2 text-sm font-medium transition",n(l.href)?"bg-brand/15 text-text":"text-muted hover:bg-text/5 hover:text-text"]),"aria-current":n(l.href)?"page":void 0},{default:rt(()=>[Re(E(p(A)(l.label)),1)]),_:2},1032,["href","class","aria-current"]))),128))]),y("div",au,[Te(wt,{href:p(k).base+"/profile",class:"group block"},{default:rt(()=>[y("p",uu,E(p(k).user?.name),1),y("p",fu,E(p(k).user?.email),1)]),_:1},8,["href"]),y("button",{type:"button",class:"m-btn m-btn-secondary mt-3 w-full justify-center",onClick:r},E(p(A)("Log out")),1)])],2),t.value?($(),I("div",{key:0,class:"fixed inset-0 z-20 bg-black/60 md:hidden",onClick:o[1]||(o[1]=l=>t.value=!1)})):ee("",!0),y("main",du,[y("div",pu,[ci(i.$slots,"default")])])]))}}),gu={key:0,class:"m-card p-5 text-sm"},mu={key:1,class:"text-sm text-muted"},_u=it({__name:"App",setup(e){return(t,s)=>($(),I(W,null,[p(ne).component&&!p(k).user?($(),qe(Jn(p(ne).component),{key:0})):p(ne).component?($(),qe(hu,{key:1},{default:rt(()=>[p(ne).forbidden?($(),I("p",gu,E(p(A)("You may not open this page.")),1)):p(ne).loading?($(),I("p",mu,E(p(A)("Loading…")),1)):($(),qe(Jn(p(ne).component),Ji(Ai({key:2},p(ne).props)),null,16))]),_:1})):ee("",!0),p(ne).toast?($(),I("div",{key:2,role:"status",class:ft(["fixed bottom-5 right-5 z-50 rounded-lg border border-l-4 border-line bg-panel px-4 py-3 text-sm font-medium text-text shadow-xl",p(ne).toast.error?"border-l-red-500":"border-l-emerald-500"])},E(p(ne).toast.text),3)):ee("",!0)],64))}});xc(k.locale);gc(_u).mount("#manager");eu(); diff --git a/resources/views/shell.blade.php b/resources/views/shell.blade.php new file mode 100644 index 0000000..3ff5eb3 --- /dev/null +++ b/resources/views/shell.blade.php @@ -0,0 +1,17 @@ + + + + + + + {{ $title }} + {{-- The theme: values were checked by IriksIT\Manager\Support\Themes, nothing else goes in here. --}} + + + + +
+ + + + diff --git a/routes/guest.php b/routes/guest.php new file mode 100644 index 0000000..e12743a --- /dev/null +++ b/routes/guest.php @@ -0,0 +1,10 @@ +name('assets')->where('file', '[a-z.]+'); +Route::get('/login', fn () => abort(404))->name('login'); // the shell answers browsers before this runs +Route::post('/login', [LoginController::class, 'store'])->name('login.store')->middleware('throttle:manager-login'); diff --git a/routes/manager.php b/routes/manager.php index 752ce8f..7283459 100644 --- a/routes/manager.php +++ b/routes/manager.php @@ -2,5 +2,10 @@ use Illuminate\Support\Facades\Route; use IriksIT\Manager\Http\Controllers\DashboardController; +use IriksIT\Manager\Http\Controllers\LoginController; +use IriksIT\Manager\Http\Controllers\ProfileController; Route::get('/', DashboardController::class)->name('dashboard'); +Route::get('/profile', [ProfileController::class, 'show'])->name('profile.show'); +Route::put('/profile', [ProfileController::class, 'update'])->name('profile.update'); +Route::post('/logout', [LoginController::class, 'destroy'])->name('logout'); diff --git a/src/Console/DoctorCommand.php b/src/Console/DoctorCommand.php index 2404fcc..b5f0231 100644 --- a/src/Console/DoctorCommand.php +++ b/src/Console/DoctorCommand.php @@ -67,6 +67,13 @@ class DoctorCommand extends Command $this->add('user_model', 'ok', "The user model is {$model}."); + $guard = config('auth.defaults.guard'); + $loggedIn = config('auth.providers.'.config("auth.guards.{$guard}.provider").'.model'); + + if (is_string($loggedIn) && $loggedIn !== $model && ! is_subclass_of($loggedIn, $model) && ! is_subclass_of($model, $loggedIn)) { + $this->add('auth_model', 'fail', "People log in as {$loggedIn} (config/auth.php), but manager.user_model is {$model}: the manager would not know their rights.", 'Point manager.user_model (MANAGER_USER_MODEL) at the same model as the auth provider.'); + } + if (! in_array(HasManagerAccess::class, class_uses_recursive($model), true)) { $this->add('user_trait', 'fail', "{$model} does not use HasManagerAccess.", "Add `use \\IriksIT\\Manager\\Concerns\\HasManagerAccess;` inside the class {$model}."); @@ -111,9 +118,13 @@ class DoctorCommand extends Command ? $this->add('routes', 'ok', 'The manager routes are registered under /'.trim((string) config('manager.path'), '/').'.') : $this->add('routes', 'fail', 'The manager routes are not registered.', 'Run `composer dump-autoload` and make sure the package service provider is discovered (not in dont-discover).'); - Route::has('login') - ? $this->add('login', 'ok', 'The app has a login route.') - : $this->add('login', 'warn', 'The app has no route named `login`: the auth middleware has nowhere to send visitors.', 'Add a login to the app (for example a starter kit), or change manager.middleware.'); + if (Route::has('login')) { + $this->add('login', 'ok', 'The app has a login route.'); + } elseif (Route::has('manager.login')) { + $this->add('login', 'ok', 'The app has no login of its own: visitors use the login of the manager.'); + } else { + $this->add('login', 'warn', 'There is no login: the auth middleware has nowhere to send visitors.', 'Set MANAGER_UI=package (the manager brings a login), or add a login to the app.'); + } } private function checkModules(ModuleRegistry $modules): void diff --git a/src/Console/MakeThemeCommand.php b/src/Console/MakeThemeCommand.php new file mode 100644 index 0000000..5bd6920 --- /dev/null +++ b/src/Console/MakeThemeCommand.php @@ -0,0 +1,95 @@ +argument('key'); + + if (! preg_match('/^[a-z0-9][a-z0-9-]{0,40}$/', $key)) { + $this->error('The key may only hold lowercase letters, numbers and dashes.'); + + return self::FAILURE; + } + + $raw = [ + 'label' => $this->option('label') ?: ucfirst($key), + 'scheme' => $this->option('light') ? 'light' : 'dark', + 'name' => $this->option('name'), + 'logo' => $this->option('logo'), + 'font' => $this->option('font'), + 'font_display' => $this->option('font-display'), + 'radius' => $this->option('radius'), + 'colors' => array_filter([ + 'brand' => $this->option('brand'), 'brand_alt' => $this->option('brand-alt'), 'ink' => $this->option('ink'), + 'panel' => $this->option('panel'), 'text' => $this->option('text'), + ]), + ]; + + // What the manager would accept: tell what was thrown away instead of silently writing a different theme. + $clean = $themes->sanitize($key, $raw); + $rejected = []; + + foreach ($raw['colors'] as $name => $value) { + ($clean['colors'][$name] ?? null) === $value || $rejected[] = $name.' ('.$value.')'; + } + + foreach (['radius', 'font', 'font_display', 'logo'] as $option) { + $raw[$option] !== null && ($clean[$option] ?? null) !== $raw[$option] && $rejected[] = $option.' ('.$raw[$option].')'; + } + + if ($rejected !== []) { + $this->error('Not accepted: '.implode(', ', $rejected).'. Colours are #rgb or #rrggbb; no quotes or semicolons in fonts.'); + + return self::FAILURE; + } + + $folder = $this->option('path') ?: (config('manager.themes_path') ?: resource_path('manager-themes')); + $file = rtrim($folder, '/')."/{$key}.json"; + + if (file_exists($file) && ! $this->option('force')) { + $this->error("{$file} exists. Use --force to overwrite it."); + + return self::FAILURE; + } + + is_dir($folder) || mkdir($folder, 0775, true); + $out = array_filter(['label' => $clean['label'], 'scheme' => $clean['scheme'], 'name' => $clean['name'], 'logo' => $clean['logo'], 'font' => $clean['font'], 'font_display' => $clean['font_display'], 'radius' => $clean['radius'], 'colors' => $clean['colors']], fn ($value) => $value !== null); + file_put_contents($file, json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)."\n"); + + $this->info("Wrote {$file}. Everyone sees it with MANAGER_THEME={$key}; each account can pick it in its profile."); + + return self::SUCCESS; + } +} diff --git a/src/Http/Controllers/AssetController.php b/src/Http/Controllers/AssetController.php new file mode 100644 index 0000000..600dd93 --- /dev/null +++ b/src/Http/Controllers/AssetController.php @@ -0,0 +1,22 @@ + 'application/javascript', 'manager.css' => 'text/css']; + + public function __invoke(string $file): BinaryFileResponse + { + abort_unless(isset(self::FILES[$file]) && is_file($path = __DIR__.'/../../../resources/dist/'.$file), 404); + + return response()->file($path, [ + 'Content-Type' => self::FILES[$file], + 'Cache-Control' => 'public, max-age=31536000, immutable', + 'X-Content-Type-Options' => 'nosniff', + ]); + } +} diff --git a/src/Http/Controllers/DashboardController.php b/src/Http/Controllers/DashboardController.php index bdec53b..810882b 100644 --- a/src/Http/Controllers/DashboardController.php +++ b/src/Http/Controllers/DashboardController.php @@ -15,6 +15,13 @@ class DashboardController fn (array $item) => $request->user()?->can($item['permission']), )); + if ($request->wantsJson()) { + return response()->json(['navigation' => array_map( + fn (array $item) => ['label' => $item['label'], 'href' => route($item['route'], [], false)], + $navigation, + )]); + } + return view('manager::dashboard', ['navigation' => $navigation]); } } diff --git a/src/Http/Controllers/LoginController.php b/src/Http/Controllers/LoginController.php new file mode 100644 index 0000000..d6614b9 --- /dev/null +++ b/src/Http/Controllers/LoginController.php @@ -0,0 +1,38 @@ +validate([ + 'email' => ['required', 'string', 'email', 'max:255'], + 'password' => ['required', 'string', 'max:200'], + ]); + + if (! Auth::attempt($credentials, $request->boolean('remember'))) { + throw ValidationException::withMessages(['email' => trans('auth.failed')]); + } + + $request->session()->regenerate(); + + return response()->json(['redirect' => '/'.trim((string) config('manager.path'), '/')]); + } + + public function destroy(Request $request): JsonResponse + { + Auth::guard()->logout(); + $request->session()->invalidate(); + $request->session()->regenerateToken(); + + return response()->json(['redirect' => Route::has('manager.login') ? route('manager.login', [], false) : '/']); + } +} diff --git a/src/Http/Controllers/ProfileController.php b/src/Http/Controllers/ProfileController.php new file mode 100644 index 0000000..98662a9 --- /dev/null +++ b/src/Http/Controllers/ProfileController.php @@ -0,0 +1,58 @@ +user(); + + return response()->json(['profile' => [ + 'name' => (string) $user->name, + 'email' => (string) $user->email, + 'is_super_admin' => method_exists($user, 'isManagerSuperAdmin') && $user->isManagerSuperAdmin(), + 'groups' => method_exists($user, 'managerGroups') ? $user->managerGroups()->pluck('name')->values() : [], + 'theme' => $themes->keyFor($user), + 'themes' => config('manager.user_themes') + ? collect($themes->all())->map(fn (array $theme, string $key) => ['key' => $key, 'label' => $theme['label'], 'colors' => $theme['colors']])->values() + : [], + ]]); + } + + public function update(Request $request, Themes $themes): JsonResponse + { + $user = $request->user(); + app(AuditTrail::class)->about($user); + + $data = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'current_password' => ['nullable', 'string', 'max:200'], + 'password' => ['nullable', 'string', 'min:12', 'max:200', 'confirmed'], + 'theme' => ['nullable', 'string', Rule::in(array_keys($themes->all()))], + ]); + + if (($data['password'] ?? '') !== '' && ! Hash::check((string) ($data['current_password'] ?? ''), $user->getAuthPassword())) { + return response()->json(['message' => 'The current password is not right.', 'errors' => ['current_password' => ['The current password is not right.']]], 422); + } + + $user->name = $data['name']; + ($data['password'] ?? '') !== '' && $user->password = Hash::make($data['password']); + $user->save(); + + if (config('manager.user_themes') && $request->has('theme')) { + UserSetting::query()->updateOrCreate(['user_id' => $user->getKey()], ['theme' => $data['theme'] ?: null]); + } + + return response()->json(['saved' => true]); + } +} diff --git a/src/Http/Middleware/Authenticate.php b/src/Http/Middleware/Authenticate.php new file mode 100644 index 0000000..5b990fd --- /dev/null +++ b/src/Http/Middleware/Authenticate.php @@ -0,0 +1,20 @@ +expectsJson()) { + return null; + } + + return Route::has('login') ? route('login') : (Route::has('manager.login') ? route('manager.login') : null); + } +} diff --git a/src/Http/Middleware/ServeShell.php b/src/Http/Middleware/ServeShell.php new file mode 100644 index 0000000..574e2da --- /dev/null +++ b/src/Http/Middleware/ServeShell.php @@ -0,0 +1,31 @@ +isMethodSafe() || $request->wantsJson() || $request->ajax()) { + return $next($request); + } + + $name = (string) $request->route()?->getName(); + + if ($name === 'manager.assets' || str_ends_with($name, '.export')) { + return $next($request); + } + + return response()->view('manager::shell', app(Shell::class)->data($request)); + } +} diff --git a/src/ManagerServiceProvider.php b/src/ManagerServiceProvider.php index 56cfa93..eca5548 100644 --- a/src/ManagerServiceProvider.php +++ b/src/ManagerServiceProvider.php @@ -2,7 +2,10 @@ namespace IriksIT\Manager; +use Illuminate\Cache\RateLimiting\Limit; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; +use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; use IriksIT\Manager\Support\ModuleRegistry; @@ -32,6 +35,11 @@ class ManagerServiceProvider extends ServiceProvider $this->publishes([__DIR__.'/../config/manager.php' => config_path('manager.php')], 'manager-config'); $this->loadViewsFrom(__DIR__.'/../resources/views', 'manager'); + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); + + $this->app['router']->aliasMiddleware('manager.auth', Http\Middleware\Authenticate::class); + $this->app['router']->aliasMiddleware('manager.shell', Http\Middleware\ServeShell::class); + RateLimiter::for('manager-login', fn (Request $request) => Limit::perMinute(5)->by(strtolower((string) $request->input('email')).'|'.$request->ip())); foreach ($modules->active() as $module) { if ($module->migrations() !== null) { @@ -46,7 +54,7 @@ class ManagerServiceProvider extends ServiceProvider } if ($this->app->runningInConsole()) { - $this->commands([Console\InstallCommand::class, Console\DoctorCommand::class]); + $this->commands([Console\InstallCommand::class, Console\DoctorCommand::class, Console\MakeThemeCommand::class]); } $this->registerGates($modules); @@ -68,7 +76,17 @@ class ManagerServiceProvider extends ServiceProvider private function registerRoutes(ModuleRegistry $modules): void { - Route::middleware([...$modules->middleware('before'), ...config('manager.middleware'), ...$modules->middleware('after')]) + $screens = config('manager.ui') === 'package'; + + if ($screens) { + // Outside `auth`, but behind the bans of the modules. + Route::middleware(['web', ...$modules->middleware('before'), 'manager.shell']) + ->prefix(config('manager.path')) + ->name('manager.') + ->group(fn () => $this->loadRoutesFrom(__DIR__.'/../routes/guest.php')); + } + + Route::middleware([...$modules->middleware('before'), ...config('manager.middleware'), ...($screens ? ['manager.shell'] : []), ...$modules->middleware('after')]) ->prefix(config('manager.path')) ->name('manager.') ->group(function () use ($modules) { diff --git a/src/Models/UserSetting.php b/src/Models/UserSetting.php new file mode 100644 index 0000000..0e18a5b --- /dev/null +++ b/src/Models/UserSetting.php @@ -0,0 +1,16 @@ + ['Changed own account']]; foreach ($this->active() as $module) { $actions = [...$actions, ...$module->actions()]; @@ -162,7 +162,7 @@ final class ModuleRegistry /** @return array */ public function views(): array { - $views = ['dashboard' => 'Opened the dashboard']; + $views = ['dashboard' => 'Opened the dashboard', 'profile.show' => 'Opened own account']; foreach ($this->active() as $module) { $views = [...$views, ...$module->views()]; diff --git a/src/Support/Shell.php b/src/Support/Shell.php new file mode 100644 index 0000000..36ba347 --- /dev/null +++ b/src/Support/Shell.php @@ -0,0 +1,54 @@ +, css: string, scripts: string, styles: string} */ + public function data(Request $request): array + { + $user = $request->user(); + $key = $this->themes->keyFor($user); + $theme = $this->themes->all()[$key]; + $dist = __DIR__.'/../../resources/dist'; + + $allowed = $user === null ? [] : array_values(array_filter( + [...$this->modules->permissionValues(), ManagerServiceProvider::MANAGE_GROUPS], + fn (string $permission) => Gate::forUser($user)->allows($permission), + )); + + $navigation = $user === null ? [] : array_values(array_map( + fn (array $item) => ['label' => $item['label'], 'href' => route($item['route'], [], false)], + array_filter($this->modules->navigation(), fn (array $item) => in_array($item['permission'], $allowed, true)), + )); + + return [ + 'css' => $this->themes->css($theme), + 'title' => $theme['name'] ?? config('manager.name') ?? config('app.name', 'Manager'), + 'version' => is_file($dist.'/manager.js') ? substr(md5_file($dist.'/manager.js').md5_file($dist.'/manager.css'), 0, 10) : 'dev', + 'boot' => [ + 'base' => '/'.trim((string) config('manager.path'), '/'), + 'name' => $theme['name'] ?? config('manager.name') ?? config('app.name', 'Manager'), + 'logo' => $theme['logo'], + 'locale' => app()->getLocale(), + 'user' => $user === null ? null : [ + 'name' => (string) ($user->name ?? ''), + 'email' => (string) ($user->email ?? ''), + 'is_super_admin' => method_exists($user, 'isManagerSuperAdmin') && $user->isManagerSuperAdmin(), + ], + 'permissions' => $allowed, + 'navigation' => $navigation, + 'theme' => $key, + 'can_login' => Route::has('manager.login'), + ], + ]; + } +} diff --git a/src/Support/Themes.php b/src/Support/Themes.php new file mode 100644 index 0000000..fd665b1 --- /dev/null +++ b/src/Support/Themes.php @@ -0,0 +1,128 @@ + ['label' => 'Dark', 'scheme' => 'dark', 'colors' => [ + 'ink' => '#0a0a12', 'panel' => '#12121d', 'panel2' => '#191927', 'line' => '#26263a', + 'muted' => '#a3a3b8', 'text' => '#f4f4f8', 'brand' => '#f43676', 'brand_alt' => '#ff6b9d', + ]], + 'light' => ['label' => 'Light', 'scheme' => 'light', 'colors' => [ + 'ink' => '#f4f6f8', 'panel' => '#ffffff', 'panel2' => '#eceff3', 'line' => '#d9dee5', + 'muted' => '#5d6a73', 'text' => '#192c27', 'brand' => '#009ba3', 'brand_alt' => '#007c83', + ]], + ]; + + /** @return array> */ + public function all(): array + { + $themes = self::BUILT_IN; + + foreach ((array) config('manager.themes', []) as $key => $theme) { + $themes[(string) $key] = $theme; + } + + $path = config('manager.themes_path') ?: (function_exists('resource_path') ? resource_path('manager-themes') : null); + + foreach ($path && is_dir($path) ? glob($path.'/*.json') : [] as $file) { + $theme = json_decode((string) file_get_contents($file), true); + + if (is_array($theme)) { + $themes[basename($file, '.json')] = $theme; + } + } + + $clean = []; + + foreach ($themes as $key => $theme) { + if (preg_match('/^[a-z0-9][a-z0-9-]{0,40}$/', (string) $key) && ($safe = $this->sanitize($key, $theme))) { + $clean[$key] = $safe; + } + } + + return $clean; + } + + /** The key of the theme this account sees: its own choice when allowed, else the site's. */ + public function keyFor(?object $user): string + { + $all = $this->all(); + $default = array_key_exists(config('manager.theme'), $all) ? config('manager.theme') : 'dark'; + + if ($user !== null && config('manager.user_themes') && $user->getKey() !== null) { + $chosen = UserSetting::query()->where('user_id', $user->getKey())->value('theme'); + + if ($chosen !== null && isset($all[$chosen])) { + return $chosen; + } + } + + return $default; + } + + /** @return array|null */ + public function sanitize(string $key, mixed $theme): ?array + { + if (! is_array($theme)) { + return null; + } + + $base = self::BUILT_IN[($theme['scheme'] ?? 'dark') === 'light' ? 'light' : 'dark']; + $colors = $base['colors']; + + foreach (self::COLORS as $name) { + $value = $theme['colors'][$name] ?? null; + + if (is_string($value) && preg_match('/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/', $value)) { + $colors[$name] = $value; + } + } + + $radius = $theme['radius'] ?? '0.5rem'; + $font = $theme['font'] ?? null; + $display = $theme['font_display'] ?? null; + $logo = $theme['logo'] ?? null; + $name = $theme['name'] ?? null; + $label = $theme['label'] ?? ucfirst(str_replace('-', ' ', $key)); + + return [ + 'label' => is_string($label) ? mb_substr(strip_tags($label), 0, 60) : $key, + 'scheme' => $base['scheme'], + 'colors' => $colors, + 'radius' => is_string($radius) && preg_match('/^\d{1,2}(\.\d{1,2})?(px|rem)$/', $radius) ? $radius : '0.5rem', + 'font' => is_string($font) && preg_match('/^[\w ,\'"-]{1,120}$/', $font) ? $font : null, + 'font_display' => is_string($display) && preg_match('/^[\w ,\'"-]{1,120}$/', $display) ? $display : null, + 'logo' => is_string($logo) && preg_match('#^(/|https://)[\w\-./%~]{1,300}$#', $logo) ? $logo : null, + 'name' => is_string($name) ? mb_substr(strip_tags($name), 0, 80) : null, + ]; + } + + /** The CSS variables of one theme, ready for a style block (values are already checked). */ + public function css(array $theme): string + { + $vars = []; + + foreach ($theme['colors'] as $name => $value) { + $vars[] = '--m-'.str_replace('_', '-', $name).':'.$value; + } + + $vars[] = '--m-radius:'.$theme['radius']; + $theme['font'] && $vars[] = '--m-font:'.$theme['font']; + $theme['font_display'] && $vars[] = '--m-font-display:'.$theme['font_display']; + $vars[] = 'color-scheme:'.$theme['scheme']; + + return ':root{'.implode(';', $vars).'}'; + } +} diff --git a/tests/Feature/AuditTest.php b/tests/Feature/AuditTest.php index 54555b5..4d22681 100644 --- a/tests/Feature/AuditTest.php +++ b/tests/Feature/AuditTest.php @@ -46,7 +46,8 @@ describe('what is switched on', function () { ->map(fn ($route) => $route->getName()) ->filter(fn ($name) => is_string($name) && str_starts_with($name, 'manager.')) ->map(fn ($name) => substr($name, 8)) - ->reject(fn ($name) => in_array($name, $labelled, true)) + // The login and the built files are outside `auth` (nobody is known there); a logout is logged by Laravel's Logout event. + ->reject(fn ($name) => in_array($name, [...$labelled, 'assets', 'login', 'login.store', 'logout'], true)) ->values()->all(); expect($missing)->toBe([]); diff --git a/tests/Feature/DoctorTest.php b/tests/Feature/DoctorTest.php index 234819d..8dc5077 100644 --- a/tests/Feature/DoctorTest.php +++ b/tests/Feature/DoctorTest.php @@ -6,6 +6,10 @@ use IriksIT\Manager\Tests\TestCase; uses(TestCase::class); +// The installer publishes the config into the app, here the skeleton in vendor/: leave it as it was. +beforeEach(fn () => $this->hadConfig = file_exists(config_path('manager.php'))); +afterEach(fn () => $this->hadConfig || @unlink(config_path('manager.php'))); + function doctorReport(): array { Artisan::call('manager:doctor', ['--json' => true]); diff --git a/tests/Feature/ScreensTest.php b/tests/Feature/ScreensTest.php new file mode 100644 index 0000000..5a7f23b --- /dev/null +++ b/tests/Feature/ScreensTest.php @@ -0,0 +1,127 @@ + 'Ann', 'email' => 'ann@example.com', 'password' => Hash::make('a-long-enough-password')]); + $user->forceFill(['is_super_admin' => true])->save(); + test()->actingAs($user); + + return $user; +} + +it('gives a browser the shell and a script the data', function () { + signedIn(); + + $this->get('/manager/posts')->assertOk()->assertSee('id="manager"', false)->assertSee('"navigation"', false); + $this->getJson('/manager/posts')->assertOk()->assertJsonStructure(['posts']); +}); + +it('sends a guest to the login of the manager when the app has none', function () { + $this->get('/manager/posts')->assertRedirect('/manager/login'); + $this->getJson('/manager/posts')->assertUnauthorized(); + $this->get('/manager/login')->assertOk()->assertSee('"user":null', false); +}); + +it('logs in and out through the JSON routes', function () { + User::create(['name' => 'Ann', 'email' => 'ann@example.com', 'password' => Hash::make('a-long-enough-password')]); + + $this->postJson('/manager/login', ['email' => 'ann@example.com', 'password' => 'wrong'])->assertUnprocessable()->assertJsonValidationErrors('email'); + $this->postJson('/manager/login', ['email' => 'ann@example.com', 'password' => 'a-long-enough-password'])->assertOk()->assertJson(['redirect' => '/manager']); + $this->assertAuthenticated(); + $this->postJson('/manager/logout')->assertOk(); + $this->assertGuest(); +}); + +it('serves only the two built files', function () { + $this->get('/manager/_assets/manager.css')->assertOk()->assertHeader('X-Content-Type-Options', 'nosniff'); + $this->get('/manager/_assets/secret.php')->assertNotFound(); +}); + +it('has no screens when the app builds its own', function () { + config(['manager.ui' => 'none']); + + expect(Route::has('manager.login'))->toBeTrue(); // routes were registered at boot; the shell stays out of the way + signedIn(); + $this->get('/manager/posts')->assertOk()->assertJsonStructure(['posts']); +}); + +describe('themes', function () { + it('lets an account choose a theme, and only a known one', function () { + $user = signedIn(); + + $this->putJson('/manager/profile', ['name' => 'Ann', 'theme' => 'light'])->assertOk(); + expect(UserSetting::where('user_id', $user->id)->value('theme'))->toBe('light'); + $this->get('/manager')->assertSee('--m-brand:#009ba3', false); + + $this->putJson('/manager/profile', ['name' => 'Ann', 'theme' => 'nope'])->assertUnprocessable(); + }); + + it('ignores the choice when the site switched it off', function () { + config(['manager.user_themes' => false]); + $user = signedIn(); + UserSetting::create(['user_id' => $user->id, 'theme' => 'light']); + + expect(app(Themes::class)->keyFor($user))->toBe('dark'); + }); + + it('never lets a theme file put CSS or markup in the page', function () { + config(['manager.themes' => ['evil' => [ + 'colors' => ['brand' => 'red;}', 'ink' => '#123456'], + 'radius' => '1rem;}', 'font' => 'x', 'logo' => 'javascript:alert(1)', 'name' => 'Shop', + ]]]); + config(['manager.theme' => 'evil']); + signedIn(); + + $html = $this->get('/manager')->getContent(); + + expect($html)->not->toContain(' + + diff --git a/ui/src/api.ts b/ui/src/api.ts new file mode 100644 index 0000000..a22ffb8 --- /dev/null +++ b/ui/src/api.ts @@ -0,0 +1,88 @@ +import { reactive } from 'vue'; + +export class ApiError extends Error { + constructor(public status: number, public body: any) { + super(body?.message ?? `HTTP ${status}`); + } + + /** Validation errors by field, first message each. */ + get errors(): Record { + return Object.fromEntries(Object.entries(this.body?.errors ?? {}).map(([k, v]) => [k, (v as string[])[0]])); + } +} + +/** What the page was started with (see resources/views/shell.blade.php). */ +export interface Boot { + base: string; + name: string; + logo: string | null; + locale: string; + user: { name: string; email: string; is_super_admin: boolean } | null; + permissions: string[]; + navigation: { label: string; href: string }[]; + theme: string; + can_login: boolean; +} + +export const boot: Boot = JSON.parse(document.getElementById('manager-boot')!.textContent!); + +function xsrf(): string { + const match = document.cookie.match(/(?:^|; )XSRF-TOKEN=([^;]+)/); + + return match ? decodeURIComponent(match[1]) : ''; +} + +export async function request(method: string, path: string, body?: unknown): Promise { + const response = await fetch(path, { + method, + credentials: 'same-origin', + headers: { + Accept: 'application/json', + 'X-Requested-With': 'XMLHttpRequest', + 'X-XSRF-TOKEN': xsrf(), + ...(body === undefined ? {} : { 'Content-Type': 'application/json' }), + }, + body: body === undefined ? undefined : JSON.stringify(body), + }); + const data = response.status === 204 ? null : await response.json().catch(() => null); + + if (!response.ok) { + throw new ApiError(response.status, data); + } + + return data as T; +} + +export const api = { + get: (path: string) => request('GET', path), + post: (path: string, body: unknown = {}) => request('POST', path, body), + put: (path: string, body: unknown = {}) => request('PUT', path, body), + delete: (path: string) => request('DELETE', path), +}; + +/** A form: values, errors by field, a busy flag. */ +export function useForm>(initial: T) { + const form = reactive({ + values: { ...initial } as T, + errors: {} as Record, + busy: false, + async send(method: 'post' | 'put', path: string): Promise { + form.busy = true; + form.errors = {}; + try { + return await api[method](path, form.values); + } catch (error) { + if (error instanceof ApiError && error.status === 422) { + form.errors = error.errors; + + return null; + } + throw error; + } finally { + form.busy = false; + } + }, + }); + + return form; +} diff --git a/ui/src/components/Layout.vue b/ui/src/components/Layout.vue new file mode 100644 index 0000000..0ac63e1 --- /dev/null +++ b/ui/src/components/Layout.vue @@ -0,0 +1,67 @@ + + + diff --git a/ui/src/components/Link.vue b/ui/src/components/Link.vue new file mode 100644 index 0000000..149dd9b --- /dev/null +++ b/ui/src/components/Link.vue @@ -0,0 +1,18 @@ + + + diff --git a/ui/src/i18n.ts b/ui/src/i18n.ts new file mode 100644 index 0000000..deafdb2 --- /dev/null +++ b/ui/src/i18n.ts @@ -0,0 +1,29 @@ +// Two languages for now: English (the default) and Dutch, picked from the locale the app runs in. +const nl: Record = { + 'Dashboard': 'Dashboard', 'Log in': 'Inloggen', 'Log out': 'Uitloggen', 'Email': 'E-mailadres', 'Password': 'Wachtwoord', + 'Keep me logged in': 'Ingelogd blijven', 'Logging in…': 'Bezig met inloggen…', 'Log in to manage the site.': 'Log in om de site te beheren.', + 'My account': 'Mijn account', 'Name': 'Naam', 'Email address': 'E-mailadres', 'What you may do': 'Wat je mag', + 'Super admin: everything': 'Super admin: alles', 'Not in a group yet': 'Nog in geen groep', 'New password': 'Nieuw wachtwoord', + 'Leave empty to keep the password you have.': 'Laat leeg om je wachtwoord te houden.', 'Current password': 'Huidig wachtwoord', + 'At least 12 characters.': 'Minstens 12 tekens.', 'New password, once more': 'Nieuw wachtwoord, nogmaals', 'Save': 'Opslaan', + 'Saving…': 'Bezig met opslaan…', 'Saved.': 'Opgeslagen.', 'Look': 'Uiterlijk', 'Theme': 'Thema', 'Posts': 'Berichten', + 'New post': 'Nieuw bericht', 'Title': 'Titel', 'Status': 'Status', 'Category': 'Categorie', 'Edit': 'Bewerken', 'Delete': 'Verwijderen', + 'Put online': 'Online zetten', 'Take offline': 'Offline halen', 'Draft': 'Concept', 'Scheduled': 'Ingepland', 'Published': 'Gepubliceerd', + 'Are you sure?': 'Weet je het zeker?', 'No posts yet.': 'Nog geen berichten.', 'Address (slug)': 'Adres (slug)', 'Summary': 'Samenvatting', + 'Text (Markdown)': 'Tekst (Markdown)', 'Cover image': 'Omslagafbeelding', 'Tags (comma separated)': 'Tags (met komma\'s)', + 'Featured': 'Uitgelicht', 'Publish': 'Publiceren', 'Publish at': 'Publiceren op', 'Menu': 'Menu', 'Loading…': 'Laden…', + 'You may not open this page.': 'Je mag deze pagina niet openen.', 'Something went wrong. Try again.': 'Er ging iets mis. Probeer het opnieuw.', + 'This page has no screen in the manager yet.': 'Deze pagina heeft nog geen scherm in de manager.', 'Go to the dashboard': 'Naar het dashboard', + 'The page expired. Reload it and try again.': 'De pagina is verlopen. Laad hem opnieuw en probeer het nog eens.', 'Back': 'Terug', + 'Open': 'Openen', 'Created.': 'Aangemaakt.', 'Deleted.': 'Verwijderd.', +}; + +let words: Record = {}; + +export function setLocale(locale: string): void { + words = locale.toLowerCase().startsWith('nl') ? nl : {}; +} + +export function t(text: string): string { + return words[text] ?? text; +} diff --git a/ui/src/main.ts b/ui/src/main.ts new file mode 100644 index 0000000..745c36a --- /dev/null +++ b/ui/src/main.ts @@ -0,0 +1,10 @@ +import { createApp } from 'vue'; +import App from './App.vue'; +import { boot } from './api'; +import { setLocale } from './i18n'; +import { start } from './state'; +import './style.css'; + +setLocale(boot.locale); +createApp(App).mount('#manager'); +start(); diff --git a/ui/src/pages/Dashboard.vue b/ui/src/pages/Dashboard.vue new file mode 100644 index 0000000..05e5150 --- /dev/null +++ b/ui/src/pages/Dashboard.vue @@ -0,0 +1,17 @@ + + + diff --git a/ui/src/pages/Fallback.vue b/ui/src/pages/Fallback.vue new file mode 100644 index 0000000..2b2d3e4 --- /dev/null +++ b/ui/src/pages/Fallback.vue @@ -0,0 +1,12 @@ + + + diff --git a/ui/src/pages/Login.vue b/ui/src/pages/Login.vue new file mode 100644 index 0000000..ec22e81 --- /dev/null +++ b/ui/src/pages/Login.vue @@ -0,0 +1,43 @@ + + + diff --git a/ui/src/pages/PostForm.vue b/ui/src/pages/PostForm.vue new file mode 100644 index 0000000..4b23b6d --- /dev/null +++ b/ui/src/pages/PostForm.vue @@ -0,0 +1,85 @@ + + +