@engenty/wizards-runtime 0.14.2 → 0.15.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.
Files changed (87) hide show
  1. package/apps/runtime/dist/agents/studio-assistant.js +50 -3
  2. package/apps/runtime/dist/app.js +9 -2
  3. package/apps/runtime/dist/broker/call.js +2 -0
  4. package/apps/runtime/dist/broker/host.js +1 -0
  5. package/apps/runtime/dist/broker/rwx.js +38 -4
  6. package/apps/runtime/dist/db/migrations/tenant/0040_rwx_elements.sql +21 -0
  7. package/apps/runtime/dist/db/migrations/tenant/0041_broker_log_client.sql +1 -0
  8. package/apps/runtime/dist/db/migrations/tenant/meta/0040_snapshot.json +5153 -0
  9. package/apps/runtime/dist/db/migrations/tenant/meta/0041_snapshot.json +5160 -0
  10. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +14 -0
  11. package/apps/runtime/dist/db/schema.js +2 -0
  12. package/apps/runtime/dist/docs/dev/api.md +24 -2
  13. package/apps/runtime/dist/docs/dev/architecture.md +13 -2
  14. package/apps/runtime/dist/elements/caller.js +45 -0
  15. package/apps/runtime/dist/elements/catalogue.js +14 -0
  16. package/apps/runtime/dist/elements/connections.js +60 -0
  17. package/apps/runtime/dist/elements/gate.js +81 -0
  18. package/apps/runtime/dist/elements/knowledge.js +139 -0
  19. package/apps/runtime/dist/elements/outside.js +103 -0
  20. package/apps/runtime/dist/elements/specs.js +102 -0
  21. package/apps/runtime/dist/elements/wizards.js +59 -0
  22. package/apps/runtime/dist/env.js +5 -2
  23. package/apps/runtime/dist/mcp/elements.js +88 -0
  24. package/apps/runtime/dist/mcp/handler.js +2 -0
  25. package/apps/runtime/dist/mcp/scopes.js +5 -0
  26. package/apps/runtime/dist/prompts/authoring.md +2 -2
  27. package/apps/runtime/dist/prompts/tools.md +3 -0
  28. package/apps/runtime/dist/routes/api.js +2 -2
  29. package/apps/runtime/dist/routes/elements.js +76 -0
  30. package/apps/runtime/dist/services/work-ai.js +27 -19
  31. package/apps/runtime/dist/services/work-connections.js +2 -2
  32. package/apps/runtime/dist/tools/index.js +5 -4
  33. package/apps/runtime/dist/tools/skills.js +80 -54
  34. package/apps/runtime/dist/tools/space.js +8 -152
  35. package/apps/web/dist/assets/{AboutDialog-Cag3RJuT.js → AboutDialog-DaWEIHFN.js} +1 -1
  36. package/apps/web/dist/assets/{CapabilitiesPage-BQYiN0gT.js → CapabilitiesPage-Dt91U_sK.js} +2 -2
  37. package/apps/web/dist/assets/{ChangelogDialog-D_dQOMIq.js → ChangelogDialog-Do7pwmFv.js} +1 -1
  38. package/apps/web/dist/assets/{CodeEditor-nxoOt8ge.js → CodeEditor-Cdox-51M.js} +1 -1
  39. package/apps/web/dist/assets/{EditorPage-C4_8LsQN.js → EditorPage-DS_a5K3s.js} +1 -1
  40. package/apps/web/dist/assets/{FlowPreview-aMfwcPul.js → FlowPreview-BPS86xzA.js} +1 -1
  41. package/apps/web/dist/assets/{LangSwitch-DpD0inR4.js → LangSwitch-BRHbi_Sd.js} +1 -1
  42. package/apps/web/dist/assets/{Marketplace-CpzD9pNQ.js → Marketplace-CS7JTgiv.js} +2 -2
  43. package/apps/web/dist/assets/{NewWizardChannels-CcE3UMVb.js → NewWizardChannels-D-OLsex6.js} +1 -1
  44. package/apps/web/dist/assets/{NewWizardPage-BzN7zrQx.js → NewWizardPage-BM_pkk41.js} +1 -1
  45. package/apps/web/dist/assets/{OnboardingPage-ztHT01ah.js → OnboardingPage-Cpn5pubC.js} +1 -1
  46. package/apps/web/dist/assets/{PreviewPane-BabMbBZI.js → PreviewPane-BOk1-yO4.js} +1 -1
  47. package/apps/web/dist/assets/{PublicRunner-D-JmtqCi.js → PublicRunner-CgzMZb0r.js} +1 -1
  48. package/apps/web/dist/assets/{ReadOnly-GAORKKqV.js → ReadOnly-8DEx-ly3.js} +1 -1
  49. package/apps/web/dist/assets/{SettingsPage-BKAiYmXl.js → SettingsPage-CcrknFcI.js} +2 -2
  50. package/apps/web/dist/assets/{SetupPage-C1EZZHIp.js → SetupPage-D5nzjgPU.js} +1 -1
  51. package/apps/web/dist/assets/{SharePage-N80EhoD7.js → SharePage-PKHX8a8a.js} +1 -1
  52. package/apps/web/dist/assets/{SkillEditor-CqQMg2MC.js → SkillEditor-BsXTqNli.js} +1 -1
  53. package/apps/web/dist/assets/{Skills-CnhpgoOA.js → Skills-C_X1ZsKg.js} +1 -1
  54. package/apps/web/dist/assets/{SpacePage-CRR8JvV1.js → SpacePage-wZGqUoSQ.js} +2 -2
  55. package/apps/web/dist/assets/{UpdateCheck-CfXZBQNv.js → UpdateCheck-D6x7MqEl.js} +2 -2
  56. package/apps/web/dist/assets/changelog-M-eOBqgu.js +1 -0
  57. package/apps/web/dist/assets/{circle-alert-C8Ma-bPY.js → circle-alert-DJbCyxcg.js} +1 -1
  58. package/apps/web/dist/assets/{circle-check-Bu9Z3mlJ.js → circle-check-jqtsKi_b.js} +1 -1
  59. package/apps/web/dist/assets/{code-editor-CfTGqOpp.js → code-editor-BpCEnf8H.js} +2 -2
  60. package/apps/web/dist/assets/{code-xml-B4kLFZSj.js → code-xml-q88cSTV8.js} +1 -1
  61. package/apps/web/dist/assets/{connection-sign-in-B2D0O8W-.js → connection-sign-in-UJ6xk-TD.js} +1 -1
  62. package/apps/web/dist/assets/{eye-BpoKpIdt.js → eye-CgkvVlba.js} +1 -1
  63. package/apps/web/dist/assets/{host-BlKXX7YK.js → host-Bd_bon_c.js} +7 -7
  64. package/apps/web/dist/assets/{i18n-BJ7Ld6O6.js → i18n-0fUKyVRE.js} +1 -1
  65. package/apps/web/dist/assets/{index-66tE1oti.js → index-DOgwxnto.js} +3 -3
  66. package/apps/web/dist/assets/{phone-Ctvf-Am-.js → phone-CjPvZ0nk.js} +1 -1
  67. package/apps/web/dist/assets/{read-aloud-Da_RSm2S.js → read-aloud-CLXo_asN.js} +1 -1
  68. package/apps/web/dist/assets/{runners-CyIvJIHr.js → runners-BoPaPsjN.js} +1 -1
  69. package/apps/web/dist/assets/{scroll-text-ChrjRu9Y.js → scroll-text-2BhJO_W7.js} +1 -1
  70. package/apps/web/dist/assets/{session-SXPtTWRK.js → session-CpYa5hwd.js} +1 -1
  71. package/apps/web/dist/assets/{theme-Br1S0j5h.js → theme-Bj3wNQR0.js} +1 -1
  72. package/apps/web/dist/assets/{ui-Uqnx1UpK.js → ui-CktezodE.js} +1 -1
  73. package/apps/web/dist/assets/{upload-BchUnQGV.js → upload-CHGCFVZK.js} +1 -1
  74. package/apps/web/dist/assets/{useMutation-DEkZhp5c.js → useMutation-7_FOHoEl.js} +1 -1
  75. package/apps/web/dist/assets/{volume-2-CU_oy81Z.js → volume-2-Bw5KASy8.js} +1 -1
  76. package/apps/web/dist/index.html +13 -13
  77. package/apps/web/dist/mcp/flow.html +1 -1
  78. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +3 -0
  79. package/node_modules/@engenty/wizards-shared/dist/run.js +6 -0
  80. package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +1 -1
  81. package/node_modules/@engenty/wizards-shared/dist/rwx.js +3 -0
  82. package/package.json +1 -1
  83. package/plugin/.claude-plugin/plugin.json +1 -1
  84. package/plugin/README.md +3 -0
  85. package/plugin/plugin.json +1 -1
  86. package/plugin/skills/work-in-space/SKILL.md +16 -0
  87. package/apps/web/dist/assets/changelog-6MqC8Vy8.js +0 -1
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/qr-scanner.min-BGqShvxG.js","assets/preload-helper-DpV6A1kQ.js","assets/pdfmake-Cx9scTbD.js","assets/rolldown-runtime-hePW80VL.js","assets/vfs_fonts-DllDSYt1.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{n,t as r}from"./jsx-runtime-BNakU3Ej.js";import{t as i}from"./preload-helper-DpV6A1kQ.js";import{G as a,J as o,M as s,W as c,Z as l,_ as u,_t as d,at as f,d as p,dt as m,f as h,ft as g,g as _,gt as v,h as y,ht as b,it as x,k as S,m as C,mt as w,n as T,p as ee,pt as E,rt as te,s as D,st as O,u as k}from"./i18n-BJ7Ld6O6.js";var A=t(n(),1),j=t(r(),1),ne=A.createContext(void 0),M=e=>{let t=A.useContext(ne);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},re=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,j.jsx)(ne.Provider,{value:e,children:t})),ie={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ae=new class{#e=ie;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 oe(e){setTimeout(e,0)}var se=typeof window>`u`||`Deno`in globalThis;function ce(){}function N(e,t){return typeof e==`function`?e(t):e}function le(e){return typeof e==`number`&&e>=0&&e!==1/0}function ue(e,t){return Math.max(e+(t||0)-Date.now(),0)}function P(e,t){return typeof e==`function`?e(t):e}function de(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==pe(o,t.options))return!1}else if(!he(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 fe(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(me(t.options.mutationKey)!==me(a))return!1}else if(!he(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function pe(e,t){return(t?.queryKeyHashFn||me)(e)}function me(e){return JSON.stringify(e,(e,t)=>ve(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function he(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(!he(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!he(e[r],t[r]))return!1;return!0}return!1}var ge=Object.prototype.hasOwnProperty;function F(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=I(e)&&I(t);if(!r&&!(ve(e)&&ve(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:ge.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=F(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function _e(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 I(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ve(e){if(!ye(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!(!ye(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function ye(e){return Object.prototype.toString.call(e)===`[object Object]`}function be(e){return new Promise(t=>{ae.setTimeout(t,e)})}function xe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:F(e,t)}function Se(e){return e}function Ce(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function we(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Te=Symbol();function Ee(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Te?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function De(e,t){return typeof e==`function`?e(...t):!!e}function Oe(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 ke=()=>se,Ae=()=>ke(),je=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(){}},Me=new class extends je{#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`}},Ne=oe;function Pe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ne,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 Fe=Pe(),Ie=new class extends je{#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 Le(e){return Math.min(1e3*2**e,3e4)}function Re(e){return(e??`online`)!==`online`||Ie.isOnline()}var ze=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Be(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(ce);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new ze(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Me.isFocused()&&(e.networkMode===`always`||Ie.isOnline())&&e.canRun(),p=()=>Re(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??(Ae()?0:3),a=e.retryDelay??Le,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),be(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 Ve=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),le(this.gcTime)&&(this.#e=ae.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ae()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(ae.clearTimeout(this.#e),this.#e=void 0)}};function He(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=>{Oe(e,()=>t.signal,()=>n=!0)},u=Ee(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?we:Ce;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?We:Ue,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:Ue(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 Ue(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 We(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ge(e,t){return t?Ue(e,t)!=null:!1}function Ke(e,t){return!t||!e.getPreviousPageParam?!1:We(e,t)!=null}var qe=class extends Ve{#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=Xe(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=Xe(this.options);e.data!==void 0&&(this.setState(Ye(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=xe(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(ce).catch(ce):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=>P(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Te||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>P(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:!ue(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=Ee(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`?He(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=Be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ze&&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 ze){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,...Je(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ye(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),Fe.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Je(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Re(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ye(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Xe(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 Ze=class extends je{#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),$e(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return et(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return et(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 P(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&&!_e(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&tt(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||P(this.options.enabled,this.#t)!==P(t.enabled,this.#t)||P(this.options.staleTime,this.#t)!==P(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||P(this.options.enabled,this.#t)!==P(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 _e(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(ce)),t}#h(e){return!Ae()&&P(this.options.enabled,this.#t)!==!1&&le(e)}#g(){this.#b();let e=P(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=ue(this.#r.dataUpdatedAt,e)+1;this.#u=ae.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return P(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=ae.setInterval(()=>{(this.options.refetchIntervalInBackground||Me.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(ae.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(ae.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&&$e(e,t),o=i&&tt(e,n,t,r);(a||o)&&(l={...l,...Je(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=xe(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=xe(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:nt(e,t),refetch:this.refetch,isEnabled:P(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),_e(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)})})();Fe.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 Qe(e,t){return P(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||P(t.retryOnMount,e)!==!1)}function $e(e,t){return Qe(e,t)||e.state.data!==void 0&&et(e,t,t.refetchOnMount)}function et(e,t,n){if(P(t.enabled,e)!==!1&&P(t.staleTime,e)!==`static`){let r=P(n,e);return r===`always`||r!==!1&&nt(e,t)}return!1}function tt(e,t,n,r){return(e!==t||P(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&nt(e,n)}function nt(e,t){return P(t.enabled,e)!==!1&&e.isStaleByTime(P(t.staleTime,e))}var rt=A.createContext(!1),it=()=>A.useContext(rt);rt.Provider;function at(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ot=A.createContext(at()),st=()=>A.useContext(ot),ct=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?De(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},lt=e=>{A.useEffect(()=>{e.clearReset()},[e])},L=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||De(n,[e.error,r])),ut=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))}},dt=(e,t)=>e?.suspense&&t.isPending,ft=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function pt(e,t,n){let r=it(),i=st(),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,ut(o),ct(o,i,s),lt(i);let[l]=A.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(A.useSyncExternalStore(A.useCallback(e=>{let t=d?l.subscribe(Fe.batchCalls(e)):ce;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),A.useEffect(()=>{l.setOptions(o)},[o,l]),dt(o,u))throw ft(o,l,i);if(L({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function mt(e,t){return pt(e,Ze,t)}var ht=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,gt=/^[\\/]{2}/;function _t(e,t){return t+e.replace(/\\/g,`/`)}var vt=`popstate`;function yt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function bt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return wt(``,{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:Tt(t)}return Dt(t,n,null,e)}function R(e,t){if(e===!1||e==null)throw Error(t)}function xt(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function St(){return Math.random().toString(36).substring(2,10)}function Ct(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 wt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Et(t):t,state:n,key:t&&t.key||r||St(),mask:i}}function Tt({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 Et(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 Dt(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=yt(e)?e:wt(h.location,e,t);n&&n(r,e),l=u()+1;let d=Ct(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=yt(e)?e:wt(h.location,e,t);n&&n(r,e),l=u();let i=Ct(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 Ot(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(vt,d),c=e,()=>{i.removeEventListener(vt,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 Ot(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),R(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Tt(t);return i=i.replace(/ $/,`%20`),!n&&gt.test(i)&&(i=r+i),new URL(i,r)}function kt(e,t,n=`/`){return At(e,t,n,!1)}function At(e,t,n,r,i){let a=Zt((typeof t==`string`?Et(t):t).pathname||`/`,n);if(a==null)return null;let o=i??jt(e),s=null,c=Xt(a);for(let e=0;s==null&&e<o.length;++e)s=Kt(o[e],c,r);return s}function jt(e){let t=Mt(e);return Pt(t),t}function Mt(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;R(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=on([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(R(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Mt(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:Wt(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Yt(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 Nt(e.path))a(e,t,!0,n)}),t}function Nt(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=Nt(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 Pt(e){e.sort((e,t)=>e.score===t.score?Gt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Ft=/^:[\w-]+$/,It=/^:[\w-]+/,Lt=3.5,Rt=3,zt=2,Bt=1,Vt=10,Ht=-2,Ut=e=>e===`*`;function Wt(e,t){let n=e.split(`/`),r=n.length;return n.some(Ut)&&(r+=Ht),t&&(r+=zt),n.filter(e=>!Ut(e)).reduce((e,t)=>e+(Ft.test(t)?Rt:It.test(t)?Lt:t===``?Bt:Vt),r)}function Gt(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 Kt(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?Jt(u,l,s.matcher,s.compiledParams):qt(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=qt({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:on([a,d.pathname]),pathnameBase:cn(on([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=on([a,d.pathnameBase]))}return o}function qt(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Yt(e.path,e.caseSensitive,e.end);return Jt(e,t,n,r)}function Jt(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=sn(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=sn(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 Yt(e,t=!1,n=!0){xt(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(/\/((?:[^/?()[\]*^\\]|\\.)+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Xt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return xt(!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 Zt(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 Qt(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Et(e):e,a;return n?(n=an(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?$t(n.substring(1),`/`):$t(n,t)):a=t,{pathname:a,search:ln(r),hash:un(i)}}function $t(e,t){let n=sn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function en(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 tn(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function nn(e){let t=tn(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function rn(e,t,n,r=!1){let i;typeof e==`string`?i=Et(e):(i={...e},R(!i.pathname||!i.pathname.includes(`?`),en(`?`,`pathname`,`search`,i)),R(!i.pathname||!i.pathname.includes(`#`),en(`#`,`pathname`,`hash`,i)),R(!i.search||!i.search.includes(`#`),en(`#`,`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=Qt(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var an=e=>e.replace(/[\\/]{2,}/g,`/`),on=e=>an(e.join(`/`));function sn(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 cn=e=>sn(e).replace(/^\/*/,`/`),ln=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,un=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,dn=class{status;statusText;data;error;internal;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 fn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function pn(e){return on(e.map(e=>e.route.path).filter(Boolean))||`/`}var mn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function hn(e,t){let n=e;if(typeof n!=`string`||!ht.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(mn)try{let e=new URL(window.location.href),r=gt.test(n)?new URL(_t(n,e.protocol)):new URL(n),a=Zt(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{xt(!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}}var gn=new URL(`http://localhost`);function _n(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),gn)}catch{return gn}}function vn(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function yn(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 bn(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&&!vn(i,n),s=!vn(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!yn(e,i)||!vn(i,a)))throw Error(`External navigation is not allowed`)}var xn=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(xn);var Sn=[`GET`,...xn];new Set(Sn);var Cn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function wn(e){try{return Cn.includes(new URL(e).protocol)}catch{return!1}}var Tn=A.createContext(null);Tn.displayName=`DataRouter`;var En=A.createContext(null);En.displayName=`DataRouterState`;var Dn=A.createContext(null);Dn.displayName=`DataRouterData`;var On=A.createContext(null);On.displayName=`DataRouterNavigation`;var kn=A.createContext(!1);function An(){return A.useContext(kn)}var jn=A.createContext({isTransitioning:!1});jn.displayName=`ViewTransition`;var Mn=A.createContext(null);Mn.displayName=`Fetchers`;var Nn=A.createContext(null);Nn.displayName=`Await`;var Pn=A.createContext(null);Pn.displayName=`Navigation`;var Fn=A.createContext(null);Fn.displayName=`Location`;var In=A.createContext({outlet:null,matches:[],isDataRoute:!1});In.displayName=`Route`;var Ln=A.createContext(!1);Ln.displayName=`IsDataRoute`;var Rn=A.createContext(void 0);Rn.displayName=`RouteId`;var zn=A.createContext(null);zn.displayName=`RouteError`;var Bn=`REACT_ROUTER_ERROR`,Vn=`REDIRECT`,Hn=`ROUTE_ERROR_RESPONSE`;function Un(e){if(e.startsWith(`${Bn}:${Vn}:{`))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 Wn(e){if(e.startsWith(`${Bn}:${Hn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new dn(t.status,t.statusText,t.data)}catch{}}function Gn(e,{relative:t}={}){R(Kn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=A.useContext(Pn),{hash:i,pathname:a,search:o}=Qn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:on([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Kn(){return A.useContext(Fn)!=null}function qn(){return R(Kn(),`useLocation() may be used only in the context of a <Router> component.`),A.useContext(Fn).location}var Jn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Yn(){return A.useContext(Ln)?mr():Xn()}function Xn(){R(Kn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=A.useContext(Tn),{basename:t,navigator:n}=A.useContext(Pn),{matches:r}=A.useContext(In),{pathname:i}=qn(),a=JSON.stringify(nn(r)),o=A.useRef(!1);return A.useLayoutEffect(()=>{o.current=!0}),A.useCallback((r,s={})=>{if(xt(o.current,Jn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=rn(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:on([t,c.pathname])),bn(typeof r==`string`?r:Tt(r),n.createHref(c),_n(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}A.createContext(null);function Zn(){let{matches:e}=A.useContext(In);return e[e.length-1]?.params??{}}function Qn(e,{relative:t}={}){let{matches:n}=A.useContext(In),{pathname:r}=qn(),i=JSON.stringify(nn(n));return A.useMemo(()=>rn(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function $n(e,t){return er(e,t)}function er(e,t,n){R(Kn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=A.useContext(Pn),{matches:i}=A.useContext(In),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=qn(),l;if(t){let e=typeof t==`string`?Et(t):t;R(s===`/`||e.pathname?.startsWith(s),`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 "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f;f=n?n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):n.router.match(n.state.location):kt(e,{pathname:d});let p=sr(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:on([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:on([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?A.createElement(Fn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function tr(){let e=pr(),t=fn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return A.createElement(A.Fragment,null,A.createElement(`h2`,null,`Unexpected Application Error!`),A.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?A.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var nr=A.createElement(tr,null),rr=class extends A.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=kn;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=Wn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:A.createElement(In.Provider,{value:this.props.routeContext},A.createElement(Ln.Provider,{value:this.props.routeContext.isDataRoute},A.createElement(Rn.Provider,{value:this.props.routeContext.matches[this.props.routeContext.matches.length-1]?.route.id},A.createElement(zn.Provider,{value:e,children:this.props.component}))));return this.context?A.createElement(ar,{error:e},t):t}},ir=new WeakMap;function ar({children:e,error:t}){let{basename:n,navigator:r}=A.useContext(Pn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Un(t.digest);if(e){let i=ir.get(t);if(i)throw i;let a=hn(e.location,n),o=a.absoluteURL||a.to;if(bn(e.location,o,_n(r),`allow-explicit`),wn(o))throw Error(`Invalid redirect location`);if(mn&&!ir.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 ir.set(t,n),n}}return A.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function or({routeContext:e,match:t,children:n}){let r=A.useContext(Tn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),A.createElement(In.Provider,{value:e},A.createElement(Ln.Provider,{value:e.isDataRoute},A.createElement(Rn.Provider,{value:t.route.id},n)))}function sr(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);R(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:pn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||nr,o&&(s<0&&c===0?(gr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?A.createElement(n.route.Component,null):n.route.element?n.route.element:e,A.createElement(or,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?A.createElement(rr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function cr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lr(e){let t=A.useContext(Tn);return R(t,cr(e)),t}function ur(e){let t=A.useContext(En);return R(t,cr(e)),t}function dr(e){let t=A.useContext(Dn);return R(t,cr(e)),t}function fr(e){let t=A.useContext(Rn);return R(t,`${e} can only be used on routes that contain a unique "id"`),t}function pr(){let e=A.useContext(zn),t=dr(`useRouteError`),n=fr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function mr(){let{router:e}=lr(`useNavigate`),t=fr(`useNavigate`),n=A.useRef(!1);return A.useLayoutEffect(()=>{n.current=!0}),A.useCallback(async(r,i={})=>{xt(n.current,Jn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var hr={};function gr(e,t,n){!t&&!hr[e]&&(hr[e]=!0,xt(!1,n))}function _r(e,t){if(e===!1||e==null)throw Error(t)}function vr(e,t,n){let r=typeof e==`string`?new URL(e,n??(typeof window>`u`?`server://singlefetch/`:window.location.origin)):new URL(e);return n&&r.origin!==n&&(r=new URL(r.pathname+r.search+r.hash,n)),r.pathname.endsWith(`/`)?r.pathname=`${r.pathname}_.${t}`:r.pathname=`${r.pathname}.${t}`,r}async function yr(e,t){if(e.id in t)return t[e.id];try{let n=await i(()=>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 br(e){return e!=null&&typeof e.page==`string`}function xr(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 Sr(e,t,n){return Dr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await yr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(xr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Cr(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 wr(e,t,{includeHydrateFallback:n}={}){return Tr(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 Tr(e){return[...new Set(e)]}function Er(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Dr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!br(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Er(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}var Or=A.createContext(void 0);Or.displayName=`FrameworkContext`;function kr(){let e=A.useContext(Or);return _r(e,`You must render this element inside a <HydratedRouter> element`),e}function Ar(e,t){let n=A.useContext(Or),[r,i]=A.useState(!1),[a,o]=A.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=A.useRef(null);A.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),A.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:jr(s,p),onBlur:jr(c,m),onMouseEnter:jr(l,p),onMouseLeave:jr(u,m),onTouchStart:jr(d,p)}]:[a,f,{}]:[!1,f,{}]}function jr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Mr({page:e,...t}){let n=An(),{nonce:r}=kr(),{router:i}=lr(`PrefetchPageLinks`),a=A.useMemo(()=>i.match(e),[i,i.routes,e]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?A.createElement(Pr,{page:e,matches:a,...t}):A.createElement(Fr,{page:e,matches:a,...t})):null}function Nr(e){let{manifest:t,routeModules:n}=kr(),[r,i]=A.useState([]);return A.useEffect(()=>{let r=!1;return Sr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Pr({page:e,matches:t,...n}){let r=qn(),{unstable_apiServerOrigin:i}=kr(),a=A.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=vr(e,`rsc`,i),a=!1,o=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?a=!0:o.push(e.route.id);return a&&o.length>0&&n.searchParams.set(`_routes`,o.join(`,`)),[i?n.toString():n.pathname+n.search]},[e,r,t,i]);return A.createElement(A.Fragment,null,a.map(e=>A.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Fr({page:e,matches:t,...n}){let r=qn(),{manifest:i,routeModules:a,unstable_apiServerOrigin:o}=kr(),{matches:s}=ur(`PrefetchPageLinks`),{loaderData:c}=dr(`PrefetchPageLinks`),l=A.useMemo(()=>Cr(e,t,s,i,r,`data`),[e,t,s,i,r]),u=A.useMemo(()=>Cr(e,t,s,i,r,`assets`),[e,t,s,i,r]),d=A.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!l.some(t=>t.route.id===e.route.id)&&e.route.id in c&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let u=vr(e,`data`,o);return s&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[o?u.toString():u.pathname+u.search]},[c,r,i,l,t,e,a,o]),f=A.useMemo(()=>wr(u,i),[u,i]),p=Nr(u);return A.createElement(A.Fragment,null,d.map(e=>A.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),f.map(e=>A.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),p.map(({key:e,link:t})=>A.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Ir(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}A.memo(Lr);function Lr({routes:e,manifest:t,state:n,isStatic:r,onError:i}){let a=A.useContext(Tn);R(a,`You must render this element inside a <DataRouterContext.Provider> element`);let o=A.useContext(Or)?.routeDiscoveryRuntime;return A.useEffect(()=>{n.initialized&&o?.markReady()},[n.initialized,o]),er(e,void 0,{router:a.router,manifest:t,state:n,isStatic:r,onError:i})}function Rr({to:e,replace:t,state:n,relative:r}){R(Kn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=A.useContext(Pn);xt(!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}=A.useContext(In),{pathname:s}=qn(),c=Yn(),l=rn(e,nn(o),s,r===`path`);bn(typeof e==`string`?e:Tt(e),a.createHref(l),_n(a),`reject`);let u=JSON.stringify(l);return A.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function zr(e){R(!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 Br({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){R(!Kn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=A.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Et(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=A.useMemo(()=>{let e=Zt(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return xt(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:A.createElement(Pn.Provider,{value:c},A.createElement(Fn.Provider,{children:t,value:h}))}function Vr({children:e,location:t}){return $n(Hr(e),t)}A.Component;function Hr(e,t=[]){let n=[];return A.Children.forEach(e,(e,r)=>{if(!A.isValidElement(e))return;let i=[...t,r];if(e.type===A.Fragment){n.push.apply(n,Hr(e.props.children,i));return}R(e.type===zr,`[${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>`);let a=e.props;R(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=Hr(a.children,i)),n.push(o)}),n}var Ur=`application/x-www-form-urlencoded`;function Wr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Gr(e){return Wr(e)&&e.tagName.toLowerCase()===`button`}function Kr(e){return Wr(e)&&e.tagName.toLowerCase()===`form`}function qr(e){return Wr(e)&&e.tagName.toLowerCase()===`input`}function Jr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Yr(e,t){return e.button===0&&(!t||t===`_self`)&&!Jr(e)}function Xr(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 Zr(e,t){let n=Xr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Qr=null;function $r(){if(Qr===null)try{new FormData(document.createElement(`form`),0),Qr=!1}catch{Qr=!0}return Qr}var ei=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ti(e){return e!=null&&!ei.has(e)?(xt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ur}"`),null):e}function ni(e,t){let n,r,i,a,o;if(Kr(e)){let o=e.getAttribute(`action`);r=o?Zt(o,t):null,n=e.getAttribute(`method`)||`get`,i=ti(e.getAttribute(`enctype`))||Ur,a=new FormData(e)}else if(Gr(e)||qr(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?Zt(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=ti(e.getAttribute(`formenctype`))||ti(o.getAttribute(`enctype`))||Ur,a=new FormData(o,e),!$r()){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(Wr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=Ur,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}var ri=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ri&&(window.__reactRouterVersion=`8`)}catch{}function ii({basename:e,children:t,useTransitions:n,window:r}){let i=A.useRef(null);i.current??=bt({window:r,v5Compat:!0});let a=i.current,[o,s]=A.useState({action:a.action,location:a.location}),c=A.useCallback(e=>{n===!1?s(e):A.startTransition(()=>s(e))},[n]);return A.useLayoutEffect(()=>a.listen(c),[a,c]),A.createElement(Br,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var ai=A.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:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=A.useContext(Pn),v=typeof l==`string`&&ht.test(l),y=hn(l,h);l=y.to;let b=Gn(l,{relative:r}),x=qn(),S=null;if(o){let e=rn(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:on([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Ar(n,p),ee=ci(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function E(t){e&&e(t),t.defaultPrevented||ee(t)}let te=!(y.isExternal||i),D=A.createElement(`a`,{...p,...T,href:(te?S:void 0)||y.absoluteURL||b,onClick:te?E:e,ref:Ir(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?A.createElement(A.Fragment,null,D,A.createElement(Mr,{page:b})):D});ai.displayName=`Link`;var oi=A.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=Qn(a,{relative:c.relative}),d=qn(),f=A.useContext(On),{navigator:p,basename:m}=A.useContext(Pn),h=f!=null&&mi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f?.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=Zt(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return A.createElement(ai,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});oi.displayName=`NavLink`;var si=A.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=A.useContext(Pn),g=fi(),_=pi(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&ht.test(s);return A.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?A.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});si.displayName=`Form`;function ci(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Yn(),d=qn(),f=Qn(e,{relative:o});return A.useCallback(p=>{if(Yr(p,t)){p.preventDefault();let t=n===void 0?Tt(d)===Tt(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?A.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function li(e){xt(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=A.useRef(Xr(e)),n=A.useRef(!1),r=qn(),i=A.useMemo(()=>Zr(r.search,n.current?null:t.current),[r.search]),a=Yn();return[i,A.useCallback((e,t)=>{let r=Xr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var ui=0,di=()=>`__${String(++ui)}__`;function fi(){let{router:e}=lr(`useSubmit`),{basename:t}=A.useContext(Pn),n=fr(`useSubmit`),r=e.fetch,i=e.navigate;return A.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=ni(e,t);a.navigate===!1?await r(a.fetcherKey||di(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,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 pi(e,{relative:t}={}){let{basename:n}=A.useContext(Pn),r=A.useContext(In);R(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Qn(e||`.`,{relative:t})},o=qn();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:on([n,a.pathname])),Tt(a)}function mi(e,{relative:t}={}){let n=A.useContext(jn);R(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=lr(`useViewTransitionState`),i=Qn(e,{relative:t});if(!n.isTransitioning)return!1;let a=Zt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Zt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return qt(i.pathname,o)!=null||qt(i.pathname,a)!=null}var hi=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function gi(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:hi(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var _i=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},vi=e=>{let t=_i(e);return t.charAt(0).toUpperCase()+t.slice(1)},yi=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),bi={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function xi(e){return e!=null}function Si(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??bi.width,a=e.size??e.height??bi.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?yi(...c):yi(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??bi[`stroke-width`])*Number(e.size??e.width??bi.width)/Number(t.size??t.width??bi.width):t.strokeWidth??bi[`stroke-width`];return[`svg`,{...Object.entries(bi).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&xi(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&xi(t.width)&&{[r(`width`)]:t.width},...`height`in t&&xi(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function Ci(e,t={}){return Si(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var wi=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ti=(0,A.createContext)({}),Ei=()=>(0,A.useContext)(Ti),Di=(0,A.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=Ei()??{},y=!!c||wi(d),[b,x,S=[]]=Ci(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:yi(v,s),hasA11yProp:y,attributes:d});return(0,A.createElement)(b,{ref:f,...x},[...S.map(([e,t])=>(0,A.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function z(e,t=[],n=[]){let r=typeof e==`string`?gi(e,t,n):e,i=(0,A.forwardRef)(({className:e,...t},n)=>(0,A.createElement)(Di,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=vi(r.name)),i}var Oi={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};Oi.node;var ki=z(Oi),Ai={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};Ai.node;var ji=z(Ai),Mi={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Mi.node;var Ni=z(Mi),Pi={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Pi.node;var Fi=z(Pi),Ii={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};Ii.node;var Li=z(Ii),Ri={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`}]]};Ri.node;var zi=z(Ri),Bi={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`}]]};Bi.node;var Vi=z(Bi),Hi={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};Hi.node;var Ui=z(Hi),Wi={name:`calendar-days`,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`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]};Wi.node;var Gi=z(Wi),Ki={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`}]]};Ki.node;var qi=z(Ki),Ji={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Ji.node;var B=z(Ji),Yi={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Yi.node;var Xi=z(Yi),Zi={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Zi.node;var Qi=z(Zi),$i={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};$i.node;var ea=z($i),ta={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};ta.node;var na=z(ta),ra={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};ra.node;var ia=z(ra),aa={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`}]]};aa.node;var oa=z(aa),sa={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`}]]};sa.node;var ca=z(sa),la={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};la.node;var ua=z(la),da={name:`ellipsis-vertical`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]],aliases:[`more-vertical`]};da.node;var fa=z(da),pa={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`}]]};pa.node;var ma=z(pa),ha={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};ha.node;var ga=z(ha),_a={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`]};_a.node;var va=z(_a),ya={name:`file-text`,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:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};ya.node;var ba=z(ya),xa={name:`file`,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`}]]};xa.node;var Sa=z(xa),Ca={name:`film`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]};Ca.node;var wa=z(Ca),Ta={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`}]]};Ta.node;var Ea=z(Ta),Da={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`}]]};Da.node;var Oa=z(Da),ka={name:`folder-input`,size:24,node:[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]};ka.node;var Aa=z(ka),ja={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`}]]};ja.node;var Ma=z(ja),Na={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`}]]};Na.node;var Pa=z(Na),Fa={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`}]]};Fa.node;var Ia=z(Fa),La={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};La.node;var Ra=z(La),za={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};za.node;var Ba=z(za),Va={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Va.node;var Ha=z(Va),Ua={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`}]]};Ua.node;var Wa=z(Ua),Ga={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`}]]};Ga.node;var Ka=z(Ga),qa={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`}]]};qa.node;var Ja=z(qa),Ya={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};Ya.node;var Xa=z(Ya),Za={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Za.node;var Qa=z(Za),$a={name:`mic`,size:24,node:[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]};$a.node;var eo=z($a),to={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};to.node;var no=z(to),ro={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`}]]};ro.node;var io=z(ro),ao={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};ao.node;var oo=z(ao),so={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`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`}]],aliases:[`edit-3`]};so.node;var co=z(so),lo={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`}]]};lo.node;var uo=z(lo),fo={name:`pencil`,size:24,node:[[`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`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};fo.node;var po=z(fo),mo={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};mo.node;var ho=z(mo),go={name:`printer`,size:24,node:[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]};go.node;var _o=z(go),vo={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};vo.node;var yo=z(vo),bo={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`}]]};bo.node;var xo=z(bo),So={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`}]]};So.node;var Co=z(So),wo={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};wo.node;var To=z(wo),Eo={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`}]]};Eo.node;var Do=z(Eo),Oo={name:`share`,size:24,node:[[`path`,{d:`M12 2v13`,key:`1km8f5`}],[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}]]};Oo.node;var ko=z(Oo),Ao={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`}]]};Ao.node;var jo=z(Ao),Mo={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};Mo.node;var No=z(Mo),Po={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};Po.node;var Fo=z(Po),Io={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`}]]};Io.node;var Lo=z(Io),Ro={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};Ro.node;var zo=z(Ro),Bo={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Bo.node;var Vo=z(Bo),Ho={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`]};Ho.node;var Uo=z(Ho),Wo={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`}]]};Wo.node;var Go=z(Wo),Ko={name:`video`,size:24,node:[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]};Ko.node;var qo=z(Ko),Jo={name:`wand-sparkles`,size:24,node:[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]],aliases:[`wand-2`]};Jo.node;var Yo=z(Jo),Xo={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Xo.node;var Zo=z(Xo);function V(...e){return e.filter(Boolean).join(` `)}var Qo={primary:`bg-primary text-primary-foreground hover:brightness-[1.06] active:brightness-95 shadow-[0_1px_0_oklch(0%_0_0/0.08)]`,secondary:`bg-card text-ink border border-border hover:bg-paper-2`,ghost:`text-ink-2 hover:text-ink hover:bg-accent`,quiet:`bg-paper-2 text-ink hover:bg-paper-3`,danger:`text-rose hover:bg-rose-tint`},H=(0,A.forwardRef)(function({variant:e=`primary`,size:t=`md`,busy:n,className:r,children:i,disabled:a,...o},s){return(0,j.jsxs)(`button`,{ref:s,type:`button`,"data-variant":e,disabled:a||n,className:V(`inline-flex select-none items-center justify-center gap-2 whitespace-nowrap rounded-full font-medium transition-[background,filter,color,transform] duration-150 active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50`,t===`sm`&&`h-8 px-3 text-[0.8125rem] coarse:h-11 coarse:px-4`,t===`md`&&`h-10 px-4 text-sm coarse:h-11`,t===`lg`&&`h-12 px-6 text-[0.9375rem]`,Qo[e],e===`primary`&&`wizard-button`,r),...o,children:[n?(0,j.jsx)(us,{className:`size-4`}):null,i]})});function U({label:e,className:t,children:n,...r}){return(0,j.jsx)(`button`,{type:`button`,"aria-label":e,title:e,className:V(`inline-flex size-9 shrink-0 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink disabled:opacity-40 coarse:size-11`,t),...r,children:n})}var $o=`wizard-field rounded-lg border border-input bg-card px-3.5 text-[0.9375rem] text-ink shadow-[inset_0_1px_0_oklch(0%_0_0/0.02)] outline-none transition placeholder:text-ink-4 focus:border-focus focus:ring-4 focus:ring-focus-glow disabled:opacity-60`;function es(e){return/(^|\s)w-/.test(e??``)?null:`w-full`}var ts=(0,A.forwardRef)(function({className:e,...t},n){return(0,j.jsx)(`input`,{ref:n,className:V($o,es(e),`h-11`,e),...t})});function ns(e){return(0,j.jsx)(`input`,{type:`color`,className:`swatch size-11 shrink-0 cursor-pointer rounded-lg border border-input bg-card p-1`,...e})}var rs=(0,A.forwardRef)(function({className:e,minRows:t=3,maxRows:n=14,onChange:r,...i},a){let o=(0,A.useRef)(null),s=()=>{let e=o.current;if(!e)return;let r=Number.parseFloat(getComputedStyle(e).lineHeight)||22;e.style.height=`auto`;let i=r*n+20;e.style.height=`${Math.min(Math.max(e.scrollHeight,r*t+20),i)}px`,e.style.overflowY=e.scrollHeight>i?`auto`:`hidden`};return(0,A.useLayoutEffect)(s),(0,j.jsx)(`textarea`,{ref:e=>{o.current=e,typeof a==`function`?a(e):a&&(a.current=e)},className:V($o,es(e),`resize-none py-2.5 leading-[1.5]`,e),onChange:e=>{s(),r?.(e)},...i})});function is({value:e,onChange:t,options:n,className:r,placeholder:i}){return(0,j.jsxs)(`div`,{className:V(`relative`,r),children:[(0,j.jsxs)(`select`,{value:e,onChange:e=>t(e.target.value),className:V($o,`h-11 w-full appearance-none pr-9`),children:[i===void 0?null:(0,j.jsx)(`option`,{value:``,children:i}),n.map(e=>(0,j.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))]}),(0,j.jsx)(`svg`,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 right-3 size-4 text-ink-3`,viewBox:`0 0 16 16`,fill:`none`,children:(0,j.jsx)(`path`,{d:`M4 6l4 4 4-4`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})})]})}function as({value:e,onChange:t,options:n,multi:r,disabled:i,label:a}){let o=new Set(Array.isArray(e)?e:e?[e]:[]);return(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.map(e=>{let s=o.has(e);return(0,j.jsx)(`button`,{type:`button`,"aria-pressed":s,disabled:i?.includes(e),onClick:()=>{if(r){let r=new Set(o);s?r.delete(e):r.add(e),t(n.filter(e=>r.has(e)))}else t(e)},className:V(`h-10 rounded-full border px-4 text-sm transition disabled:pointer-events-none disabled:opacity-60 disabled:line-through coarse:h-11`,s?`border-ember bg-ember-tint text-ink`:`border-input bg-card text-ink-2 hover:border-ink-4 hover:text-ink`),children:a?a(e):e},e)})})}var os=`cubic-bezier(0.3, 0.7, 0.2, 1)`;function ss({value:e,onChange:t,options:n,label:r}){let i=(0,A.useRef)(new Map),[a,o]=(0,A.useState)(null);return(0,A.useLayoutEffect)(()=>{let t=i.current.get(e);if(!t)return;let n=()=>o({x:t.offsetLeft,w:t.offsetWidth});n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[e]),(0,j.jsxs)(`div`,{role:`tablist`,"aria-label":r,className:`relative inline-flex items-center rounded-full bg-paper-2 p-0.5 ring-1 ring-border-soft`,children:[a?(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-0.5 bottom-0.5 left-0 rounded-full bg-card shadow-sm motion-reduce:transition-none`,style:{width:a.w,transform:`translateX(${a.x}px)`,transition:`transform 300ms ${os}, width 300ms ${os}`}}):null,n.map(n=>{let r=n.id===e;return(0,j.jsx)(`button`,{ref:e=>{e?i.current.set(n.id,e):i.current.delete(n.id)},type:`button`,role:`tab`,"aria-selected":r,onClick:()=>t(n.id),className:V(`relative h-8 whitespace-nowrap rounded-full px-4 font-medium text-[0.875rem] transition-colors motion-reduce:transition-none coarse:h-9`,r?`text-ink`:`text-ink-3 hover:text-ink-2`),children:n.label},n.id)})]})}function cs({checked:e,onChange:t,label:n,disabled:r}){return(0,j.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,disabled:r,onClick:()=>t(!e),className:V(`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition before:absolute before:-inset-x-1 before:-inset-y-2.5 before:content-[''] disabled:pointer-events-none disabled:opacity-60`,e?`bg-primary`:`bg-paper-3`),children:(0,j.jsx)(`span`,{className:V(`inline-block size-5 rounded-full bg-white shadow-sm transition-transform`,e?`translate-x-[22px]`:`translate-x-[2px]`)})})}function ls({children:e,hint:t,required:n}){return(0,j.jsxs)(`div`,{className:`mb-2`,children:[(0,j.jsxs)(`div`,{className:`font-medium text-[0.875rem] text-ink`,children:[e,n?(0,j.jsx)(`span`,{className:`ml-1 text-ember`,children:`*`}):null]}),t?(0,j.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:t}):null]})}function us({className:e}){return(0,j.jsxs)(`svg`,{className:V(`size-5 animate-spin`,e),viewBox:`0 0 24 24`,fill:`none`,children:[(0,j.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:`currentColor`,strokeOpacity:`0.2`,strokeWidth:`3`}),(0,j.jsx)(`path`,{d:`M21 12a9 9 0 0 0-9-9`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`})]})}function ds({className:e,children:t,...n}){return(0,j.jsx)(`div`,{className:V(`wizard-card rounded-xl bg-card shadow-soft ring-1 ring-border-soft`,e),...n,children:t})}function fs({children:e,tone:t=`neutral`,icon:n,title:r}){return(0,j.jsxs)(`span`,{title:r,className:V(`inline-flex h-6 items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 font-medium text-[0.75rem]`,t===`neutral`&&`bg-paper-2 text-ink-2`,t===`live`&&`bg-moss-tint text-moss`,t===`warn`&&`bg-amber-tint text-ink-2`,t===`ember`&&`bg-ember-tint text-ember-strong`),children:[n??(t===`live`?(0,j.jsx)(`span`,{className:`size-1.5 rounded-full bg-moss`}):null),e]})}function ps({open:e,onClose:t,title:n,children:r,wide:i,bare:a,height:o=`auto`}){let s=(0,A.useRef)(null);return(0,A.useEffect)(()=>{let t=s.current;t&&(e&&!t.open?(t.showModal(),t.querySelector(`[data-autofocus]`)?.focus()):!e&&t.open&&t.close())},[e]),(0,A.useEffect)(()=>{let t=s.current;if(!t||!e||a||o===`tall`)return;let n=0,r=()=>{n=Math.max(n,t.getBoundingClientRect().height),t.style.minHeight=`${Math.min(n,window.innerHeight-32)}px`},i=new ResizeObserver(r);return i.observe(t),window.addEventListener(`resize`,r),()=>{i.disconnect(),window.removeEventListener(`resize`,r),t.style.minHeight=``}},[e,a,o]),(0,j.jsx)(`dialog`,{ref:s,onClose:t,onClick:e=>{e.target===s.current&&t()},className:V(`m-auto p-0 text-ink backdrop:bg-[oklch(20%_0.01_60/0.28)] backdrop:backdrop-blur-[2px]`,`max-sm:m-0 max-sm:h-dvh max-sm:max-h-none max-sm:w-full max-sm:max-w-none`,a?`w-[calc(100%-48px)] overflow-visible bg-transparent`:`max-h-[calc(100dvh-32px)] w-[calc(100%-32px)] overflow-y-auto overscroll-contain rounded-2xl bg-card shadow-overlay max-sm:rounded-none max-sm:pt-[env(safe-area-inset-top)] max-sm:pb-[env(safe-area-inset-bottom)]`,i===`full`?`sm:max-w-7xl`:i===`page`?`sm:max-w-4xl`:i?`sm:max-w-2xl`:`sm:max-w-md`,!a&&o===`tall`&&`sm:h-[min(calc(100dvh-32px),56rem)]`),children:e&&a?r:e?(0,j.jsxs)(`div`,{className:`p-5 sm:p-7`,children:[n?(0,j.jsxs)(`div`,{className:`mb-5 flex items-start justify-between gap-3`,children:[(0,j.jsx)(`h2`,{className:`min-w-0 font-display font-semibold text-xl`,children:n}),(0,j.jsx)(U,{label:_(`common.close`),onClick:t,className:`-mt-1.5 -mr-2`,children:(0,j.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,className:`size-4`,"aria-hidden":`true`,children:(0,j.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})})})]}):null,r]}):null})}function ms({children:e}){return(0,j.jsx)(`div`,{className:`py-16 text-center text-ink-3`,children:e})}function hs({text:e}){return e.split(/(https?:\/\/[^\s)]+)/).map((e,t)=>t%2?(0,j.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`font-medium text-ink underline underline-offset-2`,children:new URL(e).host},e):e)}var gs=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(gs||{}),_s=[0,1],vs=[1,0],ys=[2,3],bs=[3,2],xs={L:_s,M:vs,Q:ys,H:bs},Ss=/^\d*$/,Cs=/^[A-Z0-9 $%*+./:-]*$/,ws=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,Ts=1,Es=40,Ds=3,Os=3,ks=40,As=10,js=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],Ms=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],Ns=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<Ts||e>Es)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,gs.Timing),this.setFunctionModule(e,6,e%2==0,gs.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,Fs(r,e));this.setFunctionModule(8,7,Fs(r,6)),this.setFunctionModule(8,8,Fs(r,7)),this.setFunctionModule(7,8,Fs(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,Fs(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,Fs(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,Fs(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=Fs(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,gs.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,gs.Alignment)}setFunctionModule(e,t,n,r=gs.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==Xs(t,n))throw RangeError(`Invalid argument`);let r=Ms[n[0]][t],i=js[n[0]][t],a=Math.floor(Ys(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=Zs(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=Qs(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(Ys(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=Fs(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=Ds:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*ks),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*ks}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=Ds:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*ks),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*ks}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=Os)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*As,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function Ps(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function Fs(e,t){return!!(e>>>t&1)}var Is=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},Ls=[1,10,12,14],Rs=[2,9,11,13],zs=[4,8,16,16];function Bs(e,t){return e[Math.floor((t+7)/17)+1]}function Vs(e){let t=[];for(let n of e)Ps(n,8,t);return new Is(zs,e.length,t)}function Hs(e){if(!Gs(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);Ps(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new Is(Ls,e.length,t)}function Us(e){if(!Ks(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=ws.indexOf(e.charAt(n))*45;r+=ws.indexOf(e.charAt(n+1)),Ps(r,11,t)}return n<e.length&&Ps(ws.indexOf(e.charAt(n)),6,t),new Is(Rs,e.length,t)}function Ws(e){return e===``?[]:Gs(e)?[Hs(e)]:Ks(e)?[Us(e)]:[Vs(Js(e))]}function Gs(e){return Ss.test(e)}function Ks(e){return Cs.test(e)}function qs(e,t){let n=0;for(let r of e){let e=Bs(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function Js(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function Ys(e){if(e<Ts||e>Es)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function Xs(e,t){return Math.floor(Ys(e)/8)-js[t[0]][e]*Ms[t[0]][e]}function Zs(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=$s(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=$s(n,2)}return t}function Qs(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=$s(t,e))}return n}function $s(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function ec(e,t,n=1,r=40,i=-1,a=!0){if(!(Ts<=n&&n<=r&&r<=Es)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=Xs(o,t)*8,i=qs(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[vs,ys,bs])a&&s<=Xs(o,e)*8&&(t=e);let c=[];for(let t of e){Ps(t.mode[0],4,c),Ps(t.numChars,Bs(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=Xs(o,t)*8;Ps(0,Math.min(4,l-c.length),c),Ps(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)Ps(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new Ns(o,t,u,i)}function tc(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?Ws(e):Array.isArray(e)?[Vs(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=ec(c,xs[n],i,a,o,r),u=nc({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function nc(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=gs.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function rc(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function ic(e,t={}){let n=tc(e,t),{pixelSize:r=10,whiteColor:i=`white`,blackColor:a=`black`}=t,o=n.size*r,s=n.size*r,c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${o}">`,l=[];for(let e=0;e<n.size;e++)for(let t=0;t<n.size;t++){let i=t*r,a=e*r;n.data[e][t]&&l.push(`M${i},${a}h${r}v${r}h-${r}z`)}return c+=`<rect fill="${rc(i)}" width="${s}" height="${o}"/>`,c+=`<path fill="${rc(a)}" d="${l.join(``)}"/>`,c+=`</svg>`,c}var ac=e=>`${e.slice(0,4)} ${e.slice(4)}`,oc=e=>ic(e,{ecc:`M`,border:2,pixelSize:8}),sc=e=>`${(e.trim()||`wizard`).replace(/[^\p{L}\p{N}]+/gu,`-`).toLowerCase()}-qr`;function cc(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}async function lc(e,t){let n=new Image,r=URL.createObjectURL(new Blob([e],{type:`image/svg+xml`}));try{n.src=r,await n.decode();let e=document.createElement(`canvas`);e.width=1024,e.height=1024;let i=e.getContext(`2d`);if(!i)return;i.imageSmoothingEnabled=!1,i.drawImage(n,0,0,1024,1024);let a=await new Promise(t=>e.toBlob(t,`image/png`));a&&cc(a,`${sc(t)}.png`)}finally{URL.revokeObjectURL(r)}}function uc(e,t){let n=window.open(``,`_blank`,`width=520,height=680`);if(!n)return;let r=n.document;r.title=t;let i=r.createElement(`style`);i.textContent=`body{margin:0;min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;font:600 28px system-ui,sans-serif}svg{width:12cm;height:12cm}`,r.head.append(i);let a=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement,o=r.createElement(`div`);o.textContent=t,r.body.append(r.importNode(a,!0),o),n.addEventListener(`afterprint`,()=>n.close()),n.focus(),n.print()}function dc({svg:e,label:t,className:n}){return(0,j.jsx)(`div`,{role:`img`,"aria-label":t,className:V(`overflow-hidden rounded-xl bg-white [&>svg]:size-full`,n),dangerouslySetInnerHTML:{__html:e}})}function fc({text:e,label:t,className:n}){let r=(0,A.useMemo)(()=>oc(e),[e]);return(0,j.jsx)(dc,{svg:r,label:t,className:V(`size-40 p-1`,n)})}var pc=class extends Error{status;body;constructor(e,t,n){super(e),this.status=t,this.body=n}};function mc(e){return e instanceof pc&&e.status===0}function hc(e){try{return JSON.parse(e)}catch{return{error:e}}}function gc(e,t={},n){async function r(r,i,a){let o=await fetch(e(i),{method:r,credentials:`include`,headers:{"accept-language":h,...t,...a!==void 0&&!(a instanceof FormData)?{"content-type":`application/json`}:{}},body:a===void 0?void 0:a instanceof FormData?a:JSON.stringify(a)}).catch(()=>{throw new pc(_(`common.offline`),0,null)}),s=await o.text(),c=s?hc(s):null;if(!o.ok)throw o.status>=500&&n?.(`${r} ${i} answered ${o.status}: ${c?.error??``}`),new pc(c?.error??c?.message??o.statusText,o.status,c);return c}return{get:e=>r(`GET`,e),post:(e,t)=>r(`POST`,e,t??{}),put:(e,t)=>r(`PUT`,e,t),patch:(e,t)=>r(`PATCH`,e,t),del:e=>r(`DELETE`,e),upload:(e,t)=>{let n=new FormData;return n.set(`file`,t),r(`POST`,e,n)}}}var _c={can:()=>!1,call:e=>Promise.reject(Error(`the app cannot ${e}`)),tell:()=>void 0,download:()=>!1},vc=null;function yc(e){vc=e,W=gc(e.withBase,e.headers,e.onServerError),y(e.lang)}function bc(){if(!vc)throw Error(`configureRunner() first`);return vc}var W=gc(e=>e),xc=e=>bc().withBase(e),Sc=e=>bc().asset(e),G=e=>bc().runBase(e),Cc=e=>(vc?.app??_c).can(e),wc=(e,t)=>(vc?.app??_c).call(e,t),Tc=(e,t)=>(vc?.app??_c).tell(e,t),Ec=(e,t,n)=>(vc?.app??_c).download(e,t,n),Dc=()=>vc?.standalone===!0,Oc=250;function kc({runId:e,driving:t,caption:n,action:r,hint:i,className:a,onBroken:o}){let s=(0,A.useRef)(null),c=(0,A.useRef)(null),[l,u]=(0,A.useState)(``),[d,f]=(0,A.useState)(!1),[p,m]=(0,A.useState)(null),h=async t=>{m(null);try{await W.post(`${G(e)}/browser/act`,t)}catch(e){m(e.message)}};return(0,A.useEffect)(()=>{t&&c.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[t]),(0,A.useEffect)(()=>{let n=s.current;if(!(n&&t))return;let r=0,i=null,a=t=>{t.preventDefault(),r+=t.deltaY,i??=setTimeout(()=>{i=null;let t=Math.max(-2e3,Math.min(2e3,Math.round(r)));r=0,t&&W.post(`${G(e)}/browser/act`,{type:`scroll`,dy:t}).catch(()=>void 0)},Oc)};return n.addEventListener(`wheel`,a,{passive:!1}),()=>{n.removeEventListener(`wheel`,a),i&&clearTimeout(i)}},[t,e]),(0,j.jsxs)(`div`,{className:a,children:[(0,j.jsxs)(`div`,{className:V(`relative aspect-[1280/900] w-full overflow-hidden rounded-xl bg-paper-2 ring-1`,t?`ring-2 ring-ember`:`ring-border-soft`),children:[(0,j.jsx)(`img`,{ref:s,src:xc(`${G(e)}/browser/live`),alt:``,draggable:!1,onClick:e=>{if(!t)return;let n=e.currentTarget.getBoundingClientRect();h({type:`click`,fx:Math.min(1,Math.max(0,(e.clientX-n.left)/n.width)),fy:Math.min(1,Math.max(0,(e.clientY-n.top)/n.height))})},onError:o,className:V(`size-full object-cover object-top`,t&&`cursor-pointer`)}),r?(0,j.jsx)(`div`,{className:`absolute top-2 right-2`,children:r}):null,n&&!t?(0,j.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 flex items-center gap-1.5 bg-gradient-to-t from-black/75 to-transparent px-3 pt-8 pb-2 text-[0.8125rem] text-white`,children:[(0,j.jsx)(no,{className:`size-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,children:n})]}):null]}),t?(0,j.jsxs)(`div`,{ref:c,className:`mt-1.5`,children:[i?(0,j.jsx)(`p`,{className:`mb-1.5 text-[0.8125rem] text-ink-3`,children:i}):null,(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 rounded-xl bg-card p-2 ring-1 ring-border-soft`,children:[(0,j.jsx)(ts,{type:d?`password`:`text`,autoComplete:`off`,value:l,placeholder:_(`ask.typeInto`),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),h({type:`type`,text:l}).then(()=>u(``)))},autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`send`,className:`h-9 min-w-[9rem] flex-1 basis-full text-[0.8125rem] sm:basis-0 coarse:h-11`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>f(e=>!e),className:V(`h-9 shrink-0 rounded-md px-2.5 text-[0.75rem] coarse:h-11 coarse:px-3.5`,d?`bg-ember-veil text-ink`:`text-ink-3 hover:bg-paper-2`),children:_(`ask.hide`)}),(0,j.jsx)(Ac,{label:`Enter`,onClick:()=>void h({type:`key`,key:`Enter`}),children:(0,j.jsx)(oa,{className:`size-4`})}),(0,j.jsx)(Ac,{label:_(`ask.up`),onClick:()=>void h({type:`scroll`,dy:-500}),children:(0,j.jsx)(Fi,{className:`size-4`})}),(0,j.jsx)(Ac,{label:_(`ask.down`),onClick:()=>void h({type:`scroll`,dy:500}),children:(0,j.jsx)(ki,{className:`size-4`})})]}),p?(0,j.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-rose`,children:p}):null]}):null]})}function Ac({label:e,onClick:t,children:n}){return(0,j.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})}function jc({runId:e,ask:t}){return t.kind===`confirm`?(0,j.jsx)(Mc,{runId:e,ask:t}):(0,j.jsx)(Nc,{runId:e,ask:t})}function Mc({runId:e,ask:t}){let[n,r]=(0,A.useState)(!1),[i,a]=(0,A.useState)(!1),[o,s]=(0,A.useState)(null),c=async n=>{a(!0),s(null);try{await W.post(`${G(e)}/ask/${t.id}`,n)}catch(e){s(e.message),a(!1)}},l=t.action.destructive?Uo:uo;return(0,j.jsxs)(`div`,{className:`animate-rise`,children:[(0,j.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,j.jsx)(`div`,{className:V(`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,j.jsx)(l,{className:`size-5`})}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:_(`ask.wants`,{service:t.service})}),(0,j.jsx)(`h2`,{className:`wizard-heading font-display font-semibold text-[1.25rem] leading-snug tracking-tight`,children:t.reason})]})]}),(0,j.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-paper-2 p-4 text-[0.8125rem] leading-relaxed ring-1 ring-border-soft`,children:t.input}),t.once?null:(0,j.jsxs)(`div`,{className:`mt-5 flex items-center gap-4`,children:[(0,j.jsx)(cs,{checked:n,onChange:r,label:_(`ask.allowRest`)}),(0,j.jsx)(`span`,{className:`flex-1 text-[0.8125rem] text-ink-2`,children:_(`ask.allowRest`)})]}),o?(0,j.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:o}):null,(0,j.jsxs)(`div`,{className:`action-bar mt-6 flex items-center justify-between gap-3`,children:[(0,j.jsx)(H,{variant:`ghost`,disabled:i,onClick:()=>void c({type:`skip`}),children:_(`ask.deny`)}),(0,j.jsx)(H,{busy:i,onClick:()=>void c({type:`done`,remember:n}),children:_(`ask.allow`)})]})]})}function Nc({runId:e,ask:t}){let[n,r]=(0,A.useState)({}),[i,a]=(0,A.useState)(!1),[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(null),u=async n=>{s(!0),l(null);try{await W.post(`${G(e)}/ask/${t.id}`,n)}catch(e){l(e.message),s(!1)}},d=t.fields.some(e=>n[e.id]);return(0,j.jsxs)(`div`,{className:`animate-rise`,children:[(0,j.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,j.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-ember-tint text-ember-strong`,children:(0,j.jsx)(Ka,{className:`size-5`})}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`h2`,{className:`wizard-heading font-display font-semibold text-[1.25rem] leading-snug tracking-tight`,children:t.reason}),(0,j.jsxs)(`p`,{className:`mt-0.5 truncate text-[0.8125rem] text-ink-3`,children:[t.site.host,t.site.title?` · ${t.site.title}`:``]})]})]}),(0,j.jsx)(kc,{runId:e,driving:!0}),(0,j.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-4`,children:_(`ask.pictureHint`)}),t.fields.length?(0,j.jsxs)(`form`,{className:`mt-5 flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),u({type:`fill`,values:n,remember:i})},children:[t.fields.map((e,i)=>(0,j.jsxs)(`div`,{children:[(0,j.jsx)(ls,{children:e.label}),(0,j.jsx)(ts,{autoFocus:i===0,type:e.secret?`password`:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:i===t.fields.length-1?`go`:`next`,value:n[e.id]??``,onChange:t=>r(n=>({...n,[e.id]:t.target.value}))})]},e.id)),(0,j.jsx)(`button`,{type:`submit`,hidden:!0})]}):null,(0,j.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-4`,children:[(0,j.jsx)(cs,{checked:i,onChange:a,label:_(`ask.remember`)}),(0,j.jsx)(`span`,{className:`flex-1 text-[0.8125rem] text-ink-2`,children:_(`ask.remember`)})]}),(0,j.jsxs)(`p`,{className:`mt-3 flex items-start gap-2 text-[0.8125rem] text-ink-3`,children:[(0,j.jsx)(jo,{className:`mt-0.5 size-4 shrink-0 text-moss`}),` `,_(`ask.private`)]}),c?(0,j.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:c}):null,(0,j.jsxs)(`div`,{className:`action-bar mt-6 flex flex-wrap items-center justify-between gap-3`,children:[(0,j.jsx)(H,{variant:`ghost`,disabled:o,onClick:()=>void u({type:`skip`}),children:_(`ask.skip`)}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.fields.length?(0,j.jsx)(H,{variant:`secondary`,disabled:o,onClick:()=>void u({type:`done`,remember:i}),children:_(`ask.done`)}):null,t.fields.length?(0,j.jsx)(H,{busy:o,disabled:!d,onClick:()=>void u({type:`fill`,values:n,remember:i}),children:_(`ask.signIn`)}):(0,j.jsx)(H,{busy:o,onClick:()=>void u({type:`done`,remember:i}),children:_(`ask.done`)})]})]})]})}var Pc=typeof window<`u`&&window.matchMedia?.(`(pointer: coarse)`).matches===!0,Fc=typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia;function Ic(){(0,A.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=()=>{let e=document.activeElement;t.classList.contains(`keyboard-open`)&&e instanceof HTMLElement&&e!==document.body&&requestAnimationFrame(()=>e.scrollIntoView({block:`nearest`}))},r=()=>{let r=e.scale>1.01?0:window.innerHeight-e.height-e.offsetTop,i=r>80,a=i&&!t.classList.contains(`keyboard-open`);t.style.setProperty(`--kb`,i?`${Math.round(r)}px`:`0px`),t.classList.toggle(`keyboard-open`,i),a&&n()};return r(),e.addEventListener(`resize`,r),e.addEventListener(`scroll`,r),document.addEventListener(`focusin`,n),()=>{e.removeEventListener(`resize`,r),e.removeEventListener(`scroll`,r),document.removeEventListener(`focusin`,n),t.style.removeProperty(`--kb`),t.classList.remove(`keyboard-open`)}},[])}function Lc(e){let[t,n]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{if(e&&Cc(`keepAwake`))return Tc(`keepAwake`,!0),n(!0),()=>{Tc(`keepAwake`,!1),n(!1)};if(!e||!(`wakeLock`in navigator))return;let t=null,r=!1,i=async()=>{if(!(r||t||document.visibilityState!==`visible`))try{let e=await navigator.wakeLock.request(`screen`);if(r){e.release().catch(()=>void 0);return}t=e,n(!0),e.addEventListener(`release`,()=>{t===e&&(t=null,n(!1))})}catch{}};return i(),document.addEventListener(`visibilitychange`,i),()=>{r=!0,document.removeEventListener(`visibilitychange`,i),t?.release().catch(()=>void 0),t=null,n(!1)}},[e]),t}var Rc=`wz.notify`,zc=new Set,Bc=null;function Vc(){try{return localStorage.getItem(Rc)===`1`}catch{return!1}}function Hc(e){try{e?localStorage.setItem(Rc,`1`):localStorage.removeItem(Rc)}catch{}for(let e of zc)e()}var Uc=typeof window<`u`&&`Notification`in window,Wc=null;function Gc(){return Vc()?Cc(`notify`)?Wc===!1?`quiet`:`on`:Uc&&Notification.permission===`granted`?`on`:`quiet`:`off`}function Kc(){return(0,A.useSyncExternalStore)(e=>(zc.add(e),()=>zc.delete(e)),Gc,()=>`off`)}function qc(){return Cc(`notify`)?Wc===!1:Uc&&Notification.permission===`denied`}async function Jc(){if(Hc(!0),Cc(`notify`)){Wc=!Cc(`notifyPermission`)||await wc(`notifyPermission`).catch(()=>!1);for(let e of zc)e();return Gc()}try{Bc??=new AudioContext,Bc.resume()}catch{Bc=null}if(Uc&&Notification.permission==="default")try{await Notification.requestPermission()}catch{}if(Uc&&Notification.permission===`granted`){let e=bc().serviceWorker;e&&await navigator.serviceWorker?.register(e).catch(()=>void 0)}for(let e of zc)e();return Gc()}function Yc(){Hc(!1)}function Xc(){let e=Bc;if(e?.state!==`running`)return;let t=e.currentTime;for(let[n,r]of[660,880].entries()){let i=e.createOscillator(),a=e.createGain();i.frequency.value=r,a.gain.setValueAtTime(0,t+n*.16),a.gain.linearRampToValueAtTime(.18,t+n*.16+.02),a.gain.exponentialRampToValueAtTime(.001,t+n*.16+.32),i.connect(a).connect(e.destination),i.start(t+n*.16),i.stop(t+n*.16+.34)}}async function Zc(e){if(!Vc())return;if(Cc(`notify`)){Tc(`notify`,e);return}if(document.visibilityState===`visible`){Xc(),navigator.vibrate?.([120,60,120]);return}if(!Uc||Notification.permission!==`granted`)return;let t={body:e.body,tag:e.tag,icon:Sc(`icons/icon-192.png`),badge:Sc(`icons/icon-192.png`),data:{url:location.href}};try{let n=await navigator.serviceWorker?.getRegistration();if(n?.active){await n.showNotification(e.title,t);return}}catch{}try{new Notification(e.title,t)}catch{}}function Qc(){if(typeof navigator>`u`||!navigator.canShare)return!1;try{return navigator.canShare({files:[new File([`x`],`x.pdf`,{type:`application/pdf`})]})}catch{return!1}}async function $c(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 el(){return new Date().toISOString().slice(0,19).replace(/[:T]/g,`-`)}function tl(e){let t=e?.name;return t===`NotFoundError`||t===`OverconstrainedError`?`missing`:t===`NotReadableError`||t===`AbortError`?`busy`:`denied`}function nl(e){return!!e?.getCapabilities?.()?.torch}function rl(e,t,n=!1){let r=(0,A.useRef)(null),[i,a]=(0,A.useState)(null),[o,s]=(0,A.useState)(null),[c,l]=(0,A.useState)(1),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(!1);return(0,A.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(nl(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(tl(e))),()=>{i=!0;for(let e of r?.getTracks()??[])e.stop()}},[e,t,n]),(0,A.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 il({open:e,onClose:t,label:n,children:r}){let i=(0,A.useRef)(null);return(0,A.useEffect)(()=>{let t=i.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),(0,j.jsx)(`dialog`,{ref:i,onClose:t,"aria-label":n,className:`media-sheet`,children:e?(0,j.jsx)(`div`,{className:`flex h-full flex-col`,children:r}):null})}function al({label:e,onClick:t,active:n,children:r}){return(0,j.jsx)(`button`,{type:`button`,"aria-label":e,title:e,"aria-pressed":n,onClick:t,className:V(`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 ol({title:e,onClose:t,camera:n,onFlip:r}){return(0,j.jsx)(`div`,{className:`safe-top`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,j.jsx)(al,{label:_(`common.close`),onClick:t,children:(0,j.jsx)(Zo,{className:`size-5`})}),(0,j.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-center font-medium text-[0.9375rem]`,children:e}),n.torchable?(0,j.jsx)(al,{label:_(`camera.torch`),active:n.torch,onClick:()=>void n.setTorch(!n.torch),children:n.torch?(0,j.jsx)(Oa,{className:`size-5`}):(0,j.jsx)(Ea,{className:`size-5`})}):null,n.stream&&(n.cameras>1||Pc)?(0,j.jsx)(al,{label:_(`camera.flip`),onClick:r,children:(0,j.jsx)(Lo,{className:`size-5`})}):(0,j.jsx)(`span`,{className:`size-11`})]})})}function sl({camera:e,asking:t,children:n,actions:r}){return(0,j.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[(0,j.jsx)(`video`,{ref:e.video,autoPlay:!0,playsInline:!0,muted:!0,className:V(`absolute inset-0 size-full object-contain`,e.mirrored&&`-scale-x-100`)}),e.error?(0,j.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-5 bg-black px-8 text-center`,children:[(0,j.jsx)(`p`,{className:`max-w-sm text-[0.9375rem] text-white/85 leading-relaxed`,children:_(`camera.${e.error}`)}),r]}):e.stream?n:(0,j.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-4 px-8 text-center text-white/75`,children:[(0,j.jsx)(us,{}),(0,j.jsx)(`p`,{className:`max-w-xs text-[0.875rem] leading-relaxed`,children:t})]})]})}var cl=30;function ll(){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 ul=!!ll();function dl({open:e,multiple:t,video:n,onClose:r,onCapture:i,onNative:a}){let[o,s]=(0,A.useState)(`environment`),[c,l]=(0,A.useState)(`photo`),[u,d]=(0,A.useState)(0),[f,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(null),g=(0,A.useRef)(null),v=rl(e,o,c===`video`);(0,A.useEffect)(()=>{e&&(d(0),l(`photo`),h(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-${el()}.jpg`,{type:`image/jpeg`}))},x=()=>{g.current?.state===`recording`&&g.current.stop()},S=()=>{let e=ll();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=()=>{h(null),g.current=null;let n=e.split(`;`)[0];if(t.length){let e=n===`video/mp4`?`mp4`:`webm`;y(new File(t,`video-${el()}.${e}`,{type:n}))}},g.current=n,n.start(1e3),h(0)};(0,A.useEffect)(()=>{if(m===null)return;if(m>=cl){g.current?.state===`recording`&&g.current.stop();return}let e=setTimeout(()=>h(e=>e===null?null:e+1),1e3);return()=>clearTimeout(e)},[m]),(0,A.useEffect)(()=>{!e&&g.current&&(g.current.onstop=null,g.current.stop(),g.current=null)},[e]);let C=e=>`0:${String(e).padStart(2,`0`)}`;return(0,j.jsxs)(il,{open:e,onClose:r,label:_(`camera.title`),children:[(0,j.jsx)(ol,{title:m===null?u?_(`camera.taken`,{n:u}):_(`camera.title`):`${C(m)} / ${C(cl)}`,onClose:r,camera:v,onFlip:()=>s(e=>e===`environment`?`user`:`environment`)}),(0,j.jsx)(sl,{camera:v,asking:_(`camera.asking`),actions:(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,j.jsxs)(fl,{onClick:()=>{r(),a()},children:[(0,j.jsx)(qi,{className:`size-4`}),` `,_(Pc?`camera.native`:`camera.pick`)]}):null,(0,j.jsx)(fl,{quiet:!0,onClick:r,children:_(`common.close`)})]})}),(0,j.jsxs)(`div`,{className:V(`safe-bottom px-4 pt-3`,v.error&&`invisible`),children:[n&&ul&&m===null?(0,j.jsx)(`div`,{className:`mb-3 flex justify-center gap-1 text-[0.8125rem]`,children:[`photo`,`video`].map(e=>(0,j.jsx)(`button`,{type:`button`,"aria-pressed":c===e,onClick:()=>l(e),className:V(`h-9 rounded-full px-4 font-medium transition`,c===e?`bg-white text-black`:`text-white/70 hover:text-white`),children:_(e===`photo`?`camera.photo`:`camera.video`)},e))}):null,(0,j.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_1fr] items-center gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[0.8125rem] text-white/70 leading-snug`,children:m===null?c===`video`?_(`camera.clipHint`,{s:cl}):_(t?`camera.hintMany`:`camera.hint`):_(`camera.recording`)}),(0,j.jsx)(`button`,{type:`button`,"aria-label":_(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,j.jsx)(us,{className:`text-white`}):c===`photo`?(0,j.jsx)(`span`,{className:`size-[54px] rounded-full bg-white`}):m===null?(0,j.jsx)(`span`,{className:`flex size-[54px] items-center justify-center rounded-full bg-[#e5484d]`,children:(0,j.jsx)(qo,{className:`size-6 text-white`})}):(0,j.jsx)(`span`,{className:`size-7 rounded-md bg-[#e5484d]`})}),(0,j.jsx)(`div`,{className:`flex justify-end`,children:t&&u&&m===null?(0,j.jsxs)(fl,{onClick:r,children:[(0,j.jsx)(B,{className:`size-4`}),` `,_(`camera.done`)]}):null})]})]})]})}function fl({onClick:e,quiet:t,children:n}){return(0,j.jsx)(`button`,{type:`button`,onClick:e,className:V(`inline-flex h-11 items-center justify-center gap-2 rounded-full px-5 font-medium text-[0.875rem] transition`,t?`text-white/75 hover:text-white`:`bg-white text-black hover:bg-white/90`),children:n})}var pl=`w-full min-w-0 rounded-md bg-transparent px-2 py-1.5 text-[0.875rem] outline-none transition placeholder:text-ink-4 hover:bg-accent focus:bg-paper focus:ring-1 focus:ring-ring`,ml=`font-medium text-[0.6875rem] text-ink-3 uppercase tracking-[0.08em]`,hl=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function gl(e,t,n){if(!t.length)return n;let[r,...i]=t;if(Array.isArray(e)){let t=[...e];return t[r]=gl(t[r],i,n),t}let a=e??{};return{...a,[r]:gl(a[r],i,n)}}function _l(e,t){let n=e?.length?e:[...new Set(t.filter(hl).flatMap(e=>Object.keys(e)))];return{kind:`object`,fields:Object.fromEntries(n.map(e=>[e,{kind:`text`}]))}}var vl=e=>e.kind!==`object`&&e.kind!==`table`&&(e.kind!==`list`||e.of.kind!==`object`)&&!(e.kind===`text`&&e.long),yl=e=>Object.values(e.fields).every(vl),bl=e=>Object.values(e.fields).every(e=>e.kind!==`table`&&(e.kind!==`list`||e.of.kind!==`object`));function xl(e,t){let n=b(e);return n?String(t[n]??``):``}function Sl({text:e}){return(0,j.jsx)(`span`,{className:`whitespace-pre-wrap`,children:e})}function Cl({shape:e,value:t,path:n,ctx:r,cell:i}){switch(e.kind){case`text`:return r.edit?e.long?(0,j.jsx)(`textarea`,{className:V(pl,`field-sizing-content max-h-60 resize-none`),value:String(t??``),onChange:e=>r.set(n,e.target.value)}):(0,j.jsx)(`input`,{className:pl,value:String(t??``),onChange:e=>r.set(n,e.target.value)}):(0,j.jsx)(Sl,{text:t==null?``:String(t)});case`number`:return r.edit?(0,j.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`input`,{type:`number`,className:V(pl,`text-right tabular-nums`,i&&`w-20`),value:t==null?``:Number(t),onChange:e=>r.set(n,e.target.value===``?null:Number(e.target.value))}),e.unit?(0,j.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:e.unit}):null]}):(0,j.jsx)(`span`,{className:`tabular-nums`,children:t==null?``:`${t}${e.unit?` ${e.unit}`:``}`});case`yesno`:{let i=t?e.yes??_(`data.yes`):e.no??_(`data.no`);return r.edit?(0,j.jsxs)(`label`,{className:`flex items-center gap-2 px-2 py-1.5 text-[0.8125rem] text-ink-2`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:!!t,onChange:e=>r.set(n,e.target.checked),className:`size-4 accent-[var(--second)]`}),i]}):(0,j.jsx)(`span`,{className:V(`inline-flex rounded-full px-2 py-0.5 text-[0.75rem]`,t?`bg-second-tint text-second`:`bg-paper-2 text-ink-3`),children:i})}case`choice`:case`score`:return r.edit?(0,j.jsx)(`select`,{className:pl,value:String(t??``),onChange:e=>r.set(n,e.target.value),children:[...new Set([String(t??``),...e.options])].map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))}):(0,j.jsx)(`span`,{children:String(t??``)});case`ref`:{let i=r.shape.fields[e.to],a=i?.kind===`list`&&i.of.kind===`object`?i.of:{kind:`object`,fields:{}},o=(Array.isArray(r.root[e.to])?r.root[e.to]:[]).filter(hl),s=o.find(e=>e.id===t);return r.edit?(0,j.jsxs)(`select`,{className:pl,value:String(t??``),onChange:e=>r.set(n,e.target.value),children:[s?null:(0,j.jsx)(`option`,{value:String(t??``),children:String(t??``)}),o.map(e=>(0,j.jsx)(`option`,{value:String(e.id),children:xl(a,e)||String(e.id)},String(e.id)))]}):s?(0,j.jsxs)(`button`,{type:`button`,onClick:()=>r.open(String(s.id)),className:`inline-flex items-center gap-1 text-left text-ember-strong hover:underline`,children:[(0,j.jsx)(Ha,{className:`size-3.5 shrink-0`}),xl(a,s)||String(s.id)]}):(0,j.jsx)(`span`,{className:`text-rose`,children:_(`data.missing`,{id:String(t??``)})})}case`table`:{let i=Array.isArray(t)?t:[];return(0,j.jsx)(Dl,{shape:_l(e.columns,i),value:i,path:n,ctx:r})}case`list`:if(e.of.kind===`object`){let i=e.of,a=yl(i)?Dl:bl(i)?Ol:kl;return(0,j.jsx)(a,{shape:i,value:t,path:n,ctx:r})}return(0,j.jsx)(wl,{value:t,path:n,ctx:r});case`object`:return(0,j.jsx)(Al,{shape:e,value:t,path:n,ctx:r})}}function wl({value:e,path:t,ctx:n}){let r=Array.isArray(e)?e.map(String):[],[i,a]=(0,A.useState)(``);return(0,j.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1`,children:[r.map((e,i)=>(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-paper-2 px-2 py-0.5 text-[0.75rem]`,children:[e,n.edit?(0,j.jsx)(`button`,{type:`button`,"aria-label":_(`data.remove`),onClick:()=>n.set(t,r.filter((e,t)=>t!==i)),className:`text-ink-3 hover:text-ink`,children:(0,j.jsx)(Zo,{className:`size-3`})}):null]},`${e}-${i}`)),n.edit?(0,j.jsx)(`input`,{className:`w-20 rounded-full bg-transparent px-2 py-0.5 text-[0.75rem] outline-none ring-1 ring-border-soft focus:ring-ring`,placeholder:`+`,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i.trim()&&(e.preventDefault(),n.set(t,[...r,i.trim()]),a(``))}}):null]})}var Tl=e=>(Array.isArray(e)?e:[]).filter(hl),El=e=>e.fields.id?{id:`n${Date.now().toString(36)}`}:{};function Dl({shape:e,value:t,path:n,ctx:r}){let i=Tl(t),a=Object.entries(e.fields);return(0,j.jsxs)(`div`,{className:`overflow-x-auto rounded-lg ring-1 ring-border-soft`,children:[(0,j.jsxs)(`table`,{className:`w-full border-collapse text-[0.8125rem]`,children:[(0,j.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,j.jsxs)(`tr`,{children:[a.map(([e,t])=>(0,j.jsx)(`th`,{className:`whitespace-nowrap px-3 py-2 text-left font-medium`,children:E(e,t)},e)),r.edit?(0,j.jsx)(`th`,{className:`w-8`}):null]})}),(0,j.jsx)(`tbody`,{children:i.map((e,t)=>(0,j.jsxs)(`tr`,{className:`group border-border-soft border-t`,children:[a.map(([i,a])=>(0,j.jsx)(`td`,{className:V(`align-top`,r.edit?`p-0.5`:`px-3 py-2`),children:(0,j.jsx)(Cl,{shape:a,value:e[i],path:[...n,t,i],ctx:r,cell:!0})},i)),r.edit?(0,j.jsx)(`td`,{className:`p-0.5 align-middle`,children:(0,j.jsx)(Ml,{onClick:()=>r.set(n,i.filter((e,n)=>n!==t))})}):null]},t))})]}),r.edit?(0,j.jsx)(Nl,{what:e.label,onClick:()=>r.set(n,[...i,El(e)])}):null]})}function Ol({shape:e,value:t,path:n,ctx:r}){let i=Tl(t),a=Object.entries(e.fields),o=a.filter(([,e])=>e.kind===`text`&&e.long),s=a.filter(([,e])=>!(e.kind===`text`&&e.long));return(0,j.jsxs)(`div`,{className:`overflow-hidden rounded-lg ring-1 ring-border-soft`,children:[(0,j.jsx)(`ol`,{children:i.map((e,t)=>(0,j.jsxs)(`li`,{className:`grid grid-cols-[1.75rem_1fr_auto] items-start gap-2 border-border-soft border-t px-3 py-2 first:border-0`,children:[(0,j.jsx)(`span`,{className:`pt-1.5 font-display font-semibold text-ember-strong tabular-nums`,children:t+1}),(0,j.jsx)(`div`,{className:V(`flex min-w-0 flex-col`,!r.edit&&`pt-1`),children:o.map(([i,a])=>(0,j.jsx)(Cl,{shape:a,value:e[i],path:[...n,t,i],ctx:r},i))}),(0,j.jsxs)(`div`,{className:V(`flex items-center gap-2 text-[0.8125rem] text-ink-3`,!r.edit&&`pt-1`),children:[s.map(([i,a])=>(0,j.jsx)(Cl,{shape:a,value:e[i],path:[...n,t,i],ctx:r,cell:!0},i)),r.edit?(0,j.jsx)(Ml,{onClick:()=>r.set(n,i.filter((e,n)=>n!==t))}):null]})]},t))}),r.edit?(0,j.jsx)(Nl,{what:e.label,onClick:()=>r.set(n,[...i,El(e)])}):null]})}function kl({shape:e,value:t,path:n,ctx:r}){let i=Tl(t),a=Object.entries(e.fields),o=b(e),s=a.filter(([e,t])=>e!==o&&e!==`id`&&(t.kind===`text`&&!t.long||t.kind===`number`||t.kind===`choice`)),c=a.filter(([,e])=>e.kind===`list`&&e.of.kind===`object`);return(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.map((t,a)=>{let o=typeof t.id==`string`?t.id:void 0;return(0,j.jsxs)(`details`,{id:o?`${r.scope}-${o}`:void 0,className:`group rounded-xl bg-card ring-1 ring-border-soft open:ring-ink-4/40`,children:[(0,j.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-3 px-4 py-3 [&::-webkit-details-marker]:hidden`,children:[(0,j.jsx)(ea,{className:`size-4 shrink-0 text-ink-3 transition-transform group-open:rotate-90`}),(0,j.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate font-medium text-[0.9375rem]`,children:xl(e,t)||`${e.label??``} ${a+1}`.trim()}),(0,j.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[0.75rem] text-ink-3`,children:[s.map(([e,n])=>t[e]===void 0||t[e]===``?null:(0,j.jsx)(`span`,{children:n.kind===`number`&&n.unit?`${t[e]} ${n.unit}`:String(t[e])},e)),c.map(([e,n])=>(0,j.jsxs)(`span`,{children:[Array.isArray(t[e])?t[e].length:0,` `,E(e,n)]},e))]})]}),r.edit?(0,j.jsx)(Ml,{onClick:()=>r.set(n,i.filter((e,t)=>t!==a))}):null]}),(0,j.jsx)(`div`,{className:`border-border-soft border-t px-4 py-4`,children:(0,j.jsx)(Al,{shape:e,value:t,path:[...n,a],ctx:r})})]},a)}),r.edit?(0,j.jsx)(Nl,{what:e.label,onClick:()=>r.set(n,[...i,El(e)])}):null]})}function Al({shape:e,value:t,path:n,ctx:r}){let i=hl(t)?t:{},a=e=>e.kind===`list`||e.kind===`object`||e.kind===`table`||e.kind===`text`&&!!e.long;return(0,j.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-x-4 gap-y-4`,children:Object.entries(e.fields).map(([e,t])=>(0,j.jsx)(jl,{title:E(e,t),wide:a(t),count:Array.isArray(i[e])?i[e].length:null,children:(0,j.jsx)(Cl,{shape:t,value:i[e],path:[...n,e],ctx:r})},e))})}function jl({title:e,wide:t,count:n,children:r}){return(0,j.jsxs)(`div`,{className:V(`flex min-w-0 flex-col gap-1.5 text-[0.875rem]`,t&&`col-span-full`),children:[(0,j.jsxs)(`span`,{className:ml,children:[e,n===null?null:(0,j.jsx)(`span`,{className:`ml-1 text-ink-4`,children:n})]}),r]})}function Ml({onClick:e}){return(0,j.jsx)(`button`,{type:`button`,"aria-label":_(`data.remove`),onClick:t=>{t.preventDefault(),e()},className:`grid size-7 place-items-center rounded-md text-ink-3 hover:bg-accent hover:text-rose`,children:(0,j.jsx)(Vo,{className:`size-3.5`})})}function Nl({what:e,onClick:t}){return(0,j.jsxs)(`button`,{type:`button`,onClick:t,className:`flex w-full items-center gap-1.5 border-border-soft border-t px-3 py-2 text-[0.8125rem] text-ink-3 hover:bg-accent hover:text-ink`,children:[(0,j.jsx)(ho,{className:`size-3.5`}),` `,_(`data.add`,{what:e??``}).trim()]})}function Pl({shape:e,value:t,onChange:n,mode:r,onMode:i,modes:a=[`view`,`edit`,`json`],start:o}){let s=n?a:a.filter(e=>e!==`edit`),[c,l]=(0,A.useState)(o&&s.includes(o)?o:s[0]??`view`),u=r??c,d=i??l,f=(0,A.useId)().replace(/[^a-zA-Z0-9_-]/g,``),p={root:t,shape:e,edit:u===`edit`&&!!n,scope:f,set:(e,r)=>n?.(gl(t,e,r)),open:e=>{let t=document.getElementById(`${f}-${e}`);t&&(t.open=!0,t.scrollIntoView({behavior:`smooth`,block:`center`}))}},m=Object.entries(e.fields);return(0,j.jsxs)(`div`,{className:`flex flex-col`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-border-soft border-b px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1`,children:m.length>1?m.map(([e,n])=>(0,j.jsxs)(`a`,{href:`#${f}-part-${e}`,className:`rounded-full px-2.5 py-1 text-[0.8125rem] text-ink-2 hover:bg-accent`,children:[E(e,n),Array.isArray(t[e])?(0,j.jsx)(`span`,{className:`ml-1 text-ink-4 tabular-nums`,children:t[e].length}):null]},e)):null}),s.length>1?(0,j.jsx)(ss,{value:u,onChange:d,label:_(`data.modes`),options:s.map(e=>({id:e,label:_(`data.${e}`)}))}):null]}),u===`json`?(0,j.jsx)(`pre`,{className:`max-h-[36rem] overflow-auto p-4 font-mono text-[0.75rem] text-ink-2 leading-relaxed`,children:JSON.stringify(t,null,2)}):(0,j.jsx)(`div`,{className:`flex flex-col gap-7 p-4 sm:p-5`,children:m.map(([e,n])=>(0,j.jsxs)(`section`,{id:`${f}-part-${e}`,className:`flex scroll-mt-4 flex-col gap-2`,children:[(0,j.jsxs)(`h3`,{className:`flex items-baseline gap-2 font-display font-semibold text-[1rem]`,children:[E(e,n),Array.isArray(t[e])?(0,j.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-4 tabular-nums`,children:t[e].length}):null]}),(0,j.jsx)(`div`,{className:`text-[0.9375rem] leading-relaxed`,children:(0,j.jsx)(Cl,{shape:n,value:t[e],path:[e],ctx:p})})]},e))})]})}function Fl({items:e}){let[t,n]=(0,A.useState)(!1),r=(0,A.useRef)(null);return(0,A.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)},i=e=>e.key===`Escape`&&n(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,i)}},[t]),(0,j.jsxs)(`div`,{ref:r,className:`relative`,children:[(0,j.jsx)(`button`,{type:`button`,"aria-label":_(`data.menu`),title:_(`data.menu`),"aria-haspopup":`menu`,"aria-expanded":t,onClick:()=>n(e=>!e),className:V(`grid size-8 place-items-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink coarse:size-11`,t&&`bg-accent text-ink`),children:(0,j.jsx)(fa,{className:`size-4`})}),t?(0,j.jsx)(`div`,{role:`menu`,className:`absolute top-full right-0 z-50 mt-1 w-60 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:e.map(e=>(0,j.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 transition hover:bg-accent hover:text-ink`,onClick:()=>{n(!1),e.onClick()},children:[e.icon,e.label]},e.label))}):null]})}function Il(e){return e.toLowerCase().replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`output`}function Ll({shape:e,title:t,open:n,onClose:r}){let[i,a]=(0,A.useState)(!1),o=n?JSON.stringify(w(e,t),null,2):``;return(0,j.jsx)(ps,{open:n,onClose:r,title:`${_(`data.schema`)} · ${t}`,wide:!0,height:`tall`,children:(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,j.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto rounded-lg bg-paper-2 p-3 font-mono text-[0.75rem] text-ink-2 leading-relaxed`,children:o}),(0,j.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(o),a(!0),setTimeout(()=>a(!1),1500)},className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 hover:text-ink coarse:h-11 coarse:px-4`,children:[i?(0,j.jsx)(B,{className:`size-3.5`}):(0,j.jsx)(ia,{className:`size-3.5`}),_(i?`share.copied`:`data.copy`)]}),(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{let e=URL.createObjectURL(new Blob([o],{type:`application/schema+json`})),n=document.createElement(`a`);n.href=e,n.download=`${Il(t)}.schema.json`,n.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 hover:text-ink coarse:h-11 coarse:px-4`,children:[(0,j.jsx)(ua,{className:`size-3.5`}),` `,_(`data.download`)]})]})]})})}function Rl(e){let t=e;return t.type===`agent`&&t.output.format===`json`&&!t.each&&!t.call}function zl({runId:e,step:t,output:n,header:r,children:i}){let a=O(t),[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(null),g=u??(hl(n.json)?n.json:{}),v=async()=>{if(u){p(!0),h(null);try{await W.put(`${G(e)}/outputs/${t.id}`,{json:u}),d(null),s(!1)}catch(e){h(e.message)}finally{p(!1)}}},y=(0,j.jsx)(Fl,{items:[{label:_(o?`data.close`:`data.open`),icon:(0,j.jsx)(ca,{className:`size-4 shrink-0`}),onClick:()=>{s(e=>!e),d(null)}},{label:_(`data.schema`),icon:(0,j.jsx)(Ui,{className:`size-4 shrink-0`}),onClick:()=>l(!0)}]});return(0,j.jsxs)(j.Fragment,{children:[r(y),o?(0,j.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-card ring-1 ring-border-soft`,children:[(0,j.jsx)(Pl,{shape:a,value:g,onChange:d}),u?(0,j.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-border-soft border-t px-3 py-2`,children:[m?(0,j.jsx)(`span`,{className:`mr-auto text-[0.8125rem] text-rose`,children:m}):null,(0,j.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>d(null),children:_(`common.cancel`)}),(0,j.jsx)(H,{size:`sm`,busy:f,onClick:()=>void v(),children:_(`data.save`)})]}):null]}):i,(0,j.jsx)(Ll,{shape:a,title:t.title,open:c,onClose:()=>l(!1)})]})}var Bl=25,Vl=9e3;function Hl(e){return e.code===e.PERMISSION_DENIED?`denied`:e.code===e.TIMEOUT?`timeout`:`unavailable`}function Ul({value:e,base:t,placeholder:n,onChange:r,onBusy:i}){let a=o(e)?e:null,[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(null),d=(0,A.useRef)(null),f=(0,A.useRef)(!!a?.label),p=(0,A.useRef)(a);p.current=a;let m=a?.lat!==void 0&&a.lng!==void 0,g=typeof navigator<`u`&&`geolocation`in navigator,v=()=>{d.current!==null&&(navigator.geolocation.clearWatch(d.current),d.current=null),c(!1),i?.(!1)};(0,A.useEffect)(()=>()=>{d.current!==null&&navigator.geolocation.clearWatch(d.current)},[]);let y=async(e,n)=>{try{let{label:i}=await W.post(`${t}/geocode`,{lat:e,lng:n,language:h}),a=p.current;i&&!f.current&&a?.lat===e&&a.lng===n&&r({...a,label:i})}catch{}},b=()=>{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<=Bl||Date.now()-e>Vl){v();let e=p.current;e?.lat!==void 0&&e.lng!==void 0&&y(e.lat,e.lng)}},e=>{v(),t===1/0&&u(Hl(e))},{enableHighAccuracy:!0,timeout:15e3,maximumAge:1e4})},x=e=>{f.current=e.trim().length>0;let t={...m?a:{},label:e};r(m||e.trim()?t:void 0)};return(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[m?(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,j.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,j.jsx)(Ja,{className:`size-5`})}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`truncate font-medium text-[0.9375rem] tabular-nums`,children:[a.lat?.toFixed(5),`, `,a.lng?.toFixed(5)]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 text-[0.8125rem] text-ink-3`,children:[(0,j.jsx)(`span`,{children:s?_(`location.refining`):a.accuracy?_(`location.accuracy`,{m:a.accuracy}):null}),(0,j.jsxs)(`a`,{href:`https://www.openstreetmap.org/?mlat=${a.lat}&mlon=${a.lng}#map=17/${a.lat}/${a.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:[_(`location.map`),` `,(0,j.jsx)(ga,{className:`size-3`})]})]})]}),(0,j.jsx)(U,{label:_(`location.remove`),onClick:()=>{v(),f.current=!1,r(void 0)},children:(0,j.jsx)(Zo,{className:`size-4`})})]}):g?(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(H,{variant:`secondary`,size:`lg`,busy:s,onClick:b,className:`w-full sm:w-auto`,children:[s?null:(0,j.jsx)(Wa,{className:`size-4`}),_(s?`location.locating`:`location.use`)]}),l?(0,j.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[0.8125rem] text-ink-2 leading-relaxed`,children:_(`location.${l}`)}):(0,j.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3 leading-relaxed`,children:_(`location.why`)})]}):null,(0,j.jsx)(ts,{value:a?.label??``,placeholder:n??_(m?`location.label`:`location.manual`),autoComplete:`street-address`,enterKeyHint:`done`,"aria-label":_(`location.manual`),onChange:e=>x(e.target.value)})]})}var Wl=null;function Gl(){return Wl??=(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 i(async()=>{let{default:e}=await import(`./qr-scanner.min-BGqShvxG.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}}}})(),Wl}function Kl({open:e,onClose:t,onResult:n}){let r=(0,A.useRef)(n);r.current=n;let i=(0,A.useRef)(t);return i.current=t,(0,A.useEffect)(()=>{e&&wc(`scan`).then(e=>{e&&r.current(e)}).catch(()=>void 0).finally(()=>i.current())},[e]),null}function ql(e){return Cc(`scan`)?(0,j.jsx)(Kl,{...e}):(0,j.jsx)(Jl,{...e})}function Jl({open:e,onClose:t,onResult:n}){let[r,i]=(0,A.useState)(`environment`),[a,o]=(0,A.useState)(!1),[s,c]=(0,A.useState)(!1),l=(0,A.useRef)(null),u=rl(e,r),d=(0,A.useRef)(n);d.current=n;let f=(0,A.useRef)(t);f.current=t,(0,A.useEffect)(()=>{e&&(c(!1),Gl().then(e=>o(e.qrOnly)))},[e]),(0,A.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 Gl()).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 Gl()).detect(r).catch(()=>null):null;i?(n(i),t()):c(!0)};return(0,j.jsxs)(il,{open:e,onClose:t,label:_(`scan.title`),children:[(0,j.jsx)(ol,{title:_(`scan.title`),onClose:t,camera:u,onFlip:()=>i(e=>e===`environment`?`user`:`environment`)}),(0,j.jsx)(sl,{camera:u,asking:_(`scan.asking`),actions:(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,j.jsxs)(fl,{onClick:()=>l.current?.click(),children:[(0,j.jsx)(Ia,{className:`size-4`}),` `,_(`scan.fromPhoto`)]}),(0,j.jsx)(fl,{quiet:!0,onClick:t,children:_(`scan.typeInstead`)})]}),children:(0,j.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,j.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,j.jsxs)(`div`,{className:`safe-bottom flex flex-col items-center gap-3 px-5 pt-3 text-center`,children:[(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-white/75 leading-snug`,children:_(s?`scan.miss`:a?`scan.hintQr`:`scan.hint`)}),u.stream?(0,j.jsxs)(fl,{quiet:!0,onClick:()=>l.current?.click(),children:[(0,j.jsx)(Ia,{className:`size-4`}),` `,_(`scan.fromPhoto`)]}):null]}),(0,j.jsx)(`input`,{ref:l,type:`file`,hidden:!0,accept:`image/*`,onChange:e=>{p(e.target.files?.[0]),e.target.value=``}})]})}var Yl=`#1d1a17`,Xl={width:1200,height:480};function Zl(e,t,n,r,i){e.lineCap=`round`,e.lineJoin=`round`,e.strokeStyle=Yl,e.fillStyle=Yl,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 Ql({strokes:e,onStrokes:t}){let n=(0,A.useRef)(null),r=(0,A.useRef)(null),i=(0,A.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),Zl(t,r.current?[...i.current,r.current]:i.current,o,s,2.4*a)};(0,A.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,j.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl bg-white ring-1 ring-input`,children:[(0,j.jsx)(`canvas`,{ref:n,"aria-label":_(`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,j.jsx)(`div`,{className:`pointer-events-none absolute inset-x-6 bottom-[22%] border-[#1d1a17]/25 border-b`}),e.length?null:(0,j.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center text-[#1d1a17]/40 text-[0.875rem]`,children:_(`sign.hint`)})]})}async function $l(e){let t=document.createElement(`canvas`);t.width=Xl.width,t.height=Xl.height;let n=t.getContext(`2d`);if(!n)return null;Zl(n,e,Xl.width,Xl.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 eu({label:e,value:t,base:n,onChange:r}){let[i,a]=(0,A.useState)(!1),[o,s]=(0,A.useState)([]),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(null),f=typeof t==`string`&&t?t:null,p=async()=>{l(!0),d(null);try{let e=await $l(o);if(!e)return;r((await W.upload(`${n}/uploads`,e)).id),a(!1)}catch(e){d(e.message)}finally{l(!1)}};return(0,j.jsxs)(`div`,{children:[f?(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:()=>{s([]),a(!0)},className:`min-w-0 flex-1 rounded-lg bg-white px-3`,"aria-label":_(`sign.again`),children:(0,j.jsx)(`img`,{src:xc(`${n}/assets/${f}`),alt:e,className:`mx-auto h-20 object-contain`})}),(0,j.jsx)(U,{label:_(`sign.remove`),onClick:()=>r(void 0),children:(0,j.jsx)(Zo,{className:`size-4`})})]}):(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{s([]),a(!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-[0.875rem] text-ink-3 transition hover:border-ember hover:text-ink`,children:[(0,j.jsx)(co,{className:`size-6`}),_(`sign.open`)]}),(0,j.jsxs)(ps,{open:i,onClose:()=>a(!1),title:e,wide:!0,children:[(0,j.jsx)(Ql,{strokes:o,onStrokes:s}),u?(0,j.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:u}):null,(0,j.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-3`,children:[(0,j.jsxs)(H,{variant:`ghost`,disabled:!o.length||c,onClick:()=>s([]),children:[(0,j.jsx)(ma,{className:`size-4`}),` `,_(`sign.clear`)]}),(0,j.jsx)(H,{busy:c,disabled:!o.length,onClick:()=>void p(),children:_(`sign.accept`)})]})]})]})}var tu=36e5,nu=6e4,ru=1e3;function iu(e){return e.fractionDigits===void 0?e.style===`integer`?0:2:e.fractionDigits}function au(e,t,n=`en`){if(typeof e!=`number`||!Number.isFinite(e))return``;let r=iu(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 ou(e,t,n=`en`){if(typeof e!=`string`||e.length===0)return``;if(t.kind===`time`)return su(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 su(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 cu(e,t){if(typeof e!=`number`||!Number.isFinite(e))return``;let n=Math.max(0,Math.round(e));if(t.display===`iso`)return lu(n);if(t.display===`minutes`)return`${Math.round(n/nu)} min`;if(t.display===`hours`)return`${(n/tu).toFixed(2)} h`;if(t.display===`decimal-hours`)return(n/tu).toFixed(2);let r=Math.floor(n/tu),i=Math.floor(n%tu/nu),a=Math.floor(n%nu/ru);return`${r}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}function lu(e){let t=Math.floor(e/tu),n=Math.floor(e%tu/nu),r=Math.floor(e%nu/ru);return`${t>=24?`P${Math.floor(t/24)}D`:`P`}T${t%24}H${n}M${r}S`}function uu(e,t,n=`en`){if(t==null)return``;switch(e.type){case`number`:return au(t,e.format,n);case`date`:return ou(t,e.format,n);case`duration`:return cu(t,e.format);case`boolean`:return t===!0?`true`:t===!1?`false`:``;case`select`:return du(e,t);default:return String(t)}}function du(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(`, `)}function fu({runId:e,connectionId:t,connector:n,onCancel:r}){let[i,a]=(0,A.useState)({}),[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(null),u=async()=>{s(!0),l(null);try{await W.post(`${G(e)}/connections/${t}/credentials/${n.id}`,{values:i})}catch(e){l(e.message)}finally{s(!1)}};return(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-card p-4 ring-1 ring-input`,children:[(n.fields??[]).map(e=>(0,j.jsxs)(`div`,{children:[(0,j.jsx)(ls,{children:e.label}),(0,j.jsx)(ts,{type:e.secret?`password`:`text`,autoComplete:`off`,value:i[e.key]??``,placeholder:e.placeholder,onChange:t=>a(n=>({...n,[e.key]:t.target.value})),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u())}})]},e.key)),n.hint?(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:n.hint}):null,c?(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:c}):null,(0,j.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,j.jsx)(H,{variant:`ghost`,size:`sm`,onClick:r,children:_(`common.cancel`)}),(0,j.jsx)(H,{size:`sm`,busy:o,onClick:()=>void u(),children:_(`connect.go`)})]})]})}function pu({runId:e,connection:t}){let[n,r]=(0,A.useState)(null),[i,a]=(0,A.useState)(null),[o,s]=(0,A.useState)(null);if(!t)return null;if(t.account){let n=t.connectors.find(e=>e.id===t.account?.connector)?.name??``;return(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,j.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,j.jsx)(B,{className:`size-5`})}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium text-[0.9375rem]`,children:t.account.label}),(0,j.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:_(`connect.connected`,{name:n})})]}),(0,j.jsx)(U,{label:_(`connect.disconnect`),onClick:()=>void W.del(`${G(e)}/connections/${t.id}`),children:(0,j.jsx)(Go,{className:`size-4`})})]})}let c=async n=>{if(s(null),a(null),Cc(`signIn`)){try{let{url:r}=await W.post(`${G(e)}/connections/${t.id}/oauth/${n.id}`);await wc(`signIn`,{url:r})}catch(e){s(e.message)}return}let r=window.open(`about:blank`,`wizard-connect`,`width=540,height=700`);try{let{url:i}=await W.post(`${G(e)}/connections/${t.id}/oauth/${n.id}`);r?r.location.replace(i):a(i)}catch(e){r?.close(),s(e.message)}},l=t.connectors.find(e=>e.id===n);return t.connectors.length?(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.connectors.map(e=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>e.auth===`oauth2`?void c(e):r(n===e.id?null:e.id),className:V(`inline-flex h-11 items-center gap-2 rounded-full px-4 font-medium text-[0.875rem] 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,j.jsx)(Ha,{className:`size-4`}),` `,e.name]},e.id))}),l?(0,j.jsx)(fu,{runId:e,connectionId:t.id,connector:l,onCancel:()=>r(null)}):null,i?(0,j.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:`text-[0.875rem] text-ember underline`,children:_(`connect.openLink`)}):null,o?(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:o}):null]}):(0,j.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`connect.none`)})}function mu(e){return e==null?``:Array.isArray(e)?e.join(`, `):String(e)}function hu({column:e,value:t,boxed:n,onCommit:r}){let[i,a]=(0,A.useState)(mu(t));(0,A.useEffect)(()=>a(mu(t)),[t]);let o=V(`w-full min-w-0 rounded-md border border-transparent px-2 text-[0.8125rem] 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,j.jsx)(`label`,{className:`flex size-9 cursor-pointer items-center justify-center coarse:size-11`,children:(0,j.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,j.jsxs)(`select`,{value:i,onChange:e=>r(e.target.value||null),className:o,children:[(0,j.jsx)(`option`,{value:``}),e.format.options.map(e=>(0,j.jsx)(`option`,{value:e.id,children:e.label},e.id))]}):(0,j.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!==mu(t)&&r(g(e,i))},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.target.blur())},className:V(o,e.type===`number`&&`text-right tabular-nums`)})}function gu({runId:e,list:t,editable:n}){let{def:r,rows:i}=t,[a,o]=(0,A.useState)(null),[s,c]=(0,A.useState)({}),l=`${G(e)}/lists/${r.id}/rows`,u=async e=>{o(null);try{await e()}catch(e){o(e instanceof pc?e.message:String(e))}},d=()=>u(async()=>{await W.post(l,{cells:s}),c({})}),f=Object.values(s).some(e=>e!=null&&e!==``);if(!i.length&&!n)return(0,j.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`list.empty`)});let p=(e,t)=>t===0||e.type===`text`&&e.format?.style===`multiline`,m=(e,t,n)=>void u(()=>W.patch(`${l}/${e}`,{cells:{[t]:n}}));return(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`flex flex-col gap-2 sm:hidden`,children:[i.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:r.columns.map((t,r)=>(0,j.jsxs)(`div`,{className:V(`min-w-0`,p(t,r)&&`col-span-2`),children:[(0,j.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:t.name}),n?(0,j.jsx)(hu,{boxed:!0,column:t,value:e.cells[t.id],onCommit:n=>m(e.id,t.id,n)}):(0,j.jsx)(`div`,{className:V(`break-words px-1 text-[0.875rem]`,t.type===`number`&&`tabular-nums`),children:uu(t,e.cells[t.id],h)||`—`})]},t.id))}),n?(0,j.jsx)(`div`,{className:`mt-1 flex justify-end`,children:(0,j.jsx)(U,{label:_(`list.delete`),onClick:()=>void u(()=>W.del(`${l}/${e.id}`)),children:(0,j.jsx)(Vo,{className:`size-4`})})}):null]},e.id)),n?(0,j.jsxs)(`div`,{className:`rounded-lg border border-input border-dashed p-2`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:r.columns.map((e,t)=>(0,j.jsxs)(`div`,{className:V(`min-w-0`,p(e,t)&&`col-span-2`),children:[(0,j.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:e.name}),(0,j.jsx)(hu,{boxed:!0,column:e,value:s[e.id],onCommit:t=>c(n=>({...n,[e.id]:t}))})]},e.id))}),(0,j.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,j.jsxs)(H,{variant:`secondary`,size:`sm`,onClick:()=>f?void d():void 0,children:[(0,j.jsx)(ho,{className:`size-4`}),` `,_(`run.addRow`)]})})]}):null]}),(0,j.jsx)(`div`,{className:`hidden overflow-x-auto rounded-lg ring-1 ring-border-soft sm:block`,children:(0,j.jsxs)(`table`,{className:`w-full text-[0.8125rem]`,children:[(0,j.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,j.jsxs)(`tr`,{children:[r.columns.map(e=>(0,j.jsx)(`th`,{className:`whitespace-nowrap px-3 py-2 text-left font-medium`,children:e.name},e.id)),n?(0,j.jsx)(`th`,{className:`w-10`}):null]})}),(0,j.jsxs)(`tbody`,{children:[i.map(e=>(0,j.jsxs)(`tr`,{className:`border-border-soft border-t align-top`,children:[r.columns.map(t=>(0,j.jsx)(`td`,{className:V(`min-w-[7.5rem]`,n?`px-1 py-0.5`:`px-3 py-2`),children:n?(0,j.jsx)(hu,{column:t,value:e.cells[t.id],onCommit:n=>m(e.id,t.id,n)}):(0,j.jsx)(`span`,{className:V(t.type===`number`&&`tabular-nums`),children:uu(t,e.cells[t.id],h)})},t.id)),n?(0,j.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,j.jsx)(U,{label:_(`list.delete`),className:`size-9`,onClick:()=>void u(()=>W.del(`${l}/${e.id}`)),children:(0,j.jsx)(Vo,{className:`size-3.5`})})}):null]},e.id)),n?(0,j.jsxs)(`tr`,{className:`border-border-soft border-t bg-paper`,children:[r.columns.map(e=>(0,j.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,j.jsx)(hu,{column:e,value:s[e.id],onCommit:t=>c(n=>({...n,[e.id]:t}))})},e.id)),(0,j.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,j.jsx)(U,{label:_(`run.addRow`),className:`size-9`,onClick:()=>f?void d():void 0,children:(0,j.jsx)(ho,{className:`size-4`})})})]}):null]})]})}),a?(0,j.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:a}):null]})}function _u(e,t,n){let r=t.split(`/`).map(encodeURIComponent).join(`/`);return xc(`${G(e)}/store/files/${r}${n?`?inline=1`:``}`)}var vu=[`bg-paper-3 text-ink-3`,`bg-moss-tint text-moss`,`bg-rose-tint text-rose`,`bg-ember-tint text-ember-strong`];function yu({runId:e,list:t}){let{def:n,rows:r}=t,i=n.columns.find(e=>e.id===n.check?.file),a=n.columns.find(e=>e.id===n.check?.status),o=a?.type===`select`?a.format.options:[],s=o[0]?.id,c=e=>a?String(e.cells[a.id]??s??``):``,l=e=>!a||c(e)===s,[u,d]=(0,A.useState)(()=>(r.find(l)??r[0])?.id??null),[f,p]=(0,A.useState)(!1),[m,g]=(0,A.useState)(null),v=`${G(e)}/lists/${n.id}/rows`,y=r.find(e=>e.id===u)??r[0],b=f?r.filter(e=>l(e)||e.id===y?.id):r,x=r.filter(e=>!l(e)).length,S=n.columns.filter(e=>e!==i&&e!==a),C=S.filter(e=>e.id!==n.key),w=C.find(e=>e.type===`text`)??C[0],T=C.filter(e=>e!==w),ee=async(e,t)=>{g(null);try{await W.patch(`${v}/${e}`,{cells:t})}catch(e){g(e instanceof pc?e.message:String(e))}},E=e=>{let t=b.findIndex(e=>e.id===y?.id),n=b[Math.min(b.length-1,Math.max(0,t+e))];n&&d(n.id)},te=async e=>{if(!y||!a)return;let t=r.findIndex(e=>e.id===y.id),n=[...r.slice(t+1),...r.slice(0,t)].find(l);await ee(y.id,{[a.id]:e}),n&&e!==s&&d(n.id)},D=e=>{e.target.closest(`input, textarea, select`)||(e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),E(e.key===`ArrowDown`?1:-1)):/^[1-9]$/.test(e.key)&&o[Number(e.key)]&&(e.preventDefault(),te(o[Number(e.key)].id)))};if(!r.length)return(0,j.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`list.empty`)});let O=i&&y?String(y.cells[i.id]??``).trim():``,k=O.split(`.`).pop()?.toLowerCase()??``,ne=e=>vu[Math.min(Math.max(0,o.findIndex(t=>t.id===c(e))),3)];return(0,j.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(280px,360px)_minmax(0,1fr)]`,onKeyDown:D,children:[(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-col`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:_(`check.progress`,{done:x,total:r.length})}),a?(0,j.jsx)(`button`,{type:`button`,"aria-pressed":f,onClick:()=>p(e=>!e),className:V(`inline-flex h-8 items-center rounded-full px-3 text-[0.8125rem] ring-1 transition coarse:h-11`,f?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink`),children:_(`check.onlyOpen`)}):null]}),(0,j.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,j.jsx)(`li`,{children:(0,j.jsxs)(`button`,{type:`button`,onClick:()=>d(e.id),"aria-current":e.id===y?.id,className:V(`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,j.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate font-medium text-[0.875rem]`,children:w&&uu(w,e.cells[w.id],h)||`—`}),(0,j.jsx)(`span`,{className:`block truncate text-[0.75rem] text-ink-3 tabular-nums`,children:T.slice(0,2).map(t=>uu(t,e.cells[t.id],h)).filter(Boolean).join(` · `)})]}),a?(0,j.jsx)(`span`,{className:V(`shrink-0 rounded-full px-2 py-0.5 font-medium text-[0.6875rem]`,ne(e)),children:o.find(t=>t.id===c(e))?.label??c(e)}):null]})},e.id))})]}),y?(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[o.length>1?(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[o.slice(1).map((e,t)=>(0,j.jsxs)(H,{size:`md`,variant:c(y)===e.id?`primary`:`secondary`,onClick:()=>void te(e.id),children:[c(y)===e.id?(0,j.jsx)(B,{className:`size-4`}):null,e.label,(0,j.jsx)(`kbd`,{className:`ml-1 hidden rounded bg-black/10 px-1.5 text-[0.6875rem] lg:inline`,children:t+1})]},e.id)),c(y)===s?null:(0,j.jsx)(H,{size:`md`,variant:`ghost`,onClick:()=>void te(s??``),children:_(`check.reopen`)})]}):null,(0,j.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-paper-2 ring-1 ring-border-soft`,children:O?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-border-soft border-b bg-card px-3 py-2 text-[0.8125rem]`,children:[(0,j.jsx)(ba,{className:`size-3.5 shrink-0 text-ink-3`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:O.split(`/`).pop()}),(0,j.jsx)(`a`,{href:_u(e,O,k===`pdf`),target:`_blank`,rel:`noreferrer`,className:`shrink-0 text-ink-2 underline-offset-2 hover:text-ink hover:underline`,children:_(`run.openFull`)})]}),k===`pdf`?(0,j.jsx)(`iframe`,{title:O,src:`${_u(e,O,!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]`},O):[`png`,`jpg`,`jpeg`,`webp`].includes(k)?(0,j.jsx)(`div`,{className:`flex max-h-[46vh] justify-center overflow-auto bg-white lg:max-h-[calc(100vh-27rem)]`,children:(0,j.jsx)(`img`,{src:_u(e,O,!0),alt:O,className:`max-w-full object-contain`},O)}):(0,j.jsx)(`p`,{className:`px-4 py-10 text-center text-[0.875rem] text-ink-3`,children:_(`check.noPreview`)})]}):(0,j.jsx)(`p`,{className:`px-4 py-14 text-center text-[0.875rem] text-ink-3`,children:_(`check.noFile`)})}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-3`,children:S.map(e=>(0,j.jsxs)(`div`,{className:V(`min-w-0`,e.type===`text`&&e.format?.style===`multiline`&&`col-span-full`),children:[(0,j.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:e.name}),(0,j.jsx)(hu,{boxed:!0,column:e,value:y.cells[e.id],onCommit:t=>void ee(y.id,{[e.id]:t})})]},e.id))}),m?(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:m}):null]}):null]})}var bu={xlsx:`Excel`,csv:`CSV`,json:`JSON`,md:`Markdown`,zip:`ZIP`};function xu({runId:e,list:t}){return(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.formats.map(n=>(0,j.jsx)(`a`,{href:xc(`${G(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-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink coarse:h-11 coarse:px-4`,children:bu[n]??n},n))})}function Su({runId:e}){let[t,n]=(0,A.useState)(!1),[r,i]=(0,A.useState)(null),[a,o]=(0,A.useState)(!1);(0,A.useEffect)(()=>{t&&(o(!1),W.get(`${G(e)}/store`).then(i))},[t,e]);let s=r&&!r.files.length&&!r.connections.length&&!r.keepsSignIns&&r.lists.every(e=>!e.rows);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-1.5 text-[0.8125rem] text-ink-4 transition hover:text-ink-2 coarse:min-h-11`,children:[(0,j.jsx)(ca,{className:`size-3.5`}),` `,_(`store.open`)]}),(0,j.jsx)(ps,{open:t,onClose:()=>n(!1),title:_(`store.title`),wide:!0,children:r?(0,j.jsxs)(`div`,{className:`flex flex-col gap-5 text-[0.875rem]`,children:[(0,j.jsx)(`p`,{className:`text-ink-3`,children:_(`store.explain`)}),s?(0,j.jsx)(`p`,{className:`text-ink-2`,children:_(`store.empty`)}):null,r.lists.some(e=>e.rows)?(0,j.jsx)(`ul`,{className:`flex flex-col gap-1`,children:r.lists.filter(e=>e.rows).map(e=>(0,j.jsxs)(`li`,{className:`flex justify-between gap-3`,children:[(0,j.jsx)(`span`,{children:e.title}),(0,j.jsx)(`span`,{className:`text-ink-3 tabular-nums`,children:_(`store.rows`,{n:e.rows})})]},e.id))}):null,r.connections.map(e=>(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(Ha,{className:`size-4 text-ink-3`}),` `,e.account?.label]},e.id)),r.keepsSignIns?(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(B,{className:`size-4 text-ink-3`}),` `,_(`store.signIns`)]}):null,r.files.length?(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`mb-1 text-ink-3`,children:_(`store.files`,{n:r.files.length,size:v(r.files.reduce((e,t)=>e+t.size,0))})}),(0,j.jsx)(`ul`,{className:`max-h-56 overflow-y-auto rounded-lg ring-1 ring-border-soft`,children:r.files.map(t=>(0,j.jsx)(`li`,{className:`border-border-soft border-b last:border-0`,children:(0,j.jsxs)(`a`,{href:xc(`${G(e)}/store/files/${t.path}`),className:`flex items-center gap-2 px-3 py-2 text-[0.8125rem] hover:bg-paper-2 coarse:min-h-11`,title:t.source??void 0,children:[(0,j.jsx)(ba,{className:`size-3.5 shrink-0 text-ink-3`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.path}),(0,j.jsx)(`span`,{className:`text-ink-4 tabular-nums`,children:v(t.size)})]})},t.path))})]}):null,(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[s?(0,j.jsx)(`span`,{}):a?(0,j.jsxs)(H,{variant:`secondary`,onClick:async()=>{await W.del(`${G(e)}/store`),i(await W.get(`${G(e)}/store`)),o(!1)},children:[(0,j.jsx)(Vo,{className:`size-4`}),` `,_(`store.confirmDelete`)]}):(0,j.jsxs)(H,{variant:`ghost`,onClick:()=>o(!0),children:[(0,j.jsx)(Vo,{className:`size-4`}),` `,_(`store.delete`)]}),(0,j.jsx)(H,{onClick:()=>n(!1),children:_(`common.close`)})]})]}):(0,j.jsx)(`div`,{className:`flex justify-center py-8 text-ink-4`,children:(0,j.jsx)(us,{})})})]})}var Cu=300;function wu(){if(typeof MediaRecorder<`u`)return(Cc(`transcribe`)?[`audio/mp4`,`audio/webm;codecs=opus`,`audio/webm`,`audio/ogg;codecs=opus`]:[`audio/webm;codecs=opus`,`audio/mp4`,`audio/webm`,`audio/ogg;codecs=opus`]).find(e=>MediaRecorder.isTypeSupported(e))}async function Tu(e,t){if(Cc(`transcribe`))try{let n=await wc(`transcribe`,{audio:await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).split(`,`)[1]??``),r.onerror=()=>n(r.error),r.readAsDataURL(e)}),mime:e.type,lang:t});return typeof n?.text==`string`?n.text:void 0}catch{return}}function Eu(e){return`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`}function Du({value:e,base:t,onChange:n,onBusy:r}){let i=c(e)?e:null,[a,o]=(0,A.useState)(null),[s,l]=(0,A.useState)(0),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(null),[m,h]=(0,A.useState)(!1),[g,v]=(0,A.useState)(null),y=(0,A.useRef)(null),b=(0,A.useRef)(null),x=wu(),S=Fc&&!!x;(0,A.useEffect)(()=>()=>{y.current&&(y.current.recorder.onstop=null,y.current.stop())},[]),(0,A.useEffect)(()=>()=>{g&&URL.revokeObjectURL(g.url)},[g]);let C=async(e,i)=>{d(!0),r?.(!0),p(null);try{let r=await W.upload(`${t}/uploads`,e);v({asset:r.id,url:URL.createObjectURL(e)});let{lang:a}=bc(),o=await Tu(e,a);n({asset:r.id,lang:a,...i===void 0?{}:{seconds:i},...o===void 0?{}:{transcript:o}})}catch(e){p(e.message)}finally{d(!1),r?.(!1)}},w=async()=>{p(null),h(!1);let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0}})}catch{h(!0);return}let t=[],n=new MediaRecorder(e,{mimeType:x,audioBitsPerSecond:48e3}),i=Date.now(),a=new AudioContext,s=a.createAnalyser();s.fftSize=256,a.createMediaStreamSource(e).connect(s);let c=new Uint8Array(s.fftSize),u=0,d=()=>{s.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)),o((Date.now()-i)/1e3),(Date.now()-i)/1e3>=Cu){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),y.current=null,o(null),l(0)};n.ondataavailable=e=>e.data.size&&t.push(e.data),n.onstop=()=>{let e=(n.mimeType||x||`audio/webm`).split(`;`)[0],r=e===`audio/mp4`?`m4a`:e===`audio/ogg`?`ogg`:`webm`,a=Math.max(1,Math.round((Date.now()-i)/1e3));C(new File(t,`sprachnotiz-${el()}.${r}`,{type:e}),a)},y.current={recorder:n,stop:f},r?.(!0),n.start(1e3),u=requestAnimationFrame(d)},T=a!==null,ee=(0,j.jsxs)(H,{variant:`secondary`,onClick:()=>b.current?.click(),children:[(0,j.jsx)(va,{className:`size-4`}),` `,_(`voice.pick`)]});return(0,j.jsxs)(`div`,{children:[T?(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-ember`,children:[(0,j.jsxs)(`span`,{className:`relative flex size-11 shrink-0 items-center justify-center`,children:[(0,j.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-rose-tint transition-transform duration-75`,style:{transform:`scale(${.7+s*.5})`}}),(0,j.jsx)(`span`,{className:`relative size-3.5 animate-pulse-dot rounded-full bg-rose`})]}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`div`,{className:`font-medium text-[0.9375rem] tabular-nums`,children:Eu(a)}),(0,j.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:a>270?_(`voice.left`,{s:Math.ceil(Cu-a)}):_(`voice.recording`)})]}),(0,j.jsxs)(H,{onClick:()=>y.current?.stop(),children:[(0,j.jsx)(Fo,{className:`size-3.5 fill-current`}),` `,_(`voice.stop`)]})]}):u?(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-4 text-[0.875rem] text-ink-3 ring-1 ring-input`,children:[(0,j.jsx)(us,{className:`size-4`}),` `,_(`run.uploading`)]}):i?(0,j.jsxs)(`div`,{className:`rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,j.jsx)(`audio`,{controls:!0,preload:`metadata`,src:g?.asset===i.asset?g.url:`${t}/assets/${i.asset}`,className:`h-11 w-full`}),i.transcript?(0,j.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap px-1 text-[0.875rem] text-ink-2 leading-relaxed`,children:i.transcript}):null,(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:i.seconds?Eu(i.seconds):null}),(0,j.jsxs)(`div`,{className:`flex gap-1`,children:[S?(0,j.jsxs)(H,{variant:`ghost`,size:`sm`,onClick:()=>void w(),children:[(0,j.jsx)(xo,{className:`size-3.5`}),` `,_(`voice.again`)]}):null,(0,j.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>n(void 0),children:_(`voice.remove`)})]})]})]}):(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[S?(0,j.jsxs)(H,{variant:`secondary`,size:`lg`,onClick:()=>void w(),className:`w-full sm:w-auto`,children:[(0,j.jsx)(eo,{className:`size-4`}),` `,_(`voice.start`)]}):ee,S&&m?ee:null]}),m?(0,j.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[0.8125rem] text-ink-2 leading-relaxed`,children:_(`voice.denied`)}):(0,j.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3 leading-relaxed`,children:_(S?`voice.why`:`voice.noRecorder`)})]}),(0,j.jsx)(`input`,{ref:b,type:`file`,hidden:!0,accept:`audio/*`,capture:!0,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&C(t,void 0)}}),f?(0,j.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-rose`,children:f}):null]})}function Ou({field:e,value:t,values:n,onChange:r}){let i=e.columns??[],a=Array.isArray(t)&&t.length?t:[{}],o=l(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,j.jsxs)(`div`,{className:`rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,j.jsx)(`div`,{className:`hidden gap-2 px-2 pt-1 pb-2 text-[0.75rem] text-ink-3 sm:grid`,style:{gridTemplateColumns:`${c} 36px`},children:i.map(e=>(0,j.jsx)(`div`,{className:e.kind===`text`?``:`text-right`,children:e.label},e.id))}),(0,j.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map((e,t)=>(0,j.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,j.jsxs)(`label`,{className:V(`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,j.jsx)(`span`,{className:`px-0.5 text-[0.6875rem] text-ink-3 sm:hidden`,children:n.label}),(0,j.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:V(`h-11 w-full min-w-0 rounded-md border border-transparent bg-paper-2 px-2.5 text-[0.875rem] 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,j.jsx)(U,{label:_(`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,j.jsx)(Vo,{className:`size-4`})})]},t))}),(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-end justify-between gap-3 px-2 pb-1`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>r([...a,{}]),className:`inline-flex h-9 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-2 hover:bg-accent coarse:h-11`,children:[(0,j.jsx)(ho,{className:`size-4`}),` `,_(`run.addRow`)]}),(0,j.jsxs)(`div`,{className:`text-right text-[0.8125rem] tabular-nums`,children:[(0,j.jsxs)(`div`,{className:`text-ink-3`,children:[_(`run.net`),` `,d(o.net,o.currency,h)]}),o.vatRate?(0,j.jsxs)(`div`,{className:`text-ink-3`,children:[_(`run.vat`,{r:o.vatRate}),` `,d(o.vat,o.currency,h)]}):null,(0,j.jsxs)(`div`,{className:`font-semibold text-[0.9375rem] text-ink`,children:[_(`run.total`),` `,d(o.gross,o.currency,h)]})]})]})]})}function ku(e){return!!e?.closest(`input, textarea, [contenteditable='true']`)}function Au({field:e,value:t,base:n,onChange:r,onBusy:i}){let a=(0,A.useRef)(null),o=(0,A.useRef)(null),s=(0,A.useRef)(null),c=(0,A.useRef)(null),[l,u]=(0,A.useState)(!1),[d,f]=(0,A.useState)({}),[p,m]=(0,A.useState)(null),[h,g]=(0,A.useState)(!1),[v,y]=(0,A.useState)(!1),[b,x]=(0,A.useState)(null),S=(0,A.useRef)(null),C=e=>{S.current=e,x(e)},w=e.kind===`image`,T=!!e.multiple,ee=T?e.max??30:1,E=w||!!e.camera||!!e.video,te=!w&&!!e.video,D=Array.isArray(t)?t:typeof t==`string`&&t?[t]:[],O=(0,A.useRef)(D);O.current=D;let k=D.length<ee,ne=async e=>{let t=(w?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 a=ee-(T?O.current.length:0);u(!0),i?.(!0),m(t.length>a&&T?_(`run.maxFiles`,{n:ee}):null);try{for(let e of t.slice(0,Math.max(0,a))){let t=await $c(e),i=await W.upload(`${n}/uploads`,t);f(e=>({...e,[i.id]:{name:i.name,mime:i.mime}}));let a=T?[...O.current,i.id]:i.id;O.current=T?a:[i.id],r(a)}}catch(e){m(e.message)}finally{u(!1),i?.(!1)}},M=(0,A.useRef)(ne);M.current=ne;let re=e=>{let t=D.filter(t=>t!==e);r(T?t:void 0)},ie=(e,t)=>{let n=O.current.indexOf(e),i=Math.min(O.current.length-1,Math.max(0,t));if(n<0||n===i)return;let a=O.current.filter(t=>t!==e);a.splice(i,0,e),O.current=a,r(a)},ae=T&&D.length>1;(0,A.useEffect)(()=>{if(!k)return;let e=e=>{let t=Array.from(e.clipboardData?.files??[]),n=a.current;if(!t.length||!n||ku(document.activeElement))return;let r=document.querySelectorAll(`[data-upload-field]`);(n.matches(`:hover`)||n.contains(document.activeElement)||r.length===1)&&(e.preventDefault(),M.current(t))};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[k]);let oe=V(`flex flex-col items-center justify-center gap-2 rounded-xl border border-input border-dashed bg-card px-3 text-[0.875rem] text-ink-3 transition hover:border-ember hover:text-ink`,D.length?`py-4`:`py-8`);return(0,j.jsxs)(`div`,{ref:a,"data-upload-field":``,onDragOver:e=>{k&&(e.preventDefault(),y(!0))},onDragLeave:()=>y(!1),onDrop:e=>{y(!1),k&&(e.preventDefault(),ne(Array.from(e.dataTransfer.files)))},children:[D.length?(0,j.jsx)(`div`,{className:`mb-2 flex flex-col gap-2`,children:D.map((e,t)=>{let r=d[e],i=r?.mime??(w?`image/`:``);return(0,j.jsxs)(`div`,{"data-file-id":e,className:V(`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input transition-shadow`,b===e&&`relative z-10 shadow-elevated ring-2 ring-ember`),children:[ae?(0,j.jsxs)(`button`,{type:`button`,"aria-label":_(`run.moveFile`,{n:t+1}),title:_(`run.moveFileHint`),className:V(`-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`,b===e?`cursor-grabbing`:`cursor-grab`),onPointerDown:t=>{try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}C(e)},onPointerMove:t=>{if(S.current!==e)return;let n=document.elementFromPoint(t.clientX,t.clientY)?.closest(`[data-file-id]`),r=n?.getAttribute(`data-file-id`);r&&r!==e&&a.current?.contains(n??null)&&ie(e,O.current.indexOf(r))},onPointerUp:()=>C(null),onPointerCancel:()=>C(null),onKeyDown:n=>{(n.key===`ArrowUp`||n.key===`ArrowDown`)&&(n.preventDefault(),ie(e,t+(n.key===`ArrowUp`?-1:1)))},children:[(0,j.jsx)(`span`,{className:`font-medium text-[0.75rem] tabular-nums`,children:t+1}),(0,j.jsx)(Ma,{className:`size-4`})]}):null,i.startsWith(`image/`)?(0,j.jsx)(`img`,{src:xc(`${n}/assets/${e}`),alt:``,className:`size-14 rounded-lg object-cover`}):(0,j.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg bg-paper-2`,children:i.startsWith(`video/`)?(0,j.jsx)(wa,{className:`size-5 text-ink-3`}):(0,j.jsx)(oo,{className:`size-5 text-ink-3`})}),(0,j.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[0.875rem]`,children:r?.name??`✓`}),(0,j.jsx)(U,{label:_(`run.removeFile`),onClick:()=>re(e),children:(0,j.jsx)(Zo,{className:`size-4`})})]},e)})}):null,k?(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>o.current?.click(),className:V(oe,`min-w-[9rem] flex-1 px-4`,v&&`border-ember text-ink`),children:[w?(0,j.jsx)(Pa,{className:`size-6`}):(0,j.jsx)(oo,{className:`size-6`}),l?_(`run.uploading`):D.length?_(`run.uploadMore`):_(Pc?`run.uploadTouch`:`run.upload`)]}),E?(0,j.jsxs)(`button`,{type:`button`,onClick:()=>Fc?g(!0):s.current?.click(),className:V(oe,`w-28`),children:[(0,j.jsx)(qi,{className:`size-6`}),_(`run.camera`)]}):null,te&&!(Fc&&ul)?(0,j.jsxs)(`button`,{type:`button`,onClick:()=>c.current?.click(),className:V(oe,`w-28`),children:[(0,j.jsx)(qo,{className:`size-6`}),_(`camera.video`)]}):null]}):null,(0,j.jsx)(`input`,{ref:o,type:`file`,hidden:!0,multiple:T,accept:w?`image/*`:void 0,onChange:e=>{ne(Array.from(e.target.files??[])),e.target.value=``}}),(0,j.jsx)(`input`,{ref:s,type:`file`,hidden:!0,accept:`image/*`,capture:`environment`,onChange:e=>{ne(Array.from(e.target.files??[])),e.target.value=``}}),te?(0,j.jsx)(`input`,{ref:c,type:`file`,hidden:!0,accept:`video/*`,capture:`environment`,onChange:e=>{ne(Array.from(e.target.files??[])),e.target.value=``}}):null,(0,j.jsx)(dl,{open:h,multiple:T,video:te,onClose:()=>g(!1),onCapture:e=>ne([e]),onNative:()=>s.current?.click()}),T&&(e.min||e.max)?(0,j.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-ink-3 tabular-nums`,children:e.min&&D.length<e.min?_(`run.filesMin`,{n:D.length,min:e.min}):e.max?_(`run.filesOf`,{n:D.length,max:e.max}):null}):null,p?(0,j.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-rose`,children:p}):null]})}function ju(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 Mu({field:e,value:t,onChange:n}){let[r,i]=(0,A.useState)(!1);return(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(ts,{value:t,placeholder:e.placeholder,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>n(e.target.value)}),(0,j.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-[0.875rem] text-ink-2 transition hover:border-ember hover:text-ink`,children:[(0,j.jsx)(Co,{className:`size-4`}),` `,_(`scan.button`)]}),(0,j.jsx)(ql,{open:r,onClose:()=>i(!1),onResult:n})]})}var Nu=4;function Pu(e){let t=new Map,n=e.map(e=>({value:e,slot:f(e)})).filter(e=>e.slot).sort((e,t)=>Date.parse(e.value)-Date.parse(t.value));for(let{value:e,slot:r}of n){if(!r)continue;let n=t.get(r.day)??{label:x(e,h),times:[]};n.times.push({value:e,time:r.time}),t.set(r.day,n)}return[...t.values()]}function Fu({name:e,label:t,options:n,value:r,onChange:i,disabled:a}){let o=Pu(n),s=o.findIndex(e=>e.times.some(e=>e.value===r)),[c,l]=(0,A.useState)(s>=Nu);if(!o.length)return(0,j.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`slot.none`)});let u=c?o:o.slice(0,Nu);return(0,j.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,j.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,j.jsx)(`legend`,{className:`sr-only`,children:t}),u.map(t=>(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`mb-2 font-medium text-[0.75rem] text-ink-3`,children:t.label}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.times.map(n=>(0,j.jsxs)(`label`,{className:`relative`,children:[(0,j.jsx)(`input`,{type:`radio`,name:`slot-${e}`,value:n.value,checked:n.value===r,disabled:a.has(n.value),"aria-label":`${t.label}, ${n.time}`,onChange:()=>i(n.value),className:`peer sr-only`}),(0,j.jsx)(`span`,{className:V(`inline-flex h-10 cursor-pointer items-center rounded-full border px-4 text-sm tabular-nums transition coarse:h-11`,`border-input bg-card text-ink-2 hover:border-ink-4 hover:text-ink`,`peer-checked:border-ember peer-checked:bg-ember-tint peer-checked:text-ink`,`peer-disabled:pointer-events-none peer-disabled:line-through peer-disabled:opacity-60`,`peer-focus-visible:outline-[1.5px] peer-focus-visible:outline-offset-2 peer-focus-visible:outline-(--focus-line) peer-focus-visible:outline-solid`),children:n.time})]},n.value))})]},t.label))]}),o.length>u.length?(0,j.jsx)(`button`,{type:`button`,onClick:()=>l(!0),className:`self-start text-[0.8125rem] text-ink-3 underline-offset-4 transition hover:text-ink hover:underline coarse:min-h-11`,children:_(`slot.later`)}):null]})}function Iu({cards:e,value:t,multi:n,runId:r,onChange:i,disabled:a}){let o=new Set(n?Array.isArray(t)?t.map(String):[]:t==null||t===``?[]:[String(t)]),s=e=>{i(n?o.has(e)?[...o].filter(t=>t!==e):[...o,e]:o.has(e)?``:e)},c=e=>/^(https?:|data:|\/)/.test(e)?e:xc(`/api/runs/${r}/assets/${e}`);return(0,j.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr))`},children:e.map(e=>{let t=o.has(e.value),n=a.has(e.value);return(0,j.jsxs)(`div`,{className:V(`flex flex-col overflow-hidden rounded-xl bg-card ring-1 ring-border-soft transition`,t&&`ring-2 ring-ember`,n&&`opacity-50`),children:[e.image?(0,j.jsx)(`img`,{src:c(e.image),alt:``,className:`aspect-square w-full object-cover`}):null,(0,j.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1 p-3`,children:[(0,j.jsx)(`div`,{className:`font-medium text-[0.9375rem] leading-snug`,children:e.label}),e.subtitle?(0,j.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:e.subtitle}):null,e.meta?(0,j.jsx)(`div`,{className:`mt-auto pt-1 font-display font-semibold text-[0.9375rem] tabular-nums`,children:e.meta}):null,(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[(0,j.jsx)(`button`,{type:`button`,"aria-pressed":t,disabled:n,onClick:()=>s(e.value),className:V(`inline-flex h-9 flex-1 items-center justify-center rounded-full px-3 text-[0.8125rem] transition coarse:h-11`,t?`bg-ember text-ember-on`:`bg-paper-2 text-ink-2 hover:text-ink`),children:_(t?`cards.picked`:`cards.pick`)}),e.link?(0,j.jsx)(`a`,{href:e.link,target:`_blank`,rel:`noopener`,className:`inline-flex h-9 items-center rounded-full px-3 text-[0.8125rem] text-ink-2 ring-1 ring-border-soft hover:text-ink coarse:h-11`,children:_(`cards.open`)}):null]})]})]},e.value)})})}function Lu({field:e,value:t,values:n,runId:r,base:i,view:a,onChange:o,onBusy:s,error:c,closed:l}){let u=i??G(r),d=t==null?``:String(t),f=new Set(l?.values.map(String)),p;switch(e.kind){case`textarea`:p=(0,j.jsx)(rs,{value:d,placeholder:e.placeholder,autoCapitalize:`sentences`,enterKeyHint:`enter`,onChange:e=>o(e.target.value)});break;case`number`:p=(0,j.jsx)(ts,{inputMode:`decimal`,autoComplete:`off`,value:d,placeholder:e.placeholder,onChange:e=>o(e.target.value)});break;case`select`:{let n=e.options??[],i=a?.cards?.[e.id];p=i?.length?(0,j.jsx)(Iu,{cards:i,value:t,multi:!1,runId:r,onChange:o,disabled:f}):n.length<=5&&n.every(e=>e.length<=28)?(0,j.jsx)(as,{value:d,options:n,onChange:o,disabled:[...f],label:k}):(0,j.jsx)(is,{value:d,placeholder:`—`,onChange:o,options:n.map(e=>({value:e,label:k(e),disabled:f.has(e)}))});break}case`slot`:p=(0,j.jsx)(Fu,{name:e.id,label:e.label,options:e.options??[],value:d,onChange:o,disabled:f});break;case`multiselect`:{let n=a?.cards?.[e.id];p=n?.length?(0,j.jsx)(Iu,{cards:n,value:t,multi:!0,runId:r,onChange:o,disabled:f}):(0,j.jsx)(as,{multi:!0,value:Array.isArray(t)?t:[],options:e.options??[],onChange:o,label:k});break}case`date`:p=(0,j.jsx)(ts,{type:`date`,value:d,onChange:e=>o(e.target.value),className:`w-full sm:w-56`});break;case`email`:p=(0,j.jsx)(ts,{type:`email`,inputMode:`email`,autoComplete:`email`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:d,placeholder:e.placeholder,onChange:e=>o(e.target.value)});break;case`url`:p=(0,j.jsx)(ts,{type:`url`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:d,placeholder:e.placeholder??`https://`,onChange:e=>o(e.target.value)});break;case`toggle`:p=(0,j.jsx)(cs,{checked:t===!0,onChange:o,label:e.label,disabled:f.has(String(t!==!0))});break;case`color`:p=(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(ns,{value:d||`#e0531b`,onChange:e=>o(e.target.value)}),(0,j.jsx)(ts,{value:d,placeholder:`#e0531b`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>o(e.target.value),className:`w-36`})]});break;case`image`:case`file`:p=(0,j.jsx)(Au,{field:e,value:t,base:u,onChange:o,onBusy:s});break;case`items`:p=(0,j.jsx)(Ou,{field:e,value:t,values:n,onChange:o});break;case`connection`:p=(0,j.jsx)(pu,{runId:r,connection:a?.connections.find(t=>t.id===e.connection)});break;case`list`:{let t=a?.lists.find(t=>t.def.id===e.list);p=t?(0,j.jsx)(gu,{runId:r,list:t,editable:!0}):null;break}case`location`:p=(0,j.jsx)(Ul,{value:t,base:u,placeholder:e.placeholder,onChange:o,onBusy:s});break;case`audio`:p=l?null:(0,j.jsx)(Du,{value:t,base:u,onChange:o,onBusy:s});break;case`signature`:p=(0,j.jsx)(eu,{label:e.label,value:t,base:u,onChange:o});break;default:p=e.scan?(0,j.jsx)(Mu,{field:e,value:d,onChange:o}):(0,j.jsx)(ts,{...ju(e),value:d,placeholder:e.placeholder,onChange:e=>o(e.target.value)})}return(0,j.jsxs)(`div`,{children:[e.kind===`toggle`?(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-6`,children:[(0,j.jsx)(ls,{hint:e.help,children:e.label}),p]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(ls,{hint:e.help,required:e.required,children:e.label}),p]}),l?(0,j.jsx)(`div`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:_(`run.closed`,{list:l.classes.map(e=>_(`run.cls.${Ru(e)}`)).join(`, `)})}):null,c?(0,j.jsx)(`div`,{className:`mt-1.5 text-[0.8125rem] text-rose`,children:c}):null]})}function Ru(e){return e in zu?zu[e]:e===`account`?`account`:`text`}var zu={classifier:`text`,low:`text`,standard:`text`,high:`text`,image:`image`,video:`video`,speech:`speech`,audio:`audio`};function Bu(e,t){this.v=e,this.k=t}function Vu(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Hu(e){if(Array.isArray(e))return e}function Uu(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Wu(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{n,t as r}from"./jsx-runtime-BNakU3Ej.js";import{t as i}from"./preload-helper-DpV6A1kQ.js";import{G as a,J as o,M as s,W as c,Z as l,_ as u,_t as d,at as f,d as p,dt as m,f as h,ft as g,g as _,gt as v,h as y,ht as b,it as x,k as S,m as C,mt as w,n as T,p as ee,pt as E,rt as te,s as D,st as O,u as k}from"./i18n-0fUKyVRE.js";var A=t(n(),1),j=t(r(),1),ne=A.createContext(void 0),M=e=>{let t=A.useContext(ne);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},re=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,j.jsx)(ne.Provider,{value:e,children:t})),ie={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ae=new class{#e=ie;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 oe(e){setTimeout(e,0)}var se=typeof window>`u`||`Deno`in globalThis;function ce(){}function N(e,t){return typeof e==`function`?e(t):e}function le(e){return typeof e==`number`&&e>=0&&e!==1/0}function ue(e,t){return Math.max(e+(t||0)-Date.now(),0)}function P(e,t){return typeof e==`function`?e(t):e}function de(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==pe(o,t.options))return!1}else if(!he(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 fe(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(me(t.options.mutationKey)!==me(a))return!1}else if(!he(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function pe(e,t){return(t?.queryKeyHashFn||me)(e)}function me(e){return JSON.stringify(e,(e,t)=>ve(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function he(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(!he(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!he(e[r],t[r]))return!1;return!0}return!1}var ge=Object.prototype.hasOwnProperty;function F(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=I(e)&&I(t);if(!r&&!(ve(e)&&ve(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:ge.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=F(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function _e(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 I(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ve(e){if(!ye(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!(!ye(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function ye(e){return Object.prototype.toString.call(e)===`[object Object]`}function be(e){return new Promise(t=>{ae.setTimeout(t,e)})}function xe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:F(e,t)}function Se(e){return e}function Ce(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function we(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Te=Symbol();function Ee(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Te?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function De(e,t){return typeof e==`function`?e(...t):!!e}function Oe(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 ke=()=>se,Ae=()=>ke(),je=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(){}},Me=new class extends je{#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`}},Ne=oe;function Pe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ne,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 Fe=Pe(),Ie=new class extends je{#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 Le(e){return Math.min(1e3*2**e,3e4)}function Re(e){return(e??`online`)!==`online`||Ie.isOnline()}var ze=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Be(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(ce);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new ze(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Me.isFocused()&&(e.networkMode===`always`||Ie.isOnline())&&e.canRun(),p=()=>Re(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??(Ae()?0:3),a=e.retryDelay??Le,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),be(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 Ve=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),le(this.gcTime)&&(this.#e=ae.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ae()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(ae.clearTimeout(this.#e),this.#e=void 0)}};function He(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=>{Oe(e,()=>t.signal,()=>n=!0)},u=Ee(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?we:Ce;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?We:Ue,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:Ue(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 Ue(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 We(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ge(e,t){return t?Ue(e,t)!=null:!1}function Ke(e,t){return!t||!e.getPreviousPageParam?!1:We(e,t)!=null}var qe=class extends Ve{#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=Xe(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=Xe(this.options);e.data!==void 0&&(this.setState(Ye(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=xe(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(ce).catch(ce):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=>P(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Te||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>P(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:!ue(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=Ee(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`?He(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=Be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ze&&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 ze){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,...Je(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ye(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),Fe.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Je(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Re(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ye(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Xe(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 Ze=class extends je{#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),$e(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return et(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return et(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 P(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&&!_e(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&tt(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||P(this.options.enabled,this.#t)!==P(t.enabled,this.#t)||P(this.options.staleTime,this.#t)!==P(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||P(this.options.enabled,this.#t)!==P(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 _e(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(ce)),t}#h(e){return!Ae()&&P(this.options.enabled,this.#t)!==!1&&le(e)}#g(){this.#b();let e=P(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=ue(this.#r.dataUpdatedAt,e)+1;this.#u=ae.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return P(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=ae.setInterval(()=>{(this.options.refetchIntervalInBackground||Me.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(ae.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(ae.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&&$e(e,t),o=i&&tt(e,n,t,r);(a||o)&&(l={...l,...Je(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=xe(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=xe(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:nt(e,t),refetch:this.refetch,isEnabled:P(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),_e(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)})})();Fe.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 Qe(e,t){return P(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||P(t.retryOnMount,e)!==!1)}function $e(e,t){return Qe(e,t)||e.state.data!==void 0&&et(e,t,t.refetchOnMount)}function et(e,t,n){if(P(t.enabled,e)!==!1&&P(t.staleTime,e)!==`static`){let r=P(n,e);return r===`always`||r!==!1&&nt(e,t)}return!1}function tt(e,t,n,r){return(e!==t||P(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&nt(e,n)}function nt(e,t){return P(t.enabled,e)!==!1&&e.isStaleByTime(P(t.staleTime,e))}var rt=A.createContext(!1),it=()=>A.useContext(rt);rt.Provider;function at(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ot=A.createContext(at()),st=()=>A.useContext(ot),ct=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?De(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},lt=e=>{A.useEffect(()=>{e.clearReset()},[e])},L=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||De(n,[e.error,r])),ut=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))}},dt=(e,t)=>e?.suspense&&t.isPending,ft=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function pt(e,t,n){let r=it(),i=st(),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,ut(o),ct(o,i,s),lt(i);let[l]=A.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(A.useSyncExternalStore(A.useCallback(e=>{let t=d?l.subscribe(Fe.batchCalls(e)):ce;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),A.useEffect(()=>{l.setOptions(o)},[o,l]),dt(o,u))throw ft(o,l,i);if(L({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function mt(e,t){return pt(e,Ze,t)}var ht=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,gt=/^[\\/]{2}/;function _t(e,t){return t+e.replace(/\\/g,`/`)}var vt=`popstate`;function yt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function bt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return wt(``,{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:Tt(t)}return Dt(t,n,null,e)}function R(e,t){if(e===!1||e==null)throw Error(t)}function xt(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function St(){return Math.random().toString(36).substring(2,10)}function Ct(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 wt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Et(t):t,state:n,key:t&&t.key||r||St(),mask:i}}function Tt({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 Et(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 Dt(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=yt(e)?e:wt(h.location,e,t);n&&n(r,e),l=u()+1;let d=Ct(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=yt(e)?e:wt(h.location,e,t);n&&n(r,e),l=u();let i=Ct(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 Ot(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(vt,d),c=e,()=>{i.removeEventListener(vt,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 Ot(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),R(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Tt(t);return i=i.replace(/ $/,`%20`),!n&&gt.test(i)&&(i=r+i),new URL(i,r)}function kt(e,t,n=`/`){return At(e,t,n,!1)}function At(e,t,n,r,i){let a=Zt((typeof t==`string`?Et(t):t).pathname||`/`,n);if(a==null)return null;let o=i??jt(e),s=null,c=Xt(a);for(let e=0;s==null&&e<o.length;++e)s=Kt(o[e],c,r);return s}function jt(e){let t=Mt(e);return Pt(t),t}function Mt(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;R(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=on([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(R(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Mt(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:Wt(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Yt(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 Nt(e.path))a(e,t,!0,n)}),t}function Nt(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=Nt(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 Pt(e){e.sort((e,t)=>e.score===t.score?Gt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Ft=/^:[\w-]+$/,It=/^:[\w-]+/,Lt=3.5,Rt=3,zt=2,Bt=1,Vt=10,Ht=-2,Ut=e=>e===`*`;function Wt(e,t){let n=e.split(`/`),r=n.length;return n.some(Ut)&&(r+=Ht),t&&(r+=zt),n.filter(e=>!Ut(e)).reduce((e,t)=>e+(Ft.test(t)?Rt:It.test(t)?Lt:t===``?Bt:Vt),r)}function Gt(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 Kt(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?Jt(u,l,s.matcher,s.compiledParams):qt(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=qt({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:on([a,d.pathname]),pathnameBase:cn(on([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=on([a,d.pathnameBase]))}return o}function qt(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Yt(e.path,e.caseSensitive,e.end);return Jt(e,t,n,r)}function Jt(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=sn(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=sn(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 Yt(e,t=!1,n=!0){xt(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(/\/((?:[^/?()[\]*^\\]|\\.)+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Xt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return xt(!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 Zt(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 Qt(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Et(e):e,a;return n?(n=an(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?$t(n.substring(1),`/`):$t(n,t)):a=t,{pathname:a,search:ln(r),hash:un(i)}}function $t(e,t){let n=sn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function en(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 tn(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function nn(e){let t=tn(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function rn(e,t,n,r=!1){let i;typeof e==`string`?i=Et(e):(i={...e},R(!i.pathname||!i.pathname.includes(`?`),en(`?`,`pathname`,`search`,i)),R(!i.pathname||!i.pathname.includes(`#`),en(`#`,`pathname`,`hash`,i)),R(!i.search||!i.search.includes(`#`),en(`#`,`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=Qt(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var an=e=>e.replace(/[\\/]{2,}/g,`/`),on=e=>an(e.join(`/`));function sn(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 cn=e=>sn(e).replace(/^\/*/,`/`),ln=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,un=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,dn=class{status;statusText;data;error;internal;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 fn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function pn(e){return on(e.map(e=>e.route.path).filter(Boolean))||`/`}var mn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function hn(e,t){let n=e;if(typeof n!=`string`||!ht.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(mn)try{let e=new URL(window.location.href),r=gt.test(n)?new URL(_t(n,e.protocol)):new URL(n),a=Zt(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{xt(!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}}var gn=new URL(`http://localhost`);function _n(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),gn)}catch{return gn}}function vn(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function yn(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 bn(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&&!vn(i,n),s=!vn(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!yn(e,i)||!vn(i,a)))throw Error(`External navigation is not allowed`)}var xn=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(xn);var Sn=[`GET`,...xn];new Set(Sn);var Cn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function wn(e){try{return Cn.includes(new URL(e).protocol)}catch{return!1}}var Tn=A.createContext(null);Tn.displayName=`DataRouter`;var En=A.createContext(null);En.displayName=`DataRouterState`;var Dn=A.createContext(null);Dn.displayName=`DataRouterData`;var On=A.createContext(null);On.displayName=`DataRouterNavigation`;var kn=A.createContext(!1);function An(){return A.useContext(kn)}var jn=A.createContext({isTransitioning:!1});jn.displayName=`ViewTransition`;var Mn=A.createContext(null);Mn.displayName=`Fetchers`;var Nn=A.createContext(null);Nn.displayName=`Await`;var Pn=A.createContext(null);Pn.displayName=`Navigation`;var Fn=A.createContext(null);Fn.displayName=`Location`;var In=A.createContext({outlet:null,matches:[],isDataRoute:!1});In.displayName=`Route`;var Ln=A.createContext(!1);Ln.displayName=`IsDataRoute`;var Rn=A.createContext(void 0);Rn.displayName=`RouteId`;var zn=A.createContext(null);zn.displayName=`RouteError`;var Bn=`REACT_ROUTER_ERROR`,Vn=`REDIRECT`,Hn=`ROUTE_ERROR_RESPONSE`;function Un(e){if(e.startsWith(`${Bn}:${Vn}:{`))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 Wn(e){if(e.startsWith(`${Bn}:${Hn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new dn(t.status,t.statusText,t.data)}catch{}}function Gn(e,{relative:t}={}){R(Kn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=A.useContext(Pn),{hash:i,pathname:a,search:o}=Qn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:on([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Kn(){return A.useContext(Fn)!=null}function qn(){return R(Kn(),`useLocation() may be used only in the context of a <Router> component.`),A.useContext(Fn).location}var Jn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Yn(){return A.useContext(Ln)?mr():Xn()}function Xn(){R(Kn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=A.useContext(Tn),{basename:t,navigator:n}=A.useContext(Pn),{matches:r}=A.useContext(In),{pathname:i}=qn(),a=JSON.stringify(nn(r)),o=A.useRef(!1);return A.useLayoutEffect(()=>{o.current=!0}),A.useCallback((r,s={})=>{if(xt(o.current,Jn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=rn(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:on([t,c.pathname])),bn(typeof r==`string`?r:Tt(r),n.createHref(c),_n(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}A.createContext(null);function Zn(){let{matches:e}=A.useContext(In);return e[e.length-1]?.params??{}}function Qn(e,{relative:t}={}){let{matches:n}=A.useContext(In),{pathname:r}=qn(),i=JSON.stringify(nn(n));return A.useMemo(()=>rn(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function $n(e,t){return er(e,t)}function er(e,t,n){R(Kn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=A.useContext(Pn),{matches:i}=A.useContext(In),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=qn(),l;if(t){let e=typeof t==`string`?Et(t):t;R(s===`/`||e.pathname?.startsWith(s),`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 "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f;f=n?n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):n.router.match(n.state.location):kt(e,{pathname:d});let p=sr(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:on([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:on([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?A.createElement(Fn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function tr(){let e=pr(),t=fn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return A.createElement(A.Fragment,null,A.createElement(`h2`,null,`Unexpected Application Error!`),A.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?A.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var nr=A.createElement(tr,null),rr=class extends A.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=kn;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=Wn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:A.createElement(In.Provider,{value:this.props.routeContext},A.createElement(Ln.Provider,{value:this.props.routeContext.isDataRoute},A.createElement(Rn.Provider,{value:this.props.routeContext.matches[this.props.routeContext.matches.length-1]?.route.id},A.createElement(zn.Provider,{value:e,children:this.props.component}))));return this.context?A.createElement(ar,{error:e},t):t}},ir=new WeakMap;function ar({children:e,error:t}){let{basename:n,navigator:r}=A.useContext(Pn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Un(t.digest);if(e){let i=ir.get(t);if(i)throw i;let a=hn(e.location,n),o=a.absoluteURL||a.to;if(bn(e.location,o,_n(r),`allow-explicit`),wn(o))throw Error(`Invalid redirect location`);if(mn&&!ir.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 ir.set(t,n),n}}return A.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function or({routeContext:e,match:t,children:n}){let r=A.useContext(Tn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),A.createElement(In.Provider,{value:e},A.createElement(Ln.Provider,{value:e.isDataRoute},A.createElement(Rn.Provider,{value:t.route.id},n)))}function sr(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);R(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:pn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||nr,o&&(s<0&&c===0?(gr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?A.createElement(n.route.Component,null):n.route.element?n.route.element:e,A.createElement(or,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?A.createElement(rr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function cr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lr(e){let t=A.useContext(Tn);return R(t,cr(e)),t}function ur(e){let t=A.useContext(En);return R(t,cr(e)),t}function dr(e){let t=A.useContext(Dn);return R(t,cr(e)),t}function fr(e){let t=A.useContext(Rn);return R(t,`${e} can only be used on routes that contain a unique "id"`),t}function pr(){let e=A.useContext(zn),t=dr(`useRouteError`),n=fr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function mr(){let{router:e}=lr(`useNavigate`),t=fr(`useNavigate`),n=A.useRef(!1);return A.useLayoutEffect(()=>{n.current=!0}),A.useCallback(async(r,i={})=>{xt(n.current,Jn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var hr={};function gr(e,t,n){!t&&!hr[e]&&(hr[e]=!0,xt(!1,n))}function _r(e,t){if(e===!1||e==null)throw Error(t)}function vr(e,t,n){let r=typeof e==`string`?new URL(e,n??(typeof window>`u`?`server://singlefetch/`:window.location.origin)):new URL(e);return n&&r.origin!==n&&(r=new URL(r.pathname+r.search+r.hash,n)),r.pathname.endsWith(`/`)?r.pathname=`${r.pathname}_.${t}`:r.pathname=`${r.pathname}.${t}`,r}async function yr(e,t){if(e.id in t)return t[e.id];try{let n=await i(()=>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 br(e){return e!=null&&typeof e.page==`string`}function xr(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 Sr(e,t,n){return Dr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await yr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(xr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Cr(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 wr(e,t,{includeHydrateFallback:n}={}){return Tr(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 Tr(e){return[...new Set(e)]}function Er(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Dr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!br(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Er(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}var Or=A.createContext(void 0);Or.displayName=`FrameworkContext`;function kr(){let e=A.useContext(Or);return _r(e,`You must render this element inside a <HydratedRouter> element`),e}function Ar(e,t){let n=A.useContext(Or),[r,i]=A.useState(!1),[a,o]=A.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=A.useRef(null);A.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),A.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:jr(s,p),onBlur:jr(c,m),onMouseEnter:jr(l,p),onMouseLeave:jr(u,m),onTouchStart:jr(d,p)}]:[a,f,{}]:[!1,f,{}]}function jr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Mr({page:e,...t}){let n=An(),{nonce:r}=kr(),{router:i}=lr(`PrefetchPageLinks`),a=A.useMemo(()=>i.match(e),[i,i.routes,e]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?A.createElement(Pr,{page:e,matches:a,...t}):A.createElement(Fr,{page:e,matches:a,...t})):null}function Nr(e){let{manifest:t,routeModules:n}=kr(),[r,i]=A.useState([]);return A.useEffect(()=>{let r=!1;return Sr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Pr({page:e,matches:t,...n}){let r=qn(),{unstable_apiServerOrigin:i}=kr(),a=A.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=vr(e,`rsc`,i),a=!1,o=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?a=!0:o.push(e.route.id);return a&&o.length>0&&n.searchParams.set(`_routes`,o.join(`,`)),[i?n.toString():n.pathname+n.search]},[e,r,t,i]);return A.createElement(A.Fragment,null,a.map(e=>A.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Fr({page:e,matches:t,...n}){let r=qn(),{manifest:i,routeModules:a,unstable_apiServerOrigin:o}=kr(),{matches:s}=ur(`PrefetchPageLinks`),{loaderData:c}=dr(`PrefetchPageLinks`),l=A.useMemo(()=>Cr(e,t,s,i,r,`data`),[e,t,s,i,r]),u=A.useMemo(()=>Cr(e,t,s,i,r,`assets`),[e,t,s,i,r]),d=A.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!l.some(t=>t.route.id===e.route.id)&&e.route.id in c&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let u=vr(e,`data`,o);return s&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[o?u.toString():u.pathname+u.search]},[c,r,i,l,t,e,a,o]),f=A.useMemo(()=>wr(u,i),[u,i]),p=Nr(u);return A.createElement(A.Fragment,null,d.map(e=>A.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),f.map(e=>A.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),p.map(({key:e,link:t})=>A.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Ir(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}A.memo(Lr);function Lr({routes:e,manifest:t,state:n,isStatic:r,onError:i}){let a=A.useContext(Tn);R(a,`You must render this element inside a <DataRouterContext.Provider> element`);let o=A.useContext(Or)?.routeDiscoveryRuntime;return A.useEffect(()=>{n.initialized&&o?.markReady()},[n.initialized,o]),er(e,void 0,{router:a.router,manifest:t,state:n,isStatic:r,onError:i})}function Rr({to:e,replace:t,state:n,relative:r}){R(Kn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=A.useContext(Pn);xt(!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}=A.useContext(In),{pathname:s}=qn(),c=Yn(),l=rn(e,nn(o),s,r===`path`);bn(typeof e==`string`?e:Tt(e),a.createHref(l),_n(a),`reject`);let u=JSON.stringify(l);return A.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function zr(e){R(!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 Br({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){R(!Kn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=A.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Et(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=A.useMemo(()=>{let e=Zt(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return xt(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:A.createElement(Pn.Provider,{value:c},A.createElement(Fn.Provider,{children:t,value:h}))}function Vr({children:e,location:t}){return $n(Hr(e),t)}A.Component;function Hr(e,t=[]){let n=[];return A.Children.forEach(e,(e,r)=>{if(!A.isValidElement(e))return;let i=[...t,r];if(e.type===A.Fragment){n.push.apply(n,Hr(e.props.children,i));return}R(e.type===zr,`[${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>`);let a=e.props;R(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=Hr(a.children,i)),n.push(o)}),n}var Ur=`application/x-www-form-urlencoded`;function Wr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Gr(e){return Wr(e)&&e.tagName.toLowerCase()===`button`}function Kr(e){return Wr(e)&&e.tagName.toLowerCase()===`form`}function qr(e){return Wr(e)&&e.tagName.toLowerCase()===`input`}function Jr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Yr(e,t){return e.button===0&&(!t||t===`_self`)&&!Jr(e)}function Xr(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 Zr(e,t){let n=Xr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Qr=null;function $r(){if(Qr===null)try{new FormData(document.createElement(`form`),0),Qr=!1}catch{Qr=!0}return Qr}var ei=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ti(e){return e!=null&&!ei.has(e)?(xt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ur}"`),null):e}function ni(e,t){let n,r,i,a,o;if(Kr(e)){let o=e.getAttribute(`action`);r=o?Zt(o,t):null,n=e.getAttribute(`method`)||`get`,i=ti(e.getAttribute(`enctype`))||Ur,a=new FormData(e)}else if(Gr(e)||qr(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?Zt(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=ti(e.getAttribute(`formenctype`))||ti(o.getAttribute(`enctype`))||Ur,a=new FormData(o,e),!$r()){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(Wr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=Ur,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}var ri=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ri&&(window.__reactRouterVersion=`8`)}catch{}function ii({basename:e,children:t,useTransitions:n,window:r}){let i=A.useRef(null);i.current??=bt({window:r,v5Compat:!0});let a=i.current,[o,s]=A.useState({action:a.action,location:a.location}),c=A.useCallback(e=>{n===!1?s(e):A.startTransition(()=>s(e))},[n]);return A.useLayoutEffect(()=>a.listen(c),[a,c]),A.createElement(Br,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var ai=A.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:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=A.useContext(Pn),v=typeof l==`string`&&ht.test(l),y=hn(l,h);l=y.to;let b=Gn(l,{relative:r}),x=qn(),S=null;if(o){let e=rn(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:on([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Ar(n,p),ee=ci(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function E(t){e&&e(t),t.defaultPrevented||ee(t)}let te=!(y.isExternal||i),D=A.createElement(`a`,{...p,...T,href:(te?S:void 0)||y.absoluteURL||b,onClick:te?E:e,ref:Ir(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?A.createElement(A.Fragment,null,D,A.createElement(Mr,{page:b})):D});ai.displayName=`Link`;var oi=A.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=Qn(a,{relative:c.relative}),d=qn(),f=A.useContext(On),{navigator:p,basename:m}=A.useContext(Pn),h=f!=null&&mi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f?.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=Zt(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return A.createElement(ai,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});oi.displayName=`NavLink`;var si=A.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=A.useContext(Pn),g=fi(),_=pi(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&ht.test(s);return A.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?A.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});si.displayName=`Form`;function ci(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Yn(),d=qn(),f=Qn(e,{relative:o});return A.useCallback(p=>{if(Yr(p,t)){p.preventDefault();let t=n===void 0?Tt(d)===Tt(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?A.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function li(e){xt(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=A.useRef(Xr(e)),n=A.useRef(!1),r=qn(),i=A.useMemo(()=>Zr(r.search,n.current?null:t.current),[r.search]),a=Yn();return[i,A.useCallback((e,t)=>{let r=Xr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var ui=0,di=()=>`__${String(++ui)}__`;function fi(){let{router:e}=lr(`useSubmit`),{basename:t}=A.useContext(Pn),n=fr(`useSubmit`),r=e.fetch,i=e.navigate;return A.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=ni(e,t);a.navigate===!1?await r(a.fetcherKey||di(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,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 pi(e,{relative:t}={}){let{basename:n}=A.useContext(Pn),r=A.useContext(In);R(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Qn(e||`.`,{relative:t})},o=qn();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:on([n,a.pathname])),Tt(a)}function mi(e,{relative:t}={}){let n=A.useContext(jn);R(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=lr(`useViewTransitionState`),i=Qn(e,{relative:t});if(!n.isTransitioning)return!1;let a=Zt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Zt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return qt(i.pathname,o)!=null||qt(i.pathname,a)!=null}var hi=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function gi(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:hi(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var _i=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},vi=e=>{let t=_i(e);return t.charAt(0).toUpperCase()+t.slice(1)},yi=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),bi={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function xi(e){return e!=null}function Si(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??bi.width,a=e.size??e.height??bi.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?yi(...c):yi(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??bi[`stroke-width`])*Number(e.size??e.width??bi.width)/Number(t.size??t.width??bi.width):t.strokeWidth??bi[`stroke-width`];return[`svg`,{...Object.entries(bi).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&xi(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&xi(t.width)&&{[r(`width`)]:t.width},...`height`in t&&xi(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function Ci(e,t={}){return Si(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var wi=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ti=(0,A.createContext)({}),Ei=()=>(0,A.useContext)(Ti),Di=(0,A.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=Ei()??{},y=!!c||wi(d),[b,x,S=[]]=Ci(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:yi(v,s),hasA11yProp:y,attributes:d});return(0,A.createElement)(b,{ref:f,...x},[...S.map(([e,t])=>(0,A.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function z(e,t=[],n=[]){let r=typeof e==`string`?gi(e,t,n):e,i=(0,A.forwardRef)(({className:e,...t},n)=>(0,A.createElement)(Di,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=vi(r.name)),i}var Oi={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};Oi.node;var ki=z(Oi),Ai={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};Ai.node;var ji=z(Ai),Mi={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Mi.node;var Ni=z(Mi),Pi={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Pi.node;var Fi=z(Pi),Ii={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};Ii.node;var Li=z(Ii),Ri={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`}]]};Ri.node;var zi=z(Ri),Bi={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`}]]};Bi.node;var Vi=z(Bi),Hi={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};Hi.node;var Ui=z(Hi),Wi={name:`calendar-days`,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`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]};Wi.node;var Gi=z(Wi),Ki={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`}]]};Ki.node;var qi=z(Ki),Ji={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Ji.node;var B=z(Ji),Yi={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Yi.node;var Xi=z(Yi),Zi={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Zi.node;var Qi=z(Zi),$i={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};$i.node;var ea=z($i),ta={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};ta.node;var na=z(ta),ra={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};ra.node;var ia=z(ra),aa={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`}]]};aa.node;var oa=z(aa),sa={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`}]]};sa.node;var ca=z(sa),la={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};la.node;var ua=z(la),da={name:`ellipsis-vertical`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]],aliases:[`more-vertical`]};da.node;var fa=z(da),pa={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`}]]};pa.node;var ma=z(pa),ha={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};ha.node;var ga=z(ha),_a={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`]};_a.node;var va=z(_a),ya={name:`file-text`,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:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};ya.node;var ba=z(ya),xa={name:`file`,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`}]]};xa.node;var Sa=z(xa),Ca={name:`film`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]};Ca.node;var wa=z(Ca),Ta={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`}]]};Ta.node;var Ea=z(Ta),Da={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`}]]};Da.node;var Oa=z(Da),ka={name:`folder-input`,size:24,node:[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]};ka.node;var Aa=z(ka),ja={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`}]]};ja.node;var Ma=z(ja),Na={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`}]]};Na.node;var Pa=z(Na),Fa={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`}]]};Fa.node;var Ia=z(Fa),La={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};La.node;var Ra=z(La),za={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};za.node;var Ba=z(za),Va={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Va.node;var Ha=z(Va),Ua={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`}]]};Ua.node;var Wa=z(Ua),Ga={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`}]]};Ga.node;var Ka=z(Ga),qa={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`}]]};qa.node;var Ja=z(qa),Ya={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};Ya.node;var Xa=z(Ya),Za={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Za.node;var Qa=z(Za),$a={name:`mic`,size:24,node:[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]};$a.node;var eo=z($a),to={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};to.node;var no=z(to),ro={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`}]]};ro.node;var io=z(ro),ao={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};ao.node;var oo=z(ao),so={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`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`}]],aliases:[`edit-3`]};so.node;var co=z(so),lo={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`}]]};lo.node;var uo=z(lo),fo={name:`pencil`,size:24,node:[[`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`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};fo.node;var po=z(fo),mo={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};mo.node;var ho=z(mo),go={name:`printer`,size:24,node:[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]};go.node;var _o=z(go),vo={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};vo.node;var yo=z(vo),bo={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`}]]};bo.node;var xo=z(bo),So={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`}]]};So.node;var Co=z(So),wo={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};wo.node;var To=z(wo),Eo={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`}]]};Eo.node;var Do=z(Eo),Oo={name:`share`,size:24,node:[[`path`,{d:`M12 2v13`,key:`1km8f5`}],[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}]]};Oo.node;var ko=z(Oo),Ao={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`}]]};Ao.node;var jo=z(Ao),Mo={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};Mo.node;var No=z(Mo),Po={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};Po.node;var Fo=z(Po),Io={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`}]]};Io.node;var Lo=z(Io),Ro={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};Ro.node;var zo=z(Ro),Bo={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Bo.node;var Vo=z(Bo),Ho={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`]};Ho.node;var Uo=z(Ho),Wo={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`}]]};Wo.node;var Go=z(Wo),Ko={name:`video`,size:24,node:[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]};Ko.node;var qo=z(Ko),Jo={name:`wand-sparkles`,size:24,node:[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]],aliases:[`wand-2`]};Jo.node;var Yo=z(Jo),Xo={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Xo.node;var Zo=z(Xo);function V(...e){return e.filter(Boolean).join(` `)}var Qo={primary:`bg-primary text-primary-foreground hover:brightness-[1.06] active:brightness-95 shadow-[0_1px_0_oklch(0%_0_0/0.08)]`,secondary:`bg-card text-ink border border-border hover:bg-paper-2`,ghost:`text-ink-2 hover:text-ink hover:bg-accent`,quiet:`bg-paper-2 text-ink hover:bg-paper-3`,danger:`text-rose hover:bg-rose-tint`},H=(0,A.forwardRef)(function({variant:e=`primary`,size:t=`md`,busy:n,className:r,children:i,disabled:a,...o},s){return(0,j.jsxs)(`button`,{ref:s,type:`button`,"data-variant":e,disabled:a||n,className:V(`inline-flex select-none items-center justify-center gap-2 whitespace-nowrap rounded-full font-medium transition-[background,filter,color,transform] duration-150 active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50`,t===`sm`&&`h-8 px-3 text-[0.8125rem] coarse:h-11 coarse:px-4`,t===`md`&&`h-10 px-4 text-sm coarse:h-11`,t===`lg`&&`h-12 px-6 text-[0.9375rem]`,Qo[e],e===`primary`&&`wizard-button`,r),...o,children:[n?(0,j.jsx)(us,{className:`size-4`}):null,i]})});function U({label:e,className:t,children:n,...r}){return(0,j.jsx)(`button`,{type:`button`,"aria-label":e,title:e,className:V(`inline-flex size-9 shrink-0 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink disabled:opacity-40 coarse:size-11`,t),...r,children:n})}var $o=`wizard-field rounded-lg border border-input bg-card px-3.5 text-[0.9375rem] text-ink shadow-[inset_0_1px_0_oklch(0%_0_0/0.02)] outline-none transition placeholder:text-ink-4 focus:border-focus focus:ring-4 focus:ring-focus-glow disabled:opacity-60`;function es(e){return/(^|\s)w-/.test(e??``)?null:`w-full`}var ts=(0,A.forwardRef)(function({className:e,...t},n){return(0,j.jsx)(`input`,{ref:n,className:V($o,es(e),`h-11`,e),...t})});function ns(e){return(0,j.jsx)(`input`,{type:`color`,className:`swatch size-11 shrink-0 cursor-pointer rounded-lg border border-input bg-card p-1`,...e})}var rs=(0,A.forwardRef)(function({className:e,minRows:t=3,maxRows:n=14,onChange:r,...i},a){let o=(0,A.useRef)(null),s=()=>{let e=o.current;if(!e)return;let r=Number.parseFloat(getComputedStyle(e).lineHeight)||22;e.style.height=`auto`;let i=r*n+20;e.style.height=`${Math.min(Math.max(e.scrollHeight,r*t+20),i)}px`,e.style.overflowY=e.scrollHeight>i?`auto`:`hidden`};return(0,A.useLayoutEffect)(s),(0,j.jsx)(`textarea`,{ref:e=>{o.current=e,typeof a==`function`?a(e):a&&(a.current=e)},className:V($o,es(e),`resize-none py-2.5 leading-[1.5]`,e),onChange:e=>{s(),r?.(e)},...i})});function is({value:e,onChange:t,options:n,className:r,placeholder:i}){return(0,j.jsxs)(`div`,{className:V(`relative`,r),children:[(0,j.jsxs)(`select`,{value:e,onChange:e=>t(e.target.value),className:V($o,`h-11 w-full appearance-none pr-9`),children:[i===void 0?null:(0,j.jsx)(`option`,{value:``,children:i}),n.map(e=>(0,j.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))]}),(0,j.jsx)(`svg`,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 right-3 size-4 text-ink-3`,viewBox:`0 0 16 16`,fill:`none`,children:(0,j.jsx)(`path`,{d:`M4 6l4 4 4-4`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})})]})}function as({value:e,onChange:t,options:n,multi:r,disabled:i,label:a}){let o=new Set(Array.isArray(e)?e:e?[e]:[]);return(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.map(e=>{let s=o.has(e);return(0,j.jsx)(`button`,{type:`button`,"aria-pressed":s,disabled:i?.includes(e),onClick:()=>{if(r){let r=new Set(o);s?r.delete(e):r.add(e),t(n.filter(e=>r.has(e)))}else t(e)},className:V(`h-10 rounded-full border px-4 text-sm transition disabled:pointer-events-none disabled:opacity-60 disabled:line-through coarse:h-11`,s?`border-ember bg-ember-tint text-ink`:`border-input bg-card text-ink-2 hover:border-ink-4 hover:text-ink`),children:a?a(e):e},e)})})}var os=`cubic-bezier(0.3, 0.7, 0.2, 1)`;function ss({value:e,onChange:t,options:n,label:r}){let i=(0,A.useRef)(new Map),[a,o]=(0,A.useState)(null);return(0,A.useLayoutEffect)(()=>{let t=i.current.get(e);if(!t)return;let n=()=>o({x:t.offsetLeft,w:t.offsetWidth});n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[e]),(0,j.jsxs)(`div`,{role:`tablist`,"aria-label":r,className:`relative inline-flex items-center rounded-full bg-paper-2 p-0.5 ring-1 ring-border-soft`,children:[a?(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-0.5 bottom-0.5 left-0 rounded-full bg-card shadow-sm motion-reduce:transition-none`,style:{width:a.w,transform:`translateX(${a.x}px)`,transition:`transform 300ms ${os}, width 300ms ${os}`}}):null,n.map(n=>{let r=n.id===e;return(0,j.jsx)(`button`,{ref:e=>{e?i.current.set(n.id,e):i.current.delete(n.id)},type:`button`,role:`tab`,"aria-selected":r,onClick:()=>t(n.id),className:V(`relative h-8 whitespace-nowrap rounded-full px-4 font-medium text-[0.875rem] transition-colors motion-reduce:transition-none coarse:h-9`,r?`text-ink`:`text-ink-3 hover:text-ink-2`),children:n.label},n.id)})]})}function cs({checked:e,onChange:t,label:n,disabled:r}){return(0,j.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,disabled:r,onClick:()=>t(!e),className:V(`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition before:absolute before:-inset-x-1 before:-inset-y-2.5 before:content-[''] disabled:pointer-events-none disabled:opacity-60`,e?`bg-primary`:`bg-paper-3`),children:(0,j.jsx)(`span`,{className:V(`inline-block size-5 rounded-full bg-white shadow-sm transition-transform`,e?`translate-x-[22px]`:`translate-x-[2px]`)})})}function ls({children:e,hint:t,required:n}){return(0,j.jsxs)(`div`,{className:`mb-2`,children:[(0,j.jsxs)(`div`,{className:`font-medium text-[0.875rem] text-ink`,children:[e,n?(0,j.jsx)(`span`,{className:`ml-1 text-ember`,children:`*`}):null]}),t?(0,j.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:t}):null]})}function us({className:e}){return(0,j.jsxs)(`svg`,{className:V(`size-5 animate-spin`,e),viewBox:`0 0 24 24`,fill:`none`,children:[(0,j.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:`currentColor`,strokeOpacity:`0.2`,strokeWidth:`3`}),(0,j.jsx)(`path`,{d:`M21 12a9 9 0 0 0-9-9`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`})]})}function ds({className:e,children:t,...n}){return(0,j.jsx)(`div`,{className:V(`wizard-card rounded-xl bg-card shadow-soft ring-1 ring-border-soft`,e),...n,children:t})}function fs({children:e,tone:t=`neutral`,icon:n,title:r}){return(0,j.jsxs)(`span`,{title:r,className:V(`inline-flex h-6 items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 font-medium text-[0.75rem]`,t===`neutral`&&`bg-paper-2 text-ink-2`,t===`live`&&`bg-moss-tint text-moss`,t===`warn`&&`bg-amber-tint text-ink-2`,t===`ember`&&`bg-ember-tint text-ember-strong`),children:[n??(t===`live`?(0,j.jsx)(`span`,{className:`size-1.5 rounded-full bg-moss`}):null),e]})}function ps({open:e,onClose:t,title:n,children:r,wide:i,bare:a,height:o=`auto`}){let s=(0,A.useRef)(null);return(0,A.useEffect)(()=>{let t=s.current;t&&(e&&!t.open?(t.showModal(),t.querySelector(`[data-autofocus]`)?.focus()):!e&&t.open&&t.close())},[e]),(0,A.useEffect)(()=>{let t=s.current;if(!t||!e||a||o===`tall`)return;let n=0,r=()=>{n=Math.max(n,t.getBoundingClientRect().height),t.style.minHeight=`${Math.min(n,window.innerHeight-32)}px`},i=new ResizeObserver(r);return i.observe(t),window.addEventListener(`resize`,r),()=>{i.disconnect(),window.removeEventListener(`resize`,r),t.style.minHeight=``}},[e,a,o]),(0,j.jsx)(`dialog`,{ref:s,onClose:t,onClick:e=>{e.target===s.current&&t()},className:V(`m-auto p-0 text-ink backdrop:bg-[oklch(20%_0.01_60/0.28)] backdrop:backdrop-blur-[2px]`,`max-sm:m-0 max-sm:h-dvh max-sm:max-h-none max-sm:w-full max-sm:max-w-none`,a?`w-[calc(100%-48px)] overflow-visible bg-transparent`:`max-h-[calc(100dvh-32px)] w-[calc(100%-32px)] overflow-y-auto overscroll-contain rounded-2xl bg-card shadow-overlay max-sm:rounded-none max-sm:pt-[env(safe-area-inset-top)] max-sm:pb-[env(safe-area-inset-bottom)]`,i===`full`?`sm:max-w-7xl`:i===`page`?`sm:max-w-4xl`:i?`sm:max-w-2xl`:`sm:max-w-md`,!a&&o===`tall`&&`sm:h-[min(calc(100dvh-32px),56rem)]`),children:e&&a?r:e?(0,j.jsxs)(`div`,{className:`p-5 sm:p-7`,children:[n?(0,j.jsxs)(`div`,{className:`mb-5 flex items-start justify-between gap-3`,children:[(0,j.jsx)(`h2`,{className:`min-w-0 font-display font-semibold text-xl`,children:n}),(0,j.jsx)(U,{label:_(`common.close`),onClick:t,className:`-mt-1.5 -mr-2`,children:(0,j.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,className:`size-4`,"aria-hidden":`true`,children:(0,j.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})})})]}):null,r]}):null})}function ms({children:e}){return(0,j.jsx)(`div`,{className:`py-16 text-center text-ink-3`,children:e})}function hs({text:e}){return e.split(/(https?:\/\/[^\s)]+)/).map((e,t)=>t%2?(0,j.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`font-medium text-ink underline underline-offset-2`,children:new URL(e).host},e):e)}var gs=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(gs||{}),_s=[0,1],vs=[1,0],ys=[2,3],bs=[3,2],xs={L:_s,M:vs,Q:ys,H:bs},Ss=/^\d*$/,Cs=/^[A-Z0-9 $%*+./:-]*$/,ws=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,Ts=1,Es=40,Ds=3,Os=3,ks=40,As=10,js=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],Ms=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],Ns=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<Ts||e>Es)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,gs.Timing),this.setFunctionModule(e,6,e%2==0,gs.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,Fs(r,e));this.setFunctionModule(8,7,Fs(r,6)),this.setFunctionModule(8,8,Fs(r,7)),this.setFunctionModule(7,8,Fs(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,Fs(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,Fs(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,Fs(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=Fs(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,gs.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,gs.Alignment)}setFunctionModule(e,t,n,r=gs.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==Xs(t,n))throw RangeError(`Invalid argument`);let r=Ms[n[0]][t],i=js[n[0]][t],a=Math.floor(Ys(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=Zs(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=Qs(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(Ys(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=Fs(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=Ds:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*ks),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*ks}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=Ds:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*ks),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*ks}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=Os)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*As,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function Ps(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function Fs(e,t){return!!(e>>>t&1)}var Is=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},Ls=[1,10,12,14],Rs=[2,9,11,13],zs=[4,8,16,16];function Bs(e,t){return e[Math.floor((t+7)/17)+1]}function Vs(e){let t=[];for(let n of e)Ps(n,8,t);return new Is(zs,e.length,t)}function Hs(e){if(!Gs(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);Ps(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new Is(Ls,e.length,t)}function Us(e){if(!Ks(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=ws.indexOf(e.charAt(n))*45;r+=ws.indexOf(e.charAt(n+1)),Ps(r,11,t)}return n<e.length&&Ps(ws.indexOf(e.charAt(n)),6,t),new Is(Rs,e.length,t)}function Ws(e){return e===``?[]:Gs(e)?[Hs(e)]:Ks(e)?[Us(e)]:[Vs(Js(e))]}function Gs(e){return Ss.test(e)}function Ks(e){return Cs.test(e)}function qs(e,t){let n=0;for(let r of e){let e=Bs(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function Js(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function Ys(e){if(e<Ts||e>Es)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function Xs(e,t){return Math.floor(Ys(e)/8)-js[t[0]][e]*Ms[t[0]][e]}function Zs(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=$s(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=$s(n,2)}return t}function Qs(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=$s(t,e))}return n}function $s(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function ec(e,t,n=1,r=40,i=-1,a=!0){if(!(Ts<=n&&n<=r&&r<=Es)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=Xs(o,t)*8,i=qs(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[vs,ys,bs])a&&s<=Xs(o,e)*8&&(t=e);let c=[];for(let t of e){Ps(t.mode[0],4,c),Ps(t.numChars,Bs(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=Xs(o,t)*8;Ps(0,Math.min(4,l-c.length),c),Ps(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)Ps(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new Ns(o,t,u,i)}function tc(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?Ws(e):Array.isArray(e)?[Vs(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=ec(c,xs[n],i,a,o,r),u=nc({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function nc(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=gs.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function rc(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function ic(e,t={}){let n=tc(e,t),{pixelSize:r=10,whiteColor:i=`white`,blackColor:a=`black`}=t,o=n.size*r,s=n.size*r,c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${o}">`,l=[];for(let e=0;e<n.size;e++)for(let t=0;t<n.size;t++){let i=t*r,a=e*r;n.data[e][t]&&l.push(`M${i},${a}h${r}v${r}h-${r}z`)}return c+=`<rect fill="${rc(i)}" width="${s}" height="${o}"/>`,c+=`<path fill="${rc(a)}" d="${l.join(``)}"/>`,c+=`</svg>`,c}var ac=e=>`${e.slice(0,4)} ${e.slice(4)}`,oc=e=>ic(e,{ecc:`M`,border:2,pixelSize:8}),sc=e=>`${(e.trim()||`wizard`).replace(/[^\p{L}\p{N}]+/gu,`-`).toLowerCase()}-qr`;function cc(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}async function lc(e,t){let n=new Image,r=URL.createObjectURL(new Blob([e],{type:`image/svg+xml`}));try{n.src=r,await n.decode();let e=document.createElement(`canvas`);e.width=1024,e.height=1024;let i=e.getContext(`2d`);if(!i)return;i.imageSmoothingEnabled=!1,i.drawImage(n,0,0,1024,1024);let a=await new Promise(t=>e.toBlob(t,`image/png`));a&&cc(a,`${sc(t)}.png`)}finally{URL.revokeObjectURL(r)}}function uc(e,t){let n=window.open(``,`_blank`,`width=520,height=680`);if(!n)return;let r=n.document;r.title=t;let i=r.createElement(`style`);i.textContent=`body{margin:0;min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;font:600 28px system-ui,sans-serif}svg{width:12cm;height:12cm}`,r.head.append(i);let a=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement,o=r.createElement(`div`);o.textContent=t,r.body.append(r.importNode(a,!0),o),n.addEventListener(`afterprint`,()=>n.close()),n.focus(),n.print()}function dc({svg:e,label:t,className:n}){return(0,j.jsx)(`div`,{role:`img`,"aria-label":t,className:V(`overflow-hidden rounded-xl bg-white [&>svg]:size-full`,n),dangerouslySetInnerHTML:{__html:e}})}function fc({text:e,label:t,className:n}){let r=(0,A.useMemo)(()=>oc(e),[e]);return(0,j.jsx)(dc,{svg:r,label:t,className:V(`size-40 p-1`,n)})}var pc=class extends Error{status;body;constructor(e,t,n){super(e),this.status=t,this.body=n}};function mc(e){return e instanceof pc&&e.status===0}function hc(e){try{return JSON.parse(e)}catch{return{error:e}}}function gc(e,t={},n){async function r(r,i,a){let o=await fetch(e(i),{method:r,credentials:`include`,headers:{"accept-language":h,...t,...a!==void 0&&!(a instanceof FormData)?{"content-type":`application/json`}:{}},body:a===void 0?void 0:a instanceof FormData?a:JSON.stringify(a)}).catch(()=>{throw new pc(_(`common.offline`),0,null)}),s=await o.text(),c=s?hc(s):null;if(!o.ok)throw o.status>=500&&n?.(`${r} ${i} answered ${o.status}: ${c?.error??``}`),new pc(c?.error??c?.message??o.statusText,o.status,c);return c}return{get:e=>r(`GET`,e),post:(e,t)=>r(`POST`,e,t??{}),put:(e,t)=>r(`PUT`,e,t),patch:(e,t)=>r(`PATCH`,e,t),del:e=>r(`DELETE`,e),upload:(e,t)=>{let n=new FormData;return n.set(`file`,t),r(`POST`,e,n)}}}var _c={can:()=>!1,call:e=>Promise.reject(Error(`the app cannot ${e}`)),tell:()=>void 0,download:()=>!1},vc=null;function yc(e){vc=e,W=gc(e.withBase,e.headers,e.onServerError),y(e.lang)}function bc(){if(!vc)throw Error(`configureRunner() first`);return vc}var W=gc(e=>e),xc=e=>bc().withBase(e),Sc=e=>bc().asset(e),G=e=>bc().runBase(e),Cc=e=>(vc?.app??_c).can(e),wc=(e,t)=>(vc?.app??_c).call(e,t),Tc=(e,t)=>(vc?.app??_c).tell(e,t),Ec=(e,t,n)=>(vc?.app??_c).download(e,t,n),Dc=()=>vc?.standalone===!0,Oc=250;function kc({runId:e,driving:t,caption:n,action:r,hint:i,className:a,onBroken:o}){let s=(0,A.useRef)(null),c=(0,A.useRef)(null),[l,u]=(0,A.useState)(``),[d,f]=(0,A.useState)(!1),[p,m]=(0,A.useState)(null),h=async t=>{m(null);try{await W.post(`${G(e)}/browser/act`,t)}catch(e){m(e.message)}};return(0,A.useEffect)(()=>{t&&c.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[t]),(0,A.useEffect)(()=>{let n=s.current;if(!(n&&t))return;let r=0,i=null,a=t=>{t.preventDefault(),r+=t.deltaY,i??=setTimeout(()=>{i=null;let t=Math.max(-2e3,Math.min(2e3,Math.round(r)));r=0,t&&W.post(`${G(e)}/browser/act`,{type:`scroll`,dy:t}).catch(()=>void 0)},Oc)};return n.addEventListener(`wheel`,a,{passive:!1}),()=>{n.removeEventListener(`wheel`,a),i&&clearTimeout(i)}},[t,e]),(0,j.jsxs)(`div`,{className:a,children:[(0,j.jsxs)(`div`,{className:V(`relative aspect-[1280/900] w-full overflow-hidden rounded-xl bg-paper-2 ring-1`,t?`ring-2 ring-ember`:`ring-border-soft`),children:[(0,j.jsx)(`img`,{ref:s,src:xc(`${G(e)}/browser/live`),alt:``,draggable:!1,onClick:e=>{if(!t)return;let n=e.currentTarget.getBoundingClientRect();h({type:`click`,fx:Math.min(1,Math.max(0,(e.clientX-n.left)/n.width)),fy:Math.min(1,Math.max(0,(e.clientY-n.top)/n.height))})},onError:o,className:V(`size-full object-cover object-top`,t&&`cursor-pointer`)}),r?(0,j.jsx)(`div`,{className:`absolute top-2 right-2`,children:r}):null,n&&!t?(0,j.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 flex items-center gap-1.5 bg-gradient-to-t from-black/75 to-transparent px-3 pt-8 pb-2 text-[0.8125rem] text-white`,children:[(0,j.jsx)(no,{className:`size-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,children:n})]}):null]}),t?(0,j.jsxs)(`div`,{ref:c,className:`mt-1.5`,children:[i?(0,j.jsx)(`p`,{className:`mb-1.5 text-[0.8125rem] text-ink-3`,children:i}):null,(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 rounded-xl bg-card p-2 ring-1 ring-border-soft`,children:[(0,j.jsx)(ts,{type:d?`password`:`text`,autoComplete:`off`,value:l,placeholder:_(`ask.typeInto`),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),h({type:`type`,text:l}).then(()=>u(``)))},autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`send`,className:`h-9 min-w-[9rem] flex-1 basis-full text-[0.8125rem] sm:basis-0 coarse:h-11`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>f(e=>!e),className:V(`h-9 shrink-0 rounded-md px-2.5 text-[0.75rem] coarse:h-11 coarse:px-3.5`,d?`bg-ember-veil text-ink`:`text-ink-3 hover:bg-paper-2`),children:_(`ask.hide`)}),(0,j.jsx)(Ac,{label:`Enter`,onClick:()=>void h({type:`key`,key:`Enter`}),children:(0,j.jsx)(oa,{className:`size-4`})}),(0,j.jsx)(Ac,{label:_(`ask.up`),onClick:()=>void h({type:`scroll`,dy:-500}),children:(0,j.jsx)(Fi,{className:`size-4`})}),(0,j.jsx)(Ac,{label:_(`ask.down`),onClick:()=>void h({type:`scroll`,dy:500}),children:(0,j.jsx)(ki,{className:`size-4`})})]}),p?(0,j.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-rose`,children:p}):null]}):null]})}function Ac({label:e,onClick:t,children:n}){return(0,j.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})}function jc({runId:e,ask:t}){return t.kind===`confirm`?(0,j.jsx)(Mc,{runId:e,ask:t}):(0,j.jsx)(Nc,{runId:e,ask:t})}function Mc({runId:e,ask:t}){let[n,r]=(0,A.useState)(!1),[i,a]=(0,A.useState)(!1),[o,s]=(0,A.useState)(null),c=async n=>{a(!0),s(null);try{await W.post(`${G(e)}/ask/${t.id}`,n)}catch(e){s(e.message),a(!1)}},l=t.action.destructive?Uo:uo;return(0,j.jsxs)(`div`,{className:`animate-rise`,children:[(0,j.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,j.jsx)(`div`,{className:V(`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,j.jsx)(l,{className:`size-5`})}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:_(`ask.wants`,{service:t.service})}),(0,j.jsx)(`h2`,{className:`wizard-heading font-display font-semibold text-[1.25rem] leading-snug tracking-tight`,children:t.reason})]})]}),(0,j.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-paper-2 p-4 text-[0.8125rem] leading-relaxed ring-1 ring-border-soft`,children:t.input}),t.once?null:(0,j.jsxs)(`div`,{className:`mt-5 flex items-center gap-4`,children:[(0,j.jsx)(cs,{checked:n,onChange:r,label:_(`ask.allowRest`)}),(0,j.jsx)(`span`,{className:`flex-1 text-[0.8125rem] text-ink-2`,children:_(`ask.allowRest`)})]}),o?(0,j.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:o}):null,(0,j.jsxs)(`div`,{className:`action-bar mt-6 flex items-center justify-between gap-3`,children:[(0,j.jsx)(H,{variant:`ghost`,disabled:i,onClick:()=>void c({type:`skip`}),children:_(`ask.deny`)}),(0,j.jsx)(H,{busy:i,onClick:()=>void c({type:`done`,remember:n}),children:_(`ask.allow`)})]})]})}function Nc({runId:e,ask:t}){let[n,r]=(0,A.useState)({}),[i,a]=(0,A.useState)(!1),[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(null),u=async n=>{s(!0),l(null);try{await W.post(`${G(e)}/ask/${t.id}`,n)}catch(e){l(e.message),s(!1)}},d=t.fields.some(e=>n[e.id]);return(0,j.jsxs)(`div`,{className:`animate-rise`,children:[(0,j.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,j.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-ember-tint text-ember-strong`,children:(0,j.jsx)(Ka,{className:`size-5`})}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`h2`,{className:`wizard-heading font-display font-semibold text-[1.25rem] leading-snug tracking-tight`,children:t.reason}),(0,j.jsxs)(`p`,{className:`mt-0.5 truncate text-[0.8125rem] text-ink-3`,children:[t.site.host,t.site.title?` · ${t.site.title}`:``]})]})]}),(0,j.jsx)(kc,{runId:e,driving:!0}),(0,j.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-4`,children:_(`ask.pictureHint`)}),t.fields.length?(0,j.jsxs)(`form`,{className:`mt-5 flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),u({type:`fill`,values:n,remember:i})},children:[t.fields.map((e,i)=>(0,j.jsxs)(`div`,{children:[(0,j.jsx)(ls,{children:e.label}),(0,j.jsx)(ts,{autoFocus:i===0,type:e.secret?`password`:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:i===t.fields.length-1?`go`:`next`,value:n[e.id]??``,onChange:t=>r(n=>({...n,[e.id]:t.target.value}))})]},e.id)),(0,j.jsx)(`button`,{type:`submit`,hidden:!0})]}):null,(0,j.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-4`,children:[(0,j.jsx)(cs,{checked:i,onChange:a,label:_(`ask.remember`)}),(0,j.jsx)(`span`,{className:`flex-1 text-[0.8125rem] text-ink-2`,children:_(`ask.remember`)})]}),(0,j.jsxs)(`p`,{className:`mt-3 flex items-start gap-2 text-[0.8125rem] text-ink-3`,children:[(0,j.jsx)(jo,{className:`mt-0.5 size-4 shrink-0 text-moss`}),` `,_(`ask.private`)]}),c?(0,j.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:c}):null,(0,j.jsxs)(`div`,{className:`action-bar mt-6 flex flex-wrap items-center justify-between gap-3`,children:[(0,j.jsx)(H,{variant:`ghost`,disabled:o,onClick:()=>void u({type:`skip`}),children:_(`ask.skip`)}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.fields.length?(0,j.jsx)(H,{variant:`secondary`,disabled:o,onClick:()=>void u({type:`done`,remember:i}),children:_(`ask.done`)}):null,t.fields.length?(0,j.jsx)(H,{busy:o,disabled:!d,onClick:()=>void u({type:`fill`,values:n,remember:i}),children:_(`ask.signIn`)}):(0,j.jsx)(H,{busy:o,onClick:()=>void u({type:`done`,remember:i}),children:_(`ask.done`)})]})]})]})}var Pc=typeof window<`u`&&window.matchMedia?.(`(pointer: coarse)`).matches===!0,Fc=typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia;function Ic(){(0,A.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=()=>{let e=document.activeElement;t.classList.contains(`keyboard-open`)&&e instanceof HTMLElement&&e!==document.body&&requestAnimationFrame(()=>e.scrollIntoView({block:`nearest`}))},r=()=>{let r=e.scale>1.01?0:window.innerHeight-e.height-e.offsetTop,i=r>80,a=i&&!t.classList.contains(`keyboard-open`);t.style.setProperty(`--kb`,i?`${Math.round(r)}px`:`0px`),t.classList.toggle(`keyboard-open`,i),a&&n()};return r(),e.addEventListener(`resize`,r),e.addEventListener(`scroll`,r),document.addEventListener(`focusin`,n),()=>{e.removeEventListener(`resize`,r),e.removeEventListener(`scroll`,r),document.removeEventListener(`focusin`,n),t.style.removeProperty(`--kb`),t.classList.remove(`keyboard-open`)}},[])}function Lc(e){let[t,n]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{if(e&&Cc(`keepAwake`))return Tc(`keepAwake`,!0),n(!0),()=>{Tc(`keepAwake`,!1),n(!1)};if(!e||!(`wakeLock`in navigator))return;let t=null,r=!1,i=async()=>{if(!(r||t||document.visibilityState!==`visible`))try{let e=await navigator.wakeLock.request(`screen`);if(r){e.release().catch(()=>void 0);return}t=e,n(!0),e.addEventListener(`release`,()=>{t===e&&(t=null,n(!1))})}catch{}};return i(),document.addEventListener(`visibilitychange`,i),()=>{r=!0,document.removeEventListener(`visibilitychange`,i),t?.release().catch(()=>void 0),t=null,n(!1)}},[e]),t}var Rc=`wz.notify`,zc=new Set,Bc=null;function Vc(){try{return localStorage.getItem(Rc)===`1`}catch{return!1}}function Hc(e){try{e?localStorage.setItem(Rc,`1`):localStorage.removeItem(Rc)}catch{}for(let e of zc)e()}var Uc=typeof window<`u`&&`Notification`in window,Wc=null;function Gc(){return Vc()?Cc(`notify`)?Wc===!1?`quiet`:`on`:Uc&&Notification.permission===`granted`?`on`:`quiet`:`off`}function Kc(){return(0,A.useSyncExternalStore)(e=>(zc.add(e),()=>zc.delete(e)),Gc,()=>`off`)}function qc(){return Cc(`notify`)?Wc===!1:Uc&&Notification.permission===`denied`}async function Jc(){if(Hc(!0),Cc(`notify`)){Wc=!Cc(`notifyPermission`)||await wc(`notifyPermission`).catch(()=>!1);for(let e of zc)e();return Gc()}try{Bc??=new AudioContext,Bc.resume()}catch{Bc=null}if(Uc&&Notification.permission==="default")try{await Notification.requestPermission()}catch{}if(Uc&&Notification.permission===`granted`){let e=bc().serviceWorker;e&&await navigator.serviceWorker?.register(e).catch(()=>void 0)}for(let e of zc)e();return Gc()}function Yc(){Hc(!1)}function Xc(){let e=Bc;if(e?.state!==`running`)return;let t=e.currentTime;for(let[n,r]of[660,880].entries()){let i=e.createOscillator(),a=e.createGain();i.frequency.value=r,a.gain.setValueAtTime(0,t+n*.16),a.gain.linearRampToValueAtTime(.18,t+n*.16+.02),a.gain.exponentialRampToValueAtTime(.001,t+n*.16+.32),i.connect(a).connect(e.destination),i.start(t+n*.16),i.stop(t+n*.16+.34)}}async function Zc(e){if(!Vc())return;if(Cc(`notify`)){Tc(`notify`,e);return}if(document.visibilityState===`visible`){Xc(),navigator.vibrate?.([120,60,120]);return}if(!Uc||Notification.permission!==`granted`)return;let t={body:e.body,tag:e.tag,icon:Sc(`icons/icon-192.png`),badge:Sc(`icons/icon-192.png`),data:{url:location.href}};try{let n=await navigator.serviceWorker?.getRegistration();if(n?.active){await n.showNotification(e.title,t);return}}catch{}try{new Notification(e.title,t)}catch{}}function Qc(){if(typeof navigator>`u`||!navigator.canShare)return!1;try{return navigator.canShare({files:[new File([`x`],`x.pdf`,{type:`application/pdf`})]})}catch{return!1}}async function $c(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 el(){return new Date().toISOString().slice(0,19).replace(/[:T]/g,`-`)}function tl(e){let t=e?.name;return t===`NotFoundError`||t===`OverconstrainedError`?`missing`:t===`NotReadableError`||t===`AbortError`?`busy`:`denied`}function nl(e){return!!e?.getCapabilities?.()?.torch}function rl(e,t,n=!1){let r=(0,A.useRef)(null),[i,a]=(0,A.useState)(null),[o,s]=(0,A.useState)(null),[c,l]=(0,A.useState)(1),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(!1);return(0,A.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(nl(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(tl(e))),()=>{i=!0;for(let e of r?.getTracks()??[])e.stop()}},[e,t,n]),(0,A.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 il({open:e,onClose:t,label:n,children:r}){let i=(0,A.useRef)(null);return(0,A.useEffect)(()=>{let t=i.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),(0,j.jsx)(`dialog`,{ref:i,onClose:t,"aria-label":n,className:`media-sheet`,children:e?(0,j.jsx)(`div`,{className:`flex h-full flex-col`,children:r}):null})}function al({label:e,onClick:t,active:n,children:r}){return(0,j.jsx)(`button`,{type:`button`,"aria-label":e,title:e,"aria-pressed":n,onClick:t,className:V(`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 ol({title:e,onClose:t,camera:n,onFlip:r}){return(0,j.jsx)(`div`,{className:`safe-top`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,j.jsx)(al,{label:_(`common.close`),onClick:t,children:(0,j.jsx)(Zo,{className:`size-5`})}),(0,j.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-center font-medium text-[0.9375rem]`,children:e}),n.torchable?(0,j.jsx)(al,{label:_(`camera.torch`),active:n.torch,onClick:()=>void n.setTorch(!n.torch),children:n.torch?(0,j.jsx)(Oa,{className:`size-5`}):(0,j.jsx)(Ea,{className:`size-5`})}):null,n.stream&&(n.cameras>1||Pc)?(0,j.jsx)(al,{label:_(`camera.flip`),onClick:r,children:(0,j.jsx)(Lo,{className:`size-5`})}):(0,j.jsx)(`span`,{className:`size-11`})]})})}function sl({camera:e,asking:t,children:n,actions:r}){return(0,j.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[(0,j.jsx)(`video`,{ref:e.video,autoPlay:!0,playsInline:!0,muted:!0,className:V(`absolute inset-0 size-full object-contain`,e.mirrored&&`-scale-x-100`)}),e.error?(0,j.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-5 bg-black px-8 text-center`,children:[(0,j.jsx)(`p`,{className:`max-w-sm text-[0.9375rem] text-white/85 leading-relaxed`,children:_(`camera.${e.error}`)}),r]}):e.stream?n:(0,j.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-4 px-8 text-center text-white/75`,children:[(0,j.jsx)(us,{}),(0,j.jsx)(`p`,{className:`max-w-xs text-[0.875rem] leading-relaxed`,children:t})]})]})}var cl=30;function ll(){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 ul=!!ll();function dl({open:e,multiple:t,video:n,onClose:r,onCapture:i,onNative:a}){let[o,s]=(0,A.useState)(`environment`),[c,l]=(0,A.useState)(`photo`),[u,d]=(0,A.useState)(0),[f,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(null),g=(0,A.useRef)(null),v=rl(e,o,c===`video`);(0,A.useEffect)(()=>{e&&(d(0),l(`photo`),h(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-${el()}.jpg`,{type:`image/jpeg`}))},x=()=>{g.current?.state===`recording`&&g.current.stop()},S=()=>{let e=ll();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=()=>{h(null),g.current=null;let n=e.split(`;`)[0];if(t.length){let e=n===`video/mp4`?`mp4`:`webm`;y(new File(t,`video-${el()}.${e}`,{type:n}))}},g.current=n,n.start(1e3),h(0)};(0,A.useEffect)(()=>{if(m===null)return;if(m>=cl){g.current?.state===`recording`&&g.current.stop();return}let e=setTimeout(()=>h(e=>e===null?null:e+1),1e3);return()=>clearTimeout(e)},[m]),(0,A.useEffect)(()=>{!e&&g.current&&(g.current.onstop=null,g.current.stop(),g.current=null)},[e]);let C=e=>`0:${String(e).padStart(2,`0`)}`;return(0,j.jsxs)(il,{open:e,onClose:r,label:_(`camera.title`),children:[(0,j.jsx)(ol,{title:m===null?u?_(`camera.taken`,{n:u}):_(`camera.title`):`${C(m)} / ${C(cl)}`,onClose:r,camera:v,onFlip:()=>s(e=>e===`environment`?`user`:`environment`)}),(0,j.jsx)(sl,{camera:v,asking:_(`camera.asking`),actions:(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,j.jsxs)(fl,{onClick:()=>{r(),a()},children:[(0,j.jsx)(qi,{className:`size-4`}),` `,_(Pc?`camera.native`:`camera.pick`)]}):null,(0,j.jsx)(fl,{quiet:!0,onClick:r,children:_(`common.close`)})]})}),(0,j.jsxs)(`div`,{className:V(`safe-bottom px-4 pt-3`,v.error&&`invisible`),children:[n&&ul&&m===null?(0,j.jsx)(`div`,{className:`mb-3 flex justify-center gap-1 text-[0.8125rem]`,children:[`photo`,`video`].map(e=>(0,j.jsx)(`button`,{type:`button`,"aria-pressed":c===e,onClick:()=>l(e),className:V(`h-9 rounded-full px-4 font-medium transition`,c===e?`bg-white text-black`:`text-white/70 hover:text-white`),children:_(e===`photo`?`camera.photo`:`camera.video`)},e))}):null,(0,j.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_1fr] items-center gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[0.8125rem] text-white/70 leading-snug`,children:m===null?c===`video`?_(`camera.clipHint`,{s:cl}):_(t?`camera.hintMany`:`camera.hint`):_(`camera.recording`)}),(0,j.jsx)(`button`,{type:`button`,"aria-label":_(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,j.jsx)(us,{className:`text-white`}):c===`photo`?(0,j.jsx)(`span`,{className:`size-[54px] rounded-full bg-white`}):m===null?(0,j.jsx)(`span`,{className:`flex size-[54px] items-center justify-center rounded-full bg-[#e5484d]`,children:(0,j.jsx)(qo,{className:`size-6 text-white`})}):(0,j.jsx)(`span`,{className:`size-7 rounded-md bg-[#e5484d]`})}),(0,j.jsx)(`div`,{className:`flex justify-end`,children:t&&u&&m===null?(0,j.jsxs)(fl,{onClick:r,children:[(0,j.jsx)(B,{className:`size-4`}),` `,_(`camera.done`)]}):null})]})]})]})}function fl({onClick:e,quiet:t,children:n}){return(0,j.jsx)(`button`,{type:`button`,onClick:e,className:V(`inline-flex h-11 items-center justify-center gap-2 rounded-full px-5 font-medium text-[0.875rem] transition`,t?`text-white/75 hover:text-white`:`bg-white text-black hover:bg-white/90`),children:n})}var pl=`w-full min-w-0 rounded-md bg-transparent px-2 py-1.5 text-[0.875rem] outline-none transition placeholder:text-ink-4 hover:bg-accent focus:bg-paper focus:ring-1 focus:ring-ring`,ml=`font-medium text-[0.6875rem] text-ink-3 uppercase tracking-[0.08em]`,hl=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function gl(e,t,n){if(!t.length)return n;let[r,...i]=t;if(Array.isArray(e)){let t=[...e];return t[r]=gl(t[r],i,n),t}let a=e??{};return{...a,[r]:gl(a[r],i,n)}}function _l(e,t){let n=e?.length?e:[...new Set(t.filter(hl).flatMap(e=>Object.keys(e)))];return{kind:`object`,fields:Object.fromEntries(n.map(e=>[e,{kind:`text`}]))}}var vl=e=>e.kind!==`object`&&e.kind!==`table`&&(e.kind!==`list`||e.of.kind!==`object`)&&!(e.kind===`text`&&e.long),yl=e=>Object.values(e.fields).every(vl),bl=e=>Object.values(e.fields).every(e=>e.kind!==`table`&&(e.kind!==`list`||e.of.kind!==`object`));function xl(e,t){let n=b(e);return n?String(t[n]??``):``}function Sl({text:e}){return(0,j.jsx)(`span`,{className:`whitespace-pre-wrap`,children:e})}function Cl({shape:e,value:t,path:n,ctx:r,cell:i}){switch(e.kind){case`text`:return r.edit?e.long?(0,j.jsx)(`textarea`,{className:V(pl,`field-sizing-content max-h-60 resize-none`),value:String(t??``),onChange:e=>r.set(n,e.target.value)}):(0,j.jsx)(`input`,{className:pl,value:String(t??``),onChange:e=>r.set(n,e.target.value)}):(0,j.jsx)(Sl,{text:t==null?``:String(t)});case`number`:return r.edit?(0,j.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`input`,{type:`number`,className:V(pl,`text-right tabular-nums`,i&&`w-20`),value:t==null?``:Number(t),onChange:e=>r.set(n,e.target.value===``?null:Number(e.target.value))}),e.unit?(0,j.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:e.unit}):null]}):(0,j.jsx)(`span`,{className:`tabular-nums`,children:t==null?``:`${t}${e.unit?` ${e.unit}`:``}`});case`yesno`:{let i=t?e.yes??_(`data.yes`):e.no??_(`data.no`);return r.edit?(0,j.jsxs)(`label`,{className:`flex items-center gap-2 px-2 py-1.5 text-[0.8125rem] text-ink-2`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:!!t,onChange:e=>r.set(n,e.target.checked),className:`size-4 accent-[var(--second)]`}),i]}):(0,j.jsx)(`span`,{className:V(`inline-flex rounded-full px-2 py-0.5 text-[0.75rem]`,t?`bg-second-tint text-second`:`bg-paper-2 text-ink-3`),children:i})}case`choice`:case`score`:return r.edit?(0,j.jsx)(`select`,{className:pl,value:String(t??``),onChange:e=>r.set(n,e.target.value),children:[...new Set([String(t??``),...e.options])].map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))}):(0,j.jsx)(`span`,{children:String(t??``)});case`ref`:{let i=r.shape.fields[e.to],a=i?.kind===`list`&&i.of.kind===`object`?i.of:{kind:`object`,fields:{}},o=(Array.isArray(r.root[e.to])?r.root[e.to]:[]).filter(hl),s=o.find(e=>e.id===t);return r.edit?(0,j.jsxs)(`select`,{className:pl,value:String(t??``),onChange:e=>r.set(n,e.target.value),children:[s?null:(0,j.jsx)(`option`,{value:String(t??``),children:String(t??``)}),o.map(e=>(0,j.jsx)(`option`,{value:String(e.id),children:xl(a,e)||String(e.id)},String(e.id)))]}):s?(0,j.jsxs)(`button`,{type:`button`,onClick:()=>r.open(String(s.id)),className:`inline-flex items-center gap-1 text-left text-ember-strong hover:underline`,children:[(0,j.jsx)(Ha,{className:`size-3.5 shrink-0`}),xl(a,s)||String(s.id)]}):(0,j.jsx)(`span`,{className:`text-rose`,children:_(`data.missing`,{id:String(t??``)})})}case`table`:{let i=Array.isArray(t)?t:[];return(0,j.jsx)(Dl,{shape:_l(e.columns,i),value:i,path:n,ctx:r})}case`list`:if(e.of.kind===`object`){let i=e.of,a=yl(i)?Dl:bl(i)?Ol:kl;return(0,j.jsx)(a,{shape:i,value:t,path:n,ctx:r})}return(0,j.jsx)(wl,{value:t,path:n,ctx:r});case`object`:return(0,j.jsx)(Al,{shape:e,value:t,path:n,ctx:r})}}function wl({value:e,path:t,ctx:n}){let r=Array.isArray(e)?e.map(String):[],[i,a]=(0,A.useState)(``);return(0,j.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1`,children:[r.map((e,i)=>(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-paper-2 px-2 py-0.5 text-[0.75rem]`,children:[e,n.edit?(0,j.jsx)(`button`,{type:`button`,"aria-label":_(`data.remove`),onClick:()=>n.set(t,r.filter((e,t)=>t!==i)),className:`text-ink-3 hover:text-ink`,children:(0,j.jsx)(Zo,{className:`size-3`})}):null]},`${e}-${i}`)),n.edit?(0,j.jsx)(`input`,{className:`w-20 rounded-full bg-transparent px-2 py-0.5 text-[0.75rem] outline-none ring-1 ring-border-soft focus:ring-ring`,placeholder:`+`,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i.trim()&&(e.preventDefault(),n.set(t,[...r,i.trim()]),a(``))}}):null]})}var Tl=e=>(Array.isArray(e)?e:[]).filter(hl),El=e=>e.fields.id?{id:`n${Date.now().toString(36)}`}:{};function Dl({shape:e,value:t,path:n,ctx:r}){let i=Tl(t),a=Object.entries(e.fields);return(0,j.jsxs)(`div`,{className:`overflow-x-auto rounded-lg ring-1 ring-border-soft`,children:[(0,j.jsxs)(`table`,{className:`w-full border-collapse text-[0.8125rem]`,children:[(0,j.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,j.jsxs)(`tr`,{children:[a.map(([e,t])=>(0,j.jsx)(`th`,{className:`whitespace-nowrap px-3 py-2 text-left font-medium`,children:E(e,t)},e)),r.edit?(0,j.jsx)(`th`,{className:`w-8`}):null]})}),(0,j.jsx)(`tbody`,{children:i.map((e,t)=>(0,j.jsxs)(`tr`,{className:`group border-border-soft border-t`,children:[a.map(([i,a])=>(0,j.jsx)(`td`,{className:V(`align-top`,r.edit?`p-0.5`:`px-3 py-2`),children:(0,j.jsx)(Cl,{shape:a,value:e[i],path:[...n,t,i],ctx:r,cell:!0})},i)),r.edit?(0,j.jsx)(`td`,{className:`p-0.5 align-middle`,children:(0,j.jsx)(Ml,{onClick:()=>r.set(n,i.filter((e,n)=>n!==t))})}):null]},t))})]}),r.edit?(0,j.jsx)(Nl,{what:e.label,onClick:()=>r.set(n,[...i,El(e)])}):null]})}function Ol({shape:e,value:t,path:n,ctx:r}){let i=Tl(t),a=Object.entries(e.fields),o=a.filter(([,e])=>e.kind===`text`&&e.long),s=a.filter(([,e])=>!(e.kind===`text`&&e.long));return(0,j.jsxs)(`div`,{className:`overflow-hidden rounded-lg ring-1 ring-border-soft`,children:[(0,j.jsx)(`ol`,{children:i.map((e,t)=>(0,j.jsxs)(`li`,{className:`grid grid-cols-[1.75rem_1fr_auto] items-start gap-2 border-border-soft border-t px-3 py-2 first:border-0`,children:[(0,j.jsx)(`span`,{className:`pt-1.5 font-display font-semibold text-ember-strong tabular-nums`,children:t+1}),(0,j.jsx)(`div`,{className:V(`flex min-w-0 flex-col`,!r.edit&&`pt-1`),children:o.map(([i,a])=>(0,j.jsx)(Cl,{shape:a,value:e[i],path:[...n,t,i],ctx:r},i))}),(0,j.jsxs)(`div`,{className:V(`flex items-center gap-2 text-[0.8125rem] text-ink-3`,!r.edit&&`pt-1`),children:[s.map(([i,a])=>(0,j.jsx)(Cl,{shape:a,value:e[i],path:[...n,t,i],ctx:r,cell:!0},i)),r.edit?(0,j.jsx)(Ml,{onClick:()=>r.set(n,i.filter((e,n)=>n!==t))}):null]})]},t))}),r.edit?(0,j.jsx)(Nl,{what:e.label,onClick:()=>r.set(n,[...i,El(e)])}):null]})}function kl({shape:e,value:t,path:n,ctx:r}){let i=Tl(t),a=Object.entries(e.fields),o=b(e),s=a.filter(([e,t])=>e!==o&&e!==`id`&&(t.kind===`text`&&!t.long||t.kind===`number`||t.kind===`choice`)),c=a.filter(([,e])=>e.kind===`list`&&e.of.kind===`object`);return(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.map((t,a)=>{let o=typeof t.id==`string`?t.id:void 0;return(0,j.jsxs)(`details`,{id:o?`${r.scope}-${o}`:void 0,className:`group rounded-xl bg-card ring-1 ring-border-soft open:ring-ink-4/40`,children:[(0,j.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-3 px-4 py-3 [&::-webkit-details-marker]:hidden`,children:[(0,j.jsx)(ea,{className:`size-4 shrink-0 text-ink-3 transition-transform group-open:rotate-90`}),(0,j.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate font-medium text-[0.9375rem]`,children:xl(e,t)||`${e.label??``} ${a+1}`.trim()}),(0,j.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[0.75rem] text-ink-3`,children:[s.map(([e,n])=>t[e]===void 0||t[e]===``?null:(0,j.jsx)(`span`,{children:n.kind===`number`&&n.unit?`${t[e]} ${n.unit}`:String(t[e])},e)),c.map(([e,n])=>(0,j.jsxs)(`span`,{children:[Array.isArray(t[e])?t[e].length:0,` `,E(e,n)]},e))]})]}),r.edit?(0,j.jsx)(Ml,{onClick:()=>r.set(n,i.filter((e,t)=>t!==a))}):null]}),(0,j.jsx)(`div`,{className:`border-border-soft border-t px-4 py-4`,children:(0,j.jsx)(Al,{shape:e,value:t,path:[...n,a],ctx:r})})]},a)}),r.edit?(0,j.jsx)(Nl,{what:e.label,onClick:()=>r.set(n,[...i,El(e)])}):null]})}function Al({shape:e,value:t,path:n,ctx:r}){let i=hl(t)?t:{},a=e=>e.kind===`list`||e.kind===`object`||e.kind===`table`||e.kind===`text`&&!!e.long;return(0,j.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-x-4 gap-y-4`,children:Object.entries(e.fields).map(([e,t])=>(0,j.jsx)(jl,{title:E(e,t),wide:a(t),count:Array.isArray(i[e])?i[e].length:null,children:(0,j.jsx)(Cl,{shape:t,value:i[e],path:[...n,e],ctx:r})},e))})}function jl({title:e,wide:t,count:n,children:r}){return(0,j.jsxs)(`div`,{className:V(`flex min-w-0 flex-col gap-1.5 text-[0.875rem]`,t&&`col-span-full`),children:[(0,j.jsxs)(`span`,{className:ml,children:[e,n===null?null:(0,j.jsx)(`span`,{className:`ml-1 text-ink-4`,children:n})]}),r]})}function Ml({onClick:e}){return(0,j.jsx)(`button`,{type:`button`,"aria-label":_(`data.remove`),onClick:t=>{t.preventDefault(),e()},className:`grid size-7 place-items-center rounded-md text-ink-3 hover:bg-accent hover:text-rose`,children:(0,j.jsx)(Vo,{className:`size-3.5`})})}function Nl({what:e,onClick:t}){return(0,j.jsxs)(`button`,{type:`button`,onClick:t,className:`flex w-full items-center gap-1.5 border-border-soft border-t px-3 py-2 text-[0.8125rem] text-ink-3 hover:bg-accent hover:text-ink`,children:[(0,j.jsx)(ho,{className:`size-3.5`}),` `,_(`data.add`,{what:e??``}).trim()]})}function Pl({shape:e,value:t,onChange:n,mode:r,onMode:i,modes:a=[`view`,`edit`,`json`],start:o}){let s=n?a:a.filter(e=>e!==`edit`),[c,l]=(0,A.useState)(o&&s.includes(o)?o:s[0]??`view`),u=r??c,d=i??l,f=(0,A.useId)().replace(/[^a-zA-Z0-9_-]/g,``),p={root:t,shape:e,edit:u===`edit`&&!!n,scope:f,set:(e,r)=>n?.(gl(t,e,r)),open:e=>{let t=document.getElementById(`${f}-${e}`);t&&(t.open=!0,t.scrollIntoView({behavior:`smooth`,block:`center`}))}},m=Object.entries(e.fields);return(0,j.jsxs)(`div`,{className:`flex flex-col`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-border-soft border-b px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1`,children:m.length>1?m.map(([e,n])=>(0,j.jsxs)(`a`,{href:`#${f}-part-${e}`,className:`rounded-full px-2.5 py-1 text-[0.8125rem] text-ink-2 hover:bg-accent`,children:[E(e,n),Array.isArray(t[e])?(0,j.jsx)(`span`,{className:`ml-1 text-ink-4 tabular-nums`,children:t[e].length}):null]},e)):null}),s.length>1?(0,j.jsx)(ss,{value:u,onChange:d,label:_(`data.modes`),options:s.map(e=>({id:e,label:_(`data.${e}`)}))}):null]}),u===`json`?(0,j.jsx)(`pre`,{className:`max-h-[36rem] overflow-auto p-4 font-mono text-[0.75rem] text-ink-2 leading-relaxed`,children:JSON.stringify(t,null,2)}):(0,j.jsx)(`div`,{className:`flex flex-col gap-7 p-4 sm:p-5`,children:m.map(([e,n])=>(0,j.jsxs)(`section`,{id:`${f}-part-${e}`,className:`flex scroll-mt-4 flex-col gap-2`,children:[(0,j.jsxs)(`h3`,{className:`flex items-baseline gap-2 font-display font-semibold text-[1rem]`,children:[E(e,n),Array.isArray(t[e])?(0,j.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-4 tabular-nums`,children:t[e].length}):null]}),(0,j.jsx)(`div`,{className:`text-[0.9375rem] leading-relaxed`,children:(0,j.jsx)(Cl,{shape:n,value:t[e],path:[e],ctx:p})})]},e))})]})}function Fl({items:e}){let[t,n]=(0,A.useState)(!1),r=(0,A.useRef)(null);return(0,A.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)},i=e=>e.key===`Escape`&&n(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,i)}},[t]),(0,j.jsxs)(`div`,{ref:r,className:`relative`,children:[(0,j.jsx)(`button`,{type:`button`,"aria-label":_(`data.menu`),title:_(`data.menu`),"aria-haspopup":`menu`,"aria-expanded":t,onClick:()=>n(e=>!e),className:V(`grid size-8 place-items-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink coarse:size-11`,t&&`bg-accent text-ink`),children:(0,j.jsx)(fa,{className:`size-4`})}),t?(0,j.jsx)(`div`,{role:`menu`,className:`absolute top-full right-0 z-50 mt-1 w-60 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:e.map(e=>(0,j.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 transition hover:bg-accent hover:text-ink`,onClick:()=>{n(!1),e.onClick()},children:[e.icon,e.label]},e.label))}):null]})}function Il(e){return e.toLowerCase().replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`output`}function Ll({shape:e,title:t,open:n,onClose:r}){let[i,a]=(0,A.useState)(!1),o=n?JSON.stringify(w(e,t),null,2):``;return(0,j.jsx)(ps,{open:n,onClose:r,title:`${_(`data.schema`)} · ${t}`,wide:!0,height:`tall`,children:(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,j.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto rounded-lg bg-paper-2 p-3 font-mono text-[0.75rem] text-ink-2 leading-relaxed`,children:o}),(0,j.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(o),a(!0),setTimeout(()=>a(!1),1500)},className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 hover:text-ink coarse:h-11 coarse:px-4`,children:[i?(0,j.jsx)(B,{className:`size-3.5`}):(0,j.jsx)(ia,{className:`size-3.5`}),_(i?`share.copied`:`data.copy`)]}),(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{let e=URL.createObjectURL(new Blob([o],{type:`application/schema+json`})),n=document.createElement(`a`);n.href=e,n.download=`${Il(t)}.schema.json`,n.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 hover:text-ink coarse:h-11 coarse:px-4`,children:[(0,j.jsx)(ua,{className:`size-3.5`}),` `,_(`data.download`)]})]})]})})}function Rl(e){let t=e;return t.type===`agent`&&t.output.format===`json`&&!t.each&&!t.call}function zl({runId:e,step:t,output:n,header:r,children:i}){let a=O(t),[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(null),g=u??(hl(n.json)?n.json:{}),v=async()=>{if(u){p(!0),h(null);try{await W.put(`${G(e)}/outputs/${t.id}`,{json:u}),d(null),s(!1)}catch(e){h(e.message)}finally{p(!1)}}},y=(0,j.jsx)(Fl,{items:[{label:_(o?`data.close`:`data.open`),icon:(0,j.jsx)(ca,{className:`size-4 shrink-0`}),onClick:()=>{s(e=>!e),d(null)}},{label:_(`data.schema`),icon:(0,j.jsx)(Ui,{className:`size-4 shrink-0`}),onClick:()=>l(!0)}]});return(0,j.jsxs)(j.Fragment,{children:[r(y),o?(0,j.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-card ring-1 ring-border-soft`,children:[(0,j.jsx)(Pl,{shape:a,value:g,onChange:d}),u?(0,j.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-border-soft border-t px-3 py-2`,children:[m?(0,j.jsx)(`span`,{className:`mr-auto text-[0.8125rem] text-rose`,children:m}):null,(0,j.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>d(null),children:_(`common.cancel`)}),(0,j.jsx)(H,{size:`sm`,busy:f,onClick:()=>void v(),children:_(`data.save`)})]}):null]}):i,(0,j.jsx)(Ll,{shape:a,title:t.title,open:c,onClose:()=>l(!1)})]})}var Bl=25,Vl=9e3;function Hl(e){return e.code===e.PERMISSION_DENIED?`denied`:e.code===e.TIMEOUT?`timeout`:`unavailable`}function Ul({value:e,base:t,placeholder:n,onChange:r,onBusy:i}){let a=o(e)?e:null,[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(null),d=(0,A.useRef)(null),f=(0,A.useRef)(!!a?.label),p=(0,A.useRef)(a);p.current=a;let m=a?.lat!==void 0&&a.lng!==void 0,g=typeof navigator<`u`&&`geolocation`in navigator,v=()=>{d.current!==null&&(navigator.geolocation.clearWatch(d.current),d.current=null),c(!1),i?.(!1)};(0,A.useEffect)(()=>()=>{d.current!==null&&navigator.geolocation.clearWatch(d.current)},[]);let y=async(e,n)=>{try{let{label:i}=await W.post(`${t}/geocode`,{lat:e,lng:n,language:h}),a=p.current;i&&!f.current&&a?.lat===e&&a.lng===n&&r({...a,label:i})}catch{}},b=()=>{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<=Bl||Date.now()-e>Vl){v();let e=p.current;e?.lat!==void 0&&e.lng!==void 0&&y(e.lat,e.lng)}},e=>{v(),t===1/0&&u(Hl(e))},{enableHighAccuracy:!0,timeout:15e3,maximumAge:1e4})},x=e=>{f.current=e.trim().length>0;let t={...m?a:{},label:e};r(m||e.trim()?t:void 0)};return(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[m?(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,j.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,j.jsx)(Ja,{className:`size-5`})}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`truncate font-medium text-[0.9375rem] tabular-nums`,children:[a.lat?.toFixed(5),`, `,a.lng?.toFixed(5)]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 text-[0.8125rem] text-ink-3`,children:[(0,j.jsx)(`span`,{children:s?_(`location.refining`):a.accuracy?_(`location.accuracy`,{m:a.accuracy}):null}),(0,j.jsxs)(`a`,{href:`https://www.openstreetmap.org/?mlat=${a.lat}&mlon=${a.lng}#map=17/${a.lat}/${a.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:[_(`location.map`),` `,(0,j.jsx)(ga,{className:`size-3`})]})]})]}),(0,j.jsx)(U,{label:_(`location.remove`),onClick:()=>{v(),f.current=!1,r(void 0)},children:(0,j.jsx)(Zo,{className:`size-4`})})]}):g?(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(H,{variant:`secondary`,size:`lg`,busy:s,onClick:b,className:`w-full sm:w-auto`,children:[s?null:(0,j.jsx)(Wa,{className:`size-4`}),_(s?`location.locating`:`location.use`)]}),l?(0,j.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[0.8125rem] text-ink-2 leading-relaxed`,children:_(`location.${l}`)}):(0,j.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3 leading-relaxed`,children:_(`location.why`)})]}):null,(0,j.jsx)(ts,{value:a?.label??``,placeholder:n??_(m?`location.label`:`location.manual`),autoComplete:`street-address`,enterKeyHint:`done`,"aria-label":_(`location.manual`),onChange:e=>x(e.target.value)})]})}var Wl=null;function Gl(){return Wl??=(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 i(async()=>{let{default:e}=await import(`./qr-scanner.min-BGqShvxG.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}}}})(),Wl}function Kl({open:e,onClose:t,onResult:n}){let r=(0,A.useRef)(n);r.current=n;let i=(0,A.useRef)(t);return i.current=t,(0,A.useEffect)(()=>{e&&wc(`scan`).then(e=>{e&&r.current(e)}).catch(()=>void 0).finally(()=>i.current())},[e]),null}function ql(e){return Cc(`scan`)?(0,j.jsx)(Kl,{...e}):(0,j.jsx)(Jl,{...e})}function Jl({open:e,onClose:t,onResult:n}){let[r,i]=(0,A.useState)(`environment`),[a,o]=(0,A.useState)(!1),[s,c]=(0,A.useState)(!1),l=(0,A.useRef)(null),u=rl(e,r),d=(0,A.useRef)(n);d.current=n;let f=(0,A.useRef)(t);f.current=t,(0,A.useEffect)(()=>{e&&(c(!1),Gl().then(e=>o(e.qrOnly)))},[e]),(0,A.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 Gl()).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 Gl()).detect(r).catch(()=>null):null;i?(n(i),t()):c(!0)};return(0,j.jsxs)(il,{open:e,onClose:t,label:_(`scan.title`),children:[(0,j.jsx)(ol,{title:_(`scan.title`),onClose:t,camera:u,onFlip:()=>i(e=>e===`environment`?`user`:`environment`)}),(0,j.jsx)(sl,{camera:u,asking:_(`scan.asking`),actions:(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,j.jsxs)(fl,{onClick:()=>l.current?.click(),children:[(0,j.jsx)(Ia,{className:`size-4`}),` `,_(`scan.fromPhoto`)]}),(0,j.jsx)(fl,{quiet:!0,onClick:t,children:_(`scan.typeInstead`)})]}),children:(0,j.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,j.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,j.jsxs)(`div`,{className:`safe-bottom flex flex-col items-center gap-3 px-5 pt-3 text-center`,children:[(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-white/75 leading-snug`,children:_(s?`scan.miss`:a?`scan.hintQr`:`scan.hint`)}),u.stream?(0,j.jsxs)(fl,{quiet:!0,onClick:()=>l.current?.click(),children:[(0,j.jsx)(Ia,{className:`size-4`}),` `,_(`scan.fromPhoto`)]}):null]}),(0,j.jsx)(`input`,{ref:l,type:`file`,hidden:!0,accept:`image/*`,onChange:e=>{p(e.target.files?.[0]),e.target.value=``}})]})}var Yl=`#1d1a17`,Xl={width:1200,height:480};function Zl(e,t,n,r,i){e.lineCap=`round`,e.lineJoin=`round`,e.strokeStyle=Yl,e.fillStyle=Yl,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 Ql({strokes:e,onStrokes:t}){let n=(0,A.useRef)(null),r=(0,A.useRef)(null),i=(0,A.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),Zl(t,r.current?[...i.current,r.current]:i.current,o,s,2.4*a)};(0,A.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,j.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl bg-white ring-1 ring-input`,children:[(0,j.jsx)(`canvas`,{ref:n,"aria-label":_(`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,j.jsx)(`div`,{className:`pointer-events-none absolute inset-x-6 bottom-[22%] border-[#1d1a17]/25 border-b`}),e.length?null:(0,j.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center text-[#1d1a17]/40 text-[0.875rem]`,children:_(`sign.hint`)})]})}async function $l(e){let t=document.createElement(`canvas`);t.width=Xl.width,t.height=Xl.height;let n=t.getContext(`2d`);if(!n)return null;Zl(n,e,Xl.width,Xl.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 eu({label:e,value:t,base:n,onChange:r}){let[i,a]=(0,A.useState)(!1),[o,s]=(0,A.useState)([]),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(null),f=typeof t==`string`&&t?t:null,p=async()=>{l(!0),d(null);try{let e=await $l(o);if(!e)return;r((await W.upload(`${n}/uploads`,e)).id),a(!1)}catch(e){d(e.message)}finally{l(!1)}};return(0,j.jsxs)(`div`,{children:[f?(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:()=>{s([]),a(!0)},className:`min-w-0 flex-1 rounded-lg bg-white px-3`,"aria-label":_(`sign.again`),children:(0,j.jsx)(`img`,{src:xc(`${n}/assets/${f}`),alt:e,className:`mx-auto h-20 object-contain`})}),(0,j.jsx)(U,{label:_(`sign.remove`),onClick:()=>r(void 0),children:(0,j.jsx)(Zo,{className:`size-4`})})]}):(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{s([]),a(!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-[0.875rem] text-ink-3 transition hover:border-ember hover:text-ink`,children:[(0,j.jsx)(co,{className:`size-6`}),_(`sign.open`)]}),(0,j.jsxs)(ps,{open:i,onClose:()=>a(!1),title:e,wide:!0,children:[(0,j.jsx)(Ql,{strokes:o,onStrokes:s}),u?(0,j.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:u}):null,(0,j.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-3`,children:[(0,j.jsxs)(H,{variant:`ghost`,disabled:!o.length||c,onClick:()=>s([]),children:[(0,j.jsx)(ma,{className:`size-4`}),` `,_(`sign.clear`)]}),(0,j.jsx)(H,{busy:c,disabled:!o.length,onClick:()=>void p(),children:_(`sign.accept`)})]})]})]})}var tu=36e5,nu=6e4,ru=1e3;function iu(e){return e.fractionDigits===void 0?e.style===`integer`?0:2:e.fractionDigits}function au(e,t,n=`en`){if(typeof e!=`number`||!Number.isFinite(e))return``;let r=iu(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 ou(e,t,n=`en`){if(typeof e!=`string`||e.length===0)return``;if(t.kind===`time`)return su(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 su(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 cu(e,t){if(typeof e!=`number`||!Number.isFinite(e))return``;let n=Math.max(0,Math.round(e));if(t.display===`iso`)return lu(n);if(t.display===`minutes`)return`${Math.round(n/nu)} min`;if(t.display===`hours`)return`${(n/tu).toFixed(2)} h`;if(t.display===`decimal-hours`)return(n/tu).toFixed(2);let r=Math.floor(n/tu),i=Math.floor(n%tu/nu),a=Math.floor(n%nu/ru);return`${r}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}function lu(e){let t=Math.floor(e/tu),n=Math.floor(e%tu/nu),r=Math.floor(e%nu/ru);return`${t>=24?`P${Math.floor(t/24)}D`:`P`}T${t%24}H${n}M${r}S`}function uu(e,t,n=`en`){if(t==null)return``;switch(e.type){case`number`:return au(t,e.format,n);case`date`:return ou(t,e.format,n);case`duration`:return cu(t,e.format);case`boolean`:return t===!0?`true`:t===!1?`false`:``;case`select`:return du(e,t);default:return String(t)}}function du(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(`, `)}function fu({runId:e,connectionId:t,connector:n,onCancel:r}){let[i,a]=(0,A.useState)({}),[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(null),u=async()=>{s(!0),l(null);try{await W.post(`${G(e)}/connections/${t}/credentials/${n.id}`,{values:i})}catch(e){l(e.message)}finally{s(!1)}};return(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-card p-4 ring-1 ring-input`,children:[(n.fields??[]).map(e=>(0,j.jsxs)(`div`,{children:[(0,j.jsx)(ls,{children:e.label}),(0,j.jsx)(ts,{type:e.secret?`password`:`text`,autoComplete:`off`,value:i[e.key]??``,placeholder:e.placeholder,onChange:t=>a(n=>({...n,[e.key]:t.target.value})),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u())}})]},e.key)),n.hint?(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:n.hint}):null,c?(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:c}):null,(0,j.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,j.jsx)(H,{variant:`ghost`,size:`sm`,onClick:r,children:_(`common.cancel`)}),(0,j.jsx)(H,{size:`sm`,busy:o,onClick:()=>void u(),children:_(`connect.go`)})]})]})}function pu({runId:e,connection:t}){let[n,r]=(0,A.useState)(null),[i,a]=(0,A.useState)(null),[o,s]=(0,A.useState)(null);if(!t)return null;if(t.account){let n=t.connectors.find(e=>e.id===t.account?.connector)?.name??``;return(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,j.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,j.jsx)(B,{className:`size-5`})}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium text-[0.9375rem]`,children:t.account.label}),(0,j.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:_(`connect.connected`,{name:n})})]}),(0,j.jsx)(U,{label:_(`connect.disconnect`),onClick:()=>void W.del(`${G(e)}/connections/${t.id}`),children:(0,j.jsx)(Go,{className:`size-4`})})]})}let c=async n=>{if(s(null),a(null),Cc(`signIn`)){try{let{url:r}=await W.post(`${G(e)}/connections/${t.id}/oauth/${n.id}`);await wc(`signIn`,{url:r})}catch(e){s(e.message)}return}let r=window.open(`about:blank`,`wizard-connect`,`width=540,height=700`);try{let{url:i}=await W.post(`${G(e)}/connections/${t.id}/oauth/${n.id}`);r?r.location.replace(i):a(i)}catch(e){r?.close(),s(e.message)}},l=t.connectors.find(e=>e.id===n);return t.connectors.length?(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.connectors.map(e=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>e.auth===`oauth2`?void c(e):r(n===e.id?null:e.id),className:V(`inline-flex h-11 items-center gap-2 rounded-full px-4 font-medium text-[0.875rem] 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,j.jsx)(Ha,{className:`size-4`}),` `,e.name]},e.id))}),l?(0,j.jsx)(fu,{runId:e,connectionId:t.id,connector:l,onCancel:()=>r(null)}):null,i?(0,j.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:`text-[0.875rem] text-ember underline`,children:_(`connect.openLink`)}):null,o?(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:o}):null]}):(0,j.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`connect.none`)})}function mu(e){return e==null?``:Array.isArray(e)?e.join(`, `):String(e)}function hu({column:e,value:t,boxed:n,onCommit:r}){let[i,a]=(0,A.useState)(mu(t));(0,A.useEffect)(()=>a(mu(t)),[t]);let o=V(`w-full min-w-0 rounded-md border border-transparent px-2 text-[0.8125rem] 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,j.jsx)(`label`,{className:`flex size-9 cursor-pointer items-center justify-center coarse:size-11`,children:(0,j.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,j.jsxs)(`select`,{value:i,onChange:e=>r(e.target.value||null),className:o,children:[(0,j.jsx)(`option`,{value:``}),e.format.options.map(e=>(0,j.jsx)(`option`,{value:e.id,children:e.label},e.id))]}):(0,j.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!==mu(t)&&r(g(e,i))},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.target.blur())},className:V(o,e.type===`number`&&`text-right tabular-nums`)})}function gu({runId:e,list:t,editable:n}){let{def:r,rows:i}=t,[a,o]=(0,A.useState)(null),[s,c]=(0,A.useState)({}),l=`${G(e)}/lists/${r.id}/rows`,u=async e=>{o(null);try{await e()}catch(e){o(e instanceof pc?e.message:String(e))}},d=()=>u(async()=>{await W.post(l,{cells:s}),c({})}),f=Object.values(s).some(e=>e!=null&&e!==``);if(!i.length&&!n)return(0,j.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`list.empty`)});let p=(e,t)=>t===0||e.type===`text`&&e.format?.style===`multiline`,m=(e,t,n)=>void u(()=>W.patch(`${l}/${e}`,{cells:{[t]:n}}));return(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`flex flex-col gap-2 sm:hidden`,children:[i.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:r.columns.map((t,r)=>(0,j.jsxs)(`div`,{className:V(`min-w-0`,p(t,r)&&`col-span-2`),children:[(0,j.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:t.name}),n?(0,j.jsx)(hu,{boxed:!0,column:t,value:e.cells[t.id],onCommit:n=>m(e.id,t.id,n)}):(0,j.jsx)(`div`,{className:V(`break-words px-1 text-[0.875rem]`,t.type===`number`&&`tabular-nums`),children:uu(t,e.cells[t.id],h)||`—`})]},t.id))}),n?(0,j.jsx)(`div`,{className:`mt-1 flex justify-end`,children:(0,j.jsx)(U,{label:_(`list.delete`),onClick:()=>void u(()=>W.del(`${l}/${e.id}`)),children:(0,j.jsx)(Vo,{className:`size-4`})})}):null]},e.id)),n?(0,j.jsxs)(`div`,{className:`rounded-lg border border-input border-dashed p-2`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:r.columns.map((e,t)=>(0,j.jsxs)(`div`,{className:V(`min-w-0`,p(e,t)&&`col-span-2`),children:[(0,j.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:e.name}),(0,j.jsx)(hu,{boxed:!0,column:e,value:s[e.id],onCommit:t=>c(n=>({...n,[e.id]:t}))})]},e.id))}),(0,j.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,j.jsxs)(H,{variant:`secondary`,size:`sm`,onClick:()=>f?void d():void 0,children:[(0,j.jsx)(ho,{className:`size-4`}),` `,_(`run.addRow`)]})})]}):null]}),(0,j.jsx)(`div`,{className:`hidden overflow-x-auto rounded-lg ring-1 ring-border-soft sm:block`,children:(0,j.jsxs)(`table`,{className:`w-full text-[0.8125rem]`,children:[(0,j.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,j.jsxs)(`tr`,{children:[r.columns.map(e=>(0,j.jsx)(`th`,{className:`whitespace-nowrap px-3 py-2 text-left font-medium`,children:e.name},e.id)),n?(0,j.jsx)(`th`,{className:`w-10`}):null]})}),(0,j.jsxs)(`tbody`,{children:[i.map(e=>(0,j.jsxs)(`tr`,{className:`border-border-soft border-t align-top`,children:[r.columns.map(t=>(0,j.jsx)(`td`,{className:V(`min-w-[7.5rem]`,n?`px-1 py-0.5`:`px-3 py-2`),children:n?(0,j.jsx)(hu,{column:t,value:e.cells[t.id],onCommit:n=>m(e.id,t.id,n)}):(0,j.jsx)(`span`,{className:V(t.type===`number`&&`tabular-nums`),children:uu(t,e.cells[t.id],h)})},t.id)),n?(0,j.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,j.jsx)(U,{label:_(`list.delete`),className:`size-9`,onClick:()=>void u(()=>W.del(`${l}/${e.id}`)),children:(0,j.jsx)(Vo,{className:`size-3.5`})})}):null]},e.id)),n?(0,j.jsxs)(`tr`,{className:`border-border-soft border-t bg-paper`,children:[r.columns.map(e=>(0,j.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,j.jsx)(hu,{column:e,value:s[e.id],onCommit:t=>c(n=>({...n,[e.id]:t}))})},e.id)),(0,j.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,j.jsx)(U,{label:_(`run.addRow`),className:`size-9`,onClick:()=>f?void d():void 0,children:(0,j.jsx)(ho,{className:`size-4`})})})]}):null]})]})}),a?(0,j.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:a}):null]})}function _u(e,t,n){let r=t.split(`/`).map(encodeURIComponent).join(`/`);return xc(`${G(e)}/store/files/${r}${n?`?inline=1`:``}`)}var vu=[`bg-paper-3 text-ink-3`,`bg-moss-tint text-moss`,`bg-rose-tint text-rose`,`bg-ember-tint text-ember-strong`];function yu({runId:e,list:t}){let{def:n,rows:r}=t,i=n.columns.find(e=>e.id===n.check?.file),a=n.columns.find(e=>e.id===n.check?.status),o=a?.type===`select`?a.format.options:[],s=o[0]?.id,c=e=>a?String(e.cells[a.id]??s??``):``,l=e=>!a||c(e)===s,[u,d]=(0,A.useState)(()=>(r.find(l)??r[0])?.id??null),[f,p]=(0,A.useState)(!1),[m,g]=(0,A.useState)(null),v=`${G(e)}/lists/${n.id}/rows`,y=r.find(e=>e.id===u)??r[0],b=f?r.filter(e=>l(e)||e.id===y?.id):r,x=r.filter(e=>!l(e)).length,S=n.columns.filter(e=>e!==i&&e!==a),C=S.filter(e=>e.id!==n.key),w=C.find(e=>e.type===`text`)??C[0],T=C.filter(e=>e!==w),ee=async(e,t)=>{g(null);try{await W.patch(`${v}/${e}`,{cells:t})}catch(e){g(e instanceof pc?e.message:String(e))}},E=e=>{let t=b.findIndex(e=>e.id===y?.id),n=b[Math.min(b.length-1,Math.max(0,t+e))];n&&d(n.id)},te=async e=>{if(!y||!a)return;let t=r.findIndex(e=>e.id===y.id),n=[...r.slice(t+1),...r.slice(0,t)].find(l);await ee(y.id,{[a.id]:e}),n&&e!==s&&d(n.id)},D=e=>{e.target.closest(`input, textarea, select`)||(e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),E(e.key===`ArrowDown`?1:-1)):/^[1-9]$/.test(e.key)&&o[Number(e.key)]&&(e.preventDefault(),te(o[Number(e.key)].id)))};if(!r.length)return(0,j.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`list.empty`)});let O=i&&y?String(y.cells[i.id]??``).trim():``,k=O.split(`.`).pop()?.toLowerCase()??``,ne=e=>vu[Math.min(Math.max(0,o.findIndex(t=>t.id===c(e))),3)];return(0,j.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(280px,360px)_minmax(0,1fr)]`,onKeyDown:D,children:[(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-col`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:_(`check.progress`,{done:x,total:r.length})}),a?(0,j.jsx)(`button`,{type:`button`,"aria-pressed":f,onClick:()=>p(e=>!e),className:V(`inline-flex h-8 items-center rounded-full px-3 text-[0.8125rem] ring-1 transition coarse:h-11`,f?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink`),children:_(`check.onlyOpen`)}):null]}),(0,j.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,j.jsx)(`li`,{children:(0,j.jsxs)(`button`,{type:`button`,onClick:()=>d(e.id),"aria-current":e.id===y?.id,className:V(`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,j.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate font-medium text-[0.875rem]`,children:w&&uu(w,e.cells[w.id],h)||`—`}),(0,j.jsx)(`span`,{className:`block truncate text-[0.75rem] text-ink-3 tabular-nums`,children:T.slice(0,2).map(t=>uu(t,e.cells[t.id],h)).filter(Boolean).join(` · `)})]}),a?(0,j.jsx)(`span`,{className:V(`shrink-0 rounded-full px-2 py-0.5 font-medium text-[0.6875rem]`,ne(e)),children:o.find(t=>t.id===c(e))?.label??c(e)}):null]})},e.id))})]}),y?(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[o.length>1?(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[o.slice(1).map((e,t)=>(0,j.jsxs)(H,{size:`md`,variant:c(y)===e.id?`primary`:`secondary`,onClick:()=>void te(e.id),children:[c(y)===e.id?(0,j.jsx)(B,{className:`size-4`}):null,e.label,(0,j.jsx)(`kbd`,{className:`ml-1 hidden rounded bg-black/10 px-1.5 text-[0.6875rem] lg:inline`,children:t+1})]},e.id)),c(y)===s?null:(0,j.jsx)(H,{size:`md`,variant:`ghost`,onClick:()=>void te(s??``),children:_(`check.reopen`)})]}):null,(0,j.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-paper-2 ring-1 ring-border-soft`,children:O?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-border-soft border-b bg-card px-3 py-2 text-[0.8125rem]`,children:[(0,j.jsx)(ba,{className:`size-3.5 shrink-0 text-ink-3`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:O.split(`/`).pop()}),(0,j.jsx)(`a`,{href:_u(e,O,k===`pdf`),target:`_blank`,rel:`noreferrer`,className:`shrink-0 text-ink-2 underline-offset-2 hover:text-ink hover:underline`,children:_(`run.openFull`)})]}),k===`pdf`?(0,j.jsx)(`iframe`,{title:O,src:`${_u(e,O,!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]`},O):[`png`,`jpg`,`jpeg`,`webp`].includes(k)?(0,j.jsx)(`div`,{className:`flex max-h-[46vh] justify-center overflow-auto bg-white lg:max-h-[calc(100vh-27rem)]`,children:(0,j.jsx)(`img`,{src:_u(e,O,!0),alt:O,className:`max-w-full object-contain`},O)}):(0,j.jsx)(`p`,{className:`px-4 py-10 text-center text-[0.875rem] text-ink-3`,children:_(`check.noPreview`)})]}):(0,j.jsx)(`p`,{className:`px-4 py-14 text-center text-[0.875rem] text-ink-3`,children:_(`check.noFile`)})}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-3`,children:S.map(e=>(0,j.jsxs)(`div`,{className:V(`min-w-0`,e.type===`text`&&e.format?.style===`multiline`&&`col-span-full`),children:[(0,j.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:e.name}),(0,j.jsx)(hu,{boxed:!0,column:e,value:y.cells[e.id],onCommit:t=>void ee(y.id,{[e.id]:t})})]},e.id))}),m?(0,j.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:m}):null]}):null]})}var bu={xlsx:`Excel`,csv:`CSV`,json:`JSON`,md:`Markdown`,zip:`ZIP`};function xu({runId:e,list:t}){return(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.formats.map(n=>(0,j.jsx)(`a`,{href:xc(`${G(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-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink coarse:h-11 coarse:px-4`,children:bu[n]??n},n))})}function Su({runId:e}){let[t,n]=(0,A.useState)(!1),[r,i]=(0,A.useState)(null),[a,o]=(0,A.useState)(!1);(0,A.useEffect)(()=>{t&&(o(!1),W.get(`${G(e)}/store`).then(i))},[t,e]);let s=r&&!r.files.length&&!r.connections.length&&!r.keepsSignIns&&r.lists.every(e=>!e.rows);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-1.5 text-[0.8125rem] text-ink-4 transition hover:text-ink-2 coarse:min-h-11`,children:[(0,j.jsx)(ca,{className:`size-3.5`}),` `,_(`store.open`)]}),(0,j.jsx)(ps,{open:t,onClose:()=>n(!1),title:_(`store.title`),wide:!0,children:r?(0,j.jsxs)(`div`,{className:`flex flex-col gap-5 text-[0.875rem]`,children:[(0,j.jsx)(`p`,{className:`text-ink-3`,children:_(`store.explain`)}),s?(0,j.jsx)(`p`,{className:`text-ink-2`,children:_(`store.empty`)}):null,r.lists.some(e=>e.rows)?(0,j.jsx)(`ul`,{className:`flex flex-col gap-1`,children:r.lists.filter(e=>e.rows).map(e=>(0,j.jsxs)(`li`,{className:`flex justify-between gap-3`,children:[(0,j.jsx)(`span`,{children:e.title}),(0,j.jsx)(`span`,{className:`text-ink-3 tabular-nums`,children:_(`store.rows`,{n:e.rows})})]},e.id))}):null,r.connections.map(e=>(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(Ha,{className:`size-4 text-ink-3`}),` `,e.account?.label]},e.id)),r.keepsSignIns?(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(B,{className:`size-4 text-ink-3`}),` `,_(`store.signIns`)]}):null,r.files.length?(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`mb-1 text-ink-3`,children:_(`store.files`,{n:r.files.length,size:v(r.files.reduce((e,t)=>e+t.size,0))})}),(0,j.jsx)(`ul`,{className:`max-h-56 overflow-y-auto rounded-lg ring-1 ring-border-soft`,children:r.files.map(t=>(0,j.jsx)(`li`,{className:`border-border-soft border-b last:border-0`,children:(0,j.jsxs)(`a`,{href:xc(`${G(e)}/store/files/${t.path}`),className:`flex items-center gap-2 px-3 py-2 text-[0.8125rem] hover:bg-paper-2 coarse:min-h-11`,title:t.source??void 0,children:[(0,j.jsx)(ba,{className:`size-3.5 shrink-0 text-ink-3`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.path}),(0,j.jsx)(`span`,{className:`text-ink-4 tabular-nums`,children:v(t.size)})]})},t.path))})]}):null,(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[s?(0,j.jsx)(`span`,{}):a?(0,j.jsxs)(H,{variant:`secondary`,onClick:async()=>{await W.del(`${G(e)}/store`),i(await W.get(`${G(e)}/store`)),o(!1)},children:[(0,j.jsx)(Vo,{className:`size-4`}),` `,_(`store.confirmDelete`)]}):(0,j.jsxs)(H,{variant:`ghost`,onClick:()=>o(!0),children:[(0,j.jsx)(Vo,{className:`size-4`}),` `,_(`store.delete`)]}),(0,j.jsx)(H,{onClick:()=>n(!1),children:_(`common.close`)})]})]}):(0,j.jsx)(`div`,{className:`flex justify-center py-8 text-ink-4`,children:(0,j.jsx)(us,{})})})]})}var Cu=300;function wu(){if(typeof MediaRecorder<`u`)return(Cc(`transcribe`)?[`audio/mp4`,`audio/webm;codecs=opus`,`audio/webm`,`audio/ogg;codecs=opus`]:[`audio/webm;codecs=opus`,`audio/mp4`,`audio/webm`,`audio/ogg;codecs=opus`]).find(e=>MediaRecorder.isTypeSupported(e))}async function Tu(e,t){if(Cc(`transcribe`))try{let n=await wc(`transcribe`,{audio:await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).split(`,`)[1]??``),r.onerror=()=>n(r.error),r.readAsDataURL(e)}),mime:e.type,lang:t});return typeof n?.text==`string`?n.text:void 0}catch{return}}function Eu(e){return`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`}function Du({value:e,base:t,onChange:n,onBusy:r}){let i=c(e)?e:null,[a,o]=(0,A.useState)(null),[s,l]=(0,A.useState)(0),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(null),[m,h]=(0,A.useState)(!1),[g,v]=(0,A.useState)(null),y=(0,A.useRef)(null),b=(0,A.useRef)(null),x=wu(),S=Fc&&!!x;(0,A.useEffect)(()=>()=>{y.current&&(y.current.recorder.onstop=null,y.current.stop())},[]),(0,A.useEffect)(()=>()=>{g&&URL.revokeObjectURL(g.url)},[g]);let C=async(e,i)=>{d(!0),r?.(!0),p(null);try{let r=await W.upload(`${t}/uploads`,e);v({asset:r.id,url:URL.createObjectURL(e)});let{lang:a}=bc(),o=await Tu(e,a);n({asset:r.id,lang:a,...i===void 0?{}:{seconds:i},...o===void 0?{}:{transcript:o}})}catch(e){p(e.message)}finally{d(!1),r?.(!1)}},w=async()=>{p(null),h(!1);let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0}})}catch{h(!0);return}let t=[],n=new MediaRecorder(e,{mimeType:x,audioBitsPerSecond:48e3}),i=Date.now(),a=new AudioContext,s=a.createAnalyser();s.fftSize=256,a.createMediaStreamSource(e).connect(s);let c=new Uint8Array(s.fftSize),u=0,d=()=>{s.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)),o((Date.now()-i)/1e3),(Date.now()-i)/1e3>=Cu){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),y.current=null,o(null),l(0)};n.ondataavailable=e=>e.data.size&&t.push(e.data),n.onstop=()=>{let e=(n.mimeType||x||`audio/webm`).split(`;`)[0],r=e===`audio/mp4`?`m4a`:e===`audio/ogg`?`ogg`:`webm`,a=Math.max(1,Math.round((Date.now()-i)/1e3));C(new File(t,`sprachnotiz-${el()}.${r}`,{type:e}),a)},y.current={recorder:n,stop:f},r?.(!0),n.start(1e3),u=requestAnimationFrame(d)},T=a!==null,ee=(0,j.jsxs)(H,{variant:`secondary`,onClick:()=>b.current?.click(),children:[(0,j.jsx)(va,{className:`size-4`}),` `,_(`voice.pick`)]});return(0,j.jsxs)(`div`,{children:[T?(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-ember`,children:[(0,j.jsxs)(`span`,{className:`relative flex size-11 shrink-0 items-center justify-center`,children:[(0,j.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-rose-tint transition-transform duration-75`,style:{transform:`scale(${.7+s*.5})`}}),(0,j.jsx)(`span`,{className:`relative size-3.5 animate-pulse-dot rounded-full bg-rose`})]}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`div`,{className:`font-medium text-[0.9375rem] tabular-nums`,children:Eu(a)}),(0,j.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:a>270?_(`voice.left`,{s:Math.ceil(Cu-a)}):_(`voice.recording`)})]}),(0,j.jsxs)(H,{onClick:()=>y.current?.stop(),children:[(0,j.jsx)(Fo,{className:`size-3.5 fill-current`}),` `,_(`voice.stop`)]})]}):u?(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-4 text-[0.875rem] text-ink-3 ring-1 ring-input`,children:[(0,j.jsx)(us,{className:`size-4`}),` `,_(`run.uploading`)]}):i?(0,j.jsxs)(`div`,{className:`rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,j.jsx)(`audio`,{controls:!0,preload:`metadata`,src:g?.asset===i.asset?g.url:`${t}/assets/${i.asset}`,className:`h-11 w-full`}),i.transcript?(0,j.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap px-1 text-[0.875rem] text-ink-2 leading-relaxed`,children:i.transcript}):null,(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:i.seconds?Eu(i.seconds):null}),(0,j.jsxs)(`div`,{className:`flex gap-1`,children:[S?(0,j.jsxs)(H,{variant:`ghost`,size:`sm`,onClick:()=>void w(),children:[(0,j.jsx)(xo,{className:`size-3.5`}),` `,_(`voice.again`)]}):null,(0,j.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>n(void 0),children:_(`voice.remove`)})]})]})]}):(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[S?(0,j.jsxs)(H,{variant:`secondary`,size:`lg`,onClick:()=>void w(),className:`w-full sm:w-auto`,children:[(0,j.jsx)(eo,{className:`size-4`}),` `,_(`voice.start`)]}):ee,S&&m?ee:null]}),m?(0,j.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[0.8125rem] text-ink-2 leading-relaxed`,children:_(`voice.denied`)}):(0,j.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3 leading-relaxed`,children:_(S?`voice.why`:`voice.noRecorder`)})]}),(0,j.jsx)(`input`,{ref:b,type:`file`,hidden:!0,accept:`audio/*`,capture:!0,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&C(t,void 0)}}),f?(0,j.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-rose`,children:f}):null]})}function Ou({field:e,value:t,values:n,onChange:r}){let i=e.columns??[],a=Array.isArray(t)&&t.length?t:[{}],o=l(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,j.jsxs)(`div`,{className:`rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,j.jsx)(`div`,{className:`hidden gap-2 px-2 pt-1 pb-2 text-[0.75rem] text-ink-3 sm:grid`,style:{gridTemplateColumns:`${c} 36px`},children:i.map(e=>(0,j.jsx)(`div`,{className:e.kind===`text`?``:`text-right`,children:e.label},e.id))}),(0,j.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map((e,t)=>(0,j.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,j.jsxs)(`label`,{className:V(`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,j.jsx)(`span`,{className:`px-0.5 text-[0.6875rem] text-ink-3 sm:hidden`,children:n.label}),(0,j.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:V(`h-11 w-full min-w-0 rounded-md border border-transparent bg-paper-2 px-2.5 text-[0.875rem] 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,j.jsx)(U,{label:_(`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,j.jsx)(Vo,{className:`size-4`})})]},t))}),(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-end justify-between gap-3 px-2 pb-1`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>r([...a,{}]),className:`inline-flex h-9 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-2 hover:bg-accent coarse:h-11`,children:[(0,j.jsx)(ho,{className:`size-4`}),` `,_(`run.addRow`)]}),(0,j.jsxs)(`div`,{className:`text-right text-[0.8125rem] tabular-nums`,children:[(0,j.jsxs)(`div`,{className:`text-ink-3`,children:[_(`run.net`),` `,d(o.net,o.currency,h)]}),o.vatRate?(0,j.jsxs)(`div`,{className:`text-ink-3`,children:[_(`run.vat`,{r:o.vatRate}),` `,d(o.vat,o.currency,h)]}):null,(0,j.jsxs)(`div`,{className:`font-semibold text-[0.9375rem] text-ink`,children:[_(`run.total`),` `,d(o.gross,o.currency,h)]})]})]})]})}function ku(e){return!!e?.closest(`input, textarea, [contenteditable='true']`)}function Au({field:e,value:t,base:n,onChange:r,onBusy:i}){let a=(0,A.useRef)(null),o=(0,A.useRef)(null),s=(0,A.useRef)(null),c=(0,A.useRef)(null),[l,u]=(0,A.useState)(!1),[d,f]=(0,A.useState)({}),[p,m]=(0,A.useState)(null),[h,g]=(0,A.useState)(!1),[v,y]=(0,A.useState)(!1),[b,x]=(0,A.useState)(null),S=(0,A.useRef)(null),C=e=>{S.current=e,x(e)},w=e.kind===`image`,T=!!e.multiple,ee=T?e.max??30:1,E=w||!!e.camera||!!e.video,te=!w&&!!e.video,D=Array.isArray(t)?t:typeof t==`string`&&t?[t]:[],O=(0,A.useRef)(D);O.current=D;let k=D.length<ee,ne=async e=>{let t=(w?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 a=ee-(T?O.current.length:0);u(!0),i?.(!0),m(t.length>a&&T?_(`run.maxFiles`,{n:ee}):null);try{for(let e of t.slice(0,Math.max(0,a))){let t=await $c(e),i=await W.upload(`${n}/uploads`,t);f(e=>({...e,[i.id]:{name:i.name,mime:i.mime}}));let a=T?[...O.current,i.id]:i.id;O.current=T?a:[i.id],r(a)}}catch(e){m(e.message)}finally{u(!1),i?.(!1)}},M=(0,A.useRef)(ne);M.current=ne;let re=e=>{let t=D.filter(t=>t!==e);r(T?t:void 0)},ie=(e,t)=>{let n=O.current.indexOf(e),i=Math.min(O.current.length-1,Math.max(0,t));if(n<0||n===i)return;let a=O.current.filter(t=>t!==e);a.splice(i,0,e),O.current=a,r(a)},ae=T&&D.length>1;(0,A.useEffect)(()=>{if(!k)return;let e=e=>{let t=Array.from(e.clipboardData?.files??[]),n=a.current;if(!t.length||!n||ku(document.activeElement))return;let r=document.querySelectorAll(`[data-upload-field]`);(n.matches(`:hover`)||n.contains(document.activeElement)||r.length===1)&&(e.preventDefault(),M.current(t))};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[k]);let oe=V(`flex flex-col items-center justify-center gap-2 rounded-xl border border-input border-dashed bg-card px-3 text-[0.875rem] text-ink-3 transition hover:border-ember hover:text-ink`,D.length?`py-4`:`py-8`);return(0,j.jsxs)(`div`,{ref:a,"data-upload-field":``,onDragOver:e=>{k&&(e.preventDefault(),y(!0))},onDragLeave:()=>y(!1),onDrop:e=>{y(!1),k&&(e.preventDefault(),ne(Array.from(e.dataTransfer.files)))},children:[D.length?(0,j.jsx)(`div`,{className:`mb-2 flex flex-col gap-2`,children:D.map((e,t)=>{let r=d[e],i=r?.mime??(w?`image/`:``);return(0,j.jsxs)(`div`,{"data-file-id":e,className:V(`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input transition-shadow`,b===e&&`relative z-10 shadow-elevated ring-2 ring-ember`),children:[ae?(0,j.jsxs)(`button`,{type:`button`,"aria-label":_(`run.moveFile`,{n:t+1}),title:_(`run.moveFileHint`),className:V(`-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`,b===e?`cursor-grabbing`:`cursor-grab`),onPointerDown:t=>{try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}C(e)},onPointerMove:t=>{if(S.current!==e)return;let n=document.elementFromPoint(t.clientX,t.clientY)?.closest(`[data-file-id]`),r=n?.getAttribute(`data-file-id`);r&&r!==e&&a.current?.contains(n??null)&&ie(e,O.current.indexOf(r))},onPointerUp:()=>C(null),onPointerCancel:()=>C(null),onKeyDown:n=>{(n.key===`ArrowUp`||n.key===`ArrowDown`)&&(n.preventDefault(),ie(e,t+(n.key===`ArrowUp`?-1:1)))},children:[(0,j.jsx)(`span`,{className:`font-medium text-[0.75rem] tabular-nums`,children:t+1}),(0,j.jsx)(Ma,{className:`size-4`})]}):null,i.startsWith(`image/`)?(0,j.jsx)(`img`,{src:xc(`${n}/assets/${e}`),alt:``,className:`size-14 rounded-lg object-cover`}):(0,j.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg bg-paper-2`,children:i.startsWith(`video/`)?(0,j.jsx)(wa,{className:`size-5 text-ink-3`}):(0,j.jsx)(oo,{className:`size-5 text-ink-3`})}),(0,j.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[0.875rem]`,children:r?.name??`✓`}),(0,j.jsx)(U,{label:_(`run.removeFile`),onClick:()=>re(e),children:(0,j.jsx)(Zo,{className:`size-4`})})]},e)})}):null,k?(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>o.current?.click(),className:V(oe,`min-w-[9rem] flex-1 px-4`,v&&`border-ember text-ink`),children:[w?(0,j.jsx)(Pa,{className:`size-6`}):(0,j.jsx)(oo,{className:`size-6`}),l?_(`run.uploading`):D.length?_(`run.uploadMore`):_(Pc?`run.uploadTouch`:`run.upload`)]}),E?(0,j.jsxs)(`button`,{type:`button`,onClick:()=>Fc?g(!0):s.current?.click(),className:V(oe,`w-28`),children:[(0,j.jsx)(qi,{className:`size-6`}),_(`run.camera`)]}):null,te&&!(Fc&&ul)?(0,j.jsxs)(`button`,{type:`button`,onClick:()=>c.current?.click(),className:V(oe,`w-28`),children:[(0,j.jsx)(qo,{className:`size-6`}),_(`camera.video`)]}):null]}):null,(0,j.jsx)(`input`,{ref:o,type:`file`,hidden:!0,multiple:T,accept:w?`image/*`:void 0,onChange:e=>{ne(Array.from(e.target.files??[])),e.target.value=``}}),(0,j.jsx)(`input`,{ref:s,type:`file`,hidden:!0,accept:`image/*`,capture:`environment`,onChange:e=>{ne(Array.from(e.target.files??[])),e.target.value=``}}),te?(0,j.jsx)(`input`,{ref:c,type:`file`,hidden:!0,accept:`video/*`,capture:`environment`,onChange:e=>{ne(Array.from(e.target.files??[])),e.target.value=``}}):null,(0,j.jsx)(dl,{open:h,multiple:T,video:te,onClose:()=>g(!1),onCapture:e=>ne([e]),onNative:()=>s.current?.click()}),T&&(e.min||e.max)?(0,j.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-ink-3 tabular-nums`,children:e.min&&D.length<e.min?_(`run.filesMin`,{n:D.length,min:e.min}):e.max?_(`run.filesOf`,{n:D.length,max:e.max}):null}):null,p?(0,j.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-rose`,children:p}):null]})}function ju(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 Mu({field:e,value:t,onChange:n}){let[r,i]=(0,A.useState)(!1);return(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(ts,{value:t,placeholder:e.placeholder,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>n(e.target.value)}),(0,j.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-[0.875rem] text-ink-2 transition hover:border-ember hover:text-ink`,children:[(0,j.jsx)(Co,{className:`size-4`}),` `,_(`scan.button`)]}),(0,j.jsx)(ql,{open:r,onClose:()=>i(!1),onResult:n})]})}var Nu=4;function Pu(e){let t=new Map,n=e.map(e=>({value:e,slot:f(e)})).filter(e=>e.slot).sort((e,t)=>Date.parse(e.value)-Date.parse(t.value));for(let{value:e,slot:r}of n){if(!r)continue;let n=t.get(r.day)??{label:x(e,h),times:[]};n.times.push({value:e,time:r.time}),t.set(r.day,n)}return[...t.values()]}function Fu({name:e,label:t,options:n,value:r,onChange:i,disabled:a}){let o=Pu(n),s=o.findIndex(e=>e.times.some(e=>e.value===r)),[c,l]=(0,A.useState)(s>=Nu);if(!o.length)return(0,j.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`slot.none`)});let u=c?o:o.slice(0,Nu);return(0,j.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,j.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,j.jsx)(`legend`,{className:`sr-only`,children:t}),u.map(t=>(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`mb-2 font-medium text-[0.75rem] text-ink-3`,children:t.label}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.times.map(n=>(0,j.jsxs)(`label`,{className:`relative`,children:[(0,j.jsx)(`input`,{type:`radio`,name:`slot-${e}`,value:n.value,checked:n.value===r,disabled:a.has(n.value),"aria-label":`${t.label}, ${n.time}`,onChange:()=>i(n.value),className:`peer sr-only`}),(0,j.jsx)(`span`,{className:V(`inline-flex h-10 cursor-pointer items-center rounded-full border px-4 text-sm tabular-nums transition coarse:h-11`,`border-input bg-card text-ink-2 hover:border-ink-4 hover:text-ink`,`peer-checked:border-ember peer-checked:bg-ember-tint peer-checked:text-ink`,`peer-disabled:pointer-events-none peer-disabled:line-through peer-disabled:opacity-60`,`peer-focus-visible:outline-[1.5px] peer-focus-visible:outline-offset-2 peer-focus-visible:outline-(--focus-line) peer-focus-visible:outline-solid`),children:n.time})]},n.value))})]},t.label))]}),o.length>u.length?(0,j.jsx)(`button`,{type:`button`,onClick:()=>l(!0),className:`self-start text-[0.8125rem] text-ink-3 underline-offset-4 transition hover:text-ink hover:underline coarse:min-h-11`,children:_(`slot.later`)}):null]})}function Iu({cards:e,value:t,multi:n,runId:r,onChange:i,disabled:a}){let o=new Set(n?Array.isArray(t)?t.map(String):[]:t==null||t===``?[]:[String(t)]),s=e=>{i(n?o.has(e)?[...o].filter(t=>t!==e):[...o,e]:o.has(e)?``:e)},c=e=>/^(https?:|data:|\/)/.test(e)?e:xc(`/api/runs/${r}/assets/${e}`);return(0,j.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr))`},children:e.map(e=>{let t=o.has(e.value),n=a.has(e.value);return(0,j.jsxs)(`div`,{className:V(`flex flex-col overflow-hidden rounded-xl bg-card ring-1 ring-border-soft transition`,t&&`ring-2 ring-ember`,n&&`opacity-50`),children:[e.image?(0,j.jsx)(`img`,{src:c(e.image),alt:``,className:`aspect-square w-full object-cover`}):null,(0,j.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1 p-3`,children:[(0,j.jsx)(`div`,{className:`font-medium text-[0.9375rem] leading-snug`,children:e.label}),e.subtitle?(0,j.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:e.subtitle}):null,e.meta?(0,j.jsx)(`div`,{className:`mt-auto pt-1 font-display font-semibold text-[0.9375rem] tabular-nums`,children:e.meta}):null,(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[(0,j.jsx)(`button`,{type:`button`,"aria-pressed":t,disabled:n,onClick:()=>s(e.value),className:V(`inline-flex h-9 flex-1 items-center justify-center rounded-full px-3 text-[0.8125rem] transition coarse:h-11`,t?`bg-ember text-ember-on`:`bg-paper-2 text-ink-2 hover:text-ink`),children:_(t?`cards.picked`:`cards.pick`)}),e.link?(0,j.jsx)(`a`,{href:e.link,target:`_blank`,rel:`noopener`,className:`inline-flex h-9 items-center rounded-full px-3 text-[0.8125rem] text-ink-2 ring-1 ring-border-soft hover:text-ink coarse:h-11`,children:_(`cards.open`)}):null]})]})]},e.value)})})}function Lu({field:e,value:t,values:n,runId:r,base:i,view:a,onChange:o,onBusy:s,error:c,closed:l}){let u=i??G(r),d=t==null?``:String(t),f=new Set(l?.values.map(String)),p;switch(e.kind){case`textarea`:p=(0,j.jsx)(rs,{value:d,placeholder:e.placeholder,autoCapitalize:`sentences`,enterKeyHint:`enter`,onChange:e=>o(e.target.value)});break;case`number`:p=(0,j.jsx)(ts,{inputMode:`decimal`,autoComplete:`off`,value:d,placeholder:e.placeholder,onChange:e=>o(e.target.value)});break;case`select`:{let n=e.options??[],i=a?.cards?.[e.id];p=i?.length?(0,j.jsx)(Iu,{cards:i,value:t,multi:!1,runId:r,onChange:o,disabled:f}):n.length<=5&&n.every(e=>e.length<=28)?(0,j.jsx)(as,{value:d,options:n,onChange:o,disabled:[...f],label:k}):(0,j.jsx)(is,{value:d,placeholder:`—`,onChange:o,options:n.map(e=>({value:e,label:k(e),disabled:f.has(e)}))});break}case`slot`:p=(0,j.jsx)(Fu,{name:e.id,label:e.label,options:e.options??[],value:d,onChange:o,disabled:f});break;case`multiselect`:{let n=a?.cards?.[e.id];p=n?.length?(0,j.jsx)(Iu,{cards:n,value:t,multi:!0,runId:r,onChange:o,disabled:f}):(0,j.jsx)(as,{multi:!0,value:Array.isArray(t)?t:[],options:e.options??[],onChange:o,label:k});break}case`date`:p=(0,j.jsx)(ts,{type:`date`,value:d,onChange:e=>o(e.target.value),className:`w-full sm:w-56`});break;case`email`:p=(0,j.jsx)(ts,{type:`email`,inputMode:`email`,autoComplete:`email`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:d,placeholder:e.placeholder,onChange:e=>o(e.target.value)});break;case`url`:p=(0,j.jsx)(ts,{type:`url`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:d,placeholder:e.placeholder??`https://`,onChange:e=>o(e.target.value)});break;case`toggle`:p=(0,j.jsx)(cs,{checked:t===!0,onChange:o,label:e.label,disabled:f.has(String(t!==!0))});break;case`color`:p=(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(ns,{value:d||`#e0531b`,onChange:e=>o(e.target.value)}),(0,j.jsx)(ts,{value:d,placeholder:`#e0531b`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>o(e.target.value),className:`w-36`})]});break;case`image`:case`file`:p=(0,j.jsx)(Au,{field:e,value:t,base:u,onChange:o,onBusy:s});break;case`items`:p=(0,j.jsx)(Ou,{field:e,value:t,values:n,onChange:o});break;case`connection`:p=(0,j.jsx)(pu,{runId:r,connection:a?.connections.find(t=>t.id===e.connection)});break;case`list`:{let t=a?.lists.find(t=>t.def.id===e.list);p=t?(0,j.jsx)(gu,{runId:r,list:t,editable:!0}):null;break}case`location`:p=(0,j.jsx)(Ul,{value:t,base:u,placeholder:e.placeholder,onChange:o,onBusy:s});break;case`audio`:p=l?null:(0,j.jsx)(Du,{value:t,base:u,onChange:o,onBusy:s});break;case`signature`:p=(0,j.jsx)(eu,{label:e.label,value:t,base:u,onChange:o});break;default:p=e.scan?(0,j.jsx)(Mu,{field:e,value:d,onChange:o}):(0,j.jsx)(ts,{...ju(e),value:d,placeholder:e.placeholder,onChange:e=>o(e.target.value)})}return(0,j.jsxs)(`div`,{children:[e.kind===`toggle`?(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-6`,children:[(0,j.jsx)(ls,{hint:e.help,children:e.label}),p]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(ls,{hint:e.help,required:e.required,children:e.label}),p]}),l?(0,j.jsx)(`div`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:_(`run.closed`,{list:l.classes.map(e=>_(`run.cls.${Ru(e)}`)).join(`, `)})}):null,c?(0,j.jsx)(`div`,{className:`mt-1.5 text-[0.8125rem] text-rose`,children:c}):null]})}function Ru(e){return e in zu?zu[e]:e===`account`?`account`:`text`}var zu={classifier:`text`,low:`text`,standard:`text`,high:`text`,image:`image`,video:`video`,speech:`speech`,audio:`audio`};function Bu(e,t){this.v=e,this.k=t}function Vu(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Hu(e){if(Array.isArray(e))return e}function Uu(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Wu(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gu(e,t){return Hu(e)||Uu(e,t)||Ku(e,t)||Wu()}function Ku(e,t){if(e){if(typeof e==`string`)return Vu(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vu(e,t):void 0}}function qu(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Bu;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}qu.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},qu.prototype.next=function(e){return this._invoke(`next`,e)},qu.prototype.throw=function(e){return this._invoke(`throw`,e)},qu.prototype.return=function(e){return this._invoke(`return`,e)};var Ju=Object.entries,Yu=Object.setPrototypeOf,Xu=Object.isFrozen,Zu=Object.getPrototypeOf,Qu=Object.getOwnPropertyDescriptor,K=Object.freeze,$u=Object.seal,ed=Object.create,td=typeof Reflect<`u`&&Reflect,nd=td.apply,rd=td.construct;K||=function(e){return e},$u||=function(e){return e},nd||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},rd||=function(e){return new e(...[...arguments].slice(1))};var id=J(Array.prototype.forEach);Array.prototype.indexOf;var ad=J(Array.prototype.lastIndexOf),od=J(Array.prototype.pop),sd=J(Array.prototype.push),cd=J(Array.prototype.slice),ld=J(Array.prototype.splice),ud=Array.isArray,dd=Dd(Set),fd=J(Set.prototype.add),pd=J(Set.prototype.has),md=J(String.prototype.toLowerCase),hd=J(String.prototype.toString),gd=J(String.prototype.match),_d=J(String.prototype.replace),vd=J(String.prototype.indexOf),yd=J(String.prototype.trim),bd=J(Number.prototype.toString),xd=J(Boolean.prototype.toString),Sd=typeof BigInt>`u`?null:J(BigInt.prototype.toString),Cd=typeof Symbol>`u`?null:J(Symbol.prototype.toString),wd=J(Object.prototype.hasOwnProperty),Td=J(Object.prototype.toString),q=J(RegExp.prototype.test),Ed=Dd(TypeError);function J(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return nd(e,t,n)}}function Dd(e){return function(){return rd(e,[...arguments])}}function Y(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:md;if(Yu&&Yu(e,null),!ud(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Xu(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Od(e){for(let t=0;t<e.length;t++)wd(e,t)||(e[t]=null);return e}function kd(e){let t=ed(null);for(let r of Ju(e)){var n=Gu(r,2);let i=n[0],a=n[1];wd(e,i)&&(t[i]=ud(a)?Od(a):a&&typeof a==`object`&&a.constructor===Object?kd(a):a)}return t}function Ad(e){switch(typeof e){case`string`:return e;case`number`:return bd(e);case`boolean`:return xd(e);case`bigint`:return Sd?Sd(e):`0`;case`symbol`:return Cd?Cd(e):`Symbol()`;case`undefined`:return Td(e);case`function`:case`object`:{if(e===null)return Td(e);let t=e,n=jd(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Td(e)}return Td(e)}default:return Td(e)}}function jd(e,t){for(;e!==null;){let n=Qu(e,t);if(n){if(n.get)return J(n.get);if(typeof n.value==`function`)return J(n.value)}e=Zu(e)}function n(){return null}return n}function Md(e,t){for(;e!==null;){let n=Qu(e,t);if(n)return n.get?J(n.get):null;e=Zu(e)}return null}function Nd(e){try{return q(e,``),!0}catch{return!1}}var Pd=K(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Fd=K(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Id=K([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ld=K([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Rd=K(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),zd=K([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Bd=K([`#text`]),Vd=K(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Hd=K(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Ud=K(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Wd=K([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Gd=$u(/{{[\w\W]*|^[\w\W]*}}/g),Kd=$u(/<%[\w\W]*|^[\w\W]*%>/g),qd=$u(/\${[\w\W]*/g),Jd=$u(/^data-[\-\w.\u00B7-\uFFFF]+$/),Yd=$u(/^aria-[\-\w]+$/),Xd=$u(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zd=$u(/^(?:\w+script|data):/i),Qd=$u(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$d=$u(/^html$/i),ef=$u(/^[a-z][.\w]*(-[.\w]+)+$/i),tf=$u(/<[/\w!]/g),nf=$u(/<[/\w]/g),rf=$u(/<\/no(script|embed|frames)/i),af=$u(/\/>/i),X={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},of=K(Y({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),sf=function(){return typeof window>`u`?null:window},cf=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},lf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},uf=function(e,t,n,r){return wd(e,t)&&ud(e[t])?Y(r.base?kd(r.base):{},e[t],r.transform):n},df=function(e,t,n){let r=wd(e,t)?e[t]:void 0;return r&&typeof r==`object`?kd(r):n()};function ff(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sf(),t=e=>ff(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==X.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=jd(d,`cloneNode`),p=jd(d,`remove`),m=jd(d,`removeAttributeNode`),h=jd(d,`nextSibling`),g=jd(d,`childNodes`),_=jd(d,`parentNode`),v=jd(d,`shadowRoot`),y=jd(d,`attributes`),b=o&&o.prototype?jd(o.prototype,`nodeType`):null,x=o&&o.prototype?jd(o.prototype,`nodeName`):null,S=o&&o.prototype?jd(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},T=Md(d,`namespaceURI`),ee=function(e){return T?T(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let E,te=``,D,O=!1,k=0,A=function(){if(k>0)throw Ed(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},j=function(e){A(),k++;try{return E.createHTML(e)}finally{k--}},ne=function(e){A(),k++;try{return E.createScriptURL(e)}finally{k--}},M=function(){return O||=(D=cf(u,i),!0),D},re=n,ie=re.implementation,ae=re.createNodeIterator,oe=re.createDocumentFragment,se=re.getElementsByTagName,ce=r.importNode,N=lf();t.isSupported=typeof Ju==`function`&&typeof _==`function`&&ie&&ie.createHTMLDocument!==void 0;let le=Gd,ue=Kd,P=qd,de=Jd,fe=Yd,pe=Zd,me=Qd,he=ef,ge=Xd,F=null,_e=Y({},[...Pd,...Fd,...Id,...Rd,...Bd]),I=null,ve=Y({},[...Vd,...Hd,...Ud,...Wd]),ye=Object.seal(ed(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),be=null,xe=null,Se=Object.seal(ed(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ce=!0,we=!0,Te=!1,Ee=!0,De=!1,Oe=!0,ke=!1,Ae=!1,je=null,Me=null,Ne=!1,Pe=!1,Fe=!1,Ie=!1,Le=!0,Re=!1,ze=`user-content-`,Be=!0,Ve=!1,He=null,Ue={},We=null,Ge=Y({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ke=null,qe=Y({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Je=null,Ye=Y({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Xe=`http://www.w3.org/1998/Math/MathML`,Ze=`http://www.w3.org/2000/svg`,Qe=`http://www.w3.org/1999/xhtml`,$e=Qe,et=!1,tt=null,nt=Y({},[Xe,Ze,Qe],hd),rt=K([`mi`,`mo`,`mn`,`ms`,`mtext`]),it=Y({},rt),at=K([`annotation-xml`]),ot=Y({},at),st=Y({},[`title`,`style`,`font`,`a`,`script`]),ct=null,lt=[`application/xhtml+xml`,`text/html`],L=null,ut=null,dt=n.createElement(`form`),ft=function(e){return e instanceof RegExp||e instanceof Function},pt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ut&&ut===e)return;(!e||typeof e!=`object`)&&(e={}),e=kd(e),ct=lt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,L=ct===`application/xhtml+xml`?hd:md,F=uf(e,`ALLOWED_TAGS`,_e,{transform:L}),I=uf(e,`ALLOWED_ATTR`,ve,{transform:L}),tt=uf(e,`ALLOWED_NAMESPACES`,nt,{transform:hd}),Je=uf(e,`ADD_URI_SAFE_ATTR`,Ye,{transform:L,base:Ye}),Ke=uf(e,`ADD_DATA_URI_TAGS`,qe,{transform:L,base:qe}),We=uf(e,`FORBID_CONTENTS`,Ge,{transform:L}),be=uf(e,`FORBID_TAGS`,kd({}),{transform:L}),xe=uf(e,`FORBID_ATTR`,kd({}),{transform:L}),Ue=wd(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?kd(e.USE_PROFILES):e.USE_PROFILES:!1,Ce=e.ALLOW_ARIA_ATTR!==!1,we=e.ALLOW_DATA_ATTR!==!1,Te=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ee=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,De=e.SAFE_FOR_TEMPLATES||!1,Oe=e.SAFE_FOR_XML!==!1,ke=e.WHOLE_DOCUMENT||!1,Pe=e.RETURN_DOM||!1,Fe=e.RETURN_DOM_FRAGMENT||!1,Ie=e.RETURN_TRUSTED_TYPE||!1,Ne=e.FORCE_BODY||!1,Le=e.SANITIZE_DOM!==!1,Re=e.SANITIZE_NAMED_PROPS||!1,Be=e.KEEP_CONTENT!==!1,Ve=e.IN_PLACE||!1,ge=Nd(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Xd,$e=typeof e.NAMESPACE==`string`?e.NAMESPACE:Qe,it=df(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Y({},rt)),ot=df(e,`HTML_INTEGRATION_POINTS`,()=>Y({},at));let t=df(e,`CUSTOM_ELEMENT_HANDLING`,()=>ed(null));if(ye=ed(null),wd(t,`tagNameCheck`)&&ft(t.tagNameCheck)&&(ye.tagNameCheck=t.tagNameCheck),wd(t,`attributeNameCheck`)&&ft(t.attributeNameCheck)&&(ye.attributeNameCheck=t.attributeNameCheck),wd(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(ye.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),$u(ye),De&&(we=!1),Fe&&(Pe=!0),Ue&&(F=Y({},Bd),I=ed(null),Ue.html===!0&&(Y(F,Pd),Y(I,Vd)),Ue.svg===!0&&(Y(F,Fd),Y(I,Hd),Y(I,Wd)),Ue.svgFilters===!0&&(Y(F,Id),Y(I,Hd),Y(I,Wd)),Ue.mathMl===!0&&(Y(F,Rd),Y(I,Ud),Y(I,Wd))),Se.tagCheck=null,Se.attributeCheck=null,wd(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Se.tagCheck=e.ADD_TAGS:ud(e.ADD_TAGS)&&(F===_e&&(F=kd(F)),Y(F,e.ADD_TAGS,L))),wd(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Se.attributeCheck=e.ADD_ATTR:ud(e.ADD_ATTR)&&(I===ve&&(I=kd(I)),Y(I,e.ADD_ATTR,L))),wd(e,`ADD_FORBID_CONTENTS`)&&ud(e.ADD_FORBID_CONTENTS)&&(We===Ge&&(We=kd(We)),Y(We,e.ADD_FORBID_CONTENTS,L)),Be&&(F[`#text`]=!0),ke&&Y(F,[`html`,`head`,`body`]),F.table&&(Y(F,[`tbody`]),delete be.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Ed(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Ed(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=E;E=e.TRUSTED_TYPES_POLICY;try{te=j(``)}catch(e){throw E=t,e}}else e.TRUSTED_TYPES_POLICY===null?(E=void 0,te=``):(E===void 0&&(E=M()),E&&typeof te==`string`&&(te=j(``)));K&&K(e),ut=e},mt=Y({},[...Fd,...Id,...Ld]),ht=Y({},[...Rd,...zd]),gt=function(e,t,n){return t.namespaceURI===Qe?e===`svg`:t.namespaceURI===Xe?e===`svg`&&(n===`annotation-xml`||it[n]):!!mt[e]},_t=function(e,t,n){return t.namespaceURI===Qe?e===`math`:t.namespaceURI===Ze?e===`math`&&ot[n]:!!ht[e]},vt=function(e,t,n){return t.namespaceURI===Ze&&!ot[n]||t.namespaceURI===Xe&&!it[n]?!1:!ht[e]&&(st[e]||!mt[e])},yt=function(e){let t=ee(e),n=md(w(e)),r=_(e),i,a;return r&&C(r)===X.element?(i={namespaceURI:ee(r)},a=md(w(r))):(i={namespaceURI:$e},a=`template`),tt[t]?t===Ze?gt(n,i,a):t===Xe?_t(n,i,a):t===Qe?vt(n,i,a):!!(ct===`application/xhtml+xml`&&tt[t]):!1},bt=function(e){sd(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Ed(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},R=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},xt=function(e){Tt(e);let t=g(e);t&&id(cd(t),e=>{try{p(e)}catch{}});let n=C(e)===X.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&R(e,r,i)}},St=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}sd(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Pe||Fe)try{bt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},Ct=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||I[L(i)]||R(e,r,i)}},wt=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===X.element){let t=v(e);Bt(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},Tt=function(e){wt(e,e=>{C(e)===X.element&&Ct(e)})},Et=function(e){let t=[];return wt(e,e=>{t.push(e)},!0),t},Dt=function(e,t){let n=dd();id(Et(e),e=>{C(e)===X.element&&fd(n,e)}),id(t,e=>{C(e)===X.element&&!pd(n,e)&&Ct(e)})},Ot=function(e,n){let r=!1;return id(t.removed,t=>{t.element&&(r||=t.element===e,Tt(t.element))}),Dt(e,n),r},kt=function(e,t){let n=He,r=null,i=()=>(r||(r=dd(),id(t,e=>{fd(r,e)})),r);for(let t=0;;t++){let r=Et(e),a=[e],o=!1;if(id(r,e=>{C(e)===X.documentFragment?sd(a,e):!o&&!pd(n,e)&&(o=pd(i(),e))}),!o)return;if(t>=8)throw Ed(`the tree kept changing during in-place sanitization; refusing to return it`);id(a,(t,n)=>{At(t,n>0,e,i())})}},At=function(e,t,n,r){let i=Ft(e),a;for(;a=i.nextNode();)pd(r,a)&&!pd(He,a)&&(t&&Ht(N.uponSanitizeShadowNode,a,null),Jt(a,n),tn(a,n),Bt(a.content)&&nn(a.content))},jt=function(e){He&&fd(He,e)},Mt=function(e,t){return Oe?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Nt=function(e){Oe&&wt(e,e=>{let t=C(e);if(t===X.processingInstruction||t===X.comment&&q(nf,e.data)){try{p(e)}catch{}return!1}if(t===X.element){let t=e,n=L(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Mt(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Pt=function(e){let t=null,r=null;if(Ne)e=`<remove></remove>`+e;else{let t=gd(e,/^[\r\n\t ]+/);r=t&&t[0]}ct===`application/xhtml+xml`&&$e===Qe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=E?j(e):e;if($e===Qe)try{t=new l().parseFromString(i,ct)}catch{}if(!t||!t.documentElement){t=ie.createDocument($e,`template`,null);try{t.documentElement.innerHTML=et?te:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),$e===Qe?se.call(t,ke?`html`:`body`)[0]:ke?t.documentElement:a},Ft=function(e){let t=S?S(e):e.ownerDocument;return ae.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},It=function(e){return e=_d(e,le,` `),e=_d(e,ue,` `),e=_d(e,P,` `),e},Lt=function(e){Rt(e);let t=e.querySelectorAll?.call(e,`template`);t&&id(t,e=>{Bt(e.content)&&Lt(e.content)})},Rt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ae.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=It(r.data),r=n.nextNode()},zt=function(e){let t=x?x(e):null;return typeof t!=`string`||L(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Bt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===X.documentFragment}catch{return!1}},Vt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Ht(e,n,r){e.length!==0&&id(e,e=>{e.call(t,n,r,ut)})}let Ut=function(e,t){return!!(Oe&&e.hasChildNodes()&&!Vt(e.firstElementChild)&&q(tf,e.textContent)&&q(tf,e.innerHTML)||Oe&&of[t]&&C(e)===X.element&&ee(e)===Qe&&(Vt(e.firstElementChild)||typeof e.textContent==`string`&&q(tf,e.textContent))||e.nodeType===X.processingInstruction||Oe&&e.nodeType===X.comment&&q(nf,e.data))},Wt=function(e,t){return e instanceof RegExp?q(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Gt=function(e,t,n){if(!be[t]&&Zt(t)&&Wt(ye.tagNameCheck,t))return!1;if(Be&&!We[t]&&!We[md(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return bt(e),!0},Kt=function(e,t,n,r){return e.length===0?t:t===n||t===r?kd(t):t},qt=function(e,t){return e===t||_(e)!==null?!1:(Ve&&Tt(e),!0)},Jt=function(e,n){if(jt(e),Ht(N.beforeSanitizeElements,e,null),qt(e,n))return!0;if(zt(e))return bt(e),!0;let r=L(w(e));if(F=Kt(N.uponSanitizeElement,F,_e,je),Ht(N.uponSanitizeElement,e,{tagName:r,allowedTags:F}),qt(e,n))return!0;if(Ut(e,r))return bt(e),!0;if(be[r]||!(Se.tagCheck instanceof Function&&Se.tagCheck(r))&&!F[r]){let t=Gt(e,r,n);return t===!1&&(Ht(N.afterSanitizeElements,e,null),qt(e,n))?!0:t}if(C(e)===X.element&&!yt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&q(rf,e.innerHTML))return bt(e),!0;if(De&&e.nodeType===X.text){let n=It(e.textContent);e.textContent!==n&&(sd(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Ht(N.afterSanitizeElements,e,null),qt(e,n)},Yt=function(e,t,r){if(xe[t]||Mt(t,e)||Le&&(t===`id`||t===`name`)&&(r in n||r in dt))return!1;let i=I[t]||Se.attributeCheck instanceof Function&&Se.attributeCheck(t,e);return we&&q(de,t)||Ce&&q(fe,t)?!0:i?Je[t]||q(ge,_d(r,me,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&vd(r,`data:`)===0&&Ke[e]||Te&&!q(pe,_d(r,me,``))?!0:!r:Zt(e)&&Wt(ye.tagNameCheck,e)&&Wt(ye.attributeNameCheck,t,e)||t===`is`&&ye.allowCustomizedBuiltInElements&&Wt(ye.tagNameCheck,r)},Xt=Y({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Zt=function(e){return!Xt[md(e)]&&q(he,e)},Qt=function(e,t,n,r){if(E&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return j(r);case`TrustedScriptURL`:return ne(r)}return r},$t=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!zt(e)||(bt(e),!1)}catch{return St(t,e),!1}},en=function(e,t){return Oe&&q(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:md(e)===`attributename`&&gd(t,`href`)!==null},tn=function(e,n){if(Ht(N.beforeSanitizeAttributes,e,null),qt(e,n))return;let r=e.attributes;if(!r||zt(e))return;I=Kt(N.uponSanitizeAttribute,I,ve,Me);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},a=r.length,o=L(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=L(s),d=l,f=s===`value`?d:yd(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Ht(N.uponSanitizeAttribute,e,i),f=i.attrValue,Re&&(u===`id`||u===`name`)&&vd(f,ze)!==0&&(St(s,e,n),f=ze+f,p=!0),en(s,f)){St(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){St(s,e,n);continue}if(!Ee&&q(af,f)){St(s,e,n);continue}if(De&&(f=It(f)),!Yt(o,u,f)){St(s,e,n);continue}f=Qt(o,u,c,f),f!==d&&$t(e,s,c,f)&&p&&od(t.removed)}}Ht(N.afterSanitizeAttributes,e,null),qt(e,n)},nn=function(e){let t=null,n=Ft(e);for(Ht(N.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Ht(N.uponSanitizeShadowNode,t,null),Jt(t,e),tn(t,e),Bt(t.content)&&nn(t.content),C(t)===X.element){let e=v(t);Bt(e)&&(rn(e),nn(e))}De&&Rt(e),Ht(N.afterSanitizeShadowDOM,e,null)},rn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){nn(e.shadow);continue}let n=e.node,r=C(n)===X.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&L(e)===`template`){let e=n.content;Bt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Bt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(et=!e,et&&(e=`<!-->`),typeof e!=`string`&&!Vt(e)&&(e=Ad(e),typeof e!=`string`))throw Ed(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ae?(F=je,I=Me):pt(n),(N.uponSanitizeElement.length>0||N.uponSanitizeAttribute.length>0)&&(F=kd(F)),N.uponSanitizeAttribute.length>0&&(I=kd(I)),t.removed=[];let c=Ve&&typeof e!=`string`&&Vt(e),l=[],u=He;if(c){Nt(e);let t=w(e);if(typeof t==`string`){let n=L(t);if(!F[n]||be[n])throw xt(e),Ed(`root node is forbidden and cannot be sanitized in-place`)}if(zt(e))throw xt(e),Ed(`root node is clobbered and cannot be sanitized in-place`);l=Et(e),He=dd()}else if(Vt(e))i=Pt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===X.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),rn(i);else{if(!Pe&&!De&&!ke&&e.indexOf(`<`)===-1)return E&&Ie?j(e):e;if(i=Pt(e),!i)return Pe?null:Ie?te:``}i&&Ne&&bt(i.firstChild);let d=c?e:i;try{c&&rn(e);let t=Ft(d);for(;o=t.nextNode();)Jt(o,d),tn(o,d),Bt(o.content)&&nn(o.content);c&&kt(e,l)}catch(t){throw c&&(xt(e),Ot(e,l)),t}finally{He=u}if(c){if(Ot(e,l))throw Ed(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return De&&Lt(e),e}if(Pe){if(De&&Lt(i),Fe)for(s=oe.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(I.shadowroot||I.shadowrootmode)&&(s=ce.call(r,s,!0)),s}let f=ke?i.outerHTML:i.innerHTML;return ke&&F[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&q($d,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
4
4
  `+f),De&&(f=It(f)),E&&Ie?j(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pt(e),Ae=!0,je=F,Me=I},t.clearConfig=function(){ut=null,Ae=!1,je=null,Me=null,E=D,te=``},t.isValidAttribute=function(e,t,n){ut||pt({});let r=L(e),i=L(t);return typeof n==`string`&&(en(t,n)||!Ee&&q(af,n))?!1:Yt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&wd(N,e)&&sd(N[e],t)},t.removeHook=function(e,t){if(wd(N,e)){if(t!==void 0){let n=ad(N[e],t);return n===-1?void 0:ld(N[e],n,1)[0]}return od(N[e])}},t.removeHooks=function(e){wd(N,e)&&(N[e]=[])},t.removeAllHooks=function(){N=lf()},t}var pf=ff();function mf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var hf=mf();function gf(e){hf=e}var _f={exec:()=>null};function vf(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Z(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(bf.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var yf=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),bf={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:vf(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:vf(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:vf(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:vf(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:vf(e=>RegExp(`^ {0,${e}}(?:</?(?:${Ff})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:vf(e=>RegExp(`^ {0,${e}}>`))},xf=/^(?:[ \t]*(?:\n|$))+/,Sf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Cf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,wf=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Tf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ef=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Df=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Of=Z(Df).replace(/bull/g,Ef).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),kf=Z(Df).replace(/bull/g,Ef).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Af=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,jf=/^[^\n]+/,Mf=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Nf=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Mf).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Pf=Z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ef).getRegex(),Ff=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,If=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Lf=Z(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,If).replace(`tag`,Ff).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Rf=e=>Z(Af).replace(`hr`,wf).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Ff).getRegex(),zf=Rf(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Bf=Rf(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Vf={blockquote:Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Bf).getRegex(),code:Sf,def:Nf,fences:Cf,heading:Tf,hr:wf,html:Lf,lheading:Of,list:Pf,newline:xf,paragraph:zf,table:_f,text:jf},Hf=Z(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,wf).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Ff).getRegex(),Uf={...Vf,lheading:kf,table:Hf,paragraph:Z(Af).replace(`hr`,wf).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Hf).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Ff).getRegex()},Wf={...Vf,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,If).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_f,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Z(Af).replace(`hr`,wf).replace(`heading`,` *#{1,6} *[^
5
5
  ]`).replace(`lheading`,Of).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Gf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Kf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qf=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,Jf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Yf=/[\p{P}\p{S}]/u,Xf=/[\s\p{P}\p{S}]/u,Zf=/[^\s\p{P}\p{S}]/u,Qf=Z(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Xf).getRegex(),$f=/[\p{Pi}\p{Ps}"']/u,ep=/(?!~)[\p{P}\p{S}]/u,tp=/(?!~)[\s\p{P}\p{S}]/u,np=/(?:[^\s\p{P}\p{S}]|~)/u,rp=Z(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,yf?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),ip=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ap=Z(ip,`u`).replace(/punct/g,Yf).getRegex(),op=Z(ip,`u`).replace(/punct/g,ep).getRegex(),sp=Z(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,$f).replace(/punct/g,Yf).getRegex(),cp=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,lp=Z(cp,`gu`).replace(/notPunctSpace/g,Zf).replace(/punctSpace/g,Xf).replace(/punct/g,Yf).getRegex(),up=Z(cp,`gu`).replace(/notPunctSpace/g,np).replace(/punctSpace/g,tp).replace(/punct/g,ep).getRegex(),dp=Z(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Zf).replace(/punctSpace/g,Xf).replace(/punct/g,Yf).getRegex(),fp=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Zf).replace(/punctSpace/g,Xf).replace(/punct/g,Yf).getRegex(),pp=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Zf).replace(/punctSpace/g,Xf).replace(/punct/g,Yf).getRegex(),mp=Z(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Yf).getRegex(),hp=Z(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Zf).replace(/punctSpace/g,Xf).replace(/punct/g,Yf).getRegex(),gp=Z(/\\(punct)/,`gu`).replace(/punct/g,Yf).getRegex(),_p=Z(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),vp=Z(If).replace(`(?:-->|$)`,`-->`).getRegex(),yp=Z(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,vp).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),bp=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,xp=Z(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,bp).getRegex(),Sp=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,xp).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Cp=Z(/^!?\[(label)\]\[(ref)\]/).replace(`label`,xp).replace(`ref`,Mf).getRegex(),wp=Z(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Mf).getRegex(),Tp=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Ep=Z(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,bp).getRegex(),Dp=Z(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Z(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Ep).replace(`ref`,Tp).getRegex()).replace(`nolink`,Z(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Tp).getRegex()).getRegex(),Op=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,kp=Z(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),Ap={_backpedal:_f,anyPunctuation:gp,autolink:_p,blockSkip:rp,br:qf,code:Kf,del:_f,delLDelim:_f,delRDelim:_f,emStrongLDelim:ap,emStrongRDelimAst:lp,emStrongRDelimUnd:fp,escape:Gf,link:Sp,nolink:wp,punctuation:Qf,reflink:Cp,reflinkSearch:Dp,tag:yp,text:Jf,url:_f},jp={...Ap,emStrongLDelim:sp,emStrongRDelimAst:dp,emStrongRDelimUnd:pp,link:Z(/^!?\[(label)\]\((.*?)\)/).replace(`label`,xp).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,xp).getRegex()},Mp={...Ap,emStrongRDelimAst:up,emStrongLDelim:op,delLDelim:mp,delRDelim:hp,url:Z(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,kp).replace(`protocol`,Op).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Z(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,Op).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Np={...Mp,br:Z(qf).replace(`{2,}`,`*`).getRegex(),text:Z(Mp.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Pp={normal:Vf,gfm:Uf,pedantic:Wf},Fp={normal:Ap,gfm:Mp,breaks:Np,pedantic:jp},Ip={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Lp=e=>Ip[e];function Rp(e,t){if(t){if(bf.escapeTest.test(e))return e.replace(bf.escapeReplace,Lp)}else if(bf.escapeTestNoEncode.test(e))return e.replace(bf.escapeReplaceNoEncode,Lp);return e}function zp(e){return e.replace(bf.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function Bp(e){try{e=encodeURI(e).replace(bf.percentDecode,`%`)}catch{return null}return e}function Vp(e,t){let n=e.replace(bf.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(bf.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(bf.slashPipe,`|`);return n}function Hp(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Up(e){let t=e.split(`