@monotykamary/localterm 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monotykamary/localterm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A browser-based terminal: one browser tab is one PTY session. Friendly URL, persistent xterm.js front-end, hono + node-pty back-end.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser-terminal",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"kleur": "^4.1.5",
|
|
49
49
|
"open": "^10.1.0",
|
|
50
50
|
"zod": "^4.3.6",
|
|
51
|
-
"@monotykamary/localterm-server": "0.1.
|
|
51
|
+
"@monotykamary/localterm-server": "0.1.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "^25.5.0",
|
|
@@ -235,6 +235,6 @@ ${s.join(`
|
|
|
235
235
|
|
|
236
236
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=UF,s=!OF.jitless,c=s&&WF.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?uR([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function pR(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!oI(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>lI(e,r,kF())))}),t)}var mR=$(`$ZodUnion`,(e,t)=>{EL.init(e,t),LF(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),LF(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),LF(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),LF(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>PF(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>pR(t,i,e,a)):pR(s,i,e,a)}}),hR=$(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,mR.init(e,t);let n=e._zod.parse;LF(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=MF(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!UF(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),gR=$(`$ZodIntersection`,(e,t)=>{EL.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>vR(e,t,n)):vR(e,i,a)}});function _R(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(GF(e)&&GF(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=_R(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=_R(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function vR(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),oI(e))return e;let o=_R(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var yR=$(`$ZodEnum`,(e,t)=>{EL.init(e,t);let n=AF(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>qF.has(typeof e)).map(e=>typeof e==`string`?JF(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),bR=$(`$ZodLiteral`,(e,t)=>{if(EL.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?JF(e):e?JF(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),xR=$(`$ZodTransform`,(e,t)=>{EL.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new DF(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new EF;return n.value=i,n}});function SR(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var CR=$(`$ZodOptional`,(e,t)=>{EL.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,LF(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),LF(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${PF(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>SR(t,e.value)):SR(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),wR=$(`$ZodExactOptional`,(e,t)=>{CR.init(e,t),LF(e._zod,`values`,()=>t.innerType._zod.values),LF(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),TR=$(`$ZodNullable`,(e,t)=>{EL.init(e,t),LF(e._zod,`optin`,()=>t.innerType._zod.optin),LF(e._zod,`optout`,()=>t.innerType._zod.optout),LF(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${PF(e.source)}|null)$`):void 0}),LF(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ER=$(`$ZodDefault`,(e,t)=>{EL.init(e,t),e._zod.optin=`optional`,LF(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>DR(e,t)):DR(r,t)}});function DR(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var OR=$(`$ZodPrefault`,(e,t)=>{EL.init(e,t),e._zod.optin=`optional`,LF(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),kR=$(`$ZodNonOptional`,(e,t)=>{EL.init(e,t),LF(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>AR(t,e)):AR(i,e)}});function AR(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 jR=$(`$ZodCatch`,(e,t)=>{EL.init(e,t),LF(e._zod,`optin`,()=>t.innerType._zod.optin),LF(e._zod,`optout`,()=>t.innerType._zod.optout),LF(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>lI(e,n,kF()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>lI(e,n,kF()))},input:e.value}),e.issues=[]),e)}}),MR=$(`$ZodPipe`,(e,t)=>{EL.init(e,t),LF(e._zod,`values`,()=>t.in._zod.values),LF(e._zod,`optin`,()=>t.in._zod.optin),LF(e._zod,`optout`,()=>t.out._zod.optout),LF(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>NR(e,t.in,n)):NR(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>NR(e,t.out,n)):NR(r,t.out,n)}});function NR(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var PR=$(`$ZodReadonly`,(e,t)=>{EL.init(e,t),LF(e._zod,`propValues`,()=>t.innerType._zod.propValues),LF(e._zod,`values`,()=>t.innerType._zod.values),LF(e._zod,`optin`,()=>t.innerType?._zod?.optin),LF(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(FR):FR(r)}});function FR(e){return e.value=Object.freeze(e.value),e}var IR=$(`$ZodCustom`,(e,t)=>{sL.init(e,t),EL.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>LR(t,n,r,e));LR(i,n,r,e)}});function LR(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(dI(e))}}var RR,zR=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function BR(){return new zR}(RR=globalThis).__zod_globalRegistry??(RR.__zod_globalRegistry=BR());var VR=globalThis.__zod_globalRegistry;function HR(e,t){return new e({type:`string`,...XF(t)})}function UR(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...XF(t)})}function WR(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...XF(t)})}function GR(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...XF(t)})}function KR(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...XF(t)})}function qR(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...XF(t)})}function JR(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...XF(t)})}function YR(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...XF(t)})}function XR(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...XF(t)})}function ZR(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...XF(t)})}function QR(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...XF(t)})}function $R(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...XF(t)})}function ez(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...XF(t)})}function tz(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...XF(t)})}function nz(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...XF(t)})}function rz(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...XF(t)})}function iz(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...XF(t)})}function az(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...XF(t)})}function oz(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...XF(t)})}function sz(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...XF(t)})}function cz(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...XF(t)})}function lz(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...XF(t)})}function uz(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...XF(t)})}function dz(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...XF(t)})}function fz(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...XF(t)})}function pz(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...XF(t)})}function mz(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...XF(t)})}function hz(e,t){return new e({type:`number`,checks:[],...XF(t)})}function gz(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...XF(t)})}function _z(e,t){return new e({type:`boolean`,...XF(t)})}function vz(e){return new e({type:`unknown`})}function yz(e,t){return new e({type:`never`,...XF(t)})}function bz(e,t){return new lL({check:`less_than`,...XF(t),value:e,inclusive:!1})}function xz(e,t){return new lL({check:`less_than`,...XF(t),value:e,inclusive:!0})}function Sz(e,t){return new uL({check:`greater_than`,...XF(t),value:e,inclusive:!1})}function Cz(e,t){return new uL({check:`greater_than`,...XF(t),value:e,inclusive:!0})}function wz(e,t){return new dL({check:`multiple_of`,...XF(t),value:e})}function Tz(e,t){return new pL({check:`max_length`,...XF(t),maximum:e})}function Ez(e,t){return new mL({check:`min_length`,...XF(t),minimum:e})}function Dz(e,t){return new hL({check:`length_equals`,...XF(t),length:e})}function Oz(e,t){return new _L({check:`string_format`,format:`regex`,...XF(t),pattern:e})}function kz(e){return new vL({check:`string_format`,format:`lowercase`,...XF(e)})}function Az(e){return new yL({check:`string_format`,format:`uppercase`,...XF(e)})}function jz(e,t){return new bL({check:`string_format`,format:`includes`,...XF(t),includes:e})}function Mz(e,t){return new xL({check:`string_format`,format:`starts_with`,...XF(t),prefix:e})}function Nz(e,t){return new SL({check:`string_format`,format:`ends_with`,...XF(t),suffix:e})}function Pz(e){return new CL({check:`overwrite`,tx:e})}function Fz(e){return Pz(t=>t.normalize(e))}function Iz(){return Pz(e=>e.trim())}function Lz(){return Pz(e=>e.toLowerCase())}function Rz(){return Pz(e=>e.toUpperCase())}function zz(){return Pz(e=>VF(e))}function Bz(e,t,n){return new e({type:`array`,element:t,...XF(n)})}function Vz(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...XF(n)})}function Hz(e){let t=Uz(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(dI(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(dI(r))}},e(n.value,n)));return t}function Uz(e,t){let n=new sL({check:`custom`,...XF(t)});return n._zod.check=e,n}function Wz(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??VR,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 Gz(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Gz(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Jz(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Kz(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
237
237
|
|
|
238
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function qz(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Xz(t,`input`,e.processors),output:Xz(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Jz(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Jz(r.element,n);if(r.type===`set`)return Jz(r.valueType,n);if(r.type===`lazy`)return Jz(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Jz(r.innerType,n);if(r.type===`intersection`)return Jz(r.left,n)||Jz(r.right,n);if(r.type===`record`||r.type===`map`)return Jz(r.keyType,n)||Jz(r.valueType,n);if(r.type===`pipe`)return Jz(r.in,n)||Jz(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Jz(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Jz(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Jz(e,n))return!0;return!!(r.rest&&Jz(r.rest,n))}return!1}var Yz=(e,t={})=>n=>{let r=Wz({...n,processors:t});return Gz(e,r),Kz(r,e),qz(r,e)},Xz=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Wz({...i??{},target:a,io:t,processors:n});return Gz(e,o),Kz(o,e),qz(o,e)},Zz={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Qz=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Zz[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},$z=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},eB=(e,t,n,r)=>{n.type=`boolean`},tB=(e,t,n,r)=>{n.not={}},nB=(e,t,n,r)=>{let i=e._zod.def,a=AF(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},rB=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},iB=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},aB=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},oB=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Gz(a.element,t,{...r,path:[...r.path,`items`]})},sB=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Gz(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Gz(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},cB=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Gz(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},lB=(e,t,n,r)=>{let i=e._zod.def,a=Gz(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Gz(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},uB=(e,t,n,r)=>{let i=e._zod.def,a=Gz(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},dB=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},fB=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},pB=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},mB=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},hB=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Gz(a,t,r);let o=t.seen.get(e);o.ref=a},gB=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},_B=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},vB=$(`ZodISODateTime`,(e,t)=>{BL.init(e,t),WB.init(e,t)});function yB(e){return dz(vB,e)}var bB=$(`ZodISODate`,(e,t)=>{VL.init(e,t),WB.init(e,t)});function xB(e){return fz(bB,e)}var SB=$(`ZodISOTime`,(e,t)=>{HL.init(e,t),WB.init(e,t)});function CB(e){return pz(SB,e)}var wB=$(`ZodISODuration`,(e,t)=>{UL.init(e,t),WB.init(e,t)});function TB(e){return mz(wB,e)}var EB=(e,t)=>{pI.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>gI(e,t)},flatten:{value:t=>hI(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,jF,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,jF,2)}},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,EB);var DB=$(`ZodError`,EB,{Parent:Error}),OB=_I(DB),kB=vI(DB),AB=yI(DB),jB=xI(DB),MB=CI(DB),NB=wI(DB),PB=TI(DB),FB=EI(DB),IB=DI(DB),LB=OI(DB),RB=kI(DB),zB=AI(DB),BB=$(`ZodType`,(e,t)=>(EL.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Xz(e,`input`),output:Xz(e,`output`)}}),e.toJSONSchema=Yz(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(zF(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>YF(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>OB(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>AB(e,t,n),e.parseAsync=async(t,n)=>kB(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>jB(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>MB(e,t,n),e.decode=(t,n)=>NB(e,t,n),e.encodeAsync=async(t,n)=>PB(e,t,n),e.decodeAsync=async(t,n)=>FB(e,t,n),e.safeEncode=(t,n)=>IB(e,t,n),e.safeDecode=(t,n)=>LB(e,t,n),e.safeEncodeAsync=async(t,n)=>RB(e,t,n),e.safeDecodeAsync=async(t,n)=>zB(e,t,n),e.refine=(t,n)=>e.check(tH(t,n)),e.superRefine=t=>e.check(nH(t)),e.overwrite=t=>e.check(Pz(t)),e.optional=()=>LV(e),e.exactOptional=()=>zV(e),e.nullable=()=>VV(e),e.nullish=()=>LV(VV(e)),e.nonoptional=t=>qV(e,t),e.array=()=>xV(e),e.or=t=>TV([e,t]),e.and=t=>kV(e,t),e.transform=t=>ZV(e,FV(t)),e.default=t=>UV(e,t),e.prefault=t=>GV(e,t),e.catch=t=>YV(e,t),e.pipe=t=>ZV(e,t),e.readonly=()=>$V(e),e.describe=t=>{let n=e.clone();return VR.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return VR.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return VR.get(e);let n=e.clone();return VR.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),VB=$(`_ZodString`,(e,t)=>{DL.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qz(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Oz(...t)),e.includes=(...t)=>e.check(jz(...t)),e.startsWith=(...t)=>e.check(Mz(...t)),e.endsWith=(...t)=>e.check(Nz(...t)),e.min=(...t)=>e.check(Ez(...t)),e.max=(...t)=>e.check(Tz(...t)),e.length=(...t)=>e.check(Dz(...t)),e.nonempty=(...t)=>e.check(Ez(1,...t)),e.lowercase=t=>e.check(kz(t)),e.uppercase=t=>e.check(Az(t)),e.trim=()=>e.check(Iz()),e.normalize=(...t)=>e.check(Fz(...t)),e.toLowerCase=()=>e.check(Lz()),e.toUpperCase=()=>e.check(Rz()),e.slugify=()=>e.check(zz())}),HB=$(`ZodString`,(e,t)=>{DL.init(e,t),VB.init(e,t),e.email=t=>e.check(UR(GB,t)),e.url=t=>e.check(YR(JB,t)),e.jwt=t=>e.check(uz(lV,t)),e.emoji=t=>e.check(XR(YB,t)),e.guid=t=>e.check(WR(KB,t)),e.uuid=t=>e.check(GR(qB,t)),e.uuidv4=t=>e.check(KR(qB,t)),e.uuidv6=t=>e.check(qR(qB,t)),e.uuidv7=t=>e.check(JR(qB,t)),e.nanoid=t=>e.check(ZR(XB,t)),e.guid=t=>e.check(WR(KB,t)),e.cuid=t=>e.check(QR(ZB,t)),e.cuid2=t=>e.check($R(QB,t)),e.ulid=t=>e.check(ez($B,t)),e.base64=t=>e.check(sz(oV,t)),e.base64url=t=>e.check(cz(sV,t)),e.xid=t=>e.check(tz(eV,t)),e.ksuid=t=>e.check(nz(tV,t)),e.ipv4=t=>e.check(rz(nV,t)),e.ipv6=t=>e.check(iz(rV,t)),e.cidrv4=t=>e.check(az(iV,t)),e.cidrv6=t=>e.check(oz(aV,t)),e.e164=t=>e.check(lz(cV,t)),e.datetime=t=>e.check(yB(t)),e.date=t=>e.check(xB(t)),e.time=t=>e.check(CB(t)),e.duration=t=>e.check(TB(t))});function UB(e){return HR(HB,e)}var WB=$(`ZodStringFormat`,(e,t)=>{OL.init(e,t),VB.init(e,t)}),GB=$(`ZodEmail`,(e,t)=>{jL.init(e,t),WB.init(e,t)}),KB=$(`ZodGUID`,(e,t)=>{kL.init(e,t),WB.init(e,t)}),qB=$(`ZodUUID`,(e,t)=>{AL.init(e,t),WB.init(e,t)}),JB=$(`ZodURL`,(e,t)=>{ML.init(e,t),WB.init(e,t)}),YB=$(`ZodEmoji`,(e,t)=>{NL.init(e,t),WB.init(e,t)}),XB=$(`ZodNanoID`,(e,t)=>{PL.init(e,t),WB.init(e,t)}),ZB=$(`ZodCUID`,(e,t)=>{FL.init(e,t),WB.init(e,t)}),QB=$(`ZodCUID2`,(e,t)=>{IL.init(e,t),WB.init(e,t)}),$B=$(`ZodULID`,(e,t)=>{LL.init(e,t),WB.init(e,t)}),eV=$(`ZodXID`,(e,t)=>{RL.init(e,t),WB.init(e,t)}),tV=$(`ZodKSUID`,(e,t)=>{zL.init(e,t),WB.init(e,t)}),nV=$(`ZodIPv4`,(e,t)=>{WL.init(e,t),WB.init(e,t)}),rV=$(`ZodIPv6`,(e,t)=>{GL.init(e,t),WB.init(e,t)}),iV=$(`ZodCIDRv4`,(e,t)=>{KL.init(e,t),WB.init(e,t)}),aV=$(`ZodCIDRv6`,(e,t)=>{qL.init(e,t),WB.init(e,t)}),oV=$(`ZodBase64`,(e,t)=>{YL.init(e,t),WB.init(e,t)}),sV=$(`ZodBase64URL`,(e,t)=>{ZL.init(e,t),WB.init(e,t)}),cV=$(`ZodE164`,(e,t)=>{QL.init(e,t),WB.init(e,t)}),lV=$(`ZodJWT`,(e,t)=>{eR.init(e,t),WB.init(e,t)}),uV=$(`ZodNumber`,(e,t)=>{tR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$z(e,t,n,r),e.gt=(t,n)=>e.check(Sz(t,n)),e.gte=(t,n)=>e.check(Cz(t,n)),e.min=(t,n)=>e.check(Cz(t,n)),e.lt=(t,n)=>e.check(bz(t,n)),e.lte=(t,n)=>e.check(xz(t,n)),e.max=(t,n)=>e.check(xz(t,n)),e.int=t=>e.check(pV(t)),e.safe=t=>e.check(pV(t)),e.positive=t=>e.check(Sz(0,t)),e.nonnegative=t=>e.check(Cz(0,t)),e.negative=t=>e.check(bz(0,t)),e.nonpositive=t=>e.check(xz(0,t)),e.multipleOf=(t,n)=>e.check(wz(t,n)),e.step=(t,n)=>e.check(wz(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function dV(e){return hz(uV,e)}var fV=$(`ZodNumberFormat`,(e,t)=>{nR.init(e,t),uV.init(e,t)});function pV(e){return gz(fV,e)}var mV=$(`ZodBoolean`,(e,t)=>{rR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eB(e,t,n,r)});function hV(e){return _z(mV,e)}var gV=$(`ZodUnknown`,(e,t)=>{iR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function _V(){return vz(gV)}var vV=$(`ZodNever`,(e,t)=>{aR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tB(e,t,n,r)});function yV(e){return yz(vV,e)}var bV=$(`ZodArray`,(e,t)=>{sR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oB(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Ez(t,n)),e.nonempty=t=>e.check(Ez(1,t)),e.max=(t,n)=>e.check(Tz(t,n)),e.length=(t,n)=>e.check(Dz(t,n)),e.unwrap=()=>e.element});function xV(e,t){return Bz(bV,e,t)}var SV=$(`ZodObject`,(e,t)=>{fR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sB(e,t,n,r),LF(e,`shape`,()=>t.shape),e.keyof=()=>jV(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:_V()}),e.loose=()=>e.clone({...e._zod.def,catchall:_V()}),e.strict=()=>e.clone({...e._zod.def,catchall:yV()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>tI(e,t),e.safeExtend=t=>nI(e,t),e.merge=t=>rI(e,t),e.pick=t=>$F(e,t),e.omit=t=>eI(e,t),e.partial=(...t)=>iI(IV,e,t[0]),e.required=(...t)=>aI(KV,e,t[0])});function CV(e,t){return new SV({type:`object`,shape:e??{},...XF(t)})}var wV=$(`ZodUnion`,(e,t)=>{mR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cB(e,t,n,r),e.options=t.options});function TV(e,t){return new wV({type:`union`,options:e,...XF(t)})}var EV=$(`ZodDiscriminatedUnion`,(e,t)=>{wV.init(e,t),hR.init(e,t)});function DV(e,t,n){return new EV({type:`union`,options:t,discriminator:e,...XF(n)})}var OV=$(`ZodIntersection`,(e,t)=>{gR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lB(e,t,n,r)});function kV(e,t){return new OV({type:`intersection`,left:e,right:t})}var AV=$(`ZodEnum`,(e,t)=>{yR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nB(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new AV({...t,checks:[],...XF(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new AV({...t,checks:[],...XF(r),entries:i})}});function jV(e,t){return new AV({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...XF(t)})}var MV=$(`ZodLiteral`,(e,t)=>{bR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rB(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function NV(e,t){return new MV({type:`literal`,values:Array.isArray(e)?e:[e],...XF(t)})}var PV=$(`ZodTransform`,(e,t)=>{xR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aB(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new DF(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(dI(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(dI(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function FV(e){return new PV({type:`transform`,transform:e})}var IV=$(`ZodOptional`,(e,t)=>{CR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_B(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function LV(e){return new IV({type:`optional`,innerType:e})}var RV=$(`ZodExactOptional`,(e,t)=>{wR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_B(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zV(e){return new RV({type:`optional`,innerType:e})}var BV=$(`ZodNullable`,(e,t)=>{TR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function VV(e){return new BV({type:`nullable`,innerType:e})}var HV=$(`ZodDefault`,(e,t)=>{ER.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function UV(e,t){return new HV({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():KF(t)}})}var WV=$(`ZodPrefault`,(e,t)=>{OR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function GV(e,t){return new WV({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():KF(t)}})}var KV=$(`ZodNonOptional`,(e,t)=>{kR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qV(e,t){return new KV({type:`nonoptional`,innerType:e,...XF(t)})}var JV=$(`ZodCatch`,(e,t)=>{jR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function YV(e,t){return new JV({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var XV=$(`ZodPipe`,(e,t)=>{MR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hB(e,t,n,r),e.in=t.in,e.out=t.out});function ZV(e,t){return new XV({type:`pipe`,in:e,out:t})}var QV=$(`ZodReadonly`,(e,t)=>{PR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $V(e){return new QV({type:`readonly`,innerType:e})}var eH=$(`ZodCustom`,(e,t)=>{IR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>iB(e,t,n,r)});function tH(e,t={}){return Vz(eH,e,t)}function nH(e){return Hz(e)}CV({ok:hV(),sessions:dV().int().nonnegative()}).strict(),DV(`type`,[CV({type:NV(`input`),data:UB().max(xF)}).strict(),CV({type:NV(`resize`),cols:dV().int().positive().max(wF),rows:dV().int().positive().max(TF)}).strict()]);var rH=DV(`type`,[CV({type:NV(`output`),data:UB().max(SF)}).strict(),CV({type:NV(`exit`),code:dV().int().nullable()}).strict(),CV({type:NV(`title`),title:UB().max(CF)}).strict(),CV({type:NV(`session`),shell:UB().min(1),shellName:UB().min(1),pid:dV().int().nonnegative(),cwd:UB().min(1)}).strict(),CV({type:NV(`cwd`),cwd:UB().min(1)}).strict(),CV({type:NV(`foreground`),process:UB().max(256).nullable()}).strict()]),iH=async e=>{if(!(typeof document>`u`)&&e.name)try{await Promise.all([document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`)])}catch{}},aH=(e,t)=>`\x1b[${e};${t+1}u`,oH=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},sH=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),cH=(e,t)=>{let n=e.buffer.active,r=Math.max(0,n.baseY-n.viewportY),i=r===0;try{t.fit()}catch{return!1}try{if(i)return e.scrollToBottom(),!0;let t=e.buffer.active;if(r>t.baseY)return e.scrollToBottom(),!0;let n=t.baseY-r-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},lH=(e,t)=>`\r\n\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,uH={block:{blink:`\x1B[1 q`,steady:`\x1B[2 q`},underline:{blink:`\x1B[3 q`,steady:`\x1B[4 q`},bar:{blink:`\x1B[5 q`,steady:`\x1B[6 q`}},dH=(e,t)=>{let n=t?`blink`:`steady`;return`\x1b[?25h${uH[e][n]}`},fH=(e,t)=>`${dH(e,t)}\r\n\x1b[2;32m[reconnected]\x1b[0m\r\n\r\n`,pH=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,mH=55296,hH=56319,gH=(e,t)=>{if(e.length<=t)return[e];let n=[],r=0;for(;r<e.length;){let i=Math.min(r+t,e.length);if(i<e.length){let t=e.charCodeAt(i-1);t>=mH&&t<=hH&&--i}i===r&&(i=r+t),n.push(e.slice(r,i)),r=i}return n},_H=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active,r=Math.max(0,n.baseY-t.distanceFromBottom)-n.viewportY;r!==0&&e.scrollLines(r)},vH=(e,t)=>{e._core?._writeBuffer?.handleUserInput(),e.write(t)},yH=e=>e[0]===3,bH=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},xH=1/bA,SH=e=>Math.round(e*xH)/xH,CH=e=>{if(!Number.isFinite(e))return yA;let t=SH(e);return t<1?1:t>2?2:t},wH=1/1,TH=e=>Math.round(e*wH)/wH,EH=e=>{if(!Number.isFinite(e))return 0;let t=TH(e);return t<0?0:t>48?48:t},DH=e=>{if(!Number.isFinite(e))return 0;let t=TH(e);return t<0?0:t>48?48:t},OH=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},kH=(e,t)=>e.key!==`k`&&e.key!==`K`?!1:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,AH=(e,t)=>e.key!==`f`&&e.key!==`F`?!1:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,jH=()=>{if(typeof window>`u`)return null;try{let e=window.localStorage.getItem(NA);return e&&e.trim()?e:null}catch{return null}},MH=()=>{if(typeof window>`u`)return!0;try{let e=window.localStorage.getItem(RA);return e===`true`?!0:e!==`false`}catch{return!0}},NH=()=>{if(typeof window>`u`)return IP;try{let e=window.localStorage.getItem(LA);return RP(e)?e:IP}catch{return IP}},PH=()=>{if(typeof window>`u`)return $P;try{let e=window.localStorage.getItem(MA);return e===`local`?jH()?PA:$P:eF(e).id}catch{return $P}},FH=()=>{if(typeof window>`u`)return 13;try{let e=window.localStorage.getItem(FA);return e===null||e===``?13:bH(Number(e))}catch{return 13}},IH=()=>{if(typeof window>`u`)return yA;try{let e=window.localStorage.getItem(IA);return e===null||e===``?yA:CH(Number(e))}catch{return yA}},LH=()=>{if(typeof window>`u`)return rF;try{let e=window.localStorage.getItem(zA);if(e===null||e===``)return rF;let t=Number(e);return aF(t)?t:rF}catch{return rF}},RH=()=>{if(typeof window>`u`)return!0;try{let e=window.localStorage.getItem(BA);return e===`true`?!0:e!==`false`}catch{return!0}},zH=()=>{if(typeof window>`u`)return cF;try{return lF(window.localStorage.getItem(jA)).id}catch{return cF}},BH=()=>{if(typeof window>`u`)return 0;try{let e=window.localStorage.getItem(VA);return e===null||e===``?0:EH(Number(e))}catch{return 0}},VH=()=>{if(typeof window>`u`)return 0;try{let e=window.localStorage.getItem(HA);return e===null||e===``?0:DH(Number(e))}catch{return 0}},HH=`<path d='m6 8 4 4-4 4M12 16h6'/>`,UH=[`<circle cx='7' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='12' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='17' cy='12' r='1.5' fill='currentColor' stroke='none'/>`].join(``),WH=(e,t)=>{let n=`hsl(${e} 80% 62%)`,r=`hsl(${e} 85% 12%)`,i=t===`active`?UH:HH;return[`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' color='${r}' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='${t===`dead`?EA:1}'>`,`<rect x='2' y='4' width='20' height='16' rx='2' fill='${n}'/>`,i,`</svg>`].join(``)},GH=e=>{try{let t=window.localStorage?.getItem(e);return t?JSON.parse(t):null}catch{return null}},KH=(e,t)=>{try{window.localStorage?.setItem(e,JSON.stringify(t))}catch{}},qH=e=>{try{return window.sessionStorage?.getItem(e)??null}catch{return null}},JH=(e,t)=>{try{window.sessionStorage?.setItem(e,t)}catch{}},YH=(e,t)=>{let n=Math.abs(e-t);return Math.min(n,360-n)},XH=e=>{if(e.length===0)return Math.floor(Math.random()*360);let t=0,n=-1;for(let r=0;r<360;r+=12){let i=360;for(let t of e){let e=YH(r,t);e<i&&(i=e)}i>n&&(n=i,t=r)}let r=Math.floor((Math.random()-.5)*12);return(t+r+360)%360},ZH=()=>{let e=qH(WA);if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null},QH=()=>{let e=GH(GA);return Array.isArray(e)?e.filter(e=>typeof e==`number`&&Number.isFinite(e)):[]},$H=(e,t)=>{JH(WA,String(e)),KH(GA,[...t,e].slice(-16))},eU=null,tU=`idle`,nU=null,rU=()=>{if(eU!==null)return eU;let e=ZH();if(e!==null)return eU=e,e;let t=QH(),n=XH(t);return $H(n,t),eU=n,n},iU=e=>XH([...QH(),...e]),aU=e=>{eU=e,$H(e,QH())},oU=(e,t)=>nU===null||e!==tU||t!==nU,sU=(e,t)=>{tU=e,nU=t},cU=()=>{eU=null,tU=`idle`,nU=null},lU=e=>{if(typeof document>`u`)return;let t=rU();if(!oU(e,t))return;sU(e,t);let n=`data:image/svg+xml,${encodeURIComponent(WH(t,e))}`,r=document.querySelector(`link[rel="icon"]`);r||(r=document.createElement(`link`),r.rel=`icon`,document.head.appendChild(r)),r.type=`image/svg+xml`,r.href=n},uU=`/api/health`,dU=async()=>{try{return(await fetch(uU)).ok}catch{return!1}},fU=(e,t)=>t.buffer.active.type===`alternate`?e.deltaMode===WheelEvent.DOM_DELTA_PIXEL:!1,pU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(NA,e)}catch{}},mU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(RA,String(e))}catch{}},hU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(LA,e)}catch{}},gU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(MA,e)}catch{}},_U=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(FA,String(e))}catch{}},vU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(IA,String(e))}catch{}},yU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(zA,String(e))}catch{}},bU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(BA,String(e))}catch{}},xU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(jA,e)}catch{}},SU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(VA,String(e))}catch{}},CU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(HA,String(e))}catch{}},wU=e=>e||`localterm`,TU=e=>`${SA}${e||`localterm`}`,EU={matchBackground:OA,activeMatchBackground:kA,activeMatchBorder:AA,matchOverviewRuler:kA,activeMatchColorOverviewRuler:AA},DU=`cwd`,OU=e=>{let t=new URL(`/ws`,window.location.href);t.protocol=t.protocol===`https:`?`wss:`:`ws:`;let n=e??new URLSearchParams(window.location.search).get(DU);return n&&t.searchParams.set(DU,n),t.toString()},kU=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(DU,e),t.toString()},AU=({onModalOpenChange:e,onForegroundProcessChange:t}={})=>{let n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(!1),a=(0,b.useRef)(null),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(null),d=(0,b.useRef)(null),f=(0,b.useRef)(zH()),p=(0,b.useRef)(PH()),m=(0,b.useRef)(jH()),h=(0,b.useRef)(FH()),g=(0,b.useRef)(IH()),_=(0,b.useRef)(NH()),v=(0,b.useRef)(MH()),x=(0,b.useRef)(LH()),S=(0,b.useRef)(RH()),C=(0,b.useRef)(BH()),w=(0,b.useRef)(VH()),T=(0,b.useRef)(null),E=(0,b.useRef)(null),D=(0,b.useRef)(null),O=(0,b.useRef)(null),[k,A]=(0,b.useState)(null),[j,M]=(0,b.useState)(0),[N,P]=(0,b.useState)(!1),[F,I]=(0,b.useState)(!1),[L,ee]=(0,b.useState)(!1),[R,z]=(0,b.useState)(!1),B=(0,b.useRef)(null),[V,H]=(0,b.useState)(0),[U,te]=(0,b.useState)(!1),[W,ne]=(0,b.useState)(!1),re=(0,b.useRef)(null),ie=(0,b.useRef)(!1),ae=U||W;ie.current=W;let[oe,se]=(0,b.useState)(``),[ce,le]=(0,b.useState)({resultIndex:-1,resultCount:0}),[ue,de]=(0,b.useState)(f.current),[fe,pe]=(0,b.useState)(null),he=fe??ue,ge=(0,b.useMemo)(()=>lF(he),[he]),[_e,ve]=(0,b.useState)(p.current),[be,xe]=(0,b.useState)(m.current),[Se,Ce]=(0,b.useState)(null),we=Se??_e,Te=(0,b.useMemo)(()=>eF(we,be),[we,be]),[Ee,De]=(0,b.useState)(h.current),[Oe,ke]=(0,b.useState)(g.current),[Ae,je]=(0,b.useState)(_.current),[Me,Ne]=(0,b.useState)(null),Pe=Me??Ae,[Fe,Ie]=(0,b.useState)(v.current),[Le,Re]=(0,b.useState)(x.current),[ze,Be]=(0,b.useState)(S.current),[Ve,He]=(0,b.useState)(C.current),[Ue,We]=(0,b.useState)(w.current),[Ge,Ke]=(0,b.useState)(null),[qe,Je]=(0,b.useState)(null),Ye=(0,b.useRef)(null),Xe=(0,b.useMemo)(OH,[]);(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let c=!1,l=!1,u=!1,y=``,b=null,C=null,w=null,k=null,j=null,N=`idle`,P=[0],F=()=>P[P.length-1]??0,I=()=>{j!==null&&(window.clearTimeout(j),j=null),N===`idle`&&k===null&&(k=window.setTimeout(()=>{k=null,!(c||l)&&(N=`active`,lU(`active`))},250)),j=window.setTimeout(()=>{j=null,k!==null&&(window.clearTimeout(k),k=null),N===`active`&&(N=`idle`,lU(`idle`))},750)},L=()=>{k!==null&&(window.clearTimeout(k),k=null),j!==null&&(window.clearTimeout(j),j=null),N===`active`&&(N=`idle`,lU(`idle`))},ee=eF(p.current,m.current);iH(ee).then(()=>{c||(R._core._charSizeService.measure(),Ee())});let R=new Wv({allowProposedApi:!0,cursorBlink:v.current,cursorStyle:_.current,fontFamily:ee.family,fontSize:h.current,lineHeight:g.current,scrollback:x.current,theme:lF(f.current).colors,macOptionIsMeta:!0,scrollOnUserInput:S.current,overviewRuler:{width:0}});r.current=R;let z=new ye;T.current=z,R.loadAddon(z),R.loadAddon(new ka),R.loadAddon(new me),R.loadAddon(new It),R.loadAddon(new Rt);let V=new Ca;R.loadAddon(V),R.unicode.activeVersion=`15`;let H=new lr;R.loadAddon(H),o.current=H;let U=H.onDidChangeResults(le);R.open(e),z.proposeDimensions&&=()=>{if(!R||!R.element||!R.element.parentElement)return;let e=R,t=e._core._renderService.dimensions.css.cell.width,n=e._core._renderService.dimensions.css.cell.height;if(t===0||n===0)return;let r=window.getComputedStyle(R.element.parentElement),i=window.getComputedStyle(R.element),a=Math.max(0,parseInt(r.getPropertyValue(`width`)))-(parseInt(i.getPropertyValue(`padding-right`))+parseInt(i.getPropertyValue(`padding-left`))),o=parseInt(r.getPropertyValue(`height`))-(parseInt(i.getPropertyValue(`padding-top`))+parseInt(i.getPropertyValue(`padding-bottom`)));return{cols:Math.max(2,Math.floor(a/t)),rows:Math.max(1,Math.floor(o/n))}};let te=()=>{let e=R.buffer.active,t=e.length,n=R.rows,r=e.viewportY+n>=t,i=t>n,a=D.current,o=O.current;if(!(!a||!o)&&(a.classList.toggle(`xterm-scrollbar-visible`,!r&&i),i)){let r=n/t,i=e.viewportY/t;o.style.height=`${r*100}%`,o.style.top=`${i*100}%`}};te();let W=R.onScroll(te),ne=!1,re=0,ie=0,ae=e=>{if(e.button===0){ne=!0,re=e.clientY,ie=R.buffer.active.viewportY;try{e.target.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}},oe=e=>{if(!ne)return;let t=D.current;if(!t)return;let n=t.clientHeight,r=R.buffer.active.length-R.rows;if(r<=0||n<=0)return;let i=n/r,a=e.clientY-re,o=Math.max(0,Math.min(r,ie+Math.round(a/i)));o!==R.buffer.active.viewportY&&R.scrollLines(o-R.buffer.active.viewportY)},se=()=>{ne=!1},ce=e=>{if(e.button!==0||e.target===O.current)return;let t=D.current;if(!t)return;let n=t.getBoundingClientRect(),r=(e.clientY-n.top)/n.height,i=R.buffer.active,a=i.length,o=Math.max(0,Math.min(a-R.rows,Math.round(r*a)-Math.floor(R.rows/2)));R.scrollLines(o-i.viewportY)},ue=O.current,de=D.current;ue&&(ue.addEventListener(`pointerdown`,ae),ue.addEventListener(`pointermove`,oe),ue.addEventListener(`pointerup`,se),ue.addEventListener(`pointercancel`,se)),de&&de.addEventListener(`pointerdown`,ce);try{let e=new yu;e.onContextLoss(()=>e.dispose()),R.loadAddon(e)}catch{}let fe=R.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let t=e[0],n=typeof t==`number`?t:1;return P.push(n),!0}),pe=R.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let t=e[0],n=typeof t==`number`&&t>0?t:1;for(let e=0;e<n&&P.length>1;e+=1)P.pop();return!0}),he=R.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let t=e[0],n=e[1];if(typeof t!=`number`)return!0;let r=t,i=typeof n==`number`&&n>0?n:1,a=P.length-1,o=P[a]??0;return i===1?P[a]=r:i===2?P[a]=o|r:i===3&&(P[a]=o&~r),!0}),ge=R.parser.registerCsiHandler({final:`J`},yH),_e=R.parser.registerCsiHandler({prefix:`?`,final:`J`},yH),ve=e=>{b?.readyState===WebSocket.OPEN&&b.send(JSON.stringify(e))},be=()=>{let e=d.current;e&&window.clearTimeout(e.timer),d.current=null},xe=()=>{let e=d.current;if(e){if(Date.now()>e.expiresAtMs){be();return}_H(R,e.anchor)}},Se=e=>{be();let t=window.setTimeout(()=>{xe(),d.current=null},vA);d.current={anchor:e,expiresAtMs:Date.now()+vA,timer:t}};R.attachCustomWheelEventHandler(e=>fU(e,R)?(e.preventDefault(),!1):!0),R.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(e.altKey&&e.code===`KeyT`){if(e.type===`keydown`){e.preventDefault();let t=document.getElementById(`new-shell-link`);t instanceof HTMLAnchorElement&&t.click()}return!1}if(kH(e,Xe))return e.type===`keydown`&&(e.preventDefault(),B.current?.()),!1;if(AH(e,Xe))return e.type===`keydown`&&(e.preventDefault(),E.current?.()),!1;if(e.type===`keydown`&&e.key===`Enter`){let t=sH(e),n=(F()&1)!=0;if(t!==0&&n)return e.preventDefault(),ve({type:`input`,data:aH(13,t)}),!1;if(t===1)return e.preventDefault(),ve({type:`input`,data:`
|
|
239
|
-
`}),!1}return!0});let Ce=e=>{if(l)return;let t=e.trim();t&&(y=t,document.title=wU(t))},we=R.onTitleChange(Ce);s.current=()=>R.focus();let Te=(e,t)=>ve({type:`resize`,cols:e,rows:t}),Ee=()=>{let e=oH(R);cH(R,z)&&(Se(e),Te(R.cols,R.rows))},De=()=>{w!==null&&window.clearTimeout(w),w=window.setTimeout(()=>{w=null,Ee()},80)};R.onData(e=>{for(let t of gH(e,xF))ve({type:`input`,data:t})}),R.onResize(({cols:e,rows:t})=>Te(e,t));let Oe=new ResizeObserver(De);Oe.observe(e),Ee(),requestAnimationFrame(()=>R.focus());let ke=e=>{if(!l){if(l=!0,e===null||e===0){window.close(),setTimeout(()=>{c||(L(),lU(`dead`),R.write(pH(e)),document.title=TU(y),A({reason:`shell-exited`,exitCode:e}),Ke(null))},100);return}L(),lU(`dead`),R.write(pH(e)),document.title=TU(y),A({reason:`shell-exited`,exitCode:e}),Ke(null)}},Ae=(e,t,n)=>{l||(l=!0,L(),lU(`dead`),R.write(lH(e,t)),document.title=TU(y),A({reason:`connection-lost`,closeCode:e,closeReason:t,wasClean:n}),Ke(null))},je=()=>{if(c)return;let e=new WebSocket(OU(Ye.current));b=e,e.addEventListener(`open`,()=>{c||b!==e||(u=!0,M(0),Te(R.cols,R.rows))}),e.addEventListener(`message`,n=>{if(c||b!==e)return;let r;try{r=JSON.parse(typeof n.data==`string`?n.data:String(n.data))}catch{return}if(typeof r==`object`&&r&&r.type===`output`&&typeof r.data==`string`){let e=r.data;vH(R,e),I();return}let i=rH.safeParse(r);if(!i.success)return;let a=i.data;a.type===`title`?Ce(a.title):a.type===`session`?(Ke({shell:a.shell,shellName:a.shellName,pid:a.pid,cwd:a.cwd}),Je(a.cwd)):a.type===`cwd`?Je(a.cwd):a.type===`foreground`?t?.(a.process!==null):a.type===`exit`&&(L(),ke(a.code))}),e.addEventListener(`close`,t=>{if(b===e&&(b=null,!c&&!l)){if(u){console.warn(`[localterm] websocket closed: code=${t.code} reason=${JSON.stringify(t.reason)} wasClean=${t.wasClean}`),Ae(t.code,t.reason,t.wasClean);return}M(e=>e+1),C=window.setTimeout(je,_A)}}),e.addEventListener(`error`,t=>{console.warn(`[localterm] websocket error`,t);try{e.close()}catch{}})};return a.current=()=>{if(!c){l=!1,u=!1,A(null),Ke(null),M(0),lU(`idle`),t?.(!1),C!==null&&(window.clearTimeout(C),C=null);try{b?.close()}catch{}b=null,je()}},je(),i.current=!0,()=>{c=!0,a.current=null,s.current=null,o.current=null,r.current=null,i.current=!1,T.current=null,D.current=null,O.current=null,ue&&(ue.removeEventListener(`pointerdown`,ae),ue.removeEventListener(`pointermove`,oe),ue.removeEventListener(`pointerup`,se),ue.removeEventListener(`pointercancel`,se)),de&&de.removeEventListener(`pointerdown`,ce),we.dispose(),U.dispose(),W.dispose(),fe.dispose(),pe.dispose(),he.dispose(),ge.dispose(),_e.dispose(),C!==null&&window.clearTimeout(C),w!==null&&window.clearTimeout(w),be(),L(),Oe.disconnect();try{b?.close()}catch{}b=null,R.dispose(),document.title=xA}},[]),(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.theme=ge.colors)},[ge]),(0,b.useEffect)(()=>{if(!i.current||!r.current)return;let e=!1;return iH(Te).then(()=>{if(e)return;let t=r.current;if(!t)return;t.options.fontFamily=Te.family;let n=T.current;n&&cH(t,n)}),()=>{e=!0}},[Te]);let Ze=(0,b.useCallback)(e=>{de(e),pe(null),xU(e)},[]),Qe=(0,b.useCallback)(e=>{ve(e),Ce(null),gU(e)},[]),$e=(0,b.useCallback)(e=>{xe(e),ve(PA),Ce(null),pU(e),gU(PA)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.fontSize=Ee;let t=T.current;t&&cH(e,t)},[Ee]);let et=(0,b.useCallback)(e=>{let t=bH(e);De(t),_U(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.lineHeight=Oe;let t=T.current;t&&cH(e,t)},[Oe]);let tt=(0,b.useCallback)(e=>{let t=CH(e);ke(t),vU(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorStyle=Pe)},[Pe]);let nt=(0,b.useCallback)(e=>{je(e),Ne(null),hU(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorBlink=Fe)},[Fe]);let rt=(0,b.useCallback)(e=>{Ie(e),mU(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollback=Le)},[Le]);let it=(0,b.useCallback)(e=>{Re(e),yU(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollOnUserInput=ze)},[ze]);let at=(0,b.useCallback)(e=>{Be(e),bU(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;let t=T.current;t&&cH(e,t)},[Ve,Ue]);let ot=(0,b.useCallback)(e=>{let t=EH(e);He(t),SU(t)},[]),st=(0,b.useCallback)(e=>{let t=DH(e);We(t),CU(t)},[]);(0,b.useEffect)(()=>{if(!L)return;let e=c.current;e&&(e.focus(),e.select())},[L,V]);let ct=(0,b.useCallback)(e=>{if(!e){o.current?.clearDecorations(),le({resultIndex:-1,resultCount:0});return}o.current?.findNext(e,{decorations:EU})},[]),lt=(0,b.useCallback)(e=>{e&&o.current?.findPrevious(e,{decorations:EU})},[]),ut=(0,b.useCallback)(()=>{ee(!1),se(``),le({resultIndex:-1,resultCount:0}),o.current?.clearDecorations(),s.current?.()},[]),dt=(0,b.useCallback)(()=>{re.current!==null&&(window.clearTimeout(re.current),re.current=null),te(!0)},[]),ft=(0,b.useCallback)(()=>{re.current=window.setTimeout(()=>{re.current=null,ie.current||te(!1)},200)},[]),pt=(0,b.useCallback)(e=>{ne(e),e||(re.current!==null&&window.clearTimeout(re.current),re.current=window.setTimeout(()=>{re.current=null,te(!1)},200))},[]);B.current=(0,b.useCallback)(()=>{z(e=>!e)},[]);let mt=(0,b.useCallback)(()=>{z(!1),s.current?.()},[]),ht=(0,b.useCallback)(()=>{ee(!0),z(!1),H(e=>e+1)},[]);E.current=ht;let gt=(0,b.useCallback)(e=>{let t=e.target.value;se(t),ct(t)},[ct]),_t=(0,b.useCallback)(e=>{if(AH(e.nativeEvent,Xe)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),ut();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?lt(oe):ct(oe))},[ut,ct,lt,Xe,oe]),vt=(0,b.useCallback)(()=>{I(!0),a.current?.(),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{l.current=null,I(!1)},800)},[]),yt=(0,b.useCallback)(()=>{navigator.clipboard.writeText(CA).then(()=>{P(!0),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,P(!1)},wA)}).catch(()=>{})},[]);(0,b.useEffect)(()=>()=>{re.current!==null&&(window.clearTimeout(re.current),re.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),u.current!==null&&(window.clearTimeout(u.current),u.current=null)},[]),(0,b.useEffect)(()=>{if(Ye.current=qe,!qe)return;let e=new URL(window.location.href);e.searchParams.set(DU,qe),window.history.replaceState(null,``,e)},[qe]);let bt=kU(qe),xt=k!==null,St=!xt&&j>=2,Ct=xt||St,wt=k!==null&&k.reason!==`shell-exited`||St;(0,b.useEffect)(()=>{if(!wt)return;let e=Date.now(),t=!1,n=null,i=i=>{if(t)return;if(i){let e=r.current;e&&(e.write(fH(Pe,Fe)),e.refresh(0,e.rows-1),e.focus()),a.current?.();return}let s=Date.now()-e<5e3?250:TA;n=window.setTimeout(o,s)},o=()=>{dU().then(i)};return o(),()=>{t=!0,n!==null&&window.clearTimeout(n)}},[wt]),(0,b.useEffect)(()=>{e?.(Ct),Ct&&z(!1)},[Ct,e]);let Tt=ce.resultCount===0?`0/0`:`${ce.resultIndex+1}/${ce.resultCount}`,Et=ge.colors.background??`#101010`,Dt=(0,b.useMemo)(()=>{let e=Xe?`⌘`:`Ctrl+`,t=sF.map(e=>({id:`theme:${e.id}`,label:`Theme: ${e.name}`,category:`Theme`,action:()=>Ze(e.id)})),n=QP.map(e=>({id:`font:${e.id}`,label:`Font: ${e.name}`,category:`Font`,action:()=>Qe(e.id)}));return[...t,...n,{id:`find`,label:`Find in terminal`,category:`Search`,shortcut:`${e}F`,icon:(0,y.jsx)(ly,{className:`size-3.5`}),action:ht},{id:`new-shell`,label:`Open new shell`,category:`Tab`,shortcut:`Alt+T`,icon:(0,y.jsx)(cy,{className:`size-3.5`}),action:()=>{let e=document.getElementById(`new-shell-link`);e instanceof HTMLAnchorElement&&e.click()}},...FP.map(e=>({id:`cursor:${e.id}`,label:`Cursor: ${e.name}`,category:`Cursor`,action:()=>nt(e.id)})),{id:`cursor-blink`,label:`Cursor blink: ${Fe?`On`:`Off`}`,category:`Cursor`,action:()=>rt(!Fe)},{id:`font-size-up`,label:`Increase font size`,category:`Font`,shortcut:`${e}+`,icon:(0,y.jsx)(sy,{className:`size-3.5`}),action:()=>et(Ee+1)},{id:`font-size-down`,label:`Decrease font size`,category:`Font`,shortcut:`${e}-`,icon:(0,y.jsx)(sy,{className:`size-3.5`}),action:()=>et(Ee-1)},{id:`scroll-on-input`,label:`Pin to bottom on input: ${ze?`On`:`Off`}`,category:`Scrollback`,action:()=>at(!ze)}]},[Xe,Ze,Qe,ht,nt,Fe,rt,Ee,et,ze,at]);return(0,y.jsxs)(`div`,{className:`h-dvh w-dvw`,style:{background:Et},children:[(0,y.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,y.jsx)(`div`,{ref:n,"aria-label":`terminal session`,className:`absolute`,style:{top:Ue,right:Ve,bottom:Ue,left:Ve}}),(0,y.jsx)(`div`,{ref:D,className:`xterm-scrollbar-track`,style:{top:Ue,right:Ve,bottom:Ue},children:(0,y.jsx)(`div`,{ref:O,className:`xterm-scrollbar-thumb`})}),k===null?null:(0,y.jsx)(Hk,{variant:`destructive`,role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10`,children:k.reason===`shell-exited`?k.exitCode===null?`exited`:`exited · code ${k.exitCode}`:`disconnected · code ${k.closeCode}`}),(0,y.jsxs)(`div`,{className:Lb(`absolute right-0 top-0 z-10 flex flex-col items-end pr-3 pt-1`,ae?`pointer-events-auto`:`pointer-events-none`),onMouseEnter:dt,onMouseLeave:ft,children:[(0,y.jsx)(`div`,{"aria-hidden":`true`,className:Lb(`pointer-events-auto mr-0.5 h-[2px] w-5 rounded-full bg-muted-foreground/25 transition-opacity duration-150`,ae||L?`opacity-0`:`opacity-100`)}),!L&&(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,className:Lb(`mt-1 flex items-center gap-0.5 rounded-md border border-border/60 bg-background/70 p-0.5 text-muted-foreground shadow-xs backdrop-blur-md`,`transition-[opacity,transform] duration-200 ease-snappy`,ae?`translate-y-0 opacity-100`:`pointer-events-none -translate-y-1 opacity-0`),onMouseDown:e=>e.preventDefault(),onKeyDown:()=>s.current?.(),children:[(0,y.jsx)(bF,{themeId:ue,onThemeChange:Ze,onThemePreview:pe,fontId:_e,onFontChange:Qe,onFontPreview:Ce,localFontFamily:be,onLocalFontChange:$e,fontSize:Ee,onFontSizeChange:et,lineHeight:Oe,onLineHeightChange:tt,cursorStyle:Ae,onCursorStyleChange:nt,onCursorStylePreview:Ne,cursorBlink:Fe,onCursorBlinkChange:rt,scrollback:Le,onScrollbackChange:it,scrollOnUserInput:ze,onScrollOnUserInputChange:at,paddingX:Ve,onPaddingXChange:ot,paddingY:Ue,onPaddingYChange:st,sessionInfo:Ge,onPopoverOpenChange:pt,onClose:s.current??void 0}),(0,y.jsx)(Ak,{variant:`ghost`,size:`icon-sm`,onClick:ht,"aria-label":`find in terminal`,className:`hover:text-foreground`,children:(0,y.jsx)(ly,{})}),(0,y.jsx)(Ak,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,"aria-label":`open a new shell in a new browser tab`,render:(0,y.jsx)(`a`,{id:`new-shell-link`,href:bt,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`,children:(0,y.jsx)(cy,{})})]}),L&&(0,y.jsxs)(lA,{role:`search`,"aria-label":`find in terminal`,className:`mt-1 w-80 border-border/60 bg-background/70 text-muted-foreground shadow-xs backdrop-blur-md dark:bg-background/70`,children:[(0,y.jsx)(hA,{ref:c,type:`search`,value:oe,onChange:gt,onKeyDown:_t,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(dA,{align:`inline-end`,children:[(0,y.jsx)(mA,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:Tt}),(0,y.jsx)(pA,{size:`icon-xs`,onClick:()=>lt(oe),disabled:ce.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(ry,{})}),(0,y.jsx)(pA,{size:`icon-xs`,onClick:()=>ct(oe),disabled:ce.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(ny,{})})]})]})]})]}),(0,y.jsx)(YA,{open:R,onClose:mt,commands:Dt}),(0,y.jsx)(jk,{open:Ct,children:(0,y.jsx)(Pk,{children:k===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Fk,{children:[(0,y.jsxs)(Lk,{className:`flex items-center gap-2`,children:[(0,y.jsx)(gA,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Lost connection`]}),(0,y.jsx)(Rk,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(lA,{children:[(0,y.jsx)(hA,{readOnly:!0,value:CA,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(dA,{align:`inline-end`,children:(0,y.jsx)(pA,{size:`icon-xs`,onClick:yt,"aria-label":N?`Copied`:`Copy restart command`,children:N?(0,y.jsx)(ty,{}):(0,y.jsx)(iy,{})})})]}),(0,y.jsx)(Ik,{children:(0,y.jsxs)(zk,{onClick:vt,disabled:F,children:[F?(0,y.jsx)(gA,{"data-icon":`inline-start`}):null,`Retry`]})})]}):k.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Fk,{children:[(0,y.jsx)(Lk,{children:`Shell ended`}),(0,y.jsx)(Rk,{children:k.exitCode===null||k.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${k.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(Ik,{children:(0,y.jsx)(zk,{onClick:()=>window.open(bt,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Fk,{children:[(0,y.jsxs)(Lk,{className:`flex items-center gap-2`,children:[(0,y.jsx)(gA,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Connection lost`]}),(0,y.jsxs)(Rk,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,k.closeCode,k.closeReason?` · ${k.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(Ik,{children:(0,y.jsxs)(zk,{onClick:vt,disabled:F,children:[F?(0,y.jsx)(gA,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})})]})},jU=()=>{let e=(0,b.useRef)(!1),t=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{let n=n=>{e.current||t.current&&n.preventDefault()},r=()=>window.addEventListener(`beforeunload`,n);return window.addEventListener(`keydown`,r,{once:!0}),()=>{window.removeEventListener(`keydown`,r),window.removeEventListener(`beforeunload`,n)}},[]),(0,y.jsx)(AU,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[]),onForegroundProcessChange:(0,b.useCallback)(e=>{t.current=e},[])})},MU=null,NU=null,PU=()=>MU||(typeof BroadcastChannel>`u`||typeof crypto>`u`||typeof crypto.randomUUID!=`function`?null:(NU=crypto.randomUUID(),MU=new BroadcastChannel(DA),MU.addEventListener(`message`,e=>{let t=e.data,n=rU();t.type===`ping`&&t.tabId!==NU&&t.hue===n&&MU&&NU&&MU.postMessage({type:`claimed`,tabId:NU,hue:n})}),MU));cU(),lU(`idle`),(()=>{let e=PU();if(!e||!NU)return;let t=rU(),n=new Set,r=e=>{let r=e.data;r.type===`claimed`&&r.tabId!==NU&&r.hue===t&&n.add(r.hue)};e.addEventListener(`message`,r),e.postMessage({type:`ping`,tabId:NU,hue:t}),setTimeout(()=>{if(e.removeEventListener(`message`,r),n.size===0)return;let i=iU([...n]);i!==t&&(aU(i),lU(`idle`))},250)})(),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=tF();if(!e)return;let t=document.createElement(`link`);t.id=UA,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})();var FU=document.getElementById(`root`);if(!FU)throw Error(`Root element not found`);(0,x.createRoot)(FU).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(jP,{delay:300,children:(0,y.jsx)(jU,{})})}));
|
|
240
|
-
//# sourceMappingURL=index-
|
|
238
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function qz(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Xz(t,`input`,e.processors),output:Xz(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Jz(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Jz(r.element,n);if(r.type===`set`)return Jz(r.valueType,n);if(r.type===`lazy`)return Jz(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Jz(r.innerType,n);if(r.type===`intersection`)return Jz(r.left,n)||Jz(r.right,n);if(r.type===`record`||r.type===`map`)return Jz(r.keyType,n)||Jz(r.valueType,n);if(r.type===`pipe`)return Jz(r.in,n)||Jz(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Jz(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Jz(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Jz(e,n))return!0;return!!(r.rest&&Jz(r.rest,n))}return!1}var Yz=(e,t={})=>n=>{let r=Wz({...n,processors:t});return Gz(e,r),Kz(r,e),qz(r,e)},Xz=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Wz({...i??{},target:a,io:t,processors:n});return Gz(e,o),Kz(o,e),qz(o,e)},Zz={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Qz=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Zz[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},$z=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},eB=(e,t,n,r)=>{n.type=`boolean`},tB=(e,t,n,r)=>{n.not={}},nB=(e,t,n,r)=>{let i=e._zod.def,a=AF(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},rB=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},iB=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},aB=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},oB=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Gz(a.element,t,{...r,path:[...r.path,`items`]})},sB=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Gz(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Gz(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},cB=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Gz(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},lB=(e,t,n,r)=>{let i=e._zod.def,a=Gz(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Gz(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},uB=(e,t,n,r)=>{let i=e._zod.def,a=Gz(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},dB=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},fB=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},pB=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},mB=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},hB=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Gz(a,t,r);let o=t.seen.get(e);o.ref=a},gB=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},_B=(e,t,n,r)=>{let i=e._zod.def;Gz(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},vB=$(`ZodISODateTime`,(e,t)=>{BL.init(e,t),WB.init(e,t)});function yB(e){return dz(vB,e)}var bB=$(`ZodISODate`,(e,t)=>{VL.init(e,t),WB.init(e,t)});function xB(e){return fz(bB,e)}var SB=$(`ZodISOTime`,(e,t)=>{HL.init(e,t),WB.init(e,t)});function CB(e){return pz(SB,e)}var wB=$(`ZodISODuration`,(e,t)=>{UL.init(e,t),WB.init(e,t)});function TB(e){return mz(wB,e)}var EB=(e,t)=>{pI.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>gI(e,t)},flatten:{value:t=>hI(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,jF,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,jF,2)}},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,EB);var DB=$(`ZodError`,EB,{Parent:Error}),OB=_I(DB),kB=vI(DB),AB=yI(DB),jB=xI(DB),MB=CI(DB),NB=wI(DB),PB=TI(DB),FB=EI(DB),IB=DI(DB),LB=OI(DB),RB=kI(DB),zB=AI(DB),BB=$(`ZodType`,(e,t)=>(EL.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Xz(e,`input`),output:Xz(e,`output`)}}),e.toJSONSchema=Yz(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(zF(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>YF(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>OB(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>AB(e,t,n),e.parseAsync=async(t,n)=>kB(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>jB(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>MB(e,t,n),e.decode=(t,n)=>NB(e,t,n),e.encodeAsync=async(t,n)=>PB(e,t,n),e.decodeAsync=async(t,n)=>FB(e,t,n),e.safeEncode=(t,n)=>IB(e,t,n),e.safeDecode=(t,n)=>LB(e,t,n),e.safeEncodeAsync=async(t,n)=>RB(e,t,n),e.safeDecodeAsync=async(t,n)=>zB(e,t,n),e.refine=(t,n)=>e.check(tH(t,n)),e.superRefine=t=>e.check(nH(t)),e.overwrite=t=>e.check(Pz(t)),e.optional=()=>LV(e),e.exactOptional=()=>zV(e),e.nullable=()=>VV(e),e.nullish=()=>LV(VV(e)),e.nonoptional=t=>qV(e,t),e.array=()=>xV(e),e.or=t=>TV([e,t]),e.and=t=>kV(e,t),e.transform=t=>ZV(e,FV(t)),e.default=t=>UV(e,t),e.prefault=t=>GV(e,t),e.catch=t=>YV(e,t),e.pipe=t=>ZV(e,t),e.readonly=()=>$V(e),e.describe=t=>{let n=e.clone();return VR.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return VR.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return VR.get(e);let n=e.clone();return VR.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),VB=$(`_ZodString`,(e,t)=>{DL.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qz(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Oz(...t)),e.includes=(...t)=>e.check(jz(...t)),e.startsWith=(...t)=>e.check(Mz(...t)),e.endsWith=(...t)=>e.check(Nz(...t)),e.min=(...t)=>e.check(Ez(...t)),e.max=(...t)=>e.check(Tz(...t)),e.length=(...t)=>e.check(Dz(...t)),e.nonempty=(...t)=>e.check(Ez(1,...t)),e.lowercase=t=>e.check(kz(t)),e.uppercase=t=>e.check(Az(t)),e.trim=()=>e.check(Iz()),e.normalize=(...t)=>e.check(Fz(...t)),e.toLowerCase=()=>e.check(Lz()),e.toUpperCase=()=>e.check(Rz()),e.slugify=()=>e.check(zz())}),HB=$(`ZodString`,(e,t)=>{DL.init(e,t),VB.init(e,t),e.email=t=>e.check(UR(GB,t)),e.url=t=>e.check(YR(JB,t)),e.jwt=t=>e.check(uz(lV,t)),e.emoji=t=>e.check(XR(YB,t)),e.guid=t=>e.check(WR(KB,t)),e.uuid=t=>e.check(GR(qB,t)),e.uuidv4=t=>e.check(KR(qB,t)),e.uuidv6=t=>e.check(qR(qB,t)),e.uuidv7=t=>e.check(JR(qB,t)),e.nanoid=t=>e.check(ZR(XB,t)),e.guid=t=>e.check(WR(KB,t)),e.cuid=t=>e.check(QR(ZB,t)),e.cuid2=t=>e.check($R(QB,t)),e.ulid=t=>e.check(ez($B,t)),e.base64=t=>e.check(sz(oV,t)),e.base64url=t=>e.check(cz(sV,t)),e.xid=t=>e.check(tz(eV,t)),e.ksuid=t=>e.check(nz(tV,t)),e.ipv4=t=>e.check(rz(nV,t)),e.ipv6=t=>e.check(iz(rV,t)),e.cidrv4=t=>e.check(az(iV,t)),e.cidrv6=t=>e.check(oz(aV,t)),e.e164=t=>e.check(lz(cV,t)),e.datetime=t=>e.check(yB(t)),e.date=t=>e.check(xB(t)),e.time=t=>e.check(CB(t)),e.duration=t=>e.check(TB(t))});function UB(e){return HR(HB,e)}var WB=$(`ZodStringFormat`,(e,t)=>{OL.init(e,t),VB.init(e,t)}),GB=$(`ZodEmail`,(e,t)=>{jL.init(e,t),WB.init(e,t)}),KB=$(`ZodGUID`,(e,t)=>{kL.init(e,t),WB.init(e,t)}),qB=$(`ZodUUID`,(e,t)=>{AL.init(e,t),WB.init(e,t)}),JB=$(`ZodURL`,(e,t)=>{ML.init(e,t),WB.init(e,t)}),YB=$(`ZodEmoji`,(e,t)=>{NL.init(e,t),WB.init(e,t)}),XB=$(`ZodNanoID`,(e,t)=>{PL.init(e,t),WB.init(e,t)}),ZB=$(`ZodCUID`,(e,t)=>{FL.init(e,t),WB.init(e,t)}),QB=$(`ZodCUID2`,(e,t)=>{IL.init(e,t),WB.init(e,t)}),$B=$(`ZodULID`,(e,t)=>{LL.init(e,t),WB.init(e,t)}),eV=$(`ZodXID`,(e,t)=>{RL.init(e,t),WB.init(e,t)}),tV=$(`ZodKSUID`,(e,t)=>{zL.init(e,t),WB.init(e,t)}),nV=$(`ZodIPv4`,(e,t)=>{WL.init(e,t),WB.init(e,t)}),rV=$(`ZodIPv6`,(e,t)=>{GL.init(e,t),WB.init(e,t)}),iV=$(`ZodCIDRv4`,(e,t)=>{KL.init(e,t),WB.init(e,t)}),aV=$(`ZodCIDRv6`,(e,t)=>{qL.init(e,t),WB.init(e,t)}),oV=$(`ZodBase64`,(e,t)=>{YL.init(e,t),WB.init(e,t)}),sV=$(`ZodBase64URL`,(e,t)=>{ZL.init(e,t),WB.init(e,t)}),cV=$(`ZodE164`,(e,t)=>{QL.init(e,t),WB.init(e,t)}),lV=$(`ZodJWT`,(e,t)=>{eR.init(e,t),WB.init(e,t)}),uV=$(`ZodNumber`,(e,t)=>{tR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$z(e,t,n,r),e.gt=(t,n)=>e.check(Sz(t,n)),e.gte=(t,n)=>e.check(Cz(t,n)),e.min=(t,n)=>e.check(Cz(t,n)),e.lt=(t,n)=>e.check(bz(t,n)),e.lte=(t,n)=>e.check(xz(t,n)),e.max=(t,n)=>e.check(xz(t,n)),e.int=t=>e.check(pV(t)),e.safe=t=>e.check(pV(t)),e.positive=t=>e.check(Sz(0,t)),e.nonnegative=t=>e.check(Cz(0,t)),e.negative=t=>e.check(bz(0,t)),e.nonpositive=t=>e.check(xz(0,t)),e.multipleOf=(t,n)=>e.check(wz(t,n)),e.step=(t,n)=>e.check(wz(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function dV(e){return hz(uV,e)}var fV=$(`ZodNumberFormat`,(e,t)=>{nR.init(e,t),uV.init(e,t)});function pV(e){return gz(fV,e)}var mV=$(`ZodBoolean`,(e,t)=>{rR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eB(e,t,n,r)});function hV(e){return _z(mV,e)}var gV=$(`ZodUnknown`,(e,t)=>{iR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function _V(){return vz(gV)}var vV=$(`ZodNever`,(e,t)=>{aR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tB(e,t,n,r)});function yV(e){return yz(vV,e)}var bV=$(`ZodArray`,(e,t)=>{sR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oB(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Ez(t,n)),e.nonempty=t=>e.check(Ez(1,t)),e.max=(t,n)=>e.check(Tz(t,n)),e.length=(t,n)=>e.check(Dz(t,n)),e.unwrap=()=>e.element});function xV(e,t){return Bz(bV,e,t)}var SV=$(`ZodObject`,(e,t)=>{fR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sB(e,t,n,r),LF(e,`shape`,()=>t.shape),e.keyof=()=>jV(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:_V()}),e.loose=()=>e.clone({...e._zod.def,catchall:_V()}),e.strict=()=>e.clone({...e._zod.def,catchall:yV()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>tI(e,t),e.safeExtend=t=>nI(e,t),e.merge=t=>rI(e,t),e.pick=t=>$F(e,t),e.omit=t=>eI(e,t),e.partial=(...t)=>iI(IV,e,t[0]),e.required=(...t)=>aI(KV,e,t[0])});function CV(e,t){return new SV({type:`object`,shape:e??{},...XF(t)})}var wV=$(`ZodUnion`,(e,t)=>{mR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cB(e,t,n,r),e.options=t.options});function TV(e,t){return new wV({type:`union`,options:e,...XF(t)})}var EV=$(`ZodDiscriminatedUnion`,(e,t)=>{wV.init(e,t),hR.init(e,t)});function DV(e,t,n){return new EV({type:`union`,options:t,discriminator:e,...XF(n)})}var OV=$(`ZodIntersection`,(e,t)=>{gR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lB(e,t,n,r)});function kV(e,t){return new OV({type:`intersection`,left:e,right:t})}var AV=$(`ZodEnum`,(e,t)=>{yR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nB(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new AV({...t,checks:[],...XF(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new AV({...t,checks:[],...XF(r),entries:i})}});function jV(e,t){return new AV({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...XF(t)})}var MV=$(`ZodLiteral`,(e,t)=>{bR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rB(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function NV(e,t){return new MV({type:`literal`,values:Array.isArray(e)?e:[e],...XF(t)})}var PV=$(`ZodTransform`,(e,t)=>{xR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aB(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new DF(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(dI(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(dI(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function FV(e){return new PV({type:`transform`,transform:e})}var IV=$(`ZodOptional`,(e,t)=>{CR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_B(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function LV(e){return new IV({type:`optional`,innerType:e})}var RV=$(`ZodExactOptional`,(e,t)=>{wR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_B(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zV(e){return new RV({type:`optional`,innerType:e})}var BV=$(`ZodNullable`,(e,t)=>{TR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function VV(e){return new BV({type:`nullable`,innerType:e})}var HV=$(`ZodDefault`,(e,t)=>{ER.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function UV(e,t){return new HV({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():KF(t)}})}var WV=$(`ZodPrefault`,(e,t)=>{OR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function GV(e,t){return new WV({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():KF(t)}})}var KV=$(`ZodNonOptional`,(e,t)=>{kR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qV(e,t){return new KV({type:`nonoptional`,innerType:e,...XF(t)})}var JV=$(`ZodCatch`,(e,t)=>{jR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function YV(e,t){return new JV({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var XV=$(`ZodPipe`,(e,t)=>{MR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hB(e,t,n,r),e.in=t.in,e.out=t.out});function ZV(e,t){return new XV({type:`pipe`,in:e,out:t})}var QV=$(`ZodReadonly`,(e,t)=>{PR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gB(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $V(e){return new QV({type:`readonly`,innerType:e})}var eH=$(`ZodCustom`,(e,t)=>{IR.init(e,t),BB.init(e,t),e._zod.processJSONSchema=(t,n,r)=>iB(e,t,n,r)});function tH(e,t={}){return Vz(eH,e,t)}function nH(e){return Hz(e)}CV({ok:hV(),sessions:dV().int().nonnegative()}).strict(),DV(`type`,[CV({type:NV(`input`),data:UB().max(xF)}).strict(),CV({type:NV(`resize`),cols:dV().int().positive().max(wF),rows:dV().int().positive().max(TF)}).strict()]);var rH=DV(`type`,[CV({type:NV(`output`),data:UB().max(SF)}).strict(),CV({type:NV(`exit`),code:dV().int().nullable()}).strict(),CV({type:NV(`title`),title:UB().max(CF)}).strict(),CV({type:NV(`session`),shell:UB().min(1),shellName:UB().min(1),pid:dV().int().nonnegative(),cwd:UB().min(1)}).strict(),CV({type:NV(`cwd`),cwd:UB().min(1)}).strict(),CV({type:NV(`foreground`),process:UB().max(256).nullable()}).strict()]),iH=async e=>{if(!(typeof document>`u`)&&e.name)try{await Promise.all([document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`)])}catch{}},aH=(e,t)=>`\x1b[${e};${t+1}u`,oH=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},sH=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),cH=(e,t)=>{let n=e.buffer.active,r=Math.max(0,n.baseY-n.viewportY),i=r===0;try{t.fit()}catch{return!1}try{if(i)return e.scrollToBottom(),!0;let t=e.buffer.active;if(r>t.baseY)return e.scrollToBottom(),!0;let n=t.baseY-r-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},lH=(e,t)=>`\r\n\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,uH={block:{blink:`\x1B[1 q`,steady:`\x1B[2 q`},underline:{blink:`\x1B[3 q`,steady:`\x1B[4 q`},bar:{blink:`\x1B[5 q`,steady:`\x1B[6 q`}},dH=(e,t)=>{let n=t?`blink`:`steady`;return`\x1b[?25h${uH[e][n]}`},fH=(e,t)=>`${dH(e,t)}\r\n\x1b[2;32m[reconnected]\x1b[0m\r\n\r\n`,pH=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,mH=55296,hH=56319,gH=(e,t)=>{if(e.length<=t)return[e];let n=[],r=0;for(;r<e.length;){let i=Math.min(r+t,e.length);if(i<e.length){let t=e.charCodeAt(i-1);t>=mH&&t<=hH&&--i}i===r&&(i=r+t),n.push(e.slice(r,i)),r=i}return n},_H=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active,r=Math.max(0,n.baseY-t.distanceFromBottom)-n.viewportY;r!==0&&e.scrollLines(r)},vH=(e,t)=>{e._core?._writeBuffer?.handleUserInput(),e.write(t)},yH=e=>e[0]===3,bH=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},xH=1/bA,SH=e=>Math.round(e*xH)/xH,CH=e=>{if(!Number.isFinite(e))return yA;let t=SH(e);return t<1?1:t>2?2:t},wH=1/1,TH=e=>Math.round(e*wH)/wH,EH=e=>{if(!Number.isFinite(e))return 0;let t=TH(e);return t<0?0:t>48?48:t},DH=e=>{if(!Number.isFinite(e))return 0;let t=TH(e);return t<0?0:t>48?48:t},OH=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},kH=(e,t)=>e.key!==`k`&&e.key!==`K`?!1:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,AH=(e,t)=>e.key!==`f`&&e.key!==`F`?!1:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,jH=()=>{if(typeof window>`u`)return null;try{let e=window.localStorage.getItem(NA);return e&&e.trim()?e:null}catch{return null}},MH=()=>{if(typeof window>`u`)return!0;try{let e=window.localStorage.getItem(RA);return e===`true`?!0:e!==`false`}catch{return!0}},NH=()=>{if(typeof window>`u`)return IP;try{let e=window.localStorage.getItem(LA);return RP(e)?e:IP}catch{return IP}},PH=()=>{if(typeof window>`u`)return $P;try{let e=window.localStorage.getItem(MA);return e===`local`?jH()?PA:$P:eF(e).id}catch{return $P}},FH=()=>{if(typeof window>`u`)return 13;try{let e=window.localStorage.getItem(FA);return e===null||e===``?13:bH(Number(e))}catch{return 13}},IH=()=>{if(typeof window>`u`)return yA;try{let e=window.localStorage.getItem(IA);return e===null||e===``?yA:CH(Number(e))}catch{return yA}},LH=()=>{if(typeof window>`u`)return rF;try{let e=window.localStorage.getItem(zA);if(e===null||e===``)return rF;let t=Number(e);return aF(t)?t:rF}catch{return rF}},RH=()=>{if(typeof window>`u`)return!0;try{let e=window.localStorage.getItem(BA);return e===`true`?!0:e!==`false`}catch{return!0}},zH=()=>{if(typeof window>`u`)return cF;try{return lF(window.localStorage.getItem(jA)).id}catch{return cF}},BH=()=>{if(typeof window>`u`)return 0;try{let e=window.localStorage.getItem(VA);return e===null||e===``?0:EH(Number(e))}catch{return 0}},VH=()=>{if(typeof window>`u`)return 0;try{let e=window.localStorage.getItem(HA);return e===null||e===``?0:DH(Number(e))}catch{return 0}},HH=`<path d='m6 8 4 4-4 4M12 16h6'/>`,UH=[`<circle cx='7' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='12' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='17' cy='12' r='1.5' fill='currentColor' stroke='none'/>`].join(``),WH=(e,t)=>{let n=`hsl(${e} 80% 62%)`,r=`hsl(${e} 85% 12%)`,i=t===`active`?UH:HH;return[`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' color='${r}' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='${t===`dead`?EA:1}'>`,`<rect x='2' y='4' width='20' height='16' rx='2' fill='${n}'/>`,i,`</svg>`].join(``)},GH=e=>{try{let t=window.localStorage?.getItem(e);return t?JSON.parse(t):null}catch{return null}},KH=(e,t)=>{try{window.localStorage?.setItem(e,JSON.stringify(t))}catch{}},qH=e=>{try{return window.sessionStorage?.getItem(e)??null}catch{return null}},JH=(e,t)=>{try{window.sessionStorage?.setItem(e,t)}catch{}},YH=(e,t)=>{let n=Math.abs(e-t);return Math.min(n,360-n)},XH=e=>{if(e.length===0)return Math.floor(Math.random()*360);let t=0,n=-1;for(let r=0;r<360;r+=12){let i=360;for(let t of e){let e=YH(r,t);e<i&&(i=e)}i>n&&(n=i,t=r)}let r=Math.floor((Math.random()-.5)*12);return(t+r+360)%360},ZH=()=>{let e=qH(WA);if(!e)return null;let t=Number(e);return Number.isFinite(t)?t:null},QH=()=>{let e=GH(GA);return Array.isArray(e)?e.filter(e=>typeof e==`number`&&Number.isFinite(e)):[]},$H=(e,t)=>{JH(WA,String(e)),KH(GA,[...t,e].slice(-16))},eU=null,tU=`idle`,nU=null,rU=()=>{if(eU!==null)return eU;let e=ZH();if(e!==null)return eU=e,e;let t=QH(),n=XH(t);return $H(n,t),eU=n,n},iU=e=>XH([...QH(),...e]),aU=e=>{eU=e,$H(e,QH())},oU=(e,t)=>nU===null||e!==tU||t!==nU,sU=(e,t)=>{tU=e,nU=t},cU=()=>{eU=null,tU=`idle`,nU=null},lU=e=>{if(typeof document>`u`)return;let t=rU();if(!oU(e,t))return;sU(e,t);let n=`data:image/svg+xml,${encodeURIComponent(WH(t,e))}`,r=document.querySelector(`link[rel="icon"]`);r||(r=document.createElement(`link`),r.rel=`icon`,document.head.appendChild(r)),r.type=`image/svg+xml`,r.href=n},uU=`/api/health`,dU=async()=>{try{return(await fetch(uU)).ok}catch{return!1}},fU=(e,t)=>t.buffer.active.type===`alternate`?e.deltaMode===WheelEvent.DOM_DELTA_PIXEL:!1,pU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(NA,e)}catch{}},mU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(RA,String(e))}catch{}},hU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(LA,e)}catch{}},gU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(MA,e)}catch{}},_U=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(FA,String(e))}catch{}},vU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(IA,String(e))}catch{}},yU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(zA,String(e))}catch{}},bU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(BA,String(e))}catch{}},xU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(jA,e)}catch{}},SU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(VA,String(e))}catch{}},CU=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(HA,String(e))}catch{}},wU=e=>e||`localterm`,TU=e=>`${SA}${e||`localterm`}`,EU={matchBackground:OA,activeMatchBackground:kA,activeMatchBorder:AA,matchOverviewRuler:kA,activeMatchColorOverviewRuler:AA},DU=`cwd`,OU=e=>{let t=new URL(`/ws`,window.location.href);t.protocol=t.protocol===`https:`?`wss:`:`ws:`;let n=e??new URLSearchParams(window.location.search).get(DU);return n&&t.searchParams.set(DU,n),t.toString()},kU=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(DU,e),t.toString()},AU=({onModalOpenChange:e,onForegroundProcessChange:t}={})=>{let n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(!1),a=(0,b.useRef)(null),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(null),d=(0,b.useRef)(null),f=(0,b.useRef)(zH()),p=(0,b.useRef)(PH()),m=(0,b.useRef)(jH()),h=(0,b.useRef)(FH()),g=(0,b.useRef)(IH()),_=(0,b.useRef)(NH()),v=(0,b.useRef)(MH()),x=(0,b.useRef)(LH()),S=(0,b.useRef)(RH()),C=(0,b.useRef)(BH()),w=(0,b.useRef)(VH()),T=(0,b.useRef)(null),E=(0,b.useRef)(null),D=(0,b.useRef)(null),O=(0,b.useRef)(null),[k,A]=(0,b.useState)(null),[j,M]=(0,b.useState)(0),[N,P]=(0,b.useState)(!1),[F,I]=(0,b.useState)(!1),[L,ee]=(0,b.useState)(!1),[R,z]=(0,b.useState)(!1),B=(0,b.useRef)(null),[V,H]=(0,b.useState)(0),[U,te]=(0,b.useState)(!1),[W,ne]=(0,b.useState)(!1),re=(0,b.useRef)(null),ie=(0,b.useRef)(!1),ae=U||W;ie.current=W;let[oe,se]=(0,b.useState)(``),[ce,le]=(0,b.useState)({resultIndex:-1,resultCount:0}),[ue,de]=(0,b.useState)(f.current),[fe,pe]=(0,b.useState)(null),he=fe??ue,ge=(0,b.useMemo)(()=>lF(he),[he]),[_e,ve]=(0,b.useState)(p.current),[be,xe]=(0,b.useState)(m.current),[Se,Ce]=(0,b.useState)(null),we=Se??_e,Te=(0,b.useMemo)(()=>eF(we,be),[we,be]),[Ee,De]=(0,b.useState)(h.current),[Oe,ke]=(0,b.useState)(g.current),[Ae,je]=(0,b.useState)(_.current),[Me,Ne]=(0,b.useState)(null),Pe=Me??Ae,[Fe,Ie]=(0,b.useState)(v.current),[Le,Re]=(0,b.useState)(x.current),[ze,Be]=(0,b.useState)(S.current),[Ve,He]=(0,b.useState)(C.current),[Ue,We]=(0,b.useState)(w.current),[Ge,Ke]=(0,b.useState)(null),[qe,Je]=(0,b.useState)(null),Ye=(0,b.useRef)(null),Xe=(0,b.useMemo)(OH,[]);(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let c=!1,l=!1,u=!1,y=``,b=null,C=null,w=null,k=null,j=null,N=`idle`,P=[0],F=()=>P[P.length-1]??0,I=()=>{j!==null&&(window.clearTimeout(j),j=null),N===`idle`&&k===null&&(k=window.setTimeout(()=>{k=null,!(c||l)&&(N=`active`,lU(`active`))},250)),j=window.setTimeout(()=>{j=null,k!==null&&(window.clearTimeout(k),k=null),N===`active`&&(N=`idle`,lU(`idle`))},750)},L=()=>{k!==null&&(window.clearTimeout(k),k=null),j!==null&&(window.clearTimeout(j),j=null),N===`active`&&(N=`idle`,lU(`idle`))},ee=eF(p.current,m.current);iH(ee).then(()=>{c||(R._core._charSizeService.measure(),Te())});let R=new Wv({allowProposedApi:!0,cursorBlink:v.current,cursorStyle:_.current,fontFamily:ee.family,fontSize:h.current,lineHeight:g.current,scrollback:x.current,theme:lF(f.current).colors,macOptionIsMeta:!0,scrollOnUserInput:S.current,overviewRuler:{width:0}});r.current=R;let z=new ye;T.current=z,R.loadAddon(z),R.loadAddon(new ka),R.loadAddon(new me),R.loadAddon(new It),R.loadAddon(new Rt);let V=new Ca;R.loadAddon(V),R.unicode.activeVersion=`15`;let H=new lr;R.loadAddon(H),o.current=H;let U=H.onDidChangeResults(le);R.open(e),z.proposeDimensions&&=()=>{if(!R||!R.element||!R.element.parentElement)return;let e=R,t=e._core._renderService.dimensions.css.cell.width,n=e._core._renderService.dimensions.css.cell.height;if(t===0||n===0)return;let r=window.getComputedStyle(R.element.parentElement),i=window.getComputedStyle(R.element),a=Math.max(0,parseInt(r.getPropertyValue(`width`)))-(parseInt(i.getPropertyValue(`padding-right`))+parseInt(i.getPropertyValue(`padding-left`))),o=parseInt(r.getPropertyValue(`height`))-(parseInt(i.getPropertyValue(`padding-top`))+parseInt(i.getPropertyValue(`padding-bottom`)));return{cols:Math.max(2,Math.floor(a/t)),rows:Math.max(1,Math.floor(o/n))}};let te=()=>{let e=R.buffer.active,t=e.length,n=R.rows,r=e.viewportY+n>=t,i=t>n,a=D.current,o=O.current;if(!(!a||!o)&&(a.classList.toggle(`xterm-scrollbar-visible`,!r&&i),i)){let r=n/t,i=e.viewportY/t;o.style.height=`${r*100}%`,o.style.top=`${i*100}%`}};te();let W=R.onScroll(te),ne=!1,re=0,ie=0,ae=e=>{if(e.button===0){ne=!0,re=e.clientY,ie=R.buffer.active.viewportY;try{e.target.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}},oe=e=>{if(!ne)return;let t=D.current;if(!t)return;let n=t.clientHeight,r=R.buffer.active.length-R.rows;if(r<=0||n<=0)return;let i=n/r,a=e.clientY-re,o=Math.max(0,Math.min(r,ie+Math.round(a/i)));o!==R.buffer.active.viewportY&&R.scrollLines(o-R.buffer.active.viewportY)},se=()=>{ne=!1},ce=e=>{if(e.button!==0||e.target===O.current)return;let t=D.current;if(!t)return;let n=t.getBoundingClientRect(),r=(e.clientY-n.top)/n.height,i=R.buffer.active,a=i.length,o=Math.max(0,Math.min(a-R.rows,Math.round(r*a)-Math.floor(R.rows/2)));R.scrollLines(o-i.viewportY)},ue=O.current,de=D.current;ue&&(ue.addEventListener(`pointerdown`,ae),ue.addEventListener(`pointermove`,oe),ue.addEventListener(`pointerup`,se),ue.addEventListener(`pointercancel`,se)),de&&de.addEventListener(`pointerdown`,ce);try{let e=new yu;e.onContextLoss(()=>e.dispose()),R.loadAddon(e)}catch{}let fe=R.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let t=e[0],n=typeof t==`number`?t:1;return P.push(n),!0}),pe=R.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let t=e[0],n=typeof t==`number`&&t>0?t:1;for(let e=0;e<n&&P.length>1;e+=1)P.pop();return!0}),he=R.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let t=e[0],n=e[1];if(typeof t!=`number`)return!0;let r=t,i=typeof n==`number`&&n>0?n:1,a=P.length-1,o=P[a]??0;return i===1?P[a]=r:i===2?P[a]=o|r:i===3&&(P[a]=o&~r),!0}),ge=R.parser.registerCsiHandler({final:`J`},yH),_e=R.parser.registerCsiHandler({prefix:`?`,final:`J`},yH),ve=e=>{b?.readyState===WebSocket.OPEN&&b.send(JSON.stringify(e))},be=()=>{let e=d.current;e&&window.clearTimeout(e.timer),d.current=null},xe=()=>{let e=d.current;if(e){if(Date.now()>e.expiresAtMs){be();return}_H(R,e.anchor)}},Se=e=>{be();let t=window.setTimeout(()=>{xe(),d.current=null},vA);d.current={anchor:e,expiresAtMs:Date.now()+vA,timer:t}};R.attachCustomWheelEventHandler(e=>fU(e,R)?(e.preventDefault(),!1):!0),R.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(e.altKey&&e.code===`KeyT`){if(e.type===`keydown`){e.preventDefault();let t=document.getElementById(`new-shell-link`);t instanceof HTMLAnchorElement&&t.click()}return!1}if(kH(e,Xe))return e.type===`keydown`&&(e.preventDefault(),B.current?.()),!1;if(AH(e,Xe))return e.type===`keydown`&&(e.preventDefault(),E.current?.()),!1;if(e.type===`keydown`&&e.key===`Enter`){let t=sH(e),n=(F()&1)!=0;if(t!==0&&n)return e.preventDefault(),ve({type:`input`,data:aH(13,t)}),!1;if(t===1)return e.preventDefault(),ve({type:`input`,data:`
|
|
239
|
+
`}),!1}return!0});let Ce=e=>{if(l)return;let t=e.trim();t&&(y=t,document.title=wU(t))};s.current=()=>R.focus();let we=(e,t)=>ve({type:`resize`,cols:e,rows:t}),Te=()=>{let e=oH(R);cH(R,z)&&(Se(e),we(R.cols,R.rows))},Ee=()=>{w!==null&&window.clearTimeout(w),w=window.setTimeout(()=>{w=null,Te()},80)};R.onData(e=>{for(let t of gH(e,xF))ve({type:`input`,data:t})}),R.onResize(({cols:e,rows:t})=>we(e,t));let De=new ResizeObserver(Ee);De.observe(e),Te(),requestAnimationFrame(()=>R.focus());let Oe=e=>{if(!l){if(l=!0,e===null||e===0){window.close(),setTimeout(()=>{c||(L(),lU(`dead`),R.write(pH(e)),document.title=TU(y),A({reason:`shell-exited`,exitCode:e}),Ke(null))},100);return}L(),lU(`dead`),R.write(pH(e)),document.title=TU(y),A({reason:`shell-exited`,exitCode:e}),Ke(null)}},ke=(e,t,n)=>{l||(l=!0,L(),lU(`dead`),R.write(lH(e,t)),document.title=TU(y),A({reason:`connection-lost`,closeCode:e,closeReason:t,wasClean:n}),Ke(null))},Ae=()=>{if(c)return;let e=new WebSocket(OU(Ye.current));b=e,e.addEventListener(`open`,()=>{c||b!==e||(u=!0,M(0),we(R.cols,R.rows))}),e.addEventListener(`message`,n=>{if(c||b!==e)return;let r;try{r=JSON.parse(typeof n.data==`string`?n.data:String(n.data))}catch{return}if(typeof r==`object`&&r&&r.type===`output`&&typeof r.data==`string`){let e=r.data;vH(R,e),I();return}let i=rH.safeParse(r);if(!i.success)return;let a=i.data;a.type===`title`?Ce(a.title):a.type===`session`?(Ke({shell:a.shell,shellName:a.shellName,pid:a.pid,cwd:a.cwd}),Je(a.cwd)):a.type===`cwd`?Je(a.cwd):a.type===`foreground`?t?.(a.process!==null):a.type===`exit`&&(L(),Oe(a.code))}),e.addEventListener(`close`,t=>{if(b===e&&(b=null,!c&&!l)){if(u){console.warn(`[localterm] websocket closed: code=${t.code} reason=${JSON.stringify(t.reason)} wasClean=${t.wasClean}`),ke(t.code,t.reason,t.wasClean);return}M(e=>e+1),C=window.setTimeout(Ae,_A)}}),e.addEventListener(`error`,t=>{console.warn(`[localterm] websocket error`,t);try{e.close()}catch{}})};return a.current=()=>{if(!c){l=!1,u=!1,A(null),Ke(null),M(0),lU(`idle`),t?.(!1),C!==null&&(window.clearTimeout(C),C=null);try{b?.close()}catch{}b=null,Ae()}},Ae(),i.current=!0,()=>{c=!0,a.current=null,s.current=null,o.current=null,r.current=null,i.current=!1,T.current=null,D.current=null,O.current=null,ue&&(ue.removeEventListener(`pointerdown`,ae),ue.removeEventListener(`pointermove`,oe),ue.removeEventListener(`pointerup`,se),ue.removeEventListener(`pointercancel`,se)),de&&de.removeEventListener(`pointerdown`,ce),U.dispose(),W.dispose(),fe.dispose(),pe.dispose(),he.dispose(),ge.dispose(),_e.dispose(),C!==null&&window.clearTimeout(C),w!==null&&window.clearTimeout(w),be(),L(),De.disconnect();try{b?.close()}catch{}b=null,R.dispose(),document.title=xA}},[]),(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.theme=ge.colors)},[ge]),(0,b.useEffect)(()=>{if(!i.current||!r.current)return;let e=!1;return iH(Te).then(()=>{if(e)return;let t=r.current;if(!t)return;t.options.fontFamily=Te.family;let n=T.current;n&&cH(t,n)}),()=>{e=!0}},[Te]);let Ze=(0,b.useCallback)(e=>{de(e),pe(null),xU(e)},[]),Qe=(0,b.useCallback)(e=>{ve(e),Ce(null),gU(e)},[]),$e=(0,b.useCallback)(e=>{xe(e),ve(PA),Ce(null),pU(e),gU(PA)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.fontSize=Ee;let t=T.current;t&&cH(e,t)},[Ee]);let et=(0,b.useCallback)(e=>{let t=bH(e);De(t),_U(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.lineHeight=Oe;let t=T.current;t&&cH(e,t)},[Oe]);let tt=(0,b.useCallback)(e=>{let t=CH(e);ke(t),vU(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorStyle=Pe)},[Pe]);let nt=(0,b.useCallback)(e=>{je(e),Ne(null),hU(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorBlink=Fe)},[Fe]);let rt=(0,b.useCallback)(e=>{Ie(e),mU(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollback=Le)},[Le]);let it=(0,b.useCallback)(e=>{Re(e),yU(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollOnUserInput=ze)},[ze]);let at=(0,b.useCallback)(e=>{Be(e),bU(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;let t=T.current;t&&cH(e,t)},[Ve,Ue]);let ot=(0,b.useCallback)(e=>{let t=EH(e);He(t),SU(t)},[]),st=(0,b.useCallback)(e=>{let t=DH(e);We(t),CU(t)},[]);(0,b.useEffect)(()=>{if(!L)return;let e=c.current;e&&(e.focus(),e.select())},[L,V]);let ct=(0,b.useCallback)(e=>{if(!e){o.current?.clearDecorations(),le({resultIndex:-1,resultCount:0});return}o.current?.findNext(e,{decorations:EU})},[]),lt=(0,b.useCallback)(e=>{e&&o.current?.findPrevious(e,{decorations:EU})},[]),ut=(0,b.useCallback)(()=>{ee(!1),se(``),le({resultIndex:-1,resultCount:0}),o.current?.clearDecorations(),s.current?.()},[]),dt=(0,b.useCallback)(()=>{re.current!==null&&(window.clearTimeout(re.current),re.current=null),te(!0)},[]),ft=(0,b.useCallback)(()=>{re.current=window.setTimeout(()=>{re.current=null,ie.current||te(!1)},200)},[]),pt=(0,b.useCallback)(e=>{ne(e),e||(re.current!==null&&window.clearTimeout(re.current),re.current=window.setTimeout(()=>{re.current=null,te(!1)},200))},[]);B.current=(0,b.useCallback)(()=>{z(e=>!e)},[]);let mt=(0,b.useCallback)(()=>{z(!1),s.current?.()},[]),ht=(0,b.useCallback)(()=>{ee(!0),z(!1),H(e=>e+1)},[]);E.current=ht;let gt=(0,b.useCallback)(e=>{let t=e.target.value;se(t),ct(t)},[ct]),_t=(0,b.useCallback)(e=>{if(AH(e.nativeEvent,Xe)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),ut();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?lt(oe):ct(oe))},[ut,ct,lt,Xe,oe]),vt=(0,b.useCallback)(()=>{I(!0),a.current?.(),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{l.current=null,I(!1)},800)},[]),yt=(0,b.useCallback)(()=>{navigator.clipboard.writeText(CA).then(()=>{P(!0),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,P(!1)},wA)}).catch(()=>{})},[]);(0,b.useEffect)(()=>()=>{re.current!==null&&(window.clearTimeout(re.current),re.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),u.current!==null&&(window.clearTimeout(u.current),u.current=null)},[]),(0,b.useEffect)(()=>{if(Ye.current=qe,!qe)return;let e=new URL(window.location.href);e.searchParams.set(DU,qe),window.history.replaceState(null,``,e)},[qe]);let bt=kU(qe),xt=k!==null,St=!xt&&j>=2,Ct=xt||St,wt=k!==null&&k.reason!==`shell-exited`||St;(0,b.useEffect)(()=>{if(!wt)return;let e=Date.now(),t=!1,n=null,i=i=>{if(t)return;if(i){let e=r.current;e&&(e.write(fH(Pe,Fe)),e.refresh(0,e.rows-1),e.focus()),a.current?.();return}let s=Date.now()-e<5e3?250:TA;n=window.setTimeout(o,s)},o=()=>{dU().then(i)};return o(),()=>{t=!0,n!==null&&window.clearTimeout(n)}},[wt]),(0,b.useEffect)(()=>{e?.(Ct),Ct&&z(!1)},[Ct,e]);let Tt=ce.resultCount===0?`0/0`:`${ce.resultIndex+1}/${ce.resultCount}`,Et=ge.colors.background??`#101010`,Dt=(0,b.useMemo)(()=>{let e=Xe?`⌘`:`Ctrl+`,t=sF.map(e=>({id:`theme:${e.id}`,label:`Theme: ${e.name}`,category:`Theme`,action:()=>Ze(e.id)})),n=QP.map(e=>({id:`font:${e.id}`,label:`Font: ${e.name}`,category:`Font`,action:()=>Qe(e.id)}));return[...t,...n,{id:`find`,label:`Find in terminal`,category:`Search`,shortcut:`${e}F`,icon:(0,y.jsx)(ly,{className:`size-3.5`}),action:ht},{id:`new-shell`,label:`Open new shell`,category:`Tab`,shortcut:`Alt+T`,icon:(0,y.jsx)(cy,{className:`size-3.5`}),action:()=>{let e=document.getElementById(`new-shell-link`);e instanceof HTMLAnchorElement&&e.click()}},...FP.map(e=>({id:`cursor:${e.id}`,label:`Cursor: ${e.name}`,category:`Cursor`,action:()=>nt(e.id)})),{id:`cursor-blink`,label:`Cursor blink: ${Fe?`On`:`Off`}`,category:`Cursor`,action:()=>rt(!Fe)},{id:`font-size-up`,label:`Increase font size`,category:`Font`,shortcut:`${e}+`,icon:(0,y.jsx)(sy,{className:`size-3.5`}),action:()=>et(Ee+1)},{id:`font-size-down`,label:`Decrease font size`,category:`Font`,shortcut:`${e}-`,icon:(0,y.jsx)(sy,{className:`size-3.5`}),action:()=>et(Ee-1)},{id:`scroll-on-input`,label:`Pin to bottom on input: ${ze?`On`:`Off`}`,category:`Scrollback`,action:()=>at(!ze)}]},[Xe,Ze,Qe,ht,nt,Fe,rt,Ee,et,ze,at]);return(0,y.jsxs)(`div`,{className:`h-dvh w-dvw`,style:{background:Et},children:[(0,y.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,y.jsx)(`div`,{ref:n,"aria-label":`terminal session`,className:`absolute`,style:{top:Ue,right:Ve,bottom:Ue,left:Ve}}),(0,y.jsx)(`div`,{ref:D,className:`xterm-scrollbar-track`,style:{top:Ue,right:Ve,bottom:Ue},children:(0,y.jsx)(`div`,{ref:O,className:`xterm-scrollbar-thumb`})}),k===null?null:(0,y.jsx)(Hk,{variant:`destructive`,role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10`,children:k.reason===`shell-exited`?k.exitCode===null?`exited`:`exited · code ${k.exitCode}`:`disconnected · code ${k.closeCode}`}),(0,y.jsxs)(`div`,{className:Lb(`absolute right-0 top-0 z-10 flex flex-col items-end pr-3 pt-1`,ae?`pointer-events-auto`:`pointer-events-none`),onMouseEnter:dt,onMouseLeave:ft,children:[(0,y.jsx)(`div`,{"aria-hidden":`true`,className:Lb(`pointer-events-auto mr-0.5 h-[2px] w-5 rounded-full bg-muted-foreground/25 transition-opacity duration-150`,ae||L?`opacity-0`:`opacity-100`)}),!L&&(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,className:Lb(`mt-1 flex items-center gap-0.5 rounded-md border border-border/60 bg-background/70 p-0.5 text-muted-foreground shadow-xs backdrop-blur-md`,`transition-[opacity,transform] duration-200 ease-snappy`,ae?`translate-y-0 opacity-100`:`pointer-events-none -translate-y-1 opacity-0`),onMouseDown:e=>e.preventDefault(),onKeyDown:()=>s.current?.(),children:[(0,y.jsx)(bF,{themeId:ue,onThemeChange:Ze,onThemePreview:pe,fontId:_e,onFontChange:Qe,onFontPreview:Ce,localFontFamily:be,onLocalFontChange:$e,fontSize:Ee,onFontSizeChange:et,lineHeight:Oe,onLineHeightChange:tt,cursorStyle:Ae,onCursorStyleChange:nt,onCursorStylePreview:Ne,cursorBlink:Fe,onCursorBlinkChange:rt,scrollback:Le,onScrollbackChange:it,scrollOnUserInput:ze,onScrollOnUserInputChange:at,paddingX:Ve,onPaddingXChange:ot,paddingY:Ue,onPaddingYChange:st,sessionInfo:Ge,onPopoverOpenChange:pt,onClose:s.current??void 0}),(0,y.jsx)(Ak,{variant:`ghost`,size:`icon-sm`,onClick:ht,"aria-label":`find in terminal`,className:`hover:text-foreground`,children:(0,y.jsx)(ly,{})}),(0,y.jsx)(Ak,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,"aria-label":`open a new shell in a new browser tab`,render:(0,y.jsx)(`a`,{id:`new-shell-link`,href:bt,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`,children:(0,y.jsx)(cy,{})})]}),L&&(0,y.jsxs)(lA,{role:`search`,"aria-label":`find in terminal`,className:`mt-1 w-80 border-border/60 bg-background/70 text-muted-foreground shadow-xs backdrop-blur-md dark:bg-background/70`,children:[(0,y.jsx)(hA,{ref:c,type:`search`,value:oe,onChange:gt,onKeyDown:_t,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(dA,{align:`inline-end`,children:[(0,y.jsx)(mA,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:Tt}),(0,y.jsx)(pA,{size:`icon-xs`,onClick:()=>lt(oe),disabled:ce.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(ry,{})}),(0,y.jsx)(pA,{size:`icon-xs`,onClick:()=>ct(oe),disabled:ce.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(ny,{})})]})]})]})]}),(0,y.jsx)(YA,{open:R,onClose:mt,commands:Dt}),(0,y.jsx)(jk,{open:Ct,children:(0,y.jsx)(Pk,{children:k===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Fk,{children:[(0,y.jsxs)(Lk,{className:`flex items-center gap-2`,children:[(0,y.jsx)(gA,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Lost connection`]}),(0,y.jsx)(Rk,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(lA,{children:[(0,y.jsx)(hA,{readOnly:!0,value:CA,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(dA,{align:`inline-end`,children:(0,y.jsx)(pA,{size:`icon-xs`,onClick:yt,"aria-label":N?`Copied`:`Copy restart command`,children:N?(0,y.jsx)(ty,{}):(0,y.jsx)(iy,{})})})]}),(0,y.jsx)(Ik,{children:(0,y.jsxs)(zk,{onClick:vt,disabled:F,children:[F?(0,y.jsx)(gA,{"data-icon":`inline-start`}):null,`Retry`]})})]}):k.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Fk,{children:[(0,y.jsx)(Lk,{children:`Shell ended`}),(0,y.jsx)(Rk,{children:k.exitCode===null||k.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${k.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(Ik,{children:(0,y.jsx)(zk,{onClick:()=>window.open(bt,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Fk,{children:[(0,y.jsxs)(Lk,{className:`flex items-center gap-2`,children:[(0,y.jsx)(gA,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Connection lost`]}),(0,y.jsxs)(Rk,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,k.closeCode,k.closeReason?` · ${k.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(Ik,{children:(0,y.jsxs)(zk,{onClick:vt,disabled:F,children:[F?(0,y.jsx)(gA,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})})]})},jU=()=>{let e=(0,b.useRef)(!1),t=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{let n=n=>{e.current||t.current&&n.preventDefault()},r=()=>window.addEventListener(`beforeunload`,n);return window.addEventListener(`keydown`,r,{once:!0}),()=>{window.removeEventListener(`keydown`,r),window.removeEventListener(`beforeunload`,n)}},[]),(0,y.jsx)(AU,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[]),onForegroundProcessChange:(0,b.useCallback)(e=>{t.current=e},[])})},MU=null,NU=null,PU=()=>MU||(typeof BroadcastChannel>`u`||typeof crypto>`u`||typeof crypto.randomUUID!=`function`?null:(NU=crypto.randomUUID(),MU=new BroadcastChannel(DA),MU.addEventListener(`message`,e=>{let t=e.data,n=rU();t.type===`ping`&&t.tabId!==NU&&t.hue===n&&MU&&NU&&MU.postMessage({type:`claimed`,tabId:NU,hue:n})}),MU));cU(),lU(`idle`),(()=>{let e=PU();if(!e||!NU)return;let t=rU(),n=new Set,r=e=>{let r=e.data;r.type===`claimed`&&r.tabId!==NU&&r.hue===t&&n.add(r.hue)};e.addEventListener(`message`,r),e.postMessage({type:`ping`,tabId:NU,hue:t}),setTimeout(()=>{if(e.removeEventListener(`message`,r),n.size===0)return;let i=iU([...n]);i!==t&&(aU(i),lU(`idle`))},250)})(),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=tF();if(!e)return;let t=document.createElement(`link`);t.id=UA,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})();var FU=document.getElementById(`root`);if(!FU)throw Error(`Root element not found`);(0,x.createRoot)(FU).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(jP,{delay:300,children:(0,y.jsx)(jU,{})})}));
|
|
240
|
+
//# sourceMappingURL=index-CSyPEA7w.js.map
|