@tonyclaw/agent-inspector 4.0.21 → 4.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/backend/nitro.json +1 -1
- package/.output/cli.js +1 -1
- package/.output/server/_ssr/index.mjs +1 -1
- package/.output/server/_ssr/{router-HTKEFlBr.mjs → router-CQUHvHaC.mjs} +52 -52
- package/.output/server/index.mjs +1 -1
- package/.output/ui/assets/{CompareDrawer-CGtGLpRr.js → CompareDrawer-BEhpK9TK.js} +1 -1
- package/.output/ui/assets/{InspectorPet-C7EyBke0.js → InspectorPet-BTD2kmJS.js} +1 -1
- package/.output/ui/assets/{ProxyViewerContainer-DyEPnEkM.js → ProxyViewerContainer-BfgC3WD4.js} +4 -4
- package/.output/ui/assets/{ReplayDialog-D-HJ-GY-.js → ReplayDialog-Dqu5PYoY.js} +1 -1
- package/.output/ui/assets/{RequestAnatomy-CS3IEG8L.js → RequestAnatomy-DA3Ec3N5.js} +1 -1
- package/.output/ui/assets/{ResponseView-BU2uDaMH.js → ResponseView-rLcEGvUE.js} +1 -1
- package/.output/ui/assets/{StreamingChunkSequence-DT7vuTnV.js → StreamingChunkSequence-BZe687eP.js} +1 -1
- package/.output/ui/assets/{_sessionId-LpWM6fUR.js → _sessionId-BF48B6Rg.js} +1 -1
- package/.output/ui/assets/{_sessionId-DVNVVqtQ.js → _sessionId-bsVxghzs.js} +1 -1
- package/.output/ui/assets/{index-BX9hEtiY.js → index-BhAEodLw.js} +1 -1
- package/.output/ui/assets/{index-CHGXicPQ.js → index-CjapymGT.js} +1 -1
- package/.output/ui/assets/{index-qkfRlMvL.js → index-D2b-v1-r.js} +1 -1
- package/.output/ui/assets/{index-D0laIdpr.js → index-R9w-ZILP.js} +2 -2
- package/.output/ui/assets/{json-viewer-Be1ybyLo.js → json-viewer-CWC--H4M.js} +1 -1
- package/.output/ui/assets/{jszip.min-CNa5iyer.js → jszip.min-CpXBBgLx.js} +1 -1
- package/.output/ui/index.html +1 -1
- package/README.md +6 -0
- package/package.json +4 -4
package/.output/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var ix=Object.defineProperty;var y=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(o){throw r=[o],o}};var we=(e,t)=>{for(var r in t)ix(e,r,{get:t[r],enumerable:!0})};var ot,ps=y(()=>{ot={name:"@tonyclaw/agent-inspector",version:"4.0.21",type:"module",description:"Agent observability and knowledge capture layer for AI coding tools.",license:"MIT",engines:{node:">=22.0.0"},author:"TonyClaw",repository:{type:"git",url:"git+https://gitcode.com/TonyClaw/OpenInspector.git"},homepage:"https://gitcode.com/TonyClaw/OpenInspector#readme",workspaces:["packages/*"],bugs:{url:"https://gitcode.com/TonyClaw/OpenInspector/issues"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["claude","anthropic","openai","proxy","api-inspector","agent-observability","agent-memory","debugging","llm","ai-coding-tools"],bin:{"agent-inspector":"bin/agent-inspector.js"},files:["bin","src/assets/agent-inspector.ico","scripts/setup-windows-runtime.mjs","scripts/setup-agent-skills.mjs","scripts/generate-theme-scales.mjs","docs/instance-control.openapi.yaml","styles",".output","!.output/*.exe"],scripts:{dev:"node scripts/dev-decoupled.mjs","dev:ui":"vite dev --config vite.ui.config.ts","dev:backend":"node scripts/dev-backend.mjs","test:smoke":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs smoke","test:fast":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs smoke","test:unit":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs unit","test:integration":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs integration","test:changed":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs changed","test:all":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs all","test:hostile-inputs":"bun test src/proxy/identityProxy.test.ts src/proxy/handler.cancellationCompatibility.test.ts src/proxy/logImporter.test.ts src/backend/routes/api/-logs.stream.test.ts src/proxy/handler.admission.test.ts src/proxy/runtimeHealth.test.ts src/proxy/storageLifecycle.test.ts","test:compatibility-tooling":"node scripts/run-compatibility-tests.mjs ultra","test:compatibility-tooling:extended":"node scripts/run-compatibility-tests.mjs extended","test:compatibility-conformance":"node scripts/run-compatibility-tests.mjs conformance",start:"node .output/cli.js","start:backend":"node .output/cli.js --backend-only --no-open","preview:ui":"vite preview --config vite.ui.config.ts","clean:output":"node scripts/clean-output.mjs",build:"bun clean:output && bun build:backend && bun build:ui && bun smoke:ui-preview && bun build:workers && bun build:cli && bun build:mcp && bun check:bundle && bun check:boundaries","build:backend":"vite build --config vite.backend.config.ts","build:ui":"vite build --config vite.ui.config.ts","build:workers":"npx esbuild src/proxy/logFinalizer.worker.ts src/proxy/sessionWorkerEntry.ts --bundle --minify --legal-comments=none --platform=node --target=node22 --format=esm --outdir=.output/workers --external:better-sqlite3","smoke:workers":"node scripts/smoke-production-workers.mjs","smoke:packed-workers":"node scripts/smoke-packed-workers.mjs","smoke:instances":"node scripts/smoke-windows-instances.mjs","smoke:coding-agent-instances":"node scripts/smoke-coding-agent-instances.mjs","smoke:ui-preview":"node scripts/smoke-decoupled-ui-preview.mjs","check:bundle":"node scripts/check-client-bundle.mjs","check:boundaries":"node scripts/check-runtime-boundaries.mjs","check:commercial-performance":"node scripts/check-commercial-performance-budgets.mjs","check:hostile-inputs":"node scripts/check-hostile-input-coverage.mjs","check:supply-chain":"node scripts/check-commercial-supply-chain.mjs","compatibility:bdd":"node scripts/lint-bdd-catalog.mjs","compatibility:compare":"node scripts/compatibility/cli.mjs compare","compatibility:drift":"node scripts/check-backend-compatibility.mjs","compatibility:fixtures":"bun scripts/validate-compatibility-fixtures.ts","compatibility:freeze":"node scripts/freeze-backend-baseline.mjs","compatibility:run":"node scripts/compatibility/cli.mjs run","compatibility:performance":"node scripts/compatibility/performance-cli.mjs","compatibility:performance:verify":"node scripts/compatibility/performance-cli.mjs verify","build:cli":"npx esbuild src/cli.ts --bundle --minify --legal-comments=none --platform=node --target=node22 --format=esm --outfile=.output/cli.js","build:mcp":"npx esbuild packages/agent-inspector-mcp/src/cli.ts --bundle --minify --legal-comments=none --platform=node --target=node22 --format=esm --outfile=packages/agent-inspector-mcp/dist/cli.js","rust:build-package":"node scripts/rust/build-platform.mjs","rust:stage-package":"node scripts/rust/stage-platform.mjs","rust:verify-package":"node scripts/rust/verify-platform.mjs","rust:pack-package":"node scripts/rust/pack-platform.mjs","rust:native-artifact":"node scripts/rust/create-native-artifact.mjs","rust:native:aggregate":"node scripts/rust/aggregate-native-artifacts.mjs","rust:release-gate:preflight":"node scripts/rust/release-gate-preflight.mjs","rust:release-evidence:plan":"node scripts/rust/release-evidence-plan.mjs","commercial:release-gate:preflight":"node scripts/commercial-release-preflight.mjs","test:commercial-release-gate":"bun test scripts/commercialReleasePreflight.test.ts","test:rust-packaging":"bun test scripts/rust/npmPackaging.test.ts scripts/rust/nativeReleaseContract.test.ts scripts/rust/nativeStartupSmoke.test.ts scripts/rust/releaseGatePreflight.test.ts scripts/releaseCore.test.ts","rust:packages:check":"node scripts/rust/sync-package-versions.mjs","rust:packages:sync":"node scripts/rust/sync-package-versions.mjs --write","themes:generate":"node scripts/generate-theme-scales.mjs",postinstall:"node scripts/setup-windows-runtime.mjs && node scripts/setup-agent-skills.mjs",prepublishOnly:"node scripts/rust/require-release-orchestrator.mjs",typecheck:"tsc --noEmit --incremental --tsBuildInfoFile .cache/tsconfig.tsbuildinfo",lint:"eslint . --cache --cache-location .cache/eslintcache",format:"biome format --write .","format:check":"biome format .","verify:ultra":"node scripts/compatibility/ultra-gate.mjs","verify:ultra:fresh":"node scripts/compatibility/ultra-gate.mjs --no-cache","verify:ultra:smoke":"npm run verify:ultra && npm run test:smoke","verify:fast":"bun scripts/run-static-checks.mjs --format && bun test:changed","extension:zip":"node scripts/pack-chrome-extension.mjs","extension:release":"node scripts/release-chrome-extension.mjs",release:"node scripts/release.mjs",knip:"knip",check:"bun scripts/run-static-checks.mjs --format && bun check:boundaries && bun check:commercial-performance && bun check:hostile-inputs && bun compatibility:bdd && bun rust:packages:check",prepare:"husky",ladle:"ladle serve","ladle:build":"ladle build"},dependencies:{"@mariozechner/pi-agent-core":"^0.73.1","@mariozechner/pi-ai":"^0.73.1","@modelcontextprotocol/server":"^2.0.0-beta.4","@tailwindcss/typography":"^0.5.20","@tanstack/react-router":"^1.170.18","@tanstack/react-start":"^1.168.28","@tanstack/react-virtual":"^3.14.6","class-variance-authority":"^0.7.1",clsx:"^2.1.1",conf:"^15.1.0",diff:"^9.0.0",jszip:"^3.10.1","lucide-react":"^0.563.0","radix-ui":"1.6.2",react:"^19.2.7","react-dom":"^19.2.7","react-markdown":"^10.1.0",swr:"^2.4.2","tailwind-merge":"^3.6.0",three:"0.185.1","tw-animate-css":"^1.4.0",zod:"^4.4.3"},optionalDependencies:{"@tonyclaw/agent-inspector-backend-darwin-arm64":"4.0.21","@tonyclaw/agent-inspector-backend-linux-x64-gnu":"4.0.21","@tonyclaw/agent-inspector-backend-win32-x64-msvc":"4.0.21","better-sqlite3":"^12.11.1",rcedit:"4.0.1"},devDependencies:{"@biomejs/biome":"^2.5.3","@eslint/js":"^10.0.1","@ladle/react":"^5.1.1","@radix-ui/colors":"^3.0.0","@tailwindcss/vite":"^4.3.2","@tanstack/router-plugin":"^1.168.20","@types/bun":"^1.3.14","@types/react":"^19.2.17","@types/react-dom":"^19.2.3","@types/three":"0.185.1","@typescript-eslint/eslint-plugin":"^8.64.0","@typescript-eslint/parser":"^8.64.0","@vitejs/plugin-react":"^5.2.0",ajv:"8.20.0","ajv-formats":"3.0.1","colorjs.io":"^0.7.0",esbuild:"^0.28.1",eslint:"^9.39.5","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-functional":"^9.0.5","eslint-plugin-unicorn":"^63.0.0",husky:"^9.1.7",knip:"^5.88.1",nitro:"^3.0.260610-beta",playwright:"^1.61.1",tailwindcss:"^4.3.2",typescript:"^5.9.3",vite:"^7.3.6","vite-tsconfig-paths":"^6.1.1"},overrides:{undici:">=7.24.0 <8.0.0",rollup:">=4.59.0 <5.0.0",postcss:">=8.5.10 <9.0.0","js-yaml":">=4.1.2 <5.0.0",flatted:">=3.4.0 <4.0.0","smol-toml":">=1.6.1 <2.0.0",koa:">=2.16.4 <3.0.0","@babel/core":">=7.29.1 <8.0.0","@typescript-eslint/typescript-estree":"^8.63.0",vite:"^7.3.6"}}});function m(e,t,r){function o(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let l=a.prototype,d=Object.keys(l);for(let p=0;p<d.length;p++){let f=d[p];f in s||(s[f]=l[f].bind(s))}}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function a(s){var u;let l=r?.Parent?new i:this;o(l,s),(u=l._zod).deferred??(u.deferred=[]);for(let d of l._zod.deferred)d();return l}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}function Y(e){return e&&Object.assign(zt,e),zt}var Bf,ms,fs,Be,ft,zt,Dt=y(()=>{ms=Object.freeze({status:"aborted"});fs=Symbol("zod_brand"),Be=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ft=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Bf=globalThis).__zod_globalConfig??(Bf.__zod_globalConfig={});zt=globalThis.__zod_globalConfig});var k={};we(k,{BIGINT_FORMAT_RANGES:()=>Is,Class:()=>hs,NUMBER_FORMAT_RANGES:()=>xs,aborted:()=>yt,allowsEval:()=>bs,assert:()=>dx,assertEqual:()=>sx,assertIs:()=>ux,assertNever:()=>lx,assertNotEqual:()=>cx,assignProp:()=>ht,base64ToUint8Array:()=>Zf,base64urlToUint8Array:()=>Rx,cached:()=>cn,captureStackTrace:()=>Po,cleanEnum:()=>wx,cleanRegex:()=>ar,clone:()=>he,cloneDef:()=>mx,createTransparentProxy:()=>bx,defineLazy:()=>A,esc:()=>So,escapeRegex:()=>je,explicitlyAborted:()=>Ss,extend:()=>$x,finalizeIssue:()=>ve,floatSafeRemainder:()=>vs,getElementAtPath:()=>fx,getEnumValues:()=>ir,getLengthableOrigin:()=>ur,getParsedType:()=>yx,getSizableOrigin:()=>cr,hexToUint8Array:()=>Ex,isObject:()=>Ut,isPlainObject:()=>vt,issue:()=>un,joinValues:()=>h,jsonStringifyReplacer:()=>sn,merge:()=>Ix,mergeDefs:()=>it,normalizeParams:()=>$,nullish:()=>gt,numKeys:()=>vx,objectClone:()=>px,omit:()=>kx,optionalKeys:()=>$s,parsedType:()=>_,partial:()=>Sx,pick:()=>_x,prefixIssues:()=>ke,primitiveTypes:()=>ks,promiseAllObject:()=>gx,propertyKeyTypes:()=>sr,randomString:()=>hx,required:()=>Px,safeExtend:()=>xx,shallowClone:()=>_s,slugify:()=>ys,stringifyPrimitive:()=>b,uint8ArrayToBase64:()=>Gf,uint8ArrayToBase64url:()=>Tx,uint8ArrayToHex:()=>Ox,unwrapMessage:()=>or});function sx(e){return e}function cx(e){return e}function ux(e){}function lx(e){throw new Error("Unexpected value in exhaustive check")}function dx(e){}function ir(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function h(e,t="|"){return e.map(r=>b(r)).join(t)}function sn(e,t){return typeof t=="bigint"?t.toString():t}function cn(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function gt(e){return e==null}function ar(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function vs(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}function A(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Ff)return o===void 0&&(o=Ff,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function px(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ht(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function it(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function mx(e){return it(e._zod.def)}function fx(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function gx(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}function hx(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function So(e){return JSON.stringify(e)}function ys(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function vt(e){if(Ut(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ut(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function _s(e){return vt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function vx(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function je(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function he(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function $(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 new 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 bx(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function b(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function $s(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function _x(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=it(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return ht(this,"shape",a),a},checks:[]});return he(e,i)}function kx(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=it(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return ht(this,"shape",a),a},checks:[]});return he(e,i)}function $x(e,t){if(!vt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=it(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return ht(this,"shape",i),i}});return he(e,n)}function xx(e,t){if(!vt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=it(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return ht(this,"shape",o),o}});return he(e,r)}function Ix(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=it(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return ht(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return he(e,r)}function Sx(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=it(t._zod.def,{get shape(){let s=t._zod.def.shape,u={...s};if(r)for(let l in r){if(!(l in s))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(u[l]=e?new e({type:"optional",innerType:s[l]}):s[l])}else for(let l in s)u[l]=e?new e({type:"optional",innerType:s[l]}):s[l];return ht(this,"shape",u),u},checks:[]});return he(t,a)}function Px(e,t,r){let o=it(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:n[a]}))}else for(let a in n)i[a]=new e({type:"nonoptional",innerType:n[a]});return ht(this,"shape",i),i}});return he(t,o)}function yt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ss(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function ke(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function or(e){return typeof e=="string"?e:e?.message}function ve(e,t,r){let o=e.message?e.message:or(e.inst?._zod.def?.error?.(e))??or(t?.error?.(e))??or(r.customError?.(e))??or(r.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:a,...s}=e;return s.path??(s.path=[]),s.message=o,t?.reportInput&&(s.input=a),s}function cr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ur(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function _(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function un(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function wx(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Zf(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function Gf(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Rx(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Zf(t+r)}function Tx(e){return Gf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Ex(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function Ox(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ff,Po,bs,yx,sr,ks,xs,Is,hs,S=y(()=>{Dt();Ff=Symbol("evaluating");Po="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};bs=cn(()=>{if(zt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});yx=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},sr=new Set(["string","number","symbol"]),ks=new Set(["string","number","bigint","boolean","symbol","undefined"]);xs={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Is={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};hs=class{constructor(...t){}}});function dr(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function pr(e,t=r=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>o({issues:s},[...i,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...i,...a.path]);else{let s=[...i,...a.path];if(s.length===0)r._errors.push(t(a));else{let u=r,l=0;for(;l<s.length;){let d=s[l];l===s.length-1?(u[d]=u[d]||{_errors:[]},u[d]._errors.push(t(a))):u[d]=u[d]||{_errors:[]},u=u[d],l++}}}};return o(e),r}function Ps(e,t=r=>r.message){let r={errors:[]},o=(n,i=[])=>{var a,s;for(let u of n.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(l=>o({issues:l},[...i,...u.path]));else if(u.code==="invalid_key")o({issues:u.issues},[...i,...u.path]);else if(u.code==="invalid_element")o({issues:u.issues},[...i,...u.path]);else{let l=[...i,...u.path];if(l.length===0){r.errors.push(t(u));continue}let d=r,p=0;for(;p<l.length;){let f=l[p],v=p===l.length-1;typeof f=="string"?(d.properties??(d.properties={}),(a=d.properties)[f]??(a[f]={errors:[]}),d=d.properties[f]):(d.items??(d.items=[]),(s=d.items)[f]??(s[f]={errors:[]}),d=d.items[f]),v&&d.errors.push(t(u)),p++}}};return o(e),r}function Jf(e){let t=[],r=e.map(o=>typeof o=="object"?o.key:o);for(let o of r)typeof o=="number"?t.push(`[${o}]`):typeof o=="symbol"?t.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?t.push(`[${JSON.stringify(o)}]`):(t.length&&t.push("."),t.push(o));return t.join("")}function ws(e){let t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)t.push(`\u2716 ${o.message}`),o.path?.length&&t.push(` \u2192 at ${Jf(o.path)}`);return t.join(`
|
|
2
|
+
var ix=Object.defineProperty;var y=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(o){throw r=[o],o}};var we=(e,t)=>{for(var r in t)ix(e,r,{get:t[r],enumerable:!0})};var ot,ps=y(()=>{ot={name:"@tonyclaw/agent-inspector",version:"4.0.22",type:"module",description:"Agent observability and knowledge capture layer for AI coding tools.",license:"MIT",engines:{node:">=22.0.0"},author:"TonyClaw",repository:{type:"git",url:"git+https://gitcode.com/TonyClaw/OpenInspector.git"},homepage:"https://gitcode.com/TonyClaw/OpenInspector#readme",workspaces:["packages/*"],bugs:{url:"https://gitcode.com/TonyClaw/OpenInspector/issues"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["claude","anthropic","openai","proxy","api-inspector","agent-observability","agent-memory","debugging","llm","ai-coding-tools"],bin:{"agent-inspector":"bin/agent-inspector.js"},files:["bin","src/assets/agent-inspector.ico","scripts/setup-windows-runtime.mjs","scripts/setup-agent-skills.mjs","scripts/generate-theme-scales.mjs","docs/instance-control.openapi.yaml","styles",".output","!.output/*.exe"],scripts:{dev:"node scripts/dev-decoupled.mjs","dev:ui":"vite dev --config vite.ui.config.ts","dev:backend":"node scripts/dev-backend.mjs","test:smoke":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs smoke","test:fast":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs smoke","test:unit":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs unit","test:integration":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs integration","test:changed":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs changed","test:all":"node scripts/run-local-bun.mjs scripts/run-test-suite.mjs all","test:hostile-inputs":"bun test src/proxy/identityProxy.test.ts src/proxy/handler.cancellationCompatibility.test.ts src/proxy/logImporter.test.ts src/backend/routes/api/-logs.stream.test.ts src/proxy/handler.admission.test.ts src/proxy/runtimeHealth.test.ts src/proxy/storageLifecycle.test.ts","test:compatibility-tooling":"node scripts/run-compatibility-tests.mjs ultra","test:compatibility-tooling:extended":"node scripts/run-compatibility-tests.mjs extended","test:compatibility-conformance":"node scripts/run-compatibility-tests.mjs conformance",start:"node .output/cli.js","start:backend":"node .output/cli.js --backend-only --no-open","preview:ui":"vite preview --config vite.ui.config.ts","clean:output":"node scripts/clean-output.mjs",build:"bun clean:output && bun build:backend && bun build:ui && bun smoke:ui-preview && bun build:workers && bun build:cli && bun build:mcp && bun check:bundle && bun check:boundaries","build:backend":"vite build --config vite.backend.config.ts","build:ui":"vite build --config vite.ui.config.ts","build:workers":"npx esbuild src/proxy/logFinalizer.worker.ts src/proxy/sessionWorkerEntry.ts --bundle --minify --legal-comments=none --platform=node --target=node22 --format=esm --outdir=.output/workers --external:better-sqlite3","smoke:workers":"node scripts/smoke-production-workers.mjs","smoke:packed-workers":"node scripts/smoke-packed-workers.mjs","smoke:instances":"node scripts/smoke-windows-instances.mjs","smoke:coding-agent-instances":"node scripts/smoke-coding-agent-instances.mjs","smoke:ui-preview":"node scripts/smoke-decoupled-ui-preview.mjs","check:bundle":"node scripts/check-client-bundle.mjs","check:boundaries":"node scripts/check-runtime-boundaries.mjs","check:commercial-performance":"node scripts/check-commercial-performance-budgets.mjs","check:hostile-inputs":"node scripts/check-hostile-input-coverage.mjs","check:supply-chain":"node scripts/check-commercial-supply-chain.mjs","compatibility:bdd":"node scripts/lint-bdd-catalog.mjs","compatibility:compare":"node scripts/compatibility/cli.mjs compare","compatibility:drift":"node scripts/check-backend-compatibility.mjs","compatibility:fixtures":"bun scripts/validate-compatibility-fixtures.ts","compatibility:freeze":"node scripts/freeze-backend-baseline.mjs","compatibility:run":"node scripts/compatibility/cli.mjs run","compatibility:performance":"node scripts/compatibility/performance-cli.mjs","compatibility:performance:verify":"node scripts/compatibility/performance-cli.mjs verify","build:cli":"npx esbuild src/cli.ts --bundle --minify --legal-comments=none --platform=node --target=node22 --format=esm --outfile=.output/cli.js","build:mcp":"npx esbuild packages/agent-inspector-mcp/src/cli.ts --bundle --minify --legal-comments=none --platform=node --target=node22 --format=esm --outfile=packages/agent-inspector-mcp/dist/cli.js","rust:build-package":"node scripts/rust/build-platform.mjs","rust:stage-package":"node scripts/rust/stage-platform.mjs","rust:verify-package":"node scripts/rust/verify-platform.mjs","rust:pack-package":"node scripts/rust/pack-platform.mjs","rust:native-artifact":"node scripts/rust/create-native-artifact.mjs","rust:native:aggregate":"node scripts/rust/aggregate-native-artifacts.mjs","rust:release-gate:preflight":"node scripts/rust/release-gate-preflight.mjs","rust:release-evidence:plan":"node scripts/rust/release-evidence-plan.mjs","commercial:release-gate:preflight":"node scripts/commercial-release-preflight.mjs","test:commercial-release-gate":"bun test scripts/commercialReleasePreflight.test.ts","test:rust-packaging":"bun test scripts/rust/npmPackaging.test.ts scripts/rust/nativeReleaseContract.test.ts scripts/rust/nativeStartupSmoke.test.ts scripts/rust/releaseGatePreflight.test.ts scripts/releaseCore.test.ts","rust:packages:check":"node scripts/rust/sync-package-versions.mjs","rust:packages:sync":"node scripts/rust/sync-package-versions.mjs --write","themes:generate":"node scripts/generate-theme-scales.mjs",postinstall:"node scripts/setup-windows-runtime.mjs && node scripts/setup-agent-skills.mjs",prepublishOnly:"node scripts/rust/require-release-orchestrator.mjs",typecheck:"tsc --noEmit --incremental --tsBuildInfoFile .cache/tsconfig.tsbuildinfo",lint:"eslint . --cache --cache-location .cache/eslintcache",format:"biome format --write .","format:check":"biome format .","verify:ultra":"node scripts/compatibility/ultra-gate.mjs","verify:ultra:fresh":"node scripts/compatibility/ultra-gate.mjs --no-cache","verify:ultra:smoke":"npm run verify:ultra && npm run test:smoke","verify:fast":"bun scripts/run-static-checks.mjs --format && bun test:changed","extension:zip":"node scripts/pack-chrome-extension.mjs","extension:release":"node scripts/release-chrome-extension.mjs",release:"node scripts/release.mjs",knip:"knip",check:"bun scripts/run-static-checks.mjs --format && bun check:boundaries && bun check:commercial-performance && bun check:hostile-inputs && bun compatibility:bdd && bun rust:packages:check",prepare:"husky",ladle:"ladle serve","ladle:build":"ladle build"},dependencies:{"@mariozechner/pi-agent-core":"^0.73.1","@mariozechner/pi-ai":"^0.73.1","@modelcontextprotocol/server":"^2.0.0-beta.4","@tailwindcss/typography":"^0.5.20","@tanstack/react-router":"^1.170.18","@tanstack/react-start":"^1.168.28","@tanstack/react-virtual":"^3.14.6","class-variance-authority":"^0.7.1",clsx:"^2.1.1",conf:"^15.1.0",diff:"^9.0.0",jszip:"^3.10.1","lucide-react":"^0.563.0","radix-ui":"1.6.2",react:"^19.2.7","react-dom":"^19.2.7","react-markdown":"^10.1.0",swr:"^2.4.2","tailwind-merge":"^3.6.0",three:"0.185.1","tw-animate-css":"^1.4.0",zod:"^4.4.3"},optionalDependencies:{"@tonyclaw/agent-inspector-backend-darwin-arm64":"4.0.22","@tonyclaw/agent-inspector-backend-linux-x64-gnu":"4.0.22","@tonyclaw/agent-inspector-backend-win32-x64-msvc":"4.0.22","better-sqlite3":"^12.11.1",rcedit:"4.0.1"},devDependencies:{"@biomejs/biome":"^2.5.3","@eslint/js":"^10.0.1","@ladle/react":"^5.1.1","@radix-ui/colors":"^3.0.0","@tailwindcss/vite":"^4.3.2","@tanstack/router-plugin":"^1.168.20","@types/bun":"^1.3.14","@types/react":"^19.2.17","@types/react-dom":"^19.2.3","@types/three":"0.185.1","@typescript-eslint/eslint-plugin":"^8.64.0","@typescript-eslint/parser":"^8.64.0","@vitejs/plugin-react":"^5.2.0",ajv:"8.20.0","ajv-formats":"3.0.1","colorjs.io":"^0.7.0",esbuild:"^0.28.1",eslint:"^9.39.5","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-functional":"^9.0.5","eslint-plugin-unicorn":"^63.0.0",husky:"^9.1.7",knip:"^5.88.1",nitro:"^3.0.260610-beta",playwright:"^1.61.1",tailwindcss:"^4.3.2",typescript:"^5.9.3",vite:"^7.3.6","vite-tsconfig-paths":"^6.1.1"},overrides:{undici:">=7.24.0 <8.0.0",rollup:">=4.59.0 <5.0.0",postcss:">=8.5.10 <9.0.0","js-yaml":">=4.1.2 <5.0.0",flatted:">=3.4.0 <4.0.0","smol-toml":">=1.6.1 <2.0.0",koa:">=2.16.4 <3.0.0","@babel/core":">=7.29.1 <8.0.0","@typescript-eslint/typescript-estree":"^8.63.0",vite:"^7.3.6"}}});function m(e,t,r){function o(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let l=a.prototype,d=Object.keys(l);for(let p=0;p<d.length;p++){let f=d[p];f in s||(s[f]=l[f].bind(s))}}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function a(s){var u;let l=r?.Parent?new i:this;o(l,s),(u=l._zod).deferred??(u.deferred=[]);for(let d of l._zod.deferred)d();return l}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}function Y(e){return e&&Object.assign(zt,e),zt}var Bf,ms,fs,Be,ft,zt,Dt=y(()=>{ms=Object.freeze({status:"aborted"});fs=Symbol("zod_brand"),Be=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ft=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Bf=globalThis).__zod_globalConfig??(Bf.__zod_globalConfig={});zt=globalThis.__zod_globalConfig});var k={};we(k,{BIGINT_FORMAT_RANGES:()=>Is,Class:()=>hs,NUMBER_FORMAT_RANGES:()=>xs,aborted:()=>yt,allowsEval:()=>bs,assert:()=>dx,assertEqual:()=>sx,assertIs:()=>ux,assertNever:()=>lx,assertNotEqual:()=>cx,assignProp:()=>ht,base64ToUint8Array:()=>Zf,base64urlToUint8Array:()=>Rx,cached:()=>cn,captureStackTrace:()=>Po,cleanEnum:()=>wx,cleanRegex:()=>ar,clone:()=>he,cloneDef:()=>mx,createTransparentProxy:()=>bx,defineLazy:()=>A,esc:()=>So,escapeRegex:()=>je,explicitlyAborted:()=>Ss,extend:()=>$x,finalizeIssue:()=>ve,floatSafeRemainder:()=>vs,getElementAtPath:()=>fx,getEnumValues:()=>ir,getLengthableOrigin:()=>ur,getParsedType:()=>yx,getSizableOrigin:()=>cr,hexToUint8Array:()=>Ex,isObject:()=>Ut,isPlainObject:()=>vt,issue:()=>un,joinValues:()=>h,jsonStringifyReplacer:()=>sn,merge:()=>Ix,mergeDefs:()=>it,normalizeParams:()=>$,nullish:()=>gt,numKeys:()=>vx,objectClone:()=>px,omit:()=>kx,optionalKeys:()=>$s,parsedType:()=>_,partial:()=>Sx,pick:()=>_x,prefixIssues:()=>ke,primitiveTypes:()=>ks,promiseAllObject:()=>gx,propertyKeyTypes:()=>sr,randomString:()=>hx,required:()=>Px,safeExtend:()=>xx,shallowClone:()=>_s,slugify:()=>ys,stringifyPrimitive:()=>b,uint8ArrayToBase64:()=>Gf,uint8ArrayToBase64url:()=>Tx,uint8ArrayToHex:()=>Ox,unwrapMessage:()=>or});function sx(e){return e}function cx(e){return e}function ux(e){}function lx(e){throw new Error("Unexpected value in exhaustive check")}function dx(e){}function ir(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function h(e,t="|"){return e.map(r=>b(r)).join(t)}function sn(e,t){return typeof t=="bigint"?t.toString():t}function cn(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function gt(e){return e==null}function ar(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function vs(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}function A(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Ff)return o===void 0&&(o=Ff,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function px(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ht(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function it(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function mx(e){return it(e._zod.def)}function fx(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function gx(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}function hx(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function So(e){return JSON.stringify(e)}function ys(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function vt(e){if(Ut(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ut(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function _s(e){return vt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function vx(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function je(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function he(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function $(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 new 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 bx(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function b(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function $s(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function _x(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=it(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return ht(this,"shape",a),a},checks:[]});return he(e,i)}function kx(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=it(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return ht(this,"shape",a),a},checks:[]});return he(e,i)}function $x(e,t){if(!vt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=it(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return ht(this,"shape",i),i}});return he(e,n)}function xx(e,t){if(!vt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=it(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return ht(this,"shape",o),o}});return he(e,r)}function Ix(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=it(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return ht(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return he(e,r)}function Sx(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=it(t._zod.def,{get shape(){let s=t._zod.def.shape,u={...s};if(r)for(let l in r){if(!(l in s))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(u[l]=e?new e({type:"optional",innerType:s[l]}):s[l])}else for(let l in s)u[l]=e?new e({type:"optional",innerType:s[l]}):s[l];return ht(this,"shape",u),u},checks:[]});return he(t,a)}function Px(e,t,r){let o=it(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:n[a]}))}else for(let a in n)i[a]=new e({type:"nonoptional",innerType:n[a]});return ht(this,"shape",i),i}});return he(t,o)}function yt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ss(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function ke(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function or(e){return typeof e=="string"?e:e?.message}function ve(e,t,r){let o=e.message?e.message:or(e.inst?._zod.def?.error?.(e))??or(t?.error?.(e))??or(r.customError?.(e))??or(r.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:a,...s}=e;return s.path??(s.path=[]),s.message=o,t?.reportInput&&(s.input=a),s}function cr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ur(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function _(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function un(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function wx(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Zf(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function Gf(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Rx(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Zf(t+r)}function Tx(e){return Gf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Ex(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function Ox(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ff,Po,bs,yx,sr,ks,xs,Is,hs,S=y(()=>{Dt();Ff=Symbol("evaluating");Po="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};bs=cn(()=>{if(zt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});yx=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},sr=new Set(["string","number","symbol"]),ks=new Set(["string","number","bigint","boolean","symbol","undefined"]);xs={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Is={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};hs=class{constructor(...t){}}});function dr(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function pr(e,t=r=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>o({issues:s},[...i,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...i,...a.path]);else{let s=[...i,...a.path];if(s.length===0)r._errors.push(t(a));else{let u=r,l=0;for(;l<s.length;){let d=s[l];l===s.length-1?(u[d]=u[d]||{_errors:[]},u[d]._errors.push(t(a))):u[d]=u[d]||{_errors:[]},u=u[d],l++}}}};return o(e),r}function Ps(e,t=r=>r.message){let r={errors:[]},o=(n,i=[])=>{var a,s;for(let u of n.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(l=>o({issues:l},[...i,...u.path]));else if(u.code==="invalid_key")o({issues:u.issues},[...i,...u.path]);else if(u.code==="invalid_element")o({issues:u.issues},[...i,...u.path]);else{let l=[...i,...u.path];if(l.length===0){r.errors.push(t(u));continue}let d=r,p=0;for(;p<l.length;){let f=l[p],v=p===l.length-1;typeof f=="string"?(d.properties??(d.properties={}),(a=d.properties)[f]??(a[f]={errors:[]}),d=d.properties[f]):(d.items??(d.items=[]),(s=d.items)[f]??(s[f]={errors:[]}),d=d.items[f]),v&&d.errors.push(t(u)),p++}}};return o(e),r}function Jf(e){let t=[],r=e.map(o=>typeof o=="object"?o.key:o);for(let o of r)typeof o=="number"?t.push(`[${o}]`):typeof o=="symbol"?t.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?t.push(`[${JSON.stringify(o)}]`):(t.length&&t.push("."),t.push(o));return t.join("")}function ws(e){let t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)t.push(`\u2716 ${o.message}`),o.path?.length&&t.push(` \u2192 at ${Jf(o.path)}`);return t.join(`
|
|
3
3
|
`)}var Hf,lr,$e,Rs=y(()=>{Dt();S();Hf=(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,sn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lr=m("$ZodError",Hf),$e=m("$ZodError",Hf,{Parent:Error})});var ln,wo,dn,Ro,pn,Ts,mn,Es,To,Cx,Eo,Nx,Oo,zx,Ao,Dx,Co,Ux,No,jx,zo,Lx,Do,Mx,Os=y(()=>{Dt();Rs();S();ln=e=>(t,r,o,n)=>{let i=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new Be;if(a.issues.length){let s=new(n?.Err??e)(a.issues.map(u=>ve(u,i,Y())));throw Po(s,n?.callee),s}return a.value},wo=ln($e),dn=e=>async(t,r,o,n)=>{let i=o?{...o,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(n?.Err??e)(a.issues.map(u=>ve(u,i,Y())));throw Po(s,n?.callee),s}return a.value},Ro=dn($e),pn=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new Be;return i.issues.length?{success:!1,error:new(e??lr)(i.issues.map(a=>ve(a,n,Y())))}:{success:!0,data:i.value}},Ts=pn($e),mn=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>ve(a,n,Y())))}:{success:!0,data:i.value}},Es=mn($e),To=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return ln(e)(t,r,n)},Cx=To($e),Eo=e=>(t,r,o)=>ln(e)(t,r,o),Nx=Eo($e),Oo=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return dn(e)(t,r,n)},zx=Oo($e),Ao=e=>async(t,r,o)=>dn(e)(t,r,o),Dx=Ao($e),Co=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return pn(e)(t,r,n)},Ux=Co($e),No=e=>(t,r,o)=>pn(e)(t,r,o),jx=No($e),zo=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return mn(e)(t,r,n)},Lx=zo($e),Do=e=>async(t,r,o)=>mn(e)(t,r,o),Mx=Do($e)});var Re={};we(Re,{base64:()=>Vs,base64url:()=>Uo,bigint:()=>ec,boolean:()=>nc,browserEmail:()=>Wx,cidrv4:()=>Hs,cidrv6:()=>Js,cuid:()=>As,cuid2:()=>Cs,date:()=>Ks,datetime:()=>Ys,domain:()=>Xx,duration:()=>js,e164:()=>qs,email:()=>Ms,emoji:()=>Bs,extendedDuration:()=>Bx,guid:()=>Ls,hex:()=>Yx,hostname:()=>Kx,html5Email:()=>Hx,httpProtocol:()=>Ws,idnEmail:()=>Vx,integer:()=>tc,ipv4:()=>Fs,ipv6:()=>Zs,ksuid:()=>Ds,lowercase:()=>ic,mac:()=>Gs,md5_base64:()=>eI,md5_base64url:()=>tI,md5_hex:()=>Qx,nanoid:()=>Us,null:()=>rc,number:()=>jo,rfc5322Email:()=>Jx,sha1_base64:()=>rI,sha1_base64url:()=>oI,sha1_hex:()=>nI,sha256_base64:()=>aI,sha256_base64url:()=>sI,sha256_hex:()=>iI,sha384_base64:()=>uI,sha384_base64url:()=>lI,sha384_hex:()=>cI,sha512_base64:()=>pI,sha512_base64url:()=>mI,sha512_hex:()=>dI,string:()=>Qs,time:()=>Xs,ulid:()=>Ns,undefined:()=>oc,unicodeEmail:()=>Vf,uppercase:()=>ac,uuid:()=>jt,uuid4:()=>Fx,uuid6:()=>Zx,uuid7:()=>Gx,xid:()=>zs});function Bs(){return new RegExp(qx,"u")}function qf(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Xs(e){return new RegExp(`^${qf(e)}$`)}function Ys(e){let t=qf({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Wf}T(?:${o})$`)}function mr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function fr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var As,Cs,Ns,zs,Ds,Us,js,Bx,Ls,jt,Fx,Zx,Gx,Ms,Hx,Jx,Vf,Vx,Wx,qx,Fs,Zs,Gs,Hs,Js,Vs,Uo,Kx,Xx,Ws,qs,Wf,Ks,Qs,ec,tc,jo,nc,rc,oc,ic,ac,Yx,Qx,eI,tI,nI,rI,oI,iI,aI,sI,cI,uI,lI,dI,pI,mI,Lo=y(()=>{S();As=/^[cC][0-9a-z]{6,}$/,Cs=/^[0-9a-z]+$/,Ns=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,zs=/^[0-9a-vA-V]{20}$/,Ds=/^[A-Za-z0-9]{27}$/,Us=/^[a-zA-Z0-9_-]{21}$/,js=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Bx=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ls=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,jt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Fx=jt(4),Zx=jt(6),Gx=jt(7),Ms=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Hx=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Jx=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Vf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Vx=Vf,Wx=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,qx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";Fs=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Gs=e=>{let t=je(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Hs=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Js=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Uo=/^[A-Za-z0-9_-]*$/,Kx=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Xx=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Ws=/^https?$/,qs=/^\+[1-9]\d{6,14}$/,Wf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ks=new RegExp(`^${Wf}$`);Qs=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ec=/^-?\d+n?$/,tc=/^-?\d+$/,jo=/^-?\d+(?:\.\d+)?$/,nc=/^(?:true|false)$/i,rc=/^null$/i,oc=/^undefined$/i,ic=/^[^A-Z]*$/,ac=/^[^a-z]*$/,Yx=/^[0-9a-fA-F]*$/;Qx=/^[0-9a-fA-F]{32}$/,eI=mr(22,"=="),tI=fr(22),nI=/^[0-9a-fA-F]{40}$/,rI=mr(27,"="),oI=fr(27),iI=/^[0-9a-fA-F]{64}$/,aI=mr(43,"="),sI=fr(43),cI=/^[0-9a-fA-F]{96}$/,uI=mr(64,""),lI=fr(64),dI=/^[0-9a-fA-F]{128}$/,pI=mr(86,"=="),mI=fr(86)});function Kf(e,t,r){e.issues.length&&t.issues.push(...ke(r,e.issues))}var V,Xf,Mo,Bo,sc,cc,uc,lc,dc,pc,mc,fc,gc,fn,hc,vc,yc,bc,_c,kc,$c,xc,Ic,Fo=y(()=>{Dt();Lo();S();V=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Xf={number:"number",bigint:"bigint",object:"date"},Mo=m("$ZodCheckLessThan",(e,t)=>{V.init(e,t);let r=Xf[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bo=m("$ZodCheckGreaterThan",(e,t)=>{V.init(e,t);let r=Xf[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sc=m("$ZodCheckMultipleOf",(e,t)=>{V.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):vs(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),cc=m("$ZodCheckNumberFormat",(e,t)=>{V.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=xs[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=n,s.maximum=i,r&&(s.pattern=tc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}s<n&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),uc=m("$ZodCheckBigIntFormat",(e,t)=>{V.init(e,t);let[r,o]=Is[t.format];e._zod.onattach.push(n=>{let i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=n=>{let i=n.value;i<r&&n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>o&&n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),lc=m("$ZodCheckMaxSize",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!gt(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;n.size<=t.maximum||o.issues.push({origin:cr(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),dc=m("$ZodCheckMinSize",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!gt(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;n.size>=t.minimum||o.issues.push({origin:cr(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),pc=m("$ZodCheckSizeEquals",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!gt(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=o=>{let n=o.value,i=n.size;if(i===t.size)return;let a=i>t.size;o.issues.push({origin:cr(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),mc=m("$ZodCheckMaxLength",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!gt(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let a=ur(n);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),fc=m("$ZodCheckMinLength",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!gt(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let a=ur(n);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),gc=m("$ZodCheckLengthEquals",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!gt(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,i=n.length;if(i===t.length)return;let a=ur(n),s=i>t.length;o.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),fn=m("$ZodCheckStringFormat",(e,t)=>{var r,o;V.init(e,t),e._zod.onattach.push(n=>{let i=n._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),hc=m("$ZodCheckRegex",(e,t)=>{fn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),vc=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ic),fn.init(e,t)}),yc=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ac),fn.init(e,t)}),bc=m("$ZodCheckIncludes",(e,t)=>{V.init(e,t);let r=je(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),_c=m("$ZodCheckStartsWith",(e,t)=>{V.init(e,t);let r=new RegExp(`^${je(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),kc=m("$ZodCheckEndsWith",(e,t)=>{V.init(e,t);let r=new RegExp(`.*${je(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});$c=m("$ZodCheckProperty",(e,t)=>{V.init(e,t),e._zod.check=r=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then(n=>Kf(n,r,t.property));Kf(o,r,t.property)}}),xc=m("$ZodCheckMimeType",(e,t)=>{V.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(o=>{o._zod.bag.mime=t.mime}),e._zod.check=o=>{r.has(o.value.type)||o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),Ic=m("$ZodCheckOverwrite",(e,t)=>{V.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}})});var gr,Sc=y(()=>{gr=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
|
|
4
4
|
`).filter(a=>a),n=Math.min(...o.map(a=>a.length-a.trimStart().length)),i=o.map(a=>a.slice(n)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,n.join(`
|
|
5
5
|
`))}}});var Pc,wc=y(()=>{Pc={major:4,minor:4,patch:3}});function qc(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function mg(e){if(!Uo.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return qc(r)}function fg(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}function Qf(e,t,r){e.issues.length&&t.issues.push(...ke(r,e.issues)),t.value[r]=e.value}function Jo(e,t,r,o,n,i){let a=r in o;if(e.issues.length){if(n&&i&&!a)return;t.issues.push(...ke(r,e.issues))}if(!a&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?a&&(t.value[r]=void 0):t.value[r]=e.value}function gg(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=$s(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function hg(e,t,r,o,n,i){let a=[],s=n.keySet,u=n.catchall._zod,l=u.def.type,d=u.optin==="optional",p=u.optout==="optional";for(let f in t){if(f==="__proto__"||s.has(f))continue;if(l==="never"){a.push(f);continue}let v=u.run({value:t[f],issues:[]},o);v instanceof Promise?e.push(v.then(g=>Jo(g,r,f,t,d,p))):Jo(v,r,f,t,d,p)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}function eg(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter(i=>!yt(i));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>ve(a,o,Y())))}),t)}function tg(e,t,r,o){let n=e.filter(i=>i.issues.length===0);return n.length===1?(t.value=n[0].value,t):(n.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>ve(a,o,Y())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}function Rc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(vt(e)&&vt(t)){let r=Object.keys(t),o=Object.keys(e).filter(i=>r.indexOf(i)!==-1),n={...e,...t};for(let i of o){let a=Rc(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n[i]=a.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],a=Rc(n,i);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ng(e,t,r){let o=new Map,n;for(let s of t.issues)if(s.code==="unrecognized_keys"){n??(n=s);for(let u of s.keys)o.has(u)||o.set(u,{}),o.get(u).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let u of s.keys)o.has(u)||o.set(u,{}),o.get(u).r=!0;else e.issues.push(s);let i=[...o].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&n&&e.issues.push({...n,keys:i}),yt(e))return e;let a=Rc(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}function rg(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]._zod[t]!=="optional")return r+1;return 0}function og(e,t,r){e.issues.length&&t.issues.push(...ke(r,e.issues)),t.value[r]=e.value}function ig(e,t,r,o,n){for(let i=0;i<r.length;i++){let a=e[i],s=i<o.length;if(a.issues.length){if(!s&&i>=n){t.value.length=i;break}t.issues.push(...ke(i,a.issues))}t.value[i]=a.value}for(let i=t.value.length-1;i>=o.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}function ag(e,t,r,o,n,i,a){e.issues.length&&(sr.has(typeof o)?r.issues.push(...ke(o,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map(s=>ve(s,a,Y()))})),t.issues.length&&(sr.has(typeof o)?r.issues.push(...ke(o,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map(s=>ve(s,a,Y()))})),r.value.set(e.value,t.value)}function sg(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function cg(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}function ug(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function lg(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Zo(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}function Go(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let n=t.transform(e.value,e);return n instanceof Promise?n.then(i=>Ho(e,i,t.out,r)):Ho(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(i=>Ho(e,i,t.in,r)):Ho(e,n,t.in,r)}}function Ho(e,t,r,o){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},o)}function dg(e){return e.value=Object.freeze(e.value),e}function pg(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(un(n))}}var T,Lt,H,Tc,Ec,Oc,Ac,Cc,Nc,zc,Dc,Uc,jc,Lc,Mc,Bc,Fc,Zc,Gc,Hc,Jc,Vc,Wc,Kc,Xc,Yc,Qc,eu,Vo,tu,hr,Wo,nu,ru,ou,iu,au,su,cu,uu,lu,du,vg,pu,vr,mu,fu,gu,qo,hu,vu,yu,bu,_u,ku,$u,Ko,xu,Iu,Su,Pu,wu,Ru,Tu,Eu,Xo,yr,Ou,Au,Cu,Nu,zu,Du,Uu,ju=y(()=>{Fo();Dt();Sc();Os();Lo();S();wc();S();T=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pc;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(a,s,u)=>{let l=yt(a),d;for(let p of s){if(p._zod.def.when){if(Ss(a)||!p._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,v=p._zod.check(a);if(v instanceof Promise&&u?.async===!1)throw new Be;if(d||v instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await v,a.issues.length!==f&&(l||(l=yt(a,f)))});else{if(a.issues.length===f)continue;l||(l=yt(a,f))}}return d?d.then(()=>a):a},i=(a,s,u)=>{if(yt(a))return a.aborted=!0,a;let l=n(s,o,u);if(l instanceof Promise){if(u.async===!1)throw new Be;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,s)):i(l,a,s)}let u=e._zod.parse(a,s);if(u instanceof Promise){if(s.async===!1)throw new Be;return u.then(l=>n(l,o,s))}return n(u,o,s)}}A(e,"~standard",()=>({validate:n=>{try{let i=Ts(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Es(e,n).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Lt=m("$ZodString",(e,t)=>{T.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qs(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),H=m("$ZodStringFormat",(e,t)=>{fn.init(e,t),Lt.init(e,t)}),Tc=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ls),H.init(e,t)}),Ec=m("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=jt(o))}else t.pattern??(t.pattern=jt());H.init(e,t)}),Oc=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ms),H.init(e,t)}),Ac=m("$ZodURL",(e,t)=>{H.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===Ws.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Cc=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Bs()),H.init(e,t)}),Nc=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Us),H.init(e,t)}),zc=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=As),H.init(e,t)}),Dc=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Cs),H.init(e,t)}),Uc=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ns),H.init(e,t)}),jc=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=zs),H.init(e,t)}),Lc=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ds),H.init(e,t)}),Mc=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ys(t)),H.init(e,t)}),Bc=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ks),H.init(e,t)}),Fc=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Xs(t)),H.init(e,t)}),Zc=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=js),H.init(e,t)}),Gc=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Fs),H.init(e,t),e._zod.bag.format="ipv4"}),Hc=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Zs),H.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Jc=m("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Gs(t.delimiter)),H.init(e,t),e._zod.bag.format="mac"}),Vc=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Hs),H.init(e,t)}),Wc=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Js),H.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,i]=o;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});Kc=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Vs),H.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{qc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});Xc=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Uo),H.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{mg(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Yc=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qs),H.init(e,t)});Qc=m("$ZodJWT",(e,t)=>{H.init(e,t),e._zod.check=r=>{fg(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),eu=m("$ZodCustomStringFormat",(e,t)=>{H.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Vo=m("$ZodNumber",(e,t)=>{T.init(e,t),e._zod.pattern=e._zod.bag.pattern??jo,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),tu=m("$ZodNumberFormat",(e,t)=>{cc.init(e,t),Vo.init(e,t)}),hr=m("$ZodBoolean",(e,t)=>{T.init(e,t),e._zod.pattern=nc,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Wo=m("$ZodBigInt",(e,t)=>{T.init(e,t),e._zod.pattern=ec,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),nu=m("$ZodBigIntFormat",(e,t)=>{uc.init(e,t),Wo.init(e,t)}),ru=m("$ZodSymbol",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),ou=m("$ZodUndefined",(e,t)=>{T.init(e,t),e._zod.pattern=oc,e._zod.values=new Set([void 0]),e._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),iu=m("$ZodNull",(e,t)=>{T.init(e,t),e._zod.pattern=rc,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),au=m("$ZodAny",(e,t)=>{T.init(e,t),e._zod.parse=r=>r}),su=m("$ZodUnknown",(e,t)=>{T.init(e,t),e._zod.parse=r=>r}),cu=m("$ZodNever",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),uu=m("$ZodVoid",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),lu=m("$ZodDate",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,i=n instanceof Date;return i&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});du=m("$ZodArray",(e,t)=>{T.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let i=[];for(let a=0;a<n.length;a++){let s=n[a],u=t.element._zod.run({value:s,issues:[]},o);u instanceof Promise?i.push(u.then(l=>Qf(l,r,a))):Qf(u,r,a)}return i.length?Promise.all(i).then(()=>r):r}});vg=m("$ZodObject",(e,t)=>{if(T.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let o=cn(()=>gg(t));A(e._zod,"propValues",()=>{let s=t.shape,u={};for(let l in s){let d=s[l]._zod;if(d.values){u[l]??(u[l]=new Set);for(let p of d.values)u[l].add(p)}}return u});let n=Ut,i=t.catchall,a;e._zod.parse=(s,u)=>{a??(a=o.value);let l=s.value;if(!n(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),s;s.value={};let d=[],p=a.shape;for(let f of a.keys){let v=p[f],g=v._zod.optin==="optional",P=v._zod.optout==="optional",w=v._zod.run({value:l[f],issues:[]},u);w instanceof Promise?d.push(w.then(F=>Jo(F,s,f,l,g,P))):Jo(w,s,f,l,g,P)}return i?hg(d,l,s,u,o.value,e):d.length?Promise.all(d).then(()=>s):s}}),pu=m("$ZodObjectJIT",(e,t)=>{vg.init(e,t);let r=e._zod.parse,o=cn(()=>gg(t)),n=f=>{let v=new gr(["shape","payload","ctx"]),g=o.value,P=Z=>{let R=So(Z);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};v.write("const input = payload.value;");let w=Object.create(null),F=0;for(let Z of g.keys)w[Z]=`key_${F++}`;v.write("const newResult = {};");for(let Z of g.keys){let R=w[Z],C=So(Z),B=f[Z],N=B?._zod?.optin==="optional",De=B?._zod?.optout==="optional";v.write(`const ${R} = ${P(Z)};`),N&&De?v.write(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{AsyncLocalStorage as Re}from"node:async_hooks";import{H as Ie,t as Ne}from"../_libs/h3-v2.mjs";import{q as $e,s as Ee,u as De,v as ze,w as A,x as Ue,y as re,z as _e,A as z,C as Je,D as Be,E as Ge,F as We,G as Ke,H as Ve,I as oe,J as Xe,K as Ye,L as Ze,M as Qe,N as et,O as tt,P as Ce}from"../_libs/tanstack__router-core.mjs";import{i as rt,P as ie,s as nt}from"../_libs/seroval.mjs";import{c as st}from"../_libs/tanstack__history.mjs";import{j as xe}from"../_libs/react.mjs";import{r as ot,R as it}from"../_libs/tanstack__react-router.mjs";import"../_libs/rou3.mjs";import"../_libs/srvx.mjs";import"node:http";import"node:stream";import"node:stream/promises";import"node:https";import"node:http2";import"../_libs/cookie-es.mjs";import"../_libs/seroval-plugins.mjs";import"node:stream/web";import"../_libs/react-dom.mjs";import"util";import"crypto";import"async_hooks";import"stream";import"../_libs/isbot.mjs";function at(e){return xe.jsx(it,{router:e.router})}var ct=Ye(({request:e,router:t,responseHeaders:r})=>ot({request:e,router:t,responseHeaders:r,children:xe.jsx(at,{router:t})})),G=Symbol.for("tanstack-start:event-storage"),W=globalThis;W[G]||(W[G]=new Re);var ke=W[G];function ut(e){return typeof e.then=="function"}function ae(e){const t=e;if(typeof t.getSetCookie=="function")return t.getSetCookie();const r=e.get("set-cookie");return r?[r]:[]}function ce(e,t){if(e.ok)return;const r=ae(t.res.headers);if(r.length===0)return;const n=ae(e.headers);e.headers.delete("set-cookie");for(const s of n)e.headers.append("set-cookie",s);for(const s of r)e.headers.append("set-cookie",s)}function ft(e,t){return ut(e)?e.then(r=>(r instanceof Response&&ce(r,t),r)):(e instanceof Response&&ce(e,t),e)}function lt(e){return(t,r)=>{let n;try{n=new Ie(t)}catch(s){if(s instanceof URIError)return new Response(null,{status:400,statusText:"Bad Request"});throw s}return Ne(ft(ke.run({h3Event:n},()=>e(t,r)),n),n)}}function pt(){const e=ke.getStore();if(!e)throw new Error("No StartEvent found in AsyncLocalStorage. Make sure you are using the function within the server runtime.");return e.h3Event}function ue(){return pt().res}var dt={TSS_SHELL:"X-TSS_SHELL"};async function ht(e){const{tsrStartManifest:t}=await import("../_tanstack-start-manifest_v-D7cKwKzM.mjs"),r=t();let n=r.routes;n[Ge];const s={};for(const o in n){const i=n[o],a={};i.preloads&&i.preloads.length>0&&(a.preloads=i.preloads),i.scripts&&i.scripts.length>0&&(a.scripts=i.scripts),i.css?.length&&(a.css=i.css),(a.preloads||a.scripts||a.css)&&(s[o]=a)}return{...r.scriptFormat?{scriptFormat:r.scriptFormat}:{},...r.inlineCss?{inlineCss:r.inlineCss}:{},routes:s}}const yt={};async function Oe(e,t){const r=yt[e];if(!r)throw new Error("Server function info not found for "+e);const n=r.module??await r.importer();if(!n)throw new Error("Server function module not resolved for "+e);const s=n[r.functionName];if(!s)throw new Error("Server function module export not resolved for serverFn ID: "+e);return s}var fe="__TSS_CONTEXT",le=Symbol.for("TSS_SERVER_FUNCTION"),U="x-tss-serialized",mt="x-tss-raw",gt="application/x-tss-framed",P={JSON:0,CHUNK:1,END:2,ERROR:3},pe=9,wt=`${gt}; v=1`;function K(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"}function M(e,t){const r=Object.create(null);if(e)for(const n of Object.keys(e))K(n)&&(r[n]=e[n]);if(t&&typeof t=="object")for(const n of Object.keys(t))K(n)&&(r[n]=t[n]);return r}function de(e){if(!e)return Object.create(null);const t=Object.create(null);for(const r of Object.keys(e))K(r)&&(t[r]=e[r]);return t}var V=Symbol.for("tanstack-start:start-storage-context"),X=globalThis;X[V]||(X[V]=new Re);var He=X[V];async function he(e,t){return He.run(e,t)}function Y(e){const t=He.getStore();if(!t&&e?.throwIfNotFound!==!1)throw new Error("No Start context found in AsyncLocalStorage. Make sure you are using the function within the server runtime.");return t}var vt=()=>Y().startOptions;function Z(e,t=100){const r=new Set,n=[],s=(o,i)=>{if(i>t)throw new Error(`Middleware nesting depth exceeded maximum of ${t}. Check for circular references.`);o.forEach(a=>{a.options.middleware&&s(a.options.middleware,i+1),r.has(a)||(r.add(a),n.push(a))})};return s(e,0),n}var q=(e,t)=>{const r={type:"request",...t||e},n=s=>q({},Object.assign(r,{validator:s,inputValidator:s}));return{options:r,middleware:s=>q({},Object.assign(r,{middleware:s})),validator:n,inputValidator:n,client:s=>q({},Object.assign(r,{client:s})),server:s=>q({},Object.assign(r,{server:s}))}},St=(e={})=>q().server(async t=>{const r=t;return e.filter&&!await e.filter(r)||await Et(e,r)?t.next():Ot(e,r)}),Rt=St;async function Et(e,t){const r=await Ct(e,t);return r===!0||r===void 0&&e.allowRequestsWithoutOriginCheck===!0}async function Ct(e,t){const r=t.request.headers.get("Sec-Fetch-Site");if(r!==null)return _(e.secFetchSite??"same-origin",r,t);const n=t.request.headers.get("Origin");if(n!==null)return e.origin?_(e.origin,n,t):n===new URL(t.request.url).origin;const s=t.request.headers.get("Referer");if(!(s===null||e.referer===!1)){if(typeof e.referer=="function")return e.referer(s,t);if(e.origin){const o=xt(s);return o!==void 0&&_(e.origin,o,t)}return kt(s,new URL(t.request.url).origin)}}async function _(e,t,r){return typeof e=="function"?e(t,r):Array.isArray(e)?e.includes(t):t===e}function xt(e){try{return new URL(e).origin}catch{return}}function kt(e,t){if(e===t)return!0;if(!e.startsWith(t))return!1;if(e.length===t.length)return!0;const r=e.charCodeAt(t.length);return r===47||r===63||r===35}async function Ot(e,t){return typeof e.failureResponse=="function"?e.failureResponse(t):e.failureResponse?.clone()??new Response("Forbidden",{status:403})}function Ht(){return[...vt()?.serializationAdapters?.map(Qe)??[],...Ze]}var Te=new TextEncoder,Tt=new Uint8Array(0);function j(e,t,r){const n=new Uint8Array(pe+r.length);return n[0]=e,n[1]=t>>>24&255,n[2]=t>>>16&255,n[3]=t>>>8&255,n[4]=t&255,n[5]=r.length>>>24&255,n[6]=r.length>>>16&255,n[7]=r.length>>>8&255,n[8]=r.length&255,n.set(r,pe),n}function bt(e){return j(P.JSON,0,Te.encode(e))}function Lt(e,t){return j(P.CHUNK,e,t)}function Ft(e){return j(P.END,e,Tt)}function qt(e,t){const r=t instanceof Error?t.message:String(t??"Unknown error");return j(P.ERROR,e,Te.encode(r))}function At(e,t,r){let n,s=!1;const o=[],i=l=>{if(s)return!1;try{return n.enqueue(l),!0}catch{return!1}},a=l=>{if(!s){s=!0;try{n.error(l)}catch{}for(const f of o)f.cancel().catch(()=>{})}};async function c(l,f){const p=f.getReader();o.push(p);try{for(;!s;){const{done:d,value:v}=await p.read();if(d){i(Ft(l));return}if(!i(Lt(l,v)))return}}catch(d){i(qt(l,d))}finally{p.releaseLock()}}async function u(){const l=e.getReader();o.push(l);try{for(;!s;){const{done:f,value:p}=await l.read();if(f||!i(bt(p)))return}}catch(f){throw a(f),f}finally{l.releaseLock()}}async function y(){if(!r)return[];const l=[],f=r.getReader();o.push(f);try{for(;!s;){const{done:p,value:d}=await f.read();if(p)break;l.push(c(d.id,d.stream))}}finally{f.releaseLock()}return l}return new ReadableStream({async start(l){n=l;const f=[u()];for(const[p,d]of t)f.push(c(p,d));r&&f.push(y());try{const p=(await Promise.all(f)).find(Array.isArray);if(p&&p.length>0&&await Promise.all(p),!s)try{n.close()}catch{}}catch{}},cancel(){s=!0;for(const l of o)l.cancel().catch(()=>{});o.length=0}})}var L=void 0,Mt=["multipart/form-data","application/x-www-form-urlencoded"],Pt=1e6,jt=async({request:e,context:t,serverFnId:r})=>{const n=e.method.toUpperCase(),s=new URL(e.url),o=await Oe(r);if(o.method&&n!==o.method)return new Response(`expected ${o.method} method. Got ${n}`,{status:405,headers:{Allow:o.method}});const i=e.headers.get("x-tsr-serverFn")==="true";L||(L=Ht());const a=e.headers.get("Content-Type");function c(u){return ie(u,{plugins:L})}return await(async()=>{try{let u=function(f){let p;const d=ue();if(f!==void 0){const v=new Map;let C=!0,h,E;const g=[],R=[Ke((w,m)=>{if(C){v.set(w,m);return}if(h){h.write({id:w,stream:m}).catch(()=>{});return}g.push({id:w,stream:m})}),...L||[]];let k=!1;const S={onParse:w=>{p=w},onDone:()=>{k=!0},onError:w=>{throw w}};if(rt(f,{refs:new Map,plugins:R,onParse(w){S.onParse(w)},onDone(){S.onDone()},onError:w=>{S.onError(w)}}),C=!1,k&&v.size===0)return new Response(p?JSON.stringify(p):void 0,{status:d.status,statusText:d.statusText,headers:{"Content-Type":"application/json",[U]:"true"}});const{readable:I,writable:N}=new TransformStream;E=I,h=N.getWriter();for(const w of g)h.write(w).catch(()=>{});g.length=0;const $=At(new ReadableStream({start(w){S.onParse=m=>{w.enqueue(JSON.stringify(m)+`
|
|
2
|
-
`)},S.onDone=()=>{try{w.close()}catch{}h?.close().catch(()=>{}).finally(()=>{h=void 0})},S.onError=m=>{w.error(m),h?.abort(m).catch(()=>{}).finally(()=>{h=void 0})},p!==void 0&&S.onParse(p),k&&S.onDone()},cancel(){h?.abort().catch(()=>{}),h=void 0}}),v,E);return new Response($,{status:d.status,statusText:d.statusText,headers:{"Content-Type":wt,[U]:"true"}})}return new Response(void 0,{status:d.status,statusText:d.statusText})},y=await(async()=>{if(Mt.some(d=>a&&a.includes(d))){n==="GET"&&Ve();const d=await e.formData(),v=d.get(fe);d.delete(fe);const C={context:t,data:d,method:n};if(typeof v=="string")try{const h=ie(JSON.parse(v),{plugins:L});typeof h=="object"&&h&&(C.context=M(h,t))}catch{}return await o(C)}if(n==="GET"){const d=s.searchParams.get("payload");if(d&&d.length>Pt)throw new Error("Payload too large");const v=d?c(JSON.parse(d)):{};return v.context=M(v.context,t),v.method=n,await o(v)}let f;a?.includes("application/json")&&(f=await e.json());const p=f?c(f):{};return p.context=M(p.context,t),p.method=n,await o(p)})();const l=y.result||y.error;return oe(y)&&(y=ye(y)),i?l instanceof Response?(re(l)||l.headers.set(mt,"true"),l):u(y):l}catch(u){if(u instanceof Response)return u;if(oe(u))return ye(u);console.info(),console.info("Server Fn Error!"),console.info(),console.error(u),console.info();const y=JSON.stringify(await Promise.resolve(nt(u,{refs:new Map,plugins:L}))),l=ue();return new Response(y,{status:l.status??500,statusText:l.statusText,headers:{"Content-Type":"application/json",[U]:"true"}})}})()};function ye(e){const{headers:t,...r}=e;return new Response(JSON.stringify(r),{status:404,headers:{"Content-Type":"application/json",...t||{}}})}var It=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Nt=new Set(["fetch","font","image","script","style","track"]);function b(e,t){return t===void 0?e:It.test(t)?`${e}=${t}`:`${e}=${JSON.stringify(t)}`}function be(e){const t=[`<${e.href}>`,b("rel",e.rel)];return e.as&&t.push(b("as",e.as)),e.crossOrigin!==void 0&&t.push(b("crossorigin",e.crossOrigin||void 0)),e.type&&t.push(b("type",e.type)),e.integrity&&t.push(b("integrity",e.integrity)),e.referrerPolicy&&t.push(b("referrerpolicy",e.referrerPolicy)),e.fetchPriority&&t.push(b("fetchpriority",e.fetchPriority)),t.join("; ")}function H(e,t,r){const n=e?.[t]??(r?e?.[r]:void 0);return typeof n=="string"?n:void 0}function $t(e){const t=H(e,"as");return t&&Nt.has(t)?t:void 0}function Dt(e,t){const r=H(t,"crossOrigin","crossorigin"),n=H(t,"type"),s=H(t,"integrity"),o=H(t,"referrerPolicy","referrerpolicy"),i=H(t,"fetchPriority","fetchpriority");r!==void 0&&(e.crossOrigin=r),n&&(e.type=n),s&&(e.integrity=s),o&&(e.referrerPolicy=o),i&&(e.fetchPriority=i)}function zt(e){const t=H(e,"href"),r=H(e,"rel");if(!t||!r)return;const n=r.split(/\s+/);let s,o;if(n.includes("modulepreload"))s="modulepreload",o="script";else if(n.includes("stylesheet"))s="preload",o="style";else if(n.includes("preload")){if(o=$t(e),!o)return;s="preload"}else n.includes("preconnect")?(s="preconnect",o=void 0):n.includes("dns-prefetch")&&(s="dns-prefetch",o=void 0);if(!s)return;const i={href:t,rel:s};return o&&(i.as=o),Dt(i,e),i}function Ut(e,t){const r=[];for(const n of t){const s=e.routes[n.id];if(s){for(const o of s.preloads??[]){const i=et(e,o),a={href:i.href,rel:i.rel,as:"script"};i.crossOrigin!==void 0&&(a.crossOrigin=i.crossOrigin),r.push(a)}for(const o of s.css??[]){const i=tt(o);if(e.inlineCss?.styles[i]!==void 0)continue;const a=Ee(o),c={href:i,rel:"preload",as:"style"};a.crossOrigin!==void 0&&(c.crossOrigin=a.crossOrigin),r.push(c)}}}return r}function _t(e){const t=[];for(const r of e){const n=r.links;if(Array.isArray(n))for(const s of n){const o=zt(s);o&&t.push(o)}}return t}function Jt(e){const t=[],r=[];for(const n of e.hints){const s=be(n);e.sentLinks.has(s)||(e.sentLinks.add(s),e.sentHints.push(n),t.push(n),r.push(s))}if(!(!t.length&&e.phase!=="dynamic"))return{phase:e.phase,hints:t,links:r,allHints:e.sentHints.slice(),allLinks:Array.from(e.sentLinks)}}function Bt(e){for(const t of e.hints){const r=be(t);e.sentLinks.has(r)||(e.sentLinks.add(r),e.entries.push({phase:e.phase,hint:t,link:r}))}}function Gt(e){if(!e.filter)return e.entries.map(t=>t.link);try{const t=[];for(const r of e.entries)e.filter(r)&&t.push(r.link);return t}catch(t){return console.error("Error filtering response Link headers:",t),[]}}function Wt(e,t,r){try{const n=r(t);n&&Promise.resolve(n).catch(s=>{console.error(`Error sending ${e} early hints:`,s)})}catch(n){console.error(`Error sending ${e} early hints:`,n)}}function Kt(e){if(typeof e=="object")return e.filter}function Vt(e){for(const t of Gt(e))e.responseHeaders.append("Link",t)}function Xt(e){for(let t=0;t<e.event.hints.length;t++)e.entries.push({phase:e.phase,hint:e.event.hints[t],link:e.event.links[t]})}function me(e){const t=e.onEarlyHints?Jt({phase:e.phase,hints:e.hints,sentLinks:e.sentLinks,sentHints:e.sentHints}):void 0;if(t&&Wt(e.phase,t,e.onEarlyHints),!!e.responseLinkHeaderEntries){if(t){Xt({phase:e.phase,event:t,entries:e.responseLinkHeaderEntries});return}Bt({phase:e.phase,hints:e.hints,sentLinks:e.sentLinks,entries:e.responseLinkHeaderEntries})}}function Yt(e){if(!e?.onEarlyHints&&!e?.responseLinkHeader)return;const t=new Set,r=e.onEarlyHints?new Array:void 0,n=e.responseLinkHeader?new Array:void 0,s=Kt(e.responseLinkHeader);return{collectStatic:({manifest:o,matchedRoutes:i})=>{i?.length&&me({phase:"static",hints:Ut(o,i),sentLinks:t,sentHints:r,onEarlyHints:e.onEarlyHints,responseLinkHeaderEntries:n})},collectDynamic:o=>{me({phase:"dynamic",hints:_t(o),sentLinks:t,sentHints:r,onEarlyHints:e.onEarlyHints,responseLinkHeaderEntries:n})},appendResponseHeaders:o=>{n?.length&&Vt({responseHeaders:o,entries:n,filter:s})}}}function Q(e){return typeof e=="string"?{href:e}:e}function Zt(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\a ").replace(/\r/g,"\\d ").replace(/\f/g,"\\c ")}async function Qt(e){const{strings:t,urls:r}=e.template;if(t.length!==r.length+1)throw new Error(`TanStack Start inlineCss template for ${e.stylesheetHref} is invalid`);let n=t[0];for(let s=0;s<r.length;s++){const o=Q(await e.transformFn({kind:"css-url",url:r[s],stylesheetHref:e.stylesheetHref}));n+=Zt(o.href)+t[s+1]}return n}async function er(e,t){const r={},n=await Promise.all(Object.entries(e.styles).map(async([s,o])=>{const i=e.templates?.[s];return[s,i?await Qt({stylesheetHref:s,template:i,transformFn:t}):o]}));for(const[s,o]of n)r[s]=o;return{styles:r,...e.templates?{templates:e.templates}:{}}}function tr(e,t){if(e)return typeof e=="string"?e:e[t]}function rr(e){return"prefix"in e}function nr(e){if(typeof e=="string"){const t=e;return{type:"transform",transformFn:({url:r})=>({href:`${t}${r}`}),cache:!0}}if(typeof e=="function")return{type:"transform",transformFn:e,cache:!0};if(rr(e)){const{prefix:t,crossOrigin:r}=e;return{type:"transform",transformFn:({url:n,kind:s})=>{const o=`${t}${n}`;if(s==="css-url")return{href:o};const i=tr(r,s);return i?{href:o,crossOrigin:i}:{href:o}},cache:!0}}return"createTransform"in e&&e.createTransform?{type:"createTransform",createTransform:e.createTransform,cache:e.cache!==!1}:{type:"transform",transformFn:typeof e.transform=="string"?(({url:t})=>({href:`${e.transform}${t}`})):e.transform,cache:e.cache!==!1}}function ge(e,t){if(typeof e=="string")return t.crossOrigin?t:t.href;const r={...e,href:t.href};return t.crossOrigin?r.crossOrigin=t.crossOrigin:delete r.crossOrigin,r}async function sr(e,t,r){const n=structuredClone(e),s=r?.inlineCss!==!1,o=new Map,i=a=>{const c=o.get(a);if(c)return c;const u=Promise.resolve(t({url:a,kind:"script"})).then(Q);return o.set(a,u),u};s?n.inlineCss&&(n.inlineCss=await er(n.inlineCss,t)):delete n.inlineCss;for(const a of Object.values(n.routes))if(a.preloads?.length&&(a.preloads=await Promise.all(a.preloads.map(async c=>{const u=await i($e(c).href);return ge(c,{href:u.href,crossOrigin:u.crossOrigin})}))),a.css?.length&&!n.inlineCss&&(a.css=await Promise.all(a.css.map(async c=>{const u=Q(await t({url:Ee(c).href,kind:"stylesheet"}));return ge(c,{href:u.href,crossOrigin:u.crossOrigin})}))),a.scripts?.length)for(const c of a.scripts){const u=c.attrs?.src;if(typeof u!="string")continue;const y=await i(u);c.attrs={...c.attrs,src:y.href},y.crossOrigin?c.attrs.crossOrigin=y.crossOrigin:delete c.attrs.crossOrigin}return n}function or(e,t){return{...e.scriptFormat?{scriptFormat:e.scriptFormat}:{},...t?.inlineCss!==!1&&e.inlineCss?{inlineCss:structuredClone(e.inlineCss)}:{},routes:{...e.routes}}}function ir(e){if(typeof e!="function")return e??!0}async function ar(e){return e.requestInlineCss!==void 0?e.requestInlineCss:typeof e.handlerInlineCss=="function"?await e.handlerInlineCss({request:e.request}):e.handlerInlineCss??!0}function cr(e){let t;return()=>(t||(t=e().catch(r=>{throw t=void 0,r})),t)}function ur(e,t){const r=e!==void 0?nr(e):void 0,n=r?r.cache:!0,s=!!e&&typeof e=="object"&&"warmup"in e&&e.warmup===!0;let o;const i=()=>{o=void 0};return{cache:n,warmup:s,clearCachedCreateTransform:i,getTransformFn:async a=>{if(r)return r.type!=="createTransform"?r.transformFn:n?(o||(o=Promise.resolve(r.createTransform(a)).catch(c=>{throw i(),c})),o):r.createTransform(a)}}}function fr(e){const t=new Map,r=ur(e.transformAssets),n=ir(e.inlineCss),s=async i=>{const a=await r.getTransformFn({warmup:!1,request:i.request}),c=await ar({request:i.request,handlerInlineCss:e.inlineCss,requestInlineCss:i.requestInlineCss});return{getBaseManifest:i.getBaseManifest,transformFn:a,cache:r.cache,inlineCss:c}},o=async(i,a)=>pr({...await s(i),finalManifestCache:a});return{warmup:({getBaseManifest:i})=>dr({enabled:r.warmup,handlerDefaultInlineCss:n,cache:r.cache,finalManifestCache:t,getBaseManifest:i,getTransformFn:()=>r.getTransformFn({warmup:!0}),onError:r.clearCachedCreateTransform}),resolveCached:i=>o(i,t),resolveUncached:i=>o(i,void 0)}}function Le(e){return e?"inline-css":"linked-css"}function lr(e,t,r){const n=r.catch(s=>{throw e.get(t)===n&&e.delete(t),s});return e.set(t,n),n}function Fe(e,t,r){return e.get(t)||lr(e,t,Promise.resolve().then(r))}async function qe(e){return e.transformFn?await sr(e.base,e.transformFn,{inlineCss:e.inlineCss}):or(e.base,{inlineCss:e.inlineCss})}async function pr(e){const t=async()=>qe({base:await e.getBaseManifest(),transformFn:e.transformFn,inlineCss:e.inlineCss});return e.finalManifestCache&&(!e.transformFn||e.cache)?Fe(e.finalManifestCache,Le(e.inlineCss),t):t()}function dr(e){if(!e.enabled||e.handlerDefaultInlineCss===void 0||!e.cache)return;const t=e.handlerDefaultInlineCss,r=Fe(e.finalManifestCache,Le(t),async()=>{const[n,s]=await Promise.all([e.getBaseManifest(),e.getTransformFn()]);return qe({base:n,transformFn:s,inlineCss:t})});return e.onError&&r.catch(e.onError),r}var hr=We({key:"$TSS/serverfn",test:e=>typeof e!="function"||!(le in e)?!1:!!e[le],toSerializable:({serverFnMeta:e})=>({functionId:e.id}),fromSerializable:({functionId:e})=>async(t,r)=>(await(await Oe(e))(t??{},r)).result});function yr(e){return Xe({"Content-Type":"text/html; charset=utf-8"},...e.router.stores.matches.get().map(t=>t.headers))}var J,mr=Rt({filter:e=>e.handlerType==="serverFn"}),gr=cr(()=>ht()),wr=()=>gr(),we=wr,vr=Yt;async function Sr(){const[e,t,r]=await Promise.all([import("./router-HTKEFlBr.mjs"),import("./start-CbEonH-m.mjs"),import("./empty-plugin-adapters-C3Q1xu4u.mjs")]);return{routerEntry:e,startEntry:t,pluginAdapters:r}}function Rr(){return J||(J=Sr()),J}var Er="/",B="/_serverFn/",ve=process.env.TSS_PRERENDERING==="true",Cr=process.env.TSS_SHELL==="true",xr="Internal Server Error",kr="Internal Server Error";function ne(){throw new Error(xr)}function Or(){throw new Error(kr)}function Ae(e){return e instanceof Response||re(e)}function Hr(e){return Ce(e)||Ae(e)?{response:e}:e}async function ee(e,t){let r=-1,n;const s=c=>{if(Ce(c)){c.serverSsrCleanup==="stream"&&(n=c),t.response=c.response;return}t.response=c},o=async c=>{const u=n;if(!u)return;n=void 0;const y=t.response;(y===u.response||y instanceof Response&&u.response.body!==null&&y.body===u.response.body)&&(t.response=void 0),await u.dispose(c)},i=async()=>{const c=t.response;return c||ne(),n?c===n.response?n:n.response.body!==null&&c.body===n.response.body?{...n,response:c}:(await o("middleware response replaced"),c):c},a=async c=>{if(c){c.context&&(t.context=M(t.context,c.context));for(const f of Object.keys(c))f==="response"?s(c.response):f!=="context"&&(t[f]=c[f])}r++;const u=e[r];if(!u)return t;let y;try{y=await u({...t,next:a})}catch(f){if(Ae(f))return s(f),t;throw await o("middleware error"),f}const l=Hr(y);return l&&(l.response!==void 0&&s(l.response),l.context&&(t.context=M(t.context,l.context))),t};return await a(),{ctx:t,response:await i()}}function Se(e,t=!1){return t?e:async r=>{const n=await e({...r,next:Or});return n||ne(),n}}function Tr(e){const t=typeof e=="function"?{}:e,r=typeof e=="function"?e:e.handler,n=fr({...t}),s=n.resolveCached;return n.warmup({getBaseManifest:()=>we()}),lt(async(o,i)=>{let a=null,c=!1;try{const{url:u,handledProtocolRelativeURL:y}=De(o.url),l=u.pathname+u.search+u.hash,f=ze(o);if(y)return Response.redirect(u,308);const p=await Rr(),d=!!p.startEntry.startInstance,v=await p.startEntry.startInstance?.getOptions()||{},{hasPluginAdapters:C,pluginSerializationAdapters:h}=p.pluginAdapters,E=[...v.serializationAdapters||[],...C?h:[],hr],g={...v,requestMiddleware:d?v.requestMiddleware:[mr],serializationAdapters:E},R=g.requestMiddleware?Z(g.requestMiddleware):[],k=new Set(R),S=async()=>{if(a)return a;a=await p.routerEntry.getRouter();let m=Cr;ve&&!m&&(m=o.headers.get(dt.TSS_SHELL)==="true");const x=st({initialEntries:[l]});return a.update({history:x,isShell:m,isPrerendering:ve,origin:a.options.origin??f,defaultSsr:g.defaultSsr,serializationAdapters:[...g.serializationAdapters,...a.options.serializationAdapters||[]],basepath:Er}),a};if(B&&u.pathname.startsWith(B)){const m=u.pathname.slice(B.length).split("/")[0];if(!m)throw new Error("Invalid server action param for serverFnId");const x=async({context:T})=>he({getRouter:S,startOptions:g,contextAfterGlobalMiddlewares:T,request:o,executedRequestMiddlewares:k,handlerType:"serverFn"},()=>jt({request:o,context:i?.context,serverFnId:m})),{response:D}=await ee([...R.map(T=>T.options.server),x],{request:o,pathname:u.pathname,handlerType:"serverFn",context:de(i?.context)}),F=await te(D,o,S);return c=F.serverSsrCleanup==="stream",F.response}const I=async(m,x)=>{const D=(o.headers.get("Accept")||"*/*").split(",");if(!["*/*","text/html"].some(Pe=>D.some(je=>je.trim().startsWith(Pe))))return A(Response.json({error:"Only HTML requests are supported here"},{status:500}));const F=await s({request:o,requestInlineCss:i?.inlineCss,getBaseManifest:()=>we(x)}),T=vr({onEarlyHints:i?.onEarlyHints,responseLinkHeader:i?.responseLinkHeader});T?.collectStatic({manifest:F,matchedRoutes:x});const O=await S();if(Ue({router:O,manifest:F,getRequestAssets:()=>Y({throwIfNotFound:!1})?.requestAssets}),O.options.additionalContext={serverContext:m},await O.load(),O.state.redirect)return A(O.state.redirect);T?.collectDynamic(O.stores.matches.get());const Me=Y({throwIfNotFound:!1});await O.serverSsr.dehydrate({requestAssets:Me?.requestAssets});const se=yr({router:O});return T?.appendResponseHeaders(se),A(await r({request:o,router:O,responseHeaders:se}))},N=async({context:m})=>he({getRouter:S,startOptions:g,contextAfterGlobalMiddlewares:m,request:o,executedRequestMiddlewares:k,handlerType:"router"},async()=>{try{return await br({getRouter:S,request:o,url:u,executeRouter:I,context:m,executedRequestMiddlewares:k})}catch(x){if(x instanceof Response)return x;throw x}}),{response:$}=await ee([...R.map(m=>m.options.server),N],{request:o,pathname:u.pathname,handlerType:"router",context:de(i?.context)}),w=await te($,o,S);return c=w.serverSsrCleanup==="stream",w.response}finally{a?.serverSsr&&!c&&a.serverSsr.cleanup(),a=null}})}async function te(e,t,r){const n=A(e);if(!re(n.response))return n;if(_e(n.response))return t.headers.get("x-tsr-serverFn")==="true"?z(n,Response.json({...n.response.options,isSerializedRedirect:!0},{headers:n.response.headers}),"redirect response replaced"):n;const s=n.response.options;if(s.to&&typeof s.to=="string"&&!s.to.startsWith("/"))throw new Error(`Server side redirects must use absolute paths via the 'href' or 'to' options. The redirect() method's "to" property accepts an internal path only. Use the "href" property to provide an external URL. Received: ${JSON.stringify(s)}`);if(["params","search","hash"].some(i=>typeof s[i]=="function"))throw new Error(`Server side redirects must use static search, params, and hash values and do not support functional values. Received functional values for: ${Object.keys(s).filter(i=>typeof s[i]=="function").map(i=>`"${i}"`).join(", ")}`);const o=(await r()).resolveRedirect(n.response);return t.headers.get("x-tsr-serverFn")==="true"?z(n,Response.json({...n.response.options,isSerializedRedirect:!0},{headers:n.response.headers}),"redirect response replaced"):z(n,o,"redirect response replaced")}async function br({getRouter:e,request:t,url:r,executeRouter:n,context:s,executedRequestMiddlewares:o}){const i=await e(),a=Je(i.rewrite,r).pathname,{matchedRoutes:c,foundRoute:u,routeParams:y}=i.getMatchedRoutes(a),l=u&&y["**"]===void 0,f=[];for(const h of c){const E=h.options.server?.middleware;if(E){const g=Z(E);for(const R of g)o.has(R)||f.push(R.options.server)}}const p=u?.options.server;let d=!1;if(p?.handlers&&l){const h=typeof p.handlers=="function"?p.handlers({createHandlers:R=>R}):p.handlers,E=t.method.toUpperCase(),g=E==="HEAD"?h.HEAD??h.GET??h.ANY:h[E]??h.ANY;if(d=E==="HEAD"&&g!==void 0&&!h.HEAD,g){const R=!!u.options.component;if(typeof g=="function")f.push(Se(g,R));else{if(g.middleware?.length){const k=Z(g.middleware);for(const S of k)f.push(S.options.server)}g.handler&&f.push(Se(g.handler,R))}}}f.push((h=>n(h.context,c)));const{ctx:v,response:C}=await ee(f,{request:t,context:s,params:y,pathname:a,handlerType:"router"});return d?(v.response||ne(),Be(await te(C,t,e),"HEAD body stripped")):A(C)}const Lr=Tr(ct);function Fr(e){return{async fetch(...t){return await e.fetch(...t)}}}const tn=Fr({fetch:Lr});export{q as c,Fr as createServerEntry,tn as default};
|
|
2
|
+
`)},S.onDone=()=>{try{w.close()}catch{}h?.close().catch(()=>{}).finally(()=>{h=void 0})},S.onError=m=>{w.error(m),h?.abort(m).catch(()=>{}).finally(()=>{h=void 0})},p!==void 0&&S.onParse(p),k&&S.onDone()},cancel(){h?.abort().catch(()=>{}),h=void 0}}),v,E);return new Response($,{status:d.status,statusText:d.statusText,headers:{"Content-Type":wt,[U]:"true"}})}return new Response(void 0,{status:d.status,statusText:d.statusText})},y=await(async()=>{if(Mt.some(d=>a&&a.includes(d))){n==="GET"&&Ve();const d=await e.formData(),v=d.get(fe);d.delete(fe);const C={context:t,data:d,method:n};if(typeof v=="string")try{const h=ie(JSON.parse(v),{plugins:L});typeof h=="object"&&h&&(C.context=M(h,t))}catch{}return await o(C)}if(n==="GET"){const d=s.searchParams.get("payload");if(d&&d.length>Pt)throw new Error("Payload too large");const v=d?c(JSON.parse(d)):{};return v.context=M(v.context,t),v.method=n,await o(v)}let f;a?.includes("application/json")&&(f=await e.json());const p=f?c(f):{};return p.context=M(p.context,t),p.method=n,await o(p)})();const l=y.result||y.error;return oe(y)&&(y=ye(y)),i?l instanceof Response?(re(l)||l.headers.set(mt,"true"),l):u(y):l}catch(u){if(u instanceof Response)return u;if(oe(u))return ye(u);console.info(),console.info("Server Fn Error!"),console.info(),console.error(u),console.info();const y=JSON.stringify(await Promise.resolve(nt(u,{refs:new Map,plugins:L}))),l=ue();return new Response(y,{status:l.status??500,statusText:l.statusText,headers:{"Content-Type":"application/json",[U]:"true"}})}})()};function ye(e){const{headers:t,...r}=e;return new Response(JSON.stringify(r),{status:404,headers:{"Content-Type":"application/json",...t||{}}})}var It=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Nt=new Set(["fetch","font","image","script","style","track"]);function b(e,t){return t===void 0?e:It.test(t)?`${e}=${t}`:`${e}=${JSON.stringify(t)}`}function be(e){const t=[`<${e.href}>`,b("rel",e.rel)];return e.as&&t.push(b("as",e.as)),e.crossOrigin!==void 0&&t.push(b("crossorigin",e.crossOrigin||void 0)),e.type&&t.push(b("type",e.type)),e.integrity&&t.push(b("integrity",e.integrity)),e.referrerPolicy&&t.push(b("referrerpolicy",e.referrerPolicy)),e.fetchPriority&&t.push(b("fetchpriority",e.fetchPriority)),t.join("; ")}function H(e,t,r){const n=e?.[t]??(r?e?.[r]:void 0);return typeof n=="string"?n:void 0}function $t(e){const t=H(e,"as");return t&&Nt.has(t)?t:void 0}function Dt(e,t){const r=H(t,"crossOrigin","crossorigin"),n=H(t,"type"),s=H(t,"integrity"),o=H(t,"referrerPolicy","referrerpolicy"),i=H(t,"fetchPriority","fetchpriority");r!==void 0&&(e.crossOrigin=r),n&&(e.type=n),s&&(e.integrity=s),o&&(e.referrerPolicy=o),i&&(e.fetchPriority=i)}function zt(e){const t=H(e,"href"),r=H(e,"rel");if(!t||!r)return;const n=r.split(/\s+/);let s,o;if(n.includes("modulepreload"))s="modulepreload",o="script";else if(n.includes("stylesheet"))s="preload",o="style";else if(n.includes("preload")){if(o=$t(e),!o)return;s="preload"}else n.includes("preconnect")?(s="preconnect",o=void 0):n.includes("dns-prefetch")&&(s="dns-prefetch",o=void 0);if(!s)return;const i={href:t,rel:s};return o&&(i.as=o),Dt(i,e),i}function Ut(e,t){const r=[];for(const n of t){const s=e.routes[n.id];if(s){for(const o of s.preloads??[]){const i=et(e,o),a={href:i.href,rel:i.rel,as:"script"};i.crossOrigin!==void 0&&(a.crossOrigin=i.crossOrigin),r.push(a)}for(const o of s.css??[]){const i=tt(o);if(e.inlineCss?.styles[i]!==void 0)continue;const a=Ee(o),c={href:i,rel:"preload",as:"style"};a.crossOrigin!==void 0&&(c.crossOrigin=a.crossOrigin),r.push(c)}}}return r}function _t(e){const t=[];for(const r of e){const n=r.links;if(Array.isArray(n))for(const s of n){const o=zt(s);o&&t.push(o)}}return t}function Jt(e){const t=[],r=[];for(const n of e.hints){const s=be(n);e.sentLinks.has(s)||(e.sentLinks.add(s),e.sentHints.push(n),t.push(n),r.push(s))}if(!(!t.length&&e.phase!=="dynamic"))return{phase:e.phase,hints:t,links:r,allHints:e.sentHints.slice(),allLinks:Array.from(e.sentLinks)}}function Bt(e){for(const t of e.hints){const r=be(t);e.sentLinks.has(r)||(e.sentLinks.add(r),e.entries.push({phase:e.phase,hint:t,link:r}))}}function Gt(e){if(!e.filter)return e.entries.map(t=>t.link);try{const t=[];for(const r of e.entries)e.filter(r)&&t.push(r.link);return t}catch(t){return console.error("Error filtering response Link headers:",t),[]}}function Wt(e,t,r){try{const n=r(t);n&&Promise.resolve(n).catch(s=>{console.error(`Error sending ${e} early hints:`,s)})}catch(n){console.error(`Error sending ${e} early hints:`,n)}}function Kt(e){if(typeof e=="object")return e.filter}function Vt(e){for(const t of Gt(e))e.responseHeaders.append("Link",t)}function Xt(e){for(let t=0;t<e.event.hints.length;t++)e.entries.push({phase:e.phase,hint:e.event.hints[t],link:e.event.links[t]})}function me(e){const t=e.onEarlyHints?Jt({phase:e.phase,hints:e.hints,sentLinks:e.sentLinks,sentHints:e.sentHints}):void 0;if(t&&Wt(e.phase,t,e.onEarlyHints),!!e.responseLinkHeaderEntries){if(t){Xt({phase:e.phase,event:t,entries:e.responseLinkHeaderEntries});return}Bt({phase:e.phase,hints:e.hints,sentLinks:e.sentLinks,entries:e.responseLinkHeaderEntries})}}function Yt(e){if(!e?.onEarlyHints&&!e?.responseLinkHeader)return;const t=new Set,r=e.onEarlyHints?new Array:void 0,n=e.responseLinkHeader?new Array:void 0,s=Kt(e.responseLinkHeader);return{collectStatic:({manifest:o,matchedRoutes:i})=>{i?.length&&me({phase:"static",hints:Ut(o,i),sentLinks:t,sentHints:r,onEarlyHints:e.onEarlyHints,responseLinkHeaderEntries:n})},collectDynamic:o=>{me({phase:"dynamic",hints:_t(o),sentLinks:t,sentHints:r,onEarlyHints:e.onEarlyHints,responseLinkHeaderEntries:n})},appendResponseHeaders:o=>{n?.length&&Vt({responseHeaders:o,entries:n,filter:s})}}}function Q(e){return typeof e=="string"?{href:e}:e}function Zt(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\a ").replace(/\r/g,"\\d ").replace(/\f/g,"\\c ")}async function Qt(e){const{strings:t,urls:r}=e.template;if(t.length!==r.length+1)throw new Error(`TanStack Start inlineCss template for ${e.stylesheetHref} is invalid`);let n=t[0];for(let s=0;s<r.length;s++){const o=Q(await e.transformFn({kind:"css-url",url:r[s],stylesheetHref:e.stylesheetHref}));n+=Zt(o.href)+t[s+1]}return n}async function er(e,t){const r={},n=await Promise.all(Object.entries(e.styles).map(async([s,o])=>{const i=e.templates?.[s];return[s,i?await Qt({stylesheetHref:s,template:i,transformFn:t}):o]}));for(const[s,o]of n)r[s]=o;return{styles:r,...e.templates?{templates:e.templates}:{}}}function tr(e,t){if(e)return typeof e=="string"?e:e[t]}function rr(e){return"prefix"in e}function nr(e){if(typeof e=="string"){const t=e;return{type:"transform",transformFn:({url:r})=>({href:`${t}${r}`}),cache:!0}}if(typeof e=="function")return{type:"transform",transformFn:e,cache:!0};if(rr(e)){const{prefix:t,crossOrigin:r}=e;return{type:"transform",transformFn:({url:n,kind:s})=>{const o=`${t}${n}`;if(s==="css-url")return{href:o};const i=tr(r,s);return i?{href:o,crossOrigin:i}:{href:o}},cache:!0}}return"createTransform"in e&&e.createTransform?{type:"createTransform",createTransform:e.createTransform,cache:e.cache!==!1}:{type:"transform",transformFn:typeof e.transform=="string"?(({url:t})=>({href:`${e.transform}${t}`})):e.transform,cache:e.cache!==!1}}function ge(e,t){if(typeof e=="string")return t.crossOrigin?t:t.href;const r={...e,href:t.href};return t.crossOrigin?r.crossOrigin=t.crossOrigin:delete r.crossOrigin,r}async function sr(e,t,r){const n=structuredClone(e),s=r?.inlineCss!==!1,o=new Map,i=a=>{const c=o.get(a);if(c)return c;const u=Promise.resolve(t({url:a,kind:"script"})).then(Q);return o.set(a,u),u};s?n.inlineCss&&(n.inlineCss=await er(n.inlineCss,t)):delete n.inlineCss;for(const a of Object.values(n.routes))if(a.preloads?.length&&(a.preloads=await Promise.all(a.preloads.map(async c=>{const u=await i($e(c).href);return ge(c,{href:u.href,crossOrigin:u.crossOrigin})}))),a.css?.length&&!n.inlineCss&&(a.css=await Promise.all(a.css.map(async c=>{const u=Q(await t({url:Ee(c).href,kind:"stylesheet"}));return ge(c,{href:u.href,crossOrigin:u.crossOrigin})}))),a.scripts?.length)for(const c of a.scripts){const u=c.attrs?.src;if(typeof u!="string")continue;const y=await i(u);c.attrs={...c.attrs,src:y.href},y.crossOrigin?c.attrs.crossOrigin=y.crossOrigin:delete c.attrs.crossOrigin}return n}function or(e,t){return{...e.scriptFormat?{scriptFormat:e.scriptFormat}:{},...t?.inlineCss!==!1&&e.inlineCss?{inlineCss:structuredClone(e.inlineCss)}:{},routes:{...e.routes}}}function ir(e){if(typeof e!="function")return e??!0}async function ar(e){return e.requestInlineCss!==void 0?e.requestInlineCss:typeof e.handlerInlineCss=="function"?await e.handlerInlineCss({request:e.request}):e.handlerInlineCss??!0}function cr(e){let t;return()=>(t||(t=e().catch(r=>{throw t=void 0,r})),t)}function ur(e,t){const r=e!==void 0?nr(e):void 0,n=r?r.cache:!0,s=!!e&&typeof e=="object"&&"warmup"in e&&e.warmup===!0;let o;const i=()=>{o=void 0};return{cache:n,warmup:s,clearCachedCreateTransform:i,getTransformFn:async a=>{if(r)return r.type!=="createTransform"?r.transformFn:n?(o||(o=Promise.resolve(r.createTransform(a)).catch(c=>{throw i(),c})),o):r.createTransform(a)}}}function fr(e){const t=new Map,r=ur(e.transformAssets),n=ir(e.inlineCss),s=async i=>{const a=await r.getTransformFn({warmup:!1,request:i.request}),c=await ar({request:i.request,handlerInlineCss:e.inlineCss,requestInlineCss:i.requestInlineCss});return{getBaseManifest:i.getBaseManifest,transformFn:a,cache:r.cache,inlineCss:c}},o=async(i,a)=>pr({...await s(i),finalManifestCache:a});return{warmup:({getBaseManifest:i})=>dr({enabled:r.warmup,handlerDefaultInlineCss:n,cache:r.cache,finalManifestCache:t,getBaseManifest:i,getTransformFn:()=>r.getTransformFn({warmup:!0}),onError:r.clearCachedCreateTransform}),resolveCached:i=>o(i,t),resolveUncached:i=>o(i,void 0)}}function Le(e){return e?"inline-css":"linked-css"}function lr(e,t,r){const n=r.catch(s=>{throw e.get(t)===n&&e.delete(t),s});return e.set(t,n),n}function Fe(e,t,r){return e.get(t)||lr(e,t,Promise.resolve().then(r))}async function qe(e){return e.transformFn?await sr(e.base,e.transformFn,{inlineCss:e.inlineCss}):or(e.base,{inlineCss:e.inlineCss})}async function pr(e){const t=async()=>qe({base:await e.getBaseManifest(),transformFn:e.transformFn,inlineCss:e.inlineCss});return e.finalManifestCache&&(!e.transformFn||e.cache)?Fe(e.finalManifestCache,Le(e.inlineCss),t):t()}function dr(e){if(!e.enabled||e.handlerDefaultInlineCss===void 0||!e.cache)return;const t=e.handlerDefaultInlineCss,r=Fe(e.finalManifestCache,Le(t),async()=>{const[n,s]=await Promise.all([e.getBaseManifest(),e.getTransformFn()]);return qe({base:n,transformFn:s,inlineCss:t})});return e.onError&&r.catch(e.onError),r}var hr=We({key:"$TSS/serverfn",test:e=>typeof e!="function"||!(le in e)?!1:!!e[le],toSerializable:({serverFnMeta:e})=>({functionId:e.id}),fromSerializable:({functionId:e})=>async(t,r)=>(await(await Oe(e))(t??{},r)).result});function yr(e){return Xe({"Content-Type":"text/html; charset=utf-8"},...e.router.stores.matches.get().map(t=>t.headers))}var J,mr=Rt({filter:e=>e.handlerType==="serverFn"}),gr=cr(()=>ht()),wr=()=>gr(),we=wr,vr=Yt;async function Sr(){const[e,t,r]=await Promise.all([import("./router-CQUHvHaC.mjs"),import("./start-CbEonH-m.mjs"),import("./empty-plugin-adapters-C3Q1xu4u.mjs")]);return{routerEntry:e,startEntry:t,pluginAdapters:r}}function Rr(){return J||(J=Sr()),J}var Er="/",B="/_serverFn/",ve=process.env.TSS_PRERENDERING==="true",Cr=process.env.TSS_SHELL==="true",xr="Internal Server Error",kr="Internal Server Error";function ne(){throw new Error(xr)}function Or(){throw new Error(kr)}function Ae(e){return e instanceof Response||re(e)}function Hr(e){return Ce(e)||Ae(e)?{response:e}:e}async function ee(e,t){let r=-1,n;const s=c=>{if(Ce(c)){c.serverSsrCleanup==="stream"&&(n=c),t.response=c.response;return}t.response=c},o=async c=>{const u=n;if(!u)return;n=void 0;const y=t.response;(y===u.response||y instanceof Response&&u.response.body!==null&&y.body===u.response.body)&&(t.response=void 0),await u.dispose(c)},i=async()=>{const c=t.response;return c||ne(),n?c===n.response?n:n.response.body!==null&&c.body===n.response.body?{...n,response:c}:(await o("middleware response replaced"),c):c},a=async c=>{if(c){c.context&&(t.context=M(t.context,c.context));for(const f of Object.keys(c))f==="response"?s(c.response):f!=="context"&&(t[f]=c[f])}r++;const u=e[r];if(!u)return t;let y;try{y=await u({...t,next:a})}catch(f){if(Ae(f))return s(f),t;throw await o("middleware error"),f}const l=Hr(y);return l&&(l.response!==void 0&&s(l.response),l.context&&(t.context=M(t.context,l.context))),t};return await a(),{ctx:t,response:await i()}}function Se(e,t=!1){return t?e:async r=>{const n=await e({...r,next:Or});return n||ne(),n}}function Tr(e){const t=typeof e=="function"?{}:e,r=typeof e=="function"?e:e.handler,n=fr({...t}),s=n.resolveCached;return n.warmup({getBaseManifest:()=>we()}),lt(async(o,i)=>{let a=null,c=!1;try{const{url:u,handledProtocolRelativeURL:y}=De(o.url),l=u.pathname+u.search+u.hash,f=ze(o);if(y)return Response.redirect(u,308);const p=await Rr(),d=!!p.startEntry.startInstance,v=await p.startEntry.startInstance?.getOptions()||{},{hasPluginAdapters:C,pluginSerializationAdapters:h}=p.pluginAdapters,E=[...v.serializationAdapters||[],...C?h:[],hr],g={...v,requestMiddleware:d?v.requestMiddleware:[mr],serializationAdapters:E},R=g.requestMiddleware?Z(g.requestMiddleware):[],k=new Set(R),S=async()=>{if(a)return a;a=await p.routerEntry.getRouter();let m=Cr;ve&&!m&&(m=o.headers.get(dt.TSS_SHELL)==="true");const x=st({initialEntries:[l]});return a.update({history:x,isShell:m,isPrerendering:ve,origin:a.options.origin??f,defaultSsr:g.defaultSsr,serializationAdapters:[...g.serializationAdapters,...a.options.serializationAdapters||[]],basepath:Er}),a};if(B&&u.pathname.startsWith(B)){const m=u.pathname.slice(B.length).split("/")[0];if(!m)throw new Error("Invalid server action param for serverFnId");const x=async({context:T})=>he({getRouter:S,startOptions:g,contextAfterGlobalMiddlewares:T,request:o,executedRequestMiddlewares:k,handlerType:"serverFn"},()=>jt({request:o,context:i?.context,serverFnId:m})),{response:D}=await ee([...R.map(T=>T.options.server),x],{request:o,pathname:u.pathname,handlerType:"serverFn",context:de(i?.context)}),F=await te(D,o,S);return c=F.serverSsrCleanup==="stream",F.response}const I=async(m,x)=>{const D=(o.headers.get("Accept")||"*/*").split(",");if(!["*/*","text/html"].some(Pe=>D.some(je=>je.trim().startsWith(Pe))))return A(Response.json({error:"Only HTML requests are supported here"},{status:500}));const F=await s({request:o,requestInlineCss:i?.inlineCss,getBaseManifest:()=>we(x)}),T=vr({onEarlyHints:i?.onEarlyHints,responseLinkHeader:i?.responseLinkHeader});T?.collectStatic({manifest:F,matchedRoutes:x});const O=await S();if(Ue({router:O,manifest:F,getRequestAssets:()=>Y({throwIfNotFound:!1})?.requestAssets}),O.options.additionalContext={serverContext:m},await O.load(),O.state.redirect)return A(O.state.redirect);T?.collectDynamic(O.stores.matches.get());const Me=Y({throwIfNotFound:!1});await O.serverSsr.dehydrate({requestAssets:Me?.requestAssets});const se=yr({router:O});return T?.appendResponseHeaders(se),A(await r({request:o,router:O,responseHeaders:se}))},N=async({context:m})=>he({getRouter:S,startOptions:g,contextAfterGlobalMiddlewares:m,request:o,executedRequestMiddlewares:k,handlerType:"router"},async()=>{try{return await br({getRouter:S,request:o,url:u,executeRouter:I,context:m,executedRequestMiddlewares:k})}catch(x){if(x instanceof Response)return x;throw x}}),{response:$}=await ee([...R.map(m=>m.options.server),N],{request:o,pathname:u.pathname,handlerType:"router",context:de(i?.context)}),w=await te($,o,S);return c=w.serverSsrCleanup==="stream",w.response}finally{a?.serverSsr&&!c&&a.serverSsr.cleanup(),a=null}})}async function te(e,t,r){const n=A(e);if(!re(n.response))return n;if(_e(n.response))return t.headers.get("x-tsr-serverFn")==="true"?z(n,Response.json({...n.response.options,isSerializedRedirect:!0},{headers:n.response.headers}),"redirect response replaced"):n;const s=n.response.options;if(s.to&&typeof s.to=="string"&&!s.to.startsWith("/"))throw new Error(`Server side redirects must use absolute paths via the 'href' or 'to' options. The redirect() method's "to" property accepts an internal path only. Use the "href" property to provide an external URL. Received: ${JSON.stringify(s)}`);if(["params","search","hash"].some(i=>typeof s[i]=="function"))throw new Error(`Server side redirects must use static search, params, and hash values and do not support functional values. Received functional values for: ${Object.keys(s).filter(i=>typeof s[i]=="function").map(i=>`"${i}"`).join(", ")}`);const o=(await r()).resolveRedirect(n.response);return t.headers.get("x-tsr-serverFn")==="true"?z(n,Response.json({...n.response.options,isSerializedRedirect:!0},{headers:n.response.headers}),"redirect response replaced"):z(n,o,"redirect response replaced")}async function br({getRouter:e,request:t,url:r,executeRouter:n,context:s,executedRequestMiddlewares:o}){const i=await e(),a=Je(i.rewrite,r).pathname,{matchedRoutes:c,foundRoute:u,routeParams:y}=i.getMatchedRoutes(a),l=u&&y["**"]===void 0,f=[];for(const h of c){const E=h.options.server?.middleware;if(E){const g=Z(E);for(const R of g)o.has(R)||f.push(R.options.server)}}const p=u?.options.server;let d=!1;if(p?.handlers&&l){const h=typeof p.handlers=="function"?p.handlers({createHandlers:R=>R}):p.handlers,E=t.method.toUpperCase(),g=E==="HEAD"?h.HEAD??h.GET??h.ANY:h[E]??h.ANY;if(d=E==="HEAD"&&g!==void 0&&!h.HEAD,g){const R=!!u.options.component;if(typeof g=="function")f.push(Se(g,R));else{if(g.middleware?.length){const k=Z(g.middleware);for(const S of k)f.push(S.options.server)}g.handler&&f.push(Se(g.handler,R))}}}f.push((h=>n(h.context,c)));const{ctx:v,response:C}=await ee(f,{request:t,context:s,params:y,pathname:a,handlerType:"router"});return d?(v.response||ne(),Be(await te(C,t,e),"HEAD body stripped")):A(C)}const Lr=Tr(ct);function Fr(e){return{async fetch(...t){return await e.fetch(...t)}}}const tn=Fr({fetch:Lr});export{q as c,Fr as createServerEntry,tn as default};
|