@synnaxlabs/client 0.43.0 → 0.44.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/.turbo/turbo-build.log +7 -7
- package/dist/access/payload.d.ts +1 -1
- package/dist/access/payload.d.ts.map +1 -1
- package/dist/access/policy/client.d.ts +263 -6
- package/dist/access/policy/client.d.ts.map +1 -1
- package/dist/access/policy/external.d.ts +0 -1
- package/dist/access/policy/external.d.ts.map +1 -1
- package/dist/access/policy/payload.d.ts +105 -93
- package/dist/access/policy/payload.d.ts.map +1 -1
- package/dist/auth/auth.d.ts +1 -1
- package/dist/auth/auth.d.ts.map +1 -1
- package/dist/channel/client.d.ts +12 -13
- package/dist/channel/client.d.ts.map +1 -1
- package/dist/channel/payload.d.ts +77 -19
- package/dist/channel/payload.d.ts.map +1 -1
- package/dist/channel/retriever.d.ts +9 -16
- package/dist/channel/retriever.d.ts.map +1 -1
- package/dist/channel/writer.d.ts +1 -1
- package/dist/channel/writer.d.ts.map +1 -1
- package/dist/client.cjs +27 -135
- package/dist/client.d.ts +3 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8619 -28938
- package/dist/connection/checker.d.ts +1 -1
- package/dist/connection/checker.d.ts.map +1 -1
- package/dist/control/client.d.ts +1 -0
- package/dist/control/client.d.ts.map +1 -1
- package/dist/control/state.d.ts +6 -6
- package/dist/control/state.d.ts.map +1 -1
- package/dist/errors.d.ts +18 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/framer/adapter.d.ts +3 -3
- package/dist/framer/adapter.d.ts.map +1 -1
- package/dist/framer/client.d.ts +4 -13
- package/dist/framer/client.d.ts.map +1 -1
- package/dist/framer/codec.d.ts +1 -1
- package/dist/framer/codec.d.ts.map +1 -1
- package/dist/framer/deleter.d.ts +5 -5
- package/dist/framer/deleter.d.ts.map +1 -1
- package/dist/framer/frame.d.ts +5 -7
- package/dist/framer/frame.d.ts.map +1 -1
- package/dist/framer/streamProxy.d.ts +1 -1
- package/dist/framer/streamProxy.d.ts.map +1 -1
- package/dist/framer/streamer.d.ts +139 -20
- package/dist/framer/streamer.d.ts.map +1 -1
- package/dist/framer/writer.d.ts +222 -33
- package/dist/framer/writer.d.ts.map +1 -1
- package/dist/hardware/device/client.d.ts +49 -28
- package/dist/hardware/device/client.d.ts.map +1 -1
- package/dist/hardware/device/payload.d.ts +126 -46
- package/dist/hardware/device/payload.d.ts.map +1 -1
- package/dist/hardware/rack/client.d.ts +78 -22
- package/dist/hardware/rack/client.d.ts.map +1 -1
- package/dist/hardware/rack/payload.d.ts +99 -56
- package/dist/hardware/rack/payload.d.ts.map +1 -1
- package/dist/hardware/task/client.d.ts +100 -41
- package/dist/hardware/task/client.d.ts.map +1 -1
- package/dist/hardware/task/payload.d.ts +83 -61
- package/dist/hardware/task/payload.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/label/client.d.ts +138 -20
- package/dist/label/client.d.ts.map +1 -1
- package/dist/label/external.d.ts +0 -2
- package/dist/label/external.d.ts.map +1 -1
- package/dist/label/payload.d.ts +4 -5
- package/dist/label/payload.d.ts.map +1 -1
- package/dist/ontology/client.d.ts +45 -135
- package/dist/ontology/client.d.ts.map +1 -1
- package/dist/ontology/group/group.d.ts +3 -3
- package/dist/ontology/group/group.d.ts.map +1 -1
- package/dist/ontology/group/payload.d.ts +3 -27
- package/dist/ontology/group/payload.d.ts.map +1 -1
- package/dist/ontology/payload.d.ts +113 -243
- package/dist/ontology/payload.d.ts.map +1 -1
- package/dist/ontology/writer.d.ts +4 -4
- package/dist/ontology/writer.d.ts.map +1 -1
- package/dist/ranger/alias.d.ts +11 -5
- package/dist/ranger/alias.d.ts.map +1 -1
- package/dist/ranger/client.d.ts +87 -30
- package/dist/ranger/client.d.ts.map +1 -1
- package/dist/ranger/external.d.ts +1 -1
- package/dist/ranger/external.d.ts.map +1 -1
- package/dist/ranger/kv.d.ts +10 -12
- package/dist/ranger/kv.d.ts.map +1 -1
- package/dist/ranger/payload.d.ts +23 -44
- package/dist/ranger/payload.d.ts.map +1 -1
- package/dist/ranger/writer.d.ts +22 -19
- package/dist/ranger/writer.d.ts.map +1 -1
- package/dist/testutil/client.d.ts +4 -0
- package/dist/testutil/client.d.ts.map +1 -0
- package/dist/user/client.d.ts +59 -6
- package/dist/user/client.d.ts.map +1 -1
- package/dist/user/payload.d.ts +4 -6
- package/dist/user/payload.d.ts.map +1 -1
- package/dist/user/retriever.d.ts +2 -2
- package/dist/user/retriever.d.ts.map +1 -1
- package/dist/util/decodeJSONString.d.ts +2 -2
- package/dist/util/decodeJSONString.d.ts.map +1 -1
- package/dist/util/parseWithoutKeyConversion.d.ts +2 -2
- package/dist/util/parseWithoutKeyConversion.d.ts.map +1 -1
- package/dist/util/retrieve.d.ts +1 -1
- package/dist/util/retrieve.d.ts.map +1 -1
- package/dist/util/zod.d.ts +1 -1
- package/dist/util/zod.d.ts.map +1 -1
- package/dist/workspace/client.d.ts +17 -6
- package/dist/workspace/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/client.d.ts +2 -2
- package/dist/workspace/lineplot/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/payload.d.ts +8 -9
- package/dist/workspace/lineplot/payload.d.ts.map +1 -1
- package/dist/workspace/log/client.d.ts +2 -2
- package/dist/workspace/log/client.d.ts.map +1 -1
- package/dist/workspace/log/payload.d.ts +8 -9
- package/dist/workspace/log/payload.d.ts.map +1 -1
- package/dist/workspace/payload.d.ts +10 -11
- package/dist/workspace/payload.d.ts.map +1 -1
- package/dist/workspace/schematic/client.d.ts +2 -2
- package/dist/workspace/schematic/client.d.ts.map +1 -1
- package/dist/workspace/schematic/payload.d.ts +10 -11
- package/dist/workspace/schematic/payload.d.ts.map +1 -1
- package/dist/workspace/table/client.d.ts +2 -2
- package/dist/workspace/table/client.d.ts.map +1 -1
- package/dist/workspace/table/payload.d.ts +10 -11
- package/dist/workspace/table/payload.d.ts.map +1 -1
- package/examples/node/package-lock.json +47 -39
- package/examples/node/package.json +2 -1
- package/examples/node/streamWrite.js +5 -11
- package/package.json +14 -13
- package/src/access/payload.ts +1 -1
- package/src/access/policy/client.ts +87 -32
- package/src/access/policy/external.ts +0 -1
- package/src/access/policy/payload.ts +4 -4
- package/src/access/policy/policy.spec.ts +86 -83
- package/src/auth/auth.spec.ts +29 -18
- package/src/auth/auth.ts +1 -1
- package/src/channel/batchRetriever.spec.ts +4 -9
- package/src/channel/channel.spec.ts +24 -6
- package/src/channel/client.ts +31 -46
- package/src/channel/payload.ts +13 -14
- package/src/channel/retriever.ts +26 -41
- package/src/channel/writer.ts +3 -3
- package/src/client.ts +4 -4
- package/src/connection/checker.ts +1 -1
- package/src/connection/connection.spec.ts +31 -23
- package/src/control/client.ts +2 -2
- package/src/control/state.spec.ts +3 -3
- package/src/control/state.ts +1 -1
- package/src/errors.spec.ts +9 -5
- package/src/errors.ts +28 -15
- package/src/framer/adapter.spec.ts +118 -9
- package/src/framer/adapter.ts +24 -11
- package/src/framer/client.spec.ts +125 -2
- package/src/framer/client.ts +41 -47
- package/src/framer/codec.ts +1 -1
- package/src/framer/deleter.spec.ts +2 -2
- package/src/framer/deleter.ts +1 -1
- package/src/framer/frame.ts +1 -4
- package/src/framer/iterator.spec.ts +8 -8
- package/src/framer/iterator.ts +1 -1
- package/src/framer/streamProxy.ts +1 -1
- package/src/framer/streamer.spec.ts +185 -36
- package/src/framer/streamer.ts +28 -36
- package/src/framer/writer.spec.ts +6 -6
- package/src/framer/writer.ts +97 -111
- package/src/hardware/device/client.ts +45 -131
- package/src/hardware/device/device.spec.ts +163 -52
- package/src/hardware/device/payload.ts +10 -21
- package/src/hardware/rack/client.ts +87 -105
- package/src/hardware/rack/payload.ts +4 -13
- package/src/hardware/rack/rack.spec.ts +28 -35
- package/src/hardware/task/client.ts +335 -291
- package/src/hardware/task/payload.ts +86 -62
- package/src/hardware/task/task.spec.ts +208 -32
- package/src/index.ts +2 -1
- package/src/label/client.ts +100 -95
- package/src/label/external.ts +0 -2
- package/src/label/label.spec.ts +8 -6
- package/src/label/payload.ts +3 -4
- package/src/ontology/client.ts +41 -324
- package/src/ontology/group/group.spec.ts +2 -2
- package/src/ontology/group/group.ts +4 -5
- package/src/ontology/group/payload.ts +2 -25
- package/src/ontology/group/writer.ts +1 -1
- package/src/ontology/ontology.spec.ts +355 -41
- package/src/ontology/payload.ts +74 -112
- package/src/ontology/writer.ts +8 -17
- package/src/ranger/alias.ts +19 -37
- package/src/ranger/client.ts +118 -150
- package/src/ranger/external.ts +9 -1
- package/src/ranger/kv.ts +6 -27
- package/src/ranger/payload.ts +21 -37
- package/src/ranger/ranger.spec.ts +37 -56
- package/src/ranger/writer.ts +1 -1
- package/src/{signals/index.ts → testutil/client.ts} +11 -1
- package/src/user/client.ts +122 -47
- package/src/user/payload.ts +2 -5
- package/src/user/retriever.ts +1 -1
- package/src/user/user.spec.ts +31 -31
- package/src/user/writer.ts +1 -1
- package/src/util/decodeJSONString.ts +3 -3
- package/src/util/parseWithoutKeyConversion.ts +2 -2
- package/src/util/retrieve.ts +1 -1
- package/src/util/zod.ts +1 -1
- package/src/workspace/client.ts +20 -36
- package/src/workspace/lineplot/client.ts +5 -7
- package/src/workspace/lineplot/lineplot.spec.ts +2 -2
- package/src/workspace/lineplot/payload.ts +4 -7
- package/src/workspace/log/client.ts +5 -7
- package/src/workspace/log/log.spec.ts +2 -2
- package/src/workspace/log/payload.ts +4 -7
- package/src/workspace/payload.ts +4 -7
- package/src/workspace/schematic/client.ts +5 -7
- package/src/workspace/schematic/payload.ts +4 -7
- package/src/workspace/schematic/schematic.spec.ts +2 -2
- package/src/workspace/table/client.ts +5 -7
- package/src/workspace/table/payload.ts +4 -7
- package/src/workspace/table/table.spec.ts +2 -2
- package/src/workspace/workspace.spec.ts +2 -2
- package/dist/access/policy/ontology.d.ts +0 -5
- package/dist/access/policy/ontology.d.ts.map +0 -1
- package/dist/access/policy/retriever.d.ts +0 -40
- package/dist/access/policy/retriever.d.ts.map +0 -1
- package/dist/access/policy/writer.d.ts +0 -9
- package/dist/access/policy/writer.d.ts.map +0 -1
- package/dist/label/retriever.d.ts +0 -14
- package/dist/label/retriever.d.ts.map +0 -1
- package/dist/label/writer.d.ts +0 -54
- package/dist/label/writer.d.ts.map +0 -1
- package/dist/setupspecs.d.ts +0 -5
- package/dist/setupspecs.d.ts.map +0 -1
- package/dist/signals/external.d.ts +0 -2
- package/dist/signals/external.d.ts.map +0 -1
- package/dist/signals/index.d.ts +0 -2
- package/dist/signals/index.d.ts.map +0 -1
- package/dist/signals/observable.d.ts +0 -12
- package/dist/signals/observable.d.ts.map +0 -1
- package/src/access/policy/ontology.ts +0 -17
- package/src/access/policy/retriever.ts +0 -44
- package/src/access/policy/writer.ts +0 -65
- package/src/label/retriever.ts +0 -63
- package/src/label/writer.ts +0 -95
- package/src/setupspecs.ts +0 -27
- package/src/signals/external.ts +0 -10
- package/src/signals/observable.ts +0 -42
package/dist/client.cjs
CHANGED
|
@@ -1,152 +1,44 @@
|
|
|
1
|
-
"use strict";var hS=Object.defineProperty;var pS=(t,e,r)=>e in t?hS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var f=(t,e,r)=>pS(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const vS=t=>Array.isArray(t)?t:t==null?[]:[t],C=Object.freeze(Object.defineProperty({__proto__:null,toArray:vS},Symbol.toStringTag,{value:"Module"})),gS=t=>{const e=t.replace(/_[a-z]/g,r=>r[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},Dh=t=>{const e=(r,i=xo)=>{if(typeof r=="string")return t(r);if(Array.isArray(r))return r.map(a=>e(a,i));if(!ro(r))return r;i=bS(i);const n={},s=r;return"toJSON"in s&&typeof s.toJSON=="function"?e(s.toJSON(),i):(Object.keys(s).forEach(a=>{let o=s[a];const u=t(a);i.recursive&&(ro(o)?Rm(o,i.keepTypesOnRecursion)||(o=e(o,i)):i.recursiveInArray&&Cm(o)&&(o=[...o].map(c=>{let l=c;return ro(c)?Rm(l,i.keepTypesOnRecursion)||(l=e(c,i)):Cm(c)&&(l=e({key:c},i).key),l}))),n[u]=o}),n)};return e},Ch=Dh(gS),yS=t=>t.replace(/([a-z0-9])([A-Z])/g,(e,r,i)=>`${r}_${i.toLowerCase()}`),$S=Dh(yS),xo={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},bS=(t=xo)=>(t.recursive==null?t=xo:t.recursiveInArray??(t.recursiveInArray=!1),t),Cm=t=>t!=null&&Array.isArray(t),ro=t=>t!=null&&typeof t=="object"&&!Array.isArray(t),Rm=(t,e)=>(e||[]).some(r=>t instanceof r),Rh=t=>t!=null&&typeof t=="object"&&!Array.isArray(t);var wS=Object.defineProperty,_S=(t,e,r)=>e in t?wS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xr=(t,e,r)=>_S(t,typeof e!="symbol"?e+"":e,r);let Lh=class{constructor(){Xr(this,"contentType","application/json"),Xr(this,"decoder"),Xr(this,"encoder"),this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(e){return this.encoder.encode(this.encodeString(e))}decode(e,r){return this.decodeString(this.decoder.decode(e),r)}decodeString(e,r){const i=JSON.parse(e),n=Ch(i);return r!=null?r.parse(n):n}encodeString(e){const r=$S(e);return JSON.stringify(r,(i,n)=>ArrayBuffer.isView(n)?Array.from(n):typeof n=="bigint"?n.toString():n)}},Mh=class{constructor(){Xr(this,"contentType","text/csv")}encode(e){const r=this.encodeString(e);return new TextEncoder().encode(r)}decode(e,r){const i=new TextDecoder().decode(e);return this.decodeString(i,r)}encodeString(e){if(!Array.isArray(e)||e.length===0||!Rh(e[0]))throw new Error("Payload must be an array of objects");const r=Object.keys(e[0]),i=[r.join(",")];return e.forEach(n=>{const s=r.map(a=>JSON.stringify(n[a]??""));i.push(s.join(","))}),i.join(`
|
|
2
|
-
`)}decodeString(e,r){const[i,...n]=e.trim().split(`
|
|
3
|
-
`).map(o=>o.trim());if(i.length===0)return r!=null?r.parse({}):{};const s=i.split(",").map(o=>o.trim()),a={};return s.forEach(o=>{a[o]=[]}),n.forEach(o=>{const u=o.split(",").map(c=>c.trim());s.forEach((c,l)=>{const d=this.parseValue(u[l]);d!=null&&a[c].push(d)})}),r!=null?r.parse(a):a}parseValue(e){if(e==null||e.length===0)return null;const r=Number(e);return isNaN(r)?e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e:r}},Bh=class{constructor(){Xr(this,"contentType","text/plain")}encode(e){if(typeof e!="string")throw new Error("TextCodec.encode payload must be a string");return new TextEncoder().encode(e)}decode(e,r){const i=new TextDecoder().decode(e);return r!=null?r.parse(i):i}};const ii=new Lh,kS=new Mh,IS=new Bh,OS=[ii],Nn=Object.freeze(Object.defineProperty({__proto__:null,CSVCodec:Mh,CSV_CODEC:kS,ENCODERS:OS,JSONCodec:Lh,JSON_CODEC:ii,TEXT_CODEC:IS,TextCodec:Bh},Symbol.toStringTag,{value:"Module"})),SS=t=>[...new Set(t)],NS=(t,e,r=!0)=>{const i=new Map;return t.forEach(n=>{const s=e(n);if(i.has(s)){if(r)return;i.delete(s)}i.set(s,n)}),Array.from(i.values())},Lm=Object.freeze(Object.defineProperty({__proto__:null,by:NS,unique:SS},Symbol.toStringTag,{value:"Module"}));var TS=Object.defineProperty,zS=(t,e,r)=>e in t?TS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xS=(t,e,r)=>zS(t,e+"",r);let br=class{constructor(e){xS(this,"value"),this.value=e}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const ES=t=>t!=null&&typeof t=="object"&&"toString"in t,US=(t,e=!1)=>{const r=ES(t)?"stringer":typeof t;let i;switch(r){case"string":i=(n,s)=>n.localeCompare(s);break;case"stringer":i=(n,s)=>n.toString().localeCompare(s.toString());break;case"number":i=(n,s)=>Number(n)-Number(s);break;case"bigint":i=(n,s)=>BigInt(n)-BigInt(s)>0n?1:-1;break;case"boolean":i=(n,s)=>Number(n)-Number(s);break;case"undefined":i=()=>0;break;default:return console.warn(`sortFunc: unknown type ${r}`),()=>-1}return e?ZS(i):i},ZS=t=>(e,r)=>t(r,e),Xs=0,io=-1,so=1,PS=t=>t<Xs,jS=t=>t>Xs,AS=t=>t===Xs;function $(t,e,r){function i(o,u){var c;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(c=o._zod).traits??(c.traits=new Set),o._zod.traits.add(t),e(o,u);for(const l in a.prototype)l in o||Object.defineProperty(o,l,{value:a.prototype[l].bind(o)});o._zod.constr=a,o._zod.def=u}const n=(r==null?void 0:r.Parent)??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function a(o){var u;const c=r!=null&&r.Parent?new s:this;i(c,o),(u=c._zod).deferred??(u.deferred=[]);for(const l of c._zod.deferred)l();return c}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>{var u,c;return r!=null&&r.Parent&&o instanceof r.Parent?!0:(c=(u=o==null?void 0:o._zod)==null?void 0:u.traits)==null?void 0:c.has(t)}}),Object.defineProperty(a,"name",{value:t}),a}const Fh=Symbol("zod_brand");let sr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};const ws={};function lt(t){return t&&Object.assign(ws,t),ws}function DS(t){return t}function CS(t){return t}function RS(t){}function LS(t){throw new Error}function MS(t){}function Iu(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function P(t,e="|"){return t.map(r=>K(r)).join(e)}function qh(t,e){return typeof e=="bigint"?e.toString():e}function Hs(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Tn(t){return t==null}function Qs(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Jh(t,e){const r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,s=Number.parseInt(t.toFixed(n).replace(".","")),a=Number.parseInt(e.toFixed(n).replace(".",""));return s%a/10**n}function ie(t,e,r){Object.defineProperty(t,e,{get(){{const i=r();return t[e]=i,i}},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function wr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function BS(t,e){return e?e.reduce((r,i)=>r==null?void 0:r[i],t):t}function FS(t){const e=Object.keys(t),r=e.map(i=>t[i]);return Promise.all(r).then(i=>{const n={};for(let s=0;s<e.length;s++)n[e[s]]=i[s];return n})}function Ou(t=10){const e="abcdefghijklmnopqrstuvwxyz";let r="";for(let i=0;i<t;i++)r+=e[Math.floor(Math.random()*e.length)];return r}function Bn(t){return JSON.stringify(t)}function si(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Vh=Hs(()=>{if(typeof navigator<"u"&&navigator!=null&&navigator.userAgent.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function _s(t){if(si(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(si(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function qS(t){let e=0;for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}const JS=t=>{const e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},ks=new Set(["string","number","symbol"]),Wh=new Set(["string","number","bigint","boolean","symbol","undefined"]);function zn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jt(t,e,r){const i=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(i._zod.parent=t),i}function N(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function VS(t){let e;return new Proxy({},{get(r,i,n){return e??(e=t()),Reflect.get(e,i,n)},set(r,i,n,s){return e??(e=t()),Reflect.set(e,i,n,s)},has(r,i){return e??(e=t()),Reflect.has(e,i)},deleteProperty(r,i){return e??(e=t()),Reflect.deleteProperty(e,i)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,i){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,i)},defineProperty(r,i,n){return e??(e=t()),Reflect.defineProperty(e,i,n)}})}function K(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Gh(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Yh={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Kh={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Xh(t,e){const r={},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=i.shape[n])}return jt(t,{...t._zod.def,shape:r,checks:[]})}function Hh(t,e){const r={...t._zod.def.shape},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return jt(t,{...t._zod.def,shape:r,checks:[]})}function Qh(t,e){const r={...t._zod.def,get shape(){const i={...t._zod.def.shape,...e};return wr(this,"shape",i),i},checks:[]};return jt(t,r)}function ep(t,e){return jt(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return wr(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function tp(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(const s in i)n[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return jt(e,{...e._zod.def,shape:n,checks:[]})}function np(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(const s in i)n[s]=new t({type:"nonoptional",innerType:i[s]});return jt(e,{...e._zod.def,shape:n,checks:[]})}function Qn(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r].continue!==!0)return!0;return!1}function gt(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function Rr(t){return typeof t=="string"?t:t==null?void 0:t.message}function kt(t,e,r){var i,n,s,a,o,u;const c={...t,path:t.path??[]};if(!t.message){const l=Rr((s=(n=(i=t.inst)==null?void 0:i._zod.def)==null?void 0:n.error)==null?void 0:s.call(n,t))??Rr((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??Rr((o=r.customError)==null?void 0:o.call(r,t))??Rr((u=r.localeError)==null?void 0:u.call(r,t))??"Invalid input";c.message=l}return delete c.inst,delete c.continue,e!=null&&e.reportInput||delete c.input,c}function ea(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function ta(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function ar(...t){const[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}function WS(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}let GS=class{constructor(...e){}};const YS=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:Kh,Class:GS,NUMBER_FORMAT_RANGES:Yh,aborted:Qn,allowsEval:Vh,assert:MS,assertEqual:DS,assertIs:RS,assertNever:LS,assertNotEqual:CS,assignProp:wr,cached:Hs,cleanEnum:WS,cleanRegex:Qs,clone:jt,createTransparentProxy:VS,defineLazy:ie,esc:Bn,escapeRegex:zn,extend:Qh,finalizeIssue:kt,floatSafeRemainder:Jh,getElementAtPath:BS,getEnumValues:Iu,getLengthableOrigin:ta,getParsedType:JS,getSizableOrigin:ea,isObject:si,isPlainObject:_s,issue:ar,joinValues:P,jsonStringifyReplacer:qh,merge:ep,normalizeParams:N,nullish:Tn,numKeys:qS,omit:Hh,optionalKeys:Gh,partial:tp,pick:Xh,prefixIssues:gt,primitiveTypes:Wh,promiseAllObject:FS,propertyKeyTypes:ks,randomString:Ou,required:np,stringifyPrimitive:K,unwrapMessage:Rr},Symbol.toStringTag,{value:"Module"})),rp=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,qh,2)},enumerable:!0})},Su=$("$ZodError",rp),Oi=$("$ZodError",rp,{Parent:Error});function Nu(t,e=r=>r.message){const r={},i=[];for(const n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}function Tu(t,e){const r=e||function(s){return s.message},i={_errors:[]},n=s=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>n({issues:o}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)i._errors.push(r(a));else{let o=i,u=0;for(;u<a.path.length;){const c=a.path[u];u===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(a))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return n(t),i}function ip(t,e){const r=e||function(s){return s.message},i={errors:[]},n=(s,a=[])=>{var o,u;for(const c of s.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>n({issues:l},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{const l=[...a,...c.path];if(l.length===0){i.errors.push(r(c));continue}let d=i,g=0;for(;g<l.length;){const p=l[g],_=g===l.length-1;typeof p=="string"?(d.properties??(d.properties={}),(o=d.properties)[p]??(o[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(u=d.items)[p]??(u[p]={errors:[]}),d=d.items[p]),_&&d.errors.push(r(c)),g++}}};return n(t),i}function sp(t){const e=[];for(const r of t)typeof r=="number"?e.push(`[${r}]`):typeof r=="symbol"?e.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?e.push(`[${JSON.stringify(r)}]`):(e.length&&e.push("."),e.push(r));return e.join("")}function ap(t){var e;const r=[],i=[...t.issues].sort((n,s)=>n.path.length-s.path.length);for(const n of i)r.push(`✖ ${n.message}`),(e=n.path)!=null&&e.length&&r.push(` → at ${sp(n.path)}`);return r.join(`
|
|
4
|
-
`)}const zu=t=>(e,r,i,n)=>{const s=i?Object.assign(i,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new sr;if(a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>kt(u,s,lt())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},Eo=zu(Oi),xu=t=>async(e,r,i,n)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>kt(u,s,lt())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},Uo=xu(Oi),Eu=t=>(e,r,i)=>{const n=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new sr;return s.issues.length?{success:!1,error:new(t??Su)(s.issues.map(a=>kt(a,n,lt())))}:{success:!0,data:s.value}},op=Eu(Oi),Uu=t=>async(e,r,i)=>{const n=i?Object.assign(i,{async:!0}):{async:!0};let s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>kt(a,n,lt())))}:{success:!0,data:s.value}},up=Uu(Oi),cp=/^[cC][^\s-]{8,}$/,lp=/^[0-9a-z]+$/,dp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,mp=/^[0-9a-vA-V]{20}$/,fp=/^[A-Za-z0-9]{27}$/,hp=/^[a-zA-Z0-9_-]{21}$/,pp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,KS=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,vp=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,or=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,XS=or(4),HS=or(6),QS=or(7),gp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,eN=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,tN=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,nN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,rN=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,yp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $p(){return new RegExp(yp,"u")}const bp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,_p=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,kp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ip=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zu=/^[A-Za-z0-9_-]*$/,Op=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,iN=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Sp=/^\+(?:[0-9]){6,14}[0-9]$/,Np="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Tp=new RegExp(`^${Np}$`);function zp(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function xp(t){return new RegExp(`^${zp(t)}$`)}function Ep(t){const e=zp({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");const i=`${e}(?:${r.join("|")})`;return new RegExp(`^${Np}T(?:${i})$`)}const Up=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Zp=/^\d+n?$/,Pp=/^\d+$/,jp=/^-?\d+(?:\.\d+)?/i,Ap=/true|false/i,Dp=/null/i,Cp=/undefined/i,Rp=/^[^A-Z]*$/,Lp=/^[^a-z]*$/,Mp=Object.freeze(Object.defineProperty({__proto__:null,_emoji:yp,base64:Ip,base64url:Zu,bigint:Zp,boolean:Ap,browserEmail:rN,cidrv4:_p,cidrv6:kp,cuid:cp,cuid2:lp,date:Tp,datetime:Ep,domain:iN,duration:pp,e164:Sp,email:gp,emoji:$p,extendedDuration:KS,guid:vp,hostname:Op,html5Email:eN,integer:Pp,ipv4:bp,ipv6:wp,ksuid:fp,lowercase:Rp,nanoid:hp,null:Dp,number:jp,rfc5322Email:tN,string:Up,time:xp,ulid:dp,undefined:Cp,unicodeEmail:nN,uppercase:Lp,uuid:or,uuid4:XS,uuid6:HS,uuid7:QS,xid:mp},Symbol.toStringTag,{value:"Module"})),Re=$("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Bp={number:"number",bigint:"bigint",object:"date"},Pu=$("$ZodCheckLessThan",(t,e)=>{Re.init(t,e);const r=Bp[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:r,code:"too_big",maximum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ju=$("$ZodCheckGreaterThan",(t,e)=>{Re.init(t,e);const r=Bp[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:r,code:"too_small",minimum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Fp=$("$ZodCheckMultipleOf",(t,e)=>{Re.init(t,e),t._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Jh(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),qp=$("$ZodCheckNumberFormat",(t,e)=>{var r;Re.init(t,e),e.format=e.format||"float64";const i=(r=e.format)==null?void 0:r.includes("int"),n=i?"int":"number",[s,a]=Yh[e.format];t._zod.onattach.push(o=>{const u=o._zod.bag;u.format=e.format,u.minimum=s,u.maximum=a,i&&(u.pattern=Pp)}),t._zod.check=o=>{const u=o.value;if(i){if(!Number.isInteger(u)){o.issues.push({expected:n,format:e.format,code:"invalid_type",input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?o.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):o.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}u<s&&o.issues.push({origin:"number",input:u,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),u>a&&o.issues.push({origin:"number",input:u,code:"too_big",maximum:a,inst:t})}}),Jp=$("$ZodCheckBigIntFormat",(t,e)=>{Re.init(t,e);const[r,i]=Kh[e.format];t._zod.onattach.push(n=>{const s=n._zod.bag;s.format=e.format,s.minimum=r,s.maximum=i}),t._zod.check=n=>{const s=n.value;s<r&&n.issues.push({origin:"bigint",input:s,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),s>i&&n.issues.push({origin:"bigint",input:s,code:"too_big",maximum:i,inst:t})}}),Vp=$("$ZodCheckMaxSize",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;i.size<=e.maximum||r.issues.push({origin:ea(i),code:"too_big",maximum:e.maximum,input:i,inst:t,continue:!e.abort})}}),Wp=$("$ZodCheckMinSize",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;i.size>=e.minimum||r.issues.push({origin:ea(i),code:"too_small",minimum:e.minimum,input:i,inst:t,continue:!e.abort})}}),Gp=$("$ZodCheckSizeEquals",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=r=>{const i=r.value,n=i.size;if(n===e.size)return;const s=n>e.size;r.issues.push({origin:ea(i),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},input:r.value,inst:t,continue:!e.abort})}}),Yp=$("$ZodCheckMaxLength",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const n=ta(i);r.issues.push({origin:n,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Kp=$("$ZodCheckMinLength",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const n=ta(i);r.issues.push({origin:n,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Xp=$("$ZodCheckLengthEquals",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,n=i.length;if(n===e.length)return;const s=ta(i),a=n>e.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},input:r.value,inst:t,continue:!e.abort})}}),Si=$("$ZodCheckStringFormat",(t,e)=>{var r;Re.init(t,e),t._zod.onattach.push(i=>{const n=i._zod.bag;n.format=e.format,e.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(e.pattern))}),(r=t._zod).check??(r.check=i=>{if(!e.pattern)throw new Error("Not implemented.");e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})})}),Hp=$("$ZodCheckRegex",(t,e)=>{Si.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Qp=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Rp),Si.init(t,e)}),ev=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Lp),Si.init(t,e)}),tv=$("$ZodCheckIncludes",(t,e)=>{Re.init(t,e);const r=zn(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=i,t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),nv=$("$ZodCheckStartsWith",(t,e)=>{Re.init(t,e);const r=new RegExp(`^${zn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),rv=$("$ZodCheckEndsWith",(t,e)=>{Re.init(t,e);const r=new RegExp(`.*${zn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}});function Mm(t,e,r){t.issues.length&&e.issues.push(...gt(r,t.issues))}const iv=$("$ZodCheckProperty",(t,e)=>{Re.init(t,e),t._zod.check=r=>{const i=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>Mm(n,r,e.property));Mm(i,r,e.property)}}),sv=$("$ZodCheckMimeType",(t,e)=>{Re.init(t,e);const r=new Set(e.mime);t._zod.onattach.push(i=>{i._zod.bag.mime=e.mime}),t._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:e.mime,input:i.value.type,path:["type"],inst:t})}}),av=$("$ZodCheckOverwrite",(t,e)=>{Re.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});let ov=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
5
|
-
`).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),n=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of n)this.content.push(s)}compile(){const e=Function,r=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(n=>` ${n}`)];return new e(...r,i.join(`
|
|
6
|
-
`))}};const uv={major:4,minor:0,patch:0},B=$("$ZodType",(t,e)=>{var r,i;t??(t={}),ie(t._zod,"id",()=>e.type+"_"+Ou(10)),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=uv;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const s of n)for(const a of s._zod.onattach)a(t);if(n.length===0)(i=t._zod).deferred??(i.deferred=[]),(r=t._zod.deferred)==null||r.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,o,u)=>{let c=Qn(a),l;for(const d of o){if(d._zod.when){if(!d._zod.when(a))continue}else if(c)continue;const g=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&(u==null?void 0:u.async)===!1)throw new sr;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==g&&(c||(c=Qn(a,g)))});else{if(a.issues.length===g)continue;c||(c=Qn(a,g))}}return l?l.then(()=>a):a};t._zod.run=(a,o)=>{const u=t._zod.parse(a,o);if(u instanceof Promise){if(o.async===!1)throw new sr;return u.then(c=>s(c,n,o))}return s(u,n,o)}}t["~standard"]={validate:s=>{var a;try{const o=op(t,s);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return up(t,s).then(o=>{var u;return o.success?{value:o.data}:{issues:(u=o.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),Ni=$("$ZodString",(t,e)=>{var r;B.init(t,e),t._zod.pattern=[...((r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)??[]].pop()??Up(t._zod.bag),t._zod.parse=(i,n)=>{if(e.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:t}),i}}),$e=$("$ZodStringFormat",(t,e)=>{Si.init(t,e),Ni.init(t,e)}),cv=$("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=vp),$e.init(t,e)}),lv=$("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=or(r))}else e.pattern??(e.pattern=or());$e.init(t,e)}),dv=$("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=gp),$e.init(t,e)}),mv=$("$ZodURL",(t,e)=>{$e.init(t,e),t._zod.check=r=>{try{const i=new URL(r.value);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Op.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort}));return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),fv=$("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=$p()),$e.init(t,e)}),hv=$("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=hp),$e.init(t,e)}),pv=$("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=cp),$e.init(t,e)}),vv=$("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=lp),$e.init(t,e)}),gv=$("$ZodULID",(t,e)=>{e.pattern??(e.pattern=dp),$e.init(t,e)}),yv=$("$ZodXID",(t,e)=>{e.pattern??(e.pattern=mp),$e.init(t,e)}),$v=$("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=fp),$e.init(t,e)}),bv=$("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Ep(e)),$e.init(t,e),t._zod.check}),wv=$("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Tp),$e.init(t,e)}),_v=$("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=xp(e)),$e.init(t,e),t._zod.check}),kv=$("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=pp),$e.init(t,e)}),Iv=$("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=bp),$e.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv4"})}),Ov=$("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=wp),$e.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Sv=$("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=_p),$e.init(t,e)}),Nv=$("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=kp),$e.init(t,e),t._zod.check=r=>{const[i,n]=r.value.split("/");try{if(!n)throw new Error;const s=Number(n);if(`${s}`!==n)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Au(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Tv=$("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Ip),$e.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{Au(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function zv(t){if(!Zu.test(t))return!1;const e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Au(r)}const xv=$("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Zu),$e.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{zv(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Ev=$("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Sp),$e.init(t,e)});function Uv(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[i]=r,n=JSON.parse(atob(i));return!("typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}const Zv=$("$ZodJWT",(t,e)=>{$e.init(t,e),t._zod.check=r=>{Uv(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Du=$("$ZodNumber",(t,e)=>{B.init(t,e),t._zod.pattern=t._zod.bag.pattern??jp,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;const s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}}),Pv=$("$ZodNumber",(t,e)=>{qp.init(t,e),Du.init(t,e)}),Cu=$("$ZodBoolean",(t,e)=>{B.init(t,e),t._zod.pattern=Ap,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=!!r.value}catch{}const n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}}),Ru=$("$ZodBigInt",(t,e)=>{B.init(t,e),t._zod.pattern=Zp,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}const{value:n}=r;return typeof n=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:n,inst:t}),r}}),jv=$("$ZodBigInt",(t,e)=>{Jp.init(t,e),Ru.init(t,e)}),Av=$("$ZodSymbol",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:t}),r}}),Dv=$("$ZodUndefined",(t,e)=>{B.init(t,e),t._zod.pattern=Cp,t._zod.values=new Set([void 0]),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:t}),r}}),Cv=$("$ZodNull",(t,e)=>{B.init(t,e),t._zod.pattern=Dp,t._zod.values=new Set([null]),t._zod.parse=(r,i)=>{const{value:n}=r;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),Rv=$("$ZodAny",(t,e)=>{B.init(t,e),t._zod.parse=r=>r}),Is=$("$ZodUnknown",(t,e)=>{B.init(t,e),t._zod.parse=r=>r}),Lv=$("$ZodNever",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Mv=$("$ZodVoid",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:t}),r}}),Bv=$("$ZodDate",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}const n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:t}),r}});function Bm(t,e,r){t.issues.length&&e.issues.push(...gt(r,t.issues)),e.value[r]=t.value}const Lu=$("$ZodArray",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);const s=[];for(let a=0;a<n.length;a++){const o=n[a],u=e.element._zod.run({value:o,issues:[]},i);u instanceof Promise?s.push(u.then(c=>Bm(c,r,a))):Bm(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function Ki(t,e,r){t.issues.length&&e.issues.push(...gt(r,t.issues)),e.value[r]=t.value}function Fm(t,e,r,i){t.issues.length?i[r]===void 0?r in i?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...gt(r,t.issues)):t.value===void 0?r in i&&(e.value[r]=void 0):e.value[r]=t.value}const Fv=$("$ZodObject",(t,e)=>{B.init(t,e);const r=Hs(()=>{const l=Object.keys(e.shape);for(const g of l)if(!(e.shape[g]instanceof B))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);const d=Gh(e.shape);return{shape:e.shape,keys:l,keySet:new Set(l),numKeys:l.length,optionalKeys:new Set(d)}});ie(t._zod,"propValues",()=>{const l=e.shape,d={};for(const g in l){const p=l[g]._zod;if(p.values){d[g]??(d[g]=new Set);for(const _ of p.values)d[g].add(_)}}return d});const i=l=>{const d=new ov(["shape","payload","ctx"]),{keys:g,optionalKeys:p}=r.value,_=h=>{const v=Bn(h);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};d.write("const input = payload.value;");const k=Object.create(null);for(const h of g)k[h]=Ou(15);d.write("const newResult = {}");for(const h of g)if(p.has(h)){const v=k[h];d.write(`const ${v} = ${_(h)};`);const w=Bn(h);d.write(`
|
|
7
|
-
if (${v}.issues.length) {
|
|
8
|
-
if (input[${w}] === undefined) {
|
|
9
|
-
if (${w} in input) {
|
|
10
|
-
newResult[${w}] = undefined;
|
|
11
|
-
}
|
|
12
|
-
} else {
|
|
13
|
-
payload.issues = payload.issues.concat(
|
|
14
|
-
${v}.issues.map((iss) => ({
|
|
15
|
-
...iss,
|
|
16
|
-
path: iss.path ? [${w}, ...iss.path] : [${w}],
|
|
17
|
-
}))
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
} else if (${v}.value === undefined) {
|
|
21
|
-
if (${w} in input) newResult[${w}] = undefined;
|
|
22
|
-
} else {
|
|
23
|
-
newResult[${w}] = ${v}.value;
|
|
24
|
-
}
|
|
25
|
-
`)}else{const v=k[h];d.write(`const ${v} = ${_(h)};`),d.write(`
|
|
26
|
-
if (${v}.issues.length) payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
|
|
27
|
-
...iss,
|
|
28
|
-
path: iss.path ? [${Bn(h)}, ...iss.path] : [${Bn(h)}]
|
|
29
|
-
})));`),d.write(`newResult[${Bn(h)}] = ${v}.value`)}d.write("payload.value = newResult;"),d.write("return payload;");const m=d.compile();return(h,v)=>m(l,h,v)};let n;const s=si,a=!ws.jitless,o=a&&Vh.value,{catchall:u}=e;let c;t._zod.parse=(l,d)=>{c??(c=r.value);const g=l.value;if(!s(g))return l.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),l;const p=[];if(a&&o&&(d==null?void 0:d.async)===!1&&d.jitless!==!0)n||(n=i(e.shape)),l=n(l,d);else{l.value={};const v=c.shape;for(const w of c.keys){const I=v[w],A=I._zod.run({value:g[w],issues:[]},d),J=I._zod.optin==="optional"&&I._zod.optout==="optional";A instanceof Promise?p.push(A.then(ce=>J?Fm(ce,l,w,g):Ki(ce,l,w))):J?Fm(A,l,w,g):Ki(A,l,w)}}if(!u)return p.length?Promise.all(p).then(()=>l):l;const _=[],k=c.keySet,m=u._zod,h=m.def.type;for(const v of Object.keys(g)){if(k.has(v))continue;if(h==="never"){_.push(v);continue}const w=m.run({value:g[v],issues:[]},d);w instanceof Promise?p.push(w.then(I=>Ki(I,l,v))):Ki(w,l,v)}return _.length&&l.issues.push({code:"unrecognized_keys",keys:_,input:g,inst:t}),p.length?Promise.all(p).then(()=>l):l}});function qm(t,e,r,i){for(const n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(s=>kt(s,i,lt())))}),e}const Mu=$("$ZodUnion",(t,e)=>{B.init(t,e),ie(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),ie(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>Qs(i.source)).join("|")})$`)}}),t._zod.parse=(r,i)=>{let n=!1;const s=[];for(const a of e.options){const o=a._zod.run({value:r.value,issues:[]},i);if(o instanceof Promise)s.push(o),n=!0;else{if(o.issues.length===0)return o;s.push(o)}}return n?Promise.all(s).then(a=>qm(a,r,t,i)):qm(s,r,t,i)}}),qv=$("$ZodDiscriminatedUnion",(t,e)=>{Mu.init(t,e);const r=t._zod.parse;ie(t._zod,"propValues",()=>{const n={};for(const s of e.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(const[o,u]of Object.entries(a)){n[o]||(n[o]=new Set);for(const c of u)n[o].add(c)}}return n});const i=Hs(()=>{const n=e.options,s=new Map;for(const a of n){const o=a._zod.propValues[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const u of o){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,a)}}return s});t._zod.parse=(n,s)=>{const a=n.value;if(!si(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),n;const o=i.value.get(a==null?void 0:a[e.discriminator]);return o?o._zod.run(n,s):e.unionFallback?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[e.discriminator],inst:t}),n)}}),Jv=$("$ZodIntersection",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r,s=e.left._zod.run({value:n,issues:[]},i),a=e.right._zod.run({value:n,issues:[]},i);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([o,u])=>Jm(r,o,u)):Jm(r,s,a)}});function Zo(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(_s(t)&&_s(e)){const r=Object.keys(e),i=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(const s of i){const a=Zo(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n[s]=a.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<t.length;i++){const n=t[i],s=e[i],a=Zo(n,s);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Jm(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),Qn(t))return t;const i=Zo(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}const na=$("$ZodTuple",(t,e)=>{B.init(t,e);const r=e.items,i=r.length-[...r].reverse().findIndex(n=>n._zod.optin!=="optional");t._zod.parse=(n,s)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({input:a,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];const o=[];if(!e.rest){const c=a.length>r.length,l=a.length<i-1;if(c||l)return n.issues.push({input:a,inst:t,origin:"array",...c?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length}}),n}let u=-1;for(const c of r){if(u++,u>=a.length&&u>=i)continue;const l=c._zod.run({value:a[u],issues:[]},s);l instanceof Promise?o.push(l.then(d=>Xi(d,n,u))):Xi(l,n,u)}if(e.rest){const c=a.slice(r.length);for(const l of c){u++;const d=e.rest._zod.run({value:l,issues:[]},s);d instanceof Promise?o.push(d.then(g=>Xi(g,n,u))):Xi(d,n,u)}}return o.length?Promise.all(o).then(()=>n):n}});function Xi(t,e,r){t.issues.length&&e.issues.push(...gt(r,t.issues)),e.value[r]=t.value}const Vv=$("$ZodRecord",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!_s(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;const s=[];if(e.keyType._zod.values){const a=e.keyType._zod.values;r.value={};for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){const c=e.valueType._zod.run({value:n[u],issues:[]},i);c instanceof Promise?s.push(c.then(l=>{l.issues.length&&r.issues.push(...gt(u,l.issues)),r.value[u]=l.value})):(c.issues.length&&r.issues.push(...gt(u,c.issues)),r.value[u]=c.value)}let o;for(const u in n)a.has(u)||(o=o??[],o.push(u));o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:o})}else{r.value={};for(const a of Reflect.ownKeys(n)){if(a==="__proto__")continue;const o=e.keyType._zod.run({value:a,issues:[]},i);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:o.issues.map(c=>kt(c,i,lt())),input:a,path:[a],inst:t}),r.value[o.value]=o.value;continue}const u=e.valueType._zod.run({value:n[a],issues:[]},i);u instanceof Promise?s.push(u.then(c=>{c.issues.length&&r.issues.push(...gt(a,c.issues)),r.value[o.value]=c.value})):(u.issues.length&&r.issues.push(...gt(a,u.issues)),r.value[o.value]=u.value)}}return s.length?Promise.all(s).then(()=>r):r}}),Wv=$("$ZodMap",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:t}),r;const s=[];r.value=new Map;for(const[a,o]of n){const u=e.keyType._zod.run({value:a,issues:[]},i),c=e.valueType._zod.run({value:o,issues:[]},i);u instanceof Promise||c instanceof Promise?s.push(Promise.all([u,c]).then(([l,d])=>{Vm(l,d,r,a,n,t,i)})):Vm(u,c,r,a,n,t,i)}return s.length?Promise.all(s).then(()=>r):r}});function Vm(t,e,r,i,n,s,a){t.issues.length&&(ks.has(typeof i)?r.issues.push(...gt(i,t.issues)):r.issues.push({origin:"map",code:"invalid_key",input:n,inst:s,issues:t.issues.map(o=>kt(o,a,lt()))})),e.issues.length&&(ks.has(typeof i)?r.issues.push(...gt(i,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:s,key:i,issues:e.issues.map(o=>kt(o,a,lt()))})),r.value.set(t.value,e.value)}const Gv=$("$ZodSet",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:t,expected:"set",code:"invalid_type"}),r;const s=[];r.value=new Set;for(const a of n){const o=e.valueType._zod.run({value:a,issues:[]},i);o instanceof Promise?s.push(o.then(u=>Wm(u,r))):Wm(o,r)}return s.length?Promise.all(s).then(()=>r):r}});function Wm(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}const Yv=$("$ZodEnum",(t,e)=>{B.init(t,e);const r=Iu(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(i=>ks.has(typeof i)).map(i=>typeof i=="string"?zn(i):i.toString()).join("|")})$`),t._zod.parse=(i,n)=>{const s=i.value;return t._zod.values.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),Kv=$("$ZodLiteral",(t,e)=>{B.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?zn(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,i)=>{const n=r.value;return t._zod.values.has(n)||r.issues.push({code:"invalid_value",values:e.values,input:n,inst:t}),r}}),Xv=$("$ZodFile",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:t}),r}}),Bu=$("$ZodTransform",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=e.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new sr;return r.value=n,r}}),Hv=$("$ZodOptional",(t,e)=>{B.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ie(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ie(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qs(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>r.value===void 0?r:e.innerType._zod.run(r,i)}),Qv=$("$ZodNullable",(t,e)=>{B.init(t,e),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),ie(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${Qs(r.source)}|null)$`):void 0}),ie(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),eg=$("$ZodDefault",(t,e)=>{B.init(t,e),t._zod.optin="optional",ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(r.value===void 0)return r.value=e.defaultValue,r;const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>Gm(s,e)):Gm(n,e)}});function Gm(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const tg=$("$ZodPrefault",(t,e)=>{B.init(t,e),t._zod.optin="optional",ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,i))}),ng=$("$ZodNonOptional",(t,e)=>{B.init(t,e),ie(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>Ym(s,t)):Ym(n,t)}});function Ym(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const rg=$("$ZodSuccess",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),ig=$("$ZodCatch",(t,e)=>{B.init(t,e),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(a=>kt(a,i,lt()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>kt(s,i,lt()))},input:r.value}),r.issues=[]),r)}}),sg=$("$ZodNaN",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),Fu=$("$ZodPipe",(t,e)=>{B.init(t,e),ie(t._zod,"values",()=>e.in._zod.values),ie(t._zod,"optin",()=>e.in._zod.optin),ie(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,i)=>{const n=e.in._zod.run(r,i);return n instanceof Promise?n.then(s=>Km(s,e,i)):Km(n,e,i)}});function Km(t,e,r){return Qn(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const ag=$("$ZodReadonly",(t,e)=>{B.init(t,e),ie(t._zod,"propValues",()=>e.innerType._zod.propValues),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(Xm):Xm(n)}});function Xm(t){return t.value=Object.freeze(t.value),t}const og=$("$ZodTemplateLiteral",(t,e)=>{B.init(t,e);const r=[];for(const i of e.parts)if(i instanceof B){if(!i._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);const n=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${i._zod.traits}`);const s=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(s,a))}else if(i===null||Wh.has(typeof i))r.push(zn(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(i,n)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:t,expected:"template_literal",code:"invalid_type"}),i):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),i)}),ug=$("$ZodPromise",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>Promise.resolve(r.value).then(n=>e.innerType._zod.run({value:n,issues:[]},i))}),cg=$("$ZodLazy",(t,e)=>{B.init(t,e),ie(t._zod,"innerType",()=>e.getter()),ie(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),ie(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),ie(t._zod,"optin",()=>t._zod.innerType._zod.optin),ie(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(r,i)=>t._zod.innerType._zod.run(r,i)}),lg=$("$ZodCustom",(t,e)=>{Re.init(t,e),B.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{const i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(s=>Hm(s,r,i,t));Hm(n,r,i,t)}});function Hm(t,e,r,i){if(!t){const n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(ar(n))}}const dg=Symbol("ZodOutput"),mg=Symbol("ZodInput");let qu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const i=r[0];if(this._map.set(e,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const i={...this.get(r)??{}};return delete i.id,{...i,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Ju(){return new qu}const dn=Ju();function fg(t,e){return new t({type:"string",...N(e)})}function hg(t,e){return new t({type:"string",coerce:!0,...N(e)})}function Vu(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...N(e)})}function Os(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...N(e)})}function Wu(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...N(e)})}function Gu(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N(e)})}function Yu(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N(e)})}function Ku(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N(e)})}function Xu(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...N(e)})}function Hu(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...N(e)})}function Qu(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...N(e)})}function ec(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...N(e)})}function tc(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...N(e)})}function nc(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...N(e)})}function rc(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...N(e)})}function ic(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...N(e)})}function sc(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...N(e)})}function ac(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...N(e)})}function oc(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N(e)})}function uc(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N(e)})}function cc(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...N(e)})}function lc(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...N(e)})}function dc(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...N(e)})}function mc(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...N(e)})}const pg={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function vg(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N(e)})}function gg(t,e){return new t({type:"string",format:"date",check:"string_format",...N(e)})}function yg(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...N(e)})}function $g(t,e){return new t({type:"string",format:"duration",check:"string_format",...N(e)})}function bg(t,e){return new t({type:"number",checks:[],...N(e)})}function wg(t,e){return new t({type:"number",coerce:!0,checks:[],...N(e)})}function _g(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...N(e)})}function kg(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...N(e)})}function Ig(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...N(e)})}function Og(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...N(e)})}function Sg(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...N(e)})}function Ng(t,e){return new t({type:"boolean",...N(e)})}function Tg(t,e){return new t({type:"boolean",coerce:!0,...N(e)})}function zg(t,e){return new t({type:"bigint",...N(e)})}function xg(t,e){return new t({type:"bigint",coerce:!0,...N(e)})}function Eg(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...N(e)})}function Ug(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...N(e)})}function Zg(t,e){return new t({type:"symbol",...N(e)})}function Pg(t,e){return new t({type:"undefined",...N(e)})}function jg(t,e){return new t({type:"null",...N(e)})}function Ag(t){return new t({type:"any"})}function Ss(t){return new t({type:"unknown"})}function Dg(t,e){return new t({type:"never",...N(e)})}function Cg(t,e){return new t({type:"void",...N(e)})}function Rg(t,e){return new t({type:"date",...N(e)})}function Lg(t,e){return new t({type:"date",coerce:!0,...N(e)})}function Mg(t,e){return new t({type:"nan",...N(e)})}function pn(t,e){return new Pu({check:"less_than",...N(e),value:t,inclusive:!1})}function wt(t,e){return new Pu({check:"less_than",...N(e),value:t,inclusive:!0})}function vn(t,e){return new ju({check:"greater_than",...N(e),value:t,inclusive:!1})}function ht(t,e){return new ju({check:"greater_than",...N(e),value:t,inclusive:!0})}function Bg(t){return vn(0,t)}function Fg(t){return pn(0,t)}function qg(t){return wt(0,t)}function Jg(t){return ht(0,t)}function ai(t,e){return new Fp({check:"multiple_of",...N(e),value:t})}function ra(t,e){return new Vp({check:"max_size",...N(e),maximum:t})}function oi(t,e){return new Wp({check:"min_size",...N(e),minimum:t})}function fc(t,e){return new Gp({check:"size_equals",...N(e),size:t})}function ia(t,e){return new Yp({check:"max_length",...N(e),maximum:t})}function ur(t,e){return new Kp({check:"min_length",...N(e),minimum:t})}function sa(t,e){return new Xp({check:"length_equals",...N(e),length:t})}function hc(t,e){return new Hp({check:"string_format",format:"regex",...N(e),pattern:t})}function pc(t){return new Qp({check:"string_format",format:"lowercase",...N(t)})}function vc(t){return new ev({check:"string_format",format:"uppercase",...N(t)})}function gc(t,e){return new tv({check:"string_format",format:"includes",...N(e),includes:t})}function yc(t,e){return new nv({check:"string_format",format:"starts_with",...N(e),prefix:t})}function $c(t,e){return new rv({check:"string_format",format:"ends_with",...N(e),suffix:t})}function Vg(t,e,r){return new iv({check:"property",property:t,schema:e,...N(r)})}function bc(t,e){return new sv({check:"mime_type",mime:t,...N(e)})}function xn(t){return new av({check:"overwrite",tx:t})}function wc(t){return xn(e=>e.normalize(t))}function _c(){return xn(t=>t.trim())}function kc(){return xn(t=>t.toLowerCase())}function Ic(){return xn(t=>t.toUpperCase())}function Oc(t,e,r){return new t({type:"array",element:e,...N(r)})}function sN(t,e,r){return new t({type:"union",options:e,...N(r)})}function aN(t,e,r,i){return new t({type:"union",options:r,discriminator:e,...N(i)})}function oN(t,e,r){return new t({type:"intersection",left:e,right:r})}function Wg(t,e,r,i){const n=r instanceof B,s=n?i:r,a=n?r:null;return new t({type:"tuple",items:e,rest:a,...N(s)})}function uN(t,e,r,i){return new t({type:"record",keyType:e,valueType:r,...N(i)})}function cN(t,e,r,i){return new t({type:"map",keyType:e,valueType:r,...N(i)})}function lN(t,e,r){return new t({type:"set",valueType:e,...N(r)})}function dN(t,e,r){const i=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new t({type:"enum",entries:i,...N(r)})}function mN(t,e,r){return new t({type:"enum",entries:e,...N(r)})}function fN(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...N(r)})}function Gg(t,e){return new t({type:"file",...N(e)})}function hN(t,e){return new t({type:"transform",transform:e})}function pN(t,e){return new t({type:"optional",innerType:e})}function vN(t,e){return new t({type:"nullable",innerType:e})}function gN(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():r}})}function yN(t,e,r){return new t({type:"nonoptional",innerType:e,...N(r)})}function $N(t,e){return new t({type:"success",innerType:e})}function bN(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function wN(t,e,r){return new t({type:"pipe",in:e,out:r})}function _N(t,e){return new t({type:"readonly",innerType:e})}function kN(t,e,r){return new t({type:"template_literal",parts:e,...N(r)})}function IN(t,e){return new t({type:"lazy",getter:e})}function ON(t,e){return new t({type:"promise",innerType:e})}function Yg(t,e,r){const i=N(r);return i.abort??(i.abort=!0),new t({type:"custom",check:"custom",fn:e,...i})}function Kg(t,e,r){return new t({type:"custom",check:"custom",fn:e,...N(r)})}function Xg(t,e){const{case:r,error:i,truthy:n,falsy:s}=N(e);let a=n??["true","1","yes","on","y","enabled"],o=s??["false","0","no","off","n","disabled"];r!=="sensitive"&&(a=a.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));const u=new Set(a),c=new Set(o),l=t.Pipe??Fu,d=t.Boolean??Cu,g=t.String??Ni,p=t.Transform??Bu,_=new p({type:"transform",transform:(m,h)=>{let v=m;return r!=="sensitive"&&(v=v.toLowerCase()),u.has(v)?!0:c.has(v)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...u,...c],input:h.value,inst:_}),{})},error:i}),k=new l({type:"pipe",in:new g({type:"string",error:i}),out:_,error:i});return new l({type:"pipe",in:k,out:new d({type:"boolean",error:i}),error:i})}const Sc=$("ZodISODateTime",(t,e)=>{bv.init(t,e),we.init(t,e)});function Hg(t){return vg(Sc,t)}const Nc=$("ZodISODate",(t,e)=>{wv.init(t,e),we.init(t,e)});function Qg(t){return gg(Nc,t)}const Tc=$("ZodISOTime",(t,e)=>{_v.init(t,e),we.init(t,e)});function ey(t){return yg(Tc,t)}const zc=$("ZodISODuration",(t,e)=>{kv.init(t,e),we.init(t,e)});function ty(t){return $g(zc,t)}const SN=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:Nc,ZodISODateTime:Sc,ZodISODuration:zc,ZodISOTime:Tc,date:Qg,datetime:Hg,duration:ty,time:ey},Symbol.toStringTag,{value:"Module"})),ny=(t,e)=>{Su.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Tu(t,r)},flatten:{value:r=>Nu(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},NN=$("ZodError",ny),Ti=$("ZodError",ny,{Parent:Error}),ry=zu(Ti),iy=xu(Ti),sy=Eu(Ti),ay=Uu(Ti),ee=$("ZodType",(t,e)=>(B.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),t.clone=(r,i)=>jt(t,r,i),t.brand=()=>t,t.register=(r,i)=>(r.add(t,i),t),t.parse=(r,i)=>ry(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>sy(t,r,i),t.parseAsync=async(r,i)=>iy(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>ay(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(Fy(r,i)),t.superRefine=r=>t.check(qy(r)),t.overwrite=r=>t.check(xn(r)),t.optional=()=>Ts(t),t.nullable=()=>zs(t),t.nullish=()=>Ts(zs(t)),t.nonoptional=r=>Ey(t,r),t.array=()=>xi(t),t.or=r=>ze([t,r]),t.and=r=>$y(t,r),t.transform=r=>xs(t,el(r)),t.default=r=>Ty(t,r),t.prefault=r=>xy(t,r),t.catch=r=>Py(t,r),t.pipe=r=>xs(t,r),t.readonly=()=>Dy(t),t.describe=r=>{const i=t.clone();return dn.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){var r;return(r=dn.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return dn.get(t);const i=t.clone();return dn.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),xc=$("_ZodString",(t,e)=>{Ni.init(t,e),ee.init(t,e);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...i)=>t.check(hc(...i)),t.includes=(...i)=>t.check(gc(...i)),t.startsWith=(...i)=>t.check(yc(...i)),t.endsWith=(...i)=>t.check($c(...i)),t.min=(...i)=>t.check(ur(...i)),t.max=(...i)=>t.check(ia(...i)),t.length=(...i)=>t.check(sa(...i)),t.nonempty=(...i)=>t.check(ur(1,...i)),t.lowercase=i=>t.check(pc(i)),t.uppercase=i=>t.check(vc(i)),t.trim=()=>t.check(_c()),t.normalize=(...i)=>t.check(wc(...i)),t.toLowerCase=()=>t.check(kc()),t.toUpperCase=()=>t.check(Ic())}),aa=$("ZodString",(t,e)=>{Ni.init(t,e),xc.init(t,e),t.email=r=>t.check(Vu(Ec,r)),t.url=r=>t.check(Xu(Uc,r)),t.jwt=r=>t.check(mc(Wc,r)),t.emoji=r=>t.check(Hu(Zc,r)),t.guid=r=>t.check(Os(Ns,r)),t.uuid=r=>t.check(Wu(Mt,r)),t.uuidv4=r=>t.check(Gu(Mt,r)),t.uuidv6=r=>t.check(Yu(Mt,r)),t.uuidv7=r=>t.check(Ku(Mt,r)),t.nanoid=r=>t.check(Qu(Pc,r)),t.guid=r=>t.check(Os(Ns,r)),t.cuid=r=>t.check(ec(jc,r)),t.cuid2=r=>t.check(tc(Ac,r)),t.ulid=r=>t.check(nc(Dc,r)),t.base64=r=>t.check(cc(qc,r)),t.base64url=r=>t.check(lc(Jc,r)),t.xid=r=>t.check(rc(Cc,r)),t.ksuid=r=>t.check(ic(Rc,r)),t.ipv4=r=>t.check(sc(Lc,r)),t.ipv6=r=>t.check(ac(Mc,r)),t.cidrv4=r=>t.check(oc(Bc,r)),t.cidrv6=r=>t.check(uc(Fc,r)),t.e164=r=>t.check(dc(Vc,r)),t.datetime=r=>t.check(Hg(r)),t.date=r=>t.check(Qg(r)),t.time=r=>t.check(ey(r)),t.duration=r=>t.check(ty(r))});function Ne(t){return fg(aa,t)}const we=$("ZodStringFormat",(t,e)=>{$e.init(t,e),xc.init(t,e)}),Ec=$("ZodEmail",(t,e)=>{dv.init(t,e),we.init(t,e)});function TN(t){return Vu(Ec,t)}const Ns=$("ZodGUID",(t,e)=>{cv.init(t,e),we.init(t,e)});function zN(t){return Os(Ns,t)}const Mt=$("ZodUUID",(t,e)=>{lv.init(t,e),we.init(t,e)});function xN(t){return Wu(Mt,t)}function EN(t){return Gu(Mt,t)}function UN(t){return Yu(Mt,t)}function ZN(t){return Ku(Mt,t)}const Uc=$("ZodURL",(t,e)=>{mv.init(t,e),we.init(t,e)});function PN(t){return Xu(Uc,t)}const Zc=$("ZodEmoji",(t,e)=>{fv.init(t,e),we.init(t,e)});function jN(t){return Hu(Zc,t)}const Pc=$("ZodNanoID",(t,e)=>{hv.init(t,e),we.init(t,e)});function AN(t){return Qu(Pc,t)}const jc=$("ZodCUID",(t,e)=>{pv.init(t,e),we.init(t,e)});function DN(t){return ec(jc,t)}const Ac=$("ZodCUID2",(t,e)=>{vv.init(t,e),we.init(t,e)});function CN(t){return tc(Ac,t)}const Dc=$("ZodULID",(t,e)=>{gv.init(t,e),we.init(t,e)});function RN(t){return nc(Dc,t)}const Cc=$("ZodXID",(t,e)=>{yv.init(t,e),we.init(t,e)});function LN(t){return rc(Cc,t)}const Rc=$("ZodKSUID",(t,e)=>{$v.init(t,e),we.init(t,e)});function MN(t){return ic(Rc,t)}const Lc=$("ZodIPv4",(t,e)=>{Iv.init(t,e),we.init(t,e)});function BN(t){return sc(Lc,t)}const Mc=$("ZodIPv6",(t,e)=>{Ov.init(t,e),we.init(t,e)});function FN(t){return ac(Mc,t)}const Bc=$("ZodCIDRv4",(t,e)=>{Sv.init(t,e),we.init(t,e)});function qN(t){return oc(Bc,t)}const Fc=$("ZodCIDRv6",(t,e)=>{Nv.init(t,e),we.init(t,e)});function JN(t){return uc(Fc,t)}const qc=$("ZodBase64",(t,e)=>{Tv.init(t,e),we.init(t,e)});function VN(t){return cc(qc,t)}const Jc=$("ZodBase64URL",(t,e)=>{xv.init(t,e),we.init(t,e)});function WN(t){return lc(Jc,t)}const Vc=$("ZodE164",(t,e)=>{Ev.init(t,e),we.init(t,e)});function GN(t){return dc(Vc,t)}const Wc=$("ZodJWT",(t,e)=>{Zv.init(t,e),we.init(t,e)});function YN(t){return mc(Wc,t)}const oa=$("ZodNumber",(t,e)=>{Du.init(t,e),ee.init(t,e),t.gt=(i,n)=>t.check(vn(i,n)),t.gte=(i,n)=>t.check(ht(i,n)),t.min=(i,n)=>t.check(ht(i,n)),t.lt=(i,n)=>t.check(pn(i,n)),t.lte=(i,n)=>t.check(wt(i,n)),t.max=(i,n)=>t.check(wt(i,n)),t.int=i=>t.check(Po(i)),t.safe=i=>t.check(Po(i)),t.positive=i=>t.check(vn(0,i)),t.nonnegative=i=>t.check(ht(0,i)),t.negative=i=>t.check(pn(0,i)),t.nonpositive=i=>t.check(wt(0,i)),t.multipleOf=(i,n)=>t.check(ai(i,n)),t.step=(i,n)=>t.check(ai(i,n)),t.finite=()=>t;const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function H(t){return bg(oa,t)}const _r=$("ZodNumberFormat",(t,e)=>{Pv.init(t,e),oa.init(t,e)});function Po(t){return _g(_r,t)}function KN(t){return kg(_r,t)}function XN(t){return Ig(_r,t)}function HN(t){return Og(_r,t)}function QN(t){return Sg(_r,t)}const ua=$("ZodBoolean",(t,e)=>{Cu.init(t,e),ee.init(t,e)});function Gc(t){return Ng(ua,t)}const ca=$("ZodBigInt",(t,e)=>{Ru.init(t,e),ee.init(t,e),t.gte=(i,n)=>t.check(ht(i,n)),t.min=(i,n)=>t.check(ht(i,n)),t.gt=(i,n)=>t.check(vn(i,n)),t.gte=(i,n)=>t.check(ht(i,n)),t.min=(i,n)=>t.check(ht(i,n)),t.lt=(i,n)=>t.check(pn(i,n)),t.lte=(i,n)=>t.check(wt(i,n)),t.max=(i,n)=>t.check(wt(i,n)),t.positive=i=>t.check(vn(BigInt(0),i)),t.negative=i=>t.check(pn(BigInt(0),i)),t.nonpositive=i=>t.check(wt(BigInt(0),i)),t.nonnegative=i=>t.check(ht(BigInt(0),i)),t.multipleOf=(i,n)=>t.check(ai(i,n));const r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function gn(t){return zg(ca,t)}const Yc=$("ZodBigIntFormat",(t,e)=>{jv.init(t,e),ca.init(t,e)});function eT(t){return Eg(Yc,t)}function tT(t){return Ug(Yc,t)}const oy=$("ZodSymbol",(t,e)=>{Av.init(t,e),ee.init(t,e)});function uy(t){return Zg(oy,t)}const cy=$("ZodUndefined",(t,e)=>{Dv.init(t,e),ee.init(t,e)});function ly(t){return Pg(cy,t)}const dy=$("ZodNull",(t,e)=>{Cv.init(t,e),ee.init(t,e)});function zi(t){return jg(dy,t)}const my=$("ZodAny",(t,e)=>{Rv.init(t,e),ee.init(t,e)});function nT(){return Ag(my)}const fy=$("ZodUnknown",(t,e)=>{Is.init(t,e),ee.init(t,e)});function cr(){return Ss(fy)}const hy=$("ZodNever",(t,e)=>{Lv.init(t,e),ee.init(t,e)});function la(t){return Dg(hy,t)}const py=$("ZodVoid",(t,e)=>{Mv.init(t,e),ee.init(t,e)});function rT(t){return Cg(py,t)}const Kc=$("ZodDate",(t,e)=>{Bv.init(t,e),ee.init(t,e),t.min=(i,n)=>t.check(ht(i,n)),t.max=(i,n)=>t.check(wt(i,n));const r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function iT(t){return Rg(Kc,t)}const vy=$("ZodArray",(t,e)=>{Lu.init(t,e),ee.init(t,e),t.element=e.element,t.min=(r,i)=>t.check(ur(r,i)),t.nonempty=r=>t.check(ur(1,r)),t.max=(r,i)=>t.check(ia(r,i)),t.length=(r,i)=>t.check(sa(r,i)),t.unwrap=()=>t.element});function xi(t,e){return Oc(vy,t,e)}function sT(t){const e=t._zod.def.shape;return Iy(Object.keys(e))}const da=$("ZodObject",(t,e)=>{Fv.init(t,e),ee.init(t,e),ie(t,"shape",()=>Object.fromEntries(Object.entries(t._zod.def.shape))),t.keyof=()=>Ye(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:cr()}),t.loose=()=>t.clone({...t._zod.def,catchall:cr()}),t.strict=()=>t.clone({...t._zod.def,catchall:la()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>Qh(t,r),t.merge=r=>ep(t,r),t.pick=r=>Xh(t,r),t.omit=r=>Hh(t,r),t.partial=(...r)=>tp(tl,t,r[0]),t.required=(...r)=>np(nl,t,r[0])});function re(t,e){const r={type:"object",get shape(){return wr(this,"shape",{...t}),this.shape},...N(e)};return new da(r)}function aT(t,e){return new da({type:"object",get shape(){return wr(this,"shape",{...t}),this.shape},catchall:la(),...N(e)})}function oT(t,e){return new da({type:"object",get shape(){return wr(this,"shape",{...t}),this.shape},catchall:cr(),...N(e)})}const Xc=$("ZodUnion",(t,e)=>{Mu.init(t,e),ee.init(t,e),t.options=e.options});function ze(t,e){return new Xc({type:"union",options:t,...N(e)})}const gy=$("ZodDiscriminatedUnion",(t,e)=>{Xc.init(t,e),qv.init(t,e)});function uT(t,e,r){return new gy({type:"union",options:e,discriminator:t,...N(r)})}const yy=$("ZodIntersection",(t,e)=>{Jv.init(t,e),ee.init(t,e)});function $y(t,e){return new yy({type:"intersection",left:t,right:e})}const by=$("ZodTuple",(t,e)=>{na.init(t,e),ee.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});function kr(t,e,r){const i=e instanceof B,n=i?r:e,s=i?e:null;return new by({type:"tuple",items:t,rest:s,...N(n)})}const Hc=$("ZodRecord",(t,e)=>{Vv.init(t,e),ee.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function ma(t,e,r){return new Hc({type:"record",keyType:t,valueType:e,...N(r)})}function cT(t,e,r){return new Hc({type:"record",keyType:ze([t,la()]),valueType:e,...N(r)})}const wy=$("ZodMap",(t,e)=>{Wv.init(t,e),ee.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function lT(t,e,r){return new wy({type:"map",keyType:t,valueType:e,...N(r)})}const _y=$("ZodSet",(t,e)=>{Gv.init(t,e),ee.init(t,e),t.min=(...r)=>t.check(oi(...r)),t.nonempty=r=>t.check(oi(1,r)),t.max=(...r)=>t.check(ra(...r)),t.size=(...r)=>t.check(fc(...r))});function dT(t,e){return new _y({type:"set",valueType:t,...N(e)})}const ui=$("ZodEnum",(t,e)=>{Yv.init(t,e),ee.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(i,n)=>{const s={};for(const a of i)if(r.has(a))s[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ui({...e,checks:[],...N(n),entries:s})},t.exclude=(i,n)=>{const s={...e.entries};for(const a of i)if(r.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new ui({...e,checks:[],...N(n),entries:s})}});function Ye(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new ui({type:"enum",entries:r,...N(e)})}function mT(t,e){return new ui({type:"enum",entries:t,...N(e)})}const ky=$("ZodLiteral",(t,e)=>{Kv.init(t,e),ee.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function Iy(t,e){return new ky({type:"literal",values:Array.isArray(t)?t:[t],...N(e)})}const Oy=$("ZodFile",(t,e)=>{Xv.init(t,e),ee.init(t,e),t.min=(r,i)=>t.check(oi(r,i)),t.max=(r,i)=>t.check(ra(r,i)),t.mime=(r,i)=>t.check(bc(Array.isArray(r)?r:[r],i))});function fT(t){return Gg(Oy,t)}const Qc=$("ZodTransform",(t,e)=>{Bu.init(t,e),ee.init(t,e),t._zod.parse=(r,i)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(ar(s,r.value,e));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(ar(a))}};const n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function el(t){return new Qc({type:"transform",transform:t})}const tl=$("ZodOptional",(t,e)=>{Hv.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ts(t){return new tl({type:"optional",innerType:t})}const Sy=$("ZodNullable",(t,e)=>{Qv.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function zs(t){return new Sy({type:"nullable",innerType:t})}function hT(t){return Ts(zs(t))}const Ny=$("ZodDefault",(t,e)=>{eg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Ty(t,e){return new Ny({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const zy=$("ZodPrefault",(t,e)=>{tg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function xy(t,e){return new zy({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const nl=$("ZodNonOptional",(t,e)=>{ng.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ey(t,e){return new nl({type:"nonoptional",innerType:t,...N(e)})}const Uy=$("ZodSuccess",(t,e)=>{rg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function pT(t){return new Uy({type:"success",innerType:t})}const Zy=$("ZodCatch",(t,e)=>{ig.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Py(t,e){return new Zy({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const jy=$("ZodNaN",(t,e)=>{sg.init(t,e),ee.init(t,e)});function vT(t){return Mg(jy,t)}const rl=$("ZodPipe",(t,e)=>{Fu.init(t,e),ee.init(t,e),t.in=e.in,t.out=e.out});function xs(t,e){return new rl({type:"pipe",in:t,out:e})}const Ay=$("ZodReadonly",(t,e)=>{ag.init(t,e),ee.init(t,e)});function Dy(t){return new Ay({type:"readonly",innerType:t})}const Cy=$("ZodTemplateLiteral",(t,e)=>{og.init(t,e),ee.init(t,e)});function gT(t,e){return new Cy({type:"template_literal",parts:t,...N(e)})}const Ry=$("ZodLazy",(t,e)=>{cg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.getter()});function Ly(t){return new Ry({type:"lazy",getter:t})}const My=$("ZodPromise",(t,e)=>{ug.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function yT(t){return new My({type:"promise",innerType:t})}const fa=$("ZodCustom",(t,e)=>{lg.init(t,e),ee.init(t,e)});function By(t,e){const r=new Re({check:"custom",...N(e)});return r._zod.check=t,r}function $T(t,e){return Yg(fa,t??(()=>!0),e)}function Fy(t,e={}){return Kg(fa,t,e)}function qy(t,e){const r=By(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(ar(n,i.value,r._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),i.issues.push(ar(s))}},t(i.value,i)),e);return r}function ge(t,e={error:`Input not instance of ${t.name}`}){const r=new fa({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...N(e)});return r._zod.bag.Class=t,r}const bT=(...t)=>Xg({Pipe:rl,Boolean:ua,String:aa,Transform:Qc},...t);function wT(t){const e=Ly(()=>ze([Ne(t),H(),Gc(),zi(),xi(e),ma(Ne(),e)]));return e}function _T(t,e){return xs(el(t),e)}const ha=kr([H(),H()]);kr([gn(),gn()]);const Jy=re({width:H(),height:H()}),kT=re({signedWidth:H(),signedHeight:H()}),IT=["width","height"];Ye(IT);const OT=["start","center","end"],ST=["signedWidth","signedHeight"];Ye(ST);const Es=re({x:H(),y:H()}),NT=re({clientX:H(),clientY:H()}),TT=["x","y"],Vy=Ye(TT),Wy=["top","right","bottom","left"];Ye(Wy);const zT=["left","right"],Gy=Ye(zT),xT=["top","bottom"],Yy=Ye(xT),Ky=["center"],Qm=Ye(Ky),ET=[...Wy,...Ky],Xy=Ye(ET);Ye(OT);const UT=["first","last"];Ye(UT);const ZT=re({lower:H(),upper:H()}),PT=re({lower:gn(),upper:gn()});ze([ZT,ha]);ze([PT,ha]);Ye([...Vy.options,...Xy.options]);ze([Vy,Xy,ge(String)]);const Ir=t=>typeof t=="bigint"||t instanceof BigInt,ao=(t,e)=>Ir(t)?t.valueOf()-BigInt(e.valueOf().valueOf()):t.valueOf()-Number(e.valueOf()),jT=(t,e)=>Ir(t)?t.valueOf()+BigInt(e.valueOf().valueOf()):t+Number(e.valueOf()),ef=(t,e)=>Ir(t)?t===BigInt(e.valueOf().valueOf()):t===Number(e.valueOf()),AT=(t,e)=>Ir(t)?t.valueOf()<BigInt(e.valueOf())?t:BigInt(e.valueOf()):t.valueOf()<Number(e.valueOf())?t:Number(e.valueOf()),DT=t=>Ir(t)||t instanceof BigInt?t.valueOf()<0n?-t:t:t.valueOf()<0?-t:t,Ln=(t,e)=>Ir(t)?t.valueOf()*BigInt(e.valueOf()):t.valueOf()*Number(e.valueOf()),nt=(t,e,r)=>{const i={};if(typeof e=="object"&&(r=e,e=void 0),r={makeValid:!0,...r},typeof t=="number"||typeof t=="bigint")e!=null?(i.lower=t,i.upper=e):(i.lower=typeof t=="bigint"?0n:0,i.upper=t);else if(Array.isArray(t)){if(t.length!==2)throw new Error("bounds: expected array of length 2");[i.lower,i.upper]=t}else i.lower=t.lower,i.upper=t.upper;return r!=null&&r.makeValid?CT(i):i},CT=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t,tf=(t,e)=>{const r=nt(t);return e<r.lower?r.lower:e>=r.upper?r.upper-(typeof r.upper=="number"?1:1n):e},Hi=(t,e)=>{const r=nt(t);if(typeof e=="number"||typeof e=="bigint")return e>=r.lower&&e<r.upper;const i=nt(e);return i.lower>=r.lower&&i.upper<=r.upper},RT=t=>({lower:Math.min(...t.map(e=>nt(e).lower)),upper:Math.max(...t.map(e=>nt(e).upper))}),LT=(t,e,r)=>{const i=t.map(o=>nt(o)),n=r>0?1:r<0?-1:0;if(n===0)return e;let s=r,a=e;for(;ef(s,0)===!1;){const o=i.findIndex(u=>n>0?a>=u.lower&&a<u.upper:a>u.lower&&a<=u.upper);if(o!==-1){const u=i[o];let c;if(n>0?c=ao(u.upper,a):c=ao(a,u.lower),c>0){const l=AT(DT(s),c);if(a=jT(a,n>0?l:-l),s=ao(s,n>0?l:-l),ef(s,0))return a;continue}}if(n>0){const u=i.filter(c=>c.lower>a);if(u.length>0)a=u[0].lower;else return a}else{const u=i.filter(c=>c.upper<a);if(u.length>0)a=u[u.length-1].upper;else return a}}return a},MT=(t,e,r)=>{const i=t.map(a=>nt(a));if(e===r)return typeof e=="bigint"?0n:0;const n=e<r?nt([e,r]):nt([r,e]);let s=typeof e=="bigint"?0n:0;for(const a of i){const o=a.lower>n.lower?a.lower:n.lower,u=a.upper<n.upper?a.upper:n.upper;if(o<u){const c=u-o;s=s+c}}return s};re({x:Gy.or(Qm),y:Yy.or(Qm)});const BT=re({x:Gy,y:Yy}),FT=Object.freeze({x:"left",y:"top"}),qT=(t,e)=>t.x===e.x&&t.y===e.y,nf=ze([H(),Es,ha,Jy,kT,NT]),JT=(t,e)=>{if(typeof t=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return t==="x"?{x:e,y:0}:{x:0,y:e}}return typeof t=="number"?{x:t,y:e??t}:Array.isArray(t)?{x:t[0],y:t[1]}:"signedWidth"in t?{x:t.signedWidth,y:t.signedHeight}:"clientX"in t?{x:t.clientX,y:t.clientY}:"width"in t?{x:t.width,y:t.height}:{x:t.x,y:t.y}},rf=Object.freeze({x:0,y:0}),Qi=ze([H(),Ne()]);re({top:Qi,left:Qi,width:Qi,height:Qi});re({left:H(),top:H(),right:H(),bottom:H()});re({one:Es,two:Es,root:BT});const il=(t,e,r=0,i=0,n)=>{const s={one:{...rf},two:{...rf},root:n??FT};if(typeof t=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return s.one={x:t,y:e},s.two={x:s.one.x+r,y:s.one.y+i},s}return"one"in t&&"two"in t&&"root"in t?{...t,root:n??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(s.one={x:t.left,y:t.top},s.two={x:t.right,y:t.bottom},s):(s.one=t,e==null?s.two={x:s.one.x+r,y:s.one.y+i}:typeof e=="number"?s.two={x:s.one.x+e,y:s.one.y+r}:"width"in e?s.two={x:s.one.x+e.width,y:s.one.y+e.height}:"signedWidth"in e?s.two={x:s.one.x+e.signedWidth,y:s.one.y+e.signedHeight}:s.two=e,s))},oo=t=>{const e=il(t);return{lower:e.one.x,upper:e.two.x}},uo=t=>{const e=il(t);return{lower:e.one.y,upper:e.two.y}},VT=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,WT=re({signedWidth:H(),signedHeight:H()});ze([Jy,WT,Es,ha]);var GT=Object.defineProperty,YT=(t,e,r)=>e in t?GT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Bt=(t,e,r)=>YT(t,typeof e!="symbol"?e+"":e,r);const KT=(t,e,r)=>e!==void 0&&t<e?e:r!==void 0&&t>r?r:t;re({offset:nf,scale:nf});re({offset:H(),scale:H()});const XT=t=>(e,r,i,n)=>r==="dimension"?[e,i]:[e,n?i-t:i+t],HT=t=>(e,r,i,n)=>[e,n?i/t:i*t],QT=t=>(e,r,i)=>{if(e===null)return[t,i];const{lower:n,upper:s}=e,{lower:a,upper:o}=t,u=s-n,c=o-a;if(r==="dimension")return[t,i*(c/u)];const l=(i-n)*(c/u)+a;return[t,l]},ez=t=>(e,r,i)=>[t,i],tz=()=>(t,e,r)=>{if(t===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[t,r];const{lower:i,upper:n}=t;return[t,n-(r-i)]},nz=t=>(e,r,i)=>{const{lower:n,upper:s}=t;return i=KT(i,n,s),[e,i]},jo=class Lr{constructor(){Bt(this,"ops",[]),Bt(this,"currBounds",null),Bt(this,"currType",null),Bt(this,"reversed",!1),this.ops=[]}static translate(e){return new Lr().translate(e)}static magnify(e){return new Lr().magnify(e)}static scale(e,r){return new Lr().scale(e,r)}translate(e){const r=this.new(),i=XT(e);return i.type="translate",r.ops.push(i),r}magnify(e){const r=this.new(),i=HT(e);return i.type="magnify",r.ops.push(i),r}scale(e,r){const i=nt(e,r),n=this.new(),s=QT(i);return s.type="scale",n.ops.push(s),n}clamp(e,r){const i=nt(e,r),n=this.new(),s=nz(i);return s.type="clamp",n.ops.push(s),n}reBound(e,r){const i=nt(e,r),n=this.new(),s=ez(i);return s.type="re-bound",n.ops.push(s),n}invert(){const e=tz();e.type="invert";const r=this.new();return r.ops.push(e),r}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new Lr;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,r){return this.currBounds=null,this.ops.reduce(([i,n],s)=>s(i,e,n,this.reversed),[null,r])[1]}reverse(){const e=this.new();e.ops.reverse();const r=[];return e.ops.forEach((i,n)=>{if(i.type==="scale"||r.some(([a,o])=>n>=a&&n<=o))return;const s=e.ops.findIndex((a,o)=>a.type==="scale"&&o>n);s!==-1&&r.push([n,s])}),r.forEach(([i,n])=>{const s=e.ops.slice(i,n);s.unshift(e.ops[n]),e.ops.splice(i,n-i+1,...s)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};Bt(jo,"IDENTITY",new jo);let sf=jo;const af=class Rt{constructor(e=new sf,r=new sf,i=null){Bt(this,"x"),Bt(this,"y"),Bt(this,"currRoot"),this.x=e,this.y=r,this.currRoot=i}static translate(e,r){return new Rt().translate(e,r)}static translateX(e){return new Rt().translateX(e)}static translateY(e){return new Rt().translateY(e)}static clamp(e){return new Rt().clamp(e)}static magnify(e){return new Rt().magnify(e)}static scale(e){return new Rt().scale(e)}static reBound(e){return new Rt().reBound(e)}translate(e,r){const i=JT(e,r),n=this.copy();return n.x=this.x.translate(i.x),n.y=this.y.translate(i.y),n}translateX(e){const r=this.copy();return r.x=this.x.translate(e),r}translateY(e){const r=this.copy();return r.y=this.y.translate(e),r}magnify(e){const r=this.copy();return r.x=this.x.magnify(e.x),r.y=this.y.magnify(e.y),r}scale(e){const r=this.copy();if(VT(e)){const i=this.currRoot;return r.currRoot=e.root,i!=null&&!qT(i,e.root)&&(i.x!==e.root.x&&(r.x=r.x.invert()),i.y!==e.root.y&&(r.y=r.y.invert())),r.x=r.x.scale(oo(e)),r.y=r.y.scale(uo(e)),r}return r.x=r.x.scale(e.width),r.y=r.y.scale(e.height),r}reBound(e){const r=this.copy();return r.x=this.x.reBound(oo(e)),r.y=this.y.reBound(uo(e)),r}clamp(e){const r=this.copy();return r.x=this.x.clamp(oo(e)),r.y=this.y.clamp(uo(e)),r}copy(){const e=new Rt;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return il(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}};Bt(af,"IDENTITY",new af);var rz=Object.defineProperty,iz=(t,e,r)=>e in t?rz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,z=(t,e,r)=>iz(t,typeof e!="symbol"?e+"":e,r);function sz(t){return hg(aa,t)}function az(t){return wg(oa,t)}function oz(t){return Tg(ua,t)}function Hy(t){return xg(ca,t)}function uz(t){return Lg(Kc,t)}const cz=Object.freeze(Object.defineProperty({__proto__:null,bigint:Hy,boolean:oz,date:uz,number:az,string:sz},Symbol.toStringTag,{value:"Module"}));let lz=(t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i};const dz="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",mz=lz(dz,11),Qy=()=>mz(),fz=Object.freeze(Object.defineProperty({__proto__:null,create:Qy},Symbol.toStringTag,{value:"Module"})),hz=(t,e)=>r=>r instanceof e||typeof r=="object"&&r!==null&&"discriminator"in r&&r.discriminator===t,pz=Ye(["static","dynamic"]),e$=(t,e)=>{const r=new W(e);if(![M.DAY,M.HOUR,M.MINUTE,M.SECOND,M.MILLISECOND,M.MICROSECOND,M.NANOSECOND].some(n=>n.equals(r)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const i=t.valueOf()%r.valueOf();return t instanceof W?new W(i):new M(i)},le=class R extends br{constructor(e,r="UTC"){if(e==null)super(R.now().valueOf());else if(e instanceof Date)super(BigInt(e.getTime())*R.MILLISECOND.valueOf());else if(typeof e=="string")super(R.parseDateTimeString(e,r).valueOf());else if(Array.isArray(e))super(R.parseDate(e));else{let i=BigInt(0);e instanceof Number&&(e=e.valueOf()),r==="local"&&(i=R.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=R.MAX:e=R.MIN)),super(BigInt(e.valueOf())+i)}}static parseDate([e=1970,r=1,i=1]){const n=new Date(e,r-1,i,0,0,0,0);return new R(BigInt(n.getTime())*R.MILLISECOND.valueOf()).truncate(R.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,r="UTC"){const[i,n,s]=e.split(":");let a="00",o="00";s!=null&&([a,o]=s.split("."));let u=R.hours(parseInt(i??"00")).add(R.minutes(parseInt(n??"00"))).add(R.seconds(parseInt(a??"00"))).add(R.milliseconds(parseInt(o??"00")));return r==="local"&&(u=u.add(R.utcOffset)),u.valueOf()}static parseDateTimeString(e,r="UTC"){if(!e.includes("/")&&!e.includes("-"))return R.parseTimeString(e,r);const i=new Date(e);return e.includes(":")||i.setUTCHours(0,0,0,0),new R(BigInt(i.getTime())*R.MILLISECOND.valueOf(),r).valueOf()}fString(e="ISO",r="UTC"){switch(e){case"ISODate":return this.toISOString(r).slice(0,10);case"ISOTime":return this.toISOString(r).slice(11,23);case"time":return this.timeString(!1,r);case"preciseTime":return this.timeString(!0,r);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,r)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,r)}`;default:return this.toISOString(r)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(R.utcOffset).date().toISOString()}timeString(e=!1,r="UTC"){const i=this.toISOString(r);return e?i.slice(11,23):i.slice(11,19)}dateString(){const e=this.date(),r=e.toLocaleString("default",{month:"short"}),i=e.toLocaleString("default",{day:"numeric"});return`${r} ${i}`}static get utcOffset(){return new M(BigInt(new Date().getTimezoneOffset())*R.MINUTE.valueOf())}static since(e){return new R().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new R(e).valueOf()}span(e){return this.range(e).span}range(e){return new Ee(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new R(e).valueOf()}afterEq(e){return this.valueOf()>=new R(e).valueOf()}before(e){return this.valueOf()<new R(e).valueOf()}beforeEq(e){return this.valueOf()<=new R(e).valueOf()}add(e){return new R(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new R(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(M.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(M.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(M.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(M.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(R.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(R.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}setYear(e){const r=this.date();return r.setUTCFullYear(e),new R(r)}get month(){return this.date().getUTCMonth()}setMonth(e){const r=this.date();return r.setUTCMonth(e),new R(r)}get day(){return this.date().getUTCDate()}setDay(e){const r=this.date();return r.setUTCDate(e),new R(r)}get hour(){return this.date().getUTCHours()}setHour(e){const r=this.date();return r.setUTCHours(e),new R(r,"UTC")}get minute(){return this.date().getUTCMinutes()}setMinute(e){const r=this.date();return r.setUTCMinutes(e),new R(r)}get second(){return this.date().getUTCSeconds()}setSecond(e){const r=this.date();return r.setUTCSeconds(e),new R(r)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(e){const r=this.date();return r.setUTCMilliseconds(e),new R(r)}toString(){return this.date().toISOString()}remainder(e){return e$(this,e)}get isToday(){return this.truncate(M.DAY).equals(R.now().truncate(M.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new R(new Date)}static max(...e){let r=R.MIN;for(const i of e){const n=new R(i);n.after(r)&&(r=n)}return r}static min(...e){let r=R.MAX;for(const i of e){const n=new R(i);n.before(r)&&(r=n)}return r}static nanoseconds(e,r="UTC"){return new R(e,r)}static microseconds(e,r="UTC"){return R.nanoseconds(e*1e3,r)}static milliseconds(e,r="UTC"){return R.microseconds(e*1e3,r)}static seconds(e,r="UTC"){return R.milliseconds(e*1e3,r)}static minutes(e,r="UTC"){return R.seconds(e*60,r)}static hours(e,r="UTC"){return R.minutes(e*60,r)}static days(e,r="UTC"){return R.hours(e*24,r)}};z(le,"NANOSECOND",le.nanoseconds(1)),z(le,"MICROSECOND",le.microseconds(1)),z(le,"MILLISECOND",le.milliseconds(1)),z(le,"SECOND",le.seconds(1)),z(le,"MINUTE",le.minutes(1)),z(le,"HOUR",le.hours(1)),z(le,"DAY",le.days(1)),z(le,"MAX",new le((1n<<63n)-1n)),z(le,"MIN",new le(0)),z(le,"ZERO",new le(0)),z(le,"z",ze([re({value:gn()}).transform(t=>new le(t.value)),Ne().transform(t=>new le(BigInt(t))),ge(Number).transform(t=>new le(t)),H().transform(t=>new le(t)),ge(le)]));let W=le;const de=class G extends br{constructor(e){typeof e=="number"&&(e=Math.trunc(e.valueOf())),super(BigInt(e.valueOf()))}static fromSeconds(e){return e instanceof G?e:e instanceof Ao?e.period:e instanceof W?new G(e):["number","bigint"].includes(typeof e)?G.seconds(e):new G(e)}static fromMilliseconds(e){return e instanceof G?e:e instanceof Ao?e.period:e instanceof W?new G(e):["number","bigint"].includes(typeof e)?G.milliseconds(e):new G(e)}valueOf(){return this.value}lessThan(e){return this.valueOf()<new G(e).valueOf()}greaterThan(e){return this.valueOf()>new G(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new G(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new G(e).valueOf()}remainder(e){return e$(this,e)}truncate(e){return new G(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(G.DAY),r=this.truncate(G.HOUR),i=this.truncate(G.MINUTE),n=this.truncate(G.SECOND),s=this.truncate(G.MILLISECOND),a=this.truncate(G.MICROSECOND),o=this.truncate(G.NANOSECOND),u=e,c=r.sub(e),l=i.sub(r),d=n.sub(i),g=s.sub(n),p=a.sub(s),_=o.sub(a);let k="";return u.isZero||(k+=`${u.days}d `),c.isZero||(k+=`${c.hours}h `),l.isZero||(k+=`${l.minutes}m `),d.isZero||(k+=`${d.seconds}s `),g.isZero||(k+=`${g.milliseconds}ms `),p.isZero||(k+=`${p.microseconds}µs `),_.isZero||(k+=`${_.nanoseconds}ns`),k.trim()}mult(e){return new G(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(G.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(G.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(G.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(G.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(G.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(G.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new G(e).valueOf()}add(e){return new G(this.valueOf()+new G(e).valueOf())}sub(e){return new G(this.valueOf()-new G(e).valueOf())}static nanoseconds(e=1){return new G(e)}static microseconds(e=1){return G.nanoseconds(Ln(e,1e3))}static milliseconds(e=1){return G.microseconds(Ln(e,1e3))}static seconds(e=1){return G.milliseconds(Ln(e,1e3))}static minutes(e=1){return G.seconds(Ln(e,60))}static hours(e){return G.minutes(Ln(e,60))}static days(e){return G.hours(Ln(e,24))}};z(de,"NANOSECOND",de.nanoseconds(1)),z(de,"MICROSECOND",de.microseconds(1)),z(de,"MILLISECOND",de.milliseconds(1)),z(de,"SECOND",de.seconds(1)),z(de,"MINUTE",de.minutes(1)),z(de,"HOUR",de.hours(1)),z(de,"DAY",de.days(1)),z(de,"MAX",new de((1n<<63n)-1n)),z(de,"MIN",new de(0)),z(de,"ZERO",new de(0)),z(de,"z",ze([re({value:gn()}).transform(t=>new de(t.value)),Ne().transform(t=>new de(BigInt(t))),ge(Number).transform(t=>new de(t)),H().transform(t=>new de(t)),ge(de)]));let M=de;const Mr=class ps extends br{constructor(e){super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new ps(e).valueOf()}get period(){return M.seconds(1/this.valueOf())}sampleCount(e){return new M(e).seconds*this.valueOf()}byteCount(e,r){return this.sampleCount(e)*new ot(r).valueOf()}span(e){return M.seconds(e/this.valueOf())}byteSpan(e,r){return this.span(e.valueOf()/r.valueOf())}static hz(e){return new ps(e)}static khz(e){return ps.hz(e*1e3)}};z(Mr,"z",ze([H().transform(t=>new Mr(t)),ge(Number).transform(t=>new Mr(t)),ge(Mr)]));let Ao=Mr;const He=class extends br{constructor(e){super(e.valueOf())}length(e){return e.valueOf()/this.valueOf()}size(e){return new lr(e*this.valueOf())}};z(He,"UNKNOWN",new He(0)),z(He,"BIT128",new He(16)),z(He,"BIT64",new He(8)),z(He,"BIT32",new He(4)),z(He,"BIT16",new He(2)),z(He,"BIT8",new He(1)),z(He,"z",ze([H().transform(t=>new He(t)),ge(Number).transform(t=>new He(t)),ge(He)]));let ot=He;const Nt=class Br{constructor(e,r){z(this,"start"),z(this,"end"),typeof e=="object"&&"start"in e?(this.start=new W(e.start),this.end=new W(e.end)):(this.start=new W(e),this.end=new W(r))}get span(){return new M(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new Br(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,r=M.ZERO){if(r.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let i=this.start.sub(e.start).valueOf(),n=this.end.sub(e.end).valueOf();return i<0&&(i=-i),n<0&&(n=-n),i<=r.valueOf()&&n<=r.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,r=M.ZERO){e=e.makeValid();const i=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(i.start)||i.end.equals(e.start))return!1;const n=W.max(i.start,e.start),s=W.min(i.end,e.end);return s.before(n)?!1:new M(s.sub(n)).greaterThanOrEqual(r)}contains(e){return e instanceof Br?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const r=new Br(this.start,this.end);return e.start.after(this.start)&&(r.start=e.start),e.start.after(this.end)&&(r.end=e.start),e.end.before(this.end)&&(r.end=e.end),e.end.before(this.start)&&(r.start=e.end),r}static max(...e){return new Br(W.min(...e.map(r=>r.start)),W.max(...e.map(r=>r.end)))}};z(Nt,"MAX",new Nt(W.MIN,W.MAX)),z(Nt,"MIN",new Nt(W.MAX,W.MIN)),z(Nt,"ZERO",new Nt(W.ZERO,W.ZERO)),z(Nt,"z",ze([re({start:W.z,end:W.z}).transform(t=>new Nt(t.start,t.end)),ge(Nt)]));let Ee=Nt;const vz=(t,e)=>t.start.before(e.start)?-1:t.start.after(e.start)?1:t.end.before(e.end)?-1:t.end.after(e.end)?1:0,x=class Ze extends br{constructor(e){if(e instanceof Ze||typeof e=="string"||typeof e.valueOf()=="string")super(e.valueOf());else{const r=Ze.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(r==null)throw new Error(`unable to find data type for ${e.toString()}`);super(r.valueOf())}}get Array(){const e=Ze.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(r=>this.equals(r))}toString(){return this.valueOf()}get isVariable(){return this.equals(Ze.JSON)||this.equals(Ze.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(Ze.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=Ze.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsignedInteger(){return this.equals(Ze.UINT8)||this.equals(Ze.UINT16)||this.equals(Ze.UINT32)||this.equals(Ze.UINT64)}get isSignedInteger(){return this.equals(Ze.INT8)||this.equals(Ze.INT16)||this.equals(Ze.INT32)||this.equals(Ze.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsignedInteger&&e.isSignedInteger?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(Ze.INT32)&&e.equals(Ze.FLOAT64)||this.equals(Ze.INT8)&&e.equals(Ze.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsignedInteger===e.isUnsignedInteger:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}get usesBigInt(){return Ze.BIG_INT_TYPES.some(e=>e.equals(this))}};z(x,"UNKNOWN",new x("unknown")),z(x,"FLOAT64",new x("float64")),z(x,"FLOAT32",new x("float32")),z(x,"INT64",new x("int64")),z(x,"INT32",new x("int32")),z(x,"INT16",new x("int16")),z(x,"INT8",new x("int8")),z(x,"UINT64",new x("uint64")),z(x,"UINT32",new x("uint32")),z(x,"UINT16",new x("uint16")),z(x,"UINT8",new x("uint8")),z(x,"BOOLEAN",x.UINT8),z(x,"TIMESTAMP",new x("timestamp")),z(x,"UUID",new x("uuid")),z(x,"STRING",new x("string")),z(x,"JSON",new x("json")),z(x,"ARRAY_CONSTRUCTORS",new Map([[x.UINT8.toString(),Uint8Array],[x.UINT16.toString(),Uint16Array],[x.UINT32.toString(),Uint32Array],[x.UINT64.toString(),BigUint64Array],[x.FLOAT32.toString(),Float32Array],[x.FLOAT64.toString(),Float64Array],[x.INT8.toString(),Int8Array],[x.INT16.toString(),Int16Array],[x.INT32.toString(),Int32Array],[x.INT64.toString(),BigInt64Array],[x.TIMESTAMP.toString(),BigInt64Array],[x.STRING.toString(),Uint8Array],[x.JSON.toString(),Uint8Array],[x.UUID.toString(),Uint8Array]])),z(x,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,x.UINT8],[Uint16Array.name,x.UINT16],[Uint32Array.name,x.UINT32],[BigUint64Array.name,x.UINT64],[Float32Array.name,x.FLOAT32],[Float64Array.name,x.FLOAT64],[Int8Array.name,x.INT8],[Int16Array.name,x.INT16],[Int32Array.name,x.INT32],[BigInt64Array.name,x.INT64]])),z(x,"DENSITIES",new Map([[x.UINT8.toString(),ot.BIT8],[x.UINT16.toString(),ot.BIT16],[x.UINT32.toString(),ot.BIT32],[x.UINT64.toString(),ot.BIT64],[x.FLOAT32.toString(),ot.BIT32],[x.FLOAT64.toString(),ot.BIT64],[x.INT8.toString(),ot.BIT8],[x.INT16.toString(),ot.BIT16],[x.INT32.toString(),ot.BIT32],[x.INT64.toString(),ot.BIT64],[x.TIMESTAMP.toString(),ot.BIT64],[x.STRING.toString(),ot.UNKNOWN],[x.JSON.toString(),ot.UNKNOWN],[x.UUID.toString(),ot.BIT128]])),z(x,"ALL",[x.UNKNOWN,x.FLOAT64,x.FLOAT32,x.INT64,x.INT32,x.INT16,x.INT8,x.UINT64,x.UINT32,x.UINT16,x.UINT8,x.TIMESTAMP,x.UUID,x.STRING,x.JSON]),z(x,"BIG_INT_TYPES",[x.INT64,x.UINT64,x.TIMESTAMP]),z(x,"z",ze([Ne().transform(t=>new x(t)),ge(x)]));let ae=x;const st=class Me extends br{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Me.bytes(this.valueOf()+e.valueOf())}sub(e){return Me.bytes(this.valueOf()-e.valueOf())}truncate(e){return new Me(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return Me.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/Me.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/Me.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/Me.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/Me.TERABYTE.valueOf()}toString(){const e=this.truncate(Me.TERABYTE),r=this.truncate(Me.GIGABYTE),i=this.truncate(Me.MEGABYTE),n=this.truncate(Me.KILOBYTE),s=this.truncate(Me.BYTE),a=e,o=r.sub(e),u=i.sub(r),c=n.sub(i),l=s.sub(n);let d="";return a.isZero||(d+=`${a.terabytes}TB `),o.isZero||(d+=`${o.gigabytes}GB `),u.isZero||(d+=`${u.megabytes}MB `),c.isZero||(d+=`${c.kilobytes}KB `),(!l.isZero||d==="")&&(d+=`${l.valueOf()}B`),d.trim()}static bytes(e=1){return new Me(e)}static kilobytes(e=1){return Me.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Me.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Me.megabytes(e.valueOf()*1e3)}static terabytes(e){return Me.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};z(st,"BYTE",new st(1)),z(st,"KILOBYTE",st.kilobytes(1)),z(st,"MEGABYTE",st.megabytes(1)),z(st,"GIGABYTE",st.gigabytes(1)),z(st,"TERABYTE",st.terabytes(1)),z(st,"ZERO",new st(0)),z(st,"z",ze([H().transform(t=>new st(t)),ge(st)]));let lr=st;ze([ge(Uint8Array),ge(Uint16Array),ge(Uint32Array),ge(BigUint64Array),ge(Float32Array),ge(Float64Array),ge(Int8Array),ge(Int16Array),ge(Int32Array),ge(BigInt64Array)]);const t$=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof W||t instanceof M||t instanceof Date},gz=(t,e,r,i=0)=>t.usesBigInt&&!e.usesBigInt?Number(r)-Number(i):!t.usesBigInt&&e.usesBigInt?BigInt(r.valueOf())-BigInt(i.valueOf()):vs(r,-i).valueOf(),vs=(t,e)=>e==0?t:t==0?e:typeof t=="bigint"&&typeof e=="bigint"||typeof t=="number"&&typeof e=="number"?t+e:Number(t)+Number(e),yz=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function $z(t){return typeof t=="string"&&yz.test(t)}const Qe=[];for(let t=0;t<256;++t)Qe.push((t+256).toString(16).slice(1));function bz(t,e=0){return(Qe[t[e+0]]+Qe[t[e+1]]+Qe[t[e+2]]+Qe[t[e+3]]+"-"+Qe[t[e+4]]+Qe[t[e+5]]+"-"+Qe[t[e+6]]+Qe[t[e+7]]+"-"+Qe[t[e+8]]+Qe[t[e+9]]+"-"+Qe[t[e+10]]+Qe[t[e+11]]+Qe[t[e+12]]+Qe[t[e+13]]+Qe[t[e+14]]+Qe[t[e+15]]).toLowerCase()}function wz(t,e=0){const r=bz(t,e);if(!$z(r))throw TypeError("Stringified UUID is invalid");return r}typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const _z=(t,e)=>wz(t,e),Yt=-1,Do={[Symbol.iterator]:()=>Do,next:()=>({done:!0,value:void 0})},kz=Ne().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer),Iz=ze([zi(),ly()]).transform(()=>new Uint8Array().buffer),Co=10,n$=(t,e)=>{if(t==="string"&&!e.isVariable)throw new Error(`cannot convert series of type ${e.toString()} to string`);if(t==="number"&&!e.isNumeric)throw new Error(`cannot convert series of type ${e.toString()} to number`);if(t==="bigint"&&!e.usesBigInt)throw new Error(`cannot convert series of type ${e.toString()} to bigint`)},r$="sy_x_telem_series",Fr=class Fn{constructor(e){z(this,"key"),z(this,"discriminator",r$),z(this,"dataType"),z(this,"sampleOffset"),z(this,"gl"),z(this,"_data"),z(this,"timeRange",Ee.ZERO),z(this,"alignment",0n),z(this,"cachedMin"),z(this,"cachedMax"),z(this,"writePos",Yt),z(this,"_refCount",0),z(this,"cachedLength"),z(this,"_cachedIndexes"),Oz(e)&&(e={data:e}),e.data??(e.data=[]);const{dataType:r,timeRange:i,sampleOffset:n=0,glBufferUsage:s="static",alignment:a=0n,key:o=Qy(),data:u}=e;if(i$(u)){const d=u;this.key=d.key,this.dataType=d.dataType,this.sampleOffset=d.sampleOffset,this.gl=d.gl,this._data=d._data,this.timeRange=d.timeRange,this.alignment=d.alignment,this.cachedMin=d.cachedMin,this.cachedMax=d.cachedMax,this.writePos=d.writePos,this._refCount=d._refCount,this.cachedLength=d.cachedLength;return}const c=t$(u),l=Array.isArray(u);if(r!=null)this.dataType=new ae(r);else{if(u instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(l||c){let d=u;if(!c){if(u.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");d=u[0]}if(typeof d=="string")this.dataType=ae.STRING;else if(typeof d=="number")this.dataType=ae.FLOAT64;else if(typeof d=="bigint")this.dataType=ae.INT64;else if(typeof d=="boolean")this.dataType=ae.BOOLEAN;else if(d instanceof W||d instanceof Date||d instanceof W)this.dataType=ae.TIMESTAMP;else if(typeof d=="object")this.dataType=ae.JSON;else throw new Error(`cannot infer data type of ${typeof d} when constructing a Series from a JS array`)}else this.dataType=new ae(u)}if(!l&&!c)this._data=u;else{let d=c?[u]:u;const g=d[0];(g instanceof W||g instanceof Date||g instanceof M)&&(d=d.map(p=>new W(p).valueOf())),this.dataType.equals(ae.STRING)?(this.cachedLength=d.length,this._data=new TextEncoder().encode(`${d.join(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("zod"),Qi=r=>{const e=r.replace(/_[a-z]/g,t=>t[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},ys=r=>{const e=(t,n=Nr)=>{if(typeof t=="string")return r(t);if(Array.isArray(t))return t.map(o=>e(o,n));if(!or(t))return t;n=no(n);const a={},i=t;return"toJSON"in i&&typeof i.toJSON=="function"?e(i.toJSON(),n):(Object.keys(i).forEach(o=>{let c=i[o];const l=r(o);n.recursive&&(or(c)?Sn(c)||(c=e(c,n)):n.recursiveInArray&&zn(c)&&(c=[...c].map(h=>{let d=h;return or(h)?Sn(d)||(d=e(h,n)):zn(h)&&(d=e({key:h},n).key),d}))),a[l]=c}),a)};return e},gs=ys(Qi),eo=r=>r.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`),to=ys(eo),ro=[Number,String,Uint8Array],Nr={recursive:!0,recursiveInArray:!0},no=(r=Nr)=>(r.recursive==null?r=Nr:r.recursiveInArray??=!1,r),zn=r=>r!=null&&Array.isArray(r),or=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),Sn=r=>ro.some(e=>r instanceof e);let so=class{contentType="application/json";decoder;encoder;constructor(){this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(r){return this.encoder.encode(this.encodeString(r))}decode(r,e){return this.decodeString(this.decoder.decode(r),e)}decodeString(r,e){const t=JSON.parse(r),n=gs(t);return e!=null?e.parse(n):n}encodeString(r){const e=to(r);return JSON.stringify(e,(t,n)=>ArrayBuffer.isView(n)?Array.from(n):typeof n=="bigint"?n.toString():n)}};const zr=new so;let _e=class{value;constructor(e){this.value=e}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const ao=r=>r!=null&&typeof r=="object"&&"toString"in r,io=(r,e=!1)=>{const t=ao(r)?"stringer":typeof r;let n;switch(t){case"string":n=(a,i)=>a.localeCompare(i);break;case"stringer":n=(a,i)=>a.toString().localeCompare(i.toString());break;case"number":n=(a,i)=>Number(a)-Number(i);break;case"bigint":n=(a,i)=>BigInt(a)-BigInt(i)>0n?1:-1;break;case"boolean":n=(a,i)=>Number(a)-Number(i);break;case"undefined":n=()=>0;break;default:return console.warn(`sortFunc: unknown type ${t}`),()=>-1}return e?oo(n):n},oo=r=>(e,t)=>r(t,e),Vt=s.z.tuple([s.z.number(),s.z.number()]);s.z.tuple([s.z.bigint(),s.z.bigint()]);const ps=s.z.object({width:s.z.number(),height:s.z.number()}),co=s.z.object({signedWidth:s.z.number(),signedHeight:s.z.number()}),lo=["width","height"];s.z.enum(lo);const uo=["start","center","end"],ho=["signedWidth","signedHeight"];s.z.enum(ho);const Bt=s.z.object({x:s.z.number(),y:s.z.number()}),fo=s.z.object({clientX:s.z.number(),clientY:s.z.number()}),yo=["x","y"],ms=s.z.enum(yo),ws=["top","right","bottom","left"];s.z.enum(ws);const go=["left","right"],bs=s.z.enum(go),po=["top","bottom"],Ts=s.z.enum(po),vs=["center"],In=s.z.enum(vs),mo=[...ws,...vs],Es=s.z.enum(mo);s.z.enum(uo);const wo=["first","last"];s.z.enum(wo);const bo=s.z.object({lower:s.z.number(),upper:s.z.number()}),To=s.z.object({lower:s.z.bigint(),upper:s.z.bigint()});s.z.union([bo,Vt]);s.z.union([To,Vt]);s.z.enum([...ms.options,...Es.options]);s.z.union([ms,Es,s.z.instanceof(String)]);const xe=(r,e)=>typeof r=="bigint"?r*BigInt(e):r*Number(e),Ie=(r,e,t)=>{const n={};if(typeof e=="object"&&(t=e,e=void 0),t={makeValid:!0,...t},typeof r=="number"||typeof r=="bigint")e!=null?(n.lower=r,n.upper=e):(n.lower=typeof r=="bigint"?0n:0,n.upper=r);else if(Array.isArray(r)){if(r.length!==2)throw new Error("bounds: expected array of length 2");[n.lower,n.upper]=r}else n.lower=r.lower,n.upper=r.upper;return t?.makeValid?vo(n):n},vo=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r,An=(r,e)=>{const t=Ie(r);return e<t.lower?t.lower:e>=t.upper?t.upper-(typeof t.upper=="number"?1:1n):e};s.z.object({x:bs.or(In),y:Ts.or(In)});const Eo=s.z.object({x:bs,y:Ts}),Oo=Object.freeze({x:"left",y:"top"}),No=(r,e)=>r.x===e.x&&r.y===e.y,$n=s.z.union([s.z.number(),Bt,Vt,ps,co,fo]),zo=(r,e)=>{if(typeof r=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return r==="x"?{x:e,y:0}:{x:0,y:e}}return typeof r=="number"?{x:r,y:e??r}:Array.isArray(r)?{x:r[0],y:r[1]}:"signedWidth"in r?{x:r.signedWidth,y:r.signedHeight}:"clientX"in r?{x:r.clientX,y:r.clientY}:"width"in r?{x:r.width,y:r.height}:{x:r.x,y:r.y}},kn=Object.freeze({x:0,y:0}),kt=s.z.union([s.z.number(),s.z.string()]);s.z.object({top:kt,left:kt,width:kt,height:kt});s.z.object({left:s.z.number(),top:s.z.number(),right:s.z.number(),bottom:s.z.number()});s.z.object({one:Bt,two:Bt,root:Eo});const _r=(r,e,t=0,n=0,a)=>{const i={one:{...kn},two:{...kn},root:a??Oo};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return i.one={x:r,y:e},i.two={x:i.one.x+t,y:i.one.y+n},i}return"one"in r&&"two"in r&&"root"in r?{...r,root:a??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(i.one={x:r.left,y:r.top},i.two={x:r.right,y:r.bottom},i):(i.one=r,e==null?i.two={x:i.one.x+t,y:i.one.y+n}:typeof e=="number"?i.two={x:i.one.x+e,y:i.one.y+t}:"width"in e?i.two={x:i.one.x+e.width,y:i.one.y+e.height}:"signedWidth"in e?i.two={x:i.one.x+e.signedWidth,y:i.one.y+e.signedHeight}:i.two=e,i))},cr=r=>{const e=_r(r);return{lower:e.one.x,upper:e.two.x}},lr=r=>{const e=_r(r);return{lower:e.one.y,upper:e.two.y}},So=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Io=s.z.object({signedWidth:s.z.number(),signedHeight:s.z.number()});s.z.union([ps,Io,Bt,Vt]);const Ao=(r,e,t)=>e!==void 0&&r<e?e:t!==void 0&&r>t?t:r;s.z.object({offset:$n,scale:$n});s.z.object({offset:s.z.number(),scale:s.z.number()});const $o=r=>(e,t,n,a)=>t==="dimension"?[e,n]:[e,a?n-r:n+r],ko=r=>(e,t,n,a)=>[e,a?n/r:n*r],Co=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:a,upper:i}=e,{lower:o,upper:c}=r,l=i-a,h=c-o;if(t==="dimension")return[r,n*(h/l)];const d=(n-a)*(h/l)+o;return[r,d]},xo=r=>(e,t,n)=>[r,n],Ro=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:a}=r;return[r,a-(t-n)]},jo=r=>(e,t,n)=>{const{lower:a,upper:i}=r;return n=Ao(n,a,i),[e,n]};let Cn=class je{ops=[];currBounds=null;currType=null;reversed=!1;constructor(){this.ops=[]}static translate(e){return new je().translate(e)}static magnify(e){return new je().magnify(e)}static scale(e,t){return new je().scale(e,t)}translate(e){const t=this.new(),n=$o(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=ko(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=Ie(e,t),a=this.new(),i=Co(n);return i.type="scale",a.ops.push(i),a}clamp(e,t){const n=Ie(e,t),a=this.new(),i=jo(n);return i.type="clamp",a.ops.push(i),a}reBound(e,t){const n=Ie(e,t),a=this.new(),i=xo(n);return i.type="re-bound",a.ops.push(i),a}invert(){const e=Ro();e.type="invert";const t=this.new();return t.ops.push(e),t}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new je;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,a],i)=>i(n,e,a,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,a)=>{if(n.type==="scale"||t.some(([o,c])=>a>=o&&a<=c))return;const i=e.ops.findIndex((o,c)=>o.type==="scale"&&c>a);i!==-1&&t.push([a,i])}),t.forEach(([n,a])=>{const i=e.ops.slice(n,a);i.unshift(e.ops[a]),e.ops.splice(n,a-n+1,...i)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}static IDENTITY=new je};(class Q{x;y;currRoot;constructor(e=new Cn,t=new Cn,n=null){this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new Q().translate(e,t)}static translateX(e){return new Q().translateX(e)}static translateY(e){return new Q().translateY(e)}static clamp(e){return new Q().clamp(e)}static magnify(e){return new Q().magnify(e)}static scale(e){return new Q().scale(e)}static reBound(e){return new Q().reBound(e)}translate(e,t){const n=zo(e,t),a=this.copy();return a.x=this.x.translate(n.x),a.y=this.y.translate(n.y),a}translateX(e){const t=this.copy();return t.x=this.x.translate(e),t}translateY(e){const t=this.copy();return t.y=this.y.translate(e),t}magnify(e){const t=this.copy();return t.x=this.x.magnify(e.x),t.y=this.y.magnify(e.y),t}scale(e){const t=this.copy();if(So(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!No(n,e.root)&&(n.x!==e.root.x&&(t.x=t.x.invert()),n.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(cr(e)),t.y=t.y.scale(lr(e)),t}return t.x=t.x.scale(e.width),t.y=t.y.scale(e.height),t}reBound(e){const t=this.copy();return t.x=this.x.reBound(cr(e)),t.y=this.y.reBound(lr(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(cr(e)),t.y=this.y.clamp(lr(e)),t}copy(){const e=new Q;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return _r(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}static IDENTITY=new Q});let Uo=(r,e=21)=>(t=e)=>{let n="",a=t|0;for(;a--;)n+=r[Math.random()*r.length|0];return n};const Do="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Mo=11,Zo=Uo(Do,Mo),Po=()=>Zo(),Lo=(r,e)=>t=>t instanceof e||typeof t=="object"&&t!==null&&"discriminator"in t&&t.discriminator===r,Bo=s.z.enum(["static","dynamic"]),qo=s.z.union([s.z.tuple([s.z.int()]),s.z.tuple([s.z.int(),s.z.int().min(1).max(12)]),s.z.tuple([s.z.int(),s.z.int().min(1).max(12),s.z.int().min(1).max(31)])]),Os=(r,e)=>{const t=new $(e);if(![A.DAY,A.HOUR,A.MINUTE,A.SECOND,A.MILLISECOND,A.MICROSECOND,A.NANOSECOND].some(a=>a.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof $?new $(n):new A(n)};let $=class p extends _e{constructor(e,t="UTC"){if(e==null)super(p.now().valueOf());else if(e instanceof Date)super(BigInt(e.getTime())*p.MILLISECOND.valueOf());else if(typeof e=="string")super(p.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(p.parseDate(e));else{let n=0n;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=p.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=p.MAX:e=p.MIN)),super(BigInt(e.valueOf())+n)}}static parseDate([e=1970,t=1,n=1]){const a=new Date(e,t-1,n,0,0,0,0);return new p(BigInt(a.getTime())*p.MILLISECOND.valueOf()).truncate(p.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[n,a,i]=e.split(":");let o="00",c="00";i!=null&&([o,c]=i.split("."));let l=p.hours(parseInt(n??"00")).add(p.minutes(parseInt(a??"00"))).add(p.seconds(parseInt(o??"00"))).add(p.milliseconds(parseInt(c??"00")));return t==="local"&&(l=l.add(p.utcOffset)),l.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return p.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new p(BigInt(n.getTime())*p.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(p.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(){const e=this.date(),t=e.toLocaleString("default",{month:"short"}),n=e.toLocaleString("default",{day:"numeric"});return`${t} ${n}`}static get utcOffset(){return new A(BigInt(new Date().getTimezoneOffset())*p.MINUTE.valueOf())}static since(e){return new p().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new p(e).valueOf()}span(e){return this.range(e).span}range(e){return new st(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0n}after(e){return this.valueOf()>new p(e).valueOf()}afterEq(e){return this.valueOf()>=new p(e).valueOf()}before(e){return this.valueOf()<new p(e).valueOf()}beforeEq(e){return this.valueOf()<=new p(e).valueOf()}add(e){return new p(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new p(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(A.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(A.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(A.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(A.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(p.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(p.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}setYear(e){const t=this.date();return t.setUTCFullYear(e),new p(t)}get month(){return this.date().getUTCMonth()}setMonth(e){const t=this.date();return t.setUTCMonth(e),new p(t)}get day(){return this.date().getUTCDate()}setDay(e){const t=this.date();return t.setUTCDate(e),new p(t)}get hour(){return this.date().getUTCHours()}setHour(e){const t=this.date();return t.setUTCHours(e),new p(t,"UTC")}get minute(){return this.date().getUTCMinutes()}setMinute(e){const t=this.date();return t.setUTCMinutes(e),new p(t)}get second(){return this.date().getUTCSeconds()}setSecond(e){const t=this.date();return t.setUTCSeconds(e),new p(t)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(e){const t=this.date();return t.setUTCMilliseconds(e),new p(t)}toString(){return this.date().toISOString()}remainder(e){return Os(this,e)}get isToday(){return this.truncate(A.DAY).equals(p.now().truncate(A.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new p(new Date)}static max(...e){let t=p.MIN;for(const n of e){const a=new p(n);a.after(t)&&(t=a)}return t}static min(...e){let t=p.MAX;for(const n of e){const a=new p(n);a.before(t)&&(t=a)}return t}static nanoseconds(e,t="UTC"){return new p(e,t)}static NANOSECOND=p.nanoseconds(1);static microseconds(e,t="UTC"){return p.nanoseconds(e*1e3,t)}static MICROSECOND=p.microseconds(1);static milliseconds(e,t="UTC"){return p.microseconds(e*1e3,t)}static MILLISECOND=p.milliseconds(1);static seconds(e,t="UTC"){return p.milliseconds(e*1e3,t)}static SECOND=p.seconds(1);static minutes(e,t="UTC"){return p.seconds(e*60,t)}static MINUTE=p.minutes(1);static hours(e,t="UTC"){return p.minutes(e*60,t)}static HOUR=p.hours(1);static days(e,t="UTC"){return p.hours(e*24,t)}static DAY=p.days(1);static MAX=new p((1n<<63n)-1n);static MIN=new p(0);static ZERO=new p(0);static z=s.z.union([s.z.instanceof(p),s.z.object({value:s.z.bigint()}).transform(e=>new p(e.value)),s.z.string().transform(e=>new p(BigInt(e))),s.z.number().transform(e=>new p(e)),s.z.bigint().transform(e=>new p(e)),s.z.date().transform(e=>new p(e)),s.z.custom(e=>e instanceof A).transform(e=>new p(e)),qo.transform(e=>new p(e))]);static sort(e,t){return Number(e.valueOf()-t.valueOf())}},A=class w extends _e{constructor(e){typeof e=="number"&&(e=Math.trunc(e.valueOf())),super(BigInt(e.valueOf()))}static fromSeconds(e){return e instanceof w?e:e instanceof xn?e.period:e instanceof $?new w(e):["number","bigint"].includes(typeof e)?w.seconds(e):new w(e)}static fromMilliseconds(e){return e instanceof w?e:e instanceof xn?e.period:e instanceof $?new w(e):["number","bigint"].includes(typeof e)?w.milliseconds(e):new w(e)}valueOf(){return this.value}lessThan(e){return this.valueOf()<new w(e).valueOf()}greaterThan(e){return this.valueOf()>new w(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new w(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new w(e).valueOf()}remainder(e){return Os(this,e)}truncate(e){return new w(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(w.DAY),t=this.truncate(w.HOUR),n=this.truncate(w.MINUTE),a=this.truncate(w.SECOND),i=this.truncate(w.MILLISECOND),o=this.truncate(w.MICROSECOND),c=this.truncate(w.NANOSECOND),l=e,h=t.sub(e),d=n.sub(t),u=a.sub(n),N=i.sub(a),E=o.sub(i),P=c.sub(o);let k="";return l.isZero||(k+=`${l.days}d `),h.isZero||(k+=`${h.hours}h `),d.isZero||(k+=`${d.minutes}m `),u.isZero||(k+=`${u.seconds}s `),N.isZero||(k+=`${N.milliseconds}ms `),E.isZero||(k+=`${E.microseconds}µs `),P.isZero||(k+=`${P.nanoseconds}ns`),k.trim()}mult(e){return new w(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(w.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(w.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(w.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(w.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(w.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(w.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===0n}equals(e){return this.valueOf()===new w(e).valueOf()}add(e){return new w(this.valueOf()+new w(e).valueOf())}sub(e){return new w(this.valueOf()-new w(e).valueOf())}static nanoseconds(e=1){return new w(e)}static NANOSECOND=w.nanoseconds(1);static microseconds(e=1){return w.nanoseconds(xe(e,1e3))}static MICROSECOND=w.microseconds(1);static milliseconds(e=1){return w.microseconds(xe(e,1e3))}static MILLISECOND=w.milliseconds(1);static seconds(e=1){return w.milliseconds(xe(e,1e3))}static SECOND=w.seconds(1);static minutes(e=1){return w.seconds(xe(e,60))}static MINUTE=w.minutes(1);static hours(e){return w.minutes(xe(e,60))}static HOUR=w.hours(1);static days(e){return w.hours(xe(e,24))}static DAY=w.days(1);static MAX=new w((1n<<63n)-1n);static MIN=new w(0);static ZERO=new w(0);static z=s.z.union([s.z.object({value:s.z.bigint()}).transform(e=>new w(e.value)),s.z.string().transform(e=>new w(BigInt(e))),s.z.number().transform(e=>new w(e)),s.z.instanceof(w)])},xn=class Ue extends _e{constructor(e){super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Ue(e).valueOf()}get period(){return A.seconds(1/this.valueOf())}sampleCount(e){return new A(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new H(t).valueOf()}span(e){return A.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Ue(e)}static khz(e){return Ue.hz(e*1e3)}static z=s.z.union([s.z.number().transform(e=>new Ue(e)),s.z.instanceof(Ue)])},H=class ie extends _e{constructor(e){super(e.valueOf())}length(e){return e.valueOf()/this.valueOf()}size(e){return new Sr(e*this.valueOf())}static UNKNOWN=new ie(0);static BIT128=new ie(16);static BIT64=new ie(8);static BIT32=new ie(4);static BIT16=new ie(2);static BIT8=new ie(1);static z=s.z.union([s.z.number().transform(e=>new ie(e)),s.z.instanceof(ie)])},st=class ee{start;end;constructor(e,t){typeof e=="object"&&"start"in e?(this.start=new $(e.start),this.end=new $(e.end)):(this.start=new $(e),this.end=new $(t))}get span(){return new A(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new ee(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,t=A.ZERO){if(t.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let n=this.start.sub(e.start).valueOf(),a=this.end.sub(e.end).valueOf();return n<0&&(n=-n),a<0&&(a=-a),n<=t.valueOf()&&a<=t.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,t=A.ZERO){e=e.makeValid();const n=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(n.start)||n.end.equals(e.start))return!1;const a=$.max(n.start,e.start),i=$.min(n.end,e.end);return i.before(a)?!1:new A(i.sub(a)).greaterThanOrEqual(t)}contains(e){return e instanceof ee?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new ee(this.start,this.end);return e.start.after(this.start)&&(t.start=e.start),e.start.after(this.end)&&(t.end=e.start),e.end.before(this.end)&&(t.end=e.end),e.end.before(this.start)&&(t.start=e.end),t}static max(...e){return new ee($.min(...e.map(t=>t.start)),$.max(...e.map(t=>t.end)))}static MAX=new ee($.MIN,$.MAX);static MIN=new ee($.MAX,$.MIN);static ZERO=new ee($.ZERO,$.ZERO);static z=s.z.union([s.z.object({start:$.z,end:$.z}).transform(e=>new ee(e.start,e.end)),s.z.instanceof(ee)]);static sort(e,t){return $.sort(e.start,t.start)||$.sort(e.end,t.end)}},j=class f extends _e{constructor(e){if(e instanceof f||typeof e=="string"||typeof e.valueOf()=="string")super(e.valueOf());else{const t=f.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t==null)throw new Error(`unable to find data type for ${e.toString()}`);super(t.valueOf())}}get Array(){const e=f.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(t=>this.equals(t))}toString(){return this.valueOf()}get isVariable(){return this.equals(f.JSON)||this.equals(f.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(f.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=f.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsignedInteger(){return this.equals(f.UINT8)||this.equals(f.UINT16)||this.equals(f.UINT32)||this.equals(f.UINT64)}get isSignedInteger(){return this.equals(f.INT8)||this.equals(f.INT16)||this.equals(f.INT32)||this.equals(f.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsignedInteger&&e.isSignedInteger?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(f.INT32)&&e.equals(f.FLOAT64)||this.equals(f.INT8)&&e.equals(f.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsignedInteger===e.isUnsignedInteger:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}get usesBigInt(){return f.BIG_INT_TYPES.some(e=>e.equals(this))}static UNKNOWN=new f("unknown");static FLOAT64=new f("float64");static FLOAT32=new f("float32");static INT64=new f("int64");static INT32=new f("int32");static INT16=new f("int16");static INT8=new f("int8");static UINT64=new f("uint64");static UINT32=new f("uint32");static UINT16=new f("uint16");static UINT8=new f("uint8");static BOOLEAN=this.UINT8;static TIMESTAMP=new f("timestamp");static UUID=new f("uuid");static STRING=new f("string");static JSON=new f("json");static ARRAY_CONSTRUCTORS=new Map([[f.UINT8.toString(),Uint8Array],[f.UINT16.toString(),Uint16Array],[f.UINT32.toString(),Uint32Array],[f.UINT64.toString(),BigUint64Array],[f.FLOAT32.toString(),Float32Array],[f.FLOAT64.toString(),Float64Array],[f.INT8.toString(),Int8Array],[f.INT16.toString(),Int16Array],[f.INT32.toString(),Int32Array],[f.INT64.toString(),BigInt64Array],[f.TIMESTAMP.toString(),BigInt64Array],[f.STRING.toString(),Uint8Array],[f.JSON.toString(),Uint8Array],[f.UUID.toString(),Uint8Array]]);static ARRAY_CONSTRUCTOR_DATA_TYPES=new Map([[Uint8Array.name,f.UINT8],[Uint16Array.name,f.UINT16],[Uint32Array.name,f.UINT32],[BigUint64Array.name,f.UINT64],[Float32Array.name,f.FLOAT32],[Float64Array.name,f.FLOAT64],[Int8Array.name,f.INT8],[Int16Array.name,f.INT16],[Int32Array.name,f.INT32],[BigInt64Array.name,f.INT64]]);static DENSITIES=new Map([[f.UINT8.toString(),H.BIT8],[f.UINT16.toString(),H.BIT16],[f.UINT32.toString(),H.BIT32],[f.UINT64.toString(),H.BIT64],[f.FLOAT32.toString(),H.BIT32],[f.FLOAT64.toString(),H.BIT64],[f.INT8.toString(),H.BIT8],[f.INT16.toString(),H.BIT16],[f.INT32.toString(),H.BIT32],[f.INT64.toString(),H.BIT64],[f.TIMESTAMP.toString(),H.BIT64],[f.STRING.toString(),H.UNKNOWN],[f.JSON.toString(),H.UNKNOWN],[f.UUID.toString(),H.BIT128]]);static ALL=[f.UNKNOWN,f.FLOAT64,f.FLOAT32,f.INT64,f.INT32,f.INT16,f.INT8,f.UINT64,f.UINT32,f.UINT16,f.UINT8,f.TIMESTAMP,f.UUID,f.STRING,f.JSON];static BIG_INT_TYPES=[f.INT64,f.UINT64,f.TIMESTAMP];static z=s.z.union([s.z.string().transform(e=>new f(e)),s.z.instanceof(f)])},Sr=class x extends _e{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return x.bytes(this.valueOf()+e.valueOf())}sub(e){return x.bytes(this.valueOf()-e.valueOf())}truncate(e){return new x(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return x.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/x.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/x.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/x.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/x.TERABYTE.valueOf()}toString(){const e=this.truncate(x.TERABYTE),t=this.truncate(x.GIGABYTE),n=this.truncate(x.MEGABYTE),a=this.truncate(x.KILOBYTE),i=this.truncate(x.BYTE),o=e,c=t.sub(e),l=n.sub(t),h=a.sub(n),d=i.sub(a);let u="";return o.isZero||(u+=`${o.terabytes}TB `),c.isZero||(u+=`${c.gigabytes}GB `),l.isZero||(u+=`${l.megabytes}MB `),h.isZero||(u+=`${h.kilobytes}KB `),(!d.isZero||u==="")&&(u+=`${d.valueOf()}B`),u.trim()}static bytes(e=1){return new x(e)}static BYTE=new x(1);static kilobytes(e=1){return x.bytes(e.valueOf()*1e3)}static KILOBYTE=x.kilobytes(1);static megabytes(e=1){return x.kilobytes(e.valueOf()*1e3)}static MEGABYTE=x.megabytes(1);static gigabytes(e=1){return x.megabytes(e.valueOf()*1e3)}static GIGABYTE=x.gigabytes(1);static terabytes(e){return x.gigabytes(e.valueOf()*1e3)}static TERABYTE=x.terabytes(1);static ZERO=new x(0);static z=s.z.union([s.z.number().transform(e=>new x(e)),s.z.instanceof(x)]);get isZero(){return this.valueOf()===0}};s.z.union([s.z.instanceof(Uint8Array),s.z.instanceof(Uint16Array),s.z.instanceof(Uint32Array),s.z.instanceof(BigUint64Array),s.z.instanceof(Float32Array),s.z.instanceof(Float64Array),s.z.instanceof(Int8Array),s.z.instanceof(Int16Array),s.z.instanceof(Int32Array),s.z.instanceof(BigInt64Array)]);const Ns=r=>{const e=typeof r;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||r instanceof $||r instanceof A||r instanceof Date},Fo=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t.valueOf())-BigInt(n.valueOf()):Ut(t,-n),Ut=(r,e)=>e==0?r:r==0?e:typeof r=="bigint"&&typeof e=="bigint"||typeof r=="number"&&typeof e=="number"?r+e:Number(r)+Number(e),Yo=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Vo(r){return typeof r=="string"&&Yo.test(r)}const q=[];for(let r=0;r<256;++r)q.push((r+256).toString(16).slice(1));function Wo(r,e=0){return(q[r[e+0]]+q[r[e+1]]+q[r[e+2]]+q[r[e+3]]+"-"+q[r[e+4]]+q[r[e+5]]+"-"+q[r[e+6]]+q[r[e+7]]+"-"+q[r[e+8]]+q[r[e+9]]+"-"+q[r[e+10]]+q[r[e+11]]+q[r[e+12]]+q[r[e+13]]+q[r[e+14]]+q[r[e+15]]).toLowerCase()}function _o(r,e=0){const t=Wo(r,e);if(!Vo(t))throw TypeError("Stringified UUID is invalid");return t}typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const zs=(r,e)=>_o(r,e),ye=-1,Ho=s.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer),Go=s.z.union([s.z.null(),s.z.undefined()]).transform(()=>new Uint8Array().buffer),Ir=10,Jo=(r,e)=>{if(r==="number"&&!e.isNumeric)throw new Error(`cannot convert series of type ${e.toString()} to number`);if(r==="bigint"&&!e.usesBigInt)throw new Error(`cannot convert series of type ${e.toString()} to bigint`)},Ss="sy_x_telem_series";let Is=class we{key;discriminator=Ss;dataType;sampleOffset;gl;_data;timeRange=st.ZERO;alignment=0n;cachedMin;cachedMax;writePos=ye;_refCount=0;cachedLength;_cachedIndexes;static crudeZ=s.z.object({timeRange:st.z.optional(),dataType:j.z,alignment:s.z.coerce.bigint().optional(),data:s.z.union([Ho,Go,s.z.instanceof(ArrayBuffer),s.z.instanceof(Uint8Array)]),glBufferUsage:Bo.optional().default("static").optional()});static z=we.crudeZ.transform(e=>new we(e));constructor(e){Ko(e)&&(e={data:e}),e.data??=[];const{dataType:t,timeRange:n,sampleOffset:a=0,glBufferUsage:i="static",alignment:o=0n,key:c=Po(),data:l}=e;if(Xo(l)){const u=l;this.key=u.key,this.dataType=u.dataType,this.sampleOffset=u.sampleOffset,this.gl=u.gl,this._data=u._data,this.timeRange=u.timeRange,this.alignment=u.alignment,this.cachedMin=u.cachedMin,this.cachedMax=u.cachedMax,this.writePos=u.writePos,this._refCount=u._refCount,this.cachedLength=u.cachedLength;return}const h=Ns(l),d=Array.isArray(l);if(t!=null)this.dataType=new j(t);else{if(l instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(d||h){let u=l;if(!h){if(l.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");u=l[0]}if(typeof u=="string")this.dataType=j.STRING;else if(typeof u=="number")this.dataType=j.FLOAT64;else if(typeof u=="bigint")this.dataType=j.INT64;else if(typeof u=="boolean")this.dataType=j.BOOLEAN;else if(u instanceof $||u instanceof Date||u instanceof $)this.dataType=j.TIMESTAMP;else if(typeof u=="object")this.dataType=j.JSON;else throw new Error(`cannot infer data type of ${typeof u} when constructing a Series from a JS array`)}else this.dataType=new j(l)}if(!d&&!h)this._data=l;else if(d&&l.length===0)this._data=new this.dataType.Array([]).buffer;else{let u=h?[l]:l;const N=u[0];(N instanceof $||N instanceof Date||N instanceof A)&&(u=u.map(E=>new $(E).valueOf())),this.dataType.equals(j.STRING)?(this.cachedLength=u.length,this._data=new TextEncoder().encode(`${u.join(`
|
|
30
2
|
`)}
|
|
31
|
-
`).buffer):this.dataType.equals(
|
|
3
|
+
`).buffer):this.dataType.equals(j.JSON)?(this.cachedLength=u.length,this._data=new TextEncoder().encode(`${u.map(E=>zr.encodeString(E)).join(`
|
|
32
4
|
`)}
|
|
33
|
-
`).buffer):this.dataType.usesBigInt&&typeof
|
|
34
|
-
`).slice(0,-1):Array.from(this).map(e=>e.toString())}toUUIDs(){if(!this.dataType.equals(ae.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=ae.UUID.density.valueOf(),r=new Uint8Array(this.underlyingData.buffer);return Array.from({length:this.length},(i,n)=>_z(r,n*e))}parseJSON(e){if(!this.dataType.equals(ae.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.toStrings().map(r=>e.parse(ii.decodeString(r)))}get byteCapacity(){return new lr(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===Yt?this.byteCapacity:this.dataType.isVariable?new lr(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength!=null?this.cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===Yt?this.byteCapacity.valueOf()/this.dataType.density.valueOf():this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const r=[0];return this.data.forEach((i,n)=>{i===Co&&(e++,r.push(n+1))}),this._cachedIndexes=r,this.cachedLength=e,e}convert(e,r=0){if(this.dataType.equals(e))return this;const i=new e.Array(this.length);for(let n=0;n<this.length;n++)i[n]=gz(this.dataType,e,this.data[n],r);return new Fn({data:i.buffer,dataType:e,timeRange:this.timeRange,sampleOffset:r,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(ae.TIMESTAMP))this.cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMax=e.reduce((r,i)=>r>i?r:i)}else{const e=this.data;this.cachedMax=e.reduce((r,i)=>r>i?r:i)}return this.cachedMax}get max(){return this.calcMax()}calcMax(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this.cachedMax??(this.cachedMax=this.calcRawMax()),vs(this.cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(ae.TIMESTAMP))this.cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMin=e.reduce((r,i)=>r<i?r:i)}else{const e=this.data;this.cachedMin=e.reduce((r,i)=>r<i?r:i)}return this.cachedMin}get min(){return this.calcMin()}calcMin(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this.cachedMin??(this.cachedMin=this.calcRawMin()),vs(this.cachedMin,this.sampleOffset))}get bounds(){return nt(Number(this.min),Number(this.max),{makeValid:!1})}maybeRecomputeMinMax(e){if(this.cachedMin!=null){const r=e.cachedMin??e.calcRawMin();r<this.cachedMin&&(this.cachedMin=r)}if(this.cachedMax!=null){const r=e.cachedMax??e.calcRawMax();r>this.cachedMax&&(this.cachedMax=r)}}atAlignment(e,r){const i=Number(e-this.alignment);if(i<0||i>=this.length){if(r===!0)throw new Error(`[series] - no value at index ${i}`);return}return this.at(i,r)}at(e,r){if(this.dataType.isVariable)return this.atVariable(e,r??!1);e<0&&(e=this.length+e);const i=this.data[e];if(i==null){if(r===!0)throw new Error(`[series] - no value at index ${e}`);return}return vs(i,this.sampleOffset)}atVariable(e,r){let i=0,n=0;if(this._cachedIndexes!=null)i=this._cachedIndexes[e],n=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let a=0;a<this.data.length;a++)if(this.data[a]===Co){if(e===0){n=a;break}i=a+1,e--}if(n===0&&(n=this.data.length),i>=n||e>0){if(r)throw new Error(`[series] - no value at index ${e}`);return}}const s=this.data.slice(i,n);return this.dataType.equals(ae.STRING)?new TextDecoder().decode(s):Ch(JSON.parse(new TextDecoder().decode(s)))}binarySearch(e){let r=0,i=this.length-1;const n=US(e);for(;r<=i;){const s=Math.floor((r+i)/2),a=n(this.at(s,!0),e);if(a===0)return s;a<0?r=s+1:i=s-1}return r}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(ae.FLOAT32)&&!this.dataType.equals(ae.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:r,bufferUsage:i,prevBuffer:n}=this.gl;if(r==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==n)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Yt){n===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const s=this.dataType.density.size(n).valueOf(),a=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,s,a.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,i==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=Yt}as(e){return n$(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:uf(this.alignmentBounds.lower),upper:uf(this.alignmentBounds.upper)},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}get alignmentBounds(){return nt(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const e=new Sz(this);return this.dataType.equals(ae.JSON)?new Nz(e):e}return new Tz(this)}slice(e,r){return this.sliceSub(!1,e,r)}sub(e,r){return this.sliceSub(!0,e,r)}subIterator(e,r){return new of(this,e,r??this.length)}subAlignmentIterator(e,r){return new of(this,Number(e-this.alignment),Number(r-this.alignment))}subBytes(e,r){if(e>=0&&(r==null||r>=this.byteLength.valueOf()))return this;const i=this.data.subarray(e,r);return new Fn({data:i,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,r,i){if(r<=0&&(i==null||i>=this.length))return this;let n;return e?n=this.data.subarray(r,i):n=this.data.slice(r,i),new Fn({data:n,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(r)})}reAlign(e){return new Fn({data:this.buffer,dataType:this.dataType,timeRange:Ee.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){var e,r;let i=`Series(${this.dataType.toString()} ${this.length} [`;if(this.length<=10)i+=Array.from(this).map(n=>n.toString());else{for(let n=0;n<5;n++)i+=`${(e=this.at(n))==null?void 0:e.toString()}`,i+=",";i+="...,";for(let n=-5;n<0;n++)i+=(r=this.at(n))==null?void 0:r.toString(),n<-1&&(i+=",")}return i+="])",i}};z(Fr,"crudeZ",re({timeRange:Ee.z.optional(),dataType:ae.z,alignment:Hy().optional(),data:ze([kz,Iz,ge(ArrayBuffer),ge(Uint8Array)]),glBufferUsage:pz.optional().default("static").optional()})),z(Fr,"z",Fr.crudeZ.transform(t=>new Fr(t)));let Ft=Fr;const Oz=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof Ft?!0:t$(t),i$=hz(r$,Ft);let of=class{constructor(e,r,i){z(this,"series"),z(this,"end"),z(this,"index"),this.series=e;const n=nt(0,e.length);this.end=tf(n,i),this.index=tf(n,r)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},Sz=class{constructor(e){if(z(this,"series"),z(this,"index"),z(this,"decoder"),!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,r=this.series.data;for(;this.index<r.length&&r[this.index]!==Co;)this.index++;const i=this.index;return e===i?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,i))})}};const s$=class a${constructor(e){z(this,"wrapped"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:ii.decodeString(e.value,a$.schema)}}};z(s$,"schema",ma(Ne(),cr()));let Nz=s$,Tz=class{constructor(e){z(this,"series"),z(this,"index"),this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}};class o${constructor(e=[]){if(z(this,"series"),e.length!==0){const r=e[0].dataType;for(let i=1;i<e.length;i++)if(!e[i].dataType.equals(r))throw new Error("[multi-series] - series must have the same data type")}this.series=e}as(e){return n$(e,this.dataType),this}get dataType(){return this.series.length===0?ae.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?Ee.ZERO:new Ee(this.series[0].timeRange.start,this.series[this.series.length-1].timeRange.end)}get alignment(){return this.series.length===0?0n:this.series[0].alignment}get alignmentBounds(){return this.series.length===0?nt(0n,0n):nt(this.series[0].alignmentBounds.lower,this.series[this.series.length-1].alignmentBounds.upper)}push(e){const r=()=>new Error(`cannot push a ${e.dataType.toString()} series to a ${this.dataType.toString()} multi-series`),i=e.dataType.equals(this.dataType);if(i$(e)){if(this.series.length!==0&&!i)throw r();this.series.push(e)}else{if(this.series.length!==0&&e.series.length!==0&&!i)throw r();this.series.push(...e.series)}}get length(){return this.series.reduce((e,r)=>e+r.length,0)}atAlignment(e,r){for(const i of this.series)if(Hi(i.alignmentBounds,e))return i.atAlignment(e,r);if(r)throw new Error(`[series] - no value at alignment ${e}`)}at(e,r=!1){e<0&&(e=this.length+e);for(const i of this.series){if(e<i.length)return i.at(e,r);e-=i.length}if(r)throw new Error(`[series] - no value at index ${e}`)}subIterator(e,r){return new co(this,e,r??this.length)}subAlignmentIterator(e,r){if(e>=this.alignmentBounds.upper||r<=this.alignmentBounds.lower)return Do;let i=0;for(let s=0;s<this.series.length;s++){const a=this.series[s];if(e<a.alignment)break;if(e>=a.alignmentBounds.upper)i+=a.length;else if(Hi(a.alignmentBounds,e)){i+=Number(e-a.alignment);break}}let n=0;for(let s=0;s<this.series.length;s++){const a=this.series[s];if(r<a.alignment)break;if(r>=a.alignmentBounds.upper)n+=a.length;else if(Hi(a.alignmentBounds,r)){n+=Number(r-a.alignment);break}}return new co(this,i,n)}subAlignmentSpanIterator(e,r){if(e>=this.alignmentBounds.upper)return Do;r=Math.min(r,Number(this.distance(e,this.alignmentBounds.upper)));let i=0;for(let n=0;n<this.series.length;n++){const s=this.series[n];if(e<s.alignment)break;if(e>=s.alignmentBounds.upper)i+=s.length;else if(Hi(s.alignmentBounds,e)){i+=Number(e-s.alignment);break}}return new co(this,i,i+r)}updateGLBuffer(e){this.series.forEach(r=>r.updateGLBuffer(e))}get bounds(){return RT(this.series.map(e=>e.bounds))}get byteLength(){return new lr(this.series.reduce((e,r)=>e+r.byteLength.valueOf(),0))}get data(){const e=new this.dataType.Array(this.length);let r=0;for(const i of this.series)e.set(i.data,r),r+=i.length;return new this.dataType.Array(e.buffer)}traverseAlignment(e,r){const i=this.series.map(n=>n.alignmentBounds);return LT(i,e,r)}acquire(e){this.series.forEach(r=>r.acquire(e))}release(){this.series.forEach(e=>e.release())}distance(e,r){const i=this.series.map(n=>n.alignmentBounds);return MT(i,e,r)}parseJSON(e){if(!this.dataType.equals(ae.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.series.flatMap(r=>r.parseJSON(e))}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new zz(this.series)}}let zz=class{constructor(e){z(this,"series"),z(this,"seriesIndex"),z(this,"internal"),this.series=e,this.seriesIndex=0,this.internal=e[0][Symbol.iterator]()}next(){const e=this.internal.next();return e.done===!1?e:this.seriesIndex===this.series.length-1?{done:!0,value:void 0}:(this.internal=this.series[++this.seriesIndex][Symbol.iterator](),this.next())}[Symbol.iterator](){return this}},co=class{constructor(e,r,i){z(this,"series"),z(this,"index"),z(this,"end"),this.series=e,this.end=i,this.index=r}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}};const uf=t=>{const e=t>>32n,r=t&0xffffffffn;return{domain:e,sample:r}},xz=(t,e)=>{let r=null;return e===0?t:(...i)=>{r!==null&&(clearTimeout(r),r=null),r=setTimeout(()=>t(...i),e)}},Ez=(t,e,r=".")=>{const i=t.split(r);return i.map((n,s)=>{const a=e(n,s,i);return a==null?null:typeof a=="string"?a:a.join(r)}).filter(n=>n!=null).join(r)},Uz=(t,e,r={optional:!1,separator:"."})=>{r.separator??(r.separator=".");const{optional:i,getter:n=(o,u)=>o[u]}=r,s=e.split(r.separator);if(s.length===1&&s[0]==="")return t;let a=t;for(const o of s){const u=n(a,o);if(u==null){if(i)return null;throw new Error(`Path ${e} does not exist. ${o} is null`)}a=u}return a};re({key:Ne(),value:Ne()});var Zz=Object.defineProperty,Pz=(t,e,r)=>e in t?Zz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gs=(t,e,r)=>Pz(t,typeof e!="symbol"?e+"":e,r);let jz=class{constructor(e,r){gs(this,"handlers"),gs(this,"transform"),gs(this,"closer"),this.transform=e,this.handlers=r??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){let r=e;if(this.transform!=null){const[i,n]=this.transform(e);if(!n)return;r=i}this.handlers.forEach((i,n)=>n(r))}setCloser(e){this.closer=e}async close(){var e;return await((e=this.closer)==null?void 0:e.call(this))}},Az=class{constructor(e){gs(this,"handlers"),this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((r,i)=>i(e))}};const yn=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:Az,Observer:jz},Symbol.toStringTag,{value:"Module"})),$t=ma(ze([H(),Ne(),uy()]),cr()),Dz=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";Dz();const Cz=["macOS","Windows","Linux"],Rz=["macos","windows","linux"],Lz={macos:"macOS",windows:"Windows",linux:"Linux"};Ye(Cz).or(Ye(Rz).transform(t=>Lz[t]));var Mz=Object.defineProperty,Bz=(t,e,r)=>e in t?Mz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qr=(t,e,r)=>Bz(t,typeof e!="symbol"?e+"":e,r);const Fz=(...t)=>t.map(u$).join(""),u$=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),qz=t=>t.endsWith("/")?t.slice(0,-1):t,Ro=class Lo{constructor({host:e,port:r,protocol:i="",pathPrefix:n=""}){qr(this,"protocol"),qr(this,"host"),qr(this,"port"),qr(this,"path"),this.protocol=i,this.host=e,this.port=r,this.path=u$(n)}replace(e){return new Lo({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Lo({...this,pathPrefix:Fz(this.path,e)})}toString(){return qz(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};qr(Ro,"UNKNOWN",new Ro({host:"unknown",port:0}));let Jz=Ro;const Vz=t=>t.nullable().transform(e=>e===null?void 0:e).optional(),c$=t=>Ez(t,(e,r,i)=>{const n=r===i.length-1,s=!isNaN(parseInt(e)),a=!isNaN(parseInt(i[r+1]));return s&&(e="element"),n||a?e:[e,"shape"]}),cf=(t,e)=>{if(t==null)return null;const r=t[e];return r==null&&typeof t=="object"&&"sourceType"in t?t.sourceType()[e]:r},Wz=(t,e,r)=>Uz(cf(t,"shape"),c$(e),{...r,getter:cf}),l$=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:Wz,getFieldSchemaPath:c$,nullToUndefined:Vz},Symbol.toStringTag,{value:"Module"}));var Gz=Object.defineProperty,Yz=(t,e,r)=>e in t?Gz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xt=(t,e,r)=>Yz(t,typeof e!="symbol"?e+"":e,r);const Kz=()=>{const t={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return n=>{switch(n.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${n.expected}، ولكن تم إدخال ${r(n.input)}`;case"invalid_value":return n.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${K(n.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${s} ${n.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${s} ${n.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`:s.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${s.suffix}"`:s.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${s.includes}"`:s.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${s.pattern}`:`${i[s.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${P(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function Xz(){return{localeError:Kz()}}const Hz=()=>{const t={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${n.expected}, daxil olan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Yanlış dəyər: gözlənilən ${K(n.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${s}${n.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Çox kiçik: gözlənilən ${n.origin} ${s}${n.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Yanlış mətn: "${s.prefix}" ilə başlamalıdır`:s.format==="ends_with"?`Yanlış mətn: "${s.suffix}" ilə bitməlidir`:s.format==="includes"?`Yanlış mətn: "${s.includes}" daxil olmalıdır`:s.format==="regex"?`Yanlış mətn: ${s.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${i[s.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function Qz(){return{localeError:Hz()}}function lf(t,e,r,i){const n=Math.abs(t),s=n%10,a=n%100;return a>=11&&a<=19?i:s===1?e:s>=2&&s<=4?r:i}const ex=()=>{const t={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"лік";case"object":{if(Array.isArray(n))return"масіў";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return n=>{switch(n.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${n.expected}, атрымана ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Няправільны ўвод: чакалася ${K(n.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);if(a){const o=Number(n.maximum),u=lf(o,a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${a.verb} ${s}${n.maximum.toString()} ${u}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);if(a){const o=Number(n.minimum),u=lf(o,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${a.verb} ${s}${n.minimum.toString()} ${u}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${s.prefix}"`:s.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${s.suffix}"`:s.format==="includes"?`Няправільны радок: павінен змяшчаць "${s.includes}"`:s.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${s.pattern}`:`Няправільны ${i[s.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${P(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function tx(){return{localeError:ex()}}const nx=()=>{const t={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipus invàlid: s'esperava ${n.expected}, s'ha rebut ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Valor invàlid: s'esperava ${K(n.values[0])}`:`Opció invàlida: s'esperava una de ${P(n.values," o ")}`;case"too_big":{const s=n.inclusive?"com a màxim":"menys de",a=e(n.origin);return a?`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${s} ${n.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"com a mínim":"més de",a=e(n.origin);return a?`Massa petit: s'esperava que ${n.origin} contingués ${s} ${n.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Format invàlid: ha de començar amb "${s.prefix}"`:s.format==="ends_with"?`Format invàlid: ha d'acabar amb "${s.suffix}"`:s.format==="includes"?`Format invàlid: ha d'incloure "${s.includes}"`:s.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${s.pattern}`:`Format invàlid per a ${i[s.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function rx(){return{localeError:nx()}}const ix=()=>{const t={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(n))return"pole";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return n=>{switch(n.code){case"invalid_type":return`Neplatný vstup: očekáváno ${n.expected}, obdrženo ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neplatný vstup: očekáváno ${K(n.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${s}${n.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${s}${n.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Neplatný řetězec: musí začínat na "${s.prefix}"`:s.format==="ends_with"?`Neplatný řetězec: musí končit na "${s.suffix}"`:s.format==="includes"?`Neplatný řetězec: musí obsahovat "${s.includes}"`:s.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${s.pattern}`:`Neplatný formát ${i[s.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${P(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function sx(){return{localeError:ix()}}const ax=()=>{const t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"Zahl";case"object":{if(Array.isArray(n))return"Array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return n=>{switch(n.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${n.expected}, erhalten ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ungültige Eingabe: erwartet ${K(n.values[0])}`:`Ungültige Option: erwartet eine von ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Zu groß: erwartet, dass ${n.origin??"Wert"} ${s}${n.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${n.origin??"Wert"} ${s}${n.maximum.toString()} ist`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Zu klein: erwartet, dass ${n.origin} ${s}${n.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${s}${n.minimum.toString()} ist`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ungültiger String: muss mit "${s.prefix}" beginnen`:s.format==="ends_with"?`Ungültiger String: muss mit "${s.suffix}" enden`:s.format==="includes"?`Ungültiger String: muss "${s.includes}" enthalten`:s.format==="regex"?`Ungültiger String: muss dem Muster ${s.pattern} entsprechen`:`Ungültig: ${i[s.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${P(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function ox(){return{localeError:ax()}}const ux=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},cx=()=>{const t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(i){return t[i]??null}const r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Invalid input: expected ${i.expected}, received ${ux(i.input)}`;case"invalid_value":return i.values.length===1?`Invalid input: expected ${K(i.values[0])}`:`Invalid option: expected one of ${P(i.values,"|")}`;case"too_big":{const n=i.inclusive?"<=":"<",s=e(i.origin);return s?`Too big: expected ${i.origin??"value"} to have ${n}${i.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${n}${i.maximum.toString()}`}case"too_small":{const n=i.inclusive?">=":">",s=e(i.origin);return s?`Too small: expected ${i.origin} to have ${n}${i.minimum.toString()} ${s.unit}`:`Too small: expected ${i.origin} to be ${n}${i.minimum.toString()}`}case"invalid_format":{const n=i;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${P(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function d$(){return{localeError:cx()}}const lx=()=>{const t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"arreglo";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype)return n.constructor.name}}return s},i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Entrada inválida: se esperaba ${n.expected}, recibido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inválida: se esperaba ${K(n.values[0])}`:`Opción inválida: se esperaba una de ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Demasiado grande: se esperaba que ${n.origin??"valor"} tuviera ${s}${n.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${n.origin??"valor"} fuera ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Demasiado pequeño: se esperaba que ${n.origin} tuviera ${s}${n.minimum.toString()} ${a.unit}`:`Demasiado pequeño: se esperaba que ${n.origin} fuera ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Cadena inválida: debe comenzar con "${s.prefix}"`:s.format==="ends_with"?`Cadena inválida: debe terminar en "${s.suffix}"`:s.format==="includes"?`Cadena inválida: debe incluir "${s.includes}"`:s.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${s.pattern}`:`Inválido ${i[s.format]??n.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Llave inválida en ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${n.origin}`;default:return"Entrada inválida"}}};function dx(){return{localeError:lx()}}const mx=()=>{const t={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"آرایه";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return n=>{switch(n.code){case"invalid_type":return`ورودی نامعتبر: میبایست ${n.expected} میبود، ${r(n.input)} دریافت شد`;case"invalid_value":return n.values.length===1?`ورودی نامعتبر: میبایست ${K(n.values[0])} میبود`:`گزینه نامعتبر: میبایست یکی از ${P(n.values,"|")} میبود`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`خیلی بزرگ: ${n.origin??"مقدار"} باید ${s}${n.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${n.origin??"مقدار"} باید ${s}${n.maximum.toString()} باشد`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`خیلی کوچک: ${n.origin} باید ${s}${n.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${n.origin} باید ${s}${n.minimum.toString()} باشد`}case"invalid_format":{const s=n;return s.format==="starts_with"?`رشته نامعتبر: باید با "${s.prefix}" شروع شود`:s.format==="ends_with"?`رشته نامعتبر: باید با "${s.suffix}" تمام شود`:s.format==="includes"?`رشته نامعتبر: باید شامل "${s.includes}" باشد`:s.format==="regex"?`رشته نامعتبر: باید با الگوی ${s.pattern} مطابقت داشته باشد`:`${i[s.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${P(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function fx(){return{localeError:mx()}}const hx=()=>{const t={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return n=>{switch(n.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${n.expected}, oli ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Virheellinen syöte: täytyy olla ${K(n.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${s}${n.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${s}${n.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${s.prefix}"`:s.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${s.suffix}"`:s.format==="includes"?`Virheellinen syöte: täytyy sisältää "${s.includes}"`:s.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${s.pattern}`:`Virheellinen ${i[s.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${P(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function px(){return{localeError:hx()}}const vx=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"nombre";case"object":{if(Array.isArray(n))return"tableau";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : ${n.expected} attendu, ${r(n.input)} reçu`;case"invalid_value":return n.values.length===1?`Entrée invalide : ${K(n.values[0])} attendu`:`Option invalide : une valeur parmi ${P(n.values,"|")} attendue`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Trop grand : ${n.origin??"valeur"} doit ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${n.origin??"valeur"} doit être ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Trop petit : ${n.origin} doit ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Trop petit : ${n.origin} doit être ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chaîne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Chaîne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Chaîne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${s.pattern}`:`${i[s.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${P(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function gx(){return{localeError:vx()}}const yx=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : attendu ${n.expected}, reçu ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrée invalide : attendu ${K(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"≤":"<",a=e(n.origin);return a?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${s}${n.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"≥":">",a=e(n.origin);return a?`Trop petit : attendu que ${n.origin} ait ${s}${n.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${n.origin} soit ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chaîne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Chaîne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Chaîne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Chaîne invalide : doit correspondre au motif ${s.pattern}`:`${i[s.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${P(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function $x(){return{localeError:yx()}}const bx=()=>{const t={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return n=>{switch(n.code){case"invalid_type":return`קלט לא תקין: צריך ${n.expected}, התקבל ${r(n.input)}`;case"invalid_value":return n.values.length===1?`קלט לא תקין: צריך ${K(n.values[0])}`:`קלט לא תקין: צריך אחת מהאפשרויות ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`גדול מדי: ${n.origin??"value"} צריך להיות ${s}${n.maximum.toString()} ${a.unit??"elements"}`:`גדול מדי: ${n.origin??"value"} צריך להיות ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`קטן מדי: ${n.origin} צריך להיות ${s}${n.minimum.toString()} ${a.unit}`:`קטן מדי: ${n.origin} צריך להיות ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`מחרוזת לא תקינה: חייבת להתחיל ב"${s.prefix}"`:s.format==="ends_with"?`מחרוזת לא תקינה: חייבת להסתיים ב "${s.suffix}"`:s.format==="includes"?`מחרוזת לא תקינה: חייבת לכלול "${s.includes}"`:s.format==="regex"?`מחרוזת לא תקינה: חייבת להתאים לתבנית ${s.pattern}`:`${i[s.format]??n.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${n.divisor}`;case"unrecognized_keys":return`מפתח${n.keys.length>1?"ות":""} לא מזוה${n.keys.length>1?"ים":"ה"}: ${P(n.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${n.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n.origin}`;default:return"קלט לא תקין"}}};function wx(){return{localeError:bx()}}const _x=()=>{const t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"szám";case"object":{if(Array.isArray(n))return"tömb";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return n=>{switch(n.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${n.expected}, a kapott érték ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Érvénytelen bemenet: a várt érték ${K(n.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${s}${n.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${s}${n.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Érvénytelen string: "${s.prefix}" értékkel kell kezdődnie`:s.format==="ends_with"?`Érvénytelen string: "${s.suffix}" értékkel kell végződnie`:s.format==="includes"?`Érvénytelen string: "${s.includes}" értéket kell tartalmaznia`:s.format==="regex"?`Érvénytelen string: ${s.pattern} mintának kell megfelelnie`:`Érvénytelen ${i[s.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function kx(){return{localeError:_x()}}const Ix=()=>{const t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak valid: diharapkan ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${K(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${s}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Terlalu kecil: diharapkan ${n.origin} memiliki ${s}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`String tidak valid: harus dimulai dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak valid: harus berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak valid: harus menyertakan "${s.includes}"`:s.format==="regex"?`String tidak valid: harus sesuai pola ${s.pattern}`:`${i[s.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function Ox(){return{localeError:Ix()}}const Sx=()=>{const t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"numero";case"object":{if(Array.isArray(n))return"vettore";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input non valido: atteso ${n.expected}, ricevuto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input non valido: atteso ${K(n.values[0])}`:`Opzione non valida: atteso uno tra ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Troppo grande: ${n.origin??"valore"} deve avere ${s}${n.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Troppo piccolo: ${n.origin} deve avere ${s}${n.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${n.origin} deve essere ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Stringa non valida: deve iniziare con "${s.prefix}"`:s.format==="ends_with"?`Stringa non valida: deve terminare con "${s.suffix}"`:s.format==="includes"?`Stringa non valida: deve includere "${s.includes}"`:s.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${s.pattern}`:`Invalid ${i[s.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${P(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function Nx(){return{localeError:Sx()}}const Tx=()=>{const t={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"数値";case"object":{if(Array.isArray(n))return"配列";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return n=>{switch(n.code){case"invalid_type":return`無効な入力: ${n.expected}が期待されましたが、${r(n.input)}が入力されました`;case"invalid_value":return n.values.length===1?`無効な入力: ${K(n.values[0])}が期待されました`:`無効な選択: ${P(n.values,"、")}のいずれかである必要があります`;case"too_big":{const s=n.inclusive?"以下である":"より小さい",a=e(n.origin);return a?`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${a.unit??"要素"}${s}必要があります`:`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${s}必要があります`}case"too_small":{const s=n.inclusive?"以上である":"より大きい",a=e(n.origin);return a?`小さすぎる値: ${n.origin}は${n.minimum.toString()}${a.unit}${s}必要があります`:`小さすぎる値: ${n.origin}は${n.minimum.toString()}${s}必要があります`}case"invalid_format":{const s=n;return s.format==="starts_with"?`無効な文字列: "${s.prefix}"で始まる必要があります`:s.format==="ends_with"?`無効な文字列: "${s.suffix}"で終わる必要があります`:s.format==="includes"?`無効な文字列: "${s.includes}"を含む必要があります`:s.format==="regex"?`無効な文字列: パターン${s.pattern}に一致する必要があります`:`無効な${i[s.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${P(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function zx(){return{localeError:Tx()}}const xx=()=>{const t={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(n))return"អារេ (Array)";if(n===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return n=>{switch(n.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${n.expected} ប៉ុន្តែទទួលបាន ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${K(n.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${s} ${n.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`តូចពេក៖ ត្រូវការ ${n.origin} ${s} ${n.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${n.origin} ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${s.prefix}"`:s.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${s.suffix}"`:s.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${s.includes}"`:s.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${s.pattern}`:`មិនត្រឹមត្រូវ៖ ${i[s.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${P(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function Ex(){return{localeError:xx()}}const Ux=()=>{const t={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return n=>{switch(n.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${n.expected}, 받은 타입은 ${r(n.input)}입니다`;case"invalid_value":return n.values.length===1?`잘못된 입력: 값은 ${K(n.values[0])} 이어야 합니다`:`잘못된 옵션: ${P(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const s=n.inclusive?"이하":"미만",a=s==="미만"?"이어야 합니다":"여야 합니다",o=e(n.origin),u=(o==null?void 0:o.unit)??"요소";return o?`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${u} ${s}${a}`:`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${s}${a}`}case"too_small":{const s=n.inclusive?"이상":"초과",a=s==="이상"?"이어야 합니다":"여야 합니다",o=e(n.origin),u=(o==null?void 0:o.unit)??"요소";return o?`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${u} ${s}${a}`:`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${s}${a}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`잘못된 문자열: "${s.prefix}"(으)로 시작해야 합니다`:s.format==="ends_with"?`잘못된 문자열: "${s.suffix}"(으)로 끝나야 합니다`:s.format==="includes"?`잘못된 문자열: "${s.includes}"을(를) 포함해야 합니다`:s.format==="regex"?`잘못된 문자열: 정규식 ${s.pattern} 패턴과 일치해야 합니다`:`잘못된 ${i[s.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${P(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function Zx(){return{localeError:Ux()}}const Px=()=>{const t={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"број";case"object":{if(Array.isArray(n))return"низа";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return n=>{switch(n.code){case"invalid_type":return`Грешен внес: се очекува ${n.expected}, примено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${K(n.values[0])}`:`Грешана опција: се очекува една ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${s}${n.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Премногу мал: се очекува ${n.origin} да има ${s}${n.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${n.origin} да биде ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неважечка низа: мора да започнува со "${s.prefix}"`:s.format==="ends_with"?`Неважечка низа: мора да завршува со "${s.suffix}"`:s.format==="includes"?`Неважечка низа: мора да вклучува "${s.includes}"`:s.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${s.pattern}`:`Invalid ${i[s.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${P(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function jx(){return{localeError:Px()}}const Ax=()=>{const t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"nombor";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak sah: dijangka ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${K(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Terlalu besar: dijangka ${n.origin??"nilai"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Terlalu kecil: dijangka ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`String tidak sah: mesti bermula dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak sah: mesti mengandungi "${s.includes}"`:s.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${s.pattern}`:`${i[s.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${P(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function Dx(){return{localeError:Ax()}}const Cx=()=>{const t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"getal";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return n=>{switch(n.code){case"invalid_type":return`Ongeldige invoer: verwacht ${n.expected}, ontving ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${K(n.values[0])}`:`Ongeldige optie: verwacht één van ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Te lang: verwacht dat ${n.origin??"waarde"} ${s}${n.maximum.toString()} ${a.unit??"elementen"} bevat`:`Te lang: verwacht dat ${n.origin??"waarde"} ${s}${n.maximum.toString()} is`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Te kort: verwacht dat ${n.origin} ${s}${n.minimum.toString()} ${a.unit} bevat`:`Te kort: verwacht dat ${n.origin} ${s}${n.minimum.toString()} is`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ongeldige tekst: moet met "${s.prefix}" beginnen`:s.format==="ends_with"?`Ongeldige tekst: moet op "${s.suffix}" eindigen`:s.format==="includes"?`Ongeldige tekst: moet "${s.includes}" bevatten`:s.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${s.pattern}`:`Ongeldig: ${i[s.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function Rx(){return{localeError:Cx()}}const Lx=()=>{const t={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"tall";case"object":{if(Array.isArray(n))return"liste";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Ugyldig input: forventet ${n.expected}, fikk ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${K(n.values[0])}`:`Ugyldig valg: forventet en av ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`For stor(t): forventet ${n.origin??"value"} til å ha ${s}${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til å ha ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`For lite(n): forventet ${n.origin} til å ha ${s}${n.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${n.origin} til å ha ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ugyldig streng: må starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: må ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: må inneholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: må matche mønsteret ${s.pattern}`:`Ugyldig ${i[s.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${P(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function Mx(){return{localeError:Lx()}}const Bx=()=>{const t={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"numara";case"object":{if(Array.isArray(n))return"saf";if(n===null)return"gayb";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return n=>{switch(n.code){case"invalid_type":return`Fâsit giren: umulan ${n.expected}, alınan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Fâsit giren: umulan ${K(n.values[0])}`:`Fâsit tercih: mûteberler ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Fazla büyük: ${n.origin??"value"}, ${s}${n.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${n.origin??"value"}, ${s}${n.maximum.toString()} olmalıydı.`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Fazla küçük: ${n.origin}, ${s}${n.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${n.origin}, ${s}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Fâsit metin: "${s.prefix}" ile başlamalı.`:s.format==="ends_with"?`Fâsit metin: "${s.suffix}" ile bitmeli.`:s.format==="includes"?`Fâsit metin: "${s.includes}" ihtivâ etmeli.`:s.format==="regex"?`Fâsit metin: ${s.pattern} nakşına uymalı.`:`Fâsit ${i[s.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Fx(){return{localeError:Bx()}}const qx=()=>{const t={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"ارې";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return n=>{switch(n.code){case"invalid_type":return`ناسم ورودي: باید ${n.expected} وای, مګر ${r(n.input)} ترلاسه شو`;case"invalid_value":return n.values.length===1?`ناسم ورودي: باید ${K(n.values[0])} وای`:`ناسم انتخاب: باید یو له ${P(n.values,"|")} څخه وای`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`ډیر لوی: ${n.origin??"ارزښت"} باید ${s}${n.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${n.origin??"ارزښت"} باید ${s}${n.maximum.toString()} وي`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`ډیر کوچنی: ${n.origin} باید ${s}${n.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${n.origin} باید ${s}${n.minimum.toString()} وي`}case"invalid_format":{const s=n;return s.format==="starts_with"?`ناسم متن: باید د "${s.prefix}" سره پیل شي`:s.format==="ends_with"?`ناسم متن: باید د "${s.suffix}" سره پای ته ورسيږي`:s.format==="includes"?`ناسم متن: باید "${s.includes}" ولري`:s.format==="regex"?`ناسم متن: باید د ${s.pattern} سره مطابقت ولري`:`${i[s.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${P(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function Jx(){return{localeError:qx()}}const Vx=()=>{const t={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"liczba";case"object":{if(Array.isArray(n))return"tablica";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return n=>{switch(n.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${n.expected}, otrzymano ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${K(n.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${s}${n.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${s}${n.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${s.prefix}"`:s.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${s.suffix}"`:s.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${s.includes}"`:s.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${s.pattern}`:`Nieprawidłow(y/a/e) ${i[s.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Wx(){return{localeError:Vx()}}const Gx=()=>{const t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"array";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipo inválido: esperado ${n.expected}, recebido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inválida: esperado ${K(n.values[0])}`:`Opção inválida: esperada uma das ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${s}${n.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Muito pequeno: esperado que ${n.origin} tivesse ${s}${n.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Texto inválido: deve começar com "${s.prefix}"`:s.format==="ends_with"?`Texto inválido: deve terminar com "${s.suffix}"`:s.format==="includes"?`Texto inválido: deve incluir "${s.includes}"`:s.format==="regex"?`Texto inválido: deve corresponder ao padrão ${s.pattern}`:`${i[s.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function Yx(){return{localeError:Gx()}}function df(t,e,r,i){const n=Math.abs(t),s=n%10,a=n%100;return a>=11&&a<=19?i:s===1?e:s>=2&&s<=4?r:i}const Kx=()=>{const t={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"массив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return n=>{switch(n.code){case"invalid_type":return`Неверный ввод: ожидалось ${n.expected}, получено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неверный ввод: ожидалось ${K(n.values[0])}`:`Неверный вариант: ожидалось одно из ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);if(a){const o=Number(n.maximum),u=df(o,a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${s}${n.maximum.toString()} ${u}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);if(a){const o=Number(n.minimum),u=df(o,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${s}${n.minimum.toString()} ${u}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неверная строка: должна начинаться с "${s.prefix}"`:s.format==="ends_with"?`Неверная строка: должна заканчиваться на "${s.suffix}"`:s.format==="includes"?`Неверная строка: должна содержать "${s.includes}"`:s.format==="regex"?`Неверная строка: должна соответствовать шаблону ${s.pattern}`:`Неверный ${i[s.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function Xx(){return{localeError:Kx()}}const Hx=()=>{const t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"število";case"object":{if(Array.isArray(n))return"tabela";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return n=>{switch(n.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${n.expected}, prejeto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neveljaven vnos: pričakovano ${K(n.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${s}${n.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Premajhno: pričakovano, da bo ${n.origin} imelo ${s}${n.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Neveljaven niz: mora se začeti z "${s.prefix}"`:s.format==="ends_with"?`Neveljaven niz: mora se končati z "${s.suffix}"`:s.format==="includes"?`Neveljaven niz: mora vsebovati "${s.includes}"`:s.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${s.pattern}`:`Neveljaven ${i[s.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${P(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function Qx(){return{localeError:Hx()}}const e0=()=>{const t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"antal";case"object":{if(Array.isArray(n))return"lista";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return n=>{switch(n.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${n.expected}, fick ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ogiltig inmatning: förväntat ${K(n.values[0])}`:`Ogiltigt val: förväntade en av ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`För stor(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${n.origin??"värdet"} att ha ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`För lite(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ogiltig sträng: måste börja med "${s.prefix}"`:s.format==="ends_with"?`Ogiltig sträng: måste sluta med "${s.suffix}"`:s.format==="includes"?`Ogiltig sträng: måste innehålla "${s.includes}"`:s.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${s.pattern}"`:`Ogiltig(t) ${i[s.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${P(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function t0(){return{localeError:e0()}}const n0=()=>{const t={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(n))return"அணி";if(n===null)return"வெறுமை";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${n.expected}, பெறப்பட்டது ${r(n.input)}`;case"invalid_value":return n.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${K(n.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${P(n.values,"|")} இல் ஒன்று`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${s}${n.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${s}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${s}${n.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${s}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const s=n;return s.format==="starts_with"?`தவறான சரம்: "${s.prefix}" இல் தொடங்க வேண்டும்`:s.format==="ends_with"?`தவறான சரம்: "${s.suffix}" இல் முடிவடைய வேண்டும்`:s.format==="includes"?`தவறான சரம்: "${s.includes}" ஐ உள்ளடக்க வேண்டும்`:s.format==="regex"?`தவறான சரம்: ${s.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${i[s.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function r0(){return{localeError:n0()}}const i0=()=>{const t={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(n))return"อาร์เรย์ (Array)";if(n===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return n=>{switch(n.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${n.expected} แต่ได้รับ ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${K(n.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"ไม่เกิน":"น้อยกว่า",a=e(n.origin);return a?`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${s} ${n.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"อย่างน้อย":"มากกว่า",a=e(n.origin);return a?`น้อยกว่ากำหนด: ${n.origin} ควรมี${s} ${n.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${n.origin} ควรมี${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${s.prefix}"`:s.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${s.suffix}"`:s.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${s.includes}" อยู่ในข้อความ`:s.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${s.pattern}`:`รูปแบบไม่ถูกต้อง: ${i[s.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${P(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function s0(){return{localeError:i0()}}const a0=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},o0=()=>{const t={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function e(i){return t[i]??null}const r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return i=>{switch(i.code){case"invalid_type":return`Geçersiz değer: beklenen ${i.expected}, alınan ${a0(i.input)}`;case"invalid_value":return i.values.length===1?`Geçersiz değer: beklenen ${K(i.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${P(i.values,"|")}`;case"too_big":{const n=i.inclusive?"<=":"<",s=e(i.origin);return s?`Çok büyük: beklenen ${i.origin??"değer"} ${n}${i.maximum.toString()} ${s.unit??"öğe"}`:`Çok büyük: beklenen ${i.origin??"değer"} ${n}${i.maximum.toString()}`}case"too_small":{const n=i.inclusive?">=":">",s=e(i.origin);return s?`Çok küçük: beklenen ${i.origin} ${n}${i.minimum.toString()} ${s.unit}`:`Çok küçük: beklenen ${i.origin} ${n}${i.minimum.toString()}`}case"invalid_format":{const n=i;return n.format==="starts_with"?`Geçersiz metin: "${n.prefix}" ile başlamalı`:n.format==="ends_with"?`Geçersiz metin: "${n.suffix}" ile bitmeli`:n.format==="includes"?`Geçersiz metin: "${n.includes}" içermeli`:n.format==="regex"?`Geçersiz metin: ${n.pattern} desenine uymalı`:`Geçersiz ${r[n.format]??i.format}`}case"not_multiple_of":return`Geçersiz sayı: ${i.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${i.keys.length>1?"lar":""}: ${P(i.keys,", ")}`;case"invalid_key":return`${i.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${i.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function u0(){return{localeError:o0()}}const c0=()=>{const t={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"масив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return n=>{switch(n.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${n.expected}, отримано ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неправильні вхідні дані: очікується ${K(n.values[0])}`:`Неправильна опція: очікується одне з ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Занадто велике: очікується, що ${n.origin??"значення"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${n.origin??"значення"} буде ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Занадто мале: очікується, що ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${n.origin} буде ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неправильний рядок: повинен починатися з "${s.prefix}"`:s.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${s.suffix}"`:s.format==="includes"?`Неправильний рядок: повинен містити "${s.includes}"`:s.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${s.pattern}`:`Неправильний ${i[s.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function l0(){return{localeError:c0()}}const d0=()=>{const t={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"نمبر";case"object":{if(Array.isArray(n))return"آرے";if(n===null)return"نل";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return n=>{switch(n.code){case"invalid_type":return`غلط ان پٹ: ${n.expected} متوقع تھا، ${r(n.input)} موصول ہوا`;case"invalid_value":return n.values.length===1?`غلط ان پٹ: ${K(n.values[0])} متوقع تھا`:`غلط آپشن: ${P(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`بہت بڑا: ${n.origin??"ویلیو"} کے ${s}${n.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${n.origin??"ویلیو"} کا ${s}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`بہت چھوٹا: ${n.origin} کے ${s}${n.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${n.origin} کا ${s}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const s=n;return s.format==="starts_with"?`غلط سٹرنگ: "${s.prefix}" سے شروع ہونا چاہیے`:s.format==="ends_with"?`غلط سٹرنگ: "${s.suffix}" پر ختم ہونا چاہیے`:s.format==="includes"?`غلط سٹرنگ: "${s.includes}" شامل ہونا چاہیے`:s.format==="regex"?`غلط سٹرنگ: پیٹرن ${s.pattern} سے میچ ہونا چاہیے`:`غلط ${i[s.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${P(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function m0(){return{localeError:d0()}}const f0=()=>{const t={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"số";case"object":{if(Array.isArray(n))return"mảng";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return n=>{switch(n.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${n.expected}, nhận được ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Đầu vào không hợp lệ: mong đợi ${K(n.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Quá lớn: mong đợi ${n.origin??"giá trị"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${n.origin??"giá trị"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Quá nhỏ: mong đợi ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${s.prefix}"`:s.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${s.suffix}"`:s.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${s.includes}"`:s.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${s.pattern}`:`${i[s.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${P(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function h0(){return{localeError:f0()}}const p0=()=>{const t={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(n))return"数组";if(n===null)return"空值(null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return n=>{switch(n.code){case"invalid_type":return`无效输入:期望 ${n.expected},实际接收 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`无效输入:期望 ${K(n.values[0])}`:`无效选项:期望以下之一 ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`数值过大:期望 ${n.origin??"值"} ${s}${n.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${n.origin??"值"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`数值过小:期望 ${n.origin} ${s}${n.minimum.toString()} ${a.unit}`:`数值过小:期望 ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`无效字符串:必须以 "${s.prefix}" 开头`:s.format==="ends_with"?`无效字符串:必须以 "${s.suffix}" 结尾`:s.format==="includes"?`无效字符串:必须包含 "${s.includes}"`:s.format==="regex"?`无效字符串:必须满足正则表达式 ${s.pattern}`:`无效${i[s.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function v0(){return{localeError:p0()}}const g0=()=>{const t={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return n=>{switch(n.code){case"invalid_type":return`無效的輸入值:預期為 ${n.expected},但收到 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`無效的輸入值:預期為 ${K(n.values[0])}`:`無效的選項:預期為以下其中之一 ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`數值過大:預期 ${n.origin??"值"} 應為 ${s}${n.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${n.origin??"值"} 應為 ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`數值過小:預期 ${n.origin} 應為 ${s}${n.minimum.toString()} ${a.unit}`:`數值過小:預期 ${n.origin} 應為 ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`無效的字串:必須以 "${s.prefix}" 開頭`:s.format==="ends_with"?`無效的字串:必須以 "${s.suffix}" 結尾`:s.format==="includes"?`無效的字串:必須包含 "${s.includes}"`:s.format==="regex"?`無效的字串:必須符合格式 ${s.pattern}`:`無效的 ${i[s.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${P(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function y0(){return{localeError:g0()}}const m$=Object.freeze(Object.defineProperty({__proto__:null,ar:Xz,az:Qz,be:tx,ca:rx,cs:sx,de:ox,en:d$,es:dx,fa:fx,fi:px,fr:gx,frCA:$x,he:wx,hu:kx,id:Ox,it:Nx,ja:zx,kh:Ex,ko:Zx,mk:jx,ms:Dx,nl:Rx,no:Mx,ota:Fx,pl:Wx,ps:Jx,pt:Yx,ru:Xx,sl:Qx,sv:t0,ta:r0,th:s0,tr:u0,ua:l0,ur:m0,vi:h0,zhCN:v0,zhTW:y0},Symbol.toStringTag,{value:"Module"}));let f$=class{constructor(e){this._def=e,this.def=e}implement(e){if(typeof e!="function")throw new Error("implement() must be called with a function");const r=(...i)=>{const n=this._def.input?Eo(this._def.input,i,void 0,{callee:r}):i;if(!Array.isArray(n))throw new Error("Invalid arguments schema: not an array or tuple schema.");const s=e(...n);return this._def.output?Eo(this._def.output,s,void 0,{callee:r}):s};return r}implementAsync(e){if(typeof e!="function")throw new Error("implement() must be called with a function");const r=async(...i)=>{const n=this._def.input?await Uo(this._def.input,i,void 0,{callee:r}):i;if(!Array.isArray(n))throw new Error("Invalid arguments schema: not an array or tuple schema.");const s=await e(...n);return this._def.output?Uo(this._def.output,s,void 0,{callee:r}):s};return r}input(...e){const r=this.constructor;return Array.isArray(e[0])?new r({type:"function",input:new na({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output}):new r({type:"function",input:e[0],output:this._def.output})}output(e){const r=this.constructor;return new r({type:"function",input:this._def.input,output:e})}};function h$(t){return new f$({type:"function",input:Array.isArray(t==null?void 0:t.input)?Wg(na,t==null?void 0:t.input):(t==null?void 0:t.input)??Oc(Lu,Ss(Is)),output:(t==null?void 0:t.output)??Ss(Is)})}let Mo=class{constructor(e){this.counter=0,this.metadataRegistry=(e==null?void 0:e.metadata)??dn,this.target=(e==null?void 0:e.target)??"draft-2020-12",this.unrepresentable=(e==null?void 0:e.unrepresentable)??"throw",this.override=(e==null?void 0:e.override)??(()=>{}),this.io=(e==null?void 0:e.io)??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var i,n,s,a;const o=e._zod.def,u={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},c=this.seen.get(e);if(c)return c.count++,r.schemaPath.includes(e)&&(c.cycle=r.path),c.schema;const l={schema:{},count:1,cycle:void 0};this.seen.set(e,l);const d=(n=(i=e._zod).toJSONSchema)==null?void 0:n.call(i);if(d)l.schema=d;else{const p={...r,schemaPath:[...r.schemaPath,e],path:r.path},_=e._zod.parent;if(_)l.ref=_,this.process(_,p),this.seen.get(_).isParent=!0;else{const k=l.schema;switch(o.type){case"string":{const m=k;m.type="string";const{minimum:h,maximum:v,format:w,patterns:I,contentEncoding:A}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof v=="number"&&(m.maxLength=v),w&&(m.format=u[w]??w,m.format===""&&delete m.format),A&&(m.contentEncoding=A),I&&I.size>0){const J=[...I];J.length===1?m.pattern=J[0].source:J.length>1&&(l.schema.allOf=[...J.map(ce=>({...this.target==="draft-7"?{type:"string"}:{},pattern:ce.source}))])}break}case"number":{const m=k,{minimum:h,maximum:v,format:w,multipleOf:I,exclusiveMaximum:A,exclusiveMinimum:J}=e._zod.bag;typeof w=="string"&&w.includes("int")?m.type="integer":m.type="number",typeof J=="number"&&(m.exclusiveMinimum=J),typeof h=="number"&&(m.minimum=h,typeof J=="number"&&(J>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof A=="number"&&(m.exclusiveMaximum=A),typeof v=="number"&&(m.maximum=v,typeof A=="number"&&(A<=v?delete m.maximum:delete m.exclusiveMaximum)),typeof I=="number"&&(m.multipleOf=I);break}case"boolean":{const m=k;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"undefined":{const m=k;m.type="null";break}case"null":{k.type="null";break}case"any":break;case"unknown":break;case"never":{k.not={};break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const m=k,{minimum:h,maximum:v}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof v=="number"&&(m.maxItems=v),m.type="array",m.items=this.process(o.element,{...p,path:[...p.path,"items"]});break}case"object":{const m=k;m.type="object",m.properties={};const h=o.shape;for(const I in h)m.properties[I]=this.process(h[I],{...p,path:[...p.path,"properties",I]});const v=new Set(Object.keys(h)),w=new Set([...v].filter(I=>{const A=o.shape[I]._zod;return this.io==="input"?A.optin===void 0:A.optout===void 0}));w.size>0&&(m.required=Array.from(w)),((s=o.catchall)==null?void 0:s._zod.def.type)==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...p,path:[...p.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{const m=k;m.anyOf=o.options.map((h,v)=>this.process(h,{...p,path:[...p.path,"anyOf",v]}));break}case"intersection":{const m=k,h=this.process(o.left,{...p,path:[...p.path,"allOf",0]}),v=this.process(o.right,{...p,path:[...p.path,"allOf",1]}),w=A=>"allOf"in A&&Object.keys(A).length===1,I=[...w(h)?h.allOf:[h],...w(v)?v.allOf:[v]];m.allOf=I;break}case"tuple":{const m=k;m.type="array";const h=o.items.map((I,A)=>this.process(I,{...p,path:[...p.path,"prefixItems",A]}));if(this.target==="draft-2020-12"?m.prefixItems=h:m.items=h,o.rest){const I=this.process(o.rest,{...p,path:[...p.path,"items"]});this.target==="draft-2020-12"?m.items=I:m.additionalItems=I}o.rest&&(m.items=this.process(o.rest,{...p,path:[...p.path,"items"]}));const{minimum:v,maximum:w}=e._zod.bag;typeof v=="number"&&(m.minItems=v),typeof w=="number"&&(m.maxItems=w);break}case"record":{const m=k;m.type="object",m.propertyNames=this.process(o.keyType,{...p,path:[...p.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...p,path:[...p.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const m=k,h=Iu(o.entries);h.every(v=>typeof v=="number")&&(m.type="number"),h.every(v=>typeof v=="string")&&(m.type="string"),m.enum=h;break}case"literal":{const m=k,h=[];for(const v of o.values)if(v===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(v))}else h.push(v);if(h.length!==0)if(h.length===1){const v=h[0];m.type=v===null?"null":typeof v,m.const=v}else h.every(v=>typeof v=="number")&&(m.type="number"),h.every(v=>typeof v=="string")&&(m.type="string"),h.every(v=>typeof v=="boolean")&&(m.type="string"),h.every(v=>v===null)&&(m.type="null"),m.enum=h;break}case"file":{const m=k,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:w,mime:I}=e._zod.bag;v!==void 0&&(h.minLength=v),w!==void 0&&(h.maxLength=w),I?I.length===1?(h.contentMediaType=I[0],Object.assign(m,h)):m.anyOf=I.map(A=>({...h,contentMediaType:A})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const m=this.process(o.innerType,p);k.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,p),l.ref=o.innerType;break}case"success":{const m=k;m.type="boolean";break}case"default":{this.process(o.innerType,p),l.ref=o.innerType,k.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,p),l.ref=o.innerType,this.io==="input"&&(k._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,p),l.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}k.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const m=k,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{const m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,p),l.ref=m;break}case"readonly":{this.process(o.innerType,p),l.ref=o.innerType,k.readOnly=!0;break}case"promise":{this.process(o.innerType,p),l.ref=o.innerType;break}case"optional":{this.process(o.innerType,p),l.ref=o.innerType;break}case"lazy":{const m=e._zod.innerType;this.process(m,p),l.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const g=this.metadataRegistry.get(e);return g&&Object.assign(l.schema,g),this.io==="input"&&Be(e)&&(delete l.schema.examples,delete l.schema.default),this.io==="input"&&l.schema._prefault&&((a=l.schema).default??(a.default=l.schema._prefault)),delete l.schema._prefault,this.seen.get(e).schema}emit(e,r){var i,n,s,a;const o={cycles:(r==null?void 0:r.cycles)??"ref",reused:(r==null?void 0:r.reused)??"inline",external:(r==null?void 0:r.external)??void 0},u=this.seen.get(e);if(!u)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=_=>{var k;const m=this.target==="draft-2020-12"?"$defs":"definitions";if(o.external){const w=(k=o.external.registry.get(_[0]))==null?void 0:k.id;if(w)return{ref:o.external.uri(w)};const I=_[1].defId??_[1].schema.id??`schema${this.counter++}`;return _[1].defId=I,{defId:I,ref:`${o.external.uri("__shared")}#/${m}/${I}`}}if(_[1]===u)return{ref:"#"};const h=`#/${m}/`,v=_[1].schema.id??`__schema${this.counter++}`;return{defId:v,ref:h+v}},l=_=>{if(_[1].schema.$ref)return;const k=_[1],{ref:m,defId:h}=c(_);k.def={...k.schema},h&&(k.defId=h);const v=k.schema;for(const w in v)delete v[w];v.$ref=m};for(const _ of this.seen.entries()){const k=_[1];if(e===_[0]){l(_);continue}if(o.external){const m=(i=o.external.registry.get(_[0]))==null?void 0:i.id;if(e!==_[0]&&m){l(_);continue}}if((n=this.metadataRegistry.get(_[0]))!=null&&n.id){l(_);continue}if(k.cycle){if(o.cycles==="throw")throw new Error(`Cycle detected: #/${(s=k.cycle)==null?void 0:s.join("/")}/<root>
|
|
35
|
-
|
|
36
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);o.cycles==="ref"&&l(_);continue}if(k.count>1&&o.reused==="ref"){l(_);continue}}const d=(_,k)=>{const m=this.seen.get(_),h=m.def??m.schema,v={...h};if(m.ref===null)return;const w=m.ref;if(m.ref=null,w){d(w,k);const I=this.seen.get(w).schema;I.$ref&&k.target==="draft-7"?(h.allOf=h.allOf??[],h.allOf.push(I)):(Object.assign(h,I),Object.assign(h,v))}m.isParent||this.override({zodSchema:_,jsonSchema:h})};for(const _ of[...this.seen.entries()].reverse())d(_[0],{target:this.target});const g={};this.target==="draft-2020-12"?g.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?g.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),Object.assign(g,u.def);const p=((a=o.external)==null?void 0:a.defs)??{};for(const _ of this.seen.entries()){const k=_[1];k.def&&k.defId&&(p[k.defId]=k.def)}!o.external&&Object.keys(p).length>0&&(this.target==="draft-2020-12"?g.$defs=p:g.definitions=p);try{return JSON.parse(JSON.stringify(g))}catch{throw new Error("Error converting schema to JSON.")}}};function p$(t,e){if(t instanceof qu){const i=new Mo(e),n={};for(const o of t._idmap.entries()){const[u,c]=o;i.process(c)}const s={},a={registry:t,uri:(e==null?void 0:e.uri)||(o=>o),defs:n};for(const o of t._idmap.entries()){const[u,c]=o;s[u]=i.emit(c,{...e,external:a})}if(Object.keys(n).length>0){const o=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[o]:n}}return{schemas:s}}const r=new Mo(e);return r.process(t),r.emit(t,e)}function Be(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const i=t._zod.def;switch(i.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Be(i.element,r);case"object":{for(const n in i.shape)if(Be(i.shape[n],r))return!0;return!1}case"union":{for(const n of i.options)if(Be(n,r))return!0;return!1}case"intersection":return Be(i.left,r)||Be(i.right,r);case"tuple":{for(const n of i.items)if(Be(n,r))return!0;return!!(i.rest&&Be(i.rest,r))}case"record":return Be(i.keyType,r)||Be(i.valueType,r);case"map":return Be(i.keyType,r)||Be(i.valueType,r);case"set":return Be(i.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Be(i.innerType,r);case"lazy":return Be(i.getter(),r);case"default":return Be(i.innerType,r);case"prefault":return Be(i.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Be(i.in,r)||Be(i.out,r);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${i.type}`)}const $0=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),b0=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:Rv,$ZodArray:Lu,$ZodAsyncError:sr,$ZodBase64:Tv,$ZodBase64URL:xv,$ZodBigInt:Ru,$ZodBigIntFormat:jv,$ZodBoolean:Cu,$ZodCIDRv4:Sv,$ZodCIDRv6:Nv,$ZodCUID:pv,$ZodCUID2:vv,$ZodCatch:ig,$ZodCheck:Re,$ZodCheckBigIntFormat:Jp,$ZodCheckEndsWith:rv,$ZodCheckGreaterThan:ju,$ZodCheckIncludes:tv,$ZodCheckLengthEquals:Xp,$ZodCheckLessThan:Pu,$ZodCheckLowerCase:Qp,$ZodCheckMaxLength:Yp,$ZodCheckMaxSize:Vp,$ZodCheckMimeType:sv,$ZodCheckMinLength:Kp,$ZodCheckMinSize:Wp,$ZodCheckMultipleOf:Fp,$ZodCheckNumberFormat:qp,$ZodCheckOverwrite:av,$ZodCheckProperty:iv,$ZodCheckRegex:Hp,$ZodCheckSizeEquals:Gp,$ZodCheckStartsWith:nv,$ZodCheckStringFormat:Si,$ZodCheckUpperCase:ev,$ZodCustom:lg,$ZodDate:Bv,$ZodDefault:eg,$ZodDiscriminatedUnion:qv,$ZodE164:Ev,$ZodEmail:dv,$ZodEmoji:fv,$ZodEnum:Yv,$ZodError:Su,$ZodFile:Xv,$ZodFunction:f$,$ZodGUID:cv,$ZodIPv4:Iv,$ZodIPv6:Ov,$ZodISODate:wv,$ZodISODateTime:bv,$ZodISODuration:kv,$ZodISOTime:_v,$ZodIntersection:Jv,$ZodJWT:Zv,$ZodKSUID:$v,$ZodLazy:cg,$ZodLiteral:Kv,$ZodMap:Wv,$ZodNaN:sg,$ZodNanoID:hv,$ZodNever:Lv,$ZodNonOptional:ng,$ZodNull:Cv,$ZodNullable:Qv,$ZodNumber:Du,$ZodNumberFormat:Pv,$ZodObject:Fv,$ZodOptional:Hv,$ZodPipe:Fu,$ZodPrefault:tg,$ZodPromise:ug,$ZodReadonly:ag,$ZodRealError:Oi,$ZodRecord:Vv,$ZodRegistry:qu,$ZodSet:Gv,$ZodString:Ni,$ZodStringFormat:$e,$ZodSuccess:rg,$ZodSymbol:Av,$ZodTemplateLiteral:og,$ZodTransform:Bu,$ZodTuple:na,$ZodType:B,$ZodULID:gv,$ZodURL:mv,$ZodUUID:lv,$ZodUndefined:Dv,$ZodUnion:Mu,$ZodUnknown:Is,$ZodVoid:Mv,$ZodXID:yv,$brand:Fh,$constructor:$,$input:mg,$output:dg,Doc:ov,JSONSchema:$0,JSONSchemaGenerator:Mo,TimePrecision:pg,_any:Ag,_array:Oc,_base64:cc,_base64url:lc,_bigint:zg,_boolean:Ng,_catch:bN,_cidrv4:oc,_cidrv6:uc,_coercedBigint:xg,_coercedBoolean:Tg,_coercedDate:Lg,_coercedNumber:wg,_coercedString:hg,_cuid:ec,_cuid2:tc,_custom:Yg,_date:Rg,_default:gN,_discriminatedUnion:aN,_e164:dc,_email:Vu,_emoji:Hu,_endsWith:$c,_enum:dN,_file:Gg,_float32:kg,_float64:Ig,_gt:vn,_gte:ht,_guid:Os,_includes:gc,_int:_g,_int32:Og,_int64:Eg,_intersection:oN,_ipv4:sc,_ipv6:ac,_isoDate:gg,_isoDateTime:vg,_isoDuration:$g,_isoTime:yg,_jwt:mc,_ksuid:ic,_lazy:IN,_length:sa,_literal:fN,_lowercase:pc,_lt:pn,_lte:wt,_map:cN,_max:wt,_maxLength:ia,_maxSize:ra,_mime:bc,_min:ht,_minLength:ur,_minSize:oi,_multipleOf:ai,_nan:Mg,_nanoid:Qu,_nativeEnum:mN,_negative:Fg,_never:Dg,_nonnegative:Jg,_nonoptional:yN,_nonpositive:qg,_normalize:wc,_null:jg,_nullable:vN,_number:bg,_optional:pN,_overwrite:xn,_parse:zu,_parseAsync:xu,_pipe:wN,_positive:Bg,_promise:ON,_property:Vg,_readonly:_N,_record:uN,_refine:Kg,_regex:hc,_safeParse:Eu,_safeParseAsync:Uu,_set:lN,_size:fc,_startsWith:yc,_string:fg,_stringbool:Xg,_success:$N,_symbol:Zg,_templateLiteral:kN,_toLowerCase:kc,_toUpperCase:Ic,_transform:hN,_trim:_c,_tuple:Wg,_uint32:Sg,_uint64:Ug,_ulid:nc,_undefined:Pg,_union:sN,_unknown:Ss,_uppercase:vc,_url:Xu,_uuid:Wu,_uuidv4:Gu,_uuidv6:Yu,_uuidv7:Ku,_void:Cg,_xid:rc,clone:jt,config:lt,flattenError:Nu,formatError:Tu,function:h$,globalConfig:ws,globalRegistry:dn,isValidBase64:Au,isValidBase64URL:zv,isValidJWT:Uv,locales:m$,parse:Eo,parseAsync:Uo,prettifyError:ap,regexes:Mp,registry:Ju,safeParse:op,safeParseAsync:up,toDotPath:sp,toJSONSchema:p$,treeifyError:ip,util:YS,version:uv},Symbol.toStringTag,{value:"Module"})),w0={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},_0=Object.freeze({status:"aborted"}),k0=_0;function I0(t){lt({customError:t})}function O0(){return lt().customError}lt(d$());const Ae=Object.freeze(Object.defineProperty({__proto__:null,$brand:Fh,$input:mg,$output:dg,NEVER:k0,TimePrecision:pg,ZodAny:my,ZodArray:vy,ZodBase64:qc,ZodBase64URL:Jc,ZodBigInt:ca,ZodBigIntFormat:Yc,ZodBoolean:ua,ZodCIDRv4:Bc,ZodCIDRv6:Fc,ZodCUID:jc,ZodCUID2:Ac,ZodCatch:Zy,ZodCustom:fa,ZodDate:Kc,ZodDefault:Ny,ZodDiscriminatedUnion:gy,ZodE164:Vc,ZodEmail:Ec,ZodEmoji:Zc,ZodEnum:ui,ZodError:NN,ZodFile:Oy,ZodGUID:Ns,ZodIPv4:Lc,ZodIPv6:Mc,ZodISODate:Nc,ZodISODateTime:Sc,ZodISODuration:zc,ZodISOTime:Tc,ZodIntersection:yy,ZodIssueCode:w0,ZodJWT:Wc,ZodKSUID:Rc,ZodLazy:Ry,ZodLiteral:ky,ZodMap:wy,ZodNaN:jy,ZodNanoID:Pc,ZodNever:hy,ZodNonOptional:nl,ZodNull:dy,ZodNullable:Sy,ZodNumber:oa,ZodNumberFormat:_r,ZodObject:da,ZodOptional:tl,ZodPipe:rl,ZodPrefault:zy,ZodPromise:My,ZodReadonly:Ay,ZodRealError:Ti,ZodRecord:Hc,ZodSet:_y,ZodString:aa,ZodStringFormat:we,ZodSuccess:Uy,ZodSymbol:oy,ZodTemplateLiteral:Cy,ZodTransform:Qc,ZodTuple:by,ZodType:ee,ZodULID:Dc,ZodURL:Uc,ZodUUID:Mt,ZodUndefined:cy,ZodUnion:Xc,ZodUnknown:fy,ZodVoid:py,ZodXID:Cc,_ZodString:xc,_default:Ty,any:nT,array:xi,base64:VN,base64url:WN,bigint:gn,boolean:Gc,catch:Py,check:By,cidrv4:qN,cidrv6:JN,clone:jt,coerce:cz,config:lt,core:b0,cuid:DN,cuid2:CN,custom:$T,date:iT,discriminatedUnion:uT,e164:GN,email:TN,emoji:jN,endsWith:$c,enum:Ye,file:fT,flattenError:Nu,float32:KN,float64:XN,formatError:Tu,function:h$,getErrorMap:O0,globalRegistry:dn,gt:vn,gte:ht,guid:zN,includes:gc,instanceof:ge,int:Po,int32:HN,int64:eT,intersection:$y,ipv4:BN,ipv6:FN,iso:SN,json:wT,jwt:YN,keyof:sT,ksuid:MN,lazy:Ly,length:sa,literal:Iy,locales:m$,looseObject:oT,lowercase:pc,lt:pn,lte:wt,map:lT,maxLength:ia,maxSize:ra,mime:bc,minLength:ur,minSize:oi,multipleOf:ai,nan:vT,nanoid:AN,nativeEnum:mT,negative:Fg,never:la,nonnegative:Jg,nonoptional:Ey,nonpositive:qg,normalize:wc,null:zi,nullable:zs,nullish:hT,number:H,object:re,optional:Ts,overwrite:xn,parse:ry,parseAsync:iy,partialRecord:cT,pipe:xs,positive:Bg,prefault:xy,preprocess:_T,prettifyError:ap,promise:yT,property:Vg,readonly:Dy,record:ma,refine:Fy,regex:hc,regexes:Mp,registry:Ju,safeParse:sy,safeParseAsync:ay,set:dT,setErrorMap:I0,size:fc,startsWith:yc,strictObject:aT,string:Ne,stringbool:bT,success:pT,superRefine:qy,symbol:uy,templateLiteral:gT,toJSONSchema:p$,toLowerCase:kc,toUpperCase:Ic,transform:el,treeifyError:ip,trim:_c,tuple:kr,uint32:QN,uint64:tT,ulid:RN,undefined:ly,union:ze,unknown:cr,uppercase:vc,url:PN,uuid:xN,uuidv4:EN,uuidv6:UN,uuidv7:ZN,void:rT,xid:LN},Symbol.toStringTag,{value:"Module"})),S0=async t=>await new Promise(e=>setTimeout(e,M.fromMilliseconds(t).milliseconds));let N0=class{constructor(e){xt(this,"config"),xt(this,"retries"),xt(this,"interval"),this.config={baseInterval:new M((e==null?void 0:e.baseInterval)??M.seconds(1)),maxRetries:(e==null?void 0:e.maxRetries)??5,scale:(e==null?void 0:e.scale)??1,sleepFn:(e==null?void 0:e.sleepFn)??S0},this.retries=0,this.interval=new M(this.config.baseInterval)}async wait(){const{maxRetries:e,scale:r,sleepFn:i}=this.config;return this.retries>=e?!1:(await i(this.interval),this.interval=this.interval.mult(r),this.retries++,!0)}reset(){this.retries=0,this.interval=this.config.baseInterval}};const T0=re({baseInterval:M.z.optional(),maxRetries:H().optional(),scale:H().optional()}),v$=Object.freeze(Object.defineProperty({__proto__:null,Breaker:N0,breakerConfigZ:T0},Symbol.toStringTag,{value:"Module"})),z0=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,g$=Ne().regex(z0),er=H().min(0).max(255),y$=H().min(0).max(1),$$=kr([er,er,er,y$]),x0=kr([er,er,er]),E0=re({rgba255:$$}),U0=H().min(0).max(360),Z0=H().min(0).max(100),P0=H().min(0).max(100),j0=kr([U0,Z0,P0,y$]),sl=ze([g$,x0,$$,j0,E0]),A0=sl.transform(t=>al(t)),al=(t,e=1)=>{if(t=sl.parse(t),typeof t=="string")return D0(t,e);if(Array.isArray(t)){if(t.length<3||t.length>4)throw new Error(`Invalid color: [${t.join(", ")}]`);return t.length===3?[...t,e]:t}return t.rgba255},D0=(t,e=1)=>(t=g$.parse(t),t=C0(t),[es(t,0),es(t,2),es(t,4),t.length===8?es(t,6)/255:e]),es=(t,e)=>parseInt(t.slice(e,e+2),16),C0=t=>t.startsWith("#")?t.slice(1):t;al("#000000");al("#ffffff");const R0=re({key:Ne(),color:sl,position:H(),switched:Gc().optional()});xi(R0);const L0=re({key:Ne(),name:Ne(),color:A0});re({key:Ne(),name:Ne(),swatches:xi(L0)});const b$=H().int().min(0).max(255),w$=255,_$=0,M0={lower:_$,upper:w$+1},k$=re({name:Ne(),key:Ne()}),ci=t=>re({subject:k$,resource:t,authority:b$}),B0=(...t)=>e=>e.filter(r=>{let i=!1;return r.to!=null&&(i=t.includes(r.to.resource)),r.from!=null&&!i&&(i=t.includes(r.from.resource)),i}),I$=t=>re({from:ci(t),to:zi()}),O$=t=>re({from:zi(),to:ci(t)}),F0=t=>ze([I$(t),O$(t),re({from:ci(t),to:ci(t)})]),$n=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:w$,AUTHORITY_BOUNDS:M0,ZERO_AUTHORITY:_$,acquireZ:O$,authorityZ:b$,filterTransfersByChannelKey:B0,releaseZ:I$,stateZ:ci,subjectZ:k$,transferZ:F0},Symbol.toStringTag,{value:"Module"})),q0=t=>Object.getOwnPropertySymbols(globalThis).includes(t),J0=(t,e)=>{const r=Symbol.for(t);if(!q0(r)){const i=e();Object.defineProperty(globalThis,r,{value:i})}return()=>globalThis[r]},S$="sy_x_error",V0=t=>e=>e!=null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"?e.type.startsWith(t):e instanceof Error?e.message.startsWith(t):typeof e!="string"?!1:e.startsWith(t),pa=t=>{var e;return e=class extends Error{constructor(r,i){super(r,i),xt(this,"discriminator",e.discriminator),xt(this,"type",e.TYPE),xt(this,"matches",e.matches),this.name=e.TYPE}static sub(r){return pa(`${t}.${r}`)}},xt(e,"discriminator",S$),xt(e,"TYPE",t),xt(e,"matches",V0(t)),e},N$=t=>{if(t==null||typeof t!="object")return!1;const e=t;if(e.discriminator!==S$)return!1;if(!("type"in e))throw new Error(`X Error is missing its type property: ${JSON.stringify(e)}`);return!0},qn="unknown",Bo="nil";let W0=class{constructor(){xt(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Bo,data:""};if(N$(e))for(const r of this.providers){const i=r.encode(e);if(i!=null)return i}if(e instanceof Error)return{type:qn,data:e.message};if(typeof e=="string")return{type:qn,data:e};try{return{type:qn,data:JSON.stringify(e)}}catch{return{type:qn,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===Bo)return null;if(e.type===qn)return new Fo(e.data);for(const r of this.providers){const i=r.decode(e);if(i!=null)return i}return new Fo(e.data)}};const ol=J0("synnax-error-registry",()=>new W0),G0=({encode:t,decode:e})=>ol().register({encode:t,decode:e}),Y0=t=>ol().encode(t),K0=t=>t==null?null:ol().decode(t);let Fo=class extends pa("unknown"){};const X0=re({type:Ne(),data:Ne()});let H0=class extends pa("canceled"){};const dr=Object.freeze(Object.defineProperty({__proto__:null,Canceled:H0,NONE:Bo,UNKNOWN:qn,Unknown:Fo,createTyped:pa,decode:K0,encode:Y0,isTyped:N$,payloadZ:X0,register:G0},Symbol.toStringTag,{value:"Module"})),Q0=Ae.object({jsonrpc:Ae.literal("2.0"),method:Ae.string(),params:Ae.any().optional(),id:Ae.union([Ae.string(),Ae.number(),Ae.null()]).optional()}),T$=Ae.object({jsonrpc:Ae.literal("2.0"),id:Ae.union([Ae.string(),Ae.number(),Ae.null()])}),eE=T$.extend({result:Ae.json()}),tE=T$.extend({error:Ae.object({code:Ae.number().int(),message:Ae.string().optional(),data:Ae.json().optional()})}),nE=Ae.union([eE,tE]);Ae.union([Q0,nE]);const qo=Ne().regex(/^\d+\.\d+\.\d+$/),Ei=(t,e,r={})=>{r.checkMajor??(r.checkMajor=!0),r.checkMinor??(r.checkMinor=!0),r.checkPatch??(r.checkPatch=!0);const i=qo.parse(t),n=qo.parse(e),[s,a,o]=i.split(".").map(Number),[u,c,l]=n.split(".").map(Number);if(r.checkMajor){if(s<u)return io;if(s>u)return so}if(r.checkMinor){if(a<c)return io;if(a>c)return so}if(r.checkPatch){if(o<l)return io;if(o>l)return so}return Xs},rE=(t,e,r={})=>AS(Ei(t,e,r)),z$=(t,e,r={})=>jS(Ei(t,e,r)),iE=(t,e,r={})=>PS(Ei(t,e,r)),sE=({name:t,migrate:e})=>r=>{try{const i=e(r);return console.log(`${t} migrated: ${r.version} -> ${i.version}`),i}catch(i){throw console.log(`${t} failed to migrate from ${r.version}`),console.error(i),i}},aE=({name:t,migrations:e,targetSchema:r,defaultVersion:i,def:n})=>{const s=Object.keys(e).sort(Ei).pop();if(s==null)return c=>{if(c.version??(c.version=i),c.version!==n.version)return console.log(`${t} version ${c.version} is newer than latest version of ${n.version}.
|
|
37
|
-
Returning default instead.
|
|
38
|
-
`),n;try{return r!=null?r.parse(c):c}catch(l){return console.log(`${t} failed to parse default. Exiting with default`),console.error(l),n}};const a=Object.keys(e).length;let o=!1;const u=c=>{try{if(a===0||z$(c.version,s))return console.log(o?`${t} ${c.version} now up to date`:`${t} version ${c.version} is up to date with target version ${n.version}`),c;const l=c.version,d=e[l],g=d(c);return o=!0,u(g)}catch(l){return console.log(`${t} failed to migrate from ${c.version} to ${s}`),console.error(l),n}};return c=>{try{if(c.version==null)if(i!=null)console.log(`${t} version is null. Setting version to default of ${i}`),c.version=i;else return console.log(`${t} version is null and no default version set. Exiting with default`),n;return u(c)}catch(l){return console.log(`${t} failed to parse final result. Exiting with default`),console.error(l),n}}},mf=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:Ei,createMigration:sE,migrator:aE,semVerNewer:z$,semVerOlder:iE,semVerZ:qo,versionsEqual:rE},Symbol.toStringTag,{value:"Module"})),oE=["standard","scientific","engineering"];Ye(oE);const uE=Ye(["success","info","warning","error","loading","disabled"]),va=Object.freeze(Object.defineProperty({__proto__:null,variantZ:uE},Symbol.toStringTag,{value:"Module"})),cE=(t,e="")=>{const r=t.length;return r===0?e:r===1?t[0]:r===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t[r-1]}`},lE=t=>{const e=t.split(" "),r=new Set,i=e.map(a=>a.charAt(0).toLowerCase()).join("");r.add(i.replace(/-/g,"_")),r.add(i.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"));const n=/\d+/g;t.match(n)&&e.forEach((a,o)=>{if(n.test(a)){const u=e.map((c,l)=>l!==o?c.charAt(0).toLowerCase():c).join("");r.add(u.replace(/-/g,"_")),r.add(u.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"))}});const s=e.map(a=>(a.length>3?a.substring(0,3):a).toLowerCase());return r.add(s.join("").replace(/-/g,"_")),r.add(s.join("_").replace(/-/g,"_")),Array.from(r).filter(a=>a.length>=2&&a.length<=12&&!/^\d/.test(a))},dE=Object.freeze(Object.defineProperty({__proto__:null,createShortIdentifiers:lE,naturalLanguageJoin:cE},Symbol.toStringTag,{value:"Module"})),ul="policy",cl="allow_all";var mE=Object.defineProperty,fE=(t,e,r)=>e in t?mE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ge=(t,e,r)=>fE(t,typeof e!="symbol"?e+"":e,r);const hE=t=>{const e=t.replace(/_[a-z]/g,r=>r[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},x$=t=>{const e=(r,i=Jo)=>{if(typeof r=="string")return t(r);if(Array.isArray(r))return r.map(a=>e(a,i));if(!lo(r))return r;i=gE(i);const n={},s=r;return"toJSON"in s&&typeof s.toJSON=="function"?e(s.toJSON(),i):(Object.keys(s).forEach(a=>{let o=s[a];const u=t(a);i.recursive&&(lo(o)?hf(o,i.keepTypesOnRecursion)||(o=e(o,i)):i.recursiveInArray&&ff(o)&&(o=[...o].map(c=>{let l=c;return lo(c)?hf(l,i.keepTypesOnRecursion)||(l=e(c,i)):ff(c)&&(l=e({key:c},i).key),l}))),n[u]=o}),n)};return e},E$=x$(hE),pE=t=>t.replace(/([a-z0-9])([A-Z])/g,(e,r,i)=>`${r}_${i.toLowerCase()}`),vE=x$(pE),Jo={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},gE=(t=Jo)=>(t.recursive==null?t=Jo:t.recursiveInArray??(t.recursiveInArray=!1),t),ff=t=>t!=null&&Array.isArray(t),lo=t=>t!=null&&typeof t=="object"&&!Array.isArray(t),hf=(t,e)=>(e||[]).some(r=>t instanceof r),yE=t=>t!=null&&typeof t=="object"&&!Array.isArray(t);var $E=Object.defineProperty,bE=(t,e,r)=>e in t?$E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hr=(t,e,r)=>bE(t,typeof e!="symbol"?e+"":e,r);let wE=class{constructor(){Hr(this,"contentType","application/json"),Hr(this,"decoder"),Hr(this,"encoder"),this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(t){return this.encoder.encode(this.encodeString(t))}decode(t,e){return this.decodeString(this.decoder.decode(t),e)}decodeString(t,e){const r=JSON.parse(t),i=E$(r);return e!=null?e.parse(i):i}encodeString(t){const e=vE(t);return JSON.stringify(e,(r,i)=>ArrayBuffer.isView(i)?Array.from(i):typeof i=="bigint"?i.toString():i)}},_E=class{constructor(){Hr(this,"contentType","text/csv")}encode(t){const e=this.encodeString(t);return new TextEncoder().encode(e)}decode(t,e){const r=new TextDecoder().decode(t);return this.decodeString(r,e)}encodeString(t){if(!Array.isArray(t)||t.length===0||!yE(t[0]))throw new Error("Payload must be an array of objects");const e=Object.keys(t[0]),r=[e.join(",")];return t.forEach(i=>{const n=e.map(s=>JSON.stringify(i[s]??""));r.push(n.join(","))}),r.join(`
|
|
39
|
-
`)}decodeString(t,e){const[r,...i]=t.trim().split(`
|
|
40
|
-
`).map(a=>a.trim());if(r.length===0)return e!=null?e.parse({}):{};const n=r.split(",").map(a=>a.trim()),s={};return n.forEach(a=>{s[a]=[]}),i.forEach(a=>{const o=a.split(",").map(u=>u.trim());n.forEach((u,c)=>{const l=this.parseValue(o[c]);l!=null&&s[u].push(l)})}),e!=null?e.parse(s):s}parseValue(t){if(t==null||t.length===0)return null;const e=Number(t);return isNaN(e)?t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t:e}},kE=class{constructor(){Hr(this,"contentType","text/plain")}encode(t){if(typeof t!="string")throw new Error("TextCodec.encode payload must be a string");return new TextEncoder().encode(t)}decode(t,e){const r=new TextDecoder().decode(t);return e!=null?e.parse(r):r}};const Vo=new wE;new _E;new kE;var IE=Object.defineProperty,OE=(t,e,r)=>e in t?IE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,SE=(t,e,r)=>OE(t,e+"",r);let Or=class{constructor(t){SE(this,"value"),this.value=t}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const NE=t=>t!=null&&typeof t=="object"&&"toString"in t,TE=(t,e=!1)=>{const r=NE(t)?"stringer":typeof t;let i;switch(r){case"string":i=(n,s)=>n.localeCompare(s);break;case"stringer":i=(n,s)=>n.toString().localeCompare(s.toString());break;case"number":i=(n,s)=>Number(n)-Number(s);break;case"bigint":i=(n,s)=>BigInt(n)-BigInt(s)>0n?1:-1;break;case"boolean":i=(n,s)=>Number(n)-Number(s);break;case"undefined":i=()=>0;break;default:return console.warn(`sortFunc: unknown type ${r}`),()=>-1}return e?zE(i):i},zE=t=>(e,r)=>t(r,e);function b(t,e,r){function i(o,u){var c;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(c=o._zod).traits??(c.traits=new Set),o._zod.traits.add(t),e(o,u);for(const l in a.prototype)l in o||Object.defineProperty(o,l,{value:a.prototype[l].bind(o)});o._zod.constr=a,o._zod.def=u}const n=(r==null?void 0:r.Parent)??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function a(o){var u;const c=r!=null&&r.Parent?new s:this;i(c,o),(u=c._zod).deferred??(u.deferred=[]);for(const l of c._zod.deferred)l();return c}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>{var u,c;return r!=null&&r.Parent&&o instanceof r.Parent?!0:(c=(u=o==null?void 0:o._zod)==null?void 0:u.traits)==null?void 0:c.has(t)}}),Object.defineProperty(a,"name",{value:t}),a}const U$=Symbol("zod_brand");class mr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Us={};function dt(t){return t&&Object.assign(Us,t),Us}function xE(t){return t}function EE(t){return t}function UE(t){}function ZE(t){throw new Error}function PE(t){}function ll(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function j(t,e="|"){return t.map(r=>X(r)).join(e)}function Z$(t,e){return typeof e=="bigint"?e.toString():e}function ga(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function En(t){return t==null}function ya(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function P$(t,e){const r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,s=Number.parseInt(t.toFixed(n).replace(".","")),a=Number.parseInt(e.toFixed(n).replace(".",""));return s%a/10**n}function se(t,e,r){Object.defineProperty(t,e,{get(){{const i=r();return t[e]=i,i}},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Sr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jE(t,e){return e?e.reduce((r,i)=>r==null?void 0:r[i],t):t}function AE(t){const e=Object.keys(t),r=e.map(i=>t[i]);return Promise.all(r).then(i=>{const n={};for(let s=0;s<e.length;s++)n[e[s]]=i[s];return n})}function dl(t=10){const e="abcdefghijklmnopqrstuvwxyz";let r="";for(let i=0;i<t;i++)r+=e[Math.floor(Math.random()*e.length)];return r}function Jn(t){return JSON.stringify(t)}function li(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const j$=ga(()=>{if(typeof navigator<"u"&&navigator!=null&&navigator.userAgent.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Zs(t){if(li(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(li(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function DE(t){let e=0;for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}const CE=t=>{const e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Ps=new Set(["string","number","symbol"]),A$=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Un(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function At(t,e,r){const i=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(i._zod.parent=t),i}function T(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function RE(t){let e;return new Proxy({},{get(r,i,n){return e??(e=t()),Reflect.get(e,i,n)},set(r,i,n,s){return e??(e=t()),Reflect.set(e,i,n,s)},has(r,i){return e??(e=t()),Reflect.has(e,i)},deleteProperty(r,i){return e??(e=t()),Reflect.deleteProperty(e,i)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,i){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,i)},defineProperty(r,i,n){return e??(e=t()),Reflect.defineProperty(e,i,n)}})}function X(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function D$(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const C$={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},R$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function L$(t,e){const r={},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=i.shape[n])}return At(t,{...t._zod.def,shape:r,checks:[]})}function M$(t,e){const r={...t._zod.def.shape},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return At(t,{...t._zod.def,shape:r,checks:[]})}function B$(t,e){const r={...t._zod.def,get shape(){const i={...t._zod.def.shape,...e};return Sr(this,"shape",i),i},checks:[]};return At(t,r)}function F$(t,e){return At(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return Sr(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function q$(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(const s in i)n[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return At(e,{...e._zod.def,shape:n,checks:[]})}function J$(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(const s in i)n[s]=new t({type:"nonoptional",innerType:i[s]});return At(e,{...e._zod.def,shape:n,checks:[]})}function tr(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r].continue!==!0)return!0;return!1}function yt(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function Jr(t){return typeof t=="string"?t:t==null?void 0:t.message}function It(t,e,r){var i,n,s,a,o,u;const c={...t,path:t.path??[]};if(!t.message){const l=Jr((s=(n=(i=t.inst)==null?void 0:i._zod.def)==null?void 0:n.error)==null?void 0:s.call(n,t))??Jr((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??Jr((o=r.customError)==null?void 0:o.call(r,t))??Jr((u=r.localeError)==null?void 0:u.call(r,t))??"Invalid input";c.message=l}return delete c.inst,delete c.continue,e!=null&&e.reportInput||delete c.input,c}function $a(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function ba(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function fr(...t){const[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}function LE(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}class ME{constructor(...e){}}const BE=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:R$,Class:ME,NUMBER_FORMAT_RANGES:C$,aborted:tr,allowsEval:j$,assert:PE,assertEqual:xE,assertIs:UE,assertNever:ZE,assertNotEqual:EE,assignProp:Sr,cached:ga,cleanEnum:LE,cleanRegex:ya,clone:At,createTransparentProxy:RE,defineLazy:se,esc:Jn,escapeRegex:Un,extend:B$,finalizeIssue:It,floatSafeRemainder:P$,getElementAtPath:jE,getEnumValues:ll,getLengthableOrigin:ba,getParsedType:CE,getSizableOrigin:$a,isObject:li,isPlainObject:Zs,issue:fr,joinValues:j,jsonStringifyReplacer:Z$,merge:F$,normalizeParams:T,nullish:En,numKeys:DE,omit:M$,optionalKeys:D$,partial:q$,pick:L$,prefixIssues:yt,primitiveTypes:A$,promiseAllObject:AE,propertyKeyTypes:Ps,randomString:dl,required:J$,stringifyPrimitive:X,unwrapMessage:Jr},Symbol.toStringTag,{value:"Module"})),V$=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Z$,2)},enumerable:!0})},ml=b("$ZodError",V$),Ui=b("$ZodError",V$,{Parent:Error});function fl(t,e=r=>r.message){const r={},i=[];for(const n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}function hl(t,e){const r=e||function(s){return s.message},i={_errors:[]},n=s=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>n({issues:o}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)i._errors.push(r(a));else{let o=i,u=0;for(;u<a.path.length;){const c=a.path[u];u===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(a))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return n(t),i}function W$(t,e){const r=e||function(s){return s.message},i={errors:[]},n=(s,a=[])=>{var o,u;for(const c of s.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>n({issues:l},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{const l=[...a,...c.path];if(l.length===0){i.errors.push(r(c));continue}let d=i,g=0;for(;g<l.length;){const p=l[g],_=g===l.length-1;typeof p=="string"?(d.properties??(d.properties={}),(o=d.properties)[p]??(o[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(u=d.items)[p]??(u[p]={errors:[]}),d=d.items[p]),_&&d.errors.push(r(c)),g++}}};return n(t),i}function G$(t){const e=[];for(const r of t)typeof r=="number"?e.push(`[${r}]`):typeof r=="symbol"?e.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?e.push(`[${JSON.stringify(r)}]`):(e.length&&e.push("."),e.push(r));return e.join("")}function Y$(t){var e;const r=[],i=[...t.issues].sort((n,s)=>n.path.length-s.path.length);for(const n of i)r.push(`✖ ${n.message}`),(e=n.path)!=null&&e.length&&r.push(` → at ${G$(n.path)}`);return r.join(`
|
|
41
|
-
`)}const pl=t=>(e,r,i,n)=>{const s=i?Object.assign(i,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new mr;if(a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>It(u,s,dt())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},Wo=pl(Ui),vl=t=>async(e,r,i,n)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>It(u,s,dt())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},Go=vl(Ui),gl=t=>(e,r,i)=>{const n=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new mr;return s.issues.length?{success:!1,error:new(t??ml)(s.issues.map(a=>It(a,n,dt())))}:{success:!0,data:s.value}},K$=gl(Ui),yl=t=>async(e,r,i)=>{const n=i?Object.assign(i,{async:!0}):{async:!0};let s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>It(a,n,dt())))}:{success:!0,data:s.value}},X$=yl(Ui),H$=/^[cC][^\s-]{8,}$/,Q$=/^[0-9a-z]+$/,eb=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tb=/^[0-9a-vA-V]{20}$/,nb=/^[A-Za-z0-9]{27}$/,rb=/^[a-zA-Z0-9_-]{21}$/,ib=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,FE=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,sb=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,hr=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,qE=hr(4),JE=hr(6),VE=hr(7),ab=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,WE=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,GE=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,YE=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,KE=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ob="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ub(){return new RegExp(ob,"u")}const cb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,lb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,db=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,mb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$l=/^[A-Za-z0-9_-]*$/,hb=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,XE=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,pb=/^\+(?:[0-9]){6,14}[0-9]$/,vb="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",gb=new RegExp(`^${vb}$`);function yb(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $b(t){return new RegExp(`^${yb(t)}$`)}function bb(t){const e=yb({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");const i=`${e}(?:${r.join("|")})`;return new RegExp(`^${vb}T(?:${i})$`)}const wb=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},_b=/^\d+n?$/,kb=/^\d+$/,Ib=/^-?\d+(?:\.\d+)?/i,Ob=/true|false/i,Sb=/null/i,Nb=/undefined/i,Tb=/^[^A-Z]*$/,zb=/^[^a-z]*$/,xb=Object.freeze(Object.defineProperty({__proto__:null,_emoji:ob,base64:fb,base64url:$l,bigint:_b,boolean:Ob,browserEmail:KE,cidrv4:db,cidrv6:mb,cuid:H$,cuid2:Q$,date:gb,datetime:bb,domain:XE,duration:ib,e164:pb,email:ab,emoji:ub,extendedDuration:FE,guid:sb,hostname:hb,html5Email:WE,integer:kb,ipv4:cb,ipv6:lb,ksuid:nb,lowercase:Tb,nanoid:rb,null:Sb,number:Ib,rfc5322Email:GE,string:wb,time:$b,ulid:eb,undefined:Nb,unicodeEmail:YE,uppercase:zb,uuid:hr,uuid4:qE,uuid6:JE,uuid7:VE,xid:tb},Symbol.toStringTag,{value:"Module"})),Le=b("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Eb={number:"number",bigint:"bigint",object:"date"},bl=b("$ZodCheckLessThan",(t,e)=>{Le.init(t,e);const r=Eb[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:r,code:"too_big",maximum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),wl=b("$ZodCheckGreaterThan",(t,e)=>{Le.init(t,e);const r=Eb[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:r,code:"too_small",minimum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Ub=b("$ZodCheckMultipleOf",(t,e)=>{Le.init(t,e),t._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):P$(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Zb=b("$ZodCheckNumberFormat",(t,e)=>{var r;Le.init(t,e),e.format=e.format||"float64";const i=(r=e.format)==null?void 0:r.includes("int"),n=i?"int":"number",[s,a]=C$[e.format];t._zod.onattach.push(o=>{const u=o._zod.bag;u.format=e.format,u.minimum=s,u.maximum=a,i&&(u.pattern=kb)}),t._zod.check=o=>{const u=o.value;if(i){if(!Number.isInteger(u)){o.issues.push({expected:n,format:e.format,code:"invalid_type",input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?o.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):o.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}u<s&&o.issues.push({origin:"number",input:u,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),u>a&&o.issues.push({origin:"number",input:u,code:"too_big",maximum:a,inst:t})}}),Pb=b("$ZodCheckBigIntFormat",(t,e)=>{Le.init(t,e);const[r,i]=R$[e.format];t._zod.onattach.push(n=>{const s=n._zod.bag;s.format=e.format,s.minimum=r,s.maximum=i}),t._zod.check=n=>{const s=n.value;s<r&&n.issues.push({origin:"bigint",input:s,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),s>i&&n.issues.push({origin:"bigint",input:s,code:"too_big",maximum:i,inst:t})}}),jb=b("$ZodCheckMaxSize",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;i.size<=e.maximum||r.issues.push({origin:$a(i),code:"too_big",maximum:e.maximum,input:i,inst:t,continue:!e.abort})}}),Ab=b("$ZodCheckMinSize",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;i.size>=e.minimum||r.issues.push({origin:$a(i),code:"too_small",minimum:e.minimum,input:i,inst:t,continue:!e.abort})}}),Db=b("$ZodCheckSizeEquals",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=r=>{const i=r.value,n=i.size;if(n===e.size)return;const s=n>e.size;r.issues.push({origin:$a(i),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},input:r.value,inst:t,continue:!e.abort})}}),Cb=b("$ZodCheckMaxLength",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const n=ba(i);r.issues.push({origin:n,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Rb=b("$ZodCheckMinLength",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const n=ba(i);r.issues.push({origin:n,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Lb=b("$ZodCheckLengthEquals",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,n=i.length;if(n===e.length)return;const s=ba(i),a=n>e.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},input:r.value,inst:t,continue:!e.abort})}}),Zi=b("$ZodCheckStringFormat",(t,e)=>{var r;Le.init(t,e),t._zod.onattach.push(i=>{const n=i._zod.bag;n.format=e.format,e.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(e.pattern))}),(r=t._zod).check??(r.check=i=>{if(!e.pattern)throw new Error("Not implemented.");e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})})}),Mb=b("$ZodCheckRegex",(t,e)=>{Zi.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Bb=b("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Tb),Zi.init(t,e)}),Fb=b("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=zb),Zi.init(t,e)}),qb=b("$ZodCheckIncludes",(t,e)=>{Le.init(t,e);const r=Un(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=i,t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),Jb=b("$ZodCheckStartsWith",(t,e)=>{Le.init(t,e);const r=new RegExp(`^${Un(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),Vb=b("$ZodCheckEndsWith",(t,e)=>{Le.init(t,e);const r=new RegExp(`.*${Un(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}});function pf(t,e,r){t.issues.length&&e.issues.push(...yt(r,t.issues))}const Wb=b("$ZodCheckProperty",(t,e)=>{Le.init(t,e),t._zod.check=r=>{const i=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>pf(n,r,e.property));pf(i,r,e.property)}}),Gb=b("$ZodCheckMimeType",(t,e)=>{Le.init(t,e);const r=new Set(e.mime);t._zod.onattach.push(i=>{i._zod.bag.mime=e.mime}),t._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:e.mime,input:i.value.type,path:["type"],inst:t})}}),Yb=b("$ZodCheckOverwrite",(t,e)=>{Le.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class Kb{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
42
|
-
`).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),n=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of n)this.content.push(s)}compile(){const e=Function,r=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(n=>` ${n}`)];return new e(...r,i.join(`
|
|
43
|
-
`))}}const Xb={major:4,minor:0,patch:0},F=b("$ZodType",(t,e)=>{var r,i;t??(t={}),se(t._zod,"id",()=>e.type+"_"+dl(10)),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Xb;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const s of n)for(const a of s._zod.onattach)a(t);if(n.length===0)(i=t._zod).deferred??(i.deferred=[]),(r=t._zod.deferred)==null||r.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,o,u)=>{let c=tr(a),l;for(const d of o){if(d._zod.when){if(!d._zod.when(a))continue}else if(c)continue;const g=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&(u==null?void 0:u.async)===!1)throw new mr;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==g&&(c||(c=tr(a,g)))});else{if(a.issues.length===g)continue;c||(c=tr(a,g))}}return l?l.then(()=>a):a};t._zod.run=(a,o)=>{const u=t._zod.parse(a,o);if(u instanceof Promise){if(o.async===!1)throw new mr;return u.then(c=>s(c,n,o))}return s(u,n,o)}}t["~standard"]={validate:s=>{var a;try{const o=K$(t,s);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return X$(t,s).then(o=>{var u;return o.success?{value:o.data}:{issues:(u=o.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),Pi=b("$ZodString",(t,e)=>{var r;F.init(t,e),t._zod.pattern=[...((r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)??[]].pop()??wb(t._zod.bag),t._zod.parse=(i,n)=>{if(e.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:t}),i}}),be=b("$ZodStringFormat",(t,e)=>{Zi.init(t,e),Pi.init(t,e)}),Hb=b("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=sb),be.init(t,e)}),Qb=b("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=hr(r))}else e.pattern??(e.pattern=hr());be.init(t,e)}),ew=b("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=ab),be.init(t,e)}),tw=b("$ZodURL",(t,e)=>{be.init(t,e),t._zod.check=r=>{try{const i=new URL(r.value);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:hb.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort}));return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),nw=b("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=ub()),be.init(t,e)}),rw=b("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=rb),be.init(t,e)}),iw=b("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=H$),be.init(t,e)}),sw=b("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Q$),be.init(t,e)}),aw=b("$ZodULID",(t,e)=>{e.pattern??(e.pattern=eb),be.init(t,e)}),ow=b("$ZodXID",(t,e)=>{e.pattern??(e.pattern=tb),be.init(t,e)}),uw=b("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=nb),be.init(t,e)}),cw=b("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=bb(e)),be.init(t,e),t._zod.check}),lw=b("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=gb),be.init(t,e)}),dw=b("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=$b(e)),be.init(t,e),t._zod.check}),mw=b("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=ib),be.init(t,e)}),fw=b("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=cb),be.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv4"})}),hw=b("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=lb),be.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),pw=b("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=db),be.init(t,e)}),vw=b("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=mb),be.init(t,e),t._zod.check=r=>{const[i,n]=r.value.split("/");try{if(!n)throw new Error;const s=Number(n);if(`${s}`!==n)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function _l(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const gw=b("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=fb),be.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{_l(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function yw(t){if(!$l.test(t))return!1;const e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return _l(r)}const $w=b("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=$l),be.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{yw(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),bw=b("$ZodE164",(t,e)=>{e.pattern??(e.pattern=pb),be.init(t,e)});function ww(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[i]=r,n=JSON.parse(atob(i));return!("typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}const _w=b("$ZodJWT",(t,e)=>{be.init(t,e),t._zod.check=r=>{ww(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),kl=b("$ZodNumber",(t,e)=>{F.init(t,e),t._zod.pattern=t._zod.bag.pattern??Ib,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;const s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}}),kw=b("$ZodNumber",(t,e)=>{Zb.init(t,e),kl.init(t,e)}),Il=b("$ZodBoolean",(t,e)=>{F.init(t,e),t._zod.pattern=Ob,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=!!r.value}catch{}const n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}}),Ol=b("$ZodBigInt",(t,e)=>{F.init(t,e),t._zod.pattern=_b,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}const{value:n}=r;return typeof n=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:n,inst:t}),r}}),Iw=b("$ZodBigInt",(t,e)=>{Pb.init(t,e),Ol.init(t,e)}),Ow=b("$ZodSymbol",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:t}),r}}),Sw=b("$ZodUndefined",(t,e)=>{F.init(t,e),t._zod.pattern=Nb,t._zod.values=new Set([void 0]),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:t}),r}}),Nw=b("$ZodNull",(t,e)=>{F.init(t,e),t._zod.pattern=Sb,t._zod.values=new Set([null]),t._zod.parse=(r,i)=>{const{value:n}=r;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),Tw=b("$ZodAny",(t,e)=>{F.init(t,e),t._zod.parse=r=>r}),js=b("$ZodUnknown",(t,e)=>{F.init(t,e),t._zod.parse=r=>r}),zw=b("$ZodNever",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),xw=b("$ZodVoid",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:t}),r}}),Ew=b("$ZodDate",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}const n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:t}),r}});function vf(t,e,r){t.issues.length&&e.issues.push(...yt(r,t.issues)),e.value[r]=t.value}const Sl=b("$ZodArray",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);const s=[];for(let a=0;a<n.length;a++){const o=n[a],u=e.element._zod.run({value:o,issues:[]},i);u instanceof Promise?s.push(u.then(c=>vf(c,r,a))):vf(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function ts(t,e,r){t.issues.length&&e.issues.push(...yt(r,t.issues)),e.value[r]=t.value}function gf(t,e,r,i){t.issues.length?i[r]===void 0?r in i?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...yt(r,t.issues)):t.value===void 0?r in i&&(e.value[r]=void 0):e.value[r]=t.value}const Uw=b("$ZodObject",(t,e)=>{F.init(t,e);const r=ga(()=>{const l=Object.keys(e.shape);for(const g of l)if(!(e.shape[g]instanceof F))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);const d=D$(e.shape);return{shape:e.shape,keys:l,keySet:new Set(l),numKeys:l.length,optionalKeys:new Set(d)}});se(t._zod,"propValues",()=>{const l=e.shape,d={};for(const g in l){const p=l[g]._zod;if(p.values){d[g]??(d[g]=new Set);for(const _ of p.values)d[g].add(_)}}return d});const i=l=>{const d=new Kb(["shape","payload","ctx"]),{keys:g,optionalKeys:p}=r.value,_=h=>{const v=Jn(h);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};d.write("const input = payload.value;");const k=Object.create(null);for(const h of g)k[h]=dl(15);d.write("const newResult = {}");for(const h of g)if(p.has(h)){const v=k[h];d.write(`const ${v} = ${_(h)};`);const w=Jn(h);d.write(`
|
|
44
|
-
if (${v}.issues.length) {
|
|
45
|
-
if (input[${w}] === undefined) {
|
|
46
|
-
if (${w} in input) {
|
|
47
|
-
newResult[${w}] = undefined;
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
payload.issues = payload.issues.concat(
|
|
51
|
-
${v}.issues.map((iss) => ({
|
|
52
|
-
...iss,
|
|
53
|
-
path: iss.path ? [${w}, ...iss.path] : [${w}],
|
|
54
|
-
}))
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
} else if (${v}.value === undefined) {
|
|
58
|
-
if (${w} in input) newResult[${w}] = undefined;
|
|
59
|
-
} else {
|
|
60
|
-
newResult[${w}] = ${v}.value;
|
|
61
|
-
}
|
|
62
|
-
`)}else{const v=k[h];d.write(`const ${v} = ${_(h)};`),d.write(`
|
|
63
|
-
if (${v}.issues.length) payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
|
|
64
|
-
...iss,
|
|
65
|
-
path: iss.path ? [${Jn(h)}, ...iss.path] : [${Jn(h)}]
|
|
66
|
-
})));`),d.write(`newResult[${Jn(h)}] = ${v}.value`)}d.write("payload.value = newResult;"),d.write("return payload;");const m=d.compile();return(h,v)=>m(l,h,v)};let n;const s=li,a=!Us.jitless,o=a&&j$.value,{catchall:u}=e;let c;t._zod.parse=(l,d)=>{c??(c=r.value);const g=l.value;if(!s(g))return l.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),l;const p=[];if(a&&o&&(d==null?void 0:d.async)===!1&&d.jitless!==!0)n||(n=i(e.shape)),l=n(l,d);else{l.value={};const v=c.shape;for(const w of c.keys){const I=v[w],A=I._zod.run({value:g[w],issues:[]},d),J=I._zod.optin==="optional"&&I._zod.optout==="optional";A instanceof Promise?p.push(A.then(ce=>J?gf(ce,l,w,g):ts(ce,l,w))):J?gf(A,l,w,g):ts(A,l,w)}}if(!u)return p.length?Promise.all(p).then(()=>l):l;const _=[],k=c.keySet,m=u._zod,h=m.def.type;for(const v of Object.keys(g)){if(k.has(v))continue;if(h==="never"){_.push(v);continue}const w=m.run({value:g[v],issues:[]},d);w instanceof Promise?p.push(w.then(I=>ts(I,l,v))):ts(w,l,v)}return _.length&&l.issues.push({code:"unrecognized_keys",keys:_,input:g,inst:t}),p.length?Promise.all(p).then(()=>l):l}});function yf(t,e,r,i){for(const n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(s=>It(s,i,dt())))}),e}const Nl=b("$ZodUnion",(t,e)=>{F.init(t,e),se(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),se(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>ya(i.source)).join("|")})$`)}}),t._zod.parse=(r,i)=>{let n=!1;const s=[];for(const a of e.options){const o=a._zod.run({value:r.value,issues:[]},i);if(o instanceof Promise)s.push(o),n=!0;else{if(o.issues.length===0)return o;s.push(o)}}return n?Promise.all(s).then(a=>yf(a,r,t,i)):yf(s,r,t,i)}}),Zw=b("$ZodDiscriminatedUnion",(t,e)=>{Nl.init(t,e);const r=t._zod.parse;se(t._zod,"propValues",()=>{const n={};for(const s of e.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(const[o,u]of Object.entries(a)){n[o]||(n[o]=new Set);for(const c of u)n[o].add(c)}}return n});const i=ga(()=>{const n=e.options,s=new Map;for(const a of n){const o=a._zod.propValues[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const u of o){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,a)}}return s});t._zod.parse=(n,s)=>{const a=n.value;if(!li(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),n;const o=i.value.get(a==null?void 0:a[e.discriminator]);return o?o._zod.run(n,s):e.unionFallback?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[e.discriminator],inst:t}),n)}}),Pw=b("$ZodIntersection",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r,s=e.left._zod.run({value:n,issues:[]},i),a=e.right._zod.run({value:n,issues:[]},i);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([o,u])=>$f(r,o,u)):$f(r,s,a)}});function Yo(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Zs(t)&&Zs(e)){const r=Object.keys(e),i=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(const s of i){const a=Yo(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n[s]=a.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<t.length;i++){const n=t[i],s=e[i],a=Yo(n,s);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function $f(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),tr(t))return t;const i=Yo(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}const wa=b("$ZodTuple",(t,e)=>{F.init(t,e);const r=e.items,i=r.length-[...r].reverse().findIndex(n=>n._zod.optin!=="optional");t._zod.parse=(n,s)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({input:a,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];const o=[];if(!e.rest){const c=a.length>r.length,l=a.length<i-1;if(c||l)return n.issues.push({input:a,inst:t,origin:"array",...c?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length}}),n}let u=-1;for(const c of r){if(u++,u>=a.length&&u>=i)continue;const l=c._zod.run({value:a[u],issues:[]},s);l instanceof Promise?o.push(l.then(d=>ns(d,n,u))):ns(l,n,u)}if(e.rest){const c=a.slice(r.length);for(const l of c){u++;const d=e.rest._zod.run({value:l,issues:[]},s);d instanceof Promise?o.push(d.then(g=>ns(g,n,u))):ns(d,n,u)}}return o.length?Promise.all(o).then(()=>n):n}});function ns(t,e,r){t.issues.length&&e.issues.push(...yt(r,t.issues)),e.value[r]=t.value}const jw=b("$ZodRecord",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!Zs(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;const s=[];if(e.keyType._zod.values){const a=e.keyType._zod.values;r.value={};for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){const c=e.valueType._zod.run({value:n[u],issues:[]},i);c instanceof Promise?s.push(c.then(l=>{l.issues.length&&r.issues.push(...yt(u,l.issues)),r.value[u]=l.value})):(c.issues.length&&r.issues.push(...yt(u,c.issues)),r.value[u]=c.value)}let o;for(const u in n)a.has(u)||(o=o??[],o.push(u));o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:o})}else{r.value={};for(const a of Reflect.ownKeys(n)){if(a==="__proto__")continue;const o=e.keyType._zod.run({value:a,issues:[]},i);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:o.issues.map(c=>It(c,i,dt())),input:a,path:[a],inst:t}),r.value[o.value]=o.value;continue}const u=e.valueType._zod.run({value:n[a],issues:[]},i);u instanceof Promise?s.push(u.then(c=>{c.issues.length&&r.issues.push(...yt(a,c.issues)),r.value[o.value]=c.value})):(u.issues.length&&r.issues.push(...yt(a,u.issues)),r.value[o.value]=u.value)}}return s.length?Promise.all(s).then(()=>r):r}}),Aw=b("$ZodMap",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:t}),r;const s=[];r.value=new Map;for(const[a,o]of n){const u=e.keyType._zod.run({value:a,issues:[]},i),c=e.valueType._zod.run({value:o,issues:[]},i);u instanceof Promise||c instanceof Promise?s.push(Promise.all([u,c]).then(([l,d])=>{bf(l,d,r,a,n,t,i)})):bf(u,c,r,a,n,t,i)}return s.length?Promise.all(s).then(()=>r):r}});function bf(t,e,r,i,n,s,a){t.issues.length&&(Ps.has(typeof i)?r.issues.push(...yt(i,t.issues)):r.issues.push({origin:"map",code:"invalid_key",input:n,inst:s,issues:t.issues.map(o=>It(o,a,dt()))})),e.issues.length&&(Ps.has(typeof i)?r.issues.push(...yt(i,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:s,key:i,issues:e.issues.map(o=>It(o,a,dt()))})),r.value.set(t.value,e.value)}const Dw=b("$ZodSet",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:t,expected:"set",code:"invalid_type"}),r;const s=[];r.value=new Set;for(const a of n){const o=e.valueType._zod.run({value:a,issues:[]},i);o instanceof Promise?s.push(o.then(u=>wf(u,r))):wf(o,r)}return s.length?Promise.all(s).then(()=>r):r}});function wf(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}const Cw=b("$ZodEnum",(t,e)=>{F.init(t,e);const r=ll(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(i=>Ps.has(typeof i)).map(i=>typeof i=="string"?Un(i):i.toString()).join("|")})$`),t._zod.parse=(i,n)=>{const s=i.value;return t._zod.values.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),Rw=b("$ZodLiteral",(t,e)=>{F.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Un(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,i)=>{const n=r.value;return t._zod.values.has(n)||r.issues.push({code:"invalid_value",values:e.values,input:n,inst:t}),r}}),Lw=b("$ZodFile",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:t}),r}}),Tl=b("$ZodTransform",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=e.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new mr;return r.value=n,r}}),Mw=b("$ZodOptional",(t,e)=>{F.init(t,e),t._zod.optin="optional",t._zod.optout="optional",se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),se(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${ya(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>r.value===void 0?r:e.innerType._zod.run(r,i)}),Bw=b("$ZodNullable",(t,e)=>{F.init(t,e),se(t._zod,"optin",()=>e.innerType._zod.optin),se(t._zod,"optout",()=>e.innerType._zod.optout),se(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${ya(r.source)}|null)$`):void 0}),se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),Fw=b("$ZodDefault",(t,e)=>{F.init(t,e),t._zod.optin="optional",se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(r.value===void 0)return r.value=e.defaultValue,r;const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>_f(s,e)):_f(n,e)}});function _f(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const qw=b("$ZodPrefault",(t,e)=>{F.init(t,e),t._zod.optin="optional",se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,i))}),Jw=b("$ZodNonOptional",(t,e)=>{F.init(t,e),se(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>kf(s,t)):kf(n,t)}});function kf(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const Vw=b("$ZodSuccess",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),Ww=b("$ZodCatch",(t,e)=>{F.init(t,e),se(t._zod,"optin",()=>e.innerType._zod.optin),se(t._zod,"optout",()=>e.innerType._zod.optout),se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(a=>It(a,i,dt()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>It(s,i,dt()))},input:r.value}),r.issues=[]),r)}}),Gw=b("$ZodNaN",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),zl=b("$ZodPipe",(t,e)=>{F.init(t,e),se(t._zod,"values",()=>e.in._zod.values),se(t._zod,"optin",()=>e.in._zod.optin),se(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,i)=>{const n=e.in._zod.run(r,i);return n instanceof Promise?n.then(s=>If(s,e,i)):If(n,e,i)}});function If(t,e,r){return tr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const Yw=b("$ZodReadonly",(t,e)=>{F.init(t,e),se(t._zod,"propValues",()=>e.innerType._zod.propValues),se(t._zod,"optin",()=>e.innerType._zod.optin),se(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(Of):Of(n)}});function Of(t){return t.value=Object.freeze(t.value),t}const Kw=b("$ZodTemplateLiteral",(t,e)=>{F.init(t,e);const r=[];for(const i of e.parts)if(i instanceof F){if(!i._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);const n=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${i._zod.traits}`);const s=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(s,a))}else if(i===null||A$.has(typeof i))r.push(Un(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(i,n)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:t,expected:"template_literal",code:"invalid_type"}),i):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),i)}),Xw=b("$ZodPromise",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>Promise.resolve(r.value).then(n=>e.innerType._zod.run({value:n,issues:[]},i))}),Hw=b("$ZodLazy",(t,e)=>{F.init(t,e),se(t._zod,"innerType",()=>e.getter()),se(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),se(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),se(t._zod,"optin",()=>t._zod.innerType._zod.optin),se(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(r,i)=>t._zod.innerType._zod.run(r,i)}),Qw=b("$ZodCustom",(t,e)=>{Le.init(t,e),F.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{const i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(s=>Sf(s,r,i,t));Sf(n,r,i,t)}});function Sf(t,e,r,i){if(!t){const n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(fr(n))}}const e_=Symbol("ZodOutput"),t_=Symbol("ZodInput");class xl{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const i=r[0];if(this._map.set(e,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const i={...this.get(r)??{}};return delete i.id,{...i,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function El(){return new xl}const mn=El();function n_(t,e){return new t({type:"string",...T(e)})}function r_(t,e){return new t({type:"string",coerce:!0,...T(e)})}function Ul(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...T(e)})}function As(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...T(e)})}function Zl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...T(e)})}function Pl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(e)})}function jl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(e)})}function Al(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(e)})}function Dl(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...T(e)})}function Cl(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...T(e)})}function Rl(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(e)})}function Ll(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...T(e)})}function Ml(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(e)})}function Bl(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...T(e)})}function Fl(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...T(e)})}function ql(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(e)})}function Jl(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(e)})}function Vl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(e)})}function Wl(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(e)})}function Gl(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(e)})}function Yl(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...T(e)})}function Kl(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...T(e)})}function Xl(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...T(e)})}function Hl(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...T(e)})}const i_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function s_(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(e)})}function a_(t,e){return new t({type:"string",format:"date",check:"string_format",...T(e)})}function o_(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...T(e)})}function u_(t,e){return new t({type:"string",format:"duration",check:"string_format",...T(e)})}function c_(t,e){return new t({type:"number",checks:[],...T(e)})}function l_(t,e){return new t({type:"number",coerce:!0,checks:[],...T(e)})}function d_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...T(e)})}function m_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...T(e)})}function f_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...T(e)})}function h_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...T(e)})}function p_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...T(e)})}function v_(t,e){return new t({type:"boolean",...T(e)})}function g_(t,e){return new t({type:"boolean",coerce:!0,...T(e)})}function y_(t,e){return new t({type:"bigint",...T(e)})}function $_(t,e){return new t({type:"bigint",coerce:!0,...T(e)})}function b_(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...T(e)})}function w_(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...T(e)})}function __(t,e){return new t({type:"symbol",...T(e)})}function k_(t,e){return new t({type:"undefined",...T(e)})}function I_(t,e){return new t({type:"null",...T(e)})}function O_(t){return new t({type:"any"})}function Ds(t){return new t({type:"unknown"})}function S_(t,e){return new t({type:"never",...T(e)})}function N_(t,e){return new t({type:"void",...T(e)})}function T_(t,e){return new t({type:"date",...T(e)})}function z_(t,e){return new t({type:"date",coerce:!0,...T(e)})}function x_(t,e){return new t({type:"nan",...T(e)})}function bn(t,e){return new bl({check:"less_than",...T(e),value:t,inclusive:!1})}function _t(t,e){return new bl({check:"less_than",...T(e),value:t,inclusive:!0})}function wn(t,e){return new wl({check:"greater_than",...T(e),value:t,inclusive:!1})}function pt(t,e){return new wl({check:"greater_than",...T(e),value:t,inclusive:!0})}function E_(t){return wn(0,t)}function U_(t){return bn(0,t)}function Z_(t){return _t(0,t)}function P_(t){return pt(0,t)}function di(t,e){return new Ub({check:"multiple_of",...T(e),value:t})}function _a(t,e){return new jb({check:"max_size",...T(e),maximum:t})}function mi(t,e){return new Ab({check:"min_size",...T(e),minimum:t})}function Ql(t,e){return new Db({check:"size_equals",...T(e),size:t})}function ka(t,e){return new Cb({check:"max_length",...T(e),maximum:t})}function pr(t,e){return new Rb({check:"min_length",...T(e),minimum:t})}function Ia(t,e){return new Lb({check:"length_equals",...T(e),length:t})}function ed(t,e){return new Mb({check:"string_format",format:"regex",...T(e),pattern:t})}function td(t){return new Bb({check:"string_format",format:"lowercase",...T(t)})}function nd(t){return new Fb({check:"string_format",format:"uppercase",...T(t)})}function rd(t,e){return new qb({check:"string_format",format:"includes",...T(e),includes:t})}function id(t,e){return new Jb({check:"string_format",format:"starts_with",...T(e),prefix:t})}function sd(t,e){return new Vb({check:"string_format",format:"ends_with",...T(e),suffix:t})}function j_(t,e,r){return new Wb({check:"property",property:t,schema:e,...T(r)})}function ad(t,e){return new Gb({check:"mime_type",mime:t,...T(e)})}function Zn(t){return new Yb({check:"overwrite",tx:t})}function od(t){return Zn(e=>e.normalize(t))}function ud(){return Zn(t=>t.trim())}function cd(){return Zn(t=>t.toLowerCase())}function ld(){return Zn(t=>t.toUpperCase())}function dd(t,e,r){return new t({type:"array",element:e,...T(r)})}function HE(t,e,r){return new t({type:"union",options:e,...T(r)})}function QE(t,e,r,i){return new t({type:"union",options:r,discriminator:e,...T(i)})}function e1(t,e,r){return new t({type:"intersection",left:e,right:r})}function A_(t,e,r,i){const n=r instanceof F,s=n?i:r,a=n?r:null;return new t({type:"tuple",items:e,rest:a,...T(s)})}function t1(t,e,r,i){return new t({type:"record",keyType:e,valueType:r,...T(i)})}function n1(t,e,r,i){return new t({type:"map",keyType:e,valueType:r,...T(i)})}function r1(t,e,r){return new t({type:"set",valueType:e,...T(r)})}function i1(t,e,r){const i=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new t({type:"enum",entries:i,...T(r)})}function s1(t,e,r){return new t({type:"enum",entries:e,...T(r)})}function a1(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...T(r)})}function D_(t,e){return new t({type:"file",...T(e)})}function o1(t,e){return new t({type:"transform",transform:e})}function u1(t,e){return new t({type:"optional",innerType:e})}function c1(t,e){return new t({type:"nullable",innerType:e})}function l1(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():r}})}function d1(t,e,r){return new t({type:"nonoptional",innerType:e,...T(r)})}function m1(t,e){return new t({type:"success",innerType:e})}function f1(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function h1(t,e,r){return new t({type:"pipe",in:e,out:r})}function p1(t,e){return new t({type:"readonly",innerType:e})}function v1(t,e,r){return new t({type:"template_literal",parts:e,...T(r)})}function g1(t,e){return new t({type:"lazy",getter:e})}function y1(t,e){return new t({type:"promise",innerType:e})}function C_(t,e,r){const i=T(r);return i.abort??(i.abort=!0),new t({type:"custom",check:"custom",fn:e,...i})}function R_(t,e,r){return new t({type:"custom",check:"custom",fn:e,...T(r)})}function L_(t,e){const{case:r,error:i,truthy:n,falsy:s}=T(e);let a=n??["true","1","yes","on","y","enabled"],o=s??["false","0","no","off","n","disabled"];r!=="sensitive"&&(a=a.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));const u=new Set(a),c=new Set(o),l=t.Pipe??zl,d=t.Boolean??Il,g=t.String??Pi,p=t.Transform??Tl,_=new p({type:"transform",transform:(m,h)=>{let v=m;return r!=="sensitive"&&(v=v.toLowerCase()),u.has(v)?!0:c.has(v)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...u,...c],input:h.value,inst:_}),{})},error:i}),k=new l({type:"pipe",in:new g({type:"string",error:i}),out:_,error:i});return new l({type:"pipe",in:k,out:new d({type:"boolean",error:i}),error:i})}const md=b("ZodISODateTime",(t,e)=>{cw.init(t,e),_e.init(t,e)});function M_(t){return s_(md,t)}const fd=b("ZodISODate",(t,e)=>{lw.init(t,e),_e.init(t,e)});function B_(t){return a_(fd,t)}const hd=b("ZodISOTime",(t,e)=>{dw.init(t,e),_e.init(t,e)});function F_(t){return o_(hd,t)}const pd=b("ZodISODuration",(t,e)=>{mw.init(t,e),_e.init(t,e)});function q_(t){return u_(pd,t)}const $1=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:fd,ZodISODateTime:md,ZodISODuration:pd,ZodISOTime:hd,date:B_,datetime:M_,duration:q_,time:F_},Symbol.toStringTag,{value:"Module"})),J_=(t,e)=>{ml.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>hl(t,r)},flatten:{value:r=>fl(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},b1=b("ZodError",J_),ji=b("ZodError",J_,{Parent:Error}),V_=pl(ji),W_=vl(ji),G_=gl(ji),Y_=yl(ji),te=b("ZodType",(t,e)=>(F.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),t.clone=(r,i)=>At(t,r,i),t.brand=()=>t,t.register=(r,i)=>(r.add(t,i),t),t.parse=(r,i)=>V_(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>G_(t,r,i),t.parseAsync=async(r,i)=>W_(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>Y_(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(Uk(r,i)),t.superRefine=r=>t.check(Zk(r)),t.overwrite=r=>t.check(Zn(r)),t.optional=()=>Rs(t),t.nullable=()=>Ls(t),t.nullish=()=>Rs(Ls(t)),t.nonoptional=r=>bk(t,r),t.array=()=>Ai(t),t.or=r=>Ue([t,r]),t.and=r=>uk(t,r),t.transform=r=>Ms(t,Md(r)),t.default=r=>gk(t,r),t.prefault=r=>$k(t,r),t.catch=r=>kk(t,r),t.pipe=r=>Ms(t,r),t.readonly=()=>Sk(t),t.describe=r=>{const i=t.clone();return mn.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){var r;return(r=mn.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return mn.get(t);const i=t.clone();return mn.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),vd=b("_ZodString",(t,e)=>{Pi.init(t,e),te.init(t,e);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...i)=>t.check(ed(...i)),t.includes=(...i)=>t.check(rd(...i)),t.startsWith=(...i)=>t.check(id(...i)),t.endsWith=(...i)=>t.check(sd(...i)),t.min=(...i)=>t.check(pr(...i)),t.max=(...i)=>t.check(ka(...i)),t.length=(...i)=>t.check(Ia(...i)),t.nonempty=(...i)=>t.check(pr(1,...i)),t.lowercase=i=>t.check(td(i)),t.uppercase=i=>t.check(nd(i)),t.trim=()=>t.check(ud()),t.normalize=(...i)=>t.check(od(...i)),t.toLowerCase=()=>t.check(cd()),t.toUpperCase=()=>t.check(ld())}),Oa=b("ZodString",(t,e)=>{Pi.init(t,e),vd.init(t,e),t.email=r=>t.check(Ul(gd,r)),t.url=r=>t.check(Dl(yd,r)),t.jwt=r=>t.check(Hl(Zd,r)),t.emoji=r=>t.check(Cl($d,r)),t.guid=r=>t.check(As(Cs,r)),t.uuid=r=>t.check(Zl(qt,r)),t.uuidv4=r=>t.check(Pl(qt,r)),t.uuidv6=r=>t.check(jl(qt,r)),t.uuidv7=r=>t.check(Al(qt,r)),t.nanoid=r=>t.check(Rl(bd,r)),t.guid=r=>t.check(As(Cs,r)),t.cuid=r=>t.check(Ll(wd,r)),t.cuid2=r=>t.check(Ml(_d,r)),t.ulid=r=>t.check(Bl(kd,r)),t.base64=r=>t.check(Yl(xd,r)),t.base64url=r=>t.check(Kl(Ed,r)),t.xid=r=>t.check(Fl(Id,r)),t.ksuid=r=>t.check(ql(Od,r)),t.ipv4=r=>t.check(Jl(Sd,r)),t.ipv6=r=>t.check(Vl(Nd,r)),t.cidrv4=r=>t.check(Wl(Td,r)),t.cidrv6=r=>t.check(Gl(zd,r)),t.e164=r=>t.check(Xl(Ud,r)),t.datetime=r=>t.check(M_(r)),t.date=r=>t.check(B_(r)),t.time=r=>t.check(F_(r)),t.duration=r=>t.check(q_(r))});function Te(t){return n_(Oa,t)}const _e=b("ZodStringFormat",(t,e)=>{be.init(t,e),vd.init(t,e)}),gd=b("ZodEmail",(t,e)=>{ew.init(t,e),_e.init(t,e)});function w1(t){return Ul(gd,t)}const Cs=b("ZodGUID",(t,e)=>{Hb.init(t,e),_e.init(t,e)});function _1(t){return As(Cs,t)}const qt=b("ZodUUID",(t,e)=>{Qb.init(t,e),_e.init(t,e)});function k1(t){return Zl(qt,t)}function I1(t){return Pl(qt,t)}function O1(t){return jl(qt,t)}function S1(t){return Al(qt,t)}const yd=b("ZodURL",(t,e)=>{tw.init(t,e),_e.init(t,e)});function N1(t){return Dl(yd,t)}const $d=b("ZodEmoji",(t,e)=>{nw.init(t,e),_e.init(t,e)});function T1(t){return Cl($d,t)}const bd=b("ZodNanoID",(t,e)=>{rw.init(t,e),_e.init(t,e)});function z1(t){return Rl(bd,t)}const wd=b("ZodCUID",(t,e)=>{iw.init(t,e),_e.init(t,e)});function x1(t){return Ll(wd,t)}const _d=b("ZodCUID2",(t,e)=>{sw.init(t,e),_e.init(t,e)});function E1(t){return Ml(_d,t)}const kd=b("ZodULID",(t,e)=>{aw.init(t,e),_e.init(t,e)});function U1(t){return Bl(kd,t)}const Id=b("ZodXID",(t,e)=>{ow.init(t,e),_e.init(t,e)});function Z1(t){return Fl(Id,t)}const Od=b("ZodKSUID",(t,e)=>{uw.init(t,e),_e.init(t,e)});function P1(t){return ql(Od,t)}const Sd=b("ZodIPv4",(t,e)=>{fw.init(t,e),_e.init(t,e)});function j1(t){return Jl(Sd,t)}const Nd=b("ZodIPv6",(t,e)=>{hw.init(t,e),_e.init(t,e)});function A1(t){return Vl(Nd,t)}const Td=b("ZodCIDRv4",(t,e)=>{pw.init(t,e),_e.init(t,e)});function D1(t){return Wl(Td,t)}const zd=b("ZodCIDRv6",(t,e)=>{vw.init(t,e),_e.init(t,e)});function C1(t){return Gl(zd,t)}const xd=b("ZodBase64",(t,e)=>{gw.init(t,e),_e.init(t,e)});function R1(t){return Yl(xd,t)}const Ed=b("ZodBase64URL",(t,e)=>{$w.init(t,e),_e.init(t,e)});function L1(t){return Kl(Ed,t)}const Ud=b("ZodE164",(t,e)=>{bw.init(t,e),_e.init(t,e)});function M1(t){return Xl(Ud,t)}const Zd=b("ZodJWT",(t,e)=>{_w.init(t,e),_e.init(t,e)});function B1(t){return Hl(Zd,t)}const Sa=b("ZodNumber",(t,e)=>{kl.init(t,e),te.init(t,e),t.gt=(i,n)=>t.check(wn(i,n)),t.gte=(i,n)=>t.check(pt(i,n)),t.min=(i,n)=>t.check(pt(i,n)),t.lt=(i,n)=>t.check(bn(i,n)),t.lte=(i,n)=>t.check(_t(i,n)),t.max=(i,n)=>t.check(_t(i,n)),t.int=i=>t.check(Ko(i)),t.safe=i=>t.check(Ko(i)),t.positive=i=>t.check(wn(0,i)),t.nonnegative=i=>t.check(pt(0,i)),t.negative=i=>t.check(bn(0,i)),t.nonpositive=i=>t.check(_t(0,i)),t.multipleOf=(i,n)=>t.check(di(i,n)),t.step=(i,n)=>t.check(di(i,n)),t.finite=()=>t;const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function Q(t){return c_(Sa,t)}const Nr=b("ZodNumberFormat",(t,e)=>{kw.init(t,e),Sa.init(t,e)});function Ko(t){return d_(Nr,t)}function F1(t){return m_(Nr,t)}function q1(t){return f_(Nr,t)}function J1(t){return h_(Nr,t)}function V1(t){return p_(Nr,t)}const Na=b("ZodBoolean",(t,e)=>{Il.init(t,e),te.init(t,e)});function Pd(t){return v_(Na,t)}const Ta=b("ZodBigInt",(t,e)=>{Ol.init(t,e),te.init(t,e),t.gte=(i,n)=>t.check(pt(i,n)),t.min=(i,n)=>t.check(pt(i,n)),t.gt=(i,n)=>t.check(wn(i,n)),t.gte=(i,n)=>t.check(pt(i,n)),t.min=(i,n)=>t.check(pt(i,n)),t.lt=(i,n)=>t.check(bn(i,n)),t.lte=(i,n)=>t.check(_t(i,n)),t.max=(i,n)=>t.check(_t(i,n)),t.positive=i=>t.check(wn(BigInt(0),i)),t.negative=i=>t.check(bn(BigInt(0),i)),t.nonpositive=i=>t.check(_t(BigInt(0),i)),t.nonnegative=i=>t.check(pt(BigInt(0),i)),t.multipleOf=(i,n)=>t.check(di(i,n));const r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function _n(t){return y_(Ta,t)}const jd=b("ZodBigIntFormat",(t,e)=>{Iw.init(t,e),Ta.init(t,e)});function W1(t){return b_(jd,t)}function G1(t){return w_(jd,t)}const K_=b("ZodSymbol",(t,e)=>{Ow.init(t,e),te.init(t,e)});function X_(t){return __(K_,t)}const H_=b("ZodUndefined",(t,e)=>{Sw.init(t,e),te.init(t,e)});function Q_(t){return k_(H_,t)}const ek=b("ZodNull",(t,e)=>{Nw.init(t,e),te.init(t,e)});function Ad(t){return I_(ek,t)}const tk=b("ZodAny",(t,e)=>{Tw.init(t,e),te.init(t,e)});function Y1(){return O_(tk)}const nk=b("ZodUnknown",(t,e)=>{js.init(t,e),te.init(t,e)});function vr(){return Ds(nk)}const rk=b("ZodNever",(t,e)=>{zw.init(t,e),te.init(t,e)});function za(t){return S_(rk,t)}const ik=b("ZodVoid",(t,e)=>{xw.init(t,e),te.init(t,e)});function K1(t){return N_(ik,t)}const Dd=b("ZodDate",(t,e)=>{Ew.init(t,e),te.init(t,e),t.min=(i,n)=>t.check(pt(i,n)),t.max=(i,n)=>t.check(_t(i,n));const r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function X1(t){return T_(Dd,t)}const sk=b("ZodArray",(t,e)=>{Sl.init(t,e),te.init(t,e),t.element=e.element,t.min=(r,i)=>t.check(pr(r,i)),t.nonempty=r=>t.check(pr(1,r)),t.max=(r,i)=>t.check(ka(r,i)),t.length=(r,i)=>t.check(Ia(r,i)),t.unwrap=()=>t.element});function Ai(t,e){return dd(sk,t,e)}function H1(t){const e=t._zod.def.shape;return fk(Object.keys(e))}const xa=b("ZodObject",(t,e)=>{Uw.init(t,e),te.init(t,e),se(t,"shape",()=>Object.fromEntries(Object.entries(t._zod.def.shape))),t.keyof=()=>Ke(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:vr()}),t.loose=()=>t.clone({...t._zod.def,catchall:vr()}),t.strict=()=>t.clone({...t._zod.def,catchall:za()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>B$(t,r),t.merge=r=>F$(t,r),t.pick=r=>L$(t,r),t.omit=r=>M$(t,r),t.partial=(...r)=>q$(Bd,t,r[0]),t.required=(...r)=>J$(Fd,t,r[0])});function he(t,e){const r={type:"object",get shape(){return Sr(this,"shape",{...t}),this.shape},...T(e)};return new xa(r)}function Q1(t,e){return new xa({type:"object",get shape(){return Sr(this,"shape",{...t}),this.shape},catchall:za(),...T(e)})}function eU(t,e){return new xa({type:"object",get shape(){return Sr(this,"shape",{...t}),this.shape},catchall:vr(),...T(e)})}const Cd=b("ZodUnion",(t,e)=>{Nl.init(t,e),te.init(t,e),t.options=e.options});function Ue(t,e){return new Cd({type:"union",options:t,...T(e)})}const ak=b("ZodDiscriminatedUnion",(t,e)=>{Cd.init(t,e),Zw.init(t,e)});function tU(t,e,r){return new ak({type:"union",options:e,discriminator:t,...T(r)})}const ok=b("ZodIntersection",(t,e)=>{Pw.init(t,e),te.init(t,e)});function uk(t,e){return new ok({type:"intersection",left:t,right:e})}const ck=b("ZodTuple",(t,e)=>{wa.init(t,e),te.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});function Tr(t,e,r){const i=e instanceof F,n=i?r:e,s=i?e:null;return new ck({type:"tuple",items:t,rest:s,...T(n)})}const Rd=b("ZodRecord",(t,e)=>{jw.init(t,e),te.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Ea(t,e,r){return new Rd({type:"record",keyType:t,valueType:e,...T(r)})}function nU(t,e,r){return new Rd({type:"record",keyType:Ue([t,za()]),valueType:e,...T(r)})}const lk=b("ZodMap",(t,e)=>{Aw.init(t,e),te.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function rU(t,e,r){return new lk({type:"map",keyType:t,valueType:e,...T(r)})}const dk=b("ZodSet",(t,e)=>{Dw.init(t,e),te.init(t,e),t.min=(...r)=>t.check(mi(...r)),t.nonempty=r=>t.check(mi(1,r)),t.max=(...r)=>t.check(_a(...r)),t.size=(...r)=>t.check(Ql(...r))});function iU(t,e){return new dk({type:"set",valueType:t,...T(e)})}const fi=b("ZodEnum",(t,e)=>{Cw.init(t,e),te.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(i,n)=>{const s={};for(const a of i)if(r.has(a))s[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new fi({...e,checks:[],...T(n),entries:s})},t.exclude=(i,n)=>{const s={...e.entries};for(const a of i)if(r.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new fi({...e,checks:[],...T(n),entries:s})}});function Ke(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new fi({type:"enum",entries:r,...T(e)})}function sU(t,e){return new fi({type:"enum",entries:t,...T(e)})}const mk=b("ZodLiteral",(t,e)=>{Rw.init(t,e),te.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function fk(t,e){return new mk({type:"literal",values:Array.isArray(t)?t:[t],...T(e)})}const hk=b("ZodFile",(t,e)=>{Lw.init(t,e),te.init(t,e),t.min=(r,i)=>t.check(mi(r,i)),t.max=(r,i)=>t.check(_a(r,i)),t.mime=(r,i)=>t.check(ad(Array.isArray(r)?r:[r],i))});function aU(t){return D_(hk,t)}const Ld=b("ZodTransform",(t,e)=>{Tl.init(t,e),te.init(t,e),t._zod.parse=(r,i)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(fr(s,r.value,e));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(fr(a))}};const n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function Md(t){return new Ld({type:"transform",transform:t})}const Bd=b("ZodOptional",(t,e)=>{Mw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Rs(t){return new Bd({type:"optional",innerType:t})}const pk=b("ZodNullable",(t,e)=>{Bw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ls(t){return new pk({type:"nullable",innerType:t})}function oU(t){return Rs(Ls(t))}const vk=b("ZodDefault",(t,e)=>{Fw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function gk(t,e){return new vk({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const yk=b("ZodPrefault",(t,e)=>{qw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function $k(t,e){return new yk({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const Fd=b("ZodNonOptional",(t,e)=>{Jw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function bk(t,e){return new Fd({type:"nonoptional",innerType:t,...T(e)})}const wk=b("ZodSuccess",(t,e)=>{Vw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function uU(t){return new wk({type:"success",innerType:t})}const _k=b("ZodCatch",(t,e)=>{Ww.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function kk(t,e){return new _k({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Ik=b("ZodNaN",(t,e)=>{Gw.init(t,e),te.init(t,e)});function cU(t){return x_(Ik,t)}const qd=b("ZodPipe",(t,e)=>{zl.init(t,e),te.init(t,e),t.in=e.in,t.out=e.out});function Ms(t,e){return new qd({type:"pipe",in:t,out:e})}const Ok=b("ZodReadonly",(t,e)=>{Yw.init(t,e),te.init(t,e)});function Sk(t){return new Ok({type:"readonly",innerType:t})}const Nk=b("ZodTemplateLiteral",(t,e)=>{Kw.init(t,e),te.init(t,e)});function lU(t,e){return new Nk({type:"template_literal",parts:t,...T(e)})}const Tk=b("ZodLazy",(t,e)=>{Hw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.getter()});function zk(t){return new Tk({type:"lazy",getter:t})}const xk=b("ZodPromise",(t,e)=>{Xw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function dU(t){return new xk({type:"promise",innerType:t})}const Ua=b("ZodCustom",(t,e)=>{Qw.init(t,e),te.init(t,e)});function Ek(t,e){const r=new Le({check:"custom",...T(e)});return r._zod.check=t,r}function mU(t,e){return C_(Ua,t??(()=>!0),e)}function Uk(t,e={}){return R_(Ua,t,e)}function Zk(t,e){const r=Ek(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(fr(n,i.value,r._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),i.issues.push(fr(s))}},t(i.value,i)),e);return r}function ye(t,e={error:`Input not instance of ${t.name}`}){const r=new Ua({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...T(e)});return r._zod.bag.Class=t,r}const fU=(...t)=>L_({Pipe:qd,Boolean:Na,String:Oa,Transform:Ld},...t);function hU(t){const e=zk(()=>Ue([Te(t),Q(),Pd(),Ad(),Ai(e),Ea(Te(),e)]));return e}function pU(t,e){return Ms(Md(t),e)}const Za=Tr([Q(),Q()]);Tr([_n(),_n()]);const Pk=he({width:Q(),height:Q()}),vU=he({signedWidth:Q(),signedHeight:Q()}),gU=["width","height"];Ke(gU);const yU=["start","center","end"],$U=["signedWidth","signedHeight"];Ke($U);const Bs=he({x:Q(),y:Q()}),bU=he({clientX:Q(),clientY:Q()}),wU=["x","y"],jk=Ke(wU),Ak=["top","right","bottom","left"];Ke(Ak);const _U=["left","right"],Dk=Ke(_U),kU=["top","bottom"],Ck=Ke(kU),Rk=["center"],Nf=Ke(Rk),IU=[...Ak,...Rk],Lk=Ke(IU);Ke(yU);const OU=["first","last"];Ke(OU);const SU=he({lower:Q(),upper:Q()}),NU=he({lower:_n(),upper:_n()});Ue([SU,Za]);Ue([NU,Za]);Ke([...jk.options,...Lk.options]);Ue([jk,Lk,ye(String)]);const TU=t=>typeof t=="bigint"||t instanceof BigInt,Mn=(t,e)=>TU(t)?t.valueOf()*BigInt(e.valueOf()):t.valueOf()*Number(e.valueOf()),hn=(t,e,r)=>{const i={};if(typeof e=="object"&&(r=e,e=void 0),r={makeValid:!0,...r},typeof t=="number"||typeof t=="bigint")e!=null?(i.lower=t,i.upper=e):(i.lower=typeof t=="bigint"?0n:0,i.upper=t);else if(Array.isArray(t)){if(t.length!==2)throw new Error("bounds: expected array of length 2");[i.lower,i.upper]=t}else i.lower=t.lower,i.upper=t.upper;return r!=null&&r.makeValid?zU(i):i},zU=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t,Tf=(t,e)=>{const r=hn(t);return e<r.lower?r.lower:e>=r.upper?r.upper-(typeof r.upper=="number"?1:1n):e};he({x:Dk.or(Nf),y:Ck.or(Nf)});const xU=he({x:Dk,y:Ck}),EU=Object.freeze({x:"left",y:"top"}),UU=(t,e)=>t.x===e.x&&t.y===e.y,zf=Ue([Q(),Bs,Za,Pk,vU,bU]),ZU=(t,e)=>{if(typeof t=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return t==="x"?{x:e,y:0}:{x:0,y:e}}return typeof t=="number"?{x:t,y:e??t}:Array.isArray(t)?{x:t[0],y:t[1]}:"signedWidth"in t?{x:t.signedWidth,y:t.signedHeight}:"clientX"in t?{x:t.clientX,y:t.clientY}:"width"in t?{x:t.width,y:t.height}:{x:t.x,y:t.y}},xf=Object.freeze({x:0,y:0}),rs=Ue([Q(),Te()]);he({top:rs,left:rs,width:rs,height:rs});he({left:Q(),top:Q(),right:Q(),bottom:Q()});he({one:Bs,two:Bs,root:xU});const Jd=(t,e,r=0,i=0,n)=>{const s={one:{...xf},two:{...xf},root:n??EU};if(typeof t=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return s.one={x:t,y:e},s.two={x:s.one.x+r,y:s.one.y+i},s}return"one"in t&&"two"in t&&"root"in t?{...t,root:n??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(s.one={x:t.left,y:t.top},s.two={x:t.right,y:t.bottom},s):(s.one=t,e==null?s.two={x:s.one.x+r,y:s.one.y+i}:typeof e=="number"?s.two={x:s.one.x+e,y:s.one.y+r}:"width"in e?s.two={x:s.one.x+e.width,y:s.one.y+e.height}:"signedWidth"in e?s.two={x:s.one.x+e.signedWidth,y:s.one.y+e.signedHeight}:s.two=e,s))},mo=t=>{const e=Jd(t);return{lower:e.one.x,upper:e.two.x}},fo=t=>{const e=Jd(t);return{lower:e.one.y,upper:e.two.y}},PU=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,jU=he({signedWidth:Q(),signedHeight:Q()});Ue([Pk,jU,Bs,Za]);var AU=Object.defineProperty,DU=(t,e,r)=>e in t?AU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jt=(t,e,r)=>DU(t,typeof e!="symbol"?e+"":e,r);const CU=(t,e,r)=>e!==void 0&&t<e?e:r!==void 0&&t>r?r:t;he({offset:zf,scale:zf});he({offset:Q(),scale:Q()});const RU=t=>(e,r,i,n)=>r==="dimension"?[e,i]:[e,n?i-t:i+t],LU=t=>(e,r,i,n)=>[e,n?i/t:i*t],MU=t=>(e,r,i)=>{if(e===null)return[t,i];const{lower:n,upper:s}=e,{lower:a,upper:o}=t,u=s-n,c=o-a;if(r==="dimension")return[t,i*(c/u)];const l=(i-n)*(c/u)+a;return[t,l]},BU=t=>(e,r,i)=>[t,i],FU=()=>(t,e,r)=>{if(t===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[t,r];const{lower:i,upper:n}=t;return[t,n-(r-i)]},qU=t=>(e,r,i)=>{const{lower:n,upper:s}=t;return i=CU(i,n,s),[e,i]},Xo=class Vr{constructor(){Jt(this,"ops",[]),Jt(this,"currBounds",null),Jt(this,"currType",null),Jt(this,"reversed",!1),this.ops=[]}static translate(e){return new Vr().translate(e)}static magnify(e){return new Vr().magnify(e)}static scale(e,r){return new Vr().scale(e,r)}translate(e){const r=this.new(),i=RU(e);return i.type="translate",r.ops.push(i),r}magnify(e){const r=this.new(),i=LU(e);return i.type="magnify",r.ops.push(i),r}scale(e,r){const i=hn(e,r),n=this.new(),s=MU(i);return s.type="scale",n.ops.push(s),n}clamp(e,r){const i=hn(e,r),n=this.new(),s=qU(i);return s.type="clamp",n.ops.push(s),n}reBound(e,r){const i=hn(e,r),n=this.new(),s=BU(i);return s.type="re-bound",n.ops.push(s),n}invert(){const e=FU();e.type="invert";const r=this.new();return r.ops.push(e),r}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new Vr;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,r){return this.currBounds=null,this.ops.reduce(([i,n],s)=>s(i,e,n,this.reversed),[null,r])[1]}reverse(){const e=this.new();e.ops.reverse();const r=[];return e.ops.forEach((i,n)=>{if(i.type==="scale"||r.some(([a,o])=>n>=a&&n<=o))return;const s=e.ops.findIndex((a,o)=>a.type==="scale"&&o>n);s!==-1&&r.push([n,s])}),r.forEach(([i,n])=>{const s=e.ops.slice(i,n);s.unshift(e.ops[n]),e.ops.splice(i,n-i+1,...s)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};Jt(Xo,"IDENTITY",new Xo);let Ef=Xo;const Uf=class Lt{constructor(e=new Ef,r=new Ef,i=null){Jt(this,"x"),Jt(this,"y"),Jt(this,"currRoot"),this.x=e,this.y=r,this.currRoot=i}static translate(e,r){return new Lt().translate(e,r)}static translateX(e){return new Lt().translateX(e)}static translateY(e){return new Lt().translateY(e)}static clamp(e){return new Lt().clamp(e)}static magnify(e){return new Lt().magnify(e)}static scale(e){return new Lt().scale(e)}static reBound(e){return new Lt().reBound(e)}translate(e,r){const i=ZU(e,r),n=this.copy();return n.x=this.x.translate(i.x),n.y=this.y.translate(i.y),n}translateX(e){const r=this.copy();return r.x=this.x.translate(e),r}translateY(e){const r=this.copy();return r.y=this.y.translate(e),r}magnify(e){const r=this.copy();return r.x=this.x.magnify(e.x),r.y=this.y.magnify(e.y),r}scale(e){const r=this.copy();if(PU(e)){const i=this.currRoot;return r.currRoot=e.root,i!=null&&!UU(i,e.root)&&(i.x!==e.root.x&&(r.x=r.x.invert()),i.y!==e.root.y&&(r.y=r.y.invert())),r.x=r.x.scale(mo(e)),r.y=r.y.scale(fo(e)),r}return r.x=r.x.scale(e.width),r.y=r.y.scale(e.height),r}reBound(e){const r=this.copy();return r.x=this.x.reBound(mo(e)),r.y=this.y.reBound(fo(e)),r}clamp(e){const r=this.copy();return r.x=this.x.clamp(mo(e)),r.y=this.y.clamp(fo(e)),r}copy(){const e=new Lt;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return Jd(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}};Jt(Uf,"IDENTITY",new Uf);var JU=Object.defineProperty,VU=(t,e,r)=>e in t?JU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,U=(t,e,r)=>VU(t,typeof e!="symbol"?e+"":e,r);function WU(t){return r_(Oa,t)}function GU(t){return l_(Sa,t)}function YU(t){return g_(Na,t)}function Mk(t){return $_(Ta,t)}function KU(t){return z_(Dd,t)}const XU=Object.freeze(Object.defineProperty({__proto__:null,bigint:Mk,boolean:YU,date:KU,number:GU,string:WU},Symbol.toStringTag,{value:"Module"}));let HU=(t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i};const QU="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",eZ=HU(QU,11),tZ=()=>eZ(),nZ=(t,e)=>r=>r instanceof e||typeof r=="object"&&r!==null&&"discriminator"in r&&r.discriminator===t,rZ=Ke(["static","dynamic"]),Bk=(t,e)=>{const r=new pe(e);if(![oe.DAY,oe.HOUR,oe.MINUTE,oe.SECOND,oe.MILLISECOND,oe.MICROSECOND,oe.NANOSECOND].some(n=>n.equals(r)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const i=t.valueOf()%r.valueOf();return t instanceof pe?new pe(i):new oe(i)},me=class L extends Or{constructor(e,r="UTC"){if(e==null)super(L.now().valueOf());else if(e instanceof Date)super(BigInt(e.getTime())*L.MILLISECOND.valueOf());else if(typeof e=="string")super(L.parseDateTimeString(e,r).valueOf());else if(Array.isArray(e))super(L.parseDate(e));else{let i=BigInt(0);e instanceof Number&&(e=e.valueOf()),r==="local"&&(i=L.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=L.MAX:e=L.MIN)),super(BigInt(e.valueOf())+i)}}static parseDate([e=1970,r=1,i=1]){const n=new Date(e,r-1,i,0,0,0,0);return new L(BigInt(n.getTime())*L.MILLISECOND.valueOf()).truncate(L.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,r="UTC"){const[i,n,s]=e.split(":");let a="00",o="00";s!=null&&([a,o]=s.split("."));let u=L.hours(parseInt(i??"00")).add(L.minutes(parseInt(n??"00"))).add(L.seconds(parseInt(a??"00"))).add(L.milliseconds(parseInt(o??"00")));return r==="local"&&(u=u.add(L.utcOffset)),u.valueOf()}static parseDateTimeString(e,r="UTC"){if(!e.includes("/")&&!e.includes("-"))return L.parseTimeString(e,r);const i=new Date(e);return e.includes(":")||i.setUTCHours(0,0,0,0),new L(BigInt(i.getTime())*L.MILLISECOND.valueOf(),r).valueOf()}fString(e="ISO",r="UTC"){switch(e){case"ISODate":return this.toISOString(r).slice(0,10);case"ISOTime":return this.toISOString(r).slice(11,23);case"time":return this.timeString(!1,r);case"preciseTime":return this.timeString(!0,r);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,r)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,r)}`;default:return this.toISOString(r)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(L.utcOffset).date().toISOString()}timeString(e=!1,r="UTC"){const i=this.toISOString(r);return e?i.slice(11,23):i.slice(11,19)}dateString(){const e=this.date(),r=e.toLocaleString("default",{month:"short"}),i=e.toLocaleString("default",{day:"numeric"});return`${r} ${i}`}static get utcOffset(){return new oe(BigInt(new Date().getTimezoneOffset())*L.MINUTE.valueOf())}static since(e){return new L().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new L(e).valueOf()}span(e){return this.range(e).span}range(e){return new Qr(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new L(e).valueOf()}afterEq(e){return this.valueOf()>=new L(e).valueOf()}before(e){return this.valueOf()<new L(e).valueOf()}beforeEq(e){return this.valueOf()<=new L(e).valueOf()}add(e){return new L(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new L(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(oe.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(oe.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(oe.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(oe.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(L.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(L.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}setYear(e){const r=this.date();return r.setUTCFullYear(e),new L(r)}get month(){return this.date().getUTCMonth()}setMonth(e){const r=this.date();return r.setUTCMonth(e),new L(r)}get day(){return this.date().getUTCDate()}setDay(e){const r=this.date();return r.setUTCDate(e),new L(r)}get hour(){return this.date().getUTCHours()}setHour(e){const r=this.date();return r.setUTCHours(e),new L(r,"UTC")}get minute(){return this.date().getUTCMinutes()}setMinute(e){const r=this.date();return r.setUTCMinutes(e),new L(r)}get second(){return this.date().getUTCSeconds()}setSecond(e){const r=this.date();return r.setUTCSeconds(e),new L(r)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(e){const r=this.date();return r.setUTCMilliseconds(e),new L(r)}toString(){return this.date().toISOString()}remainder(e){return Bk(this,e)}get isToday(){return this.truncate(oe.DAY).equals(L.now().truncate(oe.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new L(new Date)}static max(...e){let r=L.MIN;for(const i of e){const n=new L(i);n.after(r)&&(r=n)}return r}static min(...e){let r=L.MAX;for(const i of e){const n=new L(i);n.before(r)&&(r=n)}return r}static nanoseconds(e,r="UTC"){return new L(e,r)}static microseconds(e,r="UTC"){return L.nanoseconds(e*1e3,r)}static milliseconds(e,r="UTC"){return L.microseconds(e*1e3,r)}static seconds(e,r="UTC"){return L.milliseconds(e*1e3,r)}static minutes(e,r="UTC"){return L.seconds(e*60,r)}static hours(e,r="UTC"){return L.minutes(e*60,r)}static days(e,r="UTC"){return L.hours(e*24,r)}};U(me,"NANOSECOND",me.nanoseconds(1)),U(me,"MICROSECOND",me.microseconds(1)),U(me,"MILLISECOND",me.milliseconds(1)),U(me,"SECOND",me.seconds(1)),U(me,"MINUTE",me.minutes(1)),U(me,"HOUR",me.hours(1)),U(me,"DAY",me.days(1)),U(me,"MAX",new me((1n<<63n)-1n)),U(me,"MIN",new me(0)),U(me,"ZERO",new me(0)),U(me,"z",Ue([he({value:_n()}).transform(t=>new me(t.value)),Te().transform(t=>new me(BigInt(t))),ye(Number).transform(t=>new me(t)),Q().transform(t=>new me(t)),ye(me)]));let pe=me;const fe=class Y extends Or{constructor(e){typeof e=="number"&&(e=Math.trunc(e.valueOf())),super(BigInt(e.valueOf()))}static fromSeconds(e){return e instanceof Y?e:e instanceof Zf?e.period:e instanceof pe?new Y(e):["number","bigint"].includes(typeof e)?Y.seconds(e):new Y(e)}static fromMilliseconds(e){return e instanceof Y?e:e instanceof Zf?e.period:e instanceof pe?new Y(e):["number","bigint"].includes(typeof e)?Y.milliseconds(e):new Y(e)}valueOf(){return this.value}lessThan(e){return this.valueOf()<new Y(e).valueOf()}greaterThan(e){return this.valueOf()>new Y(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new Y(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new Y(e).valueOf()}remainder(e){return Bk(this,e)}truncate(e){return new Y(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(Y.DAY),r=this.truncate(Y.HOUR),i=this.truncate(Y.MINUTE),n=this.truncate(Y.SECOND),s=this.truncate(Y.MILLISECOND),a=this.truncate(Y.MICROSECOND),o=this.truncate(Y.NANOSECOND),u=e,c=r.sub(e),l=i.sub(r),d=n.sub(i),g=s.sub(n),p=a.sub(s),_=o.sub(a);let k="";return u.isZero||(k+=`${u.days}d `),c.isZero||(k+=`${c.hours}h `),l.isZero||(k+=`${l.minutes}m `),d.isZero||(k+=`${d.seconds}s `),g.isZero||(k+=`${g.milliseconds}ms `),p.isZero||(k+=`${p.microseconds}µs `),_.isZero||(k+=`${_.nanoseconds}ns`),k.trim()}mult(e){return new Y(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(Y.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(Y.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(Y.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(Y.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(Y.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(Y.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new Y(e).valueOf()}add(e){return new Y(this.valueOf()+new Y(e).valueOf())}sub(e){return new Y(this.valueOf()-new Y(e).valueOf())}static nanoseconds(e=1){return new Y(e)}static microseconds(e=1){return Y.nanoseconds(Mn(e,1e3))}static milliseconds(e=1){return Y.microseconds(Mn(e,1e3))}static seconds(e=1){return Y.milliseconds(Mn(e,1e3))}static minutes(e=1){return Y.seconds(Mn(e,60))}static hours(e){return Y.minutes(Mn(e,60))}static days(e){return Y.hours(Mn(e,24))}};U(fe,"NANOSECOND",fe.nanoseconds(1)),U(fe,"MICROSECOND",fe.microseconds(1)),U(fe,"MILLISECOND",fe.milliseconds(1)),U(fe,"SECOND",fe.seconds(1)),U(fe,"MINUTE",fe.minutes(1)),U(fe,"HOUR",fe.hours(1)),U(fe,"DAY",fe.days(1)),U(fe,"MAX",new fe((1n<<63n)-1n)),U(fe,"MIN",new fe(0)),U(fe,"ZERO",new fe(0)),U(fe,"z",Ue([he({value:_n()}).transform(t=>new fe(t.value)),Te().transform(t=>new fe(BigInt(t))),ye(Number).transform(t=>new fe(t)),Q().transform(t=>new fe(t)),ye(fe)]));let oe=fe;const Wr=class ys extends Or{constructor(e){super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new ys(e).valueOf()}get period(){return oe.seconds(1/this.valueOf())}sampleCount(e){return new oe(e).seconds*this.valueOf()}byteCount(e,r){return this.sampleCount(e)*new ut(r).valueOf()}span(e){return oe.seconds(e/this.valueOf())}byteSpan(e,r){return this.span(e.valueOf()/r.valueOf())}static hz(e){return new ys(e)}static khz(e){return ys.hz(e*1e3)}};U(Wr,"z",Ue([Q().transform(t=>new Wr(t)),ye(Number).transform(t=>new Wr(t)),ye(Wr)]));let Zf=Wr;const et=class extends Or{constructor(t){super(t.valueOf())}length(t){return t.valueOf()/this.valueOf()}size(t){return new Ho(t*this.valueOf())}};U(et,"UNKNOWN",new et(0)),U(et,"BIT128",new et(16)),U(et,"BIT64",new et(8)),U(et,"BIT32",new et(4)),U(et,"BIT16",new et(2)),U(et,"BIT8",new et(1)),U(et,"z",Ue([Q().transform(t=>new et(t)),ye(Number).transform(t=>new et(t)),ye(et)]));let ut=et;const Tt=class Gr{constructor(e,r){U(this,"start"),U(this,"end"),typeof e=="object"&&"start"in e?(this.start=new pe(e.start),this.end=new pe(e.end)):(this.start=new pe(e),this.end=new pe(r))}get span(){return new oe(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new Gr(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,r=oe.ZERO){if(r.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let i=this.start.sub(e.start).valueOf(),n=this.end.sub(e.end).valueOf();return i<0&&(i=-i),n<0&&(n=-n),i<=r.valueOf()&&n<=r.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,r=oe.ZERO){e=e.makeValid();const i=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(i.start)||i.end.equals(e.start))return!1;const n=pe.max(i.start,e.start),s=pe.min(i.end,e.end);return s.before(n)?!1:new oe(s.sub(n)).greaterThanOrEqual(r)}contains(e){return e instanceof Gr?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const r=new Gr(this.start,this.end);return e.start.after(this.start)&&(r.start=e.start),e.start.after(this.end)&&(r.end=e.start),e.end.before(this.end)&&(r.end=e.end),e.end.before(this.start)&&(r.start=e.end),r}static max(...e){return new Gr(pe.min(...e.map(r=>r.start)),pe.max(...e.map(r=>r.end)))}};U(Tt,"MAX",new Tt(pe.MIN,pe.MAX)),U(Tt,"MIN",new Tt(pe.MAX,pe.MIN)),U(Tt,"ZERO",new Tt(pe.ZERO,pe.ZERO)),U(Tt,"z",Ue([he({start:pe.z,end:pe.z}).transform(t=>new Tt(t.start,t.end)),ye(Tt)]));let Qr=Tt;const E=class Pe extends Or{constructor(e){if(e instanceof Pe||typeof e=="string"||typeof e.valueOf()=="string")super(e.valueOf());else{const r=Pe.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(r==null)throw new Error(`unable to find data type for ${e.toString()}`);super(r.valueOf())}}get Array(){const e=Pe.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(r=>this.equals(r))}toString(){return this.valueOf()}get isVariable(){return this.equals(Pe.JSON)||this.equals(Pe.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(Pe.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=Pe.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsignedInteger(){return this.equals(Pe.UINT8)||this.equals(Pe.UINT16)||this.equals(Pe.UINT32)||this.equals(Pe.UINT64)}get isSignedInteger(){return this.equals(Pe.INT8)||this.equals(Pe.INT16)||this.equals(Pe.INT32)||this.equals(Pe.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsignedInteger&&e.isSignedInteger?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(Pe.INT32)&&e.equals(Pe.FLOAT64)||this.equals(Pe.INT8)&&e.equals(Pe.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsignedInteger===e.isUnsignedInteger:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}get usesBigInt(){return Pe.BIG_INT_TYPES.some(e=>e.equals(this))}};U(E,"UNKNOWN",new E("unknown")),U(E,"FLOAT64",new E("float64")),U(E,"FLOAT32",new E("float32")),U(E,"INT64",new E("int64")),U(E,"INT32",new E("int32")),U(E,"INT16",new E("int16")),U(E,"INT8",new E("int8")),U(E,"UINT64",new E("uint64")),U(E,"UINT32",new E("uint32")),U(E,"UINT16",new E("uint16")),U(E,"UINT8",new E("uint8")),U(E,"BOOLEAN",E.UINT8),U(E,"TIMESTAMP",new E("timestamp")),U(E,"UUID",new E("uuid")),U(E,"STRING",new E("string")),U(E,"JSON",new E("json")),U(E,"ARRAY_CONSTRUCTORS",new Map([[E.UINT8.toString(),Uint8Array],[E.UINT16.toString(),Uint16Array],[E.UINT32.toString(),Uint32Array],[E.UINT64.toString(),BigUint64Array],[E.FLOAT32.toString(),Float32Array],[E.FLOAT64.toString(),Float64Array],[E.INT8.toString(),Int8Array],[E.INT16.toString(),Int16Array],[E.INT32.toString(),Int32Array],[E.INT64.toString(),BigInt64Array],[E.TIMESTAMP.toString(),BigInt64Array],[E.STRING.toString(),Uint8Array],[E.JSON.toString(),Uint8Array],[E.UUID.toString(),Uint8Array]])),U(E,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,E.UINT8],[Uint16Array.name,E.UINT16],[Uint32Array.name,E.UINT32],[BigUint64Array.name,E.UINT64],[Float32Array.name,E.FLOAT32],[Float64Array.name,E.FLOAT64],[Int8Array.name,E.INT8],[Int16Array.name,E.INT16],[Int32Array.name,E.INT32],[BigInt64Array.name,E.INT64]])),U(E,"DENSITIES",new Map([[E.UINT8.toString(),ut.BIT8],[E.UINT16.toString(),ut.BIT16],[E.UINT32.toString(),ut.BIT32],[E.UINT64.toString(),ut.BIT64],[E.FLOAT32.toString(),ut.BIT32],[E.FLOAT64.toString(),ut.BIT64],[E.INT8.toString(),ut.BIT8],[E.INT16.toString(),ut.BIT16],[E.INT32.toString(),ut.BIT32],[E.INT64.toString(),ut.BIT64],[E.TIMESTAMP.toString(),ut.BIT64],[E.STRING.toString(),ut.UNKNOWN],[E.JSON.toString(),ut.UNKNOWN],[E.UUID.toString(),ut.BIT128]])),U(E,"ALL",[E.UNKNOWN,E.FLOAT64,E.FLOAT32,E.INT64,E.INT32,E.INT16,E.INT8,E.UINT64,E.UINT32,E.UINT16,E.UINT8,E.TIMESTAMP,E.UUID,E.STRING,E.JSON]),U(E,"BIG_INT_TYPES",[E.INT64,E.UINT64,E.TIMESTAMP]),U(E,"z",Ue([Te().transform(t=>new E(t)),ye(E)]));let je=E;const at=class Fe extends Or{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Fe.bytes(this.valueOf()+e.valueOf())}sub(e){return Fe.bytes(this.valueOf()-e.valueOf())}truncate(e){return new Fe(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return Fe.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/Fe.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/Fe.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/Fe.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/Fe.TERABYTE.valueOf()}toString(){const e=this.truncate(Fe.TERABYTE),r=this.truncate(Fe.GIGABYTE),i=this.truncate(Fe.MEGABYTE),n=this.truncate(Fe.KILOBYTE),s=this.truncate(Fe.BYTE),a=e,o=r.sub(e),u=i.sub(r),c=n.sub(i),l=s.sub(n);let d="";return a.isZero||(d+=`${a.terabytes}TB `),o.isZero||(d+=`${o.gigabytes}GB `),u.isZero||(d+=`${u.megabytes}MB `),c.isZero||(d+=`${c.kilobytes}KB `),(!l.isZero||d==="")&&(d+=`${l.valueOf()}B`),d.trim()}static bytes(e=1){return new Fe(e)}static kilobytes(e=1){return Fe.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Fe.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Fe.megabytes(e.valueOf()*1e3)}static terabytes(e){return Fe.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};U(at,"BYTE",new at(1)),U(at,"KILOBYTE",at.kilobytes(1)),U(at,"MEGABYTE",at.megabytes(1)),U(at,"GIGABYTE",at.gigabytes(1)),U(at,"TERABYTE",at.terabytes(1)),U(at,"ZERO",new at(0)),U(at,"z",Ue([Q().transform(t=>new at(t)),ye(at)]));let Ho=at;Ue([ye(Uint8Array),ye(Uint16Array),ye(Uint32Array),ye(BigUint64Array),ye(Float32Array),ye(Float64Array),ye(Int8Array),ye(Int16Array),ye(Int32Array),ye(BigInt64Array)]);const Fk=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof pe||t instanceof oe||t instanceof Date},iZ=(t,e,r,i=0)=>t.usesBigInt&&!e.usesBigInt?Number(r)-Number(i):!t.usesBigInt&&e.usesBigInt?BigInt(r.valueOf())-BigInt(i.valueOf()):$s(r,-i).valueOf(),$s=(t,e)=>e==0?t:t==0?e:typeof t=="bigint"&&typeof e=="bigint"||typeof t=="number"&&typeof e=="number"?t+e:Number(t)+Number(e),sZ=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function aZ(t){return typeof t=="string"&&sZ.test(t)}const tt=[];for(let t=0;t<256;++t)tt.push((t+256).toString(16).slice(1));function oZ(t,e=0){return(tt[t[e+0]]+tt[t[e+1]]+tt[t[e+2]]+tt[t[e+3]]+"-"+tt[t[e+4]]+tt[t[e+5]]+"-"+tt[t[e+6]]+tt[t[e+7]]+"-"+tt[t[e+8]]+tt[t[e+9]]+"-"+tt[t[e+10]]+tt[t[e+11]]+tt[t[e+12]]+tt[t[e+13]]+tt[t[e+14]]+tt[t[e+15]]).toLowerCase()}function uZ(t,e=0){const r=oZ(t,e);if(!aZ(r))throw TypeError("Stringified UUID is invalid");return r}typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const cZ=(t,e)=>uZ(t,e),Kt=-1,lZ=Te().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer),dZ=Ue([Ad(),Q_()]).transform(()=>new Uint8Array().buffer),Qo=10,mZ=(t,e)=>{if(t==="string"&&!e.isVariable)throw new Error(`cannot convert series of type ${e.toString()} to string`);if(t==="number"&&!e.isNumeric)throw new Error(`cannot convert series of type ${e.toString()} to number`);if(t==="bigint"&&!e.usesBigInt)throw new Error(`cannot convert series of type ${e.toString()} to bigint`)},qk="sy_x_telem_series",Yr=class Vn{constructor(e){U(this,"key"),U(this,"discriminator",qk),U(this,"dataType"),U(this,"sampleOffset"),U(this,"gl"),U(this,"_data"),U(this,"timeRange",Qr.ZERO),U(this,"alignment",0n),U(this,"cachedMin"),U(this,"cachedMax"),U(this,"writePos",Kt),U(this,"_refCount",0),U(this,"cachedLength"),U(this,"_cachedIndexes"),fZ(e)&&(e={data:e}),e.data??(e.data=[]);const{dataType:r,timeRange:i,sampleOffset:n=0,glBufferUsage:s="static",alignment:a=0n,key:o=tZ(),data:u}=e;if(hZ(u)){const d=u;this.key=d.key,this.dataType=d.dataType,this.sampleOffset=d.sampleOffset,this.gl=d.gl,this._data=d._data,this.timeRange=d.timeRange,this.alignment=d.alignment,this.cachedMin=d.cachedMin,this.cachedMax=d.cachedMax,this.writePos=d.writePos,this._refCount=d._refCount,this.cachedLength=d.cachedLength;return}const c=Fk(u),l=Array.isArray(u);if(r!=null)this.dataType=new je(r);else{if(u instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(l||c){let d=u;if(!c){if(u.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");d=u[0]}if(typeof d=="string")this.dataType=je.STRING;else if(typeof d=="number")this.dataType=je.FLOAT64;else if(typeof d=="bigint")this.dataType=je.INT64;else if(typeof d=="boolean")this.dataType=je.BOOLEAN;else if(d instanceof pe||d instanceof Date||d instanceof pe)this.dataType=je.TIMESTAMP;else if(typeof d=="object")this.dataType=je.JSON;else throw new Error(`cannot infer data type of ${typeof d} when constructing a Series from a JS array`)}else this.dataType=new je(u)}if(!l&&!c)this._data=u;else{let d=c?[u]:u;const g=d[0];(g instanceof pe||g instanceof Date||g instanceof oe)&&(d=d.map(p=>new pe(p).valueOf())),this.dataType.equals(je.STRING)?(this.cachedLength=d.length,this._data=new TextEncoder().encode(`${d.join(`
|
|
5
|
+
`).buffer):this.dataType.usesBigInt&&typeof N=="number"?this._data=new this.dataType.Array(u.map(E=>BigInt(Math.round(E)))).buffer:!this.dataType.usesBigInt&&typeof N=="bigint"?this._data=new this.dataType.Array(u.map(Number)).buffer:this._data=new this.dataType.Array(u).buffer}this.key=c,this.alignment=o,this.sampleOffset=a??0,this.timeRange=n??st.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:i}}static alloc({capacity:e,dataType:t,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const a=new new j(t).Array(e),i=new we({data:a.buffer,dataType:t,...n});return i.writePos=0,i}get refCount(){return this._refCount}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){this._refCount--,this.refCount===0&&this.gl.control!=null?this.maybeGarbageCollectGLBuffer(this.gl.control):this.refCount<0&&console.warn("cannot release a series with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(e):this.writeFixed(e)}writeVariable(e){if(this.writePos===ye)return 0;const t=this.byteCapacity.valueOf()-this.writePos,n=e.subBytes(0,t);return this.writeToUnderlyingData(n),this.writePos+=n.byteLength.valueOf(),this.cachedLength!=null&&(this.cachedLength+=n.length,this.calculateCachedLength()),n.length}writeFixed(e){if(this.writePos===ye)return 0;const t=this.capacity-this.writePos,n=e.sub(0,t);return this.writeToUnderlyingData(n),this.cachedLength=void 0,this.maybeRecomputeMinMax(n),this.writePos+=n.length,n.length}writeToUnderlyingData(e){this.underlyingData.set(e.data,this.writePos)}get buffer(){return typeof this._data=="object"&&"buffer"in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===ye?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){return this.dataType.isVariable?new TextDecoder().decode(this.underlyingData).split(`
|
|
6
|
+
`).slice(0,-1):Array.from(this).map(e=>e.toString())}parseJSON(e){if(!this.dataType.equals(j.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.toStrings().map(t=>e.parse(zr.decodeString(t)))}get byteCapacity(){return new Sr(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===ye?this.byteCapacity:this.dataType.isVariable?new Sr(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength!=null?this.cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===ye?this.byteCapacity.valueOf()/this.dataType.density.valueOf():this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const t=[0];return this.data.forEach((n,a)=>{n===Ir&&(e++,t.push(a+1))}),this._cachedIndexes=t,this.cachedLength=e,e}convert(e,t=0){if(this.dataType.equals(e))return this;const n=new e.Array(this.length);for(let a=0;a<this.length;a++)n[a]=Fo(this.dataType,e,this.data[a],t);return new we({data:n.buffer,dataType:e,timeRange:this.timeRange,sampleOffset:t,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(j.TIMESTAMP))this.cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMax=e.reduce((t,n)=>t>n?t:n)}else{const e=this.data;this.cachedMax=e.reduce((t,n)=>t>n?t:n)}return this.cachedMax}get max(){return this.calcMax()}calcMax(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this.cachedMax??=this.calcRawMax(),Ut(this.cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(j.TIMESTAMP))this.cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMin=e.reduce((t,n)=>t<n?t:n)}else{const e=this.data;this.cachedMin=e.reduce((t,n)=>t<n?t:n)}return this.cachedMin}get min(){return this.calcMin()}calcMin(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this.cachedMin??=this.calcRawMin(),Ut(this.cachedMin,this.sampleOffset))}get bounds(){return Ie(Number(this.min),Number(this.max),{makeValid:!1})}maybeRecomputeMinMax(e){if(this.cachedMin!=null){const t=e.cachedMin??e.calcRawMin();t<this.cachedMin&&(this.cachedMin=t)}if(this.cachedMax!=null){const t=e.cachedMax??e.calcRawMax();t>this.cachedMax&&(this.cachedMax=t)}}atAlignment(e,t){const n=Number(e-this.alignment);if(n<0||n>=this.length){if(t===!0)throw new Error(`[series] - no value at index ${n}`);return}return this.at(n,t)}at(e,t=!1){if(this.dataType.isVariable)return this.atVariable(e,t??!1);if(this.dataType.equals(j.UUID))return this.atUUID(e,t);e<0&&(e=this.length+e);const n=this.data[e];if(n==null){if(t===!0)throw new Error(`[series] - no value at index ${e}`);return}return Ut(n,this.sampleOffset)}atUUID(e,t){e<0&&(e=this.length+e);const n=zs(new Uint8Array(this.buffer,e*this.dataType.density.valueOf()));if(n==null){if(t)throw new Error(`[series] - no value at index ${e}`);return}return n}atVariable(e,t){let n=0,a=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[e],a=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let o=0;o<this.data.length;o++)if(this.data[o]===Ir){if(e===0){a=o;break}n=o+1,e--}if(a===0&&(a=this.data.length),n>=a||e>0){if(t)throw new Error(`[series] - no value at index ${e}`);return}}const i=this.data.slice(n,a);return this.dataType.equals(j.STRING)?new TextDecoder().decode(i):gs(JSON.parse(new TextDecoder().decode(i)))}binarySearch(e){let t=0,n=this.length-1;const a=io(e);for(;t<=n;){const i=Math.floor((t+n)/2),o=a(this.at(i,!0),e);if(o===0)return i;o<0?t=i+1:n=i-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(j.FLOAT32)&&!this.dataType.equals(j.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:a}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==a)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==ye){a===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const i=this.dataType.density.size(a).valueOf(),o=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,i,o.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,n==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=ye}as(e){return Jo(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:jn(this.alignmentBounds.lower),upper:jn(this.alignmentBounds.upper)},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}get alignmentBounds(){return Ie(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const e=new Qo(this);return this.dataType.equals(j.JSON)?new ec(e):e}return this.dataType.equals(j.UUID)?new tc(this):new rc(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new Rn(this,e,t??this.length)}subAlignmentIterator(e,t){return new Rn(this,Number(e-this.alignment),Number(t-this.alignment))}subBytes(e,t){if(e>=0&&(t==null||t>=this.byteLength.valueOf()))return this;const n=this.data.subarray(e,t);return new we({data:n,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,t,n){if(t<=0&&(n==null||n>=this.length))return this;let a;return e?a=this.data.subarray(t,n):a=this.data.slice(t,n),new we({data:a,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(e){return new we({data:this.buffer,dataType:this.dataType,timeRange:st.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){let e=`Series(${this.dataType.toString()} ${this.length} [`;if(this.length<=10)e+=Array.from(this).map(t=>t.toString());else{for(let t=0;t<5;t++)e+=`${this.at(t)?.toString()}`,e+=",";e+="...,";for(let t=-5;t<0;t++)e+=this.at(t)?.toString(),t<-1&&(e+=",")}return e+="])",e}};const Ko=r=>r==null?!1:Array.isArray(r)||r instanceof ArrayBuffer||ArrayBuffer.isView(r)&&!(r instanceof DataView)||r instanceof Is?!0:Ns(r),Xo=Lo(Ss,Is);let Rn=class{series;end;index;constructor(r,e,t){this.series=r;const n=Ie(0,r.length);this.end=An(n,t),this.index=An(n,e)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},Qo=class{series;index;decoder;constructor(e){if(!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,t=this.series.data;for(;this.index<t.length&&t[this.index]!==Ir;)this.index++;const n=this.index;return e===n?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,n))})}},ec=class As{wrapped;static schema=s.z.record(s.z.string(),s.z.unknown());constructor(e){this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:zr.decodeString(e.value,As.schema)}}};class tc{series;index;data;density;constructor(e){if(!e.dataType.equals(j.UUID))throw new Error("cannot create a UUID series iterator for a non-UUID series");this.series=e,this.index=0,this.data=new Uint8Array(e.buffer),this.density=j.UUID.density.valueOf()}next(){if(this.index>=this.series.length)return{done:!0,value:void 0};const e=zs(this.data,this.index*this.density);return this.index++,{done:!1,value:e}}}let rc=class{series;index;constructor(e){this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}};const jn=r=>{const e=r>>32n,t=r&0xffffffffn;return{domain:e,sample:t}};s.z.object({key:s.z.string(),value:s.z.string()});s.z.record(s.z.union([s.z.number(),s.z.string(),s.z.symbol()]),s.z.unknown());const nc=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";nc();const sc=["macOS","Windows","Linux"],ac=["macos","windows","linux"],ic={macos:"macOS",windows:"Windows",linux:"Linux"};s.z.enum(sc).or(s.z.enum(ac).transform(r=>ic[r]));const oc=(...r)=>r.map($s).join(""),$s=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),cc=r=>r.endsWith("/")?r.slice(0,-1):r,lc=(r,e="")=>r===null?"":`?${Object.entries(r).filter(([,t])=>t==null?!1:Array.isArray(t)?t.length>0:!0).map(([t,n])=>`${e}${t}=${n}`).join("&")}`;let uc=class Dt{protocol;host;port;path;constructor({host:e,port:t,protocol:n="",pathPrefix:a=""}){this.protocol=n,this.host=e,this.port=t,this.path=$s(a)}replace(e){return new Dt({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Dt({...this,pathPrefix:oc(this.path,e)})}toString(){return cc(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}static UNKNOWN=new Dt({host:"unknown",port:0})};const hc=async r=>await new Promise(e=>setTimeout(e,A.fromMilliseconds(r).milliseconds));class dc{config;retries;interval;constructor(e){this.config={baseInterval:new A(e?.baseInterval??A.seconds(1)),maxRetries:e?.maxRetries??5,scale:e?.scale??1,sleepFn:e?.sleepFn??hc},this.retries=0,this.interval=new A(this.config.baseInterval)}async wait(){const{maxRetries:e,scale:t,sleepFn:n}=this.config;return this.retries>=e?!1:(await n(this.interval),this.interval=this.interval.mult(t),this.retries++,!0)}reset(){this.retries=0,this.interval=this.config.baseInterval}}const fc=s.z.object({baseInterval:A.z.optional(),maxRetries:s.z.number().optional(),scale:s.z.number().optional()}),yc=Object.freeze(Object.defineProperty({__proto__:null,Breaker:dc,breakerConfigZ:fc},Symbol.toStringTag,{value:"Module"})),gc=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,ks=s.z.string().regex(gc),qe=s.z.number().min(0).max(255),Cs=s.z.number().min(0).max(1),xs=s.z.tuple([qe,qe,qe,Cs]),pc=s.z.tuple([qe,qe,qe]),mc=s.z.object({rgba255:xs}),wc=s.z.number().min(0).max(360),bc=s.z.number().min(0).max(100),Tc=s.z.number().min(0).max(100),vc=s.z.tuple([wc,bc,Tc,Cs]),Hr=s.z.union([ks,pc,xs,vc,mc]),Ec=Hr.transform(r=>Gr(r)),Gr=(r,e=1)=>{if(r=Hr.parse(r),typeof r=="string")return Oc(r,e);if(Array.isArray(r)){if(r.length<3||r.length>4)throw new Error(`Invalid color: [${r.join(", ")}]`);return r.length===3?[...r,e]:r}return r.rgba255},Oc=(r,e=1)=>(r=ks.parse(r),r=Nc(r),[Ct(r,0),Ct(r,2),Ct(r,4),r.length===8?Ct(r,6)/255:e]),Ct=(r,e)=>parseInt(r.slice(e,e+2),16),Nc=r=>r.startsWith("#")?r.slice(1):r;Gr("#000000");Gr("#ffffff");const zc=s.z.object({key:s.z.string(),color:Hr,position:s.z.number(),switched:s.z.boolean().optional()});s.z.array(zc);const Sc=s.z.object({key:s.z.string(),name:s.z.string(),color:Ec});s.z.object({key:s.z.string(),name:s.z.string(),swatches:s.z.array(Sc)});s.z.int().min(0).max(255);s.z.object({name:s.z.string(),key:s.z.string()});const Ic=r=>Object.getOwnPropertySymbols(globalThis).includes(r),Ac=(r,e)=>{const t=Symbol.for(r);if(!Ic(t)){const n=e();Object.defineProperty(globalThis,t,{value:n})}return()=>globalThis[t]},Rs="sy_x_error",$c=r=>e=>e!=null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"?e.type.startsWith(r):e instanceof Error?e.message.startsWith(r):typeof e!="string"?!1:e.startsWith(r),bt=r=>class at extends Error{static discriminator=Rs;discriminator=at.discriminator;static TYPE=r;type=at.TYPE;static matches=$c(r);matches=at.matches;constructor(t,n){super(t,n),this.name=at.TYPE}static sub(t){return bt(`${r}.${t}`)}},js=r=>{if(r==null||typeof r!="object")return!1;const e=r;if(e.discriminator!==Rs)return!1;if(!("type"in e))throw new Error(`X Error is missing its type property: ${JSON.stringify(e)}`);return!0},De="unknown",Ar="nil";class kc{providers=[];register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Ar,data:""};if(js(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:De,data:e.message};if(typeof e=="string")return{type:De,data:e};try{return{type:De,data:JSON.stringify(e)}}catch{return{type:De,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===Ar)return null;if(e.type===De)return new $r(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new $r(e.data)}}const Jr=Ac("synnax-error-registry",()=>new kc),Cc=({encode:r,decode:e})=>Jr().register({encode:r,decode:e}),xc=r=>Jr().encode(r),Rc=r=>r==null?null:Jr().decode(r);let $r=class extends bt("unknown"){};const jc=s.z.object({type:s.z.string(),data:s.z.string()});class Uc extends bt("canceled"){}class Dc extends bt("not_implemented"){}const be=Object.freeze(Object.defineProperty({__proto__:null,Canceled:Uc,NONE:Ar,NotImplemented:Dc,UNKNOWN:De,Unknown:$r,createTyped:bt,decode:Rc,encode:xc,isTyped:js,payloadZ:jc,register:Cc},Symbol.toStringTag,{value:"Module"})),Mc=s.object({jsonrpc:s.literal("2.0"),method:s.string(),params:s.any().optional(),id:s.union([s.string(),s.number(),s.null()]).optional()}),Us=s.object({jsonrpc:s.literal("2.0"),id:s.union([s.string(),s.number(),s.null()])}),Zc=Us.extend({result:s.json()}),Pc=Us.extend({error:s.object({code:s.number().int(),message:s.string().optional(),data:s.json().optional()})}),Lc=s.union([Zc,Pc]);s.union([Mc,Lc]);s.z.string().regex(/^\d+\.\d+\.\d+$/);const Bc=["standard","scientific","engineering"];s.z.enum(Bc);s.z.enum(["success","info","warning","error","loading","disabled"]);let Tt=class extends be.createTyped("freighter"){},K=class extends Tt.sub("eof"){constructor(){super("EOF")}},Ve=class extends Tt.sub("stream_closed"){constructor(){super("StreamClosed")}},Te=class extends Tt.sub("unreachable"){url;constructor(e={}){const{message:t="Unreachable",url:n=uc.UNKNOWN}=e;super(t),this.url=n}};const qc=r=>{if(!r.type.startsWith(Tt.TYPE))return null;if(K.matches(r))return{type:K.TYPE,data:"EOF"};if(Ve.matches(r))return{type:Ve.TYPE,data:"StreamClosed"};if(Te.matches(r))return{type:Te.TYPE,data:"Unreachable"};throw new Error(`Unknown error type: ${r.type}: ${r.message}`)},Fc=r=>{if(!r.type.startsWith(Tt.TYPE))return null;switch(r.type){case K.TYPE:return new K;case Ve.TYPE:return new Ve;case Te.TYPE:return new Te;default:throw new be.Unknown(`Unknown error type: ${r.data}`)}};be.register({encode:qc,decode:Fc});class Ds{middleware=[];use(...e){this.middleware.push(...e)}async executeMiddleware(e,t){let n=0;const a=async i=>{if(n===this.middleware.length)return await t(i);const o=this.middleware[n];return n++,await o(i,a)};return await a(e)}}const Ms="Content-Type",Yc=r=>typeof r.cause=="object"&&r.cause!==null&&"code"in r.cause&&r.cause.code==="ECONNREFUSED",Vc=400;class Wc extends Ds{endpoint;encoder;constructor(e,t,n=!1){return super(),this.endpoint=e.replace({protocol:n?"https":"http"}),this.encoder=t,new Proxy(this,{get:(a,i,o)=>i==="endpoint"?this.endpoint:Reflect.get(a,i,o)})}get headers(){return{[Ms]:this.encoder.contentType}}async send(e,t,n,a){t=n?.parse(t);let i=null;const o=this.endpoint.child(e),c={};c.method="POST",c.body=this.encoder.encode(t??{});const[,l]=await this.executeMiddleware({target:o.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async h=>{const d={...h,params:{}};c.headers={...this.headers,...h.params};let u;try{u=await fetch(h.target,c)}catch(E){if(!(E instanceof Error))throw E;return[d,Yc(E)?new Te({url:o}):E]}const N=await u.arrayBuffer();if(u?.ok)return a!=null&&(i=this.encoder.decode(N,a)),[d,null];try{if(u.status!==Vc)return[d,new Error(u.statusText)];const E=this.encoder.decode(N,be.payloadZ),P=be.decode(E);return[d,P]}catch(E){return[d,new Error(`[freighter] - failed to decode error: ${u.statusText}: ${E.message}`)]}});if(l!=null)return[null,l];if(i==null)throw new Error("Response must be defined");return[i,null]}}const _c=(r,e)=>{class t{wrapped;constructor(a){this.wrapped=a}use(...a){this.wrapped.use(...a)}async send(a,i,o,c){const l=new yc.Breaker(e);do{const[h,d]=await this.wrapped.send(a,i,o,c);if(d==null)return[h,null];if(!Te.matches(d))return[null,d];if(!await l.wait())return[h,d]}while(!0)}}return new t(r)},g=async(r,e,t,n,a)=>{const[i,o]=await r.send(e,t,n,a);if(o!=null)throw o;return i},Hc=s.z.object({type:s.z.enum(["data","close","open"]),payload:s.z.unknown(),error:s.z.optional(be.payloadZ)});class Gc{codec;reqSchema;resSchema;ws;serverClosed;sendClosed;receiveDataQueue=[];receiveCallbacksQueue=[];constructor(e,t,n,a){this.codec=t,this.reqSchema=n,this.resSchema=a,this.ws=e,this.sendClosed=!1,this.serverClosed=null,this.listenForMessages()}async receiveOpenAck(){const e=await this.receiveMsg();if(e.type!=="open"){if(e.error==null)throw new Error("Message error must be defined");return be.decode(e.error)}return null}send(e){if(this.serverClosed!=null)return new K;if(this.sendClosed)throw new Ve;return this.ws.send(this.codec.encode({type:"data",payload:e})),null}async receive(){if(this.serverClosed!=null)return[null,this.serverClosed];const e=await this.receiveMsg();if(e.type==="close"){if(e.error==null)throw new Error("Message error must be defined");if(this.serverClosed=be.decode(e.error),this.serverClosed==null)throw new Error("Message error must be defined");return[null,this.serverClosed]}return[this.resSchema.parse(e.payload),null]}received(){return this.receiveDataQueue.length!==0}closeSend(){if(this.sendClosed||this.serverClosed!=null)return;const e={type:"close"};try{this.ws.send(this.codec.encode(e))}finally{this.sendClosed=!0}}async receiveMsg(){return this.receiveDataQueue.shift()??await new Promise((t,n)=>this.receiveCallbacksQueue.push({resolve:t,reject:n}))}addMessage(e){const t=this.receiveCallbacksQueue.shift();t!=null?t.resolve(e):this.receiveDataQueue.push(e)}listenForMessages(){this.ws.onmessage=this.onMessage.bind(this),this.ws.onclose=this.onClose.bind(this)}onMessage(e){this.addMessage(this.codec.decode(e.data,Hc))}onClose(e){this.addMessage({type:"close",error:{type:e.code===Kc?K.TYPE:Ve.TYPE,data:""}})}}const Jc="freighterctx",Kc=1e3;let Xc=class kr extends Ds{baseUrl;encoder;secure;static MESSAGE_TYPE="arraybuffer";constructor(e,t,n=!1){super(),this.secure=n,this.baseUrl=e.replace({protocol:n?"wss":"ws"}),this.encoder=t}withCodec(e){const t=new kr(this.baseUrl,e,this.secure);return t.use(...this.middleware),t}async stream(e,t,n){let a;const[,i]=await this.executeMiddleware({target:e,protocol:"websocket",params:{},role:"client"},async o=>{const c=new WebSocket(this.buildURL(e,o)),l={...o,params:{}};c.binaryType=kr.MESSAGE_TYPE;const h=await this.wrapSocket(c,t,n);return h instanceof Error?[l,h]:(a=h,[l,null])});if(i!=null)throw i;return a}buildURL(e,t){const n=lc({[Ms]:this.encoder.contentType,...t.params},Jc);return this.baseUrl.child(e).toString()+n}async wrapSocket(e,t,n){return await new Promise(a=>{e.onopen=()=>{const i=new Gc(e,this.encoder,t,n);i.receiveOpenAck().then(o=>{o!=null?a(o):a(i)}).catch(o=>a(o))},e.onerror=i=>{const o=i;a(new Error(o.message))}})}};const Qc=r=>Array.isArray(r)?r:r==null?[]:[r],T=Object.freeze(Object.defineProperty({__proto__:null,toArray:Qc},Symbol.toStringTag,{value:"Module"})),el=r=>{const e=r.replace(/_[a-z]/g,t=>t[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},Kr=r=>{const e=(t,n=Cr)=>{if(typeof t=="string")return r(t);if(Array.isArray(t))return t.map(o=>e(o,n));if(!ur(t))return t;n=sl(n);const a={},i=t;return"toJSON"in i&&typeof i.toJSON=="function"?e(i.toJSON(),n):(Object.keys(i).forEach(o=>{let c=i[o];const l=r(o);n.recursive&&(ur(c)?Dn(c)||(c=e(c,n)):n.recursiveInArray&&Un(c)&&(c=[...c].map(h=>{let d=h;return ur(h)?Dn(d)||(d=e(h,n)):Un(h)&&(d=e({key:h},n).key),d}))),a[l]=c}),a)};return e},Xr=Kr(el),tl=r=>r.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`),Zs=Kr(tl),rl=r=>r.length===0?r:r[0].toUpperCase()+r.slice(1),nl=[Number,String,Uint8Array],Cr={recursive:!0,recursiveInArray:!0},sl=(r=Cr)=>(r.recursive==null?r=Cr:r.recursiveInArray??=!1,r),Un=r=>r!=null&&Array.isArray(r),ur=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),Dn=r=>nl.some(e=>r instanceof e),al=r=>r.replace(/\s+/g,"-").replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}-${n.toLowerCase()}`).toLowerCase(),il=Kr(al),ol=Object.freeze(Object.defineProperty({__proto__:null,camelToSnake:Zs,capitalize:rl,snakeToCamel:Xr,toKebab:il},Symbol.toStringTag,{value:"Module"})),Ps=r=>r!=null&&typeof r=="object"&&!Array.isArray(r);let Ls=class{contentType="application/json";decoder;encoder;constructor(){this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(e){return this.encoder.encode(this.encodeString(e))}decode(e,t){return this.decodeString(this.decoder.decode(e),t)}decodeString(e,t){const n=JSON.parse(e),a=Xr(n);return t!=null?t.parse(a):a}encodeString(e){const t=Zs(e);return JSON.stringify(t,(n,a)=>ArrayBuffer.isView(a)?Array.from(a):typeof a=="bigint"?a.toString():a)}},Bs=class{contentType="text/csv";encode(e){const t=this.encodeString(e);return new TextEncoder().encode(t)}decode(e,t){const n=new TextDecoder().decode(e);return this.decodeString(n,t)}encodeString(e){if(!Array.isArray(e)||e.length===0||!Ps(e[0]))throw new Error("Payload must be an array of objects");const t=Object.keys(e[0]),n=[t.join(",")];return e.forEach(a=>{const i=t.map(o=>JSON.stringify(a[o]??""));n.push(i.join(","))}),n.join(`
|
|
7
|
+
`)}decodeString(e,t){const[n,...a]=e.trim().split(`
|
|
8
|
+
`).map(c=>c.trim());if(n.length===0)return t!=null?t.parse({}):{};const i=n.split(",").map(c=>c.trim()),o={};return i.forEach(c=>{o[c]=[]}),a.forEach(c=>{const l=c.split(",").map(h=>h.trim());i.forEach((h,d)=>{const u=this.parseValue(l[d]);u!=null&&o[h].push(u)})}),t!=null?t.parse(o):o}parseValue(e){if(e==null||e.length===0)return null;const t=Number(e);return isNaN(t)?e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e:t}},qs=class{contentType="text/plain";encode(e){if(typeof e!="string")throw new Error("TextCodec.encode payload must be a string");return new TextEncoder().encode(e)}decode(e,t){const n=new TextDecoder().decode(e);return t!=null?t.parse(n):n}};const lt=new Ls,cl=new Bs,ll=new qs,ul=[lt],$e=Object.freeze(Object.defineProperty({__proto__:null,CSVCodec:Bs,CSV_CODEC:cl,ENCODERS:ul,JSONCodec:Ls,JSON_CODEC:lt,TEXT_CODEC:ll,TextCodec:qs},Symbol.toStringTag,{value:"Module"})),xr=r=>[...new Set(r)],hl=(r,e,t=!0)=>{const n=new Map;return r.forEach(a=>{const i=e(a);if(n.has(i)){if(t)return;n.delete(i)}n.set(i,a)}),Array.from(n.values())},Mn=Object.freeze(Object.defineProperty({__proto__:null,by:hl,unique:xr},Symbol.toStringTag,{value:"Module"}));let He=class{value;constructor(e){this.value=e}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const dl=r=>r!=null&&typeof r=="object"&&"toString"in r,Wt=(r,e=!1)=>{const t=dl(r)?"stringer":typeof r;let n;switch(t){case"string":n=(a,i)=>a.localeCompare(i);break;case"stringer":n=(a,i)=>a.toString().localeCompare(i.toString());break;case"number":n=(a,i)=>Number(a)-Number(i);break;case"bigint":n=(a,i)=>BigInt(a)-BigInt(i)>0n?1:-1;break;case"boolean":n=(a,i)=>Number(a)-Number(i);break;case"undefined":n=()=>0;break;default:return console.warn(`sortFunc: unknown type ${t}`),()=>-1}return e?Ys(n):n},fl=(r,e,t)=>{const n=Wt(e[r],t);return(a,i)=>n(a[r],i[r])},yl=(r,e)=>r.length!==e.length?r.length-e.length:r.every((t,n)=>t===e[n])?0:-1,Fs=(r,e)=>{if(r.length!==e.length)return r.length-e.length;if(r.length===0)return 0;const t=Wt(r[0]),n=[...r].sort(t),a=[...e].sort(t);return n.every((i,o)=>i===a[o])?0:-1},gl=(r,e)=>{const t=xr(r),n=xr(e);return Fs(t,n)},pl=(r,e)=>r===e?0:r==="first"&&e==="last"?1:-1,Ys=r=>(e,t)=>r(t,e),Ge=0,Mt=-1,Zt=1,Vs=r=>r<Ge,Ws=r=>r>Ge,ml=r=>r>=Ge,_s=r=>r===Ge,wl=(r,e)=>{const t=/([a-zA-Z]+)|(\d+)/g,n=r.replace(/[\s_.-]+/g,"").match(t),a=e.replace(/[\s_.-]+/g,"").match(t);if(!n||!a)return 0;for(let i=0;i<Math.min(n.length,a.length);i++){const o=n[i],c=a[i];if(isNaN(Number(o))&&isNaN(Number(c))){const l=o.localeCompare(c);if(l!==0)return l}else if(!isNaN(Number(o))&&!isNaN(Number(c))){const l=Number(o)-Number(c);if(l!==0)return l}else return isNaN(Number(o))?-1:1}return n.length-a.length},Zn=Object.freeze(Object.defineProperty({__proto__:null,EQUAL:Ge,GREATER_THAN:Zt,LESS_THAN:Mt,isEqualTo:_s,isGreaterThan:Ws,isGreaterThanEqual:ml,isLessThan:Vs,newF:Wt,newFieldF:fl,order:pl,primitiveArrays:yl,reverseF:Ys,stringsWithNumbers:wl,uniqueUnorderedPrimitiveArrays:gl,unorderedPrimitiveArrays:Fs},Symbol.toStringTag,{value:"Module"})),_t=s.z.tuple([s.z.number(),s.z.number()]);s.z.tuple([s.z.bigint(),s.z.bigint()]);const Hs=s.z.object({width:s.z.number(),height:s.z.number()}),bl=s.z.object({signedWidth:s.z.number(),signedHeight:s.z.number()}),Tl=["width","height"];s.z.enum(Tl);const vl=["start","center","end"],El=["signedWidth","signedHeight"];s.z.enum(El);const qt=s.z.object({x:s.z.number(),y:s.z.number()}),Ol=s.z.object({clientX:s.z.number(),clientY:s.z.number()}),Nl=["x","y"],Gs=s.z.enum(Nl),Js=["top","right","bottom","left"];s.z.enum(Js);const zl=["left","right"],Ks=s.z.enum(zl),Sl=["top","bottom"],Xs=s.z.enum(Sl),Qs=["center"],Pn=s.z.enum(Qs),Il=[...Js,...Qs],ea=s.z.enum(Il);s.z.enum(vl);const Al=["first","last"];s.z.enum(Al);const $l=s.z.object({lower:s.z.number(),upper:s.z.number()}),kl=s.z.object({lower:s.z.bigint(),upper:s.z.bigint()});s.z.union([$l,_t]);s.z.union([kl,_t]);s.z.enum([...Gs.options,...ea.options]);s.z.union([Gs,ea,s.z.instanceof(String)]);const hr=(r,e)=>typeof r=="bigint"?r-BigInt(e):r-Number(e),Cl=(r,e)=>typeof r=="bigint"?r+BigInt(e):r+Number(e),Ln=(r,e)=>typeof r=="bigint"?r===BigInt(e):r===Number(e),xl=(r,e)=>r<=e?r:typeof r=="bigint"?r<=e?r:BigInt(e):r<=e?r:Number(e),Rl=r=>r<0?-r:r,Re=(r,e)=>typeof r=="bigint"?r*BigInt(e):r*Number(e),V=(r,e,t)=>{const n={};if(typeof e=="object"&&(t=e,e=void 0),t={makeValid:!0,...t},typeof r=="number"||typeof r=="bigint")e!=null?(n.lower=r,n.upper=e):(n.lower=typeof r=="bigint"?0n:0,n.upper=r);else if(Array.isArray(r)){if(r.length!==2)throw new Error("bounds: expected array of length 2");[n.lower,n.upper]=r}else n.lower=r.lower,n.upper=r.upper;return t?.makeValid?jl(n):n},jl=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r,Bn=(r,e)=>{const t=V(r);return e<t.lower?t.lower:e>=t.upper?t.upper-(typeof t.upper=="number"?1:1n):e},xt=(r,e)=>{const t=V(r);if(typeof e=="number"||typeof e=="bigint")return e>=t.lower&&e<t.upper;const n=V(e);return n.lower>=t.lower&&n.upper<=t.upper},Ul=r=>({lower:Math.min(...r.map(e=>V(e).lower)),upper:Math.max(...r.map(e=>V(e).upper))}),Dl=(r,e,t)=>{const n=r.map(c=>V(c)),a=t>0?1:t<0?-1:0;if(a===0)return e;let i=t,o=e;for(;Ln(i,0)===!1;){const c=n.findIndex(l=>a>0?o>=l.lower&&o<l.upper:o>l.lower&&o<=l.upper);if(c!==-1){const l=n[c];let h;if(a>0?h=hr(l.upper,o):h=hr(o,l.lower),h>0){const d=xl(Rl(i),h);if(o=Cl(o,a>0?d:-d),i=hr(i,a>0?d:-d),Ln(i,0))return o;continue}}if(a>0){const l=n.filter(h=>h.lower>o);if(l.length>0)o=l[0].lower;else return o}else{const l=n.filter(h=>h.upper<o);if(l.length>0)o=l[l.length-1].upper;else return o}}return o},Ml=(r,e,t)=>{const n=r.map(o=>V(o));if(e===t)return typeof e=="bigint"?0n:0;const a=e<t?V([e,t]):V([t,e]);let i=typeof e=="bigint"?0n:0;for(const o of n){const c=o.lower>a.lower?o.lower:a.lower,l=o.upper<a.upper?o.upper:a.upper;if(c<l){const h=l-c;i=i+h}}return i};s.z.object({x:Ks.or(Pn),y:Xs.or(Pn)});const Zl=s.z.object({x:Ks,y:Xs}),Pl=Object.freeze({x:"left",y:"top"}),Ll=(r,e)=>r.x===e.x&&r.y===e.y,qn=s.z.union([s.z.number(),qt,_t,Hs,bl,Ol]),Bl=(r,e)=>{if(typeof r=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return r==="x"?{x:e,y:0}:{x:0,y:e}}return typeof r=="number"?{x:r,y:e??r}:Array.isArray(r)?{x:r[0],y:r[1]}:"signedWidth"in r?{x:r.signedWidth,y:r.signedHeight}:"clientX"in r?{x:r.clientX,y:r.clientY}:"width"in r?{x:r.width,y:r.height}:{x:r.x,y:r.y}},Fn=Object.freeze({x:0,y:0}),Rt=s.z.union([s.z.number(),s.z.string()]);s.z.object({top:Rt,left:Rt,width:Rt,height:Rt});s.z.object({left:s.z.number(),top:s.z.number(),right:s.z.number(),bottom:s.z.number()});s.z.object({one:qt,two:qt,root:Zl});const Qr=(r,e,t=0,n=0,a)=>{const i={one:{...Fn},two:{...Fn},root:a??Pl};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return i.one={x:r,y:e},i.two={x:i.one.x+t,y:i.one.y+n},i}return"one"in r&&"two"in r&&"root"in r?{...r,root:a??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(i.one={x:r.left,y:r.top},i.two={x:r.right,y:r.bottom},i):(i.one=r,e==null?i.two={x:i.one.x+t,y:i.one.y+n}:typeof e=="number"?i.two={x:i.one.x+e,y:i.one.y+t}:"width"in e?i.two={x:i.one.x+e.width,y:i.one.y+e.height}:"signedWidth"in e?i.two={x:i.one.x+e.signedWidth,y:i.one.y+e.signedHeight}:i.two=e,i))},dr=r=>{const e=Qr(r);return{lower:e.one.x,upper:e.two.x}},fr=r=>{const e=Qr(r);return{lower:e.one.y,upper:e.two.y}},ql=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Fl=s.z.object({signedWidth:s.z.number(),signedHeight:s.z.number()});s.z.union([Hs,Fl,qt,_t]);const Yl=(r,e,t)=>e!==void 0&&r<e?e:t!==void 0&&r>t?t:r;s.z.object({offset:qn,scale:qn});s.z.object({offset:s.z.number(),scale:s.z.number()});const Vl=r=>(e,t,n,a)=>t==="dimension"?[e,n]:[e,a?n-r:n+r],Wl=r=>(e,t,n,a)=>[e,a?n/r:n*r],_l=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:a,upper:i}=e,{lower:o,upper:c}=r,l=i-a,h=c-o;if(t==="dimension")return[r,n*(h/l)];const d=(n-a)*(h/l)+o;return[r,d]},Hl=r=>(e,t,n)=>[r,n],Gl=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:a}=r;return[r,a-(t-n)]},Jl=r=>(e,t,n)=>{const{lower:a,upper:i}=r;return n=Yl(n,a,i),[e,n]};let Yn=class Me{ops=[];currBounds=null;currType=null;reversed=!1;constructor(){this.ops=[]}static translate(e){return new Me().translate(e)}static magnify(e){return new Me().magnify(e)}static scale(e,t){return new Me().scale(e,t)}translate(e){const t=this.new(),n=Vl(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Wl(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=V(e,t),a=this.new(),i=_l(n);return i.type="scale",a.ops.push(i),a}clamp(e,t){const n=V(e,t),a=this.new(),i=Jl(n);return i.type="clamp",a.ops.push(i),a}reBound(e,t){const n=V(e,t),a=this.new(),i=Hl(n);return i.type="re-bound",a.ops.push(i),a}invert(){const e=Gl();e.type="invert";const t=this.new();return t.ops.push(e),t}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new Me;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,a],i)=>i(n,e,a,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,a)=>{if(n.type==="scale"||t.some(([o,c])=>a>=o&&a<=c))return;const i=e.ops.findIndex((o,c)=>o.type==="scale"&&c>a);i!==-1&&t.push([a,i])}),t.forEach(([n,a])=>{const i=e.ops.slice(n,a);i.unshift(e.ops[a]),e.ops.splice(n,a-n+1,...i)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}static IDENTITY=new Me},Um=class te{x;y;currRoot;constructor(e=new Yn,t=new Yn,n=null){this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new te().translate(e,t)}static translateX(e){return new te().translateX(e)}static translateY(e){return new te().translateY(e)}static clamp(e){return new te().clamp(e)}static magnify(e){return new te().magnify(e)}static scale(e){return new te().scale(e)}static reBound(e){return new te().reBound(e)}translate(e,t){const n=Bl(e,t),a=this.copy();return a.x=this.x.translate(n.x),a.y=this.y.translate(n.y),a}translateX(e){const t=this.copy();return t.x=this.x.translate(e),t}translateY(e){const t=this.copy();return t.y=this.y.translate(e),t}magnify(e){const t=this.copy();return t.x=this.x.magnify(e.x),t.y=this.y.magnify(e.y),t}scale(e){const t=this.copy();if(ql(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Ll(n,e.root)&&(n.x!==e.root.x&&(t.x=t.x.invert()),n.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(dr(e)),t.y=t.y.scale(fr(e)),t}return t.x=t.x.scale(e.width),t.y=t.y.scale(e.height),t}reBound(e){const t=this.copy();return t.x=this.x.reBound(dr(e)),t.y=this.y.reBound(fr(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(dr(e)),t.y=this.y.clamp(fr(e)),t}copy(){const e=new te;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return Qr(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}static IDENTITY=new te},Kl=(r,e=21)=>(t=e)=>{let n="",a=t|0;for(;a--;)n+=r[Math.random()*r.length|0];return n};const Xl="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ta=11,Ql=Kl(Xl,ta),en=()=>Ql(),eu=Object.freeze(Object.defineProperty({__proto__:null,LENGTH:ta,create:en},Symbol.toStringTag,{value:"Module"})),tu=(r,e)=>t=>t instanceof e||typeof t=="object"&&t!==null&&"discriminator"in t&&t.discriminator===r,ru=s.z.enum(["static","dynamic"]),nu=s.z.union([s.z.tuple([s.z.int()]),s.z.tuple([s.z.int(),s.z.int().min(1).max(12)]),s.z.tuple([s.z.int(),s.z.int().min(1).max(12),s.z.int().min(1).max(31)])]),ra=(r,e)=>{const t=new O(e);if(![v.DAY,v.HOUR,v.MINUTE,v.SECOND,v.MILLISECOND,v.MICROSECOND,v.NANOSECOND].some(a=>a.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof O?new O(n):new v(n)};let O=class m extends He{constructor(e,t="UTC"){if(e==null)super(m.now().valueOf());else if(e instanceof Date)super(BigInt(e.getTime())*m.MILLISECOND.valueOf());else if(typeof e=="string")super(m.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(m.parseDate(e));else{let n=0n;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=m.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=m.MAX:e=m.MIN)),super(BigInt(e.valueOf())+n)}}static parseDate([e=1970,t=1,n=1]){const a=new Date(e,t-1,n,0,0,0,0);return new m(BigInt(a.getTime())*m.MILLISECOND.valueOf()).truncate(m.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[n,a,i]=e.split(":");let o="00",c="00";i!=null&&([o,c]=i.split("."));let l=m.hours(parseInt(n??"00")).add(m.minutes(parseInt(a??"00"))).add(m.seconds(parseInt(o??"00"))).add(m.milliseconds(parseInt(c??"00")));return t==="local"&&(l=l.add(m.utcOffset)),l.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return m.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new m(BigInt(n.getTime())*m.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(m.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(){const e=this.date(),t=e.toLocaleString("default",{month:"short"}),n=e.toLocaleString("default",{day:"numeric"});return`${t} ${n}`}static get utcOffset(){return new v(BigInt(new Date().getTimezoneOffset())*m.MINUTE.valueOf())}static since(e){return new m().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new m(e).valueOf()}span(e){return this.range(e).span}range(e){return new z(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0n}after(e){return this.valueOf()>new m(e).valueOf()}afterEq(e){return this.valueOf()>=new m(e).valueOf()}before(e){return this.valueOf()<new m(e).valueOf()}beforeEq(e){return this.valueOf()<=new m(e).valueOf()}add(e){return new m(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new m(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(v.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(v.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(v.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(v.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(m.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(m.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}setYear(e){const t=this.date();return t.setUTCFullYear(e),new m(t)}get month(){return this.date().getUTCMonth()}setMonth(e){const t=this.date();return t.setUTCMonth(e),new m(t)}get day(){return this.date().getUTCDate()}setDay(e){const t=this.date();return t.setUTCDate(e),new m(t)}get hour(){return this.date().getUTCHours()}setHour(e){const t=this.date();return t.setUTCHours(e),new m(t,"UTC")}get minute(){return this.date().getUTCMinutes()}setMinute(e){const t=this.date();return t.setUTCMinutes(e),new m(t)}get second(){return this.date().getUTCSeconds()}setSecond(e){const t=this.date();return t.setUTCSeconds(e),new m(t)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(e){const t=this.date();return t.setUTCMilliseconds(e),new m(t)}toString(){return this.date().toISOString()}remainder(e){return ra(this,e)}get isToday(){return this.truncate(v.DAY).equals(m.now().truncate(v.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new m(new Date)}static max(...e){let t=m.MIN;for(const n of e){const a=new m(n);a.after(t)&&(t=a)}return t}static min(...e){let t=m.MAX;for(const n of e){const a=new m(n);a.before(t)&&(t=a)}return t}static nanoseconds(e,t="UTC"){return new m(e,t)}static NANOSECOND=m.nanoseconds(1);static microseconds(e,t="UTC"){return m.nanoseconds(e*1e3,t)}static MICROSECOND=m.microseconds(1);static milliseconds(e,t="UTC"){return m.microseconds(e*1e3,t)}static MILLISECOND=m.milliseconds(1);static seconds(e,t="UTC"){return m.milliseconds(e*1e3,t)}static SECOND=m.seconds(1);static minutes(e,t="UTC"){return m.seconds(e*60,t)}static MINUTE=m.minutes(1);static hours(e,t="UTC"){return m.minutes(e*60,t)}static HOUR=m.hours(1);static days(e,t="UTC"){return m.hours(e*24,t)}static DAY=m.days(1);static MAX=new m((1n<<63n)-1n);static MIN=new m(0);static ZERO=new m(0);static z=s.z.union([s.z.instanceof(m),s.z.object({value:s.z.bigint()}).transform(e=>new m(e.value)),s.z.string().transform(e=>new m(BigInt(e))),s.z.number().transform(e=>new m(e)),s.z.bigint().transform(e=>new m(e)),s.z.date().transform(e=>new m(e)),s.z.custom(e=>e instanceof v).transform(e=>new m(e)),nu.transform(e=>new m(e))]);static sort(e,t){return Number(e.valueOf()-t.valueOf())}},v=class b extends He{constructor(e){typeof e=="number"&&(e=Math.trunc(e.valueOf())),super(BigInt(e.valueOf()))}static fromSeconds(e){return e instanceof b?e:e instanceof Rr?e.period:e instanceof O?new b(e):["number","bigint"].includes(typeof e)?b.seconds(e):new b(e)}static fromMilliseconds(e){return e instanceof b?e:e instanceof Rr?e.period:e instanceof O?new b(e):["number","bigint"].includes(typeof e)?b.milliseconds(e):new b(e)}valueOf(){return this.value}lessThan(e){return this.valueOf()<new b(e).valueOf()}greaterThan(e){return this.valueOf()>new b(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new b(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new b(e).valueOf()}remainder(e){return ra(this,e)}truncate(e){return new b(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(b.DAY),t=this.truncate(b.HOUR),n=this.truncate(b.MINUTE),a=this.truncate(b.SECOND),i=this.truncate(b.MILLISECOND),o=this.truncate(b.MICROSECOND),c=this.truncate(b.NANOSECOND),l=e,h=t.sub(e),d=n.sub(t),u=a.sub(n),N=i.sub(a),E=o.sub(i),P=c.sub(o);let k="";return l.isZero||(k+=`${l.days}d `),h.isZero||(k+=`${h.hours}h `),d.isZero||(k+=`${d.minutes}m `),u.isZero||(k+=`${u.seconds}s `),N.isZero||(k+=`${N.milliseconds}ms `),E.isZero||(k+=`${E.microseconds}µs `),P.isZero||(k+=`${P.nanoseconds}ns`),k.trim()}mult(e){return new b(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(b.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(b.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(b.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(b.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(b.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(b.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===0n}equals(e){return this.valueOf()===new b(e).valueOf()}add(e){return new b(this.valueOf()+new b(e).valueOf())}sub(e){return new b(this.valueOf()-new b(e).valueOf())}static nanoseconds(e=1){return new b(e)}static NANOSECOND=b.nanoseconds(1);static microseconds(e=1){return b.nanoseconds(Re(e,1e3))}static MICROSECOND=b.microseconds(1);static milliseconds(e=1){return b.microseconds(Re(e,1e3))}static MILLISECOND=b.milliseconds(1);static seconds(e=1){return b.milliseconds(Re(e,1e3))}static SECOND=b.seconds(1);static minutes(e=1){return b.seconds(Re(e,60))}static MINUTE=b.minutes(1);static hours(e){return b.minutes(Re(e,60))}static HOUR=b.hours(1);static days(e){return b.hours(Re(e,24))}static DAY=b.days(1);static MAX=new b((1n<<63n)-1n);static MIN=new b(0);static ZERO=new b(0);static z=s.z.union([s.z.object({value:s.z.bigint()}).transform(e=>new b(e.value)),s.z.string().transform(e=>new b(BigInt(e))),s.z.number().transform(e=>new b(e)),s.z.instanceof(b)])},Rr=class Ze extends He{constructor(e){super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Ze(e).valueOf()}get period(){return v.seconds(1/this.valueOf())}sampleCount(e){return new v(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new W(t).valueOf()}span(e){return v.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Ze(e)}static khz(e){return Ze.hz(e*1e3)}static z=s.z.union([s.z.number().transform(e=>new Ze(e)),s.z.instanceof(Ze)])},W=class oe extends He{constructor(e){super(e.valueOf())}length(e){return e.valueOf()/this.valueOf()}size(e){return new S(e*this.valueOf())}static UNKNOWN=new oe(0);static BIT128=new oe(16);static BIT64=new oe(8);static BIT32=new oe(4);static BIT16=new oe(2);static BIT8=new oe(1);static z=s.z.union([s.z.number().transform(e=>new oe(e)),s.z.instanceof(oe)])};class z{start;end;constructor(e,t){typeof e=="object"&&"start"in e?(this.start=new O(e.start),this.end=new O(e.end)):(this.start=new O(e),this.end=new O(t))}get span(){return new v(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new z(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,t=v.ZERO){if(t.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let n=this.start.sub(e.start).valueOf(),a=this.end.sub(e.end).valueOf();return n<0&&(n=-n),a<0&&(a=-a),n<=t.valueOf()&&a<=t.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,t=v.ZERO){e=e.makeValid();const n=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(n.start)||n.end.equals(e.start))return!1;const a=O.max(n.start,e.start),i=O.min(n.end,e.end);return i.before(a)?!1:new v(i.sub(a)).greaterThanOrEqual(t)}contains(e){return e instanceof z?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new z(this.start,this.end);return e.start.after(this.start)&&(t.start=e.start),e.start.after(this.end)&&(t.end=e.start),e.end.before(this.end)&&(t.end=e.end),e.end.before(this.start)&&(t.start=e.end),t}static max(...e){return new z(O.min(...e.map(t=>t.start)),O.max(...e.map(t=>t.end)))}static MAX=new z(O.MIN,O.MAX);static MIN=new z(O.MAX,O.MIN);static ZERO=new z(O.ZERO,O.ZERO);static z=s.z.union([s.z.object({start:O.z,end:O.z}).transform(e=>new z(e.start,e.end)),s.z.instanceof(z)]);static sort(e,t){return O.sort(e.start,t.start)||O.sort(e.end,t.end)}}let I=class y extends He{constructor(e){if(e instanceof y||typeof e=="string"||typeof e.valueOf()=="string")super(e.valueOf());else{const t=y.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t==null)throw new Error(`unable to find data type for ${e.toString()}`);super(t.valueOf())}}get Array(){const e=y.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(t=>this.equals(t))}toString(){return this.valueOf()}get isVariable(){return this.equals(y.JSON)||this.equals(y.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(y.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=y.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsignedInteger(){return this.equals(y.UINT8)||this.equals(y.UINT16)||this.equals(y.UINT32)||this.equals(y.UINT64)}get isSignedInteger(){return this.equals(y.INT8)||this.equals(y.INT16)||this.equals(y.INT32)||this.equals(y.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsignedInteger&&e.isSignedInteger?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(y.INT32)&&e.equals(y.FLOAT64)||this.equals(y.INT8)&&e.equals(y.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsignedInteger===e.isUnsignedInteger:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}get usesBigInt(){return y.BIG_INT_TYPES.some(e=>e.equals(this))}static UNKNOWN=new y("unknown");static FLOAT64=new y("float64");static FLOAT32=new y("float32");static INT64=new y("int64");static INT32=new y("int32");static INT16=new y("int16");static INT8=new y("int8");static UINT64=new y("uint64");static UINT32=new y("uint32");static UINT16=new y("uint16");static UINT8=new y("uint8");static BOOLEAN=this.UINT8;static TIMESTAMP=new y("timestamp");static UUID=new y("uuid");static STRING=new y("string");static JSON=new y("json");static ARRAY_CONSTRUCTORS=new Map([[y.UINT8.toString(),Uint8Array],[y.UINT16.toString(),Uint16Array],[y.UINT32.toString(),Uint32Array],[y.UINT64.toString(),BigUint64Array],[y.FLOAT32.toString(),Float32Array],[y.FLOAT64.toString(),Float64Array],[y.INT8.toString(),Int8Array],[y.INT16.toString(),Int16Array],[y.INT32.toString(),Int32Array],[y.INT64.toString(),BigInt64Array],[y.TIMESTAMP.toString(),BigInt64Array],[y.STRING.toString(),Uint8Array],[y.JSON.toString(),Uint8Array],[y.UUID.toString(),Uint8Array]]);static ARRAY_CONSTRUCTOR_DATA_TYPES=new Map([[Uint8Array.name,y.UINT8],[Uint16Array.name,y.UINT16],[Uint32Array.name,y.UINT32],[BigUint64Array.name,y.UINT64],[Float32Array.name,y.FLOAT32],[Float64Array.name,y.FLOAT64],[Int8Array.name,y.INT8],[Int16Array.name,y.INT16],[Int32Array.name,y.INT32],[BigInt64Array.name,y.INT64]]);static DENSITIES=new Map([[y.UINT8.toString(),W.BIT8],[y.UINT16.toString(),W.BIT16],[y.UINT32.toString(),W.BIT32],[y.UINT64.toString(),W.BIT64],[y.FLOAT32.toString(),W.BIT32],[y.FLOAT64.toString(),W.BIT64],[y.INT8.toString(),W.BIT8],[y.INT16.toString(),W.BIT16],[y.INT32.toString(),W.BIT32],[y.INT64.toString(),W.BIT64],[y.TIMESTAMP.toString(),W.BIT64],[y.STRING.toString(),W.UNKNOWN],[y.JSON.toString(),W.UNKNOWN],[y.UUID.toString(),W.BIT128]]);static ALL=[y.UNKNOWN,y.FLOAT64,y.FLOAT32,y.INT64,y.INT32,y.INT16,y.INT8,y.UINT64,y.UINT32,y.UINT16,y.UINT8,y.TIMESTAMP,y.UUID,y.STRING,y.JSON];static BIG_INT_TYPES=[y.INT64,y.UINT64,y.TIMESTAMP];static z=s.z.union([s.z.string().transform(e=>new y(e)),s.z.instanceof(y)])};class S extends He{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return S.bytes(this.valueOf()+e.valueOf())}sub(e){return S.bytes(this.valueOf()-e.valueOf())}truncate(e){return new S(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return S.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/S.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/S.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/S.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/S.TERABYTE.valueOf()}toString(){const e=this.truncate(S.TERABYTE),t=this.truncate(S.GIGABYTE),n=this.truncate(S.MEGABYTE),a=this.truncate(S.KILOBYTE),i=this.truncate(S.BYTE),o=e,c=t.sub(e),l=n.sub(t),h=a.sub(n),d=i.sub(a);let u="";return o.isZero||(u+=`${o.terabytes}TB `),c.isZero||(u+=`${c.gigabytes}GB `),l.isZero||(u+=`${l.megabytes}MB `),h.isZero||(u+=`${h.kilobytes}KB `),(!d.isZero||u==="")&&(u+=`${d.valueOf()}B`),u.trim()}static bytes(e=1){return new S(e)}static BYTE=new S(1);static kilobytes(e=1){return S.bytes(e.valueOf()*1e3)}static KILOBYTE=S.kilobytes(1);static megabytes(e=1){return S.kilobytes(e.valueOf()*1e3)}static MEGABYTE=S.megabytes(1);static gigabytes(e=1){return S.megabytes(e.valueOf()*1e3)}static GIGABYTE=S.gigabytes(1);static terabytes(e){return S.gigabytes(e.valueOf()*1e3)}static TERABYTE=S.terabytes(1);static ZERO=new S(0);static z=s.z.union([s.z.number().transform(e=>new S(e)),s.z.instanceof(S)]);get isZero(){return this.valueOf()===0}}s.z.union([s.z.instanceof(Uint8Array),s.z.instanceof(Uint16Array),s.z.instanceof(Uint32Array),s.z.instanceof(BigUint64Array),s.z.instanceof(Float32Array),s.z.instanceof(Float64Array),s.z.instanceof(Int8Array),s.z.instanceof(Int16Array),s.z.instanceof(Int32Array),s.z.instanceof(BigInt64Array)]);const na=r=>{const e=typeof r;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||r instanceof O||r instanceof v||r instanceof Date},su=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t.valueOf())-BigInt(n.valueOf()):Pt(t,-n),Pt=(r,e)=>e==0?r:r==0?e:typeof r=="bigint"&&typeof e=="bigint"||typeof r=="number"&&typeof e=="number"?r+e:Number(r)+Number(e),au=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function iu(r){return typeof r=="string"&&au.test(r)}const F=[];for(let r=0;r<256;++r)F.push((r+256).toString(16).slice(1));function ou(r,e=0){return(F[r[e+0]]+F[r[e+1]]+F[r[e+2]]+F[r[e+3]]+"-"+F[r[e+4]]+F[r[e+5]]+"-"+F[r[e+6]]+F[r[e+7]]+"-"+F[r[e+8]]+F[r[e+9]]+"-"+F[r[e+10]]+F[r[e+11]]+F[r[e+12]]+F[r[e+13]]+F[r[e+14]]+F[r[e+15]]).toLowerCase()}function cu(r,e=0){const t=ou(r,e);if(!iu(t))throw TypeError("Stringified UUID is invalid");return t}typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const sa=(r,e)=>cu(r,e),ge=-1,jr={[Symbol.iterator]:()=>jr,next:()=>({done:!0,value:void 0})},lu=s.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer),uu=s.z.union([s.z.null(),s.z.undefined()]).transform(()=>new Uint8Array().buffer),Ur=10,aa=(r,e)=>{if(r==="number"&&!e.isNumeric)throw new Error(`cannot convert series of type ${e.toString()} to number`);if(r==="bigint"&&!e.usesBigInt)throw new Error(`cannot convert series of type ${e.toString()} to bigint`)},ia="sy_x_telem_series";class Y{key;discriminator=ia;dataType;sampleOffset;gl;_data;timeRange=z.ZERO;alignment=0n;cachedMin;cachedMax;writePos=ge;_refCount=0;cachedLength;_cachedIndexes;static crudeZ=s.z.object({timeRange:z.z.optional(),dataType:I.z,alignment:s.z.coerce.bigint().optional(),data:s.z.union([lu,uu,s.z.instanceof(ArrayBuffer),s.z.instanceof(Uint8Array)]),glBufferUsage:ru.optional().default("static").optional()});static z=Y.crudeZ.transform(e=>new Y(e));constructor(e){hu(e)&&(e={data:e}),e.data??=[];const{dataType:t,timeRange:n,sampleOffset:a=0,glBufferUsage:i="static",alignment:o=0n,key:c=en(),data:l}=e;if(oa(l)){const u=l;this.key=u.key,this.dataType=u.dataType,this.sampleOffset=u.sampleOffset,this.gl=u.gl,this._data=u._data,this.timeRange=u.timeRange,this.alignment=u.alignment,this.cachedMin=u.cachedMin,this.cachedMax=u.cachedMax,this.writePos=u.writePos,this._refCount=u._refCount,this.cachedLength=u.cachedLength;return}const h=na(l),d=Array.isArray(l);if(t!=null)this.dataType=new I(t);else{if(l instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(d||h){let u=l;if(!h){if(l.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");u=l[0]}if(typeof u=="string")this.dataType=I.STRING;else if(typeof u=="number")this.dataType=I.FLOAT64;else if(typeof u=="bigint")this.dataType=I.INT64;else if(typeof u=="boolean")this.dataType=I.BOOLEAN;else if(u instanceof O||u instanceof Date||u instanceof O)this.dataType=I.TIMESTAMP;else if(typeof u=="object")this.dataType=I.JSON;else throw new Error(`cannot infer data type of ${typeof u} when constructing a Series from a JS array`)}else this.dataType=new I(l)}if(!d&&!h)this._data=l;else if(d&&l.length===0)this._data=new this.dataType.Array([]).buffer;else{let u=h?[l]:l;const N=u[0];(N instanceof O||N instanceof Date||N instanceof v)&&(u=u.map(E=>new O(E).valueOf())),this.dataType.equals(I.STRING)?(this.cachedLength=u.length,this._data=new TextEncoder().encode(`${u.join(`
|
|
67
9
|
`)}
|
|
68
|
-
`).buffer):this.dataType.equals(
|
|
10
|
+
`).buffer):this.dataType.equals(I.JSON)?(this.cachedLength=u.length,this._data=new TextEncoder().encode(`${u.map(E=>lt.encodeString(E)).join(`
|
|
69
11
|
`)}
|
|
70
|
-
`).buffer):this.dataType.usesBigInt&&typeof
|
|
71
|
-
`).slice(0,-1):Array.from(this).map(e=>e.toString())}toUUIDs(){if(!this.dataType.equals(je.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=je.UUID.density.valueOf(),r=new Uint8Array(this.underlyingData.buffer);return Array.from({length:this.length},(i,n)=>cZ(r,n*e))}parseJSON(e){if(!this.dataType.equals(je.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.toStrings().map(r=>e.parse(Vo.decodeString(r)))}get byteCapacity(){return new Ho(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===Kt?this.byteCapacity:this.dataType.isVariable?new Ho(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength!=null?this.cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===Kt?this.byteCapacity.valueOf()/this.dataType.density.valueOf():this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const r=[0];return this.data.forEach((i,n)=>{i===Qo&&(e++,r.push(n+1))}),this._cachedIndexes=r,this.cachedLength=e,e}convert(e,r=0){if(this.dataType.equals(e))return this;const i=new e.Array(this.length);for(let n=0;n<this.length;n++)i[n]=iZ(this.dataType,e,this.data[n],r);return new Vn({data:i.buffer,dataType:e,timeRange:this.timeRange,sampleOffset:r,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(je.TIMESTAMP))this.cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMax=e.reduce((r,i)=>r>i?r:i)}else{const e=this.data;this.cachedMax=e.reduce((r,i)=>r>i?r:i)}return this.cachedMax}get max(){return this.calcMax()}calcMax(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this.cachedMax??(this.cachedMax=this.calcRawMax()),$s(this.cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(je.TIMESTAMP))this.cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMin=e.reduce((r,i)=>r<i?r:i)}else{const e=this.data;this.cachedMin=e.reduce((r,i)=>r<i?r:i)}return this.cachedMin}get min(){return this.calcMin()}calcMin(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this.cachedMin??(this.cachedMin=this.calcRawMin()),$s(this.cachedMin,this.sampleOffset))}get bounds(){return hn(Number(this.min),Number(this.max),{makeValid:!1})}maybeRecomputeMinMax(e){if(this.cachedMin!=null){const r=e.cachedMin??e.calcRawMin();r<this.cachedMin&&(this.cachedMin=r)}if(this.cachedMax!=null){const r=e.cachedMax??e.calcRawMax();r>this.cachedMax&&(this.cachedMax=r)}}atAlignment(e,r){const i=Number(e-this.alignment);if(i<0||i>=this.length){if(r===!0)throw new Error(`[series] - no value at index ${i}`);return}return this.at(i,r)}at(e,r){if(this.dataType.isVariable)return this.atVariable(e,r??!1);e<0&&(e=this.length+e);const i=this.data[e];if(i==null){if(r===!0)throw new Error(`[series] - no value at index ${e}`);return}return $s(i,this.sampleOffset)}atVariable(e,r){let i=0,n=0;if(this._cachedIndexes!=null)i=this._cachedIndexes[e],n=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let a=0;a<this.data.length;a++)if(this.data[a]===Qo){if(e===0){n=a;break}i=a+1,e--}if(n===0&&(n=this.data.length),i>=n||e>0){if(r)throw new Error(`[series] - no value at index ${e}`);return}}const s=this.data.slice(i,n);return this.dataType.equals(je.STRING)?new TextDecoder().decode(s):E$(JSON.parse(new TextDecoder().decode(s)))}binarySearch(e){let r=0,i=this.length-1;const n=TE(e);for(;r<=i;){const s=Math.floor((r+i)/2),a=n(this.at(s,!0),e);if(a===0)return s;a<0?r=s+1:i=s-1}return r}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(je.FLOAT32)&&!this.dataType.equals(je.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:r,bufferUsage:i,prevBuffer:n}=this.gl;if(r==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==n)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Kt){n===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const s=this.dataType.density.size(n).valueOf(),a=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,s,a.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,i==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=Kt}as(e){return mZ(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:jf(this.alignmentBounds.lower),upper:jf(this.alignmentBounds.upper)},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}get alignmentBounds(){return hn(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const e=new pZ(this);return this.dataType.equals(je.JSON)?new vZ(e):e}return new gZ(this)}slice(e,r){return this.sliceSub(!1,e,r)}sub(e,r){return this.sliceSub(!0,e,r)}subIterator(e,r){return new Pf(this,e,r??this.length)}subAlignmentIterator(e,r){return new Pf(this,Number(e-this.alignment),Number(r-this.alignment))}subBytes(e,r){if(e>=0&&(r==null||r>=this.byteLength.valueOf()))return this;const i=this.data.subarray(e,r);return new Vn({data:i,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,r,i){if(r<=0&&(i==null||i>=this.length))return this;let n;return e?n=this.data.subarray(r,i):n=this.data.slice(r,i),new Vn({data:n,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(r)})}reAlign(e){return new Vn({data:this.buffer,dataType:this.dataType,timeRange:Qr.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){var e,r;let i=`Series(${this.dataType.toString()} ${this.length} [`;if(this.length<=10)i+=Array.from(this).map(n=>n.toString());else{for(let n=0;n<5;n++)i+=`${(e=this.at(n))==null?void 0:e.toString()}`,i+=",";i+="...,";for(let n=-5;n<0;n++)i+=(r=this.at(n))==null?void 0:r.toString(),n<-1&&(i+=",")}return i+="])",i}};U(Yr,"crudeZ",he({timeRange:Qr.z.optional(),dataType:je.z,alignment:Mk().optional(),data:Ue([lZ,dZ,ye(ArrayBuffer),ye(Uint8Array)]),glBufferUsage:rZ.optional().default("static").optional()})),U(Yr,"z",Yr.crudeZ.transform(t=>new Yr(t)));let Jk=Yr;const fZ=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof Jk?!0:Fk(t),hZ=nZ(qk,Jk);class Pf{constructor(e,r,i){U(this,"series"),U(this,"end"),U(this,"index"),this.series=e;const n=hn(0,e.length);this.end=Tf(n,i),this.index=Tf(n,r)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}}class pZ{constructor(e){if(U(this,"series"),U(this,"index"),U(this,"decoder"),!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,r=this.series.data;for(;this.index<r.length&&r[this.index]!==Qo;)this.index++;const i=this.index;return e===i?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,i))})}}const Vk=class Wk{constructor(e){U(this,"wrapped"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:Vo.decodeString(e.value,Wk.schema)}}};U(Vk,"schema",Ea(Te(),vr()));let vZ=Vk;class gZ{constructor(e){U(this,"series"),U(this,"index"),this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}}const jf=t=>{const e=t>>32n,r=t&0xffffffffn;return{domain:e,sample:r}};he({key:Te(),value:Te()});Ea(Ue([Q(),Te(),X_()]),vr());const Gk=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",yZ=Gk(),Yk=["macOS","Windows","Linux"],$Z=["macos","windows","linux"],bZ={macos:"macOS",windows:"Windows",linux:"Linux"},wZ=Ke(Yk).or(Ke($Z).transform(t=>bZ[t])),_Z=()=>{if(typeof window>"u")return;const t=window.navigator.userAgent.toLowerCase();if(t.includes("mac"))return"macOS";if(t.includes("win"))return"Windows";if(t.includes("linux"))return"Linux"};let ho;const kZ=(t={})=>{const{force:e,default:r}=t;return e??ho??(ho=_Z(),ho??r)},Kk=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:Yk,RUNTIME:yZ,detect:Gk,getOS:kZ,osZ:wZ},Symbol.toStringTag,{value:"Module"}));var IZ=Object.defineProperty,OZ=(t,e,r)=>e in t?IZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kr=(t,e,r)=>OZ(t,typeof e!="symbol"?e+"":e,r);const SZ=(...t)=>t.map(Xk).join(""),Xk=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),NZ=t=>t.endsWith("/")?t.slice(0,-1):t,TZ=(t,e="")=>t===null?"":`?${Object.entries(t).filter(([,r])=>r==null?!1:Array.isArray(r)?r.length>0:!0).map(([r,i])=>`${e}${r}=${i}`).join("&")}`,eu=class tu{constructor({host:e,port:r,protocol:i="",pathPrefix:n=""}){Kr(this,"protocol"),Kr(this,"host"),Kr(this,"port"),Kr(this,"path"),this.protocol=i,this.host=e,this.port=r,this.path=Xk(n)}replace(e){return new tu({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new tu({...this,pathPrefix:SZ(this.path,e)})}toString(){return NZ(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};Kr(eu,"UNKNOWN",new eu({host:"unknown",port:0}));let zZ=eu;var xZ=Object.defineProperty,EZ=(t,e,r)=>e in t?xZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Et=(t,e,r)=>EZ(t,typeof e!="symbol"?e+"":e,r);const UZ=()=>{const t={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return n=>{switch(n.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${n.expected}، ولكن تم إدخال ${r(n.input)}`;case"invalid_value":return n.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${X(n.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${s} ${n.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${s} ${n.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`:s.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${s.suffix}"`:s.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${s.includes}"`:s.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${s.pattern}`:`${i[s.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${j(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function ZZ(){return{localeError:UZ()}}const PZ=()=>{const t={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${n.expected}, daxil olan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Yanlış dəyər: gözlənilən ${X(n.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${s}${n.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Çox kiçik: gözlənilən ${n.origin} ${s}${n.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Yanlış mətn: "${s.prefix}" ilə başlamalıdır`:s.format==="ends_with"?`Yanlış mətn: "${s.suffix}" ilə bitməlidir`:s.format==="includes"?`Yanlış mətn: "${s.includes}" daxil olmalıdır`:s.format==="regex"?`Yanlış mətn: ${s.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${i[s.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${j(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function jZ(){return{localeError:PZ()}}function Af(t,e,r,i){const n=Math.abs(t),s=n%10,a=n%100;return a>=11&&a<=19?i:s===1?e:s>=2&&s<=4?r:i}const AZ=()=>{const t={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"лік";case"object":{if(Array.isArray(n))return"масіў";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return n=>{switch(n.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${n.expected}, атрымана ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Няправільны ўвод: чакалася ${X(n.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);if(a){const o=Number(n.maximum),u=Af(o,a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${a.verb} ${s}${n.maximum.toString()} ${u}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);if(a){const o=Number(n.minimum),u=Af(o,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${a.verb} ${s}${n.minimum.toString()} ${u}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${s.prefix}"`:s.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${s.suffix}"`:s.format==="includes"?`Няправільны радок: павінен змяшчаць "${s.includes}"`:s.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${s.pattern}`:`Няправільны ${i[s.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${j(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function DZ(){return{localeError:AZ()}}const CZ=()=>{const t={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipus invàlid: s'esperava ${n.expected}, s'ha rebut ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Valor invàlid: s'esperava ${X(n.values[0])}`:`Opció invàlida: s'esperava una de ${j(n.values," o ")}`;case"too_big":{const s=n.inclusive?"com a màxim":"menys de",a=e(n.origin);return a?`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${s} ${n.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"com a mínim":"més de",a=e(n.origin);return a?`Massa petit: s'esperava que ${n.origin} contingués ${s} ${n.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Format invàlid: ha de començar amb "${s.prefix}"`:s.format==="ends_with"?`Format invàlid: ha d'acabar amb "${s.suffix}"`:s.format==="includes"?`Format invàlid: ha d'incloure "${s.includes}"`:s.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${s.pattern}`:`Format invàlid per a ${i[s.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function RZ(){return{localeError:CZ()}}const LZ=()=>{const t={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(n))return"pole";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return n=>{switch(n.code){case"invalid_type":return`Neplatný vstup: očekáváno ${n.expected}, obdrženo ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neplatný vstup: očekáváno ${X(n.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${s}${n.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${s}${n.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Neplatný řetězec: musí začínat na "${s.prefix}"`:s.format==="ends_with"?`Neplatný řetězec: musí končit na "${s.suffix}"`:s.format==="includes"?`Neplatný řetězec: musí obsahovat "${s.includes}"`:s.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${s.pattern}`:`Neplatný formát ${i[s.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${j(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function MZ(){return{localeError:LZ()}}const BZ=()=>{const t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"Zahl";case"object":{if(Array.isArray(n))return"Array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return n=>{switch(n.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${n.expected}, erhalten ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ungültige Eingabe: erwartet ${X(n.values[0])}`:`Ungültige Option: erwartet eine von ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Zu groß: erwartet, dass ${n.origin??"Wert"} ${s}${n.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${n.origin??"Wert"} ${s}${n.maximum.toString()} ist`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Zu klein: erwartet, dass ${n.origin} ${s}${n.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${s}${n.minimum.toString()} ist`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ungültiger String: muss mit "${s.prefix}" beginnen`:s.format==="ends_with"?`Ungültiger String: muss mit "${s.suffix}" enden`:s.format==="includes"?`Ungültiger String: muss "${s.includes}" enthalten`:s.format==="regex"?`Ungültiger String: muss dem Muster ${s.pattern} entsprechen`:`Ungültig: ${i[s.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${j(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function FZ(){return{localeError:BZ()}}const qZ=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},JZ=()=>{const t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(i){return t[i]??null}const r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Invalid input: expected ${i.expected}, received ${qZ(i.input)}`;case"invalid_value":return i.values.length===1?`Invalid input: expected ${X(i.values[0])}`:`Invalid option: expected one of ${j(i.values,"|")}`;case"too_big":{const n=i.inclusive?"<=":"<",s=e(i.origin);return s?`Too big: expected ${i.origin??"value"} to have ${n}${i.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${n}${i.maximum.toString()}`}case"too_small":{const n=i.inclusive?">=":">",s=e(i.origin);return s?`Too small: expected ${i.origin} to have ${n}${i.minimum.toString()} ${s.unit}`:`Too small: expected ${i.origin} to be ${n}${i.minimum.toString()}`}case"invalid_format":{const n=i;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${j(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Hk(){return{localeError:JZ()}}const VZ=()=>{const t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"arreglo";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype)return n.constructor.name}}return s},i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Entrada inválida: se esperaba ${n.expected}, recibido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inválida: se esperaba ${X(n.values[0])}`:`Opción inválida: se esperaba una de ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Demasiado grande: se esperaba que ${n.origin??"valor"} tuviera ${s}${n.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${n.origin??"valor"} fuera ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Demasiado pequeño: se esperaba que ${n.origin} tuviera ${s}${n.minimum.toString()} ${a.unit}`:`Demasiado pequeño: se esperaba que ${n.origin} fuera ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Cadena inválida: debe comenzar con "${s.prefix}"`:s.format==="ends_with"?`Cadena inválida: debe terminar en "${s.suffix}"`:s.format==="includes"?`Cadena inválida: debe incluir "${s.includes}"`:s.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${s.pattern}`:`Inválido ${i[s.format]??n.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Llave inválida en ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${n.origin}`;default:return"Entrada inválida"}}};function WZ(){return{localeError:VZ()}}const GZ=()=>{const t={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"آرایه";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return n=>{switch(n.code){case"invalid_type":return`ورودی نامعتبر: میبایست ${n.expected} میبود، ${r(n.input)} دریافت شد`;case"invalid_value":return n.values.length===1?`ورودی نامعتبر: میبایست ${X(n.values[0])} میبود`:`گزینه نامعتبر: میبایست یکی از ${j(n.values,"|")} میبود`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`خیلی بزرگ: ${n.origin??"مقدار"} باید ${s}${n.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${n.origin??"مقدار"} باید ${s}${n.maximum.toString()} باشد`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`خیلی کوچک: ${n.origin} باید ${s}${n.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${n.origin} باید ${s}${n.minimum.toString()} باشد`}case"invalid_format":{const s=n;return s.format==="starts_with"?`رشته نامعتبر: باید با "${s.prefix}" شروع شود`:s.format==="ends_with"?`رشته نامعتبر: باید با "${s.suffix}" تمام شود`:s.format==="includes"?`رشته نامعتبر: باید شامل "${s.includes}" باشد`:s.format==="regex"?`رشته نامعتبر: باید با الگوی ${s.pattern} مطابقت داشته باشد`:`${i[s.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${j(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function YZ(){return{localeError:GZ()}}const KZ=()=>{const t={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return n=>{switch(n.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${n.expected}, oli ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Virheellinen syöte: täytyy olla ${X(n.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${s}${n.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${s}${n.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${s.prefix}"`:s.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${s.suffix}"`:s.format==="includes"?`Virheellinen syöte: täytyy sisältää "${s.includes}"`:s.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${s.pattern}`:`Virheellinen ${i[s.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${j(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function XZ(){return{localeError:KZ()}}const HZ=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"nombre";case"object":{if(Array.isArray(n))return"tableau";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : ${n.expected} attendu, ${r(n.input)} reçu`;case"invalid_value":return n.values.length===1?`Entrée invalide : ${X(n.values[0])} attendu`:`Option invalide : une valeur parmi ${j(n.values,"|")} attendue`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Trop grand : ${n.origin??"valeur"} doit ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${n.origin??"valeur"} doit être ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Trop petit : ${n.origin} doit ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Trop petit : ${n.origin} doit être ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chaîne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Chaîne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Chaîne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${s.pattern}`:`${i[s.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${j(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function QZ(){return{localeError:HZ()}}const e4=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : attendu ${n.expected}, reçu ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrée invalide : attendu ${X(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"≤":"<",a=e(n.origin);return a?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${s}${n.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"≥":">",a=e(n.origin);return a?`Trop petit : attendu que ${n.origin} ait ${s}${n.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${n.origin} soit ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chaîne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Chaîne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Chaîne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Chaîne invalide : doit correspondre au motif ${s.pattern}`:`${i[s.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${j(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function t4(){return{localeError:e4()}}const n4=()=>{const t={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return n=>{switch(n.code){case"invalid_type":return`קלט לא תקין: צריך ${n.expected}, התקבל ${r(n.input)}`;case"invalid_value":return n.values.length===1?`קלט לא תקין: צריך ${X(n.values[0])}`:`קלט לא תקין: צריך אחת מהאפשרויות ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`גדול מדי: ${n.origin??"value"} צריך להיות ${s}${n.maximum.toString()} ${a.unit??"elements"}`:`גדול מדי: ${n.origin??"value"} צריך להיות ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`קטן מדי: ${n.origin} צריך להיות ${s}${n.minimum.toString()} ${a.unit}`:`קטן מדי: ${n.origin} צריך להיות ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`מחרוזת לא תקינה: חייבת להתחיל ב"${s.prefix}"`:s.format==="ends_with"?`מחרוזת לא תקינה: חייבת להסתיים ב "${s.suffix}"`:s.format==="includes"?`מחרוזת לא תקינה: חייבת לכלול "${s.includes}"`:s.format==="regex"?`מחרוזת לא תקינה: חייבת להתאים לתבנית ${s.pattern}`:`${i[s.format]??n.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${n.divisor}`;case"unrecognized_keys":return`מפתח${n.keys.length>1?"ות":""} לא מזוה${n.keys.length>1?"ים":"ה"}: ${j(n.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${n.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n.origin}`;default:return"קלט לא תקין"}}};function r4(){return{localeError:n4()}}const i4=()=>{const t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"szám";case"object":{if(Array.isArray(n))return"tömb";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return n=>{switch(n.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${n.expected}, a kapott érték ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Érvénytelen bemenet: a várt érték ${X(n.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${s}${n.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${s}${n.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Érvénytelen string: "${s.prefix}" értékkel kell kezdődnie`:s.format==="ends_with"?`Érvénytelen string: "${s.suffix}" értékkel kell végződnie`:s.format==="includes"?`Érvénytelen string: "${s.includes}" értéket kell tartalmaznia`:s.format==="regex"?`Érvénytelen string: ${s.pattern} mintának kell megfelelnie`:`Érvénytelen ${i[s.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function s4(){return{localeError:i4()}}const a4=()=>{const t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak valid: diharapkan ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${X(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${s}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Terlalu kecil: diharapkan ${n.origin} memiliki ${s}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`String tidak valid: harus dimulai dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak valid: harus berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak valid: harus menyertakan "${s.includes}"`:s.format==="regex"?`String tidak valid: harus sesuai pola ${s.pattern}`:`${i[s.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function o4(){return{localeError:a4()}}const u4=()=>{const t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"numero";case"object":{if(Array.isArray(n))return"vettore";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input non valido: atteso ${n.expected}, ricevuto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input non valido: atteso ${X(n.values[0])}`:`Opzione non valida: atteso uno tra ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Troppo grande: ${n.origin??"valore"} deve avere ${s}${n.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Troppo piccolo: ${n.origin} deve avere ${s}${n.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${n.origin} deve essere ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Stringa non valida: deve iniziare con "${s.prefix}"`:s.format==="ends_with"?`Stringa non valida: deve terminare con "${s.suffix}"`:s.format==="includes"?`Stringa non valida: deve includere "${s.includes}"`:s.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${s.pattern}`:`Invalid ${i[s.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${j(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function c4(){return{localeError:u4()}}const l4=()=>{const t={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"数値";case"object":{if(Array.isArray(n))return"配列";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return n=>{switch(n.code){case"invalid_type":return`無効な入力: ${n.expected}が期待されましたが、${r(n.input)}が入力されました`;case"invalid_value":return n.values.length===1?`無効な入力: ${X(n.values[0])}が期待されました`:`無効な選択: ${j(n.values,"、")}のいずれかである必要があります`;case"too_big":{const s=n.inclusive?"以下である":"より小さい",a=e(n.origin);return a?`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${a.unit??"要素"}${s}必要があります`:`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${s}必要があります`}case"too_small":{const s=n.inclusive?"以上である":"より大きい",a=e(n.origin);return a?`小さすぎる値: ${n.origin}は${n.minimum.toString()}${a.unit}${s}必要があります`:`小さすぎる値: ${n.origin}は${n.minimum.toString()}${s}必要があります`}case"invalid_format":{const s=n;return s.format==="starts_with"?`無効な文字列: "${s.prefix}"で始まる必要があります`:s.format==="ends_with"?`無効な文字列: "${s.suffix}"で終わる必要があります`:s.format==="includes"?`無効な文字列: "${s.includes}"を含む必要があります`:s.format==="regex"?`無効な文字列: パターン${s.pattern}に一致する必要があります`:`無効な${i[s.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${j(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function d4(){return{localeError:l4()}}const m4=()=>{const t={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(n))return"អារេ (Array)";if(n===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return n=>{switch(n.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${n.expected} ប៉ុន្តែទទួលបាន ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${X(n.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${s} ${n.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`តូចពេក៖ ត្រូវការ ${n.origin} ${s} ${n.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${n.origin} ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${s.prefix}"`:s.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${s.suffix}"`:s.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${s.includes}"`:s.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${s.pattern}`:`មិនត្រឹមត្រូវ៖ ${i[s.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${j(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function f4(){return{localeError:m4()}}const h4=()=>{const t={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return n=>{switch(n.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${n.expected}, 받은 타입은 ${r(n.input)}입니다`;case"invalid_value":return n.values.length===1?`잘못된 입력: 값은 ${X(n.values[0])} 이어야 합니다`:`잘못된 옵션: ${j(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const s=n.inclusive?"이하":"미만",a=s==="미만"?"이어야 합니다":"여야 합니다",o=e(n.origin),u=(o==null?void 0:o.unit)??"요소";return o?`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${u} ${s}${a}`:`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${s}${a}`}case"too_small":{const s=n.inclusive?"이상":"초과",a=s==="이상"?"이어야 합니다":"여야 합니다",o=e(n.origin),u=(o==null?void 0:o.unit)??"요소";return o?`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${u} ${s}${a}`:`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${s}${a}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`잘못된 문자열: "${s.prefix}"(으)로 시작해야 합니다`:s.format==="ends_with"?`잘못된 문자열: "${s.suffix}"(으)로 끝나야 합니다`:s.format==="includes"?`잘못된 문자열: "${s.includes}"을(를) 포함해야 합니다`:s.format==="regex"?`잘못된 문자열: 정규식 ${s.pattern} 패턴과 일치해야 합니다`:`잘못된 ${i[s.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${j(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function p4(){return{localeError:h4()}}const v4=()=>{const t={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"број";case"object":{if(Array.isArray(n))return"низа";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return n=>{switch(n.code){case"invalid_type":return`Грешен внес: се очекува ${n.expected}, примено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${X(n.values[0])}`:`Грешана опција: се очекува една ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${s}${n.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Премногу мал: се очекува ${n.origin} да има ${s}${n.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${n.origin} да биде ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неважечка низа: мора да започнува со "${s.prefix}"`:s.format==="ends_with"?`Неважечка низа: мора да завршува со "${s.suffix}"`:s.format==="includes"?`Неважечка низа: мора да вклучува "${s.includes}"`:s.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${s.pattern}`:`Invalid ${i[s.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${j(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function g4(){return{localeError:v4()}}const y4=()=>{const t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"nombor";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak sah: dijangka ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${X(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Terlalu besar: dijangka ${n.origin??"nilai"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Terlalu kecil: dijangka ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`String tidak sah: mesti bermula dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak sah: mesti mengandungi "${s.includes}"`:s.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${s.pattern}`:`${i[s.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${j(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function $4(){return{localeError:y4()}}const b4=()=>{const t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"getal";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return n=>{switch(n.code){case"invalid_type":return`Ongeldige invoer: verwacht ${n.expected}, ontving ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${X(n.values[0])}`:`Ongeldige optie: verwacht één van ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Te lang: verwacht dat ${n.origin??"waarde"} ${s}${n.maximum.toString()} ${a.unit??"elementen"} bevat`:`Te lang: verwacht dat ${n.origin??"waarde"} ${s}${n.maximum.toString()} is`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Te kort: verwacht dat ${n.origin} ${s}${n.minimum.toString()} ${a.unit} bevat`:`Te kort: verwacht dat ${n.origin} ${s}${n.minimum.toString()} is`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ongeldige tekst: moet met "${s.prefix}" beginnen`:s.format==="ends_with"?`Ongeldige tekst: moet op "${s.suffix}" eindigen`:s.format==="includes"?`Ongeldige tekst: moet "${s.includes}" bevatten`:s.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${s.pattern}`:`Ongeldig: ${i[s.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function w4(){return{localeError:b4()}}const _4=()=>{const t={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"tall";case"object":{if(Array.isArray(n))return"liste";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Ugyldig input: forventet ${n.expected}, fikk ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${X(n.values[0])}`:`Ugyldig valg: forventet en av ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`For stor(t): forventet ${n.origin??"value"} til å ha ${s}${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til å ha ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`For lite(n): forventet ${n.origin} til å ha ${s}${n.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${n.origin} til å ha ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ugyldig streng: må starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: må ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: må inneholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: må matche mønsteret ${s.pattern}`:`Ugyldig ${i[s.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${j(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function k4(){return{localeError:_4()}}const I4=()=>{const t={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"numara";case"object":{if(Array.isArray(n))return"saf";if(n===null)return"gayb";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return n=>{switch(n.code){case"invalid_type":return`Fâsit giren: umulan ${n.expected}, alınan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Fâsit giren: umulan ${X(n.values[0])}`:`Fâsit tercih: mûteberler ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Fazla büyük: ${n.origin??"value"}, ${s}${n.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${n.origin??"value"}, ${s}${n.maximum.toString()} olmalıydı.`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Fazla küçük: ${n.origin}, ${s}${n.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${n.origin}, ${s}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Fâsit metin: "${s.prefix}" ile başlamalı.`:s.format==="ends_with"?`Fâsit metin: "${s.suffix}" ile bitmeli.`:s.format==="includes"?`Fâsit metin: "${s.includes}" ihtivâ etmeli.`:s.format==="regex"?`Fâsit metin: ${s.pattern} nakşına uymalı.`:`Fâsit ${i[s.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function O4(){return{localeError:I4()}}const S4=()=>{const t={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"ارې";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return n=>{switch(n.code){case"invalid_type":return`ناسم ورودي: باید ${n.expected} وای, مګر ${r(n.input)} ترلاسه شو`;case"invalid_value":return n.values.length===1?`ناسم ورودي: باید ${X(n.values[0])} وای`:`ناسم انتخاب: باید یو له ${j(n.values,"|")} څخه وای`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`ډیر لوی: ${n.origin??"ارزښت"} باید ${s}${n.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${n.origin??"ارزښت"} باید ${s}${n.maximum.toString()} وي`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`ډیر کوچنی: ${n.origin} باید ${s}${n.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${n.origin} باید ${s}${n.minimum.toString()} وي`}case"invalid_format":{const s=n;return s.format==="starts_with"?`ناسم متن: باید د "${s.prefix}" سره پیل شي`:s.format==="ends_with"?`ناسم متن: باید د "${s.suffix}" سره پای ته ورسيږي`:s.format==="includes"?`ناسم متن: باید "${s.includes}" ولري`:s.format==="regex"?`ناسم متن: باید د ${s.pattern} سره مطابقت ولري`:`${i[s.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${j(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function N4(){return{localeError:S4()}}const T4=()=>{const t={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"liczba";case"object":{if(Array.isArray(n))return"tablica";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return n=>{switch(n.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${n.expected}, otrzymano ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${X(n.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${s}${n.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${s}${n.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${s.prefix}"`:s.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${s.suffix}"`:s.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${s.includes}"`:s.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${s.pattern}`:`Nieprawidłow(y/a/e) ${i[s.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function z4(){return{localeError:T4()}}const x4=()=>{const t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"array";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipo inválido: esperado ${n.expected}, recebido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inválida: esperado ${X(n.values[0])}`:`Opção inválida: esperada uma das ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${s}${n.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Muito pequeno: esperado que ${n.origin} tivesse ${s}${n.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Texto inválido: deve começar com "${s.prefix}"`:s.format==="ends_with"?`Texto inválido: deve terminar com "${s.suffix}"`:s.format==="includes"?`Texto inválido: deve incluir "${s.includes}"`:s.format==="regex"?`Texto inválido: deve corresponder ao padrão ${s.pattern}`:`${i[s.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function E4(){return{localeError:x4()}}function Df(t,e,r,i){const n=Math.abs(t),s=n%10,a=n%100;return a>=11&&a<=19?i:s===1?e:s>=2&&s<=4?r:i}const U4=()=>{const t={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"массив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return n=>{switch(n.code){case"invalid_type":return`Неверный ввод: ожидалось ${n.expected}, получено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неверный ввод: ожидалось ${X(n.values[0])}`:`Неверный вариант: ожидалось одно из ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);if(a){const o=Number(n.maximum),u=Df(o,a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${s}${n.maximum.toString()} ${u}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);if(a){const o=Number(n.minimum),u=Df(o,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${s}${n.minimum.toString()} ${u}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неверная строка: должна начинаться с "${s.prefix}"`:s.format==="ends_with"?`Неверная строка: должна заканчиваться на "${s.suffix}"`:s.format==="includes"?`Неверная строка: должна содержать "${s.includes}"`:s.format==="regex"?`Неверная строка: должна соответствовать шаблону ${s.pattern}`:`Неверный ${i[s.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function Z4(){return{localeError:U4()}}const P4=()=>{const t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"število";case"object":{if(Array.isArray(n))return"tabela";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return n=>{switch(n.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${n.expected}, prejeto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neveljaven vnos: pričakovano ${X(n.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${s}${n.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Premajhno: pričakovano, da bo ${n.origin} imelo ${s}${n.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Neveljaven niz: mora se začeti z "${s.prefix}"`:s.format==="ends_with"?`Neveljaven niz: mora se končati z "${s.suffix}"`:s.format==="includes"?`Neveljaven niz: mora vsebovati "${s.includes}"`:s.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${s.pattern}`:`Neveljaven ${i[s.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${j(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function j4(){return{localeError:P4()}}const A4=()=>{const t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"antal";case"object":{if(Array.isArray(n))return"lista";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return n=>{switch(n.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${n.expected}, fick ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ogiltig inmatning: förväntat ${X(n.values[0])}`:`Ogiltigt val: förväntade en av ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`För stor(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${n.origin??"värdet"} att ha ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`För lite(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ogiltig sträng: måste börja med "${s.prefix}"`:s.format==="ends_with"?`Ogiltig sträng: måste sluta med "${s.suffix}"`:s.format==="includes"?`Ogiltig sträng: måste innehålla "${s.includes}"`:s.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${s.pattern}"`:`Ogiltig(t) ${i[s.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${j(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function D4(){return{localeError:A4()}}const C4=()=>{const t={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(n))return"அணி";if(n===null)return"வெறுமை";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${n.expected}, பெறப்பட்டது ${r(n.input)}`;case"invalid_value":return n.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${X(n.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${j(n.values,"|")} இல் ஒன்று`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${s}${n.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${s}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${s}${n.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${s}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const s=n;return s.format==="starts_with"?`தவறான சரம்: "${s.prefix}" இல் தொடங்க வேண்டும்`:s.format==="ends_with"?`தவறான சரம்: "${s.suffix}" இல் முடிவடைய வேண்டும்`:s.format==="includes"?`தவறான சரம்: "${s.includes}" ஐ உள்ளடக்க வேண்டும்`:s.format==="regex"?`தவறான சரம்: ${s.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${i[s.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${j(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function R4(){return{localeError:C4()}}const L4=()=>{const t={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(n))return"อาร์เรย์ (Array)";if(n===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return n=>{switch(n.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${n.expected} แต่ได้รับ ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${X(n.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"ไม่เกิน":"น้อยกว่า",a=e(n.origin);return a?`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${s} ${n.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"อย่างน้อย":"มากกว่า",a=e(n.origin);return a?`น้อยกว่ากำหนด: ${n.origin} ควรมี${s} ${n.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${n.origin} ควรมี${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${s.prefix}"`:s.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${s.suffix}"`:s.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${s.includes}" อยู่ในข้อความ`:s.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${s.pattern}`:`รูปแบบไม่ถูกต้อง: ${i[s.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${j(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function M4(){return{localeError:L4()}}const B4=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},F4=()=>{const t={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function e(i){return t[i]??null}const r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return i=>{switch(i.code){case"invalid_type":return`Geçersiz değer: beklenen ${i.expected}, alınan ${B4(i.input)}`;case"invalid_value":return i.values.length===1?`Geçersiz değer: beklenen ${X(i.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${j(i.values,"|")}`;case"too_big":{const n=i.inclusive?"<=":"<",s=e(i.origin);return s?`Çok büyük: beklenen ${i.origin??"değer"} ${n}${i.maximum.toString()} ${s.unit??"öğe"}`:`Çok büyük: beklenen ${i.origin??"değer"} ${n}${i.maximum.toString()}`}case"too_small":{const n=i.inclusive?">=":">",s=e(i.origin);return s?`Çok küçük: beklenen ${i.origin} ${n}${i.minimum.toString()} ${s.unit}`:`Çok küçük: beklenen ${i.origin} ${n}${i.minimum.toString()}`}case"invalid_format":{const n=i;return n.format==="starts_with"?`Geçersiz metin: "${n.prefix}" ile başlamalı`:n.format==="ends_with"?`Geçersiz metin: "${n.suffix}" ile bitmeli`:n.format==="includes"?`Geçersiz metin: "${n.includes}" içermeli`:n.format==="regex"?`Geçersiz metin: ${n.pattern} desenine uymalı`:`Geçersiz ${r[n.format]??i.format}`}case"not_multiple_of":return`Geçersiz sayı: ${i.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${i.keys.length>1?"lar":""}: ${j(i.keys,", ")}`;case"invalid_key":return`${i.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${i.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function q4(){return{localeError:F4()}}const J4=()=>{const t={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"масив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return n=>{switch(n.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${n.expected}, отримано ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неправильні вхідні дані: очікується ${X(n.values[0])}`:`Неправильна опція: очікується одне з ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Занадто велике: очікується, що ${n.origin??"значення"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${n.origin??"значення"} буде ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Занадто мале: очікується, що ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${n.origin} буде ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неправильний рядок: повинен починатися з "${s.prefix}"`:s.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${s.suffix}"`:s.format==="includes"?`Неправильний рядок: повинен містити "${s.includes}"`:s.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${s.pattern}`:`Неправильний ${i[s.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function V4(){return{localeError:J4()}}const W4=()=>{const t={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"نمبر";case"object":{if(Array.isArray(n))return"آرے";if(n===null)return"نل";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return n=>{switch(n.code){case"invalid_type":return`غلط ان پٹ: ${n.expected} متوقع تھا، ${r(n.input)} موصول ہوا`;case"invalid_value":return n.values.length===1?`غلط ان پٹ: ${X(n.values[0])} متوقع تھا`:`غلط آپشن: ${j(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`بہت بڑا: ${n.origin??"ویلیو"} کے ${s}${n.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${n.origin??"ویلیو"} کا ${s}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`بہت چھوٹا: ${n.origin} کے ${s}${n.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${n.origin} کا ${s}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const s=n;return s.format==="starts_with"?`غلط سٹرنگ: "${s.prefix}" سے شروع ہونا چاہیے`:s.format==="ends_with"?`غلط سٹرنگ: "${s.suffix}" پر ختم ہونا چاہیے`:s.format==="includes"?`غلط سٹرنگ: "${s.includes}" شامل ہونا چاہیے`:s.format==="regex"?`غلط سٹرنگ: پیٹرن ${s.pattern} سے میچ ہونا چاہیے`:`غلط ${i[s.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${j(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function G4(){return{localeError:W4()}}const Y4=()=>{const t={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"số";case"object":{if(Array.isArray(n))return"mảng";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return n=>{switch(n.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${n.expected}, nhận được ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Đầu vào không hợp lệ: mong đợi ${X(n.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Quá lớn: mong đợi ${n.origin??"giá trị"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${n.origin??"giá trị"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Quá nhỏ: mong đợi ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${s.prefix}"`:s.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${s.suffix}"`:s.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${s.includes}"`:s.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${s.pattern}`:`${i[s.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${j(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function K4(){return{localeError:Y4()}}const X4=()=>{const t={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(n))return"数组";if(n===null)return"空值(null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return n=>{switch(n.code){case"invalid_type":return`无效输入:期望 ${n.expected},实际接收 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`无效输入:期望 ${X(n.values[0])}`:`无效选项:期望以下之一 ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`数值过大:期望 ${n.origin??"值"} ${s}${n.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${n.origin??"值"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`数值过小:期望 ${n.origin} ${s}${n.minimum.toString()} ${a.unit}`:`数值过小:期望 ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`无效字符串:必须以 "${s.prefix}" 开头`:s.format==="ends_with"?`无效字符串:必须以 "${s.suffix}" 结尾`:s.format==="includes"?`无效字符串:必须包含 "${s.includes}"`:s.format==="regex"?`无效字符串:必须满足正则表达式 ${s.pattern}`:`无效${i[s.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${j(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function H4(){return{localeError:X4()}}const Q4=()=>{const t={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return n=>{switch(n.code){case"invalid_type":return`無效的輸入值:預期為 ${n.expected},但收到 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`無效的輸入值:預期為 ${X(n.values[0])}`:`無效的選項:預期為以下其中之一 ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`數值過大:預期 ${n.origin??"值"} 應為 ${s}${n.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${n.origin??"值"} 應為 ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`數值過小:預期 ${n.origin} 應為 ${s}${n.minimum.toString()} ${a.unit}`:`數值過小:預期 ${n.origin} 應為 ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`無效的字串:必須以 "${s.prefix}" 開頭`:s.format==="ends_with"?`無效的字串:必須以 "${s.suffix}" 結尾`:s.format==="includes"?`無效的字串:必須包含 "${s.includes}"`:s.format==="regex"?`無效的字串:必須符合格式 ${s.pattern}`:`無效的 ${i[s.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${j(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function e6(){return{localeError:Q4()}}const Qk=Object.freeze(Object.defineProperty({__proto__:null,ar:ZZ,az:jZ,be:DZ,ca:RZ,cs:MZ,de:FZ,en:Hk,es:WZ,fa:YZ,fi:XZ,fr:QZ,frCA:t4,he:r4,hu:s4,id:o4,it:c4,ja:d4,kh:f4,ko:p4,mk:g4,ms:$4,nl:w4,no:k4,ota:O4,pl:z4,ps:N4,pt:E4,ru:Z4,sl:j4,sv:D4,ta:R4,th:M4,tr:q4,ua:V4,ur:G4,vi:K4,zhCN:H4,zhTW:e6},Symbol.toStringTag,{value:"Module"}));class eI{constructor(e){this._def=e,this.def=e}implement(e){if(typeof e!="function")throw new Error("implement() must be called with a function");const r=(...i)=>{const n=this._def.input?Wo(this._def.input,i,void 0,{callee:r}):i;if(!Array.isArray(n))throw new Error("Invalid arguments schema: not an array or tuple schema.");const s=e(...n);return this._def.output?Wo(this._def.output,s,void 0,{callee:r}):s};return r}implementAsync(e){if(typeof e!="function")throw new Error("implement() must be called with a function");const r=async(...i)=>{const n=this._def.input?await Go(this._def.input,i,void 0,{callee:r}):i;if(!Array.isArray(n))throw new Error("Invalid arguments schema: not an array or tuple schema.");const s=await e(...n);return this._def.output?Go(this._def.output,s,void 0,{callee:r}):s};return r}input(...e){const r=this.constructor;return Array.isArray(e[0])?new r({type:"function",input:new wa({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output}):new r({type:"function",input:e[0],output:this._def.output})}output(e){const r=this.constructor;return new r({type:"function",input:this._def.input,output:e})}}function tI(t){return new eI({type:"function",input:Array.isArray(t==null?void 0:t.input)?A_(wa,t==null?void 0:t.input):(t==null?void 0:t.input)??dd(Sl,Ds(js)),output:(t==null?void 0:t.output)??Ds(js)})}class nu{constructor(e){this.counter=0,this.metadataRegistry=(e==null?void 0:e.metadata)??mn,this.target=(e==null?void 0:e.target)??"draft-2020-12",this.unrepresentable=(e==null?void 0:e.unrepresentable)??"throw",this.override=(e==null?void 0:e.override)??(()=>{}),this.io=(e==null?void 0:e.io)??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var i,n,s,a;const o=e._zod.def,u={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},c=this.seen.get(e);if(c)return c.count++,r.schemaPath.includes(e)&&(c.cycle=r.path),c.schema;const l={schema:{},count:1,cycle:void 0};this.seen.set(e,l);const d=(n=(i=e._zod).toJSONSchema)==null?void 0:n.call(i);if(d)l.schema=d;else{const p={...r,schemaPath:[...r.schemaPath,e],path:r.path},_=e._zod.parent;if(_)l.ref=_,this.process(_,p),this.seen.get(_).isParent=!0;else{const k=l.schema;switch(o.type){case"string":{const m=k;m.type="string";const{minimum:h,maximum:v,format:w,patterns:I,contentEncoding:A}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof v=="number"&&(m.maxLength=v),w&&(m.format=u[w]??w,m.format===""&&delete m.format),A&&(m.contentEncoding=A),I&&I.size>0){const J=[...I];J.length===1?m.pattern=J[0].source:J.length>1&&(l.schema.allOf=[...J.map(ce=>({...this.target==="draft-7"?{type:"string"}:{},pattern:ce.source}))])}break}case"number":{const m=k,{minimum:h,maximum:v,format:w,multipleOf:I,exclusiveMaximum:A,exclusiveMinimum:J}=e._zod.bag;typeof w=="string"&&w.includes("int")?m.type="integer":m.type="number",typeof J=="number"&&(m.exclusiveMinimum=J),typeof h=="number"&&(m.minimum=h,typeof J=="number"&&(J>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof A=="number"&&(m.exclusiveMaximum=A),typeof v=="number"&&(m.maximum=v,typeof A=="number"&&(A<=v?delete m.maximum:delete m.exclusiveMaximum)),typeof I=="number"&&(m.multipleOf=I);break}case"boolean":{const m=k;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"undefined":{const m=k;m.type="null";break}case"null":{k.type="null";break}case"any":break;case"unknown":break;case"never":{k.not={};break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const m=k,{minimum:h,maximum:v}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof v=="number"&&(m.maxItems=v),m.type="array",m.items=this.process(o.element,{...p,path:[...p.path,"items"]});break}case"object":{const m=k;m.type="object",m.properties={};const h=o.shape;for(const I in h)m.properties[I]=this.process(h[I],{...p,path:[...p.path,"properties",I]});const v=new Set(Object.keys(h)),w=new Set([...v].filter(I=>{const A=o.shape[I]._zod;return this.io==="input"?A.optin===void 0:A.optout===void 0}));w.size>0&&(m.required=Array.from(w)),((s=o.catchall)==null?void 0:s._zod.def.type)==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...p,path:[...p.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{const m=k;m.anyOf=o.options.map((h,v)=>this.process(h,{...p,path:[...p.path,"anyOf",v]}));break}case"intersection":{const m=k,h=this.process(o.left,{...p,path:[...p.path,"allOf",0]}),v=this.process(o.right,{...p,path:[...p.path,"allOf",1]}),w=A=>"allOf"in A&&Object.keys(A).length===1,I=[...w(h)?h.allOf:[h],...w(v)?v.allOf:[v]];m.allOf=I;break}case"tuple":{const m=k;m.type="array";const h=o.items.map((I,A)=>this.process(I,{...p,path:[...p.path,"prefixItems",A]}));if(this.target==="draft-2020-12"?m.prefixItems=h:m.items=h,o.rest){const I=this.process(o.rest,{...p,path:[...p.path,"items"]});this.target==="draft-2020-12"?m.items=I:m.additionalItems=I}o.rest&&(m.items=this.process(o.rest,{...p,path:[...p.path,"items"]}));const{minimum:v,maximum:w}=e._zod.bag;typeof v=="number"&&(m.minItems=v),typeof w=="number"&&(m.maxItems=w);break}case"record":{const m=k;m.type="object",m.propertyNames=this.process(o.keyType,{...p,path:[...p.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...p,path:[...p.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const m=k,h=ll(o.entries);h.every(v=>typeof v=="number")&&(m.type="number"),h.every(v=>typeof v=="string")&&(m.type="string"),m.enum=h;break}case"literal":{const m=k,h=[];for(const v of o.values)if(v===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(v))}else h.push(v);if(h.length!==0)if(h.length===1){const v=h[0];m.type=v===null?"null":typeof v,m.const=v}else h.every(v=>typeof v=="number")&&(m.type="number"),h.every(v=>typeof v=="string")&&(m.type="string"),h.every(v=>typeof v=="boolean")&&(m.type="string"),h.every(v=>v===null)&&(m.type="null"),m.enum=h;break}case"file":{const m=k,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:w,mime:I}=e._zod.bag;v!==void 0&&(h.minLength=v),w!==void 0&&(h.maxLength=w),I?I.length===1?(h.contentMediaType=I[0],Object.assign(m,h)):m.anyOf=I.map(A=>({...h,contentMediaType:A})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const m=this.process(o.innerType,p);k.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,p),l.ref=o.innerType;break}case"success":{const m=k;m.type="boolean";break}case"default":{this.process(o.innerType,p),l.ref=o.innerType,k.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,p),l.ref=o.innerType,this.io==="input"&&(k._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,p),l.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}k.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const m=k,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{const m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,p),l.ref=m;break}case"readonly":{this.process(o.innerType,p),l.ref=o.innerType,k.readOnly=!0;break}case"promise":{this.process(o.innerType,p),l.ref=o.innerType;break}case"optional":{this.process(o.innerType,p),l.ref=o.innerType;break}case"lazy":{const m=e._zod.innerType;this.process(m,p),l.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const g=this.metadataRegistry.get(e);return g&&Object.assign(l.schema,g),this.io==="input"&&qe(e)&&(delete l.schema.examples,delete l.schema.default),this.io==="input"&&l.schema._prefault&&((a=l.schema).default??(a.default=l.schema._prefault)),delete l.schema._prefault,this.seen.get(e).schema}emit(e,r){var i,n,s,a;const o={cycles:(r==null?void 0:r.cycles)??"ref",reused:(r==null?void 0:r.reused)??"inline",external:(r==null?void 0:r.external)??void 0},u=this.seen.get(e);if(!u)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=_=>{var k;const m=this.target==="draft-2020-12"?"$defs":"definitions";if(o.external){const w=(k=o.external.registry.get(_[0]))==null?void 0:k.id;if(w)return{ref:o.external.uri(w)};const I=_[1].defId??_[1].schema.id??`schema${this.counter++}`;return _[1].defId=I,{defId:I,ref:`${o.external.uri("__shared")}#/${m}/${I}`}}if(_[1]===u)return{ref:"#"};const h=`#/${m}/`,v=_[1].schema.id??`__schema${this.counter++}`;return{defId:v,ref:h+v}},l=_=>{if(_[1].schema.$ref)return;const k=_[1],{ref:m,defId:h}=c(_);k.def={...k.schema},h&&(k.defId=h);const v=k.schema;for(const w in v)delete v[w];v.$ref=m};for(const _ of this.seen.entries()){const k=_[1];if(e===_[0]){l(_);continue}if(o.external){const m=(i=o.external.registry.get(_[0]))==null?void 0:i.id;if(e!==_[0]&&m){l(_);continue}}if((n=this.metadataRegistry.get(_[0]))!=null&&n.id){l(_);continue}if(k.cycle){if(o.cycles==="throw")throw new Error(`Cycle detected: #/${(s=k.cycle)==null?void 0:s.join("/")}/<root>
|
|
72
|
-
|
|
73
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);o.cycles==="ref"&&l(_);continue}if(k.count>1&&o.reused==="ref"){l(_);continue}}const d=(_,k)=>{const m=this.seen.get(_),h=m.def??m.schema,v={...h};if(m.ref===null)return;const w=m.ref;if(m.ref=null,w){d(w,k);const I=this.seen.get(w).schema;I.$ref&&k.target==="draft-7"?(h.allOf=h.allOf??[],h.allOf.push(I)):(Object.assign(h,I),Object.assign(h,v))}m.isParent||this.override({zodSchema:_,jsonSchema:h})};for(const _ of[...this.seen.entries()].reverse())d(_[0],{target:this.target});const g={};this.target==="draft-2020-12"?g.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?g.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),Object.assign(g,u.def);const p=((a=o.external)==null?void 0:a.defs)??{};for(const _ of this.seen.entries()){const k=_[1];k.def&&k.defId&&(p[k.defId]=k.def)}!o.external&&Object.keys(p).length>0&&(this.target==="draft-2020-12"?g.$defs=p:g.definitions=p);try{return JSON.parse(JSON.stringify(g))}catch{throw new Error("Error converting schema to JSON.")}}}function nI(t,e){if(t instanceof xl){const i=new nu(e),n={};for(const o of t._idmap.entries()){const[u,c]=o;i.process(c)}const s={},a={registry:t,uri:(e==null?void 0:e.uri)||(o=>o),defs:n};for(const o of t._idmap.entries()){const[u,c]=o;s[u]=i.emit(c,{...e,external:a})}if(Object.keys(n).length>0){const o=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[o]:n}}return{schemas:s}}const r=new nu(e);return r.process(t),r.emit(t,e)}function qe(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const i=t._zod.def;switch(i.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return qe(i.element,r);case"object":{for(const n in i.shape)if(qe(i.shape[n],r))return!0;return!1}case"union":{for(const n of i.options)if(qe(n,r))return!0;return!1}case"intersection":return qe(i.left,r)||qe(i.right,r);case"tuple":{for(const n of i.items)if(qe(n,r))return!0;return!!(i.rest&&qe(i.rest,r))}case"record":return qe(i.keyType,r)||qe(i.valueType,r);case"map":return qe(i.keyType,r)||qe(i.valueType,r);case"set":return qe(i.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return qe(i.innerType,r);case"lazy":return qe(i.getter(),r);case"default":return qe(i.innerType,r);case"prefault":return qe(i.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return qe(i.in,r)||qe(i.out,r);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${i.type}`)}const t6=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),n6=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:Tw,$ZodArray:Sl,$ZodAsyncError:mr,$ZodBase64:gw,$ZodBase64URL:$w,$ZodBigInt:Ol,$ZodBigIntFormat:Iw,$ZodBoolean:Il,$ZodCIDRv4:pw,$ZodCIDRv6:vw,$ZodCUID:iw,$ZodCUID2:sw,$ZodCatch:Ww,$ZodCheck:Le,$ZodCheckBigIntFormat:Pb,$ZodCheckEndsWith:Vb,$ZodCheckGreaterThan:wl,$ZodCheckIncludes:qb,$ZodCheckLengthEquals:Lb,$ZodCheckLessThan:bl,$ZodCheckLowerCase:Bb,$ZodCheckMaxLength:Cb,$ZodCheckMaxSize:jb,$ZodCheckMimeType:Gb,$ZodCheckMinLength:Rb,$ZodCheckMinSize:Ab,$ZodCheckMultipleOf:Ub,$ZodCheckNumberFormat:Zb,$ZodCheckOverwrite:Yb,$ZodCheckProperty:Wb,$ZodCheckRegex:Mb,$ZodCheckSizeEquals:Db,$ZodCheckStartsWith:Jb,$ZodCheckStringFormat:Zi,$ZodCheckUpperCase:Fb,$ZodCustom:Qw,$ZodDate:Ew,$ZodDefault:Fw,$ZodDiscriminatedUnion:Zw,$ZodE164:bw,$ZodEmail:ew,$ZodEmoji:nw,$ZodEnum:Cw,$ZodError:ml,$ZodFile:Lw,$ZodFunction:eI,$ZodGUID:Hb,$ZodIPv4:fw,$ZodIPv6:hw,$ZodISODate:lw,$ZodISODateTime:cw,$ZodISODuration:mw,$ZodISOTime:dw,$ZodIntersection:Pw,$ZodJWT:_w,$ZodKSUID:uw,$ZodLazy:Hw,$ZodLiteral:Rw,$ZodMap:Aw,$ZodNaN:Gw,$ZodNanoID:rw,$ZodNever:zw,$ZodNonOptional:Jw,$ZodNull:Nw,$ZodNullable:Bw,$ZodNumber:kl,$ZodNumberFormat:kw,$ZodObject:Uw,$ZodOptional:Mw,$ZodPipe:zl,$ZodPrefault:qw,$ZodPromise:Xw,$ZodReadonly:Yw,$ZodRealError:Ui,$ZodRecord:jw,$ZodRegistry:xl,$ZodSet:Dw,$ZodString:Pi,$ZodStringFormat:be,$ZodSuccess:Vw,$ZodSymbol:Ow,$ZodTemplateLiteral:Kw,$ZodTransform:Tl,$ZodTuple:wa,$ZodType:F,$ZodULID:aw,$ZodURL:tw,$ZodUUID:Qb,$ZodUndefined:Sw,$ZodUnion:Nl,$ZodUnknown:js,$ZodVoid:xw,$ZodXID:ow,$brand:U$,$constructor:b,$input:t_,$output:e_,Doc:Kb,JSONSchema:t6,JSONSchemaGenerator:nu,TimePrecision:i_,_any:O_,_array:dd,_base64:Yl,_base64url:Kl,_bigint:y_,_boolean:v_,_catch:f1,_cidrv4:Wl,_cidrv6:Gl,_coercedBigint:$_,_coercedBoolean:g_,_coercedDate:z_,_coercedNumber:l_,_coercedString:r_,_cuid:Ll,_cuid2:Ml,_custom:C_,_date:T_,_default:l1,_discriminatedUnion:QE,_e164:Xl,_email:Ul,_emoji:Cl,_endsWith:sd,_enum:i1,_file:D_,_float32:m_,_float64:f_,_gt:wn,_gte:pt,_guid:As,_includes:rd,_int:d_,_int32:h_,_int64:b_,_intersection:e1,_ipv4:Jl,_ipv6:Vl,_isoDate:a_,_isoDateTime:s_,_isoDuration:u_,_isoTime:o_,_jwt:Hl,_ksuid:ql,_lazy:g1,_length:Ia,_literal:a1,_lowercase:td,_lt:bn,_lte:_t,_map:n1,_max:_t,_maxLength:ka,_maxSize:_a,_mime:ad,_min:pt,_minLength:pr,_minSize:mi,_multipleOf:di,_nan:x_,_nanoid:Rl,_nativeEnum:s1,_negative:U_,_never:S_,_nonnegative:P_,_nonoptional:d1,_nonpositive:Z_,_normalize:od,_null:I_,_nullable:c1,_number:c_,_optional:u1,_overwrite:Zn,_parse:pl,_parseAsync:vl,_pipe:h1,_positive:E_,_promise:y1,_property:j_,_readonly:p1,_record:t1,_refine:R_,_regex:ed,_safeParse:gl,_safeParseAsync:yl,_set:r1,_size:Ql,_startsWith:id,_string:n_,_stringbool:L_,_success:m1,_symbol:__,_templateLiteral:v1,_toLowerCase:cd,_toUpperCase:ld,_transform:o1,_trim:ud,_tuple:A_,_uint32:p_,_uint64:w_,_ulid:Bl,_undefined:k_,_union:HE,_unknown:Ds,_uppercase:nd,_url:Dl,_uuid:Zl,_uuidv4:Pl,_uuidv6:jl,_uuidv7:Al,_void:N_,_xid:Fl,clone:At,config:dt,flattenError:fl,formatError:hl,function:tI,globalConfig:Us,globalRegistry:mn,isValidBase64:_l,isValidBase64URL:yw,isValidJWT:ww,locales:Qk,parse:Wo,parseAsync:Go,prettifyError:Y$,regexes:xb,registry:El,safeParse:K$,safeParseAsync:X$,toDotPath:G$,toJSONSchema:nI,treeifyError:W$,util:BE,version:Xb},Symbol.toStringTag,{value:"Module"})),r6={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},i6=Object.freeze({status:"aborted"}),s6=i6;function a6(t){dt({customError:t})}function o6(){return dt().customError}dt(Hk());const De=Object.freeze(Object.defineProperty({__proto__:null,$brand:U$,$input:t_,$output:e_,NEVER:s6,TimePrecision:i_,ZodAny:tk,ZodArray:sk,ZodBase64:xd,ZodBase64URL:Ed,ZodBigInt:Ta,ZodBigIntFormat:jd,ZodBoolean:Na,ZodCIDRv4:Td,ZodCIDRv6:zd,ZodCUID:wd,ZodCUID2:_d,ZodCatch:_k,ZodCustom:Ua,ZodDate:Dd,ZodDefault:vk,ZodDiscriminatedUnion:ak,ZodE164:Ud,ZodEmail:gd,ZodEmoji:$d,ZodEnum:fi,ZodError:b1,ZodFile:hk,ZodGUID:Cs,ZodIPv4:Sd,ZodIPv6:Nd,ZodISODate:fd,ZodISODateTime:md,ZodISODuration:pd,ZodISOTime:hd,ZodIntersection:ok,ZodIssueCode:r6,ZodJWT:Zd,ZodKSUID:Od,ZodLazy:Tk,ZodLiteral:mk,ZodMap:lk,ZodNaN:Ik,ZodNanoID:bd,ZodNever:rk,ZodNonOptional:Fd,ZodNull:ek,ZodNullable:pk,ZodNumber:Sa,ZodNumberFormat:Nr,ZodObject:xa,ZodOptional:Bd,ZodPipe:qd,ZodPrefault:yk,ZodPromise:xk,ZodReadonly:Ok,ZodRealError:ji,ZodRecord:Rd,ZodSet:dk,ZodString:Oa,ZodStringFormat:_e,ZodSuccess:wk,ZodSymbol:K_,ZodTemplateLiteral:Nk,ZodTransform:Ld,ZodTuple:ck,ZodType:te,ZodULID:kd,ZodURL:yd,ZodUUID:qt,ZodUndefined:H_,ZodUnion:Cd,ZodUnknown:nk,ZodVoid:ik,ZodXID:Id,_ZodString:vd,_default:gk,any:Y1,array:Ai,base64:R1,base64url:L1,bigint:_n,boolean:Pd,catch:kk,check:Ek,cidrv4:D1,cidrv6:C1,clone:At,coerce:XU,config:dt,core:n6,cuid:x1,cuid2:E1,custom:mU,date:X1,discriminatedUnion:tU,e164:M1,email:w1,emoji:T1,endsWith:sd,enum:Ke,file:aU,flattenError:fl,float32:F1,float64:q1,formatError:hl,function:tI,getErrorMap:o6,globalRegistry:mn,gt:wn,gte:pt,guid:_1,includes:rd,instanceof:ye,int:Ko,int32:J1,int64:W1,intersection:uk,ipv4:j1,ipv6:A1,iso:$1,json:hU,jwt:B1,keyof:H1,ksuid:P1,lazy:zk,length:Ia,literal:fk,locales:Qk,looseObject:eU,lowercase:td,lt:bn,lte:_t,map:rU,maxLength:ka,maxSize:_a,mime:ad,minLength:pr,minSize:mi,multipleOf:di,nan:cU,nanoid:z1,nativeEnum:sU,negative:U_,never:za,nonnegative:P_,nonoptional:bk,nonpositive:Z_,normalize:od,null:Ad,nullable:Ls,nullish:oU,number:Q,object:he,optional:Rs,overwrite:Zn,parse:V_,parseAsync:W_,partialRecord:nU,pipe:Ms,positive:E_,prefault:$k,preprocess:pU,prettifyError:Y$,promise:dU,property:j_,readonly:Sk,record:Ea,refine:Uk,regex:ed,regexes:xb,registry:El,safeParse:G_,safeParseAsync:Y_,set:iU,setErrorMap:a6,size:Ql,startsWith:id,strictObject:Q1,string:Te,stringbool:fU,success:uU,superRefine:Zk,symbol:X_,templateLiteral:lU,toJSONSchema:nI,toLowerCase:cd,toUpperCase:ld,transform:Md,treeifyError:W$,trim:ud,tuple:Tr,uint32:V1,uint64:G1,ulid:U1,undefined:Q_,union:Ue,unknown:vr,uppercase:nd,url:N1,uuid:k1,uuidv4:I1,uuidv6:O1,uuidv7:S1,void:K1,xid:Z1},Symbol.toStringTag,{value:"Module"})),u6=async t=>await new Promise(e=>setTimeout(e,oe.fromMilliseconds(t).milliseconds));class c6{constructor(e){Et(this,"config"),Et(this,"retries"),Et(this,"interval"),this.config={baseInterval:new oe((e==null?void 0:e.baseInterval)??oe.seconds(1)),maxRetries:(e==null?void 0:e.maxRetries)??5,scale:(e==null?void 0:e.scale)??1,sleepFn:(e==null?void 0:e.sleepFn)??u6},this.retries=0,this.interval=new oe(this.config.baseInterval)}async wait(){const{maxRetries:e,scale:r,sleepFn:i}=this.config;return this.retries>=e?!1:(await i(this.interval),this.interval=this.interval.mult(r),this.retries++,!0)}reset(){this.retries=0,this.interval=this.config.baseInterval}}const l6=he({baseInterval:oe.z.optional(),maxRetries:Q().optional(),scale:Q().optional()}),d6=Object.freeze(Object.defineProperty({__proto__:null,Breaker:c6,breakerConfigZ:l6},Symbol.toStringTag,{value:"Module"})),m6=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,rI=Te().regex(m6),nr=Q().min(0).max(255),iI=Q().min(0).max(1),sI=Tr([nr,nr,nr,iI]),f6=Tr([nr,nr,nr]),h6=he({rgba255:sI}),p6=Q().min(0).max(360),v6=Q().min(0).max(100),g6=Q().min(0).max(100),y6=Tr([p6,v6,g6,iI]),Vd=Ue([rI,f6,sI,y6,h6]),$6=Vd.transform(t=>Wd(t)),Wd=(t,e=1)=>{if(t=Vd.parse(t),typeof t=="string")return b6(t,e);if(Array.isArray(t)){if(t.length<3||t.length>4)throw new Error(`Invalid color: [${t.join(", ")}]`);return t.length===3?[...t,e]:t}return t.rgba255},b6=(t,e=1)=>(t=rI.parse(t),t=w6(t),[is(t,0),is(t,2),is(t,4),t.length===8?is(t,6)/255:e]),is=(t,e)=>parseInt(t.slice(e,e+2),16),w6=t=>t.startsWith("#")?t.slice(1):t;Wd("#000000");Wd("#ffffff");const _6=he({key:Te(),color:Vd,position:Q(),switched:Pd().optional()});Ai(_6);const k6=he({key:Te(),name:Te(),color:$6});he({key:Te(),name:Te(),swatches:Ai(k6)});Q().int().min(0).max(255);he({name:Te(),key:Te()});const I6=t=>Object.getOwnPropertySymbols(globalThis).includes(t),O6=(t,e)=>{const r=Symbol.for(t);if(!I6(r)){const i=e();Object.defineProperty(globalThis,r,{value:i})}return()=>globalThis[r]},aI="sy_x_error",S6=t=>e=>e!=null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"?e.type.startsWith(t):e instanceof Error?e.message.startsWith(t):typeof e!="string"?!1:e.startsWith(t),Pa=t=>{var e;return e=class extends Error{constructor(r,i){super(r,i),Et(this,"discriminator",e.discriminator),Et(this,"type",e.TYPE),Et(this,"matches",e.matches),this.name=e.TYPE}static sub(r){return Pa(`${t}.${r}`)}},Et(e,"discriminator",aI),Et(e,"TYPE",t),Et(e,"matches",S6(t)),e},oI=t=>{if(t==null||typeof t!="object")return!1;const e=t;if(e.discriminator!==aI)return!1;if(!("type"in e))throw new Error(`X Error is missing its type property: ${JSON.stringify(e)}`);return!0},Wn="unknown",ru="nil";class N6{constructor(){Et(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:ru,data:""};if(oI(e))for(const r of this.providers){const i=r.encode(e);if(i!=null)return i}if(e instanceof Error)return{type:Wn,data:e.message};if(typeof e=="string")return{type:Wn,data:e};try{return{type:Wn,data:JSON.stringify(e)}}catch{return{type:Wn,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===ru)return null;if(e.type===Wn)return new iu(e.data);for(const r of this.providers){const i=r.decode(e);if(i!=null)return i}return new iu(e.data)}}const Gd=O6("synnax-error-registry",()=>new N6),T6=({encode:t,decode:e})=>Gd().register({encode:t,decode:e}),z6=t=>Gd().encode(t),x6=t=>t==null?null:Gd().decode(t);class iu extends Pa("unknown"){}const E6=he({type:Te(),data:Te()});class U6 extends Pa("canceled"){}const rn=Object.freeze(Object.defineProperty({__proto__:null,Canceled:U6,NONE:ru,UNKNOWN:Wn,Unknown:iu,createTyped:Pa,decode:x6,encode:z6,isTyped:oI,payloadZ:E6,register:T6},Symbol.toStringTag,{value:"Module"})),Z6=De.object({jsonrpc:De.literal("2.0"),method:De.string(),params:De.any().optional(),id:De.union([De.string(),De.number(),De.null()]).optional()}),uI=De.object({jsonrpc:De.literal("2.0"),id:De.union([De.string(),De.number(),De.null()])}),P6=uI.extend({result:De.json()}),j6=uI.extend({error:De.object({code:De.number().int(),message:De.string().optional(),data:De.json().optional()})}),A6=De.union([P6,j6]);De.union([Z6,A6]);Te().regex(/^\d+\.\d+\.\d+$/);const D6=["standard","scientific","engineering"];Ke(D6);Ke(["success","info","warning","error","loading","disabled"]);class Di extends rn.createTyped("freighter"){}class Ot extends Di.sub("eof"){constructor(){super("EOF")}}class gr extends Di.sub("stream_closed"){constructor(){super("StreamClosed")}}class sn extends Di.sub("unreachable"){constructor(e={}){const{message:r="Unreachable",url:i=zZ.UNKNOWN}=e;super(r),Ge(this,"url"),this.url=i}}const C6=t=>{if(!t.type.startsWith(Di.TYPE))return null;if(Ot.matches(t))return{type:Ot.TYPE,data:"EOF"};if(gr.matches(t))return{type:gr.TYPE,data:"StreamClosed"};if(sn.matches(t))return{type:sn.TYPE,data:"Unreachable"};throw new Error(`Unknown error type: ${t.type}: ${t.message}`)},R6=t=>{if(!t.type.startsWith(Di.TYPE))return null;switch(t.type){case Ot.TYPE:return new Ot;case gr.TYPE:return new gr;case sn.TYPE:return new sn;default:throw new rn.Unknown(`Unknown error type: ${t.data}`)}};rn.register({encode:C6,decode:R6});class cI{constructor(){Ge(this,"middleware",[])}use(...e){this.middleware.push(...e)}async executeMiddleware(e,r){let i=0;const n=async s=>{if(i===this.middleware.length)return await r(s);const a=this.middleware[i];return i++,await a(s,n)};return await n(e)}}const lI="Content-Type",Cf=t=>{if(Kk.RUNTIME!=="node")return fetch;const e=require("node-fetch");if(t==="http")return e;const r=require("https"),i=new r.Agent({rejectUnauthorized:!1});return async(n,s)=>await e(n,{...s,agent:i})},L6=t=>"code"in t&&t.code==="ECONNREFUSED"||t.message.toLowerCase().includes("load failed"),M6=400;class B6 extends cI{constructor(e,r,i=!1){return super(),Ge(this,"endpoint"),Ge(this,"encoder"),Ge(this,"fetch"),this.endpoint=e.replace({protocol:i?"https":"http"}),this.encoder=r,this.fetch=Cf(this.endpoint.protocol),new Proxy(this,{get:(n,s,a)=>s==="endpoint"?this.endpoint:Reflect.get(n,s,a)})}get headers(){return{[lI]:this.encoder.contentType}}async send(e,r,i,n){r=i==null?void 0:i.parse(r);let s=null;const a=this.endpoint.child(e),o={};o.method="POST",o.body=this.encoder.encode(r??{});const[,u]=await this.executeMiddleware({target:a.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async c=>{const l={...c,params:{}};o.headers={...this.headers,...c.params};let d;try{d=await Cf(c.protocol)(c.target,o)}catch(p){let _=p;return L6(_)&&(_=new sn({url:a})),[l,_]}const g=await d.arrayBuffer();if(d!=null&&d.ok)return n!=null&&(s=this.encoder.decode(g,n)),[l,null];try{if(d.status!==M6)return[l,new Error(d.statusText)];const p=this.encoder.decode(g,rn.payloadZ),_=rn.decode(p);return[l,_]}catch(p){return[l,new Error(`[freighter] - failed to decode error: ${d.statusText}: ${p.message}`)]}});if(u!=null)return[null,u];if(s==null)throw new Error("Response must be defined");return[s,null]}}const F6=(t,e)=>{class r{constructor(n){Ge(this,"wrapped"),this.wrapped=n}use(...n){this.wrapped.use(...n)}async send(n,s,a,o){const u=new d6.Breaker(e);do{const[c,l]=await this.wrapped.send(n,s,a,o);if(l==null)return[c,null];if(!sn.matches(l))return[null,l];if(!await u.wait())return[c,l]}while(!0)}}return new r(t)},Z=async(t,e,r,i,n)=>{const[s,a]=await t.send(e,r,i,n);if(a!=null)throw a;return s};function q(t,e,r){function i(o,u){var c;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(c=o._zod).traits??(c.traits=new Set),o._zod.traits.add(t),e(o,u);for(const l in a.prototype)l in o||Object.defineProperty(o,l,{value:a.prototype[l].bind(o)});o._zod.constr=a,o._zod.def=u}const n=(r==null?void 0:r.Parent)??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function a(o){var u;const c=r!=null&&r.Parent?new s:this;i(c,o),(u=c._zod).deferred??(u.deferred=[]);for(const l of c._zod.deferred)l();return c}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>{var u,c;return r!=null&&r.Parent&&o instanceof r.Parent?!0:(c=(u=o==null?void 0:o._zod)==null?void 0:u.traits)==null?void 0:c.has(t)}}),Object.defineProperty(a,"name",{value:t}),a}class hi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const dI={};function kn(t){return dI}function q6(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function J6(t,e){return typeof e=="bigint"?e.toString():e}function mI(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Yd(t){return t==null}function Kd(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Oe(t,e,r){Object.defineProperty(t,e,{get(){{const i=r();return t[e]=i,i}},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Xd(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function fI(t=10){const e="abcdefghijklmnopqrstuvwxyz";let r="";for(let i=0;i<t;i++)r+=e[Math.floor(Math.random()*e.length)];return r}function Dr(t){return JSON.stringify(t)}function su(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const V6=mI(()=>{if(typeof navigator<"u"&&navigator!=null&&navigator.userAgent.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Rf(t){if(su(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(su(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}const W6=new Set(["string","number","symbol"]);function G6(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pn(t,e,r){const i=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(i._zod.parent=t),i}function vt(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Y6(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function K6(t,e){const r={},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=i.shape[n])}return Pn(t,{...t._zod.def,shape:r,checks:[]})}function X6(t,e){const r={...t._zod.def.shape},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return Pn(t,{...t._zod.def,shape:r,checks:[]})}function H6(t,e){const r={...t._zod.def,get shape(){const i={...t._zod.def.shape,...e};return Xd(this,"shape",i),i},checks:[]};return Pn(t,r)}function Q6(t,e){return Pn(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return Xd(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function eP(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(const s in i)n[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return Pn(e,{...e._zod.def,shape:n,checks:[]})}function tP(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(const s in i)n[s]=new t({type:"nonoptional",innerType:i[s]});return Pn(e,{...e._zod.def,shape:n,checks:[]})}function ei(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r].continue!==!0)return!0;return!1}function Hd(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function ss(t){return typeof t=="string"?t:t==null?void 0:t.message}function In(t,e,r){var i,n,s,a,o,u;const c={...t,path:t.path??[]};if(!t.message){const l=ss((s=(n=(i=t.inst)==null?void 0:i._zod.def)==null?void 0:n.error)==null?void 0:s.call(n,t))??ss((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??ss((o=r.customError)==null?void 0:o.call(r,t))??ss((u=r.localeError)==null?void 0:u.call(r,t))??"Invalid input";c.message=l}return delete c.inst,delete c.continue,e!=null&&e.reportInput||delete c.input,c}function Qd(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function pi(...t){const[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}const hI=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,J6,2)},enumerable:!0})},pI=q("$ZodError",hI),vI=q("$ZodError",hI,{Parent:Error});function nP(t,e=r=>r.message){const r={},i=[];for(const n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}function rP(t,e){const r=e||function(s){return s.message},i={_errors:[]},n=s=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>n({issues:o}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)i._errors.push(r(a));else{let o=i,u=0;for(;u<a.path.length;){const c=a.path[u];u===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(a))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return n(t),i}const iP=t=>(e,r,i,n)=>{const s=i?Object.assign(i,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new hi;if(a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>In(u,s,kn())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},sP=t=>async(e,r,i,n)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>In(u,s,kn())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},gI=t=>(e,r,i)=>{const n=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new hi;return s.issues.length?{success:!1,error:new(t??pI)(s.issues.map(a=>In(a,n,kn())))}:{success:!0,data:s.value}},aP=gI(vI),yI=t=>async(e,r,i)=>{const n=i?Object.assign(i,{async:!0}):{async:!0};let s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>In(a,n,kn())))}:{success:!0,data:s.value}},oP=yI(vI),zr=q("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),uP=q("$ZodCheckMaxLength",(t,e)=>{zr.init(t,e),t._zod.when=r=>{const i=r.value;return!Yd(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const n=Qd(i);r.issues.push({origin:n,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),cP=q("$ZodCheckMinLength",(t,e)=>{zr.init(t,e),t._zod.when=r=>{const i=r.value;return!Yd(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const n=Qd(i);r.issues.push({origin:n,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),lP=q("$ZodCheckLengthEquals",(t,e)=>{zr.init(t,e),t._zod.when=r=>{const i=r.value;return!Yd(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,n=i.length;if(n===e.length)return;const s=Qd(i),a=n>e.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},input:r.value,inst:t,continue:!e.abort})}}),dP=q("$ZodCheckOverwrite",(t,e)=>{zr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class mP{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
74
|
-
`).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),n=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of n)this.content.push(s)}compile(){const e=Function,r=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(n=>` ${n}`)];return new e(...r,i.join(`
|
|
75
|
-
`))}}const fP={major:4,minor:0,patch:0},We=q("$ZodType",(t,e)=>{var r,i;t??(t={}),Oe(t._zod,"id",()=>e.type+"_"+fI(10)),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=fP;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const s of n)for(const a of s._zod.onattach)a(t);if(n.length===0)(i=t._zod).deferred??(i.deferred=[]),(r=t._zod.deferred)==null||r.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,o,u)=>{let c=ei(a),l;for(const d of o){if(d._zod.when){if(!d._zod.when(a))continue}else if(c)continue;const g=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&(u==null?void 0:u.async)===!1)throw new hi;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==g&&(c||(c=ei(a,g)))});else{if(a.issues.length===g)continue;c||(c=ei(a,g))}}return l?l.then(()=>a):a};t._zod.run=(a,o)=>{const u=t._zod.parse(a,o);if(u instanceof Promise){if(o.async===!1)throw new hi;return u.then(c=>s(c,n,o))}return s(u,n,o)}}t["~standard"]={validate:s=>{var a;try{const o=aP(t,s);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return oP(t,s).then(o=>{var u;return o.success?{value:o.data}:{issues:(u=o.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),hP=q("$ZodUnknown",(t,e)=>{We.init(t,e),t._zod.parse=r=>r}),pP=q("$ZodNever",(t,e)=>{We.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Lf(t,e,r){t.issues.length&&e.issues.push(...Hd(r,t.issues)),e.value[r]=t.value}const vP=q("$ZodArray",(t,e)=>{We.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);const s=[];for(let a=0;a<n.length;a++){const o=n[a],u=e.element._zod.run({value:o,issues:[]},i);u instanceof Promise?s.push(u.then(c=>Lf(c,r,a))):Lf(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function as(t,e,r){t.issues.length&&e.issues.push(...Hd(r,t.issues)),e.value[r]=t.value}function Mf(t,e,r,i){t.issues.length?i[r]===void 0?r in i?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...Hd(r,t.issues)):t.value===void 0?r in i&&(e.value[r]=void 0):e.value[r]=t.value}const gP=q("$ZodObject",(t,e)=>{We.init(t,e);const r=mI(()=>{const l=Object.keys(e.shape);for(const g of l)if(!(e.shape[g]instanceof We))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);const d=Y6(e.shape);return{shape:e.shape,keys:l,keySet:new Set(l),numKeys:l.length,optionalKeys:new Set(d)}});Oe(t._zod,"propValues",()=>{const l=e.shape,d={};for(const g in l){const p=l[g]._zod;if(p.values){d[g]??(d[g]=new Set);for(const _ of p.values)d[g].add(_)}}return d});const i=l=>{const d=new mP(["shape","payload","ctx"]),{keys:g,optionalKeys:p}=r.value,_=h=>{const v=Dr(h);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};d.write("const input = payload.value;");const k=Object.create(null);for(const h of g)k[h]=fI(15);d.write("const newResult = {}");for(const h of g)if(p.has(h)){const v=k[h];d.write(`const ${v} = ${_(h)};`);const w=Dr(h);d.write(`
|
|
76
|
-
if (${v}.issues.length) {
|
|
77
|
-
if (input[${w}] === undefined) {
|
|
78
|
-
if (${w} in input) {
|
|
79
|
-
newResult[${w}] = undefined;
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
payload.issues = payload.issues.concat(
|
|
83
|
-
${v}.issues.map((iss) => ({
|
|
84
|
-
...iss,
|
|
85
|
-
path: iss.path ? [${w}, ...iss.path] : [${w}],
|
|
86
|
-
}))
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
} else if (${v}.value === undefined) {
|
|
90
|
-
if (${w} in input) newResult[${w}] = undefined;
|
|
91
|
-
} else {
|
|
92
|
-
newResult[${w}] = ${v}.value;
|
|
93
|
-
}
|
|
94
|
-
`)}else{const v=k[h];d.write(`const ${v} = ${_(h)};`),d.write(`
|
|
95
|
-
if (${v}.issues.length) payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
|
|
96
|
-
...iss,
|
|
97
|
-
path: iss.path ? [${Dr(h)}, ...iss.path] : [${Dr(h)}]
|
|
98
|
-
})));`),d.write(`newResult[${Dr(h)}] = ${v}.value`)}d.write("payload.value = newResult;"),d.write("return payload;");const m=d.compile();return(h,v)=>m(l,h,v)};let n;const s=su,a=!dI.jitless,o=a&&V6.value,{catchall:u}=e;let c;t._zod.parse=(l,d)=>{c??(c=r.value);const g=l.value;if(!s(g))return l.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),l;const p=[];if(a&&o&&(d==null?void 0:d.async)===!1&&d.jitless!==!0)n||(n=i(e.shape)),l=n(l,d);else{l.value={};const v=c.shape;for(const w of c.keys){const I=v[w],A=I._zod.run({value:g[w],issues:[]},d),J=I._zod.optin==="optional"&&I._zod.optout==="optional";A instanceof Promise?p.push(A.then(ce=>J?Mf(ce,l,w,g):as(ce,l,w))):J?Mf(A,l,w,g):as(A,l,w)}}if(!u)return p.length?Promise.all(p).then(()=>l):l;const _=[],k=c.keySet,m=u._zod,h=m.def.type;for(const v of Object.keys(g)){if(k.has(v))continue;if(h==="never"){_.push(v);continue}const w=m.run({value:g[v],issues:[]},d);w instanceof Promise?p.push(w.then(I=>as(I,l,v))):as(w,l,v)}return _.length&&l.issues.push({code:"unrecognized_keys",keys:_,input:g,inst:t}),p.length?Promise.all(p).then(()=>l):l}});function Bf(t,e,r,i){for(const n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(s=>In(s,i,kn())))}),e}const yP=q("$ZodUnion",(t,e)=>{We.init(t,e),Oe(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),Oe(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>Kd(i.source)).join("|")})$`)}}),t._zod.parse=(r,i)=>{let n=!1;const s=[];for(const a of e.options){const o=a._zod.run({value:r.value,issues:[]},i);if(o instanceof Promise)s.push(o),n=!0;else{if(o.issues.length===0)return o;s.push(o)}}return n?Promise.all(s).then(a=>Bf(a,r,t,i)):Bf(s,r,t,i)}}),$P=q("$ZodIntersection",(t,e)=>{We.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r,s=e.left._zod.run({value:n,issues:[]},i),a=e.right._zod.run({value:n,issues:[]},i);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([o,u])=>Ff(r,o,u)):Ff(r,s,a)}});function au(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Rf(t)&&Rf(e)){const r=Object.keys(e),i=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(const s of i){const a=au(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n[s]=a.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<t.length;i++){const n=t[i],s=e[i],a=au(n,s);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ff(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),ei(t))return t;const i=au(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}const bP=q("$ZodEnum",(t,e)=>{We.init(t,e);const r=q6(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(i=>W6.has(typeof i)).map(i=>typeof i=="string"?G6(i):i.toString()).join("|")})$`),t._zod.parse=(i,n)=>{const s=i.value;return t._zod.values.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),wP=q("$ZodTransform",(t,e)=>{We.init(t,e),t._zod.parse=(r,i)=>{const n=e.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new hi;return r.value=n,r}}),_P=q("$ZodOptional",(t,e)=>{We.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Oe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Oe(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${Kd(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>r.value===void 0?r:e.innerType._zod.run(r,i)}),kP=q("$ZodNullable",(t,e)=>{We.init(t,e),Oe(t._zod,"optin",()=>e.innerType._zod.optin),Oe(t._zod,"optout",()=>e.innerType._zod.optout),Oe(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${Kd(r.source)}|null)$`):void 0}),Oe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),IP=q("$ZodDefault",(t,e)=>{We.init(t,e),t._zod.optin="optional",Oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(r.value===void 0)return r.value=e.defaultValue,r;const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>qf(s,e)):qf(n,e)}});function qf(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const OP=q("$ZodPrefault",(t,e)=>{We.init(t,e),t._zod.optin="optional",Oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,i))}),SP=q("$ZodNonOptional",(t,e)=>{We.init(t,e),Oe(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>Jf(s,t)):Jf(n,t)}});function Jf(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const NP=q("$ZodCatch",(t,e)=>{We.init(t,e),Oe(t._zod,"optin",()=>e.innerType._zod.optin),Oe(t._zod,"optout",()=>e.innerType._zod.optout),Oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(a=>In(a,i,kn()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>In(s,i,kn()))},input:r.value}),r.issues=[]),r)}}),TP=q("$ZodPipe",(t,e)=>{We.init(t,e),Oe(t._zod,"values",()=>e.in._zod.values),Oe(t._zod,"optin",()=>e.in._zod.optin),Oe(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,i)=>{const n=e.in._zod.run(r,i);return n instanceof Promise?n.then(s=>Vf(s,e,i)):Vf(n,e,i)}});function Vf(t,e,r){return ei(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const zP=q("$ZodReadonly",(t,e)=>{We.init(t,e),Oe(t._zod,"propValues",()=>e.innerType._zod.propValues),Oe(t._zod,"optin",()=>e.innerType._zod.optin),Oe(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(Wf):Wf(n)}});function Wf(t){return t.value=Object.freeze(t.value),t}const xP=q("$ZodCustom",(t,e)=>{zr.init(t,e),We.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{const i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(s=>Gf(s,r,i,t));Gf(n,r,i,t)}});function Gf(t,e,r,i){if(!t){const n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(pi(n))}}class EP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const i=r[0];if(this._map.set(e,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const i={...this.get(r)??{}};return delete i.id,{...i,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function UP(){return new EP}const os=UP();function ZP(t){return new t({type:"unknown"})}function PP(t,e){return new t({type:"never",...vt(e)})}function jP(t,e){return new uP({check:"max_length",...vt(e),maximum:t})}function Yf(t,e){return new cP({check:"min_length",...vt(e),minimum:t})}function AP(t,e){return new lP({check:"length_equals",...vt(e),length:t})}function DP(t){return new dP({check:"overwrite",tx:t})}function CP(t,e,r){return new t({type:"array",element:e,...vt(r)})}function RP(t,e,r){return new t({type:"custom",check:"custom",fn:e,...vt(r)})}const LP=(t,e)=>{pI.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>rP(t,r)},flatten:{value:r=>nP(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},ja=q("ZodError",LP,{Parent:Error}),MP=iP(ja),BP=sP(ja),FP=gI(ja),qP=yI(ja),it=q("ZodType",(t,e)=>(We.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),t.clone=(r,i)=>Pn(t,r,i),t.brand=()=>t,t.register=(r,i)=>(r.add(t,i),t),t.parse=(r,i)=>MP(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>FP(t,r,i),t.parseAsync=async(r,i)=>BP(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>qP(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(gj(r,i)),t.superRefine=r=>t.check(yj(r)),t.overwrite=r=>t.check(DP(r)),t.optional=()=>cu(t),t.nullable=()=>Kf(t),t.nullish=()=>cu(Kf(t)),t.nonoptional=r=>cj(t,r),t.array=()=>YP(t),t.or=r=>QP([t,r]),t.and=r=>tj(t,r),t.transform=r=>Xf(t,rj(r)),t.default=r=>aj(t,r),t.prefault=r=>uj(t,r),t.catch=r=>dj(t,r),t.pipe=r=>Xf(t,r),t.readonly=()=>hj(t),t.describe=r=>{const i=t.clone();return os.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){var r;return(r=os.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return os.get(t);const i=t.clone();return os.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),JP=q("ZodUnknown",(t,e)=>{hP.init(t,e),it.init(t,e)});function ou(){return ZP(JP)}const VP=q("ZodNever",(t,e)=>{pP.init(t,e),it.init(t,e)});function WP(t){return PP(VP,t)}const GP=q("ZodArray",(t,e)=>{vP.init(t,e),it.init(t,e),t.element=e.element,t.min=(r,i)=>t.check(Yf(r,i)),t.nonempty=r=>t.check(Yf(1,r)),t.max=(r,i)=>t.check(jP(r,i)),t.length=(r,i)=>t.check(AP(r,i)),t.unwrap=()=>t.element});function YP(t,e){return CP(GP,t,e)}const KP=q("ZodObject",(t,e)=>{gP.init(t,e),it.init(t,e),Oe(t,"shape",()=>Object.fromEntries(Object.entries(t._zod.def.shape))),t.keyof=()=>$I(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ou()}),t.loose=()=>t.clone({...t._zod.def,catchall:ou()}),t.strict=()=>t.clone({...t._zod.def,catchall:WP()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>H6(t,r),t.merge=r=>Q6(t,r),t.pick=r=>K6(t,r),t.omit=r=>X6(t,r),t.partial=(...r)=>eP(bI,t,r[0]),t.required=(...r)=>tP(wI,t,r[0])});function XP(t,e){const r={type:"object",get shape(){return Xd(this,"shape",{...t}),this.shape},...vt(e)};return new KP(r)}const HP=q("ZodUnion",(t,e)=>{yP.init(t,e),it.init(t,e),t.options=e.options});function QP(t,e){return new HP({type:"union",options:t,...vt(e)})}const ej=q("ZodIntersection",(t,e)=>{$P.init(t,e),it.init(t,e)});function tj(t,e){return new ej({type:"intersection",left:t,right:e})}const uu=q("ZodEnum",(t,e)=>{bP.init(t,e),it.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(i,n)=>{const s={};for(const a of i)if(r.has(a))s[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new uu({...e,checks:[],...vt(n),entries:s})},t.exclude=(i,n)=>{const s={...e.entries};for(const a of i)if(r.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new uu({...e,checks:[],...vt(n),entries:s})}});function $I(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new uu({type:"enum",entries:r,...vt(e)})}const nj=q("ZodTransform",(t,e)=>{wP.init(t,e),it.init(t,e),t._zod.parse=(r,i)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(pi(s,r.value,e));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(pi(a))}};const n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function rj(t){return new nj({type:"transform",transform:t})}const bI=q("ZodOptional",(t,e)=>{_P.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cu(t){return new bI({type:"optional",innerType:t})}const ij=q("ZodNullable",(t,e)=>{kP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Kf(t){return new ij({type:"nullable",innerType:t})}const sj=q("ZodDefault",(t,e)=>{IP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function aj(t,e){return new sj({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const oj=q("ZodPrefault",(t,e)=>{OP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function uj(t,e){return new oj({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const wI=q("ZodNonOptional",(t,e)=>{SP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cj(t,e){return new wI({type:"nonoptional",innerType:t,...vt(e)})}const lj=q("ZodCatch",(t,e)=>{NP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function dj(t,e){return new lj({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const mj=q("ZodPipe",(t,e)=>{TP.init(t,e),it.init(t,e),t.in=e.in,t.out=e.out});function Xf(t,e){return new mj({type:"pipe",in:t,out:e})}const fj=q("ZodReadonly",(t,e)=>{zP.init(t,e),it.init(t,e)});function hj(t){return new fj({type:"readonly",innerType:t})}const pj=q("ZodCustom",(t,e)=>{xP.init(t,e),it.init(t,e)});function vj(t,e){const r=new zr({check:"custom",...vt(e)});return r._zod.check=t,r}function gj(t,e={}){return RP(pj,t,e)}function yj(t,e){const r=vj(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(pi(n,i.value,r._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),i.issues.push(pi(s))}},t(i.value,i)),e);return r}const $j=()=>Kk.RUNTIME!=="node"?t=>new WebSocket(t):t=>new(require("ws")).WebSocket(t,{rejectUnauthorized:!1}),bj=XP({type:$I(["data","close","open"]),payload:ou(),error:cu(rn.payloadZ)});class wj{constructor(e,r,i,n){Ge(this,"codec"),Ge(this,"reqSchema"),Ge(this,"resSchema"),Ge(this,"ws"),Ge(this,"serverClosed"),Ge(this,"sendClosed"),Ge(this,"receiveDataQueue",[]),Ge(this,"receiveCallbacksQueue",[]),this.codec=r,this.reqSchema=i,this.resSchema=n,this.ws=e,this.sendClosed=!1,this.serverClosed=null,this.listenForMessages()}async receiveOpenAck(){const e=await this.receiveMsg();if(e.type!=="open"){if(e.error==null)throw new Error("Message error must be defined");return rn.decode(e.error)}return null}send(e){if(this.serverClosed!=null)return new Ot;if(this.sendClosed)throw new gr;return this.ws.send(this.codec.encode({type:"data",payload:e})),null}async receive(){if(this.serverClosed!=null)return[null,this.serverClosed];const e=await this.receiveMsg();if(e.type==="close"){if(e.error==null)throw new Error("Message error must be defined");if(this.serverClosed=rn.decode(e.error),this.serverClosed==null)throw new Error("Message error must be defined");return[null,this.serverClosed]}return[this.resSchema.parse(e.payload),null]}received(){return this.receiveDataQueue.length!==0}closeSend(){if(this.sendClosed||this.serverClosed!=null)return;const e={type:"close"};try{this.ws.send(this.codec.encode(e))}finally{this.sendClosed=!0}}async receiveMsg(){return this.receiveDataQueue.shift()??await new Promise((r,i)=>this.receiveCallbacksQueue.push({resolve:r,reject:i}))}addMessage(e){const r=this.receiveCallbacksQueue.shift();r!=null?r.resolve(e):this.receiveDataQueue.push(e)}listenForMessages(){this.ws.onmessage=this.onMessage.bind(this),this.ws.onclose=this.onClose.bind(this)}onMessage(e){this.addMessage(this.codec.decode(e.data,bj))}onClose(e){this.addMessage({type:"close",error:{type:e.code===kj?Ot.TYPE:gr.TYPE,data:""}})}}const _j="freighterctx",kj=1e3,_I=class lu extends cI{constructor(e,r,i=!1){super(),Ge(this,"baseUrl"),Ge(this,"encoder"),Ge(this,"secure"),this.secure=i,this.baseUrl=e.replace({protocol:i?"wss":"ws"}),this.encoder=r}withCodec(e){const r=new lu(this.baseUrl,e,this.secure);return r.use(...this.middleware),r}async stream(e,r,i){const n=$j();let s;const[,a]=await this.executeMiddleware({target:e,protocol:"websocket",params:{},role:"client"},async o=>{const u=n(this.buildURL(e,o)),c={...o,params:{}};u.binaryType=lu.MESSAGE_TYPE;const l=await this.wrapSocket(u,r,i);return l instanceof Error?[c,l]:(s=l,[c,null])});if(a!=null)throw a;return s}buildURL(e,r){const i=TZ({[lI]:this.encoder.contentType,...r.params},_j);return this.baseUrl.child(e).toString()+i}async wrapSocket(e,r,i){return await new Promise(n=>{e.onopen=()=>{const s=new wj(e,this.encoder,r,i);s.receiveOpenAck().then(a=>{a!=null?n(a):n(s)}).catch(a=>n(a))},e.onerror=s=>{const a=s;n(new Error(a.message))}})}};Ge(_I,"MESSAGE_TYPE","arraybuffer");let Ij=_I;function S(t,e,r){function i(o,u){var c;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(c=o._zod).traits??(c.traits=new Set),o._zod.traits.add(t),e(o,u);for(const l in a.prototype)l in o||Object.defineProperty(o,l,{value:a.prototype[l].bind(o)});o._zod.constr=a,o._zod.def=u}const n=(r==null?void 0:r.Parent)??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function a(o){var u;const c=r!=null&&r.Parent?new s:this;i(c,o),(u=c._zod).deferred??(u.deferred=[]);for(const l of c._zod.deferred)l();return c}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>{var u,c;return r!=null&&r.Parent&&o instanceof r.Parent?!0:(c=(u=o==null?void 0:o._zod)==null?void 0:u.traits)==null?void 0:c.has(t)}}),Object.defineProperty(a,"name",{value:t}),a}class vi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const kI={};function an(t){return kI}function Oj(t){const e=Object.values(t).filter(i=>typeof i=="number");return Object.entries(t).filter(([i,n])=>e.indexOf(+i)===-1).map(([i,n])=>n)}function Sj(t,e){return typeof e=="bigint"?e.toString():e}function II(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function em(t){return t==null}function tm(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Nj(t,e){const r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,s=Number.parseInt(t.toFixed(n).replace(".","")),a=Number.parseInt(e.toFixed(n).replace(".",""));return s%a/10**n}function Se(t,e,r){Object.defineProperty(t,e,{get(){{const i=r();return t[e]=i,i}},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function nm(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function OI(t=10){const e="abcdefghijklmnopqrstuvwxyz";let r="";for(let i=0;i<t;i++)r+=e[Math.floor(Math.random()*e.length)];return r}function Cr(t){return JSON.stringify(t)}function du(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Tj=II(()=>{if(typeof navigator<"u"&&(navigator!=null&&navigator.userAgent.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function mu(t){if(du(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(du(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}const zj=new Set(["string","number","symbol"]);function Aa(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jn(t,e,r){const i=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(i._zod.parent=t),i}function D(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function xj(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Ej={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Uj(t,e){const r={},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=i.shape[n])}return jn(t,{...t._zod.def,shape:r,checks:[]})}function Zj(t,e){const r={...t._zod.def.shape},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return jn(t,{...t._zod.def,shape:r,checks:[]})}function Pj(t,e){const r={...t._zod.def,get shape(){const i={...t._zod.def.shape,...e};return nm(this,"shape",i),i},checks:[]};return jn(t,r)}function jj(t,e){return jn(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return nm(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function Aj(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(const s in i)n[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return jn(e,{...e._zod.def,shape:n,checks:[]})}function Dj(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(const s in i)n[s]=new t({type:"nonoptional",innerType:i[s]});return jn(e,{...e._zod.def,shape:n,checks:[]})}function ti(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r].continue!==!0)return!0;return!1}function fn(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function us(t){return typeof t=="string"?t:t==null?void 0:t.message}function on(t,e,r){var n,s,a,o,u,c;const i={...t,path:t.path??[]};if(!t.message){const l=us((a=(s=(n=t.inst)==null?void 0:n._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,t))??us((o=e==null?void 0:e.error)==null?void 0:o.call(e,t))??us((u=r.customError)==null?void 0:u.call(r,t))??us((c=r.localeError)==null?void 0:c.call(r,t))??"Invalid input";i.message=l}return delete i.inst,delete i.continue,e!=null&&e.reportInput||delete i.input,i}function rm(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function gi(...t){const[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}const SI=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Sj,2)},enumerable:!0})},NI=S("$ZodError",SI),TI=S("$ZodError",SI,{Parent:Error});function Cj(t,e=r=>r.message){const r={},i=[];for(const n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}function Rj(t,e){const r=e||function(s){return s.message},i={_errors:[]},n=s=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>n({issues:o}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)i._errors.push(r(a));else{let o=i,u=0;for(;u<a.path.length;){const c=a.path[u];u===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(a))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return n(t),i}const Lj=t=>(e,r,i,n)=>{const s=i?Object.assign(i,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new vi;if(a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>on(u,s,an())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},Mj=t=>async(e,r,i,n)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>on(u,s,an())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},zI=t=>(e,r,i)=>{const n=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new vi;return s.issues.length?{success:!1,error:new(t??NI)(s.issues.map(a=>on(a,n,an())))}:{success:!0,data:s.value}},Bj=zI(TI),xI=t=>async(e,r,i)=>{const n=i?Object.assign(i,{async:!0}):{async:!0};let s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>on(a,n,an())))}:{success:!0,data:s.value}},Fj=xI(TI),qj=/^[cC][^\s-]{8,}$/,Jj=/^[0-9a-z]+$/,Vj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Wj=/^[0-9a-vA-V]{20}$/,Gj=/^[A-Za-z0-9]{27}$/,Yj=/^[a-zA-Z0-9_-]{21}$/,Kj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Xj=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Hf=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,Hj=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function eA(){return new RegExp(Qj,"u")}const tA=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,rA=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,iA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,EI=/^[A-Za-z0-9_-]*$/,aA=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,oA=/^\+(?:[0-9]){6,14}[0-9]$/,UI="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",uA=new RegExp(`^${UI}$`);function ZI(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cA(t){return new RegExp(`^${ZI(t)}$`)}function lA(t){const e=ZI({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");const i=`${e}(?:${r.join("|")})`;return new RegExp(`^${UI}T(?:${i})$`)}const dA=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},mA=/^\d+n?$/,fA=/^\d+$/,hA=/^-?\d+(?:\.\d+)?/i,pA=/true|false/i,vA=/null/i,gA=/undefined/i,yA=/^[^A-Z]*$/,$A=/^[^a-z]*$/,ft=S("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),PI={number:"number",bigint:"bigint",object:"date"},jI=S("$ZodCheckLessThan",(t,e)=>{ft.init(t,e);const r=PI[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:r,code:"too_big",maximum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),AI=S("$ZodCheckGreaterThan",(t,e)=>{ft.init(t,e);const r=PI[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:r,code:"too_small",minimum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),bA=S("$ZodCheckMultipleOf",(t,e)=>{ft.init(t,e),t._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Nj(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),wA=S("$ZodCheckNumberFormat",(t,e)=>{var a;ft.init(t,e),e.format=e.format||"float64";const r=(a=e.format)==null?void 0:a.includes("int"),i=r?"int":"number",[n,s]=Ej[e.format];t._zod.onattach.push(o=>{const u=o._zod.bag;u.format=e.format,u.minimum=n,u.maximum=s,r&&(u.pattern=fA)}),t._zod.check=o=>{const u=o.value;if(r){if(!Number.isInteger(u)){o.issues.push({expected:i,format:e.format,code:"invalid_type",input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?o.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,continue:!e.abort}):o.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,continue:!e.abort});return}}u<n&&o.issues.push({origin:"number",input:u,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),u>s&&o.issues.push({origin:"number",input:u,code:"too_big",maximum:s,inst:t})}}),_A=S("$ZodCheckMaxLength",(t,e)=>{ft.init(t,e),t._zod.when=r=>{const i=r.value;return!em(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const s=rm(i);r.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),kA=S("$ZodCheckMinLength",(t,e)=>{ft.init(t,e),t._zod.when=r=>{const i=r.value;return!em(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const s=rm(i);r.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),IA=S("$ZodCheckLengthEquals",(t,e)=>{ft.init(t,e),t._zod.when=r=>{const i=r.value;return!em(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,n=i.length;if(n===e.length)return;const s=rm(i),a=n>e.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},input:r.value,inst:t,continue:!e.abort})}}),Da=S("$ZodCheckStringFormat",(t,e)=>{var r;ft.init(t,e),t._zod.onattach.push(i=>{const n=i._zod.bag;n.format=e.format,e.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(e.pattern))}),(r=t._zod).check??(r.check=i=>{if(!e.pattern)throw new Error("Not implemented.");e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})})}),OA=S("$ZodCheckRegex",(t,e)=>{Da.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),SA=S("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=yA),Da.init(t,e)}),NA=S("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=$A),Da.init(t,e)}),TA=S("$ZodCheckIncludes",(t,e)=>{ft.init(t,e);const r=Aa(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=i,t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),zA=S("$ZodCheckStartsWith",(t,e)=>{ft.init(t,e);const r=new RegExp(`^${Aa(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),xA=S("$ZodCheckEndsWith",(t,e)=>{ft.init(t,e);const r=new RegExp(`.*${Aa(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}}),EA=S("$ZodCheckOverwrite",(t,e)=>{ft.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class UA{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const i=e.split(`
|
|
99
|
-
`).filter(a=>a),n=Math.min(...i.map(a=>a.length-a.trimStart().length)),s=i.map(a=>a.slice(n)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const e=Function,r=this==null?void 0:this.args,n=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new e(...r,n.join(`
|
|
100
|
-
`))}}const ZA={major:4,minor:0,patch:0},ve=S("$ZodType",(t,e)=>{var n;var r;t??(t={}),Se(t._zod,"id",()=>e.type+"_"+OI(10)),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=ZA;const i=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&i.unshift(t);for(const s of i)for(const a of s._zod.onattach)a(t);if(i.length===0)(r=t._zod).deferred??(r.deferred=[]),(n=t._zod.deferred)==null||n.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,o,u)=>{let c=ti(a),l;for(const d of o){if(d._zod.when){if(!d._zod.when(a))continue}else if(c)continue;const g=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&(u==null?void 0:u.async)===!1)throw new vi;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==g&&(c||(c=ti(a,g)))});else{if(a.issues.length===g)continue;c||(c=ti(a,g))}}return l?l.then(()=>a):a};t._zod.run=(a,o)=>{const u=t._zod.parse(a,o);if(u instanceof Promise){if(o.async===!1)throw new vi;return u.then(c=>s(c,i,o))}return s(u,i,o)}}t["~standard"]={validate:s=>{var a;try{const o=Bj(t,s);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return Fj(t,s).then(u=>{var c;return u.success?{value:u.data}:{issues:(c=u.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}}),im=S("$ZodString",(t,e)=>{var r;ve.init(t,e),t._zod.pattern=[...((r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)??[]].pop()??dA(t._zod.bag),t._zod.parse=(i,n)=>{if(e.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:t}),i}}),ke=S("$ZodStringFormat",(t,e)=>{Da.init(t,e),im.init(t,e)}),PA=S("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Xj),ke.init(t,e)}),jA=S("$ZodUUID",(t,e)=>{if(e.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(i===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Hf(i))}else e.pattern??(e.pattern=Hf());ke.init(t,e)}),AA=S("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Hj),ke.init(t,e)}),DA=S("$ZodURL",(t,e)=>{ke.init(t,e),t._zod.check=r=>{try{const i=new URL(r.value);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:aA.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort}));return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),CA=S("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=eA()),ke.init(t,e)}),RA=S("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Yj),ke.init(t,e)}),LA=S("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=qj),ke.init(t,e)}),MA=S("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Jj),ke.init(t,e)}),BA=S("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Vj),ke.init(t,e)}),FA=S("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Wj),ke.init(t,e)}),qA=S("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Gj),ke.init(t,e)}),JA=S("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=lA(e)),ke.init(t,e),t._zod.check}),VA=S("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=uA),ke.init(t,e)}),WA=S("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=cA(e)),ke.init(t,e),t._zod.check}),GA=S("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Kj),ke.init(t,e)}),YA=S("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=tA),ke.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv4"})}),KA=S("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=nA),ke.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),XA=S("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=rA),ke.init(t,e)}),HA=S("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=iA),ke.init(t,e),t._zod.check=r=>{const[i,n]=r.value.split("/");try{if(!n)throw new Error;const s=Number(n);if(`${s}`!==n)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function DI(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const QA=S("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=sA),ke.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{DI(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function eD(t){if(!EI.test(t))return!1;const e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return DI(r)}const tD=S("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=EI),ke.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{eD(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),nD=S("$ZodE164",(t,e)=>{e.pattern??(e.pattern=oA),ke.init(t,e)});function rD(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[i]=r,n=JSON.parse(atob(i));return!("typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}const iD=S("$ZodJWT",(t,e)=>{ke.init(t,e),t._zod.check=r=>{rD(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),CI=S("$ZodNumber",(t,e)=>{ve.init(t,e),t._zod.pattern=t._zod.bag.pattern??hA,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;const s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}}),sD=S("$ZodNumber",(t,e)=>{wA.init(t,e),CI.init(t,e)}),aD=S("$ZodBoolean",(t,e)=>{ve.init(t,e),t._zod.pattern=pA,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=!!r.value}catch{}const n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}}),oD=S("$ZodBigInt",(t,e)=>{ve.init(t,e),t._zod.pattern=mA,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}const{value:n}=r;return typeof n=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:n,inst:t}),r}}),uD=S("$ZodUndefined",(t,e)=>{ve.init(t,e),t._zod.pattern=gA,t._zod.values=new Set([void 0]),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:t}),r}}),cD=S("$ZodNull",(t,e)=>{ve.init(t,e),t._zod.pattern=vA,t._zod.values=new Set([null]),t._zod.parse=(r,i)=>{const{value:n}=r;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),lD=S("$ZodUnknown",(t,e)=>{ve.init(t,e),t._zod.parse=r=>r}),dD=S("$ZodNever",(t,e)=>{ve.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Qf(t,e,r){t.issues.length&&e.issues.push(...fn(r,t.issues)),e.value[r]=t.value}const mD=S("$ZodArray",(t,e)=>{ve.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);const s=[];for(let a=0;a<n.length;a++){const o=n[a],u=e.element._zod.run({value:o,issues:[]},i);u instanceof Promise?s.push(u.then(c=>Qf(c,r,a))):Qf(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function cs(t,e,r){t.issues.length&&e.issues.push(...fn(r,t.issues)),e.value[r]=t.value}function eh(t,e,r,i){t.issues.length?i[r]===void 0?r in i?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...fn(r,t.issues)):t.value===void 0?r in i&&(e.value[r]=void 0):e.value[r]=t.value}const fD=S("$ZodObject",(t,e)=>{ve.init(t,e);const r=II(()=>{const d=Object.keys(e.shape);for(const p of d)if(!(e.shape[p]instanceof ve))throw new Error(`Invalid element at key "${p}": expected a Zod schema`);const g=xj(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(g)}});Se(t._zod,"propValues",()=>{const d=e.shape,g={};for(const p in d){const _=d[p]._zod;if(_.values){g[p]??(g[p]=new Set);for(const k of _.values)g[p].add(k)}}return g});const i=d=>{const g=new UA(["shape","payload","ctx"]),{keys:p,optionalKeys:_}=r.value,k=v=>{const w=Cr(v);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};g.write("const input = payload.value;");const m=Object.create(null);for(const v of p)m[v]=OI(15);g.write("const newResult = {}");for(const v of p)if(_.has(v)){const w=m[v];g.write(`const ${w} = ${k(v)};`);const I=Cr(v);g.write(`
|
|
101
|
-
if (${w}.issues.length) {
|
|
102
|
-
if (input[${I}] === undefined) {
|
|
103
|
-
if (${I} in input) {
|
|
104
|
-
newResult[${I}] = undefined;
|
|
105
|
-
}
|
|
106
|
-
} else {
|
|
107
|
-
payload.issues = payload.issues.concat(
|
|
108
|
-
${w}.issues.map((iss) => ({
|
|
109
|
-
...iss,
|
|
110
|
-
path: iss.path ? [${I}, ...iss.path] : [${I}],
|
|
111
|
-
}))
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
} else if (${w}.value === undefined) {
|
|
115
|
-
if (${I} in input) newResult[${I}] = undefined;
|
|
116
|
-
} else {
|
|
117
|
-
newResult[${I}] = ${w}.value;
|
|
118
|
-
}
|
|
119
|
-
`)}else{const w=m[v];g.write(`const ${w} = ${k(v)};`),g.write(`
|
|
120
|
-
if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
|
|
121
|
-
...iss,
|
|
122
|
-
path: iss.path ? [${Cr(v)}, ...iss.path] : [${Cr(v)}]
|
|
123
|
-
})));`),g.write(`newResult[${Cr(v)}] = ${w}.value`)}g.write("payload.value = newResult;"),g.write("return payload;");const h=g.compile();return(v,w)=>h(d,v,w)};let n;const s=du,a=!kI.jitless,u=a&&Tj.value,{catchall:c}=e;let l;t._zod.parse=(d,g)=>{l??(l=r.value);const p=d.value;if(!s(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),d;const _=[];if(a&&u&&(g==null?void 0:g.async)===!1&&g.jitless!==!0)n||(n=i(e.shape)),d=n(d,g);else{d.value={};const w=l.shape;for(const I of l.keys){const A=w[I],J=A._zod.run({value:p[I],issues:[]},g),ce=A._zod.optin==="optional"&&A._zod.optout==="optional";J instanceof Promise?_.push(J.then(Xe=>ce?eh(Xe,d,I,p):cs(Xe,d,I))):ce?eh(J,d,I,p):cs(J,d,I)}}if(!c)return _.length?Promise.all(_).then(()=>d):d;const k=[],m=l.keySet,h=c._zod,v=h.def.type;for(const w of Object.keys(p)){if(m.has(w))continue;if(v==="never"){k.push(w);continue}const I=h.run({value:p[w],issues:[]},g);I instanceof Promise?_.push(I.then(A=>cs(A,d,w))):cs(I,d,w)}return k.length&&d.issues.push({code:"unrecognized_keys",keys:k,input:p,inst:t}),_.length?Promise.all(_).then(()=>d):d}});function th(t,e,r,i){for(const n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(s=>on(s,i,an())))}),e}const hD=S("$ZodUnion",(t,e)=>{ve.init(t,e),Se(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),Se(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>tm(i.source)).join("|")})$`)}}),t._zod.parse=(r,i)=>{let n=!1;const s=[];for(const a of e.options){const o=a._zod.run({value:r.value,issues:[]},i);if(o instanceof Promise)s.push(o),n=!0;else{if(o.issues.length===0)return o;s.push(o)}}return n?Promise.all(s).then(a=>th(a,r,t,i)):th(s,r,t,i)}}),pD=S("$ZodIntersection",(t,e)=>{ve.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r,s=e.left._zod.run({value:n,issues:[]},i),a=e.right._zod.run({value:n,issues:[]},i);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([u,c])=>nh(r,u,c)):nh(r,s,a)}});function fu(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(mu(t)&&mu(e)){const r=Object.keys(e),i=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(const s of i){const a=fu(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n[s]=a.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<t.length;i++){const n=t[i],s=e[i],a=fu(n,s);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function nh(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),ti(t))return t;const i=fu(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}const vD=S("$ZodRecord",(t,e)=>{ve.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!mu(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;const s=[];if(e.keyType._zod.values){const a=e.keyType._zod.values;r.value={};for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){const c=e.valueType._zod.run({value:n[u],issues:[]},i);c instanceof Promise?s.push(c.then(l=>{l.issues.length&&r.issues.push(...fn(u,l.issues)),r.value[u]=l.value})):(c.issues.length&&r.issues.push(...fn(u,c.issues)),r.value[u]=c.value)}let o;for(const u in n)a.has(u)||(o=o??[],o.push(u));o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:o})}else{r.value={};for(const a of Reflect.ownKeys(n)){if(a==="__proto__")continue;const o=e.keyType._zod.run({value:a,issues:[]},i);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:o.issues.map(c=>on(c,i,an())),input:a,path:[a],inst:t}),r.value[o.value]=o.value;continue}const u=e.valueType._zod.run({value:n[a],issues:[]},i);u instanceof Promise?s.push(u.then(c=>{c.issues.length&&r.issues.push(...fn(a,c.issues)),r.value[o.value]=c.value})):(u.issues.length&&r.issues.push(...fn(a,u.issues)),r.value[o.value]=u.value)}}return s.length?Promise.all(s).then(()=>r):r}}),gD=S("$ZodEnum",(t,e)=>{ve.init(t,e);const r=Oj(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(i=>zj.has(typeof i)).map(i=>typeof i=="string"?Aa(i):i.toString()).join("|")})$`),t._zod.parse=(i,n)=>{const s=i.value;return t._zod.values.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),yD=S("$ZodTransform",(t,e)=>{ve.init(t,e),t._zod.parse=(r,i)=>{const n=e.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(a=>(r.value=a,r));if(n instanceof Promise)throw new vi;return r.value=n,r}}),$D=S("$ZodOptional",(t,e)=>{ve.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Se(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${tm(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>r.value===void 0?r:e.innerType._zod.run(r,i)}),bD=S("$ZodNullable",(t,e)=>{ve.init(t,e),Se(t._zod,"optin",()=>e.innerType._zod.optin),Se(t._zod,"optout",()=>e.innerType._zod.optout),Se(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${tm(r.source)}|null)$`):void 0}),Se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),wD=S("$ZodDefault",(t,e)=>{ve.init(t,e),t._zod.optin="optional",Se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(r.value===void 0)return r.value=e.defaultValue,r;const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>rh(s,e)):rh(n,e)}});function rh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const _D=S("$ZodPrefault",(t,e)=>{ve.init(t,e),t._zod.optin="optional",Se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,i))}),kD=S("$ZodNonOptional",(t,e)=>{ve.init(t,e),Se(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>ih(s,t)):ih(n,t)}});function ih(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const ID=S("$ZodCatch",(t,e)=>{ve.init(t,e),Se(t._zod,"optin",()=>e.innerType._zod.optin),Se(t._zod,"optout",()=>e.innerType._zod.optout),Se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(a=>on(a,i,an()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>on(s,i,an()))},input:r.value}),r.issues=[]),r)}}),OD=S("$ZodPipe",(t,e)=>{ve.init(t,e),Se(t._zod,"values",()=>e.in._zod.values),Se(t._zod,"optin",()=>e.in._zod.optin),Se(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,i)=>{const n=e.in._zod.run(r,i);return n instanceof Promise?n.then(s=>sh(s,e,i)):sh(n,e,i)}});function sh(t,e,r){return ti(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const SD=S("$ZodReadonly",(t,e)=>{ve.init(t,e),Se(t._zod,"propValues",()=>e.innerType._zod.propValues),Se(t._zod,"optin",()=>e.innerType._zod.optin),Se(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(ah):ah(n)}});function ah(t){return t.value=Object.freeze(t.value),t}const ND=S("$ZodCustom",(t,e)=>{ft.init(t,e),ve.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{const i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(s=>oh(s,r,i,t));oh(n,r,i,t)}});function oh(t,e,r,i){if(!t){const n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(gi(n))}}class TD{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const i=r[0];if(this._map.set(e,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const i={...this.get(r)??{}};return delete i.id,{...i,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function zD(){return new TD}const ls=zD();function xD(t,e){return new t({type:"string",...D(e)})}function ED(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...D(e)})}function uh(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...D(e)})}function UD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...D(e)})}function ZD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(e)})}function PD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(e)})}function jD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(e)})}function AD(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...D(e)})}function DD(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...D(e)})}function CD(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(e)})}function RD(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...D(e)})}function LD(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(e)})}function MD(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...D(e)})}function BD(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...D(e)})}function FD(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(e)})}function qD(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(e)})}function JD(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(e)})}function VD(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(e)})}function WD(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(e)})}function GD(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...D(e)})}function YD(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...D(e)})}function KD(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...D(e)})}function XD(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...D(e)})}function HD(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(e)})}function QD(t,e){return new t({type:"string",format:"date",check:"string_format",...D(e)})}function eC(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...D(e)})}function tC(t,e){return new t({type:"string",format:"duration",check:"string_format",...D(e)})}function nC(t,e){return new t({type:"number",checks:[],...D(e)})}function rC(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...D(e)})}function iC(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...D(e)})}function sC(t,e){return new t({type:"boolean",...D(e)})}function aC(t,e){return new t({type:"bigint",...D(e)})}function oC(t,e){return new t({type:"undefined",...D(e)})}function uC(t,e){return new t({type:"null",...D(e)})}function cC(t){return new t({type:"unknown"})}function lC(t,e){return new t({type:"never",...D(e)})}function Fs(t,e){return new jI({check:"less_than",...D(e),value:t,inclusive:!1})}function rr(t,e){return new jI({check:"less_than",...D(e),value:t,inclusive:!0})}function qs(t,e){return new AI({check:"greater_than",...D(e),value:t,inclusive:!1})}function tn(t,e){return new AI({check:"greater_than",...D(e),value:t,inclusive:!0})}function hu(t,e){return new bA({check:"multiple_of",...D(e),value:t})}function RI(t,e){return new _A({check:"max_length",...D(e),maximum:t})}function Js(t,e){return new kA({check:"min_length",...D(e),minimum:t})}function LI(t,e){return new IA({check:"length_equals",...D(e),length:t})}function dC(t,e){return new OA({check:"string_format",format:"regex",...D(e),pattern:t})}function mC(t){return new SA({check:"string_format",format:"lowercase",...D(t)})}function fC(t){return new NA({check:"string_format",format:"uppercase",...D(t)})}function hC(t,e){return new TA({check:"string_format",format:"includes",...D(e),includes:t})}function pC(t,e){return new zA({check:"string_format",format:"starts_with",...D(e),prefix:t})}function vC(t,e){return new xA({check:"string_format",format:"ends_with",...D(e),suffix:t})}function Ci(t){return new EA({check:"overwrite",tx:t})}function gC(t){return Ci(e=>e.normalize(t))}function yC(){return Ci(t=>t.trim())}function $C(){return Ci(t=>t.toLowerCase())}function bC(){return Ci(t=>t.toUpperCase())}function wC(t,e,r){return new t({type:"array",element:e,...D(r)})}function _C(t,e,r){return new t({type:"custom",check:"custom",fn:e,...D(r)})}const kC=S("ZodISODateTime",(t,e)=>{JA.init(t,e),xe.init(t,e)});function IC(t){return HD(kC,t)}const OC=S("ZodISODate",(t,e)=>{VA.init(t,e),xe.init(t,e)});function SC(t){return QD(OC,t)}const NC=S("ZodISOTime",(t,e)=>{WA.init(t,e),xe.init(t,e)});function TC(t){return eC(NC,t)}const zC=S("ZodISODuration",(t,e)=>{GA.init(t,e),xe.init(t,e)});function xC(t){return tC(zC,t)}const EC=(t,e)=>{NI.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Rj(t,r)},flatten:{value:r=>Cj(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},Ca=S("ZodError",EC,{Parent:Error}),UC=Lj(Ca),ZC=Mj(Ca),PC=zI(Ca),jC=xI(Ca),Ie=S("ZodType",(t,e)=>(ve.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),t.clone=(r,i)=>jn(t,r,i),t.brand=()=>t,t.register=(r,i)=>(r.add(t,i),t),t.parse=(r,i)=>UC(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>PC(t,r,i),t.parseAsync=async(r,i)=>ZC(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>jC(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(xR(r,i)),t.superRefine=r=>t.check(ER(r)),t.overwrite=r=>t.check(Ci(r)),t.optional=()=>dh(t),t.nullable=()=>mh(t),t.nullish=()=>dh(mh(t)),t.nonoptional=r=>kR(t,r),t.array=()=>xr(t),t.or=r=>un([t,r]),t.and=r=>hR(t,r),t.transform=r=>fh(t,gR(r)),t.default=r=>bR(t,r),t.prefault=r=>_R(t,r),t.catch=r=>OR(t,r),t.pipe=r=>fh(t,r),t.readonly=()=>TR(t),t.describe=r=>{const i=t.clone();return ls.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){var r;return(r=ls.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return ls.get(t);const i=t.clone();return ls.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),MI=S("_ZodString",(t,e)=>{im.init(t,e),Ie.init(t,e);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...i)=>t.check(dC(...i)),t.includes=(...i)=>t.check(hC(...i)),t.startsWith=(...i)=>t.check(pC(...i)),t.endsWith=(...i)=>t.check(vC(...i)),t.min=(...i)=>t.check(Js(...i)),t.max=(...i)=>t.check(RI(...i)),t.length=(...i)=>t.check(LI(...i)),t.nonempty=(...i)=>t.check(Js(1,...i)),t.lowercase=i=>t.check(mC(i)),t.uppercase=i=>t.check(fC(i)),t.trim=()=>t.check(yC()),t.normalize=(...i)=>t.check(gC(...i)),t.toLowerCase=()=>t.check($C()),t.toUpperCase=()=>t.check(bC())}),AC=S("ZodString",(t,e)=>{im.init(t,e),MI.init(t,e),t.email=r=>t.check(ED(DC,r)),t.url=r=>t.check(AD(CC,r)),t.jwt=r=>t.check(XD(QC,r)),t.emoji=r=>t.check(DD(RC,r)),t.guid=r=>t.check(uh(ch,r)),t.uuid=r=>t.check(UD(ds,r)),t.uuidv4=r=>t.check(ZD(ds,r)),t.uuidv6=r=>t.check(PD(ds,r)),t.uuidv7=r=>t.check(jD(ds,r)),t.nanoid=r=>t.check(CD(LC,r)),t.guid=r=>t.check(uh(ch,r)),t.cuid=r=>t.check(RD(MC,r)),t.cuid2=r=>t.check(LD(BC,r)),t.ulid=r=>t.check(MD(FC,r)),t.base64=r=>t.check(GD(KC,r)),t.base64url=r=>t.check(YD(XC,r)),t.xid=r=>t.check(BD(qC,r)),t.ksuid=r=>t.check(FD(JC,r)),t.ipv4=r=>t.check(qD(VC,r)),t.ipv6=r=>t.check(JD(WC,r)),t.cidrv4=r=>t.check(VD(GC,r)),t.cidrv6=r=>t.check(WD(YC,r)),t.e164=r=>t.check(KD(HC,r)),t.datetime=r=>t.check(IC(r)),t.date=r=>t.check(SC(r)),t.time=r=>t.check(TC(r)),t.duration=r=>t.check(xC(r))});function O(t){return xD(AC,t)}const xe=S("ZodStringFormat",(t,e)=>{ke.init(t,e),MI.init(t,e)}),DC=S("ZodEmail",(t,e)=>{AA.init(t,e),xe.init(t,e)}),ch=S("ZodGUID",(t,e)=>{PA.init(t,e),xe.init(t,e)}),ds=S("ZodUUID",(t,e)=>{jA.init(t,e),xe.init(t,e)}),CC=S("ZodURL",(t,e)=>{DA.init(t,e),xe.init(t,e)}),RC=S("ZodEmoji",(t,e)=>{CA.init(t,e),xe.init(t,e)}),LC=S("ZodNanoID",(t,e)=>{RA.init(t,e),xe.init(t,e)}),MC=S("ZodCUID",(t,e)=>{LA.init(t,e),xe.init(t,e)}),BC=S("ZodCUID2",(t,e)=>{MA.init(t,e),xe.init(t,e)}),FC=S("ZodULID",(t,e)=>{BA.init(t,e),xe.init(t,e)}),qC=S("ZodXID",(t,e)=>{FA.init(t,e),xe.init(t,e)}),JC=S("ZodKSUID",(t,e)=>{qA.init(t,e),xe.init(t,e)}),VC=S("ZodIPv4",(t,e)=>{YA.init(t,e),xe.init(t,e)}),WC=S("ZodIPv6",(t,e)=>{KA.init(t,e),xe.init(t,e)}),GC=S("ZodCIDRv4",(t,e)=>{XA.init(t,e),xe.init(t,e)}),YC=S("ZodCIDRv6",(t,e)=>{HA.init(t,e),xe.init(t,e)}),KC=S("ZodBase64",(t,e)=>{QA.init(t,e),xe.init(t,e)}),XC=S("ZodBase64URL",(t,e)=>{tD.init(t,e),xe.init(t,e)}),HC=S("ZodE164",(t,e)=>{nD.init(t,e),xe.init(t,e)}),QC=S("ZodJWT",(t,e)=>{iD.init(t,e),xe.init(t,e)}),BI=S("ZodNumber",(t,e)=>{CI.init(t,e),Ie.init(t,e),t.gt=(i,n)=>t.check(qs(i,n)),t.gte=(i,n)=>t.check(tn(i,n)),t.min=(i,n)=>t.check(tn(i,n)),t.lt=(i,n)=>t.check(Fs(i,n)),t.lte=(i,n)=>t.check(rr(i,n)),t.max=(i,n)=>t.check(rr(i,n)),t.int=i=>t.check(lh(i)),t.safe=i=>t.check(lh(i)),t.positive=i=>t.check(qs(0,i)),t.nonnegative=i=>t.check(tn(0,i)),t.negative=i=>t.check(Fs(0,i)),t.nonpositive=i=>t.check(rr(0,i)),t.multipleOf=(i,n)=>t.check(hu(i,n)),t.step=(i,n)=>t.check(hu(i,n)),t.finite=()=>t;const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function ue(t){return nC(BI,t)}const FI=S("ZodNumberFormat",(t,e)=>{sD.init(t,e),BI.init(t,e)});function lh(t){return rC(FI,t)}function eR(t){return iC(FI,t)}const tR=S("ZodBoolean",(t,e)=>{aD.init(t,e),Ie.init(t,e)});function ne(t){return sC(tR,t)}const nR=S("ZodBigInt",(t,e)=>{oD.init(t,e),Ie.init(t,e),t.gte=(i,n)=>t.check(tn(i,n)),t.min=(i,n)=>t.check(tn(i,n)),t.gt=(i,n)=>t.check(qs(i,n)),t.gte=(i,n)=>t.check(tn(i,n)),t.min=(i,n)=>t.check(tn(i,n)),t.lt=(i,n)=>t.check(Fs(i,n)),t.lte=(i,n)=>t.check(rr(i,n)),t.max=(i,n)=>t.check(rr(i,n)),t.positive=i=>t.check(qs(BigInt(0),i)),t.negative=i=>t.check(Fs(BigInt(0),i)),t.nonpositive=i=>t.check(rr(BigInt(0),i)),t.nonnegative=i=>t.check(tn(BigInt(0),i)),t.multipleOf=(i,n)=>t.check(hu(i,n));const r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function rR(t){return aC(nR,t)}const iR=S("ZodUndefined",(t,e)=>{uD.init(t,e),Ie.init(t,e)});function sR(t){return oC(iR,t)}const aR=S("ZodNull",(t,e)=>{cD.init(t,e),Ie.init(t,e)});function yi(t){return uC(aR,t)}const oR=S("ZodUnknown",(t,e)=>{lD.init(t,e),Ie.init(t,e)});function Ut(){return cC(oR)}const uR=S("ZodNever",(t,e)=>{dD.init(t,e),Ie.init(t,e)});function cR(t){return lC(uR,t)}const lR=S("ZodArray",(t,e)=>{mD.init(t,e),Ie.init(t,e),t.element=e.element,t.min=(r,i)=>t.check(Js(r,i)),t.nonempty=r=>t.check(Js(1,r)),t.max=(r,i)=>t.check(RI(r,i)),t.length=(r,i)=>t.check(LI(r,i)),t.unwrap=()=>t.element});function xr(t,e){return wC(lR,t,e)}const dR=S("ZodObject",(t,e)=>{fD.init(t,e),Ie.init(t,e),Se(t,"shape",()=>Object.fromEntries(Object.entries(t._zod.def.shape))),t.keyof=()=>Zt(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Ut()}),t.loose=()=>t.clone({...t._zod.def,catchall:Ut()}),t.strict=()=>t.clone({...t._zod.def,catchall:cR()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>Pj(t,r),t.merge=r=>jj(t,r),t.pick=r=>Uj(t,r),t.omit=r=>Zj(t,r),t.partial=(...r)=>Aj(qI,t,r[0]),t.required=(...r)=>Dj(JI,t,r[0])});function y(t,e){const r={type:"object",get shape(){return nm(this,"shape",{...t}),this.shape},...D(e)};return new dR(r)}const mR=S("ZodUnion",(t,e)=>{hD.init(t,e),Ie.init(t,e),t.options=e.options});function un(t,e){return new mR({type:"union",options:t,...D(e)})}const fR=S("ZodIntersection",(t,e)=>{pD.init(t,e),Ie.init(t,e)});function hR(t,e){return new fR({type:"intersection",left:t,right:e})}const pR=S("ZodRecord",(t,e)=>{vD.init(t,e),Ie.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Ra(t,e,r){return new pR({type:"record",keyType:t,valueType:e,...D(r)})}const pu=S("ZodEnum",(t,e)=>{gD.init(t,e),Ie.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(i,n)=>{const s={};for(const a of i)if(r.has(a))s[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new pu({...e,checks:[],...D(n),entries:s})},t.exclude=(i,n)=>{const s={...e.entries};for(const a of i)if(r.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new pu({...e,checks:[],...D(n),entries:s})}});function Zt(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new pu({type:"enum",entries:r,...D(e)})}const vR=S("ZodTransform",(t,e)=>{yD.init(t,e),Ie.init(t,e),t._zod.parse=(r,i)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(gi(s,r.value,e));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(gi(a))}};const n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function gR(t){return new vR({type:"transform",transform:t})}const qI=S("ZodOptional",(t,e)=>{$D.init(t,e),Ie.init(t,e),t.unwrap=()=>t._zod.def.innerType});function dh(t){return new qI({type:"optional",innerType:t})}const yR=S("ZodNullable",(t,e)=>{bD.init(t,e),Ie.init(t,e),t.unwrap=()=>t._zod.def.innerType});function mh(t){return new yR({type:"nullable",innerType:t})}const $R=S("ZodDefault",(t,e)=>{wD.init(t,e),Ie.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function bR(t,e){return new $R({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const wR=S("ZodPrefault",(t,e)=>{_D.init(t,e),Ie.init(t,e),t.unwrap=()=>t._zod.def.innerType});function _R(t,e){return new wR({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const JI=S("ZodNonOptional",(t,e)=>{kD.init(t,e),Ie.init(t,e),t.unwrap=()=>t._zod.def.innerType});function kR(t,e){return new JI({type:"nonoptional",innerType:t,...D(e)})}const IR=S("ZodCatch",(t,e)=>{ID.init(t,e),Ie.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function OR(t,e){return new IR({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const SR=S("ZodPipe",(t,e)=>{OD.init(t,e),Ie.init(t,e),t.in=e.in,t.out=e.out});function fh(t,e){return new SR({type:"pipe",in:t,out:e})}const NR=S("ZodReadonly",(t,e)=>{SD.init(t,e),Ie.init(t,e)});function TR(t){return new NR({type:"readonly",innerType:t})}const VI=S("ZodCustom",(t,e)=>{ND.init(t,e),Ie.init(t,e)});function zR(t,e){const r=new ft({check:"custom",...D(e)});return r._zod.check=t,r}function xR(t,e={}){return _C(VI,t,e)}function ER(t,e){const r=zR(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(gi(n,i.value,r._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),i.issues.push(gi(s))}},t(i.value,i)),e);return r}function sm(t,e={error:`Input not instance of ${t.name}`}){const r=new VI({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...D(e)});return r._zod.bag.Class=t,r}const WI="all",GI="create",YI="delete",KI="retrieve",XI="update",Vs=Zt([WI,GI,YI,KI,XI]);class Gt extends dr.createTyped("sy"){}class Ce extends Gt.sub("validation"){}class hh extends Ce.sub("field"){constructor(r,i){super(`${r}: ${i}`);f(this,"field");f(this,"message");this.field=r,this.message=i}}class $i extends Gt.sub("auth"){}class vu extends $i.sub("invalid_token"){}class gu extends $i.sub("expired_token"){}class ir extends Gt.sub("unexpected"){constructor(e){super(`
|
|
12
|
+
`).buffer):this.dataType.usesBigInt&&typeof N=="number"?this._data=new this.dataType.Array(u.map(E=>BigInt(Math.round(E)))).buffer:!this.dataType.usesBigInt&&typeof N=="bigint"?this._data=new this.dataType.Array(u.map(Number)).buffer:this._data=new this.dataType.Array(u).buffer}this.key=c,this.alignment=o,this.sampleOffset=a??0,this.timeRange=n??z.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:i}}static alloc({capacity:e,dataType:t,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const a=new new I(t).Array(e),i=new Y({data:a.buffer,dataType:t,...n});return i.writePos=0,i}get refCount(){return this._refCount}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){this._refCount--,this.refCount===0&&this.gl.control!=null?this.maybeGarbageCollectGLBuffer(this.gl.control):this.refCount<0&&console.warn("cannot release a series with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(e):this.writeFixed(e)}writeVariable(e){if(this.writePos===ge)return 0;const t=this.byteCapacity.valueOf()-this.writePos,n=e.subBytes(0,t);return this.writeToUnderlyingData(n),this.writePos+=n.byteLength.valueOf(),this.cachedLength!=null&&(this.cachedLength+=n.length,this.calculateCachedLength()),n.length}writeFixed(e){if(this.writePos===ge)return 0;const t=this.capacity-this.writePos,n=e.sub(0,t);return this.writeToUnderlyingData(n),this.cachedLength=void 0,this.maybeRecomputeMinMax(n),this.writePos+=n.length,n.length}writeToUnderlyingData(e){this.underlyingData.set(e.data,this.writePos)}get buffer(){return typeof this._data=="object"&&"buffer"in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===ge?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){return this.dataType.isVariable?new TextDecoder().decode(this.underlyingData).split(`
|
|
13
|
+
`).slice(0,-1):Array.from(this).map(e=>e.toString())}parseJSON(e){if(!this.dataType.equals(I.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.toStrings().map(t=>e.parse(lt.decodeString(t)))}get byteCapacity(){return new S(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===ge?this.byteCapacity:this.dataType.isVariable?new S(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength!=null?this.cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===ge?this.byteCapacity.valueOf()/this.dataType.density.valueOf():this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const t=[0];return this.data.forEach((n,a)=>{n===Ur&&(e++,t.push(a+1))}),this._cachedIndexes=t,this.cachedLength=e,e}convert(e,t=0){if(this.dataType.equals(e))return this;const n=new e.Array(this.length);for(let a=0;a<this.length;a++)n[a]=su(this.dataType,e,this.data[a],t);return new Y({data:n.buffer,dataType:e,timeRange:this.timeRange,sampleOffset:t,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(I.TIMESTAMP))this.cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMax=e.reduce((t,n)=>t>n?t:n)}else{const e=this.data;this.cachedMax=e.reduce((t,n)=>t>n?t:n)}return this.cachedMax}get max(){return this.calcMax()}calcMax(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this.cachedMax??=this.calcRawMax(),Pt(this.cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(I.TIMESTAMP))this.cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMin=e.reduce((t,n)=>t<n?t:n)}else{const e=this.data;this.cachedMin=e.reduce((t,n)=>t<n?t:n)}return this.cachedMin}get min(){return this.calcMin()}calcMin(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this.cachedMin??=this.calcRawMin(),Pt(this.cachedMin,this.sampleOffset))}get bounds(){return V(Number(this.min),Number(this.max),{makeValid:!1})}maybeRecomputeMinMax(e){if(this.cachedMin!=null){const t=e.cachedMin??e.calcRawMin();t<this.cachedMin&&(this.cachedMin=t)}if(this.cachedMax!=null){const t=e.cachedMax??e.calcRawMax();t>this.cachedMax&&(this.cachedMax=t)}}atAlignment(e,t){const n=Number(e-this.alignment);if(n<0||n>=this.length){if(t===!0)throw new Error(`[series] - no value at index ${n}`);return}return this.at(n,t)}at(e,t=!1){if(this.dataType.isVariable)return this.atVariable(e,t??!1);if(this.dataType.equals(I.UUID))return this.atUUID(e,t);e<0&&(e=this.length+e);const n=this.data[e];if(n==null){if(t===!0)throw new Error(`[series] - no value at index ${e}`);return}return Pt(n,this.sampleOffset)}atUUID(e,t){e<0&&(e=this.length+e);const n=sa(new Uint8Array(this.buffer,e*this.dataType.density.valueOf()));if(n==null){if(t)throw new Error(`[series] - no value at index ${e}`);return}return n}atVariable(e,t){let n=0,a=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[e],a=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let o=0;o<this.data.length;o++)if(this.data[o]===Ur){if(e===0){a=o;break}n=o+1,e--}if(a===0&&(a=this.data.length),n>=a||e>0){if(t)throw new Error(`[series] - no value at index ${e}`);return}}const i=this.data.slice(n,a);return this.dataType.equals(I.STRING)?new TextDecoder().decode(i):Xr(JSON.parse(new TextDecoder().decode(i)))}binarySearch(e){let t=0,n=this.length-1;const a=Wt(e);for(;t<=n;){const i=Math.floor((t+n)/2),o=a(this.at(i,!0),e);if(o===0)return i;o<0?t=i+1:n=i-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(I.FLOAT32)&&!this.dataType.equals(I.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:a}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==a)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==ge){a===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const i=this.dataType.density.size(a).valueOf(),o=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,i,o.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,n==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=ge}as(e){return aa(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:Wn(this.alignmentBounds.lower),upper:Wn(this.alignmentBounds.upper)},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}get alignmentBounds(){return V(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const e=new du(this);return this.dataType.equals(I.JSON)?new tn(e):e}return this.dataType.equals(I.UUID)?new fu(this):new yu(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new Vn(this,e,t??this.length)}subAlignmentIterator(e,t){return new Vn(this,Number(e-this.alignment),Number(t-this.alignment))}subBytes(e,t){if(e>=0&&(t==null||t>=this.byteLength.valueOf()))return this;const n=this.data.subarray(e,t);return new Y({data:n,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,t,n){if(t<=0&&(n==null||n>=this.length))return this;let a;return e?a=this.data.subarray(t,n):a=this.data.slice(t,n),new Y({data:a,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(e){return new Y({data:this.buffer,dataType:this.dataType,timeRange:z.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){let e=`Series(${this.dataType.toString()} ${this.length} [`;if(this.length<=10)e+=Array.from(this).map(t=>t.toString());else{for(let t=0;t<5;t++)e+=`${this.at(t)?.toString()}`,e+=",";e+="...,";for(let t=-5;t<0;t++)e+=this.at(t)?.toString(),t<-1&&(e+=",")}return e+="])",e}}const hu=r=>r==null?!1:Array.isArray(r)||r instanceof ArrayBuffer||ArrayBuffer.isView(r)&&!(r instanceof DataView)||r instanceof Y?!0:na(r),oa=tu(ia,Y);let Vn=class{series;end;index;constructor(e,t,n){this.series=e;const a=V(0,e.length);this.end=Bn(a,n),this.index=Bn(a,t)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},du=class{series;index;decoder;constructor(e){if(!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,t=this.series.data;for(;this.index<t.length&&t[this.index]!==Ur;)this.index++;const n=this.index;return e===n?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,n))})}};class tn{wrapped;static schema=s.z.record(s.z.string(),s.z.unknown());constructor(e){this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:lt.decodeString(e.value,tn.schema)}}}class fu{series;index;data;density;constructor(e){if(!e.dataType.equals(I.UUID))throw new Error("cannot create a UUID series iterator for a non-UUID series");this.series=e,this.index=0,this.data=new Uint8Array(e.buffer),this.density=I.UUID.density.valueOf()}next(){if(this.index>=this.series.length)return{done:!0,value:void 0};const e=sa(this.data,this.index*this.density);return this.index++,{done:!1,value:e}}}class yu{series;index;constructor(e){this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}}class ca{series;constructor(e=[]){if(e.length!==0){const t=e[0].dataType;for(let n=1;n<e.length;n++)if(!e[n].dataType.equals(t))throw new Error("[multi-series] - series must have the same data type")}this.series=e}as(e){return aa(e,this.dataType),this}get dataType(){return this.series.length===0?I.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?z.ZERO:new z(this.series[0].timeRange.start,this.series[this.series.length-1].timeRange.end)}get alignment(){return this.series.length===0?0n:this.series[0].alignment}get alignmentBounds(){return this.series.length===0?V(0n,0n):V(this.series[0].alignmentBounds.lower,this.series[this.series.length-1].alignmentBounds.upper)}push(e){const t=()=>new Error(`cannot push a ${e.dataType.toString()} series to a ${this.dataType.toString()} multi-series`),n=e.dataType.equals(this.dataType);if(oa(e)){if(this.series.length!==0&&!n)throw t();this.series.push(e)}else{if(this.series.length!==0&&e.series.length!==0&&!n)throw t();this.series.push(...e.series)}}get length(){return this.series.reduce((e,t)=>e+t.length,0)}atAlignment(e,t){for(const n of this.series)if(xt(n.alignmentBounds,e))return n.atAlignment(e,t);if(t)throw new Error(`[series] - no value at alignment ${e}`)}at(e,t=!1){e<0&&(e=this.length+e);for(const n of this.series){if(e<n.length)return n.at(e,t);e-=n.length}if(t)throw new Error(`[series] - no value at index ${e}`)}subIterator(e,t){return new yr(this,e,t??this.length)}subAlignmentIterator(e,t){if(e>=this.alignmentBounds.upper||t<=this.alignmentBounds.lower)return jr;let n=0;for(let i=0;i<this.series.length;i++){const o=this.series[i];if(e<o.alignment)break;if(e>=o.alignmentBounds.upper)n+=o.length;else if(xt(o.alignmentBounds,e)){n+=Number(e-o.alignment);break}}let a=0;for(let i=0;i<this.series.length;i++){const o=this.series[i];if(t<o.alignment)break;if(t>=o.alignmentBounds.upper)a+=o.length;else if(xt(o.alignmentBounds,t)){a+=Number(t-o.alignment);break}}return new yr(this,n,a)}subAlignmentSpanIterator(e,t){if(e>=this.alignmentBounds.upper)return jr;t=Math.min(t,Number(this.distance(e,this.alignmentBounds.upper)));let n=0;for(let a=0;a<this.series.length;a++){const i=this.series[a];if(e<i.alignment)break;if(e>=i.alignmentBounds.upper)n+=i.length;else if(xt(i.alignmentBounds,e)){n+=Number(e-i.alignment);break}}return new yr(this,n,n+t)}updateGLBuffer(e){this.series.forEach(t=>t.updateGLBuffer(e))}get bounds(){return Ul(this.series.map(e=>e.bounds))}get byteLength(){return new S(this.series.reduce((e,t)=>e+t.byteLength.valueOf(),0))}get data(){const e=new this.dataType.Array(this.length);let t=0;for(const n of this.series)e.set(n.data,t),t+=n.length;return new this.dataType.Array(e.buffer)}traverseAlignment(e,t){const n=this.series.map(a=>a.alignmentBounds);return Dl(n,e,t)}acquire(e){this.series.forEach(t=>t.acquire(e))}release(){this.series.forEach(e=>e.release())}distance(e,t){const n=this.series.map(a=>a.alignmentBounds);return Ml(n,e,t)}parseJSON(e){if(!this.dataType.equals(I.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.series.flatMap(t=>t.parseJSON(e))}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new gu(this.series)}toStrings(){return this.series.flatMap(e=>e.toStrings())}}let gu=class{series;seriesIndex;internal;constructor(e){this.series=e,this.seriesIndex=0,this.internal=e[0][Symbol.iterator]()}next(){const e=this.internal.next();return e.done===!1?e:this.seriesIndex===this.series.length-1?{done:!0,value:void 0}:(this.internal=this.series[++this.seriesIndex][Symbol.iterator](),this.next())}[Symbol.iterator](){return this}};class yr{series;index;end;constructor(e,t,n){this.series=e,this.end=n,this.index=t}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}}const Wn=r=>{const e=r>>32n,t=r&0xffffffffn;return{domain:e,sample:t}},pu=(r,e)=>{let t=null;return e===0?r:(...n)=>{t!==null&&(clearTimeout(t),t=null),t=setTimeout(()=>r(...n),e)}},mu=(r,e,t=".")=>{const n=r.split(t);return n.map((a,i)=>{const o=e(a,i,n);return o==null?null:typeof o=="string"?o:o.join(t)}).filter(a=>a!=null).join(t)},wu=(r,e)=>{if(!Array.isArray(r))return r[e];const t=r[e];if(t!=null||r.length==0)return t;const n=r[0];if(typeof n=="object"&&"key"in n)return r.find(a=>a.key===e)},bu=(r,e,t={optional:!1,separator:"."})=>{t.separator??=".";const{optional:n,getter:a=wu}=t,i=e.split(t.separator);if(i.length===1&&i[0]==="")return r;let o=r;for(const c of i){const l=a(o,c);if(l==null){if(n)return null;throw new Error(`Path ${e} does not exist. ${c} is null`)}o=l}return o};s.z.object({key:s.z.string(),value:s.z.string()});class Tu{handlers;transform;closer;constructor(e,t){this.transform=e,this.handlers=t??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){let t=e;if(this.transform!=null){const[n,a]=this.transform(e);if(!a)return;t=n}this.handlers.forEach((n,a)=>a(t))}setCloser(e){this.closer=e}async close(){return await this.closer?.()}}let vu=class{handlers;constructor(e){this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((t,n)=>n(e))}};const Eu=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:vu,Observer:Tu},Symbol.toStringTag,{value:"Module"})),Ou=s.z.record(s.z.union([s.z.number(),s.z.string(),s.z.symbol()]),s.z.unknown()),rn=r=>Object.entries(r),Nu=(r,e)=>Object.fromEntries(rn(r).map(([t,n])=>[t,e(n,t)])),zu=r=>Object.fromEntries(rn(r).filter(([e,t])=>t!==void 0)),ue=Object.freeze(Object.defineProperty({__proto__:null,entries:rn,map:Nu,purgeUndefined:zu,unknownZ:Ou},Symbol.toStringTag,{value:"Module"})),Su=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";Su();const Iu=["macOS","Windows","Linux"],Au=["macos","windows","linux"],$u={macos:"macOS",windows:"Windows",linux:"Linux"};s.z.enum(Iu).or(s.z.enum(Au).transform(r=>$u[r]));const ku=(...r)=>r.map(la).join(""),la=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),Cu=r=>r.endsWith("/")?r.slice(0,-1):r;class ot{protocol;host;port;path;constructor({host:e,port:t,protocol:n="",pathPrefix:a=""}){this.protocol=n,this.host=e,this.port=t,this.path=la(a)}replace(e){return new ot({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new ot({...this,pathPrefix:ku(this.path,e)})}toString(){return Cu(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}static UNKNOWN=new ot({host:"unknown",port:0})}const xu=r=>r.nullable().transform(e=>e===null?void 0:e).optional(),Ru=r=>s.array(r).or(r.transform(e=>[e])),ua=r=>mu(r,(e,t,n)=>{const a=t===n.length-1,i=!isNaN(parseInt(e)),o=!isNaN(parseInt(n[t+1]));return i&&(e="element"),a||o?e:[e,"shape"]}),_n=(r,e)=>{if(r==null)return null;const t=r[e];return t==null&&typeof r=="object"&&"sourceType"in r?r.sourceType()[e]:t},ju=(r,e,t)=>bu(_n(r,"shape"),ua(e),{...t,getter:_n}),ct=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:ju,getFieldSchemaPath:ua,nullToUndefined:xu,toArray:Ru},Symbol.toStringTag,{value:"Module"})),Uu=async r=>await new Promise(e=>setTimeout(e,v.fromMilliseconds(r).milliseconds));class Du{config;retries;interval;constructor(e){this.config={baseInterval:new v(e?.baseInterval??v.seconds(1)),maxRetries:e?.maxRetries??5,scale:e?.scale??1,sleepFn:e?.sleepFn??Uu},this.retries=0,this.interval=new v(this.config.baseInterval)}async wait(){const{maxRetries:e,scale:t,sleepFn:n}=this.config;return this.retries>=e?!1:(await n(this.interval),this.interval=this.interval.mult(t),this.retries++,!0)}reset(){this.retries=0,this.interval=this.config.baseInterval}}const Mu=s.z.object({baseInterval:v.z.optional(),maxRetries:s.z.number().optional(),scale:s.z.number().optional()}),ha=Object.freeze(Object.defineProperty({__proto__:null,Breaker:Du,breakerConfigZ:Mu},Symbol.toStringTag,{value:"Module"})),Zu=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,da=s.z.string().regex(Zu),Fe=s.z.number().min(0).max(255),fa=s.z.number().min(0).max(1),ya=s.z.tuple([Fe,Fe,Fe,fa]),Pu=s.z.tuple([Fe,Fe,Fe]),Lu=s.z.object({rgba255:ya}),Bu=s.z.number().min(0).max(360),qu=s.z.number().min(0).max(100),Fu=s.z.number().min(0).max(100),Yu=s.z.tuple([Bu,qu,Fu,fa]),nn=s.z.union([da,Pu,ya,Yu,Lu]),Vu=nn.transform(r=>sn(r)),sn=(r,e=1)=>{if(r=nn.parse(r),typeof r=="string")return Wu(r,e);if(Array.isArray(r)){if(r.length<3||r.length>4)throw new Error(`Invalid color: [${r.join(", ")}]`);return r.length===3?[...r,e]:r}return r.rgba255},Wu=(r,e=1)=>(r=da.parse(r),r=_u(r),[jt(r,0),jt(r,2),jt(r,4),r.length===8?jt(r,6)/255:e]),jt=(r,e)=>parseInt(r.slice(e,e+2),16),_u=r=>r.startsWith("#")?r.slice(1):r;sn("#000000");sn("#ffffff");const Hu=s.z.object({key:s.z.string(),color:nn,position:s.z.number(),switched:s.z.boolean().optional()});s.z.array(Hu);const Gu=s.z.object({key:s.z.string(),name:s.z.string(),color:Vu});s.z.object({key:s.z.string(),name:s.z.string(),swatches:s.z.array(Gu)});const ga=s.z.int().min(0).max(255),pa=255,ma=0,Ju={lower:ma,upper:pa+1},wa=s.z.object({name:s.z.string(),key:s.z.string()}),ut=r=>s.z.object({subject:wa,resource:r,authority:ga}),Ku=(...r)=>e=>e.filter(t=>{let n=!1;return t.to!=null&&(n=r.includes(t.to.resource)),t.from!=null&&!n&&(n=r.includes(t.from.resource)),n}),ba=r=>s.z.object({from:ut(r),to:s.z.null()}),Ta=r=>s.z.object({from:s.z.null(),to:ut(r)}),Xu=r=>s.z.union([ba(r),Ta(r),s.z.object({from:ut(r),to:ut(r)})]),G=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:pa,AUTHORITY_BOUNDS:Ju,ZERO_AUTHORITY:ma,acquireZ:Ta,authorityZ:ga,filterTransfersByChannelKey:Ku,releaseZ:ba,stateZ:ut,subjectZ:wa,transferZ:Xu},Symbol.toStringTag,{value:"Module"})),Qu=r=>Object.getOwnPropertySymbols(globalThis).includes(r),eh=(r,e)=>{const t=Symbol.for(r);if(!Qu(t)){const n=e();Object.defineProperty(globalThis,t,{value:n})}return()=>globalThis[t]},va="sy_x_error",th=r=>e=>e!=null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"?e.type.startsWith(r):e instanceof Error?e.message.startsWith(r):typeof e!="string"?!1:e.startsWith(r),vt=r=>class it extends Error{static discriminator=va;discriminator=it.discriminator;static TYPE=r;type=it.TYPE;static matches=th(r);matches=it.matches;constructor(t,n){super(t,n),this.name=it.TYPE}static sub(t){return vt(`${r}.${t}`)}},Ea=r=>{if(r==null||typeof r!="object")return!1;const e=r;if(e.discriminator!==va)return!1;if(!("type"in e))throw new Error(`X Error is missing its type property: ${JSON.stringify(e)}`);return!0},Pe="unknown",Dr="nil";class rh{providers=[];register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Dr,data:""};if(Ea(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:Pe,data:e.message};if(typeof e=="string")return{type:Pe,data:e};try{return{type:Pe,data:JSON.stringify(e)}}catch{return{type:Pe,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===Dr)return null;if(e.type===Pe)return new Mr(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new Mr(e.data)}}const an=eh("synnax-error-registry",()=>new rh),nh=({encode:r,decode:e})=>an().register({encode:r,decode:e}),sh=r=>an().encode(r),ah=r=>r==null?null:an().decode(r);class Mr extends vt("unknown"){}const ih=s.z.object({type:s.z.string(),data:s.z.string()});class oh extends vt("canceled"){}class ch extends vt("not_implemented"){}const le=Object.freeze(Object.defineProperty({__proto__:null,Canceled:oh,NONE:Dr,NotImplemented:ch,UNKNOWN:Pe,Unknown:Mr,createTyped:vt,decode:ah,encode:sh,isTyped:Ea,payloadZ:ih,register:nh},Symbol.toStringTag,{value:"Module"})),lh=s.object({jsonrpc:s.literal("2.0"),method:s.string(),params:s.any().optional(),id:s.union([s.string(),s.number(),s.null()]).optional()}),Oa=s.object({jsonrpc:s.literal("2.0"),id:s.union([s.string(),s.number(),s.null()])}),uh=Oa.extend({result:s.json()}),hh=Oa.extend({error:s.object({code:s.number().int(),message:s.string().optional(),data:s.json().optional()})}),dh=s.union([uh,hh]);s.union([lh,dh]);const Zr=s.z.string().regex(/^\d+\.\d+\.\d+$/),Et=(r,e,t={})=>{t.checkMajor??=!0,t.checkMinor??=!0,t.checkPatch??=!0;const n=Zr.parse(r),a=Zr.parse(e),[i,o,c]=n.split(".").map(Number),[l,h,d]=a.split(".").map(Number);if(t.checkMajor){if(i<l)return Mt;if(i>l)return Zt}if(t.checkMinor){if(o<h)return Mt;if(o>h)return Zt}if(t.checkPatch){if(c<d)return Mt;if(c>d)return Zt}return Ge},fh=(r,e,t={})=>_s(Et(r,e,t)),Na=(r,e,t={})=>Ws(Et(r,e,t)),yh=(r,e,t={})=>Vs(Et(r,e,t)),gh=({name:r,migrate:e})=>t=>{try{const n=e(t);return console.log(`${r} migrated: ${t.version} -> ${n.version}`),n}catch(n){throw console.log(`${r} failed to migrate from ${t.version}`),console.error(n),n}},ph=({name:r,migrations:e,targetSchema:t,defaultVersion:n,def:a})=>{const i=Object.keys(e).sort(Et).pop();if(i==null)return h=>{if(h.version??=n,h.version!==a.version)return console.log(`${r} version ${h.version} is newer than latest version of ${a.version}.
|
|
14
|
+
Returning default instead.
|
|
15
|
+
`),a;try{return t!=null?t.parse(h):h}catch(d){return console.log(`${r} failed to parse default. Exiting with default`),console.error(d),a}};const o=Object.keys(e).length;let c=!1;const l=h=>{try{if(o===0||Na(h.version,i))return console.log(c?`${r} ${h.version} now up to date`:`${r} version ${h.version} is up to date with target version ${a.version}`),h;const d=h.version,u=e[d],N=u(h);return c=!0,l(N)}catch(d){return console.log(`${r} failed to migrate from ${h.version} to ${i}`),console.error(d),a}};return h=>{try{if(h.version==null)if(n!=null)console.log(`${r} version is null. Setting version to default of ${n}`),h.version=n;else return console.log(`${r} version is null and no default version set. Exiting with default`),a;return l(h)}catch(d){return console.log(`${r} failed to parse final result. Exiting with default`),console.error(d),a}}},Hn=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:Et,createMigration:gh,migrator:ph,semVerNewer:Na,semVerOlder:yh,semVerZ:Zr,versionsEqual:fh},Symbol.toStringTag,{value:"Module"})),mh=["standard","scientific","engineering"];s.z.enum(mh);const za=s.z.enum(["success","info","warning","error","loading","disabled"]),wh=r=>s.z.object({key:s.z.string(),variant:za,message:s.z.string(),description:s.z.string().optional(),time:O.z,details:r??s.z.unknown().optional()}),bh=(r,e)=>{if(!(r instanceof Error))throw r;return Sa({variant:"error",message:e??r.message,description:e!=null?r.message:void 0,details:{stack:r.stack??""}})},Sa=r=>({key:en(),time:O.now(),...r}),Ht=Object.freeze(Object.defineProperty({__proto__:null,create:Sa,fromException:bh,statusZ:wh,variantZ:za},Symbol.toStringTag,{value:"Module"})),Th=(r,e="")=>{const t=r.length;return t===0?e:t===1?r[0]:t===2?`${r[0]} and ${r[1]}`:`${r.slice(0,-1).join(", ")}, and ${r[t-1]}`},vh=r=>{const e=r.split(" "),t=new Set,n=e.map(o=>o.charAt(0).toLowerCase()).join("");t.add(n.replace(/-/g,"_")),t.add(n.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"));const a=/\d+/g;r.match(a)&&e.forEach((o,c)=>{if(a.test(o)){const l=e.map((h,d)=>d!==c?h.charAt(0).toLowerCase():h).join("");t.add(l.replace(/-/g,"_")),t.add(l.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"))}});const i=e.map(o=>(o.length>3?o.substring(0,3):o).toLowerCase());return t.add(i.join("").replace(/-/g,"_")),t.add(i.join("_").replace(/-/g,"_")),Array.from(t).filter(o=>o.length>=2&&o.length<=12&&!/^\d/.test(o))},Eh=(r,e)=>r.startsWith(e)?r.slice(e.length):r,Oh=Object.freeze(Object.defineProperty({__proto__:null,createShortIdentifiers:vh,naturalLanguageJoin:Th,trimPrefix:Eh},Symbol.toStringTag,{value:"Module"})),Ia="all",Aa="create",$a="delete",ka="retrieve",Ca="update",Ft=s.z.enum([Ia,Aa,$a,ka,Ca]);class re extends le.createTyped("sy"){}class M extends re.sub("validation"){}class ht extends M.sub("path"){path;error;static encodedSchema=s.z.object({path:s.z.string().array(),error:le.payloadZ});constructor(e,t){const n=T.toArray(e);super(`${n.join(".")}: ${t.message}`),this.path=n.flatMap(a=>a.split(".")),this.error=t}static decode(e){const t=ht.encodedSchema.parse(JSON.parse(e.data));return new ht(t.path,le.decode(t.error))}}class dt extends re.sub("auth"){}class Pr extends dt.sub("invalid_token"){}class Lr extends dt.sub("expired_token"){}class Ye extends re.sub("unexpected"){constructor(e){super(`
|
|
124
16
|
Unexpected error encountered:
|
|
125
17
|
|
|
126
18
|
${e}
|
|
127
19
|
|
|
128
20
|
Please report this to the Synnax team.
|
|
129
|
-
`)}}class Vt extends Gt.sub("query"){}class On extends Vt.sub("not_found"){}class Sn extends Vt.sub("multiple_results"){}class yu extends Gt.sub("route"){constructor(r,i){super(r);f(this,"path");this.path=i}}class $u extends Gt.sub("control"){}class ph extends $u.sub("unauthorized"){}class UR extends Gt.sub("contiguity"){}const ZR=t=>{if(!t.type.startsWith(Gt.TYPE))return null;if(t.type.startsWith(Ce.TYPE)){if(t.type===hh.TYPE){const e=t.data.split(": ");return e.length<2?new Ce(t.data):new hh(e[0],e[1])}return new Ce(t.data)}return t.type.startsWith($i.TYPE)?t.type.startsWith(vu.TYPE)?new vu(t.data):t.type.startsWith(gu.TYPE)?new gu(t.data):new $i(t.data):t.type.startsWith(ir.TYPE)?new ir(t.data):t.type.startsWith(Vt.TYPE)?t.type.startsWith(On.TYPE)?new On(t.data):t.type.startsWith(Sn.TYPE)?new Sn(t.data):new Vt(t.data):t.type.startsWith($u.TYPE)?t.type.startsWith(ph.TYPE)?new ph(t.data):new $u(t.data):t.type.startsWith(yu.TYPE)?new yu(t.data,t.data):new ir(t.data)},PR=()=>{throw new Error("Not implemented")};dr.register({encode:PR,decode:ZR});const jR=async(t,e)=>{const[r,i]=await e(t);return i==null?[r,i]:i instanceof sn?[r,new sn({message:`Cannot reach cluster at ${i.url.host}:${i.url.port}`,url:i.url})]:[r,i]},Er=O().uuid(),La=O(),am=y({key:Er,name:La}),AR=t=>{const e=C.toArray(t);if(e.length===0)throw new Error("No groups specified");const r=Er.safeParse(e[0]).success;return{single:!Array.isArray(t),variant:r?"keys":"names",normalized:e,actual:t}},om="group",rt=t=>un([un([yi(),sR()]).transform(()=>[]),t.array()]),Ve=ue(),Ri=O(),Li=y({name:Ri,key:Ve,dataType:ae.z,leaseholder:ue(),index:Ve,isIndex:ne(),internal:ne(),virtual:ne(),alias:O().optional(),expression:O().default(""),requires:rt(Ve)}),HI=Li.extend({key:Ve.optional(),leaseholder:ue().optional(),index:Ve.optional(),isIndex:ne().optional(),internal:ne().optional().default(!1),virtual:ne().optional().default(!1),expression:O().optional().default(""),requires:rt(Ve).optional().default([])}),Ma="channel",DR=y({key:Ve,variant:va.variantZ,message:O()}),um="framer",vh=t=>{const e=C.toArray(t);return e.length===0?null:typeof e[0]=="number"||!isNaN(parseInt(e[0]))?"key":"name"},gh=(t,e)=>{const r=C.toArray(t);if(r.length===e.length)return;const i=vh(t);throw vh===null?new Ce("[Frame] - channel keys or names must be provided when constructing a frame."):new Ce(`[Frame] - ${i}s and series must be the same length.
|
|
130
|
-
|
|
21
|
+
`)}}class ve extends re.sub("query"){}class ft extends ve.sub("not_found"){}class yt extends ve.sub("multiple_results"){}class Br extends re.sub("route"){path;constructor(e,t){super(e),this.path=t}}class qr extends re.sub("control"){}class Gn extends qr.sub("unauthorized"){}class Nh extends re.sub("disconnected"){constructor(e="Operation failed because no cluster is connected."){super(e)}}class zh extends re.sub("contiguity"){}const Sh=r=>r.type.startsWith(re.TYPE)?r.type.startsWith(M.TYPE)?r.type===ht.TYPE?ht.decode(r):new M(r.data):r.type.startsWith(dt.TYPE)?r.type.startsWith(Pr.TYPE)?new Pr(r.data):r.type.startsWith(Lr.TYPE)?new Lr(r.data):new dt(r.data):r.type.startsWith(Ye.TYPE)?new Ye(r.data):r.type.startsWith(ve.TYPE)?r.type.startsWith(ft.TYPE)?new ft(r.data):r.type.startsWith(yt.TYPE)?new yt(r.data):new ve(r.data):r.type.startsWith(qr.TYPE)?r.type.startsWith(Gn.TYPE)?new Gn(r.data):new qr(r.data):r.type.startsWith(Br.TYPE)?new Br(r.data,r.data):new Ye(r.data):null,Ih=()=>{throw new le.NotImplemented};le.register({encode:Ih,decode:Sh});const Ah=async(r,e)=>{const[t,n]=await e(r);return n==null?[t,n]:n instanceof Te?[t,new Te({message:`Cannot reach cluster at ${n.url.host}:${n.url.port}`,url:n.url})]:[t,n]};class on{key;name;constructor(e,t){this.key=t,this.name=e}get ontologyID(){return xa(this.key)}}const xa=r=>({type:"group",key:r}),Ot=s.z.uuid(),Gt=s.z.string(),cn=s.z.object({key:Ot,name:Gt}),Ra="builtin",$h="cluster",kh="node",Jt=s.z.enum(["label","log","allow_all","builtin","cluster","channel","node","group","range","framer","range-alias","user","workspace","schematic","lineplot","rack","device","task","policy","table"]),Ch=s.z.string().transform(r=>{const[e,t]=r.split(":");return{type:Jt.parse(e),key:t??""}}),R=s.z.object({type:Jt,key:s.z.string()}).or(Ch),xh={type:Ra,key:"root"},ln=r=>`${r.type}:${r.key}`,Rh=(r,e)=>r.type===e.type&&r.key===e.key,ja=r=>{const e=T.toArray(r);return e.length===0?[]:typeof e[0]=="object"&&"id"in e[0]?e.map(({id:t})=>t):e.map(t=>R.parse(t))},Ua=s.z.object({id:R,name:s.z.string(),data:ue.unknownZ.optional().nullable()}).transform(r=>({key:ln(r.id),...r})),jh=r=>r==="to"?"from":"to",Uh=s.z.object({from:R,type:s.z.string(),to:R}).or(s.z.string().transform(r=>{const[e,t,n]=r.split("->");return{from:R.parse(e),type:t,to:R.parse(n)}})),Dh="parent",Mh=(r,e)=>!(e.type!=null&&e.type!==r.type||e.from?.type!=null&&e.from.type!==r.from.type||e.to?.type!=null&&e.to.type!==r.to.type||e.from?.key!=null&&e.from.key!==r.from.key||e.to?.key!=null&&e.to.key!==r.to.key),Zh=s.z.object({group:cn}),Ph=s.z.object({parent:R,key:Ot.optional(),name:Gt}),Lh=s.z.object({key:Ot,name:Gt}),Bh=s.z.object({keys:s.z.array(Ot)});let qh=class Lt{static CREATE_ENDPOINT="/ontology/create-group";static RENAME_ENDPOINT="/ontology/rename-group";static DELETE_ENDPOINT="/ontology/delete-group";client;constructor(e){this.client=e}async create(e,t,n){return(await g(this.client,Lt.CREATE_ENDPOINT,{parent:e,name:t,key:n},Ph,Zh)).group}async rename(e,t){await g(this.client,Lt.RENAME_ENDPOINT,{key:e,name:t},Lh,s.z.object({}))}async delete(e){await g(this.client,Lt.DELETE_ENDPOINT,{keys:e},Bh,s.z.object({}))}},Da=class{creator;constructor(e){this.creator=new qh(e)}async create(e,t,n){return this.sugar(await this.creator.create(e,t,n))}async rename(e,t){return await this.creator.rename(e,t)}async delete(...e){return await this.creator.delete(e)}sugar(e){return new on(e.name,e.key)}};const Fh=Object.freeze(Object.defineProperty({__proto__:null,Client:Da,Group:on,groupZ:cn,keyZ:Ot,nameZ:Gt,ontologyID:xa},Symbol.toStringTag,{value:"Module"})),Yh="/ontology/add-children",Vh="/ontology/remove-children",Wh="/ontology/move-children",Jn=s.z.object({id:R,children:R.array()}),_h=s.z.object({from:R,to:R,children:R.array()}),gr=s.z.object({});let Hh=class{client;constructor(e){this.client=e}async addChildren(e,...t){await g(this.client,Yh,{id:e,children:t},Jn,gr)}async removeChildren(e,...t){await g(this.client,Vh,{id:e,children:t},Jn,gr)}async moveChildren(e,t,...n){await g(this.client,Wh,{from:e,to:t,children:n},_h,gr)}};const Gh="/ontology/retrieve",Jh=s.z.object({ids:R.array().optional(),children:s.z.boolean().optional(),parents:s.z.boolean().optional(),excludeFieldData:s.z.boolean().optional(),searchTerm:s.z.string().optional(),limit:s.z.number().optional(),offset:s.z.number().optional(),types:Jt.array().optional()}),Kh=s.z.object({resources:Ua.array()});let Ma=class{type="ontology";groups;client;writer;framer;constructor(e,t){this.client=e,this.writer=new Hh(e),this.groups=new Da(e),this.framer=t}async retrieve(e,t){if(!Array.isArray(e)&&typeof e=="object"&&!("key"in e))return this.execRetrieve(e);const n=ja(e),a=await this.execRetrieve({ids:n,...t});if(Array.isArray(e))return a;if(a.length===0)throw new ve(`No resource found with ID ${Oh.naturalLanguageJoin(n.map(i=>ln(i)))}`);return a[0]}async retrieveChildren(e,t){return await this.execRetrieve({ids:T.toArray(e),children:!0,...t})}async retrieveParents(e,t){return await this.execRetrieve({ids:T.toArray(e),parents:!0,...t})}async addChildren(e,...t){return await this.writer.addChildren(e,...t)}async removeChildren(e,...t){return await this.writer.removeChildren(e,...t)}async moveChildren(e,t,...n){return await this.writer.moveChildren(e,t,...n)}async execRetrieve(e){const{resources:t}=await g(this.client,Gh,e,Jh,Kh);return t}};const Xh="sy_ontology_resource_set",Qh="sy_ontology_resource_delete",ed="sy_ontology_relationship_set",td="sy_ontology_relationship_delete",rd=Object.freeze(Object.defineProperty({__proto__:null,BUILTIN_TYPE:Ra,CLUSTER_TYPE:$h,Client:Ma,NODE_TYPE:kh,PARENT_OF_RELATIONSHIP_TYPE:Dh,RELATIONSHIP_DELETE_CHANNEL_NAME:td,RELATIONSHIP_SET_CHANNEL_NAME:ed,RESOURCE_DELETE_CHANNEL_NAME:Qh,RESOURCE_SET_CHANNEL_NAME:Xh,ROOT_ID:xh,idToString:ln,idZ:R,idsEqual:Rh,matchRelationship:Mh,oppositeRelationshipDirection:jh,parseIDs:ja,relationshipZ:Uh,resourceTypeZ:Jt,resourceZ:Ua},Symbol.toStringTag,{value:"Module"})),L=r=>s.z.union([s.z.union([s.z.null(),s.z.undefined()]).transform(()=>[]),r.array()]),Je=s.z.uuid(),Kt=s.z.object({key:Je,subjects:L(R),objects:L(R),actions:L(Ft)}),Za=s.z.object({key:Je.optional(),subjects:R.array().or(R),objects:R.array().or(R),actions:Ft.array().or(Ft)}),nd=s.z.object({keys:Je.array().optional(),subjects:R.array().optional()}),sd=s.z.object({key:Je}).transform(({key:r})=>({keys:[r]})),ad=s.z.union([s.z.object({for:R}).transform(({for:r})=>({subjects:[r]})),s.z.object({for:R.array()}).transform(({for:r})=>({subjects:r})),nd]),id=s.z.union([sd,ad]),od=s.z.object({policies:L(Kt)}),cd=s.z.object({policies:Kt.partial({key:!0}).array()}),ld=s.z.object({policies:Kt.array()}),ud=s.z.object({keys:Je.array()}),hd=s.z.object({}),dd="/access/policy/retrieve",fd="/access/policy/create",yd="/access/policy/delete";let Pa=class{client;constructor(e){this.client=e}async create(e){const t=Array.isArray(e),a=Za.array().parse(T.toArray(e)).map(o=>({objects:T.toArray(o.objects),actions:T.toArray(o.actions),subjects:T.toArray(o.subjects)})),i=await g(this.client,fd,{policies:a},cd,ld);return t?i.policies:i.policies[0]}async retrieve(e){const t="key"in e,n=await g(this.client,dd,e,id,od);return t?n.policies[0]:n.policies}async delete(e){await g(this.client,yd,{keys:T.toArray(e)},ud,hd)}};const gd=r=>({type:"policy",key:r}),pd={type:"allow_all",key:""},md=Object.freeze(Object.defineProperty({__proto__:null,ALLOW_ALL_ONTOLOGY_ID:pd,Client:Pa,keyZ:Je,newZ:Za,ontologyID:gd,policyZ:Kt},Symbol.toStringTag,{value:"Module"}));let La=class{policy;constructor(e){this.policy=new Pa(e)}};const wd=Object.freeze(Object.defineProperty({__proto__:null,ALL_ACTION:Ia,CREATE_ACTION:Aa,Client:La,DELETE_ACTION:$a,RETRIEVE_ACTION:ka,UPDATE_ACTION:Ca,actionZ:Ft},Symbol.toStringTag,{value:"Module"})),U=s.z.number(),ce=s.z.string(),Ke=s.z.object({name:ce,key:U,dataType:I.z,leaseholder:s.z.number(),index:U,isIndex:s.z.boolean(),internal:s.z.boolean(),virtual:s.z.boolean(),alias:s.z.string().optional(),expression:s.z.string().default(""),requires:L(U)}),Ba=Ke.extend({key:U.optional(),leaseholder:s.z.number().optional(),index:U.optional(),isIndex:s.z.boolean().optional(),internal:s.z.boolean().optional().default(!1),virtual:s.z.boolean().optional().default(!1),expression:s.z.string().optional().default(""),requires:L(U).optional().default([])}),bd=Ht.statusZ(),ke=s.z.union([ct.toArray(U),ct.toArray(ce),ct.toArray(Ke).transform(r=>r.map(e=>e.key))]),Td=new Error("request for lock canceled");var vd=function(r,e,t,n){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(d){try{h(n.next(d))}catch(u){o(u)}}function l(d){try{h(n.throw(d))}catch(u){o(u)}}function h(d){d.done?i(d.value):a(d.value).then(c,l)}h((n=n.apply(r,e||[])).next())})};class Ed{constructor(e,t=Td){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,a)=>{const i={resolve:n,reject:a,weight:e,priority:t},o=qa(this._queue,c=>t<=c.priority);o===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(o+1,0,i)})}runExclusive(e){return vd(this,arguments,void 0,function*(t,n=1,a=0){const[i,o]=yield this.acquire(n,a);try{return yield t(i)}finally{o()}})}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),Od(this._weightedWaiters[e-1],{resolve:n,priority:t})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const t=this._weightedWaiters[e-1];t&&(t.forEach(n=>n.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let t=this._value;t>0;t--){const n=this._weightedWaiters[t-1];if(!n)continue;const a=n.findIndex(i=>i.priority<=e);(a===-1?n:n.splice(0,a)).forEach(i=>i.resolve())}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}}function Od(r,e){const t=qa(r,n=>e.priority<=n.priority);r.splice(t+1,0,e)}function qa(r,e){for(let t=r.length-1;t>=0;t--)if(e(r[t]))return t;return-1}var Nd=function(r,e,t,n){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(d){try{h(n.next(d))}catch(u){o(u)}}function l(d){try{h(n.throw(d))}catch(u){o(u)}}function h(d){d.done?i(d.value):a(d.value).then(c,l)}h((n=n.apply(r,e||[])).next())})};class zd{constructor(e){this._semaphore=new Ed(1,e)}acquire(){return Nd(this,arguments,void 0,function*(e=0){const[,t]=yield this._semaphore.acquire(1,e);return t})}runExclusive(e,t=0){return this._semaphore.runExclusive(()=>e(),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const Sd=(r,e,{convertNumericStrings:t=!0}={})=>{const n=!Array.isArray(r);let a=T.toArray(r);const i=a[0],o=typeof i;let c;return o==="string"&&t&&!isNaN(parseInt(i))&&"number"in e?(c=e.number,a=a.map(l=>parseInt(l))):c=e[o],{single:n,variant:c,normalized:a,actual:r}},Xe=(r,e,t,n)=>{if(n){if(t.length===0)throw new ft(`${r} not found matching ${JSON.stringify(e)}`);if(t.length>1)throw new yt(`Expected one ${r} matching ${JSON.stringify(e)}, but found ${t.length}`)}},Id=s.z.object({leaseholder:s.z.number().optional(),keys:U.array().optional(),names:s.z.string().array().optional(),searchTerm:s.z.string().optional(),rangeKey:s.z.string().optional(),limit:s.z.number().optional(),offset:s.z.number().optional(),dataTypes:I.z.array().optional(),notDataTypes:I.z.array().optional(),virtual:s.z.boolean().optional(),isIndex:s.z.boolean().optional(),internal:s.z.boolean().optional(),calculated:s.z.boolean().optional()}),Ad=s.z.object({channels:L(Ke)}),J=r=>(Array.isArray(r)&&r.length>0&&typeof r[0]=="object"?r=r.map(e=>e.key):typeof r=="object"&&"key"in r&&(r=[r.key]),Sd(r,{number:"keys",string:"names"}));class Nt{static ENDPOINT="/channel/retrieve";client;constructor(e){this.client=e}async retrieve(e,t){if(!Array.isArray(e)&&typeof e=="object")return await this.execute(e);const n=J(e),{variant:a}=n;let{normalized:i}=n;return a==="keys"&&i.indexOf(0)!==-1&&(i=i.filter(o=>o!==0)),i.length===0?[]:await this.execute({[a]:i,...t})}async execute(e){const[t,n]=await this.client.send(Nt.ENDPOINT,e,Id,Ad);if(n!=null)throw n;return t.channels}}class un{cache;namesToKeys;wrapped;constructor(e){this.cache=new Map,this.namesToKeys=new Map,this.wrapped=e}async retrieve(e,t){if(!Array.isArray(e)&&typeof e=="object")return await this.wrapped.retrieve(e);const{normalized:n}=J(e),a=[],i=[];if(n.forEach(c=>{const l=this.get(c);l!=null?a.push(...l):i.push(c)}),i.length===0)return a;const o=await this.wrapped.retrieve(i,t);return this.set(o),a.concat(o)}delete(e){const{variant:t,normalized:n}=J(e);t==="names"?n.forEach(a=>{const i=this.namesToKeys.get(a);i!=null&&(i.forEach(o=>this.cache.delete(o)),this.namesToKeys.delete(a))}):n.forEach(a=>{const i=this.cache.get(a);i!=null&&(this.cache.delete(a),this.namesToKeys.delete(i.name))})}rename(e,t){e.forEach((n,a)=>{const i=t[a],o=this.cache.get(n);if(o==null)return;this.cache.delete(n);const c=this.namesToKeys.get(o.name);c!=null&&(c.delete(n),c.size===0&&this.namesToKeys.delete(o.name)),o.name=i,this.cache.set(n,o);const l=this.namesToKeys.get(i);l==null?this.namesToKeys.set(i,new Set([n])):l.add(n)})}set(e){e.forEach(t=>{this.cache.set(t.key,t);const n=this.namesToKeys.get(t.name);n==null?this.namesToKeys.set(t.name,new Set([t.key])):n.add(t.key)})}get(e){if(typeof e=="number"){const a=this.cache.get(e);return a==null?void 0:[a]}const t=this.namesToKeys.get(e);if(t==null)return;const n=[];if(t.forEach(a=>{const i=this.cache.get(a);i!=null&&n.push(i)}),n.length!==0)return n}}class Fa{mu=new zd;requests=new Map;wrapped;debouncedRun;constructor(e,t){this.wrapped=e,this.debouncedRun=pu(()=>{this.run()},t)}async retrieve(e){if(!Array.isArray(e)&&typeof e=="object")return await this.wrapped.retrieve(e);const{normalized:t,variant:n}=J(e);return n==="names"?await this.wrapped.retrieve(t):await new Promise((i,o)=>{this.mu.runExclusive(()=>{this.requests.set(t,{resolve:i,reject:o}),this.debouncedRun()})})}async run(){await this.mu.runExclusive(async()=>{const e=new Set;this.requests.forEach((t,n)=>n.forEach(a=>e.add(a)));try{const t=await this.wrapped.retrieve(Array.from(e));this.requests.forEach((n,a)=>n.resolve(t.filter(i=>a.includes(i.key))))}catch(t){this.requests.forEach(n=>n.reject(t))}finally{this.requests.clear()}})}}const Ya=async(r,e)=>{const{normalized:t}=J(e),n=await r.retrieve(t),a=[];if(t.forEach(i=>{n.find(o=>o.name===i||o.key===i)==null&&a.push(i)}),a.length>0)throw new ve(`Could not find channels: ${JSON.stringify(a)}`);return n},$d="sy_channel_set",kd="sy_channel_delete";class hn{_frameClient;key;name;dataType;leaseholder;index;isIndex;internal;alias;virtual;expression;requires;constructor({dataType:e,name:t,leaseholder:n=0,key:a=0,isIndex:i=!1,index:o=0,internal:c=!1,virtual:l=!1,frameClient:h,alias:d,expression:u="",requires:N=[]}){this.key=a,this.name=t,this.dataType=new I(e),this.leaseholder=n,this.index=o,this.isIndex=i,this.internal=c,this.alias=d,this.virtual=l,this.expression=u,this.requires=N??[],this._frameClient=h??null}get framer(){if(this._frameClient==null)throw new M("cannot read from a channel that has not been created");return this._frameClient}get payload(){return Ke.parse({key:this.key,name:this.name,dataType:this.dataType.valueOf(),leaseholder:this.leaseholder,index:this.index,isIndex:this.isIndex,internal:this.internal,virtual:this.virtual,expression:this.expression,requires:this.requires})}get isCalculated(){return gt(this.payload)}get ontologyID(){return _a(this.key)}async read(e){return await this.framer.read(e,this.key)}async write(e,t){return await this.framer.write(e,this.key,t)}}const Cd="sy_calculation_status",xd="/channel/retrieve-group",Rd=s.z.object({}),jd=s.z.object({group:cn});let Va=class{type="channel";frameClient;client;retriever;writer;constructor(e,t,n,a){this.frameClient=e,this.retriever=t,this.client=n,this.writer=a}async create(e,t={}){const{retrieveIfNameExists:n=!1}=t,a=!Array.isArray(e);let i=T.toArray(e),o=[];if(n){const c=await this.retriever.retrieve(i.map(h=>h.name)),l=new Set(c.map(h=>h.name));i=i.filter(h=>!l.has(h.name)),o=this.sugar(c)}return o=o.concat(this.sugar(await this.writer.create(i))),a?o[0]:o}async retrieve(e,t){if(typeof e=="object"&&!Array.isArray(e))return this.sugar(await this.retriever.retrieve(e));const n=!Array.isArray(e),a=this.sugar(await this.retriever.retrieve(e,t));return Xe("channel",e,a,n),n?a[0]:a}async delete(e){const{normalized:t,variant:n}=J(e);return n==="keys"?await this.writer.delete({keys:t}):await this.writer.delete({names:t})}async rename(e,t){return await this.writer.rename(T.toArray(e),T.toArray(t))}createDebouncedBatchRetriever(e=10){return new un(new Fa(new Nt(this.client),e))}sugar(e){const{frameClient:t}=this;return e.map(n=>new hn({...n,frameClient:t}))}async retrieveGroup(){const e=await g(this.client,xd,{},Rd,jd);return new on(e.group.name,e.group.key)}};const gt=({virtual:r,expression:e})=>r&&e!=="",Wa=async(r,e)=>{if(!gt(e))return e.index;for(const t of e.requires){const n=await r(t);if(n==null)return null;if(!n.virtual)return n.index}for(const t of e.requires){const n=await r(t);if(n==null)return null;if(gt(n)){const a=await Wa(r,n);if(a!=null)return a}}return null},_a=r=>({type:"channel",key:r.toString()}),Ud=s.z.object({channels:Ba.array()}),Dd=s.z.object({channels:Ke.array()}),Md=s.z.object({keys:U.array().optional(),names:ce.array().optional()}),Zd=s.z.object({}),Pd=s.z.object({keys:U.array(),names:ce.array()}),Ld=s.z.object({}),Bd="/channel/create",qd="/channel/delete",Fd="/channel/rename";let Ha=class{client;cache;constructor(e,t){this.client=e,this.cache=t}async create(e){const{channels:t}=await g(this.client,Bd,{channels:e.map(n=>({...n,dataType:n.dataType}))},Ud,Dd);return this.cache.set(t),t}async delete(e){await g(this.client,qd,e,Md,Zd),e.keys!=null&&this.cache.delete(e.keys),e.names!=null&&this.cache.delete(e.names)}async rename(e,t){await g(this.client,Fd,{keys:e,names:t},Pd,Ld),this.cache.rename(e,t)}};const Yd=Object.freeze(Object.defineProperty({__proto__:null,CALCULATION_STATUS_CHANNEL_NAME:Cd,CacheRetriever:un,Channel:hn,Client:Va,ClusterRetriever:Nt,DELETE_CHANNEL_NAME:kd,DebouncedBatchRetriever:Fa,SET_CHANNEL_NAME:$d,Writer:Ha,analyzeParams:J,calculationStatusZ:bd,isCalculated:gt,keyZ:U,nameZ:ce,newZ:Ba,ontologyID:_a,paramsZ:ke,payloadZ:Ke,resolveCalculatedIndex:Wa,retrieveRequired:Ya},Symbol.toStringTag,{value:"Module"})),Ee=s.z.uuid(),zt=s.z.object({key:Ee,username:s.z.string().min(1),firstName:s.z.string().default(""),lastName:s.z.string().default(""),rootUser:s.z.boolean().default(!0)}),Ga=zt.partial({key:!0,firstName:!0,lastName:!0}).omit({rootUser:!0}).extend({password:s.z.string().min(1)}),Vd=s.z.object({keys:Ee.array().optional(),usernames:s.z.string().array().optional()}),Wd=s.z.object({key:Ee}).transform(({key:r})=>({keys:[r]})),_d=s.z.object({username:s.z.string()}).transform(({username:r})=>({usernames:[r]})),Hd=s.z.object({usernames:s.z.string().array()}).transform(({usernames:r})=>({usernames:r})),Gd=s.z.union([Wd,_d,Hd,Vd]),Jd=s.z.object({users:L(zt)}),Kd=s.z.object({users:Ga.array()}),Xd=s.z.object({users:zt.array()}),Qd=s.z.object({key:Ee,username:s.z.string().min(1)}),ef=s.z.object({}),tf=s.z.object({key:Ee,firstName:s.z.string().optional(),lastName:s.z.string().optional()}),rf=s.z.object({}),nf=s.z.object({keys:Ee.array()}),sf=s.z.object({}),af="/user/retrieve",of="/user/create",cf="/user/change-username",lf="/user/rename",uf="/user/delete";let Ja=class{client;constructor(e){this.client=e}async create(e){const t=Array.isArray(e),n=await g(this.client,of,{users:T.toArray(e)},Kd,Xd);return t?n.users:n.users[0]}async changeUsername(e,t){await g(this.client,cf,{key:e,username:t},Qd,ef)}async retrieve(e){const t="key"in e||"username"in e,n=await g(this.client,af,e,Gd,Jd);if(!t)return n.users;if(n.users.length===0){const a="key"in e?`key ${e.key}`:`username ${e.username}`;throw new ft(`No user with ${a} found`)}if(n.users.length>1){const a="key"in e?`key ${e.key}`:`username ${e.username}`;throw new yt(`Multiple users found with ${a}`)}return n.users[0]}async rename(e,t,n){await g(this.client,lf,{key:e,firstName:t,lastName:n},tf,rf)}async delete(e){await g(this.client,uf,{keys:T.toArray(e)},nf,sf)}};const hf=r=>({type:"user",key:r}),df=Object.freeze(Object.defineProperty({__proto__:null,Client:Ja,keyZ:Ee,newZ:Ga,ontologyID:hf,userZ:zt},Symbol.toStringTag,{value:"Module"})),ff=s.z.object({username:s.z.string(),password:s.z.string()}),yf=s.z.object({token:s.z.string(),user:zt}),Kn="/auth/login",gf=3,pf="/auth/change-password",mf=s.z.object({username:s.z.string(),password:s.z.string(),newPassword:s.z.string().min(1)}),wf=s.z.object({}),bf=[Pr,Lr];let Tf=class{token;client;credentials;authenticating;authenticated;user;retryCount;constructor(e,t){this.client=e,this.authenticated=!1,this.credentials=t,this.retryCount=0}async changePassword(e){if(!this.authenticated)throw new Error("Not authenticated");await g(this.client,pf,{username:this.credentials.username,password:this.credentials.password,newPassword:e},mf,wf),this.credentials.password=e}middleware(){const e=async(t,n)=>{if(!this.authenticated&&!t.target.endsWith(Kn)){this.authenticating??=new Promise((c,l)=>{this.client.send(Kn,this.credentials,ff,yf).then(([h,d])=>{if(d!=null)return c(d);this.token=h?.token,this.user=h?.user,this.authenticated=!0,c(null)}).catch(l)});const o=await this.authenticating;if(o!=null)return[t,o]}t.params.Authorization=`Bearer ${this.token}`;const[a,i]=await n(t);return bf.some(o=>o.matches(i))&&this.retryCount<gf?(this.authenticated=!1,this.authenticating=void 0,this.retryCount+=1,e(t,n)):(this.retryCount=0,[a,i])};return e}};const Ka=s.z.enum(["disconnected","connecting","connected","failed"]),Xa=s.z.object({status:Ka,error:s.z.instanceof(Error).optional(),message:s.z.string().optional(),clusterKey:s.z.string(),clientVersion:s.z.string(),clientServerCompatible:s.z.boolean(),nodeVersion:s.z.string().optional()}),vf=s.z.object({clusterKey:s.z.string(),nodeVersion:s.z.string().optional()}),Xn={clusterKey:"",status:"disconnected",error:void 0,message:"Disconnected",clientServerCompatible:!1,clientVersion:"0.44.1"},Qn=(r,e,t)=>{const n=t?"cluster":"client";return`Synnax cluster node version ${r!=null?`${r} `:""}is too ${t?"old":"new"} for client version ${e}.
|
|
22
|
+
This may cause compatibility issues. We recommend updating the ${n}. For more information, see
|
|
23
|
+
https://docs.synnaxlabs.com/reference/typescript-client/troubleshooting#old-${n}-version`};class pt{static ENDPOINT="/connectivity/check";static DEFAULT=Xn;_state;pollFrequency=v.seconds(30);client;name;interval;clientVersion;onChangeHandlers=[];static connectionStateZ=Xa;versionWarned=!1;constructor(e,t=v.seconds(30),n,a){this._state={...Xn},this.client=e,this.pollFrequency=t,this.clientVersion=n,this.name=a,this.check(),this.startChecking()}stopChecking(){this.interval!=null&&clearInterval(this.interval)}async check(){const e=this._state.status;try{const[t,n]=await this.client.send(pt.ENDPOINT,{},s.z.object({}),vf);if(n!=null)throw n;const a=t.nodeVersion,i=this.clientVersion,o=this.versionWarned;a==null?(this._state.clientServerCompatible=!1,o||(console.warn(Qn(null,i,!0)),this.versionWarned=!0)):Hn.versionsEqual(i,a,{checkMajor:!0,checkMinor:!0,checkPatch:!1})?this._state.clientServerCompatible=!0:(this._state.clientServerCompatible=!1,o||(console.warn(Qn(a,i,Hn.semVerNewer(i,a))),this.versionWarned=!0)),this._state.status="connected",this._state.message=`Connected to ${this.name??"cluster"}`,this._state.clusterKey=t.clusterKey,this._state.nodeVersion=t.nodeVersion,this._state.clientVersion=this.clientVersion}catch(t){this._state.status="failed",this._state.error=t,this._state.message=this.state.error?.message}return this.onChangeHandlers.length>0&&e!==this._state.status&&this.onChangeHandlers.forEach(t=>t(this.state)),this.state}get state(){return{...this._state}}onChange(e){this.onChangeHandlers.push(e)}startChecking(){this.interval=setInterval(()=>{this.check()},this.pollFrequency.milliseconds)}}const Ef=Object.freeze(Object.defineProperty({__proto__:null,Checker:pt,stateZ:Xa,statusZ:Ka},Symbol.toStringTag,{value:"Module"})),Of=s.z.object({keys:U.array().optional(),bounds:z.z,names:ce.array().optional()}),Nf=s.z.object({}),zf="/frame/delete";class Sf{client;constructor(e){this.client=e}async delete(e){await g(this.client,zf,e,Of,Nf)}}const es=r=>{const e=T.toArray(r);return e.length===0?null:typeof e[0]=="number"||!isNaN(parseInt(e[0]))?"key":"name"},ts=(r,e)=>{const t=T.toArray(r);if(t.length===e.length)return;const n=es(r);throw es===null?new M("[Frame] - channel keys or names must be provided when constructing a frame."):new M(`[Frame] - ${n}s and series must be the same length.
|
|
24
|
+
Got ${t.length} ${n}s and ${e.length} series.`)};class Z{columns=[];series=[];constructor(e=[],t=[]){if(e instanceof Z){this.columns=e.columns,this.series=e.series;return}if(e instanceof Map){e.forEach((a,i)=>this.push(i,...T.toArray(a)));return}if(typeof e=="object"&&!Array.isArray(e)){if("keys"in e&&"series"in e){const a=e;a.series??=[],a.keys??=[];const i=a.series.map(o=>Qa(o));ts(a.keys,i),a.keys.forEach((o,c)=>this.push(o,i[c]))}else Object.entries(e).forEach(([a,i])=>{const o=parseInt(a);if(!isNaN(o))return this.push(o,...T.toArray(i));this.push(a,...T.toArray(i))});return}if(Array.isArray(e)||["string","number"].includes(typeof e)){const a=T.toArray(t),i=T.toArray(e);ts(i,a),a.forEach((o,c)=>this.push(i[c],o));return}throw new M(`[Frame] - invalid frame construction parameters. data parameter ust be a frame
|
|
131
25
|
payload, a list of lazy series, a lazy array, a map, or a record keyed by channel
|
|
132
|
-
name. keys parameter must be a set of channel keys or channel names.`)}get colType(){return this.columns.length===0?null:typeof this.columns[0]=="string"?"name":"key"}get keys(){if(this.colType==="name")throw new
|
|
133
|
-
`;return this.uniqueColumns.forEach(
|
|
134
|
-
`}),e+="}",e}}const Ba=y({keys:un([yi().transform(()=>[]),ue().array().optional().default([])]),series:un([yi().transform(()=>[]),Ft.crudeZ.array().optional().default([])])}),QI=t=>{const{dataType:e,data:r,timeRange:i,alignment:n}=t;return new Ft({data:r,dataType:e,timeRange:i,glBufferUsage:"static",alignment:n})},eO=t=>({timeRange:t.timeRange,dataType:t.dataType,data:new Uint8Array(t.data.buffer),alignment:t.alignment}),cn=eR(),cm=y({key:cn,variant:va.variantZ,message:O(),lastReceived:W.z}),Fa=y({key:cn,name:O(),state:l$.nullToUndefined(cm)}),tO=Fa.partial({key:!0}),qa="rack",lm=t=>t?Nn.JSON_CODEC.decodeString(t,$t):{},Mi=O(),dm=y({key:Mi,variant:va.variantZ,details:$t.or(O().transform(lm))}),Bi=y({key:Mi,rack:cn,name:O(),make:O(),model:O(),location:O(),configured:ne().optional(),properties:$t.or(O().transform(lm)),state:l$.nullToUndefined(dm)}),nO=Bi.extend({properties:Ut().transform(t=>Nn.JSON_CODEC.encodeString(t))}),Ja="device",Dt=t=>t?JSON.parse(t):{},ln=un([O(),rR().transform(t=>t.toString()),ue().transform(t=>t.toString())]),bi=y({task:ln,variant:va.variantZ,key:O().optional(),details:$t.or(O().transform(Dt)).or(xr(Ut())).or(yi())}),Fi=y({key:ln,name:O(),type:O(),internal:ne().optional(),config:$t.or(O().transform(lm)),state:bi.optional().nullable(),snapshot:ne().optional()}),rO=Fi.omit({key:!0}).extend({key:ln.transform(t=>t.toString()).optional(),config:Ut().transform(t=>Nn.JSON_CODEC.encodeString(t))}),mm=y({task:ln,type:O(),key:O(),args:$t.or(O().transform(Dt)).or(xr(Ut())).or(yi()).optional()}),Va="task",CR=t=>Number(BigInt(t)>>32n),An=O().uuid(),qi=y({key:An,name:O().min(1),color:O()}),fm="label",mt=O().uuid(),hm=O().min(1),Ur=y({key:mt,name:hm,timeRange:Ee.z,color:O().optional()}),iO=Ur.partial({key:!0}),sO=t=>{const e=C.toArray(t),r=e.length===0;let i=!1;return r||(i=mt.safeParse(e[0]).success),{single:!Array.isArray(t),variant:i?"keys":"names",normalized:e,actual:t,empty:r}},pm="range",vm="range-alias",Dn=O().uuid(),Ji=y({key:Dn,username:O().min(1),firstName:O().default(""),lastName:O().default(""),rootUser:ne().default(!0)}),aO=Ji.partial({key:!0,firstName:!0,lastName:!0}).omit({rootUser:!0}).extend({password:O().min(1)}),gm="user",Zr=O().uuid(),Wa=y({key:Zr,name:O(),data:$t.or(O().transform(Dt))}),oO=Wa.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),ym="lineplot",Pr=O().uuid(),Ga=y({key:Pr,name:O(),data:$t.or(O().transform(Dt))}),uO=Ga.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),$m="log",Ct=O().uuid(),Ya=y({key:Ct,name:O(),layout:$t.or(O().transform(Dt))}),Ka="workspace",cO=Ya.partial({key:!0}).transform(t=>({...t,layout:JSON.stringify(t.layout)})),lO=Ya.omit({layout:!0}).extend({layout:O().transform(Dt)}),Cn=O().uuid(),Xa=y({key:Cn,name:O(),data:$t.or(O().transform(Dt)),snapshot:ne()}),dO=Xa.partial({key:!0,snapshot:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),bm=Xa.extend({data:O().transform(Dt)}),wm="schematic",jr=O().uuid(),_m=y({key:jr,name:O(),data:$t.or(O().transform(Dt))}),mO=_m.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),km=_m.extend({data:O().transform(Dt)}),Im="table",Om="builtin",fO="cluster",hO="node",Vi=Zt([fm,$m,cl,Om,fO,Ma,hO,om,pm,um,vm,gm,Ka,wm,ym,qa,Ja,Va,ul,Im]),ct=y({type:Vi,key:O()}),pO=O().transform(t=>{const[e,r]=t.split(":");return{type:Vi.parse(e),key:r??""}}),Yn=un([pO,ct]),Xn=class Xn{constructor(e){f(this,"type");f(this,"key");if(e instanceof Xn){this.type=e.type,this.key=e.key;return}if(typeof e=="string"){const[r,i]=e.split(":");this.type=r,this.key=i??"";return}this.type=e.type,this.key=e.key}toString(){return`${this.type}:${this.key}`}isType(){return this.key===""}matchesType(e){return this.type===e&&this.isType()}get payload(){return{type:this.type,key:this.key}}};f(Xn,"z",un([sm(Xn),Yn.transform(e=>new Xn(e))]));let V=Xn;const RR=new V({type:Om,key:"root"}),vO=y({type:ue()}),gO=y({type:Vi,fields:Ra(O(),vO)}),yO=y({id:V.z,name:O(),schema:gO.optional().nullable(),data:$t.optional().nullable()}).transform(t=>({key:t.id.toString(),...t})),LR="to",MR="from",BR=y({from:V.z,type:O(),to:V.z}),bu=t=>{const[e,r,i]=t.split("->");return{from:new V(e),type:r,to:new V(i)}};class Sm{constructor(e,r){f(this,"key");f(this,"name");this.key=r,this.name=e}get ontologyID(){return $O(this.key)}}const $O=t=>new V({type:om,key:t}),FR=y({group:am}),qR=y({parent:ct,key:Er.optional(),name:La}),JR=y({key:Er,name:La}),VR=y({keys:xr(Er)});var bt;let WR=(bt=class{constructor(e){f(this,"client");this.client=e}async create(e,r,i){return(await Z(this.client,bt.CREATE_ENDPOINT,{parent:e,name:r,key:i},qR,FR)).group}async rename(e,r){await Z(this.client,bt.RENAME_ENDPOINT,{key:e,name:r},JR,y({}))}async delete(e){await Z(this.client,bt.DELETE_ENDPOINT,{keys:e},VR,y({}))}},f(bt,"CREATE_ENDPOINT","/ontology/create-group"),f(bt,"RENAME_ENDPOINT","/ontology/rename-group"),f(bt,"DELETE_ENDPOINT","/ontology/delete-group"),bt),bO=class{constructor(e){f(this,"creator");this.creator=new WR(e)}async create(e,r,i){return this.sugar(await this.creator.create(e,r,i))}async rename(e,r){return await this.creator.rename(e,r)}async delete(...e){return await this.creator.delete(e)}sugar(e){return new Sm(e.name,e.key)}};const GR=Object.freeze(Object.defineProperty({__proto__:null,Client:bO,Group:Sm,ONTOLOGY_TYPE:om,analyzeParams:AR,groupZ:am,keyZ:Er,nameZ:La,ontologyID:$O},Symbol.toStringTag,{value:"Module"})),YR="/ontology/add-children",KR="/ontology/remove-children",XR="/ontology/move-children",yh=y({id:ct,children:ct.array()}),HR=y({from:ct,to:ct,children:ct.array()}),po=y({});let QR=class{constructor(e){f(this,"client");this.client=e}async addChildren(e,...r){await Z(this.client,YR,{id:new V(e).payload,children:r.map(i=>new V(i).payload)},yh,po)}async removeChildren(e,...r){await Z(this.client,KR,{id:new V(e).payload,children:r.map(i=>new V(i).payload)},yh,po)}async moveChildren(e,r,...i){const n={from:new V(e).payload,to:new V(r).payload,children:i.map(s=>new V(s).payload)};await Z(this.client,XR,n,HR,po)}};const e2="/ontology/retrieve",t2=y({ids:ct.array().optional(),children:ne().optional(),parents:ne().optional(),includeSchema:ne().optional(),excludeFieldData:ne().optional(),term:O().optional(),limit:ue().optional(),offset:ue().optional(),types:Vi.array().optional()}),n2=y({resources:yO.array()}),bs=t=>C.toArray(t).map(e=>new V(e).payload);let wO=class{constructor(e,r){f(this,"type","ontology");f(this,"groups");f(this,"client");f(this,"writer");f(this,"framer");this.client=e,this.writer=new QR(e),this.groups=new bO(e),this.framer=r}async search(e,r){return await this.execRetrieve({term:e,...r})}async retrieve(e,r){const i=await this.execRetrieve({ids:bs(e),...r});if(Array.isArray(e))return i;if(i.length===0)throw new Vt(`No resource found with ID ${dE.naturalLanguageJoin(C.toArray(e).map(n=>new V(n).toString()))}`);return i[0]}async page(e,r,i){return await this.execRetrieve({offset:e,limit:r,...i})}async retrieveChildren(e,r){return await this.execRetrieve({ids:bs(e),children:!0,...r})}async retrieveParents(e,r){return await this.execRetrieve({ids:bs(e),parents:!0,...r})}async addChildren(e,...r){return await this.writer.addChildren(e,...r)}async removeChildren(e,...r){return await this.writer.removeChildren(e,...r)}async moveChildren(e,r,...i){return await this.writer.moveChildren(e,r,...i)}async openChangeTracker(){return await Wi.open(this.framer,this)}async openDependentTracker(e){return await Ha.open(e,this.framer,this)}newSearcherWithOptions(e){return{type:this.type,search:r=>this.search(r,e),retrieve:r=>this.retrieve(r,e),page:(r,i)=>this.page(r,i,e)}}async execRetrieve(e){const{resources:r}=await Z(this.client,e2,e,t2,n2);return r}};const $h="sy_ontology_resource_set",bh="sy_ontology_resource_delete",wh="sy_ontology_relationship_set",_h="sy_ontology_relationship_delete";class Wi{constructor(e,r){f(this,"relationships");f(this,"resources");f(this,"resourceObs");f(this,"relationshipObs");f(this,"streamer");f(this,"client");f(this,"closePromise");this.relationshipObs=new yn.Observer,this.relationships=this.relationshipObs,this.resourceObs=new yn.Observer,this.resources=this.resourceObs,this.client=r,this.streamer=e,this.closePromise=this.start()}async close(){this.streamer.close(),await this.closePromise}async start(){for await(const e of this.streamer)await this.update(e)}async update(e){const r=await this.parseResourceSets(e),i=this.parseResourceDeletes(e);r.concat(i).length>0&&this.resourceObs.notify(r.concat(i));const s=this.parseRelationshipSets(e),a=this.parseRelationshipDeletes(e);s.concat(a).length>0&&this.relationshipObs.notify(s.concat(a))}parseRelationshipSets(e){const r=e.get(wh);return r.length===0?[]:Array.from(r.as("string")).map(i=>({variant:"set",key:bu(i),value:void 0}))}parseRelationshipDeletes(e){const r=e.get(_h);return r.length===0?[]:Array.from(r.as("string")).map(i=>({variant:"delete",key:bu(i)}))}async parseResourceSets(e){const r=e.get($h);if(r.length===0)return[];const i=Array.from(r.as("string")).map(n=>new V(n));try{return(await this.client.retrieve(i)).map(s=>({variant:"set",key:s.id,value:s}))}catch(n){if(n instanceof Vt)return[];throw n}}parseResourceDeletes(e){const r=e.get(bh);return r.length===0?[]:Array.from(r.as("string")).map(i=>({variant:"delete",key:new V(i)}))}static async open(e,r){const i=await e.openStreamer([$h,bh,wh,_h]);return new Wi(i,r)}}const kh=t=>t==="from"?"to":"from";class Ha extends yn.Observer{constructor({target:r,dependents:i,relationshipType:n="parent",relationshipDirection:s="from",resourceType:a},o,u){super();f(this,"internal");f(this,"target");f(this,"relDir");f(this,"resourceType");f(this,"dependents");f(this,"client");f(this,"relType");f(this,"handleResourceChange",r=>{this.dependents=this.dependents.map(i=>{const n=r.find(s=>s.key.toString()==i.id.toString());return n==null||n.variant==="delete"?i:n.value}),this.notify(this.dependents)});f(this,"handleRelationshipChange",r=>{const i=r.filter(s=>s.variant==="delete"&&s.key[this.relDir].toString()===this.target.toString()&&(this.resourceType==null||s.key[kh(this.relDir)].type===this.resourceType));this.dependents=this.dependents.filter(s=>!i.some(a=>a.key.to.toString()===s.id.toString()&&a.key.type===this.relType));const n=r.filter(s=>s.variant==="set"&&s.key.type===this.relType&&s.key[this.relDir].toString()===this.target.toString()&&(this.resourceType==null||s.key[kh(this.relDir)].type===this.resourceType));if(n.length===0)return this.notify(this.dependents);this.client.retrieve(n.map(s=>s.key.to)).then(s=>{this.dependents=this.dependents.concat(s),this.notify(this.dependents)}).catch(console.error)});this.resourceType=a,this.internal=o,this.target=r,this.dependents=i,this.resourceType!=null&&(this.dependents=this.dependents.filter(c=>c.id.type===this.resourceType)),this.client=u,this.relType=n,this.relDir=s,this.internal.resources.onChange(this.handleResourceChange),this.internal.relationships.onChange(this.handleRelationshipChange)}static async open(r,i,n){const s=await Wi.open(i,n);return new Ha(r,s,n)}async close(){await this.internal.close()}}const r2=Object.freeze(Object.defineProperty({__proto__:null,BUILTIN_TYPE:Om,CLUSTER_TYPE:fO,ChangeTracker:Wi,Client:wO,DependentTracker:Ha,FROM_RELATIONSHIP_DIRECTION:MR,ID:V,NODE_TYPE:hO,ROOT_ID:RR,TO_RELATIONSHIP_DIRECTION:LR,crudeIDZ:Yn,idZ:ct,parseIDs:bs,parseRelationship:bu,relationshipSchemaZ:BR,resourceTypeZ:Vi,resourceZ:yO,schemaFieldZ:vO,schemaZ:gO,stringIDZ:pO},Symbol.toStringTag,{value:"Module"})),Gi=O().uuid(),Qa=y({key:Gi,subjects:rt(ct),objects:rt(ct),actions:rt(Vs)}),_O=y({key:Gi.optional(),subjects:Yn.array().or(Yn),objects:Yn.array().or(Yn),actions:Vs.array().or(Vs)}),i2=y({keys:Gi.array().optional(),subjects:ct.array().optional()}),s2=y({policies:rt(Qa)}),a2="/access/policy/retrieve";let o2=class{constructor(e){f(this,"client");this.client=e}async retrieve(e){return(await Z(this.client,a2,e,i2,s2)).policies}};const u2=y({policies:Qa.partial({key:!0}).array()}),c2=y({policies:Qa.array()}),l2=y({keys:Gi.array()}),d2=y({}),m2="/access/policy/create",f2="/access/policy/delete";let h2=class{constructor(e){f(this,"client");this.client=e}async create(e){const i=_O.array().parse(C.toArray(e)).map(s=>({objects:C.toArray(s.objects),actions:C.toArray(s.actions),subjects:C.toArray(s.subjects)}));return(await Z(this.client,m2,{policies:i},u2,c2)).policies}async delete(e){await Z(this.client,f2,{keys:C.toArray(e)},l2,d2)}},kO=class{constructor(e){f(this,"retriever");f(this,"writer");this.retriever=new o2(e),this.writer=new h2(e)}async create(e){const r=Array.isArray(e),i=await this.writer.create(e);return r?i:i[0]}async retrieve(e){const r=Array.isArray(e),i=await this.retriever.retrieve({keys:C.toArray(e)});return r?i:i[0]}async retrieveFor(e){const r=C.toArray(e).map(i=>new V(i).payload);return await this.retriever.retrieve({subjects:r})}async delete(e){await this.writer.delete(e)}};const p2=t=>new V({type:ul,key:t}),v2=new V({type:cl,key:""}),g2=Object.freeze(Object.defineProperty({__proto__:null,ALLOW_ALL_ONTOLOGY_ID:v2,ALLOW_ALL_ONTOLOGY_TYPE:cl,Client:kO,ONTOLOGY_TYPE:ul,keyZ:Gi,newZ:_O,ontologyID:p2,policyZ:Qa},Symbol.toStringTag,{value:"Module"}));let IO=class{constructor(e){f(this,"policy");this.policy=new kO(e)}};const y2=Object.freeze(Object.defineProperty({__proto__:null,ALL_ACTION:WI,CREATE_ACTION:GI,Client:IO,DELETE_ACTION:YI,RETRIEVE_ACTION:KI,UPDATE_ACTION:XI,actionZ:Vs},Symbol.toStringTag,{value:"Module"})),$2=new Error("request for lock canceled");var b2=function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(l){try{c(i.next(l))}catch(d){a(d)}}function u(l){try{c(i.throw(l))}catch(d){a(d)}}function c(l){l.done?s(l.value):n(l.value).then(o,u)}c((i=i.apply(t,e||[])).next())})};class w2{constructor(e,r=$2){this._value=e,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((i,n)=>{const s={resolve:i,reject:n,weight:e,priority:r},a=OO(this._queue,o=>r<=o.priority);a===-1&&e<=this._value?this._dispatchItem(s):this._queue.splice(a+1,0,s)})}runExclusive(e){return b2(this,arguments,void 0,function*(r,i=1,n=0){const[s,a]=yield this.acquire(i,n);try{return yield r(s)}finally{a()}})}waitForUnlock(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,r)?Promise.resolve():new Promise(i=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),_2(this._weightedWaiters[e-1],{resolve:i,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const r=this._value;this._value-=e.weight,e.resolve([r,this._newReleaser(e.weight)])}_newReleaser(e){let r=!1;return()=>{r||(r=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const r=this._weightedWaiters[e-1];r&&(r.forEach(i=>i.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let r=this._value;r>0;r--){const i=this._weightedWaiters[r-1];if(!i)continue;const n=i.findIndex(s=>s.priority<=e);(n===-1?i:i.splice(0,n)).forEach(s=>s.resolve())}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}}function _2(t,e){const r=OO(t,i=>e.priority<=i.priority);t.splice(r+1,0,e)}function OO(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var k2=function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(l){try{c(i.next(l))}catch(d){a(d)}}function u(l){try{c(i.throw(l))}catch(d){a(d)}}function c(l){l.done?s(l.value):n(l.value).then(o,u)}c((i=i.apply(t,e||[])).next())})};class I2{constructor(e){this._semaphore=new w2(1,e)}acquire(){return k2(this,arguments,void 0,function*(e=0){const[,r]=yield this._semaphore.acquire(1,e);return r})}runExclusive(e,r=0){return this._semaphore.runExclusive(()=>e(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const Nm=(t,e,{convertNumericStrings:r=!0}={})=>{const i=!Array.isArray(t);let n=C.toArray(t);const s=n[0],a=typeof s;let o;return a==="string"&&r&&!isNaN(parseInt(s))&&"number"in e?(o=e.number,n=n.map(u=>parseInt(u))):o=e[a],{single:i,variant:o,normalized:n,actual:t}},eo=(t,e,r,i)=>{if(i){if(r.length===0)throw new On(`${t} not found matching ${JSON.stringify(e)}`);if(r.length>1)throw new Sn(`Expected one ${t} matching ${JSON.stringify(e)}, but found ${r.length}`)}},O2=y({leaseholder:ue().optional(),keys:Ve.array().optional(),names:O().array().optional(),search:O().optional(),rangeKey:O().optional(),limit:ue().optional(),offset:ue().optional(),dataTypes:ae.z.array().optional(),notDataTypes:ae.z.array().optional(),virtual:ne().optional(),isIndex:ne().optional(),internal:ne().optional()}),S2=y({channels:rt(Li)}),Pt=t=>(Array.isArray(t)&&t.length>0&&typeof t[0]=="object"?t=t.map(e=>e.key):typeof t=="object"&&"key"in t&&(t=[t.key]),Nm(t,{number:"keys",string:"names"})),Ys=class Ys{constructor(e){f(this,"client");this.client=e}async search(e,r){return await this.execute({search:e,...r})}async retrieve(e,r){const i=Pt(e),{variant:n}=i;let{normalized:s}=i;return n==="keys"&&s.indexOf(0)!==-1&&(s=s.filter(a=>a!==0)),s.length===0?[]:await this.execute({[n]:s,...r})}async page(e,r,i){return await this.execute({offset:e,limit:r,...i})}async execute(e){const[r,i]=await this.client.send(Ys.ENDPOINT,e,O2,S2);if(i!=null)throw i;return r.channels}};f(Ys,"ENDPOINT","/channel/retrieve");let wi=Ys;class Tm{constructor(e){f(this,"cache");f(this,"namesToKeys");f(this,"wrapped");this.cache=new Map,this.namesToKeys=new Map,this.wrapped=e}async search(e,r){return await this.wrapped.search(e,r)}async page(e,r,i){return await this.wrapped.page(e,r,i)}async retrieve(e,r){const{normalized:i}=Pt(e),n=[],s=[];if(i.forEach(o=>{const u=this.get(o);u!=null?n.push(...u):s.push(o)}),s.length===0)return n;const a=await this.wrapped.retrieve(s,r);return this.set(a),n.concat(a)}delete(e){const{variant:r,normalized:i}=Pt(e);r==="names"?i.forEach(n=>{const s=this.namesToKeys.get(n);s!=null&&(s.forEach(a=>this.cache.delete(a)),this.namesToKeys.delete(n))}):i.forEach(n=>{const s=this.cache.get(n);s!=null&&(this.cache.delete(n),this.namesToKeys.delete(s.name))})}rename(e,r){e.forEach((i,n)=>{const s=r[n],a=this.cache.get(i);if(a==null)return;this.cache.delete(i);const o=this.namesToKeys.get(a.name);o!=null&&(o.delete(i),o.size===0&&this.namesToKeys.delete(a.name)),a.name=s,this.cache.set(i,a);const u=this.namesToKeys.get(s);u==null?this.namesToKeys.set(s,new Set([i])):u.add(i)})}set(e){e.forEach(r=>{this.cache.set(r.key,r);const i=this.namesToKeys.get(r.name);i==null?this.namesToKeys.set(r.name,new Set([r.key])):i.add(r.key)})}get(e){if(typeof e=="number"){const n=this.cache.get(e);return n==null?void 0:[n]}const r=this.namesToKeys.get(e);if(r==null)return;const i=[];if(r.forEach(n=>{const s=this.cache.get(n);s!=null&&i.push(s)}),i.length!==0)return i}}class SO{constructor(e,r){f(this,"mu",new I2);f(this,"requests",new Map);f(this,"wrapped");f(this,"debouncedRun");this.wrapped=e,this.debouncedRun=xz(()=>{this.run()},r)}async search(e,r){return await this.wrapped.search(e,r)}async page(e,r,i){return await this.wrapped.page(e,r,i)}async retrieve(e){const{normalized:r,variant:i}=Pt(e);return i==="names"?await this.wrapped.retrieve(r):await new Promise((s,a)=>{this.mu.runExclusive(()=>{this.requests.set(r,{resolve:s,reject:a}),this.debouncedRun()})})}async run(){await this.mu.runExclusive(async()=>{const e=new Set;this.requests.forEach((r,i)=>i.forEach(n=>e.add(n)));try{const r=await this.wrapped.retrieve(Array.from(e));this.requests.forEach((i,n)=>i.resolve(r.filter(s=>n.includes(s.key))))}catch(r){this.requests.forEach(i=>i.reject(r))}finally{this.requests.clear()}})}}const NO=async(t,e)=>{const{normalized:r}=Pt(e),i=await t.retrieve(r),n=[];if(r.forEach(s=>{i.find(a=>a.name===s||a.key===s)==null&&n.push(s)}),n.length>0)throw new Vt(`Could not find channels: ${JSON.stringify(n)}`);return i};class zm{constructor({dataType:e,name:r,leaseholder:i=0,key:n=0,isIndex:s=!1,index:a=0,internal:o=!1,virtual:u=!1,frameClient:c,alias:l,expression:d="",requires:g=[]}){f(this,"_frameClient");f(this,"key");f(this,"name");f(this,"dataType");f(this,"leaseholder");f(this,"index");f(this,"isIndex");f(this,"internal");f(this,"alias");f(this,"virtual");f(this,"expression");f(this,"requires");this.key=n,this.name=r,this.dataType=new ae(e),this.leaseholder=i,this.index=a,this.isIndex=s,this.internal=o,this.alias=l,this.virtual=u,this.expression=d,this.requires=g??[],this._frameClient=c??null}get framer(){if(this._frameClient==null)throw new Ce("cannot read from a channel that has not been created");return this._frameClient}get payload(){return Li.parse({key:this.key,name:this.name,dataType:this.dataType.valueOf(),leaseholder:this.leaseholder,index:this.index,isIndex:this.isIndex,internal:this.internal,virtual:this.virtual,expression:this.expression,requires:this.requires})}get isCalculated(){return _i(this.payload)}get ontologyID(){return xO(this.key)}async read(e){return await this.framer.read(e,this.key)}async write(e,r){return await this.framer.write(e,this.key,r)}}const N2="sy_calculation_state",T2="/channel/retrieve-group",z2=y({}),x2=y({group:am});let TO=class{constructor(e,r,i,n){f(this,"type",Ma);f(this,"frameClient");f(this,"client");f(this,"retriever");f(this,"writer");this.frameClient=e,this.retriever=r,this.client=i,this.writer=n}async create(e,r={}){const{retrieveIfNameExists:i=!1}=r,n=!Array.isArray(e);let s=C.toArray(e),a=[];if(i){const o=await this.retriever.retrieve(s.map(c=>c.name)),u=new Set(o.map(c=>c.name));s=s.filter(c=>!u.has(c.name)),a=this.sugar(o)}return a=a.concat(this.sugar(await this.writer.create(s))),n?a[0]:a}async retrieve(e,r){const i=!Array.isArray(e),n=this.sugar(await this.retriever.retrieve(e,r));return eo("channel",e,n,i),i?n[0]:n}async search(e,r){return this.sugar(await this.retriever.search(e,r))}async delete(e){const{normalized:r,variant:i}=Pt(e);return i==="keys"?await this.writer.delete({keys:r}):await this.writer.delete({names:r})}async rename(e,r){return await this.writer.rename(C.toArray(e),C.toArray(r))}newSearcherWithOptions(e){return{type:this.type,search:async r=>await this.search(r,e),retrieve:async r=>await this.retrieve(r,e),page:async(r,i)=>await this.page(r,i,e)}}async page(e,r,i){return this.sugar(await this.retriever.page(e,r,i))}createDebouncedBatchRetriever(e=10){return new Tm(new SO(new wi(this.client),e))}sugar(e){const{frameClient:r}=this;return e.map(i=>new zm({...i,frameClient:r}))}async retrieveGroup(){const e=await Z(this.client,T2,{},z2,x2);return new Sm(e.group.name,e.group.key)}};const _i=({virtual:t,expression:e})=>t&&e!=="",zO=async(t,e)=>{if(!_i(e))return e.index;for(const r of e.requires){const i=await t(r);if(i==null)return null;if(!i.virtual)return i.index}for(const r of e.requires){const i=await t(r);if(i==null)return null;if(_i(i)){const n=await zO(t,i);if(n!=null)return n}}return null},xO=t=>new V({type:Ma,key:t.toString()}),E2=y({channels:HI.array()}),U2=y({channels:Li.array()}),Z2=y({keys:Ve.array().optional(),names:Ri.array().optional()}),P2=y({}),j2=y({keys:Ve.array(),names:Ri.array()}),A2=y({}),D2="/channel/create",C2="/channel/delete",R2="/channel/rename";let EO=class{constructor(e,r){f(this,"client");f(this,"cache");this.client=e,this.cache=r}async create(e){const{channels:r}=await Z(this.client,D2,{channels:e.map(i=>({...i,dataType:i.dataType}))},E2,U2);return this.cache.set(r),r}async delete(e){await Z(this.client,C2,e,Z2,P2),e.keys!=null&&this.cache.delete(e.keys),e.names!=null&&this.cache.delete(e.names)}async rename(e,r){await Z(this.client,R2,{keys:e,names:r},j2,A2),this.cache.rename(e,r)}};const L2=Object.freeze(Object.defineProperty({__proto__:null,CALCULATION_STATE_CHANNEL_NAME:N2,CacheRetriever:Tm,Channel:zm,Client:TO,ClusterRetriever:wi,DebouncedBatchRetriever:SO,ONTOLOGY_TYPE:Ma,Writer:EO,analyzeParams:Pt,calculationStateZ:DR,channelZ:Li,isCalculated:_i,keyZ:Ve,nameZ:Ri,newZ:HI,ontologyID:xO,resolveCalculatedIndex:zO,retrieveRequired:NO},Symbol.toStringTag,{value:"Module"})),M2=y({keys:Dn.array().optional(),usernames:O().array().optional()}),B2=y({users:rt(Ji)}),F2="/user/retrieve";let q2=class{constructor(e){f(this,"client");this.client=e}async retrieve(e){return(await Z(this.client,F2,e,M2,B2)).users}};const J2=y({users:aO.array()}),V2=y({users:Ji.array()}),W2=y({key:Dn,username:O().min(1)}),G2=y({}),Y2=y({key:Dn,firstName:O().optional(),lastName:O().optional()}),K2=y({}),X2=y({keys:Dn.array()}),H2=y({}),Q2="/user/create",eL="/user/change-username",tL="/user/rename",nL="/user/delete";let rL=class{constructor(e){f(this,"client");this.client=e}async create(e){return(await Z(this.client,Q2,{users:C.toArray(e)},J2,V2)).users}async changeUsername(e,r){await Z(this.client,eL,{key:e,username:r},W2,G2)}async rename(e,r,i){await Z(this.client,tL,{key:e,firstName:r,lastName:i},Y2,K2)}async delete(e){await Z(this.client,nL,{keys:C.toArray(e)},X2,H2)}},UO=class{constructor(e){f(this,"reader");f(this,"writer");this.writer=new rL(e),this.reader=new q2(e)}async create(e){const r=Array.isArray(e),i=await this.writer.create(e);return r?i:i[0]}async changeUsername(e,r){await this.writer.changeUsername(e,r)}async retrieve(e){const r=Array.isArray(e),i=await this.reader.retrieve({keys:C.toArray(e)});if(r)return i;if(i.length===0)throw new On(`No user with key ${e} found`);if(i.length>1)throw new Sn(`Multiple users found with key ${e}`);return i[0]}async retrieveByName(e){const r=Array.isArray(e),i=await this.reader.retrieve({usernames:C.toArray(e)});if(r)return i;if(i.length===0)throw new On(`No user with username ${e} found`);if(i.length>1)throw new Sn(`Multiple users found with username ${e}`);return i[0]}async rename(e,r,i){await this.writer.rename(e,r,i)}async delete(e){await this.writer.delete(e)}};const iL=t=>new V({type:gm,key:t}),sL=Object.freeze(Object.defineProperty({__proto__:null,Client:UO,ONTOLOGY_TYPE:gm,keyZ:Dn,newZ:aO,ontologyID:iL,userZ:Ji},Symbol.toStringTag,{value:"Module"})),aL=y({username:O(),password:O()}),oL=y({token:O(),user:Ji}),Ih="/auth/login",uL=3,cL="/auth/change-password",lL=y({username:O(),password:O(),newPassword:O().min(1)}),dL=y({}),mL=[vu,gu];let fL=class{constructor(e,r){f(this,"token");f(this,"client");f(this,"credentials");f(this,"authenticating");f(this,"authenticated");f(this,"user");f(this,"retryCount");this.client=e,this.authenticated=!1,this.credentials=r,this.retryCount=0}async changePassword(e){if(!this.authenticated)throw new Error("Not authenticated");await Z(this.client,cL,{username:this.credentials.username,password:this.credentials.password,newPassword:e},lL,dL),this.credentials.password=e}middleware(){const e=async(r,i)=>{if(!this.authenticated&&!r.target.endsWith(Ih)){this.authenticating??(this.authenticating=new Promise((o,u)=>{this.client.send(Ih,this.credentials,aL,oL).then(([c,l])=>{if(l!=null)return o(l);this.token=c==null?void 0:c.token,this.user=c==null?void 0:c.user,this.authenticated=!0,o(null)}).catch(u)}));const a=await this.authenticating;if(a!=null)return[r,a]}r.params.Authorization=`Bearer ${this.token}`;const[n,s]=await i(r);return mL.some(a=>a.matches(s))&&this.retryCount<uL?(this.authenticated=!1,this.authenticating=void 0,this.retryCount+=1,e(r,i)):(this.retryCount=0,[n,s])};return e}};const ZO=Zt(["disconnected","connecting","connected","failed"]),PO=y({status:ZO,error:sm(Error).optional(),message:O().optional(),clusterKey:O(),clientVersion:O(),clientServerCompatible:ne(),nodeVersion:O().optional()}),hL=y({clusterKey:O(),nodeVersion:O().optional()}),Oh={clusterKey:"",status:"disconnected",error:void 0,message:"Disconnected",clientServerCompatible:!1,clientVersion:"0.43.0"},Sh=(t,e,r)=>{const i=r?"cluster":"client";return`Synnax cluster node version ${t!=null?`${t} `:""}is too ${r?"old":"new"} for client version ${e}.
|
|
135
|
-
This may cause compatibility issues. We recommend updating the ${i}. For more information, see
|
|
136
|
-
https://docs.synnaxlabs.com/reference/typescript-client/troubleshooting#old-${i}-version`},Hn=class Hn{constructor(e,r=M.seconds(30),i,n){f(this,"_state");f(this,"pollFrequency",M.seconds(30));f(this,"client");f(this,"name");f(this,"interval");f(this,"clientVersion");f(this,"onChangeHandlers",[]);f(this,"versionWarned",!1);this._state={...Oh},this.client=e,this.pollFrequency=r,this.clientVersion=i,this.name=n,this.check(),this.startChecking()}stopChecking(){this.interval!=null&&clearInterval(this.interval)}async check(){var r;const e=this._state.status;try{const[i,n]=await this.client.send(Hn.ENDPOINT,{},y({}),hL);if(n!=null)throw n;const s=i.nodeVersion,a=this.clientVersion,o=this.versionWarned;s==null?(this._state.clientServerCompatible=!1,o||(console.warn(Sh(null,a,!0)),this.versionWarned=!0)):mf.versionsEqual(a,s,{checkMajor:!0,checkMinor:!0,checkPatch:!1})?this._state.clientServerCompatible=!0:(this._state.clientServerCompatible=!1,o||(console.warn(Sh(s,a,mf.semVerNewer(a,s))),this.versionWarned=!0)),this._state.status="connected",this._state.message=`Connected to ${this.name??"cluster"}`,this._state.clusterKey=i.clusterKey,this._state.nodeVersion=i.nodeVersion,this._state.clientVersion=this.clientVersion}catch(i){this._state.status="failed",this._state.error=i,this._state.message=(r=this.state.error)==null?void 0:r.message}return this.onChangeHandlers.length>0&&e!==this._state.status&&this.onChangeHandlers.forEach(i=>i(this.state)),this.state}get state(){return{...this._state}}onChange(e){this.onChangeHandlers.push(e)}startChecking(){this.interval=setInterval(()=>{this.check()},this.pollFrequency.milliseconds)}};f(Hn,"ENDPOINT","/connectivity/check"),f(Hn,"DEFAULT",Oh),f(Hn,"connectionStateZ",PO);let ki=Hn;const pL=Object.freeze(Object.defineProperty({__proto__:null,Checker:ki,stateZ:PO,statusZ:ZO},Symbol.toStringTag,{value:"Module"})),vL=y({keys:Ve.array().optional(),bounds:Ee.z,names:Ri.array().optional()}),gL=y({}),yL="/frame/delete";class $L{constructor(e){f(this,"client");this.client=e}async delete(e){await Z(this.client,yL,e,vL,gL)}}var yr=(t=>(t[t.Open=0]="Open",t[t.Write=1]="Write",t[t.Commit=2]="Commit",t[t.SetAuthority=3]="SetAuthority",t))(yr||{}),$r=(t=>(t[t.PersistStream=1]="PersistStream",t[t.Persist=2]="Persist",t[t.Stream=3]="Stream",t))($r||{});const bL=t=>{switch(t){case"persist":return 2;case"stream":return 3;case"persistStream":return 1;default:if(typeof t=="number"&&t in $r)return t;throw new Error(`invalid writer mode: ${t}`)}},wL=new M(-1);class wu extends Gt.sub("writer_closed"){constructor(){super("WriterClosed")}}const _L=y({start:W.z.optional(),controlSubject:$n.subjectZ.optional(),keys:Ve.array().optional(),authorities:$n.authorityZ.array().optional(),mode:Zt($r).optional(),errOnUnauthorized:ne().optional(),enableAutoCommit:ne().optional(),autoIndexPersistInterval:M.z.optional()}),kL=y({command:Zt(yr),config:_L.optional(),frame:Ba.optional(),buffer:sm(Uint8Array).optional()}),IL=y({command:Zt(yr),end:W.z,err:dr.payloadZ.optional()});var nn;let jO=(nn=class{constructor(e,r){f(this,"stream");f(this,"adapter");f(this,"closeErr",null);this.stream=e,this.adapter=r}static async _open(e,r,{channels:i,start:n=W.now(),authorities:s=$n.ABSOLUTE_AUTHORITY,controlSubject:a,mode:o=1,errOnUnauthorized:u=!1,enableAutoCommit:c=!1,autoIndexPersistInterval:l=M.SECOND,useExperimentalCodec:d=!0}){const g=await Em.open(e,i);d&&(r=r.withCodec(new xL(g.codec)));const p=await r.stream(nn.ENDPOINT,kL,IL),_=new nn(p,g);return await _.execute({command:0,config:{start:new W(n),keys:g.keys,controlSubject:a,authorities:C.toArray(s),mode:bL(o),errOnUnauthorized:u,enableAutoCommit:c,autoIndexPersistInterval:l}}),_}async write(e,r){if(this.closeErr!=null)throw this.closeErr;if(this.stream.received())return await this.close();const i=await this.adapter.adapt(e,r);this.stream.send({command:1,frame:i.toPayload()})}async setAuthority(e,r){if(this.closeErr!=null)throw this.closeErr;let i;if(typeof e=="number"&&r==null)i={keys:[],authorities:[e]};else{let n;typeof e=="string"||typeof e=="number"?n={[e]:r}:n=e,n=await this.adapter.adaptObjectKeys(n),i={keys:Object.keys(n).map(s=>Number(s)),authorities:Object.values(n)}}await this.execute({command:3,config:i})}async commit(){if(this.closeErr!=null)throw this.closeErr;return this.stream.received()?(await this.closeInternal(null),W.ZERO):(await this.execute({command:2})).end}async close(){await this.closeInternal(null)}async closeInternal(e){if(this.closeErr!=null)throw this.closeErr;for(this.closeErr=e,this.stream.closeSend();;){if(this.closeErr!=null){if(wu.matches(this.closeErr))return null;throw this.closeErr}const[r,i]=await this.stream.receive();i!=null?this.closeErr=Ot.matches(i)?new wu:i:this.closeErr=dr.decode(r==null?void 0:r.err)}}async execute(e){const r=this.stream.send(e);for(r!=null&&await this.closeInternal(r);;){const[i,n]=await this.stream.receive();n!=null&&await this.closeInternal(n);const s=dr.decode(i==null?void 0:i.err);if(s!=null&&await this.closeInternal(s),(i==null?void 0:i.command)==e.command)return i}}},f(nn,"ENDPOINT","/frame/write"),nn);const Nh=t=>t.data.byteLength/t.dataType.density.valueOf(),OL=t=>{const{keys:e,series:r}=t;e.forEach((i,n)=>{r[n].key=i}),r.sort((i,n)=>i.key-n.key),e.sort((i,n)=>i-n),r.forEach(i=>delete i.key)},Th=5,zh=4,xh=3,Eh=2,Uh=1,Zh=0,St=ae.TIMESTAMP.density.valueOf(),Xt=8,Ht=4,vo=4,go=4,SL=1;class AO{constructor(e=[],r=[]){f(this,"contentType","application/sy-framer");f(this,"states",new Map);f(this,"currState");f(this,"seqNum",0);(e.length>0||r.length>0)&&this.update(e,r)}update(e,r){this.seqNum++;const i={keys:e,keyDataTypes:new Map,hasVariableDataTypes:!1};e.forEach((n,s)=>{const a=r[s];i.keyDataTypes.set(n,a),a.isVariable&&(i.hasVariableDataTypes=!0)}),i.keys.sort(),this.states.set(this.seqNum,i),this.currState=i}throwIfNotUpdated(e){if(this.seqNum<1)throw new Ce(`
|
|
26
|
+
name. keys parameter must be a set of channel keys or channel names.`)}get colType(){return this.columns.length===0?null:typeof this.columns[0]=="string"?"name":"key"}get keys(){if(this.colType==="name")throw new Ye("colType is not key");return this.columns??[]}get uniqueKeys(){return Mn.unique(this.keys)}get names(){if(this.colType==="key")throw new Ye("colType is not name");return this.columns??[]}get uniqueNames(){return Mn.unique(this.names)}get uniqueColumns(){return this.colType==="key"?this.uniqueKeys:this.uniqueNames}toPayload(){return{series:this.series.map(e=>ei(e)),keys:[...this.keys]}}get isVertical(){return this.uniqueColumns.length===this.columns.length}get isHorizontal(){return this.uniqueColumns.length===1}get isSquare(){return this.isHorizontal&&this.isVertical}get isWeaklyAligned(){if(this.columns.length<=1)return!0;const e=this.timeRanges;return e.every(t=>t.equals(e[0]))}timeRange(e){if(e==null){if(this.columns.length===0)return z.ZERO;const n=O.min(...this.series.map(i=>i.timeRange.start)),a=O.max(...this.series.map(i=>i.timeRange.end));return new z(n,a)}const t=this.get(e);return t==null?z.ZERO:t.timeRange}latest(){return this.at(-1)}get timeRanges(){return this.uniqueColumns.map(e=>this.timeRange(e))}get(e){return Array.isArray(e)?this.filter(t=>e.includes(t)):new ca(this.series.filter((t,n)=>this.columns[n]===e))}push(e,...t){if(e instanceof Z){if(this.colType!==null&&e.colType!==this.colType)throw new M("keyVariant must match");this.series.push(...e.series),this.columns.push(...e.columns)}else{if(this.series.push(...t),typeof e=="string"&&this.colType==="key")throw new M("keyVariant must match");if(typeof e!="string"&&this.colType==="name")throw new M("keyVariant must match");this.columns.push(...Array.from({length:t.length},()=>e))}}concat(e){return new Z([...this.columns,...e.columns],[...this.series,...e.series])}has(e){return typeof e=="string"&&this.colType==="key"||typeof e=="number"&&this.colType==="name"?!1:this.columns.includes(e)}map(e){const t=new Z;return this.forEach((n,a,i)=>t.push(...e(n,a,i))),t}forEach(e){this.columns.forEach((t,n)=>{const a=this.series[n];e(t,a,n)})}at(e,t=!1){const n={};return this.uniqueColumns.forEach(a=>{n[a]=this.get(a).at(e,t)}),n}filter(e){const t=new Z;return this.columns.forEach((n,a)=>{const i=this.series[a];e(n,i,a)&&t.push(n,i)}),t}get byteLength(){return new S(this.series.reduce((e,t)=>e.add(t.byteLength),S.ZERO))}get digest(){const e={};return this.keys.forEach((t,n)=>{const a=this.series[n].digest;t in e?e[t].push(a):e[t]=[a]}),e}get length(){return this.series.reduce((e,t)=>e+t.length,0)}toString(){let e=`Frame{
|
|
27
|
+
`;return this.uniqueColumns.forEach(t=>{e+=` ${t}: ${this.get(t).series.map(n=>n.toString()).join(",")}
|
|
28
|
+
`}),e+="}",e}}const Xt=s.z.object({keys:s.z.union([s.z.null().transform(()=>[]),s.z.number().array().optional().default([])]),series:s.z.union([s.z.null().transform(()=>[]),Y.crudeZ.array().optional().default([])])}),Qa=r=>{const{dataType:e,data:t,timeRange:n,alignment:a}=r;return new Y({data:t,dataType:e,timeRange:n,glBufferUsage:"static",alignment:a})},ei=r=>({timeRange:r.timeRange,dataType:r.dataType,data:new Uint8Array(r.data.buffer),alignment:r.alignment});var We=(r=>(r[r.Open=0]="Open",r[r.Write=1]="Write",r[r.Commit=2]="Commit",r[r.SetAuthority=3]="SetAuthority",r))(We||{}),mt=(r=>(r[r.PersistStream=1]="PersistStream",r[r.Persist=2]="Persist",r[r.Stream=3]="Stream",r))(mt||{});const If=new v(-1);class Fr extends re.sub("writer_closed"){constructor(){super("WriterClosed")}}const Af=s.z.enum(mt).or(s.z.enum(["persist","stream","persistStream"]).transform(r=>{switch(r){case"persist":return 2;case"stream":return 3;case"persistStream":return 1}})),ti=s.z.object({start:O.z.optional(),controlSubject:G.subjectZ.optional(),authorities:s.z.union([G.authorityZ.transform(r=>[r]),G.authorityZ.array()]).default([G.ABSOLUTE_AUTHORITY]),mode:Af.default(1),errOnUnauthorized:s.z.boolean().default(!1),enableAutoCommit:s.z.boolean().default(!1),autoIndexPersistInterval:v.z.default(v.SECOND),useExperimentalCodec:s.z.boolean().default(!1)}),$f=ti.extend({keys:U.array().optional()}),rs=ti.extend({channels:ke}),ri=rs.or(ke.transform(r=>rs.parse({channels:r,start:O.now()}))),kf=s.z.object({command:s.z.enum(We),config:$f.optional(),frame:Xt.optional(),buffer:s.z.instanceof(Uint8Array).optional()}),Cf=s.z.object({command:s.z.enum(We),end:O.z,err:le.payloadZ.optional()}),xf=s.z.tuple([s.z.union([s.z.record(U.or(ce),G.authorityZ),U.or(ce),G.authorityZ]),G.authorityZ.optional()]).transform(([r,e])=>{if(G.authorityZ.safeParse(r).success)return{keys:[],authorities:[r]};if(U.or(ce).safeParse(r).success){if(e==null)throw new Error("authority is required when setting authority for a single channel");return{keys:[r],authorities:[e]}}const t=r;return{keys:Object.keys(t),authorities:Object.values(t)}});let ni=class Yr{static ENDPOINT="/frame/write";stream;adapter;closeErr=null;constructor(e,t){this.stream=e,this.adapter=t}static async _open(e,t,n){const a=ri.parse(n),i=await fn.open(e,a.channels);a.useExperimentalCodec&&(t=t.withCodec(new Zf(i.codec)));const o=await t.stream(Yr.ENDPOINT,kf,Cf),c=new Yr(o,i);return await c.execute({command:0,config:{...a,keys:i.keys}}),c}async write(e,t){if(this.closeErr!=null)throw this.closeErr;if(this.stream.received())return await this.close();const n=await this.adapter.adapt(e,t);this.stream.send({command:1,frame:n.toPayload()})}async setAuthority(e,t){if(this.closeErr!=null)throw this.closeErr;const n=xf.parse([e,t]),a={keys:await this.adapter.adaptParams(n.keys),authorities:n.authorities};await this.execute({command:3,config:a})}async commit(){if(this.closeErr!=null)throw this.closeErr;return this.stream.received()?(await this.closeInternal(null),O.ZERO):(await this.execute({command:2})).end}async close(){await this.closeInternal(null)}async closeInternal(e){if(this.closeErr!=null)throw this.closeErr;for(this.closeErr=e,this.stream.closeSend();;){if(this.closeErr!=null){if(Fr.matches(this.closeErr))return null;throw this.closeErr}const[t,n]=await this.stream.receive();n!=null?this.closeErr=K.matches(n)?new Fr:n:this.closeErr=le.decode(t?.err)}}async execute(e){const t=this.stream.send(e);for(t!=null&&await this.closeInternal(t);;){const[n,a]=await this.stream.receive();a!=null&&await this.closeInternal(a);const i=le.decode(n?.err);if(i!=null&&await this.closeInternal(i),n?.command==e.command)return n}}};const ns=r=>r.data.byteLength/r.dataType.density.valueOf(),Rf=r=>{const{keys:e,series:t}=r;e.forEach((n,a)=>{t[a].key=n}),t.sort((n,a)=>n.key-a.key),e.sort((n,a)=>n-a),t.forEach(n=>delete n.key)},ss=5,as=4,is=3,os=2,cs=1,ls=0,X=I.TIMESTAMP.density.valueOf(),pe=8,me=4,pr=4,mr=4,jf=1;class si{contentType="application/sy-framer";states=new Map;currState;seqNum=0;constructor(e=[],t=[]){(e.length>0||t.length>0)&&this.update(e,t)}update(e,t){this.seqNum++;const n={keys:e,keyDataTypes:new Map,hasVariableDataTypes:!1};e.forEach((a,i)=>{const o=t[i];n.keyDataTypes.set(a,o),o.isVariable&&(n.hasVariableDataTypes=!0)}),n.keys.sort(),this.states.set(this.seqNum,n),this.currState=n}throwIfNotUpdated(e){if(this.seqNum<1)throw new M(`
|
|
137
29
|
The codec has not been updated with a list of channels and data types.
|
|
138
30
|
Please call the update method before calling ${e}.
|
|
139
|
-
`)}encode(e,
|
|
31
|
+
`)}encode(e,t=0){this.throwIfNotUpdated("encode");let n=e;e!=null&&typeof e=="object"&&"toPayload"in e&&(n=e.toPayload()),Rf(n);let a=-1,i,o,c,l=t+jf+mr,h=!this.currState?.hasVariableDataTypes,d=!0,u=!0,N=!0,E=!0,P=!0;n.keys.length!==this.currState?.keys.length&&(N=!1,l+=n.keys.length*pr),n.series.forEach((D,fe)=>{const ae=ns(D),nt=n.keys[fe],Ne=this.currState?.keyDataTypes.get(nt);if(Ne==null)throw new M(`Channel ${nt} was not provided in the list of channels when opening the writer`);if(!Ne.equals(D.dataType))throw new M(`Series data type of ${D.dataType.toString()} does not match the data type of ${Ne.toString()} for channel ${nt}`);if(l+=D.data.byteLength,a===-1){a=ae,i=D.timeRange?.start,o=D.timeRange?.end,c=BigInt(D.alignment??0n);return}a!==ae&&(h=!1),(i?.valueOf()!==D.timeRange?.start.valueOf()||o?.valueOf()!==D.timeRange?.end.valueOf())&&(d=!1),c!==BigInt(D.alignment??0)&&(E=!1)}),u=d&&i==null&&o==null,P=E&&(c===void 0||c===0n),h?l+=me:l+=n.keys.length*me,u||(d?l+=X*2:l+=n.keys.length*X*2),P||(E?l+=pe:l+=n.keys.length*pe);const k=new Uint8Array(l),B=new DataView(k.buffer);let C=t;return k[C]=Number(P)<<ss|Number(E)<<as|Number(h)<<is|Number(d)<<os|Number(u)<<cs|Number(N)<<ls,C++,B.setUint32(C,this.seqNum,!0),C+=mr,h&&(B.setUint32(C,a,!0),C+=me),d&&!u&&(B.setBigUint64(C,i?.valueOf()??0n,!0),B.setBigUint64(C,o?.valueOf()??0n,!0),C+=X*2),E&&!P&&(B.setBigUint64(C,c??0n,!0),C+=pe),n.series.forEach((D,fe)=>{if(N||(B.setUint32(C,n.keys[fe],!0),C+=pr),!h){let ae=D.data.byteLength;D.dataType.isVariable||(ae=ns(D)),B.setUint32(C,ae,!0),C+=me}k.set(new Uint8Array(D.data),C),C+=D.data.byteLength,!d&&!u&&(B.setBigUint64(C,D.timeRange?.start.valueOf()??0n,!0),B.setBigUint64(C,D.timeRange?.end.valueOf()??0n,!0),C+=X*2),!E&&!P&&(B.setBigUint64(C,D.alignment??0n,!0),C+=pe)}),k}decode(e,t=0){this.throwIfNotUpdated("decode");const n=e instanceof Uint8Array?e:new Uint8Array(e),a={keys:[],series:[]};let i=t,o=0,c=0,l,h,d;const u=new DataView(n.buffer,n.byteOffset,n.byteLength),N=!!(n[i]>>ss&1),E=!!(n[i]>>as&1),P=!!(n[i]>>is&1),k=!!(n[i]>>os&1),B=!!(n[i]>>cs&1),C=!!(n[i]>>ls&1);i++;const D=u.getUint32(i,!0);i+=mr;const fe=this.states.get(D);if(fe==null)return a;if(P){if(i+me>u.byteLength)return a;o=u.getUint32(i,!0),i+=me}if(k&&!B){if(i+X>u.byteLength)return a;l=new O(u.getBigUint64(i,!0)),i+=X,h=new O(u.getBigUint64(i,!0)),i+=X}if(E&&!N){if(i+pe>u.byteLength)return a;d=u.getBigUint64(i,!0),i+=pe}return C&&(a.keys=[...fe.keys]),fe.keys.forEach((ae,nt)=>{if(!C){if(i>=u.byteLength||u.getUint32(i,!0)!==ae)return;i+=pr,a.keys.push(ae)}const Ne=fe.keyDataTypes.get(ae);if(c=0,P)c=o;else{if(i+me>u.byteLength)return;c=u.getUint32(i,!0),i+=me}let $t=c;if(Ne.isVariable||($t*=Ne.density.valueOf()),i+$t>u.byteLength){a.keys.splice(nt,1);return}const ze={dataType:Ne,data:n.slice(i,i+$t).buffer};if(i+=$t,!k&&!B){if(i+X*2>u.byteLength)return;const Nn=u.getBigUint64(i,!0);i+=X;const Xi=u.getBigUint64(i,!0);i+=X,ze.timeRange=new z({start:Nn,end:Xi})}else B?ze.timeRange=new z({start:0n,end:0n}):ze.timeRange=new z({start:l?.valueOf()??0n,end:h?.valueOf()??0n});if(!E&&!N){if(i+pe>u.byteLength)return;d=u.getBigUint64(i,!0),i+=pe,ze.alignment=d}else N?ze.alignment=0n:ze.alignment=d;a.series.push(ze)}),a}}const dn=254,Uf=new Uint8Array([dn]),Df=255,Mf=new Uint8Array([Df]),ai="application/sy-framer";class Zf{contentType=ai;base;lowPerfCodec;constructor(e){this.base=e,this.lowPerfCodec=$e.JSON_CODEC}encode(e){const t=e;if(t.type=="close"||t.payload?.command!=We.Write){const a=this.lowPerfCodec.encode(t),i=new Uint8Array({length:a.byteLength+1});return i.set(Uf,0),i.set(new Uint8Array(a),1),i}const n=this.base.encode(t.payload?.frame,1);return n.set(Mf,0),n}decode(e,t){if(new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===dn)return this.lowPerfCodec.decode(e.slice(1),t);const i={type:"data"},o=this.base.decode(e,1);return i.payload={command:We.Write,frame:o},i}}class Pf{contentType=ai;base;lowPerfCodec;constructor(e){this.base=e,this.lowPerfCodec=$e.JSON_CODEC}encode(e){return this.lowPerfCodec.encode(e)}decode(e,t){return new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===dn?this.lowPerfCodec.decode(e.slice(1),t):{type:"data",payload:{frame:this.base.decode(e,1)}}}}class Qt{adapter;retriever;keys;codec;constructor(e){this.retriever=e,this.adapter=null,this.keys=[],this.codec=new si}static async open(e,t){const n=new Qt(e);return await n.update(t),n}async update(e){const{variant:t,normalized:n}=J(e),a=await this.retriever.retrieve(n),i=a.map(c=>c.key);if(Zn.uniqueUnorderedPrimitiveArrays(this.keys,i)===Zn.EQUAL)return!1;if(this.codec.update(i,a.map(c=>c.dataType)),t==="keys")return this.adapter=null,this.keys=n,!0;const o=new Map;return this.adapter=o,n.forEach(c=>{const l=a.find(h=>h.name===c);if(l==null)throw new Error(`Channel ${c} not found`);o.set(l.key,l.name)}),this.keys=Array.from(this.adapter.keys()),!0}adapt(e){if(this.adapter==null)return e;const t=this.adapter;return e.map((n,a)=>{if(typeof n=="number"){const i=t.get(n);if(i==null)throw new Error(`Channel ${n} not found`);return[i,a]}return[n,a]})}}class fn{adapter;retriever;keys;codec;constructor(e){this.retriever=e,this.adapter=null,this.keys=[],this.codec=new si}static async open(e,t){const n=new fn(e);return await n.update(t),n}async adaptParams(e){const t=ke.parse(e);return await Promise.all(t.map(async a=>await this.adaptToKey(a)))}async update(e){const t=await Ya(this.retriever,e),n=t.map(h=>h.key),a=new Set(this.keys),i=new Set(n),o=!i.isSubsetOf(a),c=!a.isSubsetOf(i);return o||c?(this.adapter=new Map(t.map(h=>[h.name,h.key])),this.keys=n,this.codec.update(this.keys,t.map(h=>h.dataType)),!0):!1}async fetchChannel(e){const t=await this.retriever.retrieve(e);if(t.length===0)throw new Error(`Channel ${JSON.stringify(e)} not found`);return t[0]}async adaptToKey(e){return typeof e=="number"?e:(await this.fetchChannel(e)).key}encode(e){return this.codec.encode(e.toPayload())}async adapt(e,t){if(typeof e=="string"||typeof e=="number"){if(t==null)throw new M(`
|
|
140
32
|
Received a single channel name or key but no series.
|
|
141
|
-
`);if(Array.isArray(
|
|
33
|
+
`);if(Array.isArray(t)){if(t.some(l=>l instanceof Y||Array.isArray(l)))throw new M(`
|
|
142
34
|
Received a single channel name or key but multiple series.
|
|
143
|
-
`);
|
|
35
|
+
`);t=t}const o=await this.fetchChannel(e),c=new Y({data:t,dataType:o.dataType});return new Z(o.key,c)}if(Array.isArray(e)){if(t==null)throw new M(`
|
|
144
36
|
Received an array of channel names or keys but no series.
|
|
145
|
-
`);if(!Array.isArray(
|
|
37
|
+
`);if(!Array.isArray(t))throw new M(`
|
|
146
38
|
Received an array of channel names or keys but no array of series.
|
|
147
|
-
`);const
|
|
39
|
+
`);const o=[],c=[];for(let l=0;l<e.length;l++){const h=await this.fetchChannel(e[l]);if(l>=t.length)throw new M(`
|
|
148
40
|
Received an array of channel names or keys but not enough series.
|
|
149
|
-
`);const
|
|
150
|
-
Channel ${
|
|
151
|
-
`);return
|
|
152
|
-
Please report this error to the Synnax team.`),r!=null){if(Ot.matches(r))return;throw r}}}closeSend(){this.stream.closeSend()}send(e){const r=this.stream.send(e);if(r!=null)throw r}}const _u=new M(-1);var Um=(t=>(t[t.Open=0]="Open",t[t.Next=1]="Next",t[t.Prev=2]="Prev",t[t.SeekFirst=3]="SeekFirst",t[t.SeekLast=4]="SeekLast",t[t.SeekLE=5]="SeekLE",t[t.SeekGE=6]="SeekGE",t[t.Valid=7]="Valid",t[t.Error=8]="Error",t))(Um||{}),RO=(t=>(t[t.None=0]="None",t[t.Ack=1]="Ack",t[t.Data=2]="Data",t))(RO||{});const UL=y({command:Zt(Um),span:M.z.optional(),bounds:Ee.z.optional(),stamp:W.z.optional(),keys:Ve.array().optional(),chunkSize:ue().optional()}),ZL=y({variant:Zt(RO),ack:ne(),command:Zt(Um),error:dr.payloadZ.optional().nullable(),frame:Ba.optional()}),ri=class ri{constructor(e,r){f(this,"stream");f(this,"adapter");f(this,"value");this.stream=new CO("Iterator",e),this.value=new Je,this.adapter=r}static async _open(e,r,i,n,s={}){const a=await to.open(i,r),o=await n.stream(ri.ENDPOINT,UL,ZL),u=new ri(o,a);return await u.execute({command:0,keys:a.keys,bounds:new Ee(e),chunkSize:s.chunkSize??1e5}),u}async next(e=_u){return await this.execute({command:1,span:new M(e)})}async prev(e=_u){return await this.execute({command:2,span:new M(e)})}async seekFirst(){return await this.execute({command:3})}async seekLast(){return await this.execute({command:4})}async seekLE(e){return await this.execute({command:5,stamp:new W(e)})}async seekGE(e){return await this.execute({command:6,stamp:new W(e)})}async valid(){return await this.execute({command:7})}async close(){await this.stream.closeAndAck()}[Symbol.asyncIterator](){return new PL(this)}async execute(e){for(this.stream.send(e),this.value=new Je;;){const r=await this.stream.receive();if(r.variant===1)return r.ack;this.value.push(this.adapter.adapt(new Je(r.frame)))}}};f(ri,"ENDPOINT","/frame/iterate");let Ws=ri;class PL{constructor(e){f(this,"iter");f(this,"open",!1);this.iter=e}async next(){try{let e=!0;return this.open||(await this.iter.seekFirst()||(e=!1),this.open=!0),await this.iter.next()||(e=!1),e||await this.iter.close(),{done:!e,value:this.iter.value}}catch(e){throw await this.iter.close(),e}}}const jL=y({keys:ue().array(),downsampleFactor:ue()}),AL=y({frame:Ba}),DL="/frame/stream",Zm=t=>{if(Array.isArray(t))return typeof t[0]=="object"?{channels:t.map(r=>r.key),downsampleFactor:1}:{channels:t,downsampleFactor:1};const e=Ur.safeParse(t);return e.success?{channels:[e.data.key],downsampleFactor:1}:t},LO=(t,e)=>async r=>{const i=Zm(r),n=await to.open(t,i.channels);i.useExperimentalCodec&&(e=e.withCodec(new EL(n.codec)));const s=await e.stream(DL,jL,AL),a=new CL(s,n);s.send({keys:n.keys,downsampleFactor:i.downsampleFactor??1});const[,o]=await s.receive();if(o!=null)throw o;return a},MO=async(t,e,r)=>await LO(t,e)(r);class CL{constructor(e,r){f(this,"stream");f(this,"adapter");f(this,"downsampleFactor");this.stream=new CO("Streamer",e),this.adapter=r,this.downsampleFactor=1}get keys(){return this.adapter.keys}async next(){try{return{done:!1,value:await this.read()}}catch(e){if(Ot.matches(e))return{done:!0,value:void 0};throw e}}async read(){return this.adapter.adapt(new Je((await this.stream.receive()).frame))}async update(e){await this.adapter.update(e),this.stream.send({keys:this.adapter.keys,downsampleFactor:this.downsampleFactor})}close(){this.stream.closeSend()}[Symbol.asyncIterator](){return this}}class no{constructor(e,r,i={}){f(this,"wrapped_",null);f(this,"breaker");f(this,"opener");f(this,"config");this.opener=e,this.config=Zm(r);const{maxRetries:n=5e3,baseInterval:s=M.seconds(1),scale:a=1}=i??{};this.breaker=new v$.Breaker({maxRetries:n,baseInterval:s,scale:a})}static async open(e,r,i){const n=new no(e,r,i);return await n.runStreamer(),n}async runStreamer(){for(;;)try{this.wrapped_!=null&&this.wrapped_.close(),this.wrapped_=await this.opener(this.config),this.breaker.reset();return}catch(e){if(this.wrapped_=null,!await this.breaker.wait())throw e;console.error("failed to open streamer",e);continue}}get wrapped(){if(this.wrapped_==null)throw new Error("stream closed");return this.wrapped_}async update(e){this.config.channels=e;try{await this.wrapped.update(e)}catch{return await this.runStreamer(),await this.update(e)}}async next(){try{return{done:!1,value:await this.read()}}catch(e){if(Ot.matches(e))return{done:!0,value:void 0};throw e}}async read(){try{const e=await this.wrapped.read();return this.breaker.reset(),e}catch(e){if(Ot.matches(e))throw e;return await this.runStreamer(),await this.read()}}close(){this.wrapped.close()}get keys(){return this.wrapped.keys}[Symbol.asyncIterator](){return this}}class Wt extends yn.Observer{constructor(r,i){super(i);f(this,"streamer");f(this,"closePromise");this.streamer=r,this.closePromise=this.stream()}async close(){this.streamer.close(),await this.closePromise}async stream(){for await(const r of this.streamer)this.notify(r)}}const RL=t=>new V({type:um,key:t.toString()}),Ph=t=>Array.isArray(t)||typeof t!="object"||typeof t=="object"&&"key"in t?{channels:t}:t;let BO=class{constructor(e,r,i){f(this,"streamClient");f(this,"retriever");f(this,"deleter");this.streamClient=e,this.retriever=i,this.deleter=new $L(r)}async openIterator(e,r,i){return await Ws._open(e,r,this.retriever,this.streamClient,i)}async openWriter(e){return await jO._open(this.retriever,this.streamClient,Ph(e))}async openStreamer(e){return await MO(this.retriever,this.streamClient,Ph(e))}async write(e,r,i){if(i==null){const s=r,a=await this.openWriter({start:e,channels:Object.keys(s),mode:$r.Persist,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:M.MAX});return await a.write(s),await a.close()}const n=await this.openWriter({start:e,channels:r,mode:$r.Persist,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:M.MAX});await n.write(r,i),await n.close()}async read(e,r){const{single:i}=Pt(r),n=await this.readFrame(e,r);return i?n.get(r):n}async readFrame(e,r){const i=await this.openIterator(e,r),n=new Je;try{for await(const s of i)n.push(s)}finally{await i.close()}return n}async delete(e,r){const{normalized:i,variant:n}=Pt(e);return n==="keys"?await this.deleter.delete({keys:i,bounds:r}):await this.deleter.delete({names:i,bounds:r})}};const LL=Object.freeze(Object.defineProperty({__proto__:null,ALWAYS_INDEX_PERSIST_ON_AUTO_COMMIT:wL,AUTO_SPAN:_u,Client:BO,Frame:Je,HardenedStreamer:no,Iterator:Ws,ONTOLOGY_TYPE:um,ObservableStreamer:Wt,Writer:jO,WriterClosedError:wu,WriterCommand:yr,WriterMode:$r,createStreamOpener:LO,frameZ:Ba,ontologyID:RL,openStreamer:MO,parseStreamerConfig:Zm,seriesFromPayload:QI,seriesToPayload:eO},Symbol.toStringTag,{value:"Module"})),ML=$n.ABSOLUTE_AUTHORITY,BL=$n.ZERO_AUTHORITY,FL=$n.stateZ(ue()),qL=t=>{var e,r;return t.to==null?`${(e=t.from)==null?void 0:e.resource} - ${(r=t.from)==null?void 0:r.subject.name} -> released`:t.from==null?`${t.to.resource} - released -> ${t.to.subject.name} (${t.to.authority.toString()})`:`${t.to.resource} - ${t.from.subject.name} -> ${t.to.subject.name} (${t.to.authority.toString()})`},JL=y({transfers:xr($n.transferZ(Ve))});class FO extends Wt{constructor(r){super(r,i=>{const n=this.codec.decode(i.series[0].buffer,JL);return this.merge(n),[n.transfers,!0]});f(this,"states");f(this,"codec");this.states=new Map,this.codec=new Nn.JSONCodec}subjects(){const r=new Map;return this.states.forEach(i=>r.set(i.subject.key,i.subject)),Array.from(r.values())}merge(r){r.transfers.forEach(i=>{i.from==null&&i.to==null&&console.warn("Invalid transfer: ",i),i.to==null?this.states.delete(i.from.resource):this.states.set(i.to.resource,i.to)})}}const VL="sy_node_1_control";let qO=class{constructor(e){f(this,"framer");this.framer=e}async openStateTracker(){const e=await no.open(async r=>await this.framer.openStreamer(r),VL);return new FO(e)}};const WL=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:ML,Client:qO,StateTracker:FO,ZERO_AUTHORITY:BL,stateZ:FL,transferString:qL},Symbol.toStringTag,{value:"Module"}));let JO=class{constructor(e,r,i){f(this,"tasks");f(this,"racks");f(this,"devices");this.tasks=e,this.racks=r,this.devices=i}};const GL=Object.freeze(Object.defineProperty({__proto__:null,Client:JO},Symbol.toStringTag,{value:"Module"})),Rn=async(t,e,r,i)=>{const n=await t.openStreamer([e,r]),s=a=>{const o=[];return r!=null&&o.push(...a.get(r).series.flatMap(u=>i("delete",u))),e!=null&&o.push(...a.get(e).series.flatMap(u=>i("set",u))),[o,o.length>0]};return new Wt(n,s)},YL=Object.freeze(Object.defineProperty({__proto__:null,openObservable:Rn},Symbol.toStringTag,{value:"Module"})),KL="sy_device_set",XL="sy_device_delete",jh="sy_device_state",yo="/hardware/device/retrieve",HL="/hardware/device/create",QL="/hardware/device/delete",eM=y({devices:nO.array()}),tM=y({devices:Bi.array()}),nM=y({keys:Mi.array()}),rM=y({}),$o=y({keys:Mi.array().optional(),names:O().array().optional(),makes:O().array().optional(),models:O().array().optional(),locations:O().array().optional(),racks:cn.array().optional(),search:O().optional(),limit:ue().optional(),offset:ue().optional(),ignoreNotFound:ne().optional(),includeState:ne().optional()}),bo=y({devices:rt(Bi)});let VO=class{constructor(e,r){f(this,"type",Ja);f(this,"client");f(this,"frameClient");this.client=e,this.frameClient=r}async retrieve(e,r){const i=!Array.isArray(e),n=await Z(this.client,yo,{keys:C.toArray(e),...r},$o,bo);return eo("Device",e,n.devices,i),i?n.devices[0]:n.devices}async search(e,r){return(await Z(this.client,yo,{search:e,...r},$o,bo)).devices}async page(e,r,i){return(await Z(this.client,yo,{offset:e,limit:r,...i},$o,bo)).devices}async create(e){const r=!Array.isArray(e),i=await Z(this.client,HL,{devices:C.toArray(e)},eM,tM);return r?i.devices[0]:i.devices}async delete(e){await Z(this.client,QL,{keys:C.toArray(e)},nM,rM)}async openDeviceTracker(){return await Rn(this.frameClient,KL,XL,iM)}async openStateObserver(){return new Wt(await this.frameClient.openStreamer(jh),e=>{const r=e.get(jh);return r.length===0?[null,!1]:[r.parseJSON(dm),!0]})}newSearcherWithOptions(e){return{type:this.type,search:async r=>await this.search(r,e),retrieve:async r=>await this.retrieve(r,e),page:async(r,i)=>await this.page(r,i,e)}}};const iM=(t,e)=>t==="delete"?e.toStrings().map(r=>({variant:t,key:r,value:void 0})):e.parseJSON(Bi).map(r=>({variant:t,key:r.key,value:r})),sM=t=>new V({type:Ja,key:t}),aM=Object.freeze(Object.defineProperty({__proto__:null,Client:VO,ONTOLOGY_TYPE:Ja,deviceZ:Bi,keyZ:Mi,newZ:nO,ontologyID:sM,stateZ:dm},Symbol.toStringTag,{value:"Module"})),wo="/hardware/rack/retrieve",oM="/hardware/rack/create",uM="/hardware/rack/delete",Ah="sy_rack_state",_o=y({keys:cn.array().optional(),names:O().array().optional(),search:O().optional(),embedded:ne().optional(),hostIsNode:ne().optional(),limit:ue().optional(),offset:ue().optional(),includeState:ne().optional()}),ko=y({racks:rt(Fa)}),cM=y({racks:tO.array()}),lM=y({racks:Fa.array()}),dM=y({keys:cn.array()}),mM=y({});let WO=class{constructor(e,r,i){f(this,"type",qa);f(this,"client");f(this,"tasks");f(this,"frameClient");this.client=e,this.tasks=r,this.frameClient=i}async delete(e){await Z(this.client,uM,{keys:C.toArray(e)},dM,mM)}async create(e){const r=!Array.isArray(e),i=await Z(this.client,oM,{racks:C.toArray(e)},cM,lM),n=this.sugar(i.racks);return r?n[0]:n}async search(e){const r=await Z(this.client,wo,{search:e},_o,ko);return this.sugar(r.racks)}async page(e,r){const i=await Z(this.client,wo,{offset:e,limit:r},_o,ko);return this.sugar(i.racks)}async retrieve(e,r){const{variant:i,normalized:n,single:s}=Nm(e,{string:"names",number:"keys"}),a=await Z(this.client,wo,{[i]:n,includeState:r==null?void 0:r.includeState},_o,ko),o=this.sugar(a.racks);return eo("Rack",e,o,s),s?o[0]:o}async openStateObserver(){return new Wt(await this.frameClient.openStreamer(Ah),e=>{const r=e.get(Ah);return r.length===0?[[],!1]:[r.parseJSON(cm),!0]})}sugar(e){return e.map(({key:r,name:i,state:n})=>new GO(r,i,this.tasks,n))}};class GO{constructor(e,r,i,n){f(this,"key");f(this,"name");f(this,"state");f(this,"tasks");this.key=e,this.name=r,this.tasks=i,this.state=n}async listTasks(){return await this.tasks.retrieve(this.key)}async retrieveTaskByName(e){return await this.tasks.retrieveByName(e,this.key)}async retrieveTaskByType(e){return await this.tasks.retrieveByType(e,this.key)}async createTask(e){return e.key=((BigInt(this.key)<<32n)+(BigInt(e.key??0)&0xffffffffn)).toString(),await this.tasks.create(e)}async deleteTask(e){await this.tasks.delete([e])}}const fM=t=>new V({type:qa,key:t.toString()}),hM=Object.freeze(Object.defineProperty({__proto__:null,Client:WO,ONTOLOGY_TYPE:qa,Rack:GO,keyZ:cn,newZ:tO,ontologyID:fM,rackZ:Fa,stateZ:cm},Symbol.toStringTag,{value:"Module"})),ni="sy_task_state",Kn="sy_task_cmd",pM="sy_task_set",vM="sy_task_delete",Gn=new Error("Task not created"),YO=async(t,e)=>{const r=await e.retrieveParents(t);return r.length===0?null:r[0]};class KO{constructor(e,r,i,n,s=!1,a=!1,o,u=null,c=null,l=null){f(this,"key");f(this,"name");f(this,"internal");f(this,"type");f(this,"config");f(this,"snapshot");f(this,"state");f(this,"frameClient");f(this,"ontologyClient");f(this,"rangeClient");this.key=e,this.name=r,this.type=i,this.config=n,this.internal=s,this.snapshot=a,o!==null&&(this.state=o),this.frameClient=u,this.ontologyClient=c,this.rangeClient=l}get payload(){return{key:this.key,name:this.name,type:this.type,config:this.config,state:this.state,internal:this.internal}}get ontologyID(){return HO(this.key)}async executeCommand(e,r){if(this.frameClient==null)throw Gn;const i=await this.frameClient.openWriter(Kn),n=fz.create();return await i.write(Kn,[{task:this.key,type:e,key:n,args:r}]),await i.close(),n}async executeCommandSync(e,r,i){if(this.frameClient==null)throw Gn;const n=await this.frameClient.openStreamer(ni),s=await this.executeCommand(e,r);let a;const o=new Promise(u=>setTimeout(()=>u(!1),new M(i).milliseconds));for(;;){const u=await Promise.any([n.read(),o]);if(u===!1)throw new Error("Command timed out");const c=bi.safeParse(u.at(-1).sy_task_state);if(c.success){if(a=c.data,a.key===s)break}else throw c.error}return n.close(),a}async openStateObserver(){if(this.frameClient==null)throw Gn;return new Wt(await this.frameClient.openStreamer(ni),e=>{const r=e.get(ni);if(r.length===0)return[null,!1];const i=bi.safeParse(r.at(-1));if(!i.success)return console.error(i.error),[null,!1];const n=i.data;return n.task!==this.key?[null,!1]:[n,!0]})}async openCommandObserver(){if(this.frameClient==null)throw Gn;return new Wt(await this.frameClient.openStreamer(Kn),e=>{const r=e.get(Kn);if(r.length===0)return[null,!1];const i=mm.safeParse(r.at(-1));if(!i.success)return console.error(i.error),[null,!1];const n=i.data;return n.task!==this.key?[null,!1]:[n,!0]})}async snapshottedTo(){if(this.ontologyClient==null||this.rangeClient==null)throw Gn;return this.snapshot?await YO(this.key,this.ontologyClient):null}}const gM=y({rack:cn.optional(),keys:ln.array().optional(),names:O().array().optional(),types:O().array().optional(),includeState:ne().optional(),offset:ue().optional(),limit:ue().optional()}),yM=y({tasks:rt(Fi)}),$M="/hardware/task/retrieve",bM="/hardware/task/create",wM="/hardware/task/delete",_M="/hardware/task/copy",kM=y({tasks:rO.array()}),IM=y({tasks:Fi.array()}),OM=y({keys:ln.array()}),SM=y({}),NM=y({key:ln,name:O(),snapshot:ne()}),TM=y({task:Fi});let XO=class{constructor(e,r,i,n){f(this,"type",Va);f(this,"client");f(this,"frameClient");f(this,"ontologyClient");f(this,"rangeClient");this.client=e,this.frameClient=r,this.ontologyClient=i,this.rangeClient=n}async create(e){const r=!Array.isArray(e),i=await Z(this.client,bM,{tasks:C.toArray(e)},kM,IM),n=this.sugar(i.tasks);return r?n[0]:n}async delete(e){await Z(this.client,wM,{keys:C.toArray(e)},OM,SM)}async search(e){return await this.execRetrieve({keys:[e]})}async page(e,r){return await this.execRetrieve({offset:e,limit:r})}async list(e={}){return this.sugar(await this.execRetrieve(e))}async retrieve(e,r){const{single:i,normalized:n,variant:s}=Nm(e,{number:"rack",string:"keys"},{convertNumericStrings:!1}),a={...r};s==="rack"?a.rack=e:a.keys=n;const o=await this.execRetrieve(a),u=this.sugar(o);return i&&s!=="rack"?u[0]:u}async copy(e,r,i){const n=await Z(this.client,_M,{key:e,name:r,snapshot:i},NM,TM);return this.sugar([n.task])[0]}async retrieveByName(e,r){const i=await this.execRetrieve({names:[e],rack:r});return eo("Task",e,i,!0),this.sugar(i)[0]}async retrieveByType(e,r){const i=await this.execRetrieve({types:[e],rack:r});return this.sugar(i)}async retrieveSnapshottedTo(e){if(this.ontologyClient==null)throw Gn;return await YO(e,this.ontologyClient)}async execRetrieve(e){return(await Z(this.client,$M,e,gM,yM)).tasks}sugar(e){const r=!Array.isArray(e),i=C.toArray(e).map(({key:n,name:s,type:a,config:o,state:u,internal:c,snapshot:l})=>new KO(n,s,a,o,c,l,u,this.frameClient,this.ontologyClient,this.rangeClient));return r?i[0]:i}async openTracker(){return await Rn(this.frameClient,pM,vM,(e,r)=>Array.from(r).map(i=>({variant:e,key:i.toString(),value:i.toString()})))}async openStateObserver(){return new Wt(await this.frameClient.openStreamer(ni),e=>{const r=e.get(ni);if(r.length===0)return[null,!1];const i=bi.safeParse(r.at(-1));return i.success?[i.data,!0]:(console.error(i.error),[null,!1])})}async openCommandObserver(){return new Wt(await this.frameClient.openStreamer(Kn),e=>{const r=e.get(Kn);if(r.length===0)return[null,!1];const i=mm.safeParse(r.at(-1));return i.success?[i.data,!0]:(console.error(i.error),[null,!1])})}};const HO=t=>new V({type:Va,key:t}),zM=Object.freeze(Object.defineProperty({__proto__:null,Client:XO,ONTOLOGY_TYPE:Va,Task:KO,commandZ:mm,getRackKey:CR,keyZ:ln,newZ:rO,ontologyID:HO,stateZ:bi,taskZ:Fi},Symbol.toStringTag,{value:"Module"})),xM=y({keys:An.array().optional(),for:ct.optional(),search:O().optional(),offset:ue().optional(),limit:ue().optional()}),EM=y({labels:rt(qi)}),Ks=class Ks{constructor(e){f(this,"client");this.client=e}async retrieve(e){return await this.execute({keys:C.toArray(e)})}async retrieveFor(e){return await this.execute({for:e})}async search(e){return await this.execute({search:e})}async page(e,r){return await this.execute({offset:e,limit:r})}async execute(e){const[r,i]=await this.client.send(Ks.ENDPOINT,e,xM,EM);if(i!=null)throw i;return r.labels}};f(Ks,"ENDPOINT","/label/retrieve");let Gs=Ks;const QO=qi.extend({key:An.optional()}),UM=y({labels:QO.array()}),ZM=y({labels:qi.array()}),PM=y({keys:An.array()}),eS=y({id:ct,labels:An.array(),replace:ne().optional()}),jM=eS.omit({replace:!0}),Io=y({}),AM="/label/create",DM="/label/delete",CM="/label/set",RM="/label/remove";let tS=class{constructor(e){f(this,"client");this.client=e}async create(e){return(await Z(this.client,AM,{labels:C.toArray(e)},UM,ZM)).labels}async delete(e){await Z(this.client,DM,{keys:C.toArray(e)},PM,Io)}async set(e,r,{replace:i}={}){await Z(this.client,CM,{id:e,labels:r,replace:i},eS,Io)}async remove(e,r){await Z(this.client,RM,{id:e,labels:r},jM,Io)}};const LM="sy_label_set",MM="sy_label_delete";let nS=class{constructor(e,r,i){f(this,"type","label");f(this,"retriever");f(this,"writer");f(this,"frameClient");f(this,"ontology");this.writer=new tS(e),this.retriever=new Gs(e),this.frameClient=r,this.ontology=i}async search(e){return await this.retriever.search(e)}async retrieve(e){const r=Array.isArray(e),i=await this.retriever.retrieve(e);return r?i:i[0]}async retrieveFor(e){return await this.retriever.retrieveFor(new V(e))}async label(e,r,i={}){await this.writer.set(new V(e),r,i)}async removeLabels(e,r){await this.writer.remove(new V(e),r)}async page(e,r){return await this.retriever.page(e,r)}async create(e){const r=Array.isArray(e),i=await this.writer.create(e);return r?i:i[0]}async delete(e){await this.writer.delete(e)}async openChangeTracker(){return await Rn(this.frameClient,LM,MM,BM)}async trackLabelsOf(e){const r=new yn.Observer,i=(await this.retrieveFor(e)).map(s=>({id:rS(s.key),key:s.key,name:s.name,data:s}));return(await this.ontology.openDependentTracker({target:new V(e),dependents:i,relationshipType:"labeled_by"})).onChange(s=>r.notify(s.map(a=>{var o,u;return{key:a.id.key,color:(o=a.data)==null?void 0:o.color,name:(u=a.data)==null?void 0:u.name}}))),r}};const BM=(t,e)=>t==="delete"?e.toUUIDs().map(r=>({variant:t,key:r})):e.parseJSON(qi).map(r=>({variant:t,key:r.key,value:r})),rS=t=>new V({type:fm,key:t}),FM=Object.freeze(Object.defineProperty({__proto__:null,Client:nS,ONTOLOGY_TYPE:fm,Retriever:Gs,Writer:tS,keyZ:An,labelZ:qi,newZ:QO,ontologyID:rS},Symbol.toStringTag,{value:"Module"})),qM="sy_range_alias_set",JM="sy_range_alias_delete",VM=y({range:mt,aliases:O().array()}),WM=y({aliases:Ra(O(),Ve)}),GM=y({range:mt,aliases:Ra(Ve.or(O()),O())}),YM=Ut(),KM=y({range:mt,channels:Ve.array()}),XM=Ut(),HM=y({range:mt}),QM=y({aliases:Ra(O(),O())}),zt=class zt{constructor(e,r,i){f(this,"frameClient");f(this,"cache",new Map);f(this,"client");f(this,"rangeKey");this.rangeKey=e,this.cache=new Map,this.client=i,this.frameClient=r}async resolve(e){const r=[],i=typeof e=="string",n={};if(i){const a=this.cache.get(e);if(a!=null)return a;r.push(e)}else e.forEach(a=>{const o=this.cache.get(a);o!=null?n[a]=o:r.push(a)});if(r.length===0)return n;const s=await Z(this.client,zt.RESOLVE_ENDPOINT,{range:this.rangeKey,aliases:r},VM,WM);return Object.entries(s.aliases).forEach(([a,o])=>this.cache.set(a,o)),i?s.aliases[r[0]]:{...n,...s.aliases}}async set(e){await Z(this.client,zt.SET_ENDPOINT,{range:this.rangeKey,aliases:e},GM,YM)}async list(){return(await Z(this.client,zt.LIST_ENDPOINT,{range:this.rangeKey},HM,QM)).aliases}async delete(e){await Z(this.client,zt.DELETE_ENDPOINT,{range:this.rangeKey,channels:e},KM,XM)}async openChangeTracker(){return await Rn(this.frameClient,qM,JM,nB(this.rangeKey))}};f(zt,"SET_ENDPOINT","/range/alias/set"),f(zt,"RESOLVE_ENDPOINT","/range/alias/resolve"),f(zt,"LIST_ENDPOINT","/range/alias/list"),f(zt,"DELETE_ENDPOINT","/range/alias/delete");let ku=zt;const eB=y({range:mt,channel:Ve,alias:O()}),tB="---",nB=t=>(e,r)=>e==="delete"?r.toStrings().filter(i=>i.split(tB)[0]===t).map(i=>({variant:e,key:i,value:void 0})):r.parseJSON(eB).map(i=>({variant:e,key:i.alias,value:i})),Pm=y({range:mt,key:O(),value:O()}),rB=y({range:mt,keys:O().array()}),iB=y({pairs:rt(Pm)}),sB=y({range:mt,pairs:Pm.array()}),aB=y({range:mt,keys:O().array()}),en=class en{constructor(e,r,i){f(this,"rangeKey");f(this,"client");f(this,"frameClient");this.rangeKey=e,this.client=r,this.frameClient=i}async get(e){const r=await Z(this.client,en.GET_ENDPOINT,{range:this.rangeKey,keys:C.toArray(e)},rB,iB);return typeof e=="string"?r.pairs[0].value:Object.fromEntries(r.pairs.map(i=>[i.key,i.value]))}async list(){return this.get([])}async set(e,r=""){let i;Rh(e)?i=Object.entries(e).map(([n,s])=>({range:this.rangeKey,key:n,value:s})):i=[{range:this.rangeKey,key:e,value:r}],await Z(this.client,en.SET_ENDPOINT,{range:this.rangeKey,pairs:i},sB,Ut())}async delete(e){await Z(this.client,en.DELETE_ENDPOINT,{range:this.rangeKey,keys:C.toArray(e)},aB,Ut())}async openTracker(){return await Rn(this.frameClient,"sy_range_kv_set","sy_range_kv_delete",(e,r)=>e==="delete"?r.toStrings().map(i=>{const[n,s]=i.split("<--->",2);return{variant:e,key:i,value:{range:n,key:s,value:""}}}):r.parseJSON(Pm).map(i=>({variant:e,key:`${i.range}${i.key}`,value:i})))}};f(en,"GET_ENDPOINT","/range/kv/get"),f(en,"SET_ENDPOINT","/range/kv/set"),f(en,"DELETE_ENDPOINT","/range/kv/delete");let Ii=en;class iS{constructor(e,r=Ee.ZERO,i,n,s,a,o,u,c,l,d){f(this,"key");f(this,"name");f(this,"kv");f(this,"timeRange");f(this,"color");f(this,"channels");f(this,"aliaser");f(this,"frameClient");f(this,"labelClient");f(this,"ontologyClient");f(this,"rangeClient");this.key=i,this.name=e,this.timeRange=r,this.frameClient=s,this.color=n,this.kv=a,this.aliaser=o,this.channels=u,this.labelClient=c,this.ontologyClient=l,this.rangeClient=d}get ontologyID(){return Qt(this.key)}get payload(){return{key:this.key,name:this.name,timeRange:this.timeRange,color:this.color}}async setAlias(e,r){const i=await this.channels.retrieve(e);if(i.length===0)throw new Vt(`Channel ${e} does not exist`);await this.aliaser.set({[i[0].key]:r})}async deleteAlias(...e){await this.aliaser.delete(e)}async listAliases(){return await this.aliaser.list()}async resolveAlias(e){return await this.aliaser.resolve(e)}async openAliasTracker(){return await this.aliaser.openChangeTracker()}async retrieveParent(){return this.rangeClient.retrieveParent(this.key)}async retrieveChildren(){const e=(await this.ontologyClient.retrieveChildren(this.ontologyID,{excludeFieldData:!0,types:["range"]})).map(r=>r.id.key);return await this.rangeClient.retrieve(e)}async read(e){return await this.frameClient.read(this.timeRange,e)}async labels(){return await this.labelClient.retrieveFor(Qt(this.key))}async addLabel(...e){await this.labelClient.label(Qt(this.key),e)}async removeLabel(...e){await this.labelClient.removeLabels(Qt(this.key),e)}async openChildRangeTracker(){const e=new yn.Observer,r=(await this.retrieveChildren()).map(n=>{const s=Qt(n.key);return{id:s,key:s.toString(),name:n.name,data:n.payload}}),i=await this.ontologyClient.openDependentTracker({target:this.ontologyID,dependents:r,resourceType:"range"});return i.onChange(n=>e.notify(this.rangeClient.resourcesToRanges(n))),e.setCloser(async()=>await i.close()),e}async openParentRangeTracker(){const e=new yn.Observer,r=await this.retrieveParent();if(r==null)return null;const i=Qt(r.key),n={id:i,key:i.toString(),name:r.name,data:r.payload},s=await this.ontologyClient.openDependentTracker({target:this.ontologyID,dependents:[n],relationshipDirection:"to"});return s.onChange(a=>{const o=this.rangeClient.resourcesToRanges(a);if(o.length===0)return;const u=o[0];e.notify(u)}),e.setCloser(async()=>await s.close()),e}}const oB=(t,e)=>vz(t.timeRange,e.timeRange),uB=y({keys:mt.array().optional(),names:xr(O()).optional(),term:O().optional(),overlapsWith:Ee.z.optional(),limit:ue().int().optional(),offset:ue().int().optional(),hasLabels:An.array().optional()}),cB="/range/retrieve",lB=y({ranges:rt(Ur)});let sS=class{constructor(e,r,i,n,s,a){f(this,"type","range");f(this,"frameClient");f(this,"writer");f(this,"unaryClient");f(this,"channels");f(this,"labelClient");f(this,"ontologyClient");this.frameClient=e,this.writer=r,this.unaryClient=i,this.channels=n,this.labelClient=s,this.ontologyClient=a}async create(e,r){const i=!Array.isArray(e),n=this.sugarMany(await this.writer.create(C.toArray(e),r));return i?n[0]:n}async rename(e,r){await this.writer.rename(e,r)}async delete(e){await this.writer.delete(C.toArray(e))}async search(e){return this.sugarMany(await this.execRetrieve({term:e}))}async page(e,r){return this.sugarMany(await this.execRetrieve({offset:e,limit:r}))}async retrieve(e){if(typeof e=="object"&&"start"in e)return await this.execRetrieve({overlapsWith:new Ee(e)});const{single:r,actual:i,variant:n,normalized:s,empty:a}=sO(e);if(a)return[];const o=await this.execRetrieve({[n]:s});if(!r)return o;if(o.length===0)throw new On(`range matching ${i} not found`);if(o.length>1)throw new Sn(`multiple ranges matching ${i} found`);return o[0]}getKV(e){return new Ii(e,this.unaryClient,this.frameClient)}async execRetrieve(e){const{ranges:r}=await Z(this.unaryClient,cB,e,uB,lB);return this.sugarMany(r)}async retrieveParent(e){const r=await this.ontologyClient.retrieveParents(Qt(e));if(r.length===0)return null;const i=r[0];return i.id.type!=="range"?null:await this.retrieve(i.id.key)}sugarOne(e){return new iS(e.name,e.timeRange,e.key,e.color,this.frameClient,new Ii(e.key,this.unaryClient,this.frameClient),new ku(e.key,this.frameClient,this.unaryClient),this.channels,this.labelClient,this.ontologyClient,this)}sugarMany(e){return e.map(r=>this.sugarOne(r))}async openTracker(){return await Rn(this.frameClient,"sy_range_set","sy_range_delete",(e,r)=>e==="delete"?r.toUUIDs().map(n=>({variant:e,key:n,value:void 0})):this.sugarMany(r.parseJSON(Ur)).map(n=>({variant:e,key:n.key,value:n})))}resourcesToRanges(e){return e.map(r=>this.resourceToRange(r))}resourceToRange(e){var r,i,n;return this.sugarOne({key:e.id.key,name:(r=e.data)==null?void 0:r.name,timeRange:new Ee((i=e.data)==null?void 0:i.timeRange),color:(n=e.data)==null?void 0:n.color})}};const Qt=t=>new V({type:pm,key:t}),dB=t=>new V({type:vm,key:t}),mB=y({ranges:Ur.array()}),fB=y({parent:ct.optional(),ranges:iO.array()}),hB=y({keys:mt.array()}),pB=y({}),vB=y({key:mt,name:hm}),gB=y({}),yB="/range/create",$B="/range/delete",bB="/range/rename";class aS{constructor(e){f(this,"client");this.client=e}async rename(e,r){await Z(this.client,bB,{key:e,name:r},vB,gB)}async create(e,r){return(await Z(this.client,yB,{ranges:e,...r},fB,mB)).ranges}async delete(e){await Z(this.client,$B,{keys:e},hB,pB)}}const wB=Object.freeze(Object.defineProperty({__proto__:null,ALIAS_ONTOLOGY_TYPE:vm,Client:sS,KV:Ii,ONTOLOGY_TYPE:pm,Range:iS,Writer:aS,aliasOntologyID:dB,analyzeParams:sO,keyZ:mt,nameZ:hm,newZ:iO,ontologyID:Qt,payloadZ:Ur,sort:oB},Symbol.toStringTag,{value:"Module"})),_B="/api/v1/";class kB{constructor(e,r={},i=!1){f(this,"url");f(this,"unary");f(this,"stream");f(this,"secure");this.secure=i,this.url=e.child(_B);const n=new Nn.JSONCodec;this.unary=F6(new B6(this.url,n,this.secure),r),this.stream=new Ij(this.url,n,this.secure)}use(...e){this.unary.use(...e),this.stream.use(...e)}}const IB="/workspace/lineplot/retrieve",OB="/workspace/lineplot/create",SB="/workspace/lineplot/rename",NB="/workspace/lineplot/set-data",TB="/workspace/lineplot/delete",zB=y({keys:Zr.array()}),xB=y({workspace:Ct,linePlots:oO.array()}),EB=y({key:Zr,name:O()}),UB=y({key:Zr,data:O()}),ZB=y({keys:Zr.array()}),PB=y({linePlots:rt(Wa)}),jB=y({linePlots:Wa.array()}),Oo=y({});let oS=class{constructor(e){f(this,"client");this.client=e}async create(e,r){const i=Array.isArray(r),n=await Z(this.client,OB,{workspace:e,linePlots:C.toArray(r)},xB,jB);return i?n.linePlots:n.linePlots[0]}async rename(e,r){await Z(this.client,SB,{key:e,name:r},EB,Oo)}async setData(e,r){await Z(this.client,NB,{key:e,data:JSON.stringify(r)},UB,Oo)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,IB,{keys:C.toArray(e)},zB,PB);return r?i.linePlots:i.linePlots[0]}async delete(e){await Z(this.client,TB,{keys:C.toArray(e)},ZB,Oo)}};const AB=t=>new V({type:ym,key:t}),DB=Object.freeze(Object.defineProperty({__proto__:null,Client:oS,ONTOLOGY_TYPE:ym,keyZ:Zr,linePlotZ:Wa,newZ:oO,ontologyID:AB},Symbol.toStringTag,{value:"Module"})),CB="/workspace/log/retrieve",RB="/workspace/log/create",LB="/workspace/log/rename",MB="/workspace/log/set-data",BB="/workspace/log/delete",FB=y({keys:Pr.array()}),qB=y({workspace:Ct,logs:uO.array()}),JB=y({key:Pr,name:O()}),VB=y({key:Pr,data:O()}),WB=y({keys:Pr.array()}),GB=y({logs:Ga.array()}),YB=y({logs:Ga.array()}),So=y({});let uS=class{constructor(e){f(this,"client");this.client=e}async create(e,r){const i=Array.isArray(r),n=await Z(this.client,RB,{workspace:e,logs:C.toArray(r)},qB,YB);return i?n.logs:n.logs[0]}async rename(e,r){await Z(this.client,LB,{key:e,name:r},JB,So)}async setData(e,r){await Z(this.client,MB,{key:e,data:JSON.stringify(r)},VB,So)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,CB,{keys:C.toArray(e)},FB,GB);return r?i.logs:i.logs[0]}async delete(e){await Z(this.client,BB,{keys:C.toArray(e)},WB,So)}};const KB=t=>new V({type:$m,key:t}),XB=Object.freeze(Object.defineProperty({__proto__:null,Client:uS,ONTOLOGY_TYPE:$m,keyZ:Pr,logZ:Ga,newZ:uO,ontologyID:KB},Symbol.toStringTag,{value:"Module"})),HB="/workspace/schematic/retrieve",QB="/workspace/schematic/create",eF="/workspace/schematic/rename",tF="/workspace/schematic/set-data",nF="/workspace/schematic/delete",rF="/workspace/schematic/copy",iF=y({keys:Cn.array()}),sF=y({workspace:Ct,schematics:dO.array()}),aF=y({key:Cn,name:O()}),oF=y({key:Cn,data:O()}),uF=y({keys:Cn.array()}),cF=y({key:Cn,name:O(),snapshot:ne()}),lF=y({schematics:rt(bm)}),dF=y({schematics:bm.array()}),mF=y({schematic:Xa}),No=y({});let cS=class{constructor(e){f(this,"client");this.client=e}async create(e,r){const i=Array.isArray(r),n=await Z(this.client,QB,{workspace:e,schematics:C.toArray(r)},sF,dF);return i?n.schematics:n.schematics[0]}async rename(e,r){await Z(this.client,eF,{key:e,name:r},aF,No)}async setData(e,r){await Z(this.client,tF,{key:e,data:JSON.stringify(r)},oF,No)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,HB,{keys:C.toArray(e)},iF,lF);return r?i.schematics:i.schematics[0]}async delete(e){await Z(this.client,nF,{keys:C.toArray(e)},uF,No)}async copy(e,r,i){return(await Z(this.client,rF,{key:e,name:r,snapshot:i},cF,mF)).schematic}};const fF=t=>new V({type:wm,key:t}),hF=Object.freeze(Object.defineProperty({__proto__:null,Client:cS,ONTOLOGY_TYPE:wm,keyZ:Cn,newZ:dO,ontologyID:fF,remoteZ:bm,schematicZ:Xa},Symbol.toStringTag,{value:"Module"})),pF="/workspace/table/retrieve",vF="/workspace/table/create",gF="/workspace/table/rename",yF="/workspace/table/set-data",$F="/workspace/table/delete",bF=y({keys:jr.array()}),wF=y({workspace:Ct,tables:mO.array()}),_F=y({key:jr,name:O()}),kF=y({key:jr,data:O()}),IF=y({keys:jr.array()}),OF=y({tables:km.array()}),SF=y({tables:km.array()}),To=y({});let lS=class{constructor(e){f(this,"client");this.client=e}async create(e,r){const i=Array.isArray(r),n=await Z(this.client,vF,{workspace:e,tables:C.toArray(r)},wF,SF);return i?n.tables:n.tables[0]}async rename(e,r){await Z(this.client,gF,{key:e,name:r},_F,To)}async setData(e,r){await Z(this.client,yF,{key:e,data:JSON.stringify(r)},kF,To)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,pF,{keys:C.toArray(e)},bF,OF);return r?i.tables:i.tables[0]}async delete(e){await Z(this.client,$F,{keys:C.toArray(e)},IF,To)}};const NF=t=>new V({type:Im,key:t}),TF=Object.freeze(Object.defineProperty({__proto__:null,Client:lS,ONTOLOGY_TYPE:Im,keyZ:jr,newZ:mO,ontologyID:NF,remoteZ:km,tableZ:_m},Symbol.toStringTag,{value:"Module"})),ms="/workspace/retrieve",zF="/workspace/create",xF="/workspace/rename",EF="/workspace/set-layout",UF="/workspace/delete",fs=y({keys:Ct.array().optional(),search:O().optional(),author:Dn.optional(),offset:ue().optional(),limit:ue().optional()}),ZF=y({workspaces:cO.array()}),PF=y({key:Ct,name:O()}),jF=y({key:Ct,layout:O()}),AF=y({keys:Ct.array()}),hs=y({workspaces:rt(Ya)}),DF=y({workspaces:lO.array()}),zo=y({});class dS{constructor(e){f(this,"type",Ka);f(this,"schematic");f(this,"linePlot");f(this,"log");f(this,"table");f(this,"client");this.client=e,this.schematic=new cS(e),this.linePlot=new oS(e),this.log=new uS(e),this.table=new lS(e)}async create(e){const r=Array.isArray(e),i=await Z(this.client,zF,{workspaces:C.toArray(e)},ZF,DF);return r?i.workspaces:i.workspaces[0]}async rename(e,r){await Z(this.client,xF,{key:e,name:r},PF,zo)}async setLayout(e,r){await Z(this.client,EF,{key:e,layout:JSON.stringify(r)},jF,zo)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,ms,{keys:C.toArray(e)},fs,hs);return r?i.workspaces:i.workspaces[0]}async retrieveByAuthor(e){return(await Z(this.client,ms,{author:e},fs,hs)).workspaces}async search(e){return(await Z(this.client,ms,{search:e},fs,hs)).workspaces}async page(e,r){return(await Z(this.client,ms,{offset:e,limit:r},fs,hs)).workspaces}async delete(e){await Z(this.client,UF,{keys:C.toArray(e)},AF,zo)}}const CF=t=>new V({type:Ka,key:t}),RF=Object.freeze(Object.defineProperty({__proto__:null,Client:dS,ONTOLOGY_TYPE:Ka,keyZ:Ct,newZ:cO,ontologyID:CF,remoteZ:lO,workspaceZ:Ya},Symbol.toStringTag,{value:"Module"})),mS=y({host:O({error:"Host is required"}).min(1,"Host is required"),port:ue({error:"Port is required"}).or(O({error:"Port is required"})),username:O().min(1,"Username is required"),password:O().min(1,"Password is required"),connectivityPollFrequency:M.z.default(M.seconds(30)),secure:ne().optional().default(!1),name:O().optional(),retry:v$.breakerConfigZ.optional()});class fS extends BO{constructor(r){const i=mS.parse(r),{host:n,port:s,username:a,password:o,connectivityPollFrequency:u,secure:c,retry:l}=i,d=new kB(new Jz({host:n,port:Number(s)}),l,c);d.use(jR);let g;a!=null&&o!=null&&(g=new fL(d.unary,{username:a,password:o}),d.use(g.middleware()));const p=new Tm(new wi(d.unary)),_=new EO(d.unary,p);super(d.stream,d.unary,p);f(this,"createdAt");f(this,"props");f(this,"ranges");f(this,"channels");f(this,"auth");f(this,"user");f(this,"access");f(this,"connectivity");f(this,"ontology");f(this,"workspaces");f(this,"labels");f(this,"hardware");f(this,"control");f(this,"transport");f(this,"clientVersion","0.43.0");this.createdAt=W.now(),this.props=i,this.auth=g,this.transport=d,this.channels=new TO(this,p,d.unary,_),this.connectivity=new ki(d.unary,u,this.clientVersion,i.name),this.control=new qO(this),this.ontology=new wO(d.unary,this);const k=new aS(this.transport.unary);this.labels=new nS(this.transport.unary,this,this.ontology),this.ranges=new sS(this,k,this.transport.unary,p,this.labels,this.ontology),this.access=new IO(this.transport.unary),this.user=new UO(this.transport.unary),this.workspaces=new dS(this.transport.unary);const m=new VO(this.transport.unary,this),h=new XO(this.transport.unary,this,this.ontology,this.ranges),v=new WO(this.transport.unary,h,this);this.hardware=new JO(h,v,m)}get key(){return this.createdAt.valueOf().toString()}close(){this.connectivity.stopChecking()}}f(fS,"connectivity",ki);exports.AuthError=$i;exports.Channel=zm;exports.ContiguityError=UR;exports.DataType=ae;exports.Density=ot;exports.Frame=Je;exports.MultiSeries=o$;exports.MultipleFoundError=Sn;exports.NotFoundError=On;exports.QueryError=Vt;exports.Rate=Ao;exports.RouteError=yu;exports.Series=Ft;exports.Synnax=fS;exports.TimeRange=Ee;exports.TimeSpan=M;exports.TimeStamp=W;exports.UnexpectedError=ir;exports.ValidationError=Ce;exports.access=y2;exports.channel=L2;exports.connection=pL;exports.control=WL;exports.device=aM;exports.framer=LL;exports.group=GR;exports.hardware=GL;exports.isCalculated=_i;exports.label=FM;exports.linePlot=DB;exports.log=XB;exports.ontology=r2;exports.policy=g2;exports.rack=hM;exports.ranger=wB;exports.schematic=hF;exports.signals=YL;exports.synnaxPropsZ=mS;exports.table=TF;exports.task=zM;exports.user=sL;exports.workspace=RF;
|
|
41
|
+
`);const d=new Y({data:t[l],dataType:h.dataType});o.push(h.key),c.push(d)}return new Z(o,c)}if(e instanceof Z||e instanceof Map){const o=new Z(e);if(this.adapter==null)return o;const c=o.columns.map(l=>{const h=typeof l=="string"?this.adapter?.get(l):l;if(h==null)throw new M(`
|
|
42
|
+
Channel ${l} was not provided in the list of channels when opening the writer
|
|
43
|
+
`);return h});return new Z(c,o.series)}const n=[],a=[],i=Object.entries(e);for(let o=0;o<i.length;o++){const[c,l]=i[o],h=await this.fetchChannel(c),d=new Y({data:l,dataType:h.dataType});n.push(h.key),a.push(d)}return new Z(n,a)}}class ii{name;stream;constructor(e,t){this.stream=t,this.name=e}async receive(){const[e,t]=await this.stream.receive();if(t!=null)throw t;return e}received(){return this.stream.received()}async closeAndAck(){for(this.stream.closeSend();;){const[e,t]=await this.stream.receive();if(e!=null&&console.warn(`${this.name} received unexpected response on ${JSON.stringify(e)} closure.
|
|
44
|
+
Please report this error to the Synnax team.`),t!=null){if(K.matches(t))return;throw t}}}closeSend(){this.stream.closeSend()}send(e){const t=this.stream.send(e);if(t!=null)throw t}}const Yt=new v(-1);var yn=(r=>(r[r.Open=0]="Open",r[r.Next=1]="Next",r[r.Prev=2]="Prev",r[r.SeekFirst=3]="SeekFirst",r[r.SeekLast=4]="SeekLast",r[r.SeekLE=5]="SeekLE",r[r.SeekGE=6]="SeekGE",r[r.Valid=7]="Valid",r[r.Error=8]="Error",r))(yn||{}),oi=(r=>(r[r.None=0]="None",r[r.Ack=1]="Ack",r[r.Data=2]="Data",r))(oi||{});const Lf=s.z.object({command:s.z.enum(yn),span:v.z.optional(),bounds:z.z.optional(),stamp:O.z.optional(),keys:U.array().optional(),chunkSize:s.z.number().optional()}),Bf=s.z.object({variant:s.z.enum(oi),ack:s.z.boolean(),command:s.z.enum(yn),error:le.payloadZ.optional().nullable(),frame:Xt.optional()});class wt{static ENDPOINT="/frame/iterate";stream;adapter;value;constructor(e,t){this.stream=new ii("Iterator",e),this.value=new Z,this.adapter=t}static async _open(e,t,n,a,i={}){const o=await Qt.open(n,t),c=await a.stream(wt.ENDPOINT,Lf,Bf),l=new wt(c,o);return await l.execute({command:0,keys:o.keys,bounds:new z(e),chunkSize:i.chunkSize??1e5}),l}async next(e=Yt){return await this.execute({command:1,span:new v(e)})}async prev(e=Yt){return await this.execute({command:2,span:new v(e)})}async seekFirst(){return await this.execute({command:3})}async seekLast(){return await this.execute({command:4})}async seekLE(e){return await this.execute({command:5,stamp:new O(e)})}async seekGE(e){return await this.execute({command:6,stamp:new O(e)})}async valid(){return await this.execute({command:7})}async close(){await this.stream.closeAndAck()}[Symbol.asyncIterator](){return new qf(this)}async execute(e){for(this.stream.send(e),this.value=new Z;;){const t=await this.stream.receive();if(t.variant===1)return t.ack;this.value.push(this.adapter.adapt(new Z(t.frame)))}}}class qf{iter;open=!1;constructor(e){this.iter=e}async next(){try{let e=!0;return this.open||(await this.iter.seekFirst()||(e=!1),this.open=!0),await this.iter.next()||(e=!1),e||await this.iter.close(),{done:!e,value:this.iter.value}}catch(e){throw await this.iter.close(),e}}}const Ff=s.z.object({keys:s.z.number().array(),downsampleFactor:s.z.number()}),Yf=s.z.object({frame:Xt}),Vf="/frame/stream",us=s.z.object({channels:ke,downsampleFactor:s.z.number().optional().default(1),useExperimentalCodec:s.z.boolean().optional().default(!1)}),gn=us.or(ke.transform(r=>us.parse({channels:r}))),ci=(r,e)=>async t=>{const n=gn.parse(t),a=await Qt.open(r,n.channels);n.useExperimentalCodec&&(e=e.withCodec(new Pf(a.codec)));const i=await e.stream(Vf,Ff,Yf),o=new Wf(i,a);i.send({keys:a.keys,downsampleFactor:n.downsampleFactor??1});const[,c]=await i.receive();if(c!=null)throw c;return o},li=async(r,e,t)=>await ci(r,e)(t);class Wf{stream;adapter;downsampleFactor;constructor(e,t){this.stream=new ii("Streamer",e),this.adapter=t,this.downsampleFactor=1}get keys(){return this.adapter.keys}async next(){try{return{done:!1,value:await this.read()}}catch(e){if(K.matches(e))return{done:!0,value:void 0};throw e}}async read(){return this.adapter.adapt(new Z((await this.stream.receive()).frame))}async update(e){await this.adapter.update(e)&&this.stream.send({keys:this.adapter.keys,downsampleFactor:this.downsampleFactor})}close(){this.stream.closeSend()}[Symbol.asyncIterator](){return this}}class er{wrapped_=null;breaker;opener;config;constructor(e,t,n={}){this.opener=e,this.config=gn.parse(t);const{maxRetries:a=5e3,baseInterval:i=v.seconds(1),scale:o=1}=n??{};this.breaker=new ha.Breaker({maxRetries:a,baseInterval:i,scale:o})}static async open(e,t,n){const a=new er(e,t,n);return await a.runStreamer(),a}async runStreamer(){for(;;)try{this.wrapped_!=null&&this.wrapped_.close(),this.wrapped_=await this.opener(this.config),this.breaker.reset();return}catch(e){if(this.wrapped_=null,!await this.breaker.wait())throw e;console.error("failed to open streamer",e);continue}}get wrapped(){if(this.wrapped_==null)throw new Error("stream closed");return this.wrapped_}async update(e){this.config.channels=ke.parse(e);try{await this.wrapped.update(e)}catch{return await this.runStreamer(),await this.update(e)}}async next(){try{return{done:!1,value:await this.read()}}catch(e){if(K.matches(e))return{done:!0,value:void 0};throw e}}async read(){try{const e=await this.wrapped.read();return this.breaker.reset(),e}catch(e){if(K.matches(e))throw e;return await this.runStreamer(),await this.read()}}close(){this.wrapped.close()}get keys(){return this.wrapped.keys}[Symbol.asyncIterator](){return this}}class ui extends Eu.Observer{streamer;closePromise;constructor(e,t){super(t),this.streamer=e,this.closePromise=this.stream()}async update(e){await this.streamer.update(e)}async close(){this.streamer.close(),await this.closePromise}async stream(){for await(const e of this.streamer)this.notify(e)}}const _f=r=>({type:"framer",key:r.toString()});let hi=class{streamClient;retriever;deleter;constructor(e,t,n){this.streamClient=e,this.retriever=n,this.deleter=new Sf(t)}async openIterator(e,t,n){return await wt._open(e,t,this.retriever,this.streamClient,n)}async openWriter(e){return await ni._open(this.retriever,this.streamClient,e)}async openStreamer(e){return await li(this.retriever,this.streamClient,e)}async write(e,t,n){if(n==null){const i=t,o=await this.openWriter({start:e,channels:Object.keys(i),mode:mt.Persist,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:v.MAX});return await o.write(i),await o.close()}const a=await this.openWriter({start:e,channels:t,mode:mt.Persist,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:v.MAX});await a.write(t,n),await a.close()}async read(e,t){const{single:n}=J(t),a=await this.readFrame(e,t);return n?a.get(t):a}async readFrame(e,t){const n=await this.openIterator(e,t),a=new Z;try{for await(const i of n)a.push(i)}finally{await n.close()}return a}async readLatest(e,t=1){const{single:n}=J(e),a=await this.readLatestNFrame(e,t);return n?a.get(e):a}async readLatestNFrame(e,t){const n=await this.openIterator(z.MAX,e,{chunkSize:t}),a=new Z;if(t>0)try{await n.seekLast(),await n.prev(Yt),a.push(n.value)}finally{await n.close()}return a}async delete(e,t){const{normalized:n,variant:a}=J(e);return a==="keys"?await this.deleter.delete({keys:n,bounds:t}):await this.deleter.delete({names:n,bounds:t})}};const Hf=Object.freeze(Object.defineProperty({__proto__:null,ALWAYS_INDEX_PERSIST_ON_AUTO_COMMIT:If,AUTO_SPAN:Yt,Client:hi,Frame:Z,HardenedStreamer:er,Iterator:wt,ObservableStreamer:ui,Writer:ni,WriterClosedError:Fr,WriterCommand:We,WriterMode:mt,createStreamOpener:ci,frameZ:Xt,ontologyID:_f,openStreamer:li,seriesFromPayload:Qa,seriesToPayload:ei,streamerConfigZ:gn,writerConfigZ:ri},Symbol.toStringTag,{value:"Module"})),Gf=G.ABSOLUTE_AUTHORITY,Jf=G.ZERO_AUTHORITY,Kf=G.stateZ(s.z.number()),Xf=r=>r.to==null?`${r.from?.resource} - ${r.from?.subject.name} -> released`:r.from==null?`${r.to.resource} - released -> ${r.to.subject.name} (${r.to.authority.toString()})`:`${r.to.resource} - ${r.from.subject.name} -> ${r.to.subject.name} (${r.to.authority.toString()})`,Qf=s.z.object({transfers:s.z.array(G.transferZ(U))});class di extends ui{states;codec;constructor(e){super(e,t=>{const n=this.codec.decode(t.series[0].buffer,Qf);return this.merge(n),[n.transfers,!0]}),this.states=new Map,this.codec=new $e.JSONCodec}subjects(){const e=new Map;return this.states.forEach(t=>e.set(t.subject.key,t.subject)),Array.from(e.values())}merge(e){e.transfers.forEach(t=>{t.from==null&&t.to==null&&console.warn("Invalid transfer: ",t),t.to==null?this.states.delete(t.from.resource):this.states.set(t.to.resource,t.to)})}}const fi="sy_node_1_control";let yi=class{framer;constructor(e){this.framer=e}async openStateTracker(){const e=await er.open(async t=>await this.framer.openStreamer(t),fi);return new di(e)}};const ey=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:Gf,CONTROL_STATE_CHANNEL_NAME:fi,Client:yi,StateTracker:di,ZERO_AUTHORITY:Jf,stateZ:Kf,transferString:Xf},Symbol.toStringTag,{value:"Module"}));let gi=class{tasks;racks;devices;constructor(e,t,n){this.tasks=e,this.racks=t,this.devices=n}};const ty=Object.freeze(Object.defineProperty({__proto__:null,Client:gi},Symbol.toStringTag,{value:"Module"})),ne=s.z.uint32(),pi=Ht.statusZ(s.z.object({rack:ne})),tr=s.z.object({key:ne,name:s.z.string(),status:ct.nullToUndefined(pi)}),mi=tr.partial({key:!0}),wi=r=>r?$e.JSON_CODEC.decodeString(r,ue.unknownZ):{},Qe=s.z.string(),bi=Ht.statusZ(s.z.object({rack:ne,device:Qe})),rr=s.z.object({key:Qe,rack:ne,name:s.z.string(),make:s.z.string(),model:s.z.string(),location:s.z.string(),configured:s.z.boolean().optional(),properties:ue.unknownZ.or(s.z.string().transform(wi)),status:ct.nullToUndefined(bi)}),Ti=rr.extend({properties:s.z.unknown().transform(r=>$e.JSON_CODEC.encodeString(r))}),ry="sy_device_set",ny="sy_device_delete",sy="sy_device_status",ay="/hardware/device/retrieve",iy="/hardware/device/create",oy="/hardware/device/delete",cy=s.z.object({devices:Ti.array()}),ly=s.z.object({devices:rr.array()}),uy=s.z.object({keys:Qe.array()}),hy=s.z.object({}),dy=s.z.object({keys:Qe.array().optional(),names:s.z.string().array().optional(),makes:s.z.string().array().optional(),models:s.z.string().array().optional(),locations:s.z.string().array().optional(),racks:ne.array().optional(),searchTerm:s.z.string().optional(),limit:s.z.number().optional(),offset:s.z.number().optional(),includeStatus:s.z.boolean().optional()}),fy=s.z.object({devices:L(rr)}),yy=s.z.object({key:Qe,includeStatus:s.z.boolean().optional()}).transform(({key:r,includeStatus:e})=>({keys:[r],includeStatus:e})),gy=s.z.union([yy,dy]);let vi=class{type="device";client;constructor(e){this.client=e}async retrieve(e){const t=typeof e=="object"&&"key"in e,n=await g(this.client,ay,e,gy,fy);Xe("Device",e,n.devices,t);const a=n.devices;return t?a[0]:a}async create(e){const t=!Array.isArray(e),a=(await g(this.client,iy,{devices:T.toArray(e)},cy,ly)).devices;return t?a[0]:a}async delete(e){await g(this.client,oy,{keys:T.toArray(e)},uy,hy)}};const py=r=>({type:"device",key:r}),my=Object.freeze(Object.defineProperty({__proto__:null,Client:vi,DELETE_CHANNEL_NAME:ny,SET_CHANNEL_NAME:ry,STATUS_CHANNEL_NAME:sy,deviceZ:rr,keyZ:Qe,newZ:Ti,ontologyID:py,statusZ:bi},Symbol.toStringTag,{value:"Module"})),wy="/hardware/rack/retrieve",by="/hardware/rack/create",Ty="/hardware/rack/delete",vy="sy_rack_status",Ey="sy_rack_set",Oy="sy_rack_delete",Ny=s.z.object({keys:ne.array().optional(),names:s.z.string().array().optional(),searchTerm:s.z.string().optional(),embedded:s.z.boolean().optional(),hostIsNode:s.z.boolean().optional(),limit:s.z.number().optional(),offset:s.z.number().optional(),includeStatus:s.z.boolean().optional()}),zy=s.z.object({racks:L(tr)}),Sy=s.z.union([s.z.object({key:ne,includeStatus:s.z.boolean().optional()}).transform(({key:r,includeStatus:e})=>({keys:[r],includeStatus:e})),s.z.object({name:s.z.string(),includeStatus:s.z.boolean().optional()}).transform(({name:r,includeStatus:e})=>({names:[r],includeStatus:e}))]),Iy=Ny,Ay=s.z.union([Sy,Iy]),$y=s.z.object({racks:mi.array()}),ky=s.z.object({racks:tr.array()}),Cy=s.z.object({keys:ne.array()}),xy=s.z.object({});let Ei=class{type="rack";client;tasks;constructor(e,t){this.client=e,this.tasks=t}async delete(e){await g(this.client,Ty,{keys:T.toArray(e)},Cy,xy)}async create(e){const t=!Array.isArray(e),n=await g(this.client,by,{racks:T.toArray(e)},$y,ky),a=this.sugar(n.racks);return t?a[0]:a}async retrieve(e){const t="key"in e||"name"in e,n=await g(this.client,wy,e,Ay,zy),a=this.sugar(n.racks);return Xe("Rack",e,a,t),t?a[0]:a}sugar(e){const t=!Array.isArray(e),n=T.toArray(e).map(({key:a,name:i,status:o})=>new Oi(a,i,this.tasks,o));return t?n[0]:n}};class Oi{key;name;status;tasks;constructor(e,t,n,a){this.key=e,this.name=t,this.tasks=n,this.status=a}async listTasks(){return await this.tasks.retrieve({rack:this.key})}async createTask(e,t){return e.key=((BigInt(this.key)<<32n)+(BigInt(e.key??0)&0xffffffffn)).toString(),await this.tasks.create(e,t)}async deleteTask(e){await this.tasks.delete([e])}get payload(){return{key:this.key,name:this.name,status:this.status}}}const Ry=r=>({type:"rack",key:r.toString()}),jy=Object.freeze(Object.defineProperty({__proto__:null,Client:Ei,DELETE_CHANNEL_NAME:Oy,Rack:Oi,SET_CHANNEL_NAME:Ey,STATUS_CHANNEL_NAME:vy,keyZ:ne,newZ:mi,ontologyID:Ry,rackZ:tr,statusZ:pi},Symbol.toStringTag,{value:"Module"})),he=r=>r?JSON.parse(r):{},de=s.z.union([s.z.string(),s.z.bigint().transform(r=>r.toString()),s.z.number().transform(r=>r.toString())]),Ni=r=>s.z.object({task:de,running:s.z.boolean(),data:r}),pn=r=>Ht.statusZ(Ni(r)),St=(r={typeSchema:s.z.string(),configSchema:s.z.unknown(),statusDataSchema:s.z.unknown()})=>s.z.object({key:de,name:s.z.string(),type:r.typeSchema,internal:s.z.boolean().optional(),config:s.z.string().transform(wi).or(r.configSchema),status:pn(r.statusDataSchema).optional().nullable(),snapshot:s.z.boolean().optional()}),zi=r=>St(r).omit({key:!0}).extend({key:de.transform(e=>e.toString()).optional(),config:s.z.unknown().transform(e=>$e.JSON_CODEC.encodeString(e))}),Uy=s.z.object({task:de,type:s.z.string(),key:s.z.string(),args:ue.unknownZ.or(s.z.string().transform(he)).or(s.z.array(s.z.unknown())).or(s.z.null()).optional()}),Dy=r=>Number(BigInt(r)>>32n),Vr="sy_task_status",Wr="sy_task_cmd",My="sy_task_set",Zy="sy_task_delete",Se=new Error("Task not created"),Si=async(r,e)=>{const t=await e.retrieveParents(mn(r));return t.length===0?null:t[0]};class Ii{key;name;internal;type;snapshot;config;status;schemas;frameClient_;ontologyClient_;rangeClient_;get frameClient(){if(this.frameClient_==null)throw Se;return this.frameClient_}get ontologyClient(){if(this.ontologyClient_==null)throw Se;return this.ontologyClient_}get rangeClient(){if(this.rangeClient_==null)throw Se;return this.rangeClient_}constructor({key:e,type:t,name:n,config:a,internal:i=!1,snapshot:o=!1,status:c},l,h,d,u){this.key=e,this.name=n,this.type=t,this.config=a,this.schemas=l??{typeSchema:s.z.string(),configSchema:s.z.unknown(),statusDataSchema:s.z.unknown()},this.internal=i,this.snapshot=o,this.status=c,this.frameClient_=h,this.ontologyClient_=d,this.rangeClient_=u}get payload(){return{key:this.key,name:this.name,type:this.type,config:this.config,status:this.status,internal:this.internal}}get ontologyID(){return mn(this.key)}async executeCommand(e,t){return await wn(this.frameClient,this.key,e,t)}async executeCommandSync(e,t,n){return await $i(this.frameClient,this.key,e,t,this.name,this.schemas?.statusDataSchema,n)}async snapshottedTo(){if(this.ontologyClient==null||this.rangeClient==null)throw Se;return this.snapshot?await Si(this.key,this.ontologyClient):null}}const Py=s.z.object({rack:ne.optional(),keys:de.array().optional(),names:s.z.string().array().optional(),types:s.z.string().array().optional(),includeStatus:s.z.boolean().optional(),offset:s.z.number().optional(),limit:s.z.number().optional()}),Ly=s.z.union([s.z.object({key:de,includeStatus:s.z.boolean().optional()}).transform(({key:r,includeStatus:e})=>({keys:[r],includeStatus:e})),s.z.object({name:s.z.string(),includeStatus:s.z.boolean().optional()}).transform(({name:r,includeStatus:e})=>({names:[r],includeStatus:e}))]),By=Py,qy=s.z.union([Ly,By]),Fy=r=>s.z.object({tasks:L(St(r))}),Yy="/hardware/task/retrieve",Vy="/hardware/task/create",Wy="/hardware/task/delete",_y="/hardware/task/copy",Hy=r=>s.z.object({tasks:zi(r).array()}),Gy=r=>s.z.object({tasks:St(r).array()}),Jy=s.z.object({keys:de.array()}),Ky=s.z.object({}),Xy=s.z.object({key:de,name:s.z.string(),snapshot:s.z.boolean()}),Qy=r=>s.z.object({task:St(r)});let Ai=class{type="task";client;frameClient;ontologyClient;rangeClient;constructor(e,t,n,a){this.client=e,this.frameClient=t,this.ontologyClient=n,this.rangeClient=a}async create(e,t){const n=!Array.isArray(e),a=Hy(t),i=Gy(t),o=await g(this.client,Vy,{tasks:T.toArray(e)},a,i),c=this.sugar(o.tasks,t);return n?c[0]:c}async delete(e){await g(this.client,Wy,{keys:T.toArray(e)},Jy,Ky)}async retrieve({schemas:e,...t}){const n="key"in t||"name"in t,i=(await g(this.client,Yy,t,qy,Fy(e))).tasks,o=this.sugar(i,e);return Xe("Task",t,o,n),n?o[0]:o}async copy(e,t,n){const a=Qy(),i=await g(this.client,_y,{key:e,name:t,snapshot:n},Xy,a);return this.sugar(i.task)}async retrieveSnapshottedTo(e){if(this.ontologyClient==null)throw Se;return await Si(e,this.ontologyClient)}sugar(e,t){const n=!Array.isArray(e),a=T.toArray(e).map(({key:i,name:o,type:c,config:l,status:h,internal:d,snapshot:u})=>new Ii({key:i,name:o,type:c,config:l,internal:d,snapshot:u,status:h},t,this.frameClient,this.ontologyClient,this.rangeClient));return n?a[0]:a}async executeCommand(e,t,n){return await wn(this.frameClient,e,t,n)}async executeCommandSync(e,t,n,a,i,o=s.z.unknown()){const c=async()=>(await this.retrieve({key:e})).name;return await $i(this.frameClient,e,t,n,i??c,o,a)}};const mn=r=>({type:"task",key:r}),wn=async(r,e,t,n)=>{if(r==null)throw Se;const a=eu.create(),i=await r.openWriter(Wr);return await i.write(Wr,[{args:n,key:a,task:e,type:t}]),await i.close(),a},$i=async(r,e,t,n,a,i,o)=>{if(r==null)throw Se;const c=await r.openStreamer(Vr),l=await wn(r,e,t,o),h=new v(n);let d;const u=new Promise((N,E)=>{d=setTimeout(()=>{(async()=>E(await eg(t,a,h,e)))()},h.milliseconds)});try{for(;;){const N=await Promise.race([c.read(),u]),E=pn(i).parse(N.at(-1)[Vr]);if(E.key===l)return E}}finally{clearTimeout(d),c.close()}},eg=async(r,e,t,n)=>{const a=ol.capitalize(r),i=t.toString();try{const o=typeof e=="string"?e:await e();return new Error(`${a} command to ${o} timed out after ${i}`)}catch(o){return console.error("Failed to retrieve task name for timeout error:",o),new Error(`${a} command to task with key ${n} timed out after ${i}`)}},tg=Object.freeze(Object.defineProperty({__proto__:null,COMMAND_CHANNEL_NAME:Wr,Client:Ai,DELETE_CHANNEL_NAME:Zy,SET_CHANNEL_NAME:My,STATUS_CHANNEL_NAME:Vr,Task:Ii,commandZ:Uy,keyZ:de,newZ:zi,ontologyID:mn,rackKey:Dy,statusDetailsZ:Ni,statusZ:pn,taskZ:St},Symbol.toStringTag,{value:"Module"})),Oe=s.z.uuid(),It=s.z.object({key:Oe,name:s.z.string().min(1),color:s.z.string()}),rg="labeled_by",ng="sy_label_set",sg="sy_label_delete",ki=It.extend({key:Oe.optional()}),ag=s.object({labels:ki.array()}),ig=s.object({labels:It.array()}),og=s.object({keys:Oe.array()}),Ci=s.object({id:R,labels:Oe.array(),replace:s.boolean().optional()}),cg=Ci.omit({replace:!0}),wr=s.object({}),lg="/label/create",ug="/label/delete",hg="/label/set",dg="/label/remove",fg="/label/retrieve",yg=s.object({keys:Oe.array().optional(),for:R.optional(),searchTerm:s.string().optional(),offset:s.number().optional(),limit:s.number().optional()}),gg=s.object({key:Oe}).transform(({key:r})=>({keys:[r]})),pg=s.union([gg,yg]),mg=s.object({labels:L(It)});let xi=class{type="label";client;constructor(e){this.client=e}async retrieve(e){const t="key"in e,n=await g(this.client,fg,e,pg,mg);return Xe("Label",e,n.labels,t),t?n.labels[0]:n.labels}async label(e,t,n={}){await g(this.client,hg,{id:e,labels:t,replace:n.replace},Ci,wr)}async remove(e,t){await g(this.client,dg,{id:e,labels:t},cg,wr)}async create(e){const t=Array.isArray(e),n=await g(this.client,lg,{labels:T.toArray(e)},ag,ig);return t?n.labels:n.labels[0]}async delete(e){await g(this.client,ug,{keys:T.toArray(e)},og,wr)}};const wg=r=>({type:"label",key:r}),bg=Object.freeze(Object.defineProperty({__proto__:null,Client:xi,DELETE_CHANNEL_NAME:sg,LABELED_BY_ONTOLOGY_RELATIONSHIP_TYPE:rg,SET_CHANNEL_NAME:ng,keyZ:Oe,labelZ:It,newZ:ki,ontologyID:wg},Symbol.toStringTag,{value:"Module"})),_=s.z.uuid(),bn=s.z.string().min(1),At=s.z.object({key:_,name:bn,timeRange:z.z,color:s.z.string().optional(),labels:L(It),get parent(){return At.optional().nullable().transform(r=>r===void 0?null:r)}}),Ri=At.omit({parent:!0,labels:!0}).partial({key:!0}),Tg="sy_range_alias_set",vg="sy_range_alias_delete",Eg=s.z.object({range:_,aliases:s.z.string().array()}),Og=s.z.object({aliases:s.z.record(s.z.string(),U)}),Ng=s.z.object({range:_,aliases:s.z.record(U.or(s.z.string()),s.z.string())}),zg=s.z.unknown(),Sg=s.z.object({range:_,channels:U.array()}),Ig=s.z.unknown(),Ag=s.z.object({range:_}),$g=s.z.object({aliases:s.z.record(s.z.string(),s.z.string())});class Le{static SET_ENDPOINT="/range/alias/set";static RESOLVE_ENDPOINT="/range/alias/resolve";static LIST_ENDPOINT="/range/alias/list";static DELETE_ENDPOINT="/range/alias/delete";frameClient;cache=new Map;client;rangeKey;constructor(e,t,n){this.rangeKey=e,this.cache=new Map,this.client=n,this.frameClient=t}async resolve(e){const t=[],n=typeof e=="string",a={};if(n){const o=this.cache.get(e);if(o!=null)return o;t.push(e)}else e.forEach(o=>{const c=this.cache.get(o);c!=null?a[o]=c:t.push(o)});if(t.length===0)return a;const i=await g(this.client,Le.RESOLVE_ENDPOINT,{range:this.rangeKey,aliases:t},Eg,Og);return Object.entries(i.aliases).forEach(([o,c])=>this.cache.set(o,c)),n?i.aliases[t[0]]:{...a,...i.aliases}}async set(e){await g(this.client,Le.SET_ENDPOINT,{range:this.rangeKey,aliases:e},Ng,zg)}async list(){return(await g(this.client,Le.LIST_ENDPOINT,{range:this.rangeKey},Ag,$g)).aliases}async delete(e){await g(this.client,Le.DELETE_ENDPOINT,{range:this.rangeKey,channels:e},Sg,Ig)}}const kg=s.z.object({alias:s.z.string(),channel:U,range:_}),Cg="---",xg=r=>{const[e,t]=r.split(Cg);return{range:e,channel:Number(t)}},Rg="sy_range_kv_set",jg="sy_range_kv_delete",Tn=s.z.object({range:_,key:s.z.string(),value:s.z.string()}),Ug=s.z.object({range:_,keys:s.z.string().array()}),Dg=s.z.object({pairs:L(Tn)}),Mg=s.z.object({range:_,pairs:Tn.array()}),Zg=s.z.object({range:_,keys:s.z.string().array()});class Ae{static GET_ENDPOINT="/range/kv/get";static SET_ENDPOINT="/range/kv/set";static DELETE_ENDPOINT="/range/kv/delete";rangeKey;client;constructor(e,t){this.rangeKey=e,this.client=t}async get(e){const t=await g(this.client,Ae.GET_ENDPOINT,{range:this.rangeKey,keys:T.toArray(e)},Ug,Dg);return typeof e=="string"?t.pairs[0].value:Object.fromEntries(t.pairs.map(n=>[n.key,n.value]))}async list(){return this.get([])}async set(e,t=""){let n;Ps(e)?n=Object.entries(e).map(([a,i])=>({range:this.rangeKey,key:a,value:i})):n=[{range:this.rangeKey,key:e,value:t}],await g(this.client,Ae.SET_ENDPOINT,{range:this.rangeKey,pairs:n},Mg,s.z.unknown())}async delete(e){await g(this.client,Ae.DELETE_ENDPOINT,{range:this.rangeKey,keys:T.toArray(e)},Zg,s.z.unknown())}}const Pg="sy_range_set",Lg="sy_range_delete";class ji{key;name;kv;timeRange;color;parent;labels;channels;aliaser;frameClient;labelClient;ontologyClient;rangeClient;constructor({name:e,timeRange:t=z.ZERO,key:n,color:a,parent:i,labels:o=[]},{frameClient:c,kv:l,aliaser:h,channels:d,labelClient:u,ontologyClient:N,rangeClient:E}){this.key=n,this.name=e,this.timeRange=t,this.parent=i,this.labels=o,this.frameClient=c,this.color=a,this.kv=l,this.aliaser=h,this.channels=d,this.labelClient=u,this.ontologyClient=N,this.rangeClient=E}get ontologyID(){return Be(this.key)}get payload(){return{key:this.key,name:this.name,timeRange:this.timeRange,color:this.color,labels:this.labels,parent:this.parent}}async setAlias(e,t){const n=await this.channels.retrieve(e);if(n.length===0)throw new ve(`Channel ${e} does not exist`);await this.aliaser.set({[n[0].key]:t})}async deleteAlias(...e){await this.aliaser.delete(e)}async listAliases(){return await this.aliaser.list()}async resolveAlias(e){return await this.aliaser.resolve(e)}async retrieveParent(){return this.rangeClient.retrieveParent(this.key)}async retrieveChildren(){const e=(await this.ontologyClient.retrieveChildren(this.ontologyID,{excludeFieldData:!0,types:["range"]})).map(t=>t.id.key);return await this.rangeClient.retrieve(e)}async read(e){return await this.frameClient.read(this.timeRange,e)}async retrieveLabels(){return await this.labelClient.retrieve({for:Be(this.key)})}async addLabel(...e){await this.labelClient.label(Be(this.key),e)}async removeLabel(...e){await this.labelClient.remove(Be(this.key),e)}static sort(e,t){return z.sort(e.timeRange,t.timeRange)}}const Bg=s.z.object({keys:_.array().optional(),names:s.z.array(s.z.string()).optional(),searchTerm:s.z.string().optional(),overlapsWith:z.z.optional(),limit:s.z.number().int().optional(),offset:s.z.number().int().optional(),hasLabels:Oe.array().optional(),includeLabels:s.z.boolean().optional(),includeParent:s.z.boolean().optional()}),qg=Bg.or(_.array().transform(r=>({keys:r}))).or(_.transform(r=>({keys:[r]}))).or(s.z.string().transform(r=>({names:[r]}))).or(s.z.string().array().transform(r=>({names:r}))).or(z.z.transform(r=>({overlapsWith:r}))),Fg="/range/retrieve",Yg=s.z.object({ranges:L(At)});let Ui=class{type="range";frameClient;writer;unaryClient;channels;labelClient;ontologyClient;constructor(e,t,n,a,i,o){this.frameClient=e,this.writer=t,this.unaryClient=n,this.channels=a,this.labelClient=i,this.ontologyClient=o}async create(e,t){const n=!Array.isArray(e),a=this.sugarMany(await this.writer.create(T.toArray(e),t));return n?a[0]:a}async rename(e,t){await this.writer.rename(e,t)}async delete(e){await this.writer.delete(T.toArray(e))}async retrieve(e){const t=typeof e=="string",{ranges:n}=await g(this.unaryClient,Fg,e,qg,Yg);return Xe("Range",e,n,t),t?this.sugarMany(n)[0]:this.sugarMany(n)}getKV(e){return new Ae(e,this.unaryClient)}async retrieveParent(e){const t=await this.ontologyClient.retrieveParents(Be(e));if(t.length===0)return null;const n=t[0];return n.id.type!=="range"?null:await this.retrieve(n.id.key)}sugarOntologyResource(e){return this.sugarOne(Di(e))}sugarOne(e){return new ji(e,{frameClient:this.frameClient,kv:new Ae(e.key,this.unaryClient),aliaser:new Le(e.key,this.frameClient,this.unaryClient),channels:this.channels,labelClient:this.labelClient,ontologyClient:this.ontologyClient,rangeClient:this})}sugarMany(e){return e.map(t=>this.sugarOne(t))}resourceToRange(e){return this.sugarOne({key:e.id.key,name:e.data?.name,timeRange:new z(e.data?.timeRange),color:e.data?.color,labels:[],parent:null})}};const Be=r=>({type:"range",key:r}),Vg=r=>({type:"range-alias",key:r}),Di=({data:r,id:{key:e},name:t})=>{const n=z.z.parse(r?.timeRange);return{key:e,name:t,timeRange:n,color:typeof r?.color=="string"?r.color:void 0,labels:[],parent:null}},Wg=s.z.object({ranges:At.array()}),_g=s.z.object({parent:R.optional(),ranges:Ri.array()}),Hg=s.z.object({keys:_.array()}),Gg=s.z.object({}),Jg=s.z.object({key:_,name:bn}),Kg=s.z.object({}),Xg="/range/create",Qg="/range/delete",ep="/range/rename";class Mi{client;constructor(e){this.client=e}async rename(e,t){await g(this.client,ep,{key:e,name:t},Jg,Kg)}async create(e,t){return(await g(this.client,Xg,{ranges:e,...t},_g,Wg)).ranges}async delete(e){await g(this.client,Qg,{keys:e},Hg,Gg)}}const tp=Object.freeze(Object.defineProperty({__proto__:null,Client:Ui,DELETE_ALIAS_CHANNEL_NAME:vg,DELETE_CHANNEL_NAME:Lg,KV:Ae,KV_DELETE_CHANNEL:jg,KV_SET_CHANNEL:Rg,Range:ji,SET_ALIAS_CHANNEL_NAME:Tg,SET_CHANNEL_NAME:Pg,Writer:Mi,aliasOntologyID:Vg,aliasZ:kg,convertOntologyResourceToPayload:Di,decodeDeleteAliasChange:xg,keyZ:_,kvPairZ:Tn,nameZ:bn,newZ:Ri,ontologyID:Be,payloadZ:At},Symbol.toStringTag,{value:"Module"})),rp="/api/v1/";class np{url;unary;stream;secure;constructor(e,t={},n=!1){this.secure=n,this.url=e.child(rp);const a=new $e.JSONCodec;this.unary=_c(new Wc(this.url,a,this.secure),t),this.stream=new Xc(this.url,a,this.secure)}use(...e){this.unary.use(...e),this.stream.use(...e)}}const et=s.z.uuid(),nr=s.z.object({key:et,name:s.z.string(),data:ue.unknownZ.or(s.z.string().transform(he))}),Zi=nr.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),se=s.z.uuid(),sr=s.z.object({key:se,name:s.z.string(),layout:ue.unknownZ.or(s.z.string().transform(he))}),Pi=sr.partial({key:!0}).transform(r=>({...r,layout:JSON.stringify(r.layout)})),Li=sr.omit({layout:!0}).extend({layout:s.z.string().transform(he)}),sp="/workspace/lineplot/retrieve",ap="/workspace/lineplot/create",ip="/workspace/lineplot/rename",op="/workspace/lineplot/set-data",cp="/workspace/lineplot/delete",lp=s.z.object({keys:et.array()}),up=s.z.object({workspace:se,linePlots:Zi.array()}),hp=s.z.object({key:et,name:s.z.string()}),dp=s.z.object({key:et,data:s.z.string()}),fp=s.z.object({keys:et.array()}),yp=s.z.object({linePlots:L(nr)}),gp=s.z.object({linePlots:nr.array()}),br=s.z.object({});let Bi=class{client;constructor(e){this.client=e}async create(e,t){const n=Array.isArray(t),a=await g(this.client,ap,{workspace:e,linePlots:T.toArray(t)},up,gp);return n?a.linePlots:a.linePlots[0]}async rename(e,t){await g(this.client,ip,{key:e,name:t},hp,br)}async setData(e,t){await g(this.client,op,{key:e,data:JSON.stringify(t)},dp,br)}async retrieve(e){const t=Array.isArray(e),n=await g(this.client,sp,{keys:T.toArray(e)},lp,yp);return t?n.linePlots:n.linePlots[0]}async delete(e){await g(this.client,cp,{keys:T.toArray(e)},fp,br)}};const pp=r=>({type:"lineplot",key:r}),mp=Object.freeze(Object.defineProperty({__proto__:null,Client:Bi,keyZ:et,linePlotZ:nr,newZ:Zi,ontologyID:pp},Symbol.toStringTag,{value:"Module"})),tt=s.z.uuid(),ar=s.z.object({key:tt,name:s.z.string(),data:ue.unknownZ.or(s.z.string().transform(he))}),qi=ar.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),wp="/workspace/log/retrieve",bp="/workspace/log/create",Tp="/workspace/log/rename",vp="/workspace/log/set-data",Ep="/workspace/log/delete",Op=s.z.object({keys:tt.array()}),Np=s.z.object({workspace:se,logs:qi.array()}),zp=s.z.object({key:tt,name:s.z.string()}),Sp=s.z.object({key:tt,data:s.z.string()}),Ip=s.z.object({keys:tt.array()}),Ap=s.z.object({logs:ar.array()}),$p=s.z.object({logs:ar.array()}),Tr=s.z.object({});let Fi=class{client;constructor(e){this.client=e}async create(e,t){const n=Array.isArray(t),a=await g(this.client,bp,{workspace:e,logs:T.toArray(t)},Np,$p);return n?a.logs:a.logs[0]}async rename(e,t){await g(this.client,Tp,{key:e,name:t},zp,Tr)}async setData(e,t){await g(this.client,vp,{key:e,data:JSON.stringify(t)},Sp,Tr)}async retrieve(e){const t=Array.isArray(e),n=await g(this.client,wp,{keys:T.toArray(e)},Op,Ap);return t?n.logs:n.logs[0]}async delete(e){await g(this.client,Ep,{keys:T.toArray(e)},Ip,Tr)}};const kp=r=>({type:"log",key:r}),Cp=Object.freeze(Object.defineProperty({__proto__:null,Client:Fi,keyZ:tt,logZ:ar,newZ:qi,ontologyID:kp},Symbol.toStringTag,{value:"Module"})),Ce=s.z.uuid(),ir=s.z.object({key:Ce,name:s.z.string(),data:ue.unknownZ.or(s.z.string().transform(he)),snapshot:s.z.boolean()}),Yi=ir.partial({key:!0,snapshot:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),vn=ir.extend({data:s.z.string().transform(he)}),xp="/workspace/schematic/retrieve",Rp="/workspace/schematic/create",jp="/workspace/schematic/rename",Up="/workspace/schematic/set-data",Dp="/workspace/schematic/delete",Mp="/workspace/schematic/copy",Zp=s.z.object({keys:Ce.array()}),Pp=s.z.object({workspace:se,schematics:Yi.array()}),Lp=s.z.object({key:Ce,name:s.z.string()}),Bp=s.z.object({key:Ce,data:s.z.string()}),qp=s.z.object({keys:Ce.array()}),Fp=s.z.object({key:Ce,name:s.z.string(),snapshot:s.z.boolean()}),Yp=s.z.object({schematics:L(vn)}),Vp=s.z.object({schematics:vn.array()}),Wp=s.z.object({schematic:ir}),vr=s.z.object({});let Vi=class{client;constructor(e){this.client=e}async create(e,t){const n=Array.isArray(t),a=await g(this.client,Rp,{workspace:e,schematics:T.toArray(t)},Pp,Vp);return n?a.schematics:a.schematics[0]}async rename(e,t){await g(this.client,jp,{key:e,name:t},Lp,vr)}async setData(e,t){await g(this.client,Up,{key:e,data:JSON.stringify(t)},Bp,vr)}async retrieve(e){const t=Array.isArray(e),n=await g(this.client,xp,{keys:T.toArray(e)},Zp,Yp);return t?n.schematics:n.schematics[0]}async delete(e){await g(this.client,Dp,{keys:T.toArray(e)},qp,vr)}async copy(e,t,n){return(await g(this.client,Mp,{key:e,name:t,snapshot:n},Fp,Wp)).schematic}};const _p=r=>({type:"schematic",key:r}),Hp=Object.freeze(Object.defineProperty({__proto__:null,Client:Vi,keyZ:Ce,newZ:Yi,ontologyID:_p,remoteZ:vn,schematicZ:ir},Symbol.toStringTag,{value:"Module"})),rt=s.z.uuid(),En=s.z.object({key:rt,name:s.z.string(),data:ue.unknownZ.or(s.z.string().transform(he))}),Wi=En.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),On=En.extend({data:s.z.string().transform(he)}),Gp="/workspace/table/retrieve",Jp="/workspace/table/create",Kp="/workspace/table/rename",Xp="/workspace/table/set-data",Qp="/workspace/table/delete",em=s.z.object({keys:rt.array()}),tm=s.z.object({workspace:se,tables:Wi.array()}),rm=s.z.object({key:rt,name:s.z.string()}),nm=s.z.object({key:rt,data:s.z.string()}),sm=s.z.object({keys:rt.array()}),am=s.z.object({tables:On.array()}),im=s.z.object({tables:On.array()}),Er=s.z.object({});let _i=class{client;constructor(e){this.client=e}async create(e,t){const n=Array.isArray(t),a=await g(this.client,Jp,{workspace:e,tables:T.toArray(t)},tm,im);return n?a.tables:a.tables[0]}async rename(e,t){await g(this.client,Kp,{key:e,name:t},rm,Er)}async setData(e,t){await g(this.client,Xp,{key:e,data:JSON.stringify(t)},nm,Er)}async retrieve(e){const t=Array.isArray(e),n=await g(this.client,Gp,{keys:T.toArray(e)},em,am);return t?n.tables:n.tables[0]}async delete(e){await g(this.client,Qp,{keys:T.toArray(e)},sm,Er)}};const om=r=>({type:"table",key:r}),cm=Object.freeze(Object.defineProperty({__proto__:null,Client:_i,keyZ:rt,newZ:Wi,ontologyID:om,remoteZ:On,tableZ:En},Symbol.toStringTag,{value:"Module"})),hs="/workspace/retrieve",lm="/workspace/create",um="/workspace/rename",hm="/workspace/set-layout",dm="/workspace/delete",ds=s.z.object({keys:se.array().optional(),searchTerm:s.z.string().optional(),author:Ee.optional(),offset:s.z.number().optional(),limit:s.z.number().optional()}),fm=s.z.object({workspaces:Pi.array()}),ym=s.z.object({key:se,name:s.z.string()}),gm=s.z.object({key:se,layout:s.z.string()}),pm=s.z.object({keys:se.array()}),fs=s.z.object({workspaces:L(sr)}),mm=s.z.object({workspaces:Li.array()}),Or=s.z.object({}),wm="sy_workspace_set",bm="sy_workspace_delete";class Hi{type="workspace";schematic;linePlot;log;table;client;constructor(e){this.client=e,this.schematic=new Vi(e),this.linePlot=new Bi(e),this.log=new Fi(e),this.table=new _i(e)}async create(e){const t=Array.isArray(e),n=await g(this.client,lm,{workspaces:T.toArray(e)},fm,mm);return t?n.workspaces:n.workspaces[0]}async rename(e,t){await g(this.client,um,{key:e,name:t},ym,Or)}async setLayout(e,t){await g(this.client,hm,{key:e,layout:JSON.stringify(t)},gm,Or)}async retrieve(e){let t;const n=typeof e!="string";typeof e=="string"||Array.isArray(e)?t={keys:T.toArray(e)}:t=e;const a=await g(this.client,hs,t,ds,fs);return n?a.workspaces:a.workspaces[0]}async retrieveByAuthor(e){return(await g(this.client,hs,{author:e},ds,fs)).workspaces}async delete(e){await g(this.client,dm,{keys:T.toArray(e)},pm,Or)}}const Tm=r=>({type:"workspace",key:r}),vm=Object.freeze(Object.defineProperty({__proto__:null,Client:Hi,DELETE_CHANNEL_NAME:bm,SET_CHANNEL_NAME:wm,keyZ:se,newZ:Pi,ontologyID:Tm,remoteZ:Li,workspaceZ:sr},Symbol.toStringTag,{value:"Module"})),Gi=s.z.object({host:s.z.string({error:"Host is required"}).min(1,"Host is required"),port:s.z.number({error:"Port is required"}).or(s.z.string({error:"Port is required"})),username:s.z.string().min(1,"Username is required"),password:s.z.string().min(1,"Password is required"),connectivityPollFrequency:v.z.default(v.seconds(30)),secure:s.z.boolean().optional().default(!1),name:s.z.string().optional(),retry:ha.breakerConfigZ.optional()});class Ji extends hi{createdAt;props;ranges;channels;auth;user;access;connectivity;ontology;workspaces;labels;hardware;control;static connectivity=pt;transport;clientVersion="0.44.1";constructor(e){const t=Gi.parse(e),{host:n,port:a,username:i,password:o,connectivityPollFrequency:c,secure:l,retry:h}=t,d=new np(new ot({host:n,port:Number(a)}),h,l);d.use(Ah);let u;i!=null&&o!=null&&(u=new Tf(d.unary,{username:i,password:o}),d.use(u.middleware()));const N=new un(new Nt(d.unary)),E=new Ha(d.unary,N);super(d.stream,d.unary,N),this.createdAt=O.now(),this.props=t,this.auth=u,this.transport=d,this.channels=new Va(this,N,d.unary,E),this.connectivity=new pt(d.unary,c,this.clientVersion,t.name),this.control=new yi(this),this.ontology=new Ma(d.unary,this);const P=new Mi(this.transport.unary);this.labels=new xi(this.transport.unary),this.ranges=new Ui(this,P,this.transport.unary,N,this.labels,this.ontology),this.access=new La(this.transport.unary),this.user=new Ja(this.transport.unary),this.workspaces=new Hi(this.transport.unary);const k=new vi(this.transport.unary),B=new Ai(this.transport.unary,this,this.ontology,this.ranges),C=new Ei(this.transport.unary,B);this.hardware=new gi(B,C,k)}get key(){return this.createdAt.valueOf().toString()}close(){this.connectivity.stopChecking()}}const Ki={host:"localhost",port:9090,username:"synnax",password:"seldon"},Em=r=>new Ji({...Ki,...r});exports.AuthError=dt;exports.Channel=hn;exports.ContiguityError=zh;exports.DataType=I;exports.Density=W;exports.DisconnectedError=Nh;exports.Frame=Z;exports.MultiSeries=ca;exports.MultipleFoundError=yt;exports.NotFoundError=ft;exports.QueryError=ve;exports.Rate=Rr;exports.RouteError=Br;exports.Series=Y;exports.Synnax=Ji;exports.TEST_CLIENT_PROPS=Ki;exports.TimeRange=z;exports.TimeSpan=v;exports.TimeStamp=O;exports.UnexpectedError=Ye;exports.ValidationError=M;exports.access=wd;exports.channel=Yd;exports.connection=Ef;exports.control=ey;exports.device=my;exports.framer=Hf;exports.group=Fh;exports.hardware=ty;exports.isCalculated=gt;exports.label=bg;exports.linePlot=mp;exports.log=Cp;exports.newTestClient=Em;exports.ontology=rd;exports.policy=md;exports.rack=jy;exports.ranger=tp;exports.schematic=Hp;exports.synnaxPropsZ=Gi;exports.table=cm;exports.task=tg;exports.user=df;exports.workspace=vm;
|