@synnaxlabs/client 0.42.1 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/.vscode/settings.json +2 -2
  3. package/CONTRIBUTING.md +6 -5
  4. package/README.md +7 -8
  5. package/dist/access/payload.d.ts +1 -1
  6. package/dist/access/payload.d.ts.map +1 -1
  7. package/dist/access/policy/payload.d.ts +9 -9
  8. package/dist/access/policy/payload.d.ts.map +1 -1
  9. package/dist/access/policy/retriever.d.ts +3 -3
  10. package/dist/access/policy/retriever.d.ts.map +1 -1
  11. package/dist/auth/auth.d.ts +2 -2
  12. package/dist/auth/auth.d.ts.map +1 -1
  13. package/dist/channel/client.d.ts +1 -0
  14. package/dist/channel/client.d.ts.map +1 -1
  15. package/dist/channel/payload.d.ts +21 -8
  16. package/dist/channel/payload.d.ts.map +1 -1
  17. package/dist/channel/retriever.d.ts +5 -5
  18. package/dist/channel/retriever.d.ts.map +1 -1
  19. package/dist/channel/writer.d.ts +3 -3
  20. package/dist/channel/writer.d.ts.map +1 -1
  21. package/dist/client.cjs +135 -39
  22. package/dist/client.d.ts +8 -8
  23. package/dist/client.d.ts.map +1 -1
  24. package/dist/client.js +28502 -9339
  25. package/dist/connection/checker.d.ts +5 -5
  26. package/dist/connection/checker.d.ts.map +1 -1
  27. package/dist/control/state.d.ts +46 -3
  28. package/dist/control/state.d.ts.map +1 -1
  29. package/dist/framer/adapter.d.ts +2 -2
  30. package/dist/framer/adapter.d.ts.map +1 -1
  31. package/dist/framer/client.d.ts +2 -0
  32. package/dist/framer/client.d.ts.map +1 -1
  33. package/dist/framer/codec.d.ts +3 -3
  34. package/dist/framer/codec.d.ts.map +1 -1
  35. package/dist/framer/deleter.d.ts +8 -8
  36. package/dist/framer/deleter.d.ts.map +1 -1
  37. package/dist/framer/frame.d.ts +17 -17
  38. package/dist/framer/frame.d.ts.map +1 -1
  39. package/dist/framer/streamProxy.d.ts +3 -3
  40. package/dist/framer/streamProxy.d.ts.map +1 -1
  41. package/dist/framer/streamer.d.ts +103 -22
  42. package/dist/framer/streamer.d.ts.map +1 -1
  43. package/dist/framer/writer.d.ts +25 -25
  44. package/dist/framer/writer.d.ts.map +1 -1
  45. package/dist/hardware/device/client.d.ts +3 -3
  46. package/dist/hardware/device/client.d.ts.map +1 -1
  47. package/dist/hardware/device/payload.d.ts +65 -18
  48. package/dist/hardware/device/payload.d.ts.map +1 -1
  49. package/dist/hardware/rack/client.d.ts.map +1 -1
  50. package/dist/hardware/rack/payload.d.ts +87 -30
  51. package/dist/hardware/rack/payload.d.ts.map +1 -1
  52. package/dist/hardware/task/client.d.ts +3 -3
  53. package/dist/hardware/task/client.d.ts.map +1 -1
  54. package/dist/hardware/task/payload.d.ts +14 -15
  55. package/dist/hardware/task/payload.d.ts.map +1 -1
  56. package/dist/label/payload.d.ts +2 -2
  57. package/dist/label/payload.d.ts.map +1 -1
  58. package/dist/label/writer.d.ts +4 -4
  59. package/dist/label/writer.d.ts.map +1 -1
  60. package/dist/ontology/client.d.ts +3 -3
  61. package/dist/ontology/client.d.ts.map +1 -1
  62. package/dist/ontology/group/payload.d.ts +2 -2
  63. package/dist/ontology/group/payload.d.ts.map +1 -1
  64. package/dist/ontology/payload.d.ts +25 -25
  65. package/dist/ontology/payload.d.ts.map +1 -1
  66. package/dist/ranger/client.d.ts +8 -8
  67. package/dist/ranger/client.d.ts.map +1 -1
  68. package/dist/ranger/kv.d.ts +6 -6
  69. package/dist/ranger/kv.d.ts.map +1 -1
  70. package/dist/ranger/payload.d.ts +15 -15
  71. package/dist/ranger/payload.d.ts.map +1 -1
  72. package/dist/ranger/writer.d.ts +10 -10
  73. package/dist/ranger/writer.d.ts.map +1 -1
  74. package/dist/testutil/{indexedPair.d.ts → channels.d.ts} +1 -1
  75. package/dist/testutil/channels.d.ts.map +1 -0
  76. package/dist/user/payload.d.ts +3 -3
  77. package/dist/user/payload.d.ts.map +1 -1
  78. package/dist/user/retriever.d.ts +2 -2
  79. package/dist/user/retriever.d.ts.map +1 -1
  80. package/dist/util/retrieve.d.ts +6 -6
  81. package/dist/util/retrieve.d.ts.map +1 -1
  82. package/dist/util/zod.d.ts +2 -2
  83. package/dist/util/zod.d.ts.map +1 -1
  84. package/dist/workspace/client.d.ts.map +1 -1
  85. package/dist/workspace/lineplot/client.d.ts.map +1 -1
  86. package/dist/workspace/lineplot/lineplot.spec.d.ts +2 -0
  87. package/dist/workspace/lineplot/lineplot.spec.d.ts.map +1 -0
  88. package/dist/workspace/lineplot/payload.d.ts +5 -5
  89. package/dist/workspace/lineplot/payload.d.ts.map +1 -1
  90. package/dist/workspace/log/client.d.ts.map +1 -1
  91. package/dist/workspace/log/payload.d.ts +5 -5
  92. package/dist/workspace/log/payload.d.ts.map +1 -1
  93. package/dist/workspace/payload.d.ts +6 -6
  94. package/dist/workspace/payload.d.ts.map +1 -1
  95. package/dist/workspace/schematic/client.d.ts.map +1 -1
  96. package/dist/workspace/schematic/payload.d.ts +7 -7
  97. package/dist/workspace/schematic/payload.d.ts.map +1 -1
  98. package/dist/workspace/table/client.d.ts.map +1 -1
  99. package/dist/workspace/table/payload.d.ts +6 -6
  100. package/dist/workspace/table/payload.d.ts.map +1 -1
  101. package/package.json +12 -13
  102. package/src/access/payload.ts +1 -1
  103. package/src/access/policy/client.ts +3 -3
  104. package/src/access/policy/payload.ts +1 -1
  105. package/src/access/policy/retriever.ts +1 -1
  106. package/src/access/policy/writer.ts +7 -7
  107. package/src/auth/auth.ts +1 -1
  108. package/src/channel/client.ts +6 -4
  109. package/src/channel/payload.ts +10 -18
  110. package/src/channel/retriever.ts +2 -2
  111. package/src/channel/writer.ts +11 -2
  112. package/src/client.ts +3 -3
  113. package/src/connection/checker.ts +1 -1
  114. package/src/connection/connection.spec.ts +1 -1
  115. package/src/control/client.ts +1 -1
  116. package/src/control/state.ts +4 -5
  117. package/src/errors.spec.ts +2 -3
  118. package/src/errors.ts +2 -2
  119. package/src/framer/adapter.ts +2 -2
  120. package/src/framer/client.ts +4 -3
  121. package/src/framer/codec.spec.ts +2 -2
  122. package/src/framer/codec.ts +5 -9
  123. package/src/framer/deleter.spec.ts +1 -1
  124. package/src/framer/deleter.ts +1 -1
  125. package/src/framer/frame.ts +15 -15
  126. package/src/framer/iterator.spec.ts +1 -1
  127. package/src/framer/iterator.ts +1 -1
  128. package/src/framer/streamProxy.ts +4 -4
  129. package/src/framer/streamer.spec.ts +420 -215
  130. package/src/framer/streamer.ts +119 -21
  131. package/src/framer/writer.spec.ts +1 -1
  132. package/src/framer/writer.ts +15 -8
  133. package/src/hardware/device/client.ts +5 -5
  134. package/src/hardware/device/device.spec.ts +28 -30
  135. package/src/hardware/device/payload.ts +5 -5
  136. package/src/hardware/rack/client.ts +4 -4
  137. package/src/hardware/rack/payload.ts +6 -6
  138. package/src/hardware/rack/rack.spec.ts +1 -1
  139. package/src/hardware/task/client.ts +21 -19
  140. package/src/hardware/task/payload.ts +8 -6
  141. package/src/label/payload.ts +1 -1
  142. package/src/label/retriever.ts +3 -3
  143. package/src/label/writer.ts +4 -4
  144. package/src/ontology/client.ts +4 -4
  145. package/src/ontology/group/payload.ts +3 -3
  146. package/src/ontology/group/writer.ts +1 -1
  147. package/src/ontology/payload.ts +2 -2
  148. package/src/ontology/writer.ts +1 -1
  149. package/src/ranger/alias.ts +1 -1
  150. package/src/ranger/client.ts +6 -4
  151. package/src/ranger/kv.ts +4 -4
  152. package/src/ranger/payload.ts +3 -3
  153. package/src/ranger/writer.ts +1 -1
  154. package/src/user/client.ts +3 -3
  155. package/src/user/payload.ts +1 -1
  156. package/src/user/retriever.ts +1 -1
  157. package/src/user/writer.ts +4 -4
  158. package/src/util/retrieve.spec.ts +7 -4
  159. package/src/util/retrieve.ts +10 -10
  160. package/src/util/zod.ts +3 -3
  161. package/src/workspace/client.ts +5 -5
  162. package/src/workspace/lineplot/client.ts +5 -5
  163. package/src/workspace/lineplot/{linePlot.spec.ts → lineplot.spec.ts} +2 -2
  164. package/src/workspace/lineplot/payload.ts +1 -1
  165. package/src/workspace/log/client.ts +5 -5
  166. package/src/workspace/log/log.spec.ts +2 -2
  167. package/src/workspace/log/payload.ts +1 -1
  168. package/src/workspace/payload.ts +1 -1
  169. package/src/workspace/schematic/client.ts +5 -5
  170. package/src/workspace/schematic/payload.ts +1 -1
  171. package/src/workspace/schematic/schematic.spec.ts +3 -3
  172. package/src/workspace/table/client.ts +5 -5
  173. package/src/workspace/table/payload.ts +1 -1
  174. package/src/workspace/table/table.spec.ts +2 -2
  175. package/src/workspace/workspace.spec.ts +2 -2
  176. package/tsconfig.json +3 -5
  177. package/dist/testutil/indexedPair.d.ts.map +0 -1
  178. package/dist/workspace/lineplot/linePlot.spec.d.ts +0 -2
  179. package/dist/workspace/lineplot/linePlot.spec.d.ts.map +0 -1
  180. /package/src/testutil/{indexedPair.ts → channels.ts} +0 -0
package/dist/client.cjs CHANGED
@@ -1,56 +1,152 @@
1
- "use strict";var ul=Object.defineProperty;var dl=(r,e,t)=>e in r?ul(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var l=(r,e,t)=>dl(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("zod"),b=r=>Array.isArray(r)?r:[r],Es="policy",zs="allow_all";var fl=Object.defineProperty,yl=(r,e,t)=>e in r?fl(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,G=(r,e,t)=>yl(r,typeof e!="symbol"?e+"":e,t);const gl=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)},Na=r=>{const e=(t,n=Yn)=>{if(typeof t=="string")return r(t);if(Array.isArray(t))return t.map(o=>e(o,n));if(!wn(t))return t;n=wl(n);const s={},a=t;return Object.keys(a).forEach(o=>{let c=a[o];const h=r(o);n.recursive&&(wn(c)?wi(c,n.keepTypesOnRecursion)||(c=e(c,n)):n.recursiveInArray&&pi(c)&&(c=[...c].map(d=>{let f=d;return wn(d)?wi(f,n.keepTypesOnRecursion)||(f=e(d,n)):pi(d)&&(f=e({key:d},n).key),f}))),s[h]=c}),s};return e},Ns=Na(gl),pl=r=>r.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`),Ia=Na(pl),Yn={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},wl=(r=Yn)=>(r.recursive==null?r=Yn:r.recursiveInArray??(r.recursiveInArray=!1),r),pi=r=>r!=null&&Array.isArray(r),wn=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),wi=(r,e)=>(e||[]).some(t=>r instanceof t),Is=r=>r!=null&&typeof r=="object"&&!Array.isArray(r);var ml=Object.defineProperty,bl=(r,e,t)=>e in r?ml(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,yt=(r,e,t)=>bl(r,typeof e!="symbol"?e+"":e,t);function vl(r){const e=r.length;let t=0,n=0;for(;n<e;){let s=r.charCodeAt(n++);if((s&4294967168)===0){t++;continue}else if((s&4294965248)===0)t+=2;else{if(s>=55296&&s<=56319&&n<e){const a=r.charCodeAt(n);(a&64512)===56320&&(++n,s=((s&1023)<<10)+(a&1023)+65536)}(s&4294901760)===0?t+=3:t+=4}}return t}function Tl(r,e,t){const n=r.length;let s=t,a=0;for(;a<n;){let o=r.charCodeAt(a++);if((o&4294967168)===0){e[s++]=o;continue}else if((o&4294965248)===0)e[s++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&a<n){const c=r.charCodeAt(a);(c&64512)===56320&&(++a,o=((o&1023)<<10)+(c&1023)+65536)}(o&4294901760)===0?(e[s++]=o>>12&15|224,e[s++]=o>>6&63|128):(e[s++]=o>>18&7|240,e[s++]=o>>12&63|128,e[s++]=o>>6&63|128)}e[s++]=o&63|128}}const Ol=new TextEncoder,Sl=50;function El(r,e,t){Ol.encodeInto(r,e.subarray(t))}function zl(r,e,t){r.length>Sl?El(r,e,t):Tl(r,e,t)}const Nl=4096;function $a(r,e,t){let n=e;const s=n+t,a=[];let o="";for(;n<s;){const c=r[n++];if((c&128)===0)a.push(c);else if((c&224)===192){const h=r[n++]&63;a.push((c&31)<<6|h)}else if((c&240)===224){const h=r[n++]&63,d=r[n++]&63;a.push((c&31)<<12|h<<6|d)}else if((c&248)===240){const h=r[n++]&63,d=r[n++]&63,f=r[n++]&63;let u=(c&7)<<18|h<<12|d<<6|f;u>65535&&(u-=65536,a.push(u>>>10&1023|55296),u=56320|u&1023),a.push(u)}else a.push(c);a.length>=Nl&&(o+=String.fromCharCode(...a),a.length=0)}return a.length>0&&(o+=String.fromCharCode(...a)),o}const Il=new TextDecoder,$l=200;function xl(r,e,t){const n=r.subarray(e,e+t);return Il.decode(n)}function kl(r,e,t){return t>$l?xl(r,e,t):$a(r,e,t)}let Er=class{constructor(e,t){this.type=e,this.data=t}},we=class Wn extends Error{constructor(e){super(e);const t=Object.create(Wn.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Wn.name})}};const At=4294967295;function Al(r,e,t){const n=t/4294967296,s=t;r.setUint32(e,n),r.setUint32(e+4,s)}function xa(r,e,t){const n=Math.floor(t/4294967296),s=t;r.setUint32(e,n),r.setUint32(e+4,s)}function ka(r,e){const t=r.getInt32(e),n=r.getUint32(e+4);return t*4294967296+n}function Ul(r,e){const t=r.getUint32(e),n=r.getUint32(e+4);return t*4294967296+n}const Cl=-1,Rl=4294967296-1,Bl=17179869184-1;function Pl({sec:r,nsec:e}){if(r>=0&&e>=0&&r<=Bl)if(e===0&&r<=Rl){const t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,r),t}else{const t=r/4294967296,n=r&4294967295,s=new Uint8Array(8),a=new DataView(s.buffer);return a.setUint32(0,e<<2|t&3),a.setUint32(4,n),s}else{const t=new Uint8Array(12),n=new DataView(t.buffer);return n.setUint32(0,e),xa(n,4,r),t}}function Dl(r){const e=r.getTime(),t=Math.floor(e/1e3),n=(e-t*1e3)*1e6,s=Math.floor(n/1e9);return{sec:t+s,nsec:n-s*1e9}}function Ml(r){if(r instanceof Date){const e=Dl(r);return Pl(e)}else return null}function jl(r){const e=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(r.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const t=e.getUint32(0),n=e.getUint32(4),s=(t&3)*4294967296+n,a=t>>>2;return{sec:s,nsec:a}}case 12:{const t=ka(e,4),n=e.getUint32(0);return{sec:t,nsec:n}}default:throw new we(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Ll(r){const e=jl(r);return new Date(e.sec*1e3+e.nsec/1e6)}const _l={type:Cl,encode:Ml,decode:Ll};let tr=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(_l)}register({type:e,encode:t,decode:n}){if(e>=0)this.encoders[e]=t,this.decoders[e]=n;else{const s=-1-e;this.builtInEncoders[s]=t,this.builtInDecoders[s]=n}}tryToEncode(e,t){for(let n=0;n<this.builtInEncoders.length;n++){const s=this.builtInEncoders[n];if(s!=null){const a=s(e,t);if(a!=null){const o=-1-n;return new Er(o,a)}}}for(let n=0;n<this.encoders.length;n++){const s=this.encoders[n];if(s!=null){const a=s(e,t);if(a!=null){const o=n;return new Er(o,a)}}}return e instanceof Er?e:null}decode(e,t,n){const s=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return s?s(e,t,n):new Er(t,e)}};tr.defaultCodec=new tr;function Zl(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function Vn(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):Zl(r)?new Uint8Array(r):Uint8Array.from(r)}const ql=100,Fl=2048;let Yl=class Aa{constructor(e){this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??tr.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.maxDepth=(e==null?void 0:e.maxDepth)??ql,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??Fl,this.sortKeys=(e==null?void 0:e.sortKeys)??!1,this.forceFloat32=(e==null?void 0:e.forceFloat32)??!1,this.ignoreUndefined=(e==null?void 0:e.ignoreUndefined)??!1,this.forceIntegerToFloat=(e==null?void 0:e.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new Aa({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,t){if(t>this.maxDepth)throw new Error(`Too deep objects in depth ${t}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,t)}ensureBufferSizeToWrite(e){const t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(t*2)}resizeBuffer(e){const t=new ArrayBuffer(e),n=new Uint8Array(t),s=new DataView(t);n.set(this.bytes),this.view=s,this.bytes=n}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){const t=vl(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),zl(e,this.bytes,this.pos),this.pos+=t}encodeObject(e,t){const n=this.extensionCodec.tryToEncode(e,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,t);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){const t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw new Error(`Too large binary: ${t}`);const n=Vn(e);this.writeU8a(n)}encodeArray(e,t){const n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error(`Too large array: ${n}`);for(const s of e)this.doEncode(s,t+1)}countWithoutUndefined(e,t){let n=0;for(const s of t)e[s]!==void 0&&n++;return n}encodeMap(e,t){const n=Object.keys(e);this.sortKeys&&n.sort();const s=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(s<16)this.writeU8(128+s);else if(s<65536)this.writeU8(222),this.writeU16(s);else if(s<4294967296)this.writeU8(223),this.writeU32(s);else throw new Error(`Too large map object: ${s}`);for(const a of n){const o=e[a];this.ignoreUndefined&&o===void 0||(this.encodeString(a),this.doEncode(o,t+1))}}encodeExtension(e){if(typeof e.data=="function"){const n=e.data(this.pos+6),s=n.length;if(s>=4294967296)throw new Error(`Too large extension object: ${s}`);this.writeU8(201),this.writeU32(s),this.writeI8(e.type),this.writeU8a(n);return}const t=e.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw new Error(`Too large extension object: ${t}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),Al(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),xa(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}};function Bt(r,e){return new Yl(e).encodeSharedRef(r)}function mn(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const Wl=16,Vl=16;class Gl{constructor(e=Wl,t=Vl){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=t,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,t,n){const s=this.caches[n-1];e:for(const a of s){const o=a.bytes;for(let c=0;c<n;c++)if(o[c]!==e[t+c])continue e;return a.str}return null}store(e,t){const n=this.caches[e.length-1],s={bytes:e,str:t};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=s:n.push(s)}decode(e,t,n){const s=this.find(e,t,n);if(s!=null)return this.hit++,s;this.miss++;const a=$a(e,t,n),o=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(o,a),a}}const Gn="array",Ht="map_key",Ua="map_value",Hl=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new we("The type of key must be string or number but "+typeof r)};class Kl{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const t=this.getUninitializedStateFromPool();t.type=Gn,t.position=0,t.size=e,t.array=new Array(e)}pushMapState(e){const t=this.getUninitializedStateFromPool();t.type=Ht,t.readCount=0,t.size=e,t.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===Gn){const t=e;t.size=0,t.array=void 0,t.position=0,t.type=void 0}if(e.type===Ht||e.type===Ua){const t=e;t.size=0,t.map=void 0,t.readCount=0,t.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const Ut=-1,$s=new DataView(new ArrayBuffer(0)),Jl=new Uint8Array($s.buffer);try{$s.getInt8(0)}catch(r){if(!(r instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const mi=new RangeError("Insufficient data"),Xl=new Gl;let Ql=class Ca{constructor(e){this.totalPos=0,this.pos=0,this.view=$s,this.bytes=Jl,this.headByte=Ut,this.stack=new Kl,this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??tr.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.rawStrings=(e==null?void 0:e.rawStrings)??!1,this.maxStrLength=(e==null?void 0:e.maxStrLength)??At,this.maxBinLength=(e==null?void 0:e.maxBinLength)??At,this.maxArrayLength=(e==null?void 0:e.maxArrayLength)??At,this.maxMapLength=(e==null?void 0:e.maxMapLength)??At,this.maxExtLength=(e==null?void 0:e.maxExtLength)??At,this.keyDecoder=(e==null?void 0:e.keyDecoder)!==void 0?e.keyDecoder:Xl,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??Hl}clone(){return new Ca({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=Ut,this.stack.reset()}setBuffer(e){const t=Vn(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===Ut&&!this.hasRemaining(1))this.setBuffer(e);else{const t=this.bytes.subarray(this.pos),n=Vn(e),s=new Uint8Array(t.length+n.length);s.set(t),s.set(n,t.length),this.setBuffer(s)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:t,pos:n}=this;return new RangeError(`Extra ${t.byteLength-n} of ${t.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let t=!1,n;for await(const c of e){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{n=this.doDecodeSync(),t=!0}catch(h){if(!(h instanceof RangeError))throw h}this.totalPos+=this.pos}if(t){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:s,pos:a,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${mn(s)} at ${o} (${a} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,t){if(this.entered){yield*this.clone().decodeMultiAsync(e,t);return}try{this.entered=!0;let n=t,s=-1;for await(const a of e){if(t&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a),n&&(s=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let t;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){const s=e-128;if(s!==0){this.pushMapState(s),this.complete();continue e}else t={}}else if(e<160){const s=e-144;if(s!==0){this.pushArrayState(s),this.complete();continue e}else t=[]}else{const s=e-160;t=this.decodeString(s,0)}else if(e===192)t=null;else if(e===194)t=!1;else if(e===195)t=!0;else if(e===202)t=this.readF32();else if(e===203)t=this.readF64();else if(e===204)t=this.readU8();else if(e===205)t=this.readU16();else if(e===206)t=this.readU32();else if(e===207)this.useBigInt64?t=this.readU64AsBigInt():t=this.readU64();else if(e===208)t=this.readI8();else if(e===209)t=this.readI16();else if(e===210)t=this.readI32();else if(e===211)this.useBigInt64?t=this.readI64AsBigInt():t=this.readI64();else if(e===217){const s=this.lookU8();t=this.decodeString(s,1)}else if(e===218){const s=this.lookU16();t=this.decodeString(s,2)}else if(e===219){const s=this.lookU32();t=this.decodeString(s,4)}else if(e===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue e}else t=[]}else if(e===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue e}else t=[]}else if(e===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue e}else t={}}else if(e===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue e}else t={}}else if(e===196){const s=this.lookU8();t=this.decodeBinary(s,1)}else if(e===197){const s=this.lookU16();t=this.decodeBinary(s,2)}else if(e===198){const s=this.lookU32();t=this.decodeBinary(s,4)}else if(e===212)t=this.decodeExtension(1,0);else if(e===213)t=this.decodeExtension(2,0);else if(e===214)t=this.decodeExtension(4,0);else if(e===215)t=this.decodeExtension(8,0);else if(e===216)t=this.decodeExtension(16,0);else if(e===199){const s=this.lookU8();t=this.decodeExtension(s,1)}else if(e===200){const s=this.lookU16();t=this.decodeExtension(s,2)}else if(e===201){const s=this.lookU32();t=this.decodeExtension(s,4)}else throw new we(`Unrecognized type byte: ${mn(e)}`);this.complete();const n=this.stack;for(;n.length>0;){const s=n.top();if(s.type===Gn)if(s.array[s.position]=t,s.position++,s.position===s.size)t=s.array,n.release(s);else continue e;else if(s.type===Ht){if(t==="__proto__")throw new we("The key __proto__ is not allowed");s.key=this.mapKeyConverter(t),s.type=Ua;continue e}else if(s.map[s.key]=t,s.readCount++,s.readCount===s.size)t=s.map,n.release(s);else{s.key=null,s.type=Ht;continue e}}return t}}readHeadByte(){return this.headByte===Ut&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Ut}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new we(`Unrecognized array type byte: ${mn(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new we(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new we(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,t):this.decodeBinary(e,t)}decodeUtf8String(e,t){var n;if(e>this.maxStrLength)throw new we(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw mi;const s=this.pos+t;let a;return this.stateIsMapKey()&&(n=this.keyDecoder)!=null&&n.canBeCached(e)?a=this.keyDecoder.decode(this.bytes,s,e):a=kl(this.bytes,s,e),this.pos+=t+e,a}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Ht:!1}decodeBinary(e,t){if(e>this.maxBinLength)throw new we(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw mi;const n=this.pos+t,s=this.bytes.subarray(n,n+e);return this.pos+=t+e,s}decodeExtension(e,t){if(e>this.maxExtLength)throw new we(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+t),s=this.decodeBinary(e,t+1);return this.extensionCodec.decode(s,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=Ul(this.view,this.pos);return this.pos+=8,e}readI64(){const e=ka(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}};function Ra(r,e){return new Ql(e).decode(r)}let eh=class{constructor(){yt(this,"contentType","application/json"),yt(this,"decoder"),yt(this,"encoder"),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=Ns(t);return e!=null?e.parse(n):n}encodeString(r){const e=Ia(r);return JSON.stringify(e,(t,n)=>ArrayBuffer.isView(n)?Array.from(n):Is(n)&&"encode_value"in n?typeof n.value=="bigint"?n.value.toString():n.value:typeof n=="bigint"?n.toString():n)}static registerCustomType(){}},th=class{constructor(){yt(this,"contentType","text/csv")}encode(r){const e=this.encodeString(r);return new TextEncoder().encode(e)}decode(r,e){const t=new TextDecoder().decode(r);return this.decodeString(t,e)}encodeString(r){if(!Array.isArray(r)||r.length===0||!Is(r[0]))throw new Error("Payload must be an array of objects");const e=Object.keys(r[0]),t=[e.join(",")];return r.forEach(n=>{const s=e.map(a=>JSON.stringify(n[a]??""));t.push(s.join(","))}),t.join(`
2
- `)}decodeString(r,e){const[t,...n]=r.trim().split(`
3
- `).map(o=>o.trim());if(t.length===0)return e!=null?e.parse({}):{};const s=t.split(",").map(o=>o.trim()),a={};return s.forEach(o=>{a[o]=[]}),n.forEach(o=>{const c=o.split(",").map(h=>h.trim());s.forEach((h,d)=>{const f=this.parseValue(c[d]);f!=null&&a[h].push(f)})}),e!=null?e.parse(a):a}parseValue(r){if(r==null||r.length===0)return null;const e=Number(r);return isNaN(e)?r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):r:e}static registerCustomType(){}},rh=class{constructor(){yt(this,"contentType","text/plain")}encode(r){return new TextEncoder().encode(r)}decode(r,e){const t=new TextDecoder().decode(r);return e!=null?e.parse(t):t}};const De=new tr;De.register({type:0,encode:r=>{if(ArrayBuffer.isView(r)){const e=Array.from(r);return Bt(e,{extensionCodec:De})}return Is(r)&&"encode_value"in r?typeof r.value=="bigint"?Bt(r.value.toString(),{extensionCodec:De}):Bt(r.value,{extensionCodec:De}):typeof r=="bigint"?Bt(r.toString(),{extensionCodec:De}):null},decode:r=>Ra(r,{extensionCodec:De})});let nh=class{constructor(){yt(this,"contentType","application/msgpack")}encode(r){const e=Ia(r);return Bt(e,{extensionCodec:De}).slice()}decode(r,e){const t=Ra(r,{extensionCodec:De}),n=Ns(t);return e!=null?e.parse(n):n}static registerCustomType(){}};const Rr=new eh;new th;new rh;new nh;const sh=r=>r!=null&&typeof r=="object"&&"toString"in r,ih=(r,e=!1)=>{const t=sh(r)?"stringer":typeof r;let n;switch(t){case"string":n=(s,a)=>s.localeCompare(a);break;case"stringer":n=(s,a)=>s.toString().localeCompare(a.toString());break;case"number":n=(s,a)=>Number(s)-Number(a);break;case"bigint":n=(s,a)=>BigInt(s)-BigInt(a)>0n?1:-1;break;case"boolean":n=(s,a)=>Number(s)-Number(a);break;case"undefined":n=()=>0;break;default:return console.warn(`sortFunc: unknown type ${t}`),()=>-1}return e?ah(n):n},ah=r=>(e,t)=>r(t,e),Vr=i.z.tuple([i.z.number(),i.z.number()]);i.z.tuple([i.z.bigint(),i.z.bigint()]);const Ba=i.z.object({width:i.z.number(),height:i.z.number()}),oh=i.z.object({signedWidth:i.z.number(),signedHeight:i.z.number()}),ch=["width","height"];i.z.enum(ch);const lh=["start","center","end"],hh=["signedWidth","signedHeight"];i.z.enum(hh);const jr=i.z.object({x:i.z.number(),y:i.z.number()}),uh=i.z.object({clientX:i.z.number(),clientY:i.z.number()}),dh=["x","y"],Pa=i.z.enum(dh),Da=["top","right","bottom","left"];i.z.enum(Da);const fh=["left","right"],Ma=i.z.enum(fh),yh=["top","bottom"],ja=i.z.enum(yh),La=["center"],bi=i.z.enum(La),gh=[...Da,...La],_a=i.z.enum(gh);i.z.enum(lh);const ph=["first","last"];i.z.enum(ph);const wh=i.z.object({lower:i.z.number(),upper:i.z.number()}),mh=i.z.object({lower:i.z.bigint(),upper:i.z.bigint()});i.z.union([wh,Vr]);i.z.union([mh,Vr]);i.z.enum([...Pa.options,..._a.options]);i.z.union([Pa,_a,i.z.instanceof(String)]);const bh=r=>typeof r=="bigint"||r instanceof BigInt,it=(r,e)=>bh(r)?r.valueOf()*BigInt(e.valueOf()):r.valueOf()*Number(e.valueOf()),Ge=(r,e)=>{const t={};if(typeof r=="number"||typeof r=="bigint")e!=null?(t.lower=r,t.upper=e):(t.lower=typeof r=="bigint"?0n:0,t.upper=r);else if(Array.isArray(r)){if(r.length!==2)throw new Error("bounds: expected array of length 2");[t.lower,t.upper]=r}else return vi(r);return vi(t)},vi=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r,Ti=(r,e)=>{const t=Ge(r);return e<t.lower?t.lower:e>=t.upper?t.upper-(typeof t.upper=="number"?1:1n):e};i.z.object({x:Ma.or(bi),y:ja.or(bi)});const vh=i.z.object({x:Ma,y:ja}),Th=Object.freeze({x:"left",y:"top"}),Oh=(r,e)=>r.x===e.x&&r.y===e.y,Oi=i.z.union([i.z.number(),jr,Vr,Ba,oh,uh]),Sh=(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}},Si=Object.freeze({x:0,y:0}),zr=i.z.union([i.z.number(),i.z.string()]);i.z.object({top:zr,left:zr,width:zr,height:zr});i.z.object({left:i.z.number(),top:i.z.number(),right:i.z.number(),bottom:i.z.number()});i.z.object({one:jr,two:jr,root:vh});const xs=(r,e,t=0,n=0,s)=>{const a={one:{...Si},two:{...Si},root:s??Th};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return a.one={x:r,y:e},a.two={x:a.one.x+t,y:a.one.y+n},a}return"one"in r&&"two"in r&&"root"in r?{...r,root:s??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(a.one={x:r.left,y:r.top},a.two={x:r.right,y:r.bottom},a):(a.one=r,e==null?a.two={x:a.one.x+t,y:a.one.y+n}:typeof e=="number"?a.two={x:a.one.x+e,y:a.one.y+t}:"width"in e?a.two={x:a.one.x+e.width,y:a.one.y+e.height}:"signedWidth"in e?a.two={x:a.one.x+e.signedWidth,y:a.one.y+e.signedHeight}:a.two=e,a))},bn=r=>{const e=xs(r);return{lower:e.one.x,upper:e.two.x}},vn=r=>{const e=xs(r);return{lower:e.one.y,upper:e.two.y}},Eh=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,zh=i.z.object({signedWidth:i.z.number(),signedHeight:i.z.number()});i.z.union([Ba,zh,jr,Vr]);var Nh=Object.defineProperty,Ih=(r,e,t)=>e in r?Nh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$e=(r,e,t)=>Ih(r,typeof e!="symbol"?e+"":e,t);const $h=(r,e,t)=>e!==void 0&&r<e?e:t!==void 0&&r>t?t:r;i.z.object({offset:Oi,scale:Oi});i.z.object({offset:i.z.number(),scale:i.z.number()});const xh=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],kh=r=>(e,t,n,s)=>[e,s?n/r:n*r],Ah=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:o,upper:c}=r,h=a-s,d=c-o;if(t==="dimension")return[r,n*(d/h)];const f=(n-s)*(d/h)+o;return[r,f]},Uh=r=>(e,t,n)=>[r,n],Ch=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:s}=r;return[r,s-(t-n)]},Rh=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=$h(n,s,a),[e,n]},Hn=class Pt{constructor(){$e(this,"ops",[]),$e(this,"currBounds",null),$e(this,"currType",null),$e(this,"reversed",!1),this.ops=[]}static translate(e){return new Pt().translate(e)}static magnify(e){return new Pt().magnify(e)}static scale(e,t){return new Pt().scale(e,t)}translate(e){const t=this.new(),n=xh(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=kh(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=Ge(e,t),s=this.new(),a=Ah(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=Ge(e,t),s=this.new(),a=Rh(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=Ge(e,t),s=this.new(),a=Uh(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=Ch();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 Pt;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,s],a)=>a(n,e,s,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,s)=>{if(n.type==="scale"||t.some(([o,c])=>s>=o&&s<=c))return;const a=e.ops.findIndex((o,c)=>o.type==="scale"&&c>s);a!==-1&&t.push([s,a])}),t.forEach(([n,s])=>{const a=e.ops.slice(n,s);a.unshift(e.ops[s]),e.ops.splice(n,s-n+1,...a)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};$e(Hn,"IDENTITY",new Hn);let Ei=Hn;const zi=class Ne{constructor(e=new Ei,t=new Ei,n=null){$e(this,"x"),$e(this,"y"),$e(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new Ne().translate(e,t)}static translateX(e){return new Ne().translateX(e)}static translateY(e){return new Ne().translateY(e)}static clamp(e){return new Ne().clamp(e)}static magnify(e){return new Ne().magnify(e)}static scale(e){return new Ne().scale(e)}static reBound(e){return new Ne().reBound(e)}translate(e,t){const n=Sh(e,t),s=this.copy();return s.x=this.x.translate(n.x),s.y=this.y.translate(n.y),s}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(Eh(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Oh(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(bn(e)),t.y=t.y.scale(vn(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(bn(e)),t.y=this.y.reBound(vn(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(bn(e)),t.y=this.y.clamp(vn(e)),t}copy(){const e=new Ne;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 xs(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})}}};$e(zi,"IDENTITY",new zi);var Bh=Object.defineProperty,Ph=(r,e,t)=>e in r?Bh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e,t)=>Ph(r,typeof e!="symbol"?e+"":e,t);let Dh=(r,e=21)=>(t=e)=>{let n="",s=t|0;for(;s--;)n+=r[Math.random()*r.length|0];return n};const Mh="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",jh=Dh(Mh,11),Lh=()=>jh(),_h=i.z.enum(["static","dynamic"]),Za=(r,e)=>{const t=new M(e);if(![k.DAY,k.HOUR,k.MINUTE,k.SECOND,k.MILLISECOND,k.MICROSECOND,k.NANOSECOND].some(s=>s.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 M?new M(n):new k(n)},C=class v{constructor(e,t="UTC"){if(g(this,"value"),g(this,"encodeValue",!0),e==null)this.value=v.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*v.MILLISECOND.valueOf();else if(typeof e=="string")this.value=v.parseDateTimeString(e,t).valueOf();else if(Array.isArray(e))this.value=v.parseDate(e);else{let n=BigInt(0);e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=v.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=v.MAX:e=v.MIN)),this.value=BigInt(e.valueOf())+n}}static parseDate([e=1970,t=1,n=1]){const s=new Date(e,t-1,n,0,0,0,0);return new v(BigInt(s.getTime())*v.MILLISECOND.valueOf()).truncate(v.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[n,s,a]=e.split(":");let o="00",c="00";a!=null&&([o,c]=a.split("."));let h=v.hours(parseInt(n??"00")).add(v.minutes(parseInt(s??"00"))).add(v.seconds(parseInt(o??"00"))).add(v.milliseconds(parseInt(c??"00")));return t==="local"&&(h=h.add(v.utcOffset)),h.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return v.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new v(BigInt(n.getTime())*v.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(v.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 k(BigInt(new Date().getTimezoneOffset())*v.MINUTE.valueOf())}static since(e){return new v().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new v(e).valueOf()}span(e){return this.range(e).span}range(e){return new Kt(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 v(e).valueOf()}afterEq(e){return this.valueOf()>=new v(e).valueOf()}before(e){return this.valueOf()<new v(e).valueOf()}beforeEq(e){return this.valueOf()<=new v(e).valueOf()}add(e){return new v(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new v(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(k.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(k.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(k.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(k.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(v.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(v.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getFullYear()}setYear(e){const t=this.date();return t.setFullYear(e),new v(t)}get month(){return this.date().getUTCMonth()}setMonth(e){const t=this.date();return t.setUTCMonth(e),new v(t)}get day(){return this.date().getUTCDate()}setDay(e){const t=this.date();return t.setUTCDate(e),new v(t)}get hour(){return this.date().getUTCHours()}setHour(e){const t=this.date();return t.setUTCHours(e),new v(t,"UTC")}get minute(){return this.date().getMinutes()}setMinute(e){const t=this.date();return t.setUTCMinutes(e),new v(t)}get second(){return this.date().getSeconds()}setSecond(e){const t=this.date();return t.setUTCSeconds(e),new v(t)}get millisecond(){return this.date().getMilliseconds()}setMillisecond(e){const t=this.date();return t.setMilliseconds(e),new v(t)}toString(){return this.date().toISOString()}remainder(e){return Za(this,e)}get isToday(){return this.truncate(k.DAY).equals(v.now().truncate(k.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new v(new Date)}static max(...e){let t=v.MIN;for(const n of e){const s=new v(n);s.after(t)&&(t=s)}return t}static min(...e){let t=v.MAX;for(const n of e){const s=new v(n);s.before(t)&&(t=s)}return t}static nanoseconds(e,t="UTC"){return new v(e,t)}static microseconds(e,t="UTC"){return v.nanoseconds(e*1e3,t)}static milliseconds(e,t="UTC"){return v.microseconds(e*1e3,t)}static seconds(e,t="UTC"){return v.milliseconds(e*1e3,t)}static minutes(e,t="UTC"){return v.seconds(e*60,t)}static hours(e,t="UTC"){return v.minutes(e*60,t)}static days(e,t="UTC"){return v.hours(e*24,t)}};g(C,"NANOSECOND",C.nanoseconds(1)),g(C,"MICROSECOND",C.microseconds(1)),g(C,"MILLISECOND",C.milliseconds(1)),g(C,"SECOND",C.seconds(1)),g(C,"MINUTE",C.minutes(1)),g(C,"HOUR",C.hours(1)),g(C,"DAY",C.days(1)),g(C,"MAX",new C((1n<<63n)-1n)),g(C,"MIN",new C(0)),g(C,"ZERO",new C(0)),g(C,"z",i.z.union([i.z.object({value:i.z.bigint()}).transform(r=>new C(r.value)),i.z.string().transform(r=>new C(BigInt(r))),i.z.instanceof(Number).transform(r=>new C(r)),i.z.number().transform(r=>new C(r)),i.z.instanceof(C)]));let M=C;const R=class I{constructor(e){g(this,"value"),g(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}static fromSeconds(e){return e instanceof I?e:e instanceof Ni?e.period:e instanceof M?new I(e):["number","bigint"].includes(typeof e)?I.seconds(e):new I(e)}static fromMilliseconds(e){return e instanceof I?e:e instanceof Ni?e.period:e instanceof M?new I(e):["number","bigint"].includes(typeof e)?I.milliseconds(e):new I(e)}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(e){return this.valueOf()<new I(e).valueOf()}greaterThan(e){return this.valueOf()>new I(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new I(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new I(e).valueOf()}remainder(e){return Za(this,e)}truncate(e){return new I(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(I.DAY),t=this.truncate(I.HOUR),n=this.truncate(I.MINUTE),s=this.truncate(I.SECOND),a=this.truncate(I.MILLISECOND),o=this.truncate(I.MICROSECOND),c=this.truncate(I.NANOSECOND),h=e,d=t.sub(e),f=n.sub(t),u=s.sub(n),N=a.sub(s),S=o.sub(a),j=c.sub(o);let U="";return h.isZero||(U+=`${h.days}d `),d.isZero||(U+=`${d.hours}h `),f.isZero||(U+=`${f.minutes}m `),u.isZero||(U+=`${u.seconds}s `),N.isZero||(U+=`${N.milliseconds}ms `),S.isZero||(U+=`${S.microseconds}µs `),j.isZero||(U+=`${j.nanoseconds}ns`),U.trim()}mult(e){return new I(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(I.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(I.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(I.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(I.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(I.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(I.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new I(e).valueOf()}add(e){return new I(this.valueOf()+new I(e).valueOf())}sub(e){return new I(this.valueOf()-new I(e).valueOf())}static nanoseconds(e=1){return new I(e)}static microseconds(e=1){return I.nanoseconds(it(e,1e3))}static milliseconds(e=1){return I.microseconds(it(e,1e3))}static seconds(e=1){return I.milliseconds(it(e,1e3))}static minutes(e=1){return I.seconds(it(e,60))}static hours(e){return I.minutes(it(e,60))}static days(e){return I.hours(it(e,24))}};g(R,"NANOSECOND",R.nanoseconds(1)),g(R,"MICROSECOND",R.microseconds(1)),g(R,"MILLISECOND",R.milliseconds(1)),g(R,"SECOND",R.seconds(1)),g(R,"MINUTE",R.minutes(1)),g(R,"HOUR",R.hours(1)),g(R,"DAY",R.days(1)),g(R,"MAX",new R((1n<<63n)-1n)),g(R,"MIN",new R(0)),g(R,"ZERO",new R(0)),g(R,"z",i.z.union([i.z.object({value:i.z.bigint()}).transform(r=>new R(r.value)),i.z.string().transform(r=>new R(BigInt(r))),i.z.instanceof(Number).transform(r=>new R(r)),i.z.number().transform(r=>new R(r)),i.z.instanceof(R)]));let k=R;const Dt=class Br extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Br(e).valueOf()}get period(){return k.seconds(1/this.valueOf())}sampleCount(e){return new k(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new se(t).valueOf()}span(e){return k.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Br(e)}static khz(e){return Br.hz(e*1e3)}};g(Dt,"z",i.z.union([i.z.number().transform(r=>new Dt(r)),i.z.instanceof(Number).transform(r=>new Dt(r)),i.z.instanceof(Dt)]));let Ni=Dt;const H=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Kn(e*this.valueOf())}};g(H,"UNKNOWN",new H(0)),g(H,"BIT128",new H(16)),g(H,"BIT64",new H(8)),g(H,"BIT32",new H(4)),g(H,"BIT16",new H(2)),g(H,"BIT8",new H(1)),g(H,"z",i.z.union([i.z.number().transform(r=>new H(r)),i.z.instanceof(Number).transform(r=>new H(r)),i.z.instanceof(H)]));let se=H;const fe=class Mt{constructor(e,t){g(this,"start"),g(this,"end"),typeof e=="object"&&"start"in e?(this.start=new M(e.start),this.end=new M(e.end)):(this.start=new M(e),this.end=new M(t))}get span(){return new k(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 Mt(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,t=k.ZERO){if(t.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let n=this.start.sub(e.start).valueOf(),s=this.end.sub(e.end).valueOf();return n<0&&(n=-n),s<0&&(s=-s),n<=t.valueOf()&&s<=t.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,t=k.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 s=M.max(n.start,e.start),a=M.min(n.end,e.end);return a.before(s)?!1:new k(a.sub(s)).greaterThanOrEqual(t)}contains(e){return e instanceof Mt?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new Mt(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 Mt(M.min(...e.map(t=>t.start)),M.max(...e.map(t=>t.end)))}};g(fe,"MAX",new fe(M.MIN,M.MAX)),g(fe,"MIN",new fe(M.MAX,M.MIN)),g(fe,"ZERO",new fe(M.ZERO,M.ZERO)),g(fe,"z",i.z.union([i.z.object({start:M.z,end:M.z}).transform(r=>new fe(r.start,r.end)),i.z.instanceof(fe)]));let Kt=fe;const p=class _{constructor(e){if(g(this,"value"),g(this,"encodeValue",!0),e instanceof _||typeof e=="string"||typeof e.valueOf()=="string"){this.value=e.valueOf();return}const t=_.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){this.value=t.valueOf();return}throw this.value=_.UNKNOWN.valueOf(),new Error(`unable to find data type for ${e.toString()}`)}valueOf(){return this.value}get Array(){const e=_.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(_.JSON)||this.equals(_.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(_.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=_.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsigned(){return this.equals(_.UINT8)||this.equals(_.UINT16)||this.equals(_.UINT32)||this.equals(_.UINT64)}get isSigned(){return this.equals(_.INT8)||this.equals(_.INT16)||this.equals(_.INT32)||this.equals(_.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsigned&&e.isSigned?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(_.INT32)&&e.equals(_.FLOAT64)||this.equals(_.INT8)&&e.equals(_.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsigned===e.isUnsigned:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}toJSON(){return this.toString()}get usesBigInt(){return _.BIG_INT_TYPES.some(e=>e.equals(this))}};g(p,"UNKNOWN",new p("unknown")),g(p,"FLOAT64",new p("float64")),g(p,"FLOAT32",new p("float32")),g(p,"INT64",new p("int64")),g(p,"INT32",new p("int32")),g(p,"INT16",new p("int16")),g(p,"INT8",new p("int8")),g(p,"UINT64",new p("uint64")),g(p,"UINT32",new p("uint32")),g(p,"UINT16",new p("uint16")),g(p,"UINT8",new p("uint8")),g(p,"BOOLEAN",p.UINT8),g(p,"TIMESTAMP",new p("timestamp")),g(p,"UUID",new p("uuid")),g(p,"STRING",new p("string")),g(p,"JSON",new p("json")),g(p,"ARRAY_CONSTRUCTORS",new Map([[p.UINT8.toString(),Uint8Array],[p.UINT16.toString(),Uint16Array],[p.UINT32.toString(),Uint32Array],[p.UINT64.toString(),BigUint64Array],[p.FLOAT32.toString(),Float32Array],[p.FLOAT64.toString(),Float64Array],[p.INT8.toString(),Int8Array],[p.INT16.toString(),Int16Array],[p.INT32.toString(),Int32Array],[p.INT64.toString(),BigInt64Array],[p.TIMESTAMP.toString(),BigInt64Array],[p.STRING.toString(),Uint8Array],[p.JSON.toString(),Uint8Array],[p.UUID.toString(),Uint8Array]])),g(p,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,p.UINT8],[Uint16Array.name,p.UINT16],[Uint32Array.name,p.UINT32],[BigUint64Array.name,p.UINT64],[Float32Array.name,p.FLOAT32],[Float64Array.name,p.FLOAT64],[Int8Array.name,p.INT8],[Int16Array.name,p.INT16],[Int32Array.name,p.INT32],[BigInt64Array.name,p.INT64]])),g(p,"DENSITIES",new Map([[p.UINT8.toString(),se.BIT8],[p.UINT16.toString(),se.BIT16],[p.UINT32.toString(),se.BIT32],[p.UINT64.toString(),se.BIT64],[p.FLOAT32.toString(),se.BIT32],[p.FLOAT64.toString(),se.BIT64],[p.INT8.toString(),se.BIT8],[p.INT16.toString(),se.BIT16],[p.INT32.toString(),se.BIT32],[p.INT64.toString(),se.BIT64],[p.TIMESTAMP.toString(),se.BIT64],[p.STRING.toString(),se.UNKNOWN],[p.JSON.toString(),se.UNKNOWN],[p.UUID.toString(),se.BIT128]])),g(p,"ALL",[p.UNKNOWN,p.FLOAT64,p.FLOAT32,p.INT64,p.INT32,p.INT16,p.INT8,p.UINT64,p.UINT32,p.UINT16,p.UINT8,p.TIMESTAMP,p.UUID,p.STRING,p.JSON]),g(p,"BIG_INT_TYPES",[p.INT64,p.UINT64,p.TIMESTAMP]),g(p,"z",i.z.union([i.z.string().transform(r=>new p(r)),i.z.instanceof(p)]));let D=p;const te=class Y extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Y.bytes(this.valueOf()+e.valueOf())}sub(e){return Y.bytes(this.valueOf()-e.valueOf())}truncate(e){return new Y(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return Y.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/Y.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/Y.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/Y.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/Y.TERABYTE.valueOf()}toString(){const e=this.truncate(Y.TERABYTE),t=this.truncate(Y.GIGABYTE),n=this.truncate(Y.MEGABYTE),s=this.truncate(Y.KILOBYTE),a=this.truncate(Y.BYTE),o=e,c=t.sub(e),h=n.sub(t),d=s.sub(n),f=a.sub(s);let u="";return o.isZero||(u+=`${o.terabytes}TB `),c.isZero||(u+=`${c.gigabytes}GB `),h.isZero||(u+=`${h.megabytes}MB `),d.isZero||(u+=`${d.kilobytes}KB `),(!f.isZero||u==="")&&(u+=`${f.valueOf()}B`),u.trim()}static bytes(e=1){return new Y(e)}static kilobytes(e=1){return Y.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Y.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Y.megabytes(e.valueOf()*1e3)}static terabytes(e){return Y.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};g(te,"BYTE",new te(1)),g(te,"KILOBYTE",te.kilobytes(1)),g(te,"MEGABYTE",te.megabytes(1)),g(te,"GIGABYTE",te.gigabytes(1)),g(te,"TERABYTE",te.terabytes(1)),g(te,"ZERO",new te(0)),g(te,"z",i.z.union([i.z.number().transform(r=>new te(r)),i.z.instanceof(te)]));let Kn=te;i.z.union([i.z.instanceof(Uint8Array),i.z.instanceof(Uint16Array),i.z.instanceof(Uint32Array),i.z.instanceof(BigUint64Array),i.z.instanceof(Float32Array),i.z.instanceof(Float64Array),i.z.instanceof(Int8Array),i.z.instanceof(Int16Array),i.z.instanceof(Int32Array),i.z.instanceof(BigInt64Array)]);const qa=r=>{const e=typeof r;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||r instanceof M||r instanceof k||r instanceof Date},Zh=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t.valueOf())-BigInt(n.valueOf()):jt(t,-n).valueOf(),jt=(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),qh=r=>r==null?!1:Array.isArray(r)||r instanceof ArrayBuffer||ArrayBuffer.isView(r)&&!(r instanceof DataView)||r instanceof Vh?!0:qa(r),Ce=-1,Fh=i.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer),Yh=i.z.union([i.z.null(),i.z.undefined()]).transform(()=>new Uint8Array().buffer),Jn=10,Wh=(r,e)=>{if(r==="string"&&!e.isVariable)throw new Error(`cannot convert series of type ${e.toString()} to string`);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`)},Lt=class ye{constructor(e){g(this,"key",""),g(this,"isSynnaxSeries",!0),g(this,"dataType"),g(this,"sampleOffset"),g(this,"gl"),g(this,"_data"),g(this,"timeRange",Kt.ZERO),g(this,"alignment",0n),g(this,"_cachedMin"),g(this,"_cachedMax"),g(this,"writePos",Ce),g(this,"_refCount",0),g(this,"_cachedLength"),g(this,"_cachedIndexes"),qh(e)&&(e={data:e});const{dataType:t,timeRange:n,sampleOffset:s=0,glBufferUsage:a="static",alignment:o=0n,key:c=Lh()}=e,h=e.data??[];if(h instanceof ye||typeof h=="object"&&"isSynnaxSeries"in h&&h.isSynnaxSeries===!0){const u=h;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 d=qa(h),f=Array.isArray(h);if(t!=null)this.dataType=new D(t);else{if(h instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(f||d){let u=h;if(!d){if(h.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=h[0]}if(typeof u=="string")this.dataType=D.STRING;else if(typeof u=="number")this.dataType=D.FLOAT64;else if(typeof u=="bigint")this.dataType=D.INT64;else if(typeof u=="boolean")this.dataType=D.BOOLEAN;else if(u instanceof M||u instanceof Date||u instanceof M)this.dataType=D.TIMESTAMP;else if(typeof u=="object")this.dataType=D.JSON;else throw new Error(`cannot infer data type of ${typeof u} when constructing a Series from a JS array`)}else this.dataType=new D(h)}if(!f&&!d)this._data=h;else{let u=d?[h]:h;const N=u[0];(N instanceof M||N instanceof Date||N instanceof k)&&(u=u.map(S=>new M(S).valueOf())),this.dataType.equals(D.STRING)?(this._cachedLength=u.length,this._data=new TextEncoder().encode(`${u.join(`
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(`
4
30
  `)}
5
- `).buffer):this.dataType.equals(D.JSON)?(this._cachedLength=u.length,this._data=new TextEncoder().encode(`${u.map(S=>Rr.encodeString(S)).join(`
31
+ `).buffer):this.dataType.equals(ae.JSON)?(this.cachedLength=d.length,this._data=new TextEncoder().encode(`${d.map(p=>ii.encodeString(p)).join(`
6
32
  `)}
7
- `).buffer):this.dataType.usesBigInt&&typeof N=="number"?this._data=new this.dataType.Array(u.map(S=>BigInt(Math.round(S)))).buffer:!this.dataType.usesBigInt&&typeof N=="bigint"?this._data=new this.dataType.Array(u.map(S=>Number(S))).buffer:this._data=new this.dataType.Array(u).buffer}this.key=c,this.alignment=o,this.sampleOffset=s??0,this.timeRange=n??Kt.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:a}}static alloc({capacity:e,dataType:t,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const s=new new D(t).Array(e),a=new ye({data:s.buffer,dataType:t,...n});return a.writePos=0,a}static createTimestamps(e,t,n){const s=n.spanRange(t.span(e)),a=new BigInt64Array(e);for(let o=0;o<e;o++)a[o]=BigInt(n.add(t.span(o)).valueOf());return new ye({data:a,dataType:D.TIMESTAMP,timeRange:s})}get refCount(){return this._refCount}static fromStrings(e,t){const n=new TextEncoder().encode(`${e.join(`
8
- `)}
9
- `);return new ye({data:n,dataType:D.STRING,timeRange:t})}static fromJSON(e,t){const n=new TextEncoder().encode(`${e.map(s=>Rr.encodeString(s)).join(`
10
- `)}
11
- `);return new ye({data:n,dataType:D.JSON,timeRange:t})}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){if(this._refCount<=0){console.warn("attempted to release a series with a negative reference count");return}this._refCount--,this._refCount===0&&this.gl.control!=null&&this.maybeGarbageCollectGLBuffer(this.gl.control)}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===Ce)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===Ce)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===Ce?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.matches(D.STRING,D.UUID))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.underlyingData).split(`
12
- `).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(D.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=D.UUID.density.valueOf(),t=Array(this.length);for(let n=0;n<this.length;n++){const s=this.underlyingData.slice(n*e,(n+1)*e),a=Array.from(new Uint8Array(s.buffer),o=>o.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");t[n]=a}return t}parseJSON(e){if(!this.dataType.equals(D.JSON))throw new Error("cannot parse non-JSON series as JSON");return new TextDecoder().decode(this.underlyingData).split(`
13
- `).slice(0,-1).map(t=>e.parse(Rr.decodeString(t)))}get byteCapacity(){return new Kn(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===Ce?this.byteCapacity:this.dataType.isVariable?new Kn(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===Ce?this.data.length: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,s)=>{n===Jn&&(e++,t.push(s+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 s=0;s<this.length;s++)n[s]=Zh(this.dataType,e,this.data[s],t);return new ye({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(D.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(){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()),jt(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(D.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(){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()),jt(this._cachedMin,this.sampleOffset))}get bounds(){return Ge(Number(this.min),Number(this.max))}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)}}enrich(){this.max,this.min}get range(){return jt(this.max,-this.min)}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){if(this.dataType.isVariable)return this.atVariable(e,t??!1);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 jt(n,this.sampleOffset)}atVariable(e,t){let n=0,s=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[e],s=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]===Jn){if(e===0){s=o;break}n=o+1,e--}if(s===0&&(s=this.data.length),n>=s||e>0){if(t)throw new Error(`[series] - no value at index ${e}`);return}}const a=this.data.slice(n,s);return this.dataType.equals(D.STRING)?new TextDecoder().decode(a):Ns(JSON.parse(new TextDecoder().decode(a)))}binarySearch(e){let t=0,n=this.length-1;const s=ih(e);for(;t<=n;){const a=Math.floor((t+n)/2),o=s(this.at(a,!0),e);if(o===0)return a;o<0?t=a+1:n=a-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(D.FLOAT32)&&!this.dataType.equals(D.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:s}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==s)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Ce){s===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const a=this.dataType.density.size(s).valueOf(),o=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,a,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=Ce}as(e){return Wh(e,this.dataType),this}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:Ui(this.alignmentBounds.lower),upper:Ui(this.alignmentBounds.upper)},timeRange:(e=this.timeRange)==null?void 0:e.toString(),length:this.length,capacity:this.capacity}}get memInfo(){return{key:this.key,length:this.length,byteLength:this.byteLength,glBuffer:this.gl.buffer!=null}}get alignmentBounds(){return Ge(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 Gh(this);return this.dataType.equals(D.JSON)?new Hh(e):e}return new Kh(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new Ii(this,e,t??this.length)}subAlignmentIterator(e,t){return new Ii(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 ye({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 s;return e?s=this.data.subarray(t,n):s=this.data.slice(t,n),new ye({data:s,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(e){return new ye({data:this.buffer,dataType:this.dataType,timeRange:Kt.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){var e,t;let n=`${this.dataType.toString()} ${this.length} [`;if(this.length<=10)n+=Array.from(this).map(s=>s.toString());else{for(let s=0;s<5;s++)n+=`${(e=this.at(s))==null?void 0:e.toString()}`,s<4&&(n+=",");n+="...";for(let s=-5;s<0;s++)n+=(t=this.at(s))==null?void 0:t.toString(),s<-1&&(n+=",")}return n+="]",n}};g(Lt,"crudeZ",i.z.object({timeRange:Kt.z.optional(),dataType:D.z,alignment:i.z.coerce.bigint().optional(),data:i.z.union([Fh,Yh,i.z.instanceof(ArrayBuffer),i.z.instanceof(Uint8Array)]),glBufferUsage:_h.optional().default("static").optional()})),g(Lt,"z",Lt.crudeZ.transform(r=>new Lt(r)));let Vh=Lt,Ii=class{constructor(r,e,t){g(this,"series"),g(this,"end"),g(this,"index"),this.series=r;const n=Ge(0,r.length);this.end=Ti(n,t),this.index=Ti(n,e)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}};class Gh{constructor(e){if(g(this,"series"),g(this,"index"),g(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,t=this.series.data;for(;this.index<t.length&&t[this.index]!==Jn;)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))})}[Symbol.iterator](){return this}}var $i,xi;const Fa=class Ya{constructor(e){g(this,"wrapped"),g(this,$i,"JSONSeriesIterator"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:Rr.decodeString(e.value,Ya.SCHEMA)}}[(xi=Symbol.iterator,$i=Symbol.toStringTag,xi)](){return this}};g(Fa,"SCHEMA",i.z.record(i.z.string(),i.z.unknown()));let Hh=Fa;var ki,Ai;class Kh{constructor(e){g(this,"series"),g(this,"index"),g(this,ki,"SeriesIterator"),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)}}[(Ai=Symbol.iterator,ki=Symbol.toStringTag,Ai)](){return this}}const Ui=r=>{const e=r>>32n,t=r&0xffffffffn;return{domain:e,sample:t}};i.z.object({key:i.z.string(),value:i.z.string()});i.z.record(i.z.union([i.z.number(),i.z.string(),i.z.symbol()]),i.z.unknown());const Wa=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Jh=Wa(),Va=["macOS","Windows","Linux"],Xh=["macos","windows","linux"],Qh={macos:"macOS",windows:"Windows",linux:"Linux"},eu=i.z.enum(Va).or(i.z.enum(Xh).transform(r=>Qh[r])),tu=()=>{if(typeof window>"u")return;const r=window.navigator.userAgent.toLowerCase();if(r.includes("mac"))return"macOS";if(r.includes("win"))return"Windows";if(r.includes("linux"))return"Linux"};let Tn;const ru=(r={})=>{const{force:e,default:t}=r;return e??Tn??(Tn=tu(),Tn??t)},Ga=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:Va,RUNTIME:Jh,detect:Wa,getOS:ru,osZ:eu},Symbol.toStringTag,{value:"Module"}));var nu=Object.defineProperty,su=(r,e,t)=>e in r?nu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_t=(r,e,t)=>su(r,typeof e!="symbol"?e+"":e,t);const iu=(...r)=>r.map(Ha).join(""),Ha=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),au=r=>r.endsWith("/")?r.slice(0,-1):r,ou=(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("&")}`,Xn=class Qn{constructor({host:e,port:t,protocol:n="",pathPrefix:s=""}){_t(this,"protocol"),_t(this,"host"),_t(this,"port"),_t(this,"path"),this.protocol=n,this.host=e,this.port=t,this.path=Ha(s)}replace(e){return new Qn({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Qn({...this,pathPrefix:iu(this.path,e)})}toString(){return au(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};_t(Xn,"UNKNOWN",new Xn({host:"unknown",port:0}));let cu=Xn;const lu=-128,hu=127;i.z.number().int().min(lu).max(hu);const uu=-32768,du=32767;i.z.number().int().min(uu).max(du);const fu=-2147483648,yu=2147483647;i.z.number().int().min(fu).max(yu);const gu=-9223372036854775808n,pu=9223372036854775807n;i.z.bigint().min(gu).max(pu);const wu=255;i.z.number().int().min(0).max(wu);const mu=65535;i.z.number().int().min(0).max(mu);const bu=4294967295;i.z.number().int().min(0).max(bu);const vu=18446744073709551615n;i.z.bigint().min(0n).max(vu);var Tu=Object.defineProperty,Ou=(r,e,t)=>e in r?Tu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ve=(r,e,t)=>Ou(r,typeof e!="symbol"?e+"":e,t);const Su=async r=>await new Promise(e=>setTimeout(e,k.fromMilliseconds(r).milliseconds));class Eu{constructor(e){ve(this,"config"),ve(this,"retries"),ve(this,"interval"),this.config={baseInterval:new k((e==null?void 0:e.baseInterval)??k.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)??Su},this.retries=0,this.interval=new k(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 zu=i.z.object({baseInterval:k.z.optional(),maxRetries:i.z.number().optional(),scale:i.z.number().optional()}),Nu=Object.freeze(Object.defineProperty({__proto__:null,Breaker:Eu,breakerConfig:zu},Symbol.toStringTag,{value:"Module"})),Iu=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,ks=i.z.string().regex(Iu),gt=i.z.number().min(0).max(255),$u=i.z.number().min(0).max(1),Ka=i.z.tuple([gt,gt,gt,$u]),Ja=i.z.tuple([gt,gt,gt]),As=(r,e=1)=>{if(typeof r=="string")return ku(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}throw new Error(`Invalid color: ${JSON.stringify(r)}`)},xu=i.z.union([ks,Ka,Ja]).transform(r=>As(r)),ku=(r,e=1)=>{if(!ks.safeParse(r).success)throw new Error(`Invalid hex color: ${r}`);return r=Au(r),[Nr(r,0),Nr(r,2),Nr(r,4),r.length===8?Nr(r,6)/255:e]},Nr=(r,e)=>parseInt(r.slice(e,e+2),16),Au=r=>r.startsWith("#")?r.slice(1):r,Uu=i.z.union([ks,Ka,i.z.string(),Ja]);As("#000000");As("#ffffff");const Cu=i.z.object({key:i.z.string(),color:Uu,position:i.z.number(),switched:i.z.boolean().optional()});i.z.array(Cu);const Ru=i.z.object({key:i.z.string(),name:i.z.string(),color:xu});i.z.object({key:i.z.string(),name:i.z.string(),swatches:i.z.array(Ru)});const Bu=i.z.number().int().min(0).max(255),Pu=i.z.object({name:i.z.string(),key:i.z.string()}),Lr=r=>i.z.object({subject:Pu,resource:r,authority:Bu}),Du=i.z.object({from:Lr(i.z.any()),to:i.z.null()}),Mu=i.z.object({from:i.z.null(),to:Lr(i.z.any())});i.z.union([Du,Mu,i.z.object({from:Lr(i.z.any()),to:Lr(i.z.any())})]);const ju=r=>Object.getOwnPropertySymbols(globalThis).includes(r),Lu=(r,e)=>{const t=Symbol.for(r);if(!ju(t)){const n=e();Object.defineProperty(globalThis,t,{value:n})}return()=>globalThis[t]},_u=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),Gr=r=>{var e;return e=class extends Error{constructor(t,n){super(t,n),ve(this,"discriminator",e.discriminator),ve(this,"type",e.TYPE),ve(this,"matches",e.matches),this.name=e.TYPE}static sub(t){return Gr(`${r}.${t}`)}},ve(e,"discriminator","FreighterError"),ve(e,"TYPE",r),ve(e,"matches",_u(r)),e},Xa=r=>{if(r==null||typeof r!="object")return!1;const e=r;if(e.discriminator!=="FreighterError")return!1;if(!("type"in e))throw new Error(`Freighter error is missing its type property: ${JSON.stringify(e)}`);return!0},ot="unknown",es="nil";class Zu{constructor(){ve(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:es,data:""};if(Xa(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:ot,data:e.message};if(typeof e=="string")return{type:ot,data:e};try{return{type:ot,data:JSON.stringify(e)}}catch{return{type:ot,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===es)return null;if(e.type===ot)return new ts(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new ts(e.data)}}const Us=Lu("synnax-error-registry",()=>new Zu),qu=({encode:r,decode:e})=>Us().register({encode:r,decode:e}),Fu=r=>Us().encode(r),Yu=r=>r==null?null:Us().decode(r);class ts extends Gr("unknown"){}const Wu=i.z.object({type:i.z.string(),data:i.z.string()});class Vu extends Gr("canceled"){}const qe=Object.freeze(Object.defineProperty({__proto__:null,Canceled:Vu,NONE:es,UNKNOWN:ot,Unknown:ts,createTyped:Gr,decode:Yu,encode:Fu,isTyped:Xa,payloadZ:Wu,register:qu},Symbol.toStringTag,{value:"Module"}));i.object({jsonrpc:i.string(),id:i.number().optional(),method:i.string().optional(),params:i.unknown().optional(),result:i.unknown().optional()});i.z.string().regex(/^\d+\.\d+\.\d+$/);const Gu=["standard","scientific","engineering"];i.z.enum(Gu);let hr=class extends qe.createTyped("freighter"){},ue=class extends hr.sub("eof"){constructor(){super("EOF")}},bt=class extends hr.sub("stream_closed"){constructor(){super("StreamClosed")}},Fe=class extends hr.sub("unreachable"){constructor(e={}){const{message:t="Unreachable",url:n=cu.UNKNOWN}=e;super(t),G(this,"url"),this.url=n}};const Hu=r=>{if(!r.type.startsWith(hr.TYPE))return null;if(ue.matches(r))return{type:ue.TYPE,data:"EOF"};if(bt.matches(r))return{type:bt.TYPE,data:"StreamClosed"};if(Fe.matches(r))return{type:Fe.TYPE,data:"Unreachable"};throw new Error(`Unknown error type: ${r.type}: ${r.message}`)},Ku=r=>{if(!r.type.startsWith(hr.TYPE))return null;switch(r.type){case ue.TYPE:return new ue;case bt.TYPE:return new bt;case Fe.TYPE:return new Fe;default:throw new qe.Unknown(`Unknown error type: ${r.data}`)}};qe.register({encode:Hu,decode:Ku});class Qa{constructor(){G(this,"middleware",[])}use(...e){this.middleware.push(...e)}async executeMiddleware(e,t){let n=0;const s=async a=>{if(n===this.middleware.length)return await t(a);const o=this.middleware[n];return n++,await o(a,s)};return await s(e)}}const eo="Content-Type",Ci=r=>{if(Ga.RUNTIME!=="node")return fetch;const e=require("node-fetch");if(r==="http")return e;const t=require("https"),n=new t.Agent({rejectUnauthorized:!1});return async(s,a)=>await e(s,{...a,agent:n})},Ju=r=>"code"in r&&r.code==="ECONNREFUSED"||r.message.toLowerCase().includes("load failed"),Xu=400;class Qu extends Qa{constructor(e,t,n=!1){return super(),G(this,"endpoint"),G(this,"encoder"),G(this,"fetch"),this.endpoint=e.replace({protocol:n?"https":"http"}),this.encoder=t,this.fetch=Ci(this.endpoint.protocol),new Proxy(this,{get:(s,a,o)=>a==="endpoint"?this.endpoint:Reflect.get(s,a,o)})}get headers(){return{[eo]:this.encoder.contentType}}async send(e,t,n,s){t=n==null?void 0:n.parse(t);let a=null;const o=this.endpoint.child(e),c={};c.method="POST",c.body=this.encoder.encode(t??{});const[,h]=await this.executeMiddleware({target:o.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async d=>{const f={...d,params:{}};c.headers={...this.headers,...d.params};let u;try{u=await Ci(d.protocol)(d.target,c)}catch(S){let j=S;return Ju(j)&&(j=new Fe({url:o})),[f,j]}const N=new Uint8Array(await(await u.blob()).arrayBuffer());if(u!=null&&u.ok)return s!=null&&(a=this.encoder.decode(N,s)),[f,null];try{if(u.status!==Xu)return[f,new Error(u.statusText)];const S=this.encoder.decode(N,qe.payloadZ),j=qe.decode(S);return[f,j]}catch(S){return[f,new Error(`[freighter] - failed to decode error: ${u.statusText}: ${S.message}`)]}});return h!=null?[null,h]:[a,null]}}const ed=(r,e)=>{class t{constructor(s){G(this,"wrapped"),this.wrapped=s}use(...s){this.wrapped.use(...s)}async send(s,a,o,c){const h=new Nu.Breaker(e);do{const[d,f]=await this.wrapped.send(s,a,o,c);if(f==null)return[d,null];if(!Fe.matches(f))return[null,f];if(!await h.wait())return[d,f]}while(!0)}}return new t(r)},m=async(r,e,t,n,s)=>{const[a,o]=await r.send(e,t,n,s);if(o!=null)throw o;return a},td=()=>Ga.RUNTIME!=="node"?r=>new WebSocket(r):r=>new(require("ws")).WebSocket(r,{rejectUnauthorized:!1}),rd=i.z.object({type:i.z.enum(["data","close","open"]),payload:i.z.unknown(),error:i.z.optional(qe.payloadZ)});class nd{constructor(e,t,n,s){G(this,"codec"),G(this,"reqSchema"),G(this,"resSchema"),G(this,"ws"),G(this,"serverClosed"),G(this,"sendClosed"),G(this,"receiveDataQueue",[]),G(this,"receiveCallbacksQueue",[]),this.codec=t,this.reqSchema=n,this.resSchema=s,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 qe.decode(e.error)}return null}send(e){if(this.serverClosed!=null)return new ue;if(this.sendClosed)throw new bt;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");return this.serverClosed=qe.decode(e.error),[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,rd))}onClose(e){this.addMessage({type:"close",error:{type:e.code===id?ue.TYPE:bt.TYPE,data:""}})}}const sd="freighterctx",id=1e3,to=class rs extends Qa{constructor(e,t,n=!1){super(),G(this,"baseUrl"),G(this,"encoder"),G(this,"secure"),this.secure=n,this.baseUrl=e.replace({protocol:n?"wss":"ws"}),this.encoder=t}withCodec(e){const t=new rs(this.baseUrl,e,this.secure);return t.use(...this.middleware),t}async stream(e,t,n){const s=td();let a;const[,o]=await this.executeMiddleware({target:e,protocol:"websocket",params:{},role:"client"},async c=>{const h=s(this.buildURL(e,c)),d={...c,params:{}};h.binaryType=rs.MESSAGE_TYPE;const f=await this.wrapSocket(h,t,n);return f instanceof Error?[d,f]:(a=f,[d,null])});if(o!=null)throw o;return a}buildURL(e,t){const n=ou({[eo]:this.encoder.contentType,...t.params},sd);return this.baseUrl.child(e).toString()+n}async wrapSocket(e,t,n){return await new Promise(s=>{e.onopen=()=>{const a=new nd(e,this.encoder,t,n);a.receiveOpenAck().then(o=>{o!=null?s(o):s(a)}).catch(o=>s(o))},e.onerror=a=>{const o=a;s(new Error(o.message))}})}};G(to,"MESSAGE_TYPE","arraybuffer");let ad=to;const ro="all",no="create",so="delete",io="retrieve",ao="update",_r=i.z.enum([ro,no,so,io,ao]),od=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)},oo=r=>{const e=(t,n=ns)=>{if(typeof t=="string")return r(t);if(Array.isArray(t))return t.map(o=>e(o,n));if(!On(t))return t;n=ld(n);const s={},a=t;return Object.keys(a).forEach(o=>{let c=a[o];const h=r(o);n.recursive&&(On(c)?Bi(c,n.keepTypesOnRecursion)||(c=e(c,n)):n.recursiveInArray&&Ri(c)&&(c=[...c].map(d=>{let f=d;return On(d)?Bi(f,n.keepTypesOnRecursion)||(f=e(d,n)):Ri(d)&&(f=e({key:d},n).key),f}))),s[h]=c}),s};return e},Cs=oo(od),cd=r=>r.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`),co=oo(cd),ns={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},ld=(r=ns)=>(r.recursive==null?r=ns:r.recursiveInArray??(r.recursiveInArray=!1),r),Ri=r=>r!=null&&Array.isArray(r),On=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),Bi=(r,e)=>(e||[]).some(t=>r instanceof t),Hr=r=>r!=null&&typeof r=="object"&&!Array.isArray(r);var hd=Object.defineProperty,ud=(r,e,t)=>e in r?hd(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pt=(r,e,t)=>ud(r,typeof e!="symbol"?e+"":e,t);function dd(r){const e=r.length;let t=0,n=0;for(;n<e;){let s=r.charCodeAt(n++);if((s&4294967168)===0){t++;continue}else if((s&4294965248)===0)t+=2;else{if(s>=55296&&s<=56319&&n<e){const a=r.charCodeAt(n);(a&64512)===56320&&(++n,s=((s&1023)<<10)+(a&1023)+65536)}(s&4294901760)===0?t+=3:t+=4}}return t}function fd(r,e,t){const n=r.length;let s=t,a=0;for(;a<n;){let o=r.charCodeAt(a++);if((o&4294967168)===0){e[s++]=o;continue}else if((o&4294965248)===0)e[s++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&a<n){const c=r.charCodeAt(a);(c&64512)===56320&&(++a,o=((o&1023)<<10)+(c&1023)+65536)}(o&4294901760)===0?(e[s++]=o>>12&15|224,e[s++]=o>>6&63|128):(e[s++]=o>>18&7|240,e[s++]=o>>12&63|128,e[s++]=o>>6&63|128)}e[s++]=o&63|128}}const yd=new TextEncoder,gd=50;function pd(r,e,t){yd.encodeInto(r,e.subarray(t))}function wd(r,e,t){r.length>gd?pd(r,e,t):fd(r,e,t)}const md=4096;function lo(r,e,t){let n=e;const s=n+t,a=[];let o="";for(;n<s;){const c=r[n++];if((c&128)===0)a.push(c);else if((c&224)===192){const h=r[n++]&63;a.push((c&31)<<6|h)}else if((c&240)===224){const h=r[n++]&63,d=r[n++]&63;a.push((c&31)<<12|h<<6|d)}else if((c&248)===240){const h=r[n++]&63,d=r[n++]&63,f=r[n++]&63;let u=(c&7)<<18|h<<12|d<<6|f;u>65535&&(u-=65536,a.push(u>>>10&1023|55296),u=56320|u&1023),a.push(u)}else a.push(c);a.length>=md&&(o+=String.fromCharCode(...a),a.length=0)}return a.length>0&&(o+=String.fromCharCode(...a)),o}const bd=new TextDecoder,vd=200;function Td(r,e,t){const n=r.subarray(e,e+t);return bd.decode(n)}function Od(r,e,t){return t>vd?Td(r,e,t):lo(r,e,t)}let Ir=class{constructor(e,t){this.type=e,this.data=t}},me=class ss extends Error{constructor(e){super(e);const t=Object.create(ss.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:ss.name})}};const Ct=4294967295;function Sd(r,e,t){const n=t/4294967296,s=t;r.setUint32(e,n),r.setUint32(e+4,s)}function ho(r,e,t){const n=Math.floor(t/4294967296),s=t;r.setUint32(e,n),r.setUint32(e+4,s)}function uo(r,e){const t=r.getInt32(e),n=r.getUint32(e+4);return t*4294967296+n}function Ed(r,e){const t=r.getUint32(e),n=r.getUint32(e+4);return t*4294967296+n}const zd=-1,Nd=4294967296-1,Id=17179869184-1;function $d({sec:r,nsec:e}){if(r>=0&&e>=0&&r<=Id)if(e===0&&r<=Nd){const t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,r),t}else{const t=r/4294967296,n=r&4294967295,s=new Uint8Array(8),a=new DataView(s.buffer);return a.setUint32(0,e<<2|t&3),a.setUint32(4,n),s}else{const t=new Uint8Array(12),n=new DataView(t.buffer);return n.setUint32(0,e),ho(n,4,r),t}}function xd(r){const e=r.getTime(),t=Math.floor(e/1e3),n=(e-t*1e3)*1e6,s=Math.floor(n/1e9);return{sec:t+s,nsec:n-s*1e9}}function kd(r){if(r instanceof Date){const e=xd(r);return $d(e)}else return null}function Ad(r){const e=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(r.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const t=e.getUint32(0),n=e.getUint32(4),s=(t&3)*4294967296+n,a=t>>>2;return{sec:s,nsec:a}}case 12:{const t=uo(e,4),n=e.getUint32(0);return{sec:t,nsec:n}}default:throw new me(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Ud(r){const e=Ad(r);return new Date(e.sec*1e3+e.nsec/1e6)}const Cd={type:zd,encode:kd,decode:Ud};let rr=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Cd)}register({type:e,encode:t,decode:n}){if(e>=0)this.encoders[e]=t,this.decoders[e]=n;else{const s=-1-e;this.builtInEncoders[s]=t,this.builtInDecoders[s]=n}}tryToEncode(e,t){for(let n=0;n<this.builtInEncoders.length;n++){const s=this.builtInEncoders[n];if(s!=null){const a=s(e,t);if(a!=null){const o=-1-n;return new Ir(o,a)}}}for(let n=0;n<this.encoders.length;n++){const s=this.encoders[n];if(s!=null){const a=s(e,t);if(a!=null){const o=n;return new Ir(o,a)}}}return e instanceof Ir?e:null}decode(e,t,n){const s=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return s?s(e,t,n):new Ir(t,e)}};rr.defaultCodec=new rr;function Rd(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function is(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):Rd(r)?new Uint8Array(r):Uint8Array.from(r)}const Bd=100,Pd=2048;let Dd=class fo{constructor(e){this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??rr.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.maxDepth=(e==null?void 0:e.maxDepth)??Bd,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??Pd,this.sortKeys=(e==null?void 0:e.sortKeys)??!1,this.forceFloat32=(e==null?void 0:e.forceFloat32)??!1,this.ignoreUndefined=(e==null?void 0:e.ignoreUndefined)??!1,this.forceIntegerToFloat=(e==null?void 0:e.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new fo({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,t){if(t>this.maxDepth)throw new Error(`Too deep objects in depth ${t}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,t)}ensureBufferSizeToWrite(e){const t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(t*2)}resizeBuffer(e){const t=new ArrayBuffer(e),n=new Uint8Array(t),s=new DataView(t);n.set(this.bytes),this.view=s,this.bytes=n}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){const t=dd(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),wd(e,this.bytes,this.pos),this.pos+=t}encodeObject(e,t){const n=this.extensionCodec.tryToEncode(e,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,t);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){const t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw new Error(`Too large binary: ${t}`);const n=is(e);this.writeU8a(n)}encodeArray(e,t){const n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error(`Too large array: ${n}`);for(const s of e)this.doEncode(s,t+1)}countWithoutUndefined(e,t){let n=0;for(const s of t)e[s]!==void 0&&n++;return n}encodeMap(e,t){const n=Object.keys(e);this.sortKeys&&n.sort();const s=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(s<16)this.writeU8(128+s);else if(s<65536)this.writeU8(222),this.writeU16(s);else if(s<4294967296)this.writeU8(223),this.writeU32(s);else throw new Error(`Too large map object: ${s}`);for(const a of n){const o=e[a];this.ignoreUndefined&&o===void 0||(this.encodeString(a),this.doEncode(o,t+1))}}encodeExtension(e){if(typeof e.data=="function"){const n=e.data(this.pos+6),s=n.length;if(s>=4294967296)throw new Error(`Too large extension object: ${s}`);this.writeU8(201),this.writeU32(s),this.writeI8(e.type),this.writeU8a(n);return}const t=e.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw new Error(`Too large extension object: ${t}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),Sd(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),ho(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}};function Zt(r,e){return new Dd(e).encodeSharedRef(r)}function Sn(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const Md=16,jd=16;class Ld{constructor(e=Md,t=jd){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=t,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,t,n){const s=this.caches[n-1];e:for(const a of s){const o=a.bytes;for(let c=0;c<n;c++)if(o[c]!==e[t+c])continue e;return a.str}return null}store(e,t){const n=this.caches[e.length-1],s={bytes:e,str:t};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=s:n.push(s)}decode(e,t,n){const s=this.find(e,t,n);if(s!=null)return this.hit++,s;this.miss++;const a=lo(e,t,n),o=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(o,a),a}}const as="array",Jt="map_key",yo="map_value",_d=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new me("The type of key must be string or number but "+typeof r)};class Zd{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const t=this.getUninitializedStateFromPool();t.type=as,t.position=0,t.size=e,t.array=new Array(e)}pushMapState(e){const t=this.getUninitializedStateFromPool();t.type=Jt,t.readCount=0,t.size=e,t.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===as){const t=e;t.size=0,t.array=void 0,t.position=0,t.type=void 0}if(e.type===Jt||e.type===yo){const t=e;t.size=0,t.map=void 0,t.readCount=0,t.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const Rt=-1,Rs=new DataView(new ArrayBuffer(0)),qd=new Uint8Array(Rs.buffer);try{Rs.getInt8(0)}catch(r){if(!(r instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const Pi=new RangeError("Insufficient data"),Fd=new Ld;let Yd=class go{constructor(e){this.totalPos=0,this.pos=0,this.view=Rs,this.bytes=qd,this.headByte=Rt,this.stack=new Zd,this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??rr.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.rawStrings=(e==null?void 0:e.rawStrings)??!1,this.maxStrLength=(e==null?void 0:e.maxStrLength)??Ct,this.maxBinLength=(e==null?void 0:e.maxBinLength)??Ct,this.maxArrayLength=(e==null?void 0:e.maxArrayLength)??Ct,this.maxMapLength=(e==null?void 0:e.maxMapLength)??Ct,this.maxExtLength=(e==null?void 0:e.maxExtLength)??Ct,this.keyDecoder=(e==null?void 0:e.keyDecoder)!==void 0?e.keyDecoder:Fd,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??_d}clone(){return new go({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=Rt,this.stack.reset()}setBuffer(e){const t=is(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===Rt&&!this.hasRemaining(1))this.setBuffer(e);else{const t=this.bytes.subarray(this.pos),n=is(e),s=new Uint8Array(t.length+n.length);s.set(t),s.set(n,t.length),this.setBuffer(s)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:t,pos:n}=this;return new RangeError(`Extra ${t.byteLength-n} of ${t.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let t=!1,n;for await(const c of e){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{n=this.doDecodeSync(),t=!0}catch(h){if(!(h instanceof RangeError))throw h}this.totalPos+=this.pos}if(t){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:s,pos:a,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${Sn(s)} at ${o} (${a} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,t){if(this.entered){yield*this.clone().decodeMultiAsync(e,t);return}try{this.entered=!0;let n=t,s=-1;for await(const a of e){if(t&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a),n&&(s=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let t;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){const s=e-128;if(s!==0){this.pushMapState(s),this.complete();continue e}else t={}}else if(e<160){const s=e-144;if(s!==0){this.pushArrayState(s),this.complete();continue e}else t=[]}else{const s=e-160;t=this.decodeString(s,0)}else if(e===192)t=null;else if(e===194)t=!1;else if(e===195)t=!0;else if(e===202)t=this.readF32();else if(e===203)t=this.readF64();else if(e===204)t=this.readU8();else if(e===205)t=this.readU16();else if(e===206)t=this.readU32();else if(e===207)this.useBigInt64?t=this.readU64AsBigInt():t=this.readU64();else if(e===208)t=this.readI8();else if(e===209)t=this.readI16();else if(e===210)t=this.readI32();else if(e===211)this.useBigInt64?t=this.readI64AsBigInt():t=this.readI64();else if(e===217){const s=this.lookU8();t=this.decodeString(s,1)}else if(e===218){const s=this.lookU16();t=this.decodeString(s,2)}else if(e===219){const s=this.lookU32();t=this.decodeString(s,4)}else if(e===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue e}else t=[]}else if(e===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue e}else t=[]}else if(e===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue e}else t={}}else if(e===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue e}else t={}}else if(e===196){const s=this.lookU8();t=this.decodeBinary(s,1)}else if(e===197){const s=this.lookU16();t=this.decodeBinary(s,2)}else if(e===198){const s=this.lookU32();t=this.decodeBinary(s,4)}else if(e===212)t=this.decodeExtension(1,0);else if(e===213)t=this.decodeExtension(2,0);else if(e===214)t=this.decodeExtension(4,0);else if(e===215)t=this.decodeExtension(8,0);else if(e===216)t=this.decodeExtension(16,0);else if(e===199){const s=this.lookU8();t=this.decodeExtension(s,1)}else if(e===200){const s=this.lookU16();t=this.decodeExtension(s,2)}else if(e===201){const s=this.lookU32();t=this.decodeExtension(s,4)}else throw new me(`Unrecognized type byte: ${Sn(e)}`);this.complete();const n=this.stack;for(;n.length>0;){const s=n.top();if(s.type===as)if(s.array[s.position]=t,s.position++,s.position===s.size)t=s.array,n.release(s);else continue e;else if(s.type===Jt){if(t==="__proto__")throw new me("The key __proto__ is not allowed");s.key=this.mapKeyConverter(t),s.type=yo;continue e}else if(s.map[s.key]=t,s.readCount++,s.readCount===s.size)t=s.map,n.release(s);else{s.key=null,s.type=Jt;continue e}}return t}}readHeadByte(){return this.headByte===Rt&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Rt}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new me(`Unrecognized array type byte: ${Sn(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new me(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new me(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,t):this.decodeBinary(e,t)}decodeUtf8String(e,t){var n;if(e>this.maxStrLength)throw new me(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw Pi;const s=this.pos+t;let a;return this.stateIsMapKey()&&(n=this.keyDecoder)!=null&&n.canBeCached(e)?a=this.keyDecoder.decode(this.bytes,s,e):a=Od(this.bytes,s,e),this.pos+=t+e,a}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Jt:!1}decodeBinary(e,t){if(e>this.maxBinLength)throw new me(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw Pi;const n=this.pos+t,s=this.bytes.subarray(n,n+e);return this.pos+=t+e,s}decodeExtension(e,t){if(e>this.maxExtLength)throw new me(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+t),s=this.decodeBinary(e,t+1);return this.extensionCodec.decode(s,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=Ed(this.view,this.pos);return this.pos+=8,e}readI64(){const e=uo(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}};function po(r,e){return new Yd(e).decode(r)}let wo=class{constructor(){pt(this,"contentType","application/json"),pt(this,"decoder"),pt(this,"encoder"),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),s=Cs(n);return t!=null?t.parse(s):s}encodeString(e){const t=co(e);return JSON.stringify(t,(n,s)=>ArrayBuffer.isView(s)?Array.from(s):Hr(s)&&"encode_value"in s?typeof s.value=="bigint"?s.value.toString():s.value:typeof s=="bigint"?s.toString():s)}static registerCustomType(){}},mo=class{constructor(){pt(this,"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||!Hr(e[0]))throw new Error("Payload must be an array of objects");const t=Object.keys(e[0]),n=[t.join(",")];return e.forEach(s=>{const a=t.map(o=>JSON.stringify(s[o]??""));n.push(a.join(","))}),n.join(`
14
- `)}decodeString(e,t){const[n,...s]=e.trim().split(`
15
- `).map(c=>c.trim());if(n.length===0)return t!=null?t.parse({}):{};const a=n.split(",").map(c=>c.trim()),o={};return a.forEach(c=>{o[c]=[]}),s.forEach(c=>{const h=c.split(",").map(d=>d.trim());a.forEach((d,f)=>{const u=this.parseValue(h[f]);u!=null&&o[d].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}static registerCustomType(){}},bo=class{constructor(){pt(this,"contentType","text/plain")}encode(e){return new TextEncoder().encode(e)}decode(e,t){const n=new TextDecoder().decode(e);return t!=null?t.parse(n):n}};const Me=new rr;Me.register({type:0,encode:r=>{if(ArrayBuffer.isView(r)){const e=Array.from(r);return Zt(e,{extensionCodec:Me})}return Hr(r)&&"encode_value"in r?typeof r.value=="bigint"?Zt(r.value.toString(),{extensionCodec:Me}):Zt(r.value,{extensionCodec:Me}):typeof r=="bigint"?Zt(r.toString(),{extensionCodec:Me}):null},decode:r=>po(r,{extensionCodec:Me})});let vo=class{constructor(){pt(this,"contentType","application/msgpack")}encode(e){const t=co(e);return Zt(t,{extensionCodec:Me}).slice()}decode(e,t){const n=po(e,{extensionCodec:Me}),s=Cs(n);return t!=null?t.parse(s):s}static registerCustomType(){}};const Xt=new wo,Wd=new mo,Vd=new bo,Gd=new vo,Qe=Object.freeze(Object.defineProperty({__proto__:null,CSVCodec:mo,CSV_CODEC:Wd,JSONCodec:wo,JSON_CODEC:Xt,MSGPACK_CODEC:Gd,MsgPackCodec:vo,TEXT_CODEC:Vd,TextCodec:bo},Symbol.toStringTag,{value:"Module"})),Hd=r=>[...new Set(r)],Kd=(r,e,t=!0)=>{const n=new Map;return r.forEach(s=>{const a=e(s);if(n.has(a)){if(t)return;n.delete(a)}n.set(a,s)}),Array.from(n.values())},Di=Object.freeze(Object.defineProperty({__proto__:null,by:Kd,unique:Hd},Symbol.toStringTag,{value:"Module"})),Jd=r=>r!=null&&typeof r=="object"&&"toString"in r,Xd=(r,e=!1)=>{const t=Jd(r)?"stringer":typeof r;let n;switch(t){case"string":n=(s,a)=>s.localeCompare(a);break;case"stringer":n=(s,a)=>s.toString().localeCompare(a.toString());break;case"number":n=(s,a)=>Number(s)-Number(a);break;case"bigint":n=(s,a)=>BigInt(s)-BigInt(a)>0n?1:-1;break;case"boolean":n=(s,a)=>Number(s)-Number(a);break;case"undefined":n=()=>0;break;default:return console.warn(`sortFunc: unknown type ${t}`),()=>-1}return e?Qd(n):n},Qd=r=>(e,t)=>r(t,e),Kr=0,En=-1,zn=1,ef=r=>r<Kr,tf=r=>r>Kr,rf=r=>r===Kr,Jr=i.z.tuple([i.z.number(),i.z.number()]);i.z.tuple([i.z.bigint(),i.z.bigint()]);const To=i.z.object({width:i.z.number(),height:i.z.number()}),nf=i.z.object({signedWidth:i.z.number(),signedHeight:i.z.number()}),sf=["width","height"];i.z.enum(sf);const af=["start","center","end"],of=["signedWidth","signedHeight"];i.z.enum(of);const Zr=i.z.object({x:i.z.number(),y:i.z.number()}),cf=i.z.object({clientX:i.z.number(),clientY:i.z.number()}),lf=["x","y"],Oo=i.z.enum(lf),So=["top","right","bottom","left"];i.z.enum(So);const hf=["left","right"],Eo=i.z.enum(hf),uf=["top","bottom"],zo=i.z.enum(uf),No=["center"],Mi=i.z.enum(No),df=[...So,...No],Io=i.z.enum(df);i.z.enum(af);const ff=["first","last"];i.z.enum(ff);const yf=i.z.object({lower:i.z.number(),upper:i.z.number()}),gf=i.z.object({lower:i.z.bigint(),upper:i.z.bigint()});i.z.union([yf,Jr]);i.z.union([gf,Jr]);i.z.enum([...Oo.options,...Io.options]);i.z.union([Oo,Io,i.z.instanceof(String)]);const Et=r=>typeof r=="bigint"||r instanceof BigInt,Nn=(r,e)=>Et(r)?r.valueOf()-BigInt(e.valueOf().valueOf()):r.valueOf()-Number(e.valueOf()),pf=(r,e)=>Et(r)?r.valueOf()+BigInt(e.valueOf().valueOf()):r+Number(e.valueOf()),ji=(r,e)=>Et(r)?r===BigInt(e.valueOf().valueOf()):r===Number(e.valueOf()),wf=(r,e)=>Et(r)?r.valueOf()<BigInt(e.valueOf())?r:BigInt(e.valueOf()):r.valueOf()<Number(e.valueOf())?r:Number(e.valueOf()),mf=r=>Et(r)||r instanceof BigInt?r.valueOf()<0n?-r:r:r.valueOf()<0?-r:r,at=(r,e)=>Et(r)?r.valueOf()*BigInt(e.valueOf()):r.valueOf()*Number(e.valueOf()),J=(r,e)=>{const t={};if(typeof r=="number"||typeof r=="bigint")e!=null?(t.lower=r,t.upper=e):(t.lower=typeof r=="bigint"?0n:0,t.upper=r);else if(Array.isArray(r)){if(r.length!==2)throw new Error("bounds: expected array of length 2");[t.lower,t.upper]=r}else return Li(r);return Li(t)},Li=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r,_i=(r,e)=>{const t=J(r);return e<t.lower?t.lower:e>=t.upper?t.upper-(typeof t.upper=="number"?1:1n):e},$r=(r,e)=>{const t=J(r);if(typeof e=="number"||typeof e=="bigint")return e>=t.lower&&e<t.upper;const n=J(e);return n.lower>=t.lower&&n.upper<=t.upper},bf=r=>({lower:Math.min(...r.map(e=>J(e).lower)),upper:Math.max(...r.map(e=>J(e).upper))}),vf=(r,e,t)=>{const n=r.map(c=>J(c)),s=t>0?1:t<0?-1:0;if(s===0)return e;let a=t,o=e;for(;ji(a,0)===!1;){const c=n.findIndex(h=>s>0?o>=h.lower&&o<h.upper:o>h.lower&&o<=h.upper);if(c!==-1){const h=n[c];let d;if(s>0?d=Nn(h.upper,o):d=Nn(o,h.lower),d>0){const f=wf(mf(a),d);if(o=pf(o,s>0?f:-f),a=Nn(a,s>0?f:-f),ji(a,0))return o;continue}}if(s>0){const h=n.filter(d=>d.lower>o);if(h.length>0)o=h[0].lower;else return o}else{const h=n.filter(d=>d.upper<o);if(h.length>0)o=h[h.length-1].upper;else return o}}return o},Tf=(r,e,t)=>{const n=r.map(o=>J(o));if(e===t)return typeof e=="bigint"?0n:0;const s=e<t?J([e,t]):J([t,e]);let a=typeof e=="bigint"?0n:0;for(const o of n){const c=o.lower>s.lower?o.lower:s.lower,h=o.upper<s.upper?o.upper:s.upper;if(c<h){const d=h-c;a=a+d}}return a};i.z.object({x:Eo.or(Mi),y:zo.or(Mi)});const Of=i.z.object({x:Eo,y:zo}),Sf=Object.freeze({x:"left",y:"top"}),Ef=(r,e)=>r.x===e.x&&r.y===e.y,Zi=i.z.union([i.z.number(),Zr,Jr,To,nf,cf]),zf=(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}},qi=Object.freeze({x:0,y:0}),xr=i.z.union([i.z.number(),i.z.string()]);i.z.object({top:xr,left:xr,width:xr,height:xr});i.z.object({left:i.z.number(),top:i.z.number(),right:i.z.number(),bottom:i.z.number()});i.z.object({one:Zr,two:Zr,root:Of});const Bs=(r,e,t=0,n=0,s)=>{const a={one:{...qi},two:{...qi},root:s??Sf};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return a.one={x:r,y:e},a.two={x:a.one.x+t,y:a.one.y+n},a}return"one"in r&&"two"in r&&"root"in r?{...r,root:s??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(a.one={x:r.left,y:r.top},a.two={x:r.right,y:r.bottom},a):(a.one=r,e==null?a.two={x:a.one.x+t,y:a.one.y+n}:typeof e=="number"?a.two={x:a.one.x+e,y:a.one.y+t}:"width"in e?a.two={x:a.one.x+e.width,y:a.one.y+e.height}:"signedWidth"in e?a.two={x:a.one.x+e.signedWidth,y:a.one.y+e.signedHeight}:a.two=e,a))},In=r=>{const e=Bs(r);return{lower:e.one.x,upper:e.two.x}},$n=r=>{const e=Bs(r);return{lower:e.one.y,upper:e.two.y}},Nf=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,If=i.z.object({signedWidth:i.z.number(),signedHeight:i.z.number()});i.z.union([To,If,Zr,Jr]);var $f=Object.defineProperty,xf=(r,e,t)=>e in r?$f(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xe=(r,e,t)=>xf(r,typeof e!="symbol"?e+"":e,t);const kf=(r,e,t)=>e!==void 0&&r<e?e:t!==void 0&&r>t?t:r;i.z.object({offset:Zi,scale:Zi});i.z.object({offset:i.z.number(),scale:i.z.number()});const Af=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],Uf=r=>(e,t,n,s)=>[e,s?n/r:n*r],Cf=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:o,upper:c}=r,h=a-s,d=c-o;if(t==="dimension")return[r,n*(d/h)];const f=(n-s)*(d/h)+o;return[r,f]},Rf=r=>(e,t,n)=>[r,n],Bf=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:s}=r;return[r,s-(t-n)]},Pf=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=kf(n,s,a),[e,n]},os=class qt{constructor(){xe(this,"ops",[]),xe(this,"currBounds",null),xe(this,"currType",null),xe(this,"reversed",!1),this.ops=[]}static translate(e){return new qt().translate(e)}static magnify(e){return new qt().magnify(e)}static scale(e,t){return new qt().scale(e,t)}translate(e){const t=this.new(),n=Af(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Uf(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=J(e,t),s=this.new(),a=Cf(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=J(e,t),s=this.new(),a=Pf(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=J(e,t),s=this.new(),a=Rf(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=Bf();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 qt;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,s],a)=>a(n,e,s,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,s)=>{if(n.type==="scale"||t.some(([o,c])=>s>=o&&s<=c))return;const a=e.ops.findIndex((o,c)=>o.type==="scale"&&c>s);a!==-1&&t.push([s,a])}),t.forEach(([n,s])=>{const a=e.ops.slice(n,s);a.unshift(e.ops[s]),e.ops.splice(n,s-n+1,...a)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};xe(os,"IDENTITY",new os);let Fi=os;const Yi=class Ie{constructor(e=new Fi,t=new Fi,n=null){xe(this,"x"),xe(this,"y"),xe(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new Ie().translate(e,t)}static translateX(e){return new Ie().translateX(e)}static translateY(e){return new Ie().translateY(e)}static clamp(e){return new Ie().clamp(e)}static magnify(e){return new Ie().magnify(e)}static scale(e){return new Ie().scale(e)}static reBound(e){return new Ie().reBound(e)}translate(e,t){const n=zf(e,t),s=this.copy();return s.x=this.x.translate(n.x),s.y=this.y.translate(n.y),s}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(Nf(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Ef(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(In(e)),t.y=t.y.scale($n(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(In(e)),t.y=this.y.reBound($n(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(In(e)),t.y=this.y.clamp($n(e)),t}copy(){const e=new Ie;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 Bs(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})}}};xe(Yi,"IDENTITY",new Yi);var Df=Object.defineProperty,Mf=(r,e,t)=>e in r?Df(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,y=(r,e,t)=>Mf(r,typeof e!="symbol"?e+"":e,t);let jf=(r,e=21)=>(t=e)=>{let n="",s=t|0;for(;s--;)n+=r[Math.random()*r.length|0];return n};const Lf="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",_f=jf(Lf,11),$o=()=>_f(),Zf=Object.freeze(Object.defineProperty({__proto__:null,create:$o},Symbol.toStringTag,{value:"Module"})),qf=i.z.enum(["static","dynamic"]),xo=(r,e)=>{const t=new z(e);if(![O.DAY,O.HOUR,O.MINUTE,O.SECOND,O.MILLISECOND,O.MICROSECOND,O.NANOSECOND].some(s=>s.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 z?new z(n):new O(n)},B=class T{constructor(e,t="UTC"){if(y(this,"value"),y(this,"encodeValue",!0),e==null)this.value=T.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*T.MILLISECOND.valueOf();else if(typeof e=="string")this.value=T.parseDateTimeString(e,t).valueOf();else if(Array.isArray(e))this.value=T.parseDate(e);else{let n=BigInt(0);e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=T.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=T.MAX:e=T.MIN)),this.value=BigInt(e.valueOf())+n}}static parseDate([e=1970,t=1,n=1]){const s=new Date(e,t-1,n,0,0,0,0);return new T(BigInt(s.getTime())*T.MILLISECOND.valueOf()).truncate(T.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[n,s,a]=e.split(":");let o="00",c="00";a!=null&&([o,c]=a.split("."));let h=T.hours(parseInt(n??"00")).add(T.minutes(parseInt(s??"00"))).add(T.seconds(parseInt(o??"00"))).add(T.milliseconds(parseInt(c??"00")));return t==="local"&&(h=h.add(T.utcOffset)),h.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return T.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new T(BigInt(n.getTime())*T.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(T.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 O(BigInt(new Date().getTimezoneOffset())*T.MINUTE.valueOf())}static since(e){return new T().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new T(e).valueOf()}span(e){return this.range(e).span}range(e){return new q(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 T(e).valueOf()}afterEq(e){return this.valueOf()>=new T(e).valueOf()}before(e){return this.valueOf()<new T(e).valueOf()}beforeEq(e){return this.valueOf()<=new T(e).valueOf()}add(e){return new T(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new T(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(O.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(O.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(O.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(O.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(T.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(T.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getFullYear()}setYear(e){const t=this.date();return t.setFullYear(e),new T(t)}get month(){return this.date().getUTCMonth()}setMonth(e){const t=this.date();return t.setUTCMonth(e),new T(t)}get day(){return this.date().getUTCDate()}setDay(e){const t=this.date();return t.setUTCDate(e),new T(t)}get hour(){return this.date().getUTCHours()}setHour(e){const t=this.date();return t.setUTCHours(e),new T(t,"UTC")}get minute(){return this.date().getMinutes()}setMinute(e){const t=this.date();return t.setUTCMinutes(e),new T(t)}get second(){return this.date().getSeconds()}setSecond(e){const t=this.date();return t.setUTCSeconds(e),new T(t)}get millisecond(){return this.date().getMilliseconds()}setMillisecond(e){const t=this.date();return t.setMilliseconds(e),new T(t)}toString(){return this.date().toISOString()}remainder(e){return xo(this,e)}get isToday(){return this.truncate(O.DAY).equals(T.now().truncate(O.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new T(new Date)}static max(...e){let t=T.MIN;for(const n of e){const s=new T(n);s.after(t)&&(t=s)}return t}static min(...e){let t=T.MAX;for(const n of e){const s=new T(n);s.before(t)&&(t=s)}return t}static nanoseconds(e,t="UTC"){return new T(e,t)}static microseconds(e,t="UTC"){return T.nanoseconds(e*1e3,t)}static milliseconds(e,t="UTC"){return T.microseconds(e*1e3,t)}static seconds(e,t="UTC"){return T.milliseconds(e*1e3,t)}static minutes(e,t="UTC"){return T.seconds(e*60,t)}static hours(e,t="UTC"){return T.minutes(e*60,t)}static days(e,t="UTC"){return T.hours(e*24,t)}};y(B,"NANOSECOND",B.nanoseconds(1)),y(B,"MICROSECOND",B.microseconds(1)),y(B,"MILLISECOND",B.milliseconds(1)),y(B,"SECOND",B.seconds(1)),y(B,"MINUTE",B.minutes(1)),y(B,"HOUR",B.hours(1)),y(B,"DAY",B.days(1)),y(B,"MAX",new B((1n<<63n)-1n)),y(B,"MIN",new B(0)),y(B,"ZERO",new B(0)),y(B,"z",i.z.union([i.z.object({value:i.z.bigint()}).transform(r=>new B(r.value)),i.z.string().transform(r=>new B(BigInt(r))),i.z.instanceof(Number).transform(r=>new B(r)),i.z.number().transform(r=>new B(r)),i.z.instanceof(B)]));let z=B;const P=class ${constructor(e){y(this,"value"),y(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}static fromSeconds(e){return e instanceof $?e:e instanceof cs?e.period:e instanceof z?new $(e):["number","bigint"].includes(typeof e)?$.seconds(e):new $(e)}static fromMilliseconds(e){return e instanceof $?e:e instanceof cs?e.period:e instanceof z?new $(e):["number","bigint"].includes(typeof e)?$.milliseconds(e):new $(e)}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(e){return this.valueOf()<new $(e).valueOf()}greaterThan(e){return this.valueOf()>new $(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new $(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new $(e).valueOf()}remainder(e){return xo(this,e)}truncate(e){return new $(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate($.DAY),t=this.truncate($.HOUR),n=this.truncate($.MINUTE),s=this.truncate($.SECOND),a=this.truncate($.MILLISECOND),o=this.truncate($.MICROSECOND),c=this.truncate($.NANOSECOND),h=e,d=t.sub(e),f=n.sub(t),u=s.sub(n),N=a.sub(s),S=o.sub(a),j=c.sub(o);let U="";return h.isZero||(U+=`${h.days}d `),d.isZero||(U+=`${d.hours}h `),f.isZero||(U+=`${f.minutes}m `),u.isZero||(U+=`${u.seconds}s `),N.isZero||(U+=`${N.milliseconds}ms `),S.isZero||(U+=`${S.microseconds}µs `),j.isZero||(U+=`${j.nanoseconds}ns`),U.trim()}mult(e){return new $(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number($.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number($.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number($.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number($.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number($.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number($.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new $(e).valueOf()}add(e){return new $(this.valueOf()+new $(e).valueOf())}sub(e){return new $(this.valueOf()-new $(e).valueOf())}static nanoseconds(e=1){return new $(e)}static microseconds(e=1){return $.nanoseconds(at(e,1e3))}static milliseconds(e=1){return $.microseconds(at(e,1e3))}static seconds(e=1){return $.milliseconds(at(e,1e3))}static minutes(e=1){return $.seconds(at(e,60))}static hours(e){return $.minutes(at(e,60))}static days(e){return $.hours(at(e,24))}};y(P,"NANOSECOND",P.nanoseconds(1)),y(P,"MICROSECOND",P.microseconds(1)),y(P,"MILLISECOND",P.milliseconds(1)),y(P,"SECOND",P.seconds(1)),y(P,"MINUTE",P.minutes(1)),y(P,"HOUR",P.hours(1)),y(P,"DAY",P.days(1)),y(P,"MAX",new P((1n<<63n)-1n)),y(P,"MIN",new P(0)),y(P,"ZERO",new P(0)),y(P,"z",i.z.union([i.z.object({value:i.z.bigint()}).transform(r=>new P(r.value)),i.z.string().transform(r=>new P(BigInt(r))),i.z.instanceof(Number).transform(r=>new P(r)),i.z.number().transform(r=>new P(r)),i.z.instanceof(P)]));let O=P;const Ft=class Pr extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Pr(e).valueOf()}get period(){return O.seconds(1/this.valueOf())}sampleCount(e){return new O(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new ne(t).valueOf()}span(e){return O.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Pr(e)}static khz(e){return Pr.hz(e*1e3)}};y(Ft,"z",i.z.union([i.z.number().transform(r=>new Ft(r)),i.z.instanceof(Number).transform(r=>new Ft(r)),i.z.instanceof(Ft)]));let cs=Ft;const K=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new vt(e*this.valueOf())}};y(K,"UNKNOWN",new K(0)),y(K,"BIT128",new K(16)),y(K,"BIT64",new K(8)),y(K,"BIT32",new K(4)),y(K,"BIT16",new K(2)),y(K,"BIT8",new K(1)),y(K,"z",i.z.union([i.z.number().transform(r=>new K(r)),i.z.instanceof(Number).transform(r=>new K(r)),i.z.instanceof(K)]));let ne=K;const ge=class Yt{constructor(e,t){y(this,"start"),y(this,"end"),typeof e=="object"&&"start"in e?(this.start=new z(e.start),this.end=new z(e.end)):(this.start=new z(e),this.end=new z(t))}get span(){return new O(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 Yt(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,t=O.ZERO){if(t.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let n=this.start.sub(e.start).valueOf(),s=this.end.sub(e.end).valueOf();return n<0&&(n=-n),s<0&&(s=-s),n<=t.valueOf()&&s<=t.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,t=O.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 s=z.max(n.start,e.start),a=z.min(n.end,e.end);return a.before(s)?!1:new O(a.sub(s)).greaterThanOrEqual(t)}contains(e){return e instanceof Yt?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new Yt(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 Yt(z.min(...e.map(t=>t.start)),z.max(...e.map(t=>t.end)))}};y(ge,"MAX",new ge(z.MIN,z.MAX)),y(ge,"MIN",new ge(z.MAX,z.MIN)),y(ge,"ZERO",new ge(z.ZERO,z.ZERO)),y(ge,"z",i.z.union([i.z.object({start:z.z,end:z.z}).transform(r=>new ge(r.start,r.end)),i.z.instanceof(ge)]));let q=ge;const Ff=(r,e)=>r.start.before(e.start)?-1:r.start.after(e.start)?1:r.end.before(e.end)?-1:r.end.after(e.end)?1:0,w=class Z{constructor(e){if(y(this,"value"),y(this,"encodeValue",!0),e instanceof Z||typeof e=="string"||typeof e.valueOf()=="string"){this.value=e.valueOf();return}const t=Z.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){this.value=t.valueOf();return}throw this.value=Z.UNKNOWN.valueOf(),new Error(`unable to find data type for ${e.toString()}`)}valueOf(){return this.value}get Array(){const e=Z.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(Z.JSON)||this.equals(Z.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(Z.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=Z.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsigned(){return this.equals(Z.UINT8)||this.equals(Z.UINT16)||this.equals(Z.UINT32)||this.equals(Z.UINT64)}get isSigned(){return this.equals(Z.INT8)||this.equals(Z.INT16)||this.equals(Z.INT32)||this.equals(Z.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsigned&&e.isSigned?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(Z.INT32)&&e.equals(Z.FLOAT64)||this.equals(Z.INT8)&&e.equals(Z.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsigned===e.isUnsigned:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}toJSON(){return this.toString()}get usesBigInt(){return Z.BIG_INT_TYPES.some(e=>e.equals(this))}};y(w,"UNKNOWN",new w("unknown")),y(w,"FLOAT64",new w("float64")),y(w,"FLOAT32",new w("float32")),y(w,"INT64",new w("int64")),y(w,"INT32",new w("int32")),y(w,"INT16",new w("int16")),y(w,"INT8",new w("int8")),y(w,"UINT64",new w("uint64")),y(w,"UINT32",new w("uint32")),y(w,"UINT16",new w("uint16")),y(w,"UINT8",new w("uint8")),y(w,"BOOLEAN",w.UINT8),y(w,"TIMESTAMP",new w("timestamp")),y(w,"UUID",new w("uuid")),y(w,"STRING",new w("string")),y(w,"JSON",new w("json")),y(w,"ARRAY_CONSTRUCTORS",new Map([[w.UINT8.toString(),Uint8Array],[w.UINT16.toString(),Uint16Array],[w.UINT32.toString(),Uint32Array],[w.UINT64.toString(),BigUint64Array],[w.FLOAT32.toString(),Float32Array],[w.FLOAT64.toString(),Float64Array],[w.INT8.toString(),Int8Array],[w.INT16.toString(),Int16Array],[w.INT32.toString(),Int32Array],[w.INT64.toString(),BigInt64Array],[w.TIMESTAMP.toString(),BigInt64Array],[w.STRING.toString(),Uint8Array],[w.JSON.toString(),Uint8Array],[w.UUID.toString(),Uint8Array]])),y(w,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,w.UINT8],[Uint16Array.name,w.UINT16],[Uint32Array.name,w.UINT32],[BigUint64Array.name,w.UINT64],[Float32Array.name,w.FLOAT32],[Float64Array.name,w.FLOAT64],[Int8Array.name,w.INT8],[Int16Array.name,w.INT16],[Int32Array.name,w.INT32],[BigInt64Array.name,w.INT64]])),y(w,"DENSITIES",new Map([[w.UINT8.toString(),ne.BIT8],[w.UINT16.toString(),ne.BIT16],[w.UINT32.toString(),ne.BIT32],[w.UINT64.toString(),ne.BIT64],[w.FLOAT32.toString(),ne.BIT32],[w.FLOAT64.toString(),ne.BIT64],[w.INT8.toString(),ne.BIT8],[w.INT16.toString(),ne.BIT16],[w.INT32.toString(),ne.BIT32],[w.INT64.toString(),ne.BIT64],[w.TIMESTAMP.toString(),ne.BIT64],[w.STRING.toString(),ne.UNKNOWN],[w.JSON.toString(),ne.UNKNOWN],[w.UUID.toString(),ne.BIT128]])),y(w,"ALL",[w.UNKNOWN,w.FLOAT64,w.FLOAT32,w.INT64,w.INT32,w.INT16,w.INT8,w.UINT64,w.UINT32,w.UINT16,w.UINT8,w.TIMESTAMP,w.UUID,w.STRING,w.JSON]),y(w,"BIG_INT_TYPES",[w.INT64,w.UINT64,w.TIMESTAMP]),y(w,"z",i.z.union([i.z.string().transform(r=>new w(r)),i.z.instanceof(w)]));let x=w;const re=class W extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return W.bytes(this.valueOf()+e.valueOf())}sub(e){return W.bytes(this.valueOf()-e.valueOf())}truncate(e){return new W(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return W.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/W.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/W.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/W.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/W.TERABYTE.valueOf()}toString(){const e=this.truncate(W.TERABYTE),t=this.truncate(W.GIGABYTE),n=this.truncate(W.MEGABYTE),s=this.truncate(W.KILOBYTE),a=this.truncate(W.BYTE),o=e,c=t.sub(e),h=n.sub(t),d=s.sub(n),f=a.sub(s);let u="";return o.isZero||(u+=`${o.terabytes}TB `),c.isZero||(u+=`${c.gigabytes}GB `),h.isZero||(u+=`${h.megabytes}MB `),d.isZero||(u+=`${d.kilobytes}KB `),(!f.isZero||u==="")&&(u+=`${f.valueOf()}B`),u.trim()}static bytes(e=1){return new W(e)}static kilobytes(e=1){return W.bytes(e.valueOf()*1e3)}static megabytes(e=1){return W.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return W.megabytes(e.valueOf()*1e3)}static terabytes(e){return W.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};y(re,"BYTE",new re(1)),y(re,"KILOBYTE",re.kilobytes(1)),y(re,"MEGABYTE",re.megabytes(1)),y(re,"GIGABYTE",re.gigabytes(1)),y(re,"TERABYTE",re.terabytes(1)),y(re,"ZERO",new re(0)),y(re,"z",i.z.union([i.z.number().transform(r=>new re(r)),i.z.instanceof(re)]));let vt=re;i.z.union([i.z.instanceof(Uint8Array),i.z.instanceof(Uint16Array),i.z.instanceof(Uint32Array),i.z.instanceof(BigUint64Array),i.z.instanceof(Float32Array),i.z.instanceof(Float64Array),i.z.instanceof(Int8Array),i.z.instanceof(Int16Array),i.z.instanceof(Int32Array),i.z.instanceof(BigInt64Array)]);const ko=r=>{const e=typeof r;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||r instanceof z||r instanceof O||r instanceof Date},Yf=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t.valueOf())-BigInt(n.valueOf()):Wt(t,-n).valueOf(),Wt=(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),Wf=r=>r==null?!1:Array.isArray(r)||r instanceof ArrayBuffer||ArrayBuffer.isView(r)&&!(r instanceof DataView)||r instanceof _e?!0:ko(r),Re=-1,ls={[Symbol.iterator]:()=>ls,next:()=>({done:!0,value:void 0})},Vf=i.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer),Gf=i.z.union([i.z.null(),i.z.undefined()]).transform(()=>new Uint8Array().buffer),hs=10,Ao=(r,e)=>{if(r==="string"&&!e.isVariable)throw new Error(`cannot convert series of type ${e.toString()} to string`);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`)},Vt=class pe{constructor(e){y(this,"key",""),y(this,"isSynnaxSeries",!0),y(this,"dataType"),y(this,"sampleOffset"),y(this,"gl"),y(this,"_data"),y(this,"timeRange",q.ZERO),y(this,"alignment",0n),y(this,"_cachedMin"),y(this,"_cachedMax"),y(this,"writePos",Re),y(this,"_refCount",0),y(this,"_cachedLength"),y(this,"_cachedIndexes"),Wf(e)&&(e={data:e});const{dataType:t,timeRange:n,sampleOffset:s=0,glBufferUsage:a="static",alignment:o=0n,key:c=$o()}=e,h=e.data??[];if(h instanceof pe||typeof h=="object"&&"isSynnaxSeries"in h&&h.isSynnaxSeries===!0){const u=h;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 d=ko(h),f=Array.isArray(h);if(t!=null)this.dataType=new x(t);else{if(h instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(f||d){let u=h;if(!d){if(h.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=h[0]}if(typeof u=="string")this.dataType=x.STRING;else if(typeof u=="number")this.dataType=x.FLOAT64;else if(typeof u=="bigint")this.dataType=x.INT64;else if(typeof u=="boolean")this.dataType=x.BOOLEAN;else if(u instanceof z||u instanceof Date||u instanceof z)this.dataType=x.TIMESTAMP;else if(typeof u=="object")this.dataType=x.JSON;else throw new Error(`cannot infer data type of ${typeof u} when constructing a Series from a JS array`)}else this.dataType=new x(h)}if(!f&&!d)this._data=h;else{let u=d?[h]:h;const N=u[0];(N instanceof z||N instanceof Date||N instanceof O)&&(u=u.map(S=>new z(S).valueOf())),this.dataType.equals(x.STRING)?(this._cachedLength=u.length,this._data=new TextEncoder().encode(`${u.join(`
16
- `)}
17
- `).buffer):this.dataType.equals(x.JSON)?(this._cachedLength=u.length,this._data=new TextEncoder().encode(`${u.map(S=>Xt.encodeString(S)).join(`
18
- `)}
19
- `).buffer):this.dataType.usesBigInt&&typeof N=="number"?this._data=new this.dataType.Array(u.map(S=>BigInt(Math.round(S)))).buffer:!this.dataType.usesBigInt&&typeof N=="bigint"?this._data=new this.dataType.Array(u.map(S=>Number(S))).buffer:this._data=new this.dataType.Array(u).buffer}this.key=c,this.alignment=o,this.sampleOffset=s??0,this.timeRange=n??q.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:a}}static alloc({capacity:e,dataType:t,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const s=new new x(t).Array(e),a=new pe({data:s.buffer,dataType:t,...n});return a.writePos=0,a}static createTimestamps(e,t,n){const s=n.spanRange(t.span(e)),a=new BigInt64Array(e);for(let o=0;o<e;o++)a[o]=BigInt(n.add(t.span(o)).valueOf());return new pe({data:a,dataType:x.TIMESTAMP,timeRange:s})}get refCount(){return this._refCount}static fromStrings(e,t){const n=new TextEncoder().encode(`${e.join(`
33
+ `).buffer):this.dataType.usesBigInt&&typeof g=="number"?this._data=new this.dataType.Array(d.map(p=>BigInt(Math.round(p)))).buffer:!this.dataType.usesBigInt&&typeof g=="bigint"?this._data=new this.dataType.Array(d.map(p=>Number(p))).buffer:this._data=new this.dataType.Array(d).buffer}this.key=o,this.alignment=a,this.sampleOffset=n??0,this.timeRange=i??Ee.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:s}}static alloc({capacity:e,dataType:r,...i}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const n=new new ae(r).Array(e),s=new Fn({data:n.buffer,dataType:r,...i});return s.writePos=0,s}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===Yt)return 0;const r=this.byteCapacity.valueOf()-this.writePos,i=e.subBytes(0,r);return this.writeToUnderlyingData(i),this.writePos+=i.byteLength.valueOf(),this.cachedLength!=null&&(this.cachedLength+=i.length,this.calculateCachedLength()),i.length}writeFixed(e){if(this.writePos===Yt)return 0;const r=this.capacity-this.writePos,i=e.sub(0,r);return this.writeToUnderlyingData(i),this.cachedLength=void 0,this.maybeRecomputeMinMax(i),this.writePos+=i.length,i.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===Yt?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){return this.dataType.isVariable?new TextDecoder().decode(this.underlyingData).split(`
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(`
20
67
  `)}
21
- `);return new pe({data:n,dataType:x.STRING,timeRange:t})}static fromJSON(e,t){const n=new TextEncoder().encode(`${e.map(s=>Xt.encodeString(s)).join(`
68
+ `).buffer):this.dataType.equals(je.JSON)?(this.cachedLength=d.length,this._data=new TextEncoder().encode(`${d.map(p=>Vo.encodeString(p)).join(`
22
69
  `)}
23
- `);return new pe({data:n,dataType:x.JSON,timeRange:t})}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){if(this._refCount<=0){console.warn("attempted to release a series with a negative reference count");return}this._refCount--,this._refCount===0&&this.gl.control!=null&&this.maybeGarbageCollectGLBuffer(this.gl.control)}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===Re)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===Re)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===Re?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.matches(x.STRING,x.UUID))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.underlyingData).split(`
24
- `).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(x.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=x.UUID.density.valueOf(),t=Array(this.length);for(let n=0;n<this.length;n++){const s=this.underlyingData.slice(n*e,(n+1)*e),a=Array.from(new Uint8Array(s.buffer),o=>o.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");t[n]=a}return t}parseJSON(e){if(!this.dataType.equals(x.JSON))throw new Error("cannot parse non-JSON series as JSON");return new TextDecoder().decode(this.underlyingData).split(`
25
- `).slice(0,-1).map(t=>e.parse(Xt.decodeString(t)))}get byteCapacity(){return new vt(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===Re?this.byteCapacity:this.dataType.isVariable?new vt(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===Re?this.data.length: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,s)=>{n===hs&&(e++,t.push(s+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 s=0;s<this.length;s++)n[s]=Yf(this.dataType,e,this.data[s],t);return new pe({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(x.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(){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()),Wt(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(x.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(){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()),Wt(this._cachedMin,this.sampleOffset))}get bounds(){return J(Number(this.min),Number(this.max))}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)}}enrich(){this.max,this.min}get range(){return Wt(this.max,-this.min)}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){if(this.dataType.isVariable)return this.atVariable(e,t??!1);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 Wt(n,this.sampleOffset)}atVariable(e,t){let n=0,s=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[e],s=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]===hs){if(e===0){s=o;break}n=o+1,e--}if(s===0&&(s=this.data.length),n>=s||e>0){if(t)throw new Error(`[series] - no value at index ${e}`);return}}const a=this.data.slice(n,s);return this.dataType.equals(x.STRING)?new TextDecoder().decode(a):Cs(JSON.parse(new TextDecoder().decode(a)))}binarySearch(e){let t=0,n=this.length-1;const s=Xd(e);for(;t<=n;){const a=Math.floor((t+n)/2),o=s(this.at(a,!0),e);if(o===0)return a;o<0?t=a+1:n=a-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(x.FLOAT32)&&!this.dataType.equals(x.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:s}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==s)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Re){s===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const a=this.dataType.density.size(s).valueOf(),o=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,a,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=Re}as(e){return Ao(e,this.dataType),this}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:Qi(this.alignmentBounds.lower),upper:Qi(this.alignmentBounds.upper)},timeRange:(e=this.timeRange)==null?void 0:e.toString(),length:this.length,capacity:this.capacity}}get memInfo(){return{key:this.key,length:this.length,byteLength:this.byteLength,glBuffer:this.gl.buffer!=null}}get alignmentBounds(){return J(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 Hf(this);return this.dataType.equals(x.JSON)?new Kf(e):e}return new Jf(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new Wi(this,e,t??this.length)}subAlignmentIterator(e,t){return new Wi(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 pe({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 s;return e?s=this.data.subarray(t,n):s=this.data.slice(t,n),new pe({data:s,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(e){return new pe({data:this.buffer,dataType:this.dataType,timeRange:q.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){var e,t;let n=`${this.dataType.toString()} ${this.length} [`;if(this.length<=10)n+=Array.from(this).map(s=>s.toString());else{for(let s=0;s<5;s++)n+=`${(e=this.at(s))==null?void 0:e.toString()}`,s<4&&(n+=",");n+="...";for(let s=-5;s<0;s++)n+=(t=this.at(s))==null?void 0:t.toString(),s<-1&&(n+=",")}return n+="]",n}};y(Vt,"crudeZ",i.z.object({timeRange:q.z.optional(),dataType:x.z,alignment:i.z.coerce.bigint().optional(),data:i.z.union([Vf,Gf,i.z.instanceof(ArrayBuffer),i.z.instanceof(Uint8Array)]),glBufferUsage:qf.optional().default("static").optional()})),y(Vt,"z",Vt.crudeZ.transform(r=>new Vt(r)));let _e=Vt,Wi=class{constructor(e,t,n){y(this,"series"),y(this,"end"),y(this,"index"),this.series=e;const s=J(0,e.length);this.end=_i(s,n),this.index=_i(s,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}},Hf=class{constructor(e){if(y(this,"series"),y(this,"index"),y(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,t=this.series.data;for(;this.index<t.length&&t[this.index]!==hs;)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))})}[Symbol.iterator](){return this}};var Vi,Gi;const Uo=class Co{constructor(e){y(this,"wrapped"),y(this,Vi,"JSONSeriesIterator"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:Xt.decodeString(e.value,Co.SCHEMA)}}[(Gi=Symbol.iterator,Vi=Symbol.toStringTag,Gi)](){return this}};y(Uo,"SCHEMA",i.z.record(i.z.string(),i.z.unknown()));let Kf=Uo;var Hi,Ki;class Jf{constructor(e){y(this,"series"),y(this,"index"),y(this,Hi,"SeriesIterator"),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)}}[(Ki=Symbol.iterator,Hi=Symbol.toStringTag,Ki)](){return this}}let Ro=class{constructor(e=[]){if(y(this,"series"),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 Ao(e,this.dataType),this}get dataType(){return this.series.length===0?x.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?q.ZERO:new q(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?J(0n,0n):J(this.series[0].alignmentBounds.lower,this.series[this.series.length-1].alignmentBounds.upper)}push(e){"isSynnaxSeries"in e&&e.isSynnaxSeries?this.series.push(e):this.series.push(...e.series)}get length(){return this.series.reduce((e,t)=>e+t.length,0)}atAlignment(e,t){if(this.series.length===0){if(t)throw new Error(`[series] - no value at alignment ${e}`);return}for(const n of this.series)if($r(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 xn(this,e,t??this.length)}subAlignmentIterator(e,t){if(e>=this.alignmentBounds.upper||t<=this.alignmentBounds.lower)return ls;let n=0;for(let a=0;a<this.series.length;a++){const o=this.series[a];if(e<o.alignment)break;if(e>=o.alignmentBounds.upper)n+=o.length;else if($r(o.alignmentBounds,e)){n+=Number(e-o.alignment);break}}let s=0;for(let a=0;a<this.series.length;a++){const o=this.series[a];if(t<o.alignment)break;if(t>=o.alignmentBounds.upper)s+=o.length;else if($r(o.alignmentBounds,t)){s+=Number(t-o.alignment);break}}return new xn(this,n,s)}subAlignmentSpanIterator(e,t){if(e>=this.alignmentBounds.upper)return ls;let n=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)n+=a.length;else if($r(a.alignmentBounds,e)){n+=Number(e-a.alignment);break}}return new xn(this,n,n+t)}updateGLBuffer(e){this.series.forEach(t=>t.updateGLBuffer(e))}get bounds(){return bf(this.series.map(e=>e.bounds))}get byteLength(){return new vt(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(s=>s.alignmentBounds);return vf(n,e,t)}acquire(){this.series.forEach(e=>e.acquire())}release(){this.series.forEach(e=>e.release())}distance(e,t){const n=this.series.map(s=>s.alignmentBounds);return Tf(n,e,t)}parseJSON(e){if(!this.dataType.equals(x.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 Xf(this.series)}};var Ji,Xi;class Xf{constructor(e){y(this,"series"),y(this,"seriesIndex"),y(this,"internal"),y(this,Ji,"MultiSeriesIterator"),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())}[(Xi=Symbol.iterator,Ji=Symbol.toStringTag,Xi)](){return this}}let xn=class{constructor(e,t,n){y(this,"series"),y(this,"index"),y(this,"end"),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 Qi=r=>{const e=r>>32n,t=r&0xffffffffn;return{domain:e,sample:t}},Qf=(r,e)=>{let t=null;return e===0?r:(...n)=>{t!==null&&(clearTimeout(t),t=null),t=setTimeout(()=>r(...n),e)}},ey=(r,e,t=".")=>{const n=r.split(t);return n.map((s,a)=>{const o=e(s,a,n);return o==null?null:typeof o=="string"?o:o.join(t)}).filter(s=>s!=null).join(t)},ty=(r,e,t={optional:!1,separator:"."})=>{t.separator??(t.separator=".");const{optional:n,getter:s=(c,h)=>c[h]}=t,a=e.split(t.separator);if(a.length===1&&a[0]==="")return r;let o=r;for(const c of a){const h=s(o,c);if(h==null){if(n)return null;throw new Error(`Path ${e} does not exist. ${c} is null`)}o=h}return o};i.z.object({key:i.z.string(),value:i.z.string()});var ry=Object.defineProperty,ny=(r,e,t)=>e in r?ry(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Dr=(r,e,t)=>ny(r,typeof e!="symbol"?e+"":e,t);let sy=class{constructor(e,t){Dr(this,"handlers"),Dr(this,"transform"),Dr(this,"closer"),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,s]=this.transform(e);if(!s)return;t=n}this.handlers.forEach((n,s)=>s(t))}setCloser(e){this.closer=e}async close(){var e;return await((e=this.closer)==null?void 0:e.call(this))}},iy=class{constructor(e){Dr(this,"handlers"),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 He=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:iy,Observer:sy},Symbol.toStringTag,{value:"Module"})),ce=i.z.record(i.z.union([i.z.number(),i.z.string(),i.z.symbol()]),i.z.unknown()),ay=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";ay();const oy=["macOS","Windows","Linux"],cy=["macos","windows","linux"],ly={macos:"macOS",windows:"Windows",linux:"Linux"};i.z.enum(oy).or(i.z.enum(cy).transform(r=>ly[r]));var hy=Object.defineProperty,uy=(r,e,t)=>e in r?hy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gt=(r,e,t)=>uy(r,typeof e!="symbol"?e+"":e,t);const dy=(...r)=>r.map(Bo).join(""),Bo=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),fy=r=>r.endsWith("/")?r.slice(0,-1):r,us=class ds{constructor({host:e,port:t,protocol:n="",pathPrefix:s=""}){Gt(this,"protocol"),Gt(this,"host"),Gt(this,"port"),Gt(this,"path"),this.protocol=n,this.host=e,this.port=t,this.path=Bo(s)}replace(e){return new ds({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new ds({...this,pathPrefix:dy(this.path,e)})}toString(){return fy(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};Gt(us,"UNKNOWN",new us({host:"unknown",port:0}));let yy=us;const gy=-128,py=127,wy=i.z.number().int().min(gy).max(py),my=-32768,by=32767,vy=i.z.number().int().min(my).max(by),Ty=-2147483648,Oy=2147483647,Sy=i.z.number().int().min(Ty).max(Oy),Ey=-9223372036854775808n,zy=9223372036854775807n,Ny=i.z.bigint().min(Ey).max(zy),Iy=255,$y=i.z.number().int().min(0).max(Iy),xy=65535,ky=i.z.number().int().min(0).max(xy),Ay=4294967295,Uy=i.z.number().int().min(0).max(Ay),Cy=18446744073709551615n,Ry=i.z.bigint().min(0n).max(Cy),Po=r=>ey(r,(e,t,n)=>{const s=t===n.length-1,a=!isNaN(parseInt(e)),o=!isNaN(parseInt(n[t+1]));return a&&(e="element"),s||o?e:[e,"shape"]}),ea=(r,e)=>{if(r==null)return null;const t=r[e];return t==null&&typeof r=="object"&&"sourceType"in r?r.sourceType()[e]:t},By=(r,e,t)=>ty(ea(r,"shape"),Po(e),{...t,getter:ea}),Py=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:By,getFieldSchemaPath:Po,int16:vy,int32:Sy,int64:Ny,int8:wy,uint16:ky,uint32:Uy,uint64:Ry,uint8:$y},Symbol.toStringTag,{value:"Module"}));var Dy=Object.defineProperty,My=(r,e,t)=>e in r?Dy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Te=(r,e,t)=>My(r,typeof e!="symbol"?e+"":e,t);const jy=async r=>await new Promise(e=>setTimeout(e,O.fromMilliseconds(r).milliseconds));class Ly{constructor(e){Te(this,"config"),Te(this,"retries"),Te(this,"interval"),this.config={baseInterval:new O((e==null?void 0:e.baseInterval)??O.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)??jy},this.retries=0,this.interval=new O(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 _y=i.z.object({baseInterval:O.z.optional(),maxRetries:i.z.number().optional(),scale:i.z.number().optional()}),Do=Object.freeze(Object.defineProperty({__proto__:null,Breaker:Ly,breakerConfig:_y},Symbol.toStringTag,{value:"Module"})),Zy=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,Ps=i.z.string().regex(Zy),wt=i.z.number().min(0).max(255),qy=i.z.number().min(0).max(1),Mo=i.z.tuple([wt,wt,wt,qy]),jo=i.z.tuple([wt,wt,wt]),Ds=(r,e=1)=>{if(typeof r=="string")return Yy(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}throw new Error(`Invalid color: ${JSON.stringify(r)}`)},Fy=i.z.union([Ps,Mo,jo]).transform(r=>Ds(r)),Yy=(r,e=1)=>{if(!Ps.safeParse(r).success)throw new Error(`Invalid hex color: ${r}`);return r=Wy(r),[kr(r,0),kr(r,2),kr(r,4),r.length===8?kr(r,6)/255:e]},kr=(r,e)=>parseInt(r.slice(e,e+2),16),Wy=r=>r.startsWith("#")?r.slice(1):r,Vy=i.z.union([Ps,Mo,i.z.string(),jo]);Ds("#000000");Ds("#ffffff");const Gy=i.z.object({key:i.z.string(),color:Vy,position:i.z.number(),switched:i.z.boolean().optional()});i.z.array(Gy);const Hy=i.z.object({key:i.z.string(),name:i.z.string(),color:Fy});i.z.object({key:i.z.string(),name:i.z.string(),swatches:i.z.array(Hy)});const Lo=i.z.number().int().min(0).max(255),_o=255,Zo=0,Ky={lower:Zo,upper:_o+1},qo=i.z.object({name:i.z.string(),key:i.z.string()}),nr=r=>i.z.object({subject:qo,resource:r,authority:Lo}),Jy=(...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}),Fo=i.z.object({from:nr(i.z.any()),to:i.z.null()}),Yo=i.z.object({from:i.z.null(),to:nr(i.z.any())}),Xy=i.z.union([Fo,Yo,i.z.object({from:nr(i.z.any()),to:nr(i.z.any())})]),Ke=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:_o,AUTHORITY_BOUNDS:Ky,ZERO_AUTHORITY:Zo,acquireZ:Yo,authorityZ:Lo,filterTransfersByChannelKey:Jy,releaseZ:Fo,stateZ:nr,subjectZ:qo,transferZ:Xy},Symbol.toStringTag,{value:"Module"})),Qy=r=>Object.getOwnPropertySymbols(globalThis).includes(r),eg=(r,e)=>{const t=Symbol.for(r);if(!Qy(t)){const n=e();Object.defineProperty(globalThis,t,{value:n})}return()=>globalThis[t]},tg=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),Xr=r=>{var e;return e=class extends Error{constructor(t,n){super(t,n),Te(this,"discriminator",e.discriminator),Te(this,"type",e.TYPE),Te(this,"matches",e.matches),this.name=e.TYPE}static sub(t){return Xr(`${r}.${t}`)}},Te(e,"discriminator","FreighterError"),Te(e,"TYPE",r),Te(e,"matches",tg(r)),e},Wo=r=>{if(r==null||typeof r!="object")return!1;const e=r;if(e.discriminator!=="FreighterError")return!1;if(!("type"in e))throw new Error(`Freighter error is missing its type property: ${JSON.stringify(e)}`);return!0},ct="unknown",fs="nil";class rg{constructor(){Te(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:fs,data:""};if(Wo(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:ct,data:e.message};if(typeof e=="string")return{type:ct,data:e};try{return{type:ct,data:JSON.stringify(e)}}catch{return{type:ct,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===fs)return null;if(e.type===ct)return new ys(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new ys(e.data)}}const Ms=eg("synnax-error-registry",()=>new rg),ng=({encode:r,decode:e})=>Ms().register({encode:r,decode:e}),sg=r=>Ms().encode(r),ig=r=>r==null?null:Ms().decode(r);class ys extends Xr("unknown"){}const ag=i.z.object({type:i.z.string(),data:i.z.string()});class og extends Xr("canceled"){}const Tt=Object.freeze(Object.defineProperty({__proto__:null,Canceled:og,NONE:fs,UNKNOWN:ct,Unknown:ys,createTyped:Xr,decode:ig,encode:sg,isTyped:Wo,payloadZ:ag,register:ng},Symbol.toStringTag,{value:"Module"}));i.object({jsonrpc:i.string(),id:i.number().optional(),method:i.string().optional(),params:i.unknown().optional(),result:i.unknown().optional()});const gs=i.z.string().regex(/^\d+\.\d+\.\d+$/),ur=(r,e,t={})=>{t.checkMajor??(t.checkMajor=!0),t.checkMinor??(t.checkMinor=!0),t.checkPatch??(t.checkPatch=!0);const n=gs.parse(r),s=gs.parse(e),[a,o,c]=n.split(".").map(Number),[h,d,f]=s.split(".").map(Number);if(t.checkMajor){if(a<h)return En;if(a>h)return zn}if(t.checkMinor){if(o<d)return En;if(o>d)return zn}if(t.checkPatch){if(c<f)return En;if(c>f)return zn}return Kr},cg=(r,e,t={})=>rf(ur(r,e,t)),Vo=(r,e,t={})=>tf(ur(r,e,t)),lg=(r,e,t={})=>ef(ur(r,e,t)),hg=({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}},ug=({name:r,migrations:e,targetSchema:t,defaultVersion:n,def:s})=>{const a=Object.keys(e).sort(ur).pop();if(a==null)return d=>{if(d.version??(d.version=n),d.version!==s.version)return console.log(`${r} version ${d.version} is newer than latest version of ${s.version}.
26
- Returning default instead.
27
- `),s;try{return t!=null?t.parse(d):d}catch(f){return console.log(`${r} failed to parse default. Exiting with default`),console.error(f),s}};const o=Object.keys(e).length;let c=!1;const h=d=>{try{if(o===0||Vo(d.version,a))return console.log(c?`${r} ${d.version} now up to date`:`${r} version ${d.version} is up to date with target version ${s.version}`),d;const f=d.version,u=e[f],N=u(d);return c=!0,h(N)}catch(f){return console.log(`${r} failed to migrate from ${d.version} to ${a}`),console.error(f),s}};return d=>{try{if(d.version==null)if(n!=null)console.log(`${r} version is null. Setting version to default of ${n}`),d.version=n;else return console.log(`${r} version is null and no default version set. Exiting with default`),s;return h(d)}catch(f){return console.log(`${r} failed to parse final result. Exiting with default`),console.error(f),s}}},ta=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:ur,createMigration:hg,migrator:ug,semVerNewer:Vo,semVerOlder:lg,semVerZ:gs,versionsEqual:cg},Symbol.toStringTag,{value:"Module"})),dg=["standard","scientific","engineering"];i.z.enum(dg);const fg=(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]}`},yg=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 s=/\d+/g;r.match(s)&&e.forEach((o,c)=>{if(s.test(o)){const h=e.map((d,f)=>f!==c?d.charAt(0).toLowerCase():d).join("");t.add(h.replace(/-/g,"_")),t.add(h.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"))}});const a=e.map(o=>(o.length>3?o.substring(0,3):o).toLowerCase());return t.add(a.join("").replace(/-/g,"_")),t.add(a.join("_").replace(/-/g,"_")),Array.from(t).filter(o=>o.length>=2&&o.length<=12&&!/^\d/.test(o))},gg=Object.freeze(Object.defineProperty({__proto__:null,createShortIdentifiers:yg,naturalLanguageJoin:fg},Symbol.toStringTag,{value:"Module"}));class Ue extends Tt.createTyped("sy"){}class F extends Ue.sub("validation"){}class ra extends F.sub("field"){constructor(t,n){super(`${t}: ${n}`);l(this,"field");l(this,"message");this.field=t,this.message=n}}class sr extends Ue.sub("auth"){}class ps extends sr.sub("invalid-token"){}class ws extends sr.sub("expired-token"){}class mt extends Ue.sub("unexpected"){constructor(e){super(`
70
+ `).buffer):this.dataType.usesBigInt&&typeof g=="number"?this._data=new this.dataType.Array(d.map(p=>BigInt(Math.round(p)))).buffer:!this.dataType.usesBigInt&&typeof g=="bigint"?this._data=new this.dataType.Array(d.map(p=>Number(p))).buffer:this._data=new this.dataType.Array(d).buffer}this.key=o,this.alignment=a,this.sampleOffset=n??0,this.timeRange=i??Qr.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:s}}static alloc({capacity:e,dataType:r,...i}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const n=new new je(r).Array(e),s=new Vn({data:n.buffer,dataType:r,...i});return s.writePos=0,s}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===Kt)return 0;const r=this.byteCapacity.valueOf()-this.writePos,i=e.subBytes(0,r);return this.writeToUnderlyingData(i),this.writePos+=i.byteLength.valueOf(),this.cachedLength!=null&&(this.cachedLength+=i.length,this.calculateCachedLength()),i.length}writeFixed(e){if(this.writePos===Kt)return 0;const r=this.capacity-this.writePos,i=e.sub(0,r);return this.writeToUnderlyingData(i),this.cachedLength=void 0,this.maybeRecomputeMinMax(i),this.writePos+=i.length,i.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===Kt?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){return this.dataType.isVariable?new TextDecoder().decode(this.underlyingData).split(`
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(`
28
124
  Unexpected error encountered:
29
125
 
30
126
  ${e}
31
127
 
32
128
  Please report this to the Synnax team.
33
- `)}}class ke extends Ue.sub("query"){}class Je extends ke.sub("not_found"){}class Xe extends ke.sub("multiple_results"){}class ms extends Ue.sub("route"){constructor(t,n){super(t);l(this,"path");this.path=n}}class bs extends Ue.sub("control"){}class na extends bs.sub("unauthorized"){}class pg extends Ue.sub("contiguity"){}const wg=r=>{if(!r.type.startsWith(Ue.TYPE))return null;if(r.type.startsWith(F.TYPE)){if(r.type===ra.TYPE){const e=r.data.split(": ");return e.length<2?new F(r.data):new ra(e[0],e[1])}return new F(r.data)}return r.type.startsWith(sr.TYPE)?r.type.startsWith(ps.TYPE)?new ps(r.data):r.type.startsWith(ws.TYPE)?new ws(r.data):new sr(r.data):r.type.startsWith(mt.TYPE)?new mt(r.data):r.type.startsWith(ke.TYPE)?r.type.startsWith(Je.TYPE)?new Je(r.data):r.type.startsWith(Xe.TYPE)?new Xe(r.data):new ke(r.data):r.type.startsWith(bs.TYPE)?r.type.startsWith(na.TYPE)?new na(r.data):new bs(r.data):r.type.startsWith(ms.TYPE)?new ms(r.data,r.data):new mt(r.data)},mg=()=>{throw new Error("Not implemented")};Tt.register({encode:mg,decode:wg});const bg=async(r,e)=>{const[t,n]=await e(r);return n==null?[t,n]:n instanceof Fe?[t,new Fe({message:`Cannot reach cluster at ${n.url.host}:${n.url.port}`,url:n.url})]:[t,n]},zt=i.z.string().uuid(),Qr=i.z.string(),js=i.z.object({key:zt,name:Qr}),vg=r=>{const e=b(r);if(e.length===0)throw new Error("No groups specified");const t=zt.safeParse(e[0]).success;return{single:!Array.isArray(r),variant:t?"keys":"names",normalized:e,actual:r}},Ls="group",X=r=>i.z.union([i.z.union([i.z.null(),i.z.undefined()]).transform(()=>[]),r.array()]),Q=i.z.number(),dr=i.z.string(),fr=i.z.object({name:dr,key:Q,dataType:x.z,leaseholder:i.z.number(),index:Q,isIndex:i.z.boolean(),internal:i.z.boolean(),virtual:i.z.boolean(),alias:i.z.string().optional(),expression:i.z.string().default(""),requires:X(Q)}),Go=fr.extend({key:Q.optional(),leaseholder:i.z.number().optional(),index:Q.optional(),isIndex:i.z.boolean().optional(),internal:i.z.boolean().optional().default(!1),virtual:i.z.boolean().optional().default(!1),expression:i.z.string().optional().default(""),requires:X(Q).optional().default([])}),en="channel",_s="framer",sa=r=>{const e=b(r);return e.length===0?null:typeof e[0]=="number"||!isNaN(parseInt(e[0]))?"key":"name"},ia=(r,e)=>{const t=b(r);if(t.length===e.length)return;const n=sa(r);throw sa===null?new F("[Frame] - channel keys or names must be provided when constructing a frame."):new F(`[Frame] - ${n}s and series must be the same length.
34
- Got ${t.length} ${n}s and ${e.length} series.`)};class V{constructor(e=[],t=[]){l(this,"columns",[]);l(this,"series",[]);if(e instanceof V){this.columns=e.columns,this.series=e.series;return}if(e instanceof Map){e.forEach((s,a)=>this.push(a,...b(s)));return}if(typeof e=="object"&&!Array.isArray(e)){if("keys"in e&&"series"in e){const s=e;s.series??(s.series=[]),s.keys??(s.keys=[]);const a=s.series.map(o=>Ho(o));ia(s.keys,a),s.keys.forEach((o,c)=>this.push(o,a[c]))}else Object.entries(e).forEach(([s,a])=>{const o=parseInt(s);if(!isNaN(o))return this.push(o,...b(a));this.push(s,...b(a))});return}if(Array.isArray(e)||["string","number"].includes(typeof e)){const s=b(t),a=b(e);ia(a,s),s.forEach((o,c)=>this.push(a[c],o));return}throw new F(`[Frame] - invalid frame construction parameters. data parameter ust be a frame
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
+ Got ${r.length} ${i}s and ${e.length} series.`)};class Je{constructor(e=[],r=[]){f(this,"columns",[]);f(this,"series",[]);if(e instanceof Je){this.columns=e.columns,this.series=e.series;return}if(e instanceof Map){e.forEach((n,s)=>this.push(s,...C.toArray(n)));return}if(typeof e=="object"&&!Array.isArray(e)){if("keys"in e&&"series"in e){const n=e;n.series??(n.series=[]),n.keys??(n.keys=[]);const s=n.series.map(a=>QI(a));gh(n.keys,s),n.keys.forEach((a,o)=>this.push(a,s[o]))}else Object.entries(e).forEach(([n,s])=>{const a=parseInt(n);if(!isNaN(a))return this.push(a,...C.toArray(s));this.push(n,...C.toArray(s))});return}if(Array.isArray(e)||["string","number"].includes(typeof e)){const n=C.toArray(r),s=C.toArray(e);gh(s,n),n.forEach((a,o)=>this.push(s[o],a));return}throw new Ce(`[Frame] - invalid frame construction parameters. data parameter ust be a frame
35
131
  payload, a list of lazy series, a lazy array, a map, or a record keyed by channel
36
- 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 mt("colType is not key");return this.columns??[]}get uniqueKeys(){return Di.unique(this.keys)}get names(){if(this.colType==="key")throw new mt("colType is not name");return this.columns??[]}get uniqueNames(){return Di.unique(this.names)}get uniqueColumns(){return this.colType==="key"?this.uniqueKeys:this.uniqueNames}toPayload(){return{series:this.series.map(e=>Ko(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 q.ZERO;const n=z.min(...this.series.map(a=>a.timeRange.start)),s=z.max(...this.series.map(a=>a.timeRange.end));return new q(n,s)}const t=this.get(e);return t==null?q.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 Ro(this.series.filter((t,n)=>this.columns[n]===e))}push(e,...t){if(e instanceof V){if(this.colType!==null&&e.colType!==this.colType)throw new F("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 F("keyVariant must match");if(typeof e!="string"&&this.colType==="name")throw new F("keyVariant must match");this.columns.push(...Array.from({length:t.length},()=>e))}}concat(e){return new V([...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 V;return this.forEach((n,s,a)=>t.push(...e(n,s,a))),t}forEach(e){this.columns.forEach((t,n)=>{const s=this.series[n];e(t,s,n)})}at(e,t=!1){const n={};return this.uniqueColumns.forEach(s=>{n[s]=this.get(s).at(e,t)}),n}filter(e){const t=new V;return this.columns.forEach((n,s)=>{const a=this.series[s];e(n,a,s)&&t.push(n,a)}),t}get byteLength(){return new vt(this.series.reduce((e,t)=>e.add(t.byteLength),vt.ZERO))}get digest(){const e={};return this.keys.forEach((t,n)=>{const s=this.series[n].digest;t in e?e[t].push(s):e[t]=[s]}),e}get length(){return this.series.reduce((e,t)=>e+t.length,0)}toString(){let e=`Frame{
37
- `;return this.uniqueColumns.forEach(t=>{e+=` ${t}: ${this.get(t).series.map(n=>n.toString()).join(",")}
38
- `}),e+="}",e}}const tn=i.z.object({keys:i.z.union([i.z.null().transform(()=>[]),i.z.number().array().optional().default([])]),series:i.z.union([i.z.null().transform(()=>[]),_e.crudeZ.array().optional().default([])])}),Ho=r=>{const{dataType:e,data:t,timeRange:n,alignment:s}=r;return new _e({data:t,dataType:e,timeRange:n,glBufferUsage:"static",alignment:s})},Ko=r=>({timeRange:r.timeRange,dataType:r.dataType,data:new Uint8Array(r.data.buffer),alignment:r.alignment}),Ye=Py.uint32,Zs=i.z.object({key:Ye,variant:i.z.string(),message:i.z.string(),lastReceived:z.z.optional()}),rn=i.z.object({key:Ye,name:i.z.string(),state:Zs.optional()}),Jo=rn.partial({key:!0}),nn="rack",qs=r=>r?Qe.JSON_CODEC.decodeString(r,ce):{},yr=i.z.string(),Fs=i.z.object({key:yr,variant:i.z.string(),details:ce.or(i.z.string().transform(qs))}),gr=i.z.object({key:yr,rack:Ye,name:i.z.string(),make:i.z.string(),model:i.z.string(),location:i.z.string(),configured:i.z.boolean().optional(),properties:ce.or(i.z.string().transform(qs)),state:Fs.optional()}),Xo=gr.extend({properties:i.z.unknown().transform(r=>Qe.JSON_CODEC.encodeString(r))}),sn="device",Se=r=>r?JSON.parse(r):{},We=i.z.union([i.z.string(),i.z.bigint().transform(r=>r.toString()),i.z.number().transform(r=>r.toString())]),Qo=i.z.enum(["info","success","error","warning"]),ir=i.z.object({task:We,variant:Qo,key:i.z.string().optional(),details:ce.or(i.z.string().transform(Se)).or(i.z.array(i.z.unknown())).or(i.z.null())}),pr=i.z.object({key:We,name:i.z.string(),type:i.z.string(),internal:i.z.boolean().optional(),config:ce.or(i.z.string().transform(qs)),state:ir.optional().nullable(),snapshot:i.z.boolean().optional()}),ec=pr.omit({key:!0}).extend({key:We.transform(r=>r.toString()).optional(),config:i.z.unknown().transform(r=>Qe.JSON_CODEC.encodeString(r))}),Ys=i.z.object({task:We,type:i.z.string(),key:i.z.string(),args:ce.or(i.z.string().transform(Se)).or(i.z.array(i.z.unknown())).or(i.z.null()).optional()}),an="task",Tg=r=>Number(BigInt(r)>>32n),et=i.z.string().uuid(),wr=i.z.object({key:et,name:i.z.string().min(1),color:i.z.string()}),Ws="label",ae=i.z.string().uuid(),Vs=i.z.string().min(1),mr=i.z.object({key:ae,name:Vs,timeRange:q.z,color:i.z.string().optional()}),tc=mr.partial({key:!0}),rc=r=>{const e=b(r),t=e.length===0;let n=!1;return t||(n=ae.safeParse(e[0]).success),{single:!Array.isArray(r),variant:n?"keys":"names",normalized:e,actual:r,empty:t}},Gs="range",Hs="range-alias",tt=i.z.string().uuid(),br=i.z.object({key:tt,username:i.z.string().min(1),firstName:i.z.string().default(""),lastName:i.z.string().default(""),rootUser:i.z.boolean().default(!0)}),nc=br.partial({key:!0,firstName:!0,lastName:!0}).omit({rootUser:!0}).extend({password:i.z.string().min(1)}),Ks="user",Nt=i.z.string().uuid(),on=i.z.object({key:Nt,name:i.z.string(),data:ce.or(i.z.string().transform(Se))}),sc=on.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),Js="lineplot",It=i.z.string().uuid(),cn=i.z.object({key:It,name:i.z.string(),data:ce.or(i.z.string().transform(Se))}),ic=cn.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),Xs="log",Ee=i.z.string().uuid(),ln=i.z.object({key:Ee,name:i.z.string(),layout:ce.or(i.z.string().transform(Se))}),hn="workspace",ac=ln.partial({key:!0}).transform(r=>({...r,layout:JSON.stringify(r.layout)})),oc=ln.omit({layout:!0}).extend({layout:i.z.string().transform(Se)}),rt=i.z.string().uuid(),un=i.z.object({key:rt,name:i.z.string(),data:ce.or(i.z.string().transform(Se)),snapshot:i.z.boolean()}),cc=un.partial({key:!0,snapshot:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),Qs=un.extend({data:i.z.string().transform(Se)}),ei="schematic",$t=i.z.string().uuid(),ti=i.z.object({key:$t,name:i.z.string(),data:ce.or(i.z.string().transform(Se))}),lc=ti.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),ri=ti.extend({data:i.z.string().transform(Se)}),ni="table",si="builtin",hc="cluster",uc="node",vr=i.z.enum([Ws,Xs,zs,si,hc,en,uc,Ls,Gs,_s,Hs,Ks,hn,ei,Js,nn,sn,an,Es,ni]),ie=i.z.object({type:vr,key:i.z.string()}),dc=i.z.string().transform(r=>{const[e,t]=r.split(":");return{type:vr.parse(e),key:t??""}}),ht=i.z.union([dc,ie]),dt=class dt{constructor(e){l(this,"type");l(this,"key");if(e instanceof dt){this.type=e.type,this.key=e.key;return}if(typeof e=="string"){const[t,n]=e.split(":");this.type=t,this.key=n??"";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}}};l(dt,"z",i.z.union([i.z.instanceof(dt),ht.transform(e=>new dt(e))]));let E=dt;const Og=new E({type:si,key:"root"}),fc=i.z.object({type:i.z.number()}),yc=i.z.object({type:vr,fields:i.z.record(i.z.string(),fc)}),gc=i.z.object({id:E.z,name:i.z.string(),schema:yc.optional().nullable(),data:ce.optional().nullable()}).transform(r=>({key:r.id.toString(),...r})),Sg="to",Eg="from",zg=i.z.object({from:E.z,type:i.z.string(),to:E.z}),vs=r=>{const[e,t,n]=r.split("->");return{from:new E(e),type:t,to:new E(n)}};class ii{constructor(e,t){l(this,"key");l(this,"name");this.key=t,this.name=e}get ontologyID(){return pc(this.key)}}const pc=r=>new E({type:Ls,key:r}),Ng=i.z.object({group:js}),Ig=i.z.object({parent:ie,key:zt.optional(),name:Qr}),$g=i.z.object({key:zt,name:Qr}),xg=i.z.object({keys:i.z.array(zt)});var he;let kg=(he=class{constructor(e){l(this,"client");this.client=e}async create(e,t,n){return(await m(this.client,he.CREATE_ENDPOINT,{parent:e,name:t,key:n},Ig,Ng)).group}async rename(e,t){await m(this.client,he.RENAME_ENDPOINT,{key:e,name:t},$g,i.z.object({}))}async delete(e){await m(this.client,he.DELETE_ENDPOINT,{keys:e},xg,i.z.object({}))}},l(he,"CREATE_ENDPOINT","/ontology/create-group"),l(he,"RENAME_ENDPOINT","/ontology/rename-group"),l(he,"DELETE_ENDPOINT","/ontology/delete-group"),he),wc=class{constructor(e){l(this,"creator");this.creator=new kg(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 ii(e.name,e.key)}};const Ag=Object.freeze(Object.defineProperty({__proto__:null,Client:wc,Group:ii,ONTOLOGY_TYPE:Ls,analyzeParams:vg,groupZ:js,keyZ:zt,nameZ:Qr,ontologyID:pc},Symbol.toStringTag,{value:"Module"})),Ug="/ontology/add-children",Cg="/ontology/remove-children",Rg="/ontology/move-children",aa=i.z.object({id:ie,children:ie.array()}),Bg=i.z.object({from:ie,to:ie,children:ie.array()}),kn=i.z.object({});let Pg=class{constructor(e){l(this,"client");this.client=e}async addChildren(e,...t){await m(this.client,Ug,{id:new E(e).payload,children:t.map(n=>new E(n).payload)},aa,kn)}async removeChildren(e,...t){await m(this.client,Cg,{id:new E(e).payload,children:t.map(n=>new E(n).payload)},aa,kn)}async moveChildren(e,t,...n){const s={from:new E(e).payload,to:new E(t).payload,children:n.map(a=>new E(a).payload)};await m(this.client,Rg,s,Bg,kn)}};const Dg="/ontology/retrieve",Mg=i.z.object({ids:ie.array().optional(),children:i.z.boolean().optional(),parents:i.z.boolean().optional(),includeSchema:i.z.boolean().optional(),excludeFieldData:i.z.boolean().optional(),term:i.z.string().optional(),limit:i.z.number().optional(),offset:i.z.number().optional(),types:vr.array().optional()}),jg=i.z.object({resources:gc.array()}),Mr=r=>b(r).map(e=>new E(e).payload);let mc=class{constructor(e,t){l(this,"type","ontology");l(this,"groups");l(this,"client");l(this,"writer");l(this,"framer");this.client=e,this.writer=new Pg(e),this.groups=new wc(e),this.framer=t}async search(e,t){return await this.execRetrieve({term:e,...t})}async retrieve(e,t){const n=await this.execRetrieve({ids:Mr(e),...t});if(Array.isArray(e))return n;if(n.length===0)throw new ke(`No resource found with ID ${gg.naturalLanguageJoin(b(e).map(s=>new E(s).toString()))}`);return n[0]}async page(e,t,n){return await this.execRetrieve({offset:e,limit:t,...n})}async retrieveChildren(e,t){return await this.execRetrieve({ids:Mr(e),children:!0,...t})}async retrieveParents(e,t){return await this.execRetrieve({ids:Mr(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 openChangeTracker(){return await Tr.open(this.framer,this)}async openDependentTracker(e){return await dn.open(e,this.framer,this)}newSearcherWithOptions(e){return{type:this.type,search:t=>this.search(t,e),retrieve:t=>this.retrieve(t,e),page:(t,n)=>this.page(t,n,e)}}async execRetrieve(e){const{resources:t}=await m(this.client,Dg,e,Mg,jg);return t}};const oa="sy_ontology_resource_set",ca="sy_ontology_resource_delete",la="sy_ontology_relationship_set",ha="sy_ontology_relationship_delete";class Tr{constructor(e,t){l(this,"relationships");l(this,"resources");l(this,"resourceObs");l(this,"relationshipObs");l(this,"streamer");l(this,"client");l(this,"closePromise");this.relationshipObs=new He.Observer,this.relationships=this.relationshipObs,this.resourceObs=new He.Observer,this.resources=this.resourceObs,this.client=t,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 t=await this.parseResourceSets(e),n=this.parseResourceDeletes(e);t.concat(n).length>0&&this.resourceObs.notify(t.concat(n));const a=this.parseRelationshipSets(e),o=this.parseRelationshipDeletes(e);a.concat(o).length>0&&this.relationshipObs.notify(a.concat(o))}parseRelationshipSets(e){const t=e.get(la);return t.length===0?[]:Array.from(t.as("string")).map(n=>({variant:"set",key:vs(n),value:void 0}))}parseRelationshipDeletes(e){const t=e.get(ha);return t.length===0?[]:Array.from(t.as("string")).map(n=>({variant:"delete",key:vs(n)}))}async parseResourceSets(e){const t=e.get(oa);if(t.length===0)return[];const n=Array.from(t.as("string")).map(s=>new E(s));try{return(await this.client.retrieve(n)).map(a=>({variant:"set",key:a.id,value:a}))}catch(s){if(s instanceof ke)return[];throw s}}parseResourceDeletes(e){const t=e.get(ca);return t.length===0?[]:Array.from(t.as("string")).map(n=>({variant:"delete",key:new E(n)}))}static async open(e,t){const n=await e.openStreamer([oa,ca,la,ha]);return new Tr(n,t)}}const ua=r=>r==="from"?"to":"from";class dn extends He.Observer{constructor({target:t,dependents:n,relationshipType:s="parent",relationshipDirection:a="from",resourceType:o},c,h){super();l(this,"internal");l(this,"target");l(this,"relDir");l(this,"resourceType");l(this,"dependents");l(this,"client");l(this,"relType");l(this,"handleResourceChange",t=>{this.dependents=this.dependents.map(n=>{const s=t.find(a=>a.key.toString()==n.id.toString());return s==null||s.variant==="delete"?n:s.value}),this.notify(this.dependents)});l(this,"handleRelationshipChange",t=>{const n=t.filter(a=>a.variant==="delete"&&a.key[this.relDir].toString()===this.target.toString()&&(this.resourceType==null||a.key[ua(this.relDir)].type===this.resourceType));this.dependents=this.dependents.filter(a=>!n.some(o=>o.key.to.toString()===a.id.toString()&&o.key.type===this.relType));const s=t.filter(a=>a.variant==="set"&&a.key.type===this.relType&&a.key[this.relDir].toString()===this.target.toString()&&(this.resourceType==null||a.key[ua(this.relDir)].type===this.resourceType));if(s.length===0)return this.notify(this.dependents);this.client.retrieve(s.map(a=>a.key.to)).then(a=>{this.dependents=this.dependents.concat(a),this.notify(this.dependents)}).catch(console.error)});this.resourceType=o,this.internal=c,this.target=t,this.dependents=n,this.resourceType!=null&&(this.dependents=this.dependents.filter(d=>d.id.type===this.resourceType)),this.client=h,this.relType=s,this.relDir=a,this.internal.resources.onChange(this.handleResourceChange),this.internal.relationships.onChange(this.handleRelationshipChange)}static async open(t,n,s){const a=await Tr.open(n,s);return new dn(t,a,s)}async close(){await this.internal.close()}}const Lg=Object.freeze(Object.defineProperty({__proto__:null,BUILTIN_TYPE:si,CLUSTER_TYPE:hc,ChangeTracker:Tr,Client:mc,DependentTracker:dn,FROM_RELATIONSHIP_DIRECTION:Eg,ID:E,NODE_TYPE:uc,ROOT_ID:Og,TO_RELATIONSHIP_DIRECTION:Sg,crudeIDZ:ht,idZ:ie,parseIDs:Mr,parseRelationship:vs,relationshipSchemaZ:zg,resourceTypeZ:vr,resourceZ:gc,schemaFieldZ:fc,schemaZ:yc,stringIDZ:dc},Symbol.toStringTag,{value:"Module"})),Or=i.z.string().uuid(),fn=i.z.object({key:Or,subjects:X(ie),objects:X(ie),actions:X(_r)}),bc=i.z.object({key:Or.optional(),subjects:ht.array().or(ht),objects:ht.array().or(ht),actions:_r.array().or(_r)}),_g=i.z.object({keys:Or.array().optional(),subjects:ie.array().optional()}),Zg=i.z.object({policies:X(fn)}),qg="/access/policy/retrieve";let Fg=class{constructor(e){l(this,"client");this.client=e}async retrieve(e){return(await m(this.client,qg,e,_g,Zg)).policies}};const Yg=i.z.object({policies:fn.partial({key:!0}).array()}),Wg=i.z.object({policies:fn.array()}),Vg=i.z.object({keys:Or.array()}),Gg=i.z.object({}),Hg="/access/policy/create",Kg="/access/policy/delete";let Jg=class{constructor(e){l(this,"client");this.client=e}async create(e){const n=bc.array().parse(b(e)).map(a=>({objects:b(a.objects),actions:b(a.actions),subjects:b(a.subjects)}));return(await m(this.client,Hg,{policies:n},Yg,Wg)).policies}async delete(e){await m(this.client,Kg,{keys:b(e)},Vg,Gg)}},vc=class{constructor(e){l(this,"retriever");l(this,"writer");this.retriever=new Fg(e),this.writer=new Jg(e)}async create(e){const t=Array.isArray(e),n=await this.writer.create(e);return t?n:n[0]}async retrieve(e){const t=Array.isArray(e),n=await this.retriever.retrieve({keys:b(e)});return t?n:n[0]}async retrieveFor(e){const t=b(e).map(n=>new E(n).payload);return await this.retriever.retrieve({subjects:t})}async delete(e){await this.writer.delete(e)}};const Xg=r=>new E({type:Es,key:r}),Qg=new E({type:zs,key:""}),ep=Object.freeze(Object.defineProperty({__proto__:null,ALLOW_ALL_ONTOLOGY_ID:Qg,ALLOW_ALL_ONTOLOGY_TYPE:zs,Client:vc,ONTOLOGY_TYPE:Es,keyZ:Or,newZ:bc,ontologyID:Xg,policyZ:fn},Symbol.toStringTag,{value:"Module"}));let Tc=class{constructor(e){l(this,"policy");this.policy=new vc(e)}};const tp=Object.freeze(Object.defineProperty({__proto__:null,ALL_ACTION:ro,CREATE_ACTION:no,Client:Tc,DELETE_ACTION:so,RETRIEVE_ACTION:io,UPDATE_ACTION:ao,actionZ:_r},Symbol.toStringTag,{value:"Module"})),rp=new Error("request for lock canceled");var np=function(r,e,t,n){function s(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function c(f){try{d(n.next(f))}catch(u){o(u)}}function h(f){try{d(n.throw(f))}catch(u){o(u)}}function d(f){f.done?a(f.value):s(f.value).then(c,h)}d((n=n.apply(r,e||[])).next())})};class sp{constructor(e,t=rp){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,s)=>{const a={resolve:n,reject:s,weight:e,priority:t},o=Oc(this._queue,c=>t<=c.priority);o===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(o+1,0,a)})}runExclusive(e){return np(this,arguments,void 0,function*(t,n=1,s=0){const[a,o]=yield this.acquire(n,s);try{return yield t(a)}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]=[]),ip(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 s=n.findIndex(a=>a.priority<=e);(s===-1?n:n.splice(0,s)).forEach(a=>a.resolve())}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}}function ip(r,e){const t=Oc(r,n=>e.priority<=n.priority);r.splice(t+1,0,e)}function Oc(r,e){for(let t=r.length-1;t>=0;t--)if(e(r[t]))return t;return-1}var ap=function(r,e,t,n){function s(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function c(f){try{d(n.next(f))}catch(u){o(u)}}function h(f){try{d(n.throw(f))}catch(u){o(u)}}function d(f){f.done?a(f.value):s(f.value).then(c,h)}d((n=n.apply(r,e||[])).next())})};class op{constructor(e){this._semaphore=new sp(1,e)}acquire(){return ap(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 ai=(r,e,{convertNumericStrings:t=!0}={})=>{const n=!Array.isArray(r);let s=b(r);const a=s[0],o=typeof a;let c;return o==="string"&&t&&!isNaN(parseInt(a))&&"number"in e?(c=e.number,s=s.map(h=>parseInt(h))):c=e[o],{single:n,variant:c,normalized:s,actual:r}},yn=(r,e,t,n)=>{if(n){if(t.length===0)throw new Je(`${r} not found matching ${JSON.stringify(e)}`);if(t.length>1)throw new Xe(`Expected one ${r} matching ${JSON.stringify(e)}, but found ${t.length}`)}},cp=i.z.object({leaseholder:i.z.number().optional(),keys:Q.array().optional(),names:i.z.string().array().optional(),search:i.z.string().optional(),rangeKey:i.z.string().optional(),limit:i.z.number().optional(),offset:i.z.number().optional(),dataTypes:x.z.array().optional(),notDataTypes:x.z.array().optional(),virtual:i.z.boolean().optional(),isIndex:i.z.boolean().optional(),internal:i.z.boolean().optional()}),lp=i.z.object({channels:X(fr)}),Oe=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]),ai(r,{number:"keys",string:"names"})),Yr=class Yr{constructor(e){l(this,"client");this.client=e}async search(e,t){return await this.execute({search:e,...t})}async retrieve(e,t){const n=Oe(e),{variant:s}=n;let{normalized:a}=n;return s==="keys"&&a.indexOf(0)!==-1&&(a=a.filter(o=>o!==0)),a.length===0?[]:await this.execute({[s]:a,...t})}async page(e,t,n){return await this.execute({offset:e,limit:t,...n})}async execute(e){const[t,n]=await this.client.send(Yr.ENDPOINT,e,cp,lp);if(n!=null)throw n;return t.channels}};l(Yr,"ENDPOINT","/channel/retrieve");let ar=Yr;class oi{constructor(e){l(this,"cache");l(this,"namesToKeys");l(this,"wrapped");this.cache=new Map,this.namesToKeys=new Map,this.wrapped=e}async search(e,t){return await this.wrapped.search(e,t)}async page(e,t,n){return await this.wrapped.page(e,t,n)}async retrieve(e,t){const{normalized:n}=Oe(e),s=[],a=[];if(n.forEach(c=>{const h=this.get(c);h!=null?s.push(...h):a.push(c)}),a.length===0)return s;const o=await this.wrapped.retrieve(a,t);return this.set(o),s.concat(o)}delete(e){const{variant:t,normalized:n}=Oe(e);t==="names"?n.forEach(s=>{const a=this.namesToKeys.get(s);a!=null&&(a.forEach(o=>this.cache.delete(o)),this.namesToKeys.delete(s))}):n.forEach(s=>{const a=this.cache.get(s);a!=null&&(this.cache.delete(s),this.namesToKeys.delete(a.name))})}rename(e,t){e.forEach((n,s)=>{const a=t[s],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=a,this.cache.set(n,o);const h=this.namesToKeys.get(a);h==null?this.namesToKeys.set(a,new Set([n])):h.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 s=this.cache.get(e);return s==null?void 0:[s]}const t=this.namesToKeys.get(e);if(t==null)return;const n=[];if(t.forEach(s=>{const a=this.cache.get(s);a!=null&&n.push(a)}),n.length!==0)return n}}class Sc{constructor(e,t){l(this,"mu",new op);l(this,"requests",new Map);l(this,"wrapped");l(this,"debouncedRun");this.wrapped=e,this.debouncedRun=Qf(()=>{this.run()},t)}async search(e,t){return await this.wrapped.search(e,t)}async page(e,t,n){return await this.wrapped.page(e,t,n)}async retrieve(e){const{normalized:t,variant:n}=Oe(e);return n==="names"?await this.wrapped.retrieve(t):await new Promise((a,o)=>{this.mu.runExclusive(()=>{this.requests.set(t,{resolve:a,reject:o}),this.debouncedRun()})})}async run(){await this.mu.runExclusive(async()=>{const e=new Set;this.requests.forEach((t,n)=>n.forEach(s=>e.add(s)));try{const t=await this.wrapped.retrieve(Array.from(e));this.requests.forEach((n,s)=>n.resolve(t.filter(a=>s.includes(a.key))))}catch(t){this.requests.forEach(n=>n.reject(t))}finally{this.requests.clear()}})}}const Ec=async(r,e)=>{const{normalized:t}=Oe(e),n=await r.retrieve(t),s=[];if(t.forEach(a=>{n.find(o=>o.name===a||o.key===a)==null&&s.push(a)}),s.length>0)throw new ke(`Could not find channels: ${JSON.stringify(s)}`);return n};class ci{constructor({dataType:e,name:t,leaseholder:n=0,key:s=0,isIndex:a=!1,index:o=0,internal:c=!1,virtual:h=!1,frameClient:d,alias:f,expression:u="",requires:N=[]}){l(this,"_frameClient");l(this,"key");l(this,"name");l(this,"dataType");l(this,"leaseholder");l(this,"index");l(this,"isIndex");l(this,"internal");l(this,"alias");l(this,"virtual");l(this,"expression");l(this,"requires");this.key=s,this.name=t,this.dataType=new x(e),this.leaseholder=n,this.index=o,this.isIndex=a,this.internal=c,this.alias=f,this.virtual=h,this.expression=u,this.requires=N??[],this._frameClient=d??null}get framer(){if(this._frameClient==null)throw new F("cannot read from a channel that has not been created");return this._frameClient}get payload(){return fr.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 or(this.payload)}get ontologyID(){return Ic(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 hp="/channel/retrieve-group",up=i.z.object({}),dp=i.z.object({group:js});let zc=class{constructor(e,t,n,s){l(this,"type",en);l(this,"frameClient");l(this,"client");l(this,"retriever");l(this,"writer");this.frameClient=e,this.retriever=t,this.client=n,this.writer=s}async create(e,t={}){const{retrieveIfNameExists:n=!1}=t,s=!Array.isArray(e);let a=b(e),o=[];if(n){const c=await this.retriever.retrieve(a.map(d=>d.name)),h=new Set(c.map(d=>d.name));a=a.filter(d=>!h.has(d.name)),o=this.sugar(c)}return o=o.concat(this.sugar(await this.writer.create(a))),s?o[0]:o}async retrieve(e,t){const n=!Array.isArray(e),s=this.sugar(await this.retriever.retrieve(e,t));return yn("channel",e,s,n),n?s[0]:s}async search(e,t){return this.sugar(await this.retriever.search(e,t))}async delete(e){const{normalized:t,variant:n}=Oe(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(b(e),b(t))}newSearcherWithOptions(e){return{type:this.type,search:async t=>await this.search(t,e),retrieve:async t=>await this.retrieve(t,e),page:async(t,n)=>await this.page(t,n,e)}}async page(e,t,n){return this.sugar(await this.retriever.page(e,t,n))}createDebouncedBatchRetriever(e=10){return new oi(new Sc(new ar(this.client),e))}sugar(e){const{frameClient:t}=this;return e.map(n=>new ci({...n,frameClient:t}))}async retrieveGroup(){const e=await m(this.client,hp,{},up,dp);return new ii(e.group.name,e.group.key)}};const or=({virtual:r,expression:e})=>r&&e!=="",Nc=async(r,e)=>{if(!or(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(or(n)){const s=await Nc(r,n);if(s!=null)return s}}return null},Ic=r=>new E({type:en,key:r.toString()}),fp=i.z.object({channels:Go.array()}),yp=i.z.object({channels:fr.array()}),gp=i.z.object({keys:Q.array().optional(),names:dr.array().optional()}),pp=i.z.object({}),wp=i.z.object({keys:Q.array(),names:dr.array()}),mp=i.z.object({}),bp="/channel/create",vp="/channel/delete",Tp="/channel/rename";let $c=class{constructor(e,t){l(this,"client");l(this,"cache");this.client=e,this.cache=t}async create(e){const{channels:t}=await m(this.client,bp,{channels:e},fp,yp);return this.cache.set(t),t}async delete(e){await m(this.client,vp,e,gp,pp),e.keys!=null&&this.cache.delete(e.keys),e.names!=null&&this.cache.delete(e.names)}async rename(e,t){await m(this.client,Tp,{keys:e,names:t},wp,mp),this.cache.rename(e,t)}};const Op=Object.freeze(Object.defineProperty({__proto__:null,CacheRetriever:oi,Channel:ci,Client:zc,ClusterRetriever:ar,DebouncedBatchRetriever:Sc,ONTOLOGY_TYPE:en,Writer:$c,analyzeParams:Oe,channelZ:fr,isCalculated:or,keyZ:Q,nameZ:dr,newZ:Go,ontologyID:Ic,resolveCalculatedIndex:Nc,retrieveRequired:Ec},Symbol.toStringTag,{value:"Module"})),Sp=i.z.object({keys:tt.array().optional(),usernames:i.z.string().array().optional()}),Ep=i.z.object({users:X(br)}),zp="/user/retrieve";let Np=class{constructor(e){l(this,"client");this.client=e}async retrieve(e){return(await m(this.client,zp,e,Sp,Ep)).users}};const Ip=i.z.object({users:nc.array()}),$p=i.z.object({users:br.array()}),xp=i.z.object({key:tt,username:i.z.string().min(1)}),kp=i.z.object({}),Ap=i.z.object({key:tt,firstName:i.z.string().optional(),lastName:i.z.string().optional()}),Up=i.z.object({}),Cp=i.z.object({keys:tt.array()}),Rp=i.z.object({}),Bp="/user/create",Pp="/user/change-username",Dp="/user/rename",Mp="/user/delete";let jp=class{constructor(e){l(this,"client");this.client=e}async create(e){return(await m(this.client,Bp,{users:b(e)},Ip,$p)).users}async changeUsername(e,t){await m(this.client,Pp,{key:e,username:t},xp,kp)}async rename(e,t,n){await m(this.client,Dp,{key:e,firstName:t,lastName:n},Ap,Up)}async delete(e){await m(this.client,Mp,{keys:b(e)},Cp,Rp)}},xc=class{constructor(e){l(this,"reader");l(this,"writer");this.writer=new jp(e),this.reader=new Np(e)}async create(e){const t=Array.isArray(e),n=await this.writer.create(e);return t?n:n[0]}async changeUsername(e,t){await this.writer.changeUsername(e,t)}async retrieve(e){const t=Array.isArray(e),n=await this.reader.retrieve({keys:b(e)});if(t)return n;if(n.length===0)throw new Je(`No user with key ${e} found`);if(n.length>1)throw new Xe(`Multiple users found with key ${e}`);return n[0]}async retrieveByName(e){const t=Array.isArray(e),n=await this.reader.retrieve({usernames:b(e)});if(t)return n;if(n.length===0)throw new Je(`No user with username ${e} found`);if(n.length>1)throw new Xe(`Multiple users found with username ${e}`);return n[0]}async rename(e,t,n){await this.writer.rename(e,t,n)}async delete(e){await this.writer.delete(e)}};const Lp=r=>new E({type:Ks,key:r}),_p=Object.freeze(Object.defineProperty({__proto__:null,Client:xc,ONTOLOGY_TYPE:Ks,keyZ:tt,newZ:nc,ontologyID:Lp,userZ:br},Symbol.toStringTag,{value:"Module"})),Zp=i.z.object({username:i.z.string(),password:i.z.string()}),qp=i.z.object({token:i.z.string(),user:br}),da="/auth/login",Fp=3,Yp="/auth/change-password",Wp=i.z.object({username:i.z.string(),password:i.z.string(),newPassword:i.z.string().min(1)}),Vp=i.z.object({}),Gp=[ps,ws];let Hp=class{constructor(e,t){l(this,"token");l(this,"client");l(this,"credentials");l(this,"authenticating");l(this,"authenticated");l(this,"user");l(this,"retryCount");this.client=e,this.authenticated=!1,this.credentials=t,this.retryCount=0}async changePassword(e){if(!this.authenticated)throw new Error("Not authenticated");await m(this.client,Yp,{username:this.credentials.username,password:this.credentials.password,newPassword:e},Wp,Vp),this.credentials.password=e}middleware(){const e=async(t,n)=>{if(!this.authenticated&&!t.target.endsWith(da)){this.authenticating??(this.authenticating=new Promise((c,h)=>{this.client.send(da,this.credentials,Zp,qp).then(([d,f])=>{if(f!=null)return c(f);this.token=d==null?void 0:d.token,this.user=d==null?void 0:d.user,this.authenticated=!0,c(null)}).catch(h)}));const o=await this.authenticating;if(o!=null)return[t,o]}t.params.Authorization=`Bearer ${this.token}`;const[s,a]=await n(t);return Gp.some(o=>o.matches(a))&&this.retryCount<Fp?(this.authenticated=!1,this.authenticating=void 0,this.retryCount+=1,e(t,n)):(this.retryCount=0,[s,a])};return e}};const kc=i.z.enum(["disconnected","connecting","connected","failed"]),Ac=i.z.object({status:kc,error:i.z.instanceof(Error).optional(),message:i.z.string().optional(),clusterKey:i.z.string(),clientVersion:i.z.string(),clientServerCompatible:i.z.boolean(),nodeVersion:i.z.string().optional()}),Kp=i.z.object({clusterKey:i.z.string(),nodeVersion:i.z.string().optional()}),fa={clusterKey:"",status:"disconnected",error:void 0,message:"Disconnected",clientServerCompatible:!1,clientVersion:"0.42.1"},ya=(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}.
39
- This may cause compatibility issues. We recommend updating the ${n}. For more information, see
40
- https://docs.synnaxlabs.com/reference/typescript-client/troubleshooting#old-${n}-version`},ft=class ft{constructor(e,t=O.seconds(30),n,s){l(this,"_state");l(this,"pollFrequency",O.seconds(30));l(this,"client");l(this,"name");l(this,"interval");l(this,"clientVersion");l(this,"onChangeHandlers",[]);l(this,"versionWarned",!1);this._state={...fa},this.client=e,this.pollFrequency=t,this.clientVersion=n,this.name=s,this.check(),this.startChecking()}stopChecking(){this.interval!=null&&clearInterval(this.interval)}async check(){var t;const e=this._state.status;try{const[n,s]=await this.client.send(ft.ENDPOINT,{},i.z.object({}),Kp);if(s!=null)throw s;const a=n.nodeVersion,o=this.clientVersion,c=this.versionWarned;a==null?(this._state.clientServerCompatible=!1,c||(console.warn(ya(null,o,!0)),this.versionWarned=!0)):ta.versionsEqual(o,a,{checkMajor:!0,checkMinor:!0,checkPatch:!1})?this._state.clientServerCompatible=!0:(this._state.clientServerCompatible=!1,c||(console.warn(ya(a,o,ta.semVerNewer(o,a))),this.versionWarned=!0)),this._state.status="connected",this._state.message=`Connected to ${this.name??"cluster"}`,this._state.clusterKey=n.clusterKey,this._state.nodeVersion=n.nodeVersion,this._state.clientVersion=this.clientVersion}catch(n){this._state.status="failed",this._state.error=n,this._state.message=(t=this.state.error)==null?void 0:t.message}return this.onChangeHandlers.length>0&&e!==this._state.status&&this.onChangeHandlers.forEach(n=>n(this.state)),this.state}get state(){return{...this._state}}onChange(e){this.onChangeHandlers.push(e)}startChecking(){this.interval=setInterval(()=>{this.check()},this.pollFrequency.milliseconds)}};l(ft,"ENDPOINT","/connectivity/check"),l(ft,"DEFAULT",fa),l(ft,"connectionStateZ",Ac);let cr=ft;const Jp=Object.freeze(Object.defineProperty({__proto__:null,Checker:cr,stateZ:Ac,statusZ:kc},Symbol.toStringTag,{value:"Module"})),Xp=i.z.object({keys:Q.array().optional(),bounds:q.z,names:dr.array().optional()}),Qp=i.z.object({}),ew="/frame/delete";class tw{constructor(e){l(this,"client");this.client=e}async delete(e){await m(this.client,ew,e,Xp,Qp)}}var Ot=(r=>(r[r.Open=0]="Open",r[r.Write=1]="Write",r[r.Commit=2]="Commit",r[r.SetAuthority=3]="SetAuthority",r))(Ot||{}),St=(r=>(r[r.PersistStream=1]="PersistStream",r[r.Persist=2]="Persist",r[r.Stream=3]="Stream",r))(St||{});const rw=r=>{switch(r){case"persist":return 2;case"stream":return 3;case"persistStream":return 1;default:if(typeof r=="number"&&r in St)return r;throw new Error(`invalid writer mode: ${r}`)}},nw=new O(-1);class Ts extends Ue.sub("writer_closed"){constructor(){super("WriterClosed")}}const sw=i.z.object({start:z.z.optional(),controlSubject:Ke.subjectZ.optional(),keys:Q.array().optional(),authorities:Ke.authorityZ.array().optional(),mode:i.z.enum(St).optional(),errOnUnauthorized:i.z.boolean().optional(),enableAutoCommit:i.z.boolean().optional(),autoIndexPersistInterval:O.z.optional()}),iw=i.z.object({command:i.z.enum(Ot),config:sw.optional(),frame:tn.optional(),buffer:i.z.instanceof(Uint8Array).optional()}),aw=i.z.object({command:i.z.enum(Ot),end:z.z,err:Tt.payloadZ.optional()});var Ze;let Uc=(Ze=class{constructor(e,t){l(this,"stream");l(this,"adapter");l(this,"closeErr",null);this.stream=e,this.adapter=t}static async _open(e,t,{channels:n,start:s=z.now(),authorities:a=Ke.ABSOLUTE_AUTHORITY,controlSubject:o,mode:c=1,errOnUnauthorized:h=!1,enableAutoCommit:d=!1,autoIndexPersistInterval:f=O.SECOND,useExperimentalCodec:u=!0}){const N=await hi.open(e,n);u&&(t=t.withCodec(new dw(N.codec)));const S=await t.stream(Ze.ENDPOINT,iw,aw),j=new Ze(S,N);return await j.execute({command:0,config:{start:new z(s),keys:N.keys,controlSubject:o,authorities:b(a),mode:rw(c),errOnUnauthorized:h,enableAutoCommit:d,autoIndexPersistInterval:f}}),j}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;let n;if(typeof e=="number"&&t==null)n={keys:[],authorities:[e]};else{let s;typeof e=="string"||typeof e=="number"?s={[e]:t}:s=e,s=await this.adapter.adaptObjectKeys(s),n={keys:Object.keys(s).map(a=>Number(a)),authorities:Object.values(s)}}await this.execute({command:3,config:n})}async commit(){if(this.closeErr!=null)throw this.closeErr;return this.stream.received()?(await this.closeInternal(null),z.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(Ts.matches(this.closeErr))return null;throw this.closeErr}const[t,n]=await this.stream.receive();n!=null?this.closeErr=ue.matches(n)?new Ts:n:this.closeErr=Tt.decode(t==null?void 0:t.err)}}async execute(e){const t=this.stream.send(e);for(t!=null&&await this.closeInternal(t);;){const[n,s]=await this.stream.receive();s!=null&&await this.closeInternal(s);const a=Tt.decode(n==null?void 0:n.err);if(a!=null&&await this.closeInternal(a),(n==null?void 0:n.command)==e.command)return n}}},l(Ze,"ENDPOINT","/frame/write"),Ze);const ga=r=>r.data.byteLength/r.dataType.density.valueOf(),ow=r=>{const{keys:e,series:t}=r;e.forEach((n,s)=>{t[s].key=n}),t.sort((n,s)=>n.key-s.key),e.sort((n,s)=>n-s),t.forEach(n=>delete n.key)},pa=5,wa=4,ma=3,ba=2,va=1,Ta=0,de=x.TIMESTAMP.density.valueOf(),Be=8,Pe=4,An=4,Un=4,cw=1;class Cc{constructor(e=[],t=[]){l(this,"contentType","application/sy-framer");l(this,"states",new Map);l(this,"currState");l(this,"seqNum",0);(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((s,a)=>{const o=t[a];n.keyDataTypes.set(s,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 F(`
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 ir("colType is not key");return this.columns??[]}get uniqueKeys(){return Lm.unique(this.keys)}get names(){if(this.colType==="key")throw new ir("colType is not name");return this.columns??[]}get uniqueNames(){return Lm.unique(this.names)}get uniqueColumns(){return this.colType==="key"?this.uniqueKeys:this.uniqueNames}toPayload(){return{series:this.series.map(e=>eO(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(r=>r.equals(e[0]))}timeRange(e){if(e==null){if(this.columns.length===0)return Ee.ZERO;const i=W.min(...this.series.map(s=>s.timeRange.start)),n=W.max(...this.series.map(s=>s.timeRange.end));return new Ee(i,n)}const r=this.get(e);return r==null?Ee.ZERO:r.timeRange}latest(){return this.at(-1)}get timeRanges(){return this.uniqueColumns.map(e=>this.timeRange(e))}get(e){return Array.isArray(e)?this.filter(r=>e.includes(r)):new o$(this.series.filter((r,i)=>this.columns[i]===e))}push(e,...r){if(e instanceof Je){if(this.colType!==null&&e.colType!==this.colType)throw new Ce("keyVariant must match");this.series.push(...e.series),this.columns.push(...e.columns)}else{if(this.series.push(...r),typeof e=="string"&&this.colType==="key")throw new Ce("keyVariant must match");if(typeof e!="string"&&this.colType==="name")throw new Ce("keyVariant must match");this.columns.push(...Array.from({length:r.length},()=>e))}}concat(e){return new Je([...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 r=new Je;return this.forEach((i,n,s)=>r.push(...e(i,n,s))),r}forEach(e){this.columns.forEach((r,i)=>{const n=this.series[i];e(r,n,i)})}at(e,r=!1){const i={};return this.uniqueColumns.forEach(n=>{i[n]=this.get(n).at(e,r)}),i}filter(e){const r=new Je;return this.columns.forEach((i,n)=>{const s=this.series[n];e(i,s,n)&&r.push(i,s)}),r}get byteLength(){return new lr(this.series.reduce((e,r)=>e.add(r.byteLength),lr.ZERO))}get digest(){const e={};return this.keys.forEach((r,i)=>{const n=this.series[i].digest;r in e?e[r].push(n):e[r]=[n]}),e}get length(){return this.series.reduce((e,r)=>e+r.length,0)}toString(){let e=`Frame{
133
+ `;return this.uniqueColumns.forEach(r=>{e+=` ${r}: ${this.get(r).series.map(i=>i.toString()).join(",")}
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(`
41
137
  The codec has not been updated with a list of channels and data types.
42
138
  Please call the update method before calling ${e}.
43
- `)}encode(e,t=0){var st,Ve;this.throwIfNotUpdated("encode");let n=e;e!=null&&typeof e=="object"&&"toPayload"in e&&(n=e.toPayload()),ow(n);let s=-1,a,o,c,h=t+cw+Un,d=!((st=this.currState)!=null&&st.hasVariableDataTypes),f=!0,u=!0,N=!0,S=!0,j=!0;n.keys.length!==((Ve=this.currState)==null?void 0:Ve.keys.length)&&(N=!1,h+=n.keys.length*An),n.series.forEach((L,xt)=>{var kt,Sr,fi,yi,gi;const ze=ga(L),le=n.keys[xt],oe=(kt=this.currState)==null?void 0:kt.keyDataTypes.get(le);if(oe==null)throw new F(`Channel ${le} was not provided in the list of channels when opening the writer`);if(!oe.equals(L.dataType))throw new F(`Series data type of ${L.dataType.toString()} does not match the data type of ${oe.toString()} for channel ${le}`);if(h+=L.data.byteLength,s===-1){s=ze,a=(Sr=L.timeRange)==null?void 0:Sr.start,o=(fi=L.timeRange)==null?void 0:fi.end,c=BigInt(L.alignment??0n);return}s!==ze&&(d=!1),((a==null?void 0:a.valueOf())!==((yi=L.timeRange)==null?void 0:yi.start.valueOf())||(o==null?void 0:o.valueOf())!==((gi=L.timeRange)==null?void 0:gi.end.valueOf()))&&(f=!1),c!==BigInt(L.alignment??0)&&(S=!1)}),u=f&&a==null&&o==null,j=S&&(c===void 0||c===0n),d?h+=Pe:h+=n.keys.length*Pe,u||(f?h+=de*2:h+=n.keys.length*de*2),j||(S?h+=Be:h+=n.keys.length*Be);const U=new Uint8Array(h),ee=new DataView(U.buffer);let A=t;return U[A]=Number(j)<<pa|Number(S)<<wa|Number(d)<<ma|Number(f)<<ba|Number(u)<<va|Number(N)<<Ta,A++,ee.setUint32(A,this.seqNum,!0),A+=Un,d&&(ee.setUint32(A,s,!0),A+=Pe),f&&!u&&(ee.setBigUint64(A,(a==null?void 0:a.valueOf())??0n,!0),ee.setBigUint64(A,(o==null?void 0:o.valueOf())??0n,!0),A+=de*2),S&&!j&&(ee.setBigUint64(A,c??0n,!0),A+=Be),n.series.forEach((L,xt)=>{var ze,le;if(N||(ee.setUint32(A,n.keys[xt],!0),A+=An),!d){let oe=L.data.byteLength;L.dataType.isVariable||(oe=ga(L)),ee.setUint32(A,oe,!0),A+=Pe}U.set(new Uint8Array(L.data),A),A+=L.data.byteLength,!f&&!u&&(ee.setBigUint64(A,((ze=L.timeRange)==null?void 0:ze.start.valueOf())??0n,!0),ee.setBigUint64(A,((le=L.timeRange)==null?void 0:le.end.valueOf())??0n,!0),A+=de*2),!S&&!j&&(ee.setBigUint64(A,L.alignment??0n,!0),A+=Be)}),U}decode(e,t=0){this.throwIfNotUpdated("decode");const n=e instanceof Uint8Array?e:new Uint8Array(e),s={keys:[],series:[]};let a=t,o=0,c=0,h,d,f;const u=new DataView(n.buffer,n.byteOffset,n.byteLength),N=!!(n[a]>>pa&1),S=!!(n[a]>>wa&1),j=!!(n[a]>>ma&1),U=!!(n[a]>>ba&1),ee=!!(n[a]>>va&1),A=!!(n[a]>>Ta&1);a++;const st=u.getUint32(a,!0);a+=Un;const Ve=this.states.get(st);if(Ve==null)return s;if(j){if(a+Pe>u.byteLength)return s;o=u.getUint32(a,!0),a+=Pe}if(U&&!ee){if(a+de>u.byteLength)return s;h=new z(u.getBigUint64(a,!0)),a+=de,d=new z(u.getBigUint64(a,!0)),a+=de}if(S&&!N){if(a+Be>u.byteLength)return s;f=u.getBigUint64(a,!0),a+=Be}return A&&(s.keys=[...Ve.keys]),Ve.keys.forEach((L,xt)=>{if(!A){if(a>=u.byteLength||u.getUint32(a,!0)!==L)return;a+=An,s.keys.push(L)}const ze=Ve.keyDataTypes.get(L);if(c=0,j)c=o;else{if(a+Pe>u.byteLength)return;c=u.getUint32(a,!0),a+=Pe}let le=c;if(ze.isVariable||(le*=ze.density.valueOf()),a+le>u.byteLength){s.keys.splice(xt,1);return}const oe={dataType:ze,data:n.slice(a,a+le).buffer};if(a+=le,!U&&!ee){if(a+de*2>u.byteLength)return;const kt=u.getBigUint64(a,!0);a+=de;const Sr=u.getBigUint64(a,!0);a+=de,oe.timeRange=new q({start:kt,end:Sr})}else ee?oe.timeRange=new q({start:0n,end:0n}):oe.timeRange=new q({start:(h==null?void 0:h.valueOf())??0n,end:(d==null?void 0:d.valueOf())??0n});if(!S&&!N){if(a+Be>u.byteLength)return;f=u.getBigUint64(a,!0),a+=Be,oe.alignment=f}else N?oe.alignment=0n:oe.alignment=f;s.series.push(oe)}),s}}const li=254,lw=new Uint8Array([li]),hw=255,uw=new Uint8Array([hw]),Rc="application/sy-framer";class dw{constructor(e){l(this,"contentType",Rc);l(this,"base");l(this,"lowPerfCodec");this.base=e,this.lowPerfCodec=Qe.JSON_CODEC}encode(e){var s,a;const t=e;if(t.type=="close"||((s=t.payload)==null?void 0:s.command)!=Ot.Write){const o=this.lowPerfCodec.encode(t),c=new Uint8Array({length:o.byteLength+1});return c.set(lw,0),c.set(new Uint8Array(o),1),c}const n=this.base.encode((a=t.payload)==null?void 0:a.frame,1);return n.set(uw,0),n}decode(e,t){if(new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===li)return this.lowPerfCodec.decode(e.slice(1),t);const a={type:"data"},o=this.base.decode(e,1);return a.payload={command:Ot.Write,frame:o},a}}class fw{constructor(e){l(this,"contentType",Rc);l(this,"base");l(this,"lowPerfCodec");this.base=e,this.lowPerfCodec=Qe.JSON_CODEC}encode(e){return this.lowPerfCodec.encode(e)}decode(e,t){return new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===li?this.lowPerfCodec.decode(e.slice(1),t):{type:"data",payload:{frame:this.base.decode(e,1)}}}}class gn{constructor(e){l(this,"adapter");l(this,"retriever");l(this,"keys");l(this,"codec");this.retriever=e,this.adapter=null,this.keys=[],this.codec=new Cc}static async open(e,t){const n=new gn(e);return await n.update(t),n}async update(e){const{variant:t,normalized:n}=Oe(e),s=await this.retriever.retrieve(n);if(this.codec.update(s.map(o=>o.key),s.map(o=>o.dataType)),t==="keys"){this.adapter=null,this.keys=n;return}const a=new Map;this.adapter=a,n.forEach(o=>{const c=s.find(h=>h.name===o);if(c==null)throw new Error(`Channel ${o} not found`);a.set(c.key,c.name)}),this.keys=Array.from(this.adapter.keys())}adapt(e){if(this.adapter==null)return e;const t=this.adapter;return e.map((n,s)=>{if(typeof n=="number"){const a=t.get(n);if(a==null)throw new Error(`Channel ${n} not found`);return[a,s]}return[n,s]})}}class hi{constructor(e){l(this,"adapter");l(this,"retriever");l(this,"keys");l(this,"codec");this.retriever=e,this.adapter=null,this.keys=[],this.codec=new Cc}static async open(e,t){const n=new hi(e);return await n.update(t),n}async adaptObjectKeys(e){const t={};for(const[n,s]of Object.entries(e))t[await this.adaptToKey(n)]=s;return t}async update(e){const t=await Ec(this.retriever,e);this.adapter=new Map(t.map(n=>[n.name,n.key])),this.keys=t.map(n=>n.key),this.codec.update(this.keys,t.map(n=>n.dataType))}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 F(`
139
+ `)}encode(e,r=0){var v,w;this.throwIfNotUpdated("encode");let i=e;e!=null&&typeof e=="object"&&"toPayload"in e&&(i=e.toPayload()),OL(i);let n=-1,s,a,o,u=r+SL+go,c=!((v=this.currState)!=null&&v.hasVariableDataTypes),l=!0,d=!0,g=!0,p=!0,_=!0;i.keys.length!==((w=this.currState)==null?void 0:w.keys.length)&&(g=!1,u+=i.keys.length*vo),i.series.forEach((I,A)=>{var Ar,Yi,jm,Am,Dm;const J=Nh(I),ce=i.keys[A],Xe=(Ar=this.currState)==null?void 0:Ar.keyDataTypes.get(ce);if(Xe==null)throw new Ce(`Channel ${ce} was not provided in the list of channels when opening the writer`);if(!Xe.equals(I.dataType))throw new Ce(`Series data type of ${I.dataType.toString()} does not match the data type of ${Xe.toString()} for channel ${ce}`);if(u+=I.data.byteLength,n===-1){n=J,s=(Yi=I.timeRange)==null?void 0:Yi.start,a=(jm=I.timeRange)==null?void 0:jm.end,o=BigInt(I.alignment??0n);return}n!==J&&(c=!1),((s==null?void 0:s.valueOf())!==((Am=I.timeRange)==null?void 0:Am.start.valueOf())||(a==null?void 0:a.valueOf())!==((Dm=I.timeRange)==null?void 0:Dm.end.valueOf()))&&(l=!1),o!==BigInt(I.alignment??0)&&(p=!1)}),d=l&&s==null&&a==null,_=p&&(o===void 0||o===0n),c?u+=Ht:u+=i.keys.length*Ht,d||(l?u+=St*2:u+=i.keys.length*St*2),_||(p?u+=Xt:u+=i.keys.length*Xt);const k=new Uint8Array(u),m=new DataView(k.buffer);let h=r;return k[h]=Number(_)<<Th|Number(p)<<zh|Number(c)<<xh|Number(l)<<Eh|Number(d)<<Uh|Number(g)<<Zh,h++,m.setUint32(h,this.seqNum,!0),h+=go,c&&(m.setUint32(h,n,!0),h+=Ht),l&&!d&&(m.setBigUint64(h,(s==null?void 0:s.valueOf())??0n,!0),m.setBigUint64(h,(a==null?void 0:a.valueOf())??0n,!0),h+=St*2),p&&!_&&(m.setBigUint64(h,o??0n,!0),h+=Xt),i.series.forEach((I,A)=>{var J,ce;if(g||(m.setUint32(h,i.keys[A],!0),h+=vo),!c){let Xe=I.data.byteLength;I.dataType.isVariable||(Xe=Nh(I)),m.setUint32(h,Xe,!0),h+=Ht}k.set(new Uint8Array(I.data),h),h+=I.data.byteLength,!l&&!d&&(m.setBigUint64(h,((J=I.timeRange)==null?void 0:J.start.valueOf())??0n,!0),m.setBigUint64(h,((ce=I.timeRange)==null?void 0:ce.end.valueOf())??0n,!0),h+=St*2),!p&&!_&&(m.setBigUint64(h,I.alignment??0n,!0),h+=Xt)}),k}decode(e,r=0){this.throwIfNotUpdated("decode");const i=e instanceof Uint8Array?e:new Uint8Array(e),n={keys:[],series:[]};let s=r,a=0,o=0,u,c,l;const d=new DataView(i.buffer,i.byteOffset,i.byteLength),g=!!(i[s]>>Th&1),p=!!(i[s]>>zh&1),_=!!(i[s]>>xh&1),k=!!(i[s]>>Eh&1),m=!!(i[s]>>Uh&1),h=!!(i[s]>>Zh&1);s++;const v=d.getUint32(s,!0);s+=go;const w=this.states.get(v);if(w==null)return n;if(_){if(s+Ht>d.byteLength)return n;a=d.getUint32(s,!0),s+=Ht}if(k&&!m){if(s+St>d.byteLength)return n;u=new W(d.getBigUint64(s,!0)),s+=St,c=new W(d.getBigUint64(s,!0)),s+=St}if(p&&!g){if(s+Xt>d.byteLength)return n;l=d.getBigUint64(s,!0),s+=Xt}return h&&(n.keys=[...w.keys]),w.keys.forEach((I,A)=>{if(!h){if(s>=d.byteLength||d.getUint32(s,!0)!==I)return;s+=vo,n.keys.push(I)}const J=w.keyDataTypes.get(I);if(o=0,_)o=a;else{if(s+Ht>d.byteLength)return;o=d.getUint32(s,!0),s+=Ht}let ce=o;if(J.isVariable||(ce*=J.density.valueOf()),s+ce>d.byteLength){n.keys.splice(A,1);return}const Xe={dataType:J,data:i.slice(s,s+ce).buffer};if(s+=ce,!k&&!m){if(s+St*2>d.byteLength)return;const Ar=d.getBigUint64(s,!0);s+=St;const Yi=d.getBigUint64(s,!0);s+=St,Xe.timeRange=new Ee({start:Ar,end:Yi})}else m?Xe.timeRange=new Ee({start:0n,end:0n}):Xe.timeRange=new Ee({start:(u==null?void 0:u.valueOf())??0n,end:(c==null?void 0:c.valueOf())??0n});if(!p&&!g){if(s+Xt>d.byteLength)return;l=d.getBigUint64(s,!0),s+=Xt,Xe.alignment=l}else g?Xe.alignment=0n:Xe.alignment=l;n.series.push(Xe)}),n}}const xm=254,NL=new Uint8Array([xm]),TL=255,zL=new Uint8Array([TL]),DO="application/sy-framer";class xL{constructor(e){f(this,"contentType",DO);f(this,"base");f(this,"lowPerfCodec");this.base=e,this.lowPerfCodec=Nn.JSON_CODEC}encode(e){var n,s;const r=e;if(r.type=="close"||((n=r.payload)==null?void 0:n.command)!=yr.Write){const a=this.lowPerfCodec.encode(r),o=new Uint8Array({length:a.byteLength+1});return o.set(NL,0),o.set(new Uint8Array(a),1),o}const i=this.base.encode((s=r.payload)==null?void 0:s.frame,1);return i.set(zL,0),i}decode(e,r){if(new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===xm)return this.lowPerfCodec.decode(e.slice(1),r);const s={type:"data"},a=this.base.decode(e,1);return s.payload={command:yr.Write,frame:a},s}}class EL{constructor(e){f(this,"contentType",DO);f(this,"base");f(this,"lowPerfCodec");this.base=e,this.lowPerfCodec=Nn.JSON_CODEC}encode(e){return this.lowPerfCodec.encode(e)}decode(e,r){return new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===xm?this.lowPerfCodec.decode(e.slice(1),r):{type:"data",payload:{frame:this.base.decode(e,1)}}}}class to{constructor(e){f(this,"adapter");f(this,"retriever");f(this,"keys");f(this,"codec");this.retriever=e,this.adapter=null,this.keys=[],this.codec=new AO}static async open(e,r){const i=new to(e);return await i.update(r),i}async update(e){const{variant:r,normalized:i}=Pt(e),n=await this.retriever.retrieve(i);if(this.codec.update(n.map(a=>a.key),n.map(a=>a.dataType)),r==="keys"){this.adapter=null,this.keys=i;return}const s=new Map;this.adapter=s,i.forEach(a=>{const o=n.find(u=>u.name===a);if(o==null)throw new Error(`Channel ${a} not found`);s.set(o.key,o.name)}),this.keys=Array.from(this.adapter.keys())}adapt(e){if(this.adapter==null)return e;const r=this.adapter;return e.map((i,n)=>{if(typeof i=="number"){const s=r.get(i);if(s==null)throw new Error(`Channel ${i} not found`);return[s,n]}return[i,n]})}}class Em{constructor(e){f(this,"adapter");f(this,"retriever");f(this,"keys");f(this,"codec");this.retriever=e,this.adapter=null,this.keys=[],this.codec=new AO}static async open(e,r){const i=new Em(e);return await i.update(r),i}async adaptObjectKeys(e){const r={};for(const[i,n]of Object.entries(e))r[await this.adaptToKey(i)]=n;return r}async update(e){const r=await NO(this.retriever,e);this.adapter=new Map(r.map(i=>[i.name,i.key])),this.keys=r.map(i=>i.key),this.codec.update(this.keys,r.map(i=>i.dataType))}async fetchChannel(e){const r=await this.retriever.retrieve(e);if(r.length===0)throw new Error(`Channel ${JSON.stringify(e)} not found`);return r[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,r){if(typeof e=="string"||typeof e=="number"){if(r==null)throw new Ce(`
44
140
  Received a single channel name or key but no series.
45
- `);if(Array.isArray(t)){if(t.some(h=>h instanceof _e||Array.isArray(h)))throw new F(`
141
+ `);if(Array.isArray(r)){if(r.some(u=>u instanceof Ft||Array.isArray(u)))throw new Ce(`
46
142
  Received a single channel name or key but multiple series.
47
- `);t=t}const o=await this.fetchChannel(e),c=new _e({data:t,dataType:o.dataType});return new V(o.key,c)}if(Array.isArray(e)){if(t==null)throw new F(`
143
+ `);r=r}const a=await this.fetchChannel(e),o=new Ft({data:r,dataType:a.dataType});return new Je(a.key,o)}if(Array.isArray(e)){if(r==null)throw new Ce(`
48
144
  Received an array of channel names or keys but no series.
49
- `);if(!Array.isArray(t))throw new F(`
145
+ `);if(!Array.isArray(r))throw new Ce(`
50
146
  Received an array of channel names or keys but no array of series.
51
- `);const o=[],c=[];for(let h=0;h<e.length;h++){const d=await this.fetchChannel(e[h]);if(h>=t.length)throw new F(`
147
+ `);const a=[],o=[];for(let u=0;u<e.length;u++){const c=await this.fetchChannel(e[u]);if(u>=r.length)throw new Ce(`
52
148
  Received an array of channel names or keys but not enough series.
53
- `);const f=new _e({data:t[h],dataType:d.dataType});o.push(d.key),c.push(f)}return new V(o,c)}if(e instanceof V||e instanceof Map){const o=new V(e);if(this.adapter==null)return o;const c=o.columns.map(h=>{var f;const d=typeof h=="string"?(f=this.adapter)==null?void 0:f.get(h):h;if(d==null)throw new F(`
54
- Channel ${h} was not provided in the list of channels when opening the writer
55
- `);return d});return new V(c,o.series)}const n=[],s=[],a=Object.entries(e);for(let o=0;o<a.length;o++){const[c,h]=a[o],d=await this.fetchChannel(c),f=new _e({data:h,dataType:d.dataType});n.push(d.key),s.push(f)}return new V(n,s)}}class Bc{constructor(e,t){l(this,"name");l(this,"stream");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 closure.
56
- Please report this error to the Synnax team.`),t!=null){if(ue.matches(t))return;throw t}}}closeSend(){this.stream.closeSend()}send(e){const t=this.stream.send(e);if(t!=null)throw t}}const Os=new O(-1);var ui=(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))(ui||{}),Pc=(r=>(r[r.None=0]="None",r[r.Ack=1]="Ack",r[r.Data=2]="Data",r))(Pc||{});const yw=i.z.object({command:i.z.enum(ui),span:O.z.optional(),bounds:q.z.optional(),stamp:z.z.optional(),keys:Q.array().optional(),chunkSize:i.z.number().optional()}),gw=i.z.object({variant:i.z.enum(Pc),ack:i.z.boolean(),command:i.z.enum(ui),error:Tt.payloadZ.optional().nullable(),frame:tn.optional()}),er=class er{constructor(e,t){l(this,"stream");l(this,"adapter");l(this,"value");this.stream=new Bc("Iterator",e),this.value=new V,this.adapter=t}static async _open(e,t,n,s,a={}){const o=await gn.open(n,t),c=await s.stream(er.ENDPOINT,yw,gw),h=new er(c,o);return await h.execute({command:0,keys:o.keys,bounds:new q(e),chunkSize:a.chunkSize??1e5}),h}async next(e=Os){return await this.execute({command:1,span:new O(e)})}async prev(e=Os){return await this.execute({command:2,span:new O(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 z(e)})}async seekGE(e){return await this.execute({command:6,stamp:new z(e)})}async valid(){return await this.execute({command:7})}async close(){await this.stream.closeAndAck()}[Symbol.asyncIterator](){return new pw(this)}async execute(e){for(this.stream.send(e),this.value=new V;;){const t=await this.stream.receive();if(t.variant===1)return t.ack;this.value.push(this.adapter.adapt(new V(t.frame)))}}};l(er,"ENDPOINT","/frame/iterate");let qr=er;class pw{constructor(e){l(this,"iter");l(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 ww=i.z.object({keys:i.z.number().array(),downSampleFactor:i.z.number()}),mw=i.z.object({frame:tn}),bw="/frame/stream",Dc=(r,e)=>async t=>{let n;Array.isArray(t)||typeof t!="object"?n={channels:t,downSampleFactor:1}:n=t;const s=await gn.open(r,n.channels);n.useExperimentalCodec&&(e=e.withCodec(new fw(s.codec)));const a=await e.stream(bw,ww,mw),o=new vw(a,s);a.send({keys:s.keys,downSampleFactor:n.downSampleFactor??1});const[,c]=await a.receive();if(c!=null)throw c;return o},Mc=async(r,e,t)=>await Dc(r,e)(t);class vw{constructor(e,t){l(this,"stream");l(this,"adapter");l(this,"downsampleFactor");this.stream=new Bc("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(ue.matches(e))return{done:!0,value:void 0};throw e}}async read(){return this.adapter.adapt(new V((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 pn{constructor(e,t){l(this,"wrapped_",null);l(this,"breaker");l(this,"opener");l(this,"config");this.opener=e,Array.isArray(t)||typeof t!="object"?this.config={channels:t,downSampleFactor:1}:this.config=t,this.breaker=new Do.Breaker({maxRetries:5e3,baseInterval:O.seconds(1),scale:1})}static async open(e,t){const n=new pn(e,t);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;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(ue.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(ue.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 Ae extends He.Observer{constructor(t,n){super(n);l(this,"streamer");l(this,"closePromise");this.streamer=t,this.closePromise=this.stream()}async close(){this.streamer.close(),await this.closePromise}async stream(){for await(const t of this.streamer)this.notify(t)}}const Tw=r=>new E({type:_s,key:r.toString()}),Oa=r=>Array.isArray(r)||typeof r!="object"||typeof r=="object"&&"key"in r?{channels:r}:r;let jc=class{constructor(e,t,n){l(this,"streamClient");l(this,"retriever");l(this,"deleter");this.streamClient=e,this.retriever=n,this.deleter=new tw(t)}async openIterator(e,t,n){return await qr._open(e,t,this.retriever,this.streamClient,n)}async openWriter(e){return await Uc._open(this.retriever,this.streamClient,Oa(e))}async openStreamer(e){return await Mc(this.retriever,this.streamClient,Oa(e))}async write(e,t,n){if(n==null){const a=t,o=await this.openWriter({start:e,channels:Object.keys(a),mode:St.Persist,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:O.MAX});await o.write(a),await o.commit(),await o.close();return}const s=await this.openWriter({start:e,channels:t,mode:St.Persist,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:O.MAX});await s.write(t,n),await s.close()}async read(e,t){const{single:n}=Oe(t),s=await this.readFrame(e,t);return n?s.get(t):s}async readFrame(e,t){const n=await this.openIterator(e,t),s=new V;try{for await(const a of n)s.push(a)}finally{await n.close()}return s}async delete(e,t){const{normalized:n,variant:s}=Oe(e);return s==="keys"?await this.deleter.delete({keys:n,bounds:t}):await this.deleter.delete({names:n,bounds:t})}};const Ow=Object.freeze(Object.defineProperty({__proto__:null,ALWAYS_INDEX_PERSIST_ON_AUTO_COMMIT:nw,AUTO_SPAN:Os,Client:jc,Frame:V,HardenedStreamer:pn,Iterator:qr,ONTOLOGY_TYPE:_s,ObservableStreamer:Ae,Writer:Uc,WriterClosedError:Ts,WriterCommand:Ot,WriterMode:St,createStreamOpener:Dc,frameZ:tn,ontologyID:Tw,openStreamer:Mc,seriesFromPayload:Ho,seriesToPayload:Ko},Symbol.toStringTag,{value:"Module"})),Sw=Ke.ABSOLUTE_AUTHORITY,Ew=Ke.ZERO_AUTHORITY,zw=Ke.stateZ(i.z.number()),Nw=r=>{var e,t;return r.to==null?`${(e=r.from)==null?void 0:e.resource} - ${(t=r.from)==null?void 0:t.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()})`},Iw=i.z.object({transfers:i.z.array(Ke.transferZ)});class Lc extends Ae{constructor(t){super(t,n=>{const s=this.codec.decode(n.series[0].buffer,Iw);return this.merge(s),[s.transfers,!0]});l(this,"states");l(this,"codec");this.states=new Map,this.codec=new Qe.JSONCodec}subjects(){const t=new Map;return this.states.forEach(n=>t.set(n.subject.key,n.subject)),Array.from(t.values())}merge(t){t.transfers.forEach(n=>{n.from==null&&n.to==null&&console.warn("Invalid transfer: ",n),n.to==null?this.states.delete(n.from.resource):this.states.set(n.to.resource,n.to)})}}const Sa="sy_node_1_control";let _c=class{constructor(e){l(this,"framer");this.framer=e}async openStateTracker(){const e=await pn.open(async()=>await this.framer.openStreamer(Sa),Sa);return new Lc(e)}};const $w=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:Sw,Client:_c,StateTracker:Lc,ZERO_AUTHORITY:Ew,stateZ:zw,transferString:Nw},Symbol.toStringTag,{value:"Module"}));let Zc=class{constructor(e,t,n){l(this,"tasks");l(this,"racks");l(this,"devices");this.tasks=e,this.racks=t,this.devices=n}};const xw=Object.freeze(Object.defineProperty({__proto__:null,Client:Zc},Symbol.toStringTag,{value:"Module"})),nt=async(r,e,t,n)=>{const s=await r.openStreamer([e,t]),a=o=>{const c=[];return t!=null&&c.push(...o.get(t).series.flatMap(h=>n("delete",h))),e!=null&&c.push(...o.get(e).series.flatMap(h=>n("set",h))),[c,c.length>0]};return new Ae(s,a)},kw=Object.freeze(Object.defineProperty({__proto__:null,openObservable:nt},Symbol.toStringTag,{value:"Module"})),Aw="sy_device_set",Uw="sy_device_delete",Ea="sy_device_state",Cn="/hardware/device/retrieve",Cw="/hardware/device/create",Rw="/hardware/device/delete",Bw=i.z.object({devices:Xo.array()}),Pw=i.z.object({devices:gr.array()}),Dw=i.z.object({keys:yr.array()}),Mw=i.z.object({}),Rn=i.z.object({keys:yr.array().optional(),names:i.z.string().array().optional(),makes:i.z.string().array().optional(),models:i.z.string().array().optional(),locations:i.z.string().array().optional(),racks:Ye.array().optional(),search:i.z.string().optional(),limit:i.z.number().optional(),offset:i.z.number().optional(),ignoreNotFound:i.z.boolean().optional(),includeState:i.z.boolean().optional()}),Bn=i.z.object({devices:X(gr)});let qc=class{constructor(e,t){l(this,"type",sn);l(this,"client");l(this,"frameClient");this.client=e,this.frameClient=t}async retrieve(e,t){const n=!Array.isArray(e),s=await m(this.client,Cn,{keys:b(e),...t},Rn,Bn);return yn("Device",e,s.devices,n),n?s.devices[0]:s.devices}async search(e,t){return(await m(this.client,Cn,{search:e,...t},Rn,Bn)).devices}async page(e,t,n){return(await m(this.client,Cn,{offset:e,limit:t,...n},Rn,Bn)).devices}async create(e){const t=!Array.isArray(e),n=await m(this.client,Cw,{devices:b(e)},Bw,Pw);return t?n.devices[0]:n.devices}async delete(e){await m(this.client,Rw,{keys:b(e)},Dw,Mw)}async openDeviceTracker(){return await nt(this.frameClient,Aw,Uw,jw)}async openStateObserver(){return new Ae(await this.frameClient.openStreamer(Ea),e=>{const t=e.get(Ea);return t.length===0?[null,!1]:[t.parseJSON(Fs),!0]})}newSearcherWithOptions(e){return{type:this.type,search:async t=>await this.search(t,e),retrieve:async t=>await this.retrieve(t,e),page:async(t,n)=>await this.page(t,n,e)}}};const jw=(r,e)=>r==="delete"?e.toStrings().map(t=>({variant:r,key:t,value:void 0})):e.parseJSON(gr).map(t=>({variant:r,key:t.key,value:t})),Lw=r=>new E({type:sn,key:r}),_w=Object.freeze(Object.defineProperty({__proto__:null,Client:qc,ONTOLOGY_TYPE:sn,deviceZ:gr,keyZ:yr,newZ:Xo,ontologyID:Lw,stateZ:Fs},Symbol.toStringTag,{value:"Module"})),Pn="/hardware/rack/retrieve",Zw="/hardware/rack/create",qw="/hardware/rack/delete",za="sy_rack_state",Dn=i.z.object({keys:Ye.array().optional(),names:i.z.string().array().optional(),search:i.z.string().optional(),embedded:i.z.boolean().optional(),hostIsNode:i.z.boolean().optional(),limit:i.z.number().optional(),offset:i.z.number().optional(),includeState:i.z.boolean().optional()}),Mn=i.z.object({racks:X(rn)}),Fw=i.z.object({racks:Jo.array()}),Yw=i.z.object({racks:rn.array()}),Ww=i.z.object({keys:Ye.array()}),Vw=i.z.object({});let Fc=class{constructor(e,t,n){l(this,"type",nn);l(this,"client");l(this,"tasks");l(this,"frameClient");this.client=e,this.tasks=t,this.frameClient=n}async delete(e){await m(this.client,qw,{keys:b(e)},Ww,Vw)}async create(e){const t=!Array.isArray(e),n=await m(this.client,Zw,{racks:b(e)},Fw,Yw),s=this.sugar(n.racks);return t?s[0]:s}async search(e){const t=await m(this.client,Pn,{search:e},Dn,Mn);return this.sugar(t.racks)}async page(e,t){const n=await m(this.client,Pn,{offset:e,limit:t},Dn,Mn);return this.sugar(n.racks)}async retrieve(e,t){const{variant:n,normalized:s,single:a}=ai(e,{string:"names",number:"keys"}),o=await m(this.client,Pn,{[n]:s,includeState:t==null?void 0:t.includeState},Dn,Mn),c=this.sugar(o.racks);return yn("Rack",e,c,a),a?c[0]:c}async openStateObserver(){return new Ae(await this.frameClient.openStreamer(za),e=>{const t=e.get(za);return t.length===0?[[],!1]:[t.parseJSON(Zs),!0]})}sugar(e){return e.map(({key:t,name:n,state:s})=>new Yc(t,n,this.tasks,s))}};class Yc{constructor(e,t,n,s){l(this,"key");l(this,"name");l(this,"state");l(this,"tasks");this.key=e,this.name=t,this.tasks=n,this.state=s}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 Gw=r=>new E({type:nn,key:r.toString()}),Hw=Object.freeze(Object.defineProperty({__proto__:null,Client:Fc,ONTOLOGY_TYPE:nn,Rack:Yc,keyZ:Ye,newZ:Jo,ontologyID:Gw,rackZ:rn,stateZ:Zs},Symbol.toStringTag,{value:"Module"})),Qt="sy_task_state",ut="sy_task_cmd",Kw="sy_task_set",Jw="sy_task_delete",lt=new Error("Task not created"),Wc=async(r,e)=>{const t=await e.retrieveParents(r);return t.length===0?null:t[0]};class Vc{constructor(e,t,n,s,a=!1,o=!1,c,h=null,d=null,f=null){l(this,"key");l(this,"name");l(this,"internal");l(this,"type");l(this,"config");l(this,"snapshot");l(this,"state");l(this,"frameClient");l(this,"ontologyClient");l(this,"rangeClient");this.key=e,this.name=t,this.type=n,this.config=s,this.internal=a,this.snapshot=o,c!==null&&(this.state=c),this.frameClient=h,this.ontologyClient=d,this.rangeClient=f}get payload(){return{key:this.key,name:this.name,type:this.type,config:this.config,state:this.state,internal:this.internal}}get ontologyID(){return Hc(this.key)}async executeCommand(e,t){if(this.frameClient==null)throw lt;const n=await this.frameClient.openWriter(ut),s=Zf.create();return await n.write(ut,[{task:this.key,type:e,key:s,args:t}]),await n.close(),s}async executeCommandSync(e,t,n){if(this.frameClient==null)throw lt;const s=await this.frameClient.openStreamer(Qt),a=await this.executeCommand(e,t);let o;const c=new Promise(h=>setTimeout(()=>h(!1),new O(n).milliseconds));for(;;){const h=await Promise.any([s.read(),c]);if(h===!1)throw new Error("Command timed out");const d=ir.safeParse(h.at(-1).sy_task_state);if(d.success){if(o=d.data,o.key===a)break}else throw d.error}return s.close(),o}async openStateObserver(){if(this.frameClient==null)throw lt;return new Ae(await this.frameClient.openStreamer(Qt),e=>{const t=e.get(Qt);if(t.length===0)return[null,!1];const n=ir.safeParse(t.at(-1));if(!n.success)return console.error(n.error),[null,!1];const s=n.data;return s.task!==this.key?[null,!1]:[s,!0]})}async openCommandObserver(){if(this.frameClient==null)throw lt;return new Ae(await this.frameClient.openStreamer(ut),e=>{const t=e.get(ut);if(t.length===0)return[null,!1];const n=Ys.safeParse(t.at(-1));if(!n.success)return console.error(n.error),[null,!1];const s=n.data;return s.task!==this.key?[null,!1]:[s,!0]})}async snapshottedTo(){if(this.ontologyClient==null||this.rangeClient==null)throw lt;return this.snapshot?await Wc(this.key,this.ontologyClient):null}}const Xw=i.z.object({rack:Ye.optional(),keys:We.array().optional(),names:i.z.string().array().optional(),types:i.z.string().array().optional(),includeState:i.z.boolean().optional(),offset:i.z.number().optional(),limit:i.z.number().optional()}),Qw=i.z.object({tasks:X(pr)}),em="/hardware/task/retrieve",tm="/hardware/task/create",rm="/hardware/task/delete",nm="/hardware/task/copy",sm=i.z.object({tasks:ec.array()}),im=i.z.object({tasks:pr.array()}),am=i.z.object({keys:We.array()}),om=i.z.object({}),cm=i.z.object({key:We,name:i.z.string(),snapshot:i.z.boolean()}),lm=i.z.object({task:pr});let Gc=class{constructor(e,t,n,s){l(this,"type",an);l(this,"client");l(this,"frameClient");l(this,"ontologyClient");l(this,"rangeClient");this.client=e,this.frameClient=t,this.ontologyClient=n,this.rangeClient=s}async create(e){const t=!Array.isArray(e),n=await m(this.client,tm,{tasks:b(e)},sm,im),s=this.sugar(n.tasks);return t?s[0]:s}async delete(e){await m(this.client,rm,{keys:b(e)},am,om)}async search(e){return await this.execRetrieve({keys:[e]})}async page(e,t){return await this.execRetrieve({offset:e,limit:t})}async list(e={}){return this.sugar(await this.execRetrieve(e))}async retrieve(e,t){const{single:n,normalized:s,variant:a}=ai(e,{number:"rack",string:"keys"},{convertNumericStrings:!1}),o={...t};a==="rack"?o.rack=e:o.keys=s;const c=await this.execRetrieve(o),h=this.sugar(c);return n&&a!=="rack"?h[0]:h}async copy(e,t,n){const s=await m(this.client,nm,{key:e,name:t,snapshot:n},cm,lm);return this.sugar([s.task])[0]}async retrieveByName(e,t){const n=await this.execRetrieve({names:[e],rack:t});return yn("Task",e,n,!0),this.sugar(n)[0]}async retrieveByType(e,t){const n=await this.execRetrieve({types:[e],rack:t});return this.sugar(n)}async retrieveSnapshottedTo(e){if(this.ontologyClient==null)throw lt;return await Wc(e,this.ontologyClient)}async execRetrieve(e){return(await m(this.client,em,e,Xw,Qw)).tasks}sugar(e){const t=!Array.isArray(e),n=b(e).map(({key:s,name:a,type:o,config:c,state:h,internal:d,snapshot:f})=>new Vc(s,a,o,c,d,f,h,this.frameClient,this.ontologyClient,this.rangeClient));return t?n[0]:n}async openTracker(){return await nt(this.frameClient,Kw,Jw,(e,t)=>Array.from(t).map(n=>({variant:e,key:n.toString(),value:n.toString()})))}async openStateObserver(){return new Ae(await this.frameClient.openStreamer(Qt),e=>{const t=e.get(Qt);if(t.length===0)return[null,!1];const n=ir.safeParse(t.at(-1));return n.success?[n.data,!0]:(console.error(n.error),[null,!1])})}async openCommandObserver(){return new Ae(await this.frameClient.openStreamer(ut),e=>{const t=e.get(ut);if(t.length===0)return[null,!1];const n=Ys.safeParse(t.at(-1));return n.success?[n.data,!0]:(console.error(n.error),[null,!1])})}};const Hc=r=>new E({type:an,key:r}),hm=Object.freeze(Object.defineProperty({__proto__:null,Client:Gc,ONTOLOGY_TYPE:an,Task:Vc,commandZ:Ys,getRackKey:Tg,keyZ:We,newZ:ec,ontologyID:Hc,stateZ:ir,statusZ:Qo,taskZ:pr},Symbol.toStringTag,{value:"Module"})),um=i.z.object({keys:et.array().optional(),for:ie.optional(),search:i.z.string().optional(),offset:i.z.number().optional(),limit:i.z.number().optional()}),dm=i.z.object({labels:X(wr)}),Wr=class Wr{constructor(e){l(this,"client");this.client=e}async retrieve(e){return await this.execute({keys:b(e)})}async retrieveFor(e){return await this.execute({for:e})}async search(e){return await this.execute({search:e})}async page(e,t){return await this.execute({offset:e,limit:t})}async execute(e){const[t,n]=await this.client.send(Wr.ENDPOINT,e,um,dm);if(n!=null)throw n;return t.labels}};l(Wr,"ENDPOINT","/label/retrieve");let Fr=Wr;const Kc=wr.extend({key:et.optional()}),fm=i.z.object({labels:Kc.array()}),ym=i.z.object({labels:wr.array()}),gm=i.z.object({keys:et.array()}),Jc=i.z.object({id:ie,labels:et.array(),replace:i.z.boolean().optional()}),pm=Jc.omit({replace:!0}),jn=i.z.object({}),wm="/label/create",mm="/label/delete",bm="/label/set",vm="/label/remove";let Xc=class{constructor(e){l(this,"client");this.client=e}async create(e){return(await m(this.client,wm,{labels:b(e)},fm,ym)).labels}async delete(e){await m(this.client,mm,{keys:b(e)},gm,jn)}async set(e,t,{replace:n}={}){await m(this.client,bm,{id:e,labels:t,replace:n},Jc,jn)}async remove(e,t){await m(this.client,vm,{id:e,labels:t},pm,jn)}};const Tm="sy_label_set",Om="sy_label_delete";let Qc=class{constructor(e,t,n){l(this,"type","label");l(this,"retriever");l(this,"writer");l(this,"frameClient");l(this,"ontology");this.writer=new Xc(e),this.retriever=new Fr(e),this.frameClient=t,this.ontology=n}async search(e){return await this.retriever.search(e)}async retrieve(e){const t=Array.isArray(e),n=await this.retriever.retrieve(e);return t?n:n[0]}async retrieveFor(e){return await this.retriever.retrieveFor(new E(e))}async label(e,t,n={}){await this.writer.set(new E(e),t,n)}async removeLabels(e,t){await this.writer.remove(new E(e),t)}async page(e,t){return await this.retriever.page(e,t)}async create(e){const t=Array.isArray(e),n=await this.writer.create(e);return t?n:n[0]}async delete(e){await this.writer.delete(e)}async openChangeTracker(){return await nt(this.frameClient,Tm,Om,Sm)}async trackLabelsOf(e){const t=new He.Observer,n=(await this.retrieveFor(e)).map(a=>({id:el(a.key),key:a.key,name:a.name,data:a}));return(await this.ontology.openDependentTracker({target:new E(e),dependents:n,relationshipType:"labeled_by"})).onChange(a=>t.notify(a.map(o=>{var c,h;return{key:o.id.key,color:(c=o.data)==null?void 0:c.color,name:(h=o.data)==null?void 0:h.name}}))),t}};const Sm=(r,e)=>r==="delete"?e.toUUIDs().map(t=>({variant:r,key:t})):e.parseJSON(wr).map(t=>({variant:r,key:t.key,value:t})),el=r=>new E({type:Ws,key:r}),Em=Object.freeze(Object.defineProperty({__proto__:null,Client:Qc,ONTOLOGY_TYPE:Ws,Retriever:Fr,Writer:Xc,keyZ:et,labelZ:wr,newZ:Kc,ontologyID:el},Symbol.toStringTag,{value:"Module"})),zm="sy_range_alias_set",Nm="sy_range_alias_delete",Im=i.z.object({range:ae,aliases:i.z.string().array()}),$m=i.z.object({aliases:i.z.record(i.z.string(),Q)}),xm=i.z.object({range:ae,aliases:i.z.record(Q.or(i.z.string()),i.z.string())}),km=i.z.unknown(),Am=i.z.object({range:ae,channels:Q.array()}),Um=i.z.unknown(),Cm=i.z.object({range:ae}),Rm=i.z.object({aliases:i.z.record(i.z.string(),i.z.string())}),be=class be{constructor(e,t,n){l(this,"frameClient");l(this,"cache",new Map);l(this,"client");l(this,"rangeKey");this.rangeKey=e,this.cache=new Map,this.client=n,this.frameClient=t}async resolve(e){const t=[],n=typeof e=="string",s={};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?s[o]=c:t.push(o)});if(t.length===0)return s;const a=await m(this.client,be.RESOLVE_ENDPOINT,{range:this.rangeKey,aliases:t},Im,$m);return Object.entries(a.aliases).forEach(([o,c])=>this.cache.set(o,c)),n?a.aliases[t[0]]:{...s,...a.aliases}}async set(e){await m(this.client,be.SET_ENDPOINT,{range:this.rangeKey,aliases:e},xm,km)}async list(){return(await m(this.client,be.LIST_ENDPOINT,{range:this.rangeKey},Cm,Rm)).aliases}async delete(e){await m(this.client,be.DELETE_ENDPOINT,{range:this.rangeKey,channels:e},Am,Um)}async openChangeTracker(){return await nt(this.frameClient,zm,Nm,Dm(this.rangeKey))}};l(be,"SET_ENDPOINT","/range/alias/set"),l(be,"RESOLVE_ENDPOINT","/range/alias/resolve"),l(be,"LIST_ENDPOINT","/range/alias/list"),l(be,"DELETE_ENDPOINT","/range/alias/delete");let Ss=be;const Bm=i.z.object({range:ae,channel:Q,alias:i.z.string()}),Pm="---",Dm=r=>(e,t)=>e==="delete"?t.toStrings().filter(n=>n.split(Pm)[0]===r).map(n=>({variant:e,key:n,value:void 0})):t.parseJSON(Bm).map(n=>({variant:e,key:n.alias,value:n})),di=i.z.object({range:ae,key:i.z.string(),value:i.z.string()}),Mm=i.z.object({range:ae,keys:i.z.string().array()}),jm=i.z.object({pairs:X(di)}),Lm=i.z.object({range:ae,pairs:di.array()}),_m=i.z.object({range:ae,keys:i.z.string().array()}),Le=class Le{constructor(e,t,n){l(this,"rangeKey");l(this,"client");l(this,"frameClient");this.rangeKey=e,this.client=t,this.frameClient=n}async get(e){const t=await m(this.client,Le.GET_ENDPOINT,{range:this.rangeKey,keys:b(e)},Mm,jm);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;Hr(e)?n=Object.entries(e).map(([s,a])=>({range:this.rangeKey,key:s,value:a})):n=[{range:this.rangeKey,key:e,value:t}],await m(this.client,Le.SET_ENDPOINT,{range:this.rangeKey,pairs:n},Lm,i.z.unknown())}async delete(e){await m(this.client,Le.DELETE_ENDPOINT,{range:this.rangeKey,keys:b(e)},_m,i.z.unknown())}async openTracker(){return await nt(this.frameClient,"sy_range_kv_set","sy_range_kv_delete",(e,t)=>e==="delete"?t.toStrings().map(n=>{const[s,a]=n.split("<--->",2);return{variant:e,key:n,value:{range:s,key:a,value:""}}}):t.parseJSON(di).map(n=>({variant:e,key:`${n.range}${n.key}`,value:n})))}};l(Le,"GET_ENDPOINT","/range/kv/get"),l(Le,"SET_ENDPOINT","/range/kv/set"),l(Le,"DELETE_ENDPOINT","/range/kv/delete");let lr=Le;class tl{constructor(e,t=q.ZERO,n,s,a,o,c,h,d,f,u){l(this,"key");l(this,"name");l(this,"kv");l(this,"timeRange");l(this,"color");l(this,"channels");l(this,"aliaser");l(this,"frameClient");l(this,"labelClient");l(this,"ontologyClient");l(this,"rangeClient");this.key=n,this.name=e,this.timeRange=t,this.frameClient=a,this.color=s,this.kv=o,this.aliaser=c,this.channels=h,this.labelClient=d,this.ontologyClient=f,this.rangeClient=u}get ontologyID(){return je(this.key)}get payload(){return{key:this.key,name:this.name,timeRange:this.timeRange,color:this.color}}async setAlias(e,t){const n=await this.channels.retrieve(e);if(n.length===0)throw new ke(`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 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(t=>t.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(je(this.key))}async addLabel(...e){await this.labelClient.label(je(this.key),e)}async removeLabel(...e){await this.labelClient.removeLabels(je(this.key),e)}async openChildRangeTracker(){const e=new He.Observer,t=(await this.retrieveChildren()).map(s=>{const a=je(s.key);return{id:a,key:a.toString(),name:s.name,data:s.payload}}),n=await this.ontologyClient.openDependentTracker({target:this.ontologyID,dependents:t,resourceType:"range"});return n.onChange(s=>e.notify(this.rangeClient.resourcesToRanges(s))),e.setCloser(async()=>await n.close()),e}async openParentRangeTracker(){const e=new He.Observer,t=await this.retrieveParent();if(t==null)return null;const n=je(t.key),s={id:n,key:n.toString(),name:t.name,data:t.payload},a=await this.ontologyClient.openDependentTracker({target:this.ontologyID,dependents:[s],relationshipDirection:"to"});return a.onChange(o=>{const c=this.rangeClient.resourcesToRanges(o);if(c.length===0)return;const h=c[0];e.notify(h)}),e.setCloser(async()=>await a.close()),e}}const Zm=(r,e)=>Ff(r.timeRange,e.timeRange),qm=i.z.object({keys:ae.array().optional(),names:i.z.array(i.z.string()).optional(),term:i.z.string().optional(),overlapsWith:q.z.optional(),limit:i.z.number().int().optional(),offset:i.z.number().int().optional(),hasLabels:et.array().optional()}),Fm="/range/retrieve",Ym=i.z.object({ranges:X(mr)});let rl=class{constructor(e,t,n,s,a,o){l(this,"type","range");l(this,"frameClient");l(this,"writer");l(this,"unaryClient");l(this,"channels");l(this,"labelClient");l(this,"ontologyClient");this.frameClient=e,this.writer=t,this.unaryClient=n,this.channels=s,this.labelClient=a,this.ontologyClient=o}async create(e,t){const n=!Array.isArray(e),s=this.sugarMany(await this.writer.create(b(e),t));return n?s[0]:s}async rename(e,t){await this.writer.rename(e,t)}async delete(e){await this.writer.delete(b(e))}async search(e){return this.sugarMany(await this.execRetrieve({term:e}))}async page(e,t){return this.sugarMany(await this.execRetrieve({offset:e,limit:t}))}async retrieve(e){if(typeof e=="object"&&"start"in e)return await this.execRetrieve({overlapsWith:new q(e)});const{single:t,actual:n,variant:s,normalized:a,empty:o}=rc(e);if(o)return[];const c=await this.execRetrieve({[s]:a});if(!t)return c;if(c.length===0)throw new Je(`range matching ${n} not found`);if(c.length>1)throw new Xe(`multiple ranges matching ${n} found`);return c[0]}getKV(e){return new lr(e,this.unaryClient,this.frameClient)}async execRetrieve(e){const{ranges:t}=await m(this.unaryClient,Fm,e,qm,Ym);return this.sugarMany(t)}async retrieveParent(e){const t=await this.ontologyClient.retrieveParents(je(e));if(t.length===0)return null;const n=t[0];return n.id.type!=="range"?null:await this.retrieve(n.id.key)}sugarOne(e){return new tl(e.name,e.timeRange,e.key,e.color,this.frameClient,new lr(e.key,this.unaryClient,this.frameClient),new Ss(e.key,this.frameClient,this.unaryClient),this.channels,this.labelClient,this.ontologyClient,this)}sugarMany(e){return e.map(t=>this.sugarOne(t))}async openTracker(){return await nt(this.frameClient,"sy_range_set","sy_range_delete",(e,t)=>e==="delete"?t.toUUIDs().map(s=>({variant:e,key:s,value:void 0})):this.sugarMany(t.parseJSON(mr)).map(s=>({variant:e,key:s.key,value:s})))}resourcesToRanges(e){return e.map(t=>this.resourceToRange(t))}resourceToRange(e){var t,n,s;return this.sugarOne({key:e.id.key,name:(t=e.data)==null?void 0:t.name,timeRange:new q((n=e.data)==null?void 0:n.timeRange),color:(s=e.data)==null?void 0:s.color})}};const je=r=>new E({type:Gs,key:r}),Wm=r=>new E({type:Hs,key:r}),Vm=i.z.object({ranges:mr.array()}),Gm=i.z.object({parent:ie.optional(),ranges:tc.array()}),Hm=i.z.object({keys:ae.array()}),Km=i.z.object({}),Jm=i.z.object({key:ae,name:Vs}),Xm=i.z.object({}),Qm="/range/create",eb="/range/delete",tb="/range/rename";class nl{constructor(e){l(this,"client");this.client=e}async rename(e,t){await m(this.client,tb,{key:e,name:t},Jm,Xm)}async create(e,t){return(await m(this.client,Qm,{ranges:e,...t},Gm,Vm)).ranges}async delete(e){await m(this.client,eb,{keys:e},Hm,Km)}}const rb=Object.freeze(Object.defineProperty({__proto__:null,ALIAS_ONTOLOGY_TYPE:Hs,Client:rl,KV:lr,ONTOLOGY_TYPE:Gs,Range:tl,Writer:nl,aliasOntologyID:Wm,analyzeParams:rc,keyZ:ae,nameZ:Vs,newZ:tc,ontologyID:je,payloadZ:mr,sort:Zm},Symbol.toStringTag,{value:"Module"})),nb="/api/v1/";class sb{constructor(e,t={},n=!1){l(this,"url");l(this,"unary");l(this,"stream");l(this,"secure");this.secure=n,this.url=e.child(nb);const s=new Qe.JSONCodec;this.unary=ed(new Qu(this.url,s,this.secure),t),this.stream=new ad(this.url,s,this.secure)}use(...e){this.unary.use(...e),this.stream.use(...e)}}const ib="/workspace/lineplot/retrieve",ab="/workspace/lineplot/create",ob="/workspace/lineplot/rename",cb="/workspace/lineplot/set-data",lb="/workspace/lineplot/delete",hb=i.z.object({keys:Nt.array()}),ub=i.z.object({workspace:Ee,linePlots:sc.array()}),db=i.z.object({key:Nt,name:i.z.string()}),fb=i.z.object({key:Nt,data:i.z.string()}),yb=i.z.object({keys:Nt.array()}),gb=i.z.object({linePlots:X(on)}),pb=i.z.object({linePlots:on.array()}),Ln=i.z.object({});let sl=class{constructor(e){l(this,"client");this.client=e}async create(e,t){const n=Array.isArray(t),s=await m(this.client,ab,{workspace:e,linePlots:b(t)},ub,pb);return n?s.linePlots:s.linePlots[0]}async rename(e,t){await m(this.client,ob,{key:e,name:t},db,Ln)}async setData(e,t){await m(this.client,cb,{key:e,data:JSON.stringify(t)},fb,Ln)}async retrieve(e){const t=Array.isArray(e),n=await m(this.client,ib,{keys:b(e)},hb,gb);return t?n.linePlots:n.linePlots[0]}async delete(e){await m(this.client,lb,{keys:b(e)},yb,Ln)}};const wb=r=>new E({type:Js,key:r}),mb=Object.freeze(Object.defineProperty({__proto__:null,Client:sl,ONTOLOGY_TYPE:Js,keyZ:Nt,linePlotZ:on,newZ:sc,ontologyID:wb},Symbol.toStringTag,{value:"Module"})),bb="/workspace/log/retrieve",vb="/workspace/log/create",Tb="/workspace/log/rename",Ob="/workspace/log/set-data",Sb="/workspace/log/delete",Eb=i.z.object({keys:It.array()}),zb=i.z.object({workspace:Ee,logs:ic.array()}),Nb=i.z.object({key:It,name:i.z.string()}),Ib=i.z.object({key:It,data:i.z.string()}),$b=i.z.object({keys:It.array()}),xb=i.z.object({logs:cn.array()}),kb=i.z.object({logs:cn.array()}),_n=i.z.object({});let il=class{constructor(e){l(this,"client");this.client=e}async create(e,t){const n=Array.isArray(t),s=await m(this.client,vb,{workspace:e,logs:b(t)},zb,kb);return n?s.logs:s.logs[0]}async rename(e,t){await m(this.client,Tb,{key:e,name:t},Nb,_n)}async setData(e,t){await m(this.client,Ob,{key:e,data:JSON.stringify(t)},Ib,_n)}async retrieve(e){const t=Array.isArray(e),n=await m(this.client,bb,{keys:b(e)},Eb,xb);return t?n.logs:n.logs[0]}async delete(e){await m(this.client,Sb,{keys:b(e)},$b,_n)}};const Ab=r=>new E({type:Xs,key:r}),Ub=Object.freeze(Object.defineProperty({__proto__:null,Client:il,ONTOLOGY_TYPE:Xs,keyZ:It,logZ:cn,newZ:ic,ontologyID:Ab},Symbol.toStringTag,{value:"Module"})),Cb="/workspace/schematic/retrieve",Rb="/workspace/schematic/create",Bb="/workspace/schematic/rename",Pb="/workspace/schematic/set-data",Db="/workspace/schematic/delete",Mb="/workspace/schematic/copy",jb=i.z.object({keys:rt.array()}),Lb=i.z.object({workspace:Ee,schematics:cc.array()}),_b=i.z.object({key:rt,name:i.z.string()}),Zb=i.z.object({key:rt,data:i.z.string()}),qb=i.z.object({keys:rt.array()}),Fb=i.z.object({key:rt,name:i.z.string(),snapshot:i.z.boolean()}),Yb=i.z.object({schematics:X(Qs)}),Wb=i.z.object({schematics:Qs.array()}),Vb=i.z.object({schematic:un}),Zn=i.z.object({});let al=class{constructor(e){l(this,"client");this.client=e}async create(e,t){const n=Array.isArray(t),s=await m(this.client,Rb,{workspace:e,schematics:b(t)},Lb,Wb);return n?s.schematics:s.schematics[0]}async rename(e,t){await m(this.client,Bb,{key:e,name:t},_b,Zn)}async setData(e,t){await m(this.client,Pb,{key:e,data:JSON.stringify(t)},Zb,Zn)}async retrieve(e){const t=Array.isArray(e),n=await m(this.client,Cb,{keys:b(e)},jb,Yb);return t?n.schematics:n.schematics[0]}async delete(e){await m(this.client,Db,{keys:b(e)},qb,Zn)}async copy(e,t,n){return(await m(this.client,Mb,{key:e,name:t,snapshot:n},Fb,Vb)).schematic}};const Gb=r=>new E({type:ei,key:r}),Hb=Object.freeze(Object.defineProperty({__proto__:null,Client:al,ONTOLOGY_TYPE:ei,keyZ:rt,newZ:cc,ontologyID:Gb,remoteZ:Qs,schematicZ:un},Symbol.toStringTag,{value:"Module"})),Kb="/workspace/table/retrieve",Jb="/workspace/table/create",Xb="/workspace/table/rename",Qb="/workspace/table/set-data",ev="/workspace/table/delete",tv=i.z.object({keys:$t.array()}),rv=i.z.object({workspace:Ee,tables:lc.array()}),nv=i.z.object({key:$t,name:i.z.string()}),sv=i.z.object({key:$t,data:i.z.string()}),iv=i.z.object({keys:$t.array()}),av=i.z.object({tables:ri.array()}),ov=i.z.object({tables:ri.array()}),qn=i.z.object({});let ol=class{constructor(e){l(this,"client");this.client=e}async create(e,t){const n=Array.isArray(t),s=await m(this.client,Jb,{workspace:e,tables:b(t)},rv,ov);return n?s.tables:s.tables[0]}async rename(e,t){await m(this.client,Xb,{key:e,name:t},nv,qn)}async setData(e,t){await m(this.client,Qb,{key:e,data:JSON.stringify(t)},sv,qn)}async retrieve(e){const t=Array.isArray(e),n=await m(this.client,Kb,{keys:b(e)},tv,av);return t?n.tables:n.tables[0]}async delete(e){await m(this.client,ev,{keys:b(e)},iv,qn)}};const cv=r=>new E({type:ni,key:r}),lv=Object.freeze(Object.defineProperty({__proto__:null,Client:ol,ONTOLOGY_TYPE:ni,keyZ:$t,newZ:lc,ontologyID:cv,remoteZ:ri,tableZ:ti},Symbol.toStringTag,{value:"Module"})),Ar="/workspace/retrieve",hv="/workspace/create",uv="/workspace/rename",dv="/workspace/set-layout",fv="/workspace/delete",Ur=i.z.object({keys:Ee.array().optional(),search:i.z.string().optional(),author:tt.optional(),offset:i.z.number().optional(),limit:i.z.number().optional()}),yv=i.z.object({workspaces:ac.array()}),gv=i.z.object({key:Ee,name:i.z.string()}),pv=i.z.object({key:Ee,layout:i.z.string()}),wv=i.z.object({keys:Ee.array()}),Cr=i.z.object({workspaces:X(ln)}),mv=i.z.object({workspaces:oc.array()}),Fn=i.z.object({});class cl{constructor(e){l(this,"type",hn);l(this,"schematic");l(this,"linePlot");l(this,"log");l(this,"table");l(this,"client");this.client=e,this.schematic=new al(e),this.linePlot=new sl(e),this.log=new il(e),this.table=new ol(e)}async create(e){const t=Array.isArray(e),n=await m(this.client,hv,{workspaces:b(e)},yv,mv);return t?n.workspaces:n.workspaces[0]}async rename(e,t){await m(this.client,uv,{key:e,name:t},gv,Fn)}async setLayout(e,t){await m(this.client,dv,{key:e,layout:JSON.stringify(t)},pv,Fn)}async retrieve(e){const t=Array.isArray(e),n=await m(this.client,Ar,{keys:b(e)},Ur,Cr);return t?n.workspaces:n.workspaces[0]}async retrieveByAuthor(e){return(await m(this.client,Ar,{author:e},Ur,Cr)).workspaces}async search(e){return(await m(this.client,Ar,{search:e},Ur,Cr)).workspaces}async page(e,t){return(await m(this.client,Ar,{offset:e,limit:t},Ur,Cr)).workspaces}async delete(e){await m(this.client,fv,{keys:b(e)},wv,Fn)}}const bv=r=>new E({type:hn,key:r}),vv=Object.freeze(Object.defineProperty({__proto__:null,Client:cl,ONTOLOGY_TYPE:hn,keyZ:Ee,newZ:ac,ontologyID:bv,remoteZ:oc,workspaceZ:ln},Symbol.toStringTag,{value:"Module"})),ll=i.z.object({host:i.z.string({error:"Host is required"}).min(1,"Host is required"),port:i.z.number({error:"Port is required"}).or(i.z.string({error:"Port is required"})),username:i.z.string().min(1,"Username is required"),password:i.z.string().min(1,"Password is required"),connectivityPollFrequency:O.z.default(O.seconds(30)),secure:i.z.boolean().optional().default(!1),name:i.z.string().optional(),retry:Do.breakerConfig.optional()});class hl extends jc{constructor(t){const n=ll.parse(t),{host:s,port:a,username:o,password:c,connectivityPollFrequency:h,secure:d,retry:f}=n,u=new sb(new yy({host:s,port:Number(a)}),f,d);u.use(bg);let N;o!=null&&c!=null&&(N=new Hp(u.unary,{username:o,password:c}),u.use(N.middleware()));const S=new oi(new ar(u.unary)),j=new $c(u.unary,S);super(u.stream,u.unary,S);l(this,"createdAt");l(this,"props");l(this,"ranges");l(this,"channels");l(this,"auth");l(this,"user");l(this,"access");l(this,"connectivity");l(this,"ontology");l(this,"workspaces");l(this,"labels");l(this,"hardware");l(this,"control");l(this,"transport");l(this,"clientVersion","0.42.1");this.createdAt=z.now(),this.props=n,this.auth=N,this.transport=u,this.channels=new zc(this,S,u.unary,j),this.connectivity=new cr(u.unary,h,this.clientVersion,n.name),this.control=new _c(this),this.ontology=new mc(u.unary,this);const U=new nl(this.transport.unary);this.labels=new Qc(this.transport.unary,this,this.ontology),this.ranges=new rl(this,U,this.transport.unary,S,this.labels,this.ontology),this.access=new Tc(this.transport.unary),this.user=new xc(this.transport.unary),this.workspaces=new cl(this.transport.unary);const ee=new qc(this.transport.unary,this),A=new Gc(this.transport.unary,this,this.ontology,this.ranges),st=new Fc(this.transport.unary,A,this);this.hardware=new Zc(A,st,ee)}get key(){return this.createdAt.valueOf().toString()}close(){this.connectivity.stopChecking()}}l(hl,"connectivity",cr);exports.AuthError=sr;exports.Channel=ci;exports.ContiguityError=pg;exports.DataType=x;exports.Density=ne;exports.Frame=V;exports.MultiSeries=Ro;exports.MultipleFoundError=Xe;exports.NotFoundError=Je;exports.QueryError=ke;exports.Rate=cs;exports.RouteError=ms;exports.Series=_e;exports.Synnax=hl;exports.TimeRange=q;exports.TimeSpan=O;exports.TimeStamp=z;exports.UnexpectedError=mt;exports.ValidationError=F;exports.access=tp;exports.channel=Op;exports.connection=Jp;exports.control=$w;exports.device=_w;exports.framer=Ow;exports.group=Ag;exports.hardware=xw;exports.isCalculated=or;exports.label=Em;exports.linePlot=mb;exports.log=Ub;exports.ontology=Lg;exports.policy=ep;exports.rack=Hw;exports.ranger=rb;exports.schematic=Hb;exports.signals=kw;exports.synnaxPropsZ=ll;exports.table=lv;exports.task=hm;exports.user=_p;exports.workspace=vv;
149
+ `);const l=new Ft({data:r[u],dataType:c.dataType});a.push(c.key),o.push(l)}return new Je(a,o)}if(e instanceof Je||e instanceof Map){const a=new Je(e);if(this.adapter==null)return a;const o=a.columns.map(u=>{var l;const c=typeof u=="string"?(l=this.adapter)==null?void 0:l.get(u):u;if(c==null)throw new Ce(`
150
+ Channel ${u} was not provided in the list of channels when opening the writer
151
+ `);return c});return new Je(o,a.series)}const i=[],n=[],s=Object.entries(e);for(let a=0;a<s.length;a++){const[o,u]=s[a],c=await this.fetchChannel(o),l=new Ft({data:u,dataType:c.dataType});i.push(c.key),n.push(l)}return new Je(i,n)}}class CO{constructor(e,r){f(this,"name");f(this,"stream");this.stream=r,this.name=e}async receive(){const[e,r]=await this.stream.receive();if(r!=null)throw r;return e}received(){return this.stream.received()}async closeAndAck(){for(this.stream.closeSend();;){const[e,r]=await this.stream.receive();if(e!=null&&console.warn(`${this.name} received unexpected response on ${JSON.stringify(e)} closure.
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;