@synnaxlabs/client 0.42.3 → 0.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +28499 -9313
  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 +20 -21
  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 +11 -12
  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 fl=Object.defineProperty;var yl=(r,e,t)=>e in r?fl(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var l=(r,e,t)=>yl(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 gl=Object.defineProperty,pl=(r,e,t)=>e in r?gl(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,G=(r,e,t)=>pl(r,typeof e!="symbol"?e+"":e,t);const wl=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)},$a=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=bl(n);const s={},a=t;return Object.keys(a).forEach(o=>{let c=a[o];const h=r(o);n.recursive&&(wn(c)?bi(c,n.keepTypesOnRecursion)||(c=e(c,n)):n.recursiveInArray&&mi(c)&&(c=[...c].map(d=>{let f=d;return wn(d)?bi(f,n.keepTypesOnRecursion)||(f=e(d,n)):mi(d)&&(f=e({key:d},n).key),f}))),s[h]=c}),s};return e},Ns=$a(wl),ml=r=>r.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`),xa=$a(ml),Yn={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},bl=(r=Yn)=>(r.recursive==null?r=Yn:r.recursiveInArray??(r.recursiveInArray=!1),r),mi=r=>r!=null&&Array.isArray(r),wn=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),bi=(r,e)=>(e||[]).some(t=>r instanceof t),Is=r=>r!=null&&typeof r=="object"&&!Array.isArray(r);var vl=Object.defineProperty,Tl=(r,e,t)=>e in r?vl(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,yt=(r,e,t)=>Tl(r,typeof e!="symbol"?e+"":e,t);function Ol(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 Sl(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 El=new TextEncoder,zl=50;function Nl(r,e,t){El.encodeInto(r,e.subarray(t))}function Il(r,e,t){r.length>zl?Nl(r,e,t):Sl(r,e,t)}const $l=4096;function ka(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>=$l&&(o+=String.fromCharCode(...a),a.length=0)}return a.length>0&&(o+=String.fromCharCode(...a)),o}const xl=new TextDecoder,kl=200;function Al(r,e,t){const n=r.subarray(e,e+t);return xl.decode(n)}function Ul(r,e,t){return t>kl?Al(r,e,t):ka(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 Cl(r,e,t){const n=t/4294967296,s=t;r.setUint32(e,n),r.setUint32(e+4,s)}function Aa(r,e,t){const n=Math.floor(t/4294967296),s=t;r.setUint32(e,n),r.setUint32(e+4,s)}function Ua(r,e){const t=r.getInt32(e),n=r.getUint32(e+4);return t*4294967296+n}function Rl(r,e){const t=r.getUint32(e),n=r.getUint32(e+4);return t*4294967296+n}const Bl=-1,Pl=4294967296-1,Dl=17179869184-1;function Ml({sec:r,nsec:e}){if(r>=0&&e>=0&&r<=Dl)if(e===0&&r<=Pl){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),Aa(n,4,r),t}}function jl(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 Ll(r){if(r instanceof Date){const e=jl(r);return Ml(e)}else return null}function _l(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=Ua(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 Zl(r){const e=_l(r);return new Date(e.sec*1e3+e.nsec/1e6)}const ql={type:Bl,encode:Ll,decode:Zl};let tr=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(ql)}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 Fl(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):Fl(r)?new Uint8Array(r):Uint8Array.from(r)}const Yl=100,Wl=2048;let Vl=class Ca{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)??Yl,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??Wl,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 Ca({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=Ol(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),Il(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),Cl(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),Aa(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 Vl(e).encodeSharedRef(r)}function mn(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const Gl=16,Hl=16;class Kl{constructor(e=Gl,t=Hl){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=ka(e,t,n),o=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(o,a),a}}const Gn="array",Ht="map_key",Ra="map_value",Jl=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 Xl{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===Ra){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)),Ql=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 vi=new RangeError("Insufficient data"),eh=new Kl;let th=class Ba{constructor(e){this.totalPos=0,this.pos=0,this.view=$s,this.bytes=Ql,this.headByte=Ut,this.stack=new Xl,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:eh,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??Jl}clone(){return new Ba({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=Ra;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 vi;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=Ul(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 vi;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=Rl(this.view,this.pos);return this.pos+=8,e}readI64(){const e=Ua(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 Pa(r,e){return new th(e).decode(r)}let rh=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=xa(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(){}},nh=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(){}},sh=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=>Pa(r,{extensionCodec:De})});let ih=class{constructor(){yt(this,"contentType","application/msgpack")}encode(r){const e=xa(r);return Bt(e,{extensionCodec:De}).slice()}decode(r,e){const t=Pa(r,{extensionCodec:De}),n=Ns(t);return e!=null?e.parse(n):n}static registerCustomType(){}};const Rr=new rh;new nh;new sh;new ih;const ah=r=>r!=null&&typeof r=="object"&&"toString"in r,oh=(r,e=!1)=>{const t=ah(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?ch(n):n},ch=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 Da=i.z.object({width:i.z.number(),height:i.z.number()}),lh=i.z.object({signedWidth:i.z.number(),signedHeight:i.z.number()}),hh=["width","height"];i.z.enum(hh);const uh=["start","center","end"],dh=["signedWidth","signedHeight"];i.z.enum(dh);const jr=i.z.object({x:i.z.number(),y:i.z.number()}),fh=i.z.object({clientX:i.z.number(),clientY:i.z.number()}),yh=["x","y"],Ma=i.z.enum(yh),ja=["top","right","bottom","left"];i.z.enum(ja);const gh=["left","right"],La=i.z.enum(gh),ph=["top","bottom"],_a=i.z.enum(ph),Za=["center"],Ti=i.z.enum(Za),wh=[...ja,...Za],qa=i.z.enum(wh);i.z.enum(uh);const mh=["first","last"];i.z.enum(mh);const bh=i.z.object({lower:i.z.number(),upper:i.z.number()}),vh=i.z.object({lower:i.z.bigint(),upper:i.z.bigint()});i.z.union([bh,Vr]);i.z.union([vh,Vr]);i.z.enum([...Ma.options,...qa.options]);i.z.union([Ma,qa,i.z.instanceof(String)]);const Th=r=>typeof r=="bigint"||r instanceof BigInt,it=(r,e)=>Th(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 Oi(r);return Oi(t)},Oi=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r,Si=(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:La.or(Ti),y:_a.or(Ti)});const Oh=i.z.object({x:La,y:_a}),Sh=Object.freeze({x:"left",y:"top"}),Eh=(r,e)=>r.x===e.x&&r.y===e.y,Ei=i.z.union([i.z.number(),jr,Vr,Da,lh,fh]),zh=(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}},zi=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:Oh});const xs=(r,e,t=0,n=0,s)=>{const a={one:{...zi},two:{...zi},root:s??Sh};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}},Nh=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Ih=i.z.object({signedWidth:i.z.number(),signedHeight:i.z.number()});i.z.union([Da,Ih,jr,Vr]);var $h=Object.defineProperty,xh=(r,e,t)=>e in r?$h(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$e=(r,e,t)=>xh(r,typeof e!="symbol"?e+"":e,t);const kh=(r,e,t)=>e!==void 0&&r<e?e:t!==void 0&&r>t?t:r;i.z.object({offset:Ei,scale:Ei});i.z.object({offset:i.z.number(),scale:i.z.number()});const Ah=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],Uh=r=>(e,t,n,s)=>[e,s?n/r:n*r],Ch=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]},Rh=r=>(e,t,n)=>[r,n],Bh=()=>(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)]},Ph=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=kh(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=Ah(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Uh(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=Ge(e,t),s=this.new(),a=Ch(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=Ge(e,t),s=this.new(),a=Ph(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=Ge(e,t),s=this.new(),a=Rh(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=Bh();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 Ni=Hn;const Ii=class Ne{constructor(e=new Ni,t=new Ni,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=zh(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(Nh(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Eh(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(Ii,"IDENTITY",new Ii);var Dh=Object.defineProperty,Mh=(r,e,t)=>e in r?Dh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e,t)=>Mh(r,typeof e!="symbol"?e+"":e,t);let jh=(r,e=21)=>(t=e)=>{let n="",s=t|0;for(;s--;)n+=r[Math.random()*r.length|0];return n};const Lh="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",_h=jh(Lh,11),Zh=()=>_h(),qh=i.z.enum(["static","dynamic"]),Fa=(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 Fa(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 $i?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 $i?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 Fa(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 $i=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 Ya=r=>{const e=typeof r;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||r instanceof M||r instanceof k||r instanceof Date},Fh=(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),Yh=r=>r==null?!1:Array.isArray(r)||r instanceof ArrayBuffer||ArrayBuffer.isView(r)&&!(r instanceof DataView)||r instanceof Hh?!0:Ya(r),Ce=-1,Wh=i.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer),Vh=i.z.union([i.z.null(),i.z.undefined()]).transform(()=>new Uint8Array().buffer),Jn=10,Gh=(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"),Yh(e)&&(e={data:e});const{dataType:t,timeRange:n,sampleOffset:s=0,glBufferUsage:a="static",alignment:o=0n,key:c=Zh()}=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=Ya(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 pS=Object.defineProperty;var vS=(t,e,r)=>e in t?pS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var f=(t,e,r)=>vS(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const gS=t=>Array.isArray(t)?t:t==null?[]:[t],C=Object.freeze(Object.defineProperty({__proto__:null,toArray:gS},Symbol.toStringTag,{value:"Module"})),yS=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)},Ch=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=wS(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)?Lm(o,i.keepTypesOnRecursion)||(o=e(o,i)):i.recursiveInArray&&Rm(o)&&(o=[...o].map(c=>{let l=c;return ro(c)?Lm(l,i.keepTypesOnRecursion)||(l=e(c,i)):Rm(c)&&(l=e({key:c},i).key),l}))),n[u]=o}),n)};return e},Rh=Ch(yS),$S=t=>t.replace(/([a-z0-9])([A-Z])/g,(e,r,i)=>`${r}_${i.toLowerCase()}`),bS=Ch($S),xo={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},wS=(t=xo)=>(t.recursive==null?t=xo:t.recursiveInArray??(t.recursiveInArray=!1),t),Rm=t=>t!=null&&Array.isArray(t),ro=t=>t!=null&&typeof t=="object"&&!Array.isArray(t),Lm=(t,e)=>(e||[]).some(r=>t instanceof r),Lh=t=>t!=null&&typeof t=="object"&&!Array.isArray(t);var _S=Object.defineProperty,kS=(t,e,r)=>e in t?_S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xr=(t,e,r)=>kS(t,typeof e!="symbol"?e+"":e,r);let Mh=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=Rh(i);return r!=null?r.parse(n):n}encodeString(e){const r=bS(e);return JSON.stringify(r,(i,n)=>ArrayBuffer.isView(n)?Array.from(n):typeof n=="bigint"?n.toString():n)}},Bh=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||!Lh(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}},Fh=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 Mh,IS=new Bh,OS=new Fh,SS=[ii],Nn=Object.freeze(Object.defineProperty({__proto__:null,CSVCodec:Bh,CSV_CODEC:IS,ENCODERS:SS,JSONCodec:Mh,JSON_CODEC:ii,TEXT_CODEC:OS,TextCodec:Fh},Symbol.toStringTag,{value:"Module"})),NS=t=>[...new Set(t)],TS=(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())},Mm=Object.freeze(Object.defineProperty({__proto__:null,by:TS,unique:NS},Symbol.toStringTag,{value:"Module"}));var zS=Object.defineProperty,xS=(t,e,r)=>e in t?zS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ES=(t,e,r)=>xS(t,e+"",r);let br=class{constructor(e){ES(this,"value"),this.value=e}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const US=t=>t!=null&&typeof t=="object"&&"toString"in t,ZS=(t,e=!1)=>{const r=US(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?PS(i):i},PS=t=>(e,r)=>t(r,e),Hs=0,io=-1,so=1,jS=t=>t<Hs,AS=t=>t>Hs,DS=t=>t===Hs;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 qh=Symbol("zod_brand");let sr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};const _s={};function lt(t){return t&&Object.assign(_s,t),_s}function CS(t){return t}function RS(t){return t}function LS(t){}function MS(t){throw new Error}function BS(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 Jh(t,e){return typeof e=="bigint"?e.toString():e}function Qs(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Tn(t){return t==null}function ea(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Vh(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 FS(t,e){return e?e.reduce((r,i)=>r==null?void 0:r[i],t):t}function qS(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 Wh=Qs(()=>{if(typeof navigator<"u"&&navigator!=null&&navigator.userAgent.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function ks(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 JS(t){let e=0;for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}const VS=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}`)}},Is=new Set(["string","number","symbol"]),Gh=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 WS(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 Yh(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Kh={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]},Xh={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Hh(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 Qh(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 ep(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 tp(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 np(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 rp(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 ta(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function na(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 GS(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}let YS=class{constructor(...e){}};const KS=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:Xh,Class:YS,NUMBER_FORMAT_RANGES:Kh,aborted:Qn,allowsEval:Wh,assert:BS,assertEqual:CS,assertIs:LS,assertNever:MS,assertNotEqual:RS,assignProp:wr,cached:Qs,cleanEnum:GS,cleanRegex:ea,clone:jt,createTransparentProxy:WS,defineLazy:ie,esc:Bn,escapeRegex:zn,extend:ep,finalizeIssue:kt,floatSafeRemainder:Vh,getElementAtPath:FS,getEnumValues:Iu,getLengthableOrigin:na,getParsedType:VS,getSizableOrigin:ta,isObject:si,isPlainObject:ks,issue:ar,joinValues:P,jsonStringifyReplacer:Jh,merge:tp,normalizeParams:N,nullish:Tn,numKeys:JS,omit:Qh,optionalKeys:Yh,partial:np,pick:Hh,prefixIssues:gt,primitiveTypes:Gh,promiseAllObject:qS,propertyKeyTypes:Is,randomString:Ou,required:rp,stringifyPrimitive:K,unwrapMessage:Rr},Symbol.toStringTag,{value:"Module"})),ip=(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,Jh,2)},enumerable:!0})},Su=$("$ZodError",ip),Oi=$("$ZodError",ip,{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 sp(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 ap(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 op(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 ${ap(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}},up=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}},cp=Uu(Oi),lp=/^[cC][^\s-]{8,}$/,dp=/^[0-9a-z]+$/,mp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fp=/^[0-9a-vA-V]{20}$/,hp=/^[A-Za-z0-9]{27}$/,pp=/^[a-zA-Z0-9_-]{21}$/,vp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,XS=/^[-+]?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)?)??$/,gp=/^([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)$/,HS=or(4),QS=or(6),eN=or(7),yp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tN=/^[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])?)*$/,nN=/^(([^<>()\[\]\\.,;:\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,}))$/,rN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,iN=/^[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])?)*$/,$p="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function bp(){return new RegExp($p,"u")}const wp=/^(?:(?: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])$/,_p=/^(([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})$/,kp=/^((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])$/,Ip=/^(([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])$/,Op=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zu=/^[A-Za-z0-9_-]*$/,Sp=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,sN=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Np=/^\+(?:[0-9]){6,14}[0-9]$/,Tp="(?:(?:\\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])))",zp=new RegExp(`^${Tp}$`);function xp(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 Ep(t){return new RegExp(`^${xp(t)}$`)}function Up(t){const e=xp({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(`^${Tp}T(?:${i})$`)}const Zp=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}$`)},Pp=/^\d+n?$/,jp=/^\d+$/,Ap=/^-?\d+(?:\.\d+)?/i,Dp=/true|false/i,Cp=/null/i,Rp=/undefined/i,Lp=/^[^A-Z]*$/,Mp=/^[^a-z]*$/,Bp=Object.freeze(Object.defineProperty({__proto__:null,_emoji:$p,base64:Op,base64url:Zu,bigint:Pp,boolean:Dp,browserEmail:iN,cidrv4:kp,cidrv6:Ip,cuid:lp,cuid2:dp,date:zp,datetime:Up,domain:sN,duration:vp,e164:Np,email:yp,emoji:bp,extendedDuration:XS,guid:gp,hostname:Sp,html5Email:tN,integer:jp,ipv4:wp,ipv6:_p,ksuid:hp,lowercase:Lp,nanoid:pp,null:Cp,number:Ap,rfc5322Email:nN,string:Zp,time:Ep,ulid:mp,undefined:Rp,unicodeEmail:rN,uppercase:Mp,uuid:or,uuid4:HS,uuid6:QS,uuid7:eN,xid:fp},Symbol.toStringTag,{value:"Module"})),Re=$("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Fp={number:"number",bigint:"bigint",object:"date"},Pu=$("$ZodCheckLessThan",(t,e)=>{Re.init(t,e);const r=Fp[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=Fp[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})}}),qp=$("$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):Vh(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})}}),Jp=$("$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]=Kh[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=jp)}),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})}}),Vp=$("$ZodCheckBigIntFormat",(t,e)=>{Re.init(t,e);const[r,i]=Xh[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})}}),Wp=$("$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:ta(i),code:"too_big",maximum:e.maximum,input:i,inst:t,continue:!e.abort})}}),Gp=$("$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:ta(i),code:"too_small",minimum:e.minimum,input:i,inst:t,continue:!e.abort})}}),Yp=$("$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:ta(i),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},input:r.value,inst:t,continue:!e.abort})}}),Kp=$("$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=na(i);r.issues.push({origin:n,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Xp=$("$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=na(i);r.issues.push({origin:n,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Hp=$("$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=na(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})})}),Qp=$("$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})}}),ev=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Lp),Si.init(t,e)}),tv=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Mp),Si.init(t,e)}),nv=$("$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})}}),rv=$("$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})}}),iv=$("$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 Bm(t,e,r){t.issues.length&&e.issues.push(...gt(r,t.issues))}const sv=$("$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=>Bm(n,r,e.property));Bm(i,r,e.property)}}),av=$("$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})}}),ov=$("$ZodCheckOverwrite",(t,e)=>{Re.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});let uv=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 cv={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=cv;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=up(t,s);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return cp(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()??Zp(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)}),lv=$("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=gp),$e.init(t,e)}),dv=$("$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)}),mv=$("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=yp),$e.init(t,e)}),fv=$("$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:Sp.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})}}}),hv=$("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=bp()),$e.init(t,e)}),pv=$("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=pp),$e.init(t,e)}),vv=$("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=lp),$e.init(t,e)}),gv=$("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=dp),$e.init(t,e)}),yv=$("$ZodULID",(t,e)=>{e.pattern??(e.pattern=mp),$e.init(t,e)}),$v=$("$ZodXID",(t,e)=>{e.pattern??(e.pattern=fp),$e.init(t,e)}),bv=$("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=hp),$e.init(t,e)}),wv=$("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Up(e)),$e.init(t,e),t._zod.check}),_v=$("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=zp),$e.init(t,e)}),kv=$("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Ep(e)),$e.init(t,e),t._zod.check}),Iv=$("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=vp),$e.init(t,e)}),Ov=$("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=wp),$e.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv4"})}),Sv=$("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=_p),$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})}}}),Nv=$("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=kp),$e.init(t,e)}),Tv=$("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Ip),$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 zv=$("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Op),$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 xv(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 Ev=$("$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=>{xv(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Uv=$("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Np),$e.init(t,e)});function Zv(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 Pv=$("$ZodJWT",(t,e)=>{$e.init(t,e),t._zod.check=r=>{Zv(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??Ap,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}}),jv=$("$ZodNumber",(t,e)=>{Jp.init(t,e),Du.init(t,e)}),Cu=$("$ZodBoolean",(t,e)=>{B.init(t,e),t._zod.pattern=Dp,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=Pp,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}}),Av=$("$ZodBigInt",(t,e)=>{Vp.init(t,e),Ru.init(t,e)}),Dv=$("$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}}),Cv=$("$ZodUndefined",(t,e)=>{B.init(t,e),t._zod.pattern=Rp,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}}),Rv=$("$ZodNull",(t,e)=>{B.init(t,e),t._zod.pattern=Cp,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}}),Lv=$("$ZodAny",(t,e)=>{B.init(t,e),t._zod.parse=r=>r}),Os=$("$ZodUnknown",(t,e)=>{B.init(t,e),t._zod.parse=r=>r}),Mv=$("$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)}),Bv=$("$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}}),Fv=$("$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 Fm(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=>Fm(c,r,a))):Fm(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function Xi(t,e,r){t.issues.length&&e.issues.push(...gt(r,t.issues)),e.value[r]=t.value}function qm(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 qv=$("$ZodObject",(t,e)=>{B.init(t,e);const r=Qs(()=>{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=Yh(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 uv(["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=!_s.jitless,o=a&&Wh.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?qm(ce,l,w,g):Xi(ce,l,w))):J?qm(A,l,w,g):Xi(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=>Xi(I,l,v))):Xi(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 Jm(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=>ea(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=>Jm(a,r,t,i)):Jm(s,r,t,i)}}),Jv=$("$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=Qs(()=>{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)}}),Vv=$("$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])=>Vm(r,o,u)):Vm(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(ks(t)&&ks(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 Vm(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 ra=$("$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=>Hi(d,n,u))):Hi(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=>Hi(g,n,u))):Hi(d,n,u)}}return o.length?Promise.all(o).then(()=>n):n}});function Hi(t,e,r){t.issues.length&&e.issues.push(...gt(r,t.issues)),e.value[r]=t.value}const Wv=$("$ZodRecord",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!ks(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}}),Gv=$("$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])=>{Wm(l,d,r,a,n,t,i)})):Wm(u,c,r,a,n,t,i)}return s.length?Promise.all(s).then(()=>r):r}});function Wm(t,e,r,i,n,s,a){t.issues.length&&(Is.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&&(Is.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 Yv=$("$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=>Gm(u,r))):Gm(o,r)}return s.length?Promise.all(s).then(()=>r):r}});function Gm(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}const Kv=$("$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=>Is.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}}),Xv=$("$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}}),Hv=$("$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}}),Qv=$("$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(`^(${ea(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>r.value===void 0?r:e.innerType._zod.run(r,i)}),eg=$("$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(`^(${ea(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)}),tg=$("$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=>Ym(s,e)):Ym(n,e)}});function Ym(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const ng=$("$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))}),rg=$("$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=>Km(s,t)):Km(n,t)}});function Km(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 ig=$("$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)}}),sg=$("$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)}}),ag=$("$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=>Xm(s,e,i)):Xm(n,e,i)}});function Xm(t,e,r){return Qn(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const og=$("$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(Hm):Hm(n)}});function Hm(t){return t.value=Object.freeze(t.value),t}const ug=$("$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||Gh.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)}),cg=$("$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))}),lg=$("$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)}),dg=$("$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=>Qm(s,r,i,t));Qm(n,r,i,t)}});function Qm(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 mg=Symbol("ZodOutput"),fg=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 hg(t,e){return new t({type:"string",...N(e)})}function pg(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 Ss(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 vg={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function gg(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N(e)})}function yg(t,e){return new t({type:"string",format:"date",check:"string_format",...N(e)})}function $g(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...N(e)})}function bg(t,e){return new t({type:"string",format:"duration",check:"string_format",...N(e)})}function wg(t,e){return new t({type:"number",checks:[],...N(e)})}function _g(t,e){return new t({type:"number",coerce:!0,checks:[],...N(e)})}function kg(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...N(e)})}function Ig(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...N(e)})}function Og(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...N(e)})}function Sg(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...N(e)})}function Ng(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...N(e)})}function Tg(t,e){return new t({type:"boolean",...N(e)})}function zg(t,e){return new t({type:"boolean",coerce:!0,...N(e)})}function xg(t,e){return new t({type:"bigint",...N(e)})}function Eg(t,e){return new t({type:"bigint",coerce:!0,...N(e)})}function Ug(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...N(e)})}function Zg(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...N(e)})}function Pg(t,e){return new t({type:"symbol",...N(e)})}function jg(t,e){return new t({type:"undefined",...N(e)})}function Ag(t,e){return new t({type:"null",...N(e)})}function Dg(t){return new t({type:"any"})}function Ns(t){return new t({type:"unknown"})}function Cg(t,e){return new t({type:"never",...N(e)})}function Rg(t,e){return new t({type:"void",...N(e)})}function Lg(t,e){return new t({type:"date",...N(e)})}function Mg(t,e){return new t({type:"date",coerce:!0,...N(e)})}function Bg(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 Fg(t){return vn(0,t)}function qg(t){return pn(0,t)}function Jg(t){return wt(0,t)}function Vg(t){return ht(0,t)}function ai(t,e){return new qp({check:"multiple_of",...N(e),value:t})}function ia(t,e){return new Wp({check:"max_size",...N(e),maximum:t})}function oi(t,e){return new Gp({check:"min_size",...N(e),minimum:t})}function fc(t,e){return new Yp({check:"size_equals",...N(e),size:t})}function sa(t,e){return new Kp({check:"max_length",...N(e),maximum:t})}function ur(t,e){return new Xp({check:"min_length",...N(e),minimum:t})}function aa(t,e){return new Hp({check:"length_equals",...N(e),length:t})}function hc(t,e){return new Qp({check:"string_format",format:"regex",...N(e),pattern:t})}function pc(t){return new ev({check:"string_format",format:"lowercase",...N(t)})}function vc(t){return new tv({check:"string_format",format:"uppercase",...N(t)})}function gc(t,e){return new nv({check:"string_format",format:"includes",...N(e),includes:t})}function yc(t,e){return new rv({check:"string_format",format:"starts_with",...N(e),prefix:t})}function $c(t,e){return new iv({check:"string_format",format:"ends_with",...N(e),suffix:t})}function Wg(t,e,r){return new sv({check:"property",property:t,schema:e,...N(r)})}function bc(t,e){return new av({check:"mime_type",mime:t,...N(e)})}function xn(t){return new ov({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 aN(t,e,r){return new t({type:"union",options:e,...N(r)})}function oN(t,e,r,i){return new t({type:"union",options:r,discriminator:e,...N(i)})}function uN(t,e,r){return new t({type:"intersection",left:e,right:r})}function Gg(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 cN(t,e,r,i){return new t({type:"record",keyType:e,valueType:r,...N(i)})}function lN(t,e,r,i){return new t({type:"map",keyType:e,valueType:r,...N(i)})}function dN(t,e,r){return new t({type:"set",valueType:e,...N(r)})}function mN(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 fN(t,e,r){return new t({type:"enum",entries:e,...N(r)})}function hN(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...N(r)})}function Yg(t,e){return new t({type:"file",...N(e)})}function pN(t,e){return new t({type:"transform",transform:e})}function vN(t,e){return new t({type:"optional",innerType:e})}function gN(t,e){return new t({type:"nullable",innerType:e})}function yN(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():r}})}function $N(t,e,r){return new t({type:"nonoptional",innerType:e,...N(r)})}function bN(t,e){return new t({type:"success",innerType:e})}function wN(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function _N(t,e,r){return new t({type:"pipe",in:e,out:r})}function kN(t,e){return new t({type:"readonly",innerType:e})}function IN(t,e,r){return new t({type:"template_literal",parts:e,...N(r)})}function ON(t,e){return new t({type:"lazy",getter:e})}function SN(t,e){return new t({type:"promise",innerType:e})}function Kg(t,e,r){const i=N(r);return i.abort??(i.abort=!0),new t({type:"custom",check:"custom",fn:e,...i})}function Xg(t,e,r){return new t({type:"custom",check:"custom",fn:e,...N(r)})}function Hg(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)=>{wv.init(t,e),_e.init(t,e)});function Qg(t){return gg(Sc,t)}const Nc=$("ZodISODate",(t,e)=>{_v.init(t,e),_e.init(t,e)});function ey(t){return yg(Nc,t)}const Tc=$("ZodISOTime",(t,e)=>{kv.init(t,e),_e.init(t,e)});function ty(t){return $g(Tc,t)}const zc=$("ZodISODuration",(t,e)=>{Iv.init(t,e),_e.init(t,e)});function ny(t){return bg(zc,t)}const NN=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:Nc,ZodISODateTime:Sc,ZodISODuration:zc,ZodISOTime:Tc,date:ey,datetime:Qg,duration:ny,time:ty},Symbol.toStringTag,{value:"Module"})),ry=(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}}})},TN=$("ZodError",ry),Ti=$("ZodError",ry,{Parent:Error}),iy=zu(Ti),sy=xu(Ti),ay=Eu(Ti),oy=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)=>iy(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>ay(t,r,i),t.parseAsync=async(r,i)=>sy(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>oy(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(qy(r,i)),t.superRefine=r=>t.check(Jy(r)),t.overwrite=r=>t.check(xn(r)),t.optional=()=>zs(t),t.nullable=()=>xs(t),t.nullish=()=>zs(xs(t)),t.nonoptional=r=>Uy(t,r),t.array=()=>xi(t),t.or=r=>ze([t,r]),t.and=r=>by(t,r),t.transform=r=>Es(t,el(r)),t.default=r=>zy(t,r),t.prefault=r=>Ey(t,r),t.catch=r=>jy(t,r),t.pipe=r=>Es(t,r),t.readonly=()=>Cy(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(sa(...i)),t.length=(...i)=>t.check(aa(...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())}),oa=$("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(Ss(Ts,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(Ss(Ts,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(Qg(r)),t.date=r=>t.check(ey(r)),t.time=r=>t.check(ty(r)),t.duration=r=>t.check(ny(r))});function Ne(t){return hg(oa,t)}const _e=$("ZodStringFormat",(t,e)=>{$e.init(t,e),xc.init(t,e)}),Ec=$("ZodEmail",(t,e)=>{mv.init(t,e),_e.init(t,e)});function zN(t){return Vu(Ec,t)}const Ts=$("ZodGUID",(t,e)=>{lv.init(t,e),_e.init(t,e)});function xN(t){return Ss(Ts,t)}const Mt=$("ZodUUID",(t,e)=>{dv.init(t,e),_e.init(t,e)});function EN(t){return Wu(Mt,t)}function UN(t){return Gu(Mt,t)}function ZN(t){return Yu(Mt,t)}function PN(t){return Ku(Mt,t)}const Uc=$("ZodURL",(t,e)=>{fv.init(t,e),_e.init(t,e)});function jN(t){return Xu(Uc,t)}const Zc=$("ZodEmoji",(t,e)=>{hv.init(t,e),_e.init(t,e)});function AN(t){return Hu(Zc,t)}const Pc=$("ZodNanoID",(t,e)=>{pv.init(t,e),_e.init(t,e)});function DN(t){return Qu(Pc,t)}const jc=$("ZodCUID",(t,e)=>{vv.init(t,e),_e.init(t,e)});function CN(t){return ec(jc,t)}const Ac=$("ZodCUID2",(t,e)=>{gv.init(t,e),_e.init(t,e)});function RN(t){return tc(Ac,t)}const Dc=$("ZodULID",(t,e)=>{yv.init(t,e),_e.init(t,e)});function LN(t){return nc(Dc,t)}const Cc=$("ZodXID",(t,e)=>{$v.init(t,e),_e.init(t,e)});function MN(t){return rc(Cc,t)}const Rc=$("ZodKSUID",(t,e)=>{bv.init(t,e),_e.init(t,e)});function BN(t){return ic(Rc,t)}const Lc=$("ZodIPv4",(t,e)=>{Ov.init(t,e),_e.init(t,e)});function FN(t){return sc(Lc,t)}const Mc=$("ZodIPv6",(t,e)=>{Sv.init(t,e),_e.init(t,e)});function qN(t){return ac(Mc,t)}const Bc=$("ZodCIDRv4",(t,e)=>{Nv.init(t,e),_e.init(t,e)});function JN(t){return oc(Bc,t)}const Fc=$("ZodCIDRv6",(t,e)=>{Tv.init(t,e),_e.init(t,e)});function VN(t){return uc(Fc,t)}const qc=$("ZodBase64",(t,e)=>{zv.init(t,e),_e.init(t,e)});function WN(t){return cc(qc,t)}const Jc=$("ZodBase64URL",(t,e)=>{Ev.init(t,e),_e.init(t,e)});function GN(t){return lc(Jc,t)}const Vc=$("ZodE164",(t,e)=>{Uv.init(t,e),_e.init(t,e)});function YN(t){return dc(Vc,t)}const Wc=$("ZodJWT",(t,e)=>{Pv.init(t,e),_e.init(t,e)});function KN(t){return mc(Wc,t)}const ua=$("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 wg(ua,t)}const _r=$("ZodNumberFormat",(t,e)=>{jv.init(t,e),ua.init(t,e)});function Po(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)}function eT(t){return Ng(_r,t)}const ca=$("ZodBoolean",(t,e)=>{Cu.init(t,e),ee.init(t,e)});function Gc(t){return Tg(ca,t)}const la=$("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 xg(la,t)}const Yc=$("ZodBigIntFormat",(t,e)=>{Av.init(t,e),la.init(t,e)});function tT(t){return Ug(Yc,t)}function nT(t){return Zg(Yc,t)}const uy=$("ZodSymbol",(t,e)=>{Dv.init(t,e),ee.init(t,e)});function cy(t){return Pg(uy,t)}const ly=$("ZodUndefined",(t,e)=>{Cv.init(t,e),ee.init(t,e)});function dy(t){return jg(ly,t)}const my=$("ZodNull",(t,e)=>{Rv.init(t,e),ee.init(t,e)});function zi(t){return Ag(my,t)}const fy=$("ZodAny",(t,e)=>{Lv.init(t,e),ee.init(t,e)});function rT(){return Dg(fy)}const hy=$("ZodUnknown",(t,e)=>{Os.init(t,e),ee.init(t,e)});function cr(){return Ns(hy)}const py=$("ZodNever",(t,e)=>{Mv.init(t,e),ee.init(t,e)});function da(t){return Cg(py,t)}const vy=$("ZodVoid",(t,e)=>{Bv.init(t,e),ee.init(t,e)});function iT(t){return Rg(vy,t)}const Kc=$("ZodDate",(t,e)=>{Fv.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 sT(t){return Lg(Kc,t)}const gy=$("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(sa(r,i)),t.length=(r,i)=>t.check(aa(r,i)),t.unwrap=()=>t.element});function xi(t,e){return Oc(gy,t,e)}function aT(t){const e=t._zod.def.shape;return Oy(Object.keys(e))}const ma=$("ZodObject",(t,e)=>{qv.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:da()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>ep(t,r),t.merge=r=>tp(t,r),t.pick=r=>Hh(t,r),t.omit=r=>Qh(t,r),t.partial=(...r)=>np(tl,t,r[0]),t.required=(...r)=>rp(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 ma(r)}function oT(t,e){return new ma({type:"object",get shape(){return wr(this,"shape",{...t}),this.shape},catchall:da(),...N(e)})}function uT(t,e){return new ma({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 yy=$("ZodDiscriminatedUnion",(t,e)=>{Xc.init(t,e),Jv.init(t,e)});function cT(t,e,r){return new yy({type:"union",options:e,discriminator:t,...N(r)})}const $y=$("ZodIntersection",(t,e)=>{Vv.init(t,e),ee.init(t,e)});function by(t,e){return new $y({type:"intersection",left:t,right:e})}const wy=$("ZodTuple",(t,e)=>{ra.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 wy({type:"tuple",items:t,rest:s,...N(n)})}const Hc=$("ZodRecord",(t,e)=>{Wv.init(t,e),ee.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function fa(t,e,r){return new Hc({type:"record",keyType:t,valueType:e,...N(r)})}function lT(t,e,r){return new Hc({type:"record",keyType:ze([t,da()]),valueType:e,...N(r)})}const _y=$("ZodMap",(t,e)=>{Gv.init(t,e),ee.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function dT(t,e,r){return new _y({type:"map",keyType:t,valueType:e,...N(r)})}const ky=$("ZodSet",(t,e)=>{Yv.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(ia(...r)),t.size=(...r)=>t.check(fc(...r))});function mT(t,e){return new ky({type:"set",valueType:t,...N(e)})}const ui=$("ZodEnum",(t,e)=>{Kv.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 fT(t,e){return new ui({type:"enum",entries:t,...N(e)})}const Iy=$("ZodLiteral",(t,e)=>{Xv.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 Oy(t,e){return new Iy({type:"literal",values:Array.isArray(t)?t:[t],...N(e)})}const Sy=$("ZodFile",(t,e)=>{Hv.init(t,e),ee.init(t,e),t.min=(r,i)=>t.check(oi(r,i)),t.max=(r,i)=>t.check(ia(r,i)),t.mime=(r,i)=>t.check(bc(Array.isArray(r)?r:[r],i))});function hT(t){return Yg(Sy,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)=>{Qv.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function zs(t){return new tl({type:"optional",innerType:t})}const Ny=$("ZodNullable",(t,e)=>{eg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function xs(t){return new Ny({type:"nullable",innerType:t})}function pT(t){return zs(xs(t))}const Ty=$("ZodDefault",(t,e)=>{tg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function zy(t,e){return new Ty({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const xy=$("ZodPrefault",(t,e)=>{ng.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ey(t,e){return new xy({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const nl=$("ZodNonOptional",(t,e)=>{rg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Uy(t,e){return new nl({type:"nonoptional",innerType:t,...N(e)})}const Zy=$("ZodSuccess",(t,e)=>{ig.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function vT(t){return new Zy({type:"success",innerType:t})}const Py=$("ZodCatch",(t,e)=>{sg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function jy(t,e){return new Py({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Ay=$("ZodNaN",(t,e)=>{ag.init(t,e),ee.init(t,e)});function gT(t){return Bg(Ay,t)}const rl=$("ZodPipe",(t,e)=>{Fu.init(t,e),ee.init(t,e),t.in=e.in,t.out=e.out});function Es(t,e){return new rl({type:"pipe",in:t,out:e})}const Dy=$("ZodReadonly",(t,e)=>{og.init(t,e),ee.init(t,e)});function Cy(t){return new Dy({type:"readonly",innerType:t})}const Ry=$("ZodTemplateLiteral",(t,e)=>{ug.init(t,e),ee.init(t,e)});function yT(t,e){return new Ry({type:"template_literal",parts:t,...N(e)})}const Ly=$("ZodLazy",(t,e)=>{lg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.getter()});function My(t){return new Ly({type:"lazy",getter:t})}const By=$("ZodPromise",(t,e)=>{cg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function $T(t){return new By({type:"promise",innerType:t})}const ha=$("ZodCustom",(t,e)=>{dg.init(t,e),ee.init(t,e)});function Fy(t,e){const r=new Re({check:"custom",...N(e)});return r._zod.check=t,r}function bT(t,e){return Kg(ha,t??(()=>!0),e)}function qy(t,e={}){return Xg(ha,t,e)}function Jy(t,e){const r=Fy(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 ha({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...N(e)});return r._zod.bag.Class=t,r}const wT=(...t)=>Hg({Pipe:rl,Boolean:ca,String:oa,Transform:Qc},...t);function _T(t){const e=My(()=>ze([Ne(t),H(),Gc(),zi(),xi(e),fa(Ne(),e)]));return e}function kT(t,e){return Es(el(t),e)}const pa=kr([H(),H()]);kr([gn(),gn()]);const Vy=re({width:H(),height:H()}),IT=re({signedWidth:H(),signedHeight:H()}),OT=["width","height"];Ye(OT);const ST=["start","center","end"],NT=["signedWidth","signedHeight"];Ye(NT);const Us=re({x:H(),y:H()}),TT=re({clientX:H(),clientY:H()}),zT=["x","y"],Wy=Ye(zT),Gy=["top","right","bottom","left"];Ye(Gy);const xT=["left","right"],Yy=Ye(xT),ET=["top","bottom"],Ky=Ye(ET),Xy=["center"],ef=Ye(Xy),UT=[...Gy,...Xy],Hy=Ye(UT);Ye(ST);const ZT=["first","last"];Ye(ZT);const PT=re({lower:H(),upper:H()}),jT=re({lower:gn(),upper:gn()});ze([PT,pa]);ze([jT,pa]);Ye([...Wy.options,...Hy.options]);ze([Wy,Hy,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()),AT=(t,e)=>Ir(t)?t.valueOf()+BigInt(e.valueOf().valueOf()):t+Number(e.valueOf()),tf=(t,e)=>Ir(t)?t===BigInt(e.valueOf().valueOf()):t===Number(e.valueOf()),DT=(t,e)=>Ir(t)?t.valueOf()<BigInt(e.valueOf())?t:BigInt(e.valueOf()):t.valueOf()<Number(e.valueOf())?t:Number(e.valueOf()),CT=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?RT(i):i},RT=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t,nf=(t,e)=>{const r=nt(t);return e<r.lower?r.lower:e>=r.upper?r.upper-(typeof r.upper=="number"?1:1n):e},Qi=(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},LT=t=>({lower:Math.min(...t.map(e=>nt(e).lower)),upper:Math.max(...t.map(e=>nt(e).upper))}),MT=(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(;tf(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=DT(CT(s),c);if(a=AT(a,n>0?l:-l),s=ao(s,n>0?l:-l),tf(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},BT=(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:Yy.or(ef),y:Ky.or(ef)});const FT=re({x:Yy,y:Ky}),qT=Object.freeze({x:"left",y:"top"}),JT=(t,e)=>t.x===e.x&&t.y===e.y,rf=ze([H(),Us,pa,Vy,IT,TT]),VT=(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}},sf=Object.freeze({x:0,y:0}),es=ze([H(),Ne()]);re({top:es,left:es,width:es,height:es});re({left:H(),top:H(),right:H(),bottom:H()});re({one:Us,two:Us,root:FT});const il=(t,e,r=0,i=0,n)=>{const s={one:{...sf},two:{...sf},root:n??qT};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}},WT=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,GT=re({signedWidth:H(),signedHeight:H()});ze([Vy,GT,Us,pa]);var YT=Object.defineProperty,KT=(t,e,r)=>e in t?YT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Bt=(t,e,r)=>KT(t,typeof e!="symbol"?e+"":e,r);const XT=(t,e,r)=>e!==void 0&&t<e?e:r!==void 0&&t>r?r:t;re({offset:rf,scale:rf});re({offset:H(),scale:H()});const HT=t=>(e,r,i,n)=>r==="dimension"?[e,i]:[e,n?i-t:i+t],QT=t=>(e,r,i,n)=>[e,n?i/t:i*t],ez=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]},tz=t=>(e,r,i)=>[t,i],nz=()=>(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)]},rz=t=>(e,r,i)=>{const{lower:n,upper:s}=t;return i=XT(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=HT(e);return i.type="translate",r.ops.push(i),r}magnify(e){const r=this.new(),i=QT(e);return i.type="magnify",r.ops.push(i),r}scale(e,r){const i=nt(e,r),n=this.new(),s=ez(i);return s.type="scale",n.ops.push(s),n}clamp(e,r){const i=nt(e,r),n=this.new(),s=rz(i);return s.type="clamp",n.ops.push(s),n}reBound(e,r){const i=nt(e,r),n=this.new(),s=tz(i);return s.type="re-bound",n.ops.push(s),n}invert(){const e=nz();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 af=jo;const of=class Rt{constructor(e=new af,r=new af,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=VT(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(WT(e)){const i=this.currRoot;return r.currRoot=e.root,i!=null&&!JT(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(of,"IDENTITY",new of);var iz=Object.defineProperty,sz=(t,e,r)=>e in t?iz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,z=(t,e,r)=>sz(t,typeof e!="symbol"?e+"":e,r);function az(t){return pg(oa,t)}function oz(t){return _g(ua,t)}function uz(t){return zg(ca,t)}function Qy(t){return Eg(la,t)}function cz(t){return Mg(Kc,t)}const lz=Object.freeze(Object.defineProperty({__proto__:null,bigint:Qy,boolean:uz,date:cz,number:oz,string:az},Symbol.toStringTag,{value:"Module"}));let dz=(t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i};const mz="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",fz=dz(mz,11),e$=()=>fz(),hz=Object.freeze(Object.defineProperty({__proto__:null,create:e$},Symbol.toStringTag,{value:"Module"})),pz=(t,e)=>r=>r instanceof e||typeof r=="object"&&r!==null&&"discriminator"in r&&r.discriminator===t,vz=Ye(["static","dynamic"]),t$=(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 t$(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 t$(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 vs extends br{constructor(e){super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new vs(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 vs(e)}static khz(e){return vs.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 gz=(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 n$=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof W||t instanceof M||t instanceof Date},yz=(t,e,r,i=0)=>t.usesBigInt&&!e.usesBigInt?Number(r)-Number(i):!t.usesBigInt&&e.usesBigInt?BigInt(r.valueOf())-BigInt(i.valueOf()):gs(r,-i).valueOf(),gs=(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),$z=/^(?:[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 bz(t){return typeof t=="string"&&$z.test(t)}const Qe=[];for(let t=0;t<256;++t)Qe.push((t+256).toString(16).slice(1));function wz(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 _z(t,e=0){const r=wz(t,e);if(!bz(r))throw TypeError("Stringified UUID is invalid");return r}typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const kz=(t,e)=>_z(t,e),Yt=-1,Do={[Symbol.iterator]:()=>Do,next:()=>({done:!0,value:void 0})},Iz=Ne().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer),Oz=ze([zi(),dy()]).transform(()=>new Uint8Array().buffer),Co=10,r$=(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`)},i$="sy_x_telem_series",Fr=class Fn{constructor(e){z(this,"key"),z(this,"discriminator",i$),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"),Sz(e)&&(e={data:e}),e.data??(e.data=[]);const{dataType:r,timeRange:i,sampleOffset:n=0,glBufferUsage:s="static",alignment:a=0n,key:o=e$(),data:u}=e;if(s$(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=n$(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]=Fh(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=oh(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 Gh(e,this.dataType),this}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:Ri(this.alignmentBounds.lower),upper:Ri(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 Kh(this);return this.dataType.equals(D.JSON)?new Jh(e):e}return new Xh(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new xi(this,e,t??this.length)}subAlignmentIterator(e,t){return new xi(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([Wh,Vh,i.z.instanceof(ArrayBuffer),i.z.instanceof(Uint8Array)]),glBufferUsage:qh.optional().default("static").optional()})),g(Lt,"z",Lt.crudeZ.transform(r=>new Lt(r)));let Hh=Lt,xi=class{constructor(e,t,n){g(this,"series"),g(this,"end"),g(this,"index"),this.series=e;const s=Ge(0,e.length);this.end=Si(s,n),this.index=Si(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}};class Kh{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 ki,Ai;const Wa=class Va{constructor(e){g(this,"wrapped"),g(this,ki,"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,Va.SCHEMA)}}[(Ai=Symbol.iterator,ki=Symbol.toStringTag,Ai)](){return this}};g(Wa,"SCHEMA",i.z.record(i.z.string(),i.z.unknown()));let Jh=Wa;var Ui,Ci;class Xh{constructor(e){g(this,"series"),g(this,"index"),g(this,Ui,"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)}}[(Ci=Symbol.iterator,Ui=Symbol.toStringTag,Ci)](){return this}}const Ri=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 Ga=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Qh=Ga(),Ha=["macOS","Windows","Linux"],eu=["macos","windows","linux"],tu={macos:"macOS",windows:"Windows",linux:"Linux"},ru=i.z.enum(Ha).or(i.z.enum(eu).transform(r=>tu[r])),nu=()=>{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 su=(r={})=>{const{force:e,default:t}=r;return e??Tn??(Tn=nu(),Tn??t)},Ka=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:Ha,RUNTIME:Qh,detect:Ga,getOS:su,osZ:ru},Symbol.toStringTag,{value:"Module"}));var iu=Object.defineProperty,au=(r,e,t)=>e in r?iu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_t=(r,e,t)=>au(r,typeof e!="symbol"?e+"":e,t);const ou=(...r)=>r.map(Ja).join(""),Ja=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),cu=r=>r.endsWith("/")?r.slice(0,-1):r,lu=(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=Ja(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:ou(this.path,e)})}toString(){return cu(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};_t(Xn,"UNKNOWN",new Xn({host:"unknown",port:0}));let hu=Xn;const uu=-128,du=127;i.z.number().int().min(uu).max(du);const fu=-32768,yu=32767;i.z.number().int().min(fu).max(yu);const gu=-2147483648,pu=2147483647;i.z.number().int().min(gu).max(pu);const wu=-9223372036854775808n,mu=9223372036854775807n;i.z.bigint().min(wu).max(mu);const bu=255;i.z.number().int().min(0).max(bu);const vu=65535;i.z.number().int().min(0).max(vu);const Tu=4294967295;i.z.number().int().min(0).max(Tu);const Ou=18446744073709551615n;i.z.bigint().min(0n).max(Ou);var Su=Object.defineProperty,Eu=(r,e,t)=>e in r?Su(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ve=(r,e,t)=>Eu(r,typeof e!="symbol"?e+"":e,t);const zu=async r=>await new Promise(e=>setTimeout(e,k.fromMilliseconds(r).milliseconds));class Nu{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)??zu},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 Iu=i.z.object({baseInterval:k.z.optional(),maxRetries:i.z.number().optional(),scale:i.z.number().optional()}),$u=Object.freeze(Object.defineProperty({__proto__:null,Breaker:Nu,breakerConfig:Iu},Symbol.toStringTag,{value:"Module"})),xu=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,ks=i.z.string().regex(xu),gt=i.z.number().min(0).max(255),ku=i.z.number().min(0).max(1),As=i.z.tuple([gt,gt,gt,ku]),Xa=i.z.tuple([gt,gt,gt]),Qa=i.z.object({rgba255:As}),Us=(r,e=1)=>{if(typeof r=="string")return Uu(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}if(typeof r=="object"&&"rgba255"in r)return r.rgba255;throw new Error(`Invalid color: ${JSON.stringify(r)}`)},Au=i.z.union([ks,As,Xa,Qa]).transform(r=>Us(r)),Uu=(r,e=1)=>{if(!ks.safeParse(r).success)throw new Error(`Invalid hex color: ${r}`);return r=Cu(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),Cu=r=>r.startsWith("#")?r.slice(1):r,Ru=i.z.union([ks,As,i.z.string(),Xa,Qa]);Us("#000000");Us("#ffffff");const Bu=i.z.object({key:i.z.string(),color:Ru,position:i.z.number(),switched:i.z.boolean().optional()});i.z.array(Bu);const Pu=i.z.object({key:i.z.string(),name:i.z.string(),color:Au});i.z.object({key:i.z.string(),name:i.z.string(),swatches:i.z.array(Pu)});const Du=i.z.number().int().min(0).max(255),Mu=i.z.object({name:i.z.string(),key:i.z.string()}),Lr=r=>i.z.object({subject:Mu,resource:r,authority:Du}),ju=i.z.object({from:Lr(i.z.any()),to:i.z.null()}),Lu=i.z.object({from:i.z.null(),to:Lr(i.z.any())});i.z.union([ju,Lu,i.z.object({from:Lr(i.z.any()),to:Lr(i.z.any())})]);const _u=r=>Object.getOwnPropertySymbols(globalThis).includes(r),Zu=(r,e)=>{const t=Symbol.for(r);if(!_u(t)){const n=e();Object.defineProperty(globalThis,t,{value:n})}return()=>globalThis[t]},qu=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",qu(r)),e},eo=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 Fu{constructor(){ve(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:es,data:""};if(eo(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 Cs=Zu("synnax-error-registry",()=>new Fu),Yu=({encode:r,decode:e})=>Cs().register({encode:r,decode:e}),Wu=r=>Cs().encode(r),Vu=r=>r==null?null:Cs().decode(r);class ts extends Gr("unknown"){}const Gu=i.z.object({type:i.z.string(),data:i.z.string()});class Hu extends Gr("canceled"){}const qe=Object.freeze(Object.defineProperty({__proto__:null,Canceled:Hu,NONE:es,UNKNOWN:ot,Unknown:ts,createTyped:Gr,decode:Vu,encode:Wu,isTyped:eo,payloadZ:Gu,register:Yu},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 Ku=["standard","scientific","engineering"];i.z.enum(Ku);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=hu.UNKNOWN}=e;super(t),G(this,"url"),this.url=n}};const Ju=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}`)},Xu=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:Ju,decode:Xu});let to=class{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 ro="Content-Type",Bi=r=>{if(Ka.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})},Qu=r=>"code"in r&&r.code==="ECONNREFUSED"||r.message.toLowerCase().includes("load failed"),ed=400;class td extends to{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=Bi(this.endpoint.protocol),new Proxy(this,{get:(s,a,o)=>a==="endpoint"?this.endpoint:Reflect.get(s,a,o)})}get headers(){return{[ro]: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 Bi(d.protocol)(d.target,c)}catch(S){let j=S;return Qu(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!==ed)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 rd=(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 $u.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},nd=()=>Ka.RUNTIME!=="node"?r=>new WebSocket(r):r=>new(require("ws")).WebSocket(r,{rejectUnauthorized:!1}),sd=i.z.object({type:i.z.enum(["data","close","open"]),payload:i.z.unknown(),error:i.z.optional(qe.payloadZ)});class id{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,sd))}onClose(e){this.addMessage({type:"close",error:{type:e.code===od?ue.TYPE:bt.TYPE,data:""}})}}const ad="freighterctx",od=1e3,no=class rs extends to{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=nd();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=lu({[ro]:this.encoder.contentType,...t.params},ad);return this.baseUrl.child(e).toString()+n}async wrapSocket(e,t,n){return await new Promise(s=>{e.onopen=()=>{const a=new id(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(no,"MESSAGE_TYPE","arraybuffer");let cd=no;const so="all",io="create",ao="delete",oo="retrieve",co="update",_r=i.z.enum([so,io,ao,oo,co]),ld=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)},lo=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=ud(n);const s={},a=t;return Object.keys(a).forEach(o=>{let c=a[o];const h=r(o);n.recursive&&(On(c)?Di(c,n.keepTypesOnRecursion)||(c=e(c,n)):n.recursiveInArray&&Pi(c)&&(c=[...c].map(d=>{let f=d;return On(d)?Di(f,n.keepTypesOnRecursion)||(f=e(d,n)):Pi(d)&&(f=e({key:d},n).key),f}))),s[h]=c}),s};return e},Rs=lo(ld),hd=r=>r.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`),ho=lo(hd),ns={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},ud=(r=ns)=>(r.recursive==null?r=ns:r.recursiveInArray??(r.recursiveInArray=!1),r),Pi=r=>r!=null&&Array.isArray(r),On=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),Di=(r,e)=>(e||[]).some(t=>r instanceof t),Hr=r=>r!=null&&typeof r=="object"&&!Array.isArray(r);var dd=Object.defineProperty,fd=(r,e,t)=>e in r?dd(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pt=(r,e,t)=>fd(r,typeof e!="symbol"?e+"":e,t);function yd(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 gd(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 pd=new TextEncoder,wd=50;function md(r,e,t){pd.encodeInto(r,e.subarray(t))}function bd(r,e,t){r.length>wd?md(r,e,t):gd(r,e,t)}const vd=4096;function uo(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>=vd&&(o+=String.fromCharCode(...a),a.length=0)}return a.length>0&&(o+=String.fromCharCode(...a)),o}const Td=new TextDecoder,Od=200;function Sd(r,e,t){const n=r.subarray(e,e+t);return Td.decode(n)}function Ed(r,e,t){return t>Od?Sd(r,e,t):uo(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 zd(r,e,t){const n=t/4294967296,s=t;r.setUint32(e,n),r.setUint32(e+4,s)}function fo(r,e,t){const n=Math.floor(t/4294967296),s=t;r.setUint32(e,n),r.setUint32(e+4,s)}function yo(r,e){const t=r.getInt32(e),n=r.getUint32(e+4);return t*4294967296+n}function Nd(r,e){const t=r.getUint32(e),n=r.getUint32(e+4);return t*4294967296+n}const Id=-1,$d=4294967296-1,xd=17179869184-1;function kd({sec:r,nsec:e}){if(r>=0&&e>=0&&r<=xd)if(e===0&&r<=$d){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),fo(n,4,r),t}}function Ad(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 Ud(r){if(r instanceof Date){const e=Ad(r);return kd(e)}else return null}function Cd(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=yo(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 Rd(r){const e=Cd(r);return new Date(e.sec*1e3+e.nsec/1e6)}const Bd={type:Id,encode:Ud,decode:Rd};let rr=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Bd)}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 Pd(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):Pd(r)?new Uint8Array(r):Uint8Array.from(r)}const Dd=100,Md=2048;let jd=class go{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)??Dd,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??Md,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 go({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=yd(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),bd(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),zd(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),fo(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 jd(e).encodeSharedRef(r)}function Sn(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const Ld=16,_d=16;class Zd{constructor(e=Ld,t=_d){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=uo(e,t,n),o=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(o,a),a}}const as="array",Jt="map_key",po="map_value",qd=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 Fd{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===po){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,Bs=new DataView(new ArrayBuffer(0)),Yd=new Uint8Array(Bs.buffer);try{Bs.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"),Wd=new Zd;let Vd=class wo{constructor(e){this.totalPos=0,this.pos=0,this.view=Bs,this.bytes=Yd,this.headByte=Rt,this.stack=new Fd,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:Wd,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??qd}clone(){return new wo({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=po;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 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=Ed(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 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 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=Nd(this.view,this.pos);return this.pos+=8,e}readI64(){const e=yo(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 mo(r,e){return new Vd(e).decode(r)}let bo=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=Rs(n);return t!=null?t.parse(s):s}encodeString(e){const t=ho(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(){}},vo=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(){}},To=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=>mo(r,{extensionCodec:Me})});let Oo=class{constructor(){pt(this,"contentType","application/msgpack")}encode(e){const t=ho(e);return Zt(t,{extensionCodec:Me}).slice()}decode(e,t){const n=mo(e,{extensionCodec:Me}),s=Rs(n);return t!=null?t.parse(s):s}static registerCustomType(){}};const Xt=new bo,Gd=new vo,Hd=new To,Kd=new Oo,Qe=Object.freeze(Object.defineProperty({__proto__:null,CSVCodec:vo,CSV_CODEC:Gd,JSONCodec:bo,JSON_CODEC:Xt,MSGPACK_CODEC:Kd,MsgPackCodec:Oo,TEXT_CODEC:Hd,TextCodec:To},Symbol.toStringTag,{value:"Module"})),Jd=r=>[...new Set(r)],Xd=(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())},ji=Object.freeze(Object.defineProperty({__proto__:null,by:Xd,unique:Jd},Symbol.toStringTag,{value:"Module"})),Qd=r=>r!=null&&typeof r=="object"&&"toString"in r,ef=(r,e=!1)=>{const t=Qd(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?tf(n):n},tf=r=>(e,t)=>r(t,e),Kr=0,En=-1,zn=1,rf=r=>r<Kr,nf=r=>r>Kr,sf=r=>r===Kr,Jr=i.z.tuple([i.z.number(),i.z.number()]);i.z.tuple([i.z.bigint(),i.z.bigint()]);const So=i.z.object({width:i.z.number(),height:i.z.number()}),af=i.z.object({signedWidth:i.z.number(),signedHeight:i.z.number()}),of=["width","height"];i.z.enum(of);const cf=["start","center","end"],lf=["signedWidth","signedHeight"];i.z.enum(lf);const Zr=i.z.object({x:i.z.number(),y:i.z.number()}),hf=i.z.object({clientX:i.z.number(),clientY:i.z.number()}),uf=["x","y"],Eo=i.z.enum(uf),zo=["top","right","bottom","left"];i.z.enum(zo);const df=["left","right"],No=i.z.enum(df),ff=["top","bottom"],Io=i.z.enum(ff),$o=["center"],Li=i.z.enum($o),yf=[...zo,...$o],xo=i.z.enum(yf);i.z.enum(cf);const gf=["first","last"];i.z.enum(gf);const pf=i.z.object({lower:i.z.number(),upper:i.z.number()}),wf=i.z.object({lower:i.z.bigint(),upper:i.z.bigint()});i.z.union([pf,Jr]);i.z.union([wf,Jr]);i.z.enum([...Eo.options,...xo.options]);i.z.union([Eo,xo,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()),mf=(r,e)=>Et(r)?r.valueOf()+BigInt(e.valueOf().valueOf()):r+Number(e.valueOf()),_i=(r,e)=>Et(r)?r===BigInt(e.valueOf().valueOf()):r===Number(e.valueOf()),bf=(r,e)=>Et(r)?r.valueOf()<BigInt(e.valueOf())?r:BigInt(e.valueOf()):r.valueOf()<Number(e.valueOf())?r:Number(e.valueOf()),vf=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 Zi(r);return Zi(t)},Zi=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r,qi=(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},Tf=r=>({lower:Math.min(...r.map(e=>J(e).lower)),upper:Math.max(...r.map(e=>J(e).upper))}),Of=(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(;_i(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=bf(vf(a),d);if(o=mf(o,s>0?f:-f),a=Nn(a,s>0?f:-f),_i(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},Sf=(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:No.or(Li),y:Io.or(Li)});const Ef=i.z.object({x:No,y:Io}),zf=Object.freeze({x:"left",y:"top"}),Nf=(r,e)=>r.x===e.x&&r.y===e.y,Fi=i.z.union([i.z.number(),Zr,Jr,So,af,hf]),If=(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}},Yi=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:Ef});const Ps=(r,e,t=0,n=0,s)=>{const a={one:{...Yi},two:{...Yi},root:s??zf};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=Ps(r);return{lower:e.one.x,upper:e.two.x}},$n=r=>{const e=Ps(r);return{lower:e.one.y,upper:e.two.y}},$f=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,xf=i.z.object({signedWidth:i.z.number(),signedHeight:i.z.number()});i.z.union([So,xf,Zr,Jr]);var kf=Object.defineProperty,Af=(r,e,t)=>e in r?kf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xe=(r,e,t)=>Af(r,typeof e!="symbol"?e+"":e,t);const Uf=(r,e,t)=>e!==void 0&&r<e?e:t!==void 0&&r>t?t:r;i.z.object({offset:Fi,scale:Fi});i.z.object({offset:i.z.number(),scale:i.z.number()});const Cf=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],Rf=r=>(e,t,n,s)=>[e,s?n/r:n*r],Bf=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]},Pf=r=>(e,t,n)=>[r,n],Df=()=>(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)]},Mf=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=Uf(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=Cf(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Rf(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=J(e,t),s=this.new(),a=Bf(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=J(e,t),s=this.new(),a=Mf(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=J(e,t),s=this.new(),a=Pf(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=Df();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 Wi=os;const Vi=class Ie{constructor(e=new Wi,t=new Wi,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=If(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($f(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Nf(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 Ps(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(Vi,"IDENTITY",new Vi);var jf=Object.defineProperty,Lf=(r,e,t)=>e in r?jf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,y=(r,e,t)=>Lf(r,typeof e!="symbol"?e+"":e,t);let _f=(r,e=21)=>(t=e)=>{let n="",s=t|0;for(;s--;)n+=r[Math.random()*r.length|0];return n};const Zf="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",qf=_f(Zf,11),ko=()=>qf(),Ff=Object.freeze(Object.defineProperty({__proto__:null,create:ko},Symbol.toStringTag,{value:"Module"})),Yf=i.z.enum(["static","dynamic"]),Ao=(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 Ao(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 Ao(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 Wf=(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 Uo=r=>{const e=typeof r;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||r instanceof z||r instanceof O||r instanceof Date},Vf=(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),Gf=r=>r==null?!1:Array.isArray(r)||r instanceof ArrayBuffer||ArrayBuffer.isView(r)&&!(r instanceof DataView)||r instanceof _e?!0:Uo(r),Re=-1,ls={[Symbol.iterator]:()=>ls,next:()=>({done:!0,value:void 0})},Hf=i.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer),Kf=i.z.union([i.z.null(),i.z.undefined()]).transform(()=>new Uint8Array().buffer),hs=10,Co=(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"),Gf(e)&&(e={data:e});const{dataType:t,timeRange:n,sampleOffset:s=0,glBufferUsage:a="static",alignment:o=0n,key:c=ko()}=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=Uo(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)=>kz(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]=yz(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()),gs(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()),gs(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 gs(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):Rh(JSON.parse(new TextDecoder().decode(s)))}binarySearch(e){let r=0,i=this.length-1;const n=ZS(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 r$(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:cf(this.alignmentBounds.lower),upper:cf(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 Nz(this);return this.dataType.equals(ae.JSON)?new Tz(e):e}return new zz(this)}slice(e,r){return this.sliceSub(!1,e,r)}sub(e,r){return this.sliceSub(!0,e,r)}subIterator(e,r){return new uf(this,e,r??this.length)}subAlignmentIterator(e,r){return new uf(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:Qy().optional(),data:ze([Iz,Oz,ge(ArrayBuffer),ge(Uint8Array)]),glBufferUsage:vz.optional().default("static").optional()})),z(Fr,"z",Fr.crudeZ.transform(t=>new Fr(t)));let Ft=Fr;const Sz=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof Ft?!0:n$(t),s$=pz(i$,Ft);let uf=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=nf(n,i),this.index=nf(n,r)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},Nz=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 a$=class o${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,o$.schema)}}};z(a$,"schema",fa(Ne(),cr()));let Tz=a$,zz=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 u${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 r$(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(s$(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(Qi(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(Qi(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(Qi(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(Qi(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 LT(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 MT(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 BT(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 xz(this.series)}}let xz=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 cf=t=>{const e=t>>32n,r=t&0xffffffffn;return{domain:e,sample:r}},Ez=(t,e)=>{let r=null;return e===0?t:(...i)=>{r!==null&&(clearTimeout(r),r=null),r=setTimeout(()=>t(...i),e)}},Uz=(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)},Zz=(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 Pz=Object.defineProperty,jz=(t,e,r)=>e in t?Pz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ys=(t,e,r)=>jz(t,typeof e!="symbol"?e+"":e,r);let Az=class{constructor(e,r){ys(this,"handlers"),ys(this,"transform"),ys(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))}},Dz=class{constructor(e){ys(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:Dz,Observer:Az},Symbol.toStringTag,{value:"Module"})),$t=fa(ze([H(),Ne(),cy()]),cr()),Cz=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";Cz();const Rz=["macOS","Windows","Linux"],Lz=["macos","windows","linux"],Mz={macos:"macOS",windows:"Windows",linux:"Linux"};Ye(Rz).or(Ye(Lz).transform(t=>Mz[t]));var Bz=Object.defineProperty,Fz=(t,e,r)=>e in t?Bz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qr=(t,e,r)=>Fz(t,typeof e!="symbol"?e+"":e,r);const qz=(...t)=>t.map(c$).join(""),c$=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),Jz=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=c$(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:qz(this.path,e)})}toString(){return Jz(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};qr(Ro,"UNKNOWN",new Ro({host:"unknown",port:0}));let Vz=Ro;const Wz=t=>t.nullable().transform(e=>e===null?void 0:e).optional(),l$=t=>Uz(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"]}),lf=(t,e)=>{if(t==null)return null;const r=t[e];return r==null&&typeof t=="object"&&"sourceType"in t?t.sourceType()[e]:r},Gz=(t,e,r)=>Zz(lf(t,"shape"),l$(e),{...r,getter:lf}),d$=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:Gz,getFieldSchemaPath:l$,nullToUndefined:Wz},Symbol.toStringTag,{value:"Module"}));var Yz=Object.defineProperty,Kz=(t,e,r)=>e in t?Yz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xt=(t,e,r)=>Kz(t,typeof e!="symbol"?e+"":e,r);const Xz=()=>{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 Hz(){return{localeError:Xz()}}const Qz=()=>{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 ex(){return{localeError:Qz()}}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 tx=()=>{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=df(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=df(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 nx(){return{localeError:tx()}}const rx=()=>{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 ix(){return{localeError:rx()}}const sx=()=>{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 ax(){return{localeError:sx()}}const ox=()=>{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 ux(){return{localeError:ox()}}const cx=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},lx=()=>{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 ${cx(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 m$(){return{localeError:lx()}}const dx=()=>{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 mx(){return{localeError:dx()}}const fx=()=>{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 hx(){return{localeError:fx()}}const px=()=>{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 vx(){return{localeError:px()}}const gx=()=>{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 yx(){return{localeError:gx()}}const $x=()=>{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 bx(){return{localeError:$x()}}const wx=()=>{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 _x(){return{localeError:wx()}}const kx=()=>{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 Ix(){return{localeError:kx()}}const Ox=()=>{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 Sx(){return{localeError:Ox()}}const Nx=()=>{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 Tx(){return{localeError:Nx()}}const zx=()=>{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 xx(){return{localeError:zx()}}const Ex=()=>{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 Ux(){return{localeError:Ex()}}const Zx=()=>{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 Px(){return{localeError:Zx()}}const jx=()=>{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 Ax(){return{localeError:jx()}}const Dx=()=>{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 Cx(){return{localeError:Dx()}}const Rx=()=>{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 Lx(){return{localeError:Rx()}}const Mx=()=>{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 Bx(){return{localeError:Mx()}}const Fx=()=>{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 qx(){return{localeError:Fx()}}const Jx=()=>{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 Vx(){return{localeError:Jx()}}const Wx=()=>{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 Gx(){return{localeError:Wx()}}const Yx=()=>{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 Kx(){return{localeError:Yx()}}function mf(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 Xx=()=>{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=mf(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=mf(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 Hx(){return{localeError:Xx()}}const Qx=()=>{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 e0(){return{localeError:Qx()}}const t0=()=>{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 n0(){return{localeError:t0()}}const r0=()=>{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 i0(){return{localeError:r0()}}const s0=()=>{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 a0(){return{localeError:s0()}}const o0=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},u0=()=>{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 ${o0(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 c0(){return{localeError:u0()}}const l0=()=>{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 d0(){return{localeError:l0()}}const m0=()=>{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 f0(){return{localeError:m0()}}const h0=()=>{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 p0(){return{localeError:h0()}}const v0=()=>{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 g0(){return{localeError:v0()}}const y0=()=>{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 $0(){return{localeError:y0()}}const f$=Object.freeze(Object.defineProperty({__proto__:null,ar:Hz,az:ex,be:nx,ca:ix,cs:ax,de:ux,en:m$,es:mx,fa:hx,fi:vx,fr:yx,frCA:bx,he:_x,hu:Ix,id:Sx,it:Tx,ja:xx,kh:Ux,ko:Px,mk:Ax,ms:Cx,nl:Lx,no:Bx,ota:qx,pl:Gx,ps:Vx,pt:Kx,ru:Hx,sl:e0,sv:n0,ta:i0,th:a0,tr:c0,ua:d0,ur:f0,vi:p0,zhCN:g0,zhTW:$0},Symbol.toStringTag,{value:"Module"}));let h$=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 ra({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 p$(t){return new h$({type:"function",input:Array.isArray(t==null?void 0:t.input)?Gg(ra,t==null?void 0:t.input):(t==null?void 0:t.input)??Oc(Lu,Ns(Os)),output:(t==null?void 0:t.output)??Ns(Os)})}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 v$(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 b0=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),w0=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:Lv,$ZodArray:Lu,$ZodAsyncError:sr,$ZodBase64:zv,$ZodBase64URL:Ev,$ZodBigInt:Ru,$ZodBigIntFormat:Av,$ZodBoolean:Cu,$ZodCIDRv4:Nv,$ZodCIDRv6:Tv,$ZodCUID:vv,$ZodCUID2:gv,$ZodCatch:sg,$ZodCheck:Re,$ZodCheckBigIntFormat:Vp,$ZodCheckEndsWith:iv,$ZodCheckGreaterThan:ju,$ZodCheckIncludes:nv,$ZodCheckLengthEquals:Hp,$ZodCheckLessThan:Pu,$ZodCheckLowerCase:ev,$ZodCheckMaxLength:Kp,$ZodCheckMaxSize:Wp,$ZodCheckMimeType:av,$ZodCheckMinLength:Xp,$ZodCheckMinSize:Gp,$ZodCheckMultipleOf:qp,$ZodCheckNumberFormat:Jp,$ZodCheckOverwrite:ov,$ZodCheckProperty:sv,$ZodCheckRegex:Qp,$ZodCheckSizeEquals:Yp,$ZodCheckStartsWith:rv,$ZodCheckStringFormat:Si,$ZodCheckUpperCase:tv,$ZodCustom:dg,$ZodDate:Fv,$ZodDefault:tg,$ZodDiscriminatedUnion:Jv,$ZodE164:Uv,$ZodEmail:mv,$ZodEmoji:hv,$ZodEnum:Kv,$ZodError:Su,$ZodFile:Hv,$ZodFunction:h$,$ZodGUID:lv,$ZodIPv4:Ov,$ZodIPv6:Sv,$ZodISODate:_v,$ZodISODateTime:wv,$ZodISODuration:Iv,$ZodISOTime:kv,$ZodIntersection:Vv,$ZodJWT:Pv,$ZodKSUID:bv,$ZodLazy:lg,$ZodLiteral:Xv,$ZodMap:Gv,$ZodNaN:ag,$ZodNanoID:pv,$ZodNever:Mv,$ZodNonOptional:rg,$ZodNull:Rv,$ZodNullable:eg,$ZodNumber:Du,$ZodNumberFormat:jv,$ZodObject:qv,$ZodOptional:Qv,$ZodPipe:Fu,$ZodPrefault:ng,$ZodPromise:cg,$ZodReadonly:og,$ZodRealError:Oi,$ZodRecord:Wv,$ZodRegistry:qu,$ZodSet:Yv,$ZodString:Ni,$ZodStringFormat:$e,$ZodSuccess:ig,$ZodSymbol:Dv,$ZodTemplateLiteral:ug,$ZodTransform:Bu,$ZodTuple:ra,$ZodType:B,$ZodULID:yv,$ZodURL:fv,$ZodUUID:dv,$ZodUndefined:Cv,$ZodUnion:Mu,$ZodUnknown:Os,$ZodVoid:Bv,$ZodXID:$v,$brand:qh,$constructor:$,$input:fg,$output:mg,Doc:uv,JSONSchema:b0,JSONSchemaGenerator:Mo,TimePrecision:vg,_any:Dg,_array:Oc,_base64:cc,_base64url:lc,_bigint:xg,_boolean:Tg,_catch:wN,_cidrv4:oc,_cidrv6:uc,_coercedBigint:Eg,_coercedBoolean:zg,_coercedDate:Mg,_coercedNumber:_g,_coercedString:pg,_cuid:ec,_cuid2:tc,_custom:Kg,_date:Lg,_default:yN,_discriminatedUnion:oN,_e164:dc,_email:Vu,_emoji:Hu,_endsWith:$c,_enum:mN,_file:Yg,_float32:Ig,_float64:Og,_gt:vn,_gte:ht,_guid:Ss,_includes:gc,_int:kg,_int32:Sg,_int64:Ug,_intersection:uN,_ipv4:sc,_ipv6:ac,_isoDate:yg,_isoDateTime:gg,_isoDuration:bg,_isoTime:$g,_jwt:mc,_ksuid:ic,_lazy:ON,_length:aa,_literal:hN,_lowercase:pc,_lt:pn,_lte:wt,_map:lN,_max:wt,_maxLength:sa,_maxSize:ia,_mime:bc,_min:ht,_minLength:ur,_minSize:oi,_multipleOf:ai,_nan:Bg,_nanoid:Qu,_nativeEnum:fN,_negative:qg,_never:Cg,_nonnegative:Vg,_nonoptional:$N,_nonpositive:Jg,_normalize:wc,_null:Ag,_nullable:gN,_number:wg,_optional:vN,_overwrite:xn,_parse:zu,_parseAsync:xu,_pipe:_N,_positive:Fg,_promise:SN,_property:Wg,_readonly:kN,_record:cN,_refine:Xg,_regex:hc,_safeParse:Eu,_safeParseAsync:Uu,_set:dN,_size:fc,_startsWith:yc,_string:hg,_stringbool:Hg,_success:bN,_symbol:Pg,_templateLiteral:IN,_toLowerCase:kc,_toUpperCase:Ic,_transform:pN,_trim:_c,_tuple:Gg,_uint32:Ng,_uint64:Zg,_ulid:nc,_undefined:jg,_union:aN,_unknown:Ns,_uppercase:vc,_url:Xu,_uuid:Wu,_uuidv4:Gu,_uuidv6:Yu,_uuidv7:Ku,_void:Rg,_xid:rc,clone:jt,config:lt,flattenError:Nu,formatError:Tu,function:p$,globalConfig:_s,globalRegistry:dn,isValidBase64:Au,isValidBase64URL:xv,isValidJWT:Zv,locales:f$,parse:Eo,parseAsync:Uo,prettifyError:op,regexes:Bp,registry:Ju,safeParse:up,safeParseAsync:cp,toDotPath:ap,toJSONSchema:v$,treeifyError:sp,util:KS,version:cv},Symbol.toStringTag,{value:"Module"})),_0={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"},k0=Object.freeze({status:"aborted"}),I0=k0;function O0(t){lt({customError:t})}function S0(){return lt().customError}lt(m$());const Ae=Object.freeze(Object.defineProperty({__proto__:null,$brand:qh,$input:fg,$output:mg,NEVER:I0,TimePrecision:vg,ZodAny:fy,ZodArray:gy,ZodBase64:qc,ZodBase64URL:Jc,ZodBigInt:la,ZodBigIntFormat:Yc,ZodBoolean:ca,ZodCIDRv4:Bc,ZodCIDRv6:Fc,ZodCUID:jc,ZodCUID2:Ac,ZodCatch:Py,ZodCustom:ha,ZodDate:Kc,ZodDefault:Ty,ZodDiscriminatedUnion:yy,ZodE164:Vc,ZodEmail:Ec,ZodEmoji:Zc,ZodEnum:ui,ZodError:TN,ZodFile:Sy,ZodGUID:Ts,ZodIPv4:Lc,ZodIPv6:Mc,ZodISODate:Nc,ZodISODateTime:Sc,ZodISODuration:zc,ZodISOTime:Tc,ZodIntersection:$y,ZodIssueCode:_0,ZodJWT:Wc,ZodKSUID:Rc,ZodLazy:Ly,ZodLiteral:Iy,ZodMap:_y,ZodNaN:Ay,ZodNanoID:Pc,ZodNever:py,ZodNonOptional:nl,ZodNull:my,ZodNullable:Ny,ZodNumber:ua,ZodNumberFormat:_r,ZodObject:ma,ZodOptional:tl,ZodPipe:rl,ZodPrefault:xy,ZodPromise:By,ZodReadonly:Dy,ZodRealError:Ti,ZodRecord:Hc,ZodSet:ky,ZodString:oa,ZodStringFormat:_e,ZodSuccess:Zy,ZodSymbol:uy,ZodTemplateLiteral:Ry,ZodTransform:Qc,ZodTuple:wy,ZodType:ee,ZodULID:Dc,ZodURL:Uc,ZodUUID:Mt,ZodUndefined:ly,ZodUnion:Xc,ZodUnknown:hy,ZodVoid:vy,ZodXID:Cc,_ZodString:xc,_default:zy,any:rT,array:xi,base64:WN,base64url:GN,bigint:gn,boolean:Gc,catch:jy,check:Fy,cidrv4:JN,cidrv6:VN,clone:jt,coerce:lz,config:lt,core:w0,cuid:CN,cuid2:RN,custom:bT,date:sT,discriminatedUnion:cT,e164:YN,email:zN,emoji:AN,endsWith:$c,enum:Ye,file:hT,flattenError:Nu,float32:XN,float64:HN,formatError:Tu,function:p$,getErrorMap:S0,globalRegistry:dn,gt:vn,gte:ht,guid:xN,includes:gc,instanceof:ge,int:Po,int32:QN,int64:tT,intersection:by,ipv4:FN,ipv6:qN,iso:NN,json:_T,jwt:KN,keyof:aT,ksuid:BN,lazy:My,length:aa,literal:Oy,locales:f$,looseObject:uT,lowercase:pc,lt:pn,lte:wt,map:dT,maxLength:sa,maxSize:ia,mime:bc,minLength:ur,minSize:oi,multipleOf:ai,nan:gT,nanoid:DN,nativeEnum:fT,negative:qg,never:da,nonnegative:Vg,nonoptional:Uy,nonpositive:Jg,normalize:wc,null:zi,nullable:xs,nullish:pT,number:H,object:re,optional:zs,overwrite:xn,parse:iy,parseAsync:sy,partialRecord:lT,pipe:Es,positive:Fg,prefault:Ey,preprocess:kT,prettifyError:op,promise:$T,property:Wg,readonly:Cy,record:fa,refine:qy,regex:hc,regexes:Bp,registry:Ju,safeParse:ay,safeParseAsync:oy,set:mT,setErrorMap:O0,size:fc,startsWith:yc,strictObject:oT,string:Ne,stringbool:wT,success:vT,superRefine:Jy,symbol:cy,templateLiteral:yT,toJSONSchema:v$,toLowerCase:kc,toUpperCase:Ic,transform:el,treeifyError:sp,trim:_c,tuple:kr,uint32:eT,uint64:nT,ulid:LN,undefined:dy,union:ze,unknown:cr,uppercase:vc,url:jN,uuid:EN,uuidv4:UN,uuidv6:ZN,uuidv7:PN,void:iT,xid:MN},Symbol.toStringTag,{value:"Module"})),N0=async t=>await new Promise(e=>setTimeout(e,M.fromMilliseconds(t).milliseconds));let T0=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)??N0},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 z0=re({baseInterval:M.z.optional(),maxRetries:H().optional(),scale:H().optional()}),g$=Object.freeze(Object.defineProperty({__proto__:null,Breaker:T0,breakerConfigZ:z0},Symbol.toStringTag,{value:"Module"})),x0=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,y$=Ne().regex(x0),er=H().min(0).max(255),$$=H().min(0).max(1),b$=kr([er,er,er,$$]),E0=kr([er,er,er]),U0=re({rgba255:b$}),Z0=H().min(0).max(360),P0=H().min(0).max(100),j0=H().min(0).max(100),A0=kr([Z0,P0,j0,$$]),sl=ze([y$,E0,b$,A0,U0]),D0=sl.transform(t=>al(t)),al=(t,e=1)=>{if(t=sl.parse(t),typeof t=="string")return C0(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},C0=(t,e=1)=>(t=y$.parse(t),t=R0(t),[ts(t,0),ts(t,2),ts(t,4),t.length===8?ts(t,6)/255:e]),ts=(t,e)=>parseInt(t.slice(e,e+2),16),R0=t=>t.startsWith("#")?t.slice(1):t;al("#000000");al("#ffffff");const L0=re({key:Ne(),color:sl,position:H(),switched:Gc().optional()});xi(L0);const M0=re({key:Ne(),name:Ne(),color:D0});re({key:Ne(),name:Ne(),swatches:xi(M0)});const w$=H().int().min(0).max(255),_$=255,k$=0,B0={lower:k$,upper:_$+1},I$=re({name:Ne(),key:Ne()}),ci=t=>re({subject:I$,resource:t,authority:w$}),F0=(...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}),O$=t=>re({from:ci(t),to:zi()}),S$=t=>re({from:zi(),to:ci(t)}),q0=t=>ze([O$(t),S$(t),re({from:ci(t),to:ci(t)})]),$n=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:_$,AUTHORITY_BOUNDS:B0,ZERO_AUTHORITY:k$,acquireZ:S$,authorityZ:w$,filterTransfersByChannelKey:F0,releaseZ:O$,stateZ:ci,subjectZ:I$,transferZ:q0},Symbol.toStringTag,{value:"Module"})),J0=t=>Object.getOwnPropertySymbols(globalThis).includes(t),V0=(t,e)=>{const r=Symbol.for(t);if(!J0(r)){const i=e();Object.defineProperty(globalThis,r,{value:i})}return()=>globalThis[r]},N$="sy_x_error",W0=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),va=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 va(`${t}.${r}`)}},xt(e,"discriminator",N$),xt(e,"TYPE",t),xt(e,"matches",W0(t)),e},T$=t=>{if(t==null||typeof t!="object")return!1;const e=t;if(e.discriminator!==N$)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 G0=class{constructor(){xt(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Bo,data:""};if(T$(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=V0("synnax-error-registry",()=>new G0),Y0=({encode:t,decode:e})=>ol().register({encode:t,decode:e}),K0=t=>ol().encode(t),X0=t=>t==null?null:ol().decode(t);let Fo=class extends va("unknown"){};const H0=re({type:Ne(),data:Ne()});let Q0=class extends va("canceled"){};const dr=Object.freeze(Object.defineProperty({__proto__:null,Canceled:Q0,NONE:Bo,UNKNOWN:qn,Unknown:Fo,createTyped:va,decode:X0,encode:K0,isTyped:T$,payloadZ:H0,register:Y0},Symbol.toStringTag,{value:"Module"})),eE=Ae.object({jsonrpc:Ae.literal("2.0"),method:Ae.string(),params:Ae.any().optional(),id:Ae.union([Ae.string(),Ae.number(),Ae.null()]).optional()}),z$=Ae.object({jsonrpc:Ae.literal("2.0"),id:Ae.union([Ae.string(),Ae.number(),Ae.null()])}),tE=z$.extend({result:Ae.json()}),nE=z$.extend({error:Ae.object({code:Ae.number().int(),message:Ae.string().optional(),data:Ae.json().optional()})}),rE=Ae.union([tE,nE]);Ae.union([eE,rE]);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 Hs},iE=(t,e,r={})=>DS(Ei(t,e,r)),x$=(t,e,r={})=>AS(Ei(t,e,r)),sE=(t,e,r={})=>jS(Ei(t,e,r)),aE=({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}},oE=({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||x$(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}}},ff=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:Ei,createMigration:aE,migrator:oE,semVerNewer:x$,semVerOlder:sE,semVerZ:qo,versionsEqual:iE},Symbol.toStringTag,{value:"Module"})),uE=["standard","scientific","engineering"];Ye(uE);const cE=Ye(["success","info","warning","error","loading","disabled"]),ga=Object.freeze(Object.defineProperty({__proto__:null,variantZ:cE},Symbol.toStringTag,{value:"Module"})),lE=(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]}`},dE=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))},mE=Object.freeze(Object.defineProperty({__proto__:null,createShortIdentifiers:dE,naturalLanguageJoin:lE},Symbol.toStringTag,{value:"Module"})),ul="policy",cl="allow_all";var fE=Object.defineProperty,hE=(t,e,r)=>e in t?fE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ge=(t,e,r)=>hE(t,typeof e!="symbol"?e+"":e,r);const pE=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)},E$=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=yE(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)?pf(o,i.keepTypesOnRecursion)||(o=e(o,i)):i.recursiveInArray&&hf(o)&&(o=[...o].map(c=>{let l=c;return lo(c)?pf(l,i.keepTypesOnRecursion)||(l=e(c,i)):hf(c)&&(l=e({key:c},i).key),l}))),n[u]=o}),n)};return e},U$=E$(pE),vE=t=>t.replace(/([a-z0-9])([A-Z])/g,(e,r,i)=>`${r}_${i.toLowerCase()}`),gE=E$(vE),Jo={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},yE=(t=Jo)=>(t.recursive==null?t=Jo:t.recursiveInArray??(t.recursiveInArray=!1),t),hf=t=>t!=null&&Array.isArray(t),lo=t=>t!=null&&typeof t=="object"&&!Array.isArray(t),pf=(t,e)=>(e||[]).some(r=>t instanceof r),$E=t=>t!=null&&typeof t=="object"&&!Array.isArray(t);var bE=Object.defineProperty,wE=(t,e,r)=>e in t?bE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hr=(t,e,r)=>wE(t,typeof e!="symbol"?e+"":e,r);let _E=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=U$(r);return e!=null?e.parse(i):i}encodeString(t){const e=gE(t);return JSON.stringify(e,(r,i)=>ArrayBuffer.isView(i)?Array.from(i):typeof i=="bigint"?i.toString():i)}},kE=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||!$E(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}},IE=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 _E;new kE;new IE;var OE=Object.defineProperty,SE=(t,e,r)=>e in t?OE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,NE=(t,e,r)=>SE(t,e+"",r);let Or=class{constructor(t){NE(this,"value"),this.value=t}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const TE=t=>t!=null&&typeof t=="object"&&"toString"in t,zE=(t,e=!1)=>{const r=TE(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?xE(i):i},xE=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 Z$=Symbol("zod_brand");class mr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Zs={};function dt(t){return t&&Object.assign(Zs,t),Zs}function EE(t){return t}function UE(t){return t}function ZE(t){}function PE(t){throw new Error}function jE(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 P$(t,e){return typeof e=="bigint"?e.toString():e}function ya(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function En(t){return t==null}function $a(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function j$(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 AE(t,e){return e?e.reduce((r,i)=>r==null?void 0:r[i],t):t}function DE(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 A$=ya(()=>{if(typeof navigator<"u"&&navigator!=null&&navigator.userAgent.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Ps(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 CE(t){let e=0;for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}const RE=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}`)}},js=new Set(["string","number","symbol"]),D$=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 LE(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 C$(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const R$={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]},L$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function M$(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 B$(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 F$(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 q$(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 J$(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 V$(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 ba(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function wa(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 ME(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}class BE{constructor(...e){}}const FE=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:L$,Class:BE,NUMBER_FORMAT_RANGES:R$,aborted:tr,allowsEval:A$,assert:jE,assertEqual:EE,assertIs:ZE,assertNever:PE,assertNotEqual:UE,assignProp:Sr,cached:ya,cleanEnum:ME,cleanRegex:$a,clone:At,createTransparentProxy:LE,defineLazy:se,esc:Jn,escapeRegex:Un,extend:F$,finalizeIssue:It,floatSafeRemainder:j$,getElementAtPath:AE,getEnumValues:ll,getLengthableOrigin:wa,getParsedType:RE,getSizableOrigin:ba,isObject:li,isPlainObject:Ps,issue:fr,joinValues:j,jsonStringifyReplacer:P$,merge:q$,normalizeParams:T,nullish:En,numKeys:CE,omit:B$,optionalKeys:C$,partial:J$,pick:M$,prefixIssues:yt,primitiveTypes:D$,promiseAllObject:DE,propertyKeyTypes:js,randomString:dl,required:V$,stringifyPrimitive:X,unwrapMessage:Jr},Symbol.toStringTag,{value:"Module"})),W$=(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,P$,2)},enumerable:!0})},ml=b("$ZodError",W$),Ui=b("$ZodError",W$,{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 G$(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 Y$(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 K$(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 ${Y$(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}},X$=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}},H$=yl(Ui),Q$=/^[cC][^\s-]{8,}$/,eb=/^[0-9a-z]+$/,tb=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nb=/^[0-9a-vA-V]{20}$/,rb=/^[A-Za-z0-9]{27}$/,ib=/^[a-zA-Z0-9_-]{21}$/,sb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qE=/^[-+]?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)?)??$/,ab=/^([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)$/,JE=hr(4),VE=hr(6),WE=hr(7),ob=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,GE=/^[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])?)*$/,YE=/^(([^<>()\[\]\\.,;:\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,}))$/,KE=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,XE=/^[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])?)*$/,ub="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function cb(){return new RegExp(ub,"u")}const lb=/^(?:(?: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])$/,db=/^(([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})$/,mb=/^((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])$/,fb=/^(([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])$/,hb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$l=/^[A-Za-z0-9_-]*$/,pb=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,HE=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,vb=/^\+(?:[0-9]){6,14}[0-9]$/,gb="(?:(?:\\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])))",yb=new RegExp(`^${gb}$`);function $b(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 bb(t){return new RegExp(`^${$b(t)}$`)}function wb(t){const e=$b({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(`^${gb}T(?:${i})$`)}const _b=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}$`)},kb=/^\d+n?$/,Ib=/^\d+$/,Ob=/^-?\d+(?:\.\d+)?/i,Sb=/true|false/i,Nb=/null/i,Tb=/undefined/i,zb=/^[^A-Z]*$/,xb=/^[^a-z]*$/,Eb=Object.freeze(Object.defineProperty({__proto__:null,_emoji:ub,base64:hb,base64url:$l,bigint:kb,boolean:Sb,browserEmail:XE,cidrv4:mb,cidrv6:fb,cuid:Q$,cuid2:eb,date:yb,datetime:wb,domain:HE,duration:sb,e164:vb,email:ob,emoji:cb,extendedDuration:qE,guid:ab,hostname:pb,html5Email:GE,integer:Ib,ipv4:lb,ipv6:db,ksuid:rb,lowercase:zb,nanoid:ib,null:Nb,number:Ob,rfc5322Email:YE,string:_b,time:bb,ulid:tb,undefined:Tb,unicodeEmail:KE,uppercase:xb,uuid:hr,uuid4:JE,uuid6:VE,uuid7:WE,xid:nb},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=[])}),Ub={number:"number",bigint:"bigint",object:"date"},bl=b("$ZodCheckLessThan",(t,e)=>{Le.init(t,e);const r=Ub[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=Ub[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})}}),Zb=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):j$(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})}}),Pb=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]=R$[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=Ib)}),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})}}),jb=b("$ZodCheckBigIntFormat",(t,e)=>{Le.init(t,e);const[r,i]=L$[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})}}),Ab=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:ba(i),code:"too_big",maximum:e.maximum,input:i,inst:t,continue:!e.abort})}}),Db=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:ba(i),code:"too_small",minimum:e.minimum,input:i,inst:t,continue:!e.abort})}}),Cb=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:ba(i),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},input:r.value,inst:t,continue:!e.abort})}}),Rb=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=wa(i);r.issues.push({origin:n,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Lb=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=wa(i);r.issues.push({origin:n,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Mb=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=wa(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})})}),Bb=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})}}),Fb=b("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=zb),Zi.init(t,e)}),qb=b("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=xb),Zi.init(t,e)}),Jb=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})}}),Vb=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})}}),Wb=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 vf(t,e,r){t.issues.length&&e.issues.push(...yt(r,t.issues))}const Gb=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=>vf(n,r,e.property));vf(i,r,e.property)}}),Yb=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})}}),Kb=b("$ZodCheckOverwrite",(t,e)=>{Le.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class Xb{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 Hb={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=Hb;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=X$(t,s);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return H$(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()??_b(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)}),Qb=b("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=ab),be.init(t,e)}),ew=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)}),tw=b("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=ob),be.init(t,e)}),nw=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:pb.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})}}}),rw=b("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=cb()),be.init(t,e)}),iw=b("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=ib),be.init(t,e)}),sw=b("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Q$),be.init(t,e)}),aw=b("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=eb),be.init(t,e)}),ow=b("$ZodULID",(t,e)=>{e.pattern??(e.pattern=tb),be.init(t,e)}),uw=b("$ZodXID",(t,e)=>{e.pattern??(e.pattern=nb),be.init(t,e)}),cw=b("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=rb),be.init(t,e)}),lw=b("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=wb(e)),be.init(t,e),t._zod.check}),dw=b("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=yb),be.init(t,e)}),mw=b("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=bb(e)),be.init(t,e),t._zod.check}),fw=b("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=sb),be.init(t,e)}),hw=b("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=lb),be.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv4"})}),pw=b("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=db),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})}}}),vw=b("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=mb),be.init(t,e)}),gw=b("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=fb),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 yw=b("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=hb),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 $w(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 bw=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=>{$w(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),ww=b("$ZodE164",(t,e)=>{e.pattern??(e.pattern=vb),be.init(t,e)});function _w(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 kw=b("$ZodJWT",(t,e)=>{be.init(t,e),t._zod.check=r=>{_w(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??Ob,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}}),Iw=b("$ZodNumber",(t,e)=>{Pb.init(t,e),kl.init(t,e)}),Il=b("$ZodBoolean",(t,e)=>{F.init(t,e),t._zod.pattern=Sb,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=kb,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}}),Ow=b("$ZodBigInt",(t,e)=>{jb.init(t,e),Ol.init(t,e)}),Sw=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}}),Nw=b("$ZodUndefined",(t,e)=>{F.init(t,e),t._zod.pattern=Tb,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}}),Tw=b("$ZodNull",(t,e)=>{F.init(t,e),t._zod.pattern=Nb,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}}),zw=b("$ZodAny",(t,e)=>{F.init(t,e),t._zod.parse=r=>r}),As=b("$ZodUnknown",(t,e)=>{F.init(t,e),t._zod.parse=r=>r}),xw=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)}),Ew=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}}),Uw=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 gf(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=>gf(c,r,a))):gf(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function ns(t,e,r){t.issues.length&&e.issues.push(...yt(r,t.issues)),e.value[r]=t.value}function yf(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 Zw=b("$ZodObject",(t,e)=>{F.init(t,e);const r=ya(()=>{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=C$(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 Xb(["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=!Zs.jitless,o=a&&A$.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?yf(ce,l,w,g):ns(ce,l,w))):J?yf(A,l,w,g):ns(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=>ns(I,l,v))):ns(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 $f(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=>$a(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=>$f(a,r,t,i)):$f(s,r,t,i)}}),Pw=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=ya(()=>{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)}}),jw=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])=>bf(r,o,u)):bf(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(Ps(t)&&Ps(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 bf(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 _a=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=>rs(d,n,u))):rs(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=>rs(g,n,u))):rs(d,n,u)}}return o.length?Promise.all(o).then(()=>n):n}});function rs(t,e,r){t.issues.length&&e.issues.push(...yt(r,t.issues)),e.value[r]=t.value}const Aw=b("$ZodRecord",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!Ps(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}}),Dw=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])=>{wf(l,d,r,a,n,t,i)})):wf(u,c,r,a,n,t,i)}return s.length?Promise.all(s).then(()=>r):r}});function wf(t,e,r,i,n,s,a){t.issues.length&&(js.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&&(js.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 Cw=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=>_f(u,r))):_f(o,r)}return s.length?Promise.all(s).then(()=>r):r}});function _f(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}const Rw=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=>js.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}}),Lw=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}}),Mw=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}}),Bw=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(`^(${$a(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>r.value===void 0?r:e.innerType._zod.run(r,i)}),Fw=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(`^(${$a(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)}),qw=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=>kf(s,e)):kf(n,e)}});function kf(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Jw=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))}),Vw=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=>If(s,t)):If(n,t)}});function If(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 Ww=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)}}),Gw=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)}}),Yw=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=>Of(s,e,i)):Of(n,e,i)}});function Of(t,e,r){return tr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const Kw=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(Sf):Sf(n)}});function Sf(t){return t.value=Object.freeze(t.value),t}const Xw=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||D$.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)}),Hw=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))}),Qw=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)}),e_=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=>Nf(s,r,i,t));Nf(n,r,i,t)}});function Nf(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 t_=Symbol("ZodOutput"),n_=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 r_(t,e){return new t({type:"string",...T(e)})}function i_(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 Ds(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 s_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function a_(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(e)})}function o_(t,e){return new t({type:"string",format:"date",check:"string_format",...T(e)})}function u_(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...T(e)})}function c_(t,e){return new t({type:"string",format:"duration",check:"string_format",...T(e)})}function l_(t,e){return new t({type:"number",checks:[],...T(e)})}function d_(t,e){return new t({type:"number",coerce:!0,checks:[],...T(e)})}function m_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...T(e)})}function f_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...T(e)})}function h_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...T(e)})}function p_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...T(e)})}function v_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...T(e)})}function g_(t,e){return new t({type:"boolean",...T(e)})}function y_(t,e){return new t({type:"boolean",coerce:!0,...T(e)})}function $_(t,e){return new t({type:"bigint",...T(e)})}function b_(t,e){return new t({type:"bigint",coerce:!0,...T(e)})}function w_(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...T(e)})}function __(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...T(e)})}function k_(t,e){return new t({type:"symbol",...T(e)})}function I_(t,e){return new t({type:"undefined",...T(e)})}function O_(t,e){return new t({type:"null",...T(e)})}function S_(t){return new t({type:"any"})}function Cs(t){return new t({type:"unknown"})}function N_(t,e){return new t({type:"never",...T(e)})}function T_(t,e){return new t({type:"void",...T(e)})}function z_(t,e){return new t({type:"date",...T(e)})}function x_(t,e){return new t({type:"date",coerce:!0,...T(e)})}function E_(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 U_(t){return wn(0,t)}function Z_(t){return bn(0,t)}function P_(t){return _t(0,t)}function j_(t){return pt(0,t)}function di(t,e){return new Zb({check:"multiple_of",...T(e),value:t})}function ka(t,e){return new Ab({check:"max_size",...T(e),maximum:t})}function mi(t,e){return new Db({check:"min_size",...T(e),minimum:t})}function Ql(t,e){return new Cb({check:"size_equals",...T(e),size:t})}function Ia(t,e){return new Rb({check:"max_length",...T(e),maximum:t})}function pr(t,e){return new Lb({check:"min_length",...T(e),minimum:t})}function Oa(t,e){return new Mb({check:"length_equals",...T(e),length:t})}function ed(t,e){return new Bb({check:"string_format",format:"regex",...T(e),pattern:t})}function td(t){return new Fb({check:"string_format",format:"lowercase",...T(t)})}function nd(t){return new qb({check:"string_format",format:"uppercase",...T(t)})}function rd(t,e){return new Jb({check:"string_format",format:"includes",...T(e),includes:t})}function id(t,e){return new Vb({check:"string_format",format:"starts_with",...T(e),prefix:t})}function sd(t,e){return new Wb({check:"string_format",format:"ends_with",...T(e),suffix:t})}function A_(t,e,r){return new Gb({check:"property",property:t,schema:e,...T(r)})}function ad(t,e){return new Yb({check:"mime_type",mime:t,...T(e)})}function Zn(t){return new Kb({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 QE(t,e,r){return new t({type:"union",options:e,...T(r)})}function e1(t,e,r,i){return new t({type:"union",options:r,discriminator:e,...T(i)})}function t1(t,e,r){return new t({type:"intersection",left:e,right:r})}function D_(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 n1(t,e,r,i){return new t({type:"record",keyType:e,valueType:r,...T(i)})}function r1(t,e,r,i){return new t({type:"map",keyType:e,valueType:r,...T(i)})}function i1(t,e,r){return new t({type:"set",valueType:e,...T(r)})}function s1(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 a1(t,e,r){return new t({type:"enum",entries:e,...T(r)})}function o1(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...T(r)})}function C_(t,e){return new t({type:"file",...T(e)})}function u1(t,e){return new t({type:"transform",transform:e})}function c1(t,e){return new t({type:"optional",innerType:e})}function l1(t,e){return new t({type:"nullable",innerType:e})}function d1(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():r}})}function m1(t,e,r){return new t({type:"nonoptional",innerType:e,...T(r)})}function f1(t,e){return new t({type:"success",innerType:e})}function h1(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function p1(t,e,r){return new t({type:"pipe",in:e,out:r})}function v1(t,e){return new t({type:"readonly",innerType:e})}function g1(t,e,r){return new t({type:"template_literal",parts:e,...T(r)})}function y1(t,e){return new t({type:"lazy",getter:e})}function $1(t,e){return new t({type:"promise",innerType:e})}function R_(t,e,r){const i=T(r);return i.abort??(i.abort=!0),new t({type:"custom",check:"custom",fn:e,...i})}function L_(t,e,r){return new t({type:"custom",check:"custom",fn:e,...T(r)})}function M_(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)=>{lw.init(t,e),ke.init(t,e)});function B_(t){return a_(md,t)}const fd=b("ZodISODate",(t,e)=>{dw.init(t,e),ke.init(t,e)});function F_(t){return o_(fd,t)}const hd=b("ZodISOTime",(t,e)=>{mw.init(t,e),ke.init(t,e)});function q_(t){return u_(hd,t)}const pd=b("ZodISODuration",(t,e)=>{fw.init(t,e),ke.init(t,e)});function J_(t){return c_(pd,t)}const b1=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:fd,ZodISODateTime:md,ZodISODuration:pd,ZodISOTime:hd,date:F_,datetime:B_,duration:J_,time:q_},Symbol.toStringTag,{value:"Module"})),V_=(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}}})},w1=b("ZodError",V_),ji=b("ZodError",V_,{Parent:Error}),W_=pl(ji),G_=vl(ji),Y_=gl(ji),K_=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)=>W_(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>Y_(t,r,i),t.parseAsync=async(r,i)=>G_(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>K_(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(Zk(r,i)),t.superRefine=r=>t.check(Pk(r)),t.overwrite=r=>t.check(Zn(r)),t.optional=()=>Ls(t),t.nullable=()=>Ms(t),t.nullish=()=>Ls(Ms(t)),t.nonoptional=r=>wk(t,r),t.array=()=>Ai(t),t.or=r=>Ue([t,r]),t.and=r=>ck(t,r),t.transform=r=>Bs(t,Md(r)),t.default=r=>yk(t,r),t.prefault=r=>bk(t,r),t.catch=r=>Ik(t,r),t.pipe=r=>Bs(t,r),t.readonly=()=>Nk(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(Ia(...i)),t.length=(...i)=>t.check(Oa(...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())}),Sa=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(Ds(Rs,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(Ds(Rs,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(B_(r)),t.date=r=>t.check(F_(r)),t.time=r=>t.check(q_(r)),t.duration=r=>t.check(J_(r))});function Te(t){return r_(Sa,t)}const ke=b("ZodStringFormat",(t,e)=>{be.init(t,e),vd.init(t,e)}),gd=b("ZodEmail",(t,e)=>{tw.init(t,e),ke.init(t,e)});function _1(t){return Ul(gd,t)}const Rs=b("ZodGUID",(t,e)=>{Qb.init(t,e),ke.init(t,e)});function k1(t){return Ds(Rs,t)}const qt=b("ZodUUID",(t,e)=>{ew.init(t,e),ke.init(t,e)});function I1(t){return Zl(qt,t)}function O1(t){return Pl(qt,t)}function S1(t){return jl(qt,t)}function N1(t){return Al(qt,t)}const yd=b("ZodURL",(t,e)=>{nw.init(t,e),ke.init(t,e)});function T1(t){return Dl(yd,t)}const $d=b("ZodEmoji",(t,e)=>{rw.init(t,e),ke.init(t,e)});function z1(t){return Cl($d,t)}const bd=b("ZodNanoID",(t,e)=>{iw.init(t,e),ke.init(t,e)});function x1(t){return Rl(bd,t)}const wd=b("ZodCUID",(t,e)=>{sw.init(t,e),ke.init(t,e)});function E1(t){return Ll(wd,t)}const _d=b("ZodCUID2",(t,e)=>{aw.init(t,e),ke.init(t,e)});function U1(t){return Ml(_d,t)}const kd=b("ZodULID",(t,e)=>{ow.init(t,e),ke.init(t,e)});function Z1(t){return Bl(kd,t)}const Id=b("ZodXID",(t,e)=>{uw.init(t,e),ke.init(t,e)});function P1(t){return Fl(Id,t)}const Od=b("ZodKSUID",(t,e)=>{cw.init(t,e),ke.init(t,e)});function j1(t){return ql(Od,t)}const Sd=b("ZodIPv4",(t,e)=>{hw.init(t,e),ke.init(t,e)});function A1(t){return Jl(Sd,t)}const Nd=b("ZodIPv6",(t,e)=>{pw.init(t,e),ke.init(t,e)});function D1(t){return Vl(Nd,t)}const Td=b("ZodCIDRv4",(t,e)=>{vw.init(t,e),ke.init(t,e)});function C1(t){return Wl(Td,t)}const zd=b("ZodCIDRv6",(t,e)=>{gw.init(t,e),ke.init(t,e)});function R1(t){return Gl(zd,t)}const xd=b("ZodBase64",(t,e)=>{yw.init(t,e),ke.init(t,e)});function L1(t){return Yl(xd,t)}const Ed=b("ZodBase64URL",(t,e)=>{bw.init(t,e),ke.init(t,e)});function M1(t){return Kl(Ed,t)}const Ud=b("ZodE164",(t,e)=>{ww.init(t,e),ke.init(t,e)});function B1(t){return Xl(Ud,t)}const Zd=b("ZodJWT",(t,e)=>{kw.init(t,e),ke.init(t,e)});function F1(t){return Hl(Zd,t)}const Na=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 l_(Na,t)}const Nr=b("ZodNumberFormat",(t,e)=>{Iw.init(t,e),Na.init(t,e)});function Ko(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)}function W1(t){return v_(Nr,t)}const Ta=b("ZodBoolean",(t,e)=>{Il.init(t,e),te.init(t,e)});function Pd(t){return g_(Ta,t)}const za=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 $_(za,t)}const jd=b("ZodBigIntFormat",(t,e)=>{Ow.init(t,e),za.init(t,e)});function G1(t){return w_(jd,t)}function Y1(t){return __(jd,t)}const X_=b("ZodSymbol",(t,e)=>{Sw.init(t,e),te.init(t,e)});function H_(t){return k_(X_,t)}const Q_=b("ZodUndefined",(t,e)=>{Nw.init(t,e),te.init(t,e)});function ek(t){return I_(Q_,t)}const tk=b("ZodNull",(t,e)=>{Tw.init(t,e),te.init(t,e)});function Ad(t){return O_(tk,t)}const nk=b("ZodAny",(t,e)=>{zw.init(t,e),te.init(t,e)});function K1(){return S_(nk)}const rk=b("ZodUnknown",(t,e)=>{As.init(t,e),te.init(t,e)});function vr(){return Cs(rk)}const ik=b("ZodNever",(t,e)=>{xw.init(t,e),te.init(t,e)});function xa(t){return N_(ik,t)}const sk=b("ZodVoid",(t,e)=>{Ew.init(t,e),te.init(t,e)});function X1(t){return T_(sk,t)}const Dd=b("ZodDate",(t,e)=>{Uw.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 H1(t){return z_(Dd,t)}const ak=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(Ia(r,i)),t.length=(r,i)=>t.check(Oa(r,i)),t.unwrap=()=>t.element});function Ai(t,e){return dd(ak,t,e)}function Q1(t){const e=t._zod.def.shape;return hk(Object.keys(e))}const Ea=b("ZodObject",(t,e)=>{Zw.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:xa()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>F$(t,r),t.merge=r=>q$(t,r),t.pick=r=>M$(t,r),t.omit=r=>B$(t,r),t.partial=(...r)=>J$(Bd,t,r[0]),t.required=(...r)=>V$(Fd,t,r[0])});function pe(t,e){const r={type:"object",get shape(){return Sr(this,"shape",{...t}),this.shape},...T(e)};return new Ea(r)}function eU(t,e){return new Ea({type:"object",get shape(){return Sr(this,"shape",{...t}),this.shape},catchall:xa(),...T(e)})}function tU(t,e){return new Ea({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 ok=b("ZodDiscriminatedUnion",(t,e)=>{Cd.init(t,e),Pw.init(t,e)});function nU(t,e,r){return new ok({type:"union",options:e,discriminator:t,...T(r)})}const uk=b("ZodIntersection",(t,e)=>{jw.init(t,e),te.init(t,e)});function ck(t,e){return new uk({type:"intersection",left:t,right:e})}const lk=b("ZodTuple",(t,e)=>{_a.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 lk({type:"tuple",items:t,rest:s,...T(n)})}const Rd=b("ZodRecord",(t,e)=>{Aw.init(t,e),te.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Ua(t,e,r){return new Rd({type:"record",keyType:t,valueType:e,...T(r)})}function rU(t,e,r){return new Rd({type:"record",keyType:Ue([t,xa()]),valueType:e,...T(r)})}const dk=b("ZodMap",(t,e)=>{Dw.init(t,e),te.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function iU(t,e,r){return new dk({type:"map",keyType:t,valueType:e,...T(r)})}const mk=b("ZodSet",(t,e)=>{Cw.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(ka(...r)),t.size=(...r)=>t.check(Ql(...r))});function sU(t,e){return new mk({type:"set",valueType:t,...T(e)})}const fi=b("ZodEnum",(t,e)=>{Rw.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 aU(t,e){return new fi({type:"enum",entries:t,...T(e)})}const fk=b("ZodLiteral",(t,e)=>{Lw.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 hk(t,e){return new fk({type:"literal",values:Array.isArray(t)?t:[t],...T(e)})}const pk=b("ZodFile",(t,e)=>{Mw.init(t,e),te.init(t,e),t.min=(r,i)=>t.check(mi(r,i)),t.max=(r,i)=>t.check(ka(r,i)),t.mime=(r,i)=>t.check(ad(Array.isArray(r)?r:[r],i))});function oU(t){return C_(pk,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)=>{Bw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ls(t){return new Bd({type:"optional",innerType:t})}const vk=b("ZodNullable",(t,e)=>{Fw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ms(t){return new vk({type:"nullable",innerType:t})}function uU(t){return Ls(Ms(t))}const gk=b("ZodDefault",(t,e)=>{qw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function yk(t,e){return new gk({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const $k=b("ZodPrefault",(t,e)=>{Jw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function bk(t,e){return new $k({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const Fd=b("ZodNonOptional",(t,e)=>{Vw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function wk(t,e){return new Fd({type:"nonoptional",innerType:t,...T(e)})}const _k=b("ZodSuccess",(t,e)=>{Ww.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cU(t){return new _k({type:"success",innerType:t})}const kk=b("ZodCatch",(t,e)=>{Gw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Ik(t,e){return new kk({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Ok=b("ZodNaN",(t,e)=>{Yw.init(t,e),te.init(t,e)});function lU(t){return E_(Ok,t)}const qd=b("ZodPipe",(t,e)=>{zl.init(t,e),te.init(t,e),t.in=e.in,t.out=e.out});function Bs(t,e){return new qd({type:"pipe",in:t,out:e})}const Sk=b("ZodReadonly",(t,e)=>{Kw.init(t,e),te.init(t,e)});function Nk(t){return new Sk({type:"readonly",innerType:t})}const Tk=b("ZodTemplateLiteral",(t,e)=>{Xw.init(t,e),te.init(t,e)});function dU(t,e){return new Tk({type:"template_literal",parts:t,...T(e)})}const zk=b("ZodLazy",(t,e)=>{Qw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.getter()});function xk(t){return new zk({type:"lazy",getter:t})}const Ek=b("ZodPromise",(t,e)=>{Hw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function mU(t){return new Ek({type:"promise",innerType:t})}const Za=b("ZodCustom",(t,e)=>{e_.init(t,e),te.init(t,e)});function Uk(t,e){const r=new Le({check:"custom",...T(e)});return r._zod.check=t,r}function fU(t,e){return R_(Za,t??(()=>!0),e)}function Zk(t,e={}){return L_(Za,t,e)}function Pk(t,e){const r=Uk(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 Za({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...T(e)});return r._zod.bag.Class=t,r}const hU=(...t)=>M_({Pipe:qd,Boolean:Ta,String:Sa,Transform:Ld},...t);function pU(t){const e=xk(()=>Ue([Te(t),Q(),Pd(),Ad(),Ai(e),Ua(Te(),e)]));return e}function vU(t,e){return Bs(Md(t),e)}const Pa=Tr([Q(),Q()]);Tr([_n(),_n()]);const jk=pe({width:Q(),height:Q()}),gU=pe({signedWidth:Q(),signedHeight:Q()}),yU=["width","height"];Ke(yU);const $U=["start","center","end"],bU=["signedWidth","signedHeight"];Ke(bU);const Fs=pe({x:Q(),y:Q()}),wU=pe({clientX:Q(),clientY:Q()}),_U=["x","y"],Ak=Ke(_U),Dk=["top","right","bottom","left"];Ke(Dk);const kU=["left","right"],Ck=Ke(kU),IU=["top","bottom"],Rk=Ke(IU),Lk=["center"],Tf=Ke(Lk),OU=[...Dk,...Lk],Mk=Ke(OU);Ke($U);const SU=["first","last"];Ke(SU);const NU=pe({lower:Q(),upper:Q()}),TU=pe({lower:_n(),upper:_n()});Ue([NU,Pa]);Ue([TU,Pa]);Ke([...Ak.options,...Mk.options]);Ue([Ak,Mk,ye(String)]);const zU=t=>typeof t=="bigint"||t instanceof BigInt,Mn=(t,e)=>zU(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?xU(i):i},xU=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t,zf=(t,e)=>{const r=hn(t);return e<r.lower?r.lower:e>=r.upper?r.upper-(typeof r.upper=="number"?1:1n):e};pe({x:Ck.or(Tf),y:Rk.or(Tf)});const EU=pe({x:Ck,y:Rk}),UU=Object.freeze({x:"left",y:"top"}),ZU=(t,e)=>t.x===e.x&&t.y===e.y,xf=Ue([Q(),Fs,Pa,jk,gU,wU]),PU=(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}},Ef=Object.freeze({x:0,y:0}),is=Ue([Q(),Te()]);pe({top:is,left:is,width:is,height:is});pe({left:Q(),top:Q(),right:Q(),bottom:Q()});pe({one:Fs,two:Fs,root:EU});const Jd=(t,e,r=0,i=0,n)=>{const s={one:{...Ef},two:{...Ef},root:n??UU};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}},jU=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,AU=pe({signedWidth:Q(),signedHeight:Q()});Ue([jk,AU,Fs,Pa]);var DU=Object.defineProperty,CU=(t,e,r)=>e in t?DU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jt=(t,e,r)=>CU(t,typeof e!="symbol"?e+"":e,r);const RU=(t,e,r)=>e!==void 0&&t<e?e:r!==void 0&&t>r?r:t;pe({offset:xf,scale:xf});pe({offset:Q(),scale:Q()});const LU=t=>(e,r,i,n)=>r==="dimension"?[e,i]:[e,n?i-t:i+t],MU=t=>(e,r,i,n)=>[e,n?i/t:i*t],BU=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]},FU=t=>(e,r,i)=>[t,i],qU=()=>(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)]},JU=t=>(e,r,i)=>{const{lower:n,upper:s}=t;return i=RU(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=LU(e);return i.type="translate",r.ops.push(i),r}magnify(e){const r=this.new(),i=MU(e);return i.type="magnify",r.ops.push(i),r}scale(e,r){const i=hn(e,r),n=this.new(),s=BU(i);return s.type="scale",n.ops.push(s),n}clamp(e,r){const i=hn(e,r),n=this.new(),s=JU(i);return s.type="clamp",n.ops.push(s),n}reBound(e,r){const i=hn(e,r),n=this.new(),s=FU(i);return s.type="re-bound",n.ops.push(s),n}invert(){const e=qU();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 Uf=Xo;const Zf=class Lt{constructor(e=new Uf,r=new Uf,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=PU(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(jU(e)){const i=this.currRoot;return r.currRoot=e.root,i!=null&&!ZU(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(Zf,"IDENTITY",new Zf);var VU=Object.defineProperty,WU=(t,e,r)=>e in t?VU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,U=(t,e,r)=>WU(t,typeof e!="symbol"?e+"":e,r);function GU(t){return i_(Sa,t)}function YU(t){return d_(Na,t)}function KU(t){return y_(Ta,t)}function Bk(t){return b_(za,t)}function XU(t){return x_(Dd,t)}const HU=Object.freeze(Object.defineProperty({__proto__:null,bigint:Bk,boolean:KU,date:XU,number:YU,string:GU},Symbol.toStringTag,{value:"Module"}));let QU=(t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i};const eZ="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",tZ=QU(eZ,11),nZ=()=>tZ(),rZ=(t,e)=>r=>r instanceof e||typeof r=="object"&&r!==null&&"discriminator"in r&&r.discriminator===t,iZ=Ke(["static","dynamic"]),Fk=(t,e)=>{const r=new ve(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 ve?new ve(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 Fk(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([pe({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 ve=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 Pf?e.period:e instanceof ve?new Y(e):["number","bigint"].includes(typeof e)?Y.seconds(e):new Y(e)}static fromMilliseconds(e){return e instanceof Y?e:e instanceof Pf?e.period:e instanceof ve?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 Fk(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([pe({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 $s extends Or{constructor(e){super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new $s(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 $s(e)}static khz(e){return $s.hz(e*1e3)}};U(Wr,"z",Ue([Q().transform(t=>new Wr(t)),ye(Number).transform(t=>new Wr(t)),ye(Wr)]));let Pf=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 ve(e.start),this.end=new ve(e.end)):(this.start=new ve(e),this.end=new ve(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=ve.max(i.start,e.start),s=ve.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(ve.min(...e.map(r=>r.start)),ve.max(...e.map(r=>r.end)))}};U(Tt,"MAX",new Tt(ve.MIN,ve.MAX)),U(Tt,"MIN",new Tt(ve.MAX,ve.MIN)),U(Tt,"ZERO",new Tt(ve.ZERO,ve.ZERO)),U(Tt,"z",Ue([pe({start:ve.z,end:ve.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 qk=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof ve||t instanceof oe||t instanceof Date},sZ=(t,e,r,i=0)=>t.usesBigInt&&!e.usesBigInt?Number(r)-Number(i):!t.usesBigInt&&e.usesBigInt?BigInt(r.valueOf())-BigInt(i.valueOf()):bs(r,-i).valueOf(),bs=(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),aZ=/^(?:[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 oZ(t){return typeof t=="string"&&aZ.test(t)}const tt=[];for(let t=0;t<256;++t)tt.push((t+256).toString(16).slice(1));function uZ(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 cZ(t,e=0){const r=uZ(t,e);if(!oZ(r))throw TypeError("Stringified UUID is invalid");return r}typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const lZ=(t,e)=>cZ(t,e),Kt=-1,dZ=Te().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer),mZ=Ue([Ad(),ek()]).transform(()=>new Uint8Array().buffer),Qo=10,fZ=(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`)},Jk="sy_x_telem_series",Yr=class Vn{constructor(e){U(this,"key"),U(this,"discriminator",Jk),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"),hZ(e)&&(e={data:e}),e.data??(e.data=[]);const{dataType:r,timeRange:i,sampleOffset:n=0,glBufferUsage:s="static",alignment:a=0n,key:o=nZ(),data:u}=e;if(pZ(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=qk(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 ve||d instanceof Date||d instanceof ve)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 ve||g instanceof Date||g instanceof oe)&&(d=d.map(p=>new ve(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]=Vf(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):Rs(JSON.parse(new TextDecoder().decode(a)))}binarySearch(e){let t=0,n=this.length-1;const s=ef(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 Co(e,this.dataType),this}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:ta(this.alignmentBounds.lower),upper:ta(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 Jf(this);return this.dataType.equals(x.JSON)?new Xf(e):e}return new Qf(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new Gi(this,e,t??this.length)}subAlignmentIterator(e,t){return new Gi(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([Hf,Kf,i.z.instanceof(ArrayBuffer),i.z.instanceof(Uint8Array)]),glBufferUsage:Yf.optional().default("static").optional()})),y(Vt,"z",Vt.crudeZ.transform(r=>new Vt(r)));let _e=Vt,Gi=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=qi(s,n),this.index=qi(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}};class Jf{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 Hi,Ki;const Ro=class Bo{constructor(e){y(this,"wrapped"),y(this,Hi,"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,Bo.SCHEMA)}}[(Ki=Symbol.iterator,Hi=Symbol.toStringTag,Ki)](){return this}};y(Ro,"SCHEMA",i.z.record(i.z.string(),i.z.unknown()));let Xf=Ro;var Ji,Xi;class Qf{constructor(e){y(this,"series"),y(this,"index"),y(this,Ji,"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)}}[(Xi=Symbol.iterator,Ji=Symbol.toStringTag,Xi)](){return this}}class Po{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 Co(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 Tf(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 Of(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 Sf(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 ey(this.series)}}var Qi,ea;class ey{constructor(e){y(this,"series"),y(this,"seriesIndex"),y(this,"internal"),y(this,Qi,"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())}[(ea=Symbol.iterator,Qi=Symbol.toStringTag,ea)](){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 ta=r=>{const e=r>>32n,t=r&0xffffffffn;return{domain:e,sample:t}},ty=(r,e)=>{let t=null;return e===0?r:(...n)=>{t!==null&&(clearTimeout(t),t=null),t=setTimeout(()=>r(...n),e)}},ry=(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)},ny=(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 sy=Object.defineProperty,iy=(r,e,t)=>e in r?sy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Dr=(r,e,t)=>iy(r,typeof e!="symbol"?e+"":e,t);let ay=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))}},oy=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:oy,Observer:ay},Symbol.toStringTag,{value:"Module"})),ce=i.z.record(i.z.union([i.z.number(),i.z.string(),i.z.symbol()]),i.z.unknown()),cy=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";cy();const ly=["macOS","Windows","Linux"],hy=["macos","windows","linux"],uy={macos:"macOS",windows:"Windows",linux:"Linux"};i.z.enum(ly).or(i.z.enum(hy).transform(r=>uy[r]));var dy=Object.defineProperty,fy=(r,e,t)=>e in r?dy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gt=(r,e,t)=>fy(r,typeof e!="symbol"?e+"":e,t);const yy=(...r)=>r.map(Do).join(""),Do=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),gy=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=Do(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:yy(this.path,e)})}toString(){return gy(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};Gt(us,"UNKNOWN",new us({host:"unknown",port:0}));let py=us;const wy=-128,my=127,by=i.z.number().int().min(wy).max(my),vy=-32768,Ty=32767,Oy=i.z.number().int().min(vy).max(Ty),Sy=-2147483648,Ey=2147483647,zy=i.z.number().int().min(Sy).max(Ey),Ny=-9223372036854775808n,Iy=9223372036854775807n,$y=i.z.bigint().min(Ny).max(Iy),xy=255,ky=i.z.number().int().min(0).max(xy),Ay=65535,Uy=i.z.number().int().min(0).max(Ay),Cy=4294967295,Ry=i.z.number().int().min(0).max(Cy),By=18446744073709551615n,Py=i.z.bigint().min(0n).max(By),Mo=r=>ry(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"]}),ra=(r,e)=>{if(r==null)return null;const t=r[e];return t==null&&typeof r=="object"&&"sourceType"in r?r.sourceType()[e]:t},Dy=(r,e,t)=>ny(ra(r,"shape"),Mo(e),{...t,getter:ra}),My=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:Dy,getFieldSchemaPath:Mo,int16:Oy,int32:zy,int64:$y,int8:by,uint16:Uy,uint32:Ry,uint64:Py,uint8:ky},Symbol.toStringTag,{value:"Module"}));var jy=Object.defineProperty,Ly=(r,e,t)=>e in r?jy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Te=(r,e,t)=>Ly(r,typeof e!="symbol"?e+"":e,t);const _y=async r=>await new Promise(e=>setTimeout(e,O.fromMilliseconds(r).milliseconds));class Zy{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)??_y},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 qy=i.z.object({baseInterval:O.z.optional(),maxRetries:i.z.number().optional(),scale:i.z.number().optional()}),jo=Object.freeze(Object.defineProperty({__proto__:null,Breaker:Zy,breakerConfig:qy},Symbol.toStringTag,{value:"Module"})),Fy=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,Ds=i.z.string().regex(Fy),wt=i.z.number().min(0).max(255),Yy=i.z.number().min(0).max(1),Ms=i.z.tuple([wt,wt,wt,Yy]),Lo=i.z.tuple([wt,wt,wt]),_o=i.z.object({rgba255:Ms}),js=(r,e=1)=>{if(typeof r=="string")return Vy(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}if(typeof r=="object"&&"rgba255"in r)return r.rgba255;throw new Error(`Invalid color: ${JSON.stringify(r)}`)},Wy=i.z.union([Ds,Ms,Lo,_o]).transform(r=>js(r)),Vy=(r,e=1)=>{if(!Ds.safeParse(r).success)throw new Error(`Invalid hex color: ${r}`);return r=Gy(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),Gy=r=>r.startsWith("#")?r.slice(1):r,Hy=i.z.union([Ds,Ms,i.z.string(),Lo,_o]);js("#000000");js("#ffffff");const Ky=i.z.object({key:i.z.string(),color:Hy,position:i.z.number(),switched:i.z.boolean().optional()});i.z.array(Ky);const Jy=i.z.object({key:i.z.string(),name:i.z.string(),color:Wy});i.z.object({key:i.z.string(),name:i.z.string(),swatches:i.z.array(Jy)});const Zo=i.z.number().int().min(0).max(255),qo=255,Fo=0,Xy={lower:Fo,upper:qo+1},Yo=i.z.object({name:i.z.string(),key:i.z.string()}),nr=r=>i.z.object({subject:Yo,resource:r,authority:Zo}),Qy=(...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}),Wo=i.z.object({from:nr(i.z.any()),to:i.z.null()}),Vo=i.z.object({from:i.z.null(),to:nr(i.z.any())}),eg=i.z.union([Wo,Vo,i.z.object({from:nr(i.z.any()),to:nr(i.z.any())})]),Ke=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:qo,AUTHORITY_BOUNDS:Xy,ZERO_AUTHORITY:Fo,acquireZ:Vo,authorityZ:Zo,filterTransfersByChannelKey:Qy,releaseZ:Wo,stateZ:nr,subjectZ:Yo,transferZ:eg},Symbol.toStringTag,{value:"Module"})),tg=r=>Object.getOwnPropertySymbols(globalThis).includes(r),rg=(r,e)=>{const t=Symbol.for(r);if(!tg(t)){const n=e();Object.defineProperty(globalThis,t,{value:n})}return()=>globalThis[t]},ng=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",ng(r)),e},Go=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 sg{constructor(){Te(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:fs,data:""};if(Go(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 Ls=rg("synnax-error-registry",()=>new sg),ig=({encode:r,decode:e})=>Ls().register({encode:r,decode:e}),ag=r=>Ls().encode(r),og=r=>r==null?null:Ls().decode(r);class ys extends Xr("unknown"){}const cg=i.z.object({type:i.z.string(),data:i.z.string()});class lg extends Xr("canceled"){}const Tt=Object.freeze(Object.defineProperty({__proto__:null,Canceled:lg,NONE:fs,UNKNOWN:ct,Unknown:ys,createTyped:Xr,decode:og,encode:ag,isTyped:Go,payloadZ:cg,register:ig},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},hg=(r,e,t={})=>sf(ur(r,e,t)),Ho=(r,e,t={})=>nf(ur(r,e,t)),ug=(r,e,t={})=>rf(ur(r,e,t)),dg=({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}},fg=({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||Ho(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}}},na=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:ur,createMigration:dg,migrator:fg,semVerNewer:Ho,semVerOlder:ug,semVerZ:gs,versionsEqual:hg},Symbol.toStringTag,{value:"Module"})),yg=["standard","scientific","engineering"];i.z.enum(yg);const gg=(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]}`},pg=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))},wg=Object.freeze(Object.defineProperty({__proto__:null,createShortIdentifiers:pg,naturalLanguageJoin:gg},Symbol.toStringTag,{value:"Module"}));class Ue extends Tt.createTyped("sy"){}class F extends Ue.sub("validation"){}class sa 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)=>lZ(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]=sZ(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()),bs(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()),bs(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 bs(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):U$(JSON.parse(new TextDecoder().decode(s)))}binarySearch(e){let r=0,i=this.length-1;const n=zE(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 fZ(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:Af(this.alignmentBounds.lower),upper:Af(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 vZ(this);return this.dataType.equals(je.JSON)?new gZ(e):e}return new yZ(this)}slice(e,r){return this.sliceSub(!1,e,r)}sub(e,r){return this.sliceSub(!0,e,r)}subIterator(e,r){return new jf(this,e,r??this.length)}subAlignmentIterator(e,r){return new jf(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",pe({timeRange:Qr.z.optional(),dataType:je.z,alignment:Bk().optional(),data:Ue([dZ,mZ,ye(ArrayBuffer),ye(Uint8Array)]),glBufferUsage:iZ.optional().default("static").optional()})),U(Yr,"z",Yr.crudeZ.transform(t=>new Yr(t)));let Vk=Yr;const hZ=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof Vk?!0:qk(t),pZ=rZ(Jk,Vk);class jf{constructor(e,r,i){U(this,"series"),U(this,"end"),U(this,"index"),this.series=e;const n=hn(0,e.length);this.end=zf(n,i),this.index=zf(n,r)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}}class vZ{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 Wk=class Gk{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,Gk.schema)}}};U(Wk,"schema",Ua(Te(),vr()));let gZ=Wk;class yZ{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 Af=t=>{const e=t>>32n,r=t&0xffffffffn;return{domain:e,sample:r}};pe({key:Te(),value:Te()});Ua(Ue([Q(),Te(),H_()]),vr());const Yk=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",$Z=Yk(),Kk=["macOS","Windows","Linux"],bZ=["macos","windows","linux"],wZ={macos:"macOS",windows:"Windows",linux:"Linux"},_Z=Ke(Kk).or(Ke(bZ).transform(t=>wZ[t])),kZ=()=>{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 IZ=(t={})=>{const{force:e,default:r}=t;return e??ho??(ho=kZ(),ho??r)},Xk=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:Kk,RUNTIME:$Z,detect:Yk,getOS:IZ,osZ:_Z},Symbol.toStringTag,{value:"Module"}));var OZ=Object.defineProperty,SZ=(t,e,r)=>e in t?OZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kr=(t,e,r)=>SZ(t,typeof e!="symbol"?e+"":e,r);const NZ=(...t)=>t.map(Hk).join(""),Hk=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),TZ=t=>t.endsWith("/")?t.slice(0,-1):t,zZ=(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=Hk(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:NZ(this.path,e)})}toString(){return TZ(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};Kr(eu,"UNKNOWN",new eu({host:"unknown",port:0}));let xZ=eu;var EZ=Object.defineProperty,UZ=(t,e,r)=>e in t?EZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Et=(t,e,r)=>UZ(t,typeof e!="symbol"?e+"":e,r);const ZZ=()=>{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 PZ(){return{localeError:ZZ()}}const jZ=()=>{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 AZ(){return{localeError:jZ()}}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 DZ=()=>{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=Df(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=Df(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 CZ(){return{localeError:DZ()}}const RZ=()=>{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 LZ(){return{localeError:RZ()}}const MZ=()=>{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 BZ(){return{localeError:MZ()}}const FZ=()=>{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 qZ(){return{localeError:FZ()}}const JZ=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},VZ=()=>{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 ${JZ(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 Qk(){return{localeError:VZ()}}const WZ=()=>{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 GZ(){return{localeError:WZ()}}const YZ=()=>{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 KZ(){return{localeError:YZ()}}const XZ=()=>{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 HZ(){return{localeError:XZ()}}const QZ=()=>{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 e4(){return{localeError:QZ()}}const t4=()=>{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 n4(){return{localeError:t4()}}const r4=()=>{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 i4(){return{localeError:r4()}}const s4=()=>{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 a4(){return{localeError:s4()}}const o4=()=>{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 u4(){return{localeError:o4()}}const c4=()=>{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 l4(){return{localeError:c4()}}const d4=()=>{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 m4(){return{localeError:d4()}}const f4=()=>{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 h4(){return{localeError:f4()}}const p4=()=>{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 v4(){return{localeError:p4()}}const g4=()=>{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 y4(){return{localeError:g4()}}const $4=()=>{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 b4(){return{localeError:$4()}}const w4=()=>{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 _4(){return{localeError:w4()}}const k4=()=>{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 I4(){return{localeError:k4()}}const O4=()=>{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 S4(){return{localeError:O4()}}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":"عدد";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 T4(){return{localeError:N4()}}const z4=()=>{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 x4(){return{localeError:z4()}}const E4=()=>{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 U4(){return{localeError:E4()}}function Cf(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 Z4=()=>{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=Cf(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=Cf(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 P4(){return{localeError:Z4()}}const j4=()=>{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 A4(){return{localeError:j4()}}const D4=()=>{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 C4(){return{localeError:D4()}}const R4=()=>{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 L4(){return{localeError:R4()}}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:"ช่วง 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 B4(){return{localeError:M4()}}const F4=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},q4=()=>{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 ${F4(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 J4(){return{localeError:q4()}}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?`Неправильні вхідні дані: очікується ${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 W4(){return{localeError:V4()}}const G4=()=>{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 Y4(){return{localeError:G4()}}const K4=()=>{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 X4(){return{localeError:K4()}}const H4=()=>{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 Q4(){return{localeError:H4()}}const e6=()=>{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 t6(){return{localeError:e6()}}const eI=Object.freeze(Object.defineProperty({__proto__:null,ar:PZ,az:AZ,be:CZ,ca:LZ,cs:BZ,de:qZ,en:Qk,es:GZ,fa:KZ,fi:HZ,fr:e4,frCA:n4,he:i4,hu:a4,id:u4,it:l4,ja:m4,kh:h4,ko:v4,mk:y4,ms:b4,nl:_4,no:I4,ota:S4,pl:x4,ps:T4,pt:U4,ru:P4,sl:A4,sv:C4,ta:L4,th:B4,tr:J4,ua:W4,ur:Y4,vi:X4,zhCN:Q4,zhTW:t6},Symbol.toStringTag,{value:"Module"}));class tI{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 _a({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 nI(t){return new tI({type:"function",input:Array.isArray(t==null?void 0:t.input)?D_(_a,t==null?void 0:t.input):(t==null?void 0:t.input)??dd(Sl,Cs(As)),output:(t==null?void 0:t.output)??Cs(As)})}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 rI(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 n6=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),r6=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:zw,$ZodArray:Sl,$ZodAsyncError:mr,$ZodBase64:yw,$ZodBase64URL:bw,$ZodBigInt:Ol,$ZodBigIntFormat:Ow,$ZodBoolean:Il,$ZodCIDRv4:vw,$ZodCIDRv6:gw,$ZodCUID:sw,$ZodCUID2:aw,$ZodCatch:Gw,$ZodCheck:Le,$ZodCheckBigIntFormat:jb,$ZodCheckEndsWith:Wb,$ZodCheckGreaterThan:wl,$ZodCheckIncludes:Jb,$ZodCheckLengthEquals:Mb,$ZodCheckLessThan:bl,$ZodCheckLowerCase:Fb,$ZodCheckMaxLength:Rb,$ZodCheckMaxSize:Ab,$ZodCheckMimeType:Yb,$ZodCheckMinLength:Lb,$ZodCheckMinSize:Db,$ZodCheckMultipleOf:Zb,$ZodCheckNumberFormat:Pb,$ZodCheckOverwrite:Kb,$ZodCheckProperty:Gb,$ZodCheckRegex:Bb,$ZodCheckSizeEquals:Cb,$ZodCheckStartsWith:Vb,$ZodCheckStringFormat:Zi,$ZodCheckUpperCase:qb,$ZodCustom:e_,$ZodDate:Uw,$ZodDefault:qw,$ZodDiscriminatedUnion:Pw,$ZodE164:ww,$ZodEmail:tw,$ZodEmoji:rw,$ZodEnum:Rw,$ZodError:ml,$ZodFile:Mw,$ZodFunction:tI,$ZodGUID:Qb,$ZodIPv4:hw,$ZodIPv6:pw,$ZodISODate:dw,$ZodISODateTime:lw,$ZodISODuration:fw,$ZodISOTime:mw,$ZodIntersection:jw,$ZodJWT:kw,$ZodKSUID:cw,$ZodLazy:Qw,$ZodLiteral:Lw,$ZodMap:Dw,$ZodNaN:Yw,$ZodNanoID:iw,$ZodNever:xw,$ZodNonOptional:Vw,$ZodNull:Tw,$ZodNullable:Fw,$ZodNumber:kl,$ZodNumberFormat:Iw,$ZodObject:Zw,$ZodOptional:Bw,$ZodPipe:zl,$ZodPrefault:Jw,$ZodPromise:Hw,$ZodReadonly:Kw,$ZodRealError:Ui,$ZodRecord:Aw,$ZodRegistry:xl,$ZodSet:Cw,$ZodString:Pi,$ZodStringFormat:be,$ZodSuccess:Ww,$ZodSymbol:Sw,$ZodTemplateLiteral:Xw,$ZodTransform:Tl,$ZodTuple:_a,$ZodType:F,$ZodULID:ow,$ZodURL:nw,$ZodUUID:ew,$ZodUndefined:Nw,$ZodUnion:Nl,$ZodUnknown:As,$ZodVoid:Ew,$ZodXID:uw,$brand:Z$,$constructor:b,$input:n_,$output:t_,Doc:Xb,JSONSchema:n6,JSONSchemaGenerator:nu,TimePrecision:s_,_any:S_,_array:dd,_base64:Yl,_base64url:Kl,_bigint:$_,_boolean:g_,_catch:h1,_cidrv4:Wl,_cidrv6:Gl,_coercedBigint:b_,_coercedBoolean:y_,_coercedDate:x_,_coercedNumber:d_,_coercedString:i_,_cuid:Ll,_cuid2:Ml,_custom:R_,_date:z_,_default:d1,_discriminatedUnion:e1,_e164:Xl,_email:Ul,_emoji:Cl,_endsWith:sd,_enum:s1,_file:C_,_float32:f_,_float64:h_,_gt:wn,_gte:pt,_guid:Ds,_includes:rd,_int:m_,_int32:p_,_int64:w_,_intersection:t1,_ipv4:Jl,_ipv6:Vl,_isoDate:o_,_isoDateTime:a_,_isoDuration:c_,_isoTime:u_,_jwt:Hl,_ksuid:ql,_lazy:y1,_length:Oa,_literal:o1,_lowercase:td,_lt:bn,_lte:_t,_map:r1,_max:_t,_maxLength:Ia,_maxSize:ka,_mime:ad,_min:pt,_minLength:pr,_minSize:mi,_multipleOf:di,_nan:E_,_nanoid:Rl,_nativeEnum:a1,_negative:Z_,_never:N_,_nonnegative:j_,_nonoptional:m1,_nonpositive:P_,_normalize:od,_null:O_,_nullable:l1,_number:l_,_optional:c1,_overwrite:Zn,_parse:pl,_parseAsync:vl,_pipe:p1,_positive:U_,_promise:$1,_property:A_,_readonly:v1,_record:n1,_refine:L_,_regex:ed,_safeParse:gl,_safeParseAsync:yl,_set:i1,_size:Ql,_startsWith:id,_string:r_,_stringbool:M_,_success:f1,_symbol:k_,_templateLiteral:g1,_toLowerCase:cd,_toUpperCase:ld,_transform:u1,_trim:ud,_tuple:D_,_uint32:v_,_uint64:__,_ulid:Bl,_undefined:I_,_union:QE,_unknown:Cs,_uppercase:nd,_url:Dl,_uuid:Zl,_uuidv4:Pl,_uuidv6:jl,_uuidv7:Al,_void:T_,_xid:Fl,clone:At,config:dt,flattenError:fl,formatError:hl,function:nI,globalConfig:Zs,globalRegistry:mn,isValidBase64:_l,isValidBase64URL:$w,isValidJWT:_w,locales:eI,parse:Wo,parseAsync:Go,prettifyError:K$,regexes:Eb,registry:El,safeParse:X$,safeParseAsync:H$,toDotPath:Y$,toJSONSchema:rI,treeifyError:G$,util:FE,version:Hb},Symbol.toStringTag,{value:"Module"})),i6={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"},s6=Object.freeze({status:"aborted"}),a6=s6;function o6(t){dt({customError:t})}function u6(){return dt().customError}dt(Qk());const De=Object.freeze(Object.defineProperty({__proto__:null,$brand:Z$,$input:n_,$output:t_,NEVER:a6,TimePrecision:s_,ZodAny:nk,ZodArray:ak,ZodBase64:xd,ZodBase64URL:Ed,ZodBigInt:za,ZodBigIntFormat:jd,ZodBoolean:Ta,ZodCIDRv4:Td,ZodCIDRv6:zd,ZodCUID:wd,ZodCUID2:_d,ZodCatch:kk,ZodCustom:Za,ZodDate:Dd,ZodDefault:gk,ZodDiscriminatedUnion:ok,ZodE164:Ud,ZodEmail:gd,ZodEmoji:$d,ZodEnum:fi,ZodError:w1,ZodFile:pk,ZodGUID:Rs,ZodIPv4:Sd,ZodIPv6:Nd,ZodISODate:fd,ZodISODateTime:md,ZodISODuration:pd,ZodISOTime:hd,ZodIntersection:uk,ZodIssueCode:i6,ZodJWT:Zd,ZodKSUID:Od,ZodLazy:zk,ZodLiteral:fk,ZodMap:dk,ZodNaN:Ok,ZodNanoID:bd,ZodNever:ik,ZodNonOptional:Fd,ZodNull:tk,ZodNullable:vk,ZodNumber:Na,ZodNumberFormat:Nr,ZodObject:Ea,ZodOptional:Bd,ZodPipe:qd,ZodPrefault:$k,ZodPromise:Ek,ZodReadonly:Sk,ZodRealError:ji,ZodRecord:Rd,ZodSet:mk,ZodString:Sa,ZodStringFormat:ke,ZodSuccess:_k,ZodSymbol:X_,ZodTemplateLiteral:Tk,ZodTransform:Ld,ZodTuple:lk,ZodType:te,ZodULID:kd,ZodURL:yd,ZodUUID:qt,ZodUndefined:Q_,ZodUnion:Cd,ZodUnknown:rk,ZodVoid:sk,ZodXID:Id,_ZodString:vd,_default:yk,any:K1,array:Ai,base64:L1,base64url:M1,bigint:_n,boolean:Pd,catch:Ik,check:Uk,cidrv4:C1,cidrv6:R1,clone:At,coerce:HU,config:dt,core:r6,cuid:E1,cuid2:U1,custom:fU,date:H1,discriminatedUnion:nU,e164:B1,email:_1,emoji:z1,endsWith:sd,enum:Ke,file:oU,flattenError:fl,float32:q1,float64:J1,formatError:hl,function:nI,getErrorMap:u6,globalRegistry:mn,gt:wn,gte:pt,guid:k1,includes:rd,instanceof:ye,int:Ko,int32:V1,int64:G1,intersection:ck,ipv4:A1,ipv6:D1,iso:b1,json:pU,jwt:F1,keyof:Q1,ksuid:j1,lazy:xk,length:Oa,literal:hk,locales:eI,looseObject:tU,lowercase:td,lt:bn,lte:_t,map:iU,maxLength:Ia,maxSize:ka,mime:ad,minLength:pr,minSize:mi,multipleOf:di,nan:lU,nanoid:x1,nativeEnum:aU,negative:Z_,never:xa,nonnegative:j_,nonoptional:wk,nonpositive:P_,normalize:od,null:Ad,nullable:Ms,nullish:uU,number:Q,object:pe,optional:Ls,overwrite:Zn,parse:W_,parseAsync:G_,partialRecord:rU,pipe:Bs,positive:U_,prefault:bk,preprocess:vU,prettifyError:K$,promise:mU,property:A_,readonly:Nk,record:Ua,refine:Zk,regex:ed,regexes:Eb,registry:El,safeParse:Y_,safeParseAsync:K_,set:sU,setErrorMap:o6,size:Ql,startsWith:id,strictObject:eU,string:Te,stringbool:hU,success:cU,superRefine:Pk,symbol:H_,templateLiteral:dU,toJSONSchema:rI,toLowerCase:cd,toUpperCase:ld,transform:Md,treeifyError:G$,trim:ud,tuple:Tr,uint32:W1,uint64:Y1,ulid:Z1,undefined:ek,union:Ue,unknown:vr,uppercase:nd,url:T1,uuid:I1,uuidv4:O1,uuidv6:S1,uuidv7:N1,void:X1,xid:P1},Symbol.toStringTag,{value:"Module"})),c6=async t=>await new Promise(e=>setTimeout(e,oe.fromMilliseconds(t).milliseconds));class l6{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)??c6},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 d6=pe({baseInterval:oe.z.optional(),maxRetries:Q().optional(),scale:Q().optional()}),m6=Object.freeze(Object.defineProperty({__proto__:null,Breaker:l6,breakerConfigZ:d6},Symbol.toStringTag,{value:"Module"})),f6=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,iI=Te().regex(f6),nr=Q().min(0).max(255),sI=Q().min(0).max(1),aI=Tr([nr,nr,nr,sI]),h6=Tr([nr,nr,nr]),p6=pe({rgba255:aI}),v6=Q().min(0).max(360),g6=Q().min(0).max(100),y6=Q().min(0).max(100),$6=Tr([v6,g6,y6,sI]),Vd=Ue([iI,h6,aI,$6,p6]),b6=Vd.transform(t=>Wd(t)),Wd=(t,e=1)=>{if(t=Vd.parse(t),typeof t=="string")return w6(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},w6=(t,e=1)=>(t=iI.parse(t),t=_6(t),[ss(t,0),ss(t,2),ss(t,4),t.length===8?ss(t,6)/255:e]),ss=(t,e)=>parseInt(t.slice(e,e+2),16),_6=t=>t.startsWith("#")?t.slice(1):t;Wd("#000000");Wd("#ffffff");const k6=pe({key:Te(),color:Vd,position:Q(),switched:Pd().optional()});Ai(k6);const I6=pe({key:Te(),name:Te(),color:b6});pe({key:Te(),name:Te(),swatches:Ai(I6)});Q().int().min(0).max(255);pe({name:Te(),key:Te()});const O6=t=>Object.getOwnPropertySymbols(globalThis).includes(t),S6=(t,e)=>{const r=Symbol.for(t);if(!O6(r)){const i=e();Object.defineProperty(globalThis,r,{value:i})}return()=>globalThis[r]},oI="sy_x_error",N6=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),ja=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 ja(`${t}.${r}`)}},Et(e,"discriminator",oI),Et(e,"TYPE",t),Et(e,"matches",N6(t)),e},uI=t=>{if(t==null||typeof t!="object")return!1;const e=t;if(e.discriminator!==oI)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 T6{constructor(){Et(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:ru,data:""};if(uI(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=S6("synnax-error-registry",()=>new T6),z6=({encode:t,decode:e})=>Gd().register({encode:t,decode:e}),x6=t=>Gd().encode(t),E6=t=>t==null?null:Gd().decode(t);class iu extends ja("unknown"){}const U6=pe({type:Te(),data:Te()});class Z6 extends ja("canceled"){}const rn=Object.freeze(Object.defineProperty({__proto__:null,Canceled:Z6,NONE:ru,UNKNOWN:Wn,Unknown:iu,createTyped:ja,decode:E6,encode:x6,isTyped:uI,payloadZ:U6,register:z6},Symbol.toStringTag,{value:"Module"})),P6=De.object({jsonrpc:De.literal("2.0"),method:De.string(),params:De.any().optional(),id:De.union([De.string(),De.number(),De.null()]).optional()}),cI=De.object({jsonrpc:De.literal("2.0"),id:De.union([De.string(),De.number(),De.null()])}),j6=cI.extend({result:De.json()}),A6=cI.extend({error:De.object({code:De.number().int(),message:De.string().optional(),data:De.json().optional()})}),D6=De.union([j6,A6]);De.union([P6,D6]);Te().regex(/^\d+\.\d+\.\d+$/);const C6=["standard","scientific","engineering"];Ke(C6);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=xZ.UNKNOWN}=e;super(r),Ge(this,"url"),this.url=i}}const R6=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}`)},L6=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:R6,decode:L6});class lI{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 dI="Content-Type",Rf=t=>{if(Xk.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})},M6=t=>"code"in t&&t.code==="ECONNREFUSED"||t.message.toLowerCase().includes("load failed"),B6=400;class F6 extends lI{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=Rf(this.endpoint.protocol),new Proxy(this,{get:(n,s,a)=>s==="endpoint"?this.endpoint:Reflect.get(n,s,a)})}get headers(){return{[dI]: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 Rf(c.protocol)(c.target,o)}catch(p){let _=p;return M6(_)&&(_=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!==B6)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 q6=(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 m6.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 mI={};function kn(t){return mI}function J6(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 V6(t,e){return typeof e=="bigint"?e.toString():e}function fI(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 hI(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 W6=fI(()=>{if(typeof navigator<"u"&&navigator!=null&&navigator.userAgent.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Lf(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 G6=new Set(["string","number","symbol"]);function Y6(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 K6(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function X6(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 H6(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 Q6(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 eP(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 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 Pn(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 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 as(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=as((s=(n=(i=t.inst)==null?void 0:i._zod.def)==null?void 0:n.error)==null?void 0:s.call(n,t))??as((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??as((o=r.customError)==null?void 0:o.call(r,t))??as((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 pI=(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,V6,2)},enumerable:!0})},vI=q("$ZodError",pI),gI=q("$ZodError",pI,{Parent:Error});function rP(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 iP(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 sP=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},aP=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},yI=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??vI)(s.issues.map(a=>In(a,n,kn())))}:{success:!0,data:s.value}},oP=yI(gI),$I=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}},uP=$I(gI),zr=q("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),cP=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})}}),lP=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})}}),dP=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})}}),mP=q("$ZodCheckOverwrite",(t,e)=>{zr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class fP{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 hP={major:4,minor:0,patch:0},We=q("$ZodType",(t,e)=>{var r,i;t??(t={}),Oe(t._zod,"id",()=>e.type+"_"+hI(10)),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=hP;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=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}}),pP=q("$ZodUnknown",(t,e)=>{We.init(t,e),t._zod.parse=r=>r}),vP=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 Mf(t,e,r){t.issues.length&&e.issues.push(...Hd(r,t.issues)),e.value[r]=t.value}const gP=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=>Mf(c,r,a))):Mf(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function os(t,e,r){t.issues.length&&e.issues.push(...Hd(r,t.issues)),e.value[r]=t.value}function Bf(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 yP=q("$ZodObject",(t,e)=>{We.init(t,e);const r=fI(()=>{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=K6(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 fP(["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]=hI(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=!mI.jitless,o=a&&W6.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?Bf(ce,l,w,g):os(ce,l,w))):J?Bf(A,l,w,g):os(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=>os(I,l,v))):os(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 Ff(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 $P=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=>Ff(a,r,t,i)):Ff(s,r,t,i)}}),bP=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])=>qf(r,o,u)):qf(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(Lf(t)&&Lf(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 qf(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 wP=q("$ZodEnum",(t,e)=>{We.init(t,e);const r=J6(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(i=>G6.has(typeof i)).map(i=>typeof i=="string"?Y6(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}}),_P=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}}),kP=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)}),IP=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)}),OP=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=>Jf(s,e)):Jf(n,e)}});function Jf(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const SP=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))}),NP=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=>Vf(s,t)):Vf(n,t)}});function Vf(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 TP=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)}}),zP=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=>Wf(s,e,i)):Wf(n,e,i)}});function Wf(t,e,r){return ei(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const xP=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(Gf):Gf(n)}});function Gf(t){return t.value=Object.freeze(t.value),t}const EP=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=>Yf(s,r,i,t));Yf(n,r,i,t)}});function Yf(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 UP{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 ZP(){return new UP}const us=ZP();function PP(t){return new t({type:"unknown"})}function jP(t,e){return new t({type:"never",...vt(e)})}function AP(t,e){return new cP({check:"max_length",...vt(e),maximum:t})}function Kf(t,e){return new lP({check:"min_length",...vt(e),minimum:t})}function DP(t,e){return new dP({check:"length_equals",...vt(e),length:t})}function CP(t){return new mP({check:"overwrite",tx:t})}function RP(t,e,r){return new t({type:"array",element:e,...vt(r)})}function LP(t,e,r){return new t({type:"custom",check:"custom",fn:e,...vt(r)})}const MP=(t,e)=>{vI.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>iP(t,r)},flatten:{value:r=>rP(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},Aa=q("ZodError",MP,{Parent:Error}),BP=sP(Aa),FP=aP(Aa),qP=yI(Aa),JP=$I(Aa),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)=>BP(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>qP(t,r,i),t.parseAsync=async(r,i)=>FP(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>JP(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(yj(r,i)),t.superRefine=r=>t.check($j(r)),t.overwrite=r=>t.check(CP(r)),t.optional=()=>cu(t),t.nullable=()=>Xf(t),t.nullish=()=>cu(Xf(t)),t.nonoptional=r=>lj(t,r),t.array=()=>KP(t),t.or=r=>ej([t,r]),t.and=r=>nj(t,r),t.transform=r=>Hf(t,ij(r)),t.default=r=>oj(t,r),t.prefault=r=>cj(t,r),t.catch=r=>mj(t,r),t.pipe=r=>Hf(t,r),t.readonly=()=>pj(t),t.describe=r=>{const i=t.clone();return us.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){var r;return(r=us.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return us.get(t);const i=t.clone();return us.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),VP=q("ZodUnknown",(t,e)=>{pP.init(t,e),it.init(t,e)});function ou(){return PP(VP)}const WP=q("ZodNever",(t,e)=>{vP.init(t,e),it.init(t,e)});function GP(t){return jP(WP,t)}const YP=q("ZodArray",(t,e)=>{gP.init(t,e),it.init(t,e),t.element=e.element,t.min=(r,i)=>t.check(Kf(r,i)),t.nonempty=r=>t.check(Kf(1,r)),t.max=(r,i)=>t.check(AP(r,i)),t.length=(r,i)=>t.check(DP(r,i)),t.unwrap=()=>t.element});function KP(t,e){return RP(YP,t,e)}const XP=q("ZodObject",(t,e)=>{yP.init(t,e),it.init(t,e),Oe(t,"shape",()=>Object.fromEntries(Object.entries(t._zod.def.shape))),t.keyof=()=>bI(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:GP()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>Q6(t,r),t.merge=r=>eP(t,r),t.pick=r=>X6(t,r),t.omit=r=>H6(t,r),t.partial=(...r)=>tP(wI,t,r[0]),t.required=(...r)=>nP(_I,t,r[0])});function HP(t,e){const r={type:"object",get shape(){return Xd(this,"shape",{...t}),this.shape},...vt(e)};return new XP(r)}const QP=q("ZodUnion",(t,e)=>{$P.init(t,e),it.init(t,e),t.options=e.options});function ej(t,e){return new QP({type:"union",options:t,...vt(e)})}const tj=q("ZodIntersection",(t,e)=>{bP.init(t,e),it.init(t,e)});function nj(t,e){return new tj({type:"intersection",left:t,right:e})}const uu=q("ZodEnum",(t,e)=>{wP.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 bI(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 rj=q("ZodTransform",(t,e)=>{_P.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 ij(t){return new rj({type:"transform",transform:t})}const wI=q("ZodOptional",(t,e)=>{kP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cu(t){return new wI({type:"optional",innerType:t})}const sj=q("ZodNullable",(t,e)=>{IP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Xf(t){return new sj({type:"nullable",innerType:t})}const aj=q("ZodDefault",(t,e)=>{OP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function oj(t,e){return new aj({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const uj=q("ZodPrefault",(t,e)=>{SP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cj(t,e){return new uj({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const _I=q("ZodNonOptional",(t,e)=>{NP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function lj(t,e){return new _I({type:"nonoptional",innerType:t,...vt(e)})}const dj=q("ZodCatch",(t,e)=>{TP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function mj(t,e){return new dj({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const fj=q("ZodPipe",(t,e)=>{zP.init(t,e),it.init(t,e),t.in=e.in,t.out=e.out});function Hf(t,e){return new fj({type:"pipe",in:t,out:e})}const hj=q("ZodReadonly",(t,e)=>{xP.init(t,e),it.init(t,e)});function pj(t){return new hj({type:"readonly",innerType:t})}const vj=q("ZodCustom",(t,e)=>{EP.init(t,e),it.init(t,e)});function gj(t,e){const r=new zr({check:"custom",...vt(e)});return r._zod.check=t,r}function yj(t,e={}){return LP(vj,t,e)}function $j(t,e){const r=gj(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 bj=()=>Xk.RUNTIME!=="node"?t=>new WebSocket(t):t=>new(require("ws")).WebSocket(t,{rejectUnauthorized:!1}),wj=HP({type:bI(["data","close","open"]),payload:ou(),error:cu(rn.payloadZ)});class _j{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,wj))}onClose(e){this.addMessage({type:"close",error:{type:e.code===Ij?Ot.TYPE:gr.TYPE,data:""}})}}const kj="freighterctx",Ij=1e3,kI=class lu extends lI{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=bj();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=zZ({[dI]:this.encoder.contentType,...r.params},kj);return this.baseUrl.child(e).toString()+i}async wrapSocket(e,r,i){return await new Promise(n=>{e.onopen=()=>{const s=new _j(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(kI,"MESSAGE_TYPE","arraybuffer");let Oj=kI;function O(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 II={};function an(t){return II}function Sj(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 Nj(t,e){return typeof e=="bigint"?e.toString():e}function OI(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 Tj(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 SI(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 zj=OI(()=>{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 xj=new Set(["string","number","symbol"]);function Ci(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 Ej(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Uj={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 Zj(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 Pj(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 jj(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 Aj(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 Dj(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 Cj(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 cs(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=cs((a=(s=(n=t.inst)==null?void 0:n._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,t))??cs((o=e==null?void 0:e.error)==null?void 0:o.call(e,t))??cs((u=r.customError)==null?void 0:u.call(r,t))??cs((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 NI=(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,Nj,2)},enumerable:!0})},TI=O("$ZodError",NI),zI=O("$ZodError",NI,{Parent:Error});function Rj(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 Lj(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 Mj=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},Bj=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},xI=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??TI)(s.issues.map(a=>on(a,n,an())))}:{success:!0,data:s.value}},Fj=xI(zI),EI=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}},qj=EI(zI),Jj=/^[cC][^\s-]{8,}$/,Vj=/^[0-9a-z]+$/,Wj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Gj=/^[0-9a-vA-V]{20}$/,Yj=/^[A-Za-z0-9]{27}$/,Kj=/^[a-zA-Z0-9_-]{21}$/,Xj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Hj=/^([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})$/,Qf=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)$/,Qj=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,eA="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function tA(){return new RegExp(eA,"u")}const nA=/^(?:(?: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])$/,rA=/^(([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})$/,iA=/^((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])$/,sA=/^(([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])$/,aA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,UI=/^[A-Za-z0-9_-]*$/,oA=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,uA=/^\+(?:[0-9]){6,14}[0-9]$/,ZI="(?:(?:\\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])))",cA=new RegExp(`^${ZI}$`);function PI(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 lA(t){return new RegExp(`^${PI(t)}$`)}function dA(t){const e=PI({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(`^${ZI}T(?:${i})$`)}const mA=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}$`)},fA=/^\d+n?$/,hA=/^\d+$/,pA=/^-?\d+(?:\.\d+)?/i,vA=/true|false/i,gA=/null/i,yA=/undefined/i,$A=/^[^A-Z]*$/,bA=/^[^a-z]*$/,ft=O("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),jI={number:"number",bigint:"bigint",object:"date"},AI=O("$ZodCheckLessThan",(t,e)=>{ft.init(t,e);const r=jI[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})}}),DI=O("$ZodCheckGreaterThan",(t,e)=>{ft.init(t,e);const r=jI[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})}}),wA=O("$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):Tj(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})}}),_A=O("$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]=Uj[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=hA)}),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})}}),kA=O("$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})}}),IA=O("$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})}}),OA=O("$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=O("$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})})}),SA=O("$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})}}),NA=O("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=$A),Da.init(t,e)}),TA=O("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=bA),Da.init(t,e)}),zA=O("$ZodCheckIncludes",(t,e)=>{ft.init(t,e);const r=Ci(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})}}),xA=O("$ZodCheckStartsWith",(t,e)=>{ft.init(t,e);const r=new RegExp(`^${Ci(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})}}),EA=O("$ZodCheckEndsWith",(t,e)=>{ft.init(t,e);const r=new RegExp(`.*${Ci(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})}}),UA=O("$ZodCheckOverwrite",(t,e)=>{ft.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class ZA{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 PA={major:4,minor:0,patch:0},he=O("$ZodType",(t,e)=>{var n;var r;t??(t={}),Se(t._zod,"id",()=>e.type+"_"+SI(10)),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=PA;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=Fj(t,s);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return qj(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=O("$ZodString",(t,e)=>{var r;he.init(t,e),t._zod.pattern=[...((r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)??[]].pop()??mA(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}}),Ie=O("$ZodStringFormat",(t,e)=>{Da.init(t,e),im.init(t,e)}),jA=O("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Hj),Ie.init(t,e)}),AA=O("$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=Qf(i))}else e.pattern??(e.pattern=Qf());Ie.init(t,e)}),DA=O("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Qj),Ie.init(t,e)}),CA=O("$ZodURL",(t,e)=>{Ie.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:oA.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})}}}),RA=O("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=tA()),Ie.init(t,e)}),LA=O("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Kj),Ie.init(t,e)}),MA=O("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Jj),Ie.init(t,e)}),BA=O("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Vj),Ie.init(t,e)}),FA=O("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Wj),Ie.init(t,e)}),qA=O("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Gj),Ie.init(t,e)}),JA=O("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Yj),Ie.init(t,e)}),VA=O("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=dA(e)),Ie.init(t,e),t._zod.check}),WA=O("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=cA),Ie.init(t,e)}),GA=O("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=lA(e)),Ie.init(t,e),t._zod.check}),YA=O("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Xj),Ie.init(t,e)}),KA=O("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=nA),Ie.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv4"})}),XA=O("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=rA),Ie.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})}}}),HA=O("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=iA),Ie.init(t,e)}),QA=O("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=sA),Ie.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 CI(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const eD=O("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=aA),Ie.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{CI(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function tD(t){if(!UI.test(t))return!1;const e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return CI(r)}const nD=O("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=UI),Ie.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{tD(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),rD=O("$ZodE164",(t,e)=>{e.pattern??(e.pattern=uA),Ie.init(t,e)});function iD(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 sD=O("$ZodJWT",(t,e)=>{Ie.init(t,e),t._zod.check=r=>{iD(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),RI=O("$ZodNumber",(t,e)=>{he.init(t,e),t._zod.pattern=t._zod.bag.pattern??pA,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}}),aD=O("$ZodNumber",(t,e)=>{_A.init(t,e),RI.init(t,e)}),oD=O("$ZodBoolean",(t,e)=>{he.init(t,e),t._zod.pattern=vA,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}}),uD=O("$ZodBigInt",(t,e)=>{he.init(t,e),t._zod.pattern=fA,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}}),cD=O("$ZodUndefined",(t,e)=>{he.init(t,e),t._zod.pattern=yA,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}}),lD=O("$ZodNull",(t,e)=>{he.init(t,e),t._zod.pattern=gA,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}}),dD=O("$ZodUnknown",(t,e)=>{he.init(t,e),t._zod.parse=r=>r}),mD=O("$ZodNever",(t,e)=>{he.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function eh(t,e,r){t.issues.length&&e.issues.push(...fn(r,t.issues)),e.value[r]=t.value}const fD=O("$ZodArray",(t,e)=>{he.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=>eh(c,r,a))):eh(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function ls(t,e,r){t.issues.length&&e.issues.push(...fn(r,t.issues)),e.value[r]=t.value}function th(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 hD=O("$ZodObject",(t,e)=>{he.init(t,e);const r=OI(()=>{const d=Object.keys(e.shape);for(const p of d)if(!(e.shape[p]instanceof he))throw new Error(`Invalid element at key "${p}": expected a Zod schema`);const g=Ej(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 ZA(["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]=SI(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=!II.jitless,u=a&&zj.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?th(Xe,d,I,p):ls(Xe,d,I))):ce?th(J,d,I,p):ls(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=>ls(A,d,w))):ls(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 nh(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 pD=O("$ZodUnion",(t,e)=>{he.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=>nh(a,r,t,i)):nh(s,r,t,i)}}),vD=O("$ZodIntersection",(t,e)=>{he.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])=>rh(r,u,c)):rh(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 rh(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 gD=O("$ZodRecord",(t,e)=>{he.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}}),yD=O("$ZodEnum",(t,e)=>{he.init(t,e);const r=Sj(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(i=>xj.has(typeof i)).map(i=>typeof i=="string"?Ci(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}}),$D=O("$ZodLiteral",(t,e)=>{he.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Ci(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}}),bD=O("$ZodTransform",(t,e)=>{he.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}}),wD=O("$ZodOptional",(t,e)=>{he.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)}),_D=O("$ZodNullable",(t,e)=>{he.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)}),kD=O("$ZodDefault",(t,e)=>{he.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=>ih(s,e)):ih(n,e)}});function ih(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const ID=O("$ZodPrefault",(t,e)=>{he.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))}),OD=O("$ZodNonOptional",(t,e)=>{he.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=>sh(s,t)):sh(n,t)}});function sh(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 SD=O("$ZodCatch",(t,e)=>{he.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)}}),ND=O("$ZodPipe",(t,e)=>{he.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=>ah(s,e,i)):ah(n,e,i)}});function ah(t,e,r){return ti(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const TD=O("$ZodReadonly",(t,e)=>{he.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(oh):oh(n)}});function oh(t){return t.value=Object.freeze(t.value),t}const zD=O("$ZodCustom",(t,e)=>{ft.init(t,e),he.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=>uh(s,r,i,t));uh(n,r,i,t)}});function uh(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 xD{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 ED(){return new xD}const ds=ED();function UD(t,e){return new t({type:"string",...D(e)})}function ZD(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...D(e)})}function ch(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...D(e)})}function PD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...D(e)})}function jD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(e)})}function AD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(e)})}function DD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(e)})}function CD(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...D(e)})}function RD(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...D(e)})}function LD(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(e)})}function MD(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...D(e)})}function BD(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(e)})}function FD(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...D(e)})}function qD(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...D(e)})}function JD(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(e)})}function VD(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(e)})}function WD(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(e)})}function GD(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(e)})}function YD(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(e)})}function KD(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...D(e)})}function XD(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...D(e)})}function HD(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...D(e)})}function QD(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...D(e)})}function eC(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(e)})}function tC(t,e){return new t({type:"string",format:"date",check:"string_format",...D(e)})}function nC(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...D(e)})}function rC(t,e){return new t({type:"string",format:"duration",check:"string_format",...D(e)})}function iC(t,e){return new t({type:"number",checks:[],...D(e)})}function sC(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...D(e)})}function aC(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...D(e)})}function oC(t,e){return new t({type:"boolean",...D(e)})}function uC(t,e){return new t({type:"bigint",...D(e)})}function cC(t,e){return new t({type:"undefined",...D(e)})}function lC(t,e){return new t({type:"null",...D(e)})}function dC(t){return new t({type:"unknown"})}function mC(t,e){return new t({type:"never",...D(e)})}function qs(t,e){return new AI({check:"less_than",...D(e),value:t,inclusive:!1})}function rr(t,e){return new AI({check:"less_than",...D(e),value:t,inclusive:!0})}function Js(t,e){return new DI({check:"greater_than",...D(e),value:t,inclusive:!1})}function tn(t,e){return new DI({check:"greater_than",...D(e),value:t,inclusive:!0})}function hu(t,e){return new wA({check:"multiple_of",...D(e),value:t})}function LI(t,e){return new kA({check:"max_length",...D(e),maximum:t})}function Vs(t,e){return new IA({check:"min_length",...D(e),minimum:t})}function MI(t,e){return new OA({check:"length_equals",...D(e),length:t})}function fC(t,e){return new SA({check:"string_format",format:"regex",...D(e),pattern:t})}function hC(t){return new NA({check:"string_format",format:"lowercase",...D(t)})}function pC(t){return new TA({check:"string_format",format:"uppercase",...D(t)})}function vC(t,e){return new zA({check:"string_format",format:"includes",...D(e),includes:t})}function gC(t,e){return new xA({check:"string_format",format:"starts_with",...D(e),prefix:t})}function yC(t,e){return new EA({check:"string_format",format:"ends_with",...D(e),suffix:t})}function Ri(t){return new UA({check:"overwrite",tx:t})}function $C(t){return Ri(e=>e.normalize(t))}function bC(){return Ri(t=>t.trim())}function wC(){return Ri(t=>t.toLowerCase())}function _C(){return Ri(t=>t.toUpperCase())}function kC(t,e,r){return new t({type:"array",element:e,...D(r)})}function IC(t,e,r){return new t({type:"custom",check:"custom",fn:e,...D(r)})}const OC=O("ZodISODateTime",(t,e)=>{VA.init(t,e),xe.init(t,e)});function SC(t){return eC(OC,t)}const NC=O("ZodISODate",(t,e)=>{WA.init(t,e),xe.init(t,e)});function TC(t){return tC(NC,t)}const zC=O("ZodISOTime",(t,e)=>{GA.init(t,e),xe.init(t,e)});function xC(t){return nC(zC,t)}const EC=O("ZodISODuration",(t,e)=>{YA.init(t,e),xe.init(t,e)});function UC(t){return rC(EC,t)}const ZC=(t,e)=>{TI.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Lj(t,r)},flatten:{value:r=>Rj(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},Ca=O("ZodError",ZC,{Parent:Error}),PC=Mj(Ca),jC=Bj(Ca),AC=xI(Ca),DC=EI(Ca),we=O("ZodType",(t,e)=>(he.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)=>PC(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>AC(t,r,i),t.parseAsync=async(r,i)=>jC(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>DC(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(ZR(r,i)),t.superRefine=r=>t.check(PR(r)),t.overwrite=r=>t.check(Ri(r)),t.optional=()=>mh(t),t.nullable=()=>fh(t),t.nullish=()=>mh(fh(t)),t.nonoptional=r=>SR(t,r),t.array=()=>xr(t),t.or=r=>un([t,r]),t.and=r=>vR(t,r),t.transform=r=>hh(t,bR(r)),t.default=r=>kR(t,r),t.prefault=r=>OR(t,r),t.catch=r=>TR(t,r),t.pipe=r=>hh(t,r),t.readonly=()=>ER(t),t.describe=r=>{const i=t.clone();return ds.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){var r;return(r=ds.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return ds.get(t);const i=t.clone();return ds.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),BI=O("_ZodString",(t,e)=>{im.init(t,e),we.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(fC(...i)),t.includes=(...i)=>t.check(vC(...i)),t.startsWith=(...i)=>t.check(gC(...i)),t.endsWith=(...i)=>t.check(yC(...i)),t.min=(...i)=>t.check(Vs(...i)),t.max=(...i)=>t.check(LI(...i)),t.length=(...i)=>t.check(MI(...i)),t.nonempty=(...i)=>t.check(Vs(1,...i)),t.lowercase=i=>t.check(hC(i)),t.uppercase=i=>t.check(pC(i)),t.trim=()=>t.check(bC()),t.normalize=(...i)=>t.check($C(...i)),t.toLowerCase=()=>t.check(wC()),t.toUpperCase=()=>t.check(_C())}),CC=O("ZodString",(t,e)=>{im.init(t,e),BI.init(t,e),t.email=r=>t.check(ZD(RC,r)),t.url=r=>t.check(CD(LC,r)),t.jwt=r=>t.check(QD(tR,r)),t.emoji=r=>t.check(RD(MC,r)),t.guid=r=>t.check(ch(lh,r)),t.uuid=r=>t.check(PD(ms,r)),t.uuidv4=r=>t.check(jD(ms,r)),t.uuidv6=r=>t.check(AD(ms,r)),t.uuidv7=r=>t.check(DD(ms,r)),t.nanoid=r=>t.check(LD(BC,r)),t.guid=r=>t.check(ch(lh,r)),t.cuid=r=>t.check(MD(FC,r)),t.cuid2=r=>t.check(BD(qC,r)),t.ulid=r=>t.check(FD(JC,r)),t.base64=r=>t.check(KD(HC,r)),t.base64url=r=>t.check(XD(QC,r)),t.xid=r=>t.check(qD(VC,r)),t.ksuid=r=>t.check(JD(WC,r)),t.ipv4=r=>t.check(VD(GC,r)),t.ipv6=r=>t.check(WD(YC,r)),t.cidrv4=r=>t.check(GD(KC,r)),t.cidrv6=r=>t.check(YD(XC,r)),t.e164=r=>t.check(HD(eR,r)),t.datetime=r=>t.check(SC(r)),t.date=r=>t.check(TC(r)),t.time=r=>t.check(xC(r)),t.duration=r=>t.check(UC(r))});function S(t){return UD(CC,t)}const xe=O("ZodStringFormat",(t,e)=>{Ie.init(t,e),BI.init(t,e)}),RC=O("ZodEmail",(t,e)=>{DA.init(t,e),xe.init(t,e)}),lh=O("ZodGUID",(t,e)=>{jA.init(t,e),xe.init(t,e)}),ms=O("ZodUUID",(t,e)=>{AA.init(t,e),xe.init(t,e)}),LC=O("ZodURL",(t,e)=>{CA.init(t,e),xe.init(t,e)}),MC=O("ZodEmoji",(t,e)=>{RA.init(t,e),xe.init(t,e)}),BC=O("ZodNanoID",(t,e)=>{LA.init(t,e),xe.init(t,e)}),FC=O("ZodCUID",(t,e)=>{MA.init(t,e),xe.init(t,e)}),qC=O("ZodCUID2",(t,e)=>{BA.init(t,e),xe.init(t,e)}),JC=O("ZodULID",(t,e)=>{FA.init(t,e),xe.init(t,e)}),VC=O("ZodXID",(t,e)=>{qA.init(t,e),xe.init(t,e)}),WC=O("ZodKSUID",(t,e)=>{JA.init(t,e),xe.init(t,e)}),GC=O("ZodIPv4",(t,e)=>{KA.init(t,e),xe.init(t,e)}),YC=O("ZodIPv6",(t,e)=>{XA.init(t,e),xe.init(t,e)}),KC=O("ZodCIDRv4",(t,e)=>{HA.init(t,e),xe.init(t,e)}),XC=O("ZodCIDRv6",(t,e)=>{QA.init(t,e),xe.init(t,e)}),HC=O("ZodBase64",(t,e)=>{eD.init(t,e),xe.init(t,e)}),QC=O("ZodBase64URL",(t,e)=>{nD.init(t,e),xe.init(t,e)}),eR=O("ZodE164",(t,e)=>{rD.init(t,e),xe.init(t,e)}),tR=O("ZodJWT",(t,e)=>{sD.init(t,e),xe.init(t,e)}),FI=O("ZodNumber",(t,e)=>{RI.init(t,e),we.init(t,e),t.gt=(i,n)=>t.check(Js(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(qs(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(dh(i)),t.safe=i=>t.check(dh(i)),t.positive=i=>t.check(Js(0,i)),t.nonnegative=i=>t.check(tn(0,i)),t.negative=i=>t.check(qs(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 iC(FI,t)}const qI=O("ZodNumberFormat",(t,e)=>{aD.init(t,e),FI.init(t,e)});function dh(t){return sC(qI,t)}function nR(t){return aC(qI,t)}const rR=O("ZodBoolean",(t,e)=>{oD.init(t,e),we.init(t,e)});function ne(t){return oC(rR,t)}const iR=O("ZodBigInt",(t,e)=>{uD.init(t,e),we.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(Js(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(qs(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(Js(BigInt(0),i)),t.negative=i=>t.check(qs(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 sR(t){return uC(iR,t)}const aR=O("ZodUndefined",(t,e)=>{cD.init(t,e),we.init(t,e)});function oR(t){return cC(aR,t)}const uR=O("ZodNull",(t,e)=>{lD.init(t,e),we.init(t,e)});function yi(t){return lC(uR,t)}const cR=O("ZodUnknown",(t,e)=>{dD.init(t,e),we.init(t,e)});function Ut(){return dC(cR)}const lR=O("ZodNever",(t,e)=>{mD.init(t,e),we.init(t,e)});function dR(t){return mC(lR,t)}const mR=O("ZodArray",(t,e)=>{fD.init(t,e),we.init(t,e),t.element=e.element,t.min=(r,i)=>t.check(Vs(r,i)),t.nonempty=r=>t.check(Vs(1,r)),t.max=(r,i)=>t.check(LI(r,i)),t.length=(r,i)=>t.check(MI(r,i)),t.unwrap=()=>t.element});function xr(t,e){return kC(mR,t,e)}const fR=O("ZodObject",(t,e)=>{hD.init(t,e),we.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:dR()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>jj(t,r),t.merge=r=>Aj(t,r),t.pick=r=>Zj(t,r),t.omit=r=>Pj(t,r),t.partial=(...r)=>Dj(JI,t,r[0]),t.required=(...r)=>Cj(VI,t,r[0])});function y(t,e){const r={type:"object",get shape(){return nm(this,"shape",{...t}),this.shape},...D(e)};return new fR(r)}const hR=O("ZodUnion",(t,e)=>{pD.init(t,e),we.init(t,e),t.options=e.options});function un(t,e){return new hR({type:"union",options:t,...D(e)})}const pR=O("ZodIntersection",(t,e)=>{vD.init(t,e),we.init(t,e)});function vR(t,e){return new pR({type:"intersection",left:t,right:e})}const gR=O("ZodRecord",(t,e)=>{gD.init(t,e),we.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Ra(t,e,r){return new gR({type:"record",keyType:t,valueType:e,...D(r)})}const pu=O("ZodEnum",(t,e)=>{yD.init(t,e),we.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 yR=O("ZodLiteral",(t,e)=>{$D.init(t,e),we.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 sm(t,e){return new yR({type:"literal",values:Array.isArray(t)?t:[t],...D(e)})}const $R=O("ZodTransform",(t,e)=>{bD.init(t,e),we.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 bR(t){return new $R({type:"transform",transform:t})}const JI=O("ZodOptional",(t,e)=>{wD.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function mh(t){return new JI({type:"optional",innerType:t})}const wR=O("ZodNullable",(t,e)=>{_D.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function fh(t){return new wR({type:"nullable",innerType:t})}const _R=O("ZodDefault",(t,e)=>{kD.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function kR(t,e){return new _R({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const IR=O("ZodPrefault",(t,e)=>{ID.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function OR(t,e){return new IR({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const VI=O("ZodNonOptional",(t,e)=>{OD.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function SR(t,e){return new VI({type:"nonoptional",innerType:t,...D(e)})}const NR=O("ZodCatch",(t,e)=>{SD.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function TR(t,e){return new NR({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const zR=O("ZodPipe",(t,e)=>{ND.init(t,e),we.init(t,e),t.in=e.in,t.out=e.out});function hh(t,e){return new zR({type:"pipe",in:t,out:e})}const xR=O("ZodReadonly",(t,e)=>{TD.init(t,e),we.init(t,e)});function ER(t){return new xR({type:"readonly",innerType:t})}const WI=O("ZodCustom",(t,e)=>{zD.init(t,e),we.init(t,e)});function UR(t,e){const r=new ft({check:"custom",...D(e)});return r._zod.check=t,r}function ZR(t,e={}){return IC(WI,t,e)}function PR(t,e){const r=UR(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 am(t,e={error:`Input not instance of ${t.name}`}){const r=new WI({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...D(e)});return r._zod.bag.Class=t,r}const GI="all",YI="create",KI="delete",XI="retrieve",HI="update",Ws=Zt([GI,YI,KI,XI,HI]);class Gt extends dr.createTyped("sy"){}class Ce extends Gt.sub("validation"){}class ph 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 ia extends bs.sub("unauthorized"){}class mg extends Ue.sub("contiguity"){}const bg=r=>{if(!r.type.startsWith(Ue.TYPE))return null;if(r.type.startsWith(F.TYPE)){if(r.type===sa.TYPE){const e=r.data.split(": ");return e.length<2?new F(r.data):new sa(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(ia.TYPE)?new ia(r.data):new bs(r.data):r.type.startsWith(ms.TYPE)?new ms(r.data,r.data):new mt(r.data)},vg=()=>{throw new Error("Not implemented")};Tt.register({encode:vg,decode:bg});const Tg=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(),_s=i.z.object({key:zt,name:Qr}),Og=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}},Zs="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)}),Ko=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",qs="framer",aa=r=>{const e=b(r);return e.length===0?null:typeof e[0]=="number"||!isNaN(parseInt(e[0]))?"key":"name"},oa=(r,e)=>{const t=b(r);if(t.length===e.length)return;const n=aa(r);throw aa===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=>Jo(o));oa(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);oa(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 vh extends $u.sub("unauthorized"){}class jR extends Gt.sub("contiguity"){}const AR=t=>{if(!t.type.startsWith(Gt.TYPE))return null;if(t.type.startsWith(Ce.TYPE)){if(t.type===ph.TYPE){const e=t.data.split(": ");return e.length<2?new Ce(t.data):new ph(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(vh.TYPE)?new vh(t.data):new $u(t.data):t.type.startsWith(yu.TYPE)?new yu(t.data,t.data):new ir(t.data)},DR=()=>{throw new Error("Not implemented")};dr.register({encode:DR,decode:AR});const CR=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=S().uuid(),La=S(),om=y({key:Er,name:La}),RR=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}},um="group",rt=t=>un([un([yi(),oR()]).transform(()=>[]),t.array()]),Ve=ue(),Li=S(),Mi=y({name:Li,key:Ve,dataType:ae.z,leaseholder:ue(),index:Ve,isIndex:ne(),internal:ne(),virtual:ne(),alias:S().optional(),expression:S().default(""),requires:rt(Ve)}),QI=Mi.extend({key:Ve.optional(),leaseholder:ue().optional(),index:Ve.optional(),isIndex:ne().optional(),internal:ne().optional().default(!1),virtual:ne().optional().default(!1),expression:S().optional().default(""),requires:rt(Ve).optional().default([])}),Ma="channel",LR=y({key:Ve,variant:ga.variantZ,message:S()}),cm="framer",gh=t=>{const e=C.toArray(t);return e.length===0?null:typeof e[0]=="number"||!isNaN(parseInt(e[0]))?"key":"name"},yh=(t,e)=>{const r=C.toArray(t);if(r.length===e.length)return;const i=gh(t);throw gh===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=>eO(a));yh(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);yh(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 ji.unique(this.keys)}get names(){if(this.colType==="key")throw new mt("colType is not name");return this.columns??[]}get uniqueNames(){return ji.unique(this.names)}get uniqueColumns(){return this.colType==="key"?this.uniqueKeys:this.uniqueNames}toPayload(){return{series:this.series.map(e=>Xo(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 Po(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([])])}),Jo=r=>{const{dataType:e,data:t,timeRange:n,alignment:s}=r;return new _e({data:t,dataType:e,timeRange:n,glBufferUsage:"static",alignment:s})},Xo=r=>({timeRange:r.timeRange,dataType:r.dataType,data:new Uint8Array(r.data.buffer),alignment:r.alignment}),Ye=My.uint32,Fs=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:Fs.optional()}),Qo=rn.partial({key:!0}),nn="rack",Ys=r=>r?Qe.JSON_CODEC.decodeString(r,ce):{},yr=i.z.string(),Ws=i.z.object({key:yr,variant:i.z.string(),details:ce.or(i.z.string().transform(Ys))}),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(Ys)),state:Ws.optional()}),ec=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())]),tc=i.z.enum(["info","success","error","warning"]),ir=i.z.object({task:We,variant:tc,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(Ys)),state:ir.optional().nullable(),snapshot:i.z.boolean().optional()}),rc=pr.omit({key:!0}).extend({key:We.transform(r=>r.toString()).optional(),config:i.z.unknown().transform(r=>Qe.JSON_CODEC.encodeString(r))}),Vs=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",Sg=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()}),Gs="label",ae=i.z.string().uuid(),Hs=i.z.string().min(1),mr=i.z.object({key:ae,name:Hs,timeRange:q.z,color:i.z.string().optional()}),nc=mr.partial({key:!0}),sc=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}},Ks="range",Js="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)}),ic=br.partial({key:!0,firstName:!0,lastName:!0}).omit({rootUser:!0}).extend({password:i.z.string().min(1)}),Xs="user",Nt=i.z.string().uuid(),on=i.z.object({key:Nt,name:i.z.string(),data:ce.or(i.z.string().transform(Se))}),ac=on.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),Qs="lineplot",It=i.z.string().uuid(),cn=i.z.object({key:It,name:i.z.string(),data:ce.or(i.z.string().transform(Se))}),oc=cn.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),ei="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",cc=ln.partial({key:!0}).transform(r=>({...r,layout:JSON.stringify(r.layout)})),lc=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()}),hc=un.partial({key:!0,snapshot:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),ti=un.extend({data:i.z.string().transform(Se)}),ri="schematic",$t=i.z.string().uuid(),ni=i.z.object({key:$t,name:i.z.string(),data:ce.or(i.z.string().transform(Se))}),uc=ni.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),si=ni.extend({data:i.z.string().transform(Se)}),ii="table",ai="builtin",dc="cluster",fc="node",vr=i.z.enum([Gs,ei,zs,ai,dc,en,fc,Zs,Ks,qs,Js,Xs,hn,ri,Qs,nn,sn,an,Es,ii]),ie=i.z.object({type:vr,key:i.z.string()}),yc=i.z.string().transform(r=>{const[e,t]=r.split(":");return{type:vr.parse(e),key:t??""}}),ht=i.z.union([yc,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 Eg=new E({type:ai,key:"root"}),gc=i.z.object({type:i.z.number()}),pc=i.z.object({type:vr,fields:i.z.record(i.z.string(),gc)}),wc=i.z.object({id:E.z,name:i.z.string(),schema:pc.optional().nullable(),data:ce.optional().nullable()}).transform(r=>({key:r.id.toString(),...r})),zg="to",Ng="from",Ig=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 oi{constructor(e,t){l(this,"key");l(this,"name");this.key=t,this.name=e}get ontologyID(){return mc(this.key)}}const mc=r=>new E({type:Zs,key:r}),$g=i.z.object({group:_s}),xg=i.z.object({parent:ie,key:zt.optional(),name:Qr}),kg=i.z.object({key:zt,name:Qr}),Ag=i.z.object({keys:i.z.array(zt)});var he;let Ug=(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},xg,$g)).group}async rename(e,t){await m(this.client,he.RENAME_ENDPOINT,{key:e,name:t},kg,i.z.object({}))}async delete(e){await m(this.client,he.DELETE_ENDPOINT,{keys:e},Ag,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),bc=class{constructor(e){l(this,"creator");this.creator=new Ug(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 oi(e.name,e.key)}};const Cg=Object.freeze(Object.defineProperty({__proto__:null,Client:bc,Group:oi,ONTOLOGY_TYPE:Zs,analyzeParams:Og,groupZ:_s,keyZ:zt,nameZ:Qr,ontologyID:mc},Symbol.toStringTag,{value:"Module"})),Rg="/ontology/add-children",Bg="/ontology/remove-children",Pg="/ontology/move-children",ca=i.z.object({id:ie,children:ie.array()}),Dg=i.z.object({from:ie,to:ie,children:ie.array()}),kn=i.z.object({});let Mg=class{constructor(e){l(this,"client");this.client=e}async addChildren(e,...t){await m(this.client,Rg,{id:new E(e).payload,children:t.map(n=>new E(n).payload)},ca,kn)}async removeChildren(e,...t){await m(this.client,Bg,{id:new E(e).payload,children:t.map(n=>new E(n).payload)},ca,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,Pg,s,Dg,kn)}};const jg="/ontology/retrieve",Lg=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()}),_g=i.z.object({resources:wc.array()}),Mr=r=>b(r).map(e=>new E(e).payload);let vc=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 Mg(e),this.groups=new bc(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 ${wg.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,jg,e,Lg,_g);return t}};const la="sy_ontology_resource_set",ha="sy_ontology_resource_delete",ua="sy_ontology_relationship_set",da="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(ua);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(da);return t.length===0?[]:Array.from(t.as("string")).map(n=>({variant:"delete",key:vs(n)}))}async parseResourceSets(e){const t=e.get(la);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(ha);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([la,ha,ua,da]);return new Tr(n,t)}}const fa=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[fa(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[fa(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 Zg=Object.freeze(Object.defineProperty({__proto__:null,BUILTIN_TYPE:ai,CLUSTER_TYPE:dc,ChangeTracker:Tr,Client:vc,DependentTracker:dn,FROM_RELATIONSHIP_DIRECTION:Ng,ID:E,NODE_TYPE:fc,ROOT_ID:Eg,TO_RELATIONSHIP_DIRECTION:zg,crudeIDZ:ht,idZ:ie,parseIDs:Mr,parseRelationship:vs,relationshipSchemaZ:Ig,resourceTypeZ:vr,resourceZ:wc,schemaFieldZ:gc,schemaZ:pc,stringIDZ:yc},Symbol.toStringTag,{value:"Module"})),Or=i.z.string().uuid(),fn=i.z.object({key:Or,subjects:X(ie),objects:X(ie),actions:X(_r)}),Tc=i.z.object({key:Or.optional(),subjects:ht.array().or(ht),objects:ht.array().or(ht),actions:_r.array().or(_r)}),qg=i.z.object({keys:Or.array().optional(),subjects:ie.array().optional()}),Fg=i.z.object({policies:X(fn)}),Yg="/access/policy/retrieve";let Wg=class{constructor(e){l(this,"client");this.client=e}async retrieve(e){return(await m(this.client,Yg,e,qg,Fg)).policies}};const Vg=i.z.object({policies:fn.partial({key:!0}).array()}),Gg=i.z.object({policies:fn.array()}),Hg=i.z.object({keys:Or.array()}),Kg=i.z.object({}),Jg="/access/policy/create",Xg="/access/policy/delete";let Qg=class{constructor(e){l(this,"client");this.client=e}async create(e){const n=Tc.array().parse(b(e)).map(a=>({objects:b(a.objects),actions:b(a.actions),subjects:b(a.subjects)}));return(await m(this.client,Jg,{policies:n},Vg,Gg)).policies}async delete(e){await m(this.client,Xg,{keys:b(e)},Hg,Kg)}},Oc=class{constructor(e){l(this,"retriever");l(this,"writer");this.retriever=new Wg(e),this.writer=new Qg(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 ep=r=>new E({type:Es,key:r}),tp=new E({type:zs,key:""}),rp=Object.freeze(Object.defineProperty({__proto__:null,ALLOW_ALL_ONTOLOGY_ID:tp,ALLOW_ALL_ONTOLOGY_TYPE:zs,Client:Oc,ONTOLOGY_TYPE:Es,keyZ:Or,newZ:Tc,ontologyID:ep,policyZ:fn},Symbol.toStringTag,{value:"Module"}));let Sc=class{constructor(e){l(this,"policy");this.policy=new Oc(e)}};const np=Object.freeze(Object.defineProperty({__proto__:null,ALL_ACTION:so,CREATE_ACTION:io,Client:Sc,DELETE_ACTION:ao,RETRIEVE_ACTION:oo,UPDATE_ACTION:co,actionZ:_r},Symbol.toStringTag,{value:"Module"})),sp=new Error("request for lock canceled");var ip=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 ap{constructor(e,t=sp){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=Ec(this._queue,c=>t<=c.priority);o===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(o+1,0,a)})}runExclusive(e){return ip(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]=[]),op(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 op(r,e){const t=Ec(r,n=>e.priority<=n.priority);r.splice(t+1,0,e)}function Ec(r,e){for(let t=r.length-1;t>=0;t--)if(e(r[t]))return t;return-1}var cp=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 lp{constructor(e){this._semaphore=new ap(1,e)}acquire(){return cp(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 ci=(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}`)}},hp=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()}),up=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]),ci(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,hp,up);if(n!=null)throw n;return t.channels}};l(Yr,"ENDPOINT","/channel/retrieve");let ar=Yr;class li{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 zc{constructor(e,t){l(this,"mu",new lp);l(this,"requests",new Map);l(this,"wrapped");l(this,"debouncedRun");this.wrapped=e,this.debouncedRun=ty(()=>{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 Nc=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 hi{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 xc(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 dp="/channel/retrieve-group",fp=i.z.object({}),yp=i.z.object({group:_s});let Ic=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 li(new zc(new ar(this.client),e))}sugar(e){const{frameClient:t}=this;return e.map(n=>new hi({...n,frameClient:t}))}async retrieveGroup(){const e=await m(this.client,dp,{},fp,yp);return new oi(e.group.name,e.group.key)}};const or=({virtual:r,expression:e})=>r&&e!=="",$c=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 $c(r,n);if(s!=null)return s}}return null},xc=r=>new E({type:en,key:r.toString()}),gp=i.z.object({channels:Ko.array()}),pp=i.z.object({channels:fr.array()}),wp=i.z.object({keys:Q.array().optional(),names:dr.array().optional()}),mp=i.z.object({}),bp=i.z.object({keys:Q.array(),names:dr.array()}),vp=i.z.object({}),Tp="/channel/create",Op="/channel/delete",Sp="/channel/rename";let kc=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,Tp,{channels:e},gp,pp);return this.cache.set(t),t}async delete(e){await m(this.client,Op,e,wp,mp),e.keys!=null&&this.cache.delete(e.keys),e.names!=null&&this.cache.delete(e.names)}async rename(e,t){await m(this.client,Sp,{keys:e,names:t},bp,vp),this.cache.rename(e,t)}};const Ep=Object.freeze(Object.defineProperty({__proto__:null,CacheRetriever:li,Channel:hi,Client:Ic,ClusterRetriever:ar,DebouncedBatchRetriever:zc,ONTOLOGY_TYPE:en,Writer:kc,analyzeParams:Oe,channelZ:fr,isCalculated:or,keyZ:Q,nameZ:dr,newZ:Ko,ontologyID:xc,resolveCalculatedIndex:$c,retrieveRequired:Nc},Symbol.toStringTag,{value:"Module"})),zp=i.z.object({keys:tt.array().optional(),usernames:i.z.string().array().optional()}),Np=i.z.object({users:X(br)}),Ip="/user/retrieve";let $p=class{constructor(e){l(this,"client");this.client=e}async retrieve(e){return(await m(this.client,Ip,e,zp,Np)).users}};const xp=i.z.object({users:ic.array()}),kp=i.z.object({users:br.array()}),Ap=i.z.object({key:tt,username:i.z.string().min(1)}),Up=i.z.object({}),Cp=i.z.object({key:tt,firstName:i.z.string().optional(),lastName:i.z.string().optional()}),Rp=i.z.object({}),Bp=i.z.object({keys:tt.array()}),Pp=i.z.object({}),Dp="/user/create",Mp="/user/change-username",jp="/user/rename",Lp="/user/delete";let _p=class{constructor(e){l(this,"client");this.client=e}async create(e){return(await m(this.client,Dp,{users:b(e)},xp,kp)).users}async changeUsername(e,t){await m(this.client,Mp,{key:e,username:t},Ap,Up)}async rename(e,t,n){await m(this.client,jp,{key:e,firstName:t,lastName:n},Cp,Rp)}async delete(e){await m(this.client,Lp,{keys:b(e)},Bp,Pp)}},Ac=class{constructor(e){l(this,"reader");l(this,"writer");this.writer=new _p(e),this.reader=new $p(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 Zp=r=>new E({type:Xs,key:r}),qp=Object.freeze(Object.defineProperty({__proto__:null,Client:Ac,ONTOLOGY_TYPE:Xs,keyZ:tt,newZ:ic,ontologyID:Zp,userZ:br},Symbol.toStringTag,{value:"Module"})),Fp=i.z.object({username:i.z.string(),password:i.z.string()}),Yp=i.z.object({token:i.z.string(),user:br}),ya="/auth/login",Wp=3,Vp="/auth/change-password",Gp=i.z.object({username:i.z.string(),password:i.z.string(),newPassword:i.z.string().min(1)}),Hp=i.z.object({}),Kp=[ps,ws];let Jp=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,Vp,{username:this.credentials.username,password:this.credentials.password,newPassword:e},Gp,Hp),this.credentials.password=e}middleware(){const e=async(t,n)=>{if(!this.authenticated&&!t.target.endsWith(ya)){this.authenticating??(this.authenticating=new Promise((c,h)=>{this.client.send(ya,this.credentials,Fp,Yp).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 Kp.some(o=>o.matches(a))&&this.retryCount<Wp?(this.authenticated=!1,this.authenticating=void 0,this.retryCount+=1,e(t,n)):(this.retryCount=0,[s,a])};return e}};const Uc=i.z.enum(["disconnected","connecting","connected","failed"]),Cc=i.z.object({status:Uc,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()}),Xp=i.z.object({clusterKey:i.z.string(),nodeVersion:i.z.string().optional()}),ga={clusterKey:"",status:"disconnected",error:void 0,message:"Disconnected",clientServerCompatible:!1,clientVersion:"0.42.3"},pa=(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={...ga},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({}),Xp);if(s!=null)throw s;const a=n.nodeVersion,o=this.clientVersion,c=this.versionWarned;a==null?(this._state.clientServerCompatible=!1,c||(console.warn(pa(null,o,!0)),this.versionWarned=!0)):na.versionsEqual(o,a,{checkMajor:!0,checkMinor:!0,checkPatch:!1})?this._state.clientServerCompatible=!0:(this._state.clientServerCompatible=!1,c||(console.warn(pa(a,o,na.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",ga),l(ft,"connectionStateZ",Cc);let cr=ft;const Qp=Object.freeze(Object.defineProperty({__proto__:null,Checker:cr,stateZ:Cc,statusZ:Uc},Symbol.toStringTag,{value:"Module"})),ew=i.z.object({keys:Q.array().optional(),bounds:q.z,names:dr.array().optional()}),tw=i.z.object({}),rw="/frame/delete";class nw{constructor(e){l(this,"client");this.client=e}async delete(e){await m(this.client,rw,e,ew,tw)}}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 sw=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}`)}},iw=new O(-1);class Ts extends Ue.sub("writer_closed"){constructor(){super("WriterClosed")}}const aw=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()}),ow=i.z.object({command:i.z.enum(Ot),config:aw.optional(),frame:tn.optional(),buffer:i.z.instanceof(Uint8Array).optional()}),cw=i.z.object({command:i.z.enum(Ot),end:z.z,err:Tt.payloadZ.optional()});var Ze;let Rc=(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 di.open(e,n);u&&(t=t.withCodec(new yw(N.codec)));const S=await t.stream(Ze.ENDPOINT,ow,cw),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:sw(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 wa=r=>r.data.byteLength/r.dataType.density.valueOf(),lw=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)},ma=5,ba=4,va=3,Ta=2,Oa=1,Sa=0,de=x.TIMESTAMP.density.valueOf(),Be=8,Pe=4,An=4,Un=4,hw=1;class Bc{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 Mm.unique(this.keys)}get names(){if(this.colType==="key")throw new ir("colType is not name");return this.columns??[]}get uniqueNames(){return Mm.unique(this.names)}get uniqueColumns(){return this.colType==="key"?this.uniqueKeys:this.uniqueNames}toPayload(){return{series:this.series.map(e=>tO(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 u$(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([])])}),eO=t=>{const{dataType:e,data:r,timeRange:i,alignment:n}=t;return new Ft({data:r,dataType:e,timeRange:i,glBufferUsage:"static",alignment:n})},tO=t=>({timeRange:t.timeRange,dataType:t.dataType,data:new Uint8Array(t.data.buffer),alignment:t.alignment}),cn=nR(),lm=y({key:cn,variant:ga.variantZ.or(sm("").transform(()=>"info")),message:S(),lastReceived:W.z}),Fa=y({key:cn,name:S(),state:d$.nullToUndefined(lm)}),nO=Fa.partial({key:!0}),qa="rack",dm=t=>t?Nn.JSON_CODEC.decodeString(t,$t):{},Bi=S(),mm=y({key:Bi,variant:ga.variantZ.or(sm("").transform(()=>"info")),details:$t.or(S().transform(dm))}),Fi=y({key:Bi,rack:cn,name:S(),make:S(),model:S(),location:S(),configured:ne().optional(),properties:$t.or(S().transform(dm)),state:d$.nullToUndefined(mm)}),rO=Fi.extend({properties:Ut().transform(t=>Nn.JSON_CODEC.encodeString(t))}),Ja="device",Dt=t=>t?JSON.parse(t):{},ln=un([S(),sR().transform(t=>t.toString()),ue().transform(t=>t.toString())]),bi=y({task:ln,variant:ga.variantZ.or(sm("").transform(()=>"info")),key:S().optional(),details:$t.or(S().transform(Dt)).or(xr(Ut())).or(yi())}),qi=y({key:ln,name:S(),type:S(),internal:ne().optional(),config:$t.or(S().transform(dm)),state:bi.optional().nullable(),snapshot:ne().optional()}),iO=qi.omit({key:!0}).extend({key:ln.transform(t=>t.toString()).optional(),config:Ut().transform(t=>Nn.JSON_CODEC.encodeString(t))}),fm=y({task:ln,type:S(),key:S(),args:$t.or(S().transform(Dt)).or(xr(Ut())).or(yi()).optional()}),Va="task",MR=t=>Number(BigInt(t)>>32n),An=S().uuid(),Ji=y({key:An,name:S().min(1),color:S()}),hm="label",mt=S().uuid(),pm=S().min(1),Ur=y({key:mt,name:pm,timeRange:Ee.z,color:S().optional()}),sO=Ur.partial({key:!0}),aO=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}},vm="range",gm="range-alias",Dn=S().uuid(),Vi=y({key:Dn,username:S().min(1),firstName:S().default(""),lastName:S().default(""),rootUser:ne().default(!0)}),oO=Vi.partial({key:!0,firstName:!0,lastName:!0}).omit({rootUser:!0}).extend({password:S().min(1)}),ym="user",Zr=S().uuid(),Wa=y({key:Zr,name:S(),data:$t.or(S().transform(Dt))}),uO=Wa.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),$m="lineplot",Pr=S().uuid(),Ga=y({key:Pr,name:S(),data:$t.or(S().transform(Dt))}),cO=Ga.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),bm="log",Ct=S().uuid(),Ya=y({key:Ct,name:S(),layout:$t.or(S().transform(Dt))}),Ka="workspace",lO=Ya.partial({key:!0}).transform(t=>({...t,layout:JSON.stringify(t.layout)})),dO=Ya.omit({layout:!0}).extend({layout:S().transform(Dt)}),Cn=S().uuid(),Xa=y({key:Cn,name:S(),data:$t.or(S().transform(Dt)),snapshot:ne()}),mO=Xa.partial({key:!0,snapshot:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),wm=Xa.extend({data:S().transform(Dt)}),_m="schematic",jr=S().uuid(),km=y({key:jr,name:S(),data:$t.or(S().transform(Dt))}),fO=km.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),Im=km.extend({data:S().transform(Dt)}),Om="table",Sm="builtin",hO="cluster",pO="node",Wi=Zt([hm,bm,cl,Sm,hO,Ma,pO,um,vm,cm,gm,ym,Ka,_m,$m,qa,Ja,Va,ul,Om]),ct=y({type:Wi,key:S()}),vO=S().transform(t=>{const[e,r]=t.split(":");return{type:Wi.parse(e),key:r??""}}),Yn=un([vO,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([am(Xn),Yn.transform(e=>new Xn(e))]));let V=Xn;const BR=new V({type:Sm,key:"root"}),gO=y({type:ue()}),yO=y({type:Wi,fields:Ra(S(),gO)}),$O=y({id:V.z,name:S(),schema:yO.optional().nullable(),data:$t.optional().nullable()}).transform(t=>({key:t.id.toString(),...t})),FR="to",qR="from",JR=y({from:V.z,type:S(),to:V.z}),bu=t=>{const[e,r,i]=t.split("->");return{from:new V(e),type:r,to:new V(i)}};class Nm{constructor(e,r){f(this,"key");f(this,"name");this.key=r,this.name=e}get ontologyID(){return bO(this.key)}}const bO=t=>new V({type:um,key:t}),VR=y({group:om}),WR=y({parent:ct,key:Er.optional(),name:La}),GR=y({key:Er,name:La}),YR=y({keys:xr(Er)});var bt;let KR=(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},WR,VR)).group}async rename(e,r){await Z(this.client,bt.RENAME_ENDPOINT,{key:e,name:r},GR,y({}))}async delete(e){await Z(this.client,bt.DELETE_ENDPOINT,{keys:e},YR,y({}))}},f(bt,"CREATE_ENDPOINT","/ontology/create-group"),f(bt,"RENAME_ENDPOINT","/ontology/rename-group"),f(bt,"DELETE_ENDPOINT","/ontology/delete-group"),bt),wO=class{constructor(e){f(this,"creator");this.creator=new KR(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 Nm(e.name,e.key)}};const XR=Object.freeze(Object.defineProperty({__proto__:null,Client:wO,Group:Nm,ONTOLOGY_TYPE:um,analyzeParams:RR,groupZ:om,keyZ:Er,nameZ:La,ontologyID:bO},Symbol.toStringTag,{value:"Module"})),HR="/ontology/add-children",QR="/ontology/remove-children",e2="/ontology/move-children",$h=y({id:ct,children:ct.array()}),t2=y({from:ct,to:ct,children:ct.array()}),po=y({});let n2=class{constructor(e){f(this,"client");this.client=e}async addChildren(e,...r){await Z(this.client,HR,{id:new V(e).payload,children:r.map(i=>new V(i).payload)},$h,po)}async removeChildren(e,...r){await Z(this.client,QR,{id:new V(e).payload,children:r.map(i=>new V(i).payload)},$h,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,e2,n,t2,po)}};const r2="/ontology/retrieve",i2=y({ids:ct.array().optional(),children:ne().optional(),parents:ne().optional(),includeSchema:ne().optional(),excludeFieldData:ne().optional(),term:S().optional(),limit:ue().optional(),offset:ue().optional(),types:Wi.array().optional()}),s2=y({resources:$O.array()}),ws=t=>C.toArray(t).map(e=>new V(e).payload);let _O=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 n2(e),this.groups=new wO(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:ws(e),...r});if(Array.isArray(e))return i;if(i.length===0)throw new Vt(`No resource found with ID ${mE.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:ws(e),children:!0,...r})}async retrieveParents(e,r){return await this.execRetrieve({ids:ws(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 Gi.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,r2,e,i2,s2);return r}};const bh="sy_ontology_resource_set",wh="sy_ontology_resource_delete",_h="sy_ontology_relationship_set",kh="sy_ontology_relationship_delete";class Gi{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(_h);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(kh);return r.length===0?[]:Array.from(r.as("string")).map(i=>({variant:"delete",key:bu(i)}))}async parseResourceSets(e){const r=e.get(bh);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(wh);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([bh,wh,_h,kh]);return new Gi(i,r)}}const Ih=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[Ih(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[Ih(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 Gi.open(i,n);return new Ha(r,s,n)}async close(){await this.internal.close()}}const a2=Object.freeze(Object.defineProperty({__proto__:null,BUILTIN_TYPE:Sm,CLUSTER_TYPE:hO,ChangeTracker:Gi,Client:_O,DependentTracker:Ha,FROM_RELATIONSHIP_DIRECTION:qR,ID:V,NODE_TYPE:pO,ROOT_ID:BR,TO_RELATIONSHIP_DIRECTION:FR,crudeIDZ:Yn,idZ:ct,parseIDs:ws,parseRelationship:bu,relationshipSchemaZ:JR,resourceTypeZ:Wi,resourceZ:$O,schemaFieldZ:gO,schemaZ:yO,stringIDZ:vO},Symbol.toStringTag,{value:"Module"})),Yi=S().uuid(),Qa=y({key:Yi,subjects:rt(ct),objects:rt(ct),actions:rt(Ws)}),kO=y({key:Yi.optional(),subjects:Yn.array().or(Yn),objects:Yn.array().or(Yn),actions:Ws.array().or(Ws)}),o2=y({keys:Yi.array().optional(),subjects:ct.array().optional()}),u2=y({policies:rt(Qa)}),c2="/access/policy/retrieve";let l2=class{constructor(e){f(this,"client");this.client=e}async retrieve(e){return(await Z(this.client,c2,e,o2,u2)).policies}};const d2=y({policies:Qa.partial({key:!0}).array()}),m2=y({policies:Qa.array()}),f2=y({keys:Yi.array()}),h2=y({}),p2="/access/policy/create",v2="/access/policy/delete";let g2=class{constructor(e){f(this,"client");this.client=e}async create(e){const i=kO.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,p2,{policies:i},d2,m2)).policies}async delete(e){await Z(this.client,v2,{keys:C.toArray(e)},f2,h2)}},IO=class{constructor(e){f(this,"retriever");f(this,"writer");this.retriever=new l2(e),this.writer=new g2(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 y2=t=>new V({type:ul,key:t}),$2=new V({type:cl,key:""}),b2=Object.freeze(Object.defineProperty({__proto__:null,ALLOW_ALL_ONTOLOGY_ID:$2,ALLOW_ALL_ONTOLOGY_TYPE:cl,Client:IO,ONTOLOGY_TYPE:ul,keyZ:Yi,newZ:kO,ontologyID:y2,policyZ:Qa},Symbol.toStringTag,{value:"Module"}));let OO=class{constructor(e){f(this,"policy");this.policy=new IO(e)}};const w2=Object.freeze(Object.defineProperty({__proto__:null,ALL_ACTION:GI,CREATE_ACTION:YI,Client:OO,DELETE_ACTION:KI,RETRIEVE_ACTION:XI,UPDATE_ACTION:HI,actionZ:Ws},Symbol.toStringTag,{value:"Module"})),_2=new Error("request for lock canceled");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,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=SO(this._queue,o=>r<=o.priority);a===-1&&e<=this._value?this._dispatchItem(s):this._queue.splice(a+1,0,s)})}runExclusive(e){return k2(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]=[]),O2(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 O2(t,e){const r=SO(t,i=>e.priority<=i.priority);t.splice(r+1,0,e)}function SO(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var S2=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 N2{constructor(e){this._semaphore=new I2(1,e)}acquire(){return S2(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 Tm=(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}`)}},T2=y({leaseholder:ue().optional(),keys:Ve.array().optional(),names:S().array().optional(),search:S().optional(),rangeKey:S().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()}),z2=y({channels:rt(Mi)}),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]),Tm(t,{number:"keys",string:"names"})),Ks=class Ks{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(Ks.ENDPOINT,e,T2,z2);if(i!=null)throw i;return r.channels}};f(Ks,"ENDPOINT","/channel/retrieve");let wi=Ks;class zm{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 NO{constructor(e,r){f(this,"mu",new N2);f(this,"requests",new Map);f(this,"wrapped");f(this,"debouncedRun");this.wrapped=e,this.debouncedRun=Ez(()=>{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 TO=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 xm{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 Mi.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 EO(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 x2="sy_calculation_state",E2="/channel/retrieve-group",U2=y({}),Z2=y({group:om});let zO=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 zm(new NO(new wi(this.client),e))}sugar(e){const{frameClient:r}=this;return e.map(i=>new xm({...i,frameClient:r}))}async retrieveGroup(){const e=await Z(this.client,E2,{},U2,Z2);return new Nm(e.group.name,e.group.key)}};const _i=({virtual:t,expression:e})=>t&&e!=="",xO=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 xO(t,i);if(n!=null)return n}}return null},EO=t=>new V({type:Ma,key:t.toString()}),P2=y({channels:QI.array()}),j2=y({channels:Mi.array()}),A2=y({keys:Ve.array().optional(),names:Li.array().optional()}),D2=y({}),C2=y({keys:Ve.array(),names:Li.array()}),R2=y({}),L2="/channel/create",M2="/channel/delete",B2="/channel/rename";let UO=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,L2,{channels:e.map(i=>({...i,dataType:i.dataType}))},P2,j2);return this.cache.set(r),r}async delete(e){await Z(this.client,M2,e,A2,D2),e.keys!=null&&this.cache.delete(e.keys),e.names!=null&&this.cache.delete(e.names)}async rename(e,r){await Z(this.client,B2,{keys:e,names:r},C2,R2),this.cache.rename(e,r)}};const F2=Object.freeze(Object.defineProperty({__proto__:null,CALCULATION_STATE_CHANNEL_NAME:x2,CacheRetriever:zm,Channel:xm,Client:zO,ClusterRetriever:wi,DebouncedBatchRetriever:NO,ONTOLOGY_TYPE:Ma,Writer:UO,analyzeParams:Pt,calculationStateZ:LR,channelZ:Mi,isCalculated:_i,keyZ:Ve,nameZ:Li,newZ:QI,ontologyID:EO,resolveCalculatedIndex:xO,retrieveRequired:TO},Symbol.toStringTag,{value:"Module"})),q2=y({keys:Dn.array().optional(),usernames:S().array().optional()}),J2=y({users:rt(Vi)}),V2="/user/retrieve";let W2=class{constructor(e){f(this,"client");this.client=e}async retrieve(e){return(await Z(this.client,V2,e,q2,J2)).users}};const G2=y({users:oO.array()}),Y2=y({users:Vi.array()}),K2=y({key:Dn,username:S().min(1)}),X2=y({}),H2=y({key:Dn,firstName:S().optional(),lastName:S().optional()}),Q2=y({}),eL=y({keys:Dn.array()}),tL=y({}),nL="/user/create",rL="/user/change-username",iL="/user/rename",sL="/user/delete";let aL=class{constructor(e){f(this,"client");this.client=e}async create(e){return(await Z(this.client,nL,{users:C.toArray(e)},G2,Y2)).users}async changeUsername(e,r){await Z(this.client,rL,{key:e,username:r},K2,X2)}async rename(e,r,i){await Z(this.client,iL,{key:e,firstName:r,lastName:i},H2,Q2)}async delete(e){await Z(this.client,sL,{keys:C.toArray(e)},eL,tL)}},ZO=class{constructor(e){f(this,"reader");f(this,"writer");this.writer=new aL(e),this.reader=new W2(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 oL=t=>new V({type:ym,key:t}),uL=Object.freeze(Object.defineProperty({__proto__:null,Client:ZO,ONTOLOGY_TYPE:ym,keyZ:Dn,newZ:oO,ontologyID:oL,userZ:Vi},Symbol.toStringTag,{value:"Module"})),cL=y({username:S(),password:S()}),lL=y({token:S(),user:Vi}),Oh="/auth/login",dL=3,mL="/auth/change-password",fL=y({username:S(),password:S(),newPassword:S().min(1)}),hL=y({}),pL=[vu,gu];let vL=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,mL,{username:this.credentials.username,password:this.credentials.password,newPassword:e},fL,hL),this.credentials.password=e}middleware(){const e=async(r,i)=>{if(!this.authenticated&&!r.target.endsWith(Oh)){this.authenticating??(this.authenticating=new Promise((o,u)=>{this.client.send(Oh,this.credentials,cL,lL).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 pL.some(a=>a.matches(s))&&this.retryCount<dL?(this.authenticated=!1,this.authenticating=void 0,this.retryCount+=1,e(r,i)):(this.retryCount=0,[n,s])};return e}};const PO=Zt(["disconnected","connecting","connected","failed"]),jO=y({status:PO,error:am(Error).optional(),message:S().optional(),clusterKey:S(),clientVersion:S(),clientServerCompatible:ne(),nodeVersion:S().optional()}),gL=y({clusterKey:S(),nodeVersion:S().optional()}),Sh={clusterKey:"",status:"disconnected",error:void 0,message:"Disconnected",clientServerCompatible:!1,clientVersion:"0.43.1"},Nh=(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={...Sh},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({}),gL);if(n!=null)throw n;const s=i.nodeVersion,a=this.clientVersion,o=this.versionWarned;s==null?(this._state.clientServerCompatible=!1,o||(console.warn(Nh(null,a,!0)),this.versionWarned=!0)):ff.versionsEqual(a,s,{checkMajor:!0,checkMinor:!0,checkPatch:!1})?this._state.clientServerCompatible=!0:(this._state.clientServerCompatible=!1,o||(console.warn(Nh(s,a,ff.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",Sh),f(Hn,"connectionStateZ",jO);let ki=Hn;const yL=Object.freeze(Object.defineProperty({__proto__:null,Checker:ki,stateZ:jO,statusZ:PO},Symbol.toStringTag,{value:"Module"})),$L=y({keys:Ve.array().optional(),bounds:Ee.z,names:Li.array().optional()}),bL=y({}),wL="/frame/delete";class _L{constructor(e){f(this,"client");this.client=e}async delete(e){await Z(this.client,wL,e,$L,bL)}}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 kL=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}`)}},IL=new M(-1);class wu extends Gt.sub("writer_closed"){constructor(){super("WriterClosed")}}const OL=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()}),SL=y({command:Zt(yr),config:OL.optional(),frame:Ba.optional(),buffer:am(Uint8Array).optional()}),NL=y({command:Zt(yr),end:W.z,err:dr.payloadZ.optional()});var nn;let AO=(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 Um.open(e,i);d&&(r=r.withCodec(new ZL(g.codec)));const p=await r.stream(nn.ENDPOINT,SL,NL),_=new nn(p,g);return await _.execute({command:0,config:{start:new W(n),keys:g.keys,controlSubject:a,authorities:C.toArray(s),mode:kL(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 Th=t=>t.data.byteLength/t.dataType.density.valueOf(),TL=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)},zh=5,xh=4,Eh=3,Uh=2,Zh=1,Ph=0,St=ae.TIMESTAMP.density.valueOf(),Xt=8,Ht=4,vo=4,go=4,zL=1;class DO{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()),lw(n);let s=-1,a,o,c,h=t+hw+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,gi,pi,wi;const ze=wa(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=(gi=L.timeRange)==null?void 0:gi.end,c=BigInt(L.alignment??0n);return}s!==ze&&(d=!1),((a==null?void 0:a.valueOf())!==((pi=L.timeRange)==null?void 0:pi.start.valueOf())||(o==null?void 0:o.valueOf())!==((wi=L.timeRange)==null?void 0:wi.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)<<ma|Number(S)<<ba|Number(d)<<va|Number(f)<<Ta|Number(u)<<Oa|Number(N)<<Sa,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=wa(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]>>ma&1),S=!!(n[a]>>ba&1),j=!!(n[a]>>va&1),U=!!(n[a]>>Ta&1),ee=!!(n[a]>>Oa&1),A=!!(n[a]>>Sa&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 ui=254,uw=new Uint8Array([ui]),dw=255,fw=new Uint8Array([dw]),Pc="application/sy-framer";class yw{constructor(e){l(this,"contentType",Pc);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(uw,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(fw,0),n}decode(e,t){if(new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===ui)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 gw{constructor(e){l(this,"contentType",Pc);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)===ui?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 Bc}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 di{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 Bc}static async open(e,t){const n=new di(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 Nc(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()),TL(i);let n=-1,s,a,o,u=r+zL+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,Ki,Am,Dm,Cm;const J=Th(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=(Ki=I.timeRange)==null?void 0:Ki.start,a=(Am=I.timeRange)==null?void 0:Am.end,o=BigInt(I.alignment??0n);return}n!==J&&(c=!1),((s==null?void 0:s.valueOf())!==((Dm=I.timeRange)==null?void 0:Dm.start.valueOf())||(a==null?void 0:a.valueOf())!==((Cm=I.timeRange)==null?void 0:Cm.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(_)<<zh|Number(p)<<xh|Number(c)<<Eh|Number(l)<<Uh|Number(d)<<Zh|Number(g)<<Ph,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=Th(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]>>zh&1),p=!!(i[s]>>xh&1),_=!!(i[s]>>Eh&1),k=!!(i[s]>>Uh&1),m=!!(i[s]>>Zh&1),h=!!(i[s]>>Ph&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 Ki=d.getBigUint64(s,!0);s+=St,Xe.timeRange=new Ee({start:Ar,end:Ki})}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 Em=254,xL=new Uint8Array([Em]),EL=255,UL=new Uint8Array([EL]),CO="application/sy-framer";class ZL{constructor(e){f(this,"contentType",CO);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(xL,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(UL,0),i}decode(e,r){if(new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===Em)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 PL{constructor(e){f(this,"contentType",CO);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)===Em?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 DO}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 Um{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 DO}static async open(e,r){const i=new Um(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 TO(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 Dc{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 fi=(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))(fi||{}),Mc=(r=>(r[r.None=0]="None",r[r.Ack=1]="Ack",r[r.Data=2]="Data",r))(Mc||{});const pw=i.z.object({command:i.z.enum(fi),span:O.z.optional(),bounds:q.z.optional(),stamp:z.z.optional(),keys:Q.array().optional(),chunkSize:i.z.number().optional()}),ww=i.z.object({variant:i.z.enum(Mc),ack:i.z.boolean(),command:i.z.enum(fi),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 Dc("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,pw,ww),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 mw(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 mw{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 bw=i.z.object({keys:i.z.number().array(),downSampleFactor:i.z.number()}),vw=i.z.object({frame:tn}),Tw="/frame/stream",jc=(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 gw(s.codec)));const a=await e.stream(Tw,bw,vw),o=new Ow(a,s);a.send({keys:s.keys,downSampleFactor:n.downSampleFactor??1});const[,c]=await a.receive();if(c!=null)throw c;return o},Lc=async(r,e,t)=>await jc(r,e)(t);class Ow{constructor(e,t){l(this,"stream");l(this,"adapter");l(this,"downsampleFactor");this.stream=new Dc("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 jo.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 Sw=r=>new E({type:qs,key:r.toString()}),Ea=r=>Array.isArray(r)||typeof r!="object"||typeof r=="object"&&"key"in r?{channels:r}:r;let _c=class{constructor(e,t,n){l(this,"streamClient");l(this,"retriever");l(this,"deleter");this.streamClient=e,this.retriever=n,this.deleter=new nw(t)}async openIterator(e,t,n){return await qr._open(e,t,this.retriever,this.streamClient,n)}async openWriter(e){return await Rc._open(this.retriever,this.streamClient,Ea(e))}async openStreamer(e){return await Lc(this.retriever,this.streamClient,Ea(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 Ew=Object.freeze(Object.defineProperty({__proto__:null,ALWAYS_INDEX_PERSIST_ON_AUTO_COMMIT:iw,AUTO_SPAN:Os,Client:_c,Frame:V,HardenedStreamer:pn,Iterator:qr,ONTOLOGY_TYPE:qs,ObservableStreamer:Ae,Writer:Rc,WriterClosedError:Ts,WriterCommand:Ot,WriterMode:St,createStreamOpener:jc,frameZ:tn,ontologyID:Sw,openStreamer:Lc,seriesFromPayload:Jo,seriesToPayload:Xo},Symbol.toStringTag,{value:"Module"})),zw=Ke.ABSOLUTE_AUTHORITY,Nw=Ke.ZERO_AUTHORITY,Iw=Ke.stateZ(i.z.number()),$w=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()})`},xw=i.z.object({transfers:i.z.array(Ke.transferZ)});class Zc extends Ae{constructor(t){super(t,n=>{const s=this.codec.decode(n.series[0].buffer,xw);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 za="sy_node_1_control";let qc=class{constructor(e){l(this,"framer");this.framer=e}async openStateTracker(){const e=await pn.open(async()=>await this.framer.openStreamer(za),za);return new Zc(e)}};const kw=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:zw,Client:qc,StateTracker:Zc,ZERO_AUTHORITY:Nw,stateZ:Iw,transferString:$w},Symbol.toStringTag,{value:"Module"}));let Fc=class{constructor(e,t,n){l(this,"tasks");l(this,"racks");l(this,"devices");this.tasks=e,this.racks=t,this.devices=n}};const Aw=Object.freeze(Object.defineProperty({__proto__:null,Client:Fc},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)},Uw=Object.freeze(Object.defineProperty({__proto__:null,openObservable:nt},Symbol.toStringTag,{value:"Module"})),Cw="sy_device_set",Rw="sy_device_delete",Na="sy_device_state",Cn="/hardware/device/retrieve",Bw="/hardware/device/create",Pw="/hardware/device/delete",Dw=i.z.object({devices:ec.array()}),Mw=i.z.object({devices:gr.array()}),jw=i.z.object({keys:yr.array()}),Lw=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 Yc=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,Bw,{devices:b(e)},Dw,Mw);return t?n.devices[0]:n.devices}async delete(e){await m(this.client,Pw,{keys:b(e)},jw,Lw)}async openDeviceTracker(){return await nt(this.frameClient,Cw,Rw,_w)}async openStateObserver(){return new Ae(await this.frameClient.openStreamer(Na),e=>{const t=e.get(Na);return t.length===0?[null,!1]:[t.parseJSON(Ws),!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 _w=(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})),Zw=r=>new E({type:sn,key:r}),qw=Object.freeze(Object.defineProperty({__proto__:null,Client:Yc,ONTOLOGY_TYPE:sn,deviceZ:gr,keyZ:yr,newZ:ec,ontologyID:Zw,stateZ:Ws},Symbol.toStringTag,{value:"Module"})),Pn="/hardware/rack/retrieve",Fw="/hardware/rack/create",Yw="/hardware/rack/delete",Ia="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)}),Ww=i.z.object({racks:Qo.array()}),Vw=i.z.object({racks:rn.array()}),Gw=i.z.object({keys:Ye.array()}),Hw=i.z.object({});let Wc=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,Yw,{keys:b(e)},Gw,Hw)}async create(e){const t=!Array.isArray(e),n=await m(this.client,Fw,{racks:b(e)},Ww,Vw),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}=ci(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(Ia),e=>{const t=e.get(Ia);return t.length===0?[[],!1]:[t.parseJSON(Fs),!0]})}sugar(e){return e.map(({key:t,name:n,state:s})=>new Vc(t,n,this.tasks,s))}};class Vc{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 Kw=r=>new E({type:nn,key:r.toString()}),Jw=Object.freeze(Object.defineProperty({__proto__:null,Client:Wc,ONTOLOGY_TYPE:nn,Rack:Vc,keyZ:Ye,newZ:Qo,ontologyID:Kw,rackZ:rn,stateZ:Fs},Symbol.toStringTag,{value:"Module"})),Qt="sy_task_state",ut="sy_task_cmd",Xw="sy_task_set",Qw="sy_task_delete",lt=new Error("Task not created"),Gc=async(r,e)=>{const t=await e.retrieveParents(r);return t.length===0?null:t[0]};class Hc{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 Jc(this.key)}async executeCommand(e,t){if(this.frameClient==null)throw lt;const n=await this.frameClient.openWriter(ut),s=Ff.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=Vs.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 Gc(this.key,this.ontologyClient):null}}const em=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()}),tm=i.z.object({tasks:X(pr)}),rm="/hardware/task/retrieve",nm="/hardware/task/create",sm="/hardware/task/delete",im="/hardware/task/copy",am=i.z.object({tasks:rc.array()}),om=i.z.object({tasks:pr.array()}),cm=i.z.object({keys:We.array()}),lm=i.z.object({}),hm=i.z.object({key:We,name:i.z.string(),snapshot:i.z.boolean()}),um=i.z.object({task:pr});let Kc=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,nm,{tasks:b(e)},am,om),s=this.sugar(n.tasks);return t?s[0]:s}async delete(e){await m(this.client,sm,{keys:b(e)},cm,lm)}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}=ci(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,im,{key:e,name:t,snapshot:n},hm,um);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 Gc(e,this.ontologyClient)}async execRetrieve(e){return(await m(this.client,rm,e,em,tm)).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 Hc(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,Xw,Qw,(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=Vs.safeParse(t.at(-1));return n.success?[n.data,!0]:(console.error(n.error),[null,!1])})}};const Jc=r=>new E({type:an,key:r}),dm=Object.freeze(Object.defineProperty({__proto__:null,Client:Kc,ONTOLOGY_TYPE:an,Task:Hc,commandZ:Vs,getRackKey:Sg,keyZ:We,newZ:rc,ontologyID:Jc,stateZ:ir,statusZ:tc,taskZ:pr},Symbol.toStringTag,{value:"Module"})),fm=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()}),ym=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,fm,ym);if(n!=null)throw n;return t.labels}};l(Wr,"ENDPOINT","/label/retrieve");let Fr=Wr;const Xc=wr.extend({key:et.optional()}),gm=i.z.object({labels:Xc.array()}),pm=i.z.object({labels:wr.array()}),wm=i.z.object({keys:et.array()}),Qc=i.z.object({id:ie,labels:et.array(),replace:i.z.boolean().optional()}),mm=Qc.omit({replace:!0}),jn=i.z.object({}),bm="/label/create",vm="/label/delete",Tm="/label/set",Om="/label/remove";let el=class{constructor(e){l(this,"client");this.client=e}async create(e){return(await m(this.client,bm,{labels:b(e)},gm,pm)).labels}async delete(e){await m(this.client,vm,{keys:b(e)},wm,jn)}async set(e,t,{replace:n}={}){await m(this.client,Tm,{id:e,labels:t,replace:n},Qc,jn)}async remove(e,t){await m(this.client,Om,{id:e,labels:t},mm,jn)}};const Sm="sy_label_set",Em="sy_label_delete";let tl=class{constructor(e,t,n){l(this,"type","label");l(this,"retriever");l(this,"writer");l(this,"frameClient");l(this,"ontology");this.writer=new el(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,Sm,Em,zm)}async trackLabelsOf(e){const t=new He.Observer,n=(await this.retrieveFor(e)).map(a=>({id:rl(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 zm=(r,e)=>r==="delete"?e.toUUIDs().map(t=>({variant:r,key:t})):e.parseJSON(wr).map(t=>({variant:r,key:t.key,value:t})),rl=r=>new E({type:Gs,key:r}),Nm=Object.freeze(Object.defineProperty({__proto__:null,Client:tl,ONTOLOGY_TYPE:Gs,Retriever:Fr,Writer:el,keyZ:et,labelZ:wr,newZ:Xc,ontologyID:rl},Symbol.toStringTag,{value:"Module"})),Im="sy_range_alias_set",$m="sy_range_alias_delete",xm=i.z.object({range:ae,aliases:i.z.string().array()}),km=i.z.object({aliases:i.z.record(i.z.string(),Q)}),Am=i.z.object({range:ae,aliases:i.z.record(Q.or(i.z.string()),i.z.string())}),Um=i.z.unknown(),Cm=i.z.object({range:ae,channels:Q.array()}),Rm=i.z.unknown(),Bm=i.z.object({range:ae}),Pm=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},xm,km);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},Am,Um)}async list(){return(await m(this.client,be.LIST_ENDPOINT,{range:this.rangeKey},Bm,Pm)).aliases}async delete(e){await m(this.client,be.DELETE_ENDPOINT,{range:this.rangeKey,channels:e},Cm,Rm)}async openChangeTracker(){return await nt(this.frameClient,Im,$m,jm(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 Dm=i.z.object({range:ae,channel:Q,alias:i.z.string()}),Mm="---",jm=r=>(e,t)=>e==="delete"?t.toStrings().filter(n=>n.split(Mm)[0]===r).map(n=>({variant:e,key:n,value:void 0})):t.parseJSON(Dm).map(n=>({variant:e,key:n.alias,value:n})),yi=i.z.object({range:ae,key:i.z.string(),value:i.z.string()}),Lm=i.z.object({range:ae,keys:i.z.string().array()}),_m=i.z.object({pairs:X(yi)}),Zm=i.z.object({range:ae,pairs:yi.array()}),qm=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)},Lm,_m);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},Zm,i.z.unknown())}async delete(e){await m(this.client,Le.DELETE_ENDPOINT,{range:this.rangeKey,keys:b(e)},qm,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(yi).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 nl{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 Fm=(r,e)=>Wf(r.timeRange,e.timeRange),Ym=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()}),Wm="/range/retrieve",Vm=i.z.object({ranges:X(mr)});let sl=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}=sc(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,Wm,e,Ym,Vm);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 nl(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:Ks,key:r}),Gm=r=>new E({type:Js,key:r}),Hm=i.z.object({ranges:mr.array()}),Km=i.z.object({parent:ie.optional(),ranges:nc.array()}),Jm=i.z.object({keys:ae.array()}),Xm=i.z.object({}),Qm=i.z.object({key:ae,name:Hs}),eb=i.z.object({}),tb="/range/create",rb="/range/delete",nb="/range/rename";class il{constructor(e){l(this,"client");this.client=e}async rename(e,t){await m(this.client,nb,{key:e,name:t},Qm,eb)}async create(e,t){return(await m(this.client,tb,{ranges:e,...t},Km,Hm)).ranges}async delete(e){await m(this.client,rb,{keys:e},Jm,Xm)}}const sb=Object.freeze(Object.defineProperty({__proto__:null,ALIAS_ONTOLOGY_TYPE:Js,Client:sl,KV:lr,ONTOLOGY_TYPE:Ks,Range:nl,Writer:il,aliasOntologyID:Gm,analyzeParams:sc,keyZ:ae,nameZ:Hs,newZ:nc,ontologyID:je,payloadZ:mr,sort:Fm},Symbol.toStringTag,{value:"Module"})),ib="/api/v1/";class ab{constructor(e,t={},n=!1){l(this,"url");l(this,"unary");l(this,"stream");l(this,"secure");this.secure=n,this.url=e.child(ib);const s=new Qe.JSONCodec;this.unary=rd(new td(this.url,s,this.secure),t),this.stream=new cd(this.url,s,this.secure)}use(...e){this.unary.use(...e),this.stream.use(...e)}}const ob="/workspace/lineplot/retrieve",cb="/workspace/lineplot/create",lb="/workspace/lineplot/rename",hb="/workspace/lineplot/set-data",ub="/workspace/lineplot/delete",db=i.z.object({keys:Nt.array()}),fb=i.z.object({workspace:Ee,linePlots:ac.array()}),yb=i.z.object({key:Nt,name:i.z.string()}),gb=i.z.object({key:Nt,data:i.z.string()}),pb=i.z.object({keys:Nt.array()}),wb=i.z.object({linePlots:X(on)}),mb=i.z.object({linePlots:on.array()}),Ln=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,cb,{workspace:e,linePlots:b(t)},fb,mb);return n?s.linePlots:s.linePlots[0]}async rename(e,t){await m(this.client,lb,{key:e,name:t},yb,Ln)}async setData(e,t){await m(this.client,hb,{key:e,data:JSON.stringify(t)},gb,Ln)}async retrieve(e){const t=Array.isArray(e),n=await m(this.client,ob,{keys:b(e)},db,wb);return t?n.linePlots:n.linePlots[0]}async delete(e){await m(this.client,ub,{keys:b(e)},pb,Ln)}};const bb=r=>new E({type:Qs,key:r}),vb=Object.freeze(Object.defineProperty({__proto__:null,Client:al,ONTOLOGY_TYPE:Qs,keyZ:Nt,linePlotZ:on,newZ:ac,ontologyID:bb},Symbol.toStringTag,{value:"Module"})),Tb="/workspace/log/retrieve",Ob="/workspace/log/create",Sb="/workspace/log/rename",Eb="/workspace/log/set-data",zb="/workspace/log/delete",Nb=i.z.object({keys:It.array()}),Ib=i.z.object({workspace:Ee,logs:oc.array()}),$b=i.z.object({key:It,name:i.z.string()}),xb=i.z.object({key:It,data:i.z.string()}),kb=i.z.object({keys:It.array()}),Ab=i.z.object({logs:cn.array()}),Ub=i.z.object({logs:cn.array()}),_n=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,Ob,{workspace:e,logs:b(t)},Ib,Ub);return n?s.logs:s.logs[0]}async rename(e,t){await m(this.client,Sb,{key:e,name:t},$b,_n)}async setData(e,t){await m(this.client,Eb,{key:e,data:JSON.stringify(t)},xb,_n)}async retrieve(e){const t=Array.isArray(e),n=await m(this.client,Tb,{keys:b(e)},Nb,Ab);return t?n.logs:n.logs[0]}async delete(e){await m(this.client,zb,{keys:b(e)},kb,_n)}};const Cb=r=>new E({type:ei,key:r}),Rb=Object.freeze(Object.defineProperty({__proto__:null,Client:ol,ONTOLOGY_TYPE:ei,keyZ:It,logZ:cn,newZ:oc,ontologyID:Cb},Symbol.toStringTag,{value:"Module"})),Bb="/workspace/schematic/retrieve",Pb="/workspace/schematic/create",Db="/workspace/schematic/rename",Mb="/workspace/schematic/set-data",jb="/workspace/schematic/delete",Lb="/workspace/schematic/copy",_b=i.z.object({keys:rt.array()}),Zb=i.z.object({workspace:Ee,schematics:hc.array()}),qb=i.z.object({key:rt,name:i.z.string()}),Fb=i.z.object({key:rt,data:i.z.string()}),Yb=i.z.object({keys:rt.array()}),Wb=i.z.object({key:rt,name:i.z.string(),snapshot:i.z.boolean()}),Vb=i.z.object({schematics:X(ti)}),Gb=i.z.object({schematics:ti.array()}),Hb=i.z.object({schematic:un}),Zn=i.z.object({});let cl=class{constructor(e){l(this,"client");this.client=e}async create(e,t){const n=Array.isArray(t),s=await m(this.client,Pb,{workspace:e,schematics:b(t)},Zb,Gb);return n?s.schematics:s.schematics[0]}async rename(e,t){await m(this.client,Db,{key:e,name:t},qb,Zn)}async setData(e,t){await m(this.client,Mb,{key:e,data:JSON.stringify(t)},Fb,Zn)}async retrieve(e){const t=Array.isArray(e),n=await m(this.client,Bb,{keys:b(e)},_b,Vb);return t?n.schematics:n.schematics[0]}async delete(e){await m(this.client,jb,{keys:b(e)},Yb,Zn)}async copy(e,t,n){return(await m(this.client,Lb,{key:e,name:t,snapshot:n},Wb,Hb)).schematic}};const Kb=r=>new E({type:ri,key:r}),Jb=Object.freeze(Object.defineProperty({__proto__:null,Client:cl,ONTOLOGY_TYPE:ri,keyZ:rt,newZ:hc,ontologyID:Kb,remoteZ:ti,schematicZ:un},Symbol.toStringTag,{value:"Module"})),Xb="/workspace/table/retrieve",Qb="/workspace/table/create",ev="/workspace/table/rename",tv="/workspace/table/set-data",rv="/workspace/table/delete",nv=i.z.object({keys:$t.array()}),sv=i.z.object({workspace:Ee,tables:uc.array()}),iv=i.z.object({key:$t,name:i.z.string()}),av=i.z.object({key:$t,data:i.z.string()}),ov=i.z.object({keys:$t.array()}),cv=i.z.object({tables:si.array()}),lv=i.z.object({tables:si.array()}),qn=i.z.object({});let ll=class{constructor(e){l(this,"client");this.client=e}async create(e,t){const n=Array.isArray(t),s=await m(this.client,Qb,{workspace:e,tables:b(t)},sv,lv);return n?s.tables:s.tables[0]}async rename(e,t){await m(this.client,ev,{key:e,name:t},iv,qn)}async setData(e,t){await m(this.client,tv,{key:e,data:JSON.stringify(t)},av,qn)}async retrieve(e){const t=Array.isArray(e),n=await m(this.client,Xb,{keys:b(e)},nv,cv);return t?n.tables:n.tables[0]}async delete(e){await m(this.client,rv,{keys:b(e)},ov,qn)}};const hv=r=>new E({type:ii,key:r}),uv=Object.freeze(Object.defineProperty({__proto__:null,Client:ll,ONTOLOGY_TYPE:ii,keyZ:$t,newZ:uc,ontologyID:hv,remoteZ:si,tableZ:ni},Symbol.toStringTag,{value:"Module"})),Ar="/workspace/retrieve",dv="/workspace/create",fv="/workspace/rename",yv="/workspace/set-layout",gv="/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()}),pv=i.z.object({workspaces:cc.array()}),wv=i.z.object({key:Ee,name:i.z.string()}),mv=i.z.object({key:Ee,layout:i.z.string()}),bv=i.z.object({keys:Ee.array()}),Cr=i.z.object({workspaces:X(ln)}),vv=i.z.object({workspaces:lc.array()}),Fn=i.z.object({});class hl{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 cl(e),this.linePlot=new al(e),this.log=new ol(e),this.table=new ll(e)}async create(e){const t=Array.isArray(e),n=await m(this.client,dv,{workspaces:b(e)},pv,vv);return t?n.workspaces:n.workspaces[0]}async rename(e,t){await m(this.client,fv,{key:e,name:t},wv,Fn)}async setLayout(e,t){await m(this.client,yv,{key:e,layout:JSON.stringify(t)},mv,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,gv,{keys:b(e)},bv,Fn)}}const Tv=r=>new E({type:hn,key:r}),Ov=Object.freeze(Object.defineProperty({__proto__:null,Client:hl,ONTOLOGY_TYPE:hn,keyZ:Ee,newZ:cc,ontologyID:Tv,remoteZ:lc,workspaceZ:ln},Symbol.toStringTag,{value:"Module"})),ul=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:jo.breakerConfig.optional()});class dl extends _c{constructor(t){const n=ul.parse(t),{host:s,port:a,username:o,password:c,connectivityPollFrequency:h,secure:d,retry:f}=n,u=new ab(new py({host:s,port:Number(a)}),f,d);u.use(Tg);let N;o!=null&&c!=null&&(N=new Jp(u.unary,{username:o,password:c}),u.use(N.middleware()));const S=new li(new ar(u.unary)),j=new kc(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.3");this.createdAt=z.now(),this.props=n,this.auth=N,this.transport=u,this.channels=new Ic(this,S,u.unary,j),this.connectivity=new cr(u.unary,h,this.clientVersion,n.name),this.control=new qc(this),this.ontology=new vc(u.unary,this);const U=new il(this.transport.unary);this.labels=new tl(this.transport.unary,this,this.ontology),this.ranges=new sl(this,U,this.transport.unary,S,this.labels,this.ontology),this.access=new Sc(this.transport.unary),this.user=new Ac(this.transport.unary),this.workspaces=new hl(this.transport.unary);const ee=new Yc(this.transport.unary,this),A=new Kc(this.transport.unary,this,this.ontology,this.ranges),st=new Wc(this.transport.unary,A,this);this.hardware=new Fc(A,st,ee)}get key(){return this.createdAt.valueOf().toString()}close(){this.connectivity.stopChecking()}}l(dl,"connectivity",cr);exports.AuthError=sr;exports.Channel=hi;exports.ContiguityError=mg;exports.DataType=x;exports.Density=ne;exports.Frame=V;exports.MultiSeries=Po;exports.MultipleFoundError=Xe;exports.NotFoundError=Je;exports.QueryError=ke;exports.Rate=cs;exports.RouteError=ms;exports.Series=_e;exports.Synnax=dl;exports.TimeRange=q;exports.TimeSpan=O;exports.TimeStamp=z;exports.UnexpectedError=mt;exports.ValidationError=F;exports.access=np;exports.channel=Ep;exports.connection=Qp;exports.control=kw;exports.device=qw;exports.framer=Ew;exports.group=Cg;exports.hardware=Aw;exports.isCalculated=or;exports.label=Nm;exports.linePlot=vb;exports.log=Rb;exports.ontology=Zg;exports.policy=rp;exports.rack=Jw;exports.ranger=sb;exports.schematic=Jb;exports.signals=Uw;exports.synnaxPropsZ=ul;exports.table=uv;exports.task=dm;exports.user=qp;exports.workspace=Ov;
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 RO{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 Zm=(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))(Zm||{}),LO=(t=>(t[t.None=0]="None",t[t.Ack=1]="Ack",t[t.Data=2]="Data",t))(LO||{});const jL=y({command:Zt(Zm),span:M.z.optional(),bounds:Ee.z.optional(),stamp:W.z.optional(),keys:Ve.array().optional(),chunkSize:ue().optional()}),AL=y({variant:Zt(LO),ack:ne(),command:Zt(Zm),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 RO("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,jL,AL),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 DL(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 Gs=ri;class DL{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 CL=y({keys:ue().array(),downsampleFactor:ue()}),RL=y({frame:Ba}),LL="/frame/stream",Pm=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},MO=(t,e)=>async r=>{const i=Pm(r),n=await to.open(t,i.channels);i.useExperimentalCodec&&(e=e.withCodec(new PL(n.codec)));const s=await e.stream(LL,CL,RL),a=new ML(s,n);s.send({keys:n.keys,downsampleFactor:i.downsampleFactor??1});const[,o]=await s.receive();if(o!=null)throw o;return a},BO=async(t,e,r)=>await MO(t,e)(r);class ML{constructor(e,r){f(this,"stream");f(this,"adapter");f(this,"downsampleFactor");this.stream=new RO("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=Pm(r);const{maxRetries:n=5e3,baseInterval:s=M.seconds(1),scale:a=1}=i??{};this.breaker=new g$.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 BL=t=>new V({type:cm,key:t.toString()}),jh=t=>Array.isArray(t)||typeof t!="object"||typeof t=="object"&&"key"in t?{channels:t}:t;let FO=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 Gs._open(e,r,this.retriever,this.streamClient,i)}async openWriter(e){return await AO._open(this.retriever,this.streamClient,jh(e))}async openStreamer(e){return await BO(this.retriever,this.streamClient,jh(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 FL=Object.freeze(Object.defineProperty({__proto__:null,ALWAYS_INDEX_PERSIST_ON_AUTO_COMMIT:IL,AUTO_SPAN:_u,Client:FO,Frame:Je,HardenedStreamer:no,Iterator:Gs,ONTOLOGY_TYPE:cm,ObservableStreamer:Wt,Writer:AO,WriterClosedError:wu,WriterCommand:yr,WriterMode:$r,createStreamOpener:MO,frameZ:Ba,ontologyID:BL,openStreamer:BO,parseStreamerConfig:Pm,seriesFromPayload:eO,seriesToPayload:tO},Symbol.toStringTag,{value:"Module"})),qL=$n.ABSOLUTE_AUTHORITY,JL=$n.ZERO_AUTHORITY,VL=$n.stateZ(ue()),WL=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()})`},GL=y({transfers:xr($n.transferZ(Ve))});class qO extends Wt{constructor(r){super(r,i=>{const n=this.codec.decode(i.series[0].buffer,GL);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 YL="sy_node_1_control";let JO=class{constructor(e){f(this,"framer");this.framer=e}async openStateTracker(){const e=await no.open(async r=>await this.framer.openStreamer(r),YL);return new qO(e)}};const KL=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:qL,Client:JO,StateTracker:qO,ZERO_AUTHORITY:JL,stateZ:VL,transferString:WL},Symbol.toStringTag,{value:"Module"}));let VO=class{constructor(e,r,i){f(this,"tasks");f(this,"racks");f(this,"devices");this.tasks=e,this.racks=r,this.devices=i}};const XL=Object.freeze(Object.defineProperty({__proto__:null,Client:VO},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)},HL=Object.freeze(Object.defineProperty({__proto__:null,openObservable:Rn},Symbol.toStringTag,{value:"Module"})),QL="sy_device_set",eM="sy_device_delete",Ah="sy_device_state",yo="/hardware/device/retrieve",tM="/hardware/device/create",nM="/hardware/device/delete",rM=y({devices:rO.array()}),iM=y({devices:Fi.array()}),sM=y({keys:Bi.array()}),aM=y({}),$o=y({keys:Bi.array().optional(),names:S().array().optional(),makes:S().array().optional(),models:S().array().optional(),locations:S().array().optional(),racks:cn.array().optional(),search:S().optional(),limit:ue().optional(),offset:ue().optional(),ignoreNotFound:ne().optional(),includeState:ne().optional()}),bo=y({devices:rt(Fi)});let WO=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,tM,{devices:C.toArray(e)},rM,iM);return r?i.devices[0]:i.devices}async delete(e){await Z(this.client,nM,{keys:C.toArray(e)},sM,aM)}async openDeviceTracker(){return await Rn(this.frameClient,QL,eM,oM)}async openStateObserver(){return new Wt(await this.frameClient.openStreamer(Ah),e=>{const r=e.get(Ah);return r.length===0?[null,!1]:[r.parseJSON(mm),!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 oM=(t,e)=>t==="delete"?e.toStrings().map(r=>({variant:t,key:r,value:void 0})):e.parseJSON(Fi).map(r=>({variant:t,key:r.key,value:r})),uM=t=>new V({type:Ja,key:t}),cM=Object.freeze(Object.defineProperty({__proto__:null,Client:WO,ONTOLOGY_TYPE:Ja,deviceZ:Fi,keyZ:Bi,newZ:rO,ontologyID:uM,stateZ:mm},Symbol.toStringTag,{value:"Module"})),wo="/hardware/rack/retrieve",lM="/hardware/rack/create",dM="/hardware/rack/delete",Dh="sy_rack_state",_o=y({keys:cn.array().optional(),names:S().array().optional(),search:S().optional(),embedded:ne().optional(),hostIsNode:ne().optional(),limit:ue().optional(),offset:ue().optional(),includeState:ne().optional()}),ko=y({racks:rt(Fa)}),mM=y({racks:nO.array()}),fM=y({racks:Fa.array()}),hM=y({keys:cn.array()}),pM=y({});let GO=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,dM,{keys:C.toArray(e)},hM,pM)}async create(e){const r=!Array.isArray(e),i=await Z(this.client,lM,{racks:C.toArray(e)},mM,fM),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}=Tm(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(Dh),e=>{const r=e.get(Dh);return r.length===0?[[],!1]:[r.parseJSON(lm),!0]})}sugar(e){return e.map(({key:r,name:i,state:n})=>new YO(r,i,this.tasks,n))}};class YO{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 vM=t=>new V({type:qa,key:t.toString()}),gM=Object.freeze(Object.defineProperty({__proto__:null,Client:GO,ONTOLOGY_TYPE:qa,Rack:YO,keyZ:cn,newZ:nO,ontologyID:vM,rackZ:Fa,stateZ:lm},Symbol.toStringTag,{value:"Module"})),ni="sy_task_state",Kn="sy_task_cmd",yM="sy_task_set",$M="sy_task_delete",Gn=new Error("Task not created"),KO=async(t,e)=>{const r=await e.retrieveParents(t);return r.length===0?null:r[0]};class XO{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 QO(this.key)}async executeCommand(e,r){if(this.frameClient==null)throw Gn;const i=await this.frameClient.openWriter(Kn),n=hz.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=fm.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 KO(this.key,this.ontologyClient):null}}const bM=y({rack:cn.optional(),keys:ln.array().optional(),names:S().array().optional(),types:S().array().optional(),includeState:ne().optional(),offset:ue().optional(),limit:ue().optional()}),wM=y({tasks:rt(qi)}),_M="/hardware/task/retrieve",kM="/hardware/task/create",IM="/hardware/task/delete",OM="/hardware/task/copy",SM=y({tasks:iO.array()}),NM=y({tasks:qi.array()}),TM=y({keys:ln.array()}),zM=y({}),xM=y({key:ln,name:S(),snapshot:ne()}),EM=y({task:qi});let HO=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,kM,{tasks:C.toArray(e)},SM,NM),n=this.sugar(i.tasks);return r?n[0]:n}async delete(e){await Z(this.client,IM,{keys:C.toArray(e)},TM,zM)}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}=Tm(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,OM,{key:e,name:r,snapshot:i},xM,EM);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 KO(e,this.ontologyClient)}async execRetrieve(e){return(await Z(this.client,_M,e,bM,wM)).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 XO(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,yM,$M,(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=fm.safeParse(r.at(-1));return i.success?[i.data,!0]:(console.error(i.error),[null,!1])})}};const QO=t=>new V({type:Va,key:t}),UM=Object.freeze(Object.defineProperty({__proto__:null,Client:HO,ONTOLOGY_TYPE:Va,Task:XO,commandZ:fm,getRackKey:MR,keyZ:ln,newZ:iO,ontologyID:QO,stateZ:bi,taskZ:qi},Symbol.toStringTag,{value:"Module"})),ZM=y({keys:An.array().optional(),for:ct.optional(),search:S().optional(),offset:ue().optional(),limit:ue().optional()}),PM=y({labels:rt(Ji)}),Xs=class Xs{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(Xs.ENDPOINT,e,ZM,PM);if(i!=null)throw i;return r.labels}};f(Xs,"ENDPOINT","/label/retrieve");let Ys=Xs;const eS=Ji.extend({key:An.optional()}),jM=y({labels:eS.array()}),AM=y({labels:Ji.array()}),DM=y({keys:An.array()}),tS=y({id:ct,labels:An.array(),replace:ne().optional()}),CM=tS.omit({replace:!0}),Io=y({}),RM="/label/create",LM="/label/delete",MM="/label/set",BM="/label/remove";let nS=class{constructor(e){f(this,"client");this.client=e}async create(e){return(await Z(this.client,RM,{labels:C.toArray(e)},jM,AM)).labels}async delete(e){await Z(this.client,LM,{keys:C.toArray(e)},DM,Io)}async set(e,r,{replace:i}={}){await Z(this.client,MM,{id:e,labels:r,replace:i},tS,Io)}async remove(e,r){await Z(this.client,BM,{id:e,labels:r},CM,Io)}};const FM="sy_label_set",qM="sy_label_delete";let rS=class{constructor(e,r,i){f(this,"type","label");f(this,"retriever");f(this,"writer");f(this,"frameClient");f(this,"ontology");this.writer=new nS(e),this.retriever=new Ys(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,FM,qM,JM)}async trackLabelsOf(e){const r=new yn.Observer,i=(await this.retrieveFor(e)).map(s=>({id:iS(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 JM=(t,e)=>t==="delete"?e.toUUIDs().map(r=>({variant:t,key:r})):e.parseJSON(Ji).map(r=>({variant:t,key:r.key,value:r})),iS=t=>new V({type:hm,key:t}),VM=Object.freeze(Object.defineProperty({__proto__:null,Client:rS,ONTOLOGY_TYPE:hm,Retriever:Ys,Writer:nS,keyZ:An,labelZ:Ji,newZ:eS,ontologyID:iS},Symbol.toStringTag,{value:"Module"})),WM="sy_range_alias_set",GM="sy_range_alias_delete",YM=y({range:mt,aliases:S().array()}),KM=y({aliases:Ra(S(),Ve)}),XM=y({range:mt,aliases:Ra(Ve.or(S()),S())}),HM=Ut(),QM=y({range:mt,channels:Ve.array()}),eB=Ut(),tB=y({range:mt}),nB=y({aliases:Ra(S(),S())}),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},YM,KM);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},XM,HM)}async list(){return(await Z(this.client,zt.LIST_ENDPOINT,{range:this.rangeKey},tB,nB)).aliases}async delete(e){await Z(this.client,zt.DELETE_ENDPOINT,{range:this.rangeKey,channels:e},QM,eB)}async openChangeTracker(){return await Rn(this.frameClient,WM,GM,sB(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 rB=y({range:mt,channel:Ve,alias:S()}),iB="---",sB=t=>(e,r)=>e==="delete"?r.toStrings().filter(i=>i.split(iB)[0]===t).map(i=>({variant:e,key:i,value:void 0})):r.parseJSON(rB).map(i=>({variant:e,key:i.alias,value:i})),jm=y({range:mt,key:S(),value:S()}),aB=y({range:mt,keys:S().array()}),oB=y({pairs:rt(jm)}),uB=y({range:mt,pairs:jm.array()}),cB=y({range:mt,keys:S().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)},aB,oB);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;Lh(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},uB,Ut())}async delete(e){await Z(this.client,en.DELETE_ENDPOINT,{range:this.rangeKey,keys:C.toArray(e)},cB,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(jm).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 sS{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 lB=(t,e)=>gz(t.timeRange,e.timeRange),dB=y({keys:mt.array().optional(),names:xr(S()).optional(),term:S().optional(),overlapsWith:Ee.z.optional(),limit:ue().int().optional(),offset:ue().int().optional(),hasLabels:An.array().optional()}),mB="/range/retrieve",fB=y({ranges:rt(Ur)});let aS=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}=aO(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,mB,e,dB,fB);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 sS(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:vm,key:t}),hB=t=>new V({type:gm,key:t}),pB=y({ranges:Ur.array()}),vB=y({parent:ct.optional(),ranges:sO.array()}),gB=y({keys:mt.array()}),yB=y({}),$B=y({key:mt,name:pm}),bB=y({}),wB="/range/create",_B="/range/delete",kB="/range/rename";class oS{constructor(e){f(this,"client");this.client=e}async rename(e,r){await Z(this.client,kB,{key:e,name:r},$B,bB)}async create(e,r){return(await Z(this.client,wB,{ranges:e,...r},vB,pB)).ranges}async delete(e){await Z(this.client,_B,{keys:e},gB,yB)}}const IB=Object.freeze(Object.defineProperty({__proto__:null,ALIAS_ONTOLOGY_TYPE:gm,Client:aS,KV:Ii,ONTOLOGY_TYPE:vm,Range:sS,Writer:oS,aliasOntologyID:hB,analyzeParams:aO,keyZ:mt,nameZ:pm,newZ:sO,ontologyID:Qt,payloadZ:Ur,sort:lB},Symbol.toStringTag,{value:"Module"})),OB="/api/v1/";class SB{constructor(e,r={},i=!1){f(this,"url");f(this,"unary");f(this,"stream");f(this,"secure");this.secure=i,this.url=e.child(OB);const n=new Nn.JSONCodec;this.unary=q6(new F6(this.url,n,this.secure),r),this.stream=new Oj(this.url,n,this.secure)}use(...e){this.unary.use(...e),this.stream.use(...e)}}const NB="/workspace/lineplot/retrieve",TB="/workspace/lineplot/create",zB="/workspace/lineplot/rename",xB="/workspace/lineplot/set-data",EB="/workspace/lineplot/delete",UB=y({keys:Zr.array()}),ZB=y({workspace:Ct,linePlots:uO.array()}),PB=y({key:Zr,name:S()}),jB=y({key:Zr,data:S()}),AB=y({keys:Zr.array()}),DB=y({linePlots:rt(Wa)}),CB=y({linePlots:Wa.array()}),Oo=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,TB,{workspace:e,linePlots:C.toArray(r)},ZB,CB);return i?n.linePlots:n.linePlots[0]}async rename(e,r){await Z(this.client,zB,{key:e,name:r},PB,Oo)}async setData(e,r){await Z(this.client,xB,{key:e,data:JSON.stringify(r)},jB,Oo)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,NB,{keys:C.toArray(e)},UB,DB);return r?i.linePlots:i.linePlots[0]}async delete(e){await Z(this.client,EB,{keys:C.toArray(e)},AB,Oo)}};const RB=t=>new V({type:$m,key:t}),LB=Object.freeze(Object.defineProperty({__proto__:null,Client:uS,ONTOLOGY_TYPE:$m,keyZ:Zr,linePlotZ:Wa,newZ:uO,ontologyID:RB},Symbol.toStringTag,{value:"Module"})),MB="/workspace/log/retrieve",BB="/workspace/log/create",FB="/workspace/log/rename",qB="/workspace/log/set-data",JB="/workspace/log/delete",VB=y({keys:Pr.array()}),WB=y({workspace:Ct,logs:cO.array()}),GB=y({key:Pr,name:S()}),YB=y({key:Pr,data:S()}),KB=y({keys:Pr.array()}),XB=y({logs:Ga.array()}),HB=y({logs:Ga.array()}),So=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,BB,{workspace:e,logs:C.toArray(r)},WB,HB);return i?n.logs:n.logs[0]}async rename(e,r){await Z(this.client,FB,{key:e,name:r},GB,So)}async setData(e,r){await Z(this.client,qB,{key:e,data:JSON.stringify(r)},YB,So)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,MB,{keys:C.toArray(e)},VB,XB);return r?i.logs:i.logs[0]}async delete(e){await Z(this.client,JB,{keys:C.toArray(e)},KB,So)}};const QB=t=>new V({type:bm,key:t}),eF=Object.freeze(Object.defineProperty({__proto__:null,Client:cS,ONTOLOGY_TYPE:bm,keyZ:Pr,logZ:Ga,newZ:cO,ontologyID:QB},Symbol.toStringTag,{value:"Module"})),tF="/workspace/schematic/retrieve",nF="/workspace/schematic/create",rF="/workspace/schematic/rename",iF="/workspace/schematic/set-data",sF="/workspace/schematic/delete",aF="/workspace/schematic/copy",oF=y({keys:Cn.array()}),uF=y({workspace:Ct,schematics:mO.array()}),cF=y({key:Cn,name:S()}),lF=y({key:Cn,data:S()}),dF=y({keys:Cn.array()}),mF=y({key:Cn,name:S(),snapshot:ne()}),fF=y({schematics:rt(wm)}),hF=y({schematics:wm.array()}),pF=y({schematic:Xa}),No=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,nF,{workspace:e,schematics:C.toArray(r)},uF,hF);return i?n.schematics:n.schematics[0]}async rename(e,r){await Z(this.client,rF,{key:e,name:r},cF,No)}async setData(e,r){await Z(this.client,iF,{key:e,data:JSON.stringify(r)},lF,No)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,tF,{keys:C.toArray(e)},oF,fF);return r?i.schematics:i.schematics[0]}async delete(e){await Z(this.client,sF,{keys:C.toArray(e)},dF,No)}async copy(e,r,i){return(await Z(this.client,aF,{key:e,name:r,snapshot:i},mF,pF)).schematic}};const vF=t=>new V({type:_m,key:t}),gF=Object.freeze(Object.defineProperty({__proto__:null,Client:lS,ONTOLOGY_TYPE:_m,keyZ:Cn,newZ:mO,ontologyID:vF,remoteZ:wm,schematicZ:Xa},Symbol.toStringTag,{value:"Module"})),yF="/workspace/table/retrieve",$F="/workspace/table/create",bF="/workspace/table/rename",wF="/workspace/table/set-data",_F="/workspace/table/delete",kF=y({keys:jr.array()}),IF=y({workspace:Ct,tables:fO.array()}),OF=y({key:jr,name:S()}),SF=y({key:jr,data:S()}),NF=y({keys:jr.array()}),TF=y({tables:Im.array()}),zF=y({tables:Im.array()}),To=y({});let dS=class{constructor(e){f(this,"client");this.client=e}async create(e,r){const i=Array.isArray(r),n=await Z(this.client,$F,{workspace:e,tables:C.toArray(r)},IF,zF);return i?n.tables:n.tables[0]}async rename(e,r){await Z(this.client,bF,{key:e,name:r},OF,To)}async setData(e,r){await Z(this.client,wF,{key:e,data:JSON.stringify(r)},SF,To)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,yF,{keys:C.toArray(e)},kF,TF);return r?i.tables:i.tables[0]}async delete(e){await Z(this.client,_F,{keys:C.toArray(e)},NF,To)}};const xF=t=>new V({type:Om,key:t}),EF=Object.freeze(Object.defineProperty({__proto__:null,Client:dS,ONTOLOGY_TYPE:Om,keyZ:jr,newZ:fO,ontologyID:xF,remoteZ:Im,tableZ:km},Symbol.toStringTag,{value:"Module"})),fs="/workspace/retrieve",UF="/workspace/create",ZF="/workspace/rename",PF="/workspace/set-layout",jF="/workspace/delete",hs=y({keys:Ct.array().optional(),search:S().optional(),author:Dn.optional(),offset:ue().optional(),limit:ue().optional()}),AF=y({workspaces:lO.array()}),DF=y({key:Ct,name:S()}),CF=y({key:Ct,layout:S()}),RF=y({keys:Ct.array()}),ps=y({workspaces:rt(Ya)}),LF=y({workspaces:dO.array()}),zo=y({});class mS{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 lS(e),this.linePlot=new uS(e),this.log=new cS(e),this.table=new dS(e)}async create(e){const r=Array.isArray(e),i=await Z(this.client,UF,{workspaces:C.toArray(e)},AF,LF);return r?i.workspaces:i.workspaces[0]}async rename(e,r){await Z(this.client,ZF,{key:e,name:r},DF,zo)}async setLayout(e,r){await Z(this.client,PF,{key:e,layout:JSON.stringify(r)},CF,zo)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,fs,{keys:C.toArray(e)},hs,ps);return r?i.workspaces:i.workspaces[0]}async retrieveByAuthor(e){return(await Z(this.client,fs,{author:e},hs,ps)).workspaces}async search(e){return(await Z(this.client,fs,{search:e},hs,ps)).workspaces}async page(e,r){return(await Z(this.client,fs,{offset:e,limit:r},hs,ps)).workspaces}async delete(e){await Z(this.client,jF,{keys:C.toArray(e)},RF,zo)}}const MF=t=>new V({type:Ka,key:t}),BF=Object.freeze(Object.defineProperty({__proto__:null,Client:mS,ONTOLOGY_TYPE:Ka,keyZ:Ct,newZ:lO,ontologyID:MF,remoteZ:dO,workspaceZ:Ya},Symbol.toStringTag,{value:"Module"})),fS=y({host:S({error:"Host is required"}).min(1,"Host is required"),port:ue({error:"Port is required"}).or(S({error:"Port is required"})),username:S().min(1,"Username is required"),password:S().min(1,"Password is required"),connectivityPollFrequency:M.z.default(M.seconds(30)),secure:ne().optional().default(!1),name:S().optional(),retry:g$.breakerConfigZ.optional()});class hS extends FO{constructor(r){const i=fS.parse(r),{host:n,port:s,username:a,password:o,connectivityPollFrequency:u,secure:c,retry:l}=i,d=new SB(new Vz({host:n,port:Number(s)}),l,c);d.use(CR);let g;a!=null&&o!=null&&(g=new vL(d.unary,{username:a,password:o}),d.use(g.middleware()));const p=new zm(new wi(d.unary)),_=new UO(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.1");this.createdAt=W.now(),this.props=i,this.auth=g,this.transport=d,this.channels=new zO(this,p,d.unary,_),this.connectivity=new ki(d.unary,u,this.clientVersion,i.name),this.control=new JO(this),this.ontology=new _O(d.unary,this);const k=new oS(this.transport.unary);this.labels=new rS(this.transport.unary,this,this.ontology),this.ranges=new aS(this,k,this.transport.unary,p,this.labels,this.ontology),this.access=new OO(this.transport.unary),this.user=new ZO(this.transport.unary),this.workspaces=new mS(this.transport.unary);const m=new WO(this.transport.unary,this),h=new HO(this.transport.unary,this,this.ontology,this.ranges),v=new GO(this.transport.unary,h,this);this.hardware=new VO(h,v,m)}get key(){return this.createdAt.valueOf().toString()}close(){this.connectivity.stopChecking()}}f(hS,"connectivity",ki);exports.AuthError=$i;exports.Channel=xm;exports.ContiguityError=jR;exports.DataType=ae;exports.Density=ot;exports.Frame=Je;exports.MultiSeries=u$;exports.MultipleFoundError=Sn;exports.NotFoundError=On;exports.QueryError=Vt;exports.Rate=Ao;exports.RouteError=yu;exports.Series=Ft;exports.Synnax=hS;exports.TimeRange=Ee;exports.TimeSpan=M;exports.TimeStamp=W;exports.UnexpectedError=ir;exports.ValidationError=Ce;exports.access=w2;exports.channel=F2;exports.connection=yL;exports.control=KL;exports.device=cM;exports.framer=FL;exports.group=XR;exports.hardware=XL;exports.isCalculated=_i;exports.label=VM;exports.linePlot=LB;exports.log=eF;exports.ontology=a2;exports.policy=b2;exports.rack=gM;exports.ranger=IB;exports.schematic=gF;exports.signals=HL;exports.synnaxPropsZ=fS;exports.table=EF;exports.task=UM;exports.user=uL;exports.workspace=BF;