@coreframe/dashboard 0.0.0 → 0.1.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 (40) hide show
  1. package/README.md +93 -0
  2. package/dist/client/assets/QueryClientProvider-BCOOhPXt.js +1 -0
  3. package/dist/client/assets/dashboard-0D3-ZE5r.js +64 -0
  4. package/dist/client/assets/entry.client-CommjN-q.js +9 -0
  5. package/dist/client/assets/errorBoundaries-BpDxkXkc.js +16 -0
  6. package/dist/client/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  7. package/dist/client/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  8. package/dist/client/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  9. package/dist/client/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  10. package/dist/client/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  11. package/dist/client/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  12. package/dist/client/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  13. package/dist/client/assets/jsx-runtime-CuoEKysV.js +1 -0
  14. package/dist/client/assets/lib-DzJLXgd6.js +1 -0
  15. package/dist/client/assets/manifest-23693f57.js +1 -0
  16. package/dist/client/assets/not-found-BgheKh02.js +1 -0
  17. package/dist/client/assets/root-B6xtHGyN.js +1 -0
  18. package/dist/client/assets/root-CGZxmauM.css +1 -0
  19. package/dist/client/assets/root.style-DmKiRSsP.js +1 -0
  20. package/dist/client/index.html +6 -0
  21. package/dist/server/index.js +1 -0
  22. package/dist/src/api/router.js +1 -0
  23. package/dist/src/api/routes/dashboard.js +1 -0
  24. package/dist/src/api/routes/development.js +1 -0
  25. package/dist/src/api/routes/health.js +1 -0
  26. package/dist/src/api/routes/index.js +1 -0
  27. package/dist/src/cli.d.ts +1 -0
  28. package/dist/src/cli.js +8 -0
  29. package/dist/src/development.d.ts +12 -0
  30. package/dist/src/development.js +1 -0
  31. package/dist/src/index.d.ts +3 -0
  32. package/dist/src/index.js +1 -0
  33. package/dist/src/node-fetch-adapter.js +1 -0
  34. package/dist/src/server.d.ts +24 -0
  35. package/dist/src/server.js +1 -0
  36. package/dist/src/types.d.ts +68 -0
  37. package/dist/src/worker.d.ts +30 -0
  38. package/dist/src/worker.js +1 -0
  39. package/package.json +71 -10
  40. package/readme.md +0 -1
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # Coreframe Dashboard
2
+
3
+ Local and deployed dashboard runtime for Coreframe projects.
4
+
5
+ The package starts a local Node.js backend through Portless at
6
+ `https://coreframe.localhost/__dashboard`. The backend serves the compiled React client,
7
+ production-readiness diagnostics, and controls for one dashboard-owned development process.
8
+
9
+ ```bash
10
+ coreframe-dashboard
11
+ ```
12
+
13
+ The command fails before launch when `https://coreframe.localhost` already
14
+ responds.
15
+
16
+ ## Architecture
17
+
18
+ `coreframe-dashboard` is the only launch command. It checks that the Portless
19
+ URL is free, starts Portless, and passes the assigned `PORT` to the Node.js
20
+ backend.
21
+
22
+ The browser setup intentionally mirrors the generated Coreframe web app where that contract is
23
+ useful: React Router owns the client-only route tree and hydration, TanStack Query owns server
24
+ state without persistence, React Compiler handles memoization, and Panda CSS plus Sculpted own
25
+ component styling. The dashboard keeps its own configs and generated `styled-system` output; it
26
+ does not import files from `template/`.
27
+
28
+ The runtime boundary remains dashboard-specific. A small Node adapter converts
29
+ `IncomingMessage`/`ServerResponse` to the Fetch API so Rouzer remains the single typed API
30
+ contract. Node still owns Portless startup, static files, process signals, and development-process
31
+ cleanup. A separate Worker-safe entry point owns the reduced deployed runtime.
32
+
33
+ The backend exposes these routes:
34
+
35
+ - `GET /__dashboard/api/health` confirms that the backend is running.
36
+ - `GET /__dashboard/api/dashboard` returns diagnostics, configured development targets, and the per-process
37
+ mutation token. It also returns declared Worker environment metadata and read-only deployed
38
+ secret presence; secret values never enter the response.
39
+ - `GET /__dashboard/api/development` returns the current dashboard-owned development process state, bounded
40
+ stdout/stderr output, and the ready web URL when applicable.
41
+ - `POST /__dashboard/api/development/start` starts `web`, `desktop`, `ios`, or `android` when that target is
42
+ configured and available.
43
+ - `POST /__dashboard/api/development/stop` stops the active process.
44
+ - `GET /__dashboard` and other non-API dashboard paths serve the compiled browser client from
45
+ `dist/client`.
46
+
47
+ Rouzer route modules define paths, methods, Zod request validation, handler types, and the browser
48
+ client together. Mutation endpoints additionally require the same-origin request checks and random
49
+ dashboard token enforced by the Node process. Requests remain localhost-only, bodies are bounded,
50
+ and only one child development process can run at a time.
51
+
52
+ The `@coreframe/dashboard/worker` entry point exposes `handleDashboardRequest()`. Coreframe Workers
53
+ call it before their application router. It returns `null` for non-dashboard requests and a
54
+ `Promise<Response>` for deployed `/__dashboard` requests. Staging and production use HTTP Basic
55
+ Auth and expose only release identity and required configuration presence; the Worker response never
56
+ contains environment values. The shared Vite preset serves the Node-backed dashboard locally and
57
+ copies its compiled client into deployed static assets.
58
+
59
+ ## Local development
60
+
61
+ Build the Node backend and browser client together:
62
+
63
+ ```bash
64
+ pnpm --dir dashboard build
65
+ ```
66
+
67
+ Regenerate the committed Panda runtime after changing `panda.config.ts` or style modules:
68
+
69
+ ```bash
70
+ pnpm --dir dashboard codegen
71
+ ```
72
+
73
+ Run the full local flow through Portless:
74
+
75
+ ```bash
76
+ pnpm --dir dashboard dev
77
+ ```
78
+
79
+ Useful package checks:
80
+
81
+ ```bash
82
+ pnpm --dir dashboard test
83
+ pnpm --dir dashboard typecheck
84
+ pnpm --dir dashboard lint
85
+ ```
86
+
87
+ The dashboard is a focused path from a new Coreframe project to its first production app. It
88
+ summarizes human-owned launch decisions, local/runtime problems, copyable agent tasks and commands,
89
+ configured links, and the available development targets. Dashboard-owned processes expose their live
90
+ output in the browser, and ready web targets can be opened in a separate tab. Tests and typechecks
91
+ remain agent-owned workflows rather than browser controls.
92
+
93
+ Design notes live in [`design/`](./design/).
@@ -0,0 +1 @@
1
+ import{G as e,q as t,t as n}from"./jsx-runtime-CuoEKysV.js";var r=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(){}},i=new class extends r{#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`}},a={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},o=new class{#e=a;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 s(e){setTimeout(e,0)}var c=typeof window>`u`||`Deno`in globalThis;function l(){}function u(e,t){return typeof e==`function`?e(t):e}function d(e){return typeof e==`number`&&e>=0&&e!==1/0}function f(e,t){return Math.max(e+(t||0)-Date.now(),0)}function p(e,t){return typeof e==`function`?e(t):e}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==_(o,t.options))return!1}else if(!y(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 g(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(v(t.options.mutationKey)!==v(a))return!1}else if(!y(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function _(e,t){return(t?.queryKeyHashFn||v)(e)}function v(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function y(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>y(e[n],t[n])):!1}var b=Object.prototype.hasOwnProperty;function x(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=C(e)&&C(t);if(!r&&!(w(e)&&w(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:b.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=x(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function S(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 C(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w(e){if(!T(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!T(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function T(e){return Object.prototype.toString.call(e)===`[object Object]`}function E(e){return new Promise(t=>{o.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:x(e,t)}function O(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function k(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var A=Symbol();function j(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===A?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function M(e,t){return typeof e==`function`?e(...t):!!e}function N(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 P=(()=>{let e=()=>c;return{isServer(){return e()},setIsServer(t){e=t}}})();function F(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var I=s;function L(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=I,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 R=L(),z=new class extends r{#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 B(e){return Math.min(1e3*2**e,3e4)}function V(e){return(e??`online`)===`online`?z.isOnline():!0}var H=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function U(e){let t=!1,n=0,r,a=F(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new H(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>i.isFocused()&&(e.networkMode===`always`||z.isOnline())&&e.canRun(),d=()=>V(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),a.resolve(e))},p=e=>{o()||(r?.(),a.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())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(f).catch(r=>{if(o())return;let i=e.retry??(P.isServer()?0:3),a=e.retryDelay??B,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),E(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(r?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var W=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),d(this.gcTime)&&(this.#e=o.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(P.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(o.clearTimeout(this.#e),this.#e=void 0)}};function G(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=>{N(e,()=>t.signal,()=>n=!0)},u=j(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?k:O;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?q:K,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:K(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function K(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 q(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var J=class extends W{#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=Z(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=Z(this.options);e.data!==void 0&&(this.setState(X(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(l).catch(l):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=>m(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===A||!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`):!1}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:!f(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){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({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=j(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`?G(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=U({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof H&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.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 H){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(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,...Y(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...X(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),R.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Y(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:V(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function X(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Z(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 Q=t(e(),1),ee=n(),$=Q.createContext(void 0),te=e=>{let t=Q.useContext($);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ne=({client:e,children:t})=>(Q.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,ee.jsx)($.Provider,{value:e,children:t}));export{M as C,i as D,o as E,r as O,S,f as T,l as _,W as a,m as b,R as c,u as d,v as f,h as g,g as h,Y as i,F as l,d as m,te as n,U as o,_ as p,J as r,z as s,ne as t,P as u,y as v,A as w,p as x,D as y};
@@ -0,0 +1,64 @@
1
+ import{G as e,o as t,q as n,t as r}from"./jsx-runtime-CuoEKysV.js";import{n as i,r as a,t as o}from"./root.style-DmKiRSsP.js";import{C as s,D as c,E as l,O as u,S as d,T as f,_ as p,b as m,c as h,i as g,l as _,m as v,n as y,u as b,x,y as ee}from"./QueryClientProvider-BCOOhPXt.js";var S=class extends u{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=_(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),w(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return T(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return T(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 m(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&&!d(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&E(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||x(this.options.staleTime,this.#t)!==x(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return te(this,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),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.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);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(p)),t}#g(){this.#b();let e=x(this.options.staleTime,this.#t);if(b.isServer()||this.#r.isStale||!v(e))return;let t=f(this.#r.dataUpdatedAt,e)+1;this.#d=l.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(b.isServer()||m(this.options.enabled,this.#t)===!1||!v(this.#p)||this.#p===0)&&(this.#f=l.setInterval(()=>{(this.options.refetchIntervalInBackground||c.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(l.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(l.clearInterval(this.#f),this.#f=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&&w(e,t),o=i&&E(e,n,t,r);(a||o)&&(l={...l,...g(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:h}=l;d=l.data;let v=!1;if(t.placeholderData!==void 0&&d===void 0&&h===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,v=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,d=ee(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!v)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=ee(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),h=`error`);let y=l.fetchStatus===`fetching`,b=h===`pending`,x=h===`error`,S=b&&y,C=d!==void 0,T={status:h,fetchStatus:l.fetchStatus,isPending:b,isSuccess:h===`success`,isError:x,isInitialLoading:S,isLoading:S,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:y,isRefetching:y&&!b,isLoadingError:x&&!C,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:x&&C,isStale:D(e,t),refetch:this.refetch,promise:this.#o,isEnabled:m(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=T.data!==void 0,r=T.status===`error`&&!t,i=e=>{r?e.reject(T.error):t&&e.resolve(T.data)},a=()=>{let e=this.#o=T.promise=_();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||T.data!==o.value)&&a();break;case`rejected`:(!r||T.error!==o.reason)&&a();break}}return T}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!d(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);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)})})()}))}#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()}#C(e){h.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function C(e,t){return m(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&m(t.retryOnMount,e)===!1)}function w(e,t){return C(e,t)||e.state.data!==void 0&&T(e,t,t.refetchOnMount)}function T(e,t,n){if(m(t.enabled,e)!==!1&&x(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&D(e,t)}return!1}function E(e,t,n,r){return(e!==t||m(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&D(e,n)}function D(e,t){return m(t.enabled,e)!==!1&&e.isStaleByTime(x(t.staleTime,e))}function te(e,t){return!d(e.getCurrentResult(),t)}var O=n(e(),1),k=O.createContext(!1),A=()=>O.useContext(k);k.Provider;var j=r();function M(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ne=O.createContext(M()),re=()=>O.useContext(ne),ie=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?s(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ae=e=>{O.useEffect(()=>{e.clearReset()},[e])},oe=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||s(n,[e.error,r])),se=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))}},ce=(e,t)=>e.isLoading&&e.isFetching&&!t,le=(e,t)=>e?.suspense&&t.isPending,ue=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function de(e,t,n){let r=A(),i=re(),a=y(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,se(o),ie(o,i,s),ae(i);let l=!a.getQueryCache().get(o.queryHash),[u]=O.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(O.useSyncExternalStore(O.useCallback(e=>{let t=f?u.subscribe(h.batchCalls(e)):p;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),O.useEffect(()=>{u.setOptions(o)},[o,u]),le(o,d))throw ue(o,u,i);if(oe({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!b.isServer()&&ce(d,r)&&(l?ue(o,u,i):s?.promise)?.catch(p).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function fe(e,t){return de(e,S,t)}function pe(e){return e}var N=a(),P={page:i({width:`min(76rem, calc(100vw - 2rem))`,margin:`0 auto`,padding:{base:`1.25rem 0 3rem`,md:`2rem 0 4rem`}}),topbar:i({display:`flex`,alignItems:{base:`flex-start`,md:`center`},justifyContent:`space-between`,flexDirection:{base:`column`,md:`row`},gap:`1.25rem`,padding:`0 0.25rem 1.5rem`}),brand:i({display:`flex`,alignItems:`center`,gap:`0.875rem`}),brandMark:i({display:`grid`,width:`2.625rem`,height:`2.625rem`,placeItems:`center`,borderRadius:`0.75rem`,background:`gray.900`,color:`white`,fontSize:`1rem`,fontWeight:`750`,boxShadow:`0 5px 14px rgb(32 33 38 / 0.16)`}),topbarActions:i({display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:`0.625rem`}),eyebrow:i({margin:`0 0 0.2rem`,color:`gray.600`,fontSize:`0.65rem`,fontWeight:`700`,letterSpacing:`0.1em`,textTransform:`uppercase`}),title:i({margin:`0`,fontSize:`clamp(1.5rem, 4vw, 1.875rem)`,fontWeight:`700`,letterSpacing:`-0.035em`,lineHeight:`1.05`}),button:i({border:`1px solid token(colors.gray.300)`,borderRadius:`0.625rem`,background:`white`,color:`gray.900`,padding:`0.5625rem 0.75rem`,fontWeight:`600`,boxShadow:`0 1px 2px rgb(32 33 38 / 0.05)`,transition:`border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease`,"&:hover":{borderColor:`gray.500`,boxShadow:`0 3px 8px rgb(32 33 38 / 0.08)`,transform:`translateY(-1px)`},"&:focus-visible":{outline:`3px solid rgb(91 91 214 / 0.22)`,outlineOffset:`2px`},"&:disabled":{opacity:`0.55`}}),primaryButton:i({border:`1px solid token(colors.indigo.600)`,borderRadius:`0.625rem`,background:`indigo.600`,color:`white`,padding:`0.5625rem 0.75rem`,fontWeight:`600`,boxShadow:`0 4px 10px rgb(91 91 214 / 0.2)`,transition:`filter 150ms ease, transform 150ms ease`,"&:hover:not(:disabled)":{filter:`brightness(0.94)`,transform:`translateY(-1px)`},"&:focus-visible":{outline:`3px solid rgb(91 91 214 / 0.22)`,outlineOffset:`2px`},"&:disabled":{borderColor:`gray.300`,background:`gray.100`,color:`gray.500`,boxShadow:`none`,opacity:`1`}}),smallButton:i({border:`1px solid token(colors.gray.300)`,borderRadius:`0.5rem`,background:`white`,color:`gray.900`,padding:`0.4rem 0.625rem`,fontSize:`0.75rem`,fontWeight:`600`,transition:`border-color 150ms ease, background 150ms ease`,"&:hover":{borderColor:`indigo.600`,background:`gray.100`}}),status:i({display:`inline-flex`,alignItems:`center`,borderRadius:`999px`,gap:`0.4rem`,padding:`0.5rem 0.7rem`,fontSize:`0.75rem`,fontWeight:`650`,lineHeight:`1`,whiteSpace:`nowrap`,"&::before":{width:`0.4rem`,height:`0.4rem`,borderRadius:`50%`,background:`currentColor`,content:`''`}}),success:i({background:`green.50`,color:`green.700`}),warning:i({background:`yellow.50`,color:`yellow.700`}),danger:i({background:`red.50`,color:`red.700`}),neutral:i({background:`gray.100`,color:`gray.600`}),summary:i({position:`relative`,display:`grid`,gridTemplateColumns:{base:`1fr`,md:`minmax(0, 1.05fr) minmax(21rem, 0.95fr)`},alignItems:`center`,gap:{base:`1.5rem`,md:`2.5rem`},overflow:`hidden`,border:`1px solid token(colors.gray.200)`,borderRadius:`1rem`,background:`linear-gradient(135deg, #ffffff 20%, #f8f7ff 100%)`,padding:{base:`1.25rem`,md:`1.75rem 2rem`},boxShadow:`0 12px 35px rgb(32 33 38 / 0.055)`,"&::after":{position:`absolute`,top:`-5rem`,right:`-3rem`,width:`11rem`,height:`11rem`,borderRadius:`50%`,background:`rgb(91 91 214 / 0.06)`,content:`''`,pointerEvents:`none`}}),summaryTitle:i({margin:`0`,fontSize:`clamp(1.4rem, 3vw, 1.8rem)`,fontWeight:`680`,letterSpacing:`-0.025em`,lineHeight:`1.2`}),muted:i({maxWidth:`47.5rem`,margin:`0.5rem 0 0`,color:`gray.600`,fontSize:`0.875rem`,lineHeight:`1.55`}),summaryFacts:i({position:`relative`,zIndex:`1`,display:`grid`,gridTemplateColumns:{base:`1fr`,sm:`repeat(3, minmax(0, 1fr))`},gap:`0.625rem`,margin:`0`}),summaryFact:i({minWidth:`0`,border:`1px solid rgb(229 228 223 / 0.9)`,borderRadius:`0.75rem`,background:`rgb(255 255 255 / 0.8)`,padding:`0.875rem`,boxShadow:`0 2px 10px rgb(32 33 38 / 0.035)`,"& dt":{color:`gray.500`,fontSize:`0.625rem`,fontWeight:`700`,letterSpacing:`0.035em`,textTransform:`uppercase`},"& dd":{margin:`0.35rem 0 0`,fontSize:`0.925rem`,fontWeight:`650`,lineHeight:`1.3`}}),grid:i({display:`grid`,gridTemplateColumns:{base:`1fr`,md:`repeat(2, minmax(0, 1fr))`},gap:`1rem`,paddingTop:`1rem`}),section:i({minWidth:`0`,gridColumn:{base:`auto`,md:`1 / -1`},border:`1px solid token(colors.gray.200)`,borderRadius:`1rem`,background:`white`,padding:{base:`1.125rem`,md:`1.375rem 1.5rem`},boxShadow:`0 5px 18px rgb(32 33 38 / 0.035)`}),sectionHeader:i({marginBottom:`1rem`,"& h2":{margin:`0`,fontSize:`1.05rem`,fontWeight:`680`,letterSpacing:`-0.015em`},"& p":{margin:`0.3rem 0 0`,color:`gray.600`,fontSize:`0.8125rem`,lineHeight:`1.45`}}),environmentNotice:i({margin:`0.75rem 0`,borderRadius:`0.625rem`,background:`yellow.50`,color:`yellow.700`,padding:`0.625rem 0.75rem`,fontSize:`0.75rem`,lineHeight:`1.45`}),environmentTableFrame:i({overflowX:`auto`}),environmentTable:i({width:`100%`,borderCollapse:`collapse`,textAlign:`left`,"& th, & td":{borderTop:`1px solid token(colors.gray.200)`,padding:`0.75rem`,verticalAlign:`top`,fontSize:`0.75rem`},"& thead th":{borderTop:`0`,color:`gray.500`,fontSize:`0.65rem`,fontWeight:`700`,letterSpacing:`0.04em`,textTransform:`uppercase`},"& tbody th":{minWidth:`16rem`,fontWeight:`600`},"& code":{fontSize:`0.75rem`},"& tbody th span":{display:`block`,maxWidth:`28rem`,marginTop:`0.25rem`,color:`gray.600`,fontWeight:`400`,lineHeight:`1.4`}}),environmentState:i({display:`inline-flex`,borderRadius:`999px`,background:`gray.100`,color:`gray.600`,padding:`0.3125rem 0.5rem`,fontSize:`0.6875rem`,fontWeight:`650`,lineHeight:`1`,whiteSpace:`nowrap`}),environmentStateOk:i({background:`green.50`,color:`green.700`}),environmentStateMissing:i({background:`red.50`,color:`red.700`}),environmentStatePending:i({background:`yellow.50`,color:`yellow.800`}),list:i({listStyle:`none`,margin:`0`,padding:`0`}),empty:i({borderTop:`1px solid token(colors.gray.200)`,paddingTop:`0.875rem`,"& strong":{fontSize:`0.8125rem`},"& p":{margin:`0.25rem 0 0`,color:`gray.600`,fontSize:`0.8125rem`}}),developmentRow:i({display:`flex`,alignItems:{base:`flex-start`,sm:`center`},justifyContent:`space-between`,flexDirection:{base:`column`,sm:`row`},gap:`1rem`,borderTop:`1px solid token(colors.gray.200)`,padding:`0.875rem 0`,"&:first-child":{borderTop:`0`,paddingTop:`0.125rem`},"&:last-child":{paddingBottom:`0.125rem`}}),developmentCopy:i({"& strong, & span, & small":{display:`block`},"& span":{marginTop:`0.1875rem`,color:`gray.600`,fontSize:`0.8125rem`},"& small":{marginTop:`0.25rem`,color:`gray.500`,fontSize:`0.75rem`}}),developmentActions:i({display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:`0.625rem`}),openAppLink:i({display:`inline-flex`,alignItems:`center`,gap:`0.35rem`,border:`1px solid token(colors.gray.300)`,borderRadius:`0.625rem`,background:`white`,color:`gray.900`,padding:`0.5625rem 0.75rem`,fontSize:`0.8125rem`,fontWeight:`650`,textDecoration:`none`,boxShadow:`0 1px 2px rgb(32 33 38 / 0.05)`,transition:`border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease`,"&:hover":{borderColor:`indigo.600`,boxShadow:`0 3px 8px rgb(32 33 38 / 0.08)`,transform:`translateY(-1px)`},"&:focus-visible":{outline:`3px solid rgb(91 91 214 / 0.22)`,outlineOffset:`2px`}}),terminal:i({overflow:`hidden`,marginTop:`1rem`,border:`1px solid #30323a`,borderRadius:`0.75rem`,background:`#17181d`,boxShadow:`inset 0 1px 0 rgb(255 255 255 / 0.04)`}),terminalHeader:i({display:`flex`,alignItems:`center`,justifyContent:`space-between`,borderBottom:`1px solid #30323a`,padding:`0.625rem 0.75rem`,color:`#b9bdc9`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,fontSize:`0.6875rem`,fontWeight:`650`,letterSpacing:`0.04em`,textTransform:`uppercase`,"& span:last-child":{color:`#737886`}}),terminalOutput:i({display:`block`,minHeight:`7rem`,maxHeight:`20rem`,overflow:`auto`,margin:`0`,padding:`0.875rem`,color:`#dfe2ea`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,fontSize:`0.75rem`,lineHeight:`1.55`,tabSize:`2`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,"& > span":{display:`inline`}}),terminalError:i({color:`#ff9b92`}),terminalEmpty:i({color:`#737886`,fontStyle:`italic`}),error:i({margin:`0.75rem 0 0`,color:`red.700`,fontSize:`0.8125rem`}),findingRow:i({borderTop:`1px solid token(colors.gray.200)`,padding:`1.125rem 0`,"&:first-child":{borderTop:`0`,paddingTop:`0.125rem`},"&:last-child":{paddingBottom:`0.125rem`}}),findingTitle:i({display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:`0.5rem`,"& h3":{margin:`0`,fontSize:`0.9rem`,fontWeight:`650`}}),findingArea:i({color:`gray.500`,fontSize:`0.6875rem`,fontWeight:`700`,letterSpacing:`0.04em`,textTransform:`uppercase`,whiteSpace:`nowrap`}),findingStatus:i({display:`inline-flex`,marginLeft:`auto`,borderRadius:`999px`,padding:`0.3125rem 0.5rem`,fontSize:`0.75rem`,fontWeight:`650`,lineHeight:`1`,whiteSpace:`nowrap`}),dot:i({width:`0.4375rem`,height:`0.4375rem`,flex:`0 0 auto`,borderRadius:`50%`}),successDot:i({background:`green.700`}),warningDot:i({background:`yellow.700`}),dangerDot:i({background:`red.700`}),evidence:i({display:`flex`,flexWrap:`wrap`,gap:`0.375rem 1.125rem`,margin:`0.625rem 0 0 0.9375rem`,"& > div":{display:`flex`,alignItems:`baseline`,gap:`0.3125rem`},"& dt":{color:`gray.500`,fontSize:`0.6875rem`,fontWeight:`700`,textTransform:`uppercase`},"& dd":{margin:`0`,fontSize:`0.75rem`,fontWeight:`600`}}),actions:i({display:`grid`,gap:`0.5rem`,margin:`0.75rem 0 0 0.9375rem`,"& a":{width:`fit-content`,color:`indigo.600`,fontSize:`0.8125rem`,fontWeight:`600`}}),action:i({display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:`0.5rem`,"& > span:first-child":{fontSize:`0.8125rem`,fontWeight:`600`}}),linkRow:i({borderTop:`1px solid token(colors.gray.200)`,"&:first-child":{borderTop:`0`},"& a":{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`1rem`,padding:`0.6875rem 0`,color:`indigo.600`,fontWeight:`600`,textDecoration:`none`,"&:hover":{textDecoration:`underline`}}})};function me(e){let t={protocol:null,hostname:null,port:null,pathname:null,search:null},n=e.indexOf(`?`);n!==-1&&(t.search=F(n+1,e.length),e=e.slice(0,n));let r=e.indexOf(`://`);if(r===-1)return t.pathname=ge(e,0,e.length),t;let i=e.indexOf(`/`);if(i===r+1&&(i=e.indexOf(`/`,r+3)),i===-1){t.protocol=F(0,r);let n=F(r+3,e.length);if(n){let{hostname:r,port:i}=he(e,n);t.hostname=r,t.port=i}return t}if(i<r)return t.pathname=ge(e,0,e.length),t;t.protocol=F(0,r);let a=F(r+3,i);if(a){let{hostname:n,port:r}=he(e,a);t.hostname=n,t.port=r}return t.pathname=ge(e,i,e.length),t}function F(e,t){return e===t?null:[e,t]}function he(e,t){let n=e.slice(0,t[1]).lastIndexOf(`:`);return n===-1||n<t[0]?{hostname:t,port:null}:e.slice(n+1,t[1]).match(/^\d+$/)?{hostname:F(t[0],n),port:F(n+1,t[1])}:{hostname:t,port:null}}function ge(e,t,n){return e[t]===`/`&&(t+=1),F(t,n)}var _e=/^[a-zA-Z_$][a-zA-Z_$0-9]*/;function ve(e){let t=me(e);return new Fe({protocol:be(e,t.protocol),hostname:xe(e,t.hostname),port:t.port?e.slice(...t.port):null,pathname:t.pathname?ye(e,{span:t.pathname,type:`pathname`}):ye(``,{span:[0,0],type:`pathname`}),search:t.search?Ce(e.slice(...t.search)):new Map})}function ye(e,t){let n=t.span??[0,e.length],r=t.type===`hostname`?`.`:`/`,i=[],a=new Map,o=e=>{let t=i.at(-1);t?.type===`text`?t.text+=e:i.push({type:`text`,text:e})},s=n[0],c=[];for(;s<n[1];){let t=e[s];if(t===`(`){c.push(i.length),i.push({type:t}),s+=1;continue}if(t===`)`){let n=c.pop();if(n===void 0)throw new we(`unmatched )`,e,s);a.set(n,i.length),i.push({type:t}),s+=1;continue}if(t===`:`){s+=1;let t=_e.exec(e.slice(s,n[1]))?.[0];if(!t)throw new we(`missing variable name`,e,s-1);i.push({type:`:`,name:t}),s+=t.length;continue}if(t===`*`){s+=1;let t=_e.exec(e.slice(s,n[1]))?.[0];i.push({type:`*`,name:t??`*`}),s+=t?.length??0;continue}if(t===r){i.push({type:`separator`}),s+=1;continue}if(t===`\\`){if(s+1===n[1])throw new we(`dangling escape`,e,s);o(e.slice(s+1,s+2)),s+=2;continue}o(t),s+=1}if(c.length>0)throw new we(`unmatched (`,e,c.at(-1));return{tokens:i,optionals:a,type:t.type}}function be(e,t){if(!t)return null;let n=e.slice(...t);if(n===``||n===`http`||n===`https`||n===`http(s)`)return n===``?null:n;throw new we(`invalid protocol`,e,t[0])}function xe(e,t){if(!t)return null;let n=ye(e,{span:t,type:`hostname`});return Se(n)?null:n}function Se(e){if(e.tokens.length!==1)return!1;let t=e.tokens[0];return t.type===`*`?t.name===`*`:!1}function Ce(e){let t=new Map,n=new URLSearchParams(e);for(let[e,r]of n){let n=t.get(e);n||(n=new Set,t.set(e,n)),r!==``&&n.add(r)}return t}var we=class extends Error{type;source;index;constructor(e,t,n){let r=`${e}\n\n${t}\n${` `.repeat(n)+`^`}`;super(r),this.name=`ParseError`,this.type=e,this.source=t,this.index=n}};function Te(e){let t=e===void 0?`Unreachable`:`Unreachable: ${e}`;throw Error(t)}function Ee(e){let t=Oe(e),n=ke(e),r=Ae(e),i=je(e),a=Me(e),o=``;return(t||n||r)&&(o+=`${t}://${n}${r===``?``:`:${r}`}`),o+=`/`+i,a&&(o+=`?${a}`),o}function De(e){return{protocol:Oe(e),hostname:ke(e),port:Ae(e),pathname:je(e),search:Me(e)}}function Oe(e){return e.protocol??``}function ke(e){return e.hostname?Pe(e.hostname):``}function Ae(e){return e.port??``}function je(e){return Pe(e.pathname)}function Me(e){if(e.search.size===0)return``;let t=new URLSearchParams;for(let[n,r]of e.search)if(r.size===0)t.append(n,``);else for(let e of r)t.append(n,e);return t.toString()}function Ne(e){return e.replaceAll(/[:*()\\]/g,`\\$&`)}function Pe(e){let t=e.type===`hostname`?`.`:`/`,n=``;for(let r of e.tokens){if(r.type===`(`||r.type===`)`){n+=r.type;continue}if(r.type===`text`){n+=Ne(r.text);continue}if(r.type===`:`||r.type===`*`){let e=r.name===`*`?``:r.name;n+=`${r.type}${e}`;continue}if(r.type===`separator`){n+=t;continue}Te(r.type)}return n}var Fe=class{protocol;hostname;port;pathname;search;static parse(e){return ve(e)}constructor(e){this.protocol=e.protocol,this.hostname=e.hostname,this.port=e.port,this.pathname=e.pathname,this.search=e.search}get source(){return Ee(this)}toString(){return this.source}toJSON(){return De(this)}};function Ie(e,...t){e=typeof e==`string`?Fe.parse(e):e;let[n,r]=t;r??={};let i=e.protocol!==null||e.hostname!==null||e.port!==null,a=``;if(i){let t=e.protocol===null||e.protocol===`http(s)`?`https`:e.protocol;if(e.hostname===null)throw new I({type:`missing-hostname`,pattern:e});let r=Le(e,e.hostname,n??{}),i=e.port===null?``:`:${e.port}`;a+=`${t}://${r}${i}`}let o=Le(e,e.pathname,n??{});a+=`/`+o;let s=Re(e,r);return s&&(a+=`?${s}`),a}function Le(e,t,n){let r=t.type===`hostname`?`.`:`/`,i=[],a=[{href:``}],o=0;for(;o<t.tokens.length;){let s=t.tokens[o];if(s.type===`text`){a[a.length-1].href+=s.text,o+=1;continue}if(s.type===`separator`){a[a.length-1].href+=r,o+=1;continue}if(s.type===`(`){a.push({begin:o,href:``}),o+=1;continue}if(s.type===`)`){let e=a.pop();a[a.length-1].href+=e.href,o+=1;continue}if(s.type===`:`||s.type===`*`){let r=n[s.name];if(r==null){if(a.length<=1){if(s.name===`*`)throw new I({type:`nameless-wildcard`,pattern:e});i.push(s.name)}let n=a.pop();o=t.optionals.get(n.begin)+1;continue}a[a.length-1].href+=t.type===`pathname`&&s.type===`:`?ze(e,s.name,r):t.type===`pathname`&&s.type===`*`?Be(r):t.type===`hostname`&&s.type===`:`?We(r):t.type===`hostname`&&s.type===`*`?Ge(r):Te(),o+=1;continue}Te(s.type)}if(i.length>0)throw new I({type:`missing-params`,pattern:e,part:t,missingParams:i,params:n});return a.length!==1&&Te(),a[0].href}function Re(e,t){let n=e.search;if(n.size===0&&Object.keys(t).length===0)return;let r=new URLSearchParams;for(let[e,n]of Object.entries(t))if(Array.isArray(n))for(let t of n)t!=null&&r.append(e,String(t));else n!=null&&r.append(e,String(n));for(let[e,i]of n)if(i.size===0){if(e in t)continue;r.append(e,``)}else for(let t of i)r.getAll(e).includes(t)||r.append(e,t);return r.toString()||void 0}var I=class e extends Error{details;constructor(t){super(e.message(t)),this.name=`CreateHrefError`,this.details=t}static message(e){if(e.type===`missing-hostname`)return`pattern requires hostname\n\nPattern: ${e.pattern}`;if(e.type===`nameless-wildcard`)return`pattern contains nameless wildcard\n\nPattern: ${e.pattern}`;if(e.type===`missing-params`)return`missing param(s): ${e.missingParams.map(e=>`'${e}'`).join(`, `)}\n\nPattern: ${e.pattern}\nParams: ${JSON.stringify(e.params)}`;if(e.type===`invalid-hostname-variable`)return`invalid hostname variable param: ${JSON.stringify(e.value)} contains ${JSON.stringify(e.char)}`;if(e.type===`invalid-hostname-wildcard`)return`invalid hostname wildcard param: ${JSON.stringify(e.value)} contains ${JSON.stringify(e.char)}`;if(e.type===`invalid-pathname-variable`)return`invalid pathname variable param: '${e.paramName}' cannot be empty\n\nPattern: ${e.pattern}\nValue: ${JSON.stringify(e.value)}`;Te(e)}};function ze(e,t,n){let r=String(n);if(r.length===0)throw new I({type:`invalid-pathname-variable`,pattern:e,paramName:t,value:r});return He(r)}function Be(e){return String(e).split(`/`).map(He).join(`/`)}var Ve={"/":`%2F`,"?":`%3F`,"#":`%23`,"%":`%25`,"\\":`%5C`};function He(e){let t=``;for(let n of e){let e=Ve[n];t+=e===void 0?n:e}return t}var Ue=[`@`,`:`,`/`,`?`,`#`];function We(e){let t=String(e);for(let e of t)if(e===`.`||Ue.includes(e))throw new I({type:`invalid-hostname-variable`,value:t,char:e});return t}function Ge(e){let t=String(e);for(let e of t)if(Ue.includes(e))throw new I({type:`invalid-hostname-wildcard`,value:t,char:e});return t}function Ke(e,t=e=>e===void 0){return e?Object.keys(e).reduce((n,r)=>(t(e[r])||(n[r]=e[r]),n),{}):{}}var qe=Symbol(`rouzer.metadata`);function Je(e){return typeof e==`object`&&e?e[qe]:void 0}function Ye(e){let{[qe]:t,...n}=e;return n}function Xe(e,t){let n=Je(t);return{kind:`resource`,path:Fe.parse(e),children:Ye(t),metadata:n}}function Ze(e,t){return et(`GET`,e,t)}function Qe(e,t){return et(`POST`,e,t)}function $e(e){return!!(e&&typeof e==`object`&&`__rawBody__`in e)}function et(e,t,n){let r=typeof t==`string`?Fe.parse(t):void 0;n??=typeof t==`string`?{}:t;let i=Je(n);return{kind:`action`,path:r,method:e,schema:Ye(n),metadata:i}}var tt=Symbol.for(`rouzer.response-plugin`);function nt(e){return rt(e)?e[tt].id:void 0}function rt(e){return typeof e==`object`&&!!e&&tt in e}function it(e=[],t=`response`){let n=new Map;for(let r of e){if(n.has(r.id))throw Error(`Duplicate ${t} plugin: ${r.id}`);n.set(r.id,r)}return n}function L(){return L.symbol}L.symbol=Symbol();function at(){return at.symbol}at.symbol=Symbol();function ot(e){return typeof e==`object`&&!!e&&!(tt in e)}function st(e){return e===at.symbol}function ct(e){return Object.values(e).flatMap(e=>{let t=nt(e);return t?[t]:[]})}var lt=0;function ut(e){let t=e.baseURL.replace(/\/?$/,`/`),n=e.headers&&Ke(e.headers),r=e.fetch??globalThis.fetch,i=it(e.plugins,`client response`);yt(e.routes,i);async function a(e){let{path:i,method:a,input:o={},schema:s}=e,{body:c,...l}=e.options??{},{headers:u,...d}=l,f=s.path?s.path.parse(St(s.path,o)):o,p,m=Ie(i,f);if(m[0]===`/`?(p=new URL(t),p.pathname+=m.slice(1)):p=new URL(m,t),s.query){let e=s.query.parse(St(s.query,o));p.search=new URLSearchParams(Ke(e)).toString()}let h;return s.body&&(h=$e(s.body)?c:s.body.parse(St(s.body,o))),u&&=Ke(u),n&&(u=u?{...n,...u}:n),s.headers&&(u=s.headers.parse(u)),await r(p,{...d,method:a,body:$e(s.body)?h:h===void 0?void 0:JSON.stringify(h),headers:u??n})}async function o(e,t){let n=t.schema.response;if(ot(n)){let r=e.status;if(r in n){let a=n[r];if(st(a))return[await e.json(),null,r];let o=nt(a);if(o){let n=i.get(o);if(!n)throw bt(o);return[null,await n.decode(e,{marker:a,request:t}),r]}return[null,await e.json(),r]}return l(e,t)}if(!e.ok)return l(e,t);let r=nt(n);if(r){let a=i.get(r);if(!a)throw bt(r);return a.decode(e,{marker:n,request:t})}return e.json()}async function s(e){let t=await a(e);return{value:t,status:t.status}}async function c(e){let t=await a(e);try{return{value:await o(t,e),status:t.status}}catch(e){throw new dt(e,t.status)}}async function l(t,n){if(e.onJsonError)return e.onJsonError(t);let r=Error(`Request to ${n.method} ${Ie(n.path,n.input)} failed with status ${t.status}`);throw t.headers.get(`content-type`)?.includes(`application/json`)&&Object.assign(r,await t.json()),r}return{...ft(e.routes,``,``,s,c,e.clientHook),clientConfig:e}}var dt=class{error;status;constructor(e,t){this.error=e,this.status=t}};function ft(e,t,n,r,i,a){return Object.fromEntries(Object.entries(e).map(([e,o])=>{if(o.kind===`resource`)return[e,ft(o.children,Ct(t,o.path.source),vt(n,e),r,i,a)];let s=Fe.parse(Ct(t,o.path?.source??``)),c=o.schema.response?i:r,l=vt(n,e);return[e,(e,t)=>{let n=e;return $e(o.schema.body)&&!xt(o,s)&&(t={...t,body:e},e=void 0),pt({schema:o.schema,path:s,routeName:l,method:o.method,input:e,payload:n,options:t,$result:void 0},c,a)}]}))}async function pt(e,t,n){if(!n)try{return(await t(e)).value}catch(e){throw gt(e)?.error??e}let r=ht(),i=Date.now(),a={opId:r,routeName:e.routeName,method:e.method,pathPattern:e.path.source,payload:e.payload};mt(n,{type:`request.start`,...a});try{let r=await t(e);return mt(n,{type:`request.success`,...a,response:r.value,..._t(r.status),durationMs:Date.now()-i}),r.value}catch(e){let t=gt(e),r=t?t.error:e;throw mt(n,{type:`request.error`,...a,error:r,..._t(t?.status),durationMs:Date.now()-i}),r}}function mt(e,t){try{e(t)}catch{}}function ht(){return lt+=1,`rouzer:${Date.now().toString(36)}:${lt.toString(36)}`}function gt(e){return e instanceof dt?e:void 0}function _t(e){return e===void 0?{}:{status:e}}function vt(e,t){return[e,t].filter(Boolean).join(`.`)}function yt(e,t){for(let n of Object.values(e))if(n.kind===`resource`)yt(n.children,t);else{let e=ot(n.schema.response)?ct(n.schema.response):[nt(n.schema.response)].filter(e=>e!==void 0);for(let n of e)if(!t.has(n))throw bt(n)}}function bt(e){return Error(`Missing client response plugin for ${e}`)}function xt(e,t){return!!(e.schema.path||e.schema.query||/(^|\/)[:*]/.test(t.source))}function St(e,t){return typeof t!=`object`||!t?t:Object.fromEntries(Object.keys(e.shape).filter(e=>e in t).map(e=>[e,t[e]]))}function Ct(e,t){return[e,t].filter(Boolean).join(`/`).replace(/\/+/g,`/`)}var wt;function R(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var z=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Tt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(wt=globalThis).__zod_globalConfig??(wt.__zod_globalConfig={});var Et=globalThis.__zod_globalConfig;function B(e){return e&&Object.assign(Et,e),Et}function Dt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ot(e,t){return typeof t==`bigint`?t.toString():t}function kt(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function At(e){return e==null}function jt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var Mt=Symbol(`evaluating`);function V(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Mt)return r===void 0&&(r=Mt,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function H(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function U(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Nt(e){return JSON.stringify(e)}var Pt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ft(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var It=kt(()=>{if(Et.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Lt(e){if(Ft(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Ft(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Rt(e){return Lt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var zt=new Set([`string`,`number`,`symbol`]);function Bt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function W(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function G(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Vt(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function Ht(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return W(e,U(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return H(this,`shape`,e),e},checks:[]}))}function Ut(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return W(e,U(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return H(this,`shape`,r),r},checks:[]}))}function Wt(e,t){if(!Lt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return W(e,U(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return H(this,`shape`,n),n}}))}function Gt(e,t){if(!Lt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return W(e,U(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return H(this,`shape`,n),n}}))}function Kt(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return W(e,U(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return H(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function qt(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return W(t,U(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return H(this,`shape`,i),i},checks:[]}))}function Jt(e,t,n){return W(t,U(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return H(this,`shape`,i),i}}))}function K(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Yt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Xt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Zt(e){return typeof e==`string`?e:e?.message}function q(e,t,n){let r=e.message?e.message:Zt(e.inst?._zod.def?.error?.(e))??Zt(t?.error?.(e))??Zt(n.customError?.(e))??Zt(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Qt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function $t(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var en=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ot,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tn=R(`$ZodError`,en),nn=R(`$ZodError`,en,{Parent:Error});function rn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function an(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var on=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new z;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>q(e,a,B())));throw Pt(t,i?.callee),t}return o.value},sn=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>q(e,a,B())));throw Pt(t,i?.callee),t}return o.value},cn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new z;return a.issues.length?{success:!1,error:new(e??tn)(a.issues.map(e=>q(e,i,B())))}:{success:!0,data:a.value}},ln=cn(nn),un=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>q(e,i,B())))}:{success:!0,data:a.value}},dn=un(nn),fn=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return on(e)(t,n,i)},pn=e=>(t,n,r)=>on(e)(t,n,r),mn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return sn(e)(t,n,i)},hn=e=>async(t,n,r)=>sn(e)(t,n,r),gn=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return cn(e)(t,n,i)},_n=e=>(t,n,r)=>cn(e)(t,n,r),vn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return un(e)(t,n,i)},yn=e=>async(t,n,r)=>un(e)(t,n,r),J=R(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bn=R(`$ZodCheckMaxLength`,(e,t)=>{var n;J.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!At(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Qt(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),xn=R(`$ZodCheckMinLength`,(e,t)=>{var n;J.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!At(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Qt(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Sn=R(`$ZodCheckLengthEquals`,(e,t)=>{var n;J.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!At(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Qt(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Cn=R(`$ZodCheckOverwrite`,(e,t)=>{J.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),wn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
3
+ `))}},Tn={major:4,minor:4,patch:3},Y=R(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=K(e),i;for(let a of t){if(a._zod.def.when){if(Yt(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new z;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=K(e,t))});else{if(e.issues.length===t)continue;r||=K(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(K(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new z;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new z;return o.then(e=>t(e,r,a))}return t(o,r,a)}}V(e,`~standard`,()=>({validate:t=>{try{let n=ln(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return dn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),En=R(`$ZodUnknown`,(e,t)=>{Y.init(e,t),e._zod.parse=e=>e}),Dn=R(`$ZodNever`,(e,t)=>{Y.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function On(e,t,n){e.issues.length&&t.issues.push(...Xt(n,e.issues)),t.value[n]=e.value}var kn=R(`$ZodArray`,(e,t)=>{Y.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>On(t,n,e))):On(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function An(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Xt(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function jn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Vt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Mn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>An(e,n,i,t,u,d))):An(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Nn=R(`$ZodObject`,(e,t)=>{if(Y.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=kt(()=>jn(t));V(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Ft,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>An(n,t,e,s,r,i))):An(a,t,e,s,r,i)}return i?Mn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Pn=R(`$ZodObjectJIT`,(e,t)=>{Nn.init(e,t);let n=e._zod.parse,r=kt(()=>jn(t)),i=e=>{let t=new wn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Nt(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Nt(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
4
+ if (${n}.issues.length) {
5
+ if (${o} in input) {
6
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
7
+ ...iss,
8
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
9
+ })));
10
+ }
11
+ }
12
+
13
+ if (${n}.value === undefined) {
14
+ if (${o} in input) {
15
+ newResult[${o}] = undefined;
16
+ }
17
+ } else {
18
+ newResult[${o}] = ${n}.value;
19
+ }
20
+
21
+ `):c?t.write(`
22
+ if (${n}.issues.length) {
23
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
24
+ ...iss,
25
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
26
+ })));
27
+ }
28
+
29
+ if (${n}.value === undefined) {
30
+ if (${o} in input) {
31
+ newResult[${o}] = undefined;
32
+ }
33
+ } else {
34
+ newResult[${o}] = ${n}.value;
35
+ }
36
+
37
+ `):t.write(`
38
+ const ${n}_present = ${o} in input;
39
+ if (${n}.issues.length) {
40
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
41
+ ...iss,
42
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
43
+ })));
44
+ }
45
+ if (!${n}_present && !${n}.issues.length) {
46
+ payload.issues.push({
47
+ code: "invalid_type",
48
+ expected: "nonoptional",
49
+ input: undefined,
50
+ path: [${o}]
51
+ });
52
+ }
53
+
54
+ if (${n}_present) {
55
+ if (${n}.value === undefined) {
56
+ newResult[${o}] = undefined;
57
+ } else {
58
+ newResult[${o}] = ${n}.value;
59
+ }
60
+ }
61
+
62
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Ft,s=!Et.jitless,c=s&&It.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Mn([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Fn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!K(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>q(e,r,B())))}),t)}var In=R(`$ZodUnion`,(e,t)=>{Y.init(e,t),V(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),V(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),V(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),V(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>jt(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Fn(t,r,e,i)):Fn(o,r,e,i)}}),Ln=R(`$ZodIntersection`,(e,t)=>{Y.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>zn(e,t,n)):zn(e,i,a)}});function Rn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Lt(e)&&Lt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Rn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Rn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function zn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),K(e))return e;let o=Rn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Bn=R(`$ZodEnum`,(e,t)=>{Y.init(e,t);let n=Dt(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>zt.has(typeof e)).map(e=>typeof e==`string`?Bt(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Vn=R(`$ZodLiteral`,(e,t)=>{if(Y.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Bt(e):e?Bt(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Hn=R(`$ZodTransform`,(e,t)=>{Y.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Tt(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new z;return n.value=i,n.fallback=!0,n}});function Un(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Wn=R(`$ZodOptional`,(e,t)=>{Y.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,V(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${jt(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Un(e,r)):Un(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Gn=R(`$ZodExactOptional`,(e,t)=>{Wn.init(e,t),V(e._zod,`values`,()=>t.innerType._zod.values),V(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Kn=R(`$ZodNullable`,(e,t)=>{Y.init(e,t),V(e._zod,`optin`,()=>t.innerType._zod.optin),V(e._zod,`optout`,()=>t.innerType._zod.optout),V(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${jt(e.source)}|null)$`):void 0}),V(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),qn=R(`$ZodDefault`,(e,t)=>{Y.init(e,t),e._zod.optin=`optional`,V(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Jn(e,t)):Jn(r,t)}});function Jn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Yn=R(`$ZodPrefault`,(e,t)=>{Y.init(e,t),e._zod.optin=`optional`,V(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Xn=R(`$ZodNonOptional`,(e,t)=>{Y.init(e,t),V(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Zn(t,e)):Zn(i,e)}});function Zn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Qn=R(`$ZodCatch`,(e,t)=>{Y.init(e,t),e._zod.optin=`optional`,V(e._zod,`optout`,()=>t.innerType._zod.optout),V(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>q(e,n,B()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>q(e,n,B()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),$n=R(`$ZodPipe`,(e,t)=>{Y.init(e,t),V(e._zod,`values`,()=>t.in._zod.values),V(e._zod,`optin`,()=>t.in._zod.optin),V(e._zod,`optout`,()=>t.out._zod.optout),V(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>er(e,t.in,n)):er(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>er(e,t.out,n)):er(r,t.out,n)}});function er(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var tr=R(`$ZodReadonly`,(e,t)=>{Y.init(e,t),V(e._zod,`propValues`,()=>t.innerType._zod.propValues),V(e._zod,`values`,()=>t.innerType._zod.values),V(e._zod,`optin`,()=>t.innerType?._zod?.optin),V(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(nr):nr(r)}});function nr(e){return e.value=Object.freeze(e.value),e}var rr=R(`$ZodCustom`,(e,t)=>{J.init(e,t),Y.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ir(t,n,r,e));ir(i,n,r,e)}});function ir(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push($t(e))}}var ar,or=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function sr(){return new or}(ar=globalThis).__zod_globalRegistry??(ar.__zod_globalRegistry=sr());var cr=globalThis.__zod_globalRegistry;function lr(e){return new e({type:`unknown`})}function ur(e,t){return new e({type:`never`,...G(t)})}function dr(e,t){return new bn({check:`max_length`,...G(t),maximum:e})}function fr(e,t){return new xn({check:`min_length`,...G(t),minimum:e})}function pr(e,t){return new Sn({check:`length_equals`,...G(t),length:e})}function mr(e){return new Cn({check:`overwrite`,tx:e})}function hr(e,t,n){return new e({type:`array`,element:t,...G(n)})}function gr(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...G(n)})}function _r(e,t){let n=vr(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push($t(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push($t(r))}},e(t.value,t)),t);return n}function vr(e,t){let n=new J({check:`custom`,...G(t)});return n._zod.check=e,n}function yr(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??cr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function X(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,X(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Z(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function br(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
63
+
64
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function xr(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Cr(t,`input`,e.processors),output:Cr(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Z(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Z(r.element,n);if(r.type===`set`)return Z(r.valueType,n);if(r.type===`lazy`)return Z(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Z(r.innerType,n);if(r.type===`intersection`)return Z(r.left,n)||Z(r.right,n);if(r.type===`record`||r.type===`map`)return Z(r.keyType,n)||Z(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Z(r.in,n)||Z(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Z(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Z(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Z(e,n))return!0;return!!(r.rest&&Z(r.rest,n))}return!1}var Sr=(e,t={})=>n=>{let r=yr({...n,processors:t});return X(e,r),br(r,e),xr(r,e)},Cr=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=yr({...i??{},target:a,io:t,processors:n});return X(e,o),br(o,e),xr(o,e)},wr=(e,t,n,r)=>{n.not={}},Tr=(e,t,n,r)=>{let i=e._zod.def,a=Dt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Er=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Dr=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Or=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},kr=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=X(a.element,t,{...r,path:[...r.path,`items`]})},Ar=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=X(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=X(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},jr=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>X(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Mr=(e,t,n,r)=>{let i=e._zod.def,a=X(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=X(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Nr=(e,t,n,r)=>{let i=e._zod.def,a=X(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Pr=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Fr=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ir=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Lr=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Rr=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;X(o,t,r);let s=t.seen.get(e);s.ref=o},zr=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Br=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Q=R(`ZodError`,(e,t)=>{tn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>an(e,t)},flatten:{value:t=>rn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ot,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ot,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Vr=on(Q),Hr=sn(Q),Ur=cn(Q),Wr=un(Q),Gr=fn(Q),Kr=pn(Q),qr=mn(Q),Jr=hn(Q),Yr=gn(Q),Xr=_n(Q),Zr=vn(Q),Qr=yn(Q),$r=new WeakMap;function ei(e,t,n){let r=Object.getPrototypeOf(e),i=$r.get(r);if(i||(i=new Set,$r.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var $=R(`ZodType`,(e,t)=>(Y.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Cr(e,`input`),output:Cr(e,`output`)}}),e.toJSONSchema=Sr(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Vr(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ur(e,t,n),e.parseAsync=async(t,n)=>Hr(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Wr(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Gr(e,t,n),e.decode=(t,n)=>Kr(e,t,n),e.encodeAsync=async(t,n)=>qr(e,t,n),e.decodeAsync=async(t,n)=>Jr(e,t,n),e.safeEncode=(t,n)=>Yr(e,t,n),e.safeDecode=(t,n)=>Xr(e,t,n),e.safeEncodeAsync=async(t,n)=>Zr(e,t,n),e.safeDecodeAsync=async(t,n)=>Qr(e,t,n),ei(e,`ZodType`,{check(...e){let t=this.def;return this.clone(U(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return W(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ri(e,t))},superRefine(e,t){return this.check(zi(e,t))},overwrite(e){return this.check(mr(e))},optional(){return bi(this)},exactOptional(){return Si(this)},nullable(){return wi(this)},nullish(){return bi(wi(this))},nonoptional(e){return Ai(this,e)},array(){return oi(this)},or(e){return ui([this,e])},and(e){return fi(this,e)},transform(e){return Pi(this,vi(e))},default(e){return Ei(this,e)},prefault(e){return Oi(this,e)},catch(e){return Mi(this,e)},pipe(e){return Pi(this,e)},readonly(){return Ii(this)},describe(e){let t=this.clone();return cr.add(t,{description:e}),t},meta(...e){if(e.length===0)return cr.get(this);let t=this.clone();return cr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return cr.get(e)?.description},configurable:!0}),e)),ti=R(`ZodUnknown`,(e,t)=>{En.init(e,t),$.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ni(){return lr(ti)}var ri=R(`ZodNever`,(e,t)=>{Dn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wr(e,t,n,r)});function ii(e){return ur(ri,e)}var ai=R(`ZodArray`,(e,t)=>{kn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kr(e,t,n,r),e.element=t.element,ei(e,`ZodArray`,{min(e,t){return this.check(fr(e,t))},nonempty(e){return this.check(fr(1,e))},max(e,t){return this.check(dr(e,t))},length(e,t){return this.check(pr(e,t))},unwrap(){return this.element}})});function oi(e,t){return hr(ai,e,t)}var si=R(`ZodObject`,(e,t)=>{Pn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ar(e,t,n,r),V(e,`shape`,()=>t.shape),ei(e,`ZodObject`,{keyof(){return mi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ni()})},loose(){return this.clone({...this._zod.def,catchall:ni()})},strict(){return this.clone({...this._zod.def,catchall:ii()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Wt(this,e)},safeExtend(e){return Gt(this,e)},merge(e){return Kt(this,e)},pick(e){return Ht(this,e)},omit(e){return Ut(this,e)},partial(...e){return qt(yi,this,e[0])},required(...e){return Jt(ki,this,e[0])}})});function ci(e,t){return new si({type:`object`,shape:e??{},...G(t)})}var li=R(`ZodUnion`,(e,t)=>{In.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jr(e,t,n,r),e.options=t.options});function ui(e,t){return new li({type:`union`,options:e,...G(t)})}var di=R(`ZodIntersection`,(e,t)=>{Ln.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mr(e,t,n,r)});function fi(e,t){return new di({type:`intersection`,left:e,right:t})}var pi=R(`ZodEnum`,(e,t)=>{Bn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tr(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new pi({...t,checks:[],...G(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new pi({...t,checks:[],...G(r),entries:i})}});function mi(e,t){return new pi({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...G(t)})}var hi=R(`ZodLiteral`,(e,t)=>{Vn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Er(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function gi(e,t){return new hi({type:`literal`,values:Array.isArray(e)?e:[e],...G(t)})}var _i=R(`ZodTransform`,(e,t)=>{Hn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Or(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Tt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push($t(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push($t(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function vi(e){return new _i({type:`transform`,transform:e})}var yi=R(`ZodOptional`,(e,t)=>{Wn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Br(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bi(e){return new yi({type:`optional`,innerType:e})}var xi=R(`ZodExactOptional`,(e,t)=>{Gn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Br(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Si(e){return new xi({type:`optional`,innerType:e})}var Ci=R(`ZodNullable`,(e,t)=>{Kn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wi(e){return new Ci({type:`nullable`,innerType:e})}var Ti=R(`ZodDefault`,(e,t)=>{qn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ei(e,t){return new Ti({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rt(t)}})}var Di=R(`ZodPrefault`,(e,t)=>{Yn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ir(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oi(e,t){return new Di({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rt(t)}})}var ki=R(`ZodNonOptional`,(e,t)=>{Xn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ai(e,t){return new ki({type:`nonoptional`,innerType:e,...G(t)})}var ji=R(`ZodCatch`,(e,t)=>{Qn.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Mi(e,t){return new ji({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Ni=R(`ZodPipe`,(e,t)=>{$n.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rr(e,t,n,r),e.in=t.in,e.out=t.out});function Pi(e,t){return new Ni({type:`pipe`,in:e,out:t})}var Fi=R(`ZodReadonly`,(e,t)=>{tr.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ii(e){return new Fi({type:`readonly`,innerType:e})}var Li=R(`ZodCustom`,(e,t)=>{rr.init(e,t),$.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dr(e,t,n,r)});function Ri(e,t={}){return gr(Li,e,t)}function zi(e,t){return _r(e,t)}var Bi={dashboard:Ze(`dashboard`,{response:L()})},Vi=ci({platform:mi([`web`,`desktop`,`ios`,`android`])}),Hi=ci({}),Ui={development:Xe(`development`,{status:Ze({response:L()}),start:Qe(`start`,{body:Vi,response:L()}),stop:Qe(`stop`,{body:Hi,response:L()})})};ci({ok:gi(!0)});var Wi={health:Ze(`health`,{response:L()}),...Bi,...Ui};function Gi(e){return ut({baseURL:e.baseURL,headers:{"content-type":`application/json`},routes:Wi,fetch:e.fetch})}function Ki(){return Gi({baseURL:new URL(`/__dashboard/api/`,window.location.origin).href})}var qi={overview:()=>pe({queryKey:[`dashboard`,`overview`],queryFn:()=>Ki().dashboard()}),development:()=>pe({queryKey:[`dashboard`,`development`],queryFn:()=>Ki().development.status(),staleTime:1e3})};function Ji({initialState:e,mutationToken:t}){let n=y(),[r,i]=(0,O.useState)(!1),[a,o]=(0,O.useState)(),s=(0,O.useRef)(null),c=(0,O.useRef)(!0),l=fe({...qi.development(),initialData:e,refetchInterval:e=>ta(e.state.data)?1e3:!1}),u=l.data,d=ta(u);(0,O.useEffect)(()=>{c.current&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[u.logs]);async function f(e){await m(()=>Ki().development.start({platform:e},{headers:{"x-coreframe-dashboard-token":t}}))}async function p(){await m(()=>Ki().development.stop({},{headers:{"x-coreframe-dashboard-token":t}}))}async function m(e){i(!0),o(void 0);try{let t=await e();n.setQueryData(qi.development().queryKey,t)}catch(e){o(e instanceof Error?e.message:`Development control failed.`)}finally{i(!1)}}return(0,j.jsxs)(`section`,{className:P.section,"aria-labelledby":`run-your-app-title`,children:[(0,j.jsx)(Yi,{title:`Run your app`,description:`Start one configured development target. Stop it before switching platforms.`}),u.targets.length===0?(0,j.jsx)(Xi,{title:`No development targets`,message:`Add development platforms to coreframe.config.ts to run the app here.`}):(0,j.jsx)(`ul`,{className:P.list,children:u.targets.map(e=>{let t=u.session?.platform===e.platform,n=t&&[`running`,`starting`].includes(u.session?.status??``),i=r||!e.available||d&&!n,a=t&&e.platform===`web`&&u.session?.status===`running`&&!!(u.session?.url&&u.session.readyAt);return(0,j.jsxs)(`li`,{className:P.developmentRow,children:[(0,j.jsxs)(`div`,{className:P.developmentCopy,children:[(0,j.jsx)(`strong`,{children:e.label}),(0,j.jsx)(`span`,{children:Zi(e.platform)}),(0,j.jsx)(`small`,{children:Qi(e,u)})]}),(0,j.jsxs)(`div`,{className:P.developmentActions,children:[a&&u.session?.url?(0,j.jsxs)(`a`,{className:P.openAppLink,href:u.session.url,rel:`noreferrer`,target:`_blank`,children:[`Open app `,(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`↗`})]}):null,(0,j.jsx)(`button`,{className:t&&d?P.button:P.primaryButton,disabled:i,onClick:()=>void(n?p():f(e.platform)),children:$i(e,u,r)})]})]},e.platform)})}),u.session?(0,j.jsxs)(`section`,{className:P.terminal,"aria-label":`Development server output`,children:[(0,j.jsxs)(`header`,{className:P.terminalHeader,children:[(0,j.jsx)(`span`,{children:`Live output`}),(0,j.jsx)(`span`,{children:u.session.platform})]}),(0,j.jsx)(`pre`,{className:P.terminalOutput,"aria-live":`off`,onScroll:e=>{let t=e.currentTarget;c.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},ref:s,children:u.logs.length?u.logs.map(e=>(0,j.jsx)(`span`,{className:e.stream===`stderr`?P.terminalError:void 0,children:e.text},e.sequence)):(0,j.jsx)(`span`,{className:P.terminalEmpty,children:`Waiting for output…`})})]}):null,a??l.error?.message?(0,j.jsx)(`p`,{className:P.error,role:`alert`,children:a??l.error?.message}):null,u.session?.message?(0,j.jsxs)(`p`,{className:P.error,role:`status`,children:[u.session.message,u.session.exitCode===void 0?``:` Exit code: ${u.session.exitCode}.`]}):null]})}function Yi(e){let t=(0,N.c)(8),{title:n,description:r}=e,i=`${n}-title`,a;t[0]!==i||t[1]!==n?(a=(0,j.jsx)(`h2`,{id:i,children:n}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=(0,j.jsx)(`p`,{children:r}),t[3]=r,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,j.jsxs)(`header`,{className:P.sectionHeader,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Xi(e){let t=(0,N.c)(7),{title:n,message:r}=e,i;t[0]===n?i=t[1]:(i=(0,j.jsx)(`strong`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,j.jsx)(`p`,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,j.jsxs)(`div`,{className:P.empty,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Zi(e){switch(e){case`web`:return`Browser development server`;case`desktop`:return`Tauri desktop app`;case`ios`:return`Tauri app for iPhone or iPad`;case`android`:return`Tauri app for Android`}}function Qi(e,t){return e.available?t.session?.platform===e.platform?e.platform===`web`&&t.session.status===`running`?t.session.readyAt?`Running at ${t.session.url}`:`Waiting for web server`:ea(t.session.status):ta(t)?`Stop ${t.targets.find(e=>e.platform===t.session?.platform)?.label??`the current target`} to start this target.`:`Ready to start`:e.unavailableReason}function $i(e,t,n){let r=t.session;return r?.platform===e.platform?n||r.status===`stopping`?r.status===`stopping`?`Stopping…`:`Working…`:r.status===`starting`?`Starting…`:r.status===`running`?`Stop ${e.label}`:`Start ${e.label}`:`Start ${e.label}`}function ea(e){return{starting:`Starting process`,running:`Development process running`,stopping:`Stopping process`,stopped:`Process stopped`,failed:`Process failed`}[e]}function ta(e){return[`running`,`starting`,`stopping`].includes(e?.session?.status??``)}function na(e){let t=(0,N.c)(14),{title:n,description:r,findings:i,emptyTitle:a,emptyMessage:o,copiedAction:s,copyError:c,onCopy:l}=e,u=`${n}-title`,d;t[0]!==r||t[1]!==n?(d=(0,j.jsx)(Yi,{title:n,description:r}),t[0]=r,t[1]=n,t[2]=d):d=t[2];let f;t[3]!==s||t[4]!==c||t[5]!==o||t[6]!==a||t[7]!==i||t[8]!==l?(f=i.length===0?(0,j.jsx)(Xi,{title:a,message:o}):(0,j.jsx)(`ul`,{className:P.list,children:i.map(e=>(0,j.jsx)(ra,{finding:e,copiedAction:s,copyError:c,onCopy:l},e.id))}),t[3]=s,t[4]=c,t[5]=o,t[6]=a,t[7]=i,t[8]=l,t[9]=f):f=t[9];let p;return t[10]!==u||t[11]!==d||t[12]!==f?(p=(0,j.jsxs)(`section`,{className:P.section,"aria-labelledby":u,children:[d,f]}),t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function ra(e){let t=(0,N.c)(37),{finding:n,copiedAction:r,copyError:i,onCopy:a}=e,o;t[0]===n.status?o=t[1]:(o=la(n.status),t[0]=n.status,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,j.jsx)(`span`,{className:o,"aria-hidden":`true`}),t[2]=o,t[3]=s);let c;t[4]===n.area?c=t[5]:(c=fa(n.area),t[4]=n.area,t[5]=c);let l;t[6]===c?l=t[7]:(l=(0,j.jsx)(`span`,{className:P.findingArea,children:c}),t[6]=c,t[7]=l);let u;t[8]===n.title?u=t[9]:(u=(0,j.jsx)(`h3`,{children:n.title}),t[8]=n.title,t[9]=u);let d;t[10]===n.status?d=t[11]:(d=ua(n.status),t[10]=n.status,t[11]=d);let f;t[12]===n.status?f=t[13]:(f=da(n.status),t[12]=n.status,t[13]=f);let p;t[14]!==d||t[15]!==f?(p=(0,j.jsx)(`span`,{className:d,children:f}),t[14]=d,t[15]=f,t[16]=p):p=t[16];let m;t[17]!==s||t[18]!==l||t[19]!==u||t[20]!==p?(m=(0,j.jsxs)(`div`,{className:P.findingTitle,children:[s,l,u,p]}),t[17]=s,t[18]=l,t[19]=u,t[20]=p,t[21]=m):m=t[21];let h;t[22]===n.summary?h=t[23]:(h=(0,j.jsx)(`p`,{className:P.muted,children:n.summary}),t[22]=n.summary,t[23]=h);let g;t[24]===n.evidence?g=t[25]:(g=(0,j.jsx)(ia,{evidence:n.evidence}),t[24]=n.evidence,t[25]=g);let _;t[26]!==r||t[27]!==i||t[28]!==n.actions||t[29]!==n.id||t[30]!==a?(_=(0,j.jsx)(oa,{actions:n.actions,actionPrefix:n.id,copiedAction:r,copyError:i,onCopy:a}),t[26]=r,t[27]=i,t[28]=n.actions,t[29]=n.id,t[30]=a,t[31]=_):_=t[31];let v;return t[32]!==h||t[33]!==g||t[34]!==_||t[35]!==m?(v=(0,j.jsxs)(`li`,{className:P.findingRow,children:[m,h,g,_]}),t[32]=h,t[33]=g,t[34]=_,t[35]=m,t[36]=v):v=t[36],v}function ia(e){let t=(0,N.c)(4),{evidence:n}=e;if(!n?.length)return null;let r;t[0]===n?r=t[1]:(r=n.map(aa),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,j.jsx)(`dl`,{className:P.evidence,children:r}),t[2]=r,t[3]=i),i}function aa(e){return(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`dt`,{children:e.label}),(0,j.jsx)(`dd`,{children:String(e.value)})]},e.label)}function oa(e){let t=(0,N.c)(13),{actions:n,actionPrefix:r,copiedAction:i,copyError:a,onCopy:o}=e;if(!n.length)return null;let s;if(t[0]!==r||t[1]!==n||t[2]!==i||t[3]!==a||t[4]!==o){let e;t[6]!==r||t[7]!==i||t[8]!==a||t[9]!==o?(e=(e,t)=>{let n=`${r}-${t}`;if(e.kind===`link`)return(0,j.jsx)(`a`,{href:e.href,rel:`noreferrer`,target:`_blank`,children:e.label},n);let s=e.kind===`agent_prompt`?e.prompt:e.command;return(0,j.jsxs)(`div`,{className:P.action,children:[(0,j.jsx)(`span`,{children:e.label}),(0,j.jsx)(`button`,{className:P.smallButton,onClick:()=>void o(n,s),children:i===n?`Copied`:e.kind===`agent_prompt`?`Copy task for agent`:`Copy command`}),a===n?(0,j.jsx)(`span`,{className:P.error,children:`Copy unavailable`}):null]},n)},t[6]=r,t[7]=i,t[8]=a,t[9]=o,t[10]=e):e=t[10],s=n.map(e),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,j.jsx)(`div`,{className:P.actions,children:s}),t[11]=s,t[12]=c),c}function sa(e){let t=(0,N.c)(5),{links:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,j.jsx)(Yi,{title:`Helpful links`,description:`Configured tools for deeper project detail.`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=n.map(ca),t[1]=n,t[2]=i);let a;return t[3]===i?a=t[4]:(a=(0,j.jsxs)(`section`,{className:P.section,"aria-labelledby":`links-title`,children:[r,(0,j.jsx)(`ul`,{className:P.list,children:i})]}),t[3]=i,t[4]=a),a}function ca(e){return(0,j.jsx)(`li`,{className:P.linkRow,children:(0,j.jsxs)(`a`,{href:e.href,rel:`noreferrer`,target:`_blank`,children:[(0,j.jsx)(`span`,{children:e.label}),(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`→`})]})},e.id)}function la(e){return`${P.dot} ${e===`ok`?P.successDot:e===`blocked`?P.dangerDot:P.warningDot}`}function ua(e){return`${P.findingStatus} ${e===`ok`?P.success:e===`blocked`?P.danger:e===`needs_action`?P.warning:P.neutral}`}function da(e){return{ok:`Complete`,needs_action:`Needs action`,blocked:`Blocked`,unknown:`Unknown`}[e]}function fa(e){switch(e){case`launch`:return`Release scope`;case`product`:return`Product identity`;case`legal`:return`Legal and privacy`;case`local_dev`:return`Local development`;default:return`${e[0].toUpperCase()}${e.slice(1)}`}}var pa={configured:`Configured`,declared:`Declared`,generated:`Automatic`,missing:`Missing`,not_configured:`Not configured`,pending_addition:`Pending addition`,pending_replacement:`Pending replacement`,pending_update:`Pending update`,unknown:`Unknown`};function ma(e){let t=(0,N.c)(18),{status:n}=e;if(n.entries.length===0)return null;let r;t[0]===n.providers?r=t[1]:(r=Object.values(n.providers).flatMap(va),t[0]=n.providers,t[1]=r);let i=r,a;t[2]===n.undeclaredSecrets?a=t[3]:(a=Object.entries(n.undeclaredSecrets).flatMap(_a),t[2]=n.undeclaredSecrets,t[3]=a);let o=a,s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,j.jsxs)(`header`,{className:P.sectionHeader,children:[(0,j.jsx)(`h2`,{id:`worker-environment-title`,children:`Worker environment`}),(0,j.jsx)(`p`,{children:`Local values are optional overrides of built-in defaults. Secret changes are queued until the next deploy; ordinary variables remain owned by project and deploy configuration.`})]}),t[4]=s):s=t[4];let c;t[5]===i?c=t[6]:(c=i.map(ga),t[5]=i,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{scope:`col`,children:`Name`}),(0,j.jsx)(`th`,{scope:`col`,children:`Kind`}),(0,j.jsx)(`th`,{scope:`col`,children:`Local`}),(0,j.jsx)(`th`,{scope:`col`,children:`Staging`}),(0,j.jsx)(`th`,{scope:`col`,children:`Production`})]})}),t[7]=l):l=t[7];let u;t[8]===n.entries?u=t[9]:(u=n.entries.map(ha),t[8]=n.entries,t[9]=u);let d;t[10]===u?d=t[11]:(d=(0,j.jsx)(`div`,{className:P.environmentTableFrame,children:(0,j.jsxs)(`table`,{className:P.environmentTable,children:[l,(0,j.jsx)(`tbody`,{children:u})]})}),t[10]=u,t[11]=d);let f;t[12]===o?f=t[13]:(f=o.length>0?(0,j.jsxs)(`p`,{className:P.environmentNotice,children:[`Cloudflare also contains undeclared secrets: `,o.join(`, `),`.`]}):null,t[12]=o,t[13]=f);let p;return t[14]!==c||t[15]!==d||t[16]!==f?(p=(0,j.jsxs)(`section`,{className:P.section,"aria-labelledby":`worker-environment-title`,children:[s,c,d,f]}),t[14]=c,t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function ha(e){return(0,j.jsxs)(`tr`,{children:[(0,j.jsxs)(`th`,{scope:`row`,children:[(0,j.jsx)(`code`,{children:e.name}),(0,j.jsx)(`span`,{children:e.description})]}),(0,j.jsx)(`td`,{children:e.kind}),(0,j.jsx)(`td`,{children:e.local===`override`?`Override`:`Built-in default`}),(0,j.jsx)(ya,{state:e.deployed.staging}),(0,j.jsx)(ya,{state:e.deployed.production})]},e.name)}function ga(e){return(0,j.jsx)(`p`,{className:P.environmentNotice,children:e},e)}function _a(e){let[t,n]=e;return n.map(e=>`${e} (${t})`)}function va(e){return e.message?[e.message]:[]}function ya(e){let t=(0,N.c)(5),{state:n}=e,r;t[0]===n?r=t[1]:(r=ba(n),t[0]=n,t[1]=r);let i=pa[n],a;return t[2]!==r||t[3]!==i?(a=(0,j.jsx)(`td`,{children:(0,j.jsx)(`span`,{className:r,children:i})}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function ba(e){return e===`configured`||e===`generated`?`${P.environmentState} ${P.environmentStateOk}`:e===`missing`?`${P.environmentState} ${P.environmentStateMissing}`:e.startsWith(`pending_`)?`${P.environmentState} ${P.environmentStatePending}`:P.environmentState}var xa={ready:`No outstanding findings`,needs_setup:`Launch decisions needed`,broken_locally:`Diagnostics blocked`,not_deploy_ready:`Launch work remaining`,unknown:`Readiness incomplete`};function Sa({payload:e,onRefresh:t}){let[n,r]=(0,O.useState)(),[i,a]=(0,O.useState)(),o=e.diagnostics,s=o.snapshot.facts.package?.name??`Unnamed project`,c=Ta(o);async function l(e,t){try{if(!navigator.clipboard)throw Error(`Clipboard access is unavailable`);await navigator.clipboard.writeText(t),r(e),a(void 0)}catch{a(e)}}return(0,j.jsxs)(`main`,{className:P.page,children:[(0,j.jsxs)(`header`,{className:P.topbar,children:[(0,j.jsxs)(`div`,{className:P.brand,children:[(0,j.jsx)(`span`,{className:P.brandMark,"aria-hidden":`true`,children:`C`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:P.eyebrow,children:`Coreframe Dashboard`}),(0,j.jsx)(`h1`,{className:P.title,children:s})]})]}),(0,j.jsxs)(`div`,{className:P.topbarActions,children:[(0,j.jsx)(`span`,{className:wa(o.dashboard.headline.status),children:xa[o.dashboard.headline.status]}),(0,j.jsx)(`button`,{className:P.button,onClick:t,children:`Refresh`})]})]}),(0,j.jsxs)(`section`,{className:P.summary,"aria-labelledby":`summary-title`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:P.eyebrow,children:`Production readiness`}),(0,j.jsx)(`h2`,{className:P.summaryTitle,id:`summary-title`,children:o.dashboard.headline.message}),(0,j.jsxs)(`p`,{className:P.muted,children:[`Diagnostics updated `,Ea(o.snapshot.collectedAt),`.`]})]}),(0,j.jsxs)(`dl`,{className:P.summaryFacts,children:[(0,j.jsx)(Ca,{label:`First-release scope`,value:c.scope}),(0,j.jsx)(Ca,{label:`Product identity`,value:c.identity}),(0,j.jsx)(Ca,{label:`Legal and privacy`,value:c.legal})]})]}),(0,j.jsxs)(`div`,{className:P.grid,children:[(0,j.jsx)(Ji,{initialState:e.development,mutationToken:e.mutationToken}),(0,j.jsx)(ma,{status:e.workerEnvironment}),(0,j.jsx)(na,{title:`Path to production`,description:`Decisions and human-owned work that remain before the first production release.`,findings:o.dashboard.launchItems,emptyTitle:`No outstanding launch items`,emptyMessage:`Diagnostics found no unresolved production-readiness work.`,copiedAction:n,copyError:i,onCopy:l}),o.dashboard.problems.length?(0,j.jsx)(na,{title:`Problems`,description:`Local or runtime problems that need investigation.`,findings:o.dashboard.problems,emptyTitle:`No problems`,emptyMessage:`No problems were returned.`,copiedAction:n,copyError:i,onCopy:l}):null,o.dashboard.links.length?(0,j.jsx)(sa,{links:o.dashboard.links}):null]})]})}function Ca(e){let t=(0,N.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,j.jsx)(`dt`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,j.jsx)(`dd`,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,j.jsxs)(`div`,{className:P.summaryFact,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function wa(e){return e===`ready`?`${P.status} ${P.success}`:e===`broken_locally`?`${P.status} ${P.danger}`:e===`unknown`?`${P.status} ${P.neutral}`:`${P.status} ${P.warning}`}function Ta(e){let t=e.snapshot.facts.launchReadiness;if(!t)return{scope:`Unknown`,identity:`Unknown`,legal:`Unknown`};let n=t.defaultIdentity.length+ +(e.snapshot.facts.package?.name===`coreframe`),r=t.defaultLegalDocuments.length+ +!t.privacyReviewRecorded;return{scope:t.productionChecklistExists?`Recorded`:`Undecided`,identity:n===0?`Personalized`:n===1?`1 default remains`:`${n} defaults remain`,legal:r===0?`Reviewed`:`${r} item${r===1?``:`s`} pending`}}function Ea(e){let t=new Date(e);return Number.isNaN(t.valueOf())?`just now`:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function Da(e){let t=(0,N.c)(51),{payload:n,onRefresh:r}=e,i;t[0]===n.configuration?i=t[1]:(i=n.configuration.filter(Aa),t[0]=n.configuration,t[1]=i);let a=i,o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,j.jsx)(`span`,{className:P.brandMark,"aria-hidden":`true`,children:`C`}),s=(0,j.jsx)(`p`,{className:P.eyebrow,children:`Coreframe Dashboard`}),t[2]=o,t[3]=s):(o=t[2],s=t[3]);let c;t[4]===n.release.applicationName?c=t[5]:(c=(0,j.jsxs)(`div`,{className:P.brand,children:[o,(0,j.jsxs)(`div`,{children:[s,(0,j.jsx)(`h1`,{className:P.title,children:n.release.applicationName})]})]}),t[4]=n.release.applicationName,t[5]=c);let l=`${P.status} ${a.length?P.warning:P.success}`,u=a.length?`${a.length} missing`:`Configuration ready`,d;t[6]!==l||t[7]!==u?(d=(0,j.jsx)(`span`,{className:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]===r?f=t[10]:(f=(0,j.jsx)(`button`,{className:P.button,onClick:r,children:`Refresh`}),t[9]=r,t[10]=f);let p;t[11]!==d||t[12]!==f?(p=(0,j.jsxs)(`div`,{className:P.topbarActions,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]!==c||t[15]!==p?(m=(0,j.jsxs)(`header`,{className:P.topbar,children:[c,p]}),t[14]=c,t[15]=p,t[16]=m):m=t[16];let h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,j.jsx)(`p`,{className:P.eyebrow,children:`Deployed Worker`}),t[17]=h):h=t[17];let g=n.environment===`production`?`Production`:`Staging`,_;t[18]===g?_=t[19]:(_=(0,j.jsxs)(`h2`,{className:P.summaryTitle,id:`deployment-title`,children:[g,` deployment`]}),t[18]=g,t[19]=_);let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,j.jsx)(`p`,{className:P.muted,children:`Read-only release identity and required Worker configuration.`}),t[20]=v):v=t[20];let y;t[21]===_?y=t[22]:(y=(0,j.jsxs)(`div`,{children:[h,_,v]}),t[21]=_,t[22]=y);let b=n.release.applicationVersion??`Unknown`,x;t[23]===b?x=t[24]:(x=(0,j.jsx)(ja,{label:`Application`,value:b}),t[23]=b,t[24]=x);let ee=n.release.coreframeVersion??`Unknown`,S;t[25]===ee?S=t[26]:(S=(0,j.jsx)(ja,{label:`Coreframe`,value:ee}),t[25]=ee,t[26]=S);let C=n.release.releaseName??n.release.cloudflareVersionTag??`Unknown`,w;t[27]===C?w=t[28]:(w=(0,j.jsx)(ja,{label:`Release`,value:C}),t[27]=C,t[28]=w);let T;t[29]!==x||t[30]!==S||t[31]!==w?(T=(0,j.jsxs)(`dl`,{className:P.summaryFacts,children:[x,S,w]}),t[29]=x,t[30]=S,t[31]=w,t[32]=T):T=t[32];let E;t[33]!==y||t[34]!==T?(E=(0,j.jsxs)(`section`,{className:P.summary,"aria-labelledby":`deployment-title`,children:[y,T]}),t[33]=y,t[34]=T,t[35]=E):E=t[35];let D;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,j.jsx)(Yi,{title:`Worker configuration`,description:`Required values are checked by presence only. Secret and variable values are never returned.`}),t[36]=D):D=t[36];let te;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{scope:`col`,children:`Name`}),(0,j.jsx)(`th`,{scope:`col`,children:`Kind`}),(0,j.jsx)(`th`,{scope:`col`,children:`Status`})]})}),t[37]=te):te=t[37];let O;t[38]===n.configuration?O=t[39]:(O=n.configuration.map(ka),t[38]=n.configuration,t[39]=O);let k;t[40]===O?k=t[41]:(k=(0,j.jsxs)(`section`,{className:P.section,"aria-labelledby":`configuration-title`,children:[D,(0,j.jsx)(`div`,{className:P.environmentTableFrame,children:(0,j.jsxs)(`table`,{className:P.environmentTable,children:[te,(0,j.jsx)(`tbody`,{children:O})]})})]}),t[40]=O,t[41]=k);let A;t[42]===n.links?A=t[43]:(A=n.links.length?(0,j.jsxs)(`section`,{className:P.section,"aria-labelledby":`links-title`,children:[(0,j.jsx)(Yi,{title:`Helpful links`,description:`Configured deployment resources.`}),(0,j.jsx)(`ul`,{className:P.list,children:n.links.map(Oa)})]}):null,t[42]=n.links,t[43]=A);let M;t[44]!==k||t[45]!==A?(M=(0,j.jsxs)(`div`,{className:P.grid,children:[k,A]}),t[44]=k,t[45]=A,t[46]=M):M=t[46];let ne;return t[47]!==m||t[48]!==E||t[49]!==M?(ne=(0,j.jsxs)(`main`,{className:P.page,children:[m,E,M]}),t[47]=m,t[48]=E,t[49]=M,t[50]=ne):ne=t[50],ne}function Oa(e){return(0,j.jsx)(`li`,{className:P.linkRow,children:(0,j.jsxs)(`a`,{href:e.href,rel:`noreferrer`,target:`_blank`,children:[(0,j.jsx)(`span`,{children:e.label}),(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`→`})]})},e.id)}function ka(e){return(0,j.jsxs)(`tr`,{children:[(0,j.jsxs)(`th`,{scope:`row`,children:[(0,j.jsx)(`code`,{children:e.name}),(0,j.jsx)(`span`,{children:e.description})]}),(0,j.jsx)(`td`,{children:e.kind}),(0,j.jsx)(`td`,{children:(0,j.jsx)(`span`,{className:`${P.environmentState} ${e.status===`configured`?P.environmentStateOk:P.environmentStateMissing}`,children:e.status===`configured`?`Configured`:`Missing`})})]},e.name)}function Aa(e){return e.status===`missing`}function ja(e){let t=(0,N.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,j.jsx)(`dt`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,j.jsx)(`dd`,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,j.jsxs)(`div`,{className:P.summaryFact,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var Ma=t(function(){let e=(0,N.c)(9),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=qi.overview(),e[0]=t):t=e[0];let n=fe(t);if(n.isPending){let t;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,j.jsx)(Na,{title:`Loading dashboard`,message:`Reading the latest project diagnostics.`}),e[1]=t):t=e[1],t}if(n.isError){let t;e[2]===n?t=e[3]:(t=(0,j.jsx)(`button`,{className:o.button,onClick:()=>void n.refetch(),children:`Retry`}),e[2]=n,e[3]=t);let r;return e[4]!==n.error.message||e[5]!==t?(r=(0,j.jsx)(Na,{title:`Dashboard unavailable`,message:n.error.message,action:t}),e[4]=n.error.message,e[5]=t,e[6]=r):r=e[6],r}let r;return e[7]===n?r=e[8]:(r=n.data.mode===`deployed`?(0,j.jsx)(Da,{payload:n.data,onRefresh:()=>void n.refetch()}):(0,j.jsx)(Sa,{payload:n.data,onRefresh:()=>void n.refetch()}),e[7]=n,e[8]=r),r});function Na(e){let t=(0,N.c)(9),{title:n,message:r,action:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,j.jsx)(`p`,{className:o.eyebrow,children:`Coreframe Dashboard`}),t[0]=a):a=t[0];let s;t[1]===n?s=t[2]:(s=(0,j.jsx)(`h1`,{children:n}),t[1]=n,t[2]=s);let c;t[3]===r?c=t[4]:(c=(0,j.jsx)(`p`,{className:o.message,children:r}),t[3]=r,t[4]=c);let l;return t[5]!==i||t[6]!==s||t[7]!==c?(l=(0,j.jsxs)(`main`,{className:o.statePage,children:[a,s,c,i]}),t[5]=i,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}export{Ma as default};