wizards 0.1.10 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/apps/runtime/dist/agents/architect.js +6 -4
- package/apps/runtime/dist/app.js +2 -0
- package/apps/runtime/dist/authoring/guide.js +10 -2
- package/apps/runtime/dist/cli/environment.js +5 -0
- package/apps/runtime/dist/cli/home.js +1 -0
- package/apps/runtime/dist/db/client.js +13 -0
- package/apps/runtime/dist/engine/runner.js +3 -0
- package/apps/runtime/dist/env.js +18 -4
- package/apps/runtime/dist/index.js +3 -0
- package/apps/runtime/dist/mcp/tools.js +2 -1
- package/apps/runtime/dist/plugins/discovery.js +144 -0
- package/apps/runtime/dist/plugins/events.js +40 -0
- package/apps/runtime/dist/plugins/loader.js +277 -0
- package/apps/runtime/dist/plugins/migrations.js +69 -0
- package/apps/runtime/dist/plugins/registry.js +105 -0
- package/apps/runtime/dist/routes/plugins.js +160 -0
- package/apps/runtime/dist/services/wizards.js +29 -3
- package/apps/runtime/dist/tools/index.js +2 -0
- package/apps/runtime/dist/tools/plugin.js +43 -0
- package/apps/web/dist/assets/ChangelogDialog-COqPzrKT.js +1 -0
- package/apps/web/dist/assets/{ChatPanel-BORDbEJt.js → ChatPanel-aQP8iz10.js} +1 -1
- package/apps/web/dist/assets/CreditsDialog-pRbTW7Xh.js +1 -0
- package/apps/web/dist/assets/EditorPage-xkq6pvw-.js +2 -0
- package/apps/web/dist/assets/FlowPreview-CDmcN1oX.js +1 -0
- package/apps/web/dist/assets/HomePage-DUAiS9pg.js +1 -0
- package/apps/web/dist/assets/ImportWizard-pzljVvcr.js +1 -0
- package/apps/web/dist/assets/{LocalRuntime-B33qoSb2.js → LocalRuntime-DPJMJlWc.js} +2 -2
- package/apps/web/dist/assets/NewWizardPage-TwYgdbKl.js +2 -0
- package/apps/web/dist/assets/PublicRunner-DoZdJuyW.js +1 -0
- package/apps/web/dist/assets/RunnerView-XKosfgO-.js +2 -0
- package/apps/web/dist/assets/SettingsPage-C0_peJuV.js +2 -0
- package/apps/web/dist/assets/SetupPage-BFQ0V__v.js +1 -0
- package/apps/web/dist/assets/SharePage-C1yg5bc2.js +1 -0
- package/apps/web/dist/assets/api-DijQGkp-.js +10 -0
- package/apps/web/dist/assets/{arrow-left-UpjOBfQp.js → arrow-left-hTN1VoH1.js} +1 -1
- package/apps/web/dist/assets/{arrow-right-CucQycEy.js → arrow-right-6FyN3e7D.js} +1 -1
- package/apps/web/dist/assets/changelog-sa4SXBrg.js +1 -0
- package/apps/web/dist/assets/check-CUpby_J9.js +1 -0
- package/apps/web/dist/assets/{createLucideIcon-DBu2Ovxj.js → createLucideIcon-q3MZMmnf.js} +1 -1
- package/apps/web/dist/assets/definition-DndaH5Ow.js +55 -0
- package/apps/web/dist/assets/engenty-Cm8yZLON.js +1 -0
- package/apps/web/dist/assets/esm-rJY59Ixx.js +7 -0
- package/apps/web/dist/assets/{external-link-CRg6DVdO.js → external-link-MAL7vJYj.js} +1 -1
- package/apps/web/dist/assets/{fluffy-engenty-CJ3wCQgT.js → fluffy-engenty-D7rFrNcJ.js} +2 -2
- package/apps/web/dist/assets/index-BAObuqzs.js +10 -0
- package/apps/web/dist/assets/index-BOl3401k.css +1 -0
- package/apps/web/dist/assets/jsx-runtime-D3jfb0Ew.js +1 -0
- package/apps/web/dist/assets/{meta-DmwCkikb.js → meta-ijlGGCOr.js} +1 -1
- package/apps/web/dist/assets/{mic-CeqQ89Dj.js → mic-Bvz4mA2j.js} +1 -1
- package/apps/web/dist/assets/{oss-credits-cPuZUFHD.js → oss-credits-ClwxOPrf.js} +1 -1
- package/apps/web/dist/assets/{outputs-BJ6FXJP6.js → outputs-37WFkpRS.js} +2 -2
- package/apps/web/dist/assets/{plus-HA210wXA.js → plus-Du-Jx8aI.js} +1 -1
- package/apps/web/dist/assets/react-dom-DenslgJm.js +1 -0
- package/apps/web/dist/assets/session-BerOchdC.js +1 -0
- package/apps/web/dist/assets/{type-BzYgVWKL.js → type-c_dt5Ne8.js} +1 -1
- package/apps/web/dist/assets/ui-DKc92qJ1.js +1 -0
- package/apps/web/dist/assets/{upload-DsgLfQ3U.js → upload--J5bZhEM.js} +1 -1
- package/apps/web/dist/assets/{video-Dk1fuTDl.js → video-CjgmvRDk.js} +1 -1
- package/apps/web/dist/assets/{wand-sparkles-Bf97fs8T.js → wand-sparkles-CKxArWPY.js} +1 -1
- package/apps/web/dist/index.html +9 -7
- package/apps/web/dist/install.sh +2 -3
- package/modules/README.md +15 -0
- package/node_modules/@engenty-wizards/plugin-sdk/dist/index.d.ts +144 -0
- package/node_modules/@engenty-wizards/plugin-sdk/dist/index.js +4 -0
- package/node_modules/@engenty-wizards/plugin-sdk/dist/studio.d.ts +80 -0
- package/node_modules/@engenty-wizards/plugin-sdk/dist/studio.js +4 -0
- package/node_modules/@engenty-wizards/plugin-sdk/package.json +10 -0
- package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +18 -6
- package/node_modules/@engenty-wizards/shared/dist/definition.js +22 -1
- package/package.json +5 -1
- package/apps/web/dist/assets/ChangelogDialog-UOklVDXF.js +0 -1
- package/apps/web/dist/assets/CreditsDialog-CLUOVBLG.js +0 -1
- package/apps/web/dist/assets/EditorPage-BM5yfvZ6.js +0 -2
- package/apps/web/dist/assets/FlowPreview-DIIeD1wY.js +0 -1
- package/apps/web/dist/assets/HomePage-BaVY5u1C.js +0 -1
- package/apps/web/dist/assets/ImportWizard-CD-tOsz2.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-B0jx_Ptd.js +0 -2
- package/apps/web/dist/assets/PublicRunner-Bj_gFWxk.js +0 -1
- package/apps/web/dist/assets/RunnerView-__E0Cpbc.js +0 -2
- package/apps/web/dist/assets/SettingsPage-DzhhUY31.js +0 -2
- package/apps/web/dist/assets/SetupPage-BSe-mh8G.js +0 -1
- package/apps/web/dist/assets/SharePage-Duany-Lu.js +0 -1
- package/apps/web/dist/assets/api-DbPn6Dge.js +0 -10
- package/apps/web/dist/assets/changelog-14GVP0cv.js +0 -1
- package/apps/web/dist/assets/check-Bjx41xbB.js +0 -1
- package/apps/web/dist/assets/definition-cy7uvY5L.js +0 -55
- package/apps/web/dist/assets/engenty-CWIFpgKq.js +0 -1
- package/apps/web/dist/assets/esm-Bk5dFCAD.js +0 -7
- package/apps/web/dist/assets/index-BYV0HYlP.js +0 -10
- package/apps/web/dist/assets/index-CQ_q9iMO.css +0 -1
- package/apps/web/dist/assets/jsx-runtime-Dk72oS4N.js +0 -1
- package/apps/web/dist/assets/ui-tO4ZXbfh.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/qr-scanner.min-C_UI0gH-.js","assets/preload-helper-CNEI7N0N.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-Dk72oS4N.js";import{c as r,d as i,n as a,t as o}from"./api-DbPn6Dge.js";import{t as s}from"./preload-helper-CNEI7N0N.js";import{t as c}from"./createLucideIcon-DBu2Ovxj.js";import{t as l}from"./arrow-left-UpjOBfQp.js";import{t as u}from"./arrow-right-CucQycEy.js";import{S as d,_ as f,a as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,l as x,m as S,o as C,p as w,s as T,t as E,u as D,v as O,x as ee,y as k}from"./outputs-BJ6FXJP6.js";import{t as A}from"./check-Bjx41xbB.js";import{n as j,t as M}from"./plus-HA210wXA.js";import{t as N}from"./external-link-CRg6DVdO.js";import{n as P,t as F}from"./mic-CeqQ89Dj.js";import{n as I,t as te}from"./video-Dk1fuTDl.js";import{d as ne,f as re,p as ie,u as ae}from"./definition-cy7uvY5L.js";import{c as L,d as R,f as oe,g as z,h as B,i as se,l as ce,m as le,n as ue,o as V,p as de,s as H,t as U,u as fe,v as W}from"./ui-tO4ZXbfh.js";import{u as G}from"./index-BYV0HYlP.js";var pe={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};pe.node;var me=c(pe),he={name:`bell-ring`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]};he.node;var ge=c(he),_e={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};_e.node;var ve=c(_e),ye={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};ye.node;var be=c(ye),xe={name:`corner-down-left`,size:24,node:[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]};xe.node;var Se=c(xe),Ce={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};Ce.node;var we=c(Ce),Te={name:`eraser`,size:24,node:[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]};Te.node;var Ee=c(Te),De={name:`file-headphone`,size:24,node:[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]],aliases:[`file-audio`,`file-audio-2`]};De.node;var Oe=c(De),ke={name:`flashlight-off`,size:24,node:[[`path`,{d:`M11.652 6H18`,key:`voqkpr`}],[`path`,{d:`M12 13v1`,key:`176q98`}],[`path`,{d:`M16 16v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-8a4 4 0 0 0-.8-2.4l-.6-.8A3 3 0 0 1 6 7V6`,key:`dzyf92`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M7.649 2H17a1 1 0 0 1 1 1v4a3 3 0 0 1-.6 1.8l-.6.8a4 4 0 0 0-.55 1.007`,key:`1hvcfn`}]]};ke.node;var Ae=c(ke),je={name:`flashlight`,size:24,node:[[`path`,{d:`M12 13v1`,key:`176q98`}],[`path`,{d:`M17 2a1 1 0 0 1 1 1v4a3 3 0 0 1-.6 1.8l-.6.8A4 4 0 0 0 16 12v8a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2v-8a4 4 0 0 0-.8-2.4l-.6-.8A3 3 0 0 1 6 7V3a1 1 0 0 1 1-1z`,key:`17vh7j`}],[`path`,{d:`M6 6h12`,key:`n6hhss`}]]};je.node;var Me=c(je),Ne={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};Ne.node;var Pe=c(Ne),Fe={name:`image-plus`,size:24,node:[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]};Fe.node;var Ie=c(Fe),Le={name:`image-up`,size:24,node:[[`path`,{d:`M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21`,key:`9csbqa`}],[`path`,{d:`m14 19.5 3-3 3 3`,key:`9vmjn0`}],[`path`,{d:`M17 22v-5.5`,key:`1aa6fl`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]};Le.node;var Re=c(Le),ze={name:`locate-fixed`,size:24,node:[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};ze.node;var Be=c(ze),Ve={name:`lock-keyhole`,size:24,node:[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]};Ve.node;var He=c(Ve),Ue={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};Ue.node;var We=c(Ue),Ge={name:`pencil-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]};Ge.node;var Ke=c(Ge),qe={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};qe.node;var Je=c(qe),Ye={name:`scan-line`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]};Ye.node;var Xe=c(Ye),Ze={name:`share-2`,size:24,node:[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]};Ze.node;var Qe=c(Ze),$e={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};$e.node;var et=c($e),tt={name:`switch-camera`,size:24,node:[[`path`,{d:`M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5`,key:`mtk2lu`}],[`path`,{d:`M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5`,key:`120jsl`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m18 22-3-3 3-3`,key:`kgdoj7`}],[`path`,{d:`m6 2 3 3-3 3`,key:`1fnbkv`}]]};tt.node;var nt=c(tt),rt={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};rt.node;var it=c(rt),at={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};at.node;var ot=c(at),K=e(t(),1),q=n();function st(e,t){let n=encodeURIComponent(e),r=encodeURIComponent(t);return[{id:`mail`,label:W(`shareRun.email`),href:`mailto:?subject=${r}&body=${r}%0A%0A${n}`},{id:`x`,label:`X`,href:`https://x.com/intent/post?text=${r}&url=${n}`},{id:`linkedin`,label:`LinkedIn`,href:`https://www.linkedin.com/sharing/share-offsite/?url=${n}`},{id:`whatsapp`,label:`WhatsApp`,href:`https://wa.me/?text=${r}%20${n}`},{id:`facebook`,label:`Facebook`,href:`https://www.facebook.com/sharer/sharer.php?u=${n}`}]}var ct={x:`𝕏`,linkedin:`in`,whatsapp:`WA`,facebook:`f`};function lt({runId:e,title:t,initial:n}){let[r,i]=(0,K.useState)(!1),[o,s]=(0,K.useState)(n),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null),h=async()=>{if(i(!0),!o){l(!0),p(null);try{s(await a.post(`/api/runs/${e}/share`))}catch(e){p(e.message)}finally{l(!1)}}},g=async()=>{await a.del(`/api/runs/${e}/share`),s(null),i(!1)},_=()=>{o&&(navigator.clipboard.writeText(o.url),d(!0),setTimeout(()=>d(!1),1500))},v=typeof navigator<`u`&&`share`in navigator,y=o?.expiresAt?new Intl.DateTimeFormat(z,{dateStyle:`long`}).format(new Date(o.expiresAt)):null;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(U,{variant:`secondary`,onClick:()=>void h(),children:[(0,q.jsx)(Qe,{className:`size-4`}),` `,W(`shareRun.button`)]}),(0,q.jsx)(se,{open:r,onClose:()=>i(!1),title:W(`shareRun.title`),children:c?(0,q.jsx)(`div`,{className:`flex justify-center py-8 text-ink-4`,children:(0,q.jsx)(R,{})}):f?(0,q.jsx)(`p`,{className:`rounded-lg bg-rose-tint px-3 py-2 text-[14px] text-rose`,children:f}):o?(0,q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-paper-2 p-1.5 pl-3`,children:[(0,q.jsx)(m,{className:`size-4 shrink-0 text-ink-3`}),(0,q.jsx)(`input`,{readOnly:!0,value:o.url,onFocus:e=>e.target.select(),"aria-label":W(`share.link`),className:`min-w-0 flex-1 bg-transparent text-[14px] outline-none coarse:h-11`}),(0,q.jsxs)(U,{size:`sm`,onClick:_,children:[u?(0,q.jsx)(A,{className:`size-3.5`}):(0,q.jsx)(j,{className:`size-3.5`}),W(u?`share.copied`:`share.copy`)]})]}),(0,q.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 sm:grid-cols-6`,children:[st(o.url,t).map(e=>(0,q.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`flex flex-col items-center gap-1.5 text-[12px] text-ink-2 hover:text-ink`,children:[(0,q.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-full bg-paper-2 font-semibold text-[15px] transition hover:bg-paper-3`,children:e.id===`mail`?(0,q.jsx)(k,{className:`size-5`}):ct[e.id]}),e.label]},e.id)),v?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>void navigator.share({title:t,url:o.url}).catch(()=>void 0),className:`flex flex-col items-center gap-1.5 text-[12px] text-ink-2 hover:text-ink`,children:[(0,q.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-full bg-paper-2 transition hover:bg-paper-3`,children:(0,q.jsx)(Qe,{className:`size-5`})}),W(`shareRun.more`)]}):null]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[13px] text-ink-3`,children:[(0,q.jsx)(`span`,{children:y?W(`shareRun.until`,{date:y}):W(`shareRun.kept`)}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>void g(),className:`shrink-0 hover:text-rose coarse:min-h-11`,children:W(`shareRun.withdraw`)})]})]}):null})]})}function ut({runId:e,ask:t}){return t.kind===`confirm`?(0,q.jsx)(dt,{runId:e,ask:t}):(0,q.jsx)(ft,{runId:e,ask:t})}function dt({runId:e,ask:t}){let[n,r]=(0,K.useState)(!1),[i,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(null),l=async n=>{o(!0),c(null);try{await a.post(`/api/runs/${e}/ask/${t.id}`,n)}catch(e){c(e.message),o(!1)}},u=t.action.destructive?it:Ke;return(0,q.jsxs)(`div`,{className:`animate-rise`,children:[(0,q.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:B(`flex size-10 shrink-0 items-center justify-center rounded-full`,t.action.destructive?`bg-rose-tint text-rose`:`bg-ember-tint text-ember-strong`),children:(0,q.jsx)(u,{className:`size-5`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:W(`ask.wants`,{service:t.service})}),(0,q.jsx)(`h2`,{className:`font-display font-semibold text-[20px] leading-snug tracking-tight`,children:t.reason})]})]}),(0,q.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-paper-2 p-4 text-[13px] leading-relaxed ring-1 ring-border-soft`,children:t.input}),(0,q.jsxs)(`div`,{className:`mt-5 flex items-center gap-4`,children:[(0,q.jsx)(de,{checked:n,onChange:r,label:W(`ask.allowRest`)}),(0,q.jsx)(`span`,{className:`flex-1 text-[13px] text-ink-2`,children:W(`ask.allowRest`)})]}),s?(0,q.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[14px] text-rose`,children:s}):null,(0,q.jsxs)(`div`,{className:`action-bar mt-6 flex items-center justify-between gap-3`,children:[(0,q.jsx)(U,{variant:`ghost`,disabled:i,onClick:()=>void l({type:`skip`}),children:W(`ask.deny`)}),(0,q.jsx)(U,{busy:i,onClick:()=>void l({type:`done`,remember:n}),children:W(`ask.allow`)})]})]})}function ft({runId:e,ask:t}){let[n,i]=(0,K.useState)({}),[o,s]=(0,K.useState)(!1),[c,l]=(0,K.useState)(!1),[u,f]=(0,K.useState)(null),[p,m]=(0,K.useState)(0),[h,g]=(0,K.useState)(``),[_,v]=(0,K.useState)(!1),y=(0,K.useRef)(null),b=(0,K.useCallback)(()=>m(e=>e+1),[]);(0,K.useEffect)(()=>{let e=setInterval(b,2500);return()=>clearInterval(e)},[b]);let x=async n=>{l(!0),f(null);try{await a.post(`/api/runs/${e}/ask/${t.id}`,n)}catch(e){f(e.message),l(!1)}},S=async t=>{f(null);try{await a.post(`/api/runs/${e}/browser/act`,t)}catch(e){f(e.message)}b()},C=e=>{let t=y.current;if(!t?.naturalWidth)return;let n=t.getBoundingClientRect();S({type:`click`,x:Math.round((e.clientX-n.left)/n.width*t.naturalWidth),y:Math.round((e.clientY-n.top)/n.height*t.naturalHeight)})},w=t.fields.some(e=>n[e.id]);return(0,q.jsxs)(`div`,{className:`animate-rise`,children:[(0,q.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-ember-tint text-ember-strong`,children:(0,q.jsx)(He,{className:`size-5`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`h2`,{className:`font-display font-semibold text-[20px] leading-snug tracking-tight`,children:t.reason}),(0,q.jsxs)(`p`,{className:`mt-0.5 truncate text-[13px] text-ink-3`,children:[t.site.host,t.site.title?` · ${t.site.title}`:``]})]})]}),(0,q.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-paper-2 ring-1 ring-border-soft`,children:[(0,q.jsx)(`img`,{ref:y,src:r(`/api/runs/${e}/browser/screen?t=${p}`),alt:t.site.host,onClick:C,className:`block w-full cursor-pointer`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-border-soft border-t bg-card p-2`,children:[(0,q.jsx)(H,{type:_?`password`:`text`,autoComplete:`off`,value:h,placeholder:W(`ask.typeInto`),onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S({type:`type`,text:h}).then(()=>g(``)))},autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`send`,className:`h-9 min-w-[9rem] flex-1 basis-full text-[13px] sm:basis-0 coarse:h-11`}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>v(e=>!e),className:B(`h-9 shrink-0 rounded-md px-2.5 text-[12px] coarse:h-11 coarse:px-3.5`,_?`bg-ember-veil text-ink`:`text-ink-3 hover:bg-paper-2`),children:W(`ask.hide`)}),(0,q.jsx)(pt,{label:`Enter`,onClick:()=>void S({type:`key`,key:`Enter`}),children:(0,q.jsx)(Se,{className:`size-4`})}),(0,q.jsx)(pt,{label:W(`ask.up`),onClick:()=>void S({type:`scroll`,dy:-500}),children:(0,q.jsx)(d,{className:`size-4`})}),(0,q.jsx)(pt,{label:W(`ask.down`),onClick:()=>void S({type:`scroll`,dy:500}),children:(0,q.jsx)(me,{className:`size-4`})})]})]}),(0,q.jsx)(`p`,{className:`mt-2 text-[12px] text-ink-4`,children:W(`ask.pictureHint`)}),t.fields.length?(0,q.jsxs)(`form`,{className:`mt-5 flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),x({type:`fill`,values:n,remember:o})},children:[t.fields.map((e,r)=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(L,{children:e.label}),(0,q.jsx)(H,{autoFocus:r===0,type:e.secret?`password`:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:r===t.fields.length-1?`go`:`next`,value:n[e.id]??``,onChange:t=>i(n=>({...n,[e.id]:t.target.value}))})]},e.id)),(0,q.jsx)(`button`,{type:`submit`,hidden:!0})]}):null,(0,q.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-4`,children:[(0,q.jsx)(de,{checked:o,onChange:s,label:W(`ask.remember`)}),(0,q.jsx)(`span`,{className:`flex-1 text-[13px] text-ink-2`,children:W(`ask.remember`)})]}),(0,q.jsxs)(`p`,{className:`mt-3 flex items-start gap-2 text-[13px] text-ink-3`,children:[(0,q.jsx)(et,{className:`mt-0.5 size-4 shrink-0 text-moss`}),` `,W(`ask.private`)]}),u?(0,q.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[14px] text-rose`,children:u}):null,(0,q.jsxs)(`div`,{className:`action-bar mt-6 flex flex-wrap items-center justify-between gap-3`,children:[(0,q.jsx)(U,{variant:`ghost`,disabled:c,onClick:()=>void x({type:`skip`}),children:W(`ask.skip`)}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.fields.length?(0,q.jsx)(U,{variant:`secondary`,disabled:c,onClick:()=>void x({type:`done`,remember:o}),children:W(`ask.done`)}):null,t.fields.length?(0,q.jsx)(U,{busy:c,disabled:!w,onClick:()=>void x({type:`fill`,values:n,remember:o}),children:W(`ask.signIn`)}):(0,q.jsx)(U,{busy:c,onClick:()=>void x({type:`done`,remember:o}),children:W(`ask.done`)})]})]})]})}function pt({label:e,onClick:t,children:n}){return(0,q.jsx)(`button`,{type:`button`,"aria-label":e,title:e,onClick:t,className:`flex size-9 shrink-0 items-center justify-center rounded-md text-ink-3 hover:bg-paper-2 hover:text-ink coarse:size-11`,children:n})}var J=36e5,Y=6e4,mt=1e3;function ht(e){return e.fractionDigits===void 0?e.style===`integer`?0:2:e.fractionDigits}function gt(e,t,n=`en`){if(typeof e!=`number`||!Number.isFinite(e))return``;let r=ht(t),i=t.grouping!==!1;return t.style===`percent`?new Intl.NumberFormat(n,{maximumFractionDigits:r,minimumFractionDigits:r,style:`percent`,useGrouping:i}).format(e):t.style===`currency`&&t.currency?new Intl.NumberFormat(n,{currency:t.currency,maximumFractionDigits:r,minimumFractionDigits:r,style:`currency`,useGrouping:i}).format(e):new Intl.NumberFormat(n,{maximumFractionDigits:r,minimumFractionDigits:r,useGrouping:i}).format(e)}function _t(e,t,n=`en`){if(typeof e!=`string`||e.length===0)return``;if(t.kind===`time`)return vt(e,t.timePrecision??`minutes`);if(t.dateStyle===`iso`)return t.kind===`date`?e.slice(0,10):e;let r=t.kind===`date`?new Date(`${e}T00:00:00`):new Date(e);if(Number.isNaN(r.getTime()))return e;let i=t.dateStyle??`medium`;if(t.kind===`date`)return new Intl.DateTimeFormat(n,{dateStyle:i}).format(r);let a=t.timePrecision??`minutes`;return new Intl.DateTimeFormat(n,{dateStyle:i,timeStyle:a===`hours`?`short`:`medium`}).format(r)}function vt(e,t){let[n=`0`,r=`00`,i=`00`]=e.split(`:`);return t===`hours`?`${n.padStart(2,`0`)}:00`:t===`minutes`?`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}`:`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}:${i.padStart(2,`0`)}`}function yt(e,t){if(typeof e!=`number`||!Number.isFinite(e))return``;let n=Math.max(0,Math.round(e));if(t.display===`iso`)return bt(n);if(t.display===`minutes`)return`${Math.round(n/Y)} min`;if(t.display===`hours`)return`${(n/J).toFixed(2)} h`;if(t.display===`decimal-hours`)return(n/J).toFixed(2);let r=Math.floor(n/J),i=Math.floor(n%J/Y),a=Math.floor(n%Y/mt);return`${r}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}function bt(e){let t=Math.floor(e/J),n=Math.floor(e%J/Y),r=Math.floor(e%Y/mt);return`${t>=24?`P${Math.floor(t/24)}D`:`P`}T${t%24}H${n}M${r}S`}function X(e,t,n=`en`){if(t==null)return``;switch(e.type){case`number`:return gt(t,e.format,n);case`date`:return _t(t,e.format,n);case`duration`:return yt(t,e.format);case`boolean`:return t===!0?`true`:t===!1?`false`:``;case`select`:return xt(e,t);default:return String(t)}}function xt(e,t){let n=Array.isArray(t)?t:[t],r=e.format.options.reduce((e,t)=>(e[t.id]=t.label,e),{});return n.filter(e=>typeof e==`string`&&e.length>0).map(e=>r[e]??e).join(`, `)}async function St(e,t=2400){if(!/^image\/(jpeg|png|webp)$/.test(e.type)||e.size<12e5)return e;try{let n=await createImageBitmap(e),r=Math.min(1,t/Math.max(n.width,n.height)),i=document.createElement(`canvas`);i.width=Math.round(n.width*r),i.height=Math.round(n.height*r),i.getContext(`2d`)?.drawImage(n,0,0,i.width,i.height);let a=await new Promise(e=>i.toBlob(e,`image/jpeg`,.86));return a&&a.size<e.size?new File([a],`${e.name.replace(/\.[^.]+$/,``)}.jpg`,{type:`image/jpeg`}):e}catch{return e}}function Ct(){return new Date().toISOString().slice(0,19).replace(/[:T]/g,`-`)}function wt(e){let t=e?.name;return t===`NotFoundError`||t===`OverconstrainedError`?`missing`:t===`NotReadableError`||t===`AbortError`?`busy`:`denied`}function Tt(e){return!!e?.getCapabilities?.()?.torch}function Et(e,t,n=!1){let r=(0,K.useRef)(null),[i,a]=(0,K.useState)(null),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(1),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(!1);return(0,K.useEffect)(()=>{if(!e)return;let r=null,i=!1;s(null),a(null),d(!1),p(!1);let o={facingMode:{ideal:t},width:{ideal:2560},height:{ideal:1440}};return(async()=>{if(!navigator.mediaDevices?.getUserMedia)throw new DOMException(`no camera api`,`NotAllowedError`);try{r=await navigator.mediaDevices.getUserMedia({video:o,audio:n})}catch(e){if(!n)throw e;r=await navigator.mediaDevices.getUserMedia({video:o})}if(i){for(let e of r.getTracks())e.stop();return}a(r);let e=r.getVideoTracks()[0],t=()=>!i&&d(Tt(e));t(),setTimeout(t,600);let s=await navigator.mediaDevices.enumerateDevices().catch(()=>[]);i||l(s.filter(e=>e.kind===`videoinput`).length)})().catch(e=>!i&&s(wt(e))),()=>{i=!0;for(let e of r?.getTracks()??[])e.stop()}},[e,t,n]),(0,K.useEffect)(()=>{r.current&&i&&(r.current.srcObject=i)},[i]),{video:r,stream:i,error:o,cameras:c,torchable:u,torch:f,setTorch:async e=>{let t=i?.getVideoTracks()[0];try{await t?.applyConstraints({advanced:[{torch:e}]}),p(e)}catch{d(!1)}},mirrored:i?.getVideoTracks()[0]?.getSettings().facingMode===`user`}}function Dt({open:e,onClose:t,label:n,children:r}){let i=(0,K.useRef)(null);return(0,K.useEffect)(()=>{let t=i.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),(0,q.jsx)(`dialog`,{ref:i,onClose:t,"aria-label":n,className:`media-sheet`,children:e?(0,q.jsx)(`div`,{className:`flex h-full flex-col`,children:r}):null})}function Ot({label:e,onClick:t,active:n,children:r}){return(0,q.jsx)(`button`,{type:`button`,"aria-label":e,title:e,"aria-pressed":n,onClick:t,className:B(`flex size-11 shrink-0 items-center justify-center rounded-full transition`,n?`bg-white text-black`:`bg-white/12 text-white hover:bg-white/20`),children:r})}function kt({title:e,onClose:t,camera:n,onFlip:r}){return(0,q.jsx)(`div`,{className:`safe-top`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,q.jsx)(Ot,{label:W(`common.close`),onClick:t,children:(0,q.jsx)(G,{className:`size-5`})}),(0,q.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-center font-medium text-[15px]`,children:e}),n.torchable?(0,q.jsx)(Ot,{label:W(`camera.torch`),active:n.torch,onClick:()=>void n.setTorch(!n.torch),children:n.torch?(0,q.jsx)(Me,{className:`size-5`}):(0,q.jsx)(Ae,{className:`size-5`})}):null,n.stream&&(n.cameras>1||h)?(0,q.jsx)(Ot,{label:W(`camera.flip`),onClick:r,children:(0,q.jsx)(nt,{className:`size-5`})}):(0,q.jsx)(`span`,{className:`size-11`})]})})}function At({camera:e,asking:t,children:n,actions:r}){return(0,q.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[(0,q.jsx)(`video`,{ref:e.video,autoPlay:!0,playsInline:!0,muted:!0,className:B(`absolute inset-0 size-full object-contain`,e.mirrored&&`-scale-x-100`)}),e.error?(0,q.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-5 bg-black px-8 text-center`,children:[(0,q.jsx)(`p`,{className:`max-w-sm text-[15px] text-white/85 leading-relaxed`,children:W(`camera.${e.error}`)}),r]}):e.stream?n:(0,q.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-4 px-8 text-center text-white/75`,children:[(0,q.jsx)(R,{}),(0,q.jsx)(`p`,{className:`max-w-xs text-[14px] leading-relaxed`,children:t})]})]})}var jt=30;function Mt(){if(typeof MediaRecorder<`u`)return[`video/mp4;codecs=avc1.42E01E,mp4a.40.2`,`video/mp4`,`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`].find(e=>MediaRecorder.isTypeSupported(e))}var Nt=!!Mt();function Pt({open:e,multiple:t,video:n,onClose:r,onCapture:i,onNative:a}){let[o,s]=(0,K.useState)(`environment`),[c,l]=(0,K.useState)(`photo`),[u,d]=(0,K.useState)(0),[f,p]=(0,K.useState)(!1),[m,g]=(0,K.useState)(null),_=(0,K.useRef)(null),v=Et(e,o,c===`video`);(0,K.useEffect)(()=>{e&&(d(0),l(`photo`),g(null))},[e]);let y=async e=>{p(!0);try{await i(e),d(e=>e+1),t||r()}finally{p(!1)}},b=async()=>{let e=v.video.current;if(!e?.videoWidth)return;let t=document.createElement(`canvas`);t.width=e.videoWidth,t.height=e.videoHeight,t.getContext(`2d`)?.drawImage(e,0,0);let n=await new Promise(e=>t.toBlob(e,`image/jpeg`,.9));n&&await y(new File([n],`foto-${Ct()}.jpg`,{type:`image/jpeg`}))},x=()=>{_.current?.state===`recording`&&_.current.stop()},S=()=>{let e=Mt();if(!v.stream||!e)return;let t=[],n=new MediaRecorder(v.stream,{mimeType:e,videoBitsPerSecond:25e5,audioBitsPerSecond:96e3});n.ondataavailable=e=>e.data.size&&t.push(e.data),n.onstop=()=>{g(null),_.current=null;let n=e.split(`;`)[0];if(t.length){let e=n===`video/mp4`?`mp4`:`webm`;y(new File(t,`video-${Ct()}.${e}`,{type:n}))}},_.current=n,n.start(1e3),g(0)};(0,K.useEffect)(()=>{if(m===null)return;if(m>=jt){_.current?.state===`recording`&&_.current.stop();return}let e=setTimeout(()=>g(e=>e===null?null:e+1),1e3);return()=>clearTimeout(e)},[m]),(0,K.useEffect)(()=>{!e&&_.current&&(_.current.onstop=null,_.current.stop(),_.current=null)},[e]);let C=e=>`0:${String(e).padStart(2,`0`)}`;return(0,q.jsxs)(Dt,{open:e,onClose:r,label:W(`camera.title`),children:[(0,q.jsx)(kt,{title:m===null?u?W(`camera.taken`,{n:u}):W(`camera.title`):`${C(m)} / ${C(jt)}`,onClose:r,camera:v,onFlip:()=>s(e=>e===`environment`?`user`:`environment`)}),(0,q.jsx)(At,{camera:v,asking:W(`camera.asking`),actions:(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,q.jsxs)(Z,{onClick:()=>{r(),a()},children:[(0,q.jsx)(be,{className:`size-4`}),` `,W(h?`camera.native`:`camera.pick`)]}):null,(0,q.jsx)(Z,{quiet:!0,onClick:r,children:W(`common.close`)})]})}),(0,q.jsxs)(`div`,{className:B(`safe-bottom px-4 pt-3`,v.error&&`invisible`),children:[n&&Nt&&m===null?(0,q.jsx)(`div`,{className:`mb-3 flex justify-center gap-1 text-[13px]`,children:[`photo`,`video`].map(e=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":c===e,onClick:()=>l(e),className:B(`h-9 rounded-full px-4 font-medium transition`,c===e?`bg-white text-black`:`text-white/70 hover:text-white`),children:W(e===`photo`?`camera.photo`:`camera.video`)},e))}):null,(0,q.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_1fr] items-center gap-3`,children:[(0,q.jsx)(`span`,{className:`text-[13px] text-white/70 leading-snug`,children:m===null?c===`video`?W(`camera.clipHint`,{s:jt}):W(t?`camera.hintMany`:`camera.hint`):W(`camera.recording`)}),(0,q.jsx)(`button`,{type:`button`,"aria-label":W(c===`photo`?`camera.shoot`:m===null?`camera.record`:`camera.stop`),disabled:!v.stream||f,onClick:()=>c===`photo`?void b():m===null?S():x(),className:`flex size-[72px] items-center justify-center rounded-full border-4 border-white transition active:scale-95 disabled:opacity-40`,children:f?(0,q.jsx)(R,{className:`text-white`}):c===`photo`?(0,q.jsx)(`span`,{className:`size-[54px] rounded-full bg-white`}):m===null?(0,q.jsx)(`span`,{className:`flex size-[54px] items-center justify-center rounded-full bg-[#e5484d]`,children:(0,q.jsx)(te,{className:`size-6 text-white`})}):(0,q.jsx)(`span`,{className:`size-7 rounded-md bg-[#e5484d]`})}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:t&&u&&m===null?(0,q.jsxs)(Z,{onClick:r,children:[(0,q.jsx)(A,{className:`size-4`}),` `,W(`camera.done`)]}):null})]})]})]})}function Z({onClick:e,quiet:t,children:n}){return(0,q.jsx)(`button`,{type:`button`,onClick:e,className:B(`inline-flex h-11 items-center justify-center gap-2 rounded-full px-5 font-medium text-[14px] transition`,t?`text-white/75 hover:text-white`:`bg-white text-black hover:bg-white/90`),children:n})}var Ft=25,It=9e3;function Lt(e){return e.code===e.PERMISSION_DENIED?`denied`:e.code===e.TIMEOUT?`timeout`:`unavailable`}function Rt({value:e,runId:t,placeholder:n,onChange:r,onBusy:i}){let o=ne(e)?e:null,[s,c]=(0,K.useState)(!1),[l,u]=(0,K.useState)(null),d=(0,K.useRef)(null),f=(0,K.useRef)(!!o?.label),p=(0,K.useRef)(o);p.current=o;let m=o?.lat!==void 0&&o.lng!==void 0,h=typeof navigator<`u`&&`geolocation`in navigator,g=()=>{d.current!==null&&(navigator.geolocation.clearWatch(d.current),d.current=null),c(!1),i?.(!1)};(0,K.useEffect)(()=>()=>{d.current!==null&&navigator.geolocation.clearWatch(d.current)},[]);let _=async(e,n)=>{try{let{label:i}=await a.post(`/api/runs/${t}/geocode`,{lat:e,lng:n,language:z}),o=p.current;i&&!f.current&&o?.lat===e&&o.lng===n&&r({...o,label:i})}catch{}},v=()=>{u(null),c(!0),i?.(!0);let e=Date.now(),t=1/0;d.current=navigator.geolocation.watchPosition(n=>{let{latitude:i,longitude:a,accuracy:o}=n.coords;if(o<t){t=o;let e=Math.round(i*1e6)/1e6,n=Math.round(a*1e6)/1e6,s=f.current?p.current?.label:void 0,c={lat:e,lng:n,accuracy:Math.round(o),...s?{label:s}:{}};p.current=c,r(c)}if(t<=Ft||Date.now()-e>It){g();let e=p.current;e?.lat!==void 0&&e.lng!==void 0&&_(e.lat,e.lng)}},e=>{g(),t===1/0&&u(Lt(e))},{enableHighAccuracy:!0,timeout:15e3,maximumAge:1e4})},y=e=>{f.current=e.trim().length>0;let t={...m?o:{},label:e};r(m||e.trim()?t:void 0)};return(0,q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[m?(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,q.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,q.jsx)(We,{className:`size-5`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`truncate font-medium text-[15px] tabular-nums`,children:[o.lat?.toFixed(5),`, `,o.lng?.toFixed(5)]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 text-[13px] text-ink-3`,children:[(0,q.jsx)(`span`,{children:s?W(`location.refining`):o.accuracy?W(`location.accuracy`,{m:o.accuracy}):null}),(0,q.jsxs)(`a`,{href:`https://www.openstreetmap.org/?mlat=${o.lat}&mlon=${o.lng}#map=17/${o.lat}/${o.lng}`,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 underline-offset-2 hover:text-ink hover:underline coarse:-my-3 coarse:min-h-11 coarse:min-w-11`,children:[W(`location.map`),` `,(0,q.jsx)(N,{className:`size-3`})]})]})]}),(0,q.jsx)(V,{label:W(`location.remove`),onClick:()=>{g(),f.current=!1,r(void 0)},children:(0,q.jsx)(G,{className:`size-4`})})]}):h?(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(U,{variant:`secondary`,size:`lg`,busy:s,onClick:v,className:`w-full sm:w-auto`,children:[s?null:(0,q.jsx)(Be,{className:`size-4`}),W(s?`location.locating`:`location.use`)]}),l?(0,q.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[13px] text-ink-2 leading-relaxed`,children:W(`location.${l}`)}):(0,q.jsx)(`p`,{className:`mt-2 text-[13px] text-ink-3 leading-relaxed`,children:W(`location.why`)})]}):null,(0,q.jsx)(H,{value:o?.label??``,placeholder:n??W(m?`location.label`:`location.manual`),autoComplete:`street-address`,enterKeyHint:`done`,"aria-label":W(`location.manual`),onChange:e=>y(e.target.value)})]})}var zt=null;function Bt(){return zt??=(async()=>{let e=window.BarcodeDetector;if(e)try{let t=await e.getSupportedFormats();if(t.includes(`qr_code`)){let n=new e({formats:t});return{qrOnly:!1,detect:async e=>(await n.detect(e))[0]?.rawValue||null}}}catch{}let{default:t}=await s(async()=>{let{default:e}=await import(`./qr-scanner.min-C_UI0gH-.js`);return{default:e}},__vite__mapDeps([0,1])),n=t.createQrEngine();return{qrOnly:!0,detect:async e=>{try{return(await t.scanImage(e,{qrEngine:n,returnDetailedScanResult:!0})).data||null}catch{return null}}}})(),zt}function Vt({open:e,onClose:t,onResult:n}){let[r,i]=(0,K.useState)(`environment`),[a,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(!1),l=(0,K.useRef)(null),u=Et(e,r),d=(0,K.useRef)(n);d.current=n;let f=(0,K.useRef)(t);f.current=t,(0,K.useEffect)(()=>{e&&(c(!1),Bt().then(e=>o(e.qrOnly)))},[e]),(0,K.useEffect)(()=>{if(!e||!u.stream)return;let t=!1,n,r=async()=>{let e=u.video.current;if(!t&&e&&e.readyState>=2&&e.videoWidth){let n=await(await Bt()).detect(e).catch(()=>null);if(n&&!t){navigator.vibrate?.(60),d.current(n),f.current();return}}t||(n=setTimeout(r,200))};return r(),()=>{t=!0,clearTimeout(n)}},[e,u.stream,u.video]);let p=async e=>{if(!e)return;c(!1);let r=await createImageBitmap(e).catch(()=>null),i=r?await(await Bt()).detect(r).catch(()=>null):null;i?(n(i),t()):c(!0)};return(0,q.jsxs)(Dt,{open:e,onClose:t,label:W(`scan.title`),children:[(0,q.jsx)(kt,{title:W(`scan.title`),onClose:t,camera:u,onFlip:()=>i(e=>e===`environment`?`user`:`environment`)}),(0,q.jsx)(At,{camera:u,asking:W(`scan.asking`),actions:(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsxs)(Z,{onClick:()=>l.current?.click(),children:[(0,q.jsx)(Re,{className:`size-4`}),` `,W(`scan.fromPhoto`)]}),(0,q.jsx)(Z,{quiet:!0,onClick:t,children:W(`scan.typeInstead`)})]}),children:(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,q.jsx)(`div`,{className:`aspect-square w-[min(68%,320px)] rounded-3xl border-2 border-white/90 shadow-[0_0_0_100vmax_rgb(0_0_0/0.35)]`})})}),(0,q.jsxs)(`div`,{className:`safe-bottom flex flex-col items-center gap-3 px-5 pt-3 text-center`,children:[(0,q.jsx)(`p`,{className:`text-[13px] text-white/75 leading-snug`,children:W(s?`scan.miss`:a?`scan.hintQr`:`scan.hint`)}),u.stream?(0,q.jsxs)(Z,{quiet:!0,onClick:()=>l.current?.click(),children:[(0,q.jsx)(Re,{className:`size-4`}),` `,W(`scan.fromPhoto`)]}):null]}),(0,q.jsx)(`input`,{ref:l,type:`file`,hidden:!0,accept:`image/*`,onChange:e=>{p(e.target.files?.[0]),e.target.value=``}})]})}var Ht=`#1d1a17`,Q={width:1200,height:480};function Ut(e,t,n,r,i){e.lineCap=`round`,e.lineJoin=`round`,e.strokeStyle=Ht,e.fillStyle=Ht,e.lineWidth=i;for(let a of t){if(a.length===1){e.beginPath(),e.arc(a[0].x*n,a[0].y*r,i/2,0,Math.PI*2),e.fill();continue}e.beginPath(),e.moveTo(a[0].x*n,a[0].y*r);for(let t=1;t<a.length-1;t++){let i=a[t],o=a[t+1];e.quadraticCurveTo(i.x*n,i.y*r,(i.x+o.x)/2*n,(i.y+o.y)/2*r)}let t=a[a.length-1];e.lineTo(t.x*n,t.y*r),e.stroke()}}function Wt({strokes:e,onStrokes:t}){let n=(0,K.useRef)(null),r=(0,K.useRef)(null),i=(0,K.useRef)(e);i.current=e;let a=()=>{let e=n.current,t=e?.getContext(`2d`);if(!e||!t)return;let a=window.devicePixelRatio||1,o=Math.round(e.clientWidth*a),s=Math.round(e.clientHeight*a);(e.width!==o||e.height!==s)&&(e.width=o,e.height=s),t.clearRect(0,0,o,s),Ut(t,r.current?[...i.current,r.current]:i.current,o,s,2.4*a)};(0,K.useEffect)(()=>{a();let e=n.current;if(!e)return;let t=new ResizeObserver(a);return t.observe(e),()=>t.disconnect()},[e]);let o=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),y:Math.min(1,Math.max(0,(e.clientY-t.top)/t.height))}};return(0,q.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl bg-white ring-1 ring-input`,children:[(0,q.jsx)(`canvas`,{ref:n,"aria-label":W(`sign.pad`),className:`block aspect-[5/2] w-full cursor-crosshair touch-none select-none`,onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),r.current=[o(e)],a()},onPointerMove:e=>{r.current&&(r.current.push(o(e)),a())},onPointerUp:()=>{if(r.current){let e=r.current;r.current=null,t([...i.current,e])}},onPointerCancel:()=>{r.current=null,a()}}),(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-x-6 bottom-[22%] border-[#1d1a17]/25 border-b`}),e.length?null:(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center text-[#1d1a17]/40 text-[14px]`,children:W(`sign.hint`)})]})}async function Gt(e){let t=document.createElement(`canvas`);t.width=Q.width,t.height=Q.height;let n=t.getContext(`2d`);if(!n)return null;Ut(n,e,Q.width,Q.height,7);let r=await new Promise(e=>t.toBlob(e,`image/png`));return r?new File([r],`unterschrift.png`,{type:`image/png`}):null}function Kt({label:e,value:t,runId:n,onChange:i}){let[o,s]=(0,K.useState)(!1),[c,l]=(0,K.useState)([]),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null),m=typeof t==`string`&&t?t:null,h=async()=>{d(!0),p(null);try{let e=await Gt(c);if(!e)return;i((await a.upload(`/api/runs/${n}/uploads`,e)).id),s(!1)}catch(e){p(e.message)}finally{d(!1)}};return(0,q.jsxs)(`div`,{children:[m?(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>{l([]),s(!0)},className:`min-w-0 flex-1 rounded-lg bg-white px-3`,"aria-label":W(`sign.again`),children:(0,q.jsx)(`img`,{src:r(`/api/runs/${n}/assets/${m}`),alt:e,className:`mx-auto h-20 object-contain`})}),(0,q.jsx)(V,{label:W(`sign.remove`),onClick:()=>i(void 0),children:(0,q.jsx)(G,{className:`size-4`})})]}):(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{l([]),s(!0)},className:`flex w-full flex-col items-center justify-center gap-2 rounded-xl border border-input border-dashed bg-card px-4 py-7 text-[14px] text-ink-3 transition hover:border-ember hover:text-ink`,children:[(0,q.jsx)(I,{className:`size-6`}),W(`sign.open`)]}),(0,q.jsxs)(se,{open:o,onClose:()=>s(!1),title:e,wide:!0,children:[(0,q.jsx)(Wt,{strokes:c,onStrokes:l}),f?(0,q.jsx)(`p`,{className:`mt-2 text-[13px] text-rose`,children:f}):null,(0,q.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-3`,children:[(0,q.jsxs)(U,{variant:`ghost`,disabled:!c.length||u,onClick:()=>l([]),children:[(0,q.jsx)(Ee,{className:`size-4`}),` `,W(`sign.clear`)]}),(0,q.jsx)(U,{busy:u,disabled:!c.length,onClick:()=>void h(),children:W(`sign.accept`)})]})]})]})}function qt({runId:e,connectionId:t,connector:n,onCancel:r}){let[i,o]=(0,K.useState)({}),[s,c]=(0,K.useState)(!1),[l,u]=(0,K.useState)(null),d=async()=>{c(!0),u(null);try{await a.post(`/api/runs/${e}/connections/${t}/credentials/${n.id}`,{values:i})}catch(e){u(e.message)}finally{c(!1)}};return(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-card p-4 ring-1 ring-input`,children:[(n.fields??[]).map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(L,{children:e.label}),(0,q.jsx)(H,{type:e.secret?`password`:`text`,autoComplete:`off`,value:i[e.key]??``,placeholder:e.placeholder,onChange:t=>o(n=>({...n,[e.key]:t.target.value})),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())}})]},e.key)),n.hint?(0,q.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:n.hint}):null,l?(0,q.jsx)(`p`,{className:`text-[13px] text-rose`,children:l}):null,(0,q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,q.jsx)(U,{variant:`ghost`,size:`sm`,onClick:r,children:W(`common.cancel`)}),(0,q.jsx)(U,{size:`sm`,busy:s,onClick:()=>void d(),children:W(`connect.go`)})]})]})}function Jt({runId:e,connection:t}){let[n,r]=(0,K.useState)(null),[i,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(null);if(!t)return null;if(t.account){let n=t.connectors.find(e=>e.id===t.account?.connector)?.name??``;return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,q.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,q.jsx)(A,{className:`size-5`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`div`,{className:`truncate font-medium text-[15px]`,children:t.account.label}),(0,q.jsx)(`div`,{className:`text-[13px] text-ink-3`,children:W(`connect.connected`,{name:n})})]}),(0,q.jsx)(V,{label:W(`connect.disconnect`),onClick:()=>void a.del(`/api/runs/${e}/connections/${t.id}`),children:(0,q.jsx)(ot,{className:`size-4`})})]})}let l=async n=>{c(null),o(null);let r=window.open(`about:blank`,`wizard-connect`,`width=540,height=700`);try{let{url:i}=await a.post(`/api/runs/${e}/connections/${t.id}/oauth/${n.id}`);r?r.location.replace(i):o(i)}catch(e){r?.close(),c(e.message)}},u=t.connectors.find(e=>e.id===n);return t.connectors.length?(0,q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.connectors.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>e.auth===`oauth2`?void l(e):r(n===e.id?null:e.id),className:B(`inline-flex h-11 items-center gap-2 rounded-full px-4 font-medium text-[14px] ring-1 transition`,n===e.id?`bg-ember-veil text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink hover:ring-ember`),children:[(0,q.jsx)(m,{className:`size-4`}),` `,e.name]},e.id))}),u?(0,q.jsx)(qt,{runId:e,connectionId:t.id,connector:u,onCancel:()=>r(null)}):null,i?(0,q.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:`text-[14px] text-ember underline`,children:W(`connect.openLink`)}):null,s?(0,q.jsx)(`p`,{className:`text-[13px] text-rose`,children:s}):null]}):(0,q.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:W(`connect.none`)})}function Yt(e){return e==null?``:Array.isArray(e)?e.join(`, `):String(e)}function Xt(e,t){if(t.trim()===``)return null;if(e.type===`number`){let e=Number(t.replace(/\s/g,``).replace(`,`,`.`));return Number.isFinite(e)?e:t}return e.type===`boolean`?t===`true`:t}function $({column:e,value:t,boxed:n,onCommit:r}){let[i,a]=(0,K.useState)(Yt(t));(0,K.useEffect)(()=>a(Yt(t)),[t]);let o=B(`w-full min-w-0 rounded-md border border-transparent px-2 text-[13px] outline-none focus:border-ember focus:bg-card`,n?`h-11 bg-paper-2`:`h-9 bg-transparent hover:bg-paper-2 coarse:h-11`);return e.type===`boolean`?(0,q.jsx)(`label`,{className:`flex size-9 cursor-pointer items-center justify-center coarse:size-11`,children:(0,q.jsx)(`input`,{type:`checkbox`,"aria-label":e.name,checked:t===!0,onChange:e=>r(e.target.checked),className:`size-4 accent-[var(--ember)] coarse:size-6`})}):e.type===`select`&&!e.format.multiple&&!e.format.allowCustom?(0,q.jsxs)(`select`,{value:i,onChange:e=>r(e.target.value||null),className:o,children:[(0,q.jsx)(`option`,{value:``}),e.format.options.map(e=>(0,q.jsx)(`option`,{value:e.id,children:e.label},e.id))]}):(0,q.jsx)(`input`,{"aria-label":e.name,type:e.type===`date`&&e.format.kind===`date`?`date`:`text`,inputMode:e.type===`number`?`decimal`:void 0,enterKeyHint:`done`,autoComplete:`off`,value:i,onChange:e=>a(e.target.value),onBlur:()=>{i!==Yt(t)&&r(Xt(e,i))},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.target.blur())},className:B(o,e.type===`number`&&`text-right tabular-nums`)})}function Zt({runId:e,list:t,editable:n}){let{def:r,rows:i}=t,[s,c]=(0,K.useState)(null),[l,u]=(0,K.useState)({}),d=`/api/runs/${e}/lists/${r.id}/rows`,f=async e=>{c(null);try{await e()}catch(e){c(e instanceof o?e.message:String(e))}},p=()=>f(async()=>{await a.post(d,{cells:l}),u({})}),m=Object.values(l).some(e=>e!=null&&e!==``);if(!i.length&&!n)return(0,q.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:W(`list.empty`)});let h=(e,t)=>t===0||e.type===`text`&&e.format?.style===`multiline`,g=(e,t,n)=>void f(()=>a.patch(`${d}/${e}`,{cells:{[t]:n}}));return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:hidden`,children:[i.map(e=>(0,q.jsxs)(`div`,{className:`rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,q.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:r.columns.map((t,r)=>(0,q.jsxs)(`div`,{className:B(`min-w-0`,h(t,r)&&`col-span-2`),children:[(0,q.jsx)(`div`,{className:`px-1 pb-0.5 text-[11px] text-ink-3`,children:t.name}),n?(0,q.jsx)($,{boxed:!0,column:t,value:e.cells[t.id],onCommit:n=>g(e.id,t.id,n)}):(0,q.jsx)(`div`,{className:B(`break-words px-1 text-[14px]`,t.type===`number`&&`tabular-nums`),children:X(t,e.cells[t.id],z)||`—`})]},t.id))}),n?(0,q.jsx)(`div`,{className:`mt-1 flex justify-end`,children:(0,q.jsx)(V,{label:W(`list.delete`),onClick:()=>void f(()=>a.del(`${d}/${e.id}`)),children:(0,q.jsx)(S,{className:`size-4`})})}):null]},e.id)),n?(0,q.jsxs)(`div`,{className:`rounded-lg border border-input border-dashed p-2`,children:[(0,q.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:r.columns.map((e,t)=>(0,q.jsxs)(`div`,{className:B(`min-w-0`,h(e,t)&&`col-span-2`),children:[(0,q.jsx)(`div`,{className:`px-1 pb-0.5 text-[11px] text-ink-3`,children:e.name}),(0,q.jsx)($,{boxed:!0,column:e,value:l[e.id],onCommit:t=>u(n=>({...n,[e.id]:t}))})]},e.id))}),(0,q.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,q.jsxs)(U,{variant:`secondary`,size:`sm`,onClick:()=>m?void p():void 0,children:[(0,q.jsx)(M,{className:`size-4`}),` `,W(`run.addRow`)]})})]}):null]}),(0,q.jsx)(`div`,{className:`hidden overflow-x-auto rounded-lg ring-1 ring-border-soft sm:block`,children:(0,q.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,q.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,q.jsxs)(`tr`,{children:[r.columns.map(e=>(0,q.jsx)(`th`,{className:`whitespace-nowrap px-3 py-2 text-left font-medium`,children:e.name},e.id)),n?(0,q.jsx)(`th`,{className:`w-10`}):null]})}),(0,q.jsxs)(`tbody`,{children:[i.map(e=>(0,q.jsxs)(`tr`,{className:`border-border-soft border-t align-top`,children:[r.columns.map(t=>(0,q.jsx)(`td`,{className:B(`min-w-[7.5rem]`,n?`px-1 py-0.5`:`px-3 py-2`),children:n?(0,q.jsx)($,{column:t,value:e.cells[t.id],onCommit:n=>g(e.id,t.id,n)}):(0,q.jsx)(`span`,{className:B(t.type===`number`&&`tabular-nums`),children:X(t,e.cells[t.id],z)})},t.id)),n?(0,q.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,q.jsx)(V,{label:W(`list.delete`),className:`size-9`,onClick:()=>void f(()=>a.del(`${d}/${e.id}`)),children:(0,q.jsx)(S,{className:`size-3.5`})})}):null]},e.id)),n?(0,q.jsxs)(`tr`,{className:`border-border-soft border-t bg-paper`,children:[r.columns.map(e=>(0,q.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,q.jsx)($,{column:e,value:l[e.id],onCommit:t=>u(n=>({...n,[e.id]:t}))})},e.id)),(0,q.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,q.jsx)(V,{label:W(`run.addRow`),className:`size-9`,onClick:()=>m?void p():void 0,children:(0,q.jsx)(M,{className:`size-4`})})})]}):null]})]})}),s?(0,q.jsx)(`p`,{className:`mt-2 text-[13px] text-rose`,children:s}):null]})}function Qt(e,t,n){let i=t.split(`/`).map(encodeURIComponent).join(`/`);return r(`/api/runs/${e}/store/files/${i}${n?`?inline=1`:``}`)}var $t=[`bg-paper-3 text-ink-3`,`bg-moss-tint text-moss`,`bg-rose-tint text-rose`,`bg-ember-tint text-ember-strong`];function en({runId:e,list:t}){let{def:n,rows:r}=t,i=n.columns.find(e=>e.id===n.check?.file),s=n.columns.find(e=>e.id===n.check?.status),c=s?.type===`select`?s.format.options:[],l=c[0]?.id,u=e=>s?String(e.cells[s.id]??l??``):``,d=e=>!s||u(e)===l,[f,p]=(0,K.useState)(()=>(r.find(d)??r[0])?.id??null),[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(null),v=`/api/runs/${e}/lists/${n.id}/rows`,y=r.find(e=>e.id===f)??r[0],b=m?r.filter(e=>d(e)||e.id===y?.id):r,x=r.filter(e=>!d(e)).length,S=n.columns.filter(e=>e!==i&&e!==s),C=S.filter(e=>e.id!==n.key),w=C.find(e=>e.type===`text`)??C[0],T=C.filter(e=>e!==w),E=async(e,t)=>{_(null);try{await a.patch(`${v}/${e}`,{cells:t})}catch(e){_(e instanceof o?e.message:String(e))}},D=e=>{let t=b.findIndex(e=>e.id===y?.id),n=b[Math.min(b.length-1,Math.max(0,t+e))];n&&p(n.id)},O=async e=>{if(!y||!s)return;let t=r.findIndex(e=>e.id===y.id),n=[...r.slice(t+1),...r.slice(0,t)].find(d);await E(y.id,{[s.id]:e}),n&&e!==l&&p(n.id)},ee=e=>{e.target.closest(`input, textarea, select`)||(e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),D(e.key===`ArrowDown`?1:-1)):/^[1-9]$/.test(e.key)&&c[Number(e.key)]&&(e.preventDefault(),O(c[Number(e.key)].id)))};if(!r.length)return(0,q.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:W(`list.empty`)});let k=i&&y?String(y.cells[i.id]??``).trim():``,j=k.split(`.`).pop()?.toLowerCase()??``,M=e=>$t[Math.min(Math.max(0,c.findIndex(t=>t.id===u(e))),3)];return(0,q.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(280px,360px)_minmax(0,1fr)]`,onKeyDown:ee,children:[(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-col`,children:[(0,q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,q.jsx)(`span`,{className:`text-[13px] text-ink-3 tabular-nums`,children:W(`check.progress`,{done:x,total:r.length})}),s?(0,q.jsx)(`button`,{type:`button`,"aria-pressed":m,onClick:()=>h(e=>!e),className:B(`inline-flex h-8 items-center rounded-full px-3 text-[13px] ring-1 transition coarse:h-11`,m?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink`),children:W(`check.onlyOpen`)}):null]}),(0,q.jsx)(`ul`,{className:`flex max-h-[38vh] flex-col gap-1.5 overflow-y-auto p-0.5 pr-1 lg:max-h-[calc(100vh-15rem)]`,children:b.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>p(e.id),"aria-current":e.id===y?.id,className:B(`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left ring-1 transition`,e.id===y?.id?`bg-card shadow-soft ring-ember`:`bg-paper ring-border-soft hover:bg-card`),children:[(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block truncate font-medium text-[14px]`,children:w&&X(w,e.cells[w.id],z)||`—`}),(0,q.jsx)(`span`,{className:`block truncate text-[12px] text-ink-3 tabular-nums`,children:T.slice(0,2).map(t=>X(t,e.cells[t.id],z)).filter(Boolean).join(` · `)})]}),s?(0,q.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2 py-0.5 font-medium text-[11px]`,M(e)),children:c.find(t=>t.id===u(e))?.label??u(e)}):null]})},e.id))})]}),y?(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[c.length>1?(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c.slice(1).map((e,t)=>(0,q.jsxs)(U,{size:`md`,variant:u(y)===e.id?`primary`:`secondary`,onClick:()=>void O(e.id),children:[u(y)===e.id?(0,q.jsx)(A,{className:`size-4`}):null,e.label,(0,q.jsx)(`kbd`,{className:`ml-1 hidden rounded bg-black/10 px-1.5 text-[11px] lg:inline`,children:t+1})]},e.id)),u(y)===l?null:(0,q.jsx)(U,{size:`md`,variant:`ghost`,onClick:()=>void O(l??``),children:W(`check.reopen`)})]}):null,(0,q.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-paper-2 ring-1 ring-border-soft`,children:k?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 border-border-soft border-b bg-card px-3 py-2 text-[13px]`,children:[(0,q.jsx)(P,{className:`size-3.5 shrink-0 text-ink-3`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:k.split(`/`).pop()}),(0,q.jsx)(`a`,{href:Qt(e,k,j===`pdf`),target:`_blank`,rel:`noreferrer`,className:`shrink-0 text-ink-2 underline-offset-2 hover:text-ink hover:underline`,children:W(`run.openFull`)})]}),j===`pdf`?(0,q.jsx)(`iframe`,{title:k,src:`${Qt(e,k,!0)}#toolbar=0&navpanes=0&view=FitH`,className:`h-[46vh] w-full border-0 bg-white lg:h-[calc(100vh-27rem)] lg:min-h-[360px]`},k):[`png`,`jpg`,`jpeg`,`webp`].includes(j)?(0,q.jsx)(`div`,{className:`flex max-h-[46vh] justify-center overflow-auto bg-white lg:max-h-[calc(100vh-27rem)]`,children:(0,q.jsx)(`img`,{src:Qt(e,k,!0),alt:k,className:`max-w-full object-contain`},k)}):(0,q.jsx)(`p`,{className:`px-4 py-10 text-center text-[14px] text-ink-3`,children:W(`check.noPreview`)})]}):(0,q.jsx)(`p`,{className:`px-4 py-14 text-center text-[14px] text-ink-3`,children:W(`check.noFile`)})}),(0,q.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-3`,children:S.map(e=>(0,q.jsxs)(`div`,{className:B(`min-w-0`,e.type===`text`&&e.format?.style===`multiline`&&`col-span-full`),children:[(0,q.jsx)(`div`,{className:`px-1 pb-0.5 text-[11px] text-ink-3`,children:e.name}),(0,q.jsx)($,{boxed:!0,column:e,value:y.cells[e.id],onCommit:t=>void E(y.id,{[e.id]:t})})]},e.id))}),g?(0,q.jsx)(`p`,{className:`text-[13px] text-rose`,children:g}):null]}):null]})}var tn={xlsx:`Excel`,csv:`CSV`,json:`JSON`,md:`Markdown`,zip:`ZIP`};function nn({runId:e,list:t}){return(0,q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.formats.map(n=>(0,q.jsx)(`a`,{href:r(`/api/runs/${e}/lists/${t.def.id}/download?format=${n}`),className:`inline-flex h-9 items-center rounded-full bg-paper-2 px-3.5 font-medium text-[13px] text-ink-2 transition hover:bg-paper-3 hover:text-ink coarse:h-11 coarse:px-4`,children:tn[n]??n},n))})}function rn(e){return e>1e6?`${(e/1e6).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1e3))} KB`}function an({runId:e}){let[t,n]=(0,K.useState)(!1),[i,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(!1);(0,K.useEffect)(()=>{t&&(c(!1),a.get(`/api/runs/${e}/store`).then(o))},[t,e]);let l=i&&!i.files.length&&!i.connections.length&&!i.keepsSignIns&&i.lists.every(e=>!e.rows);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-1.5 text-[13px] text-ink-4 transition hover:text-ink-2 coarse:min-h-11`,children:[(0,q.jsx)(we,{className:`size-3.5`}),` `,W(`store.open`)]}),(0,q.jsx)(se,{open:t,onClose:()=>n(!1),title:W(`store.title`),wide:!0,children:i?(0,q.jsxs)(`div`,{className:`flex flex-col gap-5 text-[14px]`,children:[(0,q.jsx)(`p`,{className:`text-ink-3`,children:W(`store.explain`)}),l?(0,q.jsx)(`p`,{className:`text-ink-2`,children:W(`store.empty`)}):null,i.lists.some(e=>e.rows)?(0,q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:i.lists.filter(e=>e.rows).map(e=>(0,q.jsxs)(`li`,{className:`flex justify-between gap-3`,children:[(0,q.jsx)(`span`,{children:e.title}),(0,q.jsx)(`span`,{className:`text-ink-3 tabular-nums`,children:W(`store.rows`,{n:e.rows})})]},e.id))}):null,i.connections.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(m,{className:`size-4 text-ink-3`}),` `,e.account?.label]},e.id)),i.keepsSignIns?(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(A,{className:`size-4 text-ink-3`}),` `,W(`store.signIns`)]}):null,i.files.length?(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`mb-1 text-ink-3`,children:W(`store.files`,{n:i.files.length,size:rn(i.files.reduce((e,t)=>e+t.size,0))})}),(0,q.jsx)(`ul`,{className:`max-h-56 overflow-y-auto rounded-lg ring-1 ring-border-soft`,children:i.files.map(t=>(0,q.jsx)(`li`,{className:`border-border-soft border-b last:border-0`,children:(0,q.jsxs)(`a`,{href:r(`/api/runs/${e}/store/files/${t.path}`),className:`flex items-center gap-2 px-3 py-2 text-[13px] hover:bg-paper-2 coarse:min-h-11`,title:t.source??void 0,children:[(0,q.jsx)(P,{className:`size-3.5 shrink-0 text-ink-3`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.path}),(0,q.jsx)(`span`,{className:`text-ink-4 tabular-nums`,children:rn(t.size)})]})},t.path))})]}):null,(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[l?(0,q.jsx)(`span`,{}):s?(0,q.jsxs)(U,{variant:`secondary`,onClick:async()=>{await a.del(`/api/runs/${e}/store`),o(await a.get(`/api/runs/${e}/store`)),c(!1)},children:[(0,q.jsx)(S,{className:`size-4`}),` `,W(`store.confirmDelete`)]}):(0,q.jsxs)(U,{variant:`ghost`,onClick:()=>c(!0),children:[(0,q.jsx)(S,{className:`size-4`}),` `,W(`store.delete`)]}),(0,q.jsx)(U,{onClick:()=>n(!1),children:W(`common.close`)})]})]}):(0,q.jsx)(`div`,{className:`flex justify-center py-8 text-ink-4`,children:(0,q.jsx)(R,{})})})]})}var on=300;function sn(){if(typeof MediaRecorder<`u`)return[`audio/webm;codecs=opus`,`audio/mp4`,`audio/webm`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function cn(e){return`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`}function ln({value:e,runId:t,onChange:n,onBusy:r}){let i=ae(e)?e:null,[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(0),[u,d]=(0,K.useState)(!1),[f,m]=(0,K.useState)(null),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(null),b=(0,K.useRef)(null),x=(0,K.useRef)(null),S=sn(),C=p&&!!S;(0,K.useEffect)(()=>()=>{b.current&&(b.current.recorder.onstop=null,b.current.stop())},[]),(0,K.useEffect)(()=>()=>{_&&URL.revokeObjectURL(_.url)},[_]);let w=async(e,i)=>{d(!0),r?.(!0),m(null);try{let r=await a.upload(`/api/runs/${t}/uploads`,e);v({asset:r.id,url:URL.createObjectURL(e)}),n({asset:r.id,...i===void 0?{}:{seconds:i}})}catch(e){m(e.message)}finally{d(!1),r?.(!1)}},T=async()=>{m(null),g(!1);let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0}})}catch{g(!0);return}let t=[],n=new MediaRecorder(e,{mimeType:S,audioBitsPerSecond:48e3}),i=Date.now(),a=new AudioContext,o=a.createAnalyser();o.fftSize=256,a.createMediaStreamSource(e).connect(o);let c=new Uint8Array(o.fftSize),u=0,d=()=>{o.getByteTimeDomainData(c);let e=0;for(let t of c)e=Math.max(e,Math.abs(t-128));if(l(Math.min(1,e/64)),s((Date.now()-i)/1e3),(Date.now()-i)/1e3>=on){f();return}u=requestAnimationFrame(d)},f=()=>{cancelAnimationFrame(u),n.state!==`inactive`&&n.stop();for(let t of e.getTracks())t.stop();a.close().catch(()=>void 0),b.current=null,s(null),l(0)};n.ondataavailable=e=>e.data.size&&t.push(e.data),n.onstop=()=>{let e=(n.mimeType||S||`audio/webm`).split(`;`)[0],r=e===`audio/mp4`?`m4a`:e===`audio/ogg`?`ogg`:`webm`,a=Math.max(1,Math.round((Date.now()-i)/1e3));w(new File(t,`sprachnotiz-${Ct()}.${r}`,{type:e}),a)},b.current={recorder:n,stop:f},r?.(!0),n.start(1e3),u=requestAnimationFrame(d)},E=o!==null,D=(0,q.jsxs)(U,{variant:`secondary`,onClick:()=>x.current?.click(),children:[(0,q.jsx)(Oe,{className:`size-4`}),` `,W(`voice.pick`)]});return(0,q.jsxs)(`div`,{children:[E?(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-ember`,children:[(0,q.jsxs)(`span`,{className:`relative flex size-11 shrink-0 items-center justify-center`,children:[(0,q.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-rose-tint transition-transform duration-75`,style:{transform:`scale(${.7+c*.5})`}}),(0,q.jsx)(`span`,{className:`relative size-3.5 animate-pulse-dot rounded-full bg-rose`})]}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`div`,{className:`font-medium text-[15px] tabular-nums`,children:cn(o)}),(0,q.jsx)(`div`,{className:`text-[13px] text-ink-3`,children:o>270?W(`voice.left`,{s:Math.ceil(on-o)}):W(`voice.recording`)})]}),(0,q.jsxs)(U,{onClick:()=>b.current?.stop(),children:[(0,q.jsx)(y,{className:`size-3.5 fill-current`}),` `,W(`voice.stop`)]})]}):u?(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-4 text-[14px] text-ink-3 ring-1 ring-input`,children:[(0,q.jsx)(R,{className:`size-4`}),` `,W(`run.uploading`)]}):i?(0,q.jsxs)(`div`,{className:`rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,q.jsx)(`audio`,{controls:!0,preload:`metadata`,src:_?.asset===i.asset?_.url:`/api/runs/${t}/assets/${i.asset}`,className:`h-11 w-full`}),i.transcript?(0,q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap px-1 text-[14px] text-ink-2 leading-relaxed`,children:i.transcript}):null,(0,q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,q.jsx)(`span`,{className:`px-1 text-[13px] text-ink-3`,children:i.seconds?cn(i.seconds):null}),(0,q.jsxs)(`div`,{className:`flex gap-1`,children:[C?(0,q.jsxs)(U,{variant:`ghost`,size:`sm`,onClick:()=>void T(),children:[(0,q.jsx)(Je,{className:`size-3.5`}),` `,W(`voice.again`)]}):null,(0,q.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>n(void 0),children:W(`voice.remove`)})]})]})]}):(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[C?(0,q.jsxs)(U,{variant:`secondary`,size:`lg`,onClick:()=>void T(),className:`w-full sm:w-auto`,children:[(0,q.jsx)(F,{className:`size-4`}),` `,W(`voice.start`)]}):D,C&&h?D:null]}),h?(0,q.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[13px] text-ink-2 leading-relaxed`,children:W(`voice.denied`)}):(0,q.jsx)(`p`,{className:`mt-2 text-[13px] text-ink-3 leading-relaxed`,children:W(C?`voice.why`:`voice.noRecorder`)})]}),(0,q.jsx)(`input`,{ref:x,type:`file`,hidden:!0,accept:`audio/*`,capture:!0,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&w(t,void 0)}}),f?(0,q.jsx)(`div`,{className:`mt-2 text-[13px] text-rose`,children:f}):null]})}function un(e,t){try{return new Intl.NumberFormat(void 0,{style:`currency`,currency:t}).format(e)}catch{return`${e.toFixed(2)} ${t}`}}function dn({field:e,value:t,values:n,onChange:r}){let i=e.columns??[],a=Array.isArray(t)&&t.length?t:[{}],o=re(e,a,n),s=(e,t,n)=>{r(a.map((r,i)=>i===e?{...r,[t]:n}:r))},c=i.map(e=>e.kind===`text`&&e===i[0]?`minmax(0,3fr)`:`minmax(0,1fr)`).join(` `);return(0,q.jsxs)(`div`,{className:`rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,q.jsx)(`div`,{className:`hidden gap-2 px-2 pt-1 pb-2 text-[12px] text-ink-3 sm:grid`,style:{gridTemplateColumns:`${c} 36px`},children:i.map(e=>(0,q.jsx)(`div`,{className:e.kind===`text`?``:`text-right`,children:e.label},e.id))}),(0,q.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map((e,t)=>(0,q.jsxs)(`div`,{className:`grid grid-cols-6 gap-2 rounded-lg bg-paper p-2 sm:bg-transparent sm:p-0 sm:[grid-template-columns:var(--cols)]`,style:{"--cols":`${c} 36px`},children:[i.map((n,r)=>(0,q.jsxs)(`label`,{className:B(`flex min-w-0 flex-col gap-1 sm:col-span-1`,r===0?`col-span-5`:i.length-1<=2?`col-span-3`:`col-span-2`),children:[(0,q.jsx)(`span`,{className:`px-0.5 text-[11px] text-ink-3 sm:hidden`,children:n.label}),(0,q.jsx)(`input`,{"aria-label":n.label,placeholder:n.label,inputMode:n.kind===`text`?`text`:`decimal`,autoComplete:`off`,value:String(e[n.id]??``),onChange:e=>s(t,n.id,e.target.value),className:B(`h-11 w-full min-w-0 rounded-md border border-transparent bg-paper-2 px-2.5 text-[14px] outline-none placeholder:text-transparent focus:border-focus focus:bg-card sm:placeholder:text-ink-4`,n.kind!==`text`&&`text-right tabular-nums`)})]},n.id)),(0,q.jsx)(V,{label:W(`list.delete`),onClick:()=>r(a.filter((e,n)=>n!==t)),className:`order-first col-start-6 row-start-1 size-11 justify-self-end self-end sm:order-none sm:col-start-auto sm:row-start-auto`,children:(0,q.jsx)(S,{className:`size-4`})})]},t))}),(0,q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-end justify-between gap-3 px-2 pb-1`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>r([...a,{}]),className:`inline-flex h-9 items-center gap-1.5 rounded-full px-3 text-[13px] text-ink-2 hover:bg-accent coarse:h-11`,children:[(0,q.jsx)(M,{className:`size-4`}),` `,W(`run.addRow`)]}),(0,q.jsxs)(`div`,{className:`text-right text-[13px] tabular-nums`,children:[(0,q.jsxs)(`div`,{className:`text-ink-3`,children:[W(`run.net`),` `,un(o.net,o.currency)]}),o.vatRate?(0,q.jsxs)(`div`,{className:`text-ink-3`,children:[W(`run.vat`,{r:o.vatRate}),` `,un(o.vat,o.currency)]}):null,(0,q.jsxs)(`div`,{className:`font-semibold text-[15px] text-ink`,children:[W(`run.total`),` `,un(o.gross,o.currency)]})]})]})]})}function fn(e){return!!e?.closest(`input, textarea, [contenteditable='true']`)}function pn({field:e,value:t,runId:n,onChange:i,onBusy:o}){let s=(0,K.useRef)(null),c=(0,K.useRef)(null),l=(0,K.useRef)(null),u=(0,K.useRef)(null),[d,f]=(0,K.useState)(!1),[m,g]=(0,K.useState)({}),[_,v]=(0,K.useState)(null),[y,b]=(0,K.useState)(!1),[x,S]=(0,K.useState)(!1),[C,w]=(0,K.useState)(null),T=(0,K.useRef)(null),E=e=>{T.current=e,w(e)},D=e.kind===`image`,k=!!e.multiple,A=k?e.max??30:1,j=D||!!e.camera||!!e.video,M=!D&&!!e.video,N=Array.isArray(t)?t:typeof t==`string`&&t?[t]:[],P=(0,K.useRef)(N);P.current=N;let F=N.length<A,I=async e=>{let t=(D?e.filter(e=>e.type.startsWith(`image/`)):e).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0}));if(!t.length)return;let r=A-(k?P.current.length:0);f(!0),o?.(!0),v(t.length>r&&k?W(`run.maxFiles`,{n:A}):null);try{for(let e of t.slice(0,Math.max(0,r))){let t=await St(e),r=await a.upload(`/api/runs/${n}/uploads`,t);g(e=>({...e,[r.id]:{name:r.name,mime:r.mime}}));let o=k?[...P.current,r.id]:r.id;P.current=k?o:[r.id],i(o)}}catch(e){v(e.message)}finally{f(!1),o?.(!1)}},ne=(0,K.useRef)(I);ne.current=I;let re=e=>{let t=N.filter(t=>t!==e);i(k?t:void 0)},ie=(e,t)=>{let n=P.current.indexOf(e),r=Math.min(P.current.length-1,Math.max(0,t));if(n<0||n===r)return;let a=P.current.filter(t=>t!==e);a.splice(r,0,e),P.current=a,i(a)},ae=k&&N.length>1;(0,K.useEffect)(()=>{if(!F)return;let e=e=>{let t=Array.from(e.clipboardData?.files??[]),n=s.current;if(!t.length||!n||fn(document.activeElement))return;let r=document.querySelectorAll(`[data-upload-field]`);(n.matches(`:hover`)||n.contains(document.activeElement)||r.length===1)&&(e.preventDefault(),ne.current(t))};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[F]);let L=B(`flex flex-col items-center justify-center gap-2 rounded-xl border border-input border-dashed bg-card px-3 text-[14px] text-ink-3 transition hover:border-ember hover:text-ink`,N.length?`py-4`:`py-8`);return(0,q.jsxs)(`div`,{ref:s,"data-upload-field":``,onDragOver:e=>{F&&(e.preventDefault(),S(!0))},onDragLeave:()=>S(!1),onDrop:e=>{S(!1),F&&(e.preventDefault(),I(Array.from(e.dataTransfer.files)))},children:[N.length?(0,q.jsx)(`div`,{className:`mb-2 flex flex-col gap-2`,children:N.map((e,t)=>{let i=m[e],a=i?.mime??(D?`image/`:``);return(0,q.jsxs)(`div`,{"data-file-id":e,className:B(`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input transition-shadow`,C===e&&`relative z-10 shadow-elevated ring-2 ring-ember`),children:[ae?(0,q.jsxs)(`button`,{type:`button`,"aria-label":W(`run.moveFile`,{n:t+1}),title:W(`run.moveFileHint`),className:B(`-mr-1 flex h-14 w-9 shrink-0 touch-none flex-col items-center justify-center gap-0.5 rounded-lg text-ink-3 hover:bg-paper-2 hover:text-ink`,C===e?`cursor-grabbing`:`cursor-grab`),onPointerDown:t=>{try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}E(e)},onPointerMove:t=>{if(T.current!==e)return;let n=document.elementFromPoint(t.clientX,t.clientY)?.closest(`[data-file-id]`),r=n?.getAttribute(`data-file-id`);r&&r!==e&&s.current?.contains(n??null)&&ie(e,P.current.indexOf(r))},onPointerUp:()=>E(null),onPointerCancel:()=>E(null),onKeyDown:n=>{(n.key===`ArrowUp`||n.key===`ArrowDown`)&&(n.preventDefault(),ie(e,t+(n.key===`ArrowUp`?-1:1)))},children:[(0,q.jsx)(`span`,{className:`font-medium text-[12px] tabular-nums`,children:t+1}),(0,q.jsx)(Pe,{className:`size-4`})]}):null,a.startsWith(`image/`)?(0,q.jsx)(`img`,{src:r(`/api/runs/${n}/assets/${e}`),alt:``,className:`size-14 rounded-lg object-cover`}):(0,q.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg bg-paper-2`,children:a.startsWith(`video/`)?(0,q.jsx)(ee,{className:`size-5 text-ink-3`}):(0,q.jsx)(O,{className:`size-5 text-ink-3`})}),(0,q.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[14px]`,children:i?.name??`✓`}),(0,q.jsx)(V,{label:W(`run.removeFile`),onClick:()=>re(e),children:(0,q.jsx)(G,{className:`size-4`})})]},e)})}):null,F?(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>c.current?.click(),className:B(L,`min-w-[9rem] flex-1 px-4`,x&&`border-ember text-ink`),children:[D?(0,q.jsx)(Ie,{className:`size-6`}):(0,q.jsx)(O,{className:`size-6`}),d?W(`run.uploading`):N.length?W(`run.uploadMore`):W(h?`run.uploadTouch`:`run.upload`)]}),j?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>p?b(!0):l.current?.click(),className:B(L,`w-28`),children:[(0,q.jsx)(be,{className:`size-6`}),W(`run.camera`)]}):null,M&&!(p&&Nt)?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>u.current?.click(),className:B(L,`w-28`),children:[(0,q.jsx)(te,{className:`size-6`}),W(`camera.video`)]}):null]}):null,(0,q.jsx)(`input`,{ref:c,type:`file`,hidden:!0,multiple:k,accept:D?`image/*`:void 0,onChange:e=>{I(Array.from(e.target.files??[])),e.target.value=``}}),(0,q.jsx)(`input`,{ref:l,type:`file`,hidden:!0,accept:`image/*`,capture:`environment`,onChange:e=>{I(Array.from(e.target.files??[])),e.target.value=``}}),M?(0,q.jsx)(`input`,{ref:u,type:`file`,hidden:!0,accept:`video/*`,capture:`environment`,onChange:e=>{I(Array.from(e.target.files??[])),e.target.value=``}}):null,(0,q.jsx)(Pt,{open:y,multiple:k,video:M,onClose:()=>b(!1),onCapture:e=>I([e]),onNative:()=>l.current?.click()}),k&&(e.min||e.max)?(0,q.jsx)(`div`,{className:`mt-2 text-[13px] text-ink-3 tabular-nums`,children:e.min&&N.length<e.min?W(`run.filesMin`,{n:N.length,min:e.min}):e.max?W(`run.filesOf`,{n:N.length,max:e.max}):null}):null,_?(0,q.jsx)(`div`,{className:`mt-2 text-[13px] text-rose`,children:_}):null]})}function mn(e){let t=`${e.id} ${e.label}`.toLowerCase();return/telefon|phone|handy|mobil(?!it)|\btel\b|rückruf/.test(t)?{type:`tel`,inputMode:`tel`,autoComplete:`tel`}:/\bplz\b|postleitzahl|postal|zip/.test(t)?{inputMode:`numeric`,autoComplete:`postal-code`}:/iban/.test(t)?{autoCapitalize:`characters`,autoCorrect:`off`,spellCheck:!1}:/vorname|first.?name/.test(t)?{autoComplete:`given-name`,autoCapitalize:`words`}:/nachname|last.?name|surname/.test(t)?{autoComplete:`family-name`,autoCapitalize:`words`}:/firma|unternehmen|company|organi[sz]ation/.test(t)?{autoComplete:`organization`,autoCapitalize:`words`}:/straße|strasse|street|anschrift|adresse|address/.test(t)?{autoComplete:`street-address`,autoCapitalize:`words`}:/\b(ort|stadt|city|town)\b/.test(t)?{autoComplete:`address-level2`,autoCapitalize:`words`}:/\bname\b|ansprechp/.test(t)?{autoComplete:`name`,autoCapitalize:`words`}:{autoCapitalize:`sentences`}}function hn({field:e,value:t,onChange:n}){let[r,i]=(0,K.useState)(!1);return(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(H,{value:t,placeholder:e.placeholder,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>n(e.target.value)}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`inline-flex h-11 shrink-0 items-center gap-2 rounded-lg border border-input bg-card px-3.5 font-medium text-[14px] text-ink-2 transition hover:border-ember hover:text-ink`,children:[(0,q.jsx)(Xe,{className:`size-4`}),` `,W(`scan.button`)]}),(0,q.jsx)(Vt,{open:r,onClose:()=>i(!1),onResult:n})]})}function gn({field:e,value:t,values:n,runId:r,view:i,onChange:a,onBusy:o,error:s}){let c=t==null?``:String(t),l;switch(e.kind){case`textarea`:l=(0,q.jsx)(le,{value:c,placeholder:e.placeholder,autoCapitalize:`sentences`,enterKeyHint:`enter`,onChange:e=>a(e.target.value)});break;case`number`:l=(0,q.jsx)(H,{inputMode:`decimal`,autoComplete:`off`,value:c,placeholder:e.placeholder,onChange:e=>a(e.target.value)});break;case`select`:{let t=e.options??[];l=t.length<=5&&t.every(e=>e.length<=28)?(0,q.jsx)(ce,{value:c,options:t,onChange:a}):(0,q.jsx)(fe,{value:c,placeholder:`—`,onChange:a,options:t.map(e=>({value:e,label:e}))});break}case`multiselect`:l=(0,q.jsx)(ce,{multi:!0,value:Array.isArray(t)?t:[],options:e.options??[],onChange:a});break;case`date`:l=(0,q.jsx)(H,{type:`date`,value:c,onChange:e=>a(e.target.value),className:`w-full sm:w-56`});break;case`email`:l=(0,q.jsx)(H,{type:`email`,inputMode:`email`,autoComplete:`email`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:c,placeholder:e.placeholder,onChange:e=>a(e.target.value)});break;case`url`:l=(0,q.jsx)(H,{type:`url`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:c,placeholder:e.placeholder??`https://`,onChange:e=>a(e.target.value)});break;case`toggle`:l=(0,q.jsx)(de,{checked:t===!0,onChange:a,label:e.label});break;case`color`:l=(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(oe,{value:c||`#e0531b`,onChange:e=>a(e.target.value)}),(0,q.jsx)(H,{value:c,placeholder:`#e0531b`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>a(e.target.value),className:`w-36`})]});break;case`image`:case`file`:l=(0,q.jsx)(pn,{field:e,value:t,runId:r,onChange:a,onBusy:o});break;case`items`:l=(0,q.jsx)(dn,{field:e,value:t,values:n,onChange:a});break;case`connection`:l=(0,q.jsx)(Jt,{runId:r,connection:i?.connections.find(t=>t.id===e.connection)});break;case`list`:{let t=i?.lists.find(t=>t.def.id===e.list);l=t?(0,q.jsx)(Zt,{runId:r,list:t,editable:!0}):null;break}case`location`:l=(0,q.jsx)(Rt,{value:t,runId:r,placeholder:e.placeholder,onChange:a,onBusy:o});break;case`audio`:l=(0,q.jsx)(ln,{value:t,runId:r,onChange:a,onBusy:o});break;case`signature`:l=(0,q.jsx)(Kt,{label:e.label,value:t,runId:r,onChange:a});break;default:l=e.scan?(0,q.jsx)(hn,{field:e,value:c,onChange:a}):(0,q.jsx)(H,{...mn(e),value:c,placeholder:e.placeholder,onChange:e=>a(e.target.value)})}return(0,q.jsxs)(`div`,{children:[e.kind===`toggle`?(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-6`,children:[(0,q.jsx)(L,{hint:e.help,children:e.label}),l]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(L,{hint:e.help,required:e.required,children:e.label}),l]}),s?(0,q.jsx)(`div`,{className:`mt-1.5 text-[13px] text-rose`,children:s}):null]})}var _n=45e3;function vn(e){let[t,n]=(0,K.useState)(null),[i,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)({});(0,K.useEffect)(()=>{if(n(null),l(!1),!e)return;let t=!1,i=0,s,c=null,u=Date.now(),d=()=>{t=!0,c?.close(),l(!0)},f=async()=>{try{let r=await a.get(`/api/runs/${e}`);t||n(r)}catch(e){e instanceof o&&e.status===404&&d()}},p=()=>{if(clearTimeout(s),c?.close(),t)return;let a=new EventSource(r(`/api/runs/${e}/stream`),{withCredentials:!0});c=a,u=Date.now(),a.addEventListener(`view`,e=>{i=0,u=Date.now(),n(JSON.parse(e.data))}),a.addEventListener(`ping`,()=>{u=Date.now()}),a.onerror=()=>{a.close(),!(t||c!==a)&&(c=null,f(),i=Math.min(i+1,6),s=setTimeout(p,500*2**i))}},m=()=>{t||document.visibilityState!==`visible`||(!c||c.readyState===EventSource.CLOSED||Date.now()-u>_n?(i=0,p()):f())},h=setInterval(()=>{!t&&c&&Date.now()-u>_n&&(i=0,p())},15e3);return p(),document.addEventListener(`visibilitychange`,m),window.addEventListener(`pageshow`,m),window.addEventListener(`online`,m),()=>{t=!0,clearTimeout(s),clearInterval(h),document.removeEventListener(`visibilitychange`,m),window.removeEventListener(`pageshow`,m),window.removeEventListener(`online`,m),c?.close()}},[e]);let m=(0,K.useCallback)(async(t,n)=>{if(!e)return!1;d(!0),s(null),p({});try{return await a.post(`/api/runs/${e}/${t}`,n),!0}catch(e){return e instanceof o&&e.status===422&&Array.isArray(e.body?.fields)&&p(Object.fromEntries(e.body.fields.map(e=>[e.field,e.message]))),s(e.message),!1}finally{d(!1)}},[e]);return{view:t,notFound:c,error:i,busy:u,fieldErrors:f,submitPage:(e,t)=>m(`pages/${e}`,{values:t}),accept:(e,t)=>m(`reviews/${e}`,{type:`accept`,edits:t}),regenerate:(e,t,n,r)=>m(`reviews/${e}`,{type:`regenerate`,target:t,note:n,items:r?.length?r:void 0}),back:()=>m(`back`),retry:()=>m(`retry`)}}function yn({view:e}){let t=Math.round(Math.min(e.progress.done,e.progress.total)/Math.max(1,e.progress.total)*100);return(0,q.jsx)(`div`,{className:`h-[3px] w-full bg-paper-2`,children:(0,q.jsx)(`div`,{className:`h-full bg-ember transition-[width] duration-700 ease-out`,style:{width:`${t}%`}})})}function bn({title:e,description:t,kicker:n}){return(0,q.jsxs)(`div`,{className:`mb-8`,children:[n?(0,q.jsx)(`p`,{className:`mb-4 text-[15px] text-ink-2 leading-relaxed`,children:n}):null,(0,q.jsx)(`h1`,{className:`font-display font-semibold text-[28px] leading-[1.15] tracking-tight sm:text-[32px]`,children:e}),t?(0,q.jsx)(`p`,{className:`mt-2 text-[15px] text-ink-3 leading-relaxed`,children:t}):null]})}function xn(e,t){let n={};for(let r of e.fields)n[r.id]=t.values[r.id]??t.prefill?.[r.id]??r.default??(r.kind===`multiselect`?[]:void 0);return n}function Sn(e){return Array.from(e.querySelectorAll(`input:not([type="hidden"], [type="file"], [type="checkbox"], [type="color"], [type="range"], [disabled]), textarea:not([disabled])`)).filter(e=>!e.closest(`dialog`)&&e.offsetParent!==null)}function Cn({view:e,run:t,step:n}){let[r,i]=(0,K.useState)(()=>xn(n,e)),[a,o]=(0,K.useState)(new Set),s=(0,K.useRef)(null),c=e.progress.done===0,l=()=>void t.submitPage(n.id,r);return(0,K.useEffect)(()=>{if(!s.current)return;let e=Sn(s.current).filter(e=>e instanceof HTMLInputElement);for(let[t,n]of e.entries())(n.dataset.hint||!n.hasAttribute(`enterkeyhint`))&&(n.dataset.hint=`1`,n.setAttribute(`enterkeyhint`,t===e.length-1?`go`:`next`))}),(0,q.jsxs)(`form`,{ref:s,className:`animate-rise`,onSubmit:e=>{e.preventDefault(),a.size||l()},onKeyDown:e=>{let t=e.target;if(e.key!==`Enter`||e.defaultPrevented||e.nativeEvent.isComposing||!(t instanceof HTMLInputElement)||t.closest(`dialog`))return;let n=Sn(e.currentTarget),r=n[n.indexOf(t)+1];r&&(e.preventDefault(),r.focus())},children:[(0,q.jsx)(bn,{title:n.title,description:n.description,kicker:c?e.wizard.intro:null}),(0,q.jsx)(`div`,{className:`flex flex-col gap-7`,children:n.fields.map(n=>(0,q.jsx)(gn,{field:n,value:r[n.id],values:r,runId:e.id,view:e,error:t.fieldErrors[n.id],onChange:e=>i(t=>({...t,[n.id]:e})),onBusy:e=>o(t=>{if(t.has(n.id)===e)return t;let r=new Set(t);return e?r.add(n.id):r.delete(n.id),r})},n.id))}),(0,q.jsx)(wn,{view:e,run:t,sticky:!0,children:(0,q.jsxs)(U,{type:`submit`,size:`lg`,busy:t.busy,disabled:a.size>0,children:[n.cta||W(`run.next`),` `,(0,q.jsx)(u,{className:`size-4`})]})})]})}function wn({view:e,run:t,sticky:n,children:r}){return(0,q.jsxs)(`div`,{className:B(`mt-10 flex items-center justify-between gap-3`,n&&`action-bar`),children:[e.canBack?(0,q.jsxs)(U,{variant:`ghost`,onClick:()=>void t.back(),disabled:t.busy,children:[(0,q.jsx)(l,{className:`size-4`}),` `,W(`run.back`)]}):(0,q.jsx)(`span`,{}),r]})}function Tn(){let e=_(),[t,n]=(0,K.useState)(!1),r=e!==`off`;return(0,q.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2`,children:[(0,q.jsxs)(`button`,{type:`button`,"aria-pressed":r,disabled:t,onClick:async()=>{if(r){C();return}n(!0),await T(),n(!1)},className:B(`inline-flex h-11 items-center gap-2 rounded-full px-4 font-medium text-[14px] ring-1 transition`,r?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink hover:ring-ink-4`),children:[r?(0,q.jsx)(ge,{className:`size-4 text-ember-strong`}):(0,q.jsx)(ve,{className:`size-4`}),W(r?`notify.on`:`notify.ask`)]}),(0,q.jsx)(`p`,{className:`max-w-xs text-[12px] text-ink-4 leading-relaxed`,children:W(e===`off`?`notify.why`:e===`on`?`notify.onHint`:x()?`notify.blocked`:`notify.quiet`)})]})}function En({view:e,compact:t,awake:n}){let a=(0,K.useMemo)(()=>{let t=[...e.events].reverse().find(t=>t.type===`step_started`&&t.stepId===e.step?.id);return t?new Date(t.at).getTime():Date.now()},[e.events,e.step?.id]),[o,s]=(0,K.useState)(Date.now());(0,K.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]);let c=[...e.events].reverse().find(t=>t.type===`step_started`&&t.stepId===e.step?.id)?.message??e.step?.title??W(`run.working`),l=e.events.filter(e=>(e.type===`tool`||e.type===`info`)&&new Date(e.at).getTime()>=a-500),u=l.slice(-4),d=[...new Set(l.map(e=>e.asset).filter(e=>!!e))],f=[...l].reverse().find(e=>e.asset)?.asset;return(0,q.jsxs)(`div`,{className:`flex animate-rise flex-col items-center pt-6 text-center`,children:[(0,q.jsx)(i,{kind:e.wizard.avatar,size:t?130:170,fluffy:!0}),(0,q.jsx)(`h2`,{className:`mt-4 font-display font-semibold text-[22px] tracking-tight`,children:c}),(0,q.jsx)(`div`,{className:`mt-1 text-[13px] text-ink-4 tabular-nums`,children:W(`run.elapsed`,{s:Math.max(0,Math.round((o-a)/1e3))})}),d.length?(0,q.jsx)(`div`,{className:`mt-5 flex max-w-full flex-wrap justify-center gap-2`,children:d.slice(-8).map(t=>(0,q.jsx)(`img`,{src:r(`/api/runs/${e.id}/assets/${t}`),alt:``,className:B(`size-16 animate-rise rounded-lg bg-paper-2 object-cover ring-1 ring-border-soft transition sm:size-20`,t===f?`ring-2 ring-ember`:`opacity-70`)},t))}):null,(0,q.jsx)(`div`,{className:`mt-6 flex min-h-[7rem] w-full max-w-sm flex-col gap-1.5`,children:u.map((e,t)=>(0,q.jsxs)(`div`,{className:B(`flex items-center justify-center gap-2 text-[13px] transition-opacity`,t===u.length-1?`text-ink-2`:`text-ink-4`),children:[t===u.length-1?(0,q.jsx)(v,{className:`size-3.5 animate-breathe text-ember`}):null,(0,q.jsx)(`span`,{className:`truncate`,children:e.message})]},e.id))}),t?null:(0,q.jsx)(Tn,{}),n?(0,q.jsx)(`p`,{className:`mt-3 text-[12px] text-ink-4`,children:W(`run.awake`)}):null]})}function Dn(e){let t=(0,K.useRef)({running:!1,since:0,ask:null});(0,K.useEffect)(()=>{if(!e)return;let n=t.current,r=e.status===`running`,i=r?n.running?n.since:Date.now():0,a=t=>{document.visibilityState!==`visible`&&!document.title.startsWith(`● `)&&(document.title=`● ${document.title}`),D({title:e.wizard.title,body:t,tag:e.id})};r&&e.ask&&e.ask.id!==n.ask?a(W(`notify.needsYou`)):!r&&n.running&&Date.now()-n.since>8e3&&a(e.status===`failed`?W(`run.failed`):e.status===`done`?W(`notify.done`):W(`notify.next`)),t.current={running:r,since:i,ask:e.ask?.id??null}},[e]),(0,K.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&document.title.startsWith(`● `)&&(document.title=document.title.slice(2))};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[])}function On({view:e,run:t,step:n}){let[r,i]=(0,K.useState)({}),[a,o]=(0,K.useState)({}),[s,c]=(0,K.useState)(``),l=e.shown.filter(e=>e.output),[d,p]=(0,K.useState)(l.length===1?l[0].step.id:null),[m,h]=(0,K.useState)({}),g=(0,K.useRef)(null),_=l.find(e=>e.step.id===d),v=_?.step.type===`generate`&&(_.output?.assets?.length??0)>1,y=()=>{_&&s.trim()&&t.regenerate(n.id,_.step.id,s.trim(),m[_.step.id])};return(0,q.jsxs)(`div`,{className:`animate-rise`,children:[(0,q.jsx)(bn,{title:n.title,description:n.description}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.shown.map(({step:t,output:s})=>{let c=!!n.edit&&t.type===`agent`&&t.output.format!==`json`;return(0,q.jsxs)(`section`,{children:[(0,q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,q.jsx)(`h3`,{className:`font-medium text-[13px] text-ink-3 uppercase tracking-[0.06em]`,children:t.title}),(0,q.jsx)(`div`,{className:`flex items-center`,children:c&&!a[t.id]?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>({...e,[t.id]:!0})),className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[13px] text-ink-2 hover:bg-accent hover:text-ink coarse:h-11`,children:[(0,q.jsx)(f,{className:`size-3.5`}),` `,W(`run.edit`)]}):null})]}),(0,q.jsx)(b,{base:`/api/runs/${e.id}`,step:t,output:s,editable:c&&a[t.id],draft:r[t.id],onDraft:e=>i(n=>({...n,[t.id]:e})),picked:m[t.id],onPick:n.regenerate?e=>{p(t.id),h(n=>{let r=n[t.id]??[];return{...n,[t.id]:r.includes(e)?r.filter(t=>t!==e):[...r,e]}}),g.current?.focus()}:void 0})]},t.id)}),e.lists.map(t=>(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h3`,{className:`mb-2 font-medium text-[13px] text-ink-3 uppercase tracking-[0.06em]`,children:t.def.title}),t.def.check?(0,q.jsx)(en,{runId:e.id,list:t}):(0,q.jsx)(Zt,{runId:e.id,list:t,editable:!0})]},t.def.id)),n.regenerate&&l.length?(0,q.jsxs)(ue,{className:`p-3`,children:[l.length>1?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 pb-2`,children:[(0,q.jsx)(`span`,{className:`mr-1 text-[13px] text-ink-3`,children:W(`run.feedbackTarget`)}),l.map(({step:e})=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":d===e.id,onClick:()=>{p(e.id),g.current?.focus()},className:B(`inline-flex h-8 items-center rounded-full px-3 text-[13px] ring-1 transition coarse:h-11`,d===e.id?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink`),children:e.title},e.id))]}):null,(0,q.jsx)(le,{ref:g,minRows:2,maxRows:8,value:s,placeholder:W(`run.feedbackPlaceholder`),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())},className:`border-0 bg-transparent shadow-none focus:ring-0`}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1 pt-1`,children:[(0,q.jsx)(`span`,{className:`min-w-0 text-[12px] text-ink-3`,children:v?m[_.step.id]?.length?W(`run.regeneratePicked`,{n:[...m[_.step.id]].sort((e,t)=>e-t).map(e=>e+1).join(`, `)}):W(`run.regenerateAll`):!_&&s.trim()?W(`run.feedbackPick`):null}),(0,q.jsxs)(U,{size:`sm`,variant:`secondary`,busy:t.busy,disabled:!s.trim()||!_,onClick:y,children:[(0,q.jsx)(ie,{className:`size-3.5`}),` `,W(`run.regenerateGo`)]})]})]}):null]}),(0,q.jsx)(wn,{view:e,run:t,sticky:!0,children:(0,q.jsxs)(U,{size:`lg`,busy:t.busy,onClick:()=>void t.accept(n.id,Object.keys(r).length?r:void 0),children:[W(`run.accept`),` `,(0,q.jsx)(u,{className:`size-4`})]})})]})}function kn({view:e,run:t,step:n,onRestart:r}){let a=e.shown.filter(e=>e.output);return(0,q.jsxs)(`div`,{className:`animate-rise`,children:[(0,q.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center gap-x-4 gap-y-5`,children:[(0,q.jsx)(i,{kind:e.wizard.avatar,size:64}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 basis-[12rem]`,children:[(0,q.jsx)(`h1`,{className:`text-balance font-display font-semibold text-[28px] leading-tight tracking-tight sm:text-[32px]`,children:n.title}),n.message?(0,q.jsx)(`p`,{className:`mt-1 text-[15px] text-ink-3`,children:n.message}):null]}),e.shown.some(e=>e.output)?(0,q.jsx)(`div`,{className:`max-sm:basis-full`,children:(0,q.jsx)(lt,{runId:e.id,title:`${n.title} · ${e.wizard.title}`,initial:e.shareUrl?{url:e.shareUrl,expiresAt:e.expiresAt}:null})}):null]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[a.map(({step:t,output:n,formats:r,label:i})=>(0,q.jsxs)(ue,{className:`p-4 sm:p-5`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,q.jsx)(`h3`,{className:`font-display font-semibold text-[17px]`,children:i??t.title}),(0,q.jsx)(E,{base:`/api/runs/${e.id}`,stepId:t.id,formats:r,title:i??t.title})]}),(0,q.jsx)(b,{base:`/api/runs/${e.id}`,step:t,output:n}),n?.assets?.some(e=>e.ai)?(0,q.jsx)(`p`,{className:`mt-3 text-[12px] text-ink-3 leading-relaxed`,children:W(`ai.publish`)}):null]},t.id)),e.lists.map(t=>(0,q.jsxs)(ue,{className:`p-4 sm:p-5`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,q.jsx)(`h3`,{className:`font-display font-semibold text-[17px]`,children:t.label??t.def.title}),(0,q.jsx)(nn,{runId:e.id,list:t})]}),(0,q.jsx)(Zt,{runId:e.id,list:t,editable:!0})]},t.def.id))]}),(0,q.jsx)(wn,{view:e,run:t,children:r?(0,q.jsxs)(U,{variant:`secondary`,onClick:r,children:[(0,q.jsx)(Je,{className:`size-4`}),` `,W(`run.again`)]}):(0,q.jsx)(`span`,{})})]})}function An({view:e,run:t}){return(0,q.jsxs)(`div`,{className:`flex animate-rise flex-col items-center pt-8 text-center`,children:[(0,q.jsx)(i,{kind:e.wizard.avatar,size:90}),(0,q.jsx)(`h2`,{className:`mt-4 font-display font-semibold text-[22px]`,children:W(`run.failed`)}),(0,q.jsx)(`p`,{className:`mt-2 max-w-md text-[15px] text-ink-3`,children:e.error}),(0,q.jsxs)(`div`,{className:`mt-8 flex gap-3`,children:[e.canBack?(0,q.jsxs)(U,{variant:`ghost`,onClick:()=>void t.back(),children:[(0,q.jsx)(l,{className:`size-4`}),` `,W(`run.back`)]}):null,(0,q.jsxs)(U,{onClick:()=>void t.retry(),busy:t.busy,children:[(0,q.jsx)(Je,{className:`size-4`}),` `,W(`run.retry`)]})]})]})}function jn({runId:e,compact:t,onRestart:n,onView:r}){let i=vn(e),{view:a}=i;(0,K.useEffect)(()=>{r?.(a)},[a,r]),g();let o=w(a?.status===`running`&&!a.ask);if(Dn(a),i.notFound)return(0,q.jsx)(`div`,{className:`py-24 text-center text-ink-3`,children:W(`run.notFound`)});if(!a)return(0,q.jsx)(`div`,{className:`flex justify-center py-24 text-ink-4`,children:(0,q.jsx)(R,{})});let s=a.step,c=null;if(a.status===`running`&&a.ask)c=(0,q.jsx)(ut,{runId:a.id,ask:a.ask},a.ask.id);else if(a.status===`running`)c=(0,q.jsx)(En,{view:a,compact:t,awake:o});else if(a.status===`failed`)c=(0,q.jsx)(An,{view:a,run:i});else if(a.status===`cancelled`)c=(0,q.jsx)(`div`,{className:`py-24 text-center text-ink-3`,children:W(`run.cancelled`)});else if(s?.type===`page`)c=(0,q.jsx)(Cn,{view:a,run:i,step:s},s.id);else if(s?.type===`review`){let e=a.shown.map(e=>e.output?.at??``).join(`|`);c=(0,q.jsx)(On,{view:a,run:i,step:s},`${s.id}:${e}`)}else s?.type===`result`&&(c=(0,q.jsx)(kn,{view:a,run:i,step:s,onRestart:n}));let l=s?.type===`review`&&a.status===`waiting_input`&&a.lists.some(e=>e.def.check);return(0,q.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,q.jsx)(yn,{view:a}),(0,q.jsxs)(`div`,{className:B(`safe-x mx-auto w-full flex-1`,l?`max-w-[1240px] py-8`:t?`max-w-[620px] py-8`:`max-w-[640px] py-8 sm:py-16`),children:[c,i.error&&a.status!==`failed`?(0,q.jsx)(`div`,{className:`mt-4 rounded-lg bg-rose-tint px-4 py-3 text-[14px] text-rose`,children:i.error}):null,a.keeps&&a.status!==`running`?(0,q.jsx)(`div`,{className:`mt-10 flex justify-center`,children:(0,q.jsx)(an,{runId:a.id})}):null]})]})}export{Qe as n,me as r,jn as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-Dk72oS4N.js";import{A as r,C as i,D as a,O as o,S as s,c,d as l,i as u,n as d,tt as f}from"./api-DbPn6Dge.js";import{t as p}from"./createLucideIcon-DBu2Ovxj.js";import{t as m}from"./arrow-right-CucQycEy.js";import{S as h,_ as g,b as _,g as ee,m as v,r as te,x as ne,y as re}from"./outputs-BJ6FXJP6.js";import{t as y}from"./check-Bjx41xbB.js";import{n as b,r as ie,t as ae}from"./wand-sparkles-Bf97fs8T.js";import{r as oe,t as se}from"./ChatPanel-BORDbEJt.js";import{n as ce,t as x}from"./plus-HA210wXA.js";import{t as S}from"./external-link-CRg6DVdO.js";import{n as le}from"./mic-CeqQ89Dj.js";import{p as ue}from"./definition-cy7uvY5L.js";import{n as de,r as fe,t as pe}from"./type-BzYgVWKL.js";import{t as me}from"./upload-DsgLfQ3U.js";import{c as C,d as w,f as he,g as ge,h as T,i as E,l as _e,m as D,n as O,o as k,p as ve,r as A,s as j,t as M,u as ye,v as N}from"./ui-tO4ZXbfh.js";import{a as be,c as xe,d as Se,g as P,i as Ce,l as we,o as Te,r as Ee,s as De}from"./index-BYV0HYlP.js";import{o as Oe,r as ke,t as Ae}from"./LocalRuntime-B33qoSb2.js";import{ProjectSwitcher as je}from"./HomePage-BaVY5u1C.js";var Me={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Me.node;var Ne=p(Me),Pe={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};Pe.node;var Fe=p(Pe),Ie={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};Ie.node;var Le=p(Ie),Re={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};Re.node;var ze=p(Re),Be={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};Be.node;var Ve=p(Be),He={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};He.node;var Ue=p(He),We={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};We.node;var Ge=p(We),Ke={name:`music`,size:24,node:[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]};Ke.node;var qe=p(Ke),Je={name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};Je.node;var Ye=p(Je),Xe={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};Xe.node;var Ze=p(Xe),Qe={name:`toggle-left`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};Qe.node;var $e=p(Qe),F=e(t(),1),et=e=>[`project-files`,e];function tt(e){return r({queryKey:et(e),queryFn:()=>d.get(`/api/studio/projects/${e}/files`),refetchInterval:e=>e.state.data?.files.some(e=>e.status===`pending`)?2e3:!1})}function I(e,t){return c(`/api/studio/projects/${e}/files/${t}/content`)}function L(e){let t=f(),[n,r]=(0,F.useState)(!1),[i,a]=(0,F.useState)(null),o=()=>t.invalidateQueries({queryKey:et(e)}),s=async e=>{a(null);try{await e()}catch(e){a(e.message)}finally{await o()}};return{busy:n,error:i,upload:async(t,n)=>{r(!0),await s(async()=>{for(let r of n)await d.upload(`/api/studio/projects/${e}/files?kind=${t}`,r),await o()}),r(!1)},describe:(t,n)=>s(()=>d.patch(`/api/studio/projects/${e}/files/${t}`,{description:n})),remove:t=>s(()=>d.del(`/api/studio/projects/${e}/files/${t}`)),reindex:t=>s(()=>d.post(`/api/studio/projects/${e}/files/${t}/reindex`)),order:(t,n)=>s(()=>d.put(`/api/studio/projects/${e}/files/order`,{kind:t,ids:n}))}}function nt(e,t){let n=`wz.layout.${e}`,[r,i]=(0,F.useState)(()=>{try{let e=localStorage.getItem(n);return e===`list`||e===`cards`?e:t}catch{return t}});return[r,()=>i(e=>{let t=e===`list`?`cards`:`list`;try{localStorage.setItem(n,t)}catch{}return t})]}function R(e,t,n=700){let[r,i]=(0,F.useState)(`idle`),[a,o]=(0,F.useState)(null),s=JSON.stringify(e),c=(0,F.useRef)(s),l=(0,F.useRef)({value:e,json:s,save:t});l.current={value:e,json:s,save:t};let u=(0,F.useRef)(Promise.resolve()),d=(0,F.useCallback)(()=>{let e=l.current;e.json!==c.current&&(c.current=e.json,i(`saving`),u.current=u.current.then(async()=>{try{await e.save(e.value),o(null),i(`saved`)}catch(e){c.current=``,o(e.message),i(`error`)}}))},[]);return(0,F.useEffect)(()=>{if(s===c.current)return;let e=setTimeout(d,n);return()=>clearTimeout(e)},[s,n,d]),(0,F.useEffect)(()=>d,[d]),{state:r,error:a}}function z(e){return e<1e6?`${Math.max(1,Math.round(e/1e3))} KB`:`${(e/1e6).toFixed(1)} MB`}var B=n();function V({title:e,hint:t,save:n,action:r,children:i}){return(0,B.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-1`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),n?.state===`saving`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,B.jsx)(w,{className:`size-3`}),` `,N(`project.saving`)]}):n?.state===`saved`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-moss`,children:[(0,B.jsx)(y,{className:`size-3.5`}),` `,N(`settings.saved`)]}):null]}),t?(0,B.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-snug`,children:t}):null]}),r?(0,B.jsx)(`div`,{className:`shrink-0`,children:r}):null]}),(0,B.jsxs)(O,{className:`p-5`,children:[i,n?.state===`error`&&n.error?(0,B.jsx)(`p`,{className:`mt-4 text-[14px] text-rose`,children:n.error}):null]})]})}function rt({children:e,layout:t,onToggle:n}){return(0,B.jsxs)(`div`,{className:`mb-3 flex items-start gap-2`,children:[(0,B.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,B.jsx)(`div`,{className:`w-56 max-w-full transition-[width] duration-200 focus-within:w-full has-[input:not(:placeholder-shown)]:w-full`,children:e})}),(0,B.jsx)(k,{label:N(t===`list`?`project.viewCards`:`project.viewList`),onClick:n,children:t===`list`?(0,B.jsx)(Ue,{className:`size-4`}):(0,B.jsx)(Ge,{className:`size-4`})})]})}function it({value:e,onChange:t,onEnter:n,placeholder:r,busy:i}){return(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(fe,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-4`}),(0,B.jsx)(`input`,{type:`search`,value:e,placeholder:r,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&n?.(),className:`h-9 w-full rounded-lg border border-input bg-card pr-3 pl-9 text-[14px] text-ink outline-none transition placeholder:text-ink-4 focus:border-focus focus:ring-4 focus:ring-focus-glow`}),i?(0,B.jsx)(w,{className:`-translate-y-1/2 absolute top-1/2 right-3 size-4 text-ink-3`}):null]})}function H({onFiles:e,accept:t,multiple:n=!0,className:r,children:i}){return(0,B.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),e.currentTarget.dataset.over=`1`},onDragLeave:e=>{delete e.currentTarget.dataset.over},onDrop:t=>{t.preventDefault(),delete t.currentTarget.dataset.over;let r=Array.from(t.dataTransfer.files);r.length&&e(n?r:r.slice(0,1))},className:T(`flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-input border-dashed text-[14px] text-ink-3 transition focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow hover:border-ink-4 hover:text-ink data-[over]:border-focus data-[over]:bg-paper-2 data-[over]:text-ink`,r),children:[i,(0,B.jsx)(`input`,{className:`sr-only`,type:`file`,accept:t,multiple:n,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length&&e(n)}})]})}var at=`mt-1.5 text-[13px] text-ink-3`;function ot({me:e}){let t=f(),n=e.mode===`managed`,[r,i]=(0,F.useState)(e.profile),a=e=>i(t=>({...t,...e})),o=R(r,async e=>{await d.put(`/api/studio/profile`,e),await t.invalidateQueries({queryKey:[`me`]})}),s=e.manageUrl?`${e.manageUrl}/account`:e.account?.url??null;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,B.jsx)(V,{title:N(`account.title`),hint:N(`account.hint`),save:o,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:gap-8`,children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 sm:w-32`,children:[(0,B.jsx)(`div`,{className:`flex size-20 items-center justify-center overflow-hidden rounded-full bg-ember-tint font-semibold text-[28px] text-ember-strong ring-1 ring-border-soft`,children:e.user.image?(0,B.jsx)(`img`,{src:e.user.image,alt:``,className:`size-full object-cover`}):Te(r.name)||`?`}),(0,B.jsx)(`p`,{className:`text-center text-[12px] text-ink-3 leading-snug`,children:N(`account.initials`)})]}),(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(C,{children:N(`account.name`)}),(0,B.jsx)(j,{value:r.name,maxLength:80,disabled:n,onChange:e=>a({name:e.target.value})}),(0,B.jsx)(`p`,{className:at,children:N(n?`account.fromAccount`:`account.nameHint`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(C,{children:N(`account.about`)}),(0,B.jsx)(D,{minRows:3,maxLength:2e3,value:r.about,onChange:e=>a({about:e.target.value})}),(0,B.jsx)(`p`,{className:at,children:N(`account.aboutHint`)})]}),(0,B.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(C,{children:N(`account.email`)}),(0,B.jsx)(j,{type:`email`,value:r.email,maxLength:200,disabled:n,onChange:e=>a({email:e.target.value})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(C,{children:N(`account.phone`)}),(0,B.jsx)(j,{type:`tel`,value:r.phone,maxLength:40,onChange:e=>a({phone:e.target.value})})]})]})]})]})}),(0,B.jsx)(V,{title:N(`account.connection`),hint:N(`account.connectionHint`),children:e.mode===`local`&&!e.account?(0,B.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,B.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-2`,children:(0,B.jsx)(Le,{className:`size-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`div`,{className:`font-medium text-[15px]`,children:N(`account.local`)}),(0,B.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-relaxed`,children:N(`account.localText`)})]})]}):(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`truncate font-medium text-[15px]`,children:e.account?.name??e.user.name}),(0,B.jsx)(A,{tone:`live`,children:N(`account.linked`)})]}),(0,B.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:e.account?.email??e.user.email})]}),s?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>ke(s),className:`inline-flex h-10 items-center gap-2 rounded-full border border-border bg-card px-4 font-medium text-sm transition hover:bg-paper-2`,children:[N(`setup.openAccount`),` `,(0,B.jsx)(S,{className:`size-4`})]}):null]})}),(0,B.jsx)(V,{title:N(`account.look`),hint:N(`account.lookHint`),children:(0,B.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pb-4`,children:[(0,B.jsx)(`span`,{className:`font-medium text-[14px]`,children:N(`nav.language`)}),(0,B.jsx)(be,{tone:`surface`})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-4`,children:[(0,B.jsx)(`span`,{className:`font-medium text-[14px]`,children:N(`nav.theme`)}),(0,B.jsx)(Ee,{})]})]})})]})}function st({connector:e}){let[t,n]=(0,F.useState)(!1);return(0,B.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-3 px-3 py-2 text-left`,children:[(0,B.jsx)(`span`,{className:T(`size-2 shrink-0 rounded-full`,e.usable?`bg-moss`:`bg-ink-4`)}),(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:[e.name,` `,(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink-4`,children:e.id})]}),(0,B.jsx)(`span`,{className:`shrink-0 text-[12px] text-ink-3`,children:e.usable?N(`connectors.actions`,{n:e.actions.length,r:e.actions.filter(e=>e.group===`read`).length}):N(`connectors.notSetUp`)})]}),t?(0,B.jsxs)(`div`,{className:`border-border-soft border-t px-3 py-2 text-[12px]`,children:[e.missingSetup?(0,B.jsxs)(`p`,{className:`mb-1 text-ink-3`,children:[N(`connectors.setup`),` `,(0,B.jsx)(`span`,{className:`font-mono text-ink-2`,children:e.missingSetup})]}):null,(0,B.jsx)(`p`,{className:`text-ink-4`,children:e.actions.map(e=>e.group===`read`?e.id:`${e.id} (${N(`connectors.group.${e.group}`)})`).join(` · `)})]}):null]})}var ct={none:`connectors.authNone`,oauth2:`connectors.authOauth`,api_key:`connectors.authKey`};function lt({projectId:e,connector:t}){let n=f(),[r,i]=(0,F.useState)(!1),a=()=>n.invalidateQueries({queryKey:[`connectors`,e]}),o=`/api/studio/projects/${e}/connectors/${t.id}`,s=P({mutationFn:()=>d.post(`${o}/refresh`),onSuccess:a}),c=P({mutationFn:()=>d.del(o),onSuccess:a}),l=t.actions.filter(e=>e.group===`read`).length;return(0,B.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,B.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-paper-2 text-ink-2`,children:(0,B.jsx)(Se,{className:`size-4`})}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`min-w-0 flex-1 text-left`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`truncate font-medium text-[14px]`,children:t.name}),(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink-4`,children:t.id})]}),(0,B.jsxs)(`div`,{className:`truncate text-[12px] text-ink-3`,children:[t.domain,` · `,t.sourceKind===`mcp`?`MCP`:`OpenAPI`,` ·`,` `,N(ct[t.auth]),` ·`,` `,t.toolsPending?N(`connectors.pending`):N(`connectors.actions`,{n:t.actions.length,r:l})]})]}),(0,B.jsx)(k,{label:N(`connectors.refresh`),onClick:()=>s.mutate(),children:s.isPending?(0,B.jsx)(w,{className:`size-4`}):(0,B.jsx)(ue,{className:`size-4`})}),(0,B.jsx)(k,{label:N(`connectors.remove`),className:`hover:text-rose`,onClick:()=>confirm(`${t.name}: ${N(`connectors.remove`)}?`)&&c.mutate(),children:(0,B.jsx)(v,{className:`size-4`})})]}),t.needsOAuthClient?(0,B.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[12px] text-rose`,children:N(`connectors.needsClient`)}):null,s.error?(0,B.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[12px] text-rose`,children:s.error.message}):null,r&&t.actions.length?(0,B.jsx)(`ul`,{className:`max-h-64 overflow-y-auto border-border-soft border-t px-3 py-2`,children:t.actions.map(e=>(0,B.jsxs)(`li`,{className:`flex items-baseline gap-2 py-1 text-[12px]`,children:[(0,B.jsx)(`span`,{className:T(`w-14 shrink-0 text-[11px] uppercase tracking-wide`,e.group===`read`?`text-moss`:e.group===`write`?`text-ink-3`:`text-rose`),children:N(`connectors.group.${e.group}`)}),(0,B.jsx)(`span`,{className:`shrink-0 font-mono text-ink-2`,children:e.id}),(0,B.jsx)(`span`,{className:`min-w-0 truncate text-ink-4`,children:e.summary})]},e.id))}):null]})}function ut({projectId:e,domain:t,source:n,taken:r,onDone:i}){let a=f(),[o,s]=(0,F.useState)({id:``,secret:``}),[c,l]=(0,F.useState)(!1),u=r.includes(n.suggestedId),p=P({mutationFn:()=>d.post(`/api/studio/projects/${e}/connectors`,{domain:t,sourceKind:n.sourceKind,sourceUrl:n.sourceUrl,id:n.suggestedId,toolPrefix:n.suggestedToolPrefix,...n.name?{name:n.name}:{},...o.id&&o.secret?{oauthClientId:o.id,oauthClientSecret:o.secret}:{}}),onSuccess:async t=>{await a.invalidateQueries({queryKey:[`connectors`,e]}),i(t.warnings)}});return(0,B.jsxs)(`div`,{className:`rounded-lg bg-card p-3 ring-1 ring-border-soft`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(A,{tone:n.sourceKind===`mcp`?`ember`:`neutral`,children:n.sourceKind===`mcp`?`MCP`:`OpenAPI`}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`div`,{className:`truncate text-[13px]`,children:n.name??n.suggestedId}),(0,B.jsx)(`div`,{className:`truncate font-mono text-[11px] text-ink-4`,children:n.sourceUrl})]}),n.blocked||u?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`text-[12px] text-ink-3 hover:text-ink`,children:N(`connectors.ownClient`)}),(0,B.jsx)(M,{size:`sm`,busy:p.isPending,onClick:()=>p.mutate(),children:N(`connectors.import`)})]})]}),n.blocked?(0,B.jsx)(`p`,{className:`mt-2 text-[12px] text-ink-3`,children:n.blocked}):null,u?(0,B.jsx)(`p`,{className:`mt-2 text-[12px] text-ink-3`,children:N(`connectors.exists`)}):null,c?(0,B.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,B.jsx)(j,{placeholder:`OAuth Client-ID`,value:o.id,onChange:e=>s(t=>({...t,id:e.target.value}))}),(0,B.jsx)(j,{type:`password`,autoComplete:`off`,placeholder:`OAuth Client-Secret`,value:o.secret,onChange:e=>s(t=>({...t,secret:e.target.value}))})]}):null,p.error?(0,B.jsx)(`p`,{className:`mt-2 text-[12px] text-rose`,children:p.error.message}):null]})}function dt({projectId:e}){let[t,n]=(0,F.useState)(``),[i,a]=(0,F.useState)(null),[o,s]=(0,F.useState)(null),[c,l]=(0,F.useState)([]),u=r({queryKey:[`connectors`,e],queryFn:()=>d.get(`/api/studio/projects/${e}/connectors`)}),f=P({mutationFn:()=>d.post(`/api/studio/connectors/search`,{query:t}),onSuccess:e=>{a(e),s(null),l([])}}),p=P({mutationFn:e=>d.get(`/api/studio/connectors/registry/${encodeURIComponent(e)}`),onSuccess:s}),m=u.data??[],h=m.filter(e=>e.sourceKind===`builtin`&&(Oe.unsetConnectors||e.usable)),g=m.filter(e=>e.sourceKind!==`builtin`);return(0,B.jsxs)(O,{className:`p-6`,children:[(0,B.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:N(`connectors.title`)}),(0,B.jsx)(`p`,{className:`mt-1 mb-5 text-[14px] text-ink-3`,children:N(`connectors.hint`)}),h.length?(0,B.jsx)(`div`,{className:`mb-5 grid gap-1.5 sm:grid-cols-2`,children:h.map(e=>(0,B.jsx)(st,{connector:e},e.id))}):null,(0,B.jsx)(`h3`,{className:`mb-2 font-medium text-[12px] text-ink-3 uppercase tracking-[0.07em]`,children:N(`connectors.imported`)}),g.length?(0,B.jsx)(`div`,{className:`mb-4 flex flex-col gap-2`,children:g.map(t=>(0,B.jsx)(lt,{projectId:e,connector:t},t.id))}):null,(0,B.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),t.trim()&&f.mutate()},children:[(0,B.jsx)(j,{value:t,placeholder:N(`connectors.search`),onChange:e=>n(e.target.value)}),(0,B.jsxs)(M,{type:`submit`,variant:`secondary`,busy:f.isPending,children:[(0,B.jsx)(fe,{className:`size-4`}),` `,N(`connectors.find`)]})]}),f.error?(0,B.jsx)(`p`,{className:`mt-3 text-[13px] text-rose`,children:f.error.message}):null,i&&!o?(0,B.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1`,children:[i.length?null:(0,B.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:N(`connectors.none`)}),i.map(e=>(0,B.jsxs)(`button`,{type:`button`,disabled:!e.kinds.length,onClick:()=>p.mutate(e.domain),className:`flex items-center gap-3 rounded-lg px-3 py-2 text-left transition hover:bg-paper-2 disabled:opacity-50`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`div`,{className:`truncate text-[14px]`,children:e.domain}),(0,B.jsx)(`div`,{className:`truncate text-[12px] text-ink-3`,children:e.description})]}),(0,B.jsx)(`span`,{className:`text-[11px] text-ink-4 uppercase`,children:e.kinds.join(` · `)}),(0,B.jsx)(ie,{className:`-rotate-90 size-4 text-ink-4`})]},e.domain)),p.isPending?(0,B.jsx)(w,{className:`mx-auto mt-2 size-4 text-ink-4`}):null,p.error?(0,B.jsx)(`p`,{className:`text-[13px] text-rose`,children:p.error.message}):null]}):null,o?(0,B.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,B.jsx)(`div`,{className:`font-medium text-[14px]`,children:o.domain}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>s(null),className:`text-[12px] text-ink-3 hover:text-ink`,children:N(`run.back`)})]}),o.summary?(0,B.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:o.summary}):null,o.sources.map(t=>(0,B.jsx)(ut,{projectId:e,domain:o.domain,source:t,taken:m.map(e=>e.id),onDone:l},`${t.sourceKind}:${t.sourceUrl}`)),o.credentials.filter(e=>e.setup||e.url).map(e=>(0,B.jsxs)(`p`,{className:`text-[12px] text-ink-3`,children:[(0,B.jsxs)(`span`,{className:`text-ink-2`,children:[e.label,`:`]}),` `,e.setup,` `,e.url?(0,B.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-ember underline`,children:e.url}):null]},e.label)),c.map(e=>(0,B.jsx)(`p`,{className:`text-[12px] text-ink-3`,children:e},e))]}):null]})}var ft=[`Claude Code`,`Codex`,`Cursor`,`Gemini CLI`,`claude.ai`],U=`engenty-wizards`,pt=`ENGENTY_WIZARDS_KEY`;function W({text:e}){let[t,n]=(0,F.useState)(!1);return(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-paper-2 p-3`,children:[(0,B.jsx)(`code`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-[12px] leading-relaxed`,children:e}),(0,B.jsx)(k,{label:N(t?`settings.copied`:`settings.copy`),onClick:async()=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,B.jsx)(y,{className:`size-4`}):(0,B.jsx)(ce,{className:`size-4`})})]})}function mt(e){try{let t=new URL(e);return t.protocol===`https:`&&!/(^|\.)localhost$/.test(t.hostname)&&!/^(127\.|10\.|192\.168\.|\[::1\])/.test(t.hostname)}catch{return!1}}function G({n:e,title:t,children:n}){return(0,B.jsxs)(`li`,{className:`grid grid-cols-[28px_minmax(0,1fr)] gap-x-3`,children:[(0,B.jsx)(`span`,{className:`grid size-7 place-items-center rounded-full bg-paper-2 font-semibold text-[13px] text-ink-2 ring-1 ring-border-soft`,children:e}),(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2.5 pt-0.5 pb-7`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-[15px]`,children:t}),n]})]})}function K({children:e}){return(0,B.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:e})}function ht({client:e,url:t,apiKey:n}){let r=n?`Authorization: Bearer ${n}`:null;switch(e){case`Claude Code`:{let e=t.replace(/\/api\/mcp$/,`/api/claude-plugin`);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(K,{children:N(`mcp.terminal`)}),(0,B.jsx)(W,{text:`claude mcp add --transport http --scope user ${U} ${t}${r?` --header "${r}"`:``}`}),!n&&mt(t)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(K,{children:N(`mcp.ccPlugin`)}),(0,B.jsx)(W,{text:`claude plugin marketplace add ${e}/marketplace.json`}),(0,B.jsx)(W,{text:`claude plugin install ${U}@engenty`})]}):null]})}case`Codex`:return n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(K,{children:N(`mcp.codexKey`)}),(0,B.jsx)(W,{text:`echo 'export ${pt}=${n}' >> ~/.zshrc && source ~/.zshrc`}),(0,B.jsx)(W,{text:`codex mcp add ${U} --url ${t} --bearer-token-env-var ${pt}`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(K,{children:N(`mcp.terminal`)}),(0,B.jsx)(W,{text:`codex mcp add ${U} --url ${t}`}),(0,B.jsx)(W,{text:`codex mcp login ${U}`})]});case`Cursor`:return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(K,{children:N(`mcp.cursor`)}),(0,B.jsx)(W,{text:JSON.stringify({mcpServers:{[U]:n?{url:t,headers:{Authorization:`Bearer ${n}`}}:{url:t}}},null,2)})]});case`Gemini CLI`:return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(K,{children:N(`mcp.terminal`)}),(0,B.jsx)(W,{text:`gemini mcp add --scope user --transport http ${U} ${t}${r?` -H "${r}"`:``}`})]});case`claude.ai`:return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(K,{children:N(`mcp.claudeAi`)}),(0,B.jsx)(W,{text:t})]})}}function gt(){let e=f(),t=r({queryKey:[`api-keys`],queryFn:()=>d.get(`/api/studio/api-keys`)}),n=P({mutationFn:e=>d.del(`/api/studio/api-keys/${e}`),onSuccess:()=>e.invalidateQueries({queryKey:[`api-keys`]})});return t.data?.length?(0,B.jsxs)(O,{className:`p-6`,children:[(0,B.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:N(`mcp.keys`)}),(0,B.jsx)(`p`,{className:`mt-1 mb-5 text-[14px] text-ink-3`,children:N(`mcp.keysHint`)}),(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:t.data.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg bg-paper px-3 py-2 ring-1 ring-border-soft`,children:[(0,B.jsx)(Ve,{className:`size-4 shrink-0 text-ink-4`}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`div`,{className:`truncate text-[14px]`,children:e.name}),(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-ink-4`,children:[e.start,`… ·`,` `,e.lastRequest?N(`settings.lastUsed`,{when:new Date(e.lastRequest).toLocaleString()}):N(`settings.neverUsed`)]})]}),(0,B.jsx)(k,{label:N(`settings.revoke`),onClick:()=>n.mutate(e.id),className:`hover:text-rose`,children:(0,B.jsx)(v,{className:`size-4`})})]},e.id))})]}):null}function _t(){let e=we(),t=f(),[n,r]=(0,F.useState)(`Claude Code`),[i,a]=(0,F.useState)({}),o=P({mutationFn:e=>d.post(`/api/studio/api-keys`,{name:e}),onSuccess:async e=>{a(t=>({...t,[n]:e.key})),await t.invalidateQueries({queryKey:[`api-keys`]})}});if(!e.data)return null;let s=e.data.mode===`managed`,c=e.data.mcpUrl??``,l=mt(c),u=i[n],p=n===`claude.ai`&&!(s&&l),h=1;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,B.jsxs)(O,{className:`p-6`,children:[(0,B.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:N(`mcp.title`)}),(0,B.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-2`,children:N(`mcp.lead`)}),(0,B.jsxs)(`div`,{className:`my-6 flex flex-wrap items-center gap-3 text-[14px]`,children:[(0,B.jsx)(`span`,{className:`rounded-full bg-paper-2 px-3.5 py-1.5 ring-1 ring-border-soft`,children:N(`mcp.yourClient`)}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[12px] text-ink-3`,children:[`MCP `,(0,B.jsx)(m,{className:`size-4`})]}),(0,B.jsx)(`span`,{className:`rounded-full bg-ember-tint px-3.5 py-1.5 font-medium text-ember-strong`,children:`engenty wizards`})]}),(0,B.jsx)(`h3`,{className:`font-medium text-[14px]`,children:N(`mcp.canTitle`)}),(0,B.jsxs)(`ul`,{className:`mt-2 flex list-disc flex-col gap-1 pl-5 text-[14px] text-ink-2`,children:[(0,B.jsx)(`li`,{children:N(`mcp.can1`)}),(0,B.jsx)(`li`,{children:N(`mcp.can2`)}),(0,B.jsx)(`li`,{children:N(`mcp.can3`)}),(0,B.jsx)(`li`,{children:N(`mcp.can4`)})]}),(0,B.jsx)(`p`,{className:`mt-5 text-[13px] text-ink-3`,children:N(`mcp.notReverse`)})]}),(0,B.jsxs)(O,{className:`p-6`,children:[(0,B.jsx)(`h2`,{className:`mb-6 font-display font-semibold text-lg`,children:N(`mcp.setup`)}),(0,B.jsxs)(`ol`,{className:`flex flex-col`,children:[(0,B.jsx)(G,{n:h++,title:N(`mcp.pick`),children:(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsx)(_e,{value:n,onChange:r,options:[...ft]})})}),p?(0,B.jsx)(G,{n:h++,title:N(`mcp.notHere`),children:(0,B.jsx)(K,{children:N(s?`mcp.needsPublic`:`mcp.claudeAiLocal`)})}):(0,B.jsxs)(B.Fragment,{children:[s?null:(0,B.jsx)(G,{n:h++,title:N(`mcp.keyTitle`),children:u?(0,B.jsxs)(`p`,{className:`flex items-center gap-2 text-[14px] text-ink-2`,children:[(0,B.jsx)(y,{className:`size-4 text-moss`}),` `,N(`mcp.keyReady`)]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(K,{children:N(`mcp.keyHint`)}),(0,B.jsx)(`div`,{children:(0,B.jsxs)(M,{variant:`secondary`,busy:o.isPending,onClick:()=>o.mutate(n),children:[(0,B.jsx)(x,{className:`size-4`}),` `,N(`mcp.keyCreate`,{client:n})]})})]})}),(0,B.jsxs)(G,{n:h++,title:N(`mcp.add`),children:[s||u?(0,B.jsx)(ht,{client:n,url:c,apiKey:u}):(0,B.jsx)(K,{children:N(`mcp.keyFirst`)}),s?(0,B.jsx)(K,{children:N(`mcp.oauth`)}):null]}),(0,B.jsxs)(G,{n:h++,title:N(`mcp.try`),children:[(0,B.jsx)(K,{children:N(`mcp.tryHint`)}),(0,B.jsx)(W,{text:N(`mcp.tryPrompt`)})]})]})]}),(0,B.jsxs)(`div`,{className:`border-border-soft border-t pt-5`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-[14px]`,children:N(`mcp.address`)}),(0,B.jsx)(`div`,{className:`mt-2`,children:(0,B.jsx)(W,{text:c})}),(0,B.jsx)(`p`,{className:`mt-2 text-[13px] text-ink-3`,children:N(l?`mcp.addressPublic`:`mcp.addressLocal`)})]})]}),s?(0,B.jsxs)(O,{className:`p-6`,children:[(0,B.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:N(`mcp.keys`)}),(0,B.jsx)(`p`,{className:`mt-1 mb-4 text-[14px] text-ink-3`,children:N(`setup.keysInAccount`)}),(0,B.jsx)(`div`,{children:(0,B.jsx)(M,{variant:`secondary`,onClick:()=>window.open(`${e.data?.manageUrl}/account`,`_blank`,`noopener`),children:N(`setup.openAccount`)})})]}):(0,B.jsx)(gt,{})]})}function vt(e){return e.type.startsWith(`image/`)&&/logo/i.test(e.name)?`logo`:/^(image|video|audio)\//.test(e.type)?`asset`:`document`}function yt(e,t){let n=f(),[r,i]=(0,F.useState)([]),[a,o]=(0,F.useState)(`idle`),[s,c]=(0,F.useState)(null),[l,p]=(0,F.useState)(null),[m,h]=(0,F.useState)(null),g=(0,F.useRef)(null),_=()=>(g.current??=(async()=>{await Promise.all([n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`project-files`,e]})]),t(),g.current=null})(),g.current);return{messages:r,phase:a,activity:l,startedAt:m,error:s,send:async(t,s=[])=>{if(!(t.trim()||s.length)||a!==`idle`)return!1;if(c(null),o(`thinking`),h(Date.now()),s.length){try{for(let t of s)await d.upload(`/api/studio/projects/${e}/files?kind=${vt(t)}`,t)}catch(e){return c(e.message),o(`idle`),h(null),await _(),!1}await _();let n=`${N(`editor.attached`)}: ${s.map(e=>e.name).join(`, `)}`;t=t.trim()?`${t}\n\n${n}`:n}let l=r.map(({role:e,content:t})=>({role:e,content:t})).slice(-12),f=`p-${Date.now()}`;i(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:t,previews:oe(s)},{id:f,role:`assistant`,content:``,pending:!0}]),p(null);let m=!1;try{await u(`/api/studio/projects/${e}/assist`,{message:t,history:l},(e,t)=>{if(e===`text`){let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:t.content+e}:t))}else if(e===`activity`)p(JSON.parse(t));else if(e===`changed`)o(`building`),_();else if(e===`done`){m=!0;let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:e.reply,changed:e.changed,pending:!1}:t))}else e===`error`&&(m=!0,c(JSON.parse(t).message))}),m||c(N(`editor.chatBroken`))}catch(e){c(e.message)}finally{p(null),h(null),i(e=>e.filter(e=>!(e.id===f&&!e.content)).map(e=>({...e,pending:!1}))),o(`idle`),await g.current,await _(),await n.invalidateQueries({queryKey:[`me`]})}return!0}}}function bt(){return(0,B.jsxs)(`div`,{className:`sm:pr-36`,children:[(0,B.jsx)(`h2`,{className:`font-display font-semibold text-[20px] leading-tight tracking-tight`,children:N(`project.assistantTitle`)}),(0,B.jsx)(`p`,{className:`mt-1.5 max-w-2xl text-[15px] text-ink-2 leading-relaxed`,children:N(`project.assistantHello`)})]})}var xt=72,St=720;function Ct({projectId:e,onChanged:t}){let n=yt(e,t),r=(0,F.useRef)(null),[i,a]=(0,F.useState)(null);return(0,F.useEffect)(()=>{let e=()=>{let e=r.current?.getBoundingClientRect();e&&a(t=>{if(e.bottom>=xt)return null;let n=Math.min(e.width,St),r=e.left+(e.width-n)/2;return t&&t.left===r&&t.width===n?t:{left:r,width:n,height:t?.height??e.height}})};return e(),window.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e),window.removeEventListener(`resize`,e)}},[]),(0,B.jsxs)(`div`,{ref:r,style:i?{minHeight:i.height}:void 0,children:[(0,B.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 px-1 font-medium text-[12px] text-ember-strong uppercase tracking-[0.07em]`,children:[(0,B.jsx)(ee,{className:`size-3.5`}),` `,N(`project.assistant`)]}),(0,B.jsxs)(`div`,{className:`relative`,children:[!i&&n.messages.length===0?(0,B.jsx)(`div`,{className:`absolute -top-14 right-10 z-10 max-sm:hidden`,children:(0,B.jsx)(l,{kind:`round`,size:104})}):null,(0,B.jsx)(`div`,{className:T(`flex flex-col overflow-hidden bg-card`,i?`fixed bottom-4 z-30 max-h-[70dvh] animate-dock rounded-2xl shadow-overlay ring-1 ring-border`:`max-h-[520px] rounded-xl bg-linear-to-br from-ember-tint via-card to-card shadow-soft ring-1 ring-ember-veil`),style:i?{left:i.left,width:i.width}:void 0,children:(0,B.jsx)(se,{chat:n,avatar:`round`,compact:!!i,intro:(0,B.jsx)(bt,{}),placeholder:N(`project.assistantComposer`),changedLabel:N(`project.assistantChanged`)})})]})]})}var wt=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],Tt=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,Et=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,Dt=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Ot=/^(https?:\/\/|www\.)\S+$/i,kt=/^\+?[\d\s()/.-]{7,20}$/,At=/^(ja|nein|yes|no|true|false)$/i;function jt(e){let t=e.trim();return t?t.includes(`
|
|
2
|
-
`)||t.length>140?`longtext`:At.test(t)?`boolean`:Dt.test(t)?`email`:Ot.test(t)?`url`:Tt.test(t)?`date`:Et.test(t)&&!/^(\+|0\d)/.test(t)?`number`:kt.test(t)&&t.replace(/\D/g,``).length>=7?`phone`:`text`:`text`}function Mt(e,t=[]){let n=e.toLowerCase().replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).normalize(`NFD`).replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`fakt`,r=n;for(let e=2;t.includes(r);e++)r=`${n}_${e}`;return r}var Nt=[{key:`adresse`,de:`Adresse`,en:`Address`},{key:`plz`,de:`PLZ`,en:`Postcode`},{key:`ort`,de:`Ort`,en:`City`},{key:`uid`,de:`UID`,en:`VAT id`},{key:`telefon`,de:`Telefon`,en:`Phone`},{key:`e_mail`,de:`E-Mail`,en:`Email`},{key:`website`,de:`Website`,en:`Website`},{key:`iban`,de:`IBAN`,en:`IBAN`}],q={facts:100,colors:12,files:{logo:8,asset:100,document:50},bytes:{logo:5e6,asset:15e6,video:8e7,document:3e7}},J=/^#[0-9a-fA-F]{6}$/;function Pt({onAdd:e,onClose:t}){let[n,r]=(0,F.useState)(`#e0531b`),[i,a]=(0,F.useState)(``),o=J.test(n);return(0,B.jsx)(E,{open:!0,onClose:t,title:N(`project.colorAddTitle`),children:(0,B.jsxs)(`form`,{onSubmit:r=>{r.preventDefault(),o&&(e({name:i.trim(),value:n.toLowerCase()}),t())},className:`flex flex-col gap-5`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(C,{children:N(`project.colorValue`)}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(he,{value:o?n:`#888888`,onChange:e=>r(e.target.value)}),(0,B.jsx)(j,{value:n,placeholder:`#e0531b`,spellCheck:!1,onChange:e=>r(e.target.value.trim()),className:`font-mono text-[14px]`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(C,{children:N(`project.colorUseLabel`)}),(0,B.jsx)(j,{autoFocus:!0,value:i,maxLength:120,placeholder:N(`project.colorName`),onChange:e=>a(e.target.value)}),(0,B.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:N(`project.colorUse`)})]}),(0,B.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,B.jsx)(M,{variant:`ghost`,onClick:t,children:N(`common.cancel`)}),(0,B.jsx)(M,{type:`submit`,disabled:!o,children:N(`project.add`)})]})]})})}function Ft({colors:e,save:t}){let n=(0,F.useRef)(0),[r,i]=(0,F.useState)(()=>e.map(e=>({...e,id:`c${n.current++}`}))),[a,o]=(0,F.useState)(!1),s=R(r.filter(e=>J.test(e.value)).map(({name:e,value:t})=>({name:e.trim(),value:t})),t),c=(e,t)=>i(n=>n.map(n=>n.id===e?{...n,...t}:n));return(0,B.jsxs)(V,{title:N(`project.colors`),hint:N(`project.colorsHint`),save:s,children:[(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(he,{value:J.test(e.value)?e.value:`#888888`,onChange:t=>c(e.id,{value:t.target.value})}),(0,B.jsx)(j,{value:e.name,placeholder:N(`project.colorName`),maxLength:120,onChange:t=>c(e.id,{name:t.target.value}),className:`min-w-0 flex-1`}),(0,B.jsx)(j,{value:e.value,placeholder:`#e0531b`,spellCheck:!1,onChange:t=>c(e.id,{value:t.target.value.trim()}),className:`w-28 font-mono text-[13px]`}),(0,B.jsxs)(`div`,{className:`flex w-24 shrink-0 items-center justify-end max-sm:w-auto`,children:[t===0?(0,B.jsx)(`span`,{className:`mr-1 max-sm:hidden`,children:(0,B.jsx)(A,{tone:`ember`,children:N(`project.colorAccent`)})}):(0,B.jsx)(k,{label:N(`project.colorFirst`),onClick:()=>i(t=>[e,...t.filter(t=>t.id!==e.id)]),children:(0,B.jsx)(h,{className:`size-4`})}),(0,B.jsx)(k,{label:N(`project.remove`),onClick:()=>i(t=>t.filter(t=>t.id!==e.id)),className:`hover:text-rose`,children:(0,B.jsx)(v,{className:`size-4`})})]})]},e.id))}),r.length?(0,B.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:N(`project.colorUse`)}):null,r.length<q.colors?(0,B.jsxs)(M,{variant:`secondary`,size:`sm`,className:r.length?`mt-3`:void 0,onClick:()=>o(!0),children:[(0,B.jsx)(x,{className:`size-4`}),` `,N(`project.colorAdd`)]}):null,a?(0,B.jsx)(Pt,{onClose:()=>o(!1),onAdd:e=>i(t=>[...t,{...e,id:`c${n.current++}`}])}):null]})}var It={backgroundImage:`repeating-conic-gradient(#c9c9c9 0% 25%, #dedede 0% 50%)`,backgroundSize:`16px 16px`};function Y({file:e,actions:t}){let[n,r]=(0,F.useState)(e.description),i=(0,F.useRef)(e.description),a=(0,F.useRef)(null);(0,F.useEffect)(()=>{e.description!==i.current&&(r(t=>t===i.current?e.description:t),i.current=e.description)},[e.description]),(0,F.useLayoutEffect)(()=>{let e=a.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},[n]);let o=e.status===`pending`&&!n;return(0,B.jsx)(`textarea`,{ref:a,rows:1,value:n,maxLength:600,placeholder:N(o?`project.describing`:`project.description`),onChange:e=>r(e.target.value),onBlur:()=>{n.trim()!==e.description&&(i.current=n.trim(),t.describe(e.id,n.trim()))},className:`-mx-1 block w-[calc(100%+0.5rem)] resize-none overflow-hidden rounded-md bg-transparent px-1 py-0.5 text-[13px] text-ink-2 leading-snug outline-none transition placeholder:text-ink-4 hover:bg-paper-2 focus:bg-card focus:text-ink focus:ring-1 focus:ring-border`})}function X(e,t){confirm(N(`project.removeConfirm`,{name:e.name}))&&t.remove(e.id)}function Z({projectId:e,file:t,small:n}){let r=I(e,t.id);return t.mime.startsWith(`image/`)?(0,B.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:T(`size-full`,t.kind===`logo`?`object-contain p-3`:`object-cover`)}):t.mime.startsWith(`video/`)?(0,B.jsx)(`video`,{src:`${r}#t=0.1`,preload:`metadata`,controls:!n,className:`size-full object-cover`}):(0,B.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-3`,children:t.mime.startsWith(`audio/`)?(0,B.jsx)(qe,{className:n?`size-5`:`size-7`}):(0,B.jsx)(ne,{className:n?`size-5`:`size-7`})})}function Lt({projectId:e,kind:t,files:n,actions:r,accept:i,addLabel:a,onPreview:o}){return(0,B.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(184px,1fr))] gap-3`,children:[n.map((i,a)=>(0,B.jsxs)(`div`,{className:`group relative flex flex-col gap-1.5 rounded-lg bg-paper p-2 pb-2.5 ring-1 ring-border-soft`,children:[t===`logo`&&a===0?(0,B.jsx)(`span`,{className:`absolute -top-3 left-3 z-10 rounded-full ring-2 ring-card`,children:(0,B.jsx)(A,{tone:`ember`,children:N(`project.logoMain`)})}):null,(0,B.jsxs)(`div`,{className:`relative h-28 overflow-hidden rounded-md bg-paper-2`,style:t===`logo`?It:void 0,children:[o&&i.mime.startsWith(`image/`)?(0,B.jsx)(`button`,{type:`button`,"aria-label":`${N(`project.preview`)}: ${i.name}`,onClick:()=>o(i),className:`block size-full cursor-zoom-in`,children:(0,B.jsx)(Z,{projectId:e,file:i})}):(0,B.jsx)(Z,{projectId:e,file:i}),(0,B.jsxs)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 transition focus-within:opacity-100 group-hover:opacity-100 coarse:opacity-100`,children:[o?(0,B.jsx)(k,{label:N(`project.preview`),onClick:()=>o(i),className:`size-8 bg-card shadow-soft`,children:(0,B.jsx)(b,{className:`size-4`})}):null,t===`logo`&&a>0?(0,B.jsx)(k,{label:N(`project.logoMakeMain`),onClick:()=>r.order(`logo`,[i.id,...n.filter(e=>e.id!==i.id).map(e=>e.id)]),className:`size-8 bg-card shadow-soft`,children:(0,B.jsx)(de,{className:`size-4`})}):null,(0,B.jsx)(k,{label:N(`project.remove`),onClick:()=>X(i,r),className:`size-8 bg-card shadow-soft hover:text-rose`,children:(0,B.jsx)(v,{className:`size-4`})})]})]}),t===`asset`?(0,B.jsx)(`div`,{className:`truncate px-0.5 text-[12px] text-ink-3`,title:i.name,children:i.name}):null,(0,B.jsx)(Y,{file:i,actions:r})]},i.id)),a?(0,B.jsxs)(H,{accept:i,multiple:!1,onFiles:e=>r.upload(t,e),className:`min-h-28 flex-col p-3`,children:[r.busy?(0,B.jsx)(w,{className:`size-5`}):(0,B.jsx)(x,{className:`size-5`}),a]}):null]})}function Rt({projectId:e,data:t}){let n=L(e);return(0,B.jsxs)(V,{title:N(`project.logos`),hint:N(`project.logosHint`),children:[(0,B.jsx)(Lt,{projectId:e,kind:`logo`,files:t.files.filter(e=>e.kind===`logo`),actions:n,accept:`image/*`,addLabel:N(`project.logoAdd`)}),n.error?(0,B.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:n.error}):null]})}var zt=e=>[(e.name.includes(`.`)?e.name.split(`.`).pop():e.mime.split(`/`).pop())?.toUpperCase().slice(0,5),z(e.size)].filter(Boolean).join(` · `);function Bt({projectId:e,file:t,actions:n,onClose:r}){let i=I(e,t.id);return(0,B.jsxs)(E,{open:!0,onClose:r,wide:`page`,title:t.name,children:[(0,B.jsxs)(`div`,{className:`-mt-2 mb-4 flex items-center justify-between gap-3`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-ink-3`,children:zt(t)}),(0,B.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,"aria-label":N(`project.openOriginal`),title:N(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,B.jsx)(S,{className:`size-4`})})]}),t.mime.startsWith(`image/`)?(0,B.jsx)(`div`,{className:`overflow-hidden rounded-lg`,style:It,children:(0,B.jsx)(`img`,{src:i,alt:``,className:`mx-auto max-h-[68dvh] object-contain`})}):t.mime.startsWith(`video/`)?(0,B.jsx)(`video`,{src:i,controls:!0,className:`max-h-[68dvh] w-full rounded-lg bg-black`}):(0,B.jsx)(`audio`,{src:i,controls:!0,className:`w-full`}),(0,B.jsx)(`div`,{className:`mt-4`,children:(0,B.jsx)(Y,{file:t,actions:n})})]})}function Vt({projectId:e,file:t,actions:n,onPreview:r}){return(0,B.jsxs)(`li`,{className:`flex items-start gap-3 rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-label":`${N(`project.preview`)}: ${t.name}`,onClick:r,className:`size-14 shrink-0 cursor-zoom-in overflow-hidden rounded-md bg-paper-2`,children:(0,B.jsx)(Z,{projectId:e,file:t,small:!0})}),(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 py-0.5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:r,title:t.name,className:`min-w-0 truncate font-medium text-[14px] hover:underline`,children:t.name}),(0,B.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:zt(t)})]}),(0,B.jsx)(Y,{file:t,actions:n})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 items-start`,children:[(0,B.jsx)(k,{label:N(`project.preview`),onClick:r,children:(0,B.jsx)(b,{className:`size-4`})}),(0,B.jsx)(k,{label:N(`project.remove`),onClick:()=>X(t,n),className:`hover:text-rose`,children:(0,B.jsx)(v,{className:`size-4`})})]})]})}function Ht({projectId:e,data:t}){let n=L(e),[r,i]=nt(`assets`,`cards`),[a,o]=(0,F.useState)(``),[s,c]=(0,F.useState)(null),l=t.files.filter(e=>e.kind===`asset`),u=l.find(e=>e.id===s),d=a.trim().toLowerCase(),f=d?l.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(d)):l;return(0,B.jsxs)(V,{title:N(`project.assets`),hint:N(`project.assetsHint`),children:[l.length?(0,B.jsx)(rt,{layout:r,onToggle:i,children:(0,B.jsx)(it,{value:a,onChange:o,placeholder:N(`project.assetSearch`)})}):null,f.length?(0,B.jsx)(`div`,{className:`mb-3`,children:r===`cards`?(0,B.jsx)(Lt,{projectId:e,kind:`asset`,files:f,actions:n,onPreview:e=>c(e.id)}):(0,B.jsx)(`ul`,{className:`flex flex-col gap-2`,children:f.map(t=>(0,B.jsx)(Vt,{projectId:e,file:t,actions:n,onPreview:()=>c(t.id)},t.id))})}):null,(0,B.jsxs)(H,{accept:`image/*,video/*,audio/*`,onFiles:e=>n.upload(`asset`,e),className:`h-16 w-full`,children:[n.busy?(0,B.jsx)(w,{className:`size-4`}):(0,B.jsx)(me,{className:`size-4`}),N(`project.drop`),` `,(0,B.jsx)(`span`,{className:`underline`,children:N(`project.assetAdd`)})]}),n.error?(0,B.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:n.error}):null,u?(0,B.jsx)(Bt,{projectId:e,file:u,actions:n,onClose:()=>c(null)}):null]})}function Ut(e,t,n){return r({queryKey:[`project-file-text`,t.id,t.chars,n],queryFn:()=>d.get(`/api/studio/projects/${e}/files/${t.id}/text?limit=${n}`),enabled:t.status===`ready`,staleTime:6e4})}function Wt(e){return((e.name.includes(`.`)?e.name.split(`.`).pop():``)||e.mime.split(`/`).pop()||``).toUpperCase().slice(0,5)}var Q=e=>[Wt(e),e.pages?N(`project.pages`,{n:e.pages}):null,z(e.size)].filter(Boolean).join(` · `);function $({file:e}){return e.status===`pending`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,B.jsx)(w,{className:`size-3`}),` `,N(`project.reading`)]}):e.status===`failed`?(0,B.jsx)(`span`,{className:`text-[12px] text-rose`,children:e.error}):e.indexed?(0,B.jsx)(A,{tone:`live`,children:e.indexed===`embeddings`?N(`project.indexed`):N(`project.indexedKeywords`)}):(0,B.jsx)(A,{tone:`warn`,children:N(`project.notIndexed`)})}function Gt({file:e,actions:t,onPreview:n}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(k,{label:N(`project.preview`),onClick:n,children:(0,B.jsx)(b,{className:`size-4`})}),e.status===`pending`?null:(0,B.jsx)(k,{label:N(`project.reindex`),onClick:()=>t.reindex(e.id),children:(0,B.jsx)(ue,{className:`size-4`})}),(0,B.jsx)(k,{label:N(`project.remove`),onClick:()=>X(e,t),className:`hover:text-rose`,children:(0,B.jsx)(v,{className:`size-4`})})]})}function Kt({file:e,actions:t,onPreview:n}){let r=/sheet|csv|excel/.test(e.mime);return(0,B.jsxs)(`li`,{className:`flex gap-3 rounded-lg bg-paper p-3 ring-1 ring-border-soft`,children:[(0,B.jsx)(`div`,{className:`mt-0.5 text-ink-3`,children:r?(0,B.jsx)(Fe,{className:`size-5`}):(0,B.jsx)(le,{className:`size-5`})}),(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:n,title:e.name,className:`min-w-0 truncate font-medium text-[14px] hover:underline`,children:e.name}),(0,B.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:Q(e)}),(0,B.jsx)($,{file:e})]}),(0,B.jsx)(Y,{file:e,actions:t})]}),(0,B.jsx)(`div`,{className:`-my-1 flex shrink-0 items-start`,children:(0,B.jsx)(Gt,{file:e,actions:t,onPreview:n})})]})}function qt({projectId:e,file:t}){let n=Ut(e,t,1500);return t.mime.startsWith(`image/`)?(0,B.jsx)(`img`,{src:I(e,t.id),alt:``,className:`size-full object-cover`}):t.status===`pending`||n.isLoading?(0,B.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-4`,children:(0,B.jsx)(w,{className:`size-5`})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`w-[222%] origin-top-left scale-[0.45] p-6`,children:(0,B.jsx)(te,{text:n.data?.text??``})}),(0,B.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 h-12 bg-linear-to-t from-card to-transparent`})]})}function Jt({projectId:e,file:t,actions:n,onPreview:r}){return(0,B.jsxs)(`li`,{className:`group flex flex-col gap-1.5 rounded-lg bg-paper p-2 pb-2.5 ring-1 ring-border-soft`,children:[(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`${N(`project.preview`)}: ${t.name}`,className:`relative block h-44 w-full overflow-hidden rounded-md bg-card text-left ring-1 ring-border-soft transition hover:ring-border`,children:(0,B.jsx)(qt,{projectId:e,file:t})}),(0,B.jsx)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 transition focus-within:opacity-100 group-hover:opacity-100 coarse:opacity-100 [&>button]:size-8 [&>button]:bg-card [&>button]:shadow-soft`,children:(0,B.jsx)(Gt,{file:t,actions:n,onPreview:r})})]}),(0,B.jsxs)(`div`,{className:`mt-1 flex flex-col gap-1 px-0.5`,children:[(0,B.jsx)(`div`,{className:`truncate font-medium text-[13px]`,title:t.name,children:t.name}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,B.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:Q(t)}),(0,B.jsx)($,{file:t})]})]}),(0,B.jsx)(Y,{file:t,actions:n})]})}var Yt=2e5;function Xt({projectId:e,file:t,onClose:n}){let r=t.mime===`application/pdf`||t.mime.startsWith(`image/`),[i,a]=(0,F.useState)(r?`original`:`text`),o=Ut(e,t,Yt),s=I(e,t.id),c=(e,t)=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":i===e,onClick:()=>a(e),className:T(`h-8 rounded-full px-3 text-[13px] transition`,i===e?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:text-ink`),children:t});return(0,B.jsxs)(E,{open:!0,onClose:n,wide:`page`,title:t.name,children:[(0,B.jsxs)(`div`,{className:`-mt-2 mb-4 flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-ink-3`,children:Q(t)}),(0,B.jsx)($,{file:t}),(0,B.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[r?(0,B.jsxs)(B.Fragment,{children:[c(`original`,N(`project.original`)),c(`text`,N(`project.readText`))]}):null,(0,B.jsx)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,"aria-label":N(`project.openOriginal`),title:N(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,B.jsx)(S,{className:`size-4`})})]})]}),i===`original`?t.mime===`application/pdf`?(0,B.jsx)(`iframe`,{src:s,title:t.name,className:`h-[70dvh] w-full rounded-lg bg-paper-2 ring-1 ring-border-soft`}):(0,B.jsx)(`img`,{src:s,alt:``,className:`mx-auto max-h-[70dvh] rounded-lg object-contain`}):o.isLoading?(0,B.jsx)(`div`,{className:`flex h-40 items-center justify-center text-ink-3`,children:(0,B.jsx)(w,{})}):o.data?.text?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`overflow-x-auto rounded-lg bg-paper p-5 ring-1 ring-border-soft`,children:(0,B.jsx)(te,{text:o.data.text,className:`text-[14px]`})}),o.data.chars>o.data.text.length?(0,B.jsx)(`p`,{className:`mt-3 text-[13px] text-ink-3`,children:N(`project.textCut`,{shown:o.data.text.length.toLocaleString(),total:o.data.chars.toLocaleString()})}):null]}):(0,B.jsx)(`p`,{className:`py-8 text-center text-[14px] text-ink-3`,children:N(`project.noText`)})]})}function Zt({projectId:e}){let[t,n]=(0,F.useState)(``),[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(!1),s=async()=>{if(!t.trim()){i(null);return}o(!0);try{let n=await d.post(`/api/studio/projects/${e}/search`,{query:t});i(n.hits)}catch{i([])}finally{o(!1)}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(it,{value:t,placeholder:N(`project.searchTest`),busy:a,onEnter:()=>void s(),onChange:e=>{n(e),e.trim()||i(null)}}),r?r.length?(0,B.jsx)(`ul`,{className:`mt-2 flex flex-col gap-2`,children:r.map((e,t)=>(0,B.jsxs)(`li`,{className:`rounded-lg bg-paper-2 px-3 py-2 text-[13px]`,children:[(0,B.jsx)(`div`,{className:`mb-0.5 font-medium text-[12px] text-ink-3`,children:e.name}),(0,B.jsx)(`p`,{className:`line-clamp-3 whitespace-pre-line text-ink-2`,children:e.text})]},t))}):(0,B.jsx)(`p`,{className:`mt-2 text-[13px] text-ink-3`,children:N(`project.searchNone`)}):null]})}function Qt({projectId:e,data:t}){let n=L(e),[r,i]=nt(`documents`,`list`),[a,o]=(0,F.useState)(null),s=t.files.filter(e=>e.kind===`document`),c=s.find(e=>e.id===a),l=r===`cards`?Jt:Kt;return(0,B.jsxs)(V,{title:N(`project.documents`),hint:N(`project.documentsHint`),children:[s.length?(0,B.jsx)(rt,{layout:r,onToggle:i,children:(0,B.jsx)(Zt,{projectId:e})}):null,s.length?(0,B.jsx)(`ul`,{className:T(`mb-3`,r===`cards`?`grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-3`:`flex flex-col gap-2`),children:s.map(t=>(0,B.jsx)(l,{projectId:e,file:t,actions:n,onPreview:()=>o(t.id)},t.id))}):null,(0,B.jsxs)(H,{accept:`.pdf,.docx,.doc,.xlsx,.csv,.tsv,.txt,.md,.json,.html,.eml,image/*`,onFiles:e=>n.upload(`document`,e),className:`h-16 w-full`,children:[n.busy?(0,B.jsx)(w,{className:`size-4`}):(0,B.jsx)(me,{className:`size-4`}),N(`project.drop`),` `,(0,B.jsx)(`span`,{className:`underline`,children:N(`project.documentAdd`)})]}),n.error?(0,B.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:n.error}):null,s.length&&!t.embeddings?(0,B.jsx)(`p`,{className:`mt-3 text-[13px] text-ink-3`,children:N(`project.keywordsOnly`)}):null,c?(0,B.jsx)(Xt,{projectId:e,file:c,onClose:()=>o(null)}):null]})}var $t=e=>/^(ja|yes|true)$/i.test(e.trim()),en={text:pe,longtext:Ze,number:ze,date:Ne,url:_,email:re,phone:Ye,boolean:$e};function tn({type:e,detected:t,onChange:n}){let[r,i]=(0,F.useState)(!1),[a,o]=(0,F.useState)(!1),s=(0,F.useRef)(null);(0,F.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||i(!1)},t=e=>e.key===`Escape`&&i(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]);let c=en[e??t],l=`${N(`project.factType`)}: ${N(`project.type.${e??t}`)}`,u=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[14px] text-ink-2 hover:bg-accent hover:text-ink`,d=e=>{n(e),i(!1)};return(0,B.jsxs)(`div`,{className:`relative`,ref:s,children:[(0,B.jsx)(`button`,{type:`button`,"aria-label":l,title:l,"aria-haspopup":`menu`,"aria-expanded":r,onClick:e=>{o(window.innerHeight-e.currentTarget.getBoundingClientRect().bottom<400),i(e=>!e)},className:T(`inline-flex size-11 items-center justify-center rounded-lg transition hover:bg-accent hover:text-ink`,r?`bg-accent text-ink`:e?`text-ink-2`:`text-ink-4`),children:(0,B.jsx)(c,{className:`size-4`})}),r?(0,B.jsxs)(`div`,{role:`menu`,className:T(`absolute right-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,a?`bottom-12`:`top-12`),children:[(0,B.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":!e,className:u,onClick:()=>d(void 0),children:[(0,B.jsx)(ae,{className:`size-4 shrink-0`}),(0,B.jsx)(`span`,{className:`flex-1`,children:N(`project.factAuto`)}),(0,B.jsx)(`span`,{className:`text-[12px] text-ink-4`,children:N(`project.type.${t}`)}),(0,B.jsx)(y,{className:T(`size-4 shrink-0`,e&&`invisible`)})]}),(0,B.jsx)(`div`,{className:`mx-2 my-1 h-px bg-border-soft`}),wt.map(t=>{let n=en[t];return(0,B.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===t,className:u,onClick:()=>d(t),children:[(0,B.jsx)(n,{className:`size-4 shrink-0`}),(0,B.jsx)(`span`,{className:`flex-1`,children:N(`project.type.${t}`)}),(0,B.jsx)(y,{className:T(`size-4 shrink-0`,e!==t&&`invisible`)})]},t)})]}):null]})}function nn({facts:e,save:t}){let n=(0,F.useRef)(0),r=(0,F.useRef)(null),[i,a]=(0,F.useState)(()=>e.map(e=>({...e,id:`f${n.current++}`}))),o=R(i.filter(e=>e.key&&e.label.trim()).map(({key:e,label:t,value:n,type:r})=>({key:e,label:t.trim(),value:n,...r?{type:r}:{}})),t),s=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n)),c=(e,t,i=!1)=>{let o=`f${n.current++}`;r.current=`${o}:${t}`;let s={id:o,key:``,label:``,value:``,...e};a(e=>i?[s,...e]:[...e,s])},l=e=>t=>{t&&r.current===e&&(r.current=null,t.focus())},u=Nt.filter(e=>!i.some(t=>t.key===e.key));return(0,B.jsxs)(V,{title:N(`project.facts`),hint:N(`project.factsHint`),save:o,action:i.length<q.facts?(0,B.jsxs)(M,{variant:`secondary`,size:`sm`,onClick:()=>c({},`label`,!0),children:[(0,B.jsx)(x,{className:`size-4`}),` `,N(`project.factAdd`)]}):null,children:[(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map(e=>{let t=jt(e.value),n=e.type??t;return(0,B.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-x-1 gap-y-2 sm:grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto_auto]`,children:[(0,B.jsx)(j,{ref:l(`${e.id}:label`),value:e.label,placeholder:N(`project.factLabel`),title:e.key?`{{facts.${e.key}}}`:void 0,onChange:t=>s(e.id,{label:t.target.value}),onBlur:()=>{!e.key&&e.label.trim()&&s(e.id,{key:Mt(e.label,i.map(e=>e.key))})},className:`max-sm:col-span-3 max-sm:font-medium sm:mr-1`}),e.type===`boolean`?(0,B.jsxs)(`div`,{className:`flex h-11 items-center gap-3`,children:[(0,B.jsx)(ve,{checked:$t(e.value),label:e.label,onChange:t=>s(e.id,{value:N(t?`project.yes`:`project.no`)})}),(0,B.jsx)(`span`,{className:`text-[14px] text-ink-2`,children:$t(e.value)?N(`project.yes`):N(`project.no`)})]}):(0,B.jsx)(D,{ref:l(`${e.id}:value`),rows:1,minRows:n===`longtext`?2:1,maxRows:10,value:e.value,placeholder:N(`project.factValue`),onChange:t=>s(e.id,{value:t.target.value}),className:`min-h-11`}),(0,B.jsx)(tn,{type:e.type,detected:t,onChange:t=>s(e.id,{type:t})}),(0,B.jsx)(k,{label:N(`project.remove`),onClick:()=>a(t=>t.filter(t=>t.id!==e.id)),className:`size-11 rounded-lg hover:text-rose`,children:(0,B.jsx)(v,{className:`size-4`})})]},e.id)})}),i.length<q.facts?(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${i.length?`mt-4`:``}`,children:[(0,B.jsxs)(M,{variant:`secondary`,size:`sm`,onClick:()=>c({},`label`),children:[(0,B.jsx)(x,{className:`size-4`}),` `,N(`project.factAdd`)]}),u.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>c({key:e.key,label:ge===`en`?e.en:e.de},`value`),className:`inline-flex h-8 items-center gap-1 rounded-full bg-paper-2 px-3 text-[13px] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,B.jsx)(x,{className:`size-3.5`}),` `,ge===`en`?e.en:e.de]},e.key))]}):null]})}function rn({project:e,save:t}){let[n,r]=(0,F.useState)(e.brand.name??``),[i,a]=(0,F.useState)(e.brand.about??``),o=R({name:n.trim(),about:i.trim()},e=>t({brand:e}));return(0,B.jsx)(V,{title:N(`project.base`),hint:N(`project.baseHint`),save:o,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(C,{children:N(`project.title`)}),(0,B.jsx)(j,{value:n,maxLength:120,onChange:e=>r(e.target.value)}),(0,B.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:N(`project.titleHint`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(C,{children:N(`project.about`)}),(0,B.jsx)(D,{minRows:4,value:i,onChange:e=>a(e.target.value)}),(0,B.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:N(`project.aboutHint`)})]})]})})}function an({project:e,save:t}){let[n,r]=(0,F.useState)(!1),[i,a]=(0,F.useState)(e.name),o=P({mutationFn:()=>t({name:i.trim()}),onSuccess:()=>r(!1)});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(k,{label:N(`project.rename`),onClick:()=>{a(e.name),r(!0)},children:(0,B.jsx)(g,{className:`size-4`})}),(0,B.jsx)(E,{open:n,onClose:()=>r(!1),title:N(`project.rename`),children:(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,B.jsx)(j,{autoFocus:!0,value:i,maxLength:80,onChange:e=>a(e.target.value)}),o.error?(0,B.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:o.error.message}):null,(0,B.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,B.jsx)(M,{variant:`ghost`,onClick:()=>r(!1),children:N(`common.cancel`)}),(0,B.jsx)(M,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:N(`settings.save`)})]})]})})]})}function on({project:e}){let t=f(),n=tt(e.id),[r,i]=(0,F.useState)(0),a=async n=>{await d.patch(`/api/studio/projects/${e.id}`,n),await t.invalidateQueries({queryKey:[`projects`]})},o=P({mutationFn:()=>d.del(`/api/studio/projects/${e.id}`),onSuccess:()=>t.invalidateQueries({queryKey:[`projects`]})}),s=xe(),c=n.data??{files:[],embeddings:!0},l=`${e.id}:${r}`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[s?(0,B.jsxs)(`div`,{className:`-mb-3 flex items-center gap-1`,children:[(0,B.jsx)(je,{}),(0,B.jsx)(an,{project:e,save:a})]}):null,(0,B.jsx)(Ct,{projectId:e.id,onChanged:()=>i(e=>e+1)},e.id),(0,B.jsx)(rn,{project:e,save:a},`base:${l}`),(0,B.jsx)(Rt,{projectId:e.id,data:c}),(0,B.jsx)(Ft,{colors:e.brand.colors??[],save:e=>a({brand:{colors:e}})},`colors:${l}`),(0,B.jsx)(Ht,{projectId:e.id,data:c}),(0,B.jsx)(Qt,{projectId:e.id,data:c}),(0,B.jsx)(nn,{facts:e.facts,save:e=>a({facts:e})},`facts:${l}`),s?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(M,{variant:`danger`,busy:o.isPending,onClick:()=>confirm(`${N(`settings.delete`)}?`)&&o.mutate(),children:N(`settings.delete`)}),o.error?(0,B.jsx)(`p`,{className:`mt-2 text-[14px] text-rose`,children:o.error.message}):null]}):null]})}function sn(e,t){let n=e.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/^[^a-z]+/,``).slice(0,24)||`system`,r=n,i=2;for(;t.includes(r);)r=`${n}_${i++}`;return r}function cn({project:e}){let t=f(),[n,r]=(0,F.useState)(e.mcpServers.map(e=>({...e,auth:e.headers?.Authorization??e.headers?.authorization??``}))),[i,a]=(0,F.useState)(!1),o=P({mutationFn:()=>d.patch(`/api/studio/projects/${e.id}`,{mcpServers:n.filter(e=>e.name&&e.url).map(({auth:e,headers:t,...n})=>({...n,headers:e?{...t,Authorization:e}:void 0}))}),onSuccess:async()=>{await t.invalidateQueries({queryKey:[`projects`]}),a(!0),setTimeout(()=>a(!1),1800)}});return(0,B.jsxs)(O,{className:`p-6`,children:[(0,B.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:N(`settings.mcp`)}),(0,B.jsx)(`p`,{className:`mt-1 mb-5 text-[14px] text-ink-3`,children:N(`settings.mcpHint`)}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[n.map((e,t)=>(0,B.jsxs)(`div`,{className:`grid gap-2 rounded-lg bg-paper p-3 ring-1 ring-border-soft sm:grid-cols-[1fr_2fr_auto]`,children:[(0,B.jsx)(j,{placeholder:N(`settings.serverName`),value:e.name,onChange:e=>r(n=>n.map((r,i)=>i===t?{...r,name:e.target.value,id:r.id||sn(e.target.value,n.map(e=>e.id))}:r))}),(0,B.jsx)(j,{placeholder:`${N(`settings.serverUrl`)} (https://…/mcp)`,value:e.url,onChange:e=>r(n=>n.map((n,r)=>r===t?{...n,url:e.target.value}:n))}),(0,B.jsx)(k,{label:`Entfernen`,onClick:()=>r(e=>e.filter((e,n)=>n!==t)),className:`hover:text-rose`,children:(0,B.jsx)(v,{className:`size-4`})}),(0,B.jsx)(j,{className:`sm:col-span-2`,placeholder:N(`settings.serverHeader`),value:e.auth??``,onChange:e=>r(n=>n.map((n,r)=>r===t?{...n,auth:e.target.value}:n))}),e.id?(0,B.jsx)(`span`,{className:`self-center font-mono text-[11px] text-ink-4`,children:e.id}):null]},t)),(0,B.jsxs)(M,{variant:`secondary`,className:`self-start`,onClick:()=>r(e=>[...e,{id:``,name:``,url:``,auth:``}]),children:[(0,B.jsx)(x,{className:`size-4`}),` `,N(`settings.addServer`)]})]}),(0,B.jsxs)(`div`,{className:`mt-5 flex items-center justify-end gap-3`,children:[o.error?(0,B.jsx)(`p`,{className:`text-[14px] text-rose`,children:o.error.message}):null,(0,B.jsx)(M,{busy:o.isPending,onClick:()=>o.mutate(),children:N(i?`settings.saved`:`settings.save`)})]})]})}function ln(){let{section:e}=o(),t=a(),n=we(),{project:r}=De(),c=xe(),[l,u]=(0,F.useState)(r?.id);(0,F.useEffect)(()=>u(r?.id),[r?.id]);let d=Ce(n.data),f=d.find(t=>t.id===e);if(!f)return(0,B.jsx)(i,{to:`/settings/project`,replace:!0});let p=f.id===`connectors`&&c;return(0,B.jsxs)(`div`,{className:`animate-rise`,children:[(0,B.jsx)(`h1`,{className:`font-display font-semibold text-[28px] tracking-tight`,children:N(`settings.title`)}),(0,B.jsxs)(`div`,{className:`mt-6 grid gap-6 md:mt-8 md:grid-cols-[200px_minmax(0,1fr)] md:gap-10`,children:[(0,B.jsx)(`nav`,{className:`max-md:hidden`,children:(0,B.jsx)(`ul`,{className:`sticky top-24 flex flex-col gap-0.5`,children:d.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsx)(s,{to:`/settings/${e.id}`,"aria-current":e.id===f.id?`page`:void 0,className:T(`block rounded-lg px-3 py-2 text-[14px] transition`,e.id===f.id?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:bg-accent hover:text-ink`),children:e.label})},e.id))})}),(0,B.jsx)(ye,{className:`md:hidden`,value:f.id,onChange:e=>t(`/settings/${e}`),options:d.map(e=>({value:e.id,label:e.label}))}),(0,B.jsxs)(`div`,{className:T(`min-w-0`,f.id!==`project`&&`max-w-2xl`),children:[p?(0,B.jsx)(`div`,{className:`mb-6`,children:(0,B.jsx)(je,{})}):null,f.id===`project`&&r?(0,B.jsx)(on,{project:r},l):null,f.id===`connectors`&&r?(0,B.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,B.jsx)(dt,{projectId:r.id},l),(0,B.jsx)(cn,{project:r},l)]}):null,f.id===`models`?(0,B.jsx)(Ae,{}):null,f.id===`build`?(0,B.jsx)(_t,{}):null,f.id===`account`&&n.data?(0,B.jsx)(ot,{me:n.data}):null]})]})]})}export{ln as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-Dk72oS4N.js";import{A as r,D as i,_ as a,d as o,m as ee,n as s,tt as c}from"./api-DbPn6Dge.js";import{t as te}from"./arrow-left-UpjOBfQp.js";import{t as l}from"./arrow-right-CucQycEy.js";import{t as u}from"./check-Bjx41xbB.js";import{p as ne}from"./definition-cy7uvY5L.js";import{h as d,t as re,v as f}from"./ui-tO4ZXbfh.js";import{a as ie,g as p,l as m}from"./index-BYV0HYlP.js";import{a as h,i as g,n as _,o as v,r as y}from"./LocalRuntime-B33qoSb2.js";var b=e(t(),1),x=n(),ae=`oklch(50% 0.2 262)`,S=`oklch(32% 0.15 262)`,C=`oklch(90% 0.1 80)`,w=`oklch(88% 0.17 150)`,T=`oklch(88% 0.14 80)`,E=`rgb(255 255 255 / 0.38)`,D={"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--ink-4":`oklch(82% 0.05 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},O=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,oe=220,se={codex:`dome`,claude:`oval`,gemini:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`},k=`oklch(27% 0.09 150)`,A=`relative w-fit max-w-full transition-[left,translate] duration-700 ease-[cubic-bezier(0.3,0.7,0.2,1)] motion-reduce:transition-none`,j=`left-1/2 -translate-x-1/2 text-center`,M=`max-lg:left-1/2 max-lg:-translate-x-1/2 max-lg:text-center lg:left-0 lg:translate-x-0 lg:text-left`;function N(){window.matchMedia(`(max-width: 1023px)`).matches&&window.scrollTo({top:0})}var P=`wizards.setup.own`;function F(){try{return sessionStorage.getItem(P)===`1`}catch{return!1}}function I(e){try{e?sessionStorage.setItem(P,`1`):sessionStorage.removeItem(P)}catch{}}function L(){return(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,x.jsx)(a,{size:28}),(0,x.jsxs)(`span`,{className:`font-display font-semibold text-[17px] tracking-tight`,children:[`engenty`,(0,x.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em]`,style:{color:C},children:`.`}),(0,x.jsx)(`span`,{className:`font-normal text-white/70`,children:`wizards`})]})]})}function R({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,x.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:d(`group relative flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left transition-[background-color,color,box-shadow] duration-300`,e?`bg-white shadow-elevated`:`bg-white/10 ring-1 ring-white/15 hover:bg-white/15`),style:e?{color:S}:void 0,children:[r?(0,x.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[11px] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:C,color:S},children:r}):null,(0,x.jsx)(`span`,{className:d(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent`:`border-white/40`),style:e?{background:S}:void 0,children:e?(0,x.jsx)(u,{className:`size-3.5 text-white`}):null}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`span`,{className:`block font-medium text-[15px]`,children:t}),(0,x.jsx)(`span`,{className:d(`mt-0.5 block truncate text-[13px]`,e?`opacity-70`:`text-white/65`),children:n})]}),i?(0,x.jsx)(`span`,{className:d(`shrink-0 text-[12px]`,e?`opacity-70`:`text-white/65`),children:i}):null,(0,x.jsx)(l,{className:d(`size-4 shrink-0 transition`,e?`opacity-70`:`text-white/40 group-hover:translate-x-0.5 group-hover:text-white/80`)})]})}function z({name:e,at:t,done:n}){let r=[f(`setup.stage.connect`),f(`setup.stage.test`),f(`setup.stage.done`)],i=n?r.length:t+1;return(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[12px] uppercase tracking-[0.14em]`,children:[(0,x.jsx)(`span`,{className:`text-white/70`,children:e}),(0,x.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:r.map((e,r)=>{let i=n||r<t;return(0,x.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?w:r===t?T:E},children:[i?(0,x.jsx)(u,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,x.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?w:T:`rgb(255 255 255 / 0.22)`}},e))})]})}function B({href:e,children:t}){return(0,x.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-white`,onClick:t=>{t.preventDefault(),y(e)},children:t})}function V(){ee(ae);let e=m(),t=c(),n=i(),a=r({queryKey:[`config`],queryFn:()=>s.get(`/api/config`)}),[l,y]=(0,b.useState)(F),[T,E]=(0,b.useState)(!1),P=p({mutationFn:e=>s.put(`/api/studio/local/models`,{source:e}),onSuccess:async(e,n)=>{await t.invalidateQueries({queryKey:[`me`]}),y(!0),E(!1),N(),I(n===`own`)}}),V=p({mutationFn:()=>Promise.all((e.data?.harnesses??[]).map(e=>s.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})});if(!e.data?.models)return null;let H=e.data.models,U=e=>(e.version===null?2:0)+ +!e.app,W=[...e.data.harnesses].sort((e,t)=>U(e)-U(t)),G=W.filter(e=>e.version!==null),K=l||e.data.setupDone||H.source!==`own`?H.source:null,q=e.data.harnesses.find(e=>e.id===K),J=e.data.setupDone,Y=Object.values(H.keys).some(Boolean),ce=J?2:q?q.auth===`none`?0:1:+!!Y,X=J?f(`setup.h.done`):q?q.version===null?f(`setup.h.install`,{name:q.name}):q.auth===`none`?f(`setup.h.signIn`,{name:q.name}):f(`setup.h.test`):f(Y?`setup.h.test`:`setup.h.keys`),Z=v.site?a.data?.site:null,Q=K!==null&&!T,$=P.isPending?P.variables??K:K;return(0,x.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-white sm:px-10`,style:D,children:[(0,x.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,x.jsx)(L,{}),(0,x.jsx)(ie,{ink:S})]}),(0,x.jsxs)(`main`,{className:`relative mx-auto flex w-full max-w-6xl flex-1 flex-col pt-6 pb-10 lg:pt-[6vh]`,children:[(0,x.jsx)(`div`,{"aria-hidden":`true`,className:d(`absolute top-6 left-1/2 z-10 origin-top -translate-x-1/2 transition-[opacity,scale,left] duration-500 motion-reduce:transition-none lg:top-[calc(6vh+5.25rem)] lg:origin-center lg:translate-x-0`,O,K?`lg:pointer-events-none lg:left-[calc(50%-560px)] lg:scale-75 lg:opacity-0`:`lg:left-[calc(50%-508px)] lg:scale-100 lg:opacity-100`,Q?`max-lg:pointer-events-none max-lg:scale-[0.4] max-lg:opacity-0`:`max-lg:scale-[0.6] max-lg:opacity-100`),children:(0,x.jsx)(`div`,{className:`animate-rise`,children:(0,x.jsx)(o,{kind:`drop`,size:oe,fluffy:!0,coat:`fur`})})}),(0,x.jsx)(`div`,{"aria-hidden":`true`,className:d(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,O,Q?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,children:[(0,x.jsxs)(`section`,{className:d(`flex w-full shrink-0 animate-rise flex-col lg:w-[32rem] lg:transition-[margin] lg:duration-700 motion-reduce:transition-none`,O,K?`lg:ml-0`:`lg:ml-[calc(50%-16rem)]`,Q?`max-lg:hidden`:``),children:[(0,x.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,x.jsx)(`p`,{className:d(A,`font-medium text-[12px] text-white/70 uppercase tracking-[0.16em]`,K?M:j),children:f(`setup.title`)}),(0,x.jsx)(`h1`,{className:d(A,`mt-2 font-display font-semibold text-[26px] leading-[1.08] tracking-[-0.02em] sm:text-[28px]`,K?M:j),children:f(`setup.source`)}),(0,x.jsx)(`p`,{className:d(A,`mt-2.5 text-[15px] text-white/75 leading-relaxed`,K?M:j),children:f(`setup.sub`)})]}),(0,x.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[W.map((e,t)=>(0,x.jsx)(R,{selected:$===e.id,title:e.name,description:f(`harness.desc.${e.id}`),badge:t===0?f(`setup.recommended`):void 0,note:e.version===null?f(`harness.notInstalled`):e.auth===`subscription`?f(`harness.ready`):void 0,onPick:()=>P.mutate(e.id)},e.id)),(0,x.jsx)(R,{selected:$===`own`,title:f(`local.sourceOwn`),description:f(`setup.ownDesc`),onPick:()=>P.mutate(`own`)})]}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-[13px] text-white/60`,children:[(0,x.jsx)(`span`,{children:G.length?null:f(`setup.noHarness`)}),(0,x.jsxs)(re,{variant:`ghost`,size:`sm`,busy:V.isPending,onClick:()=>V.mutate(),children:[(0,x.jsx)(ne,{className:`size-3.5`}),` `,f(`local.recheck`)]})]})]}),K?(0,x.jsxs)(`section`,{className:d(`min-w-0 flex-1 animate-settle`,T?`max-lg:hidden`:``),children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>{E(!0),N()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-[14px] text-white/80 transition hover:text-white lg:hidden`,children:[(0,x.jsx)(te,{className:`size-4`}),` `,f(`run.back`)]}),(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,x.jsx)(o,{kind:se[K],size:120,fluffy:!0,coat:`fur`})}),(0,x.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,x.jsx)(z,{name:q?.name??f(`local.sourceOwn`),at:ce,done:J}),(0,x.jsx)(`h2`,{className:`mt-2 animate-rise pr-32 font-display font-semibold text-[clamp(28px,3vw,40px)] leading-[1.06] tracking-[-0.03em]`,children:X},X)]}),(0,x.jsx)(`div`,{className:`mt-5 rounded-2xl bg-white/[0.07] p-5 ring-1 ring-white/12 sm:p-6`,children:q?(0,x.jsx)(g,{me:e.data,id:q.id,autoTest:!J}):(0,x.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,x.jsx)(_,{models:H}),(0,x.jsx)(h,{})]})}),(0,x.jsxs)(`div`,{className:`mt-9`,children:[J?(0,x.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[15px]`,style:{color:w},children:[(0,x.jsx)(u,{className:`size-4`,strokeWidth:3}),f(`setup.ready`)]}):null,(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,x.jsxs)(`button`,{type:`button`,disabled:!J,onClick:()=>n(`/`,{replace:!0}),className:d(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[16px] transition-[background-color,color,box-shadow,filter] duration-300`,J?`shadow-[0_6px_24px_oklch(88%_0.17_150/0.35)] hover:brightness-105`:`cursor-not-allowed bg-white/20 text-white/65`),style:J?{background:w,color:k}:void 0,children:[f(`setup.done`),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),J?null:(0,x.jsx)(`span`,{className:`text-[13px] text-white/65`,children:f(`setup.untilWorks`)})]})]})]})]},K):null]})]}),(0,x.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-[12px] text-white/55 sm:pb-8`,children:[(0,x.jsxs)(`span`,{children:[`© `,new Date().getFullYear(),` engenty · `,f(`setup.local`)]}),(0,x.jsxs)(`span`,{className:`flex items-center gap-5`,children:[Z?(0,x.jsx)(B,{href:Z,children:new URL(Z).host}):null,(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px]`,style:{background:C}})]})]})]})}export{V as SetupPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-Dk72oS4N.js";import{A as r,O as i,a,d as o,h as s,l as c,n as l,r as u}from"./api-DbPn6Dge.js";import{t as d}from"./arrow-right-CucQycEy.js";import{i as f,t as p}from"./outputs-BJ6FXJP6.js";import{d as m,g as h,n as g,t as _,v}from"./ui-tO4ZXbfh.js";import{BrandHeader as y,useBrandAccent as b}from"./PublicRunner-Bj_gFWxk.js";var x=e(t(),1),S=n();function C(){let{token:e}=i(),t=r({queryKey:[`share`,e],queryFn:()=>l.get(`/api/shares/${e}`),retry:(e,t)=>u(t)&&e<3});if(b(t.data?.brand.accent),s(t.data?.wizard.avatar),(0,x.useEffect)(()=>{t.data&&(document.title=`${t.data.title} · ${t.data.wizard.title}`)},[t.data]),t.isLoading)return(0,S.jsx)(`div`,{className:`flex min-h-dvh items-center justify-center text-ink-4`,children:(0,S.jsx)(m,{})});let n=t.data;if(!n)return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col items-center justify-center gap-4 px-6 text-center`,children:[(0,S.jsx)(o,{kind:`pebble`,size:80}),(0,S.jsx)(`p`,{className:`max-w-sm text-ink-3`,children:v(u(t.error)?`common.offline`:`sharePage.gone`)}),u(t.error)?(0,S.jsx)(_,{variant:`secondary`,onClick:()=>void t.refetch(),children:v(`common.retry`)}):null]});let C=`/api/shares/${n.token}`,w=e=>new Intl.DateTimeFormat(h,{dateStyle:`long`}).format(new Date(e));return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col`,children:[(0,S.jsx)(y,{brand:n.brand}),(0,S.jsxs)(`main`,{className:`mx-auto w-full max-w-3xl flex-1 animate-rise px-4 pt-6 pb-12 sm:px-6`,children:[(0,S.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center gap-4`,children:[(0,S.jsx)(o,{kind:n.wizard.avatar,size:64}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`text-[13px] text-ink-4`,children:n.expiresAt?v(`sharePage.until`,{date:w(n.expiresAt)}):v(`sharePage.shared`,{date:w(n.createdAt)})}),(0,S.jsx)(`h1`,{className:`font-display font-semibold text-[28px] leading-tight tracking-tight sm:text-[32px]`,children:n.title}),n.message?(0,S.jsx)(`p`,{className:`mt-1 text-[15px] text-ink-3`,children:n.message}):null]})]}),(0,S.jsx)(`div`,{className:`flex flex-col gap-6`,children:n.shown.map(({step:e,output:t,formats:n,label:r})=>(0,S.jsxs)(g,{className:`p-4 sm:p-5`,children:[(0,S.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,S.jsx)(`h2`,{className:`font-display font-semibold text-[17px]`,children:r??e.title}),(0,S.jsx)(p,{base:C,stepId:e.id,formats:n,title:r??e.title})]}),(0,S.jsx)(f,{base:C,step:e,output:t})]},e.id))}),n.wizardUrl?(0,S.jsxs)(`a`,{href:n.wizardUrl,className:`mt-10 flex items-center gap-4 rounded-2xl bg-card p-5 shadow-soft ring-1 ring-border-soft transition hover:shadow-elevated`,children:[(0,S.jsx)(o,{kind:n.wizard.avatar,size:44,interactive:!1}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-display font-semibold text-[16px]`,children:n.wizard.title}),n.wizard.description?(0,S.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:n.wizard.description}):null]}),(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-[14px] text-ember-strong`,children:[v(`sharePage.own`),` `,(0,S.jsx)(d,{className:`size-4`})]})]}):null]}),(0,S.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[12px] text-ink-4`,children:(0,S.jsx)(`a`,{href:`${a}/`,className:`inline-block py-3.5 hover:text-ink-2`,children:v(`run.madeWith`).replace(`engenty wizards`,c.name)})})]})}export{C as SharePage};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fluffy-engenty-CJ3wCQgT.js","assets/jsx-runtime-Dk72oS4N.js","assets/engenty-CWIFpgKq.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-Dk72oS4N.js";import{t as r}from"./preload-helper-CNEI7N0N.js";import{t as i}from"./createLucideIcon-DBu2Ovxj.js";import{c as a,l as o,t as s,u as c}from"./engenty-CWIFpgKq.js";import{o as l,v as u}from"./ui-tO4ZXbfh.js";var d=e(t(),1),f=n(),p=d.createContext(void 0),m=e=>{let t=d.useContext(p);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},h=({client:e,children:t})=>(d.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,f.jsx)(p.Provider,{value:e,children:t})),g={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_=new class{#e=g;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function v(e){setTimeout(e,0)}var y=typeof window>`u`||`Deno`in globalThis;function b(){}function x(e,t){return typeof e==`function`?e(t):e}function S(e){return typeof e==`number`&&e>=0&&e!==1/0}function C(e,t){return Math.max(e+(t||0)-Date.now(),0)}function w(e,t){return typeof e==`function`?e(t):e}function ee(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ne(o,t.options))return!1}else if(!E(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function te(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(T(t.options.mutationKey)!==T(a))return!1}else if(!E(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ne(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>se(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function E(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!E(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!E(e[r],t[r]))return!1;return!0}return!1}var re=Object.prototype.hasOwnProperty;function ie(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=oe(e)&&oe(t);if(!r&&!(se(e)&&se(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:re.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ie(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ae(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function oe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function se(e){if(!ce(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!ce(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function ce(e){return Object.prototype.toString.call(e)===`[object Object]`}function le(e){return new Promise(t=>{_.setTimeout(t,e)})}function ue(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ie(e,t)}function de(e){return e}function fe(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function pe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var me=Symbol();function he(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===me?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ge(e,t){return typeof e==`function`?e(...t):!!e}function _e(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ve=()=>y,ye=()=>ve(),be=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},xe=new class extends be{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Se=v;function Ce(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Se,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var we=Ce(),Te=new class extends be{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ee(e){return Math.min(1e3*2**e,3e4)}function De(e){return(e??`online`)!==`online`||Te.isOnline()}var Oe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ke(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(b);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Oe(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>xe.isFocused()&&(e.networkMode===`always`||Te.isOnline())&&e.canRun(),p=()=>De(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(ye()?0:3),a=e.retryDelay??Ee,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),le(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Ae=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S(this.gcTime)&&(this.#e=_.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ye()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(_.clearTimeout(this.#e),this.#e=void 0)}};function je(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{_e(e,()=>t.signal,()=>n=!0)},u=he(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?pe:fe;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ne:Me,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Me(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Me(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ne(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Pe(e,t){return t?Me(e,t)!=null:!1}function Fe(e,t){return!t||!e.getPreviousPageParam?!1:Ne(e,t)!=null}var Ie=class extends Ae{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ze(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ze(this.options);e.data!==void 0&&(this.setState(Re(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ue(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(b).catch(b):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>w(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>w(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!C(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=he(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?je(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ke({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Oe&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Oe){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Le(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Re(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),we.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Le(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:De(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Re(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ze(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Be=class extends be{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),He(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ue(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ue(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof w(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!ae(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&We(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||w(this.options.staleTime,this.#t)!==w(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ae(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(b)),t}#h(e){return!ye()&&w(this.options.enabled,this.#t)!==!1&&S(e)}#g(){this.#b();let e=w(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=C(this.#r.dataUpdatedAt,e)+1;this.#u=_.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return w(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=_.setInterval(()=>{(this.options.refetchIntervalInBackground||xe.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(_.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(_.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&He(e,t),o=i&&We(e,n,t,r);(a||o)&&(l={...l,...Le(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=ue(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=ue(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ge(e,t),refetch:this.refetch,isEnabled:w(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),ae(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();we.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ve(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||w(t.retryOnMount,e)!==!1)}function He(e,t){return Ve(e,t)||e.state.data!==void 0&&Ue(e,t,t.refetchOnMount)}function Ue(e,t,n){if(w(t.enabled,e)!==!1&&w(t.staleTime,e)!==`static`){let r=w(n,e);return r===`always`||r!==!1&&Ge(e,t)}return!1}function We(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ge(e,n)}function Ge(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(w(t.staleTime,e))}var Ke=d.createContext(!1),qe=()=>d.useContext(Ke);Ke.Provider;function Je(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ye=d.createContext(Je()),Xe=()=>d.useContext(Ye),Ze=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ge(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Qe=e=>{d.useEffect(()=>{e.clearReset()},[e])},$e=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ge(n,[e.error,r])),et=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},tt=(e,t)=>e?.suspense&&t.isPending,nt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function rt(e,t,n){let r=qe(),i=Xe(),a=m(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,et(o),Ze(o,i,s),Qe(i);let[l]=d.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),f=!r&&c;if(d.useSyncExternalStore(d.useCallback(e=>{let t=f?l.subscribe(we.batchCalls(e)):b;return l.updateResult(),t},[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),d.useEffect(()=>{l.setOptions(o)},[o,l]),tt(o,u))throw nt(o,l,i);if($e({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function it(e,t){return rt(e,Be,t)}var at=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,ot=/^[\\/]{2}/;function st(e,t){return t+e.replace(/\\/g,`/`)}var ct=`popstate`;function lt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function ut(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return pt(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:k(t)}return mt(t,n,null,e)}function D(e,t){if(e===!1||e==null)throw Error(t)}function O(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function dt(){return Math.random().toString(36).substring(2,10)}function ft(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function pt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?A(t):t,state:n,key:t&&t.key||r||dt(),mask:i}}function k({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function A(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function mt(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=lt(e)?e:pt(h.location,e,t);n&&n(r,e),l=u()+1;let d=ft(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=lt(e)?e:pt(h.location,e,t);n&&n(r,e),l=u();let i=ft(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ht(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(ct,d),c=e,()=>{i.removeEventListener(ct,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function ht(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),D(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:k(t);return i=i.replace(/ $/,`%20`),!n&&ot.test(i)&&(i=r+i),new URL(i,r)}function gt(e,t,n=`/`){return _t(e,t,n,!1)}function _t(e,t,n,r,i){let a=M((typeof t==`string`?A(t):t).pathname||`/`,n);if(a==null)return null;let o=i??vt(e),s=null,c=Pt(a);for(let e=0;s==null&&e<o.length;++e)s=jt(o[e],c,r);return s}function vt(e){let t=yt(e);return xt(t),t}function yt(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;D(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=N([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(D(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),yt(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:kt(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Nt(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of bt(e.path))a(e,t,!0,n)}),t}function bt(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=bt(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function xt(e){e.sort((e,t)=>e.score===t.score?At(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var St=/^:[\w-]+$/,Ct=3,wt=2,Tt=1,Et=10,Dt=-2,Ot=e=>e===`*`;function kt(e,t){let n=e.split(`/`),r=n.length;return n.some(Ot)&&(r+=Dt),t&&(r+=wt),n.filter(e=>!Ot(e)).reduce((e,t)=>e+(St.test(t)?Ct:t===``?Tt:Et),r)}function At(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function jt(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?Mt(u,l,s.matcher,s.compiledParams):j(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=j({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:N([a,d.pathname]),pathnameBase:Ht(N([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=N([a,d.pathnameBase]))}return o}function j(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Nt(e.path,e.caseSensitive,e.end);return Mt(e,t,n,r)}function Mt(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=P(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=P(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Nt(e,t=!1,n=!0){O(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Pt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return O(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function M(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Ft(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?A(e):e,a;return n?(n=Vt(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?It(n.substring(1),`/`):It(n,t)):a=t,{pathname:a,search:Ut(r),hash:Wt(i)}}function It(e,t){let n=P(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Lt(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Rt(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function zt(e){let t=Rt(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Bt(e,t,n,r=!1){let i;typeof e==`string`?i=A(e):(i={...e},D(!i.pathname||!i.pathname.includes(`?`),Lt(`?`,`pathname`,`search`,i)),D(!i.pathname||!i.pathname.includes(`#`),Lt(`#`,`pathname`,`hash`,i)),D(!i.search||!i.search.includes(`#`),Lt(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Ft(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Vt=e=>e.replace(/[\\/]{2,}/g,`/`),N=e=>Vt(e.join(`/`));function P(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var Ht=e=>P(e).replace(/^\/*/,`/`),Ut=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Wt=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Gt=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Kt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function qt(e){return N(e.map(e=>e.route.path).filter(Boolean))||`/`}var Jt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Yt(e,t){let n=e;if(typeof n!=`string`||!at.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Jt)try{let e=new URL(window.location.href),r=ot.test(n)?new URL(st(n,e.protocol)):new URL(n),a=M(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{O(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Xt=new URL(`http://localhost`);function Zt(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Xt)}catch{return Xt}}function Qt(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function $t(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function en(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Qt(i,n),s=!Qt(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!$t(e,i)||!Qt(i,a)))throw Error(`External navigation is not allowed`)}var tn=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(tn);var nn=[`GET`,...tn];new Set(nn);var rn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function an(e){try{return rn.includes(new URL(e).protocol)}catch{return!1}}var F=d.createContext(null);F.displayName=`DataRouter`;var I=d.createContext(null);I.displayName=`DataRouterState`;var on=d.createContext(!1);function sn(){return d.useContext(on)}var cn=d.createContext({isTransitioning:!1});cn.displayName=`ViewTransition`;var ln=d.createContext(new Map);ln.displayName=`Fetchers`;var un=d.createContext(null);un.displayName=`Await`;var L=d.createContext(null);L.displayName=`Navigation`;var R=d.createContext(null);R.displayName=`Location`;var z=d.createContext({outlet:null,matches:[],isDataRoute:!1});z.displayName=`Route`;var dn=d.createContext(null);dn.displayName=`RouteError`;var fn=`REACT_ROUTER_ERROR`,pn=`REDIRECT`,mn=`ROUTE_ERROR_RESPONSE`;function hn(e){if(e.startsWith(`${fn}:${pn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function gn(e){if(e.startsWith(`${fn}:${mn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Gt(t.status,t.statusText,t.data)}catch{}}function _n(e,{relative:t}={}){D(B(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=d.useContext(L),{hash:i,pathname:a,search:o}=U(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:N([n,a])),r.createHref({pathname:s,search:o,hash:i})}function B(){return d.useContext(R)!=null}function V(){return D(B(),`useLocation() may be used only in the context of a <Router> component.`),d.useContext(R).location}var vn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function yn(e){d.useContext(L).static||d.useLayoutEffect(e)}function H(){let{isDataRoute:e}=d.useContext(z);return e?Rn():bn()}function bn(){D(B(),`useNavigate() may be used only in the context of a <Router> component.`);let e=d.useContext(F),{basename:t,navigator:n}=d.useContext(L),{matches:r}=d.useContext(z),{pathname:i}=V(),a=JSON.stringify(zt(r)),o=d.useRef(!1);return yn(()=>{o.current=!0}),d.useCallback((r,s={})=>{if(O(o.current,vn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Bt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:N([t,c.pathname])),en(typeof r==`string`?r:k(r),n.createHref(c),Zt(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}d.createContext(null);function xn(){let{matches:e}=d.useContext(z);return e[e.length-1]?.params??{}}function U(e,{relative:t}={}){let{matches:n}=d.useContext(z),{pathname:r}=V(),i=JSON.stringify(zt(n));return d.useMemo(()=>Bt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Sn(e,t){return Cn(e,t)}function Cn(e,t,n){D(B(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=d.useContext(L),{matches:i}=d.useContext(z),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Bn(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
3
|
-
|
|
4
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=V(),f;if(t){let e=typeof t==`string`?A(t):t;D(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=u;let p=f.pathname||`/`,m=p;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);m=`/`+p.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let h=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):gt(e,{pathname:m});O(l||h!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),O(h==null||h[h.length-1].route.element!==void 0||h[h.length-1].route.Component!==void 0||h[h.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let g=An(h&&h.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:N([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:N([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&g?d.createElement(R.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...f},navigationType:`POP`}},g):g}function wn(){let e=Ln(),t=Kt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=d.createElement(d.Fragment,null,d.createElement(`p`,null,`💿 Hey developer 👋`),d.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,d.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,d.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),d.createElement(d.Fragment,null,d.createElement(`h2`,null,`Unexpected Application Error!`),d.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?d.createElement(`pre`,{style:i},n):null,o)}var Tn=d.createElement(wn,null),En=class extends d.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=gn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:d.createElement(z.Provider,{value:this.props.routeContext},d.createElement(dn.Provider,{value:e,children:this.props.component}));return this.context?d.createElement(On,{error:e},t):t}};En.contextType=on;var Dn=new WeakMap;function On({children:e,error:t}){let{basename:n,navigator:r}=d.useContext(L);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=hn(t.digest);if(e){let i=Dn.get(t);if(i)throw i;let a=Yt(e.location,n),o=a.absoluteURL||a.to;if(en(e.location,o,Zt(r),`allow-explicit`),an(o))throw Error(`Invalid redirect location`);if(Jt&&!Dn.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Dn.set(t,n),n}}return d.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function kn({routeContext:e,match:t,children:n}){let r=d.useContext(F);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(z.Provider,{value:e},n)}function An(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);D(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:qt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,f=!1,p=null,m=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,p=n.route.errorElement||Tn,o&&(s<0&&c===0?(Bn(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):s===c&&(f=!0,m=n.route.hydrateFallbackElement||null)));let h=t.concat(i.slice(0,c+1)),g=()=>{let t;return t=u?p:f?m:n.route.Component?d.createElement(n.route.Component,null):n.route.element?n.route.element:e,d.createElement(kn,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?d.createElement(En,{location:r.location,revalidation:r.revalidation,component:p,error:u,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:l}):g()},null)}function jn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mn(e){let t=d.useContext(F);return D(t,jn(e)),t}function Nn(e){let t=d.useContext(I);return D(t,jn(e)),t}function Pn(e){let t=d.useContext(z);return D(t,jn(e)),t}function Fn(e){let t=Pn(e),n=t.matches[t.matches.length-1];return D(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function In(){return Fn(`useRouteId`)}function Ln(){let e=d.useContext(dn),t=Nn(`useRouteError`),n=Fn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Rn(){let{router:e}=Mn(`useNavigate`),t=Fn(`useNavigate`),n=d.useRef(!1);return yn(()=>{n.current=!0}),d.useCallback(async(r,i={})=>{O(n.current,vn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var zn={};function Bn(e,t,n){!t&&!zn[e]&&(zn[e]=!0,O(!1,n))}d.memo(Vn);function Vn({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Cn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Hn({to:e,replace:t,state:n,relative:r}){D(B(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=d.useContext(L);O(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=d.useContext(z),{pathname:s}=V(),c=H(),l=Bt(e,zt(o),s,r===`path`);en(typeof e==`string`?e:k(e),a.createHref(l),Zt(a),`reject`);let u=JSON.stringify(l);return d.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function Un(e){D(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Wn({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){D(!B(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=d.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=A(n));let{pathname:l=`/`,search:u=``,hash:f=``,state:p=null,key:m=`default`,mask:h}=n,g=d.useMemo(()=>{let e=M(l,s);return e==null?null:{location:{pathname:e,search:u,hash:f,state:p,key:m,mask:h},navigationType:r}},[s,l,u,f,p,m,r,h]);return O(g!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${f}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:d.createElement(L.Provider,{value:c},d.createElement(R.Provider,{children:t,value:g}))}function Gn({children:e,location:t}){return Sn(Kn(e),t)}d.Component;function Kn(e,t=[]){let n=[];return d.Children.forEach(e,(e,r)=>{if(!d.isValidElement(e))return;let i=[...t,r];if(e.type===d.Fragment){n.push.apply(n,Kn(e.props.children,i));return}D(e.type===Un,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),D(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Kn(e.props.children,i)),n.push(a)}),n}var W=`get`,G=`application/x-www-form-urlencoded`;function K(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function qn(e){return K(e)&&e.tagName.toLowerCase()===`button`}function Jn(e){return K(e)&&e.tagName.toLowerCase()===`form`}function Yn(e){return K(e)&&e.tagName.toLowerCase()===`input`}function Xn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Zn(e,t){return e.button===0&&(!t||t===`_self`)&&!Xn(e)}function Qn(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function $n(e,t){let n=Qn(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var q=null;function er(){if(q===null)try{new FormData(document.createElement(`form`),0),q=!1}catch{q=!0}return q}var tr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function nr(e){return e!=null&&!tr.has(e)?(O(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${G}"`),null):e}function rr(e,t){let n,r,i,a,o;if(Jn(e)){let o=e.getAttribute(`action`);r=o?M(o,t):null,n=e.getAttribute(`method`)||W,i=nr(e.getAttribute(`enctype`))||G,a=new FormData(e)}else if(qn(e)||Yn(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?M(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||W,i=nr(e.getAttribute(`formenctype`))||nr(o.getAttribute(`enctype`))||G,a=new FormData(o,e),!er()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(K(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=W,r=null,i=G,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function ir(e,t){if(e===!1||e==null)throw Error(t)}function ar(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&M(i.pathname,t)===`/`?`${P(t)}/_root.${r}`:`${P(i.pathname)}.${r}`,i}async function or(e,t){if(e.id in t)return t[e.id];try{let n=await r(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function sr(e){return e!=null&&typeof e.page==`string`}function cr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function lr(e,t,n){return mr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await or(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(cr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function ur(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function dr(e,t,{includeHydrateFallback:n}={}){return fr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function fr(e){return[...new Set(e)]}function pr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function mr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!sr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(pr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function hr(){let e=d.useContext(F);return ir(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function gr(){let e=d.useContext(I);return ir(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var _r=d.createContext(void 0);_r.displayName=`FrameworkContext`;function J(){let e=d.useContext(_r);return ir(e,`You must render this element inside a <HydratedRouter> element`),e}function vr(e,t){let n=d.useContext(_r),[r,i]=d.useState(!1),[a,o]=d.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:f}=t,p=d.useRef(null);d.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),d.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),o(!1)};return n?e===`intent`?[a,p,{onFocus:Y(s,m),onBlur:Y(c,h),onMouseEnter:Y(l,m),onMouseLeave:Y(u,h),onTouchStart:Y(f,m)}]:[a,p,{}]:[!1,p,{}]}function Y(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function yr({page:e,...t}){let n=sn(),{nonce:r}=J(),{router:i}=hr(),a=d.useMemo(()=>gt(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?d.createElement(xr,{page:e,matches:a,...t}):d.createElement(Sr,{page:e,matches:a,...t})):null}function br(e){let{manifest:t,routeModules:n}=J(),[r,i]=d.useState([]);return d.useEffect(()=>{let r=!1;return lr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function xr({page:e,matches:t,...n}){let r=V(),{future:i}=J(),{basename:a}=hr(),o=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=ar(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return d.createElement(d.Fragment,null,o.map(e=>d.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Sr({page:e,matches:t,...n}){let r=V(),{future:i,manifest:a,routeModules:o}=J(),{basename:s}=hr(),{loaderData:c,matches:l}=gr(),u=d.useMemo(()=>ur(e,t,l,a,r,`data`),[e,t,l,a,r]),f=d.useMemo(()=>ur(e,t,l,a,r,`assets`),[e,t,l,a,r]),p=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=ar(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),m=d.useMemo(()=>dr(f,a),[f,a]),h=br(f);return d.createElement(d.Fragment,null,p.map(e=>d.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>d.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>d.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Cr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}d.Component;var wr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{wr&&(window.__reactRouterVersion=`7.18.4`)}catch{}function Tr({basename:e,children:t,useTransitions:n,window:r}){let i=d.useRef();i.current??=ut({window:r,v5Compat:!0});let a=i.current,[o,s]=d.useState({action:a.action,location:a.location}),c=d.useCallback(e=>{n===!1?s(e):d.startTransition(()=>s(e))},[n]);return d.useLayoutEffect(()=>a.listen(c),[a,c]),d.createElement(Wn,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var Er=d.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:f,defaultShouldRevalidate:p,...m},h){let{basename:g,navigator:_,useTransitions:v}=d.useContext(L),y=typeof l==`string`&&at.test(l),b=Yt(l,g);l=b.to;let x=_n(l,{relative:r}),S=V(),C=null;if(o){let e=Bt(o,[],S.mask?S.mask.pathname:`/`,!0);g!==`/`&&(e.pathname=e.pathname===`/`?g:N([g,e.pathname])),C=_.createHref(e)}let[w,ee,te]=vr(n,m),ne=jr(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:f,defaultShouldRevalidate:p,useTransitions:v});function T(t){e&&e(t),t.defaultPrevented||ne(t)}let E=!(b.isExternal||i),re=d.createElement(`a`,{...m,...te,href:(E?C:void 0)||b.absoluteURL||x,onClick:E?T:e,ref:Cr(h,ee),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?d.createElement(d.Fragment,null,re,d.createElement(yr,{page:x})):re});Er.displayName=`Link`;var Dr=d.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=U(a,{relative:c.relative}),f=V(),p=d.useContext(I),{navigator:m,basename:h}=d.useContext(L),g=p!=null&&Lr(u)&&o===!0,_=m.encodeLocation?m.encodeLocation(u).pathname:u.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=M(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,ee;ee=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let te=typeof i==`function`?i(C):i;return d.createElement(Er,{...c,"aria-current":w,className:ee,ref:l,style:te,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Dr.displayName=`NavLink`;var Or=d.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=W,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=d.useContext(L),_=Fr(),v=Ir(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&at.test(s);return d.createElement(`form`,{ref:h,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,m=()=>_(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:f,defaultShouldRevalidate:p});g&&n!==!1?d.startTransition(()=>m()):m()},...m,"data-discover":!b&&e===`render`?`true`:void 0})});Or.displayName=`Form`;function kr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ar(e){let t=d.useContext(F);return D(t,kr(e)),t}function jr(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=H(),f=V(),p=U(e,{relative:o});return d.useCallback(m=>{if(Zn(m,t)){m.preventDefault();let t=n===void 0?k(f)===k(p):n,h=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?d.startTransition(()=>h()):h()}},[f,u,p,n,r,i,t,e,a,o,s,c,l])}function Mr(e){O(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=d.useRef(Qn(e)),n=d.useRef(!1),r=V(),i=d.useMemo(()=>$n(r.search,n.current?null:t.current),[r.search]),a=H();return[i,d.useCallback((e,t)=>{let r=Qn(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Nr=0,Pr=()=>`__${String(++Nr)}__`;function Fr(){let{router:e}=Ar(`useSubmit`),{basename:t}=d.useContext(L),n=In(),r=e.fetch,i=e.navigate;return d.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=rr(e,t);if(a.navigate===!1){let e=a.fetcherKey||Pr();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Ir(e,{relative:t}={}){let{basename:n}=d.useContext(L),r=d.useContext(z);D(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...U(e||`.`,{relative:t})},o=V();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:N([n,a.pathname])),k(a)}function Lr(e,{relative:t}={}){let n=d.useContext(cn);D(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ar(`useViewTransitionState`),i=U(e,{relative:t});if(!n.isTransitioning)return!1;let a=M(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=M(n.nextLocation.pathname,r)||n.nextLocation.pathname;return j(i.pathname,o)!=null||j(i.pathname,a)!=null}var Rr={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};Rr.node;var zr=i(Rr),Br={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};Br.node;var Vr=i(Br),Hr=2800;function Ur({size:e=72}){let[t,n]=(0,d.useState)(0);return(0,d.useEffect)(()=>{if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=window.setInterval(()=>n(e=>(e+1)%a.length),Hr);return()=>window.clearInterval(e)},[]),(0,f.jsx)(`span`,{"aria-hidden":`true`,className:`relative inline-block shrink-0`,style:{width:e,height:e},children:a.map((n,r)=>(0,f.jsx)(`span`,{className:`absolute inset-0`,style:{opacity:+(r===t),transition:`opacity 0.45s ease`},children:(0,f.jsx)(s,{kind:n,size:e})},n))})}function Wr({className:e,style:t,onDark:n=!1}){return(0,f.jsxs)(`span`,{className:e,style:t,children:[`engenty`,(0,f.jsx)(`span`,{style:{color:n?`oklch(88% 0.11 75)`:`var(--ember, oklch(64% 0.195 35))`},children:`.`})]})}var Gr=`wizards.theme`,Kr=new Set,qr=window.matchMedia(`(prefers-color-scheme: dark)`);function Jr(){try{let e=localStorage.getItem(Gr);return e===`light`||e===`dark`?e:null}catch{return null}}var Yr=0;function Xr(){return Yr>0?`dark`:Jr()??(qr.matches?`dark`:`light`)}function Zr(){requestAnimationFrame(()=>{let e=document.querySelector(`meta[name="theme-color"]`),t=document.createElement(`canvas`).getContext(`2d`);if(!e||!t||!document.body)return;t.fillStyle=getComputedStyle(document.body).backgroundColor,t.fillRect(0,0,1,1);let[n,r,i]=t.getImageData(0,0,1,1).data;e.content=`#${[n,r,i].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`})}function X(){let e=Xr()===`dark`;document.documentElement.classList.toggle(`dark`,e),Zr();for(let e of Kr)e()}qr.addEventListener(`change`,X),X();function Qr(e){try{localStorage.setItem(Gr,e)}catch{document.documentElement.classList.toggle(`dark`,e===`dark`);return}X()}function $r(){return(0,d.useSyncExternalStore)(e=>(Kr.add(e),()=>Kr.delete(e)),()=>document.documentElement.classList.contains(`dark`)?`dark`:`light`)}var ei=e=>`oklch(from ${o[c[e]??`cobalt`]} 0.34 calc(c * 0.6) h)`;function ti(e){(0,d.useEffect)(()=>{let t=document.documentElement;return Yr+=1,t.style.setProperty(`--stage`,e),X(),()=>{--Yr,t.style.removeProperty(`--stage`),X()}},[e])}function ni(e){(0,d.useEffect)(()=>{if(!e)return;let t=document.documentElement;return t.style.setProperty(`--stage`,ei(e)),Zr(),()=>{t.style.removeProperty(`--stage`),Zr()}},[e])}var ri={name:`engenty wizards`,short:`wizards`},ii=(0,d.lazy)(()=>r(()=>import(`./fluffy-engenty-CJ3wCQgT.js`).then(e=>({default:e.FluffyEngenty})),__vite__mapDeps([0,1,2])));function ai({kind:e,size:t=64,fluffy:n,coat:r,goggles:i=!1,interactive:a=!0}){let o=e||`round`,c=$r(),l=r??(c===`dark`?`jelly`:`fur`);if(n&&t>=120&&(l===`fur`||c===`dark`))return(0,f.jsx)(d.Suspense,{fallback:(0,f.jsx)(s,{goggles:i,kind:o,size:Math.round(t*.62)}),children:(0,f.jsx)(ii,{goggles:i,coat:l,kind:o,size:t,quality:`medium`,interactive:a})});if(n&&t>=120){let e=Math.round(t*1.08);return(0,f.jsxs)(`div`,{"aria-hidden":`true`,className:`relative flex items-center justify-center overflow-hidden`,style:{background:ei(o),borderRadius:t*.28,height:t,width:t},children:[(0,f.jsx)(`span`,{className:`pointer-events-none absolute rounded-full bg-white`,style:{filter:`blur(${t*.18}px)`,height:t*.8,opacity:.16,right:-t*.3,top:-t*.3,width:t*.8}}),(0,f.jsx)(`div`,{className:`relative`,style:{marginTop:t*.04},children:(0,f.jsx)(d.Suspense,{fallback:(0,f.jsx)(s,{goggles:i,kind:o,size:Math.round(e*.62)}),children:(0,f.jsx)(ii,{goggles:i,coat:`jelly`,kind:o,size:e,quality:`medium`,interactive:a})})})]})}return(0,f.jsx)(s,{goggles:i,kind:o,size:t,animated:a})}function oi({onClick:e,place:t}){return(0,f.jsxs)(`button`,{type:`button`,onClick:e,className:`flex min-w-0 items-center gap-2.5 whitespace-nowrap rounded-full pr-2 text-ink`,children:[(0,f.jsx)(Ur,{size:30}),(0,f.jsxs)(`span`,{className:`font-display font-semibold text-[17px] tracking-tight`,children:[`engenty`,(0,f.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,f.jsx)(`span`,{className:t?`ml-1 font-normal text-ink-3 max-sm:hidden`:`ml-1 font-normal text-ink-3 max-[420px]:hidden`,children:ri.short}),t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`mx-2 font-normal text-ink-4 max-sm:hidden`,children:`/`}),(0,f.jsx)(`span`,{className:`font-medium text-ink max-sm:ml-1.5`,children:t})]}):null]})]})}function si(){let e=$r(),t=e===`dark`?`light`:`dark`;return(0,f.jsx)(l,{label:u(t===`dark`?`theme.dark`:`theme.light`),onClick:()=>Qr(t),children:e===`dark`?(0,f.jsx)(Vr,{className:`size-4`}):(0,f.jsx)(zr,{className:`size-4`})})}var Z=``.replace(/\/+$/,``),ci=`${Z}/studio`;function li(e){return!Z||!e.startsWith(`/`)||e.startsWith(`//`)||e===Z||e.startsWith(`${Z}/`)?e:`${Z}${e}`}function ui(e){return`/studio/${e.replace(/^\/+/,``)}`}var Q=class extends Error{status;body;constructor(e,t,n){super(e),this.status=t,this.body=n}};function di(e){return e instanceof Q&&e.status===0}async function $(e,t,n){let r=await fetch(li(t),{method:e,credentials:`include`,headers:n!==void 0&&!(n instanceof FormData)?{"content-type":`application/json`}:void 0,body:n===void 0?void 0:n instanceof FormData?n:JSON.stringify(n)}).catch(()=>{throw new Q(u(`common.offline`),0,null)}),i=await r.text(),a=i?fi(i):null;if(!r.ok)throw new Q(a?.error??r.statusText,r.status,a);return a}function fi(e){try{return JSON.parse(e)}catch{return{error:e}}}var pi={get:e=>$(`GET`,e),post:(e,t)=>$(`POST`,e,t??{}),put:(e,t)=>$(`PUT`,e,t),patch:(e,t)=>$(`PATCH`,e,t),del:e=>$(`DELETE`,e),upload:(e,t)=>{let n=new FormData;return n.set(`file`,t),$(`POST`,e,n)}};async function mi(e,t,n,r){let i=await fetch(li(e),{method:`POST`,credentials:`include`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:r});if(!i.ok||!i.body){let e=fi(await i.text());throw new Q(e?.error??i.statusText,i.status,e)}let a=i.body.getReader(),o=new TextDecoder,s=``;for(;;){let{done:e,value:t}=await a.read();if(e)break;s+=o.decode(t,{stream:!0});let r=s.indexOf(`
|
|
5
|
-
|
|
6
|
-
`);for(;r!==-1;){let e=s.slice(0,r);s=s.slice(r+2);let t=`message`,i=[];for(let n of e.split(`
|
|
7
|
-
`))n.startsWith(`event:`)?t=n.slice(6).trim():n.startsWith(`data:`)&&i.push(n.slice(5).replace(/^ /,``));n(t,i.join(`
|
|
8
|
-
`)),r=s.indexOf(`
|
|
9
|
-
|
|
10
|
-
`)}}}export{me as $,it as A,xe as B,Hn as C,H as D,V as E,Fe as F,de as G,x as H,Ae as I,b as J,te as K,ke as L,Be as M,Ie as N,xn as O,Pe as P,ge as Q,Te as R,Er as S,Gn as T,T as U,be as V,ne as W,w as X,E as Y,ae as Z,Ur as _,Z as a,zr as b,li as c,ai as d,h as et,si as f,$r as g,ni as h,mi as i,rt as j,Mr as k,ri as l,ti as m,pi as n,ci as o,Qr as p,ee as q,di as r,ui as s,Q as t,m as tt,oi as u,Wr as v,Un as w,Tr as x,Vr as y,we as z};
|