@synnaxlabs/pluto 0.42.0 → 0.42.4

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 (172) hide show
  1. package/dist/{Center-CNcAEDgS.js → Center-D0JeI7Ta.js} +2 -2
  2. package/dist/{Center-Map6aflE.cjs → Center-DuI3XH-Q.cjs} +1 -1
  3. package/dist/{ContextMenu-fLU0wr9S.js → ContextMenu-BiNr7Gxv.js} +3 -3
  4. package/dist/{ContextMenu-DmRPxhnI.cjs → ContextMenu-HpMLd1Ht.cjs} +1 -1
  5. package/dist/{DateTime-CP3OmEGY.cjs → DateTime-BsjSfOY-.cjs} +1 -1
  6. package/dist/{DateTime-CWAcEwXO.js → DateTime-r6hocEmI.js} +2 -2
  7. package/dist/{Divider-BTLn5ucU.js → Divider-DqEkzRIY.js} +1 -1
  8. package/dist/{Divider-Dvb6dsgX.cjs → Divider-Dut8qPee.cjs} +2 -2
  9. package/dist/{Dropdown-CaGzfZRa.cjs → Dropdown-BSSe1E1e.cjs} +1 -1
  10. package/dist/{Dropdown-nw8kRSbl.js → Dropdown-BrFL1eSc.js} +38 -38
  11. package/dist/{Haul-B8zGWk0I.cjs → Haul-C6i2oI7z.cjs} +1 -1
  12. package/dist/{Haul-Cnuzk7Z-.js → Haul-CEFSvdy9.js} +1 -1
  13. package/dist/{Item-FmwC-twg.js → Item-C5SQraZM.js} +6 -6
  14. package/dist/{Item-BzrQqxRC.cjs → Item-DSBs9VLu.cjs} +1 -1
  15. package/dist/{Keyboard-BfvjkBgh.cjs → Keyboard-Ca7TAAHK.cjs} +1 -1
  16. package/dist/{Keyboard-Cevv7vrQ.js → Keyboard-Duo41pJL.js} +2 -2
  17. package/dist/{Link-DI7BZ5dL.cjs → Link-B9ZGvoBU.cjs} +1 -1
  18. package/dist/{Link-Dljdu4e9.js → Link-C9GeoB0w.js} +1 -1
  19. package/dist/{Pack-to0DG2iP.js → Pack-BozAEHBp.js} +2 -2
  20. package/dist/{Pack-lJqoOmHx.cjs → Pack-DeZUUdJM.cjs} +1 -1
  21. package/dist/{Provider-C_B463cg.js → Provider-B86QO9NT.js} +5 -5
  22. package/dist/{Provider-BlM1x1cF.cjs → Provider-Cw0mSr2D.cjs} +1 -1
  23. package/dist/{Space-C2oZDkE1.js → Space-CyTH97CN.js} +1 -1
  24. package/dist/{Space-DfcVsxz8.cjs → Space-DvalhzRj.cjs} +1 -1
  25. package/dist/{Text-BiYpGaEZ.js → Text-8ps3Uw4T.js} +3 -3
  26. package/dist/{Text-CWiPrDI1.js → Text-BR4FW9Hy.js} +12 -12
  27. package/dist/{Text-BjHlLKsp.cjs → Text-C8GBHl-F.cjs} +1 -1
  28. package/dist/{Text-ZJqK1cI3.cjs → Text-CMTkSEWx.cjs} +2 -2
  29. package/dist/{Text-DrIBbnml.cjs → Text-DkA06TeT.cjs} +1 -1
  30. package/dist/{Text-BXADoWYY.js → Text-sH_NOelc.js} +41 -41
  31. package/dist/{Toggle-CeUVv58o.js → Toggle-BRuUrO2N.js} +29 -29
  32. package/dist/{Toggle-CfwYy9fe.cjs → Toggle-C0lZDyeo.cjs} +1 -1
  33. package/dist/{Video-BZ1XTEez.js → Video-DWStbcmD.js} +1 -1
  34. package/dist/{Video-C7YoF37-.cjs → Video-DgjuFLiE.cjs} +1 -1
  35. package/dist/{WithIcon-DG7VJxsE.cjs → WithIcon-BgS5shNZ.cjs} +1 -1
  36. package/dist/{WithIcon-pBZ7H9Lq.js → WithIcon-BhR6nwRh.js} +3 -3
  37. package/dist/align.cjs +1 -1
  38. package/dist/align.js +1 -1
  39. package/dist/button.cjs +1 -1
  40. package/dist/button.js +1 -1
  41. package/dist/color.cjs +1 -1
  42. package/dist/color.js +1 -1
  43. package/dist/{css-hg3QdDDt.cjs → css-9iEiTRNL.cjs} +8 -8
  44. package/dist/{css-B7c7_G5h.js → css-Cnb9DQMD.js} +612 -611
  45. package/dist/css.cjs +1 -1
  46. package/dist/css.js +2 -2
  47. package/dist/deep-BNa3STCp.cjs +1 -0
  48. package/dist/deep-P35D0Sz7.js +112 -0
  49. package/dist/{dimensions-DcjW7X3n.js → dimensions-B6qmnzv3.js} +1 -1
  50. package/dist/{dimensions-Cz-q0Mok.cjs → dimensions-By-vgVks.cjs} +1 -1
  51. package/dist/dropdown.cjs +1 -1
  52. package/dist/dropdown.js +1 -1
  53. package/dist/{eraser-BOx6Xhwn.cjs → eraser-BkqFgBRY.cjs} +2 -2
  54. package/dist/{eraser-Bsb4kKS3.js → eraser-CK8SwEJa.js} +8 -8
  55. package/dist/ether.cjs +1 -1
  56. package/dist/ether.js +7 -7
  57. package/dist/{external-CEfSeJMr.js → external-B1YsdhS4.js} +9 -9
  58. package/dist/{external-DeCeUbqe.js → external-B7NxSklQ.js} +6 -6
  59. package/dist/{external-CLTPcWrI.cjs → external-B8uaUKhb.cjs} +1 -1
  60. package/dist/{external-DDD_nc3x.js → external-BA_VOnV-.js} +41 -41
  61. package/dist/{external-Ck1rVwUu.js → external-BDkqwq72.js} +17 -17
  62. package/dist/{external-BdVuZd3H.cjs → external-BGBgNbe2.cjs} +1 -1
  63. package/dist/{external-1KJXZcr9.js → external-BOMdfX8_.js} +2 -2
  64. package/dist/{external-hgzjVlDR.js → external-Bl8q9UBF.js} +11 -11
  65. package/dist/{external-DgSaeiBz.js → external-BnK4UIFe.js} +3 -3
  66. package/dist/{external-Cfj1plcw.cjs → external-BwUa_5Vs.cjs} +1 -1
  67. package/dist/{external-DCcp3sQD.js → external-C0X4mXVG.js} +4 -4
  68. package/dist/{external-qwaFowDe.js → external-C7yPkamb.js} +5 -5
  69. package/dist/{external-Cni9ftkW.cjs → external-CTc1n-JC.cjs} +1 -1
  70. package/dist/{external-DCfs7IFi.cjs → external-CUgPP-JD.cjs} +1 -1
  71. package/dist/{external-C75Z9Zbn.cjs → external-CzTBFiv_.cjs} +1 -1
  72. package/dist/{external-BiBhgCdz.cjs → external-DGJ8YAe-.cjs} +1 -1
  73. package/dist/{external-DhfASB4W.cjs → external-DQwznOyH.cjs} +1 -1
  74. package/dist/{external-DNT-gmZx.cjs → external-DiLZ1dEk.cjs} +1 -1
  75. package/dist/{external-bkwgRzLc.js → external-DissGp_3.js} +7 -7
  76. package/dist/{external-BHHC7TQ_.cjs → external-DmryCcwg.cjs} +1 -1
  77. package/dist/{external-pUEPQrp_.cjs → external-Dq8-cbf3.cjs} +1 -1
  78. package/dist/{external-sUHGRdqd.js → external-_8qdWaAg.js} +2 -2
  79. package/dist/{external-CRNR1bD0.js → external-bSUra-q7.js} +4 -4
  80. package/dist/{external-BLEs2AYM.cjs → external-zbKPQ9ls.cjs} +2 -2
  81. package/dist/{font-Crn-D_ua.js → font-CjYcjBiv.js} +2 -2
  82. package/dist/{font-BFTKtIQk.cjs → font-XlUAG1-r.cjs} +1 -1
  83. package/dist/{fontString-DjnDxFrE.js → fontString-BN1kd1AP.js} +1 -1
  84. package/dist/{fontString-DQLaRHQV.cjs → fontString-Ddza50DF.cjs} +1 -1
  85. package/dist/header.cjs +1 -1
  86. package/dist/header.js +1 -1
  87. package/dist/{hooks-CTKCi-OE.cjs → hooks-B5aLaWzS.cjs} +1 -1
  88. package/dist/{hooks-CM9HWxYc.js → hooks-DjznxGgm.js} +3 -3
  89. package/dist/index.cjs +5 -5
  90. package/dist/index.js +513 -513
  91. package/dist/input.cjs +1 -1
  92. package/dist/input.js +1 -1
  93. package/dist/list.cjs +1 -1
  94. package/dist/list.js +1 -1
  95. package/dist/menu.cjs +1 -1
  96. package/dist/menu.js +1 -1
  97. package/dist/{provider-XPRFhwnl.cjs → provider-aWtsGnV8.cjs} +24 -24
  98. package/dist/{provider-BDFfcHVT.js → provider-r5Ly36FI.js} +1569 -1566
  99. package/dist/src/color/Provider.d.ts +5 -1
  100. package/dist/src/color/Provider.d.ts.map +1 -1
  101. package/dist/src/status/aether/aggregator.d.ts +2 -2
  102. package/dist/src/status/aether/types.d.ts +2 -2
  103. package/dist/src/table/cells/Cells.d.ts +6 -2
  104. package/dist/src/table/cells/Cells.d.ts.map +1 -1
  105. package/dist/src/telem/aether/static.d.ts +6 -2
  106. package/dist/src/telem/aether/static.d.ts.map +1 -1
  107. package/dist/src/telem/aether/transformers.d.ts +12 -6
  108. package/dist/src/telem/aether/transformers.d.ts.map +1 -1
  109. package/dist/src/telem/control/aether/chip.d.ts +2 -2
  110. package/dist/src/telem/control/aether/indicator.d.ts +12 -4
  111. package/dist/src/telem/control/aether/indicator.d.ts.map +1 -1
  112. package/dist/src/telem/control/aether/legend.d.ts +10 -2
  113. package/dist/src/telem/control/aether/legend.d.ts.map +1 -1
  114. package/dist/src/telem/control/aether/state.d.ts +5 -1
  115. package/dist/src/telem/control/aether/state.d.ts.map +1 -1
  116. package/dist/src/theming/aether/provider.d.ts +660 -132
  117. package/dist/src/theming/aether/provider.d.ts.map +1 -1
  118. package/dist/src/theming/core/theme.d.ts +478 -126
  119. package/dist/src/theming/core/theme.d.ts.map +1 -1
  120. package/dist/src/vis/axis/axis.d.ts +10 -2
  121. package/dist/src/vis/axis/axis.d.ts.map +1 -1
  122. package/dist/src/vis/diagram/aether/types.d.ts +9 -3
  123. package/dist/src/vis/diagram/aether/types.d.ts.map +1 -1
  124. package/dist/src/vis/line/aether/line.d.ts +5 -1
  125. package/dist/src/vis/line/aether/line.d.ts.map +1 -1
  126. package/dist/src/vis/lineplot/aether/XAxis.d.ts +20 -4
  127. package/dist/src/vis/lineplot/aether/XAxis.d.ts.map +1 -1
  128. package/dist/src/vis/lineplot/aether/YAxis.d.ts +20 -4
  129. package/dist/src/vis/lineplot/aether/YAxis.d.ts.map +1 -1
  130. package/dist/src/vis/lineplot/aether/axis.d.ts +10 -2
  131. package/dist/src/vis/lineplot/aether/axis.d.ts.map +1 -1
  132. package/dist/src/vis/lineplot/tooltip/aether/tooltip.d.ts +40 -8
  133. package/dist/src/vis/lineplot/tooltip/aether/tooltip.d.ts.map +1 -1
  134. package/dist/src/vis/log/aether/Log.d.ts +15 -3
  135. package/dist/src/vis/log/aether/Log.d.ts.map +1 -1
  136. package/dist/src/vis/measure/aether/measure.d.ts +40 -8
  137. package/dist/src/vis/measure/aether/measure.d.ts.map +1 -1
  138. package/dist/src/vis/rule/aether/aether.d.ts +10 -2
  139. package/dist/src/vis/rule/aether/aether.d.ts.map +1 -1
  140. package/dist/src/vis/value/aether/value.d.ts +15 -3
  141. package/dist/src/vis/value/aether/value.d.ts.map +1 -1
  142. package/dist/src/vis/value/use.d.ts +5 -1
  143. package/dist/src/vis/value/use.d.ts.map +1 -1
  144. package/dist/tabs.cjs +1 -1
  145. package/dist/tabs.js +1 -1
  146. package/dist/text.cjs +1 -1
  147. package/dist/text.js +2 -2
  148. package/dist/theming.cjs +1 -1
  149. package/dist/theming.js +2 -2
  150. package/dist/tree.cjs +1 -1
  151. package/dist/tree.js +1 -1
  152. package/dist/triggers.cjs +1 -1
  153. package/dist/triggers.js +1 -1
  154. package/dist/units-CX_coN92.cjs +1 -0
  155. package/dist/{units-a8CggrTe.js → units-Ct3Xl5nK.js} +1 -1
  156. package/dist/{useClickOutside-CPAEkvf8.cjs → useClickOutside-CSff8yb-.cjs} +1 -1
  157. package/dist/{useClickOutside-CKMnqdvH.js → useClickOutside-DDCP7Fh-.js} +24 -24
  158. package/dist/{useDebouncedCallback-Cyd6pZ59.js → useDebouncedCallback-BG4I7mbT.js} +1 -1
  159. package/dist/{useDebouncedCallback-DsKlBI86.cjs → useDebouncedCallback-DnwYZzjR.cjs} +1 -1
  160. package/dist/{useMemoCompare-B930TM0g.js → useMemoCompare-BViQehyd.js} +2 -2
  161. package/dist/{useMemoCompare-DprA41gC.cjs → useMemoCompare-C2X7Mzx8.cjs} +1 -1
  162. package/dist/{useVirtualCursorDragWebKit-Cvp93Pya.cjs → useVirtualCursorDragWebKit-DDmXE4RW.cjs} +1 -1
  163. package/dist/{useVirtualCursorDragWebKit-BrSOJpYY.js → useVirtualCursorDragWebKit-DTU2tUmp.js} +3 -3
  164. package/dist/value-CkzEjG7v.cjs +57 -0
  165. package/dist/{value-BdZLWVof.js → value-DIoBc3VU.js} +637 -634
  166. package/dist/video.cjs +1 -1
  167. package/dist/video.js +1 -1
  168. package/package.json +7 -7
  169. package/dist/deep-B1etRzze.cjs +0 -1
  170. package/dist/deep-BytImVW-.js +0 -102
  171. package/dist/units-CKKNRQlP.cjs +0 -1
  172. package/dist/value-B7u8K1CW.cjs +0 -57
@@ -1,15 +1,15 @@
1
- "use strict";var Qn=Object.defineProperty;var ei=(r,e,t)=>e in r?Qn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Re=(r,e,t)=>ei(r,typeof e!="symbol"?e+"":e,t);const a=require("zod"),Je=a.z.tuple([a.z.number(),a.z.number()]);a.z.tuple([a.z.bigint(),a.z.bigint()]);const kt=a.z.object({width:a.z.number(),height:a.z.number()}),ti=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()}),ri=["width","height"];a.z.enum(ri);const ni=["start","center","end"],ii=["signedWidth","signedHeight"];a.z.enum(ii);const Ne=a.z.object({x:a.z.number(),y:a.z.number()}),Nr=a.z.object({clientX:a.z.number(),clientY:a.z.number()}),Dt=["x","y"],Pt=a.z.enum(Dt),Ur=["top","right","bottom","left"],si=a.z.enum(Ur),Xe=["left","right"],Ft=a.z.enum(Xe),Qe=["top","bottom"],_t=a.z.enum(Qe),qt=["center"],yt=a.z.enum(qt),oi=[...Ur,...qt],et=a.z.enum(oi);a.z.enum(ni);const ai=["first","last"];a.z.enum(ai);const Br=a.z.object({lower:a.z.number(),upper:a.z.number()}),ui=a.z.object({lower:a.z.bigint(),upper:a.z.bigint()});a.z.union([Br,Je]);a.z.union([ui,Je]);const li=a.z.enum([...Pt.options,...et.options]),hi=a.z.union([Pt,et,a.z.instanceof(String)]),X=r=>typeof r=="bigint"||r instanceof BigInt,$e=(r,e)=>X(r)?r.valueOf()-BigInt(e.valueOf().valueOf()):r.valueOf()-Number(e.valueOf()),Er=(r,e)=>X(r)?r.valueOf()+BigInt(e.valueOf().valueOf()):r+Number(e.valueOf()),ci=(r,e,t=1e-4)=>Math.abs(r-e)<t,mt=(r,e)=>X(r)?r===BigInt(e.valueOf().valueOf()):r===Number(e.valueOf()),fi=r=>{const e=10**Math.floor(Math.log10(r));return Math.round(r/e)*e},zr=(r,e)=>X(r)?r.valueOf()<BigInt(e.valueOf())?r:BigInt(e.valueOf()):r.valueOf()<Number(e.valueOf())?r:Number(e.valueOf()),di=(r,e)=>X(r)?r.valueOf()>BigInt(e.valueOf())?r:BigInt(e.valueOf()):r.valueOf()>Number(e.valueOf())?r:Number(e.valueOf()),Ar=r=>X(r)||r instanceof BigInt?r.valueOf()<0n?-r:r:r.valueOf()<0?-r:r,Q=(r,e)=>X(r)?r.valueOf()*BigInt(e.valueOf()):r.valueOf()*Number(e.valueOf()),gi=(r,e)=>X(r)?r.valueOf()/BigInt(e.valueOf()):r.valueOf()/Number(e.valueOf()),m=(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 wt(r);return wt(t)},pi=Object.freeze({lower:0,upper:0}),yi=Object.freeze({lower:-1/0,upper:1/0}),mi=Object.freeze({lower:0,upper:1}),wi=Object.freeze({lower:-1,upper:1}),bi=(r,e)=>{if(r==null&&e==null)return!0;if(r==null||e==null)return!1;const t=m(r),n=m(e);return(t==null?void 0:t.lower)===(n==null?void 0:n.lower)&&(t==null?void 0:t.upper)===(n==null?void 0:n.upper)},wt=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r,bt=(r,e)=>{const t=m(r);return e<t.lower?t.lower:e>=t.upper?t.upper-(typeof t.upper=="number"?1:1n):e},M=(r,e)=>{const t=m(r);if(typeof e=="number"||typeof e=="bigint")return e>=t.lower&&e<t.upper;const n=m(e);return n.lower>=t.lower&&n.upper<=t.upper},vi=(r,e)=>{const t=m(r),n=m(e);return t.lower===n.lower?!0:n.upper===t.lower||n.lower===t.upper?!1:M(t,n.upper)||M(t,n.lower)||M(n,t.upper)||M(n,t.lower)},Me=r=>{const e=m(r);return e.upper-e.lower},$i=r=>{const e=m(r);return typeof e.lower=="bigint"?e.lower===0n&&e.upper===0n:e.lower===0&&e.upper===0},xi=r=>{const e=Me(r);return typeof e=="number"?e===0:e===0n},Oi=r=>{const e=m(r);return typeof e.lower=="bigint"?!0:Number.isFinite(e.lower)&&Number.isFinite(e.upper)},Ti=r=>{const e=m(r);return(e.upper+e.lower)/2},Mr=r=>({lower:Math.min(...r.map(e=>m(e).lower)),upper:Math.max(...r.map(e=>m(e).upper))}),Si=r=>({lower:Math.max(...r.map(e=>m(e).lower)),upper:Math.min(...r.map(e=>m(e).upper))}),Ii=r=>{const e=m(r),t=typeof e.lower=="bigint";return Array.from({length:Number(Me(r))},(n,i)=>t?e.lower+BigInt(i):e.lower+i)},vt=(r,e)=>{const t=r.map(s=>m(s)),n=t.findIndex(s=>M(s,e)||e<s.lower);if(n===-1)return{index:r.length,position:0};const i=t[n];return M(i,e)?{index:n,position:Number(e-i.lower)}:{index:n,position:0}},ht={removeBefore:0,removeAfter:0,insertInto:0,deleteInBetween:0},Ni=(r,e)=>{const t=r.map(f=>m(f)),n=m(e);if(t.length===0)return ht;const i=vt(t,n.lower),s=vt(t,n.upper);if(i.index===r.length)return{...ht,insertInto:r.length};if(s.index===0)return{...ht,removeAfter:s.position};if(i.index===s.index)return i.position!==0&&s.position!==0?null:{removeAfter:s.position,removeBefore:i.position,insertInto:i.index,deleteInBetween:0};let o=s.index-i.index,u=i.index,h=$e(Number(Me(t[i.index])),i.position);return i.position!==0?(o-=1,u+=1):h=0,{removeBefore:h,removeAfter:s.position,insertInto:u,deleteInBetween:o}},Cr=(r,e,t)=>{const n=r.map(u=>m(u)),i=t>0?1:t<0?-1:0;if(i===0)return e;let s=t,o=e;for(;mt(s,0)===!1;){const u=n.findIndex(h=>i>0?o>=h.lower&&o<h.upper:o>h.lower&&o<=h.upper);if(u!==-1){const h=n[u];let f;if(i>0?f=$e(h.upper,o):f=$e(o,h.lower),f>0){const g=zr(Ar(s),f);if(o=Er(o,i>0?g:-g),s=$e(s,i>0?g:-g),mt(s,0))return o;continue}}if(i>0){const h=n.filter(f=>f.lower>o);if(h.length>0)o=h[0].lower;else return o}else{const h=n.filter(f=>f.upper<o);if(h.length>0)o=h[h.length-1].upper;else return o}}return o},Lr=(r,e,t)=>{const n=r.map(o=>m(o));if(e===t)return typeof e=="bigint"?0n:0;const i=e<t?m([e,t]):m([t,e]);let s=typeof e=="bigint"?0n:0;for(const o of n){const u=o.lower>i.lower?o.lower:i.lower,h=o.upper<i.upper?o.upper:i.upper;if(u<h){const f=h-u;s=s+f}}return s},Ui=Object.freeze(Object.defineProperty({__proto__:null,CLIP:wi,DECIMAL:mi,INFINITE:yi,ZERO:pi,bounds:Br,buildInsertionPlan:Ni,clamp:bt,construct:m,contains:M,distance:Lr,equals:bi,findInsertPosition:vt,isFinite:Oi,isZero:$i,linspace:Ii,makeValid:wt,max:Mr,mean:Ti,min:Si,overlapsWith:vi,span:Me,spanIsZero:xi,traverse:Cr},Symbol.toStringTag,{value:"Module"})),Rr=li,W=r=>Dt.includes(r)?r:Qe.includes(r)?"y":"x",Bi=r=>W(r)==="x"?"y":"x",Ei=r=>W(r)==="x"?"width":"height",zi=r=>W(r)==="x"?"left":"top",Ai=r=>Rr.safeParse(r).success,Mi=r=>W(r)==="x"?"signedWidth":"signedHeight",jr=Object.freeze(Object.defineProperty({__proto__:null,construct:W,crude:Rr,dimension:Ei,direction:Pt,isDirection:Ai,location:zi,signedDimension:Mi,swap:Bi},Symbol.toStringTag,{value:"Module"})),Ci=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)},Wt=r=>{const e=(t,n=$t)=>{if(typeof t=="string")return r(t);if(Array.isArray(t))return t.map(o=>e(o,n));if(!ct(t))return t;n=Ri(n);const i={},s=t;return Object.keys(s).forEach(o=>{let u=s[o];const h=r(o);n.recursive&&(ct(u)?cr(u,n.keepTypesOnRecursion)||(u=e(u,n)):n.recursiveInArray&&hr(u)&&(u=[...u].map(f=>{let g=f;return ct(f)?cr(g,n.keepTypesOnRecursion)||(g=e(f,n)):hr(f)&&(g=e({key:f},n).key),g}))),i[h]=u}),i};return e},tt=Wt(Ci),Li=r=>r.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`),Yt=Wt(Li),kr=r=>r.length===0?r:r[0].toUpperCase()+r.slice(1),$t={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},Ri=(r=$t)=>(r.recursive==null?r=$t:r.recursiveInArray??(r.recursiveInArray=!1),r),hr=r=>r!=null&&Array.isArray(r),ct=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),cr=(r,e)=>(e||[]).some(t=>r instanceof t),ji=r=>r.replace(/\s+/g,"-").replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}-${n.toLowerCase()}`).toLowerCase(),ki=Wt(ji),Di=Object.freeze(Object.defineProperty({__proto__:null,camelToSnake:Yt,capitalize:kr,snakeToCamel:tt,toKebab:ki},Symbol.toStringTag,{value:"Module"})),Pi=Ft,Fi=_t,_i=yt,qi={top:"bottom",right:"left",bottom:"top",left:"right",center:"center"},Wi={top:"left",right:"top",bottom:"right",left:"bottom",center:"center"},Yi=hi,J=r=>r instanceof String||!Dt.includes(r)?r:r==="x"?"left":"top",Dr=r=>qi[J(r)],Vi=r=>Wi[J(r)],Ue=r=>{const e=J(r);return e==="top"||e==="bottom"?"y":"x"},Pr=a.z.object({x:Ft.or(yt),y:_t.or(yt)}),Fr=a.z.object({x:Ft,y:_t}),oe=Object.freeze({x:"left",y:"top"}),Vt=Object.freeze({x:"right",y:"top"}),rt=Object.freeze({x:"left",y:"bottom"}),Zt=Object.freeze({x:"right",y:"bottom"}),nt=Object.freeze({x:"center",y:"center"}),Ht=Object.freeze({x:"center",y:"top"}),Gt=Object.freeze({x:"center",y:"bottom"}),Kt=Object.freeze({x:"right",y:"center"}),Jt=Object.freeze({x:"left",y:"center"}),_r=Object.freeze([Jt,Kt,Ht,Gt,oe,Vt,rt,Zt,nt]),it=(r,e)=>r.x===e.x&&r.y===e.y,qr=(r,e)=>{if(typeof e=="object"){let t=!0;return"x"in e&&(r.x===e.x||(t=!1)),"y"in e&&(r.y===e.y||(t=!1)),t}return r.x===e||r.y===e},Wr=r=>[r.x,r.y],_e=r=>Ue(J(r))==="x",Zi=r=>Ue(J(r))==="y",Hi=r=>`${r.x}${kr(r.y)}`,Gi=(r,e)=>{let t,n;if(typeof r=="object"&&"x"in r?(t=r.x,n=r.y):(t=J(r),n=J(e??r)),Ue(t)===Ue(n)&&t!=="center"&&n!=="center")throw new Error(`[XYLocation] - encountered two locations with the same direction: ${t.toString()} - ${n.toString()}`);const i={...nt};return t==="center"?_e(n)?[i.x,i.y]=[n,t]:[i.x,i.y]=[t,n]:n==="center"?_e(t)?[i.x,i.y]=[t,n]:[i.x,i.y]=[n,t]:_e(t)?[i.x,i.y]=[t,n]:[i.x,i.y]=[n,t],i},Yr=Object.freeze(Object.defineProperty({__proto__:null,BOTTOM_CENTER:Gt,BOTTOM_LEFT:rt,BOTTOM_RIGHT:Zt,CENTER:nt,CENTER_LEFT:Jt,CENTER_LOCATIONS:qt,CENTER_RIGHT:Kt,TOP_CENTER:Ht,TOP_LEFT:oe,TOP_RIGHT:Vt,XY_LOCATIONS:_r,X_LOCATIONS:Xe,Y_LOCATIONS:Qe,center:_i,construct:J,constructXY:Gi,corner:Fr,crude:Yi,direction:Ue,isX:_e,isY:Zi,location:et,outer:si,rotate90:Vi,swap:Dr,x:Pi,xy:Pr,xyCouple:Wr,xyEquals:it,xyMatches:qr,xyToString:Hi,y:Fi},Symbol.toStringTag,{value:"Module"})),xt=a.z.union([a.z.number(),Ne,Je,kt,ti,Nr]),S=(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}},k=Object.freeze({x:0,y:0}),Vr=Object.freeze({x:1,y:1}),Ki=Object.freeze({x:1/0,y:1/0}),Ji=Object.freeze({x:NaN,y:NaN}),Ge=(r,e,t=0)=>{const n=S(r),i=S(e);return t===0?n.x===i.x&&n.y===i.y:Math.abs(n.x-i.x)<=t&&Math.abs(n.y-i.y)<=t},Xi=r=>Ge(r,k),Xt=(r,e,t)=>{const n=S(r),i=S(e,t);return{x:n.x*i.x,y:n.y*i.y}},Zr=(r,e)=>{const t=S(r);return{x:t.x+e,y:t.y}},Hr=(r,e)=>{const t=S(r);return{x:t.x,y:t.y+e}},Be=(r,e,t,...n)=>typeof e=="string"&&typeof t=="number"?e==="x"?Zr(r,t):Hr(r,t):[r,e,t??k,...n].reduce((i,s)=>{const o=S(s);return{x:i.x+o.x,y:i.y+o.y}},k),Qi=(r,e,t)=>{const n=S(r);return e==="x"?{x:t,y:n.y}:{x:n.x,y:t}},es=(r,e)=>{const t=S(r),n=S(e);return Math.sqrt((t.x-n.x)**2+(t.y-n.y)**2)},ts=(r,e)=>{const t=S(r),n=S(e);return{x:n.x-t.x,y:n.y-t.y}},rs=r=>{const e=S(r);return Number.isNaN(e.x)||Number.isNaN(e.y)},ns=r=>{const e=S(r);return Number.isFinite(e.x)&&Number.isFinite(e.y)},is=r=>{const e=S(r);return[e.x,e.y]},ss=r=>{const e=S(r);return{left:e.x,top:e.y}},Ot=(r,e=0)=>{const t=S(r);return{x:Number(t.x.toFixed(e)),y:Number(t.y.toFixed(e))}},fe=(r,e)=>{const t=S(r),n=S(e);return{x:t.x-n.x,y:t.y-n.y}},de=r=>{const e=S(r),t=Math.hypot(e.x,e.y);return t===0?{x:0,y:0}:{x:-e.y/t,y:e.x/t}},Gr=r=>{const e=S(r),t=Math.hypot(e.x,e.y);return t===0?{x:0,y:0}:{x:e.x/t,y:e.y/t}},Kr=(...r)=>{const e=r.reduce((t,n)=>Be(t,n),k);return Xt(e,1/r.length)},os=(r,e)=>{const t=[];for(let n=0;n<r.length;n++){const i=r[n];let s,o,u,h;if(n===0){const f=r[n+1],g=fe(f,i);o=de(g),u=o,h=e}else if(n===r.length-1){const f=r[n-1],g=fe(i,f);s=de(g),u=s,h=e}else{const f=r[n-1],g=r[n+1],d=fe(i,f),B=fe(g,i);s=de(d),o=de(B);const A=Math.acos((d.x*B.x+d.y*B.y)/(Math.hypot(d.x,d.y)*Math.hypot(B.x,B.y))),ue=Math.sin(A/2);ue===0?h=e:h=e/ue,u=Gr(Kr(s,o))}t.push(Xt(u,h))}return t},as=r=>{const e=S(r);return{x:e.y,y:e.x}},us=Object.freeze(Object.defineProperty({__proto__:null,INFINITY:Ki,NAN:Ji,ONE:Vr,ZERO:k,average:Kr,calculateMiters:os,clientXY:Nr,construct:S,couple:is,crudeZ:xt,css:ss,distance:es,equals:Ge,isFinite:ns,isNan:rs,isZero:Xi,normal:de,normalize:Gr,scale:Xt,set:Qi,sub:fe,swap:as,translate:Be,translateX:Zr,translateY:Hr,translation:ts,truncate:Ot,xy:Ne},Symbol.toStringTag,{value:"Module"})),je=a.z.union([a.z.number(),a.z.string()]),ls=a.z.object({top:je,left:je,width:je,height:je}),hs=a.z.object({left:a.z.number(),top:a.z.number(),right:a.z.number(),bottom:a.z.number()}),cs=a.z.object({one:Ne,two:Ne,root:Fr}),Jr={one:k,two:k,root:oe},fs={one:k,two:Vr,root:rt},Xr=(r,e)=>({one:r.one,two:r.two,root:e??r.root}),T=(r,e,t=0,n=0,i)=>{const s={one:{...k},two:{...k},root:i??oe};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return s.one={x:r,y:e},s.two={x:s.one.x+t,y:s.one.y+n},s}return"one"in r&&"two"in r&&"root"in r?{...r,root:i??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(s.one={x:r.left,y:r.top},s.two={x:r.right,y:r.bottom},s):(s.one=r,e==null?s.two={x:s.one.x+t,y:s.one.y+n}:typeof e=="number"?s.two={x:s.one.x+e,y:s.one.y+t}:"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))},ds=(r,e,t)=>{const n=T(r);if(typeof e=="string"){if(t==null)throw new Error("Invalid arguments for resize");const i=W(e);return T(n.one,void 0,i==="x"?t:_(n),i==="y"?t:q(n),n.root)}return T(n.one,e,void 0,void 0,n.root)},gs=(r,e,t=!0)=>{const n=T(r);let i=(s,o)=>s<o;return t&&(i=(s,o)=>s<=o),"one"in e?i(H(n),H(e))&&i(te(e),te(n))&&i(G(n),G(e))&&i(re(e),re(n)):i(H(n),e.x)&&i(e.x,te(n))&&i(G(n),e.y)&&i(e.y,re(n))},ps=(r,e)=>Ge(r.one,e.one)&&Ge(r.two,e.two)&&it(r.root,e.root),Qr=r=>({width:_(r),height:q(r)}),ys=r=>({signedWidth:st(r),signedHeight:ot(r)}),ms=r=>({top:G(r),left:H(r),width:_(r),height:q(r)}),Qt=(r,e,t=!1)=>{const n=W(e)==="y"?ot(r):st(r);return t?n:Math.abs(n)},D=(r,e)=>{const t=T(r);return{x:e.x==="center"?Tt(t).x:ne(t,e.x),y:e.y==="center"?Tt(t).y:ne(t,e.y)}},ne=(r,e)=>{const t=T(r),n=Wr(t.root).includes(e)?Math.min:Math.max;return Xe.includes(e)?n(t.one.x,t.two.x):n(t.one.y,t.two.y)},ws=r=>r.one.x===r.two.x&&r.one.y===r.two.y,_=r=>Qt(r,"x"),q=r=>Qt(r,"y"),st=r=>{const e=T(r);return e.two.x-e.one.x},ot=r=>{const e=T(r);return e.two.y-e.one.y},en=r=>D(r,oe),bs=r=>D(r,Ht),vs=r=>D(r,Vt),$s=r=>D(r,rt),xs=r=>D(r,Gt),Os=r=>D(r,Zt),Ts=r=>D(r,Jt),Ss=r=>D(r,Kt),te=r=>ne(r,"right"),re=r=>ne(r,"bottom"),H=r=>ne(r,"left"),G=r=>ne(r,"top"),Tt=r=>Be(en(r),{x:st(r)/2,y:ot(r)/2}),er=r=>{const e=T(r);return e.root.x==="left"?H(e):te(e)},tr=r=>{const e=T(r);return e.root.y==="top"?G(e):re(e)},Is=r=>({x:er(r),y:tr(r)}),qe=r=>{const e=T(r);return{lower:e.one.x,upper:e.two.x}},We=r=>{const e=T(r);return{lower:e.one.y,upper:e.two.y}},Ns=(r,e)=>Xr(r,e),Us=(r,e)=>{const t=T(r),n=Xe.includes(e)?"x":Qe.includes(e)?"y":null;if(n===null)throw new Error(`Invalid location: ${e}`);const i=e==="top"||e==="left"?Math.min:Math.max,s={...t.one},o={...t.two};return s[n]=i(t.one[n],t.two[n]),o[n]=i(t.one[n],t.two[n]),[s,o]},Bs=(r,e)=>{const t=T(r),n=T(e),i=er(n)+(_(n)-_(t))/2,s=tr(n)+(q(n)-q(t))/2;return T({x:i,y:s},Qr(t))},tn=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Es=r=>_(r)/q(r),zs=(r,e,t)=>{if(typeof e=="string"){if(t==null)throw new Error("Undefined amount passed into box.translate");const i=W(e);e=S(i,t)}const n=T(r);return T(Be(n.one,e),Be(n.two,e),void 0,void 0,n.root)},rn=(r,e)=>{const t=Math.max(H(r),H(e)),n=Math.max(G(r),G(e)),i=Math.min(te(r),te(e)),s=Math.min(re(r),re(e));return t>i||n>s?Jr:T({x:t,y:n},{x:i,y:s},void 0,void 0,r.root)},nn=r=>_(r)*q(r),As=(r,e)=>{const t=T(r);return T(Ot(t.one,e),Ot(t.two,e),void 0,void 0,t.root)},sn=(r,e,t,n,i,s)=>{const o={x:r,y:e},u={x:r+t,y:e+n};return i.x!==s.x&&(i.x==="center"?(o.x-=t/2,u.x-=t/2):(o.x-=t,u.x-=t)),i.y!==s.y&&(i.y==="center"?(o.y-=n/2,u.y-=n/2):(o.y-=n,u.y-=n)),T(o,u,void 0,void 0,s)},Ms=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:fs,ZERO:Jr,area:nn,areaIsZero:ws,aspect:Es,bottom:re,bottomCenter:xs,bottomLeft:$s,bottomRight:Os,box:cs,center:Tt,centerLeft:Ts,centerRight:Ss,construct:T,constructWithAlternateRoot:sn,contains:gs,copy:Xr,css:ms,cssBox:ls,dim:Qt,dims:Qr,domRect:hs,edgePoints:Us,equals:ps,height:q,intersection:rn,isBox:tn,left:H,loc:ne,positionInCenter:Bs,reRoot:Ns,resize:ds,right:te,root:Is,signedDims:ys,signedHeight:ot,signedWidth:st,top:G,topCenter:bs,topLeft:en,topRight:vs,translate:zs,truncate:As,width:_,x:er,xBounds:qe,xyLoc:D,y:tr,yBounds:We},Symbol.toStringTag,{value:"Module"})),on=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()}),Cs=a.z.union([kt,on,Ne,Je]),Ls={width:0,height:0},Rs={width:1,height:1},C=(r,e)=>typeof r=="number"?{width:r,height:e??r}:Array.isArray(r)?{width:r[0],height:r[1]}:"x"in r?{width:r.x,height:r.y}:"signedWidth"in r?{width:r.signedWidth,height:r.signedHeight}:{...r},js=(r,e)=>{if(e==null)return!1;const t=C(r),n=C(e);return t.width===n.width&&t.height===n.height},ks=r=>{const e=C(r);return{width:e.height,height:e.width}},Ds=r=>{const e=C(r);return`0 0 ${e.width} ${e.height}`},Ps=r=>{const e=C(r);return[e.width,e.height]},Fs=r=>({width:Math.max(...r.map(e=>C(e).width)),height:Math.max(...r.map(e=>C(e).height))}),_s=r=>({width:Math.min(...r.map(e=>C(e).width)),height:Math.min(...r.map(e=>C(e).height))}),qs=(r,e)=>{const t=C(r);return{width:t.width*e,height:t.height*e}},Ws=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:Rs,ZERO:Ls,construct:C,couple:Ps,crude:Cs,dimensions:kt,equals:js,max:Fs,min:_s,scale:qs,signed:on,svgViewBox:Ds,swap:ks},Symbol.toStringTag,{value:"Module"}));var Ys=Object.defineProperty,Vs=(r,e,t)=>e in r?Ys(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,F=(r,e,t)=>Vs(r,typeof e!="symbol"?e+"":e,t);const an=(r,e,t)=>e!==void 0&&r<e?e:t!==void 0&&r>t?t:r,Zs=a.z.object({offset:xt,scale:xt}),Hs=a.z.object({offset:a.z.number(),scale:a.z.number()}),Gs=r=>(e,t,n,i)=>t==="dimension"?[e,n]:[e,i?n-r:n+r],Ks=r=>(e,t,n,i)=>[e,i?n/r:n*r],Js=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:i,upper:s}=e,{lower:o,upper:u}=r,h=s-i,f=u-o;if(t==="dimension")return[r,n*(f/h)];const g=(n-i)*(f/h)+o;return[r,g]},Xs=r=>(e,t,n)=>[r,n],Qs=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:i}=r;return[r,i-(t-n)]},eo=r=>(e,t,n)=>{const{lower:i,upper:s}=r;return n=an(n,i,s),[e,n]},St=class ge{constructor(){F(this,"ops",[]),F(this,"currBounds",null),F(this,"currType",null),F(this,"reversed",!1),this.ops=[]}static translate(e){return new ge().translate(e)}static magnify(e){return new ge().magnify(e)}static scale(e,t){return new ge().scale(e,t)}translate(e){const t=this.new(),n=Gs(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Ks(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=m(e,t),i=this.new(),s=Js(n);return s.type="scale",i.ops.push(s),i}clamp(e,t){const n=m(e,t),i=this.new(),s=eo(n);return s.type="clamp",i.ops.push(s),i}reBound(e,t){const n=m(e,t),i=this.new(),s=Xs(n);return s.type="re-bound",i.ops.push(s),i}invert(){const e=Qs();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 ge;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,i],s)=>s(n,e,i,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,i)=>{if(n.type==="scale"||t.some(([o,u])=>i>=o&&i<=u))return;const s=e.ops.findIndex((o,u)=>o.type==="scale"&&u>i);s!==-1&&t.push([i,s])}),t.forEach(([n,i])=>{const s=e.ops.slice(n,i);s.unshift(e.ops[i]),e.ops.splice(n,i-n+1,...s)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};F(St,"IDENTITY",new St);let It=St;const Nt=class P{constructor(e=new It,t=new It,n=null){F(this,"x"),F(this,"y"),F(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new P().translate(e,t)}static translateX(e){return new P().translateX(e)}static translateY(e){return new P().translateY(e)}static clamp(e){return new P().clamp(e)}static magnify(e){return new P().magnify(e)}static scale(e){return new P().scale(e)}static reBound(e){return new P().reBound(e)}translate(e,t){const n=S(e,t),i=this.copy();return i.x=this.x.translate(n.x),i.y=this.y.translate(n.y),i}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(tn(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!it(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(qe(e)),t.y=t.y.scale(We(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(qe(e)),t.y=this.y.reBound(We(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(qe(e)),t.y=this.y.clamp(We(e)),t}copy(){const e=new P;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 T(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})}}};F(Nt,"IDENTITY",new Nt);let to=Nt;const ro=Object.freeze(Object.defineProperty({__proto__:null,Scale:It,XY:to,crudeXYTransform:Zs,transform:Hs},Symbol.toStringTag,{value:"Module"}));function un(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r)){var i=r.length;for(e=0;e<i;e++)r[e]&&(t=un(r[e]))&&(n&&(n+=" "),n+=t)}else for(t in r)r[t]&&(n&&(n+=" "),n+=t);return n}function ln(){for(var r,e,t=0,n="",i=arguments.length;t<i;t++)(r=arguments[t])&&(e=un(r))&&(n&&(n+=" "),n+=e);return n}const no=ln,fr="-",dr="__",ke="--",rr=r=>{const e=(...t)=>no(...t);return e.B=t=>r+fr+t,e.E=t=>r+dr+t,e.M=t=>r+ke+t,e.BM=(t,n)=>e.B(t)+ke+n,e.BE=(t,n)=>e.B(t)+dr+n,e.BEM=(t,n,i)=>e.BE(t,n)+ke+i,e.extend=t=>rr(e.B(t)),e.var=t=>ke+r+fr+t,e},at=r=>r!=null&&typeof r=="object"&&!Array.isArray(r);var io=Object.defineProperty,so=(r,e,t)=>e in r?io(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ie=(r,e,t)=>so(r,typeof e!="symbol"?e+"":e,t);function oo(r){const e=r.length;let t=0,n=0;for(;n<e;){let i=r.charCodeAt(n++);if((i&4294967168)===0){t++;continue}else if((i&4294965248)===0)t+=2;else{if(i>=55296&&i<=56319&&n<e){const s=r.charCodeAt(n);(s&64512)===56320&&(++n,i=((i&1023)<<10)+(s&1023)+65536)}(i&4294901760)===0?t+=3:t+=4}}return t}function ao(r,e,t){const n=r.length;let i=t,s=0;for(;s<n;){let o=r.charCodeAt(s++);if((o&4294967168)===0){e[i++]=o;continue}else if((o&4294965248)===0)e[i++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<n){const u=r.charCodeAt(s);(u&64512)===56320&&(++s,o=((o&1023)<<10)+(u&1023)+65536)}(o&4294901760)===0?(e[i++]=o>>12&15|224,e[i++]=o>>6&63|128):(e[i++]=o>>18&7|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128)}e[i++]=o&63|128}}const uo=new TextEncoder,lo=50;function ho(r,e,t){uo.encodeInto(r,e.subarray(t))}function co(r,e,t){r.length>lo?ho(r,e,t):ao(r,e,t)}const fo=4096;function hn(r,e,t){let n=e;const i=n+t,s=[];let o="";for(;n<i;){const u=r[n++];if((u&128)===0)s.push(u);else if((u&224)===192){const h=r[n++]&63;s.push((u&31)<<6|h)}else if((u&240)===224){const h=r[n++]&63,f=r[n++]&63;s.push((u&31)<<12|h<<6|f)}else if((u&248)===240){const h=r[n++]&63,f=r[n++]&63,g=r[n++]&63;let d=(u&7)<<18|h<<12|f<<6|g;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(u);s.length>=fo&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const go=new TextDecoder,po=200;function yo(r,e,t){const n=r.subarray(e,e+t);return go.decode(n)}function mo(r,e,t){return t>po?yo(r,e,t):hn(r,e,t)}let De=class{constructor(e,t){this.type=e,this.data=t}},j=class Ut extends Error{constructor(e){super(e);const t=Object.create(Ut.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Ut.name})}};const le=4294967295;function wo(r,e,t){const n=t/4294967296,i=t;r.setUint32(e,n),r.setUint32(e+4,i)}function cn(r,e,t){const n=Math.floor(t/4294967296),i=t;r.setUint32(e,n),r.setUint32(e+4,i)}function fn(r,e){const t=r.getInt32(e),n=r.getUint32(e+4);return t*4294967296+n}function bo(r,e){const t=r.getUint32(e),n=r.getUint32(e+4);return t*4294967296+n}const vo=-1,$o=4294967296-1,xo=17179869184-1;function Oo({sec:r,nsec:e}){if(r>=0&&e>=0&&r<=xo)if(e===0&&r<=$o){const t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,r),t}else{const t=r/4294967296,n=r&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,e<<2|t&3),s.setUint32(4,n),i}else{const t=new Uint8Array(12),n=new DataView(t.buffer);return n.setUint32(0,e),cn(n,4,r),t}}function To(r){const e=r.getTime(),t=Math.floor(e/1e3),n=(e-t*1e3)*1e6,i=Math.floor(n/1e9);return{sec:t+i,nsec:n-i*1e9}}function So(r){if(r instanceof Date){const e=To(r);return Oo(e)}else return null}function Io(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),i=(t&3)*4294967296+n,s=t>>>2;return{sec:i,nsec:s}}case 12:{const t=fn(e,4),n=e.getUint32(0);return{sec:t,nsec:n}}default:throw new j(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function No(r){const e=Io(r);return new Date(e.sec*1e3+e.nsec/1e6)}const Uo={type:vo,encode:So,decode:No};let Ee=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Uo)}register({type:e,encode:t,decode:n}){if(e>=0)this.encoders[e]=t,this.decoders[e]=n;else{const i=-1-e;this.builtInEncoders[i]=t,this.builtInDecoders[i]=n}}tryToEncode(e,t){for(let n=0;n<this.builtInEncoders.length;n++){const i=this.builtInEncoders[n];if(i!=null){const s=i(e,t);if(s!=null){const o=-1-n;return new De(o,s)}}}for(let n=0;n<this.encoders.length;n++){const i=this.encoders[n];if(i!=null){const s=i(e,t);if(s!=null){const o=n;return new De(o,s)}}}return e instanceof De?e:null}decode(e,t,n){const i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(e,t,n):new De(t,e)}};Ee.defaultCodec=new Ee;function Bo(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function Bt(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):Bo(r)?new Uint8Array(r):Uint8Array.from(r)}const Eo=100,zo=2048;let Ao=class dn{constructor(e){this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??Ee.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)??Eo,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??zo,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 dn({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),i=new DataView(t);n.set(this.bytes),this.view=i,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=oo(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),co(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=Bt(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 i of e)this.doEncode(i,t+1)}countWithoutUndefined(e,t){let n=0;for(const i of t)e[i]!==void 0&&n++;return n}encodeMap(e,t){const n=Object.keys(e);this.sortKeys&&n.sort();const i=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(`Too large map object: ${i}`);for(const s of n){const o=e[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,t+1))}}encodeExtension(e){if(typeof e.data=="function"){const n=e.data(this.pos+6),i=n.length;if(i>=4294967296)throw new Error(`Too large extension object: ${i}`);this.writeU8(201),this.writeU32(i),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),wo(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),cn(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 pe(r,e){return new Ao(e).encodeSharedRef(r)}function ft(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const Mo=16,Co=16;class Lo{constructor(e=Mo,t=Co){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 i=this.caches[n-1];e:for(const s of i){const o=s.bytes;for(let u=0;u<n;u++)if(o[u]!==e[t+u])continue e;return s.str}return null}store(e,t){const n=this.caches[e.length-1],i={bytes:e,str:t};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)}decode(e,t,n){const i=this.find(e,t,n);if(i!=null)return this.hit++,i;this.miss++;const s=hn(e,t,n),o=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(o,s),s}}const Et="array",xe="map_key",gn="map_value",Ro=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new j("The type of key must be string or number but "+typeof r)};class jo{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=Et,t.position=0,t.size=e,t.array=new Array(e)}pushMapState(e){const t=this.getUninitializedStateFromPool();t.type=xe,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===Et){const t=e;t.size=0,t.array=void 0,t.position=0,t.type=void 0}if(e.type===xe||e.type===gn){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 he=-1,nr=new DataView(new ArrayBuffer(0)),ko=new Uint8Array(nr.buffer);try{nr.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 gr=new RangeError("Insufficient data"),Do=new Lo;let Po=class pn{constructor(e){this.totalPos=0,this.pos=0,this.view=nr,this.bytes=ko,this.headByte=he,this.stack=new jo,this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??Ee.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)??le,this.maxBinLength=(e==null?void 0:e.maxBinLength)??le,this.maxArrayLength=(e==null?void 0:e.maxArrayLength)??le,this.maxMapLength=(e==null?void 0:e.maxMapLength)??le,this.maxExtLength=(e==null?void 0:e.maxExtLength)??le,this.keyDecoder=(e==null?void 0:e.keyDecoder)!==void 0?e.keyDecoder:Do,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??Ro}clone(){return new pn({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=he,this.stack.reset()}setBuffer(e){const t=Bt(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===he&&!this.hasRemaining(1))this.setBuffer(e);else{const t=this.bytes.subarray(this.pos),n=Bt(e),i=new Uint8Array(t.length+n.length);i.set(t),i.set(n,t.length),this.setBuffer(i)}}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 u of e){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(u);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:i,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${ft(i)} at ${o} (${s} 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,i=-1;for await(const s of e){if(t&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(i=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==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 i=e-128;if(i!==0){this.pushMapState(i),this.complete();continue e}else t={}}else if(e<160){const i=e-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else t=[]}else{const i=e-160;t=this.decodeString(i,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 i=this.lookU8();t=this.decodeString(i,1)}else if(e===218){const i=this.lookU16();t=this.decodeString(i,2)}else if(e===219){const i=this.lookU32();t=this.decodeString(i,4)}else if(e===220){const i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else t=[]}else if(e===221){const i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue e}else t=[]}else if(e===222){const i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else t={}}else if(e===223){const i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else t={}}else if(e===196){const i=this.lookU8();t=this.decodeBinary(i,1)}else if(e===197){const i=this.lookU16();t=this.decodeBinary(i,2)}else if(e===198){const i=this.lookU32();t=this.decodeBinary(i,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 i=this.lookU8();t=this.decodeExtension(i,1)}else if(e===200){const i=this.lookU16();t=this.decodeExtension(i,2)}else if(e===201){const i=this.lookU32();t=this.decodeExtension(i,4)}else throw new j(`Unrecognized type byte: ${ft(e)}`);this.complete();const n=this.stack;for(;n.length>0;){const i=n.top();if(i.type===Et)if(i.array[i.position]=t,i.position++,i.position===i.size)t=i.array,n.release(i);else continue e;else if(i.type===xe){if(t==="__proto__")throw new j("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=gn;continue e}else if(i.map[i.key]=t,i.readCount++,i.readCount===i.size)t=i.map,n.release(i);else{i.key=null,i.type=xe;continue e}}return t}}readHeadByte(){return this.headByte===he&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=he}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 j(`Unrecognized array type byte: ${ft(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new j(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new j(`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 j(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw gr;const i=this.pos+t;let s;return this.stateIsMapKey()&&(n=this.keyDecoder)!=null&&n.canBeCached(e)?s=this.keyDecoder.decode(this.bytes,i,e):s=mo(this.bytes,i,e),this.pos+=t+e,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===xe:!1}decodeBinary(e,t){if(e>this.maxBinLength)throw new j(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw gr;const n=this.pos+t,i=this.bytes.subarray(n,n+e);return this.pos+=t+e,i}decodeExtension(e,t){if(e>this.maxExtLength)throw new j(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+t),i=this.decodeBinary(e,t+1);return this.extensionCodec.decode(i,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=bo(this.view,this.pos);return this.pos+=8,e}readI64(){const e=fn(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 yn(r,e){return new Po(e).decode(r)}let Fo=class{constructor(){ie(this,"contentType","application/json"),ie(this,"decoder"),ie(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),i=tt(n);return t!=null?t.parse(i):i}encodeString(e){const t=Yt(e);return JSON.stringify(t,(n,i)=>ArrayBuffer.isView(i)?Array.from(i):at(i)&&"encode_value"in i?typeof i.value=="bigint"?i.value.toString():i.value:typeof i=="bigint"?i.toString():i)}static registerCustomType(){}},_o=class{constructor(){ie(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||!at(e[0]))throw new Error("Payload must be an array of objects");const t=Object.keys(e[0]),n=[t.join(",")];return e.forEach(i=>{const s=t.map(o=>JSON.stringify(i[o]??""));n.push(s.join(","))}),n.join(`
1
+ "use strict";var ei=Object.defineProperty;var ti=(r,e,t)=>e in r?ei(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Re=(r,e,t)=>ti(r,typeof e!="symbol"?e+"":e,t);const a=require("zod"),Ke=a.z.tuple([a.z.number(),a.z.number()]);a.z.tuple([a.z.bigint(),a.z.bigint()]);const Dt=a.z.object({width:a.z.number(),height:a.z.number()}),ri=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()}),ni=["width","height"];a.z.enum(ni);const ii=["start","center","end"],si=["signedWidth","signedHeight"];a.z.enum(si);const Ne=a.z.object({x:a.z.number(),y:a.z.number()}),Nr=a.z.object({clientX:a.z.number(),clientY:a.z.number()}),Pt=["x","y"],Ft=a.z.enum(Pt),Ur=["top","right","bottom","left"],oi=a.z.enum(Ur),Xe=["left","right"],_t=a.z.enum(Xe),Qe=["top","bottom"],qt=a.z.enum(Qe),Wt=["center"],mt=a.z.enum(Wt),ai=[...Ur,...Wt],et=a.z.enum(ai);a.z.enum(ii);const ui=["first","last"];a.z.enum(ui);const Br=a.z.object({lower:a.z.number(),upper:a.z.number()}),li=a.z.object({lower:a.z.bigint(),upper:a.z.bigint()});a.z.union([Br,Ke]);a.z.union([li,Ke]);const hi=a.z.enum([...Ft.options,...et.options]),ci=a.z.union([Ft,et,a.z.instanceof(String)]),X=r=>typeof r=="bigint"||r instanceof BigInt,$e=(r,e)=>X(r)?r.valueOf()-BigInt(e.valueOf().valueOf()):r.valueOf()-Number(e.valueOf()),Er=(r,e)=>X(r)?r.valueOf()+BigInt(e.valueOf().valueOf()):r+Number(e.valueOf()),fi=(r,e,t=1e-4)=>Math.abs(r-e)<t,wt=(r,e)=>X(r)?r===BigInt(e.valueOf().valueOf()):r===Number(e.valueOf()),di=r=>{const e=10**Math.floor(Math.log10(r));return Math.round(r/e)*e},zr=(r,e)=>X(r)?r.valueOf()<BigInt(e.valueOf())?r:BigInt(e.valueOf()):r.valueOf()<Number(e.valueOf())?r:Number(e.valueOf()),gi=(r,e)=>X(r)?r.valueOf()>BigInt(e.valueOf())?r:BigInt(e.valueOf()):r.valueOf()>Number(e.valueOf())?r:Number(e.valueOf()),Ar=r=>X(r)||r instanceof BigInt?r.valueOf()<0n?-r:r:r.valueOf()<0?-r:r,Q=(r,e)=>X(r)?r.valueOf()*BigInt(e.valueOf()):r.valueOf()*Number(e.valueOf()),pi=(r,e)=>X(r)?r.valueOf()/BigInt(e.valueOf()):r.valueOf()/Number(e.valueOf()),m=(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 bt(r);return bt(t)},yi=Object.freeze({lower:0,upper:0}),mi=Object.freeze({lower:-1/0,upper:1/0}),wi=Object.freeze({lower:0,upper:1}),bi=Object.freeze({lower:-1,upper:1}),vi=(r,e)=>{if(r==null&&e==null)return!0;if(r==null||e==null)return!1;const t=m(r),n=m(e);return(t==null?void 0:t.lower)===(n==null?void 0:n.lower)&&(t==null?void 0:t.upper)===(n==null?void 0:n.upper)},bt=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r,vt=(r,e)=>{const t=m(r);return e<t.lower?t.lower:e>=t.upper?t.upper-(typeof t.upper=="number"?1:1n):e},M=(r,e)=>{const t=m(r);if(typeof e=="number"||typeof e=="bigint")return e>=t.lower&&e<t.upper;const n=m(e);return n.lower>=t.lower&&n.upper<=t.upper},$i=(r,e)=>{const t=m(r),n=m(e);return t.lower===n.lower?!0:n.upper===t.lower||n.lower===t.upper?!1:M(t,n.upper)||M(t,n.lower)||M(n,t.upper)||M(n,t.lower)},Me=r=>{const e=m(r);return e.upper-e.lower},xi=r=>{const e=m(r);return typeof e.lower=="bigint"?e.lower===0n&&e.upper===0n:e.lower===0&&e.upper===0},Oi=r=>{const e=Me(r);return typeof e=="number"?e===0:e===0n},Ti=r=>{const e=m(r);return typeof e.lower=="bigint"?!0:Number.isFinite(e.lower)&&Number.isFinite(e.upper)},Si=r=>{const e=m(r);return(e.upper+e.lower)/2},Mr=r=>({lower:Math.min(...r.map(e=>m(e).lower)),upper:Math.max(...r.map(e=>m(e).upper))}),Ii=r=>({lower:Math.max(...r.map(e=>m(e).lower)),upper:Math.min(...r.map(e=>m(e).upper))}),Ni=r=>{const e=m(r),t=typeof e.lower=="bigint";return Array.from({length:Number(Me(r))},(n,i)=>t?e.lower+BigInt(i):e.lower+i)},$t=(r,e)=>{const t=r.map(s=>m(s)),n=t.findIndex(s=>M(s,e)||e<s.lower);if(n===-1)return{index:r.length,position:0};const i=t[n];return M(i,e)?{index:n,position:Number(e-i.lower)}:{index:n,position:0}},ct={removeBefore:0,removeAfter:0,insertInto:0,deleteInBetween:0},Ui=(r,e)=>{const t=r.map(f=>m(f)),n=m(e);if(t.length===0)return ct;const i=$t(t,n.lower),s=$t(t,n.upper);if(i.index===r.length)return{...ct,insertInto:r.length};if(s.index===0)return{...ct,removeAfter:s.position};if(i.index===s.index)return i.position!==0&&s.position!==0?null:{removeAfter:s.position,removeBefore:i.position,insertInto:i.index,deleteInBetween:0};let o=s.index-i.index,u=i.index,h=$e(Number(Me(t[i.index])),i.position);return i.position!==0?(o-=1,u+=1):h=0,{removeBefore:h,removeAfter:s.position,insertInto:u,deleteInBetween:o}},Cr=(r,e,t)=>{const n=r.map(u=>m(u)),i=t>0?1:t<0?-1:0;if(i===0)return e;let s=t,o=e;for(;wt(s,0)===!1;){const u=n.findIndex(h=>i>0?o>=h.lower&&o<h.upper:o>h.lower&&o<=h.upper);if(u!==-1){const h=n[u];let f;if(i>0?f=$e(h.upper,o):f=$e(o,h.lower),f>0){const g=zr(Ar(s),f);if(o=Er(o,i>0?g:-g),s=$e(s,i>0?g:-g),wt(s,0))return o;continue}}if(i>0){const h=n.filter(f=>f.lower>o);if(h.length>0)o=h[0].lower;else return o}else{const h=n.filter(f=>f.upper<o);if(h.length>0)o=h[h.length-1].upper;else return o}}return o},Lr=(r,e,t)=>{const n=r.map(o=>m(o));if(e===t)return typeof e=="bigint"?0n:0;const i=e<t?m([e,t]):m([t,e]);let s=typeof e=="bigint"?0n:0;for(const o of n){const u=o.lower>i.lower?o.lower:i.lower,h=o.upper<i.upper?o.upper:i.upper;if(u<h){const f=h-u;s=s+f}}return s},Bi=Object.freeze(Object.defineProperty({__proto__:null,CLIP:bi,DECIMAL:wi,INFINITE:mi,ZERO:yi,bounds:Br,buildInsertionPlan:Ui,clamp:vt,construct:m,contains:M,distance:Lr,equals:vi,findInsertPosition:$t,isFinite:Ti,isZero:xi,linspace:Ni,makeValid:bt,max:Mr,mean:Si,min:Ii,overlapsWith:$i,span:Me,spanIsZero:Oi,traverse:Cr},Symbol.toStringTag,{value:"Module"})),Rr=hi,W=r=>Pt.includes(r)?r:Qe.includes(r)?"y":"x",Ei=r=>W(r)==="x"?"y":"x",zi=r=>W(r)==="x"?"width":"height",Ai=r=>W(r)==="x"?"left":"top",Mi=r=>Rr.safeParse(r).success,Ci=r=>W(r)==="x"?"signedWidth":"signedHeight",jr=Object.freeze(Object.defineProperty({__proto__:null,construct:W,crude:Rr,dimension:zi,direction:Ft,isDirection:Mi,location:Ai,signedDimension:Ci,swap:Ei},Symbol.toStringTag,{value:"Module"})),Li=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)},Vt=r=>{const e=(t,n=xt)=>{if(typeof t=="string")return r(t);if(Array.isArray(t))return t.map(o=>e(o,n));if(!ft(t))return t;n=ji(n);const i={},s=t;return Object.keys(s).forEach(o=>{let u=s[o];const h=r(o);n.recursive&&(ft(u)?cr(u,n.keepTypesOnRecursion)||(u=e(u,n)):n.recursiveInArray&&hr(u)&&(u=[...u].map(f=>{let g=f;return ft(f)?cr(g,n.keepTypesOnRecursion)||(g=e(f,n)):hr(f)&&(g=e({key:f},n).key),g}))),i[h]=u}),i};return e},tt=Vt(Li),Ri=r=>r.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`),Yt=Vt(Ri),kr=r=>r.length===0?r:r[0].toUpperCase()+r.slice(1),xt={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},ji=(r=xt)=>(r.recursive==null?r=xt:r.recursiveInArray??(r.recursiveInArray=!1),r),hr=r=>r!=null&&Array.isArray(r),ft=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),cr=(r,e)=>(e||[]).some(t=>r instanceof t),ki=r=>r.replace(/\s+/g,"-").replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}-${n.toLowerCase()}`).toLowerCase(),Di=Vt(ki),Pi=Object.freeze(Object.defineProperty({__proto__:null,camelToSnake:Yt,capitalize:kr,snakeToCamel:tt,toKebab:Di},Symbol.toStringTag,{value:"Module"})),Fi=_t,_i=qt,qi=mt,Wi={top:"bottom",right:"left",bottom:"top",left:"right",center:"center"},Vi={top:"left",right:"top",bottom:"right",left:"bottom",center:"center"},Yi=ci,K=r=>r instanceof String||!Pt.includes(r)?r:r==="x"?"left":"top",Dr=r=>Wi[K(r)],Zi=r=>Vi[K(r)],Ue=r=>{const e=K(r);return e==="top"||e==="bottom"?"y":"x"},Pr=a.z.object({x:_t.or(mt),y:qt.or(mt)}),Fr=a.z.object({x:_t,y:qt}),oe=Object.freeze({x:"left",y:"top"}),Zt=Object.freeze({x:"right",y:"top"}),rt=Object.freeze({x:"left",y:"bottom"}),Ht=Object.freeze({x:"right",y:"bottom"}),nt=Object.freeze({x:"center",y:"center"}),Gt=Object.freeze({x:"center",y:"top"}),Jt=Object.freeze({x:"center",y:"bottom"}),Kt=Object.freeze({x:"right",y:"center"}),Xt=Object.freeze({x:"left",y:"center"}),_r=Object.freeze([Xt,Kt,Gt,Jt,oe,Zt,rt,Ht,nt]),it=(r,e)=>r.x===e.x&&r.y===e.y,qr=(r,e)=>{if(typeof e=="object"){let t=!0;return"x"in e&&(r.x===e.x||(t=!1)),"y"in e&&(r.y===e.y||(t=!1)),t}return r.x===e||r.y===e},Wr=r=>[r.x,r.y],_e=r=>Ue(K(r))==="x",Hi=r=>Ue(K(r))==="y",Gi=r=>`${r.x}${kr(r.y)}`,Ji=(r,e)=>{let t,n;if(typeof r=="object"&&"x"in r?(t=r.x,n=r.y):(t=K(r),n=K(e??r)),Ue(t)===Ue(n)&&t!=="center"&&n!=="center")throw new Error(`[XYLocation] - encountered two locations with the same direction: ${t.toString()} - ${n.toString()}`);const i={...nt};return t==="center"?_e(n)?[i.x,i.y]=[n,t]:[i.x,i.y]=[t,n]:n==="center"?_e(t)?[i.x,i.y]=[t,n]:[i.x,i.y]=[n,t]:_e(t)?[i.x,i.y]=[t,n]:[i.x,i.y]=[n,t],i},Vr=Object.freeze(Object.defineProperty({__proto__:null,BOTTOM_CENTER:Jt,BOTTOM_LEFT:rt,BOTTOM_RIGHT:Ht,CENTER:nt,CENTER_LEFT:Xt,CENTER_LOCATIONS:Wt,CENTER_RIGHT:Kt,TOP_CENTER:Gt,TOP_LEFT:oe,TOP_RIGHT:Zt,XY_LOCATIONS:_r,X_LOCATIONS:Xe,Y_LOCATIONS:Qe,center:qi,construct:K,constructXY:Ji,corner:Fr,crude:Yi,direction:Ue,isX:_e,isY:Hi,location:et,outer:oi,rotate90:Zi,swap:Dr,x:Fi,xy:Pr,xyCouple:Wr,xyEquals:it,xyMatches:qr,xyToString:Gi,y:_i},Symbol.toStringTag,{value:"Module"})),Ot=a.z.union([a.z.number(),Ne,Ke,Dt,ri,Nr]),S=(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}},k=Object.freeze({x:0,y:0}),Yr=Object.freeze({x:1,y:1}),Ki=Object.freeze({x:1/0,y:1/0}),Xi=Object.freeze({x:NaN,y:NaN}),Ge=(r,e,t=0)=>{const n=S(r),i=S(e);return t===0?n.x===i.x&&n.y===i.y:Math.abs(n.x-i.x)<=t&&Math.abs(n.y-i.y)<=t},Qi=r=>Ge(r,k),Qt=(r,e,t)=>{const n=S(r),i=S(e,t);return{x:n.x*i.x,y:n.y*i.y}},Zr=(r,e)=>{const t=S(r);return{x:t.x+e,y:t.y}},Hr=(r,e)=>{const t=S(r);return{x:t.x,y:t.y+e}},Be=(r,e,t,...n)=>typeof e=="string"&&typeof t=="number"?e==="x"?Zr(r,t):Hr(r,t):[r,e,t??k,...n].reduce((i,s)=>{const o=S(s);return{x:i.x+o.x,y:i.y+o.y}},k),es=(r,e,t)=>{const n=S(r);return e==="x"?{x:t,y:n.y}:{x:n.x,y:t}},ts=(r,e)=>{const t=S(r),n=S(e);return Math.sqrt((t.x-n.x)**2+(t.y-n.y)**2)},rs=(r,e)=>{const t=S(r),n=S(e);return{x:n.x-t.x,y:n.y-t.y}},ns=r=>{const e=S(r);return Number.isNaN(e.x)||Number.isNaN(e.y)},is=r=>{const e=S(r);return Number.isFinite(e.x)&&Number.isFinite(e.y)},ss=r=>{const e=S(r);return[e.x,e.y]},os=r=>{const e=S(r);return{left:e.x,top:e.y}},Tt=(r,e=0)=>{const t=S(r);return{x:Number(t.x.toFixed(e)),y:Number(t.y.toFixed(e))}},fe=(r,e)=>{const t=S(r),n=S(e);return{x:t.x-n.x,y:t.y-n.y}},de=r=>{const e=S(r),t=Math.hypot(e.x,e.y);return t===0?{x:0,y:0}:{x:-e.y/t,y:e.x/t}},Gr=r=>{const e=S(r),t=Math.hypot(e.x,e.y);return t===0?{x:0,y:0}:{x:e.x/t,y:e.y/t}},Jr=(...r)=>{const e=r.reduce((t,n)=>Be(t,n),k);return Qt(e,1/r.length)},as=(r,e)=>{const t=[];for(let n=0;n<r.length;n++){const i=r[n];let s,o,u,h;if(n===0){const f=r[n+1],g=fe(f,i);o=de(g),u=o,h=e}else if(n===r.length-1){const f=r[n-1],g=fe(i,f);s=de(g),u=s,h=e}else{const f=r[n-1],g=r[n+1],d=fe(i,f),B=fe(g,i);s=de(d),o=de(B);const A=Math.acos((d.x*B.x+d.y*B.y)/(Math.hypot(d.x,d.y)*Math.hypot(B.x,B.y))),ue=Math.sin(A/2);ue===0?h=e:h=e/ue,u=Gr(Jr(s,o))}t.push(Qt(u,h))}return t},us=r=>{const e=S(r);return{x:e.y,y:e.x}},ls=Object.freeze(Object.defineProperty({__proto__:null,INFINITY:Ki,NAN:Xi,ONE:Yr,ZERO:k,average:Jr,calculateMiters:as,clientXY:Nr,construct:S,couple:ss,crudeZ:Ot,css:os,distance:ts,equals:Ge,isFinite:is,isNan:ns,isZero:Qi,normal:de,normalize:Gr,scale:Qt,set:es,sub:fe,swap:us,translate:Be,translateX:Zr,translateY:Hr,translation:rs,truncate:Tt,xy:Ne},Symbol.toStringTag,{value:"Module"})),je=a.z.union([a.z.number(),a.z.string()]),hs=a.z.object({top:je,left:je,width:je,height:je}),cs=a.z.object({left:a.z.number(),top:a.z.number(),right:a.z.number(),bottom:a.z.number()}),fs=a.z.object({one:Ne,two:Ne,root:Fr}),Kr={one:k,two:k,root:oe},ds={one:k,two:Yr,root:rt},Xr=(r,e)=>({one:r.one,two:r.two,root:e??r.root}),T=(r,e,t=0,n=0,i)=>{const s={one:{...k},two:{...k},root:i??oe};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return s.one={x:r,y:e},s.two={x:s.one.x+t,y:s.one.y+n},s}return"one"in r&&"two"in r&&"root"in r?{...r,root:i??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(s.one={x:r.left,y:r.top},s.two={x:r.right,y:r.bottom},s):(s.one=r,e==null?s.two={x:s.one.x+t,y:s.one.y+n}:typeof e=="number"?s.two={x:s.one.x+e,y:s.one.y+t}:"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))},gs=(r,e,t)=>{const n=T(r);if(typeof e=="string"){if(t==null)throw new Error("Invalid arguments for resize");const i=W(e);return T(n.one,void 0,i==="x"?t:_(n),i==="y"?t:q(n),n.root)}return T(n.one,e,void 0,void 0,n.root)},ps=(r,e,t=!0)=>{const n=T(r);let i=(s,o)=>s<o;return t&&(i=(s,o)=>s<=o),"one"in e?i(H(n),H(e))&&i(te(e),te(n))&&i(G(n),G(e))&&i(re(e),re(n)):i(H(n),e.x)&&i(e.x,te(n))&&i(G(n),e.y)&&i(e.y,re(n))},ys=(r,e)=>Ge(r.one,e.one)&&Ge(r.two,e.two)&&it(r.root,e.root),Qr=r=>({width:_(r),height:q(r)}),ms=r=>({signedWidth:st(r),signedHeight:ot(r)}),ws=r=>({top:G(r),left:H(r),width:_(r),height:q(r)}),er=(r,e,t=!1)=>{const n=W(e)==="y"?ot(r):st(r);return t?n:Math.abs(n)},D=(r,e)=>{const t=T(r);return{x:e.x==="center"?St(t).x:ne(t,e.x),y:e.y==="center"?St(t).y:ne(t,e.y)}},ne=(r,e)=>{const t=T(r),n=Wr(t.root).includes(e)?Math.min:Math.max;return Xe.includes(e)?n(t.one.x,t.two.x):n(t.one.y,t.two.y)},bs=r=>r.one.x===r.two.x&&r.one.y===r.two.y,_=r=>er(r,"x"),q=r=>er(r,"y"),st=r=>{const e=T(r);return e.two.x-e.one.x},ot=r=>{const e=T(r);return e.two.y-e.one.y},en=r=>D(r,oe),vs=r=>D(r,Gt),$s=r=>D(r,Zt),xs=r=>D(r,rt),Os=r=>D(r,Jt),Ts=r=>D(r,Ht),Ss=r=>D(r,Xt),Is=r=>D(r,Kt),te=r=>ne(r,"right"),re=r=>ne(r,"bottom"),H=r=>ne(r,"left"),G=r=>ne(r,"top"),St=r=>Be(en(r),{x:st(r)/2,y:ot(r)/2}),tr=r=>{const e=T(r);return e.root.x==="left"?H(e):te(e)},rr=r=>{const e=T(r);return e.root.y==="top"?G(e):re(e)},Ns=r=>({x:tr(r),y:rr(r)}),qe=r=>{const e=T(r);return{lower:e.one.x,upper:e.two.x}},We=r=>{const e=T(r);return{lower:e.one.y,upper:e.two.y}},Us=(r,e)=>Xr(r,e),Bs=(r,e)=>{const t=T(r),n=Xe.includes(e)?"x":Qe.includes(e)?"y":null;if(n===null)throw new Error(`Invalid location: ${e}`);const i=e==="top"||e==="left"?Math.min:Math.max,s={...t.one},o={...t.two};return s[n]=i(t.one[n],t.two[n]),o[n]=i(t.one[n],t.two[n]),[s,o]},Es=(r,e)=>{const t=T(r),n=T(e),i=tr(n)+(_(n)-_(t))/2,s=rr(n)+(q(n)-q(t))/2;return T({x:i,y:s},Qr(t))},tn=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,zs=r=>_(r)/q(r),As=(r,e,t)=>{if(typeof e=="string"){if(t==null)throw new Error("Undefined amount passed into box.translate");const i=W(e);e=S(i,t)}const n=T(r);return T(Be(n.one,e),Be(n.two,e),void 0,void 0,n.root)},rn=(r,e)=>{const t=Math.max(H(r),H(e)),n=Math.max(G(r),G(e)),i=Math.min(te(r),te(e)),s=Math.min(re(r),re(e));return t>i||n>s?Kr:T({x:t,y:n},{x:i,y:s},void 0,void 0,r.root)},nn=r=>_(r)*q(r),Ms=(r,e)=>{const t=T(r);return T(Tt(t.one,e),Tt(t.two,e),void 0,void 0,t.root)},sn=(r,e,t,n,i,s)=>{const o={x:r,y:e},u={x:r+t,y:e+n};return i.x!==s.x&&(i.x==="center"?(o.x-=t/2,u.x-=t/2):(o.x-=t,u.x-=t)),i.y!==s.y&&(i.y==="center"?(o.y-=n/2,u.y-=n/2):(o.y-=n,u.y-=n)),T(o,u,void 0,void 0,s)},Cs=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:ds,ZERO:Kr,area:nn,areaIsZero:bs,aspect:zs,bottom:re,bottomCenter:Os,bottomLeft:xs,bottomRight:Ts,box:fs,center:St,centerLeft:Ss,centerRight:Is,construct:T,constructWithAlternateRoot:sn,contains:ps,copy:Xr,css:ws,cssBox:hs,dim:er,dims:Qr,domRect:cs,edgePoints:Bs,equals:ys,height:q,intersection:rn,isBox:tn,left:H,loc:ne,positionInCenter:Es,reRoot:Us,resize:gs,right:te,root:Ns,signedDims:ms,signedHeight:ot,signedWidth:st,top:G,topCenter:vs,topLeft:en,topRight:$s,translate:As,truncate:Ms,width:_,x:tr,xBounds:qe,xyLoc:D,y:rr,yBounds:We},Symbol.toStringTag,{value:"Module"})),on=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()}),Ls=a.z.union([Dt,on,Ne,Ke]),Rs={width:0,height:0},js={width:1,height:1},C=(r,e)=>typeof r=="number"?{width:r,height:e??r}:Array.isArray(r)?{width:r[0],height:r[1]}:"x"in r?{width:r.x,height:r.y}:"signedWidth"in r?{width:r.signedWidth,height:r.signedHeight}:{...r},ks=(r,e)=>{if(e==null)return!1;const t=C(r),n=C(e);return t.width===n.width&&t.height===n.height},Ds=r=>{const e=C(r);return{width:e.height,height:e.width}},Ps=r=>{const e=C(r);return`0 0 ${e.width} ${e.height}`},Fs=r=>{const e=C(r);return[e.width,e.height]},_s=r=>({width:Math.max(...r.map(e=>C(e).width)),height:Math.max(...r.map(e=>C(e).height))}),qs=r=>({width:Math.min(...r.map(e=>C(e).width)),height:Math.min(...r.map(e=>C(e).height))}),Ws=(r,e)=>{const t=C(r);return{width:t.width*e,height:t.height*e}},Vs=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:js,ZERO:Rs,construct:C,couple:Fs,crude:Ls,dimensions:Dt,equals:ks,max:_s,min:qs,scale:Ws,signed:on,svgViewBox:Ps,swap:Ds},Symbol.toStringTag,{value:"Module"}));var Ys=Object.defineProperty,Zs=(r,e,t)=>e in r?Ys(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,F=(r,e,t)=>Zs(r,typeof e!="symbol"?e+"":e,t);const an=(r,e,t)=>e!==void 0&&r<e?e:t!==void 0&&r>t?t:r,Hs=a.z.object({offset:Ot,scale:Ot}),Gs=a.z.object({offset:a.z.number(),scale:a.z.number()}),Js=r=>(e,t,n,i)=>t==="dimension"?[e,n]:[e,i?n-r:n+r],Ks=r=>(e,t,n,i)=>[e,i?n/r:n*r],Xs=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:i,upper:s}=e,{lower:o,upper:u}=r,h=s-i,f=u-o;if(t==="dimension")return[r,n*(f/h)];const g=(n-i)*(f/h)+o;return[r,g]},Qs=r=>(e,t,n)=>[r,n],eo=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:i}=r;return[r,i-(t-n)]},to=r=>(e,t,n)=>{const{lower:i,upper:s}=r;return n=an(n,i,s),[e,n]},It=class ge{constructor(){F(this,"ops",[]),F(this,"currBounds",null),F(this,"currType",null),F(this,"reversed",!1),this.ops=[]}static translate(e){return new ge().translate(e)}static magnify(e){return new ge().magnify(e)}static scale(e,t){return new ge().scale(e,t)}translate(e){const t=this.new(),n=Js(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Ks(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=m(e,t),i=this.new(),s=Xs(n);return s.type="scale",i.ops.push(s),i}clamp(e,t){const n=m(e,t),i=this.new(),s=to(n);return s.type="clamp",i.ops.push(s),i}reBound(e,t){const n=m(e,t),i=this.new(),s=Qs(n);return s.type="re-bound",i.ops.push(s),i}invert(){const e=eo();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 ge;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,i],s)=>s(n,e,i,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,i)=>{if(n.type==="scale"||t.some(([o,u])=>i>=o&&i<=u))return;const s=e.ops.findIndex((o,u)=>o.type==="scale"&&u>i);s!==-1&&t.push([i,s])}),t.forEach(([n,i])=>{const s=e.ops.slice(n,i);s.unshift(e.ops[i]),e.ops.splice(n,i-n+1,...s)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};F(It,"IDENTITY",new It);let Nt=It;const Ut=class P{constructor(e=new Nt,t=new Nt,n=null){F(this,"x"),F(this,"y"),F(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new P().translate(e,t)}static translateX(e){return new P().translateX(e)}static translateY(e){return new P().translateY(e)}static clamp(e){return new P().clamp(e)}static magnify(e){return new P().magnify(e)}static scale(e){return new P().scale(e)}static reBound(e){return new P().reBound(e)}translate(e,t){const n=S(e,t),i=this.copy();return i.x=this.x.translate(n.x),i.y=this.y.translate(n.y),i}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(tn(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!it(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(qe(e)),t.y=t.y.scale(We(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(qe(e)),t.y=this.y.reBound(We(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(qe(e)),t.y=this.y.clamp(We(e)),t}copy(){const e=new P;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 T(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})}}};F(Ut,"IDENTITY",new Ut);let ro=Ut;const no=Object.freeze(Object.defineProperty({__proto__:null,Scale:Nt,XY:ro,crudeXYTransform:Hs,transform:Gs},Symbol.toStringTag,{value:"Module"}));function un(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r)){var i=r.length;for(e=0;e<i;e++)r[e]&&(t=un(r[e]))&&(n&&(n+=" "),n+=t)}else for(t in r)r[t]&&(n&&(n+=" "),n+=t);return n}function ln(){for(var r,e,t=0,n="",i=arguments.length;t<i;t++)(r=arguments[t])&&(e=un(r))&&(n&&(n+=" "),n+=e);return n}const io=ln,fr="-",dr="__",ke="--",nr=r=>{const e=(...t)=>io(...t);return e.B=t=>r+fr+t,e.E=t=>r+dr+t,e.M=t=>r+ke+t,e.BM=(t,n)=>e.B(t)+ke+n,e.BE=(t,n)=>e.B(t)+dr+n,e.BEM=(t,n,i)=>e.BE(t,n)+ke+i,e.extend=t=>nr(e.B(t)),e.var=t=>ke+r+fr+t,e},at=r=>r!=null&&typeof r=="object"&&!Array.isArray(r);var so=Object.defineProperty,oo=(r,e,t)=>e in r?so(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ie=(r,e,t)=>oo(r,typeof e!="symbol"?e+"":e,t);function ao(r){const e=r.length;let t=0,n=0;for(;n<e;){let i=r.charCodeAt(n++);if((i&4294967168)===0){t++;continue}else if((i&4294965248)===0)t+=2;else{if(i>=55296&&i<=56319&&n<e){const s=r.charCodeAt(n);(s&64512)===56320&&(++n,i=((i&1023)<<10)+(s&1023)+65536)}(i&4294901760)===0?t+=3:t+=4}}return t}function uo(r,e,t){const n=r.length;let i=t,s=0;for(;s<n;){let o=r.charCodeAt(s++);if((o&4294967168)===0){e[i++]=o;continue}else if((o&4294965248)===0)e[i++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<n){const u=r.charCodeAt(s);(u&64512)===56320&&(++s,o=((o&1023)<<10)+(u&1023)+65536)}(o&4294901760)===0?(e[i++]=o>>12&15|224,e[i++]=o>>6&63|128):(e[i++]=o>>18&7|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128)}e[i++]=o&63|128}}const lo=new TextEncoder,ho=50;function co(r,e,t){lo.encodeInto(r,e.subarray(t))}function fo(r,e,t){r.length>ho?co(r,e,t):uo(r,e,t)}const go=4096;function hn(r,e,t){let n=e;const i=n+t,s=[];let o="";for(;n<i;){const u=r[n++];if((u&128)===0)s.push(u);else if((u&224)===192){const h=r[n++]&63;s.push((u&31)<<6|h)}else if((u&240)===224){const h=r[n++]&63,f=r[n++]&63;s.push((u&31)<<12|h<<6|f)}else if((u&248)===240){const h=r[n++]&63,f=r[n++]&63,g=r[n++]&63;let d=(u&7)<<18|h<<12|f<<6|g;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(u);s.length>=go&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const po=new TextDecoder,yo=200;function mo(r,e,t){const n=r.subarray(e,e+t);return po.decode(n)}function wo(r,e,t){return t>yo?mo(r,e,t):hn(r,e,t)}let De=class{constructor(e,t){this.type=e,this.data=t}},j=class Bt extends Error{constructor(e){super(e);const t=Object.create(Bt.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Bt.name})}};const le=4294967295;function bo(r,e,t){const n=t/4294967296,i=t;r.setUint32(e,n),r.setUint32(e+4,i)}function cn(r,e,t){const n=Math.floor(t/4294967296),i=t;r.setUint32(e,n),r.setUint32(e+4,i)}function fn(r,e){const t=r.getInt32(e),n=r.getUint32(e+4);return t*4294967296+n}function vo(r,e){const t=r.getUint32(e),n=r.getUint32(e+4);return t*4294967296+n}const $o=-1,xo=4294967296-1,Oo=17179869184-1;function To({sec:r,nsec:e}){if(r>=0&&e>=0&&r<=Oo)if(e===0&&r<=xo){const t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,r),t}else{const t=r/4294967296,n=r&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,e<<2|t&3),s.setUint32(4,n),i}else{const t=new Uint8Array(12),n=new DataView(t.buffer);return n.setUint32(0,e),cn(n,4,r),t}}function So(r){const e=r.getTime(),t=Math.floor(e/1e3),n=(e-t*1e3)*1e6,i=Math.floor(n/1e9);return{sec:t+i,nsec:n-i*1e9}}function Io(r){if(r instanceof Date){const e=So(r);return To(e)}else return null}function No(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),i=(t&3)*4294967296+n,s=t>>>2;return{sec:i,nsec:s}}case 12:{const t=fn(e,4),n=e.getUint32(0);return{sec:t,nsec:n}}default:throw new j(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Uo(r){const e=No(r);return new Date(e.sec*1e3+e.nsec/1e6)}const Bo={type:$o,encode:Io,decode:Uo};let Ee=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Bo)}register({type:e,encode:t,decode:n}){if(e>=0)this.encoders[e]=t,this.decoders[e]=n;else{const i=-1-e;this.builtInEncoders[i]=t,this.builtInDecoders[i]=n}}tryToEncode(e,t){for(let n=0;n<this.builtInEncoders.length;n++){const i=this.builtInEncoders[n];if(i!=null){const s=i(e,t);if(s!=null){const o=-1-n;return new De(o,s)}}}for(let n=0;n<this.encoders.length;n++){const i=this.encoders[n];if(i!=null){const s=i(e,t);if(s!=null){const o=n;return new De(o,s)}}}return e instanceof De?e:null}decode(e,t,n){const i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(e,t,n):new De(t,e)}};Ee.defaultCodec=new Ee;function Eo(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function Et(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):Eo(r)?new Uint8Array(r):Uint8Array.from(r)}const zo=100,Ao=2048;let Mo=class dn{constructor(e){this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??Ee.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)??zo,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??Ao,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 dn({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),i=new DataView(t);n.set(this.bytes),this.view=i,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=ao(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),fo(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=Et(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 i of e)this.doEncode(i,t+1)}countWithoutUndefined(e,t){let n=0;for(const i of t)e[i]!==void 0&&n++;return n}encodeMap(e,t){const n=Object.keys(e);this.sortKeys&&n.sort();const i=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(`Too large map object: ${i}`);for(const s of n){const o=e[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,t+1))}}encodeExtension(e){if(typeof e.data=="function"){const n=e.data(this.pos+6),i=n.length;if(i>=4294967296)throw new Error(`Too large extension object: ${i}`);this.writeU8(201),this.writeU32(i),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),bo(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),cn(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 pe(r,e){return new Mo(e).encodeSharedRef(r)}function dt(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const Co=16,Lo=16;class Ro{constructor(e=Co,t=Lo){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 i=this.caches[n-1];e:for(const s of i){const o=s.bytes;for(let u=0;u<n;u++)if(o[u]!==e[t+u])continue e;return s.str}return null}store(e,t){const n=this.caches[e.length-1],i={bytes:e,str:t};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)}decode(e,t,n){const i=this.find(e,t,n);if(i!=null)return this.hit++,i;this.miss++;const s=hn(e,t,n),o=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(o,s),s}}const zt="array",xe="map_key",gn="map_value",jo=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new j("The type of key must be string or number but "+typeof r)};class ko{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=zt,t.position=0,t.size=e,t.array=new Array(e)}pushMapState(e){const t=this.getUninitializedStateFromPool();t.type=xe,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===zt){const t=e;t.size=0,t.array=void 0,t.position=0,t.type=void 0}if(e.type===xe||e.type===gn){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 he=-1,ir=new DataView(new ArrayBuffer(0)),Do=new Uint8Array(ir.buffer);try{ir.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 gr=new RangeError("Insufficient data"),Po=new Ro;let Fo=class pn{constructor(e){this.totalPos=0,this.pos=0,this.view=ir,this.bytes=Do,this.headByte=he,this.stack=new ko,this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??Ee.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)??le,this.maxBinLength=(e==null?void 0:e.maxBinLength)??le,this.maxArrayLength=(e==null?void 0:e.maxArrayLength)??le,this.maxMapLength=(e==null?void 0:e.maxMapLength)??le,this.maxExtLength=(e==null?void 0:e.maxExtLength)??le,this.keyDecoder=(e==null?void 0:e.keyDecoder)!==void 0?e.keyDecoder:Po,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??jo}clone(){return new pn({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=he,this.stack.reset()}setBuffer(e){const t=Et(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===he&&!this.hasRemaining(1))this.setBuffer(e);else{const t=this.bytes.subarray(this.pos),n=Et(e),i=new Uint8Array(t.length+n.length);i.set(t),i.set(n,t.length),this.setBuffer(i)}}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 u of e){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(u);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:i,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${dt(i)} at ${o} (${s} 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,i=-1;for await(const s of e){if(t&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(i=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==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 i=e-128;if(i!==0){this.pushMapState(i),this.complete();continue e}else t={}}else if(e<160){const i=e-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else t=[]}else{const i=e-160;t=this.decodeString(i,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 i=this.lookU8();t=this.decodeString(i,1)}else if(e===218){const i=this.lookU16();t=this.decodeString(i,2)}else if(e===219){const i=this.lookU32();t=this.decodeString(i,4)}else if(e===220){const i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else t=[]}else if(e===221){const i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue e}else t=[]}else if(e===222){const i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else t={}}else if(e===223){const i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else t={}}else if(e===196){const i=this.lookU8();t=this.decodeBinary(i,1)}else if(e===197){const i=this.lookU16();t=this.decodeBinary(i,2)}else if(e===198){const i=this.lookU32();t=this.decodeBinary(i,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 i=this.lookU8();t=this.decodeExtension(i,1)}else if(e===200){const i=this.lookU16();t=this.decodeExtension(i,2)}else if(e===201){const i=this.lookU32();t=this.decodeExtension(i,4)}else throw new j(`Unrecognized type byte: ${dt(e)}`);this.complete();const n=this.stack;for(;n.length>0;){const i=n.top();if(i.type===zt)if(i.array[i.position]=t,i.position++,i.position===i.size)t=i.array,n.release(i);else continue e;else if(i.type===xe){if(t==="__proto__")throw new j("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=gn;continue e}else if(i.map[i.key]=t,i.readCount++,i.readCount===i.size)t=i.map,n.release(i);else{i.key=null,i.type=xe;continue e}}return t}}readHeadByte(){return this.headByte===he&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=he}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 j(`Unrecognized array type byte: ${dt(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new j(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new j(`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 j(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw gr;const i=this.pos+t;let s;return this.stateIsMapKey()&&(n=this.keyDecoder)!=null&&n.canBeCached(e)?s=this.keyDecoder.decode(this.bytes,i,e):s=wo(this.bytes,i,e),this.pos+=t+e,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===xe:!1}decodeBinary(e,t){if(e>this.maxBinLength)throw new j(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw gr;const n=this.pos+t,i=this.bytes.subarray(n,n+e);return this.pos+=t+e,i}decodeExtension(e,t){if(e>this.maxExtLength)throw new j(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+t),i=this.decodeBinary(e,t+1);return this.extensionCodec.decode(i,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=vo(this.view,this.pos);return this.pos+=8,e}readI64(){const e=fn(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 yn(r,e){return new Fo(e).decode(r)}let _o=class{constructor(){ie(this,"contentType","application/json"),ie(this,"decoder"),ie(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),i=tt(n);return t!=null?t.parse(i):i}encodeString(e){const t=Yt(e);return JSON.stringify(t,(n,i)=>ArrayBuffer.isView(i)?Array.from(i):at(i)&&"encode_value"in i?typeof i.value=="bigint"?i.value.toString():i.value:typeof i=="bigint"?i.toString():i)}static registerCustomType(){}},qo=class{constructor(){ie(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||!at(e[0]))throw new Error("Payload must be an array of objects");const t=Object.keys(e[0]),n=[t.join(",")];return e.forEach(i=>{const s=t.map(o=>JSON.stringify(i[o]??""));n.push(s.join(","))}),n.join(`
2
2
  `)}decodeString(e,t){const[n,...i]=e.trim().split(`
3
- `).map(u=>u.trim());if(n.length===0)return t!=null?t.parse({}):{};const s=n.split(",").map(u=>u.trim()),o={};return s.forEach(u=>{o[u]=[]}),i.forEach(u=>{const h=u.split(",").map(f=>f.trim());s.forEach((f,g)=>{const d=this.parseValue(h[g]);d!=null&&o[f].push(d)})}),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(){}},qo=class{constructor(){ie(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 Z=new Ee;Z.register({type:0,encode:r=>{if(ArrayBuffer.isView(r)){const e=Array.from(r);return pe(e,{extensionCodec:Z})}return at(r)&&"encode_value"in r?typeof r.value=="bigint"?pe(r.value.toString(),{extensionCodec:Z}):pe(r.value,{extensionCodec:Z}):typeof r=="bigint"?pe(r.toString(),{extensionCodec:Z}):null},decode:r=>yn(r,{extensionCodec:Z})});let Wo=class{constructor(){ie(this,"contentType","application/msgpack")}encode(e){const t=Yt(e);return pe(t,{extensionCodec:Z}).slice()}decode(e,t){const n=yn(e,{extensionCodec:Z}),i=tt(n);return t!=null?t.parse(i):i}static registerCustomType(){}};const Ye=new Fo;new _o;new qo;new Wo;const zt=r=>[...new Set(r)],Yo=(r,e,t=!0)=>{const n=new Map;return r.forEach(i=>{const s=e(i);if(n.has(s)){if(t)return;n.delete(s)}n.set(s,i)}),Array.from(n.values())},Vo=Object.freeze(Object.defineProperty({__proto__:null,by:Yo,unique:zt},Symbol.toStringTag,{value:"Module"})),mn=r=>r!=null&&typeof r=="object"&&"toString"in r,Zo=r=>{if(mn(r))return(r==null?void 0:r.toString().length)===0;switch(typeof r){case"string":return r.length===0;case"number":return r===0;case"bigint":return r===0n;case"boolean":return!r;case"undefined":return!0;case"object":return!0}},ut=(r,e=!1)=>{const t=mn(r)?"stringer":typeof r;let n;switch(t){case"string":n=(i,s)=>i.localeCompare(s);break;case"stringer":n=(i,s)=>i.toString().localeCompare(s.toString());break;case"number":n=(i,s)=>Number(i)-Number(s);break;case"bigint":n=(i,s)=>BigInt(i)-BigInt(s)>0n?1:-1;break;case"boolean":n=(i,s)=>Number(i)-Number(s);break;case"undefined":n=()=>0;break;default:return console.warn(`sortFunc: unknown type ${t}`),()=>-1}return e?bn(n):n},Ho=(r,e,t)=>{const n=ut(e[r],t);return(i,s)=>n(i[r],s[r])},Go=(r,e)=>r.length!==e.length?r.length-e.length:r.every((t,n)=>t===e[n])?0:-1,wn=(r,e)=>{if(r.length!==e.length)return r.length-e.length;if(r.length===0)return 0;const t=ut(r[0]),n=[...r].sort(t),i=[...e].sort(t);return n.every((s,o)=>s===i[o])?0:-1},Ko=(r,e)=>{const t=zt(r),n=zt(e);return wn(t,n)},Jo=(r,e)=>r===e?0:r==="first"&&e==="last"?1:-1,bn=r=>(e,t)=>r(t,e),ae=0,Ve=-1,Ze=1,vn=r=>r<ae,$n=r=>r>ae,Xo=r=>r>=ae,xn=r=>r===ae,Qo=(r,e)=>{const t=/([a-zA-Z]+)|(\d+)/g,n=r.replace(/[\s_.-]+/g,"").match(t),i=e.replace(/[\s_.-]+/g,"").match(t);if(!n||!i)return 0;for(let s=0;s<Math.min(n.length,i.length);s++){const o=n[s],u=i[s];if(isNaN(Number(o))&&isNaN(Number(u))){const h=o.localeCompare(u);if(h!==0)return h}else if(!isNaN(Number(o))&&!isNaN(Number(u))){const h=Number(o)-Number(u);if(h!==0)return h}else return isNaN(Number(o))?-1:1}return n.length-i.length},ea=Object.freeze(Object.defineProperty({__proto__:null,EQUAL:ae,GREATER_THAN:Ze,LESS_THAN:Ve,isEqualTo:xn,isGreaterThan:$n,isGreaterThanEqual:Xo,isLessThan:vn,newF:ut,newFieldF:Ho,order:Jo,primitiveArrays:Go,reverseF:bn,stringsWithNumbers:Qo,uniqueUnorderedPrimitiveArrays:Ko,unorderedPrimitiveArrays:wn},Symbol.toStringTag,{value:"Module"}));var ta=Object.defineProperty,ra=(r,e,t)=>e in r?ta(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l=(r,e,t)=>ra(r,typeof e!="symbol"?e+"":e,t);let na=(r,e=21)=>(t=e)=>{let n="",i=t|0;for(;i--;)n+=r[Math.random()*r.length|0];return n};const ia="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",sa=na(ia,11),On=()=>sa(),oa=Object.freeze(Object.defineProperty({__proto__:null,create:On},Symbol.toStringTag,{value:"Module"})),aa=a.z.enum(["static","dynamic"]),Tn=(r,e)=>{const t=new $(e);if(![O.DAY,O.HOUR,O.MINUTE,O.SECOND,O.MILLISECOND,O.MICROSECOND,O.NANOSECOND].some(i=>i.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof $?new $(n):new O(n)},b=class p{constructor(e,t="UTC"){if(l(this,"value"),l(this,"encodeValue",!0),e==null)this.value=p.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*p.MILLISECOND.valueOf();else if(typeof e=="string")this.value=p.parseDateTimeString(e,t).valueOf();else if(Array.isArray(e))this.value=p.parseDate(e);else{let n=BigInt(0);e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=p.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=p.MAX:e=p.MIN)),this.value=BigInt(e.valueOf())+n}}static parseDate([e=1970,t=1,n=1]){const i=new Date(e,t-1,n,0,0,0,0);return new p(BigInt(i.getTime())*p.MILLISECOND.valueOf()).truncate(p.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[n,i,s]=e.split(":");let o="00",u="00";s!=null&&([o,u]=s.split("."));let h=p.hours(parseInt(n??"00")).add(p.minutes(parseInt(i??"00"))).add(p.seconds(parseInt(o??"00"))).add(p.milliseconds(parseInt(u??"00")));return t==="local"&&(h=h.add(p.utcOffset)),h.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return p.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new p(BigInt(n.getTime())*p.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(p.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(){const e=this.date(),t=e.toLocaleString("default",{month:"short"}),n=e.toLocaleString("default",{day:"numeric"});return`${t} ${n}`}static get utcOffset(){return new O(BigInt(new Date().getTimezoneOffset())*p.MINUTE.valueOf())}static since(e){return new p().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new p(e).valueOf()}span(e){return this.range(e).span}range(e){return new K(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 p(e).valueOf()}afterEq(e){return this.valueOf()>=new p(e).valueOf()}before(e){return this.valueOf()<new p(e).valueOf()}beforeEq(e){return this.valueOf()<=new p(e).valueOf()}add(e){return new p(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new p(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(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(p.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(p.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 p(t)}get month(){return this.date().getUTCMonth()}setMonth(e){const t=this.date();return t.setUTCMonth(e),new p(t)}get day(){return this.date().getUTCDate()}setDay(e){const t=this.date();return t.setUTCDate(e),new p(t)}get hour(){return this.date().getUTCHours()}setHour(e){const t=this.date();return t.setUTCHours(e),new p(t,"UTC")}get minute(){return this.date().getMinutes()}setMinute(e){const t=this.date();return t.setUTCMinutes(e),new p(t)}get second(){return this.date().getSeconds()}setSecond(e){const t=this.date();return t.setUTCSeconds(e),new p(t)}get millisecond(){return this.date().getMilliseconds()}setMillisecond(e){const t=this.date();return t.setMilliseconds(e),new p(t)}toString(){return this.date().toISOString()}remainder(e){return Tn(this,e)}get isToday(){return this.truncate(O.DAY).equals(p.now().truncate(O.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new p(new Date)}static max(...e){let t=p.MIN;for(const n of e){const i=new p(n);i.after(t)&&(t=i)}return t}static min(...e){let t=p.MAX;for(const n of e){const i=new p(n);i.before(t)&&(t=i)}return t}static nanoseconds(e,t="UTC"){return new p(e,t)}static microseconds(e,t="UTC"){return p.nanoseconds(e*1e3,t)}static milliseconds(e,t="UTC"){return p.microseconds(e*1e3,t)}static seconds(e,t="UTC"){return p.milliseconds(e*1e3,t)}static minutes(e,t="UTC"){return p.seconds(e*60,t)}static hours(e,t="UTC"){return p.minutes(e*60,t)}static days(e,t="UTC"){return p.hours(e*24,t)}};l(b,"NANOSECOND",b.nanoseconds(1)),l(b,"MICROSECOND",b.microseconds(1)),l(b,"MILLISECOND",b.milliseconds(1)),l(b,"SECOND",b.seconds(1)),l(b,"MINUTE",b.minutes(1)),l(b,"HOUR",b.hours(1)),l(b,"DAY",b.days(1)),l(b,"MAX",new b((1n<<63n)-1n)),l(b,"MIN",new b(0)),l(b,"ZERO",new b(0)),l(b,"z",a.z.union([a.z.object({value:a.z.bigint()}).transform(r=>new b(r.value)),a.z.string().transform(r=>new b(BigInt(r))),a.z.instanceof(Number).transform(r=>new b(r)),a.z.number().transform(r=>new b(r)),a.z.instanceof(b)]));let $=b;const v=class y{constructor(e){l(this,"value"),l(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}static fromSeconds(e){return e instanceof y?e:e instanceof At?e.period:e instanceof $?new y(e):["number","bigint"].includes(typeof e)?y.seconds(e):new y(e)}static fromMilliseconds(e){return e instanceof y?e:e instanceof At?e.period:e instanceof $?new y(e):["number","bigint"].includes(typeof e)?y.milliseconds(e):new y(e)}encode(){return this.value.toString()}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 Tn(this,e)}truncate(e){return new y(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(y.DAY),t=this.truncate(y.HOUR),n=this.truncate(y.MINUTE),i=this.truncate(y.SECOND),s=this.truncate(y.MILLISECOND),o=this.truncate(y.MICROSECOND),u=this.truncate(y.NANOSECOND),h=e,f=t.sub(e),g=n.sub(t),d=i.sub(n),B=s.sub(i),A=o.sub(s),ue=u.sub(o);let Y="";return h.isZero||(Y+=`${h.days}d `),f.isZero||(Y+=`${f.hours}h `),g.isZero||(Y+=`${g.minutes}m `),d.isZero||(Y+=`${d.seconds}s `),B.isZero||(Y+=`${B.milliseconds}ms `),A.isZero||(Y+=`${A.microseconds}µs `),ue.isZero||(Y+=`${ue.nanoseconds}ns`),Y.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(Q(e,1e3))}static milliseconds(e=1){return y.microseconds(Q(e,1e3))}static seconds(e=1){return y.milliseconds(Q(e,1e3))}static minutes(e=1){return y.seconds(Q(e,60))}static hours(e){return y.minutes(Q(e,60))}static days(e){return y.hours(Q(e,24))}};l(v,"NANOSECOND",v.nanoseconds(1)),l(v,"MICROSECOND",v.microseconds(1)),l(v,"MILLISECOND",v.milliseconds(1)),l(v,"SECOND",v.seconds(1)),l(v,"MINUTE",v.minutes(1)),l(v,"HOUR",v.hours(1)),l(v,"DAY",v.days(1)),l(v,"MAX",new v((1n<<63n)-1n)),l(v,"MIN",new v(0)),l(v,"ZERO",new v(0)),l(v,"z",a.z.union([a.z.object({value:a.z.bigint()}).transform(r=>new v(r.value)),a.z.string().transform(r=>new v(BigInt(r))),a.z.instanceof(Number).transform(r=>new v(r)),a.z.number().transform(r=>new v(r)),a.z.instanceof(v)]));let O=v;const ye=class He extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new He(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 z(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 He(e)}static khz(e){return He.hz(e*1e3)}};l(ye,"z",a.z.union([a.z.number().transform(r=>new ye(r)),a.z.instanceof(Number).transform(r=>new ye(r)),a.z.instanceof(ye)]));let At=ye;const U=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new ze(e*this.valueOf())}};l(U,"UNKNOWN",new U(0)),l(U,"BIT128",new U(16)),l(U,"BIT64",new U(8)),l(U,"BIT32",new U(4)),l(U,"BIT16",new U(2)),l(U,"BIT8",new U(1)),l(U,"z",a.z.union([a.z.number().transform(r=>new U(r)),a.z.instanceof(Number).transform(r=>new U(r)),a.z.instanceof(U)]));let z=U;const L=class me{constructor(e,t){l(this,"start"),l(this,"end"),typeof e=="object"&&"start"in e?(this.start=new $(e.start),this.end=new $(e.end)):(this.start=new $(e),this.end=new $(t))}get span(){return new 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 me(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(),i=this.end.sub(e.end).valueOf();return n<0&&(n=-n),i<0&&(i=-i),n<=t.valueOf()&&i<=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 i=$.max(n.start,e.start),s=$.min(n.end,e.end);return s.before(i)?!1:new O(s.sub(i)).greaterThanOrEqual(t)}contains(e){return e instanceof me?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new me(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 me($.min(...e.map(t=>t.start)),$.max(...e.map(t=>t.end)))}};l(L,"MAX",new L($.MIN,$.MAX)),l(L,"MIN",new L($.MAX,$.MIN)),l(L,"ZERO",new L($.ZERO,$.ZERO)),l(L,"z",a.z.union([a.z.object({start:$.z,end:$.z}).transform(r=>new L(r.start,r.end)),a.z.instanceof(L)]));let K=L;const c=class I{constructor(e){if(l(this,"value"),l(this,"encodeValue",!0),e instanceof I||typeof e=="string"||typeof e.valueOf()=="string"){this.value=e.valueOf();return}const t=I.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){this.value=t.valueOf();return}throw this.value=I.UNKNOWN.valueOf(),new Error(`unable to find data type for ${e.toString()}`)}valueOf(){return this.value}get Array(){const e=I.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(I.JSON)||this.equals(I.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(I.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=I.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsigned(){return this.equals(I.UINT8)||this.equals(I.UINT16)||this.equals(I.UINT32)||this.equals(I.UINT64)}get isSigned(){return this.equals(I.INT8)||this.equals(I.INT16)||this.equals(I.INT32)||this.equals(I.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(I.INT32)&&e.equals(I.FLOAT64)||this.equals(I.INT8)&&e.equals(I.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 I.BIG_INT_TYPES.some(e=>e.equals(this))}};l(c,"UNKNOWN",new c("unknown")),l(c,"FLOAT64",new c("float64")),l(c,"FLOAT32",new c("float32")),l(c,"INT64",new c("int64")),l(c,"INT32",new c("int32")),l(c,"INT16",new c("int16")),l(c,"INT8",new c("int8")),l(c,"UINT64",new c("uint64")),l(c,"UINT32",new c("uint32")),l(c,"UINT16",new c("uint16")),l(c,"UINT8",new c("uint8")),l(c,"BOOLEAN",c.UINT8),l(c,"TIMESTAMP",new c("timestamp")),l(c,"UUID",new c("uuid")),l(c,"STRING",new c("string")),l(c,"JSON",new c("json")),l(c,"ARRAY_CONSTRUCTORS",new Map([[c.UINT8.toString(),Uint8Array],[c.UINT16.toString(),Uint16Array],[c.UINT32.toString(),Uint32Array],[c.UINT64.toString(),BigUint64Array],[c.FLOAT32.toString(),Float32Array],[c.FLOAT64.toString(),Float64Array],[c.INT8.toString(),Int8Array],[c.INT16.toString(),Int16Array],[c.INT32.toString(),Int32Array],[c.INT64.toString(),BigInt64Array],[c.TIMESTAMP.toString(),BigInt64Array],[c.STRING.toString(),Uint8Array],[c.JSON.toString(),Uint8Array],[c.UUID.toString(),Uint8Array]])),l(c,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,c.UINT8],[Uint16Array.name,c.UINT16],[Uint32Array.name,c.UINT32],[BigUint64Array.name,c.UINT64],[Float32Array.name,c.FLOAT32],[Float64Array.name,c.FLOAT64],[Int8Array.name,c.INT8],[Int16Array.name,c.INT16],[Int32Array.name,c.INT32],[BigInt64Array.name,c.INT64]])),l(c,"DENSITIES",new Map([[c.UINT8.toString(),z.BIT8],[c.UINT16.toString(),z.BIT16],[c.UINT32.toString(),z.BIT32],[c.UINT64.toString(),z.BIT64],[c.FLOAT32.toString(),z.BIT32],[c.FLOAT64.toString(),z.BIT64],[c.INT8.toString(),z.BIT8],[c.INT16.toString(),z.BIT16],[c.INT32.toString(),z.BIT32],[c.INT64.toString(),z.BIT64],[c.TIMESTAMP.toString(),z.BIT64],[c.STRING.toString(),z.UNKNOWN],[c.JSON.toString(),z.UNKNOWN],[c.UUID.toString(),z.BIT128]])),l(c,"ALL",[c.UNKNOWN,c.FLOAT64,c.FLOAT32,c.INT64,c.INT32,c.INT16,c.INT8,c.UINT64,c.UINT32,c.UINT16,c.UINT8,c.TIMESTAMP,c.UUID,c.STRING,c.JSON]),l(c,"BIG_INT_TYPES",[c.INT64,c.UINT64,c.TIMESTAMP]),l(c,"z",a.z.union([a.z.string().transform(r=>new c(r)),a.z.instanceof(c)]));let w=c;const E=class N extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return N.bytes(this.valueOf()+e.valueOf())}sub(e){return N.bytes(this.valueOf()-e.valueOf())}truncate(e){return new N(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return N.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/N.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/N.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/N.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/N.TERABYTE.valueOf()}toString(){const e=this.truncate(N.TERABYTE),t=this.truncate(N.GIGABYTE),n=this.truncate(N.MEGABYTE),i=this.truncate(N.KILOBYTE),s=this.truncate(N.BYTE),o=e,u=t.sub(e),h=n.sub(t),f=i.sub(n),g=s.sub(i);let d="";return o.isZero||(d+=`${o.terabytes}TB `),u.isZero||(d+=`${u.gigabytes}GB `),h.isZero||(d+=`${h.megabytes}MB `),f.isZero||(d+=`${f.kilobytes}KB `),(!g.isZero||d==="")&&(d+=`${g.valueOf()}B`),d.trim()}static bytes(e=1){return new N(e)}static kilobytes(e=1){return N.bytes(e.valueOf()*1e3)}static megabytes(e=1){return N.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return N.megabytes(e.valueOf()*1e3)}static terabytes(e){return N.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};l(E,"BYTE",new E(1)),l(E,"KILOBYTE",E.kilobytes(1)),l(E,"MEGABYTE",E.megabytes(1)),l(E,"GIGABYTE",E.gigabytes(1)),l(E,"TERABYTE",E.terabytes(1)),l(E,"ZERO",new E(0)),l(E,"z",a.z.union([a.z.number().transform(r=>new E(r)),a.z.instanceof(E)]));let ze=E;const ua=a.z.union([a.z.instanceof(Uint8Array),a.z.instanceof(Uint16Array),a.z.instanceof(Uint32Array),a.z.instanceof(BigUint64Array),a.z.instanceof(Float32Array),a.z.instanceof(Float64Array),a.z.instanceof(Int8Array),a.z.instanceof(Int16Array),a.z.instanceof(Int32Array),a.z.instanceof(BigInt64Array)]),Sn=r=>{const e=typeof r;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||r instanceof $||r instanceof O||r instanceof Date},la=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t.valueOf())-BigInt(n.valueOf()):we(t,-n).valueOf(),we=(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),ha=r=>r==null?!1:Array.isArray(r)||r instanceof ArrayBuffer||ArrayBuffer.isView(r)&&!(r instanceof DataView)||r instanceof Nn?!0:Sn(r),V=-1,Mt={[Symbol.iterator]:()=>Mt,next:()=>({done:!0,value:void 0})},ca=a.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer),fa=a.z.union([a.z.null(),a.z.undefined()]).transform(()=>new Uint8Array().buffer),Ct=10,In=(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`)},be=class R{constructor(e){l(this,"key",""),l(this,"isSynnaxSeries",!0),l(this,"dataType"),l(this,"sampleOffset"),l(this,"gl"),l(this,"_data"),l(this,"timeRange",K.ZERO),l(this,"alignment",0n),l(this,"_cachedMin"),l(this,"_cachedMax"),l(this,"writePos",V),l(this,"_refCount",0),l(this,"_cachedLength"),l(this,"_cachedIndexes"),ha(e)&&(e={data:e});const{dataType:t,timeRange:n,sampleOffset:i=0,glBufferUsage:s="static",alignment:o=0n,key:u=On()}=e,h=e.data??[];if(h instanceof R||typeof h=="object"&&"isSynnaxSeries"in h&&h.isSynnaxSeries===!0){const d=h;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 f=Sn(h),g=Array.isArray(h);if(t!=null)this.dataType=new w(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(g||f){let d=h;if(!f){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.");d=h[0]}if(typeof d=="string")this.dataType=w.STRING;else if(typeof d=="number")this.dataType=w.FLOAT64;else if(typeof d=="bigint")this.dataType=w.INT64;else if(typeof d=="boolean")this.dataType=w.BOOLEAN;else if(d instanceof $||d instanceof Date||d instanceof $)this.dataType=w.TIMESTAMP;else if(typeof d=="object")this.dataType=w.JSON;else throw new Error(`cannot infer data type of ${typeof d} when constructing a Series from a JS array`)}else this.dataType=new w(h)}if(!g&&!f)this._data=h;else{let d=f?[h]:h;const B=d[0];(B instanceof $||B instanceof Date||B instanceof O)&&(d=d.map(A=>new $(A).valueOf())),this.dataType.equals(w.STRING)?(this._cachedLength=d.length,this._data=new TextEncoder().encode(`${d.join(`
3
+ `).map(u=>u.trim());if(n.length===0)return t!=null?t.parse({}):{};const s=n.split(",").map(u=>u.trim()),o={};return s.forEach(u=>{o[u]=[]}),i.forEach(u=>{const h=u.split(",").map(f=>f.trim());s.forEach((f,g)=>{const d=this.parseValue(h[g]);d!=null&&o[f].push(d)})}),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(){}},Wo=class{constructor(){ie(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 Z=new Ee;Z.register({type:0,encode:r=>{if(ArrayBuffer.isView(r)){const e=Array.from(r);return pe(e,{extensionCodec:Z})}return at(r)&&"encode_value"in r?typeof r.value=="bigint"?pe(r.value.toString(),{extensionCodec:Z}):pe(r.value,{extensionCodec:Z}):typeof r=="bigint"?pe(r.toString(),{extensionCodec:Z}):null},decode:r=>yn(r,{extensionCodec:Z})});let Vo=class{constructor(){ie(this,"contentType","application/msgpack")}encode(e){const t=Yt(e);return pe(t,{extensionCodec:Z}).slice()}decode(e,t){const n=yn(e,{extensionCodec:Z}),i=tt(n);return t!=null?t.parse(i):i}static registerCustomType(){}};const Ve=new _o;new qo;new Wo;new Vo;const At=r=>[...new Set(r)],Yo=(r,e,t=!0)=>{const n=new Map;return r.forEach(i=>{const s=e(i);if(n.has(s)){if(t)return;n.delete(s)}n.set(s,i)}),Array.from(n.values())},Zo=Object.freeze(Object.defineProperty({__proto__:null,by:Yo,unique:At},Symbol.toStringTag,{value:"Module"})),mn=r=>r!=null&&typeof r=="object"&&"toString"in r,Ho=r=>{if(mn(r))return(r==null?void 0:r.toString().length)===0;switch(typeof r){case"string":return r.length===0;case"number":return r===0;case"bigint":return r===0n;case"boolean":return!r;case"undefined":return!0;case"object":return!0}},ut=(r,e=!1)=>{const t=mn(r)?"stringer":typeof r;let n;switch(t){case"string":n=(i,s)=>i.localeCompare(s);break;case"stringer":n=(i,s)=>i.toString().localeCompare(s.toString());break;case"number":n=(i,s)=>Number(i)-Number(s);break;case"bigint":n=(i,s)=>BigInt(i)-BigInt(s)>0n?1:-1;break;case"boolean":n=(i,s)=>Number(i)-Number(s);break;case"undefined":n=()=>0;break;default:return console.warn(`sortFunc: unknown type ${t}`),()=>-1}return e?bn(n):n},Go=(r,e,t)=>{const n=ut(e[r],t);return(i,s)=>n(i[r],s[r])},Jo=(r,e)=>r.length!==e.length?r.length-e.length:r.every((t,n)=>t===e[n])?0:-1,wn=(r,e)=>{if(r.length!==e.length)return r.length-e.length;if(r.length===0)return 0;const t=ut(r[0]),n=[...r].sort(t),i=[...e].sort(t);return n.every((s,o)=>s===i[o])?0:-1},Ko=(r,e)=>{const t=At(r),n=At(e);return wn(t,n)},Xo=(r,e)=>r===e?0:r==="first"&&e==="last"?1:-1,bn=r=>(e,t)=>r(t,e),ae=0,Ye=-1,Ze=1,vn=r=>r<ae,$n=r=>r>ae,Qo=r=>r>=ae,xn=r=>r===ae,ea=(r,e)=>{const t=/([a-zA-Z]+)|(\d+)/g,n=r.replace(/[\s_.-]+/g,"").match(t),i=e.replace(/[\s_.-]+/g,"").match(t);if(!n||!i)return 0;for(let s=0;s<Math.min(n.length,i.length);s++){const o=n[s],u=i[s];if(isNaN(Number(o))&&isNaN(Number(u))){const h=o.localeCompare(u);if(h!==0)return h}else if(!isNaN(Number(o))&&!isNaN(Number(u))){const h=Number(o)-Number(u);if(h!==0)return h}else return isNaN(Number(o))?-1:1}return n.length-i.length},ta=Object.freeze(Object.defineProperty({__proto__:null,EQUAL:ae,GREATER_THAN:Ze,LESS_THAN:Ye,isEqualTo:xn,isGreaterThan:$n,isGreaterThanEqual:Qo,isLessThan:vn,newF:ut,newFieldF:Go,order:Xo,primitiveArrays:Jo,reverseF:bn,stringsWithNumbers:ea,uniqueUnorderedPrimitiveArrays:Ko,unorderedPrimitiveArrays:wn},Symbol.toStringTag,{value:"Module"}));var ra=Object.defineProperty,na=(r,e,t)=>e in r?ra(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l=(r,e,t)=>na(r,typeof e!="symbol"?e+"":e,t);let ia=(r,e=21)=>(t=e)=>{let n="",i=t|0;for(;i--;)n+=r[Math.random()*r.length|0];return n};const sa="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",oa=ia(sa,11),On=()=>oa(),aa=Object.freeze(Object.defineProperty({__proto__:null,create:On},Symbol.toStringTag,{value:"Module"})),ua=a.z.enum(["static","dynamic"]),Tn=(r,e)=>{const t=new $(e);if(![O.DAY,O.HOUR,O.MINUTE,O.SECOND,O.MILLISECOND,O.MICROSECOND,O.NANOSECOND].some(i=>i.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof $?new $(n):new O(n)},b=class p{constructor(e,t="UTC"){if(l(this,"value"),l(this,"encodeValue",!0),e==null)this.value=p.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*p.MILLISECOND.valueOf();else if(typeof e=="string")this.value=p.parseDateTimeString(e,t).valueOf();else if(Array.isArray(e))this.value=p.parseDate(e);else{let n=BigInt(0);e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=p.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=p.MAX:e=p.MIN)),this.value=BigInt(e.valueOf())+n}}static parseDate([e=1970,t=1,n=1]){const i=new Date(e,t-1,n,0,0,0,0);return new p(BigInt(i.getTime())*p.MILLISECOND.valueOf()).truncate(p.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[n,i,s]=e.split(":");let o="00",u="00";s!=null&&([o,u]=s.split("."));let h=p.hours(parseInt(n??"00")).add(p.minutes(parseInt(i??"00"))).add(p.seconds(parseInt(o??"00"))).add(p.milliseconds(parseInt(u??"00")));return t==="local"&&(h=h.add(p.utcOffset)),h.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return p.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new p(BigInt(n.getTime())*p.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(p.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(){const e=this.date(),t=e.toLocaleString("default",{month:"short"}),n=e.toLocaleString("default",{day:"numeric"});return`${t} ${n}`}static get utcOffset(){return new O(BigInt(new Date().getTimezoneOffset())*p.MINUTE.valueOf())}static since(e){return new p().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new p(e).valueOf()}span(e){return this.range(e).span}range(e){return new J(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 p(e).valueOf()}afterEq(e){return this.valueOf()>=new p(e).valueOf()}before(e){return this.valueOf()<new p(e).valueOf()}beforeEq(e){return this.valueOf()<=new p(e).valueOf()}add(e){return new p(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new p(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(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(p.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(p.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 p(t)}get month(){return this.date().getUTCMonth()}setMonth(e){const t=this.date();return t.setUTCMonth(e),new p(t)}get day(){return this.date().getUTCDate()}setDay(e){const t=this.date();return t.setUTCDate(e),new p(t)}get hour(){return this.date().getUTCHours()}setHour(e){const t=this.date();return t.setUTCHours(e),new p(t,"UTC")}get minute(){return this.date().getMinutes()}setMinute(e){const t=this.date();return t.setUTCMinutes(e),new p(t)}get second(){return this.date().getSeconds()}setSecond(e){const t=this.date();return t.setUTCSeconds(e),new p(t)}get millisecond(){return this.date().getMilliseconds()}setMillisecond(e){const t=this.date();return t.setMilliseconds(e),new p(t)}toString(){return this.date().toISOString()}remainder(e){return Tn(this,e)}get isToday(){return this.truncate(O.DAY).equals(p.now().truncate(O.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new p(new Date)}static max(...e){let t=p.MIN;for(const n of e){const i=new p(n);i.after(t)&&(t=i)}return t}static min(...e){let t=p.MAX;for(const n of e){const i=new p(n);i.before(t)&&(t=i)}return t}static nanoseconds(e,t="UTC"){return new p(e,t)}static microseconds(e,t="UTC"){return p.nanoseconds(e*1e3,t)}static milliseconds(e,t="UTC"){return p.microseconds(e*1e3,t)}static seconds(e,t="UTC"){return p.milliseconds(e*1e3,t)}static minutes(e,t="UTC"){return p.seconds(e*60,t)}static hours(e,t="UTC"){return p.minutes(e*60,t)}static days(e,t="UTC"){return p.hours(e*24,t)}};l(b,"NANOSECOND",b.nanoseconds(1)),l(b,"MICROSECOND",b.microseconds(1)),l(b,"MILLISECOND",b.milliseconds(1)),l(b,"SECOND",b.seconds(1)),l(b,"MINUTE",b.minutes(1)),l(b,"HOUR",b.hours(1)),l(b,"DAY",b.days(1)),l(b,"MAX",new b((1n<<63n)-1n)),l(b,"MIN",new b(0)),l(b,"ZERO",new b(0)),l(b,"z",a.z.union([a.z.object({value:a.z.bigint()}).transform(r=>new b(r.value)),a.z.string().transform(r=>new b(BigInt(r))),a.z.instanceof(Number).transform(r=>new b(r)),a.z.number().transform(r=>new b(r)),a.z.instanceof(b)]));let $=b;const v=class y{constructor(e){l(this,"value"),l(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}static fromSeconds(e){return e instanceof y?e:e instanceof Mt?e.period:e instanceof $?new y(e):["number","bigint"].includes(typeof e)?y.seconds(e):new y(e)}static fromMilliseconds(e){return e instanceof y?e:e instanceof Mt?e.period:e instanceof $?new y(e):["number","bigint"].includes(typeof e)?y.milliseconds(e):new y(e)}encode(){return this.value.toString()}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 Tn(this,e)}truncate(e){return new y(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(y.DAY),t=this.truncate(y.HOUR),n=this.truncate(y.MINUTE),i=this.truncate(y.SECOND),s=this.truncate(y.MILLISECOND),o=this.truncate(y.MICROSECOND),u=this.truncate(y.NANOSECOND),h=e,f=t.sub(e),g=n.sub(t),d=i.sub(n),B=s.sub(i),A=o.sub(s),ue=u.sub(o);let V="";return h.isZero||(V+=`${h.days}d `),f.isZero||(V+=`${f.hours}h `),g.isZero||(V+=`${g.minutes}m `),d.isZero||(V+=`${d.seconds}s `),B.isZero||(V+=`${B.milliseconds}ms `),A.isZero||(V+=`${A.microseconds}µs `),ue.isZero||(V+=`${ue.nanoseconds}ns`),V.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(Q(e,1e3))}static milliseconds(e=1){return y.microseconds(Q(e,1e3))}static seconds(e=1){return y.milliseconds(Q(e,1e3))}static minutes(e=1){return y.seconds(Q(e,60))}static hours(e){return y.minutes(Q(e,60))}static days(e){return y.hours(Q(e,24))}};l(v,"NANOSECOND",v.nanoseconds(1)),l(v,"MICROSECOND",v.microseconds(1)),l(v,"MILLISECOND",v.milliseconds(1)),l(v,"SECOND",v.seconds(1)),l(v,"MINUTE",v.minutes(1)),l(v,"HOUR",v.hours(1)),l(v,"DAY",v.days(1)),l(v,"MAX",new v((1n<<63n)-1n)),l(v,"MIN",new v(0)),l(v,"ZERO",new v(0)),l(v,"z",a.z.union([a.z.object({value:a.z.bigint()}).transform(r=>new v(r.value)),a.z.string().transform(r=>new v(BigInt(r))),a.z.instanceof(Number).transform(r=>new v(r)),a.z.number().transform(r=>new v(r)),a.z.instanceof(v)]));let O=v;const ye=class He extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new He(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 z(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 He(e)}static khz(e){return He.hz(e*1e3)}};l(ye,"z",a.z.union([a.z.number().transform(r=>new ye(r)),a.z.instanceof(Number).transform(r=>new ye(r)),a.z.instanceof(ye)]));let Mt=ye;const U=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new ze(e*this.valueOf())}};l(U,"UNKNOWN",new U(0)),l(U,"BIT128",new U(16)),l(U,"BIT64",new U(8)),l(U,"BIT32",new U(4)),l(U,"BIT16",new U(2)),l(U,"BIT8",new U(1)),l(U,"z",a.z.union([a.z.number().transform(r=>new U(r)),a.z.instanceof(Number).transform(r=>new U(r)),a.z.instanceof(U)]));let z=U;const L=class me{constructor(e,t){l(this,"start"),l(this,"end"),typeof e=="object"&&"start"in e?(this.start=new $(e.start),this.end=new $(e.end)):(this.start=new $(e),this.end=new $(t))}get span(){return new 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 me(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(),i=this.end.sub(e.end).valueOf();return n<0&&(n=-n),i<0&&(i=-i),n<=t.valueOf()&&i<=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 i=$.max(n.start,e.start),s=$.min(n.end,e.end);return s.before(i)?!1:new O(s.sub(i)).greaterThanOrEqual(t)}contains(e){return e instanceof me?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new me(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 me($.min(...e.map(t=>t.start)),$.max(...e.map(t=>t.end)))}};l(L,"MAX",new L($.MIN,$.MAX)),l(L,"MIN",new L($.MAX,$.MIN)),l(L,"ZERO",new L($.ZERO,$.ZERO)),l(L,"z",a.z.union([a.z.object({start:$.z,end:$.z}).transform(r=>new L(r.start,r.end)),a.z.instanceof(L)]));let J=L;const c=class I{constructor(e){if(l(this,"value"),l(this,"encodeValue",!0),e instanceof I||typeof e=="string"||typeof e.valueOf()=="string"){this.value=e.valueOf();return}const t=I.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){this.value=t.valueOf();return}throw this.value=I.UNKNOWN.valueOf(),new Error(`unable to find data type for ${e.toString()}`)}valueOf(){return this.value}get Array(){const e=I.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(I.JSON)||this.equals(I.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(I.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=I.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsigned(){return this.equals(I.UINT8)||this.equals(I.UINT16)||this.equals(I.UINT32)||this.equals(I.UINT64)}get isSigned(){return this.equals(I.INT8)||this.equals(I.INT16)||this.equals(I.INT32)||this.equals(I.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(I.INT32)&&e.equals(I.FLOAT64)||this.equals(I.INT8)&&e.equals(I.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 I.BIG_INT_TYPES.some(e=>e.equals(this))}};l(c,"UNKNOWN",new c("unknown")),l(c,"FLOAT64",new c("float64")),l(c,"FLOAT32",new c("float32")),l(c,"INT64",new c("int64")),l(c,"INT32",new c("int32")),l(c,"INT16",new c("int16")),l(c,"INT8",new c("int8")),l(c,"UINT64",new c("uint64")),l(c,"UINT32",new c("uint32")),l(c,"UINT16",new c("uint16")),l(c,"UINT8",new c("uint8")),l(c,"BOOLEAN",c.UINT8),l(c,"TIMESTAMP",new c("timestamp")),l(c,"UUID",new c("uuid")),l(c,"STRING",new c("string")),l(c,"JSON",new c("json")),l(c,"ARRAY_CONSTRUCTORS",new Map([[c.UINT8.toString(),Uint8Array],[c.UINT16.toString(),Uint16Array],[c.UINT32.toString(),Uint32Array],[c.UINT64.toString(),BigUint64Array],[c.FLOAT32.toString(),Float32Array],[c.FLOAT64.toString(),Float64Array],[c.INT8.toString(),Int8Array],[c.INT16.toString(),Int16Array],[c.INT32.toString(),Int32Array],[c.INT64.toString(),BigInt64Array],[c.TIMESTAMP.toString(),BigInt64Array],[c.STRING.toString(),Uint8Array],[c.JSON.toString(),Uint8Array],[c.UUID.toString(),Uint8Array]])),l(c,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,c.UINT8],[Uint16Array.name,c.UINT16],[Uint32Array.name,c.UINT32],[BigUint64Array.name,c.UINT64],[Float32Array.name,c.FLOAT32],[Float64Array.name,c.FLOAT64],[Int8Array.name,c.INT8],[Int16Array.name,c.INT16],[Int32Array.name,c.INT32],[BigInt64Array.name,c.INT64]])),l(c,"DENSITIES",new Map([[c.UINT8.toString(),z.BIT8],[c.UINT16.toString(),z.BIT16],[c.UINT32.toString(),z.BIT32],[c.UINT64.toString(),z.BIT64],[c.FLOAT32.toString(),z.BIT32],[c.FLOAT64.toString(),z.BIT64],[c.INT8.toString(),z.BIT8],[c.INT16.toString(),z.BIT16],[c.INT32.toString(),z.BIT32],[c.INT64.toString(),z.BIT64],[c.TIMESTAMP.toString(),z.BIT64],[c.STRING.toString(),z.UNKNOWN],[c.JSON.toString(),z.UNKNOWN],[c.UUID.toString(),z.BIT128]])),l(c,"ALL",[c.UNKNOWN,c.FLOAT64,c.FLOAT32,c.INT64,c.INT32,c.INT16,c.INT8,c.UINT64,c.UINT32,c.UINT16,c.UINT8,c.TIMESTAMP,c.UUID,c.STRING,c.JSON]),l(c,"BIG_INT_TYPES",[c.INT64,c.UINT64,c.TIMESTAMP]),l(c,"z",a.z.union([a.z.string().transform(r=>new c(r)),a.z.instanceof(c)]));let w=c;const E=class N extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return N.bytes(this.valueOf()+e.valueOf())}sub(e){return N.bytes(this.valueOf()-e.valueOf())}truncate(e){return new N(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return N.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/N.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/N.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/N.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/N.TERABYTE.valueOf()}toString(){const e=this.truncate(N.TERABYTE),t=this.truncate(N.GIGABYTE),n=this.truncate(N.MEGABYTE),i=this.truncate(N.KILOBYTE),s=this.truncate(N.BYTE),o=e,u=t.sub(e),h=n.sub(t),f=i.sub(n),g=s.sub(i);let d="";return o.isZero||(d+=`${o.terabytes}TB `),u.isZero||(d+=`${u.gigabytes}GB `),h.isZero||(d+=`${h.megabytes}MB `),f.isZero||(d+=`${f.kilobytes}KB `),(!g.isZero||d==="")&&(d+=`${g.valueOf()}B`),d.trim()}static bytes(e=1){return new N(e)}static kilobytes(e=1){return N.bytes(e.valueOf()*1e3)}static megabytes(e=1){return N.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return N.megabytes(e.valueOf()*1e3)}static terabytes(e){return N.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};l(E,"BYTE",new E(1)),l(E,"KILOBYTE",E.kilobytes(1)),l(E,"MEGABYTE",E.megabytes(1)),l(E,"GIGABYTE",E.gigabytes(1)),l(E,"TERABYTE",E.terabytes(1)),l(E,"ZERO",new E(0)),l(E,"z",a.z.union([a.z.number().transform(r=>new E(r)),a.z.instanceof(E)]));let ze=E;const la=a.z.union([a.z.instanceof(Uint8Array),a.z.instanceof(Uint16Array),a.z.instanceof(Uint32Array),a.z.instanceof(BigUint64Array),a.z.instanceof(Float32Array),a.z.instanceof(Float64Array),a.z.instanceof(Int8Array),a.z.instanceof(Int16Array),a.z.instanceof(Int32Array),a.z.instanceof(BigInt64Array)]),Sn=r=>{const e=typeof r;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||r instanceof $||r instanceof O||r instanceof Date},ha=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t.valueOf())-BigInt(n.valueOf()):we(t,-n).valueOf(),we=(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),ca=r=>r==null?!1:Array.isArray(r)||r instanceof ArrayBuffer||ArrayBuffer.isView(r)&&!(r instanceof DataView)||r instanceof Nn?!0:Sn(r),Y=-1,Ct={[Symbol.iterator]:()=>Ct,next:()=>({done:!0,value:void 0})},fa=a.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer),da=a.z.union([a.z.null(),a.z.undefined()]).transform(()=>new Uint8Array().buffer),Lt=10,In=(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`)},be=class R{constructor(e){l(this,"key",""),l(this,"isSynnaxSeries",!0),l(this,"dataType"),l(this,"sampleOffset"),l(this,"gl"),l(this,"_data"),l(this,"timeRange",J.ZERO),l(this,"alignment",0n),l(this,"_cachedMin"),l(this,"_cachedMax"),l(this,"writePos",Y),l(this,"_refCount",0),l(this,"_cachedLength"),l(this,"_cachedIndexes"),ca(e)&&(e={data:e});const{dataType:t,timeRange:n,sampleOffset:i=0,glBufferUsage:s="static",alignment:o=0n,key:u=On()}=e,h=e.data??[];if(h instanceof R||typeof h=="object"&&"isSynnaxSeries"in h&&h.isSynnaxSeries===!0){const d=h;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 f=Sn(h),g=Array.isArray(h);if(t!=null)this.dataType=new w(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(g||f){let d=h;if(!f){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.");d=h[0]}if(typeof d=="string")this.dataType=w.STRING;else if(typeof d=="number")this.dataType=w.FLOAT64;else if(typeof d=="bigint")this.dataType=w.INT64;else if(typeof d=="boolean")this.dataType=w.BOOLEAN;else if(d instanceof $||d instanceof Date||d instanceof $)this.dataType=w.TIMESTAMP;else if(typeof d=="object")this.dataType=w.JSON;else throw new Error(`cannot infer data type of ${typeof d} when constructing a Series from a JS array`)}else this.dataType=new w(h)}if(!g&&!f)this._data=h;else{let d=f?[h]:h;const B=d[0];(B instanceof $||B instanceof Date||B instanceof O)&&(d=d.map(A=>new $(A).valueOf())),this.dataType.equals(w.STRING)?(this._cachedLength=d.length,this._data=new TextEncoder().encode(`${d.join(`
4
4
  `)}
5
- `).buffer):this.dataType.equals(w.JSON)?(this._cachedLength=d.length,this._data=new TextEncoder().encode(`${d.map(A=>Ye.encodeString(A)).join(`
5
+ `).buffer):this.dataType.equals(w.JSON)?(this._cachedLength=d.length,this._data=new TextEncoder().encode(`${d.map(A=>Ve.encodeString(A)).join(`
6
6
  `)}
7
- `).buffer):this.dataType.usesBigInt&&typeof B=="number"?this._data=new this.dataType.Array(d.map(A=>BigInt(Math.round(A)))).buffer:!this.dataType.usesBigInt&&typeof B=="bigint"?this._data=new this.dataType.Array(d.map(A=>Number(A))).buffer:this._data=new this.dataType.Array(d).buffer}this.key=u,this.alignment=o,this.sampleOffset=i??0,this.timeRange=n??K.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:s}}static alloc({capacity:e,dataType:t,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const i=new new w(t).Array(e),s=new R({data:i.buffer,dataType:t,...n});return s.writePos=0,s}static createTimestamps(e,t,n){const i=n.spanRange(t.span(e)),s=new BigInt64Array(e);for(let o=0;o<e;o++)s[o]=BigInt(n.add(t.span(o)).valueOf());return new R({data:s,dataType:w.TIMESTAMP,timeRange:i})}get refCount(){return this._refCount}static fromStrings(e,t){const n=new TextEncoder().encode(`${e.join(`
7
+ `).buffer):this.dataType.usesBigInt&&typeof B=="number"?this._data=new this.dataType.Array(d.map(A=>BigInt(Math.round(A)))).buffer:!this.dataType.usesBigInt&&typeof B=="bigint"?this._data=new this.dataType.Array(d.map(A=>Number(A))).buffer:this._data=new this.dataType.Array(d).buffer}this.key=u,this.alignment=o,this.sampleOffset=i??0,this.timeRange=n??J.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:s}}static alloc({capacity:e,dataType:t,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const i=new new w(t).Array(e),s=new R({data:i.buffer,dataType:t,...n});return s.writePos=0,s}static createTimestamps(e,t,n){const i=n.spanRange(t.span(e)),s=new BigInt64Array(e);for(let o=0;o<e;o++)s[o]=BigInt(n.add(t.span(o)).valueOf());return new R({data:s,dataType:w.TIMESTAMP,timeRange:i})}get refCount(){return this._refCount}static fromStrings(e,t){const n=new TextEncoder().encode(`${e.join(`
8
8
  `)}
9
- `);return new R({data:n,dataType:w.STRING,timeRange:t})}static fromJSON(e,t){const n=new TextEncoder().encode(`${e.map(i=>Ye.encodeString(i)).join(`
9
+ `);return new R({data:n,dataType:w.STRING,timeRange:t})}static fromJSON(e,t){const n=new TextEncoder().encode(`${e.map(i=>Ve.encodeString(i)).join(`
10
10
  `)}
11
- `);return new R({data:n,dataType:w.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===V)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===V)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===V?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.matches(w.STRING,w.UUID))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.underlyingData).split(`
11
+ `);return new R({data:n,dataType:w.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===Y)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===Y)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===Y?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.matches(w.STRING,w.UUID))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.underlyingData).split(`
12
12
  `).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(w.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=w.UUID.density.valueOf(),t=Array(this.length);for(let n=0;n<this.length;n++){const i=this.underlyingData.slice(n*e,(n+1)*e),s=Array.from(new Uint8Array(i.buffer),o=>o.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");t[n]=s}return t}parseJSON(e){if(!this.dataType.equals(w.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(Ye.decodeString(t)))}get byteCapacity(){return new ze(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===V?this.byteCapacity:this.dataType.isVariable?new ze(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===V?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,i)=>{n===Ct&&(e++,t.push(i+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 i=0;i<this.length;i++)n[i]=la(this.dataType,e,this.data[i],t);return new R({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(w.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()),we(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(w.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()),we(this._cachedMin,this.sampleOffset))}get bounds(){return m(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 we(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 we(n,this.sampleOffset)}atVariable(e,t){let n=0,i=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[e],i=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]===Ct){if(e===0){i=o;break}n=o+1,e--}if(i===0&&(i=this.data.length),n>=i||e>0){if(t)throw new Error(`[series] - no value at index ${e}`);return}}const s=this.data.slice(n,i);return this.dataType.equals(w.STRING)?new TextDecoder().decode(s):tt(JSON.parse(new TextDecoder().decode(s)))}binarySearch(e){let t=0,n=this.length-1;const i=ut(e);for(;t<=n;){const s=Math.floor((t+n)/2),o=i(this.at(s,!0),e);if(o===0)return s;o<0?t=s+1:n=s-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(w.FLOAT32)&&!this.dataType.equals(w.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:i}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==i)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==V){i===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const s=this.dataType.density.size(i).valueOf(),o=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,s,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=V}as(e){return In(e,this.dataType),this}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:xr(this.alignmentBounds.lower),upper:xr(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 m(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 da(this);return this.dataType.equals(w.JSON)?new ga(e):e}return new pa(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new pr(this,e,t??this.length)}subAlignmentIterator(e,t){return new pr(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 R({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 i;return e?i=this.data.subarray(t,n):i=this.data.slice(t,n),new R({data:i,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(e){return new R({data:this.buffer,dataType:this.dataType,timeRange:K.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(i=>i.toString());else{for(let i=0;i<5;i++)n+=`${(e=this.at(i))==null?void 0:e.toString()}`,i<4&&(n+=",");n+="...";for(let i=-5;i<0;i++)n+=(t=this.at(i))==null?void 0:t.toString(),i<-1&&(n+=",")}return n+="]",n}};l(be,"crudeZ",a.z.object({timeRange:K.z.optional(),dataType:w.z,alignment:a.z.coerce.bigint().optional(),data:a.z.union([ca,fa,a.z.instanceof(ArrayBuffer),a.z.instanceof(Uint8Array)]),glBufferUsage:aa.optional().default("static").optional()})),l(be,"z",be.crudeZ.transform(r=>new be(r)));let Nn=be,pr=class{constructor(e,t,n){l(this,"series"),l(this,"end"),l(this,"index"),this.series=e;const i=m(0,e.length);this.end=bt(i,n),this.index=bt(i,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}},da=class{constructor(e){if(l(this,"series"),l(this,"index"),l(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]!==Ct;)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 yr,mr;const Un=class Bn{constructor(e){l(this,"wrapped"),l(this,yr,"JSONSeriesIterator"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:Ye.decodeString(e.value,Bn.SCHEMA)}}[(mr=Symbol.iterator,yr=Symbol.toStringTag,mr)](){return this}};l(Un,"SCHEMA",a.z.record(a.z.string(),a.z.unknown()));let ga=Un;var wr,br;class pa{constructor(e){l(this,"series"),l(this,"index"),l(this,wr,"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)}}[(br=Symbol.iterator,wr=Symbol.toStringTag,br)](){return this}}class ya{constructor(e=[]){if(l(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 In(e,this.dataType),this}get dataType(){return this.series.length===0?w.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?K.ZERO:new K(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?m(0n,0n):m(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(M(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 dt(this,e,t??this.length)}subAlignmentIterator(e,t){if(e>=this.alignmentBounds.upper||t<=this.alignmentBounds.lower)return Mt;let n=0;for(let s=0;s<this.series.length;s++){const o=this.series[s];if(e<o.alignment)break;if(e>=o.alignmentBounds.upper)n+=o.length;else if(M(o.alignmentBounds,e)){n+=Number(e-o.alignment);break}}let i=0;for(let s=0;s<this.series.length;s++){const o=this.series[s];if(t<o.alignment)break;if(t>=o.alignmentBounds.upper)i+=o.length;else if(M(o.alignmentBounds,t)){i+=Number(t-o.alignment);break}}return new dt(this,n,i)}subAlignmentSpanIterator(e,t){if(e>=this.alignmentBounds.upper)return Mt;let n=0;for(let i=0;i<this.series.length;i++){const s=this.series[i];if(e<s.alignment)break;if(e>=s.alignmentBounds.upper)n+=s.length;else if(M(s.alignmentBounds,e)){n+=Number(e-s.alignment);break}}return new dt(this,n,n+t)}updateGLBuffer(e){this.series.forEach(t=>t.updateGLBuffer(e))}get bounds(){return Mr(this.series.map(e=>e.bounds))}get byteLength(){return new ze(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(i=>i.alignmentBounds);return Cr(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(i=>i.alignmentBounds);return Lr(n,e,t)}parseJSON(e){if(!this.dataType.equals(w.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 ma(this.series)}}var vr,$r;let ma=class{constructor(e){l(this,"series"),l(this,"seriesIndex"),l(this,"internal"),l(this,vr,"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())}[($r=Symbol.iterator,vr=Symbol.toStringTag,$r)](){return this}},dt=class{constructor(e,t,n){l(this,"series"),l(this,"index"),l(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 xr=r=>{const e=r>>32n,t=r&0xffffffffn;return{domain:e,sample:t}},En=(r,e,t=".")=>{const n=r.split(t);return n.map((i,s)=>{const o=e(i,s,n);return o==null?null:typeof o=="string"?o:o.join(t)}).filter(i=>i!=null).join(t)},ir=(r,e,t={optional:!1,separator:"."})=>{t.separator??(t.separator=".");const{optional:n,getter:i=(u,h)=>u[h]}=t,s=e.split(t.separator);if(s.length===1&&s[0]==="")return r;let o=r;for(const u of s){const h=i(o,u);if(h==null){if(n)return null;throw new Error(`Path ${e} does not exist. ${u} is null`)}o=h}return o},wa=(r,e,t)=>{const n=e.split(".");let i=r;for(let s=0;s<n.length-1;s++){const o=n[s];i[o]??(i[o]={}),i=i[o]}try{i[n[n.length-1]]=t}catch(s){throw console.error("failed to set value",t,"at path",e,"on object",r),s}},ba=(r,e)=>{const t=e.split(".");let n=r;for(let i=0;i<t.length-1;i++){const s=t[i];if(n[s]==null)return;n=n[s]}if(Array.isArray(n)){const i=parseInt(t[t.length-1]);if(isNaN(i))return;n.splice(i,1);return}delete n[t[t.length-1]]},va=(r,e)=>{const t=r.split(".");return e<0?t[t.length+e]:t[e]},$a=(r,e)=>{try{return ir(r,e),!0}catch{return!1}},xa=(r,e)=>{if(e.length===0)return!0;const t=r.split("."),n=e.split(".");if(n.length>t.length)return!1;for(let i=0;i<n.length;i++){const s=t[i],o=n[i];if(o!=="*"&&s!==o)return!1}return!0};a.z.object({key:a.z.string(),value:a.z.string()});const Oa=a.z.record(a.z.union([a.z.number(),a.z.string(),a.z.symbol()]),a.z.unknown()),zn=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Ta=zn(),An=["macOS","Windows","Linux"],Sa=["macos","windows","linux"],Ia={macos:"macOS",windows:"Windows",linux:"Linux"},Na=a.z.enum(An).or(a.z.enum(Sa).transform(r=>Ia[r])),Ua=()=>{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 gt;const Ba=(r={})=>{const{force:e,default:t}=r;return e??gt??(gt=Ua(),gt??t)},Ea=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:An,RUNTIME:Ta,detect:zn,getOS:Ba,osZ:Na},Symbol.toStringTag,{value:"Module"}));var za=Object.defineProperty,Aa=(r,e,t)=>e in r?za(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ve=(r,e,t)=>Aa(r,typeof e!="symbol"?e+"":e,t);const Ma=(...r)=>r.map(Mn).join(""),Mn=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),Ca=r=>r.endsWith("/")?r.slice(0,-1):r,Or=class Lt{constructor({host:e,port:t,protocol:n="",pathPrefix:i=""}){ve(this,"protocol"),ve(this,"host"),ve(this,"port"),ve(this,"path"),this.protocol=n,this.host=e,this.port=t,this.path=Mn(i)}replace(e){return new Lt({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Lt({...this,pathPrefix:Ma(this.path,e)})}toString(){return Ca(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};ve(Or,"UNKNOWN",new Or({host:"unknown",port:0}));const La=-128,Ra=127,ja=a.z.number().int().min(La).max(Ra),ka=-32768,Da=32767,Pa=a.z.number().int().min(ka).max(Da),Fa=-2147483648,_a=2147483647,qa=a.z.number().int().min(Fa).max(_a),Wa=-9223372036854775808n,Ya=9223372036854775807n,Va=a.z.bigint().min(Wa).max(Ya),Za=255,Ha=a.z.number().int().min(0).max(Za),Ga=65535,Ka=a.z.number().int().min(0).max(Ga),Ja=4294967295,Xa=a.z.number().int().min(0).max(Ja),Qa=18446744073709551615n,eu=a.z.bigint().min(0n).max(Qa),Cn=r=>En(r,(e,t,n)=>{const i=t===n.length-1,s=!isNaN(parseInt(e)),o=!isNaN(parseInt(n[t+1]));return s&&(e="element"),i||o?e:[e,"shape"]}),Tr=(r,e)=>{if(r==null)return null;const t=r[e];return t==null&&typeof r=="object"&&"sourceType"in r?r.sourceType()[e]:t},tu=(r,e,t)=>ir(Tr(r,"shape"),Cn(e),{...t,getter:Tr}),ru=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:tu,getFieldSchemaPath:Cn,int16:Pa,int32:qa,int64:Va,int8:ja,uint16:Ka,uint32:Xa,uint64:eu,uint8:Ha},Symbol.toStringTag,{value:"Module"}));var nu=Object.defineProperty,iu=(r,e,t)=>e in r?nu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ee=(r,e,t)=>iu(r,typeof e!="symbol"?e+"":e,t);const su=2,ou=3,au=2,uu=(r,e)=>{if(Number.isNaN(r)||!Number.isFinite(r))return r;const t=Me(e);if(t==0)return r;let n;t>=1e3?n=su:t>=1?n=ou:n=Math.ceil(-Math.log10(t))+au;const i=10**n;return Math.round(r*i)/i},lu=Object.freeze(Object.defineProperty({__proto__:null,abs:Ar,add:Er,closeTo:ci,div:gi,equal:mt,max:di,min:zr,mult:Q,roundBySpan:uu,roundToNearestMagnitude:fi,sub:$e},Symbol.toStringTag,{value:"Module"}));a.z.object({baseInterval:O.z.optional(),maxRetries:a.z.number().optional(),scale:a.z.number().optional()});const hu=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,sr=a.z.string().regex(hu),se=a.z.number().min(0).max(255),cu=a.z.number().min(0).max(1),or=a.z.tuple([se,se,se,cu]),Ln=a.z.tuple([se,se,se]),fu=r=>Ce.safeParse(r).success,du=r=>or.safeParse(r).success,gu=r=>{if(r==null)return;const e=Ce.safeParse(r);if(e.success)return kn(e.data);if(typeof r=="string")return r;throw e.error},x=(r,e=1)=>{if(typeof r=="string")return Ou(r,e);if(Array.isArray(r)){if(r.length<3||r.length>4)throw new Error(`Invalid color: [${r.join(", ")}]`);return r.length===3?[...r,e]:r}throw new Error(`Invalid color: ${JSON.stringify(r)}`)},Rn=(r,e)=>{if(r==null||e==null)return!1;const t=x(r),n=x(e);return t.every((i,s)=>i===n[s])},jn=r=>{if(r==null)return;const[e,t,n,i]=x(r);return`#${Pe(e)}${Pe(t)}${Pe(n)}${i===1?"":Pe(i*255)}`},kn=r=>{const[e,t,n,i]=x(r);return`rgba(${e}, ${t}, ${n}, ${i})`},pu=r=>`rgb(${Dn(r)})`,Dn=r=>{const[e,t,n]=x(r);return`${e}, ${t}, ${n}`},yu=r=>[...ar(r),Ie(r)],ar=r=>[Oe(r)/255,Te(r)/255,Se(r)/255],Oe=r=>x(r)[0],Te=r=>x(r)[1],Se=r=>x(r)[2],Ie=r=>x(r)[3],mu=r=>Rn(ur,r),wu=r=>Iu(x(r)),bu=(r,e)=>{const[t,n,i]=x(r);if(e>100)throw new Error(`Color opacity must be between 0 and 100, got ${e}`);return e>1&&(e/=100),[t,n,i,e]},Ke=r=>{const[e,t,n]=ar(r).map(i=>i<=.03928?i/12.92:((i+.055)/1.055)**2.4);return Number((.2126*e+.7152*t+.0722*n).toFixed(3))},vu=r=>{const[e,t,n]=ar(r);return 1-(Math.max(e,t,n)-Math.min(e,t,n))},Rt=(r,e)=>{const t=x(r),n=x(e),i=Ke(t),s=Ke(n);return(Math.max(i,s)+.5)/(Math.min(i,s)+.5)},$u=(r,...e)=>{if(e.length===0)throw new Error("[Color.pickByContrast] - must provide at least one color");const t=x(r),[n]=e.map(i=>x(i)).sort((i,s)=>Rt(t,s)-Rt(t,i));return n},Pn=r=>Ke(r)<.5,xu=r=>!Pn(r),Ce=a.z.union([sr,or,Ln]).transform(r=>x(r)),Ou=(r,e=1)=>{if(!sr.safeParse(r).success)throw new Error(`Invalid hex color: ${r}`);return r=Tu(r),[Fe(r,0),Fe(r,2),Fe(r,4),r.length===8?Fe(r,6)/255:e]},ur=[0,0,0,0],Pe=r=>Math.floor(r).toString(16).padStart(2,"0"),Fe=(r,e)=>parseInt(r.slice(e,e+2),16),Tu=r=>r.startsWith("#")?r.slice(1):r,Su=r=>{let[e,t,n]=r;const i=r[3];e/=360,t/=100,n/=100;let s,o,u;if(t===0)s=o=u=n;else{const h=n<.5?n*(1+t):n+t-n*t,f=2*n-h;s=pt(f,h,e+1/3),o=pt(f,h,e),u=pt(f,h,e-1/3)}return[Math.round(s*255),Math.round(o*255),Math.round(u*255),i]},pt=(r,e,t)=>(t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*(2/3-t)*6:r),Iu=r=>{let[e,t,n]=r;const i=r[3];e/=255,t/=255,n/=255;const s=Math.max(e,t,n),o=Math.min(e,t,n);let u,h,f=(s+o)/2;if(s===o)u=h=0;else{const g=s-o;h=f>.5?g/(2-s-o):g/(s+o),s===e?u=(t-n)/g+(t<n?6:0):s===t?u=(n-e)/g+2:u=(e-t)/g+4,u/=6}return u*=360,h*=100,f*=100,[Math.round(u),Math.round(h),Math.round(f),i]},Fn=a.z.union([sr,or,a.z.string(),Ln]),Nu=x("#000000"),Uu=x("#ffffff"),_n=a.z.object({key:a.z.string(),color:Fn,position:a.z.number(),switched:a.z.boolean().optional()}),Bu=a.z.array(_n),Eu=(r,e)=>{if(r.length===0)return ur;if(r=r.slice().sort((t,n)=>t.position-n.position),e<=r[0].position)return x(r[0].color);if(e>=r[r.length-1].position)return x(r[r.length-1].color);for(let t=0;t<r.length-1;t++){const n=r[t],i=r[t+1];if(e>=n.position&&e<=i.position){if(e===n.position)return x(n.color);if(e===i.position)return x(i.color);const s=(e-n.position)/(i.position-n.position),o=x(n.color),u=x(i.color),h=Math.round(Oe(o)+s*(Oe(u)-Oe(o))),f=Math.round(Te(o)+s*(Te(u)-Te(o))),g=Math.round(Se(o)+s*(Se(u)-Se(o))),d=Ie(o)+s*(Ie(u)-Ie(o));return x([h,f,g,d])}}return x(r[r.length-1].color)},zu=a.z.object({key:a.z.string(),name:a.z.string(),color:Ce}),Au=a.z.object({key:a.z.string(),name:a.z.string(),swatches:a.z.array(zu)}),qn=r=>{const e=Ce.safeParse(r);if(e.success)return jn(e.data);if(typeof r=="object"&&r!=null){const t=Array.isArray(r)?[]:{};for(const n of Object.keys(r))t[n]=qn(r[n]);return t}return r},Mu=Object.freeze(Object.defineProperty({__proto__:null,BLACK:Nu,WHITE:Uu,ZERO:ur,aValue:Ie,bValue:Se,colorZ:Ce,construct:x,contrast:Rt,crudeZ:Fn,cssString:gu,equals:Rn,fromGradient:Eu,fromHSLA:Su,gValue:Te,gradientZ:Bu,grayness:vu,hex:jn,hsla:wu,isColor:du,isCrude:fu,isDark:Pn,isLight:xu,isZero:mu,luminance:Ke,paletteZ:Au,pickByContrast:$u,rValue:Oe,rgbCSS:pu,rgbString:Dn,rgba1:yu,rgbaCSS:kn,setAlpha:bu,stopZ:_n,transformColorsToHex:qn},Symbol.toStringTag,{value:"Module"})),Wn=a.z.number().int().min(0).max(255),Yn=255,Vn=0,Cu={lower:Vn,upper:Yn+1},Zn=a.z.object({name:a.z.string(),key:a.z.string()}),Ae=r=>a.z.object({subject:Zn,resource:r,authority:Wn}),Lu=(...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}),Hn=a.z.object({from:Ae(a.z.any()),to:a.z.null()}),Gn=a.z.object({from:a.z.null(),to:Ae(a.z.any())}),Ru=a.z.union([Hn,Gn,a.z.object({from:Ae(a.z.any()),to:Ae(a.z.any())})]),ju=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:Yn,AUTHORITY_BOUNDS:Cu,ZERO_AUTHORITY:Vn,acquireZ:Gn,authorityZ:Wn,filterTransfersByChannelKey:Lu,releaseZ:Hn,stateZ:Ae,subjectZ:Zn,transferZ:Ru},Symbol.toStringTag,{value:"Module"})),ku=r=>Object.getOwnPropertySymbols(globalThis).includes(r),Du=(r,e)=>{const t=Symbol.for(r);if(!ku(t)){const n=e();Object.defineProperty(globalThis,t,{value:n})}return()=>globalThis[t]},Pu=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),lr=r=>{var e;return e=class extends Error{constructor(t,n){super(t,n),ee(this,"discriminator",e.discriminator),ee(this,"type",e.TYPE),ee(this,"matches",e.matches),this.name=e.TYPE}static sub(t){return lr(`${r}.${t}`)}},ee(e,"discriminator","FreighterError"),ee(e,"TYPE",r),ee(e,"matches",Pu(r)),e},Fu=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},ce="unknown",Sr="nil";class _u{constructor(){ee(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Sr,data:""};if(Fu(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:ce,data:e.message};if(typeof e=="string")return{type:ce,data:e};try{return{type:ce,data:JSON.stringify(e)}}catch{return{type:ce,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===Sr)return null;if(e.type===ce)return new Ir(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new Ir(e.data)}}Du("synnax-error-registry",()=>new _u);class Ir extends lr("unknown"){}a.z.object({type:a.z.string(),data:a.z.string()});class Sl extends lr("canceled"){}const qu=r=>r?-1:1;a.object({jsonrpc:a.string(),id:a.number().optional(),method:a.string().optional(),params:a.unknown().optional(),result:a.unknown().optional()});const jt=a.z.string().regex(/^\d+\.\d+\.\d+$/),Le=(r,e,t={})=>{t.checkMajor??(t.checkMajor=!0),t.checkMinor??(t.checkMinor=!0),t.checkPatch??(t.checkPatch=!0);const n=jt.parse(r),i=jt.parse(e),[s,o,u]=n.split(".").map(Number),[h,f,g]=i.split(".").map(Number);if(t.checkMajor){if(s<h)return Ve;if(s>h)return Ze}if(t.checkMinor){if(o<f)return Ve;if(o>f)return Ze}if(t.checkPatch){if(u<g)return Ve;if(u>g)return Ze}return ae},Wu=(r,e,t={})=>xn(Le(r,e,t)),Kn=(r,e,t={})=>$n(Le(r,e,t)),Yu=(r,e,t={})=>vn(Le(r,e,t)),Vu=({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}},Zu=({name:r,migrations:e,targetSchema:t,defaultVersion:n,def:i})=>{const s=Object.keys(e).sort(Le).pop();if(s==null)return f=>{if(f.version??(f.version=n),f.version!==i.version)return console.log(`${r} version ${f.version} is newer than latest version of ${i.version}.
13
+ `).slice(0,-1).map(t=>e.parse(Ve.decodeString(t)))}get byteCapacity(){return new ze(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===Y?this.byteCapacity:this.dataType.isVariable?new ze(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===Y?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,i)=>{n===Lt&&(e++,t.push(i+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 i=0;i<this.length;i++)n[i]=ha(this.dataType,e,this.data[i],t);return new R({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(w.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()),we(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(w.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()),we(this._cachedMin,this.sampleOffset))}get bounds(){return m(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 we(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 we(n,this.sampleOffset)}atVariable(e,t){let n=0,i=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[e],i=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]===Lt){if(e===0){i=o;break}n=o+1,e--}if(i===0&&(i=this.data.length),n>=i||e>0){if(t)throw new Error(`[series] - no value at index ${e}`);return}}const s=this.data.slice(n,i);return this.dataType.equals(w.STRING)?new TextDecoder().decode(s):tt(JSON.parse(new TextDecoder().decode(s)))}binarySearch(e){let t=0,n=this.length-1;const i=ut(e);for(;t<=n;){const s=Math.floor((t+n)/2),o=i(this.at(s,!0),e);if(o===0)return s;o<0?t=s+1:n=s-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(w.FLOAT32)&&!this.dataType.equals(w.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:i}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==i)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Y){i===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const s=this.dataType.density.size(i).valueOf(),o=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,s,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=Y}as(e){return In(e,this.dataType),this}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:xr(this.alignmentBounds.lower),upper:xr(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 m(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 ga(this);return this.dataType.equals(w.JSON)?new pa(e):e}return new ya(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new pr(this,e,t??this.length)}subAlignmentIterator(e,t){return new pr(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 R({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 i;return e?i=this.data.subarray(t,n):i=this.data.slice(t,n),new R({data:i,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(e){return new R({data:this.buffer,dataType:this.dataType,timeRange:J.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(i=>i.toString());else{for(let i=0;i<5;i++)n+=`${(e=this.at(i))==null?void 0:e.toString()}`,i<4&&(n+=",");n+="...";for(let i=-5;i<0;i++)n+=(t=this.at(i))==null?void 0:t.toString(),i<-1&&(n+=",")}return n+="]",n}};l(be,"crudeZ",a.z.object({timeRange:J.z.optional(),dataType:w.z,alignment:a.z.coerce.bigint().optional(),data:a.z.union([fa,da,a.z.instanceof(ArrayBuffer),a.z.instanceof(Uint8Array)]),glBufferUsage:ua.optional().default("static").optional()})),l(be,"z",be.crudeZ.transform(r=>new be(r)));let Nn=be,pr=class{constructor(e,t,n){l(this,"series"),l(this,"end"),l(this,"index"),this.series=e;const i=m(0,e.length);this.end=vt(i,n),this.index=vt(i,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 ga{constructor(e){if(l(this,"series"),l(this,"index"),l(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]!==Lt;)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 yr,mr;const Un=class Bn{constructor(e){l(this,"wrapped"),l(this,yr,"JSONSeriesIterator"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:Ve.decodeString(e.value,Bn.SCHEMA)}}[(mr=Symbol.iterator,yr=Symbol.toStringTag,mr)](){return this}};l(Un,"SCHEMA",a.z.record(a.z.string(),a.z.unknown()));let pa=Un;var wr,br;let ya=class{constructor(e){l(this,"series"),l(this,"index"),l(this,wr,"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)}}[(br=Symbol.iterator,wr=Symbol.toStringTag,br)](){return this}},ma=class{constructor(e=[]){if(l(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 In(e,this.dataType),this}get dataType(){return this.series.length===0?w.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?J.ZERO:new J(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?m(0n,0n):m(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(M(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 gt(this,e,t??this.length)}subAlignmentIterator(e,t){if(e>=this.alignmentBounds.upper||t<=this.alignmentBounds.lower)return Ct;let n=0;for(let s=0;s<this.series.length;s++){const o=this.series[s];if(e<o.alignment)break;if(e>=o.alignmentBounds.upper)n+=o.length;else if(M(o.alignmentBounds,e)){n+=Number(e-o.alignment);break}}let i=0;for(let s=0;s<this.series.length;s++){const o=this.series[s];if(t<o.alignment)break;if(t>=o.alignmentBounds.upper)i+=o.length;else if(M(o.alignmentBounds,t)){i+=Number(t-o.alignment);break}}return new gt(this,n,i)}subAlignmentSpanIterator(e,t){if(e>=this.alignmentBounds.upper)return Ct;let n=0;for(let i=0;i<this.series.length;i++){const s=this.series[i];if(e<s.alignment)break;if(e>=s.alignmentBounds.upper)n+=s.length;else if(M(s.alignmentBounds,e)){n+=Number(e-s.alignment);break}}return new gt(this,n,n+t)}updateGLBuffer(e){this.series.forEach(t=>t.updateGLBuffer(e))}get bounds(){return Mr(this.series.map(e=>e.bounds))}get byteLength(){return new ze(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(i=>i.alignmentBounds);return Cr(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(i=>i.alignmentBounds);return Lr(n,e,t)}parseJSON(e){if(!this.dataType.equals(w.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 wa(this.series)}};var vr,$r;let wa=class{constructor(e){l(this,"series"),l(this,"seriesIndex"),l(this,"internal"),l(this,vr,"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())}[($r=Symbol.iterator,vr=Symbol.toStringTag,$r)](){return this}},gt=class{constructor(e,t,n){l(this,"series"),l(this,"index"),l(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 xr=r=>{const e=r>>32n,t=r&0xffffffffn;return{domain:e,sample:t}},En=(r,e,t=".")=>{const n=r.split(t);return n.map((i,s)=>{const o=e(i,s,n);return o==null?null:typeof o=="string"?o:o.join(t)}).filter(i=>i!=null).join(t)},sr=(r,e,t={optional:!1,separator:"."})=>{t.separator??(t.separator=".");const{optional:n,getter:i=(u,h)=>u[h]}=t,s=e.split(t.separator);if(s.length===1&&s[0]==="")return r;let o=r;for(const u of s){const h=i(o,u);if(h==null){if(n)return null;throw new Error(`Path ${e} does not exist. ${u} is null`)}o=h}return o},ba=(r,e,t)=>{const n=e.split(".");let i=r;for(let s=0;s<n.length-1;s++){const o=n[s];i[o]??(i[o]={}),i=i[o]}try{i[n[n.length-1]]=t}catch(s){throw console.error("failed to set value",t,"at path",e,"on object",r),s}},va=(r,e)=>{const t=e.split(".");let n=r;for(let i=0;i<t.length-1;i++){const s=t[i];if(n[s]==null)return;n=n[s]}if(Array.isArray(n)){const i=parseInt(t[t.length-1]);if(isNaN(i))return;n.splice(i,1);return}delete n[t[t.length-1]]},$a=(r,e)=>{const t=r.split(".");return e<0?t[t.length+e]:t[e]},xa=(r,e)=>{try{return sr(r,e),!0}catch{return!1}},Oa=(r,e)=>{if(e.length===0)return!0;const t=r.split("."),n=e.split(".");if(n.length>t.length)return!1;for(let i=0;i<n.length;i++){const s=t[i],o=n[i];if(o!=="*"&&s!==o)return!1}return!0};a.z.object({key:a.z.string(),value:a.z.string()});const Ta=a.z.record(a.z.union([a.z.number(),a.z.string(),a.z.symbol()]),a.z.unknown()),zn=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Sa=zn(),An=["macOS","Windows","Linux"],Ia=["macos","windows","linux"],Na={macos:"macOS",windows:"Windows",linux:"Linux"},Ua=a.z.enum(An).or(a.z.enum(Ia).transform(r=>Na[r])),Ba=()=>{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 pt;const Ea=(r={})=>{const{force:e,default:t}=r;return e??pt??(pt=Ba(),pt??t)},za=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:An,RUNTIME:Sa,detect:zn,getOS:Ea,osZ:Ua},Symbol.toStringTag,{value:"Module"}));var Aa=Object.defineProperty,Ma=(r,e,t)=>e in r?Aa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ve=(r,e,t)=>Ma(r,typeof e!="symbol"?e+"":e,t);const Ca=(...r)=>r.map(Mn).join(""),Mn=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),La=r=>r.endsWith("/")?r.slice(0,-1):r,Or=class Rt{constructor({host:e,port:t,protocol:n="",pathPrefix:i=""}){ve(this,"protocol"),ve(this,"host"),ve(this,"port"),ve(this,"path"),this.protocol=n,this.host=e,this.port=t,this.path=Mn(i)}replace(e){return new Rt({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Rt({...this,pathPrefix:Ca(this.path,e)})}toString(){return La(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};ve(Or,"UNKNOWN",new Or({host:"unknown",port:0}));const Ra=-128,ja=127,ka=a.z.number().int().min(Ra).max(ja),Da=-32768,Pa=32767,Fa=a.z.number().int().min(Da).max(Pa),_a=-2147483648,qa=2147483647,Wa=a.z.number().int().min(_a).max(qa),Va=-9223372036854775808n,Ya=9223372036854775807n,Za=a.z.bigint().min(Va).max(Ya),Ha=255,Ga=a.z.number().int().min(0).max(Ha),Ja=65535,Ka=a.z.number().int().min(0).max(Ja),Xa=4294967295,Qa=a.z.number().int().min(0).max(Xa),eu=18446744073709551615n,tu=a.z.bigint().min(0n).max(eu),Cn=r=>En(r,(e,t,n)=>{const i=t===n.length-1,s=!isNaN(parseInt(e)),o=!isNaN(parseInt(n[t+1]));return s&&(e="element"),i||o?e:[e,"shape"]}),Tr=(r,e)=>{if(r==null)return null;const t=r[e];return t==null&&typeof r=="object"&&"sourceType"in r?r.sourceType()[e]:t},ru=(r,e,t)=>sr(Tr(r,"shape"),Cn(e),{...t,getter:Tr}),nu=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:ru,getFieldSchemaPath:Cn,int16:Fa,int32:Wa,int64:Za,int8:ka,uint16:Ka,uint32:Qa,uint64:tu,uint8:Ga},Symbol.toStringTag,{value:"Module"}));var iu=Object.defineProperty,su=(r,e,t)=>e in r?iu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ee=(r,e,t)=>su(r,typeof e!="symbol"?e+"":e,t);const ou=2,au=3,uu=2,lu=(r,e)=>{if(Number.isNaN(r)||!Number.isFinite(r))return r;const t=Me(e);if(t==0)return r;let n;t>=1e3?n=ou:t>=1?n=au:n=Math.ceil(-Math.log10(t))+uu;const i=10**n;return Math.round(r*i)/i},hu=Object.freeze(Object.defineProperty({__proto__:null,abs:Ar,add:Er,closeTo:fi,div:pi,equal:wt,max:gi,min:zr,mult:Q,roundBySpan:lu,roundToNearestMagnitude:di,sub:$e},Symbol.toStringTag,{value:"Module"}));a.z.object({baseInterval:O.z.optional(),maxRetries:a.z.number().optional(),scale:a.z.number().optional()});const cu=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,or=a.z.string().regex(cu),se=a.z.number().min(0).max(255),fu=a.z.number().min(0).max(1),lt=a.z.tuple([se,se,se,fu]),Ln=a.z.tuple([se,se,se]),Rn=a.z.object({rgba255:lt}),du=r=>Ce.safeParse(r).success,gu=r=>lt.safeParse(r).success,pu=r=>{if(r==null)return;const e=Ce.safeParse(r);if(e.success)return Dn(e.data);if(typeof r=="string")return r;throw e.error},x=(r,e=1)=>{if(typeof r=="string")return Tu(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)}`)},jn=(r,e)=>{if(r==null||e==null)return!1;const t=x(r),n=x(e);return t.every((i,s)=>i===n[s])},kn=r=>{if(r==null)return;const[e,t,n,i]=x(r);return`#${Pe(e)}${Pe(t)}${Pe(n)}${i===1?"":Pe(i*255)}`},Dn=r=>{const[e,t,n,i]=x(r);return`rgba(${e}, ${t}, ${n}, ${i})`},yu=r=>`rgb(${Pn(r)})`,Pn=r=>{const[e,t,n]=x(r);return`${e}, ${t}, ${n}`},mu=r=>[...ar(r),Ie(r)],ar=r=>[Oe(r)/255,Te(r)/255,Se(r)/255],Oe=r=>x(r)[0],Te=r=>x(r)[1],Se=r=>x(r)[2],Ie=r=>x(r)[3],wu=r=>jn(ur,r),bu=r=>Nu(x(r)),vu=(r,e)=>{const[t,n,i]=x(r);if(e>100)throw new Error(`Color opacity must be between 0 and 100, got ${e}`);return e>1&&(e/=100),[t,n,i,e]},Je=r=>{const[e,t,n]=ar(r).map(i=>i<=.03928?i/12.92:((i+.055)/1.055)**2.4);return Number((.2126*e+.7152*t+.0722*n).toFixed(3))},$u=r=>{const[e,t,n]=ar(r);return 1-(Math.max(e,t,n)-Math.min(e,t,n))},jt=(r,e)=>{const t=x(r),n=x(e),i=Je(t),s=Je(n);return(Math.max(i,s)+.5)/(Math.min(i,s)+.5)},xu=(r,...e)=>{if(e.length===0)throw new Error("[Color.pickByContrast] - must provide at least one color");const t=x(r),[n]=e.map(i=>x(i)).sort((i,s)=>jt(t,s)-jt(t,i));return n},Fn=r=>Je(r)<.5,Ou=r=>!Fn(r),Ce=a.z.union([or,lt,Ln,Rn]).transform(r=>x(r)),Tu=(r,e=1)=>{if(!or.safeParse(r).success)throw new Error(`Invalid hex color: ${r}`);return r=Su(r),[Fe(r,0),Fe(r,2),Fe(r,4),r.length===8?Fe(r,6)/255:e]},ur=[0,0,0,0],Pe=r=>Math.floor(r).toString(16).padStart(2,"0"),Fe=(r,e)=>parseInt(r.slice(e,e+2),16),Su=r=>r.startsWith("#")?r.slice(1):r,Iu=r=>{let[e,t,n]=r;const i=r[3];e/=360,t/=100,n/=100;let s,o,u;if(t===0)s=o=u=n;else{const h=n<.5?n*(1+t):n+t-n*t,f=2*n-h;s=yt(f,h,e+1/3),o=yt(f,h,e),u=yt(f,h,e-1/3)}return[Math.round(s*255),Math.round(o*255),Math.round(u*255),i]},yt=(r,e,t)=>(t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*(2/3-t)*6:r),Nu=r=>{let[e,t,n]=r;const i=r[3];e/=255,t/=255,n/=255;const s=Math.max(e,t,n),o=Math.min(e,t,n);let u,h,f=(s+o)/2;if(s===o)u=h=0;else{const g=s-o;h=f>.5?g/(2-s-o):g/(s+o),s===e?u=(t-n)/g+(t<n?6:0):s===t?u=(n-e)/g+2:u=(e-t)/g+4,u/=6}return u*=360,h*=100,f*=100,[Math.round(u),Math.round(h),Math.round(f),i]},_n=a.z.union([or,lt,a.z.string(),Ln,Rn]),Uu=x("#000000"),Bu=x("#ffffff"),qn=a.z.object({key:a.z.string(),color:_n,position:a.z.number(),switched:a.z.boolean().optional()}),Eu=a.z.array(qn),zu=(r,e)=>{if(r.length===0)return ur;if(r=r.slice().sort((t,n)=>t.position-n.position),e<=r[0].position)return x(r[0].color);if(e>=r[r.length-1].position)return x(r[r.length-1].color);for(let t=0;t<r.length-1;t++){const n=r[t],i=r[t+1];if(e>=n.position&&e<=i.position){if(e===n.position)return x(n.color);if(e===i.position)return x(i.color);const s=(e-n.position)/(i.position-n.position),o=x(n.color),u=x(i.color),h=Math.round(Oe(o)+s*(Oe(u)-Oe(o))),f=Math.round(Te(o)+s*(Te(u)-Te(o))),g=Math.round(Se(o)+s*(Se(u)-Se(o))),d=Ie(o)+s*(Ie(u)-Ie(o));return x([h,f,g,d])}}return x(r[r.length-1].color)},Au=a.z.object({key:a.z.string(),name:a.z.string(),color:Ce}),Mu=a.z.object({key:a.z.string(),name:a.z.string(),swatches:a.z.array(Au)}),Wn=r=>{const e=Ce.safeParse(r);if(e.success)return kn(e.data);if(typeof r=="object"&&r!=null){const t=Array.isArray(r)?[]:{};for(const n of Object.keys(r))t[n]=Wn(r[n]);return t}return r},Cu=Object.freeze(Object.defineProperty({__proto__:null,BLACK:Uu,WHITE:Bu,ZERO:ur,aValue:Ie,bValue:Se,colorZ:Ce,construct:x,contrast:jt,crudeZ:_n,cssString:pu,equals:jn,fromGradient:zu,fromHSLA:Iu,gValue:Te,gradientZ:Eu,grayness:$u,hex:kn,hsla:bu,isColor:gu,isCrude:du,isDark:Fn,isLight:Ou,isZero:wu,luminance:Je,paletteZ:Mu,pickByContrast:xu,rValue:Oe,rgbCSS:yu,rgbString:Pn,rgba1:mu,rgbaCSS:Dn,setAlpha:vu,stopZ:qn,transformColorsToHex:Wn},Symbol.toStringTag,{value:"Module"})),Vn=a.z.number().int().min(0).max(255),Yn=255,Zn=0,Lu={lower:Zn,upper:Yn+1},Hn=a.z.object({name:a.z.string(),key:a.z.string()}),Ae=r=>a.z.object({subject:Hn,resource:r,authority:Vn}),Ru=(...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}),Gn=a.z.object({from:Ae(a.z.any()),to:a.z.null()}),Jn=a.z.object({from:a.z.null(),to:Ae(a.z.any())}),ju=a.z.union([Gn,Jn,a.z.object({from:Ae(a.z.any()),to:Ae(a.z.any())})]),ku=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:Yn,AUTHORITY_BOUNDS:Lu,ZERO_AUTHORITY:Zn,acquireZ:Jn,authorityZ:Vn,filterTransfersByChannelKey:Ru,releaseZ:Gn,stateZ:Ae,subjectZ:Hn,transferZ:ju},Symbol.toStringTag,{value:"Module"})),Du=r=>Object.getOwnPropertySymbols(globalThis).includes(r),Pu=(r,e)=>{const t=Symbol.for(r);if(!Du(t)){const n=e();Object.defineProperty(globalThis,t,{value:n})}return()=>globalThis[t]},Fu=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),lr=r=>{var e;return e=class extends Error{constructor(t,n){super(t,n),ee(this,"discriminator",e.discriminator),ee(this,"type",e.TYPE),ee(this,"matches",e.matches),this.name=e.TYPE}static sub(t){return lr(`${r}.${t}`)}},ee(e,"discriminator","FreighterError"),ee(e,"TYPE",r),ee(e,"matches",Fu(r)),e},_u=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},ce="unknown",Sr="nil";class qu{constructor(){ee(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Sr,data:""};if(_u(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:ce,data:e.message};if(typeof e=="string")return{type:ce,data:e};try{return{type:ce,data:JSON.stringify(e)}}catch{return{type:ce,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===Sr)return null;if(e.type===ce)return new Ir(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new Ir(e.data)}}Pu("synnax-error-registry",()=>new qu);class Ir extends lr("unknown"){}a.z.object({type:a.z.string(),data:a.z.string()});class Nl extends lr("canceled"){}const Wu=r=>r?-1:1;a.object({jsonrpc:a.string(),id:a.number().optional(),method:a.string().optional(),params:a.unknown().optional(),result:a.unknown().optional()});const kt=a.z.string().regex(/^\d+\.\d+\.\d+$/),Le=(r,e,t={})=>{t.checkMajor??(t.checkMajor=!0),t.checkMinor??(t.checkMinor=!0),t.checkPatch??(t.checkPatch=!0);const n=kt.parse(r),i=kt.parse(e),[s,o,u]=n.split(".").map(Number),[h,f,g]=i.split(".").map(Number);if(t.checkMajor){if(s<h)return Ye;if(s>h)return Ze}if(t.checkMinor){if(o<f)return Ye;if(o>f)return Ze}if(t.checkPatch){if(u<g)return Ye;if(u>g)return Ze}return ae},Vu=(r,e,t={})=>xn(Le(r,e,t)),Kn=(r,e,t={})=>$n(Le(r,e,t)),Yu=(r,e,t={})=>vn(Le(r,e,t)),Zu=({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}},Hu=({name:r,migrations:e,targetSchema:t,defaultVersion:n,def:i})=>{const s=Object.keys(e).sort(Le).pop();if(s==null)return f=>{if(f.version??(f.version=n),f.version!==i.version)return console.log(`${r} version ${f.version} is newer than latest version of ${i.version}.
14
14
  Returning default instead.
15
- `),i;try{return t!=null?t.parse(f):f}catch(g){return console.log(`${r} failed to parse default. Exiting with default`),console.error(g),i}};const o=Object.keys(e).length;let u=!1;const h=f=>{try{if(o===0||Kn(f.version,s))return console.log(u?`${r} ${f.version} now up to date`:`${r} version ${f.version} is up to date with target version ${i.version}`),f;const g=f.version,d=e[g],B=d(f);return u=!0,h(B)}catch(g){return console.log(`${r} failed to migrate from ${f.version} to ${s}`),console.error(g),i}};return f=>{try{if(f.version==null)if(n!=null)console.log(`${r} version is null. Setting version to default of ${n}`),f.version=n;else return console.log(`${r} version is null and no default version set. Exiting with default`),i;return h(f)}catch(g){return console.log(`${r} failed to parse final result. Exiting with default`),console.error(g),i}}},Hu=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:Le,createMigration:Vu,migrator:Zu,semVerNewer:Kn,semVerOlder:Yu,semVerZ:jt,versionsEqual:Wu},Symbol.toStringTag,{value:"Module"})),Jn=["standard","scientific","engineering"],Gu=a.z.enum(Jn),Ku=(r,e,t)=>{if(Number.isNaN(r))return"NaN";if(r===1/0)return"∞";if(r===-1/0)return"-∞";if(t==="standard")return r.toFixed(e);if(r===0)return e===0?"0ᴇ0":`0.${"0".repeat(e)}ᴇ0`;let n;return t==="scientific"?n=Math.floor(Math.log10(Math.abs(r))):n=Math.floor(Math.log10(Math.abs(r))/3)*3,`${(r/10**n).toFixed(e)}ᴇ${n}`},Ju=Object.freeze(Object.defineProperty({__proto__:null,NOTATIONS:Jn,notationZ:Gu,stringifyNumber:Ku},Symbol.toStringTag,{value:"Module"})),Xu=r=>{if(r===void 0||typeof r=="string"||typeof r=="number")return r;if(r.toString===void 0)throw new Error("invalid renderer");return r.toString()},Qu=r=>Array.isArray(r)?[...r]:typeof r=="object"&&r!==null?{...r}:r,el=new Error("request for lock canceled");var tl=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function u(g){try{f(n.next(g))}catch(d){o(d)}}function h(g){try{f(n.throw(g))}catch(d){o(d)}}function f(g){g.done?s(g.value):i(g.value).then(u,h)}f((n=n.apply(r,e||[])).next())})};class rl{constructor(e,t=el){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,i)=>{const s={resolve:n,reject:i,weight:e,priority:t},o=Xn(this._queue,u=>t<=u.priority);o===-1&&e<=this._value?this._dispatchItem(s):this._queue.splice(o+1,0,s)})}runExclusive(e){return tl(this,arguments,void 0,function*(t,n=1,i=0){const[s,o]=yield this.acquire(n,i);try{return yield t(s)}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]=[]),nl(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 i=n.findIndex(s=>s.priority<=e);(i===-1?n:n.splice(0,i)).forEach(s=>s.resolve())}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}}function nl(r,e){const t=Xn(r,n=>e.priority<=n.priority);r.splice(t+1,0,e)}function Xn(r,e){for(let t=r.length-1;t>=0;t--)if(e(r[t]))return t;return-1}var il=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function u(g){try{f(n.next(g))}catch(d){o(d)}}function h(g){try{f(n.throw(g))}catch(d){o(d)}}function f(g){g.done?s(g.value):i(g.value).then(u,h)}f((n=n.apply(r,e||[])).next())})};class sl{constructor(e){this._semaphore=new rl(1,e)}acquire(){return il(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()}}class lt extends sl{static new(e){return new lt(e)}constructor(e){super(),Object.assign(this,e)}}const ol=r=>new lt(r),al=Object.freeze(Object.defineProperty({__proto__:null,mutex:lt,newMutex:ol},Symbol.toStringTag,{value:"Module"}));class ul{constructor(e=""){Re(this,"rows",[]);Re(this,"columns",[]);Re(this,"prefix");this.prefix=e}row(e,t,n){const{prefix:i}=this;return this.rows.push({startLabel:i+e,endLabel:i+t,size:n}),this}col(e,t,n){const{prefix:i}=this;return this.columns.push({startLabel:i+e,endLabel:i+t,size:n}),this}build(){return{display:"grid",gridTemplateRows:this.rows.map((e,t)=>{let n=t===0?"[":"";return n+=`${e.startLabel}] ${e.size}${typeof e.size=="number"?"px":""} [${e.endLabel}`,n+=t===this.rows.length-1?"]":"",n}).join(" "),gridTemplateColumns:this.columns.map((e,t)=>{let n=t===0?"[":"";return n+=`${e.startLabel}] ${e.size}${typeof e.size=="number"?"px":""} [${e.endLabel}`,n+=t===this.columns.length-1?"]":"",n}).join(" ")}}}const ll=(r,e)=>Object.entries(e).forEach(([t,n])=>n!=null&&r.style.setProperty(t,`${n}`)),hl=(r,e)=>Array.from(r.style).forEach(t=>{t.startsWith(e)&&r.style.removeProperty(t)}),cl=r=>{const e=rr(r);return e.visible=t=>e.M(t?"visible":"hidden"),e.expanded=t=>e.M(t?"expanded":"collapsed"),e.loc=t=>e.M(Yr.construct(t)),e.disabled=t=>t===!0&&e.M("disabled"),e.align=t=>e.M(t),e.dir=t=>t!=null&&e.M(jr.construct(t)),e.size=t=>typeof t=="string"&&e.M(t),e.sharp=t=>t!==!1&&e.M("sharp"),e.rounded=t=>t!==!1&&e.M("rounded"),e.bordered=t=>typeof t=="boolean"?t&&e.M("bordered"):t!=null?e.M(`bordered-${t.toString()}`):e.M("bordered"),e.selected=t=>t&&e.M("selected"),e.altColor=t=>t&&e.M("alt-color"),e.editable=t=>t&&e.M("editable"),e.noSelect=e.M("no-select"),e.noWrap=t=>t&&e.M("no-wrap"),e.applyVars=ll,e.removeVars=hl,e.newGridBuilder=t=>new ul(t),e.dropRegion=t=>t&&e.B("haul-drop-region"),e.px=t=>`${t}px`,e.inheritDims=(t=!0)=>t&&e.M("inherit-dims"),e.shade=t=>t!=null&&e.M(`shade-${t}`),e.shadeVar=t=>{if(t!=null)return`var(--${r}-gray-l${t})`},e.levelSizeVar=t=>`var(--${r}-${t}-size)`,e},fl=cl("pluto");exports.$=_r;exports.$$1=At;exports.$t=Ms;exports.$t$1=ya;exports.A=K;exports.B=it;exports.Bt=qu;exports.CSS=fl;exports.D=qr;exports.Dt=ju;exports.Et=nn;exports.F=ea;exports.G=Ui;exports.Gt=Qu;exports.Ht=Hu;exports.J=us;exports.Jt=Ju;exports.K=Yr;exports.Kt=al;exports.L=ru;exports.Lt=oa;exports.Mt=sn;exports.O=O;exports.P=Dr;exports.R=ze;exports.S=Ea;exports.T=oe;exports.Y=an;exports.Yt=Xu;exports._=Ws;exports.b=ro;exports.bt=rn;exports.c=ir;exports.c$1=Vo;exports.c$2=T;exports.clsx=ln;exports.d=Di;exports.f=wa;exports.f$1=_;exports.g=jr;exports.g$1=$a;exports.g$2=w;exports.h=ba;exports.i=et;exports.k=Nn;exports.m=$;exports.m$1=Oa;exports.newBEM=rr;exports.o=at;exports.p=va;exports.qt=ua;exports.qt$1=lu;exports.t=W;exports.u=En;exports.w=Pr;exports.w$1=q;exports.w$2=Zo;exports.x=nt;exports.y=xa;exports.y$1=D;exports.y$2=z;exports.zt=Mu;
15
+ `),i;try{return t!=null?t.parse(f):f}catch(g){return console.log(`${r} failed to parse default. Exiting with default`),console.error(g),i}};const o=Object.keys(e).length;let u=!1;const h=f=>{try{if(o===0||Kn(f.version,s))return console.log(u?`${r} ${f.version} now up to date`:`${r} version ${f.version} is up to date with target version ${i.version}`),f;const g=f.version,d=e[g],B=d(f);return u=!0,h(B)}catch(g){return console.log(`${r} failed to migrate from ${f.version} to ${s}`),console.error(g),i}};return f=>{try{if(f.version==null)if(n!=null)console.log(`${r} version is null. Setting version to default of ${n}`),f.version=n;else return console.log(`${r} version is null and no default version set. Exiting with default`),i;return h(f)}catch(g){return console.log(`${r} failed to parse final result. Exiting with default`),console.error(g),i}}},Gu=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:Le,createMigration:Zu,migrator:Hu,semVerNewer:Kn,semVerOlder:Yu,semVerZ:kt,versionsEqual:Vu},Symbol.toStringTag,{value:"Module"})),Xn=["standard","scientific","engineering"],Ju=a.z.enum(Xn),Ku=(r,e,t)=>{if(Number.isNaN(r))return"NaN";if(r===1/0)return"∞";if(r===-1/0)return"-∞";if(t==="standard")return r.toFixed(e);if(r===0)return e===0?"0ᴇ0":`0.${"0".repeat(e)}ᴇ0`;let n;return t==="scientific"?n=Math.floor(Math.log10(Math.abs(r))):n=Math.floor(Math.log10(Math.abs(r))/3)*3,`${(r/10**n).toFixed(e)}ᴇ${n}`},Xu=Object.freeze(Object.defineProperty({__proto__:null,NOTATIONS:Xn,notationZ:Ju,stringifyNumber:Ku},Symbol.toStringTag,{value:"Module"})),Qu=r=>{if(r===void 0||typeof r=="string"||typeof r=="number")return r;if(r.toString===void 0)throw new Error("invalid renderer");return r.toString()},el=r=>Array.isArray(r)?[...r]:typeof r=="object"&&r!==null?{...r}:r,tl=new Error("request for lock canceled");var rl=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function u(g){try{f(n.next(g))}catch(d){o(d)}}function h(g){try{f(n.throw(g))}catch(d){o(d)}}function f(g){g.done?s(g.value):i(g.value).then(u,h)}f((n=n.apply(r,e||[])).next())})};class nl{constructor(e,t=tl){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,i)=>{const s={resolve:n,reject:i,weight:e,priority:t},o=Qn(this._queue,u=>t<=u.priority);o===-1&&e<=this._value?this._dispatchItem(s):this._queue.splice(o+1,0,s)})}runExclusive(e){return rl(this,arguments,void 0,function*(t,n=1,i=0){const[s,o]=yield this.acquire(n,i);try{return yield t(s)}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]=[]),il(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 i=n.findIndex(s=>s.priority<=e);(i===-1?n:n.splice(0,i)).forEach(s=>s.resolve())}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}}function il(r,e){const t=Qn(r,n=>e.priority<=n.priority);r.splice(t+1,0,e)}function Qn(r,e){for(let t=r.length-1;t>=0;t--)if(e(r[t]))return t;return-1}var sl=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function u(g){try{f(n.next(g))}catch(d){o(d)}}function h(g){try{f(n.throw(g))}catch(d){o(d)}}function f(g){g.done?s(g.value):i(g.value).then(u,h)}f((n=n.apply(r,e||[])).next())})};class ol{constructor(e){this._semaphore=new nl(1,e)}acquire(){return sl(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()}}class ht extends ol{static new(e){return new ht(e)}constructor(e){super(),Object.assign(this,e)}}const al=r=>new ht(r),ul=Object.freeze(Object.defineProperty({__proto__:null,mutex:ht,newMutex:al},Symbol.toStringTag,{value:"Module"}));class ll{constructor(e=""){Re(this,"rows",[]);Re(this,"columns",[]);Re(this,"prefix");this.prefix=e}row(e,t,n){const{prefix:i}=this;return this.rows.push({startLabel:i+e,endLabel:i+t,size:n}),this}col(e,t,n){const{prefix:i}=this;return this.columns.push({startLabel:i+e,endLabel:i+t,size:n}),this}build(){return{display:"grid",gridTemplateRows:this.rows.map((e,t)=>{let n=t===0?"[":"";return n+=`${e.startLabel}] ${e.size}${typeof e.size=="number"?"px":""} [${e.endLabel}`,n+=t===this.rows.length-1?"]":"",n}).join(" "),gridTemplateColumns:this.columns.map((e,t)=>{let n=t===0?"[":"";return n+=`${e.startLabel}] ${e.size}${typeof e.size=="number"?"px":""} [${e.endLabel}`,n+=t===this.columns.length-1?"]":"",n}).join(" ")}}}const hl=(r,e)=>Object.entries(e).forEach(([t,n])=>n!=null&&r.style.setProperty(t,`${n}`)),cl=(r,e)=>Array.from(r.style).forEach(t=>{t.startsWith(e)&&r.style.removeProperty(t)}),fl=r=>{const e=nr(r);return e.visible=t=>e.M(t?"visible":"hidden"),e.expanded=t=>e.M(t?"expanded":"collapsed"),e.loc=t=>e.M(Vr.construct(t)),e.disabled=t=>t===!0&&e.M("disabled"),e.align=t=>e.M(t),e.dir=t=>t!=null&&e.M(jr.construct(t)),e.size=t=>typeof t=="string"&&e.M(t),e.sharp=t=>t!==!1&&e.M("sharp"),e.rounded=t=>t!==!1&&e.M("rounded"),e.bordered=t=>typeof t=="boolean"?t&&e.M("bordered"):t!=null?e.M(`bordered-${t.toString()}`):e.M("bordered"),e.selected=t=>t&&e.M("selected"),e.altColor=t=>t&&e.M("alt-color"),e.editable=t=>t&&e.M("editable"),e.noSelect=e.M("no-select"),e.noWrap=t=>t&&e.M("no-wrap"),e.applyVars=hl,e.removeVars=cl,e.newGridBuilder=t=>new ll(t),e.dropRegion=t=>t&&e.B("haul-drop-region"),e.px=t=>`${t}px`,e.inheritDims=(t=!0)=>t&&e.M("inherit-dims"),e.shade=t=>t!=null&&e.M(`shade-${t}`),e.shadeVar=t=>{if(t!=null)return`var(--${r}-gray-l${t})`},e.levelSizeVar=t=>`var(--${r}-${t}-size)`,e},dl=fl("pluto");exports.$=_r;exports.$$1=Mt;exports.$t=Cs;exports.$t$1=ma;exports.A=J;exports.B=it;exports.CSS=dl;exports.D=qr;exports.Dt=Cu;exports.Et=nn;exports.F=ta;exports.Ft=ku;exports.G=Bi;exports.Gt=Qu;exports.J=ls;exports.Jt=Gu;exports.K=Vr;exports.L=nu;exports.Lt=aa;exports.Mt=sn;exports.O=O;exports.P=Dr;exports.Qt=el;exports.R=ze;exports.S=za;exports.T=oe;exports.Vt=Wu;exports.Wt=hu;exports.Xt=ul;exports.Y=an;exports.Yt=Xu;exports._=Vs;exports.b=no;exports.bt=rn;exports.c=sr;exports.c$1=Zo;exports.c$2=T;exports.clsx=ln;exports.d=Pi;exports.f=ba;exports.f$1=_;exports.g=jr;exports.g$1=xa;exports.g$2=w;exports.h=va;exports.i=et;exports.k=Nn;exports.m=$;exports.m$1=Ta;exports.newBEM=nr;exports.o=at;exports.p=$a;exports.qt=la;exports.t=W;exports.u=En;exports.w=Pr;exports.w$1=q;exports.w$2=Ho;exports.x=nt;exports.y=Oa;exports.y$1=D;exports.y$2=z;