code-server
Version:
Run VS Code on a remote server.
84 lines • 199 kB
JavaScript
import{a as vi}from"./chunk-CC4BP63R.js";import{a as Cr}from"./chunk-XH3OJTSZ.js";import{a as ci}from"./chunk-NB6J6K2M.js";import{a as ui,b as di}from"./chunk-SAWQ6EAW.js";import{a as yi}from"./chunk-BWA7DWH2.js";import"./chunk-5EN3FUU5.js";import"./chunk-3X4WHORZ.js";import"./chunk-Q4UTCILM.js";import"./chunk-RS4OOBDL.js";import"./chunk-KWINGM6W.js";import"./chunk-XJWARXV4.js";import"./chunk-HBYVLBIR.js";import{a as _i}from"./chunk-6XUBHLNE.js";import{b as li}from"./chunk-G2EWPYLQ.js";import"./chunk-OZ4ASJEX.js";import{b as Tr,d as pi,m as Mr,n as fi,p as hi,q as Ue,r as mi,s as gi}from"./chunk-7RYOY7AM.js";import"./chunk-IAAAUKJX.js";import{A as Pr,B as ni,C as Ae,D as ii,E as ot,G as oi,P as si,R as Ar,S as ai,ea as st,fa as At,g as qn,i as Vn,j as Wn,k as zt,l as St,m as $t,n as Jn,o as Gn,q as It,r as Xn,t as Yn,u as Et,v as Qn,w as Pt,x as ei,y as ti,z as ri}from"./chunk-YX6DBKFT.js";import{b as Z,c as Er,h as pe}from"./chunk-TOKYXDRE.js";import{a as h}from"./chunk-TZZ523SA.js";import"./chunk-3RNHDNP5.js";var bi;function E(e,t,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=s.prototype,d=Object.keys(u);for(let l=0;l<d.length;l++){let p=d[l];p in a||(a[p]=u[p].bind(a))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function s(a){var c;let u=r?.Parent?new o:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var fe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(bi=globalThis).__zod_globalConfig??(bi.__zod_globalConfig={});var Or=globalThis.__zod_globalConfig;function he(e){return e&&Object.assign(Or,e),Or}function Ct(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function xi(e,t){return typeof t=="bigint"?t.toString():t}function ki(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Rr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var wi=Symbol("evaluating");function ue(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==wi)return n===void 0&&(n=wi,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var Nr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zi(e){if(Mt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Mt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}var Si=new Set(["string","number","symbol"]);function at(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Dr(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function B(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 $i(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ii={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]};function Fe(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 Ei(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 Se(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Tt(e){return typeof e=="string"?e:e?.message}function me(e,t,r){let n=e.message?e.message:Tt(e.inst?._zod.def?.error?.(e))??Tt(t?.error?.(e))??Tt(r.customError?.(e))??Tt(r.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=n,t?.reportInput&&(a.input=s),a}var Pi=(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,xi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ai=E("$ZodError",Pi),ct=E("$ZodError",Pi,{Parent:Error});var Wc=e=>(t,r,n,i)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new fe;if(s.issues.length){let a=new(i?.Err??e)(s.issues.map(c=>me(c,o,he())));throw Nr(a,i?.callee),a}return s.value},Ot=Wc(ct),Jc=e=>async(t,r,n,i)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(i?.Err??e)(s.issues.map(c=>me(c,o,he())));throw Nr(a,i?.callee),a}return s.value},Zt=Jc(ct),Gc=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new fe;return o.issues.length?{success:!1,error:new(e??Ai)(o.issues.map(s=>me(s,i,he())))}:{success:!0,data:o.value}},W=Gc(ct),Xc=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>me(s,i,he())))}:{success:!0,data:o.value}},ut=Xc(ct);var Yc="(?:(?:\\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])))",Qc=new RegExp(`^${Yc}$`);var Ti=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Mi=/^-?\d+$/,Lr=/^-?\d+(?:\.\d+)?$/,Ci=/^(?:true|false)$/i;var dt=E("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),eu={number:"number",bigint:"bigint",object:"date"};var jr=E("$ZodCheckGreaterThan",(e,t)=>{dt.init(e,t);let r=eu[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var Oi=E("$ZodCheckNumberFormat",(e,t)=>{dt.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Ii[t.format];e._zod.onattach.push(s=>{let a=s._zod.bag;a.format=t.format,a.minimum=i,a.maximum=o,r&&(a.pattern=Mi)}),e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}});var Ri={major:4,minor:4,patch:3};var J=E("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ri;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(s,a,c)=>{let u=Fe(s),d;for(let l of a){if(l._zod.def.when){if(Ei(s)||!l._zod.def.when(s))continue}else if(u)continue;let p=s.issues.length,f=l._zod.check(s);if(f instanceof Promise&&c?.async===!1)throw new fe;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(u||(u=Fe(s,p)))});else{if(s.issues.length===p)continue;u||(u=Fe(s,p))}}return d?d.then(()=>s):s},o=(s,a,c)=>{if(Fe(s))return s.aborted=!0,s;let u=i(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new fe;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let u=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>o(d,s,a)):o(u,s,a)}let c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new fe;return c.then(u=>i(u,n,a))}return i(c,n,a)}}ue(e,"~standard",()=>({validate:i=>{try{let o=W(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return ut(e,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),ji=E("$ZodString",(e,t)=>{J.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ti(e._zod.bag),e._zod.parse=(r,n)=>{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}});var Ur=E("$ZodNumber",(e,t)=>{J.init(e,t),e._zod.pattern=e._zod.bag.pattern??Lr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),Ui=E("$ZodNumberFormat",(e,t)=>{Oi.init(e,t),Ur.init(e,t)}),Fi=E("$ZodBoolean",(e,t)=>{J.init(e,t),e._zod.pattern=Ci,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}});var Ki=E("$ZodUnknown",(e,t)=>{J.init(e,t),e._zod.parse=r=>r});var Bi=E("$ZodVoid",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}});function Ni(e,t,r){e.issues.length&&t.issues.push(...Se(r,e.issues)),t.value[r]=e.value}var Hi=E("$ZodArray",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let s=0;s<i.length;s++){let a=i[s],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?o.push(c.then(u=>Ni(u,r,s))):Ni(c,r,s)}return o.length?Promise.all(o).then(()=>r):r}});function Nt(e,t,r,n,i,o){let s=r in n;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...Se(r,e.issues))}if(!s&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?s&&(t.value[r]=void 0):t.value[r]=e.value}function ru(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=$i(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function nu(e,t,r,n,i,o){let s=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,d=c.optin==="optional",l=c.optout==="optional";for(let p in t){if(p==="__proto__"||a.has(p))continue;if(u==="never"){s.push(p);continue}let f=c.run({value:t[p],issues:[]},n);f instanceof Promise?e.push(f.then(m=>Nt(m,r,p,t,d,l))):Nt(f,r,p,t,d,l)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var qi=E("$ZodObject",(e,t)=>{if(J.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=ki(()=>ru(t));ue(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let d=a[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(let l of d.values)c[u].add(l)}}return c});let i=Mt,o=t.catchall,s;e._zod.parse=(a,c)=>{s??(s=n.value);let u=a.value;if(!i(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let d=[],l=s.shape;for(let p of s.keys){let f=l[p],m=f._zod.optin==="optional",_=f._zod.optout==="optional",v=f._zod.run({value:u[p],issues:[]},c);v instanceof Promise?d.push(v.then(z=>Nt(z,a,p,u,m,_))):Nt(v,a,p,u,m,_)}return o?nu(d,u,a,c,n.value,e):d.length?Promise.all(d).then(()=>a):a}});function Di(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter(o=>!Fe(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(s=>me(s,n,he())))}),t)}var Vi=E("$ZodUnion",(e,t)=>{J.init(e,t),ue(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),ue(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),ue(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),ue(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){let n=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>Rr(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let o=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},i);if(c instanceof Promise)s.push(c),o=!0;else{if(c.issues.length===0)return c;s.push(c)}}return o?Promise.all(s).then(a=>Di(a,n,e,i)):Di(s,n,e,i)}});var Wi=E("$ZodRecord",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!zi(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let d=t.keyType._zod.run({value:u,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>me(f,n,he())),input:u,path:[u],inst:e});continue}let l=d.value,p=t.valueType._zod.run({value:i[u],issues:[]},n);p instanceof Promise?o.push(p.then(f=>{f.issues.length&&r.issues.push(...Se(u,f.issues)),r.value[l]=f.value})):(p.issues.length&&r.issues.push(...Se(u,p.issues)),r.value[l]=p.value)}let c;for(let u in i)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(i)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Lr.test(a)&&c.issues.length){let l=t.keyType._zod.run({value:Number(a),issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");l.issues.length===0&&(c=l)}if(c.issues.length){t.mode==="loose"?r.value[a]=i[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(l=>me(l,n,he())),input:a,path:[a],inst:e});continue}let d=t.valueType._zod.run({value:i[a],issues:[]},n);d instanceof Promise?o.push(d.then(l=>{l.issues.length&&r.issues.push(...Se(a,l.issues)),r.value[c.value]=l.value})):(d.issues.length&&r.issues.push(...Se(a,d.issues)),r.value[c.value]=d.value)}}return o.length?Promise.all(o).then(()=>r):r}});var Ji=E("$ZodEnum",(e,t)=>{J.init(e,t);let r=Ct(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>Si.has(typeof i)).map(i=>typeof i=="string"?at(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{let s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:e}),i}}),Gi=E("$ZodLiteral",(e,t)=>{if(J.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?at(n):n?at(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}});function Li(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Xi=E("$ZodOptional",(e,t)=>{J.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ue(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ue(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Rr(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=r.value,o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Li(s,i)):Li(o,i)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var Yi;var Fr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function iu(){return new Fr}(Yi=globalThis).__zod_globalRegistry??(Yi.__zod_globalRegistry=iu());var Qi=globalThis.__zod_globalRegistry;function eo(e,t){return new e({type:"string",...B(t)})}function to(e,t){return new e({type:"number",checks:[],...B(t)})}function ro(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...B(t)})}function no(e,t){return new e({type:"boolean",...B(t)})}function io(e){return new e({type:"unknown"})}function oo(e,t){return new e({type:"void",...B(t)})}function so(e,t){return new jr({check:"greater_than",...B(t),value:e,inclusive:!1})}function Kr(e,t){return new jr({check:"greater_than",...B(t),value:e,inclusive:!0})}function Br(e){return so(0,e)}function Me(e){return Kr(0,e)}function Dt(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Qi,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function C(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,d);else{let p=s.schema,f=t.processors[i.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);f(e,t,p,d)}let l=e._zod.parent;l&&(s.ref||(s.ref=l),C(l,t,d),t.seen.get(l).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(s.schema,c),t.io==="input"&&H(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Lt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=n.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}let i=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let l=e.external.registry.get(s[0])?.id,p=e.external.uri??(m=>m);if(l)return{ref:p(l)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(s[1]===r)return{ref:"#"};let u=`#/${a}/`,d=s[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},o=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=i(s);a.def={...a.schema},u&&(a.defId=u);let d=a.schema;for(let l in d)delete d[l];d.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}}function jt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,d={...u},l=c.ref;if(c.ref=null,l){n(l);let f=e.seen.get(l),m=f.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,d),a._zod.parent===l)for(let v in u)v==="$ref"||v==="allOf"||v in d||delete u[v];if(m.$ref&&f.def)for(let v in u)v==="$ref"||v==="allOf"||v in f.def&&JSON.stringify(u[v])===JSON.stringify(f.def[v])&&delete u[v]}let p=a._zod.parent;if(p&&p!==l){n(p);let f=e.seen.get(p);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let m in u)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(u[m])===JSON.stringify(f.def[m])&&delete u[m]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,r.def??r.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&i.id===o&&delete i.id;let s=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,s[c.defId]=c.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:ao(t,"input",e.processors),output:ao(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function H(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return H(n.element,r);if(n.type==="set")return H(n.valueType,r);if(n.type==="lazy")return H(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return H(n.innerType,r);if(n.type==="intersection")return H(n.left,r)||H(n.right,r);if(n.type==="record"||n.type==="map")return H(n.keyType,r)||H(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:H(n.in,r)||H(n.out,r);if(n.type==="object"){for(let i in n.shape)if(H(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(H(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(H(i,r))return!0;return!!(n.rest&&H(n.rest,r))}return!1}var ao=(e,t,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},s=Dt({...i??{},target:o,io:t,processors:r});return C(e,s),Lt(s,e),jt(s,e)};var su={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},au=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=su[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){let d=[...c];d.length===1?i.pattern=d[0].source:d.length>1&&(i.allOf=[...d.map(l=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:l.source}))])}},cu=(e,t,r,n)=>{let i=r,{minimum:o,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";let l=typeof d=="number"&&d>=(o??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";l?f?(i.minimum=d,i.exclusiveMinimum=!0):i.exclusiveMinimum=d:typeof o=="number"&&(i.minimum=o),p?f?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u:typeof s=="number"&&(i.maximum=s),typeof c=="number"&&(i.multipleOf=c)},uu=(e,t,r,n)=>{r.type="boolean"},du=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},lu=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},pu=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},fu=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},hu=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},mu=(e,t,r,n)=>{r.not={}},gu=(e,t,r,n)=>{},_u=(e,t,r,n)=>{},yu=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},vu=(e,t,r,n)=>{let i=e._zod.def,o=Ct(i.entries);o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},bu=(e,t,r,n)=>{let i=e._zod.def,o=[];for(let s of i.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},wu=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},xu=(e,t,r,n)=>{let i=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},ku=(e,t,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:c}=e._zod.bag;s!==void 0&&(o.minLength=s),a!==void 0&&(o.maxLength=a),c?c.length===1?(o.contentMediaType=c[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(i,o)},zu=(e,t,r,n)=>{r.type="boolean"},Su=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},$u=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Iu=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Eu=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Pu=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Au=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=C(o.element,t,{...n,path:[...n.path,"items"]})},Tu=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object",i.properties={};let s=o.shape;for(let u in s)i.properties[u]=C(s[u],t,{...n,path:[...n.path,"properties",u]});let a=new Set(Object.keys(s)),c=new Set([...a].filter(u=>{let d=o.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(i.required=Array.from(c)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=C(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Mu=(e,t,r,n)=>{let i=e._zod.def,o=i.inclusive===!1,s=i.options.map((a,c)=>C(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=s:r.anyOf=s},Cu=(e,t,r,n)=>{let i=e._zod.def,o=C(i.left,t,{...n,path:[...n.path,"allOf",0]}),s=C(i.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=c},Ou=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((p,f)=>C(p,t,{...n,path:[...n.path,s,f]})),u=o.rest?C(o.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=c,u&&(i.items=u)):t.target==="openapi-3.0"?(i.items={anyOf:c},u&&i.items.anyOf.push(u),i.minItems=c.length,u||(i.maxItems=c.length)):(i.items=c,u&&(i.additionalItems=u));let{minimum:d,maximum:l}=e._zod.bag;typeof d=="number"&&(i.minItems=d),typeof l=="number"&&(i.maxItems=l)},Zu=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object";let s=o.keyType,c=s._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let d=C(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let l of c)i.patternProperties[l.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=C(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=C(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=s._zod.values;if(u){let d=[...u].filter(l=>typeof l=="string"||typeof l=="number");d.length>0&&(i.required=d)}},Ru=(e,t,r,n)=>{let i=e._zod.def,o=C(i.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},Nu=(e,t,r,n)=>{let i=e._zod.def;C(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Du=(e,t,r,n)=>{let i=e._zod.def;C(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},Lu=(e,t,r,n)=>{let i=e._zod.def;C(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},ju=(e,t,r,n)=>{let i=e._zod.def;C(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},Uu=(e,t,r,n)=>{let i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?i.out:i.in:i.out;C(s,t,n);let a=t.seen.get(e);a.ref=s},Fu=(e,t,r,n)=>{let i=e._zod.def;C(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.readOnly=!0},Ku=(e,t,r,n)=>{let i=e._zod.def;C(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Bu=(e,t,r,n)=>{let i=e._zod.def;C(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Hu=(e,t,r,n)=>{let i=e._zod.innerType;C(i,t,n);let o=t.seen.get(e);o.ref=i},co={string:au,number:cu,boolean:uu,bigint:du,symbol:lu,null:pu,undefined:fu,void:hu,never:mu,any:gu,unknown:_u,date:yu,enum:vu,literal:bu,nan:wu,template_literal:xu,file:ku,success:zu,custom:Su,function:$u,transform:Iu,map:Eu,set:Pu,array:Au,object:Tu,union:Mu,intersection:Cu,tuple:Ou,record:Zu,nullable:Ru,nonoptional:Nu,default:Du,prefault:Lu,catch:ju,pipe:Uu,readonly:Fu,promise:Ku,optional:Bu,lazy:Hu};function Hr(e,t){if("_idmap"in e){let n=e,i=Dt({...t,processors:co}),o={};for(let c of n._idmap.entries()){let[u,d]=c;C(d,i)}let s={},a={registry:n,uri:t?.uri,defs:o};i.external=a;for(let c of n._idmap.entries()){let[u,d]=c;Lt(i,d),s[u]=jt(i,d)}if(Object.keys(o).length>0){let c=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let r=Dt({...t,processors:co});return C(e,r),Lt(r,e),jt(r,e)}var ne=E("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");J.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>Ot(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>W(e,r,n),e.parseAsync=async(r,n)=>Zt(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>ut(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>Dr(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Wu=E("ZodMiniString",(e,t)=>{ji.init(e,t),ne.init(e,t)});function b(e){return eo(Wu,e)}var lo=E("ZodMiniNumber",(e,t)=>{Ur.init(e,t),ne.init(e,t)});function te(e){return to(lo,e)}var Ju=E("ZodMiniNumberFormat",(e,t)=>{Ui.init(e,t),lo.init(e,t)});function Ce(e){return ro(Ju,e)}var Gu=E("ZodMiniBoolean",(e,t)=>{Fi.init(e,t),ne.init(e,t)});function lt(e){return no(Gu,e)}var Xu=E("ZodMiniUnknown",(e,t)=>{Ki.init(e,t),ne.init(e,t)});function $e(){return io(Xu)}var Yu=E("ZodMiniVoid",(e,t)=>{Bi.init(e,t),ne.init(e,t)});function qr(e){return oo(Yu,e)}var Qu=E("ZodMiniArray",(e,t)=>{Hi.init(e,t),ne.init(e,t)});function G(e,t){return new Qu({type:"array",element:e,...B(t)})}var ed=E("ZodMiniObject",(e,t)=>{qi.init(e,t),ne.init(e,t),ue(e,"shape",()=>t.shape)});function k(e,t){let r={type:"object",shape:e??{},...B(t)};return new ed(r)}var td=E("ZodMiniUnion",(e,t)=>{Vi.init(e,t),ne.init(e,t)});function Ke(e,t){return new td({type:"union",options:e,...B(t)})}var uo=E("ZodMiniRecord",(e,t)=>{Wi.init(e,t),ne.init(e,t)});function po(e,t,r){return!t||!t._zod?new uo({type:"record",keyType:b(),valueType:e,...B(t)}):new uo({type:"record",keyType:e,valueType:t,...B(r)})}var rd=E("ZodMiniEnum",(e,t)=>{Ji.init(e,t),ne.init(e,t),e.options=Object.values(t.entries)});function ge(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new rd({type:"enum",entries:r,...B(t)})}var nd=E("ZodMiniLiteral",(e,t)=>{Gi.init(e,t),ne.init(e,t)});function Vr(e,t){return new nd({type:"literal",values:Array.isArray(e)?e:[e],...B(t)})}var id=E("ZodMiniOptional",(e,t)=>{Xi.init(e,t),ne.init(e,t)});function S(e){return new id({type:"optional",innerType:e})}var sd=new Set(["type","format","properties","required","additionalProperties","items","prefixItems","const","enum","anyOf","oneOf","discriminator","$ref","title","description"]);function ye(e){if(e===!0||e===!1)return e;if(e===null||typeof e!="object")throw new Error(`normalizeJsonSchema: expected object, got ${typeof e}`);if(Array.isArray(e))throw new Error("normalizeJsonSchema: expected object, got array");let t=e;if("not"in t&&cd(t.not))return!1;let r={};for(let[n,i]of Object.entries(t)){if(!sd.has(n))continue;let o=ad(n,i);o!==void 0&&(r[n]=o)}if(r.type==="object"&&!("additionalProperties"in r)&&(r.additionalProperties=!1),Array.isArray(r.oneOf)&&!("discriminator"in r)){let n=ud(r.oneOf);n!==void 0&&(r.discriminator=n)}return"discriminator"in r&&!Array.isArray(r.oneOf)&&delete r.discriminator,Object.keys(r).length===0?!0:r}function ad(e,t){switch(e){case"properties":{if(!en(t))return{};let r={};for(let[n,i]of Object.entries(t))r[n]=ye(i);return r}case"items":case"additionalProperties":return t===!1?!1:ye(t);case"prefixItems":case"anyOf":case"oneOf":return Array.isArray(t)?t.map(r=>ye(r)):[];case"discriminator":{if(!en(t))return;let r=t.propertyName;return typeof r!="string"||r.length===0?void 0:{propertyName:r}}case"enum":return Array.isArray(t)?t.slice():[];case"required":return Array.isArray(t)?t.slice().sort():[];default:return t}}function cd(e){return en(e)&&Object.keys(e).length===0}function en(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ud(e){if(e.length<2)return;let t=[];for(let n of e){if(n===!0||n===!1||n.type!=="object")return;let i=n.properties;if(!i)return;t.push(i)}let r=fo(t[0]);for(let n=1;n<t.length;n++)if(r=r.filter(i=>fo(t[n]).includes(i)),r.length===0)return;for(let n of r){let i=new Set,o=!0;for(let s of t){let a=s[n],c=JSON.stringify(a.const);if(i.has(c)){o=!1;break}i.add(c)}if(o)return{propertyName:n}}}function fo(e){let t=[];for(let[r,n]of Object.entries(e))n===!0||n===!1||"const"in n&&t.push(r);return t}var fn=class yo{paramsSchema;resultSchema;errorSchema;docs;clientStreamSchema;serverStreamSchema;kind="request";constructor(t,r,n,i={},o,s){this.paramsSchema=t,this.resultSchema=r,this.errorSchema=n,this.docs=i,this.clientStreamSchema=o,this.serverStreamSchema=s}withStream(t){return new yo(this.paramsSchema,this.resultSchema,this.errorSchema,this.docs,t.client,t.server)}},hn=class{paramsSchema;docs;kind="notification";constructor(e,t={}){this.paramsSchema=e,this.docs=t}};function M(e,t,r,n){let i=a=>typeof a=="object"&&a!==null&&"_zod"in a,o=i(r)?r:void 0,s=(i(r)?n:r)??{};return new fn(e,t??qr(),o??qr(),s)}function ie(e,t={}){return new hn(e,t)}function vo(e,t){let r=e._zod?.def?.type;return r==="void"||r==="undefined"?!0:dd(Hr(e),t)}function dd(e,t){if(!Kt(e))return ye(e);let r=Kt(e.$defs)?e.$defs:{},n=tn(e);if(Object.keys(r).length===0&&n.size===0)return ye(e);if(t===void 0)throw new Error("zodToSvcJsonSchema: local references require a component destination");let i=`method=${Wr(t.methodName)}&schema=${Wr(t.schemaPosition)}`,o=new Map;for(let u of Object.keys(r))o.set(u,`${i}&def=${Wr(u)}`);let s=n.has("#")?`${i}&root`:void 0,a=u=>rn(u,o,s);for(let[u,d]of Object.entries(r)){let l=o.get(u);if(l===void 0)throw new Error(`zodToSvcJsonSchema: missing component for "${u}"`);ho(t.components,l,ye(a(d)))}let c=a(e);return s!==void 0?(ho(t.components,s,ye(c)),{$ref:nn(s)}):ye(c)}function tn(e,t=new Set){if(Array.isArray(e)){for(let r of e)tn(r,t);return t}if(!Kt(e))return t;typeof e.$ref=="string"&&e.$ref.startsWith("#")&&t.add(e.$ref);for(let r of Object.values(e))tn(r,t);return t}function rn(e,t,r){if(Array.isArray(e))return e.map(i=>rn(i,t,r));if(!Kt(e))return e;let n={};for(let[i,o]of Object.entries(e))i!=="$defs"&&(i==="$ref"&&typeof o=="string"?n[i]=ld(o,t,r):n[i]=rn(o,t,r));return n}function ld(e,t,r){if(e==="#"){if(r===void 0)throw new Error("zodToSvcJsonSchema: root reference has no component destination");return nn(r)}if(e.startsWith("#/$defs/")){let n=e.slice(8),i=[...t.keys()].find(s=>bo(s)===n),o=i===void 0?void 0:t.get(i);if(o===void 0)throw new Error(`zodToSvcJsonSchema: dangling local reference "${e}"`);return nn(o)}if(e.startsWith("#")&&!e.startsWith("#/components/schemas/"))throw new Error(`zodToSvcJsonSchema: unsupported local reference "${e}"`);return e}function ho(e,t,r){if(Object.hasOwn(e,t))throw new Error(`zodToSvcJsonSchema: duplicate component name "${t}"`);e[t]=r}function nn(e){return`#/components/schemas/${bo(e)}`}function bo(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Wr(e){return encodeURIComponent(e).replace(/~/g,"%7E")}function Kt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function wo(e){let t=Ft(e);if(t===void 0)throw new Error("jcsCanonicalize: value is not JSON-representable");return t}var D0=new TextEncoder;function Ft(e,t=new Set){if(typeof e=="number"&&Number.isNaN(e))throw new Error("NaN is not allowed");if(typeof e=="number"&&!Number.isFinite(e))throw new Error("Infinity is not allowed");if(e===null||typeof e!="object")return JSON.stringify(e);let r=e;if(typeof r.toJSON=="function"){if(t.has(r))throw new Error("Circular reference detected");t.add(r);let i=Ft(r.toJSON(),t);return t.delete(r),i}if(t.has(r))throw new Error("Circular reference detected");t.add(r);let n;if(Array.isArray(r))n=`[${r.map(i=>Ft(i===void 0||typeof i=="symbol"?null:i,t)).join(",")}]`;else{let i=[];for(let o of Object.keys(r).sort()){let s=r[o];s===void 0||typeof s=="symbol"||i.push(`${JSON.stringify(o)}:${Ft(s,t)}`)}n=`{${i.join(",")}}`}return t.delete(r),n}var pd=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function de(e,t){return e>>>t|e<<32-t}function fd(e){let t=e.length,r=t*8,n=t+9+63&-64,i=new Uint8Array(n);i.set(e),i[t]=128;let o=new DataView(i.buffer);o.setUint32(n-8,Math.floor(r/4294967296),!1),o.setUint32(n-4,r>>>0,!1);let s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);for(let d=0;d<n;d+=64){for(let y=0;y<16;y++)a[y]=o.getUint32(d+y*4,!1);for(let y=16;y<64;y++){let w=a[y-15],T=a[y-2],L=de(w,7)^de(w,18)^w>>>3,I=de(T,17)^de(T,19)^T>>>10;a[y]=a[y-16]+L+a[y-7]+I>>>0}let l=s[0],p=s[1],f=s[2],m=s[3],_=s[4],v=s[5],z=s[6],$=s[7];for(let y=0;y<64;y++){let w=de(_,6)^de(_,11)^de(_,25),T=_&v^~_&z,L=$+w+T+pd[y]+a[y]>>>0,I=(de(l,2)^de(l,13)^de(l,22))+(l&p^l&f^p&f)>>>0;$=z,z=v,v=_,_=m+L>>>0,m=f,f=p,p=l,l=L+I>>>0}s[0]=s[0]+l>>>0,s[1]=s[1]+p>>>0,s[2]=s[2]+f>>>0,s[3]=s[3]+m>>>0,s[4]=s[4]+_>>>0,s[5]=s[5]+v>>>0,s[6]=s[6]+z>>>0,s[7]=s[7]+$>>>0}let c=new Uint8Array(32),u=new DataView(c.buffer);for(let d=0;d<8;d++)u.setUint32(d*4,s[d],!1);return c}function xo(e){let t=wo(on(e,!0)),r=fd(new TextEncoder().encode(t));return Array.from(r.subarray(0,8),n=>n.toString(16).padStart(2,"0")).join("")}function on(e,t=!1){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>on(n));let r={};for(let n of Object.keys(e)){if(n==="comment"||t&&n==="hash")continue;let i=e[n];i!==void 0&&(r[n]=on(i))}return r}var Jr=new WeakMap,ko=class{info;members;constructor(e,t,r={}){if(this.info=e,this.members=t,Jr.set(this,{frozenSchema:r.frozenSchema,schemaCache:void 0,hashCache:void 0}),e.hash!==void 0&&this.schemaHash!==e.hash)throw new Error(`Interface hash mismatch for "${e.id}": expected "${e.hash}", got "${this.schemaHash}". The interface's wire contract changed \u2014 update the pinned hash to "${this.schemaHash}" after reviewing the change.`)}get schemaHash(){let e=Jr.get(this);return e.hashCache===void 0&&(e.hashCache=xo(e.frozenSchema??mo(this.info,this.members,""))),e.hashCache}toSchema(){let e=Jr.get(this);return e.schemaCache===void 0&&(e.schemaCache=e.frozenSchema!==void 0?{...e.frozenSchema,hash:this.schemaHash}:mo(this.info,this.members,this.schemaHash)),e.schemaCache}};function mo(e,t,r){let n={},i={};for(let[s,a]of Object.entries(t))n[s]=hd(s,a,i);let o={id:e.id,hash:r,methods:n};return Object.keys(i).length>0&&(o.components={schemas:i}),e.description!==void 0&&(o.description=e.description),e.comment!==void 0&&(o.comment=e.comment),o}function hd(e,t,r){let n=t.docs;if(t.kind==="request"){let o={params:pt(e,"params",t.paramsSchema,r),result:pt(e,"result",t.resultSchema,r)};return t.clientStreamSchema!==void 0&&(o.clientStream=pt(e,"clientStream",t.clientStreamSchema,r)),t.serverStreamSchema!==void 0&&(o.serverStream=pt(e,"serverStream",t.serverStreamSchema,r)),n.description!==void 0&&(o.description=n.description),n.comment!==void 0&&(o.comment=n.comment),n.annotations!==void 0&&(o.annotations=n.annotations),o}let i={params:pt(e,"params",t.paramsSchema,r)};return n.description!==void 0&&(i.description=n.description),n.comment!==void 0&&(i.comment=n.comment),n.annotations!==void 0&&(i.annotations=n.annotations),i}function pt(e,t,r,n){return vo(r,{methodName:e,schemaPosition:t,components:n})}function F(e,t){return new ko(e,t)}var sn=F({id:"hubrpc.defaults",description:"Reflection: preset default service / interface on this connection."},{get:M(k({}),k({serviceId:S(b()),interfaceId:S(b()),interfaceHash:S(b())}))}),md=G(k({principal:b(),transitive:S(lt())})),Bt=Ke([k({exact:b()}),k({prefix:b()})]),gd=k({serviceId:b(),interfaceId:b(),interfaceHash:b(),serviceDescription:S(b()),rootPrincipalSets:S(G(md)),reachableServiceIds:S(G(Bt))}),an=F({id:"hubrpc.directory",description:"Reflection: list services exposed by this endpoint. Can also list other directory services that can be explored."},{list:M(k({interfaceId:S(b()),interfaceIdPrefix:S(b()),serviceId:S(b()),serviceIdScopes:S(G(Bt)),cursor:S(b()),limit:S(te().check(Ce(),Br())),timeoutMs:S(te().check(Ce(),Me()))}),k({items:G(gd),nextCursor:S(b()),truncated:S(lt())})),watch:M(k({interfaceId:S(b()),interfaceIdPrefix:S(b()),serviceId:S(b()),serviceIdScopes:S(G(Bt))}),k({})).withStream({server:k({})})});var cn=F({id:"hubrpc.schemas",description:"Reflection: fetch interface schemas by id (+ optional hash). Must serve the interfaces advertised in this endpoint's directory."},{get:M(k({interfaceId:b(),hash:S(b())}),k({schema:$e()}))}),zo=k({portId:b(),label:S(b())}),So=k({type:S(b()),label:S(b()),processId:S(te()),processType:S(b()),nodeStatusServiceId:S(b()),metadata:S(po(b(),Ke([b(),te(),lt()])))}),mn=k({source:ge(["self","attacher"]),descriptor:So}),$o=k({nodeId:b(),kind:S(ge(["endpoint","hub"])),label:S(b()),descriptors:S(G(mn)),ports:G(zo)}),un=k({nodeId:b(),portId:b()}),Io=k({from:un,to:un,label:S(b()),peerState:S(ge(["identified","pending","unsupported","error"]))}),Eo=k({serviceId:b(),nodeId:b(),portId:b(),match:ge(["exact","prefix"])}),Po=k({observerServiceId:b(),entryNodeId:b(),nodes:G($o),links:G(Io),routes:G(Eo)}),gn=F({id:"hubrpc.topology",description:"Inspect the transport graph visible from a service. A watch emits invalidation ticks; consumers re-fetch getGraph after each tick."},{getGraph:M(k({}),Po),watchGraph:M(k({}),k({})).withStream({server:k({})})}),dn=k({edgeId:b(),portId:b(),requestId:S(Ke([te(),b()]))}),Ao=k({type:Vr("transit"),ts:te(),nodeId:b(),in:S(dn),out:S(dn),disposition:ge(["forwarded","consumed","dropped","unroutable"]),kind:ge(["request","notification","response","stream"]),method:S(b()),params:S($e()),result:S($e()),error:S(k({code:te(),message:b(),data:S($e())}))}),To=k({type:Vr("overflow"),dropped:te().check(Ce(),Me())}),ln=Ke([Ao,To]),pn=k({delivered:te().check(Ce(),Me()),dropped:te().check(Ce(),Me())}),_d=k({methodPrefix:S(b())}),yd=k({methodPrefix:S(b()),maxPayloadBytes:te().check(Ce(),Me())}),_n=F({id:"hubrpc.traffic",description:"Stream raw message transits for the entire node hosting the addressed service. Payload-free and explicitly payload-bearing variants keep disclosure opt-in."},{watch:M(_d,pn).withStream({server:ln}),watchWithPayloads:M(yd,pn).withStream({server:ln})}),vd=k({nodeId:b(),portId:b(),descriptors:S(G(mn))}),Ht=F({id:"hubrpc.node",description:"Topology bootstrap: identify the node and port at this end of the direct connection."},{getNodeId:M(k({}),vd)}),Ze={toCaller:"toCaller",toCallee:"toCallee"},_e={cancel:"cancel",ping:"ping",pong:"pong"};var Mo=F({id:"$stream",description:"Reserved sub-protocol for in-flight stream messages correlated to a request by `requestId`."},{send:ie(k({requestId:Ke([te(),b()]),dir:ge(["toCaller","toCallee"]),control:S(k({type:ge(["cancel","ping","pong"]),reason:S(b()),nonce:S(b())})),payload:S($e())}),{description:"Emit a stream message tied to the request `requestId`."})}),Re=`${Mo.info.id}::send`,X={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,permissionRequired:-32401,peerDisconnected:-32402,requestTimeout:-32403,cancelled:-32800};function Be(e){return typeof e.method=="string"&&e.id!==void 0}function yn(e){return typeof e.method=="string"&&e.id===void 0}function ft(e){return typeof e.method!="string"}var le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",L0=(()=>{let e={};for(let t=0;t<64;t++)e[le[t]]=t;return e})();function Co(e){let t="",r=0;for(;r+3<=e.length;r+=3){let i=e[r]<<16|e[r+1]<<8|e[r+2];t+=le[i>>18&63]+le[i>>12&63]+le[i>>6&63]+le[i&63]}let n=e.length-r;if(n===1){let i=e[r]<<16;t+=le[i>>18&63]+le[i>>12&63]}else if(n===2){let i=e[r]<<16|e[r+1]<<8;t+=le[i>>18&63]+le[i>>12&63]+le[i>>6&63]}return t}function Oo(e){let t=e.split("::");if(t.length===3&&t[0].length===0&&t[1].length>0&&t[2].length>0)return{kind:"interface",interfaceId:t[1],member:t[2]};if(!t.some(r=>r.length===0)){if(t.length===1)return{kind:"bare",member:t[0]};if(t.length===2)return{kind:"interface",interfaceId:t[0],member:t[1]};if(t.length===3)return{kind:"full",serviceId:t[0],interfaceId:t[1],member:t[2]}}}var Zo=Symbol.for("@vscode/hubrpc.localMessageContext");function Ro(e,t){return Object.defineProperties(e,{context:{configurable:!0,enumerable:!1,value:t},[Zo]:{configurable:!0,enumerable:!1,value:!0}}),e}function No(e){let t=e;return e[Zo]===!0?t.context:void 0}var Do=class Lo{sender;_setHandler;_setWireObserver;constructor(t,r,n){this.sender=t,this._setHandler=r,this._setWireObserver=n}setRequestHandler(t){this._setHandler(t)}setWireMessageObserver(t,r){this._setWireObserver?.(t,r)}withSender(t){return new Lo(t(this.sender),this._setHandler,this._setWireObserver)}},jo=Symbol("hubrpc.inspectionCall");function Gr(e){return Object.defineProperty(e,jo,{value:!0}),e}function Xr(e){return e?.[jo]===!0}var ve=class extends Error{code;data;constructor(e,t,r){super(e),this.code=t,this.data=r,this.name="RpcError"}};function bd(e,t){return"exact"in t?e===t.exact:t.prefix===""||e===t.prefix||e.startsWith(`${t.prefix}/`)}function Uo(e,t){return t===void 0||t.some(r=>bd(e,r))}var wd=10*6e4,qt=class Fo{_transport;static create(t){return this.createWithClose(t).channel}static createWithClose(t){let r=new Fo(t);return{channel:new Do(r,n=>r.setRequestHandler(n),(n,i)=>r.setWireMessageObserver(n,i)),close:()=>r.close()}}_nextId=1;_pending=new Map;_streamListeners=new Map;_streamControl=new Map;_incomingAborts=new Map;_handler;_wireObserver;_isInspectionMethod;_outboundInspectionRequests=new Set;_inboundInspectionRequests=new Set;_closeError;setRequestHandler(t){this._handler=t}setWireMessageObserver(t,r){this._wireObserver=t,this._isInspectionMethod=t===void 0?void 0:r,t===void 0&&(this._outboundInspectionRequests.clear(),this._inboundInspectionRequests.clear())}constructor(t){this._transport=t,this._transport.setListener(r=>this._onMessage(r))}async sendRequest(t,r,n){this._throwIfClosed();let i=this._nextId++,o={jsonrpc:"2.0",id:i,method:t};r!==void 0&&(o.params=r);let s=new Promise((a,c)=>{this._pending.set(String(i),{resolve:a,reject:c})});this._observeOutbound(o,n);try{await this._transport.send(o)}catch(a){throw this._pending.delete(String(i)),this._observeSendFailure(i,a),a}return s}async sendNotification(t,r,n){this._throwIfClosed();let i={jsonrpc:"2.0",method:t};r!==void 0&&(i.params=r),this._observeOutbound(i,n),await this._transport.send(i)}sendRequestWithStream(t,r,n){this._throwIfClosed();let i=this._nextId++,o=String(i),s,a,c=new Promise((p,f)=>{s=p,a=f});this._pending.set(o,{resolve:s,reject:a}),n?.onStreamMessage&&this._streamListeners.set(o,n.onStreamMessage);let u=this._makePinger(i,Ze.toCallee);this._streamControl.set(o,u.onControl);let d=setInterval(()=>{this._sendStream(i,Ze.toCallee,{control:{type:_e.ping}})},wd);d.unref?.();let l=()=>{clearInterval(d),u.dispose(),this._streamControl.delete(o)};return c.then(l,l),(async()=>{let p={jsonrpc:"2.0",id:i,method:t};r!==void 0&&(p.params=r),this._observeOutbound(p,n),await this._transport.send(p)})().catch(p=>{this._pending.delete(o),this._streamListeners.delete(o),this._observeSendFailure(i,p),l(),a(p instanceof Error?p:new Error(String(p)))}),{result:c,send:p=>this._sendStream(i,Ze.toCallee,{payload:p}),cancel:p=>this._sendStream(i,Ze.toCallee,{control:p!==void 0?{type:_e.cancel,reason:p}:{type:_e.cancel}}),ping:u.ping}}_makePinger(t,r){let n=new Map,i=1;return{ping:()=>{let c=`${t}:${i++}`,u=new Promise((d,l)=>n.set(c,{resolve:d,reject:l}));return this._sendStream(t,r,{control:{type:_e.ping,nonce:c}}),u},onControl:c=>{if(c.type===_e.ping)this._sendStream(t,r,{control:{type:_e.pong,nonce:c.nonce}});else if(c.type===_e.pong&&c.nonce!==void 0){let u=n.get(c.nonce);u&&(n.delete(c.nonce),u.resolve())}},dispose:()=>{let c=new ve("Request settled before pong",X.cancelled);for(let u of n.values())u.reject(c);n.clear()}}}async _sendStream(t,r,n){this._throwIfClosed();let i={jsonrpc:"2.0",method:Re,params:{requestId:t,dir:r,...n}};this._observeOutbound(i),await this._transport.send(i)}close(){if(this._closeError)return;let t=new ve("Connection closed",X.peerDisconnected);this._closeError=t;for(let r of this._incomingAborts.values())r.abort(t);this._incomingAborts.clear(),this._transport.dispose();for(let r of this._pending.values())r.reject(t);this._pending.clear(),this._streamListeners.clear(),this._streamControl.clear()}_throwIfClosed(){if(this._closeError)throw this._closeError}_onMessage(t){let r=t.context;if(this._observeInbound(t),ft(t)){if(t.id===null)return;let n=String(t.id),i=this._pending.get(n);if(!i)return;if(this._pending.delete(n),this._streamListeners.delete(n),"error"in t){let o=t.error,s=new ve(o.message,o.code,o.data);i.reject(s)}else i.resolve(t.result);return}if(Be(t)){this._handleRequest(t,r).catch(()=>{});return}if(yn(t)){if(t.method===Re){this._handleStreamNotification(t);return}this._handleNotification(t,r);return}}_handleStreamNotification(t){let r=t.params;if(!r)return;let n=r.requestId;if(n===void 0)return;let i=String(n);if(r.control){this._streamControl.get(i)?.(r.control);return}let o=this._streamListeners.get(i);o&&o(r.payload)}async _handleRequest(t,r){let n=String(t.id),i=this._makePinger(t.id,Ze.toCaller),o={send:c=>this._sendStream(t.id,Ze.toCaller,{payload:c}),onMessage:c=>{c?this._streamListeners.set(n,c):this._streamListeners.delete(n)},ping:i.ping,markInspectionLifecycle:()=>{this._wireObserver!==void 0&&this._inboundInspectionRequests.add(n)}},s=new AbortController;this._incomingAborts.set(n,s),this._streamControl.set(n,c=>{c.type===_e.cancel?s.abort(new ve(c.reason??"cancelled",X.cancelled)):i.onControl(c)});let a;try{if(!this._handler)a={error:{code:X.methodNotFound,message:`No handler registered on this endpoint (method: ${t.method}).`}};else try{a=await this._handler.handleRequest({method:t.method,params:t.params,context:r,stream:o,signal:s.signal})}catch(c){a={error:{code:X.internalError,message:c instanceof Error?c.message:String(c)}}}}finally{this._streamListeners.delete(n),this._streamControl.delete(n),this._incomingAborts.delete(n),i.dispose()}if("result"in a){let c={jsonrpc:"2.0",id:t.id,result:a.result};this._observeOutbound(c),await this._transport.send(c)}else{let c={jsonrpc:"2.0",id:t.id,error:a.error};this._observeOutbound(c),await this._transport.send(c)}}_handleNotification(t,r){if(this._handler)try{this._handler.handleNotification({method:t.method,params:t.params,context:r,stream:xd,signal:kd})}catch{}}_observeInbound(t){let r=this._wireObserver;if(r===void 0)return;let n=!1;if(Be(t))n=this._isInspectionMethod?.(t.method)===!0,n&&this._inboundInspectionRequests.add(String(t.id));else if(ft(t)){if(t.id!==null){let i=String(t.id);n=this._outboundInspectionRequests.delete(i)}}else t.method===Re?n=this._isInspectionStream(t):n=this._isInspectionMethod?.(t.method)===!0;n||r("inbound",t)}_observeOutbound(t,r){Be(t)&&Xr(r)&&Ro(t,{...No(t),inspection:!0});let n=this._wireObserver;if(n===void 0)return;let i=!1;if(Be(t))i=Xr(r),i&&this._outboundInspectionRequests.add(String(t.id));else if(ft(t)){if(t.id!==null){let o=String(t.id);i=this._inboundInspectionRequests.delete(o)}}else t.method===Re?i=this._isInspectionStream(t):i=Xr(r);i||n("outbound",t)}_observeSendFailure(t,r){if(this._wireObserver===void 0){this._outboundInspectionRequests.delete(String(t));return}this._observeInbound({jsonrpc:"2.0",id:t,error:{code:X.peerDisconnected,message:r instanceof Error?r.message:String(r)}})}_isInspectionStream(t){let r=t.params;if(r?.requestId===void 0)return!1;let n=String(r.requestId);return this._outboundInspectionRequests.has(n)||this._inboundInspectionRequests.has(n)}},xd={send:()=>Promise.resolve(),onMessage:()=>{},ping:()=>Promise.resolve(),markInspectionLifecycle:()=>{}},kd=new AbortController().signal,zd=256,Sd=class{_options;_send;_onDispose;_queueLimit;_queue=[];_active=!0;_pumping=!1;_overflowPending=0;_delivered=0;_dropped=0;_resolveClosed;closed;constructor(e,t,r,n=zd){this._options=e,this._send=t,this._onDispose=r,this._queueLimit=n;let i;this.closed=new Promise(o=>i=o),this._resolveClosed=i}enqueue(e){if(!this._active||this._options.methodPrefix!==void 0&&!e.method?.startsWith(this._options.methodPrefix))return;let t=this._options.maxPayloadBytes===void 0?$d(e):Id(e,this._options.maxPayloadBytes);this._queue.length>=this._queueLimit&&(this._queue.shift(),this._dropped++,this._overflowPending++),this._queue.push(t),this._pumping||(this._pumping=!0,queueMicrotask(()=>{this._pump()}))}dispose(){this._active&&(this._active=!1,this._dropped+=this._queue.length,this._queue.length=0,this._overflowPending=0,this._onDispose(),this._pumping||this._complete())}async _pump(){try{for(;this._active;){if(this._overflowPending>0){let t=this._overflowPending;this._overflowPending=0,await this._send({type:"overflow",dropped:t});continue}let e=this._queue.shift();if(e===void 0)break;await this._send(e),this._delivered++}}catch{this.dispose()}finally{this._pumping=!1,this._active?(this._queue.length>0||this._overflowPending>0)&&(this._pumping=!0,queueMicrotask(()=>{this._pump()})):this._complete()}}_complete(){this._resolveClosed({delivered:this._delivered,dropped:this._dropped})}};function $d(e){let{params:t,result:r,error:n,...i}=e;return n===void 0?i:{...i,error:{code:n.code,message:n.message}}}function Id(e,t){return{...e,params:Yr(e.params,t),result:Yr(e.result,t),error:e.error===void 0?void 0:{...e.error,data:Yr(e.error.data,t)}}}function Yr(e,t){if(e===void 0)return;if(t===Number.POSITIVE_INFINITY)return e;let r=JSON.stringify(e);if(r===void 0)return;let n=new TextEncoder().encode(r);if(n.byteLength<=t)return e;let i=new TextEncoder,o=new TextDecoder().decode(n.slice(0,t));for(;i.encode(o).byteLength>t;)o=o.slice(0,-1);return o}var Ed=class{_nodeId;_portId;_setActive;_subscribers=new Set;_observers=new Set;_outboundRequests=new Map;_inboundRequests=new Map;observe=(e,t)=>{this._onMessage(e,t)};constructor(e,t,r){this._nodeId=e,this._portId=t,this._setActive=r}get observerCount(){return this._subscribers.size+this._observers.size}subscribe(e,t){let r=new Sd(e,t,()=>{this._subscribers.delete(r),this._deactivateIfUnused()});return this._activateIfUnused(),this._subscribers.add(r),r}observeTransits(e){this._activateIfUnused(),this._observers.add(e);let t=!1;return{dispose:()=>{t||(t=!0,this._observers.delete(e),this._deactivateIfUnused())}}}dispose(){for(let e of[...this._subscribers])e.dispose();this._subscribers.clear(),this._observers.clear(),this._outboundRequests.clear(),this._inboundRequests.clear(),this._setActive(!1)}_onMessage(e,t){if(this._subscribers.size===0&&this._observers.size===0)return;let r=Date.now(),n,i=this._endpoint("id"in t?t.id??void 0:void 0),o={type:"transit",ts:r,nodeId:this._nodeId,...e==="inbound"?{in:i}:{out:i},disposition:e==="inbound"?"consumed":"forwarded"};if(Be(t)){let s={method:t.method};this._requestMap(e).set(String(t.id),s),n={...o,kind:"request",method:t.method,params:t.params}}else if(ft(t)){let s=e==="inbound"?this._outboundRequests:this._inboundRequests,a=String(t.id),c=s.get(a);s.delete(a),n={...o,kind:"response",method:c?.method,result:"result"in t?t.result:void 0,error:"error"in t?t.error:void 0}}else if(yn(t)&&t.method===Re){let s=t.params,a=this._endpoint(s?.requestId);n={...o,...e==="inbound"?{in:a}:{out:a},kind:"stream",method:Re,params:t.params}}else n={...o,kind:"notification",method:t.method,params:t.params};for(let s of[...this._observers])try{s(n)}catch{}for(let s of this._subscribers)s.enqueue(n)}_requestMap(e){return e==="outbound"?this._outboundRequests:this._inboundRequests}_endpoint(e){return{edgeId:this._portId,portId:this._portId,...e!==void 0?{requestId:e}:{}}}_activateIfUnused(){this._subscribers.size===0&&this._observers.size===0&&this._setActive(!0)}_deactivateIfUnused(){this._subscribers.size!==0||this._observers.size!==0||(this._outboundRequests.clear(),this._inboundRequests.clear(),this._setActive(!1))}},vn=class Ko{static fromTransport(t){return new Ko(qt.create(t))}channel;_registry=new Map;_serviceDescriptions=new Map;_serviceRootPrincipalSets=new Map;_directoryWatchers=new Set;_directoryListeners=new Set;_inspection;_trafficInspector;_serviceInspectionRegistrations=new Map;_wireChannel;_preset;constructor(t){"sender"in t?(this._wireChannel=t,this.channel=t.sender,t.setRequestHandler({handleRequest:r=>this._handleRequest(r),handleNotification:r=>this._handleNotification(r)})):(this._wireChannel=void 0,this.channel=t)}get(t,r={}){return this._buildClient(t,r)}service(t){return new Bo(this,t)}register(t,r,n={}){return this._register(t,r,n,!1)}_register(t,r,n,i){let o=n.serviceId,s=`${o??""}::${t.info.id}`;if(this._registry.has(s))throw new Error(`Interface "${t.info.id}" already registered${o?` under service "${o}"`:""}.`);let a=!1;if(n.serviceDescription!==void 0){if(o===void 0)throw new Error("register: `serviceDescription` requires `serviceId`.");let d=this._serviceDescriptions.get(o);if(d!==void 0&&d!==n.serviceDescription)throw new Error(`register: conflicting descriptions for service "${o}".`);this._serviceDescriptions.set(o,n.serviceDescription),a=d===void 0}if(n.rootPrincipalSets!==void 0){if(o===void 0)throw new Error("register: `rootPrincipalSets` requires `serviceId`.");let d=this._serviceRootPrincipalSets.get(o);if(d!==void 0&&!Pd(d,n.rootPrincipalSets))throw new Error(`register: conflicting rootPrincipalSets for service "${o}".`);this._serviceRootPrincipalSets.set(o,n.rootPrincipalSets),a||=d===void 0}let c={iface:t,handlers:r,serviceId:o,internalInspection:i};if(this._registry.set(s,c),this._notifyDirectoryWatchers(c,a),!i&&o!==void 0&&this._inspection!==void 0&&!this._serviceInspectionRegistrations.has(o))try{this._installServiceInspection(o)}catch(d){throw this._registry.delete(s),this._notifyDirectoryWatchers(c),d}let u=!1;return{dispose:()=>{u||(u=!0,this._registry.get(s)===c&&(this._registry.delete(s),this._notifyDirectoryWatchers(c),o===void 0&&this._preset?.interfaceId===t.info.id&&(this._preset=void 0),o!==void 0&&!this._hasBusinessServiceRegistration(o)&&(this._removeServiceInspection(o),this._serviceDescriptions.delete(o),this._serviceRootPrincipalSets.delete(o))))}}}setPreset(t){let r=`::${t.info.id}`;if(!this._registry.has(r))throw new Error(`setPreset: interface "${t.info.id}" is not registered under the root service.`);this._preset={serviceId:void 0,interfaceId:t.info.id,hash:t.schemaHash}}listRegisteredInterfaces(){return Array.from(this._registry.values()).map(t=>{let r=t.serviceId??"",n={serviceId:r,interfaceId:t.iface.info.id,interfaceHash:t.iface.schemaHash},i=r===""?void 0:this._serviceDescriptions.get(r);i!==void 0&&(n.serviceDescription=i);let o=r===""?void 0:this._serviceRootPrincipalSets.get(r);return o!==void 0&&(n.rootPrincipalSets=o),n})}onDidChangeDirectory(t){return this._directoryListeners.add(t),()=>this._directoryListeners.delete(t)}findRegisteredInterface(t,r){for(let n of this._registry.values())if(n.iface.info.id===t&&!(r!==void 0&&n.iface.schemaHash!==r))return n.iface}enableReflection(t={}){let r=`${t.serviceId??""}::${sn.info.id}`;if(this._registry.has(r))return{dispose(){}};let n=`${t.serviceId??""}::`;for(let a of[an,cn])if(this._registry.has(`${n}${a.info.id}`))throw new Error(`enableReflection: partial reflection registration for service "${t.serviceId??""}".`);let i=t.serviceId!==void 0?{serviceId:t.serviceId}:{},o=[];if(o.push(this.register(sn,{get:()=>this._preset?{serviceId:this._preset.serviceId,interfaceId:this._preset.interfaceId,interfaceHash:this._preset.hash}:{}},i)),o.push(this.register(an,{list:({interfaceId:a,interfaceIdPrefix:c,serviceId:u,serviceIdScopes:d,cursor:l,limit:p})=>{let f=this.listRegisteredInterfaces().filter(z=>t.serviceId===void 0||z.serviceId===t.serviceId).filter(z=>a===void 0||z.interfaceId===a).filter(z=>c===void 0||z.interfaceId.startsWith(c)).filter(z=>u===void 0||z.serviceId===u).filter(z=>Uo(z.serviceId,d)),m=l===void 0?0:Number.parseInt(l,10)||0,_=p===void 0?f.length:Math.min(f.length,m+p),v=f.slice(m,_).map(z=>({serviceId:z.serviceId,interfaceId:z.interfaceId,interfaceHash:z.interfaceHash,serviceDescription:z.serviceDescription,rootPrincipalSets:z.rootPrincipalSets?.map($=>$.map(y=>({...y})))}));return _<f.length?{items:v,nextCursor:String(_)}:{items:v}},watch:(a,c,u)=>new Promise(d=>{let l={interfaceId:a.interfaceId,interfaceIdPrefix:a.interfaceIdPrefix,serviceId:a.serviceId,serviceIdScopes:a.serviceIdScopes,send:()=>u.send({})};this._directoryWatchers.add(l);let p=()=>{this._directoryWatchers.delete(l),d({})};if(u.signal.aborted){p();return}u.signal.addEventListener("abort",p,{once:!0})})},i)),o.push(this.register(cn,{get:({interfaceId:a,hash:c})=>{let u=this.findRegisteredInterface(a,c);if(!u)throw new ve("Interface not found",X.methodNotFound,{reason:"unknown-interface",interfaceId:a,hash:c});return{schema:u.toSchema()}}},i)),t.serviceId!==void 0)try{this.enableReflection()}catch(a){for(let c of o.reverse())c.dispose();throw a}let s=!1;return{dispose:()=>{if(!s){s=!0;for(let a of o.reverse())a.dispose()}}}}_notifyDirectoryWatchers(t,r=!1){for(let n of this._directoryListeners)try{n()}catch{}for(let n of this._directoryWatchers){if(n.pending)continue;let i=_o(n,t),o=r&&t.serviceId!==void 0&&[...this._registry.values()].some(s=>s.serviceId===t.serviceId&&_o(n,s));!i&&!o||(n.pending=!0,queueMicrotask(()=>{n.pending=!1,this._directoryWatchers.has(n)&&n.send()}))}}enableInspection(t){if(this._inspection!==void 0)return this._inspection;let r={nodeId:go("node"),portId:go("port"),...t!==void 0?{descriptors:[...t]}:{}},n=this._register(Ht,{getNodeId:()=>r},{},!0),i=new Ed(r.nodeId,r.portId,a=>this._wireChannel?.setWireMessageObserver(a?i.observe:void 0,a?c=>this._isInspectionMethod(c):void 0));this._trafficInspector=i;let o=!1,s={...r,observeTraffic:a=>i.observeTransits(a),dispose:()=>{if(!o){o=!0;for(let a of[...this._serviceInspectionRegistrations.keys()])this._removeServiceInspection(a);i.dispose(),this._trafficInspector===i&&(this._trafficInspector=void 0),n.dispose(),this._inspection===s&&(this._inspection=void 0)}}};this._inspection=s;try{let a=new Set(Array.from(this._registry.values()).filter(c=>c.serviceId!==void 0&&!c.internalInspection).map(c=>c.serviceId));for(let c of a)this._installServiceInspection(c)}catch(a){throw s.dispose(),a}return s}get trafficObserverCount(){return this._trafficInspector?.observerCount??0}close(){this.channel.close()}_buildClient(t,r){let{serviceId:n,...i}=r,o=i,s=t.schemaHash,a=Qr(t),c={};for(let[u,d]of Object.entries(t.members)){let l=n?`${n}::${t.info.id}::${u}`:`${t.info.id}::${u}`;if(d.kind==="request")if(d.clientStreamSchema!==void 0||d.serverStreamSchema!==void 0){let p=d.serverStreamSchema;c[u]=(f,m)=>{let _=m?.onMessage,v=_!==void 0?w=>{if(p!==void 0){let T=W(p,w);if(!T.success)return;_(T.data);return}_(w)}:void 0,z=v!==void 0?{ctx:o,interfaceHash:s,onStreamMessage:v}:{ctx:o,interfaceHash:s};a&&Gr(z);let $=this.channel.sendRequestWithStream(l,f,z),y=$.result.then(w=>{let T=W(d.resultSchema,w===null?void 0:w);if(!T.success)throw new ve(X.internalError,`Invalid result for ${l}`,{issues:T.error.issues});return w});return Object.assign(y,{send:w=>$.send(w),cancel:w=>$.cancel(w),ping:()=>$.ping()})}}else{let p=d.resultSchema;c[u]=async f=>{let m={ctx:o,interfaceHash:s};a&&Gr(m);let _=await this.channel.sendRequest(l,f,m),v=W(p,_===null?void 0:_);if(!v.success)throw new ve(X.internalError,`Invalid result for ${l}`,{issues:v.error.issues});return _}}else c[u]=async p=>{let f={ctx:o,interfaceHash:s};a&&Gr(f),this.channel.sendNotification(l,p,f)}}return c}async _handleRequest(t){let r=this._parseRouted(t.method);if(!r.ok)return Ut(r.reason,t.method);let{entry:n,memberName:i}=r,o=n.iface.members[i];if(!o)return Ut("unknown-method",t.method);let s=n.handlers[i];if(!s)return Ut("unknown-method",t.method);let a=W(o.paramsSchema,t.params);if(!a.success)return{error:{code:X.invalidParams,message:"Invalid params",data:{issues:a.error.issues}}};if(!(o instanceof fn))return Ut("unknown-method",t.method);let c=this._buildStreamApi(t.stream,t.signal,o);try{let u=s(a.data,t.context,c);Qr(n.iface)&&t.stream.markInspectionLifecycle();let d=await u,l=W(o.resultSchema,d);return l.success?{result:d===void 0?null:d}:{error:{code:X.internalError,message:`Invalid result for ${t.method}`,data:{issues:l.error.issues}}}}catch(u){return u instanceof ve?{error:{code:u.code,message:u.message,data:u.data}}:{error:{code:X.internalError,message:u instanceof Error?u.message:String(u)}}}}_buildStreamApi(t,r,n){return{send:i=>{if(n.serverStreamSchema){let o=W(n.serverStreamSchema,i);if(!o.success)throw new Error(`Server stream payload failed schema validation: ${o.error.message}`)}return t.send(i)},onMessage:i=>{t.onMessage(o=>{if(n.clientStreamSchema){let s=W(n.clientStreamSchema,o);if(!s.success)return;i(s.data);return}})},ping:()=>t.ping(),signal:r}}_handleNotification(t){let r=this._parseRouted(t.method);if(!r.ok)return;let{entry:n,memberName:i}=r,o=n.iface.members[i];if(!(o instanceof hn))return;let s=n.handlers[i];if(!s)return;let a=W(o.paramsSchema,t.params);a.success&&s(a.data,t.context)}_parseRouted(t){let r=Oo(t);if(!r)return{ok:!1,reason:"bad-method-grammar"};if(r.kind==="bare"){if(!this._preset)return{ok:!1,reason:"no-preset"};let s=this._registry.get(`::${this._preset.interfaceId}`);return s?{ok:!0,entry:s,memberName:r.member}:{ok:!1,reason:"no-preset"}}let n=r.kind==="full"?r.serviceId:void 0,i=`${n??""}::${r.interfaceId}`,o=this._registry.get(i);return o?{ok:!0,entry:o,memberName:r.member}:{ok:!1,reason:n?"unknown-service":"unknown-interface"}}_installServiceInspection(t){if(this._serviceInspectionRegistrations.has(t))return;let r=this._inspection,n=this._trafficInspector;if(r===void 0||n===void 0)return;let i=[],o={serviceId:t};try{i.push(this._register(Ht,{getNodeId:()=>({nodeId:r.nodeId,portId:r.portId})},o,!0)),i.push(this._register(gn,{getGraph:()=>this._endpointGraph(t,r),watchGraph:async(s,a,c)=>(await Ad(c.signal),{})},o,!0)),i.push(this._register(_n,{watch:({methodPrefix:s},a,c)=>this._watchTraffic(n,{methodPrefix:s},c),watchWithPayloads:({methodPrefix:s,maxPayloadBytes:a},c,u)=>this._watchTraffic(n,{methodPrefix:s,maxPayloadBytes:a},u)},o,!0))}catch(s){for(let a of i.reverse())a.dispose();throw s}this._serviceInspectionRegistrations.set(t,i)}_removeServiceInspection(t){let r=this._serviceInspectionRegistrations.get(t);if(r!==void 0){this._serviceInspectionRegistrations.delete(t);for(let n of r.reverse())n.dispose()}}_hasBusinessServiceRegistration(t){return Array.from(this._registry.values()).some(r=>r.serviceId===t&&!r.internalInspection)}_isInspectionMethod(t){let r=this._parseRouted(t);return r.ok&&Qr(r.entry.iface)}_endpointGraph(t,r){return{observerServiceId:t,entryNodeId:r.nodeId,nodes:[{nodeId:r.nodeId,kind:"endpoint",...r.descriptors!==void 0?{descriptors:r.descriptors}:{},ports:[{portId:r.portId}]}],links:[],routes:[{serviceId:t,nodeId:r.nodeId,portId:r.portId,match:"exact"}]}}async _watchTraffic(t,r,n){let i=t.subscribe(r,s=>n.send(s)),o=()=>i.dispose();n.signal.aborted?o():n.signal.addEventListener("abort",o,{once:!0});try{return await i.closed}finally{n.signal.removeEventListener("abort",o),i.dispose()}}};function go(e){let t=new Uint8Array(16);return globalThis.crypto.getRandomValues(t),`${e}:${Co(t)}`}function Pd(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n.length!==i.length)return!1;for(let o=0;o<n.length;o++)if(n[o].principal!==i[o].principal||n[o].transitive===!0!=(i[o].transitive===!0))return!1}return!0}function _o(e,t){let r=t.serviceId??"";return(e.interfaceId===void 0||e.interfaceId===t.iface.info.id)&&(e.interfaceIdPrefix===void 0||t.iface.info.id.startsWith(e.interfaceIdPrefix))&&(e.serviceId===void 0||e.serviceId===r)&&Uo(r,e.serviceIdScopes)}var Bo=class{_connection;_serviceId;constructor(e,t){this._connection=e,this._serviceId=t}get(e,t={}){return this._connection.get(e,{...t,serviceId:this._serviceId})}register(e,t,r={}){return this._connection.register(e,t,{...r,serviceId:this._serviceId})}};function Ut(e,t){return{error:{code:X.methodNotFound,message:`Method not found: ${t}`,data:{reason:e,method:t}}}}function Qr(e){return e===Ht||e===gn||e===_n}function Ad(e){return e.aborted?Promise.resolve():new Promise(t=>{e.addEventListener("abort",()=>t(),{once:!0})})}var j0=Td(globalThis,{});function Td(e,t){return new Proxy(e,{get(r,n,i){return n in t?t[n]:e[n]},set(r,n,i){return n in t&&delete t[n],e[n]=i,!0},deleteProperty(r,n){let i=!1;return n in t&&(delete t[n],i=!0),n in e&&(delete e[n],i=!0),i},ownKeys(r){let n=Reflect.ownKeys(e),i=Reflect.ownKeys(t),o=new Set(i);return[...n.filter(s=>!o.has(s)),...i]},defineProperty(r,n,i){return n in t&&delete t[n],Reflect.defineProperty(e,n,i),!0},getOwnPropertyDescriptor(r,n){return n in t?Reflect.getOwnPropertyDescriptor(t,n):Reflect.getOwnPropertyDescriptor(e,n)},has(r,n){return n in t||n in e}})}var U0=new Uint8Array([115,101,99]);var Md;Md=new WeakMap;var Cd;Cd=new WeakMap;var Od;Od=new WeakMap;var F0=new Uint8Array([98,97,115,101,95,110,111,110,99,101]),K0=new Uint8Array([101,120,112]),B0=new Uint8Array([105,110,102,111,95,104,97,115,104]),H0=new Uint8Array([107,101,121]),q0=new Uint8Array([112,115,107,95,105,100,95,104,97,115,104]),V0=new Uint8Array([115,101,99,114,101,116]),W0=new Uint8Array([72,80,75,69,0,0,0,0,0,0]);var J0=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]);var G0=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32]),X0=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]);var Oe=b(),Zd=F({id:"identity",description:"Per-participant key oracle: exposes signing and HPKE-based wrap/unwrap for the identity the executor has attached to this participant's root overlay. Private keys never leave the executor."},{getPrincipal:M(k({}),k({principal:b()})),getWrapPublicKey:M(k({}),k({wrapPublicKey:Oe})),sign:M(k({bytes:Oe}),k({signature:Oe})),wrap:M(k({domain:b(),bytes:Oe}),k({blob:Oe})),unwrap:M(k({domain:b(),blob:Oe}),k({bytes:Oe}))}),Rd=F({id:"identity.storage",description:"Per-identity persistent key/value store. Scope is the executor's managed-identity slot; lifecycle is tied to the identity itself. Backed by an at-rest-encrypted file in the executor."},{get:M(k({key:b()}),k({value:S($e())})),set:M(k({key:b(),value:$e()}),k({})),delete:M(k({key:b()}),k({existed:lt()})),list:M(k({prefix:S(b())}),k({keys:G(b())}))});var bn=class{_our;_their;_filterSource;_listener;_buffer=[];_closed=!1;_handler=e=>{if(this._filterSource&&e.source!==this._their)return;let t=e.data;Nd(t)&&(this._listener?this._listener(t):this._buffer.push(t))};constructor(e,t,r=!0){if(this._our=e,this._their=t,this._filterSource=r,e===t)throw new Error("WindowMessageTransport: cannot connect to self");e.addEventListener("message",this._handler)}send(e){this._closed||this._their.postMessage(e,"*")}setListener(e){if(this._listener=e,e)for(;this._buffer.length>0&&this._listener;)e(this._buffer.shift())}dispose(){this._closed||(this._closed=!0,this._our.removeEventListener("message",this._handler))}};function Nd(e){return typeof e=="object"&&e!==null&&e.jsonrpc==="2.0"}var Ho;function g(e,t,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=s.prototype,d=Object.keys(u);for(let l=0;l<d.length;l++){let p=d[l];p in a||(a[p]=u[p].bind(a))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function s(a){var c;let u=r?.Parent?new o:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var qe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},gs=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Ho=globalThis).__zod_globalConfig??(Ho.__zod_globalConfig={});var Xt=globalThis.__zod_globalConfig;function Ne(e){return e&&Object.assign(Xt,e),Xt}function _s(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function kn(e,t){return typeof t=="bigint"?t.toString():t}function rr(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw new Error("cached value already set")}}}function In(e){return e==null}function En(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Dd(e,t){let r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}var qo=Symbol("evaluating");function A(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==qo)return n===void 0&&(n=qo,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Le(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ie(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Vo(e){return JSON.stringify(e)}function Ld(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ys="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function gt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var jd=rr(()=>{if(Xt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch{return!1}});function _t(e){if(gt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(gt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function vs(e){return _t(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Ud=new Set(["string","number","symbol"]);function We(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ee(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function x(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 Fd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Kd={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]};function Bd(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return Ee(e,Ie(e._zod.def,{get shape(){let i={};for(let o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(i[o]=r.shape[o])}return Le(this,"shape",i),i},checks:[]}))}function Hd(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return Ee(e,Ie(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete i[o]}return Le(this,"shape",i),i},checks:[]}))}function qd(e,t){if(!_t(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ee(e,Ie(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Le(this,"shape",n),n}}))}function Vd(e,t){if(!_t(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Ee(e,Ie(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return Le(this,"shape",r),r}}))}function Wd(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");return Ee(e,Ie(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Le(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Jd(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");return Ee(t,Ie(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=e?new e({type:"optional",innerType:i[s]}):i[s])}else for(let s in i)o[s]=e?new e({type:"optional",innerType:i[s]}):i[s];return Le(this,"shape",o),o},checks:[]}))}function Gd(e,t,r){return Ee(t,Ie(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=new e({type:"nonoptional",innerType:n[o]}))}else for(let o in n)i[o]=new e({type:"nonoptional",innerType:n[o]});return Le(this,"shape",i),i}}))}function He(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 Xd(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 bs(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Vt(e){return typeof e=="string"?e:e?.message}function De(e,t,r){let n=e.message?e.message:Vt(e.inst?._zod.def?.error?.(e))??Vt(t?.error?.(e))??Vt(r.customError?.(e))??Vt(r.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=n,t?.reportInput&&(a.input=s),a}function Pn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function yt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}var ws=(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,kn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},xs=g("$ZodError",ws),ks=g("$ZodError",ws,{Parent:Error});function Yd(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function Qd(e,t=r=>r.message){let r={_errors:[]},n=(i,o=[])=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,u=0;for(;u<a.length;){let d=a[u];u!==a.length-1?c[d]=c[d]||{_errors:[]}:(c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(s))),c=c[d],u++}}}};return n(e),r}var An=e=>(t,r,n,i)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new qe;if(s.issues.length){let a=new(i?.Err??e)(s.issues.map(c=>De(c,o,Ne())));throw ys(a,i?.callee),a}return s.value},Tn=e=>async(t,r,n,i)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(i?.Err??e)(s.issues.map(c=>De(c,o,Ne())));throw ys(a,i?.callee),a}return s.value},nr=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new qe;return o.issues.length?{success:!1,error:new(e??xs)(o.issues.map(s=>De(s,i,Ne())))}:{success:!0,data:o.value}},el=nr(ks),ir=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>De(s,i,Ne())))}:{success:!0,data:o.value}},tl=ir(ks),rl=e=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return An(e)(t,r,i)},nl=e=>(t,r,n)=>An(e)(t,r,n),il=e=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return Tn(e)(t,r,i)},ol=e=>async(t,r,n)=>Tn(e)(t,r,n),sl=e=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return nr(e)(t,r,i)},al=e=>(t,r,n)=>nr(e)(t,r,n),cl=e=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return ir(e)(t,r,i)},ul=e=>async(t,r,n)=>ir(e)(t,r,n),dl=/^[cC][0-9a-z]{6,}$/,ll=/^[0-9a-z]+$/,pl=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fl=/^[0-9a-vA-V]{20}$/,hl=/^[A-Za-z0-9]{27}$/,ml=/^[a-zA-Z0-9_-]{21}$/,gl=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_l=/^([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})$/,Wo=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)$/,yl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function bl(){return new RegExp(vl,"u")}var wl=/^(?:(?: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])$/,xl=/^(([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}|:))$/,kl=/^((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])$/,zl=/^(([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])$/,Sl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zs=/^[A-Za-z0-9_-]*$/,$l=/^https?$/,Il=/^\+[1-9]\d{6,14}$/,Ss="(?:(?:\\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])))",El=new RegExp(`^${Ss}$`);function $s(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 Pl(e){return new RegExp(`^${$s(e)}$`)}function Al(e){let t=$s({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Ss}T(?:${n})$`)}var Tl=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ml=/^-?\d+$/,Cl=/^-?\d+(?:\.\d+)?$/,Ol=/^(?:true|false)$/i,Zl=/^[^A-Z]*$/,Rl=/^[^a-z]*$/,Q=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Is={number:"number",bigint:"bigint",object:"date"},Es=g("$ZodCheckLessThan",(e,t)=>{Q.init(e,t);let r=Is[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ps=g("$ZodCheckGreaterThan",(e,t)=>{Q.init(e,t);let r=Is[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Nl=g("$ZodCheckMultipleOf",(e,t)=>{Q.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.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):Dd(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})}}),Dl=g("$ZodCheckNumberFormat",(e,t)=>{Q.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Kd[t.format];e._zod.onattach.push(s=>{let a=s._zod.bag;a.format=t.format,a.minimum=i,a.maximum=o,r&&(a.pattern=Ml)}),e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Ll=g("$ZodCheckMaxLength",(e,t)=>{var r;Q.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!In(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let o=Pn(i);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),jl=g("$ZodCheckMinLength",(e,t)=>{var r;Q.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!In(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let o=Pn(i);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ul=g("$ZodCheckLengthEquals",(e,t)=>{var r;Q.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!In(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,o=i.length;if(o===t.length)return;let s=Pn(i),a=o>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),or=g("$ZodCheckStringFormat",(e,t)=>{var r,n;Q.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Fl=g("$ZodCheckRegex",(e,t)=>{or.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})}}),Kl=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Zl),or.init(e,t)}),Bl=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Rl),or.init(e,t)}),Hl=g("$ZodCheckIncludes",(e,t)=>{Q.init(e,t);let r=We(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),ql=g("$ZodCheckStartsWith",(e,t)=>{Q.init(e,t);let r=new RegExp(`^${We(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Vl=g("$ZodCheckEndsWith",(e,t)=>{Q.init(e,t);let r=new RegExp(`.*${We(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Wl=g("$ZodCheckOverwrite",(e,t)=>{Q.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),Jl=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split(`
`).filter(i=>i),r=Math.min(...t.map(i=>i.length-i.trimStart().length)),n=t.map(i=>i.slice(r)).map(i=>" ".repeat(this.indent*2)+i);for(let i of n)this.content.push(i)}compile(){let e=Function,t=this?.args,r=[...(this?.content??[""]).map(n=>` ${n}`)];return new e(...t,r.join(`
`))}},Gl={major:4,minor:4,patch:3},N=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Gl;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(s,a,c)=>{let u=He(s),d;for(let l of a){if(l._zod.def.when){if(Xd(s)||!l._zod.def.when(s))continue}else if(u)continue;let p=s.issues.length,f=l._zod.check(s);if(f instanceof Promise&&c?.async===!1)throw new qe;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(u||(u=He(s,p)))});else{if(s.issues.length===p)continue;u||(u=He(s,p))}}return d?d.then(()=>s):s},o=(s,a,c)=>{if(He(s))return s.aborted=!0,s;let u=i(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new qe;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let u=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>o(d,s,a)):o(u,s,a)}let c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new qe;return c.then(u=>i(u,n,a))}return i(c,n,a)}}A(e,"~standard",()=>({validate:i=>{try{let o=el(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return tl(e,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Mn=g("$ZodString",(e,t)=>{N.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Tl(e._zod.bag),e._zod.parse=(r,n)=>{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}}),O=g("$ZodStringFormat",(e,t)=>{or.init(e,t),Mn.init(e,t)}),Xl=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=_l),O.init(e,t)}),Yl=g("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Wo(r))}else t.pattern??(t.pattern=Wo());O.init(e,t)}),Ql=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=yl),O.init(e,t)}),ep=g("$ZodURL",(e,t)=>{O.init(e,t),e._zod.check=r=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===$l.source&&!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.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(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.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=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),tp=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=bl()),O.init(e,t)}),rp=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ml),O.init(e,t)}),np=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=dl),O.init(e,t)}),ip=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ll),O.init(e,t)}),op=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=pl),O.init(e,t)}),sp=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=fl),O.init(e,t)}),ap=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hl),O.init(e,t)}),cp=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Al(t)),O.init(e,t)}),up=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=El),O.init(e,t)}),dp=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Pl(t)),O.init(e,t)}),lp=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=gl),O.init(e,t)}),pp=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wl),O.init(e,t),e._zod.bag.format="ipv4"}),fp=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=xl),O.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})}}}),hp=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=kl),O.init(e,t)}),mp=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=zl),O.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function As(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var gp=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Sl),O.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{As(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function _p(e){if(!zs.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/");return As(t.padEnd(Math.ceil(t.length/4)*4,"="))}var yp=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=zs),O.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{_p(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),vp=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Il),O.init(e,t)});function bp(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var wp=g("$ZodJWT",(e,t)=>{O.init(e,t),e._zod.check=r=>{bp(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Ts=g("$ZodNumber",(e,t)=>{N.init(e,t),e._zod.pattern=e._zod.bag.pattern??Cl,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),xp=g("$ZodNumberFormat",(e,t)=>{Dl.init(e,t),Ts.init(e,t)}),kp=g("$ZodBoolean",(e,t)=>{N.init(e,t),e._zod.pattern=Ol,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),zp=g("$ZodUnknown",(e,t)=>{N.init(e,t),e._zod.parse=r=>r}),Sp=g("$ZodNever",(e,t)=>{N.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Jo(e,t,r){e.issues.length&&t.issues.push(...bs(r,e.issues)),t.value[r]=e.value}var $p=g("$ZodArray",(e,t)=>{N.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let s=0;s<i.length;s++){let a=i[s],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?o.push(c.then(u=>Jo(u,r,s))):Jo(c,r,s)}return o.length?Promise.all(o).then(()=>r):r}});function Yt(e,t,r,n,i,o){let s=r in n;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...bs(r,e.issues))}if(!s&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?s&&(t.value[r]=void 0):t.value[r]=e.value}function Ms(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Fd(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Cs(e,t,r,n,i,o){let s=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,d=c.optin==="optional",l=c.optout==="optional";for(let p in t){if(p==="__proto__"||a.has(p))continue;if(u==="never"){s.push(p);continue}let f=c.run({value:t[p],issues:[]},n);f instanceof Promise?e.push(f.then(m=>Yt(m,r,p,t,d,l))):Yt(f,r,p,t,d,l)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var Ip=g("$ZodObject",(e,t)=>{if(N.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let a={...s};return Object.defineProperty(t,"shape",{value:a}),a}})}let r=rr(()=>Ms(t));A(e._zod,"propValues",()=>{let s=t.shape,a={};for(let c in s){let u=s[c]._zod;if(u.values){a[c]??(a[c]=new Set);for(let d of u.values)a[c].add(d)}}return a});let n=gt,i=t.catchall,o;e._zod.parse=(s,a)=>{o??(o=r.value);let c=s.value;if(!n(c))return s.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),s;s.value={};let u=[],d=o.shape;for(let l of o.keys){let p=d[l],f=p._zod.optin==="optional",m=p._zod.optout==="optional",_=p._zod.run({value:c[l],issues:[]},a);_ instanceof Promise?u.push(_.then(v=>Yt(v,s,l,c,f,m))):Yt(_,s,l,c,f,m)}return i?Cs(u,c,s,a,r.value,e):u.length?Promise.all(u).then(()=>s):s}}),Ep=g("$ZodObjectJIT",(e,t)=>{Ip.init(e,t);let r=e._zod.parse,n=rr(()=>Ms(t)),i=l=>{let p=new Jl(["shape","payload","ctx"]),f=n.value,m=$=>{let y=Vo($);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),v=0;for(let $ of f.keys)_[$]=`key_${v++}`;p.write("const newResult = {};");for(let $ of f.keys){let y=_[$],w=Vo($),T=l[$],L=T?._zod?.optin==="optional",I=T?._zod?.optout==="optional";p.write(`const ${y} = ${m($)};`),L&&I?p.write(`
if (${y}.issues.length) {
if (${w} in input) {
payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
...iss,
path: iss.path ? [${w}, ...iss.path] : [${w}]
})));
}
}
if (${y}.value === undefined) {
if (${w} in input) {
newResult[${w}] = undefined;
}
} else {
newResult[${w}] = ${y}.value;
}
`):L?p.write(`
if (${y}.issues.length) {
payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
...iss,
path: iss.path ? [${w}, ...iss.path] : [${w}]
})));
}
if (${y}.value === undefined) {
if (${w} in input) {
newResult[${w}] = undefined;
}
} else {
newResult[${w}] = ${y}.value;
}
`):p.write(`
const ${y}_present = ${w} in input;
if (${y}.issues.length) {
payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
...iss,
path: iss.path ? [${w}, ...iss.path] : [${w}]
})));
}
if (!${y}_present && !${y}.issues.length) {
payload.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: undefined,
path: [${w}]
});
}
if (${y}_present) {
if (${y}.value === undefined) {
newResult[${w}] = undefined;
} else {
newResult[${w}] = ${y}.value;
}
}
`)}p.write("payload.value = newResult;"),p.write("return payload;");let z=p.compile();return($,y)=>z(l,$,y)},o,s=gt,a=!Xt.jitless,c=a&&jd.value,u=t.catchall,d;e._zod.parse=(l,p)=>{d??(d=n.value);let f=l.value;return s(f)?a&&c&&p?.async===!1&&p.jitless!==!0?(o||(o=i(t.shape)),l=o(l,p),u?Cs([],f,l,p,d,e):l):r(l,p):(l.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),l)}});function Go(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter(o=>!He(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(s=>De(s,n,Ne())))}),t)}var Os=g("$ZodUnion",(e,t)=>{N.init(e,t),A(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),A(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),A(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),A(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){let n=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>En(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let o=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},i);if(c instanceof Promise)s.push(c),o=!0;else{if(c.issues.length===0)return c;s.push(c)}}return o?Promise.all(s).then(a=>Go(a,n,e,i)):Go(s,n,e,i)}}),Pp=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Os.init(e,t);let r=e._zod.parse;A(e._zod,"propValues",()=>{let i={};for(let o of t.options){let s=o._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[a,c]of Object.entries(s)){i[a]||(i[a]=new Set);for(let u of c)i[a].add(u)}}return i});let n=rr(()=>{let i=t.options,o=new Map;for(let s of i){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let c of a){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,s)}}return o});e._zod.parse=(i,o)=>{let s=i.value;if(!gt(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;let a=n.value.get(s?.[t.discriminator]);return a?a._zod.run(i,o):t.unionFallback||o.direction==="backward"?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:s,path:[t.discriminator],inst:e}),i)}}),Ap=g("$ZodIntersection",(e,t)=>{N.init(e,t),e._zod.parse=(r,n)=>{let i=r.value,o=t.left._zod.run({value:i,issues:[]},n),s=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([a,c])=>Xo(r,a,c)):Xo(r,o,s)}});function zn(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(_t(e)&&_t(t)){let r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),i={...e,...t};for(let o of n){let s=zn(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],o=t[n],s=zn(i,o);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Xo(e,t,r){let n=new Map,i;for(let a of t.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(let c of a.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(a);let o=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&i&&e.issues.push({...i,keys:o}),He(e))return e;let s=zn(t.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var Tp=g("$ZodEnum",(e,t)=>{N.init(e,t);let r=_s(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>Ud.has(typeof i)).map(i=>typeof i=="string"?We(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{let s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:e}),i}}),Mp=g("$ZodLiteral",(e,t)=>{if(N.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?We(n):n?We(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),Cp=g("$ZodTransform",(e,t)=>{N.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gs(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(r.value=o,r.fallback=!0,r));if(i instanceof Promise)throw new qe;return r.value=i,r.fallback=!0,r}});function Yo(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Zs=g("$ZodOptional",(e,t)=>{N.init(e,t),e._zod.optin="optional",e._zod.optout="optional",A(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),A(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${En(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=r.value,o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Yo(s,i)):Yo(o,i)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),Op=g("$ZodExactOptional",(e,t)=>{Zs.init(e,t),A(e._zod,"values",()=>t.innerType._zod.values),A(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Zp=g("$ZodNullable",(e,t)=>{N.init(e,t),A(e._zod,"optin",()=>t.innerType._zod.optin),A(e._zod,"optout",()=>t.innerType._zod.optout),A(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${En(r.source)}|null)$`):void 0}),A(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Rp=g("$ZodDefault",(e,t)=>{N.init(e,t),e._zod.optin="optional",A(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>Qo(o,t)):Qo(i,t)}});function Qo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Np=g("$ZodPrefault",(e,t)=>{N.init(e,t),e._zod.optin="optional",A(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Dp=g("$ZodNonOptional",(e,t)=>{N.init(e,t),A(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>es(o,e)):es(i,e)}});function es(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Lp=g("$ZodCatch",(e,t)=>{N.init(e,t),e._zod.optin="optional",A(e._zod,"optout",()=>t.innerType._zod.optout),A(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>De(s,n,Ne()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(o=>De(o,n,Ne()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),jp=g("$ZodPipe",(e,t)=>{N.init(e,t),A(e._zod,"values",()=>t.in._zod.values),A(e._zod,"optin",()=>t.in._zod.optin),A(e._zod,"optout",()=>t.out._zod.optout),A(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=t.out._zod.run(r,n);return o instanceof Promise?o.then(s=>Wt(s,t.in,n)):Wt(o,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(o=>Wt(o,t.out,n)):Wt(i,t.out,n)}});function Wt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var Up=g("$ZodReadonly",(e,t)=>{N.init(e,t),A(e._zod,"propValues",()=>t.innerType._zod.propValues),A(e._zod,"values",()=>t.innerType._zod.values),A(e._zod,"optin",()=>t.innerType?._zod?.optin),A(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(ts):ts(i)}});function ts(e){return e.value=Object.freeze(e.value),e}var Fp=g("$ZodCustom",(e,t)=>{Q.init(e,t),N.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(o=>rs(o,r,n,e));rs(i,r,n,e)}});function rs(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(yt(i))}}var ns,Kp=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Bp(){return new Kp}(ns=globalThis).__zod_globalRegistry??(ns.__zod_globalRegistry=Bp());var mt=globalThis.__zod_globalRegistry;function Hp(e,t){return new e({type:"string",...x(t)})}function qp(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...x(t)})}function is(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...x(t)})}function Vp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...x(t)})}function Wp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...x(t)})}function Jp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...x(t)})}function Gp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...x(t)})}function Xp(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...x(t)})}function Yp(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...x(t)})}function Qp(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...x(t)})}function ef(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...x(t)})}function tf(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...x(t)})}function rf(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...x(t)})}function nf(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...x(t)})}function of(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...x(t)})}function sf(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...x(t)})}function af(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...x(t)})}function cf(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...x(t)})}function uf(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...x(t)})}function df(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...x(t)})}function lf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...x(t)})}function pf(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...x(t)})}function ff(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...x(t)})}function hf(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...x(t)})}function mf(e,t){return new e({type:"string",format:"date",check:"string_format",...x(t)})}function gf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...x(t)})}function _f(e,t){return new e({type:"string",format:"duration",check:"string_format",...x(t)})}function yf(e,t){return new e({type:"number",checks:[],...x(t)})}function vf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...x(t)})}function bf(e,t){return new e({type:"boolean",...x(t)})}function wf(e){return new e({type:"unknown"})}function xf(e,t){return new e({type:"never",...x(t)})}function os(e,t){return new Es({check:"less_than",...x(t),value:e,inclusive:!1})}function wn(e,t){return new Es({check:"less_than",...x(t),value:e,inclusive:!0})}function ss(e,t){return new Ps({check:"greater_than",...x(t),value:e,inclusive:!1})}function xn(e,t){return new Ps({check:"greater_than",...x(t),value:e,inclusive:!0})}function as(e,t){return new Nl({check:"multiple_of",...x(t),value:e})}function Rs(e,t){return new Ll({check:"max_length",...x(t),maximum:e})}function Qt(e,t){return new jl({check:"min_length",...x(t),minimum:e})}function Ns(e,t){return new Ul({check:"length_equals",...x(t),length:e})}function kf(e,t){return new Fl({check:"string_format",format:"regex",...x(t),pattern:e})}function zf(e){return new Kl({check:"string_format",format:"lowercase",...x(e)})}function Sf(e){return new Bl({check:"string_format",format:"uppercase",...x(e)})}function $f(e,t){return new Hl({check:"string_format",format:"includes",...x(t),includes:e})}function If(e,t){return new ql({check:"string_format",format:"starts_with",...x(t),prefix:e})}function Ef(e,t){return new Vl({check:"string_format",format:"ends_with",...x(t),suffix:e})}function Ge(e){return new Wl({check:"overwrite",tx:e})}function Pf(e){return Ge(t=>t.normalize(e))}function Af(){return Ge(e=>e.trim())}function Tf(){return Ge(e=>e.toLowerCase())}function Mf(){return Ge(e=>e.toUpperCase())}function Cf(){return Ge(e=>Ld(e))}function Of(e,t,r){return new e({type:"array",element:t,...x(r)})}function Zf(e,t,r){return new e({type:"custom",check:"custom",fn:t,...x(r)})}function Rf(e,t){let r=Nf(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push(yt(i,n.value,r._zod.def));else{let o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),n.issues.push(yt(o))}},e(n.value,n)),t);return r}function Nf(e,t){let r=new Q({check:"custom",...x(t)});return r._zod.check=e,r}function Ds(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??mt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function K(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,u);else{let l=s.schema,p=t.processors[i.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);p(e,t,l,u)}let d=e._zod.parent;d&&(s.ref||(s.ref=d),K(d,t,u),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(s.schema,c),t.io==="input"&&q(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Ls(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=n.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}let i=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,l=e.external.uri??(f=>f);if(d)return{ref:l(d)};let p=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=p,{defId:p,ref:`${l("__shared")}#/${a}/${p}`}}if(s[1]===r)return{ref:"#"};let c=`#/${a}/`,u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:c+u}},o=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=i(s);a.def={...a.schema},u&&(a.defId=u);let d=a.schema;for(let l in d)delete d[l];d.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let c=e.external.registry.get(s[0])?.id;if(t!==s[0]&&c){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}}function js(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,d={...u},l=c.ref;if(c.ref=null,l){n(l);let f=e.seen.get(l),m=f.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,d),a._zod.parent===l)for(let _ in u)_==="$ref"||_==="allOf"||_ in d||delete u[_];if(m.$ref&&f.def)for(let _ in u)_==="$ref"||_==="allOf"||_ in f.def&&JSON.stringify(u[_])===JSON.stringify(f.def[_])&&delete u[_]}let p=a._zod.parent;if(p&&p!==l){n(p);let f=e.seen.get(p);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let m in u)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(u[m])===JSON.stringify(f.def[m])&&delete u[m]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,r.def??r.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&i.id===o&&delete i.id;let s=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,s[c.defId]=c.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:er(t,"input",e.processors),output:er(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function q(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return q(n.element,r);if(n.type==="set")return q(n.valueType,r);if(n.type==="lazy")return q(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return q(n.innerType,r);if(n.type==="intersection")return q(n.left,r)||q(n.right,r);if(n.type==="record"||n.type==="map")return q(n.keyType,r)||q(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:q(n.in,r)||q(n.out,r);if(n.type==="object"){for(let i in n.shape)if(q(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(q(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(q(i,r))return!0;return!!(n.rest&&q(n.rest,r))}return!1}var Df=(e,t={})=>r=>{let n=Ds({...r,processors:t});return K(e,n),Ls(n,e),js(n,e)},er=(e,t,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},s=Ds({...i??{},target:o,io:t,processors:r});return K(e,s),Ls(s,e),js(s,e)},Lf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},jf=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=Lf[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){let d=[...c];d.length===1?i.pattern=d[0].source:d.length>1&&(i.allOf=[...d.map(l=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:l.source}))])}},Uf=(e,t,r,n)=>{let i=r,{minimum:o,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";let l=typeof d=="number"&&d>=(o??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";l?f?(i.minimum=d,i.exclusiveMinimum=!0):i.exclusiveMinimum=d:typeof o=="number"&&(i.minimum=o),p?f?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u:typeof s=="number"&&(i.maximum=s),typeof c=="number"&&(i.multipleOf=c)},Ff=(e,t,r,n)=>{r.type="boolean"},Kf=(e,t,r,n)=>{r.not={}},Bf=(e,t,r,n)=>{let i=e._zod.def,o=_s(i.entries);o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},Hf=(e,t,r,n)=>{let i=e._zod.def,o=[];for(let s of i.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},qf=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Vf=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Wf=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=K(o.element,t,{...n,path:[...n.path,"items"]})},Jf=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object",i.properties={};let s=o.shape;for(let u in s)i.properties[u]=K(s[u],t,{...n,path:[...n.path,"properties",u]});let a=new Set(Object.keys(s)),c=new Set([...a].filter(u=>{let d=o.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(i.required=Array.from(c)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=K(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Gf=(e,t,r,n)=>{let i=e._zod.def,o=i.inclusive===!1,s=i.options.map((a,c)=>K(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=s:r.anyOf=s},Xf=(e,t,r,n)=>{let i=e._zod.def,o=K(i.left,t,{...n,path:[...n.path,"allOf",0]}),s=K(i.right,t,{...n,path:[...n.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1;r.allOf=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]]},Yf=(e,t,r,n)=>{let i=e._zod.def,o=K(i.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},Qf=(e,t,r,n)=>{let i=e._zod.def;K(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},eh=(e,t,r,n)=>{let i=e._zod.def;K(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},th=(e,t,r,n)=>{let i=e._zod.def;K(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},rh=(e,t,r,n)=>{let i=e._zod.def;K(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},nh=(e,t,r,n)=>{let i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?i.out:i.in:i.out;K(s,t,n);let a=t.seen.get(e);a.ref=s},ih=(e,t,r,n)=>{let i=e._zod.def;K(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.readOnly=!0},Us=(e,t,r,n)=>{let i=e._zod.def;K(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},oh=g("ZodISODateTime",(e,t)=>{cp.init(e,t),R.init(e,t)});function sh(e){return hf(oh,e)}var ah=g("ZodISODate",(e,t)=>{up.init(e,t),R.init(e,t)});function ch(e){return mf(ah,e)}var uh=g("ZodISOTime",(e,t)=>{dp.init(e,t),R.init(e,t)});function dh(e){return gf(uh,e)}var lh=g("ZodISODuration",(e,t)=>{lp.init(e,t),R.init(e,t)});function ph(e){return _f(lh,e)}var fh=(e,t)=>{xs.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Qd(e,r)},flatten:{value:r=>Yd(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,kn,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,kn,2)}},isEmpty:{get(){return e.issues.length===0}}})},oe=g("ZodError",fh,{Parent:Error}),hh=An(oe),mh=Tn(oe),gh=nr(oe),_h=ir(oe),yh=rl(oe),vh=nl(oe),bh=il(oe),wh=ol(oe),xh=sl(oe),kh=al(oe),zh=cl(oe),Sh=ul(oe),cs=new WeakMap;function vt(e,t,r){let n=Object.getPrototypeOf(e),i=cs.get(n);if(i||(i=new Set,cs.set(n,i)),!i.has(t)){i.add(t);for(let o in r){let s=r[o];Object.defineProperty(n,o,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var D=g("ZodType",(e,t)=>(N.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:er(e,"input"),output:er(e,"output")}}),e.toJSONSchema=Df(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>hh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>gh(e,r,n),e.parseAsync=async(r,n)=>mh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>_h(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>yh(e,r,n),e.decode=(r,n)=>vh(e,r,n),e.encodeAsync=async(r,n)=>bh(e,r,n),e.decodeAsync=async(r,n)=>wh(e,r,n),e.safeEncode=(r,n)=>xh(e,r,n),e.safeDecode=(r,n)=>kh(e,r,n),e.safeEncodeAsync=async(r,n)=>zh(e,r,n),e.safeDecodeAsync=async(r,n)=>Sh(e,r,n),vt(e,"ZodType",{check(...r){let n=this.def;return this.clone(Ie(n,{checks:[...n.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return Ee(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(vm(r,n))},superRefine(r,n){return this.check(bm(r,n))},overwrite(r){return this.check(Ge(r))},optional(){return ls(this)},exactOptional(){return sm(this)},nullable(){return ps(this)},nullish(){return ls(ps(this))},nonoptional(r){return pm(this,r)},array(){return Ve(this)},or(r){return Xh([this,r])},and(r){return tm(this,r)},transform(r){return fs(this,im(r))},default(r){return um(this,r)},prefault(r){return lm(this,r)},catch(r){return hm(this,r)},pipe(r){return fs(this,r)},readonly(){return _m(this)},describe(r){let n=this.clone();return mt.add(n,{description:r}),n},meta(...r){if(r.length===0)return mt.get(this);let n=this.clone();return mt.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return mt.get(e)?.description},configurable:!0}),e)),Fs=g("_ZodString",(e,t)=>{Mn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(n,i,o)=>jf(e,n,i,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,vt(e,"_ZodString",{regex(...n){return this.check(kf(...n))},includes(...n){return this.check($f(...n))},startsWith(...n){return this.check(If(...n))},endsWith(...n){return this.check(Ef(...n))},min(...n){return this.check(Qt(...n))},max(...n){return this.check(Rs(...n))},length(...n){return this.check(Ns(...n))},nonempty(...n){return this.check(Qt(1,...n))},lowercase(n){return this.check(zf(n))},uppercase(n){return this.check(Sf(n))},trim(){return this.check(Af())},normalize(...n){return this.check(Pf(...n))},toLowerCase(){return this.check(Tf())},toUpperCase(){return this.check(Mf())},slugify(){return this.check(Cf())}})}),$h=g("ZodString",(e,t)=>{Mn.init(e,t),Fs.init(e,t),e.email=r=>e.check(qp(Ih,r)),e.url=r=>e.check(Xp(Eh,r)),e.jwt=r=>e.check(ff(Kh,r)),e.emoji=r=>e.check(Yp(Ph,r)),e.guid=r=>e.check(is(us,r)),e.uuid=r=>e.check(Vp(Jt,r)),e.uuidv4=r=>e.check(Wp(Jt,r)),e.uuidv6=r=>e.check(Jp(Jt,r)),e.uuidv7=r=>e.check(Gp(Jt,r)),e.nanoid=r=>e.check(Qp(Ah,r)),e.guid=r=>e.check(is(us,r)),e.cuid=r=>e.check(ef(Th,r)),e.cuid2=r=>e.check(tf(Mh,r)),e.ulid=r=>e.check(rf(Ch,r)),e.base64=r=>e.check(df(jh,r)),e.base64url=r=>e.check(lf(Uh,r)),e.xid=r=>e.check(nf(Oh,r)),e.ksuid=r=>e.check(of(Zh,r)),e.ipv4=r=>e.check(sf(Rh,r)),e.ipv6=r=>e.check(af(Nh,r)),e.cidrv4=r=>e.check(cf(Dh,r)),e.cidrv6=r=>e.check(uf(Lh,r)),e.e164=r=>e.check(pf(Fh,r)),e.datetime=r=>e.check(sh(r)),e.date=r=>e.check(ch(r)),e.time=r=>e.check(dh(r)),e.duration=r=>e.check(ph(r))});function Y(e){return Hp($h,e)}var R=g("ZodStringFormat",(e,t)=>{O.init(e,t),Fs.init(e,t)}),Ih=g("ZodEmail",(e,t)=>{Ql.init(e,t),R.init(e,t)}),us=g("ZodGUID",(e,t)=>{Xl.init(e,t),R.init(e,t)}),Jt=g("ZodUUID",(e,t)=>{Yl.init(e,t),R.init(e,t)}),Eh=g("ZodURL",(e,t)=>{ep.init(e,t),R.init(e,t)}),Ph=g("ZodEmoji",(e,t)=>{tp.init(e,t),R.init(e,t)}),Ah=g("ZodNanoID",(e,t)=>{rp.init(e,t),R.init(e,t)}),Th=g("ZodCUID",(e,t)=>{np.init(e,t),R.init(e,t)}),Mh=g("ZodCUID2",(e,t)=>{ip.init(e,t),R.init(e,t)}),Ch=g("ZodULID",(e,t)=>{op.init(e,t),R.init(e,t)}),Oh=g("ZodXID",(e,t)=>{sp.init(e,t),R.init(e,t)}),Zh=g("ZodKSUID",(e,t)=>{ap.init(e,t),R.init(e,t)}),Rh=g("ZodIPv4",(e,t)=>{pp.init(e,t),R.init(e,t)}),Nh=g("ZodIPv6",(e,t)=>{fp.init(e,t),R.init(e,t)}),Dh=g("ZodCIDRv4",(e,t)=>{hp.init(e,t),R.init(e,t)}),Lh=g("ZodCIDRv6",(e,t)=>{mp.init(e,t),R.init(e,t)}),jh=g("ZodBase64",(e,t)=>{gp.init(e,t),R.init(e,t)}),Uh=g("ZodBase64URL",(e,t)=>{yp.init(e,t),R.init(e,t)}),Fh=g("ZodE164",(e,t)=>{vp.init(e,t),R.init(e,t)}),Kh=g("ZodJWT",(e,t)=>{wp.init(e,t),R.init(e,t)}),Ks=g("ZodNumber",(e,t)=>{Ts.init(e,t),D.init(e,t),e._zod.processJSONSchema=(n,i,o)=>Uf(e,n,i,o),vt(e,"ZodNumber",{gt(n,i){return this.check(ss(n,i))},gte(n,i){return this.check(xn(n,i))},min(n,i){return this.check(xn(n,i))},lt(n,i){return this.check(os(n,i))},lte(n,i){return this.check(wn(n,i))},max(n,i){return this.check(wn(n,i))},int(n){return this.check(ds(n))},safe(n){return this.check(ds(n))},positive(n){return this.check(ss(0,n))},nonnegative(n){return this.check(xn(0,n))},negative(n){return this.check(os(0,n))},nonpositive(n){return this.check(wn(0,n))},multipleOf(n,i){return this.check(as(n,i))},step(n,i){return this.check(as(n,i))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function be(e){return yf(Ks,e)}var Bh=g("ZodNumberFormat",(e,t)=>{xp.init(e,t),Ks.init(e,t)});function ds(e){return vf(Bh,e)}var Hh=g("ZodBoolean",(e,t)=>{kp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ff(e,r,n,i)});function V(e){return bf(Hh,e)}var qh=g("ZodUnknown",(e,t)=>{zp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>{}});function Sn(){return wf(qh)}var Vh=g("ZodNever",(e,t)=>{Sp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Kf(e,r,n,i)});function Wh(e){return xf(Vh,e)}var Jh=g("ZodArray",(e,t)=>{$p.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Wf(e,r,n,i),e.element=t.element,vt(e,"ZodArray",{min(r,n){return this.check(Qt(r,n))},nonempty(r){return this.check(Qt(1,r))},max(r,n){return this.check(Rs(r,n))},length(r,n){return this.check(Ns(r,n))},unwrap(){return this.element}})});function Ve(e,t){return Of(Jh,e,t)}var Gh=g("ZodObject",(e,t)=>{Ep.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Jf(e,r,n,i),A(e,"shape",()=>t.shape),vt(e,"ZodObject",{keyof(){return Cn(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Sn()})},loose(){return this.clone({...this._zod.def,catchall:Sn()})},strict(){return this.clone({...this._zod.def,catchall:Wh()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return qd(this,r)},safeExtend(r){return Vd(this,r)},merge(r){return Wd(this,r)},pick(r){return Bd(this,r)},omit(r){return Hd(this,r)},partial(...r){return Jd(Hs,this,r[0])},required(...r){return Gd(qs,this,r[0])}})});function P(e,t){let r={type:"object",shape:e??{},...x(t)};return new Gh(r)}var Bs=g("ZodUnion",(e,t)=>{Os.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Gf(e,r,n,i),e.options=t.options});function Xh(e,t){return new Bs({type:"union",options:e,...x(t)})}var Yh=g("ZodDiscriminatedUnion",(e,t)=>{Bs.init(e,t),Pp.init(e,t)});function Qh(e,t,r){return new Yh({type:"union",options:t,discriminator:e,...x(r)})}var em=g("ZodIntersection",(e,t)=>{Ap.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Xf(e,r,n,i)});function tm(e,t){return new em({type:"intersection",left:e,right:t})}var $n=g("ZodEnum",(e,t)=>{Tp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(n,i,o)=>Bf(e,n,i,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let o={};for(let s of n)if(r.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new $n({...t,checks:[],...x(i),entries:o})},e.exclude=(n,i)=>{let o={...t.entries};for(let s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new $n({...t,checks:[],...x(i),entries:o})}});function Cn(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new $n({type:"enum",entries:r,...x(t)})}var rm=g("ZodLiteral",(e,t)=>{Mp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Hf(e,r,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function tr(e,t){return new rm({type:"literal",values:Array.isArray(e)?e:[e],...x(t)})}var nm=g("ZodTransform",(e,t)=>{Cp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Vf(e,r,n,i),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gs(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(yt(o,r.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(yt(s))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function im(e){return new nm({type:"transform",transform:e})}var Hs=g("ZodOptional",(e,t)=>{Zs.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Us(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function ls(e){return new Hs({type:"optional",innerType:e})}var om=g("ZodExactOptional",(e,t)=>{Op.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Us(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function sm(e){return new om({type:"optional",innerType:e})}var am=g("ZodNullable",(e,t)=>{Zp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Yf(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function ps(e){return new am({type:"nullable",innerType:e})}var cm=g("ZodDefault",(e,t)=>{Rp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>eh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function um(e,t){return new cm({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():vs(t)}})}var dm=g("ZodPrefault",(e,t)=>{Np.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>th(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function lm(e,t){return new dm({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():vs(t)}})}var qs=g("ZodNonOptional",(e,t)=>{Dp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Qf(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function pm(e,t){return new qs({type:"nonoptional",innerType:e,...x(t)})}var fm=g("ZodCatch",(e,t)=>{Lp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>rh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hm(e,t){return new fm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var mm=g("ZodPipe",(e,t)=>{jp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>nh(e,r,n,i),e.in=t.in,e.out=t.out});function fs(e,t){return new mm({type:"pipe",in:e,out:t})}var gm=g("ZodReadonly",(e,t)=>{Up.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ih(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function _m(e){return new gm({type:"readonly",innerType:e})}var ym=g("ZodCustom",(e,t)=>{Fp.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>qf(e,r,n,i)});function vm(e,t={}){return Zf(ym,e,t)}function bm(e,t){return Rf(e,t)}var Je=Sn(),wm=P({supportsContentEdits:V().optional(),supportsOptions:V().optional()}),xm=P({supportsContentEdits:V().optional(),supportsOptions:V().optional(),supportsForceUpdate:V().optional(),supportsHostTransport:V().optional()}),km=P({offset:be().int().nonnegative(),length:be().int().nonnegative(),newText:Y()}),Vs=Qh("kind",[P({kind:tr("replace"),path:Ve(Y()),newValue:Je}),P({kind:tr("stringEdits"),path:Ve(Y()),stringEdits:Ve(km)})]),zm=P({content:Je.optional(),options:Je.optional(),readOnly:V().optional(),serverRevision:be().int().nonnegative().optional(),acknowledgedClientRevision:be().int().nonnegative().optional(),force:V().optional()}),Sm=F({id:"web-editor-host",description:"Methods the host exposes to the editor (web-editor/0.12)."},{initialized:M(P({protocolVersion:tr("web-editor/0.12"),contentType:Cn(["text","json"]),capabilities:wm.optional()}),P({protocolVersion:tr("web-editor-host/0.12"),capabilities:xm.optional()})),applyContentEdit:ie(P({edits:Ve(Vs),clientRevision:be().int().nonnegative(),basedOnServerRevision:be().int().nonnegative()})),reportSize:ie(P({height:be().nonnegative()}))}),$m=F({id:"web-editor",description:"Methods the editor exposes to the host (web-editor/0.12)."},{update:ie(zm),applyContentEdits:ie(P({edits:Ve(Vs),serverRevision:be().int().nonnegative(),acknowledgedClientRevision:be().int().nonnegative()})),getContentSchema:M(P({}),P({schema:Je}))}),Im=F({id:"web-editor-host-transport",description:"Optional messages the web editor sends to its host."},{message:ie(P({message:Je}))}),Em=F({id:"web-editor-client-transport",description:"Optional messages the web editor host sends to the editor."},{message:ie(P({message:Je}))}),Gt=P({registered:V(),isDefault:V()}),On=P({handleId:Y(),appId:Y(),serviceId:Y(),serviceIdPrefix:Y()}),Pm=On.extend({parentAppId:Y()}),$z=F({id:"vscode-app-host",description:"Methods an app `.vscode-app.html` exposes to the host (vscode-app-host/0.1)."},{getContext:M(P({}),P({dataDocument:P({contentType:Cn(["text","json"])}).nullable(),embedding:Pm.nullable()})),loadApp:M(P({path:Y()}),On).withStream({server:P({})}),unloadApp:M(P({handleId:Y()}),P({})),embeddedReady:ie(P({})),setModalVisibility:M(P({visible:V(),presentation:P({title:Y().optional()}).optional()}),P({})),getEditorRegistration:M(P({extension:Y()}),P({global:Gt,workspace:Gt,hasWorkspace:V()})),configureEditorAssociation:M(P({extension:Y(),dismissable:V().optional()}),P({global:Gt,workspace:Gt,hasWorkspace:V(),changed:V()}))}),Iz=F({id:"vscode-app-embedding-events",description:"Lifecycle notifications for child apps loaded by a VS Code app."},{changed:ie(On),removed:ie(P({handleId:Y()}))});function hs(e,t){let r=e;for(let n of t)if(n.kind==="replace")r=ms(r,n.path,n.newValue);else{let i=Tm(r,n.path);if(typeof i!="string")throw new Error(`applyContentEdits: stringEdits at path [${n.path.join(", ")}] requires a string, got ${typeof i}`);r=ms(r,n.path,Am(i,n.stringEdits))}return r}function Am(e,t){let r=e;for(let n of t)r=r.slice(0,n.offset)+n.newText+r.slice(n.offset+n.length);return r}function Tm(e,t){let r=e;for(let n of t){if(r==null)return;r=r[n]}return r}function ms(e,t,r){if(t.length===0)return r;let n=e===null||typeof e!="object"?{}:e,i=n;for(let o=0;o<t.length-1;o++){let s=t[o],a=i[s];(a===null||typeof a!="object")&&(i[s]={}),i=i[s]}return i[t[t.length-1]]=r,n}var ht=class{_listeners=new Set;event=e=>(this._listeners.add(e),{dispose:()=>this._listeners.delete(e)});fire(e){for(let t of this._listeners)try{t(e)}catch(r){console.error("Emitter listener threw:",r)}}dispose(){this._listeners.clear()}};function Mm(){return qt.create(new bn(window,window.parent))}function Cm(){return new vn(Mm())}function Om(e){return e==="windowParent"?Cm():e}var Ws=class Js{_connection;_host;_hostTransportProxy;_onError;_hostTransport;_content=void 0;_readOnly=!1;_options=void 0;_hostCapabilities;_pendingHostTransportMessages=[];_hostTransportActivated=!1;_clientRevision=0;_basedOnServerRevision=0;_pendingLocalEdits=0;_onDidChangeContent=new ht;onDidChangeContent=this._onDidChangeContent.event;_onDidApplyHostEdits=new ht;onDidApplyHostEdits=this._onDidApplyHostEdits.event;_onDidChangeReadOnly=new ht;onDidChangeReadOnly=this._onDidChangeReadOnly.event;_onDidChangeOptions=new ht;onDidChangeOptions=this._onDidChangeOptions.event;_onDidReceiveHostMessage=new ht;onDidConnect;static async connect(t){let r=new Js(t);return await r.onDidConnect,r}constructor(t){this._connection=Om(t.connection),this._onError=t.onError??((r,n)=>console.error("WebEditorClient:",r,n)),this._host=this._connection.get(Sm),this._hostTransportProxy=this._connection.get(Im),this._connection.register($m,{update:r=>this._handleUpdate(r),applyContentEdits:r=>this._handleApplyContentEdits(r),getContentSchema:async()=>({schema:t.getContentSchema?await t.getContentSchema():null})}),this._connection.register(Em,{message:({message:r})=>{this._hostTransportActivated?this._onDidReceiveHostMessage.fire(r):this._pendingHostTransportMessages.push(r)}}),this.onDidConnect=this._host.initialized({protocolVersion:"web-editor/0.12",contentType:t.contentType??"text",capabilities:t.capabilities}).then(r=>(this._hostCapabilities=r.capabilities,r.capabilities?.supportsHostTransport?this._hostTransport={onMessage:n=>{let i=this._onDidReceiveHostMessage.event(n);if(!this._hostTransportActivated){this._hostTransportActivated=!0;for(let o of this._pendingHostTransportMessages.splice(0))n(o)}return i},sendMessage:n=>this._hostTransportProxy.message({message:n})}:this._pendingHostTransportMessages.length=0,{capabilities:r.capabilities}))}get connection(){return this._connection}get hostTransport(){return this._hostTransport}getContent(){return this._content}getReadOnly(){return this._readOnly}getOptions(){return this._options}getHostCapabilities(){return this._hostCapabilities}applyEdits(t){if(t.length!==0){try{this._content=hs(this._content,t)}catch(r){this._onError("Failed to apply local edits",r);return}this._clientRevision++,this._pendingLocalEdits++,this._onDidChangeContent.fire({content:this._content,force:!1}),this._host.applyContentEdit({edits:t,clientRevision:this._clientRevision,basedOnServerRevision:this._basedOnServerRevision})}}reportSize(t){this._host.reportSize({height:t})}dispose(){this._onDidChangeContent.dispose(),this._onDidApplyHostEdits.dispose(),this._onDidChangeReadOnly.dispose(),this._onDidChangeOptions.dispose(),this._onDidReceiveHostMessage.dispose(),this._pendingHostTransportMessages.length=0,this._connection.close()}_handleUpdate(t){if(t.acknowledgedClientRevision!==void 0&&this._acknowledge(t.acknowledgedClientRevision),t.serverRevision!==void 0&&(this._basedOnServerRevision=t.serverRevision),t.readOnly!==void 0&&t.readOnly!==this._readOnly&&(this._readOnly=t.readOnly,this._onDidChangeReadOnly.fire({readOnly:t.readOnly})),t.options!==void 0&&(this._options=t.options,this._onDidChangeOptions.fire({options:t.options})),t.content!==void 0){if(this._pendingLocalEdits>0&&!t.force)return;this._content=t.content,this._onDidChangeContent.fire({content:t.content,force:t.force===!0})}}_handleApplyContentEdits(t){if(this._acknowledge(t.acknowledgedClientRevision),this._basedOnServerRevision=t.serverRevision,!(this._pendingLocalEdits>0)){try{this._content=hs(this._content,t.edits)}catch(r){this._onError("Failed to apply host edits",r);return}this._onDidApplyHostEdits.fire({edits:t.edits,content:this._content})}}_acknowledge(t){let r=Math.max(0,this._clientRevision-(this._clientRevision-t)),n=Math.max(0,this._clientRevision-r);this._pendingLocalEdits=n}};var Xe="comm",sr="rule",ar="decl";var Gs="@media",Xs="@import";var Ys="@supports";var Qs="@namespace",bt="@keyframes";var cr="@layer",ea="@scope";var Zn=Math.abs,wt=String.fromCharCode;function ur(e){return e.trim()}function Ye(e,t,r){return e.replace(t,r)}function ta(e,t,r){return e.indexOf(t,r)}function we(e,t){return e.charCodeAt(t)|0}function xe(e,t,r){return e.slice(t,r)}function ee(e){return e.length}function dr(e){return e.length}function Qe(e,t){return t.push(e),e}var lr=1,et=1,ra=0,se=0,j=0,rt="";function pr(e,t,r,n,i,o,s,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:lr,column:et,length:s,return:"",siblings:a}}function na(){return j}function ia(){return j=se>0?we(rt,--se):0,et--,j===10&&(et=1,lr--),j}function ae(){return j=se<ra?we(rt,se++):0,et++,j===10&&(et=1,lr++),j}function ke(){return we(rt,se)}function xt(){return se}function fr(e,t){return xe(rt,e,t)}function tt(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function oa(e){return lr=et=1,ra=ee(rt=e),se=0,[]}function sa(e){return rt="",e}function hr(e){return ur(fr(se-1,Rn(e===91?e+2:e===40?e+1:e)))}function aa(e){for(;(j=ke())&&j<33;)ae();return tt(e)>2||tt(j)>3?"":" "}function ca(e,t){for(;--t&&ae()&&!(j<48||j>102||j>57&&j<65||j>70&&j<97););return fr(e,xt()+(t<6&&ke()==32&&ae()==32))}function Rn(e){for(;ae();)switch(j){case e:return se;case 34:case 39:e!==34&&e!==39&&Rn(j);break;case 40:e===41&&Rn(e);break;case 92:ae();break}return se}function ua(e,t){for(;ae()&&e+j!==57;)if(e+j===84&&ke()===47)break;return"/*"+fr(t,se-1)+"*"+wt(e===47?e:ae())}function da(e){for(;!tt(ke());)ae();return fr(e,se)}function fa(e){return sa(mr("",null,null,null,[""],e=oa(e),0,[0],e))}function mr(e,t,r,n,i,o,s,a,c){for(var u=0,d=0,l=s,p=0,f=0,m=0,_=1,v=1,z=1,$=0,y="",w=i,T=o,L=n,I=y;v;)switch(m=$,$=ae()){case 40:if(m!=108&&we(I,l-1)==58){ta(I+=Ye(hr($),"&","&\f"),"&\f",Zn(u?a[u-1]:0))!=-1&&(z=-1);break}case 34:case 39:case 91:I+=hr($);break;case 9:case 10:case 13:case 32:I+=aa(m);break;case 92:I+=ca(xt()-1,7);continue;case 47:switch(ke()){case 42:case 47:Qe(Rm(ua(ae(),xt()),t,r,c),c),(tt(m||1)==5||tt(ke()||1)==5)&&ee(I)&&xe(I,-1,void 0)!==" "&&(I+=" ");break;default:I+="/"}break;case 123*_:a[u++]=ee(I)*z;case 125*_:case 59:case 0:switch($){case 0:case 125:v=0;case 59+d:z==-1&&(I=Ye(I,/\f/g,"")),f>0&&(ee(I)-l||_===0&&m===47)&&Qe(f>32?pa(I+";",n,r,l-1,c):pa(Ye(I," ","")+";",n,r,l-2,c),c);break;case 59:I+=";";default:if(Qe(L=la(I,t,r,u,d,i,a,y,w=[],T=[],l,o),o),$===123)if(d===0)mr(I,t,L,L,w,o,l,a,T);else{switch(p){case 99:if(we(I,3)===110)break;case 108:if(we(I,2)===97)break;default:d=0;case 100:case 109:case 115:}d?mr(e,L,L,n&&Qe(la(e,L,L,0,0,i,a,y,i,w=[],l,T),T),i,T,l,a,n?w:T):mr(I,L,L,L,[""],T,0,a,T)}}u=d=f=0,_=z=1,y=I="",l=s;break;case 58:l=1+ee(I),f=m;default:if(_<1){if($==123)--_;else if($==125&&_++==0&&ia()==125)continue}switch(I+=wt($),$*_){case 38:z=d>0?1:(I+="\f",-1);break;case 44:a[u++]=(ee(I)-1)*z,z=1;break;case 64:ke()===45&&(I+=hr(ae())),p=ke(),d=l=ee(y=I+=da(xt())),$++;break;case 45:m===45&&ee(I)==2&&(_=0)}}return o}function la(e,t,r,n,i,o,s,a,c,u,d,l){for(var p=i-1,f=i===0?o:[""],m=dr(f),_=0,v=0,z=0;_<n;++_)for(var $=0,y=xe(e,p+1,p=Zn(v=s[_])),w=e;$<m;++$)(w=ur(v>0?f[$]+" "+y:Ye(y,/&\f/g,f[$])))&&(c[z++]=w);return pr(e,t,r,i===0?sr:a,c,u,d,l)}function Rm(e,t,r,n){return pr(e,t,r,Xe,wt(na()),xe(e,2,-2),0,n)}function pa(e,t,r,n,i){return pr(e,t,r,ar,xe(e,0,n),xe(e,n+1,-1),n,i)}function gr(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function ha(e,t,r,n){switch(e.type){case cr:if(e.children.length)break;case Xs:case Qs:case ar:return e.return=e.return||e.value;case Xe:return"";case bt:return e.return=e.value+"{"+gr(e.children,n)+"}";case sr:if(!ee(e.value=e.props.join(",")))return""}return ee(r=gr(e.children,n))?e.return=e.value+"{"+r+"}":""}function ma(e){var t=dr(e);return function(r,n,i,o){for(var s="",a=0;a<t;a++)s+=e[a](r,n,i,o)||"";return s}}var ba="c4",Nm=h(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Dm=h(async()=>{let{diagram:e}=await import("./c4Diagram-XDPPPE54-KGFFMQ5R.js");return{id:ba,diagram:e}},"loader"),Lm={id:ba,detector:Nm,loader:Dm},jm=Lm,wa="flowchart-v2",Um=h(e=>/^\s*(graph|flowchart)/.test(e),"detector"),Fm=h(async()=>{let{diagram:e}=await import("./flowDiagram-IUGLLWBU-SUMUXOVU.js");return{id:wa,diagram:e}},"loader"),Km={id:wa,detector:Um,loader:Fm},Bm=Km,xa="agentflow",Hm=h(e=>/^\s*agentflow-beta\b/.test(e),"detector"),qm=h(async()=>{let{diagram:e}=await import("./diagram-TYUNFSNR-WF4FDPIW.js");return{id:xa,diagram:e}},"loader"),Vm={id:xa,detector:Hm,loader:qm},Wm=Vm,ka="swimlane",Jm=h(e=>/^\s*swimlane-beta\b/.test(e),"detector"),Gm=h(async()=>{let{diagram:e}=await import("./swimlanesDiagram-AYQRV4AK-SCLZIPKE.js");return{id:ka,diagram:e}},"loader"),Xm={id:ka,detector:Jm,loader:Gm},Ym=Xm,za="er",Qm=h(e=>/^\s*erDiagram/.test(e),"detector"),eg=h(async()=>{let{diagram:e}=await import("./erDiagram-KYQIGQAA-NWNKE3BT.js");return{id:za,diagram:e}},"loader"),tg={id:za,detector:Qm,loader:eg},rg=tg,Sa="gitGraph",ng=h(e=>/^\s*gitGraph/.test(e),"detector"),ig=h(async()=>{let{diagram:e}=await import("./gitGraphDiagram-PDYL7XHY-IQ2E2G4C.js");return{id:Sa,diagram:e}},"loader"),og={id:Sa,detector:ng,loader:ig},sg=og,$a="gantt",ag=h(e=>/^\s*gantt/.test(e),"detector"),cg=h(async()=>{let{diagram:e}=await import("./ganttDiagram-R7GPNTJY-I5CLHFXY.js");return{id:$a,diagram:e}},"loader"),ug={id:$a,detector:ag,loader:cg},dg=ug,Ia="info",lg=h(e=>/^\s*info/.test(e),"detector"),pg=h(async()=>{let{diagram:e}=await import("./infoDiagram-MVDRKAX5-UXPBPBGW.js");return{id:Ia,diagram:e}},"loader"),fg={id:Ia,detector:lg,loader:pg},Ea="pie",hg=h(e=>/^\s*pie/.test(e),"detector"),mg=h(async()=>{let{diagram:e}=await import("./pieDiagram-GNMPY74T-AKUQCNF4.js");return{id:Ea,diagram:e}},"loader"),gg={id:Ea,detector:hg,loader:mg},Pa="quadrantChart",_g=h(e=>/^\s*quadrantChart/.test(e),"detector"),yg=h(async()=>{let{diagram:e}=await import("./quadrantDiagram-D57K4MC3-J6FJJGFL.js");return{id:Pa,diagram:e}},"loader"),vg={id:Pa,detector:_g,loader:yg},bg=vg,Aa="xychart",wg=h(e=>/^\s*xychart(-beta)?/.test(e),"detector"),xg=h(async()=>{let{diagram:e}=await import("./xychartDiagram-4URNHDU4-MLRZGOGL.js");return{id:Aa,diagram:e}},"loader"),kg={id:Aa,detector:wg,loader:xg},zg=kg,Ta="requirement",Sg=h(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),$g=h(async()=>{let{diagram:e}=await import("./requirementDiagram-EQYSW5RA-3RJPJYI4.js");return{id:Ta,diagram:e}},"loader"),Ig={id:Ta,detector:Sg,loader:$g},Eg=Ig,Ma="sequence",Pg=h(e=>/^\s*sequenceDiagram/.test(e),"detector"),Ag=h(async()=>{let{diagram:e}=await import("./sequenceDiagram-BLEHNHQU-MWBVMWC6.js");return{id:Ma,diagram:e}},"loader"),Tg={id:Ma,detector:Pg,loader:Ag},Mg=Tg,Ca="classDiagram",Cg=h(e=>/^\s*classDiagram/.test(e),"detector"),Og=h(async()=>{let{diagram:e}=await import("./classDiagram-v2-4MYWR3UA-MWS3N4KM.js");return{id:Ca,diagram:e}},"loader"),Zg={id:Ca,detector:Cg,loader:Og},Rg=Zg,Oa="stateDiagram",Ng=h(e=>/^\s*stateDiagram/.test(e),"detector"),Dg=h(async()=>{let{diagram:e}=await import("./stateDiagram-v2-A6IESKWZ-XB43IHZF.js");return{id:Oa,diagram:e}},"loader"),Lg={id:Oa,detector:Ng,loader:Dg},jg=Lg,Za="journey",Ug=h(e=>/^\s*journey/.test(e),"detector"),Fg=h(async()=>{let{diagram:e}=await import("./journeyDiagram-BOSHW7O7-VLLUKAYH.js");return{id:Za,diagram:e}},"loader"),Kg={id:Za,detector:Ug,loader:Fg},Bg=Kg,_r=4,kt=75,Hg=h(e=>{let t=[];for(let i of e.split(/\s+/)){let o=[...i];for(;o.length>kt;)t.push(o.slice(0,kt).join("")),o=o.slice(kt);o.length>0&&t.push(o.join(""))}let r=[],n="";for(let i of t){let o=n?`${n} ${i}`:i;[...o].length>kt?(r.push(n),n=i):n=o}if(n&&r.push(n),r.length>_r){r.length=_r;let i=r[_r-1]??"";r[_r-1]=`${[...i].slice(0,kt-3).join("")}...`}return r},"wrapErrorMessage"),qg=h((e,t,r,n)=>{Z.debug(`rendering svg for syntax error
`);let i=ci(t),o=i.append("g"),s=Hg(n?.db.getErrorMessage?.()??""),a=s.length>0?500+s.length*56:512;i.attr("viewBox",`0 0 2412 ${a}`),si(i,100,a,!0),o.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),o.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),o.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),o.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),o.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),o.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),o.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),o.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`),s.forEach((c,u)=>{o.append("text").attr("class","error-text").attr("x",1440).attr("y",510+u*56).attr("font-size","42px").style("text-anchor","middle").text(c)})},"draw"),Ra={draw:qg},Vg=Ra,Nn,Wg={clear(){Nn=void 0},setErrorMessage(e){Nn=e},getErrorMessage(){return Nn}},Jg={db:Wg,renderer:Ra,parser:{parse:h(()=>{},"parse")}},Gg=Jg,Na="flowchart-elk",Xg=h((e,t={})=>/^\s*flowchart-elk/.test(e)?(t.layout="elk",!0):!1,"detector"),Yg=h(async()=>{let{diagram:e}=await import("./flowDiagram-IUGLLWBU-SUMUXOVU.js");return{id:Na,diagram:e}},"loader"),Qg={id:Na,detector:Xg,loader:Yg},e_=Qg,Da="timeline",t_=h(e=>/^\s*timeline/.test(e),"detector"),r_=h(async()=>{let{diagram:e}=await import("./timeline-definition-JXYKGLGB-VU3JOWYG.js");return{id:Da,diagram:e}},"loader"),n_={id:Da,detector:t_,loader:r_},i_=n_,La="mindmap",o_=h(e=>/^\s*mindmap/.test(e),"detector"),s_=h(async()=>{let{diagram:e}=await import("./mindmap-definition-6OY57UG3-S3HFJY4L.js");return{id:La,diagram:e}},"loader"),a_={id:La,detector:o_,loader:s_},c_=a_,ja="kanban",u_=h(e=>/^\s*kanban/.test(e),"detector"),d_=h(async()=>{let{diagram:e}=await import("./kanban-definition-FNSA4HC5-7BN44D62.js");return{id:ja,diagram:e}},"loader"),l_={id:ja,detector:u_,loader:d_},p_=l_,Ua="sankey",f_=h(e=>/^\s*sankey(-beta)?/.test(e),"detector"),h_=h(async()=>{let{diagram:e}=await import("./sankeyDiagram-SY24JHO5-UNPXLSAI.js");return{id:Ua,diagram:e}},"loader"),m_={id:Ua,detector:f_,loader:h_},g_=m_,Fa="packet",__=h(e=>/^\s*packet(-beta)?/.test(e),"detector"),y_=h(async()=>{let{diagram:e}=await import("./diagram-I5XIIV2D-N6NHFGI3.js");return{id:Fa,diagram:e}},"loader"),v_={id:Fa,detector:__,loader:y_},Ka="radar",b_=h(e=>/^\s*radar-beta/.test(e),"detector"),w_=h(async()=>{let{diagram:e}=await import("./diagram-RJA3I4VV-QGELK2KR.js");return{id:Ka,diagram:e}},"loader"),x_={id:Ka,detector:b_,loader:w_},Ba="block",k_=h(e=>/^\s*block(-beta)?/.test(e),"detector"),z_=h(async()=>{let{diagram:e}=await import("./blockDiagram-RJAE7QA3-ORASRAWT.js");return{id:Ba,diagram:e}},"loader"),S_={id:Ba,detector:k_,loader:z_},$_=S_,Ha="treeView",I_=h(e=>/^\s*treeView-beta/.test(e),"detector"),E_=h(async()=>{let{diagram:e}=await import("./diagram-ODIL2UCW-Q2V3JZ3H.js");return{id:Ha,diagram:e}},"loader"),P_={id:Ha,detector:I_,loader:E_},A_=P_,qa="architecture",T_=h(e=>/^\s*architecture/.test(e),"detector"),M_=h(async()=>{let{diagram:e}=await import("./architectureDiagram-ZHVYKT53-N2GZBKC5.js");return{id:qa,diagram:e}},"loader"),C_={id:qa,detector:T_,loader:M_},O_=C_,Va="eventmodeling",Z_=h(e=>/^\s*eventmodeling/.test(e),"detector"),R_=h(async()=>{let{diagram:e}=await import("./diagram-PFBEJUXE-Z63DQ7VX.js");return{id:Va,diagram:e}},"loader"),N_={id:Va,detector:Z_,loader:R_},D_=N_,Wa="ishikawa",L_=h(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),j_=h(async()=>{let{diagram:e}=await import("./ishikawaDiagram-HPEHV2GE-3EBW2GXK.js");return{id:Wa,diagram:e}},"loader"),U_={id:Wa,detector:L_,loader:j_},Ja="venn",F_=h(e=>/^\s*venn-beta/.test(e),"detector"),K_=h(async()=>{let{diagram:e}=await import("./vennDiagram-Q3Y3IDCW-VZX6G5DB.js");return{id:Ja,diagram:e}},"loader"),B_={id:Ja,detector:F_,loader:K_},H_=B_,Ga="treemap",q_=h(e=>/^\s*treemap/.test(e),"detector"),V_=h(async()=>{let{diagram:e}=await import("./diagram-CBK3MWTC-SH44ZLMS.js");return{id:Ga,diagram:e}},"loader"),W_={id:Ga,detector:q_,loader:V_},Xa="usecase",J_=h(e=>/^\s*usecase-beta(?:\s|$)/.test(e),"detector"),G_=h(async()=>{let{diagram:e}=await import("./usecaseDiagram-WPOLBNNX-XEBUM4BN.js");return{id:Xa,diagram:e}},"loader"),X_={id:Xa,detector:J_,loader:G_},Ya="wardley",Y_=h(e=>/^\s*wardley-beta/i.test(e),"detector"),Q_=h(async()=>{let{diagram:e}=await import("./wardleyDiagram-IVAIDKWA-CNCY6FUH.js");return{id:Ya,diagram:e}},"loader"),ey={id:Ya,detector:Y_,loader:Q_},ty=ey,Qa="cynefin",ry=h(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),ny=h(async()=>{let{diagram:e}=await import("./cynefinDiagram-WF24UDRP-URJVVPSD.js");return{id:Qa,diagram:e}},"loader"),iy={id:Qa,detector:ry,loader:ny},ec="railroad",oy=h(e=>/^\s*railroad-beta/i.test(e),"detector"),sy=h(async()=>{let{diagram:e}=await import("./railroadDiagram-Y72NRBL7-CVHEJJRD.js");return{id:ec,diagram:e}},"loader"),ay={id:ec,detector:oy,loader:sy},tc="railroadEbnf",cy=h(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),uy=h(async()=>{let{diagram:e}=await import("./ebnfDiagram-V4P3TTPT-AS63D4OQ.js");return{id:tc,diagram:e}},"loader"),dy={id:tc,detector:cy,loader:uy},rc="railroadAbnf",ly=h(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),py=h(async()=>{let{diagram:e}=await import("./abnfDiagram-WEYOIA3C-CZPIBGAL.js");return{id:rc,diagram:e}},"loader"),fy={id:rc,detector:ly,loader:py},nc="railroadPeg",hy=h(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),my=h(async()=>{let{diagram:e}=await import("./pegDiagram-ECIUJNBX-YWOAHIUG.js");return{id:nc,diagram:e}},"loader"),gy={id:nc,detector:hy,loader:my},ga=!1,br=h(()=>{ga||(ga=!0,st("error",Gg,e=>e.toLowerCase().trim()==="error"),st("---",{db:{clear:h(()=>{},"clear")},styles:{},renderer:{draw:h(()=>{},"draw")},parser:{parse:h(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:h(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),$t(e_,c_,O_),$t(Wm,jm,p_,Rg,rg,dg,fg,gg,Eg,Mg,Ym,Bm,i_,sg,jg,Bg,bg,g_,v_,zg,$_,D_,A_,x_,U_,W_,ay,dy,fy,gy,H_,ty,iy,X_))},"addDiagrams"),_y=h(async()=>{Z.debug("Loading registered diagrams");let t=(await Promise.allSettled(Object.entries(zt).map(async([r,{detector:n,loader:i}])=>{if(i)try{At(r)}catch{try{let{diagram:o,id:s}=await i();st(s,o,n)}catch(o){throw Z.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete zt[r],o}}}))).filter(r=>r.status==="rejected");if(t.length>0){Z.error(`Failed to load ${t.length} external diagrams`);for(let r of t)Z.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),yy="graphics-document document";function ic(e,t){e.attr("role",yy),t!==""&&e.attr("aria-roledescription",t)}h(ic,"setA11yDiagramInfo");function oc(e,t,r,n){if(e.insert!==void 0){if(r){let i=`chart-desc-${n}`;e.attr("aria-describedby",i),e.insert("desc",":first-child").attr("id",i).text(r)}if(t){let i=`chart-title-${n}`;e.attr("aria-labelledby",i),e.insert("title",":first-child").attr("id",i).text(t)}}}h(oc,"addSVGa11yTitleDescription");var yr=class sc{constructor(t,r,n,i,o){this.type=t,this.text=r,this.db=n,this.parser=i,this.renderer=o}static{h(this,"Diagram")}static async fromText(t,r={}){let n=typeof t=="string"?{raw:t,cleaned:t}:t,i=Ae(),o=St(n.cleaned,i);try{At(o)}catch{let p=Jn(o);if(!p)throw new Wn(`Diagram ${o} not found.`);let{id:f,diagram:m}=await p();st(f,m)}let{db:s,parser:a,renderer:c,init:u}=At(o);a.parser&&(a.parser.yy=s),s.clear?.(),u?.(i),r.title&&s.setDiagramTitle?.(r.title);let d=n.cleaned;if(s.preserveCommentsWhenParsing&&n.withComments){let p=i.maxTextSize??Xn.maxTextSize;n.withComments.length>p?Z.warn(`Comment-preserving source exceeds maxTextSize (${n.withComments.length} > ${p}); parsing the comment-stripped text instead. Reported source positions will not account for comment lines.`):d=n.withComments}let l=mi(d)+`
`;return n.frontmatterLineOffset&&s.setFrontmatterLineOffset?.(n.frontmatterLineOffset),await a.parse(l),new sc(o,l,s,a,c)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},_a=[],vy=h(()=>{_a.forEach(e=>{e()}),_a=[]},"attachFunctions"),by=h(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function ac(e){let t=Vn(e);if(!t)return{text:e,metadata:{}};let r=t.indent,n=r?t.body.split(`
`).map(s=>s.startsWith(r)?s.slice(r.length):s).join(`
`):t.body,i=di(n,{schema:ui})??{};i=typeof i=="object"&&!Array.isArray(i)?i:{};let o={};return i.displayMode&&(o.displayMode=i.displayMode.toString()),i.title&&(o.title=i.title.toString()),i.config&&(o.config=i.config),{text:e.slice(t.length),metadata:o}}h(ac,"extractFrontMatter");var wy=h(e=>e.replace(/\r\n?/g,`
`).replace(/<(\w+)([^>]*)>/g,(t,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),xy=h(e=>{let{text:t,metadata:r}=ac(e),{displayMode:n,title:i,config:o={}}=r;return n&&(o.gantt||(o.gantt={}),o.gantt.displayMode=n),{title:i,config:o,text:t}},"processFrontmatter"),ky=h(e=>{let t=Ue.detectInit(e)??{},r=Ue.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:n})=>n==="wrap"):r?.type==="wrap"&&(t.wrap=!0),{text:pi(e),directive:t}},"processDirectives");function jn(e){let t=e,r=wy(e),n=xy(r),i=ky(n.text),o=hi(n.config,i.directive),s=i.text,a=by(s),c=r.length>n.text.length?(r.substring(0,r.length-n.text.length).match(/\n/g)??[]).length:0;return{code:{raw:t,cleaned:a,withComments:s,frontmatterLineOffset:c},title:n.title,config:o}}h(jn,"preprocessDiagram");function cc(e){let t=new TextEncoder().encode(e),r=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(r)}h(cc,"toBase64");var zy=5e4,Sy="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",$y="sandbox",Iy="loose",Ey="http://www.w3.org/2000/svg",Py="http://www.w3.org/1999/xlink",Ay="http://www.w3.org/1999/xhtml",Ty="100%",My="100%",Cy="border:0;margin:0;",Oy="margin:0",Zy="allow-top-navigation-by-user-activation allow-popups",Ry='The "iframe" tag is not supported by your browser.',Ny=["foreignobject"],Dy=["dominant-baseline"];function Un(e){let t=jn(e);ot();let r;try{r=St(t.code.cleaned,Ae())}catch{r=void 0}return Pt(r),ii(t.config??{}),t}h(Un,"processAndSetConfigs");async function uc(e,t){br();try{let{code:r,config:n}=Un(e);return{diagramType:(await yr.fromText(r)).type,config:n}}catch(r){if(t?.suppressErrors)return!1;throw r}finally{Pt(void 0)}}h(uc,"parse");var ya=h((e,t,r=[])=>{let n=Yn(`{ ${r.join(" !important; ")} !important; }`);return`.${e} ${t} ${n}`},"cssImportantStyles"),Ly=h((e,t=new Map)=>{let r=new CSSStyleSheet;if(e.fontFamily!==void 0&&r.insertRule(`:root { --mermaid-font-family: ${e.fontFamily}}`,r.cssRules.length),e.altFontFamily!==void 0&&r.insertRule(`:root { --mermaid-alt-font-family: ${e.altFontFamily}}`,r.cssRules.length),t instanceof Map){let a=oi(e)?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(c=>{Tr(c.styles)||a.forEach(u=>{r.insertRule(ya(c.id,u,c.styles),r.cssRules.length)}),Tr(c.textStyles)||r.insertRule(ya(c.id,"tspan",(c?.textStyles||[]).map(u=>u.replace("color","fill"))),r.cssRules.length)})}let n="";if(e.themeCSS!==void 0)if(typeof r.replaceSync=="function"){let i=new CSSStyleSheet;i.replaceSync(e.themeCSS),n=Ar(i)+`
`}else n+=`${e.themeCSS}
`;return n+Ar(r)},"createCssStyles"),jy=h((e,t)=>gr(fa(`${e}{${t}}`),ma([h(function(n,i,o,s){if(n.type==="rule"&&Array.isArray(n.props)){if(n.parent&&n.parent.type===bt)return;n.props=n.props.map(a=>a===e&&Array.isArray(n.children)&&n.children.every(u=>u.type!=="decl"?!1:new Set(["font-family","font-size","fill"]).has(u.props))||(a.startsWith(`${e} `)||a.startsWith(`${e}>`))&&!a.startsWith(`${e} ||`)?a:`${e} ${a}`)}else n.type.startsWith("@")&&([...[Gs,Ys,cr,ea,"@container","@starting-style"],bt].includes(n.type)||(Z.warn(`Removing unsupported at-rule ${n.type} from CSS`),n.type=Xe))},"addNamespace"),ha])),"compileCSS"),Uy=h((e,t,r,n)=>{let i=Ly(e,r),o=ai(t,i,{...e.themeVariables,theme:e.theme,look:e.look},n);return jy(n,o)},"createUserStyles"),Fy=h((e="",t,r)=>{let n=e;return!r&&!t&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=gi(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),Ky=h((e="",t)=>{let r=t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+"px":My,n=cc(`<body style="${Oy}">${e}</body>`);return`<iframe style="width:${Ty};height:${r};${Cy}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${Zy}">
${Ry}
</iframe>`},"putIntoIFrame"),va=h((e,t,r,n,i)=>{let o=e.append("div");o.attr("id",r),n&&o.attr("style",n);let s=o.append("svg").attr("id",t).attr("width","100%").attr("xmlns",Ey);return i&&s.attr("xmlns:xlink",i),s.append("g"),e},"appendDivSvgG");function Ln(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}h(Ln,"sandboxedIframe");var By=h((e,t,r,n)=>{e.getElementById(t)?.remove(),e.getElementById(r)?.remove(),e.getElementById(n)?.remove()},"removeExistingElements"),Hy=h(async function(e,t,r){br();let n=Un(t),i=n.code;t=i.cleaned;let o=Ae();Z.debug(o),t.length>(o?.maxTextSize??zy)&&(t=Sy,i={raw:t,cleaned:t});let s=`#${e}`,a="i"+e,c="#"+a,u="d"+e,d="#"+u,l=h(()=>{let it=pe(f?c:d).node();it&&"remove"in it&&it.remove()},"removeTempElements"),p=pe(document.body),f=o.securityLevel===$y,m=o.securityLevel===Iy,_=o.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),f){let U=Ln(pe(r),a);p=pe(U.nodes()[0].contentDocument.body),p.node().style.margin="0"}else p=pe(r);va(p,e,u,`font-family: ${_}`,Py)}else{if(By(document,e,u,a),f){let U=Ln(pe(document.body),a);p=pe(U.nodes()[0].contentDocument.body),p.node().style.margin="0"}else p=pe("body");va(p,e,u)}let v,z;try{v=await yr.fromText(i,{title:n.title})}catch(U){if(o.suppressErrorRendering)throw l(),U;v=await yr.fromText("error"),z=U,v.db.setErrorMessage?.(fi(U))}let $=p.select(d).node(),y=v.type,w=$.firstChild,T=w.firstChild,L=v.renderer.getClasses?.(t,v),I=Uy(o,y,L,s),Hn=document.createElement("style");Hn.innerHTML=I,w.insertBefore(Hn,T);try{await v.renderer.draw(t,e,"12.2.0",v)}catch(U){throw o.suppressErrorRendering?l():Vg.draw(t,e,"12.2.0"),U}let Kc=p.select(`${d} svg`),Bc=v.db.getAccTitle?.(),Hc=v.db.getAccDescription?.();lc(y,Kc,Bc,Hc);let qc=h(()=>{p.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns",Ay);let U=p.select(d).node().innerHTML;if(Z.debug("config.arrowMarkerAbsolute",o.arrowMarkerAbsolute),U=Fy(U,f,Qn(o.arrowMarkerAbsolute)),f){let it=p.select(d+" svg").node();U=Ky(U,it)}else m||(U=qn.sanitize(U,{ADD_TAGS:Ny,ADD_ATTR:Dy,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));return vy(),U},"serializeSvg")();if(z)throw z;return l(),{diagramType:y,svg:qc,bindFunctions:v.db.bindFunctions}},"renderDiagram"),qy=h(async function(e,t,r){try{return await Hy(e,t,r)}finally{Pt(void 0)}},"render");function dc(e={}){let t=Gn({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),ti(t);let r=Et.theme;t?.theme&&Object.hasOwn(It,t.theme)?t.themeVariables=It[t.theme].getThemeVariables(t.themeVariables):t&&(t.theme!=null&&t.theme!=="null"&&(t.theme=r),t.themeVariables=It[r].getThemeVariables(t.themeVariables));let n=typeof t=="object"?ei(t):Pr();Er(n.logLevel),br()}h(dc,"initialize");var Vy=h((e,t={})=>{let{code:r}=jn(e);return yr.fromText(r,t)},"getDiagramFromText");function lc(e,t,r,n){ic(t,e),oc(t,r,n,t.attr("id"))}h(lc,"addA11yInfo");var je=Object.freeze({render:qy,parse:uc,getDiagramFromText:Vy,initialize:dc,getConfig:Ae,setConfig:ni,getSiteConfig:Pr,updateSiteConfig:ri,reset:h(()=>{ot()},"reset"),globalReset:h(()=>{ot(Et)},"globalReset"),defaultConfig:Et});Er(Ae().logLevel);ot(Ae());var Wy=h((e,t,r)=>{Z.warn(e),Mr(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),pc=h(async function(e={querySelector:".mermaid"}){try{await Jy(e)}catch(t){if(Mr(t)&&Z.error(t.str),ze.parseError&&ze.parseError(t),!e.suppressErrors)throw Z.error("Use the suppressErrors option to suppress these errors"),t}},"run"),Jy=h(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){let n=je.getConfig();Z.debug(`${e?"":"No "}Callback function found`);let i;if(r)i=r;else if(t)i=document.querySelectorAll(t);else throw new Error("Nodes and querySelector are both undefined");Z.debug(`Found ${i.length} diagrams`),n?.startOnLoad!==void 0&&(Z.debug("Start On Load: "+n?.startOnLoad),je.updateSiteConfig({startOnLoad:n?.startOnLoad}));let o=new Ue.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed),s,a=[];for(let c of Array.from(i)){if(Z.info("Rendering diagram: "+c.id),c.getAttribute("data-processed"))continue;c.setAttribute("data-processed","true");let u=`mermaid-${o.next()}`;s=c.innerHTML,s=_i(Ue.entityDecode(s)).trim().replace(/<br\s*\/?>/gi,"<br/>");let d=Ue.detectInit(s);d&&Z.debug("Detected early reinit: ",d);try{let{svg:l,bindFunctions:p}=await gc(u,s,c);c.innerHTML=l,e&&await e(u),p&&p(c)}catch(l){Wy(l,a,ze.parseError)}}if(a.length>0)throw a[0]},"runThrowsErrors"),fc=h(function(e){je.initialize(e)},"initialize"),Gy=h(async function(e,t,r){Z.warn("mermaid.init is deprecated. Please use run instead."),e&&fc(e);let n={postRenderCallback:r,querySelector:".mermaid"};typeof t=="string"?n.querySelector=t:t&&(t instanceof HTMLElement?n.nodes=[t]:n.nodes=t),await pc(n)},"init"),Xy=h(async(e,{lazyLoad:t=!0}={})=>{br(),$t(...e),t===!1&&await _y()},"registerExternalDiagrams"),hc=h(function(){if(ze.startOnLoad){let{startOnLoad:e}=je.getConfig();e&&ze.run().catch(t=>Z.error("Mermaid failed to initialize",t))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",hc,!1);var Yy=h(function(e){ze.parseError=e},"setParseErrorHandler"),vr=[],Dn=!1,mc=h(async()=>{if(!Dn){for(Dn=!0;vr.length>0;){let e=vr.shift();if(e)try{await e()}catch(t){Z.error("Error executing queue",t)}}Dn=!1}},"executeQueue"),Qy=h(async(e,t)=>new Promise((r,n)=>{let i=h(()=>new Promise((o,s)=>{je.parse(e,t).then(a=>{o(a),r(a)},a=>{Z.error("Error parsing",a),ze.parseError?.(a),s(a),n(a)})}),"performCall");vr.push(i),mc().catch(n)}),"parse"),gc=h((e,t,r)=>new Promise((n,i)=>{let o=h(()=>new Promise((s,a)=>{je.render(e,t,r).then(c=>{s(c),n(c)},c=>{Z.error("Error parsing",c),ze.parseError?.(c),a(c),i(c)})}),"performCall");vr.push(o),mc().catch(i)}),"render"),ev=h(()=>Object.keys(zt).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),ze={startOnLoad:!0,mermaidAPI:je,parse:Qy,render:gc,init:Gy,run:pc,registerExternalDiagrams:Xy,registerLayoutLoaders:yi,initialize:fc,parseError:void 0,contentLoaded:hc,setParseErrorHandler:Yy,detectType:St,registerIconPacks:li,getRegisteredDiagramsMetadata:ev},Pe=ze;var tv=vi(async()=>await import("./render-DLZURBVE-4INQB6QO.js"),"loader"),rv=[{name:"tidy-tree",loader:tv,algorithm:"tidy-tree"}],_c=rv;var yc="zenuml",nv=Cr(e=>/^\s*zenuml/.test(e),"detector"),iv=Cr(async()=>{let{diagram:e}=await import("./zenuml-definition-ZCSB3OVJ-ZJFOOP7P.js");return{id:yc,diagram:e}},"loader"),ov={id:yc,detector:nv,loader:iv},vc=ov;var bc=[{name:"logos",loader:()=>import("./logos-GMUM7UL2.js").then(e=>e.icons)},{name:"mdi",loader:()=>import("./mdi-GEDS67HN.js").then(e=>e.icons)}];var Ec={top:8,bottom:8},xr=12,wc=4,xc=8,ce=4,kc=20,kr=2,sv=20,zc=8,Sc="http://www.w3.org/2000/svg";function Pc(e){let t=e.querySelector("svg");t&&av(t)}function av(e){if(!/^(flowchart|class)/.test(e.getAttribute("aria-roledescription")??""))return!1;let t=cv(e);if(!t.length)return!1;let r=gv(e),n=uv(e,t,r.endpoints),i=[];for(let{label:o,origin:s,labelPosition:a,title:c,box:u}of t){let d=s.y+a.y,l=hv(r,d,d+c.height),{x:p,clear:f}=fv({start:u.left,end:u.right},c.width,l);if(!f){let m=r.arrowheads.filter(_=>_.left<p+c.width+ce&&_.right>p-ce&&_.bottom>d);d=Math.max(u.top,Math.min(d,...m.map(_=>_.top-c.height))),i.push({left:p-ce,top:d+kr,right:p+c.width+ce,bottom:d+c.height-kr})}(Math.abs(p-s.x-a.x)>.01||Math.abs(d-s.y-a.y)>.01)&&(o.setAttribute("transform",`translate(${p-s.x}, ${d-s.y})`),n=!0)}return pv(e,i,r.arrowheads)||n}function cv(e){let t=[];for(let r of e.querySelectorAll("g.cluster")){let n=r.querySelectorAll(":scope > rect"),i=r.querySelector(":scope > g.cluster-label"),o=zr(r,e),s=Mc(i?.getAttribute("transform"));if(n.length!==1||n[0].hasAttribute("transform")||!i||!o||!s)continue;let a=Tc(n[0]),c=a&&yv(i,a,s);if(a&&c){let u={left:o.x+a.left,top:o.y+a.top,right:o.x+a.right,bottom:o.y+a.bottom};t.push({rect:n[0],label:i,origin:o,labelPosition:s,title:c,drawn:u,box:u})}}return t}function uv(e,t,r){let n=new Map(t.map(a=>[a,dv(a,t)])),i=a=>a.bottom-a.top,o=({drawn:a})=>r.some(({x:c,y:u})=>u>=a.top-1&&u<=a.bottom+1&&(c>=a.left-kc&&c<=a.left+1||c>=a.right-1&&c<=a.right+kc));for(let a of[...t].sort((c,u)=>i(c.drawn)-i(u.drawn))){if(o(a))continue;let{left:c,right:u}=a.box,d=a.title.width+2*xr-(u-c);d>0&&(c-=d/2,u+=d/2);for(let[l,p]of n)p===a&&(c=Math.min(c,l.box.left-wr(l.drawn.left-a.drawn.left)),u=Math.max(u,l.box.right+wr(a.drawn.right-l.drawn.right)));a.box={...a.box,left:c,right:u}}for(let a of[...t].sort((c,u)=>i(u.drawn)-i(c.drawn))){let c=n.get(a);if(c){let u=Math.min(a.drawn.left,Math.max(a.box.left,c.box.left+wr(a.drawn.left-c.drawn.left))),d=Math.max(a.drawn.right,Math.min(a.box.right,c.box.right-wr(c.drawn.right-a.drawn.right)));a.box={...a.box,left:u,right:d}}}let s=t.filter(({box:a,drawn:c})=>a.left<c.left||a.right>c.right);for(let{rect:a,origin:c,box:u}of s)a.setAttribute("x",String(u.left-c.x)),a.setAttribute("width",String(u.right-u.left));return lv(e,s.map(a=>a.box)),s.length>0}function dv(e,t){let{left:r,top:n,right:i,bottom:o}=e.drawn,s=(r+i)/2,a;for(let c of t){let u=c.drawn;u.top<=n&&u.bottom>=o&&u.bottom-u.top>o-n&&u.left<s&&s<u.right&&(!a||u.bottom-u.top<a.drawn.bottom-a.drawn.top)&&(a=c)}return a}function wr(e){return e<0?xr:Math.min(e,xr)}function lv(e,t){let r=Fn(e);if(!t.length||!r)return;let{x:n,y:i,width:o,height:s}=r,a=Math.min(n,...t.map(p=>p.left-xc)),c=Math.max(n+o,...t.map(p=>p.right+xc)),u=c-a-o;if(u<=0)return;e.setAttribute("viewBox",`${a} ${i} ${c-a} ${s}`);let d=parseFloat(e.style.maxWidth);Number.isFinite(d)&&(e.style.maxWidth=`${d+u}px`);let l=e.getAttribute("width");l&&!l.endsWith("%")&&Number.isFinite(parseFloat(l))&&e.setAttribute("width",String(parseFloat(l)+u))}function Fn(e){let t=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(parseFloat);if(t?.length!==4||!t.every(Number.isFinite))return;let[r,n,i,o]=t;return{x:r,y:n,width:i,height:o}}function pv(e,t,r){let n=Fn(e);if(!t.length||!n||!/^[\w-]+$/.test(e.id))return!1;let i={left:n.x-n.width,top:n.y-n.height,right:n.x+2*n.width,bottom:n.y+2*n.height},o=r.filter(a=>t.some(c=>a.left<c.right&&a.right>c.left&&a.top<c.bottom&&a.bottom>c.top)),s=!1;return e.querySelectorAll(".edgePaths").forEach((a,c)=>{let u=zr(a,e);if(!u||a.hasAttribute("clip-path"))return;let d=({left:m,top:_,right:v,bottom:z})=>`M${m-u.x},${_-u.y}H${v-u.x}V${z-u.y}H${m-u.x}Z`,l=({left:m,top:_,right:v,bottom:z})=>`M${m-u.x},${_-u.y}V${z-u.y}H${v-u.x}V${_-u.y}Z`,p=e.ownerDocument.createElementNS(Sc,"path");p.setAttribute("d",[d(i),...t.map(l),...o.map(d)].join(""));let f=e.ownerDocument.createElementNS(Sc,"clipPath");f.id=`${e.id}-subgraph-titles-${c}`,f.append(p),a.before(f),a.setAttribute("clip-path",`url(#${f.id})`),s=!0}),s}function fv(e,t,r){let n=(e.start+e.end-t)/2,i=Math.max(0,Math.min(xr,n-e.start)),o=e.start+i,s=e.end-i-t,a=f=>Math.max(0,...r.map(m=>Math.min(m.end-f+ce,f+t+ce-m.start)));for(let f of[n,o,s])if(a(f)<=0)return{x:f,clear:!0};let c=[],u=e.start+Math.min(wc,i),d=e.end-Math.min(wc,i)-t;for(let f of[...r].sort((m,_)=>m.start-_.start))c.push({start:u,end:Math.min(d,f.start-ce-t)}),u=Math.max(u,f.end+ce);c.push({start:u,end:d});let l;for(let f of c.filter(m=>m.start<=m.end)){let m=Math.min(Math.max(o,f.start),f.end);(l===void 0||Math.abs(m-o)<Math.abs(l-o))&&(l=m)}if(l!==void 0)return{x:l,clear:!0};let p=o;for(let f of[n,s])a(f)<a(p)-.5&&(p=f);return{x:p,clear:!1}}function hv(e,t,r){let n=[];for(let i of e.edges)for(let o=1;o<i.length;o++){let s=mv(i[o-1],i[o],t-ce,r+ce);s&&n.push(s)}for(let i of e.labels)i.top<r+ce&&i.bottom>t-ce&&n.push({start:i.left,end:i.right});for(let i of e.arrowheads)i.top<r-kr&&i.bottom>t+kr&&n.push({start:i.left,end:i.right});return n}function mv(e,t,r,n){if(e.y<r&&t.y<r||e.y>n&&t.y>n)return;let i=a=>e.x+(t.x-e.x)*(a-e.y)/(t.y-e.y),o=e.y<r?i(r):e.y>n?i(n):e.x,s=t.y<r?i(r):t.y>n?i(n):t.x;return{start:Math.min(o,s),end:Math.max(o,s)}}function gv(e){let t=[],r=[],n=[];for(let o of e.querySelectorAll(".edgePaths path")){let s=zr(o,e),a=o.getAttribute("d"),c=s&&a?Ac(a,s):[];t.push(...c);let u=c[0],d=c[c.length-1];u&&d&&n.push(u[0],d[d.length-1]);let l=u&&Ic(e,o,"marker-start",u[0],$c(u[0],u.slice(1))),p=d&&Ic(e,o,"marker-end",d[d.length-1],$c(d[d.length-1],d.slice(0,-1).reverse(),-1));r.push(...[l,p].filter(f=>f!==void 0))}let i=[];for(let o of e.querySelectorAll(".edgeLabel foreignObject, .edgeLabel rect.background")){let s=zr(o,e),a=Tc(o);s&&a&&a.right>a.left&&a.bottom>a.top&&i.push({left:s.x+a.left,top:s.y+a.top,right:s.x+a.right,bottom:s.y+a.bottom})}return{edges:t,labels:i,arrowheads:r,endpoints:n}}function $c(e,t,r=1){for(let n of t){let i=Math.hypot(n.x-e.x,n.y-e.y);if(i>.01)return{x:r*(n.x-e.x)/i,y:r*(n.y-e.y)/i}}}function Ic(e,t,r,n,i){let o=t.getAttribute(r)?.match(/^url\(#(?<id>[\w-]+)\)$/)?.groups?.id,s=o?e.querySelector(`marker[id="${o}"]`):null,a=s&&_v(s);if(!s||!a||!i)return;let c=Fn(s),u=re(s,"markerWidth")??3,d=re(s,"markerHeight")??3,l=c&&c.width>0&&c.height>0?Math.min(u/c.width,d/c.height):1,p=re(s,"refX")??0,f=re(s,"refY")??0,m=s.getAttribute("orient")??"0",_=m==="auto"?Math.atan2(i.y,i.x):m==="auto-start-reverse"?Math.atan2(i.y,i.x)+(r==="marker-start"?Math.PI:0):(parseFloat(m)||0)*Math.PI/180,v=[],z=[];for(let $ of[a.left,a.right])for(let y of[a.top,a.bottom]){let w=($-p)*l,T=(y-f)*l;v.push(n.x+w*Math.cos(_)-T*Math.sin(_)),z.push(n.y+w*Math.sin(_)+T*Math.cos(_))}return{left:Math.min(...v),top:Math.min(...z),right:Math.max(...v),bottom:Math.max(...z)}}function _v(e){let t=[];for(let n of e.querySelectorAll("path, polygon, polyline, circle"))if(n.localName==="path")t.push(...Ac(n.getAttribute("d")??"",{x:0,y:0}).flat());else if(n.localName==="circle"){let i=re(n,"cx")??0,o=re(n,"cy")??0,s=re(n,"r")??0;t.push({x:i-s,y:o-s},{x:i+s,y:o+s})}else{let i=(n.getAttribute("points")??"").trim().split(/[\s,]+/).map(parseFloat);for(let o=0;o+1<i.length;o+=2)t.push({x:i[o],y:i[o+1]})}let r=t.filter(n=>Number.isFinite(n.x)&&Number.isFinite(n.y));if(r.length)return{left:Math.min(...r.map(n=>n.x)),top:Math.min(...r.map(n=>n.y)),right:Math.max(...r.map(n=>n.x)),bottom:Math.max(...r.map(n=>n.y))}}function Ac(e,t){let r=e.match(/[a-z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi)??[],n=[],i=[],o={x:0,y:0},s=o,a="",c=0,u=m=>m!==void 0&&!/^[a-z]$/i.test(m),d=m=>{let _=parseFloat(r[c++]),v=parseFloat(r[c++]);return{x:m.x+_,y:m.y+v}},l=m=>{i.push({x:t.x+m.x,y:t.y+m.y}),o=m},p=(m,_,v)=>{let z=o;for(let $=1;$<=zc;$++){let y=$/zc,w=1-y;l({x:w*w*w*z.x+3*w*w*y*m.x+3*w*y*y*_.x+y*y*y*v.x,y:w*w*w*z.y+3*w*w*y*m.y+3*w*y*y*_.y+y*y*y*v.y})}},f=(m,_)=>{let v=o;p({x:v.x+2/3*(m.x-v.x),y:v.y+2/3*(m.y-v.y)},{x:_.x+2/3*(m.x-_.x),y:_.y+2/3*(m.y-_.y)},_)};for(;c<r.length;){u(r[c])||(a=r[c++]);let m=a===a.toLowerCase()?o:{x:0,y:0};switch(a.toUpperCase()){case"M":i.length>1&&n.push(i),i=[],l(d(m)),s=o,a=a==="M"?"L":"l";break;case"L":l(d(m));break;case"H":l({x:m.x+parseFloat(r[c++]),y:o.y});break;case"V":l({x:o.x,y:m.y+parseFloat(r[c++])});break;case"C":p(d(m),d(m),d(m));break;case"S":p(o,d(m),d(m));break;case"Q":f(d(m),d(m));break;case"T":l(d(m));break;case"A":c+=5,l(d(m));break;case"Z":l(s),a="";break;default:c=r.length;break}}return i.length>1&&n.push(i),n.filter(m=>m.every(_=>Number.isFinite(_.x)&&Number.isFinite(_.y)))}function yv(e,t,r){let n=e.querySelector("foreignObject");if(n){let s=re(n,"width"),a=re(n,"height");return s&&a&&s>0&&a>0?{width:s,height:a}:void 0}let i=2*((t.left+t.right)/2-r.x),o=Math.max(1,e.querySelectorAll(".text-outer-tspan").length);return i>0?{width:i,height:o*sv}:void 0}function Tc(e){let t=re(e,"x")??0,r=re(e,"y")??0,n=re(e,"width"),i=re(e,"height");if(!(n===void 0||i===void 0))return{left:t,top:r,right:t+n,bottom:r+i}}function re(e,t){let r=parseFloat(e.getAttribute(t)??"");return Number.isFinite(r)?r:void 0}function zr(e,t){let r=0,n=0;for(let i=e;i&&i!==t;i=i.parentElement){let o=i.getAttribute("transform");if(o){let s=Mc(o);if(!s)return;r+=s.x,n+=s.y}}return{x:r,y:n}}function Mc(e){let t=e?.match(/^\s*translate\(\s*(?<x>[-+.\de]+)(?:\s*,?\s*(?<y>[-+.\de]+))?\s*\)\s*$/i);if(!t?.groups)return;let r=parseFloat(t.groups.x),n=parseFloat(t.groups.y??"0");return Number.isFinite(r)&&Number.isFinite(n)?{x:r,y:n}:void 0}var $r="vscode";function Oc(){return document.body.classList.contains("vscode-dark")||document.body.classList.contains("vscode-high-contrast")&&!document.body.classList.contains("vscode-high-contrast-light")}function vv(e){let t=document.createElement("span");t.style.display="none",t.style.color=e,document.body.appendChild(t);try{return bv(getComputedStyle(t).color)}finally{t.remove()}}function bv(e){let t=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)$/);if(!t)return;let r=parseInt(t[1],10),n=parseInt(t[2],10),i=parseInt(t[3],10),o=t[4]!==void 0?Math.round(parseFloat(t[4])*255):255,s=a=>Math.max(0,Math.min(255,a)).toString(16).padStart(2,"0");return o<255?`#${s(r)}${s(n)}${s(i)}${s(o)}`:`#${s(r)}${s(n)}${s(i)}`}function wv(...e){for(let t of e){if(!Kn(t))continue;let r=vv(`var(${t})`);if(r)return r}}function Kn(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}var Sr=class{_value;_listeners=new Set;get value(){return this._value??=Cc()}refresh(){let t=Cc();if(t.fingerprint===this._value?.fingerprint)return!1;this._value=t;for(let r of this._listeners)r();return!0}invalidate(){this._value=void 0}onDidChange(t){return this._listeners.add(t),{dispose:()=>this._listeners.delete(t)}}resolveMermaidTheme(t){let r=Oc()?t.darkModeTheme:t.lightModeTheme;return r===$r?{theme:"base",themeVariables:this.value.variables}:{theme:r,themeVariables:{}}}observeDomChanges(){let t=new MutationObserver(()=>this.refresh());return t.observe(document.body,{attributes:!0,attributeFilter:["class","data-vscode-theme-id","data-vscode-theme-kind"]}),t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),{dispose:()=>t.disconnect()}}};function Cc(){let e={darkMode:Oc()},t=(o,...s)=>{let a=wv(...s);a&&(e[o]=a)};t("background","--vscode-editor-background"),t("textColor","--vscode-charts-foreground","--vscode-editor-foreground","--vscode-foreground"),t("lineColor","--vscode-chart-line","--vscode-charts-lines","--vscode-editor-foreground","--vscode-foreground"),t("primaryColor","--vscode-editorWidget-background"),t("primaryTextColor","--vscode-charts-foreground","--vscode-editor-foreground","--vscode-foreground"),t("primaryBorderColor","--vscode-chart-line","--vscode-editorWidget-border","--vscode-focusBorder"),t("mainBkg","--vscode-editorWidget-background"),t("nodeBorder","--vscode-chart-line","--vscode-editorWidget-border","--vscode-focusBorder"),t("secondaryColor","--vscode-input-background","--vscode-editorWidget-background"),t("secondaryTextColor","--vscode-input-foreground","--vscode-foreground"),t("secondaryBorderColor","--vscode-input-border","--vscode-editorWidget-border"),t("tertiaryColor","--vscode-textBlockQuote-background","--vscode-input-background"),t("tertiaryTextColor","--vscode-foreground"),t("tertiaryBorderColor","--vscode-textBlockQuote-border","--vscode-editorWidget-border"),t("clusterBkg","--vscode-editor-background"),t("clusterBorder","--vscode-chart-guide","--vscode-editorWidget-border"),t("noteBkgColor","--vscode-textBlockQuote-background","--vscode-editorWidget-background"),t("noteTextColor","--vscode-foreground"),t("noteBorderColor","--vscode-textBlockQuote-border","--vscode-editorWidget-border"),t("errorBkgColor","--vscode-inputValidation-errorBackground","--vscode-editorError-background"),t("errorTextColor","--vscode-editorError-foreground","--vscode-foreground"),t("titleColor","--vscode-charts-foreground","--vscode-editor-foreground","--vscode-foreground"),t("edgeLabelBackground","--vscode-editor-background");let r=["--vscode-charts-blue","--vscode-charts-green","--vscode-charts-orange","--vscode-charts-red","--vscode-charts-purple","--vscode-charts-yellow"];for(let o=0;o<r.length;o++)t(`pie${o+1}`,r[o]),t(`cScale${o}`,r[o]);let n=Kn("--vscode-font-family");n&&(e.fontFamily=n);let i=Kn("--vscode-font-size");return i&&(e.fontSize=i),{variables:e,fingerprint:JSON.stringify(e)}}function Ir(e){let t=document.createElement("pre");return t.className="mermaid-error",t.innerText=xv(e),t}function xv(e){if(e instanceof Error)return e.message;if(e&&typeof e=="object"){let t=e;if(typeof t.message=="string"&&t.message)return t.message;if(typeof t.str=="string"&&t.str)return t.str}return String(e)}function kv(e){let t;try{t=JSON.parse(e.dataset.vscodeContext||"{}")}catch{t={}}e.dataset.vscodeContext=JSON.stringify({...t,mermaidError:!0})}function zv(e,t,r,n){let i=(e.textContent??"").trim();if(!i)return;let o=Lc(i),s=Sv(i,t),a=`d${s}`;return e.id=s,e.dataset.vscodeContext=JSON.stringify({webviewSection:"mermaid",mermaidSource:i,preventDefaultContextMenuItems:!0}),e.innerHTML="",{containerId:s,contentHash:o,p:(async()=>{try{if(await Pe.parse(i),n.aborted)throw new DOMException("Aborted","AbortError");let c=await Pe.render(a,i);if(n.aborted)throw new DOMException("Aborted","AbortError");r(e,c.svg,!1),c.bindFunctions?.(e)}catch(c){throw c instanceof Error&&c.name!=="AbortError"&&(kv(e),r(e,Ir(c).outerHTML,!0)),c}})()}}async function Zc(e,t,r){let n=new Set;for(let o of e.querySelectorAll(".mermaid > svg"))o.remove();for(let o of e.querySelectorAll("svg"))o.parentElement?.id.startsWith("dmermaid")&&o.parentElement.remove();let i=[];for(let o of e.querySelectorAll(".mermaid")){let s=zv(o,n,(a,c,u)=>{t(a,c,s.contentHash,u)},r);s&&i.push(s.p)}await Promise.all(i)}async function Rc(){Pe.registerIconPacks(bc),Pe.registerLayoutLoaders(_c),await Pe.registerExternalDiagrams([vc])}var Bn={darkModeTheme:$r,lightModeTheme:$r,maxTextSize:5e4,clickDrag:"alt",showControls:"onHoverOrFocus",resizable:!0,maxHeight:""};function Nc(){let t=document.getElementById("markdown-mermaid")?.dataset.config;if(!t)return Bn;try{return{...Bn,...JSON.parse(t)}}catch{return Bn}}function Dc(e,t){return{startOnLoad:!1,look:"classic",flowchart:{subGraphTitleMargin:{...Ec}},...t.resolveMermaidTheme(e)}}function Lc(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return(t>>>0).toString(16).padStart(8,"0")}function Sv(e,t){let r=Lc(e),n=`mermaid-${r}`,i=0;for(;t.has(n);)i++,n=`mermaid-${r}-${i}`;return t.add(n),n}var nt=document.querySelector("main"),jc=Nc(),Uc=new Sr;function Fc(){let e=getComputedStyle(document.documentElement).colorScheme.split(/\s+/)[0]==="dark";document.body.classList.toggle("vscode-dark",e),document.body.classList.toggle("vscode-light",!e)}async function $v(){Fc(),await Rc();let e=await Ws.connect({connection:"windowParent"}),t,r=()=>{let c=nt.firstElementChild;if(!c)return;let u=c.querySelector("svg"),d=u?.viewBox.baseVal,l=Math.ceil(Math.round(100*(u&&d&&d.width>0?Math.min(parseFloat(u.style.maxWidth)||d.width,document.documentElement.clientWidth)*d.height/d.width:c.getBoundingClientRect().height))/100);l>0&&l!==t&&(t=l,e.reportSize(l))},n=new ResizeObserver(r);n.observe(document.documentElement);let i,o=async()=>{i?.abort();let c=i=new AbortController,u=e.getContent();Pe.initialize({...Dc(jc,Uc),maxTextSize:jc.maxTextSize});let d=document.createElement("div");d.className="mermaid",d.textContent=typeof u=="string"?u:"";let l=document.createElement("div");l.append(d),nt.setAttribute("aria-busy","true");try{await Zc(l,(p,f,m,_)=>{p.innerHTML=f,_||Pc(p)},c.signal)}catch(p){if(c.signal.aborted)return;d.hasChildNodes()||d.replaceChildren(Ir(p))}c.signal.aborted||(d.querySelector("svg")?.removeAttribute("height"),d.querySelector(".mermaid-error")?.setAttribute("role","alert"),nt.replaceChildren(d),nt.setAttribute("aria-busy","false"),r())},s=e.onDidChangeContent(()=>{o()}),a=new MutationObserver(()=>{Fc(),Uc.refresh()&&o()});a.observe(document.head,{subtree:!0,childList:!0,characterData:!0}),o(),window.addEventListener("pagehide",()=>{i?.abort(),s.dispose(),a.disconnect(),n.disconnect(),e.dispose()},{once:!0})}$v().catch(e=>{console.error("Mermaid code block editor failed",e);let t=Ir(e);t.setAttribute("role","alert"),nt.replaceChildren(t),nt.setAttribute("aria-busy","false")});
/*! Bundled license information:
mermaid/dist/mermaid.core.mjs:
(*! Check if previously processed *)
(*!
* Wait for document loaded before starting the execution
*)
*/