@synnaxlabs/pluto 0.44.3 → 0.44.5

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 (153) hide show
  1. package/dist/Animated-BDoJWl9g.cjs +1 -0
  2. package/dist/{Animated-BHxq6Pmm.js → Animated-fI-NFaha.js} +2 -2
  3. package/dist/{symbols-aLnytgtc.js → Editable-C1g_CFYk.js} +5898 -5888
  4. package/dist/{symbols-DWZqHjhU.cjs → Editable-DUtJOqJ5.cjs} +41 -41
  5. package/dist/{LinePlot-BJ10hKs7.cjs → LinePlot-6cl8_hmn.cjs} +5 -5
  6. package/dist/{LinePlot-VIcFjuPQ.js → LinePlot-Ck0rhtFk.js} +712 -728
  7. package/dist/{Toggle-C--I90ch.js → Toggle-DEJ8Uvun.js} +1 -1
  8. package/dist/Toggle-DUKDeqpe.cjs +1 -0
  9. package/dist/{Video-DdsVXhnt.js → Video-B6tujjr8.js} +1 -1
  10. package/dist/{Video-BbRLzkdH.cjs → Video-BjRd9sFv.cjs} +1 -1
  11. package/dist/button.cjs +1 -1
  12. package/dist/button.js +1 -1
  13. package/dist/color.cjs +1 -1
  14. package/dist/color.js +1 -1
  15. package/dist/css-DI0uCCGq.cjs +8 -0
  16. package/dist/{css-BKrX40Df.js → css-DvIPI3Qm.js} +1383 -1252
  17. package/dist/css.cjs +1 -1
  18. package/dist/css.js +2 -2
  19. package/dist/dialog.cjs +1 -1
  20. package/dist/dialog.js +1 -1
  21. package/dist/eraser-B03ej59l.cjs +63 -0
  22. package/dist/{eraser-DtXU7kOS.js → eraser-CnRJY__h.js} +4999 -4687
  23. package/dist/ether.cjs +1 -1
  24. package/dist/ether.js +6 -6
  25. package/dist/{external-BT0nByPv.js → external-B3dPSZUg.js} +7 -8
  26. package/dist/external-BEd3F7zY.cjs +1 -0
  27. package/dist/external-BS9S-b49.cjs +1 -0
  28. package/dist/external-BVDQNHbo.cjs +1 -0
  29. package/dist/external-BenP6Hcm.cjs +1 -0
  30. package/dist/external-Blrrgnzw.cjs +1 -0
  31. package/dist/{external-tHxdTvxn.js → external-BzV_PGNe.js} +2 -2
  32. package/dist/{external-ONwuyKzG.js → external-C2iqWGd2.js} +22 -22
  33. package/dist/external-CAAPXpVr.cjs +1 -0
  34. package/dist/{external-n4gJTJfw.js → external-CKhbbig_.js} +15 -15
  35. package/dist/external-CNF5TNBY.cjs +1 -0
  36. package/dist/{external-Bt-WjDvD.js → external-D16M7vHB.js} +9 -9
  37. package/dist/{external-dkXc0y5z.js → external-D6hAP7eJ.js} +7 -7
  38. package/dist/external-D98a3YQJ.cjs +1 -0
  39. package/dist/external-DKh0JhWO.cjs +1 -0
  40. package/dist/external-DNO3FJLl.cjs +1 -0
  41. package/dist/{external-yddEc8os.cjs → external-DOEaBrpz.cjs} +2 -2
  42. package/dist/external-DRuZ24L7.js +78 -0
  43. package/dist/{external-CEMgElRx.js → external-Daage1AI.js} +10 -10
  44. package/dist/{external-BApQK7XP.js → external-Db9iKa8k.js} +3 -3
  45. package/dist/{external-BmfZaFKB.js → external-Dfr7xymv.js} +3 -3
  46. package/dist/external-DwRvB5ZT.cjs +1 -0
  47. package/dist/{external-NUi5IwGn.js → external-GR-20z_c.js} +14 -14
  48. package/dist/external-I_-aclFy.cjs +1 -0
  49. package/dist/{external-Dgui980d.js → external-R9a28aP6.js} +24 -24
  50. package/dist/{external-Dwfn2jsF.js → external-dew29Q0v.js} +9 -9
  51. package/dist/flex.cjs +1 -1
  52. package/dist/flex.js +1 -1
  53. package/dist/{fontString-D2-HUuI_.js → fontString-CW0wLG5g.js} +2 -2
  54. package/dist/{fontString-BWGnZU-8.cjs → fontString-aK--tYMM.cjs} +1 -1
  55. package/dist/header.cjs +1 -1
  56. package/dist/header.js +1 -1
  57. package/dist/index.cjs +7 -7
  58. package/dist/index.js +6084 -5944
  59. package/dist/input.cjs +1 -1
  60. package/dist/input.js +1 -1
  61. package/dist/list.cjs +1 -1
  62. package/dist/list.js +1 -1
  63. package/dist/menu.cjs +1 -1
  64. package/dist/menu.js +1 -1
  65. package/dist/pluto.css +1 -1
  66. package/dist/src/channel/queries.d.ts.map +1 -1
  67. package/dist/src/flux/form.d.ts +39 -10
  68. package/dist/src/flux/form.d.ts.map +1 -1
  69. package/dist/src/flux/retrieve.d.ts +4 -2
  70. package/dist/src/flux/retrieve.d.ts.map +1 -1
  71. package/dist/src/flux/update.d.ts +13 -0
  72. package/dist/src/flux/update.d.ts.map +1 -1
  73. package/dist/src/form/Context.d.ts +6 -2
  74. package/dist/src/form/Context.d.ts.map +1 -1
  75. package/dist/src/form/state.d.ts +1 -0
  76. package/dist/src/form/state.d.ts.map +1 -1
  77. package/dist/src/form/use.d.ts.map +1 -1
  78. package/dist/src/hardware/device/queries.d.ts.map +1 -1
  79. package/dist/src/hardware/rack/queries.d.ts.map +1 -1
  80. package/dist/src/hardware/task/queries.d.ts +22 -1
  81. package/dist/src/hardware/task/queries.d.ts.map +1 -1
  82. package/dist/src/icon/registry.d.ts +1 -0
  83. package/dist/src/icon/registry.d.ts.map +1 -1
  84. package/dist/src/label/queries.d.ts.map +1 -1
  85. package/dist/src/mosaic/Mosaic.d.ts +1 -1
  86. package/dist/src/mosaic/Mosaic.d.ts.map +1 -1
  87. package/dist/src/ontology/queries.d.ts.map +1 -1
  88. package/dist/src/ranger/queries.d.ts +3 -3
  89. package/dist/src/ranger/queries.d.ts.map +1 -1
  90. package/dist/src/select/Button.d.ts +3 -2
  91. package/dist/src/select/Button.d.ts.map +1 -1
  92. package/dist/src/select/use.d.ts +7 -4
  93. package/dist/src/select/use.d.ts.map +1 -1
  94. package/dist/src/showcase/TextShowcase.d.ts.map +1 -1
  95. package/dist/src/status/Summary.d.ts.map +1 -1
  96. package/dist/src/synnax/Provider.d.ts.map +1 -1
  97. package/dist/src/synnax/aether/provider.d.ts +6 -6
  98. package/dist/src/telem/aether/remote.d.ts +4 -4
  99. package/dist/src/telem/aether/transformers.d.ts +0 -2
  100. package/dist/src/telem/aether/transformers.d.ts.map +1 -1
  101. package/dist/src/telem/aether/transformers.spec.d.ts +2 -0
  102. package/dist/src/telem/aether/transformers.spec.d.ts.map +1 -0
  103. package/dist/src/text/external.d.ts +0 -1
  104. package/dist/src/text/external.d.ts.map +1 -1
  105. package/dist/src/triggers/Text.d.ts.map +1 -1
  106. package/dist/src/triggers/triggers.d.ts +3 -0
  107. package/dist/src/triggers/triggers.d.ts.map +1 -1
  108. package/dist/src/viewport/SelectMode.d.ts +10 -2
  109. package/dist/src/viewport/SelectMode.d.ts.map +1 -1
  110. package/dist/src/vis/diagram/Diagram.d.ts.map +1 -1
  111. package/dist/src/vis/legend/Simple.d.ts.map +1 -1
  112. package/dist/src/vis/line/aether/line.d.ts +0 -1
  113. package/dist/src/vis/line/aether/line.d.ts.map +1 -1
  114. package/dist/src/vis/lineplot/Legend.d.ts.map +1 -1
  115. package/dist/src/vis/lineplot/aether/XAxis.d.ts +2 -2
  116. package/dist/src/vis/lineplot/aether/YAxis.d.ts +2 -2
  117. package/dist/src/vis/lineplot/aether/axis.d.ts +2 -2
  118. package/dist/src/vis/lineplot/aether/axis.d.ts.map +1 -1
  119. package/dist/tabs.cjs +1 -1
  120. package/dist/tabs.js +1 -1
  121. package/dist/text.cjs +1 -1
  122. package/dist/text.js +2 -2
  123. package/dist/theming.cjs +1 -1
  124. package/dist/theming.js +2 -2
  125. package/dist/tree.cjs +1 -1
  126. package/dist/tree.js +1 -1
  127. package/dist/triggers.cjs +1 -1
  128. package/dist/triggers.js +1 -1
  129. package/dist/{units-ny6lkoIv.js → units-Dh7MflIZ.js} +3 -3
  130. package/dist/units-WWUmv-rf.cjs +1 -0
  131. package/dist/video.cjs +1 -1
  132. package/dist/video.js +1 -1
  133. package/package.json +6 -6
  134. package/dist/Animated-DEXELMDa.cjs +0 -1
  135. package/dist/Toggle-CCsw0kkq.cjs +0 -1
  136. package/dist/css-TyQvZIXQ.cjs +0 -8
  137. package/dist/eraser-Bxknv-HS.cjs +0 -63
  138. package/dist/external-BBXhtVjD.cjs +0 -1
  139. package/dist/external-BOmNpcyI.js +0 -75
  140. package/dist/external-BPF50O_x.cjs +0 -1
  141. package/dist/external-BUAnicLg.cjs +0 -1
  142. package/dist/external-BaRBYE0N.cjs +0 -1
  143. package/dist/external-BsyCwXWB.cjs +0 -1
  144. package/dist/external-COBt6FnN.cjs +0 -1
  145. package/dist/external-CZSk2V5E.cjs +0 -1
  146. package/dist/external-Cw5iYImi.cjs +0 -1
  147. package/dist/external-EMhi5ISu.cjs +0 -1
  148. package/dist/external-Jee63xkv.cjs +0 -1
  149. package/dist/external-TAYJZFme.cjs +0 -1
  150. package/dist/external-bvOijYCw.cjs +0 -1
  151. package/dist/src/text/symbols.d.ts +0 -3
  152. package/dist/src/text/symbols.d.ts.map +0 -1
  153. package/dist/units-XE06scfL.cjs +0 -1
@@ -1,8 +0,0 @@
1
- "use strict";const a=require("zod"),gn=t=>{const e=t.replace(/_[a-z]/g,r=>r[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},ft=t=>{const e=(r,n=Je)=>{if(typeof r=="string")return t(r);if(Array.isArray(r))return r.map(o=>e(o,n));if(!Ye(r))return r;n=mn(n);const s={},i=r;return"toJSON"in i&&typeof i.toJSON=="function"?e(i.toJSON(),n):(Object.keys(i).forEach(o=>{let c=i[o];const l=t(o);n.recursive&&(Ye(c)?Lt(c)||(c=e(c,n)):n.recursiveInArray&&Rt(c)&&(c=[...c].map(f=>{let g=f;return Ye(f)?Lt(g)||(g=e(f,n)):Rt(f)&&(g=e({key:f},n).key),g}))),s[l]=c}),s)};return e},dt=ft(gn),pn=t=>t.replace(/([a-z0-9])([A-Z])/g,(e,r,n)=>`${r}_${n.toLowerCase()}`),Zt=ft(pn),Yt=t=>t.length===0?t:t[0].toUpperCase()+t.slice(1),yn=[Number,String,Uint8Array],Je={recursive:!0,recursiveInArray:!0},mn=(t=Je)=>(t.recursive==null?t=Je:t.recursiveInArray??=!1,t),Rt=t=>t!=null&&Array.isArray(t),Ye=t=>t!=null&&typeof t=="object"&&!Array.isArray(t),Lt=t=>yn.some(e=>t instanceof e),bn=t=>t.replace(/\s+/g,"-").replace(/([a-z0-9])([A-Z])/g,(e,r,n)=>`${r}-${n.toLowerCase()}`).toLowerCase(),wn=ft(bn),On=Object.freeze(Object.defineProperty({__proto__:null,camelToSnake:Zt,capitalize:Yt,snakeToCamel:dt,toKebab:wn},Symbol.toStringTag,{value:"Module"}));let Tn=class{contentType="application/json";decoder;encoder;constructor(){this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(e){return this.encoder.encode(this.encodeString(e))}decode(e,r){return this.decodeString(this.decoder.decode(e),r)}decodeString(e,r){const n=JSON.parse(e),s=dt(n);return r!=null?r.parse(s):s}encodeString(e){const r=Zt(e);return JSON.stringify(r,(n,s)=>ArrayBuffer.isView(s)?Array.from(s):typeof s=="bigint"?s.toString():s)}};const Xe=new Tn,Ke=t=>[...new Set(t)],vn=(t,e,r=!0)=>{const n=new Map;return t.forEach(s=>{const i=e(s);if(n.has(i)){if(r)return;n.delete(i)}n.set(i,s)}),Array.from(n.values())},$n=Object.freeze(Object.defineProperty({__proto__:null,by:vn,unique:Ke},Symbol.toStringTag,{value:"Module"}));let H=class{value;constructor(e){this.value=e}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const gt=t=>t!=null&&typeof t=="object"&&"toString"in t,Vt=t=>{if(gt(t))return t?.toString().length===0;switch(typeof t){case"string":return t.length===0;case"number":return t===0;case"bigint":return t===0n;case"boolean":return!t;case"undefined":return!0;case"object":return t==null;default:return!1}},xn=t=>!Vt(t),Sn=Object.freeze(Object.defineProperty({__proto__:null,ValueExtension:H,isNonZero:xn,isStringer:gt,isZero:Vt},Symbol.toStringTag,{value:"Module"})),Ee=(t,e=!1)=>{const r=gt(t)?"stringer":typeof t;let n;switch(r){case"string":n=(s,i)=>s.localeCompare(i);break;case"stringer":n=(s,i)=>s.toString().localeCompare(i.toString());break;case"number":n=(s,i)=>Number(s)-Number(i);break;case"bigint":n=(s,i)=>BigInt(s)-BigInt(i)>0n?1:-1;break;case"boolean":n=(s,i)=>Number(s)-Number(i);break;case"undefined":n=()=>0;break;default:return console.warn(`sortFunc: unknown type ${r}`),()=>-1}return e?Gt(n):n},Nn=(t,e,r)=>{const n=Ee(e[t],r);return(s,i)=>n(s[t],i[t])},In=(t,e)=>t.length!==e.length?t.length-e.length:t.every((r,n)=>r===e[n])?0:-1,Wt=(t,e)=>{if(t.length!==e.length)return t.length-e.length;if(t.length===0)return 0;const r=Ee(t[0]),n=[...t].sort(r),s=[...e].sort(r);return n.every((i,o)=>i===s[o])?0:-1},zn=(t,e)=>{const r=Ke(t),n=Ke(e);return Wt(r,n)},Mn=(t,e)=>t===e?0:t==="first"&&e==="last"?1:-1,Gt=t=>(e,r)=>t(r,e),_=0,ve=-1,$e=1,Ht=t=>t<_,Jt=t=>t>_,En=t=>t>=_,Xt=t=>t===_,An=(t,e)=>{const r=/([a-zA-Z]+)|(\d+)/g,n=t.replace(/[\s_.-]+/g,"").match(r),s=e.replace(/[\s_.-]+/g,"").match(r);if(!n||!s)return 0;for(let i=0;i<Math.min(n.length,s.length);i++){const o=n[i],c=s[i];if(isNaN(Number(o))&&isNaN(Number(c))){const l=o.localeCompare(c);if(l!==0)return l}else if(!isNaN(Number(o))&&!isNaN(Number(c))){const l=Number(o)-Number(c);if(l!==0)return l}else return isNaN(Number(o))?-1:1}return n.length-s.length},Bn=Object.freeze(Object.defineProperty({__proto__:null,EQUAL:_,GREATER_THAN:$e,LESS_THAN:ve,isEqualTo:Xt,isGreaterThan:Jt,isGreaterThanEqual:En,isLessThan:Ht,newF:Ee,newFieldF:Nn,order:Mn,primitiveArrays:In,reverseF:Gt,stringsWithNumbers:An,uniqueUnorderedPrimitiveArrays:zn,unorderedPrimitiveArrays:Wt},Symbol.toStringTag,{value:"Module"})),Ae=a.z.tuple([a.z.number(),a.z.number()]);a.z.tuple([a.z.bigint(),a.z.bigint()]);const pt=a.z.object({width:a.z.number(),height:a.z.number()}),Un=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()}),Cn=["width","height"];a.z.enum(Cn);const jn=["start","center","end"],Rn=["signedWidth","signedHeight"];a.z.enum(Rn);const he=a.z.object({x:a.z.number(),y:a.z.number()}),Kt=a.z.object({clientX:a.z.number(),clientY:a.z.number()}),Be=["x","y"],yt=a.z.enum(Be),Qt=["top","right","bottom","left"],Ln=a.z.enum(Qt),Ue=["left","right"],mt=a.z.enum(Ue),Ce=["top","bottom"],bt=a.z.enum(Ce),wt=["center"],Qe=a.z.enum(wt),Dn=[...Qt,...wt],je=a.z.enum(Dn);a.z.enum(jn);const Pn=["first","last"];a.z.enum(Pn);const _t=a.z.object({lower:a.z.number(),upper:a.z.number()}),qn=a.z.object({lower:a.z.bigint(),upper:a.z.bigint()});a.z.union([_t,Ae]);a.z.union([qn,Ae]);const kn=a.z.enum([...yt.options,...je.options]),Fn=a.z.union([yt,je,a.z.instanceof(String)]),ae=(t,e)=>typeof t=="bigint"?t-BigInt(e):t-Number(e),er=(t,e)=>typeof t=="bigint"?t+BigInt(e):t+Number(e),Zn=(t,e,r=1e-4)=>Math.abs(t-e)<r,_e=(t,e)=>typeof t=="bigint"?t===BigInt(e):t===Number(e),Yn=t=>{const e=10**Math.floor(Math.log10(t));return Math.round(t/e)*e},tr=(t,e)=>t<=e?t:typeof t=="bigint"?t<=e?t:BigInt(e):t<=e?t:Number(e),Vn=(t,e)=>typeof t=="bigint"?t>=e?t:BigInt(e):t>=e?t:Number(e),rr=t=>t<0?-t:t,Y=(t,e)=>typeof t=="bigint"?t*BigInt(e):t*Number(e),Wn=(t,e)=>typeof t=="bigint"?t/BigInt(e):t/Number(e),m=(t,e,r)=>{const n={};if(typeof e=="object"&&(r=e,e=void 0),r={makeValid:!0,...r},typeof t=="number"||typeof t=="bigint")e!=null?(n.lower=t,n.upper=e):(n.lower=typeof t=="bigint"?0n:0,n.upper=t);else if(Array.isArray(t)){if(t.length!==2)throw new Error("bounds: expected array of length 2");[n.lower,n.upper]=t}else n.lower=t.lower,n.upper=t.upper;return r?.makeValid?nr(n):n},Gn=Object.freeze({lower:0,upper:0}),Hn=Object.freeze({lower:-1/0,upper:1/0}),Jn=Object.freeze({lower:0,upper:1}),Xn=Object.freeze({lower:-1,upper:1}),Kn=(t,e)=>{if(t==null&&e==null)return!0;if(t==null||e==null)return!1;const r=m(t),n=m(e);return r?.lower===n?.lower&&r?.upper===n?.upper},nr=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t,et=(t,e)=>{const r=m(t);return e<r.lower?r.lower:e>=r.upper?r.upper-(typeof r.upper=="number"?1:1n):e},N=(t,e)=>{const r=m(t);if(typeof e=="number"||typeof e=="bigint")return e>=r.lower&&e<r.upper;const n=m(e);return n.lower>=r.lower&&n.upper<=r.upper},Qn=(t,e)=>{const r=m(t),n=m(e);return r.lower===n.lower?!0:n.upper===r.lower||n.lower===r.upper?!1:N(r,n.upper)||N(r,n.lower)||N(n,r.upper)||N(n,r.lower)},ye=t=>{const e=m(t);return e.upper-e.lower},_n=t=>{const e=m(t);return typeof e.lower=="bigint"?e.lower===0n&&e.upper===0n:e.lower===0&&e.upper===0},es=t=>{const e=ye(t);return typeof e=="number"?e===0:e===0n},ts=t=>{const e=m(t);return typeof e.lower=="bigint"?!0:Number.isFinite(e.lower)&&Number.isFinite(e.upper)},rs=t=>{const e=m(t);return(e.upper+e.lower)/2},sr=t=>({lower:Math.min(...t.map(e=>m(e).lower)),upper:Math.max(...t.map(e=>m(e).upper))}),ns=t=>({lower:Math.max(...t.map(e=>m(e).lower)),upper:Math.min(...t.map(e=>m(e).upper))}),ss=t=>{const e=m(t),r=typeof e.lower=="bigint";return Array.from({length:Number(ye(t))},(n,s)=>r?e.lower+BigInt(s):e.lower+s)},tt=(t,e)=>{const r=t.map(i=>m(i)),n=r.findIndex(i=>N(i,e)||e<i.lower);if(n===-1)return{index:t.length,position:0};const s=r[n];return N(s,e)?{index:n,position:Number(e-s.lower)}:{index:n,position:0}},Ve={removeBefore:0,removeAfter:0,insertInto:0,deleteInBetween:0},is=(t,e)=>{const r=t.map(f=>m(f)),n=m(e);if(r.length===0)return Ve;const s=tt(r,n.lower),i=tt(r,n.upper);if(s.index===t.length)return{...Ve,insertInto:t.length};if(i.index===0)return{...Ve,removeAfter:i.position};if(s.index===i.index)return s.position!==0&&i.position!==0?null:{removeAfter:i.position,removeBefore:s.position,insertInto:s.index,deleteInBetween:0};let o=i.index-s.index,c=s.index,l=ae(Number(ye(r[s.index])),s.position);return s.position!==0?(o-=1,c+=1):l=0,{removeBefore:l,removeAfter:i.position,insertInto:c,deleteInBetween:o}},ir=(t,e,r)=>{const n=t.map(c=>m(c)),s=r>0?1:r<0?-1:0;if(s===0)return e;let i=r,o=e;for(;_e(i,0)===!1;){const c=n.findIndex(l=>s>0?o>=l.lower&&o<l.upper:o>l.lower&&o<=l.upper);if(c!==-1){const l=n[c];let f;if(s>0?f=ae(l.upper,o):f=ae(o,l.lower),f>0){const g=tr(rr(i),f);if(o=er(o,s>0?g:-g),i=ae(i,s>0?g:-g),_e(i,0))return o;continue}}if(s>0){const l=n.filter(f=>f.lower>o);if(l.length>0)o=l[0].lower;else return o}else{const l=n.filter(f=>f.upper<o);if(l.length>0)o=l[l.length-1].upper;else return o}}return o},ar=(t,e,r)=>{const n=t.map(o=>m(o));if(e===r)return typeof e=="bigint"?0n:0;const s=e<r?m([e,r]):m([r,e]);let i=typeof e=="bigint"?0n:0;for(const o of n){const c=o.lower>s.lower?o.lower:s.lower,l=o.upper<s.upper?o.upper:s.upper;if(c<l){const f=l-c;i=i+f}}return i},as=Object.freeze(Object.defineProperty({__proto__:null,CLIP:Xn,DECIMAL:Jn,INFINITE:Hn,ZERO:Gn,bounds:_t,buildInsertionPlan:is,clamp:et,construct:m,contains:N,distance:ar,equals:Kn,findInsertPosition:tt,isFinite:ts,isZero:_n,linspace:ss,makeValid:nr,max:sr,mean:rs,min:ns,overlapsWith:Qn,span:ye,spanIsZero:es,traverse:ir},Symbol.toStringTag,{value:"Module"})),or=kn,R=t=>Be.includes(t)?t:Ce.includes(t)?"y":"x",os=t=>R(t)==="x"?"y":"x",us=t=>R(t)==="x"?"width":"height",ls=t=>R(t)==="x"?"left":"top",cs=t=>or.safeParse(t).success,hs=t=>R(t)==="x"?"signedWidth":"signedHeight",ur=Object.freeze(Object.defineProperty({__proto__:null,DIRECTIONS:Be,construct:R,crude:or,dimension:us,direction:yt,isDirection:cs,location:ls,signedDimension:hs,swap:os},Symbol.toStringTag,{value:"Module"})),fs=mt,ds=bt,gs=Qe,ps={top:"bottom",right:"left",bottom:"top",left:"right",center:"center"},ys={top:"left",right:"top",bottom:"right",left:"bottom",center:"center"},ms=Fn,Z=t=>t instanceof String||!Be.includes(t)?t:t==="x"?"left":"top",lr=t=>ps[Z(t)],bs=t=>ys[Z(t)],fe=t=>{const e=Z(t);return e==="top"||e==="bottom"?"y":"x"},cr=a.z.object({x:mt.or(Qe),y:bt.or(Qe)}),hr=a.z.object({x:mt,y:bt}),ee=Object.freeze({x:"left",y:"top"}),Ot=Object.freeze({x:"right",y:"top"}),Re=Object.freeze({x:"left",y:"bottom"}),Tt=Object.freeze({x:"right",y:"bottom"}),Le=Object.freeze({x:"center",y:"center"}),vt=Object.freeze({x:"center",y:"top"}),$t=Object.freeze({x:"center",y:"bottom"}),xt=Object.freeze({x:"right",y:"center"}),St=Object.freeze({x:"left",y:"center"}),fr=Object.freeze([St,xt,vt,$t,ee,Ot,Re,Tt,Le]),De=(t,e)=>t.x===e.x&&t.y===e.y,dr=(t,e)=>{if(typeof e=="object"){let r=!0;return"x"in e&&(t.x===e.x||(r=!1)),"y"in e&&(t.y===e.y||(r=!1)),r}return t.x===e||t.y===e},gr=t=>[t.x,t.y],xe=t=>fe(Z(t))==="x",ws=t=>fe(Z(t))==="y",Os=t=>`${t.x}${Yt(t.y)}`,Ts=(t,e)=>{let r,n;if(typeof t=="object"&&"x"in t?(r=t.x,n=t.y):(r=Z(t),n=Z(e??t)),fe(r)===fe(n)&&r!=="center"&&n!=="center")throw new Error(`[XYLocation] - encountered two locations with the same direction: ${r.toString()} - ${n.toString()}`);const s={...Le};return r==="center"?xe(n)?[s.x,s.y]=[n,r]:[s.x,s.y]=[r,n]:n==="center"?xe(r)?[s.x,s.y]=[r,n]:[s.x,s.y]=[n,r]:xe(r)?[s.x,s.y]=[r,n]:[s.x,s.y]=[n,r],s},pr=Object.freeze(Object.defineProperty({__proto__:null,BOTTOM_CENTER:$t,BOTTOM_LEFT:Re,BOTTOM_RIGHT:Tt,CENTER:Le,CENTER_LEFT:St,CENTER_LOCATIONS:wt,CENTER_RIGHT:xt,TOP_CENTER:vt,TOP_LEFT:ee,TOP_RIGHT:Ot,XY_LOCATIONS:fr,X_LOCATIONS:Ue,Y_LOCATIONS:Ce,center:gs,construct:Z,constructXY:Ts,corner:hr,crude:ms,direction:fe,isX:xe,isY:ws,location:je,outer:Ln,rotate90:bs,swap:lr,x:fs,xy:cr,xyCouple:gr,xyEquals:De,xyMatches:dr,xyToString:Os,y:ds},Symbol.toStringTag,{value:"Module"})),rt=a.z.union([a.z.number(),he,Ae,pt,Un,Kt]),v=(t,e)=>{if(typeof t=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return t==="x"?{x:e,y:0}:{x:0,y:e}}return typeof t=="number"?{x:t,y:e??t}:Array.isArray(t)?{x:t[0],y:t[1]}:"signedWidth"in t?{x:t.signedWidth,y:t.signedHeight}:"clientX"in t?{x:t.clientX,y:t.clientY}:"width"in t?{x:t.width,y:t.height}:{x:t.x,y:t.y}},A=Object.freeze({x:0,y:0}),yr=Object.freeze({x:1,y:1}),vs=Object.freeze({x:1/0,y:1/0}),$s=Object.freeze({x:NaN,y:NaN}),Me=(t,e,r=0)=>{const n=v(t),s=v(e);return r===0?n.x===s.x&&n.y===s.y:Math.abs(n.x-s.x)<=r&&Math.abs(n.y-s.y)<=r},xs=t=>Me(t,A),Nt=(t,e,r)=>{const n=v(t),s=v(e,r);return{x:n.x*s.x,y:n.y*s.y}},mr=(t,e)=>{const r=v(t);return{x:r.x+e,y:r.y}},br=(t,e)=>{const r=v(t);return{x:r.x,y:r.y+e}},de=(t,e,r,...n)=>typeof e=="string"&&typeof r=="number"?e==="x"?mr(t,r):br(t,r):[t,e,r??A,...n].reduce((s,i)=>{const o=v(i);return{x:s.x+o.x,y:s.y+o.y}},A),Ss=(t,e,r)=>{const n=v(t);return e==="x"?{x:r,y:n.y}:{x:n.x,y:r}},Ns=(t,e)=>{const r=v(t),n=v(e);return Math.sqrt((r.x-n.x)**2+(r.y-n.y)**2)},Is=(t,e)=>{const r=v(t),n=v(e);return{x:n.x-r.x,y:n.y-r.y}},zs=t=>{const e=v(t);return Number.isNaN(e.x)||Number.isNaN(e.y)},Ms=t=>{const e=v(t);return Number.isFinite(e.x)&&Number.isFinite(e.y)},Es=t=>{const e=v(t);return[e.x,e.y]},As=t=>{const e=v(t);return{left:e.x,top:e.y}},nt=(t,e=0)=>{const r=v(t);return{x:Number(r.x.toFixed(e)),y:Number(r.y.toFixed(e))}},ne=(t,e)=>{const r=v(t),n=v(e);return{x:r.x-n.x,y:r.y-n.y}},se=t=>{const e=v(t),r=Math.hypot(e.x,e.y);return r===0?{x:0,y:0}:{x:-e.y/r,y:e.x/r}},wr=t=>{const e=v(t),r=Math.hypot(e.x,e.y);return r===0?{x:0,y:0}:{x:e.x/r,y:e.y/r}},Or=(...t)=>{const e=t.reduce((r,n)=>de(r,n),A);return Nt(e,1/t.length)},Bs=(t,e)=>{const r=[];for(let n=0;n<t.length;n++){const s=t[n];let i,o,c,l;if(n===0){const f=t[n+1],g=ne(f,s);o=se(g),c=o,l=e}else if(n===t.length-1){const f=t[n-1],g=ne(s,f);i=se(g),c=i,l=e}else{const f=t[n-1],g=t[n+1],p=ne(s,f),x=ne(g,s);i=se(p),o=se(x);const z=Math.acos((p.x*x.x+p.y*x.y)/(Math.hypot(p.x,p.y)*Math.hypot(x.x,x.y))),te=Math.sin(z/2);te===0?l=e:l=e/te,c=wr(Or(i,o))}r.push(Nt(c,l))}return r},Us=t=>{const e=v(t);return{x:e.y,y:e.x}},st=t=>{const e=v(t);return{x:Math.round(e.x),y:Math.round(e.y)}},Cs=Object.freeze(Object.defineProperty({__proto__:null,INFINITY:vs,NAN:$s,ONE:yr,ZERO:A,average:Or,calculateMiters:Bs,clientXY:Kt,construct:v,couple:Es,crudeZ:rt,css:As,distance:Ns,equals:Me,isFinite:Ms,isNan:zs,isZero:xs,normal:se,normalize:wr,round:st,scale:Nt,set:Ss,sub:ne,swap:Us,translate:de,translateX:mr,translateY:br,translation:Is,truncate:nt,xy:he},Symbol.toStringTag,{value:"Module"})),be=a.z.union([a.z.number(),a.z.string()]),js=a.z.object({top:be,left:be,width:be,height:be}),Rs=a.z.object({left:a.z.number(),top:a.z.number(),right:a.z.number(),bottom:a.z.number()}),Ls=a.z.object({one:he,two:he,root:hr}),Tr={one:A,two:A,root:ee},Ds={one:A,two:yr,root:Re},vr=(t,e)=>({one:t.one,two:t.two,root:e??t.root}),O=(t,e,r=0,n=0,s)=>{const i={one:{...A},two:{...A},root:s??ee};if(typeof t=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return i.one={x:t,y:e},i.two={x:i.one.x+r,y:i.one.y+n},i}return"one"in t&&"two"in t&&"root"in t?{...t,root:s??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(i.one={x:t.left,y:t.top},i.two={x:t.right,y:t.bottom},i):(i.one=t,e==null?i.two={x:i.one.x+r,y:i.one.y+n}:typeof e=="number"?i.two={x:i.one.x+e,y:i.one.y+r}:"width"in e?i.two={x:i.one.x+e.width,y:i.one.y+e.height}:"signedWidth"in e?i.two={x:i.one.x+e.signedWidth,y:i.one.y+e.signedHeight}:i.two=e,i))},Ps=(t,e,r)=>{const n=O(t);if(typeof e=="string"){if(r==null)throw new Error("Invalid arguments for resize");const s=R(e);return O(n.one,void 0,s==="x"?r:C(n),s==="y"?r:j(n),n.root)}return O(n.one,e,void 0,void 0,n.root)},qs=(t,e,r=!0)=>{const n=O(t);let s=(i,o)=>i<o;return r&&(s=(i,o)=>i<=o),"one"in e?s(k(n),k(e))&&s(V(e),V(n))&&s(F(n),F(e))&&s(W(e),W(n)):s(k(n),e.x)&&s(e.x,V(n))&&s(F(n),e.y)&&s(e.y,W(n))},ks=(t,e)=>Me(t.one,e.one)&&Me(t.two,e.two)&&De(t.root,e.root),$r=t=>({width:C(t),height:j(t)}),Fs=t=>({signedWidth:Pe(t),signedHeight:qe(t)}),Zs=t=>({top:F(t),left:k(t),width:C(t),height:j(t)}),It=(t,e,r=!1)=>{const n=R(e)==="y"?qe(t):Pe(t);return r?n:Math.abs(n)},B=(t,e)=>{const r=O(t);return{x:e.x==="center"?it(r).x:G(r,e.x),y:e.y==="center"?it(r).y:G(r,e.y)}},G=(t,e)=>{const r=O(t),n=gr(r.root).includes(e)?Math.min:Math.max;return Ue.includes(e)?n(r.one.x,r.two.x):n(r.one.y,r.two.y)},Ys=t=>t.one.x===t.two.x&&t.one.y===t.two.y,C=t=>It(t,"x"),j=t=>It(t,"y"),Pe=t=>{const e=O(t);return e.two.x-e.one.x},qe=t=>{const e=O(t);return e.two.y-e.one.y},xr=t=>B(t,ee),Vs=t=>B(t,vt),Ws=t=>B(t,Ot),Gs=t=>B(t,Re),Hs=t=>B(t,$t),Js=t=>B(t,Tt),Xs=t=>B(t,St),Ks=t=>B(t,xt),V=t=>G(t,"right"),W=t=>G(t,"bottom"),k=t=>G(t,"left"),F=t=>G(t,"top"),it=t=>de(xr(t),{x:Pe(t)/2,y:qe(t)/2}),zt=t=>{const e=O(t);return e.root.x==="left"?k(e):V(e)},Mt=t=>{const e=O(t);return e.root.y==="top"?F(e):W(e)},Qs=t=>({x:zt(t),y:Mt(t)}),Se=t=>{const e=O(t);return{lower:e.one.x,upper:e.two.x}},Ne=t=>{const e=O(t);return{lower:e.one.y,upper:e.two.y}},_s=(t,e)=>vr(t,e),ei=(t,e)=>{const r=O(t),n=Ue.includes(e)?"x":Ce.includes(e)?"y":null;if(n===null)throw new Error(`Invalid location: ${e}`);const s=e==="top"||e==="left"?Math.min:Math.max,i={...r.one},o={...r.two};return i[n]=s(r.one[n],r.two[n]),o[n]=s(r.one[n],r.two[n]),[i,o]},ti=(t,e)=>{const r=O(t),n=O(e),s=zt(n)+(C(n)-C(r))/2,i=Mt(n)+(j(n)-j(r))/2;return O({x:s,y:i},$r(r))},Sr=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,ri=t=>C(t)/j(t),ni=(t,e,r)=>{if(typeof e=="string"){if(r==null)throw new Error("Undefined amount passed into box.translate");const s=R(e);e=v(s,r)}const n=O(t);return O(de(n.one,e),de(n.two,e),void 0,void 0,n.root)},Nr=(t,e)=>{const r=Math.max(k(t),k(e)),n=Math.max(F(t),F(e)),s=Math.min(V(t),V(e)),i=Math.min(W(t),W(e));return r>s||n>i?Tr:O({x:r,y:n},{x:s,y:i},void 0,void 0,t.root)},Ir=t=>C(t)*j(t),si=(t,e)=>{const r=O(t);return O(nt(r.one,e),nt(r.two,e),void 0,void 0,r.root)},zr=(t,e,r,n,s,i)=>{const o={x:t,y:e},c={x:t+r,y:e+n};return s.x!==i.x&&(s.x==="center"?(o.x-=r/2,c.x-=r/2):(o.x-=r,c.x-=r)),s.y!==i.y&&(s.y==="center"?(o.y-=n/2,c.y-=n/2):(o.y-=n,c.y-=n)),O(o,c,void 0,void 0,i)},ii=t=>{const e=O(t);return O(st(e.one),st(e.two),void 0,void 0,e.root)},ai=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:Ds,ZERO:Tr,area:Ir,areaIsZero:Ys,aspect:ri,bottom:W,bottomCenter:Hs,bottomLeft:Gs,bottomRight:Js,box:Ls,center:it,centerLeft:Xs,centerRight:Ks,construct:O,constructWithAlternateRoot:zr,contains:qs,copy:vr,css:Zs,cssBox:js,dim:It,dims:$r,domRect:Rs,edgePoints:ei,equals:ks,height:j,intersection:Nr,isBox:Sr,left:k,loc:G,positionInCenter:ti,reRoot:_s,resize:Ps,right:V,root:Qs,round:ii,signedDims:Fs,signedHeight:qe,signedWidth:Pe,top:F,topCenter:Vs,topLeft:xr,topRight:Ws,translate:ni,truncate:si,width:C,x:zt,xBounds:Se,xyLoc:B,y:Mt,yBounds:Ne},Symbol.toStringTag,{value:"Module"})),Mr=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()}),oi=a.z.union([pt,Mr,he,Ae]),ui={width:0,height:0},li={width:1,height:1},I=(t,e)=>typeof t=="number"?{width:t,height:e??t}:Array.isArray(t)?{width:t[0],height:t[1]}:"x"in t?{width:t.x,height:t.y}:"signedWidth"in t?{width:t.signedWidth,height:t.signedHeight}:{...t},ci=(t,e)=>{if(e==null)return!1;const r=I(t),n=I(e);return r.width===n.width&&r.height===n.height},hi=t=>{const e=I(t);return{width:e.height,height:e.width}},fi=t=>{const e=I(t);return`0 0 ${e.width} ${e.height}`},di=t=>{const e=I(t);return[e.width,e.height]},gi=t=>({width:Math.max(...t.map(e=>I(e).width)),height:Math.max(...t.map(e=>I(e).height))}),pi=t=>({width:Math.min(...t.map(e=>I(e).width)),height:Math.min(...t.map(e=>I(e).height))}),yi=(t,e)=>{const r=I(t);return{width:r.width*e,height:r.height*e}},mi=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:li,ZERO:ui,construct:I,couple:di,crude:oi,dimensions:pt,equals:ci,max:gi,min:pi,scale:yi,signed:Mr,svgViewBox:fi,swap:hi},Symbol.toStringTag,{value:"Module"})),Er=(t,e,r)=>e!==void 0&&t<e?e:r!==void 0&&t>r?r:t,bi=a.z.object({offset:rt,scale:rt}),wi=a.z.object({offset:a.z.number(),scale:a.z.number()}),Oi=t=>(e,r,n,s)=>r==="dimension"?[e,n]:[e,s?n-t:n+t],Ti=t=>(e,r,n,s)=>[e,s?n/t:n*t],vi=t=>(e,r,n)=>{if(e===null)return[t,n];const{lower:s,upper:i}=e,{lower:o,upper:c}=t,l=i-s,f=c-o;if(r==="dimension")return[t,n*(f/l)];const g=(n-s)*(f/l)+o;return[t,g]},$i=t=>(e,r,n)=>[t,n],xi=()=>(t,e,r)=>{if(t===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[t,r];const{lower:n,upper:s}=t;return[t,s-(r-n)]},Si=t=>(e,r,n)=>{const{lower:s,upper:i}=t;return n=Er(n,s,i),[e,n]};let at=class X{ops=[];currBounds=null;currType=null;reversed=!1;constructor(){this.ops=[]}static translate(e){return new X().translate(e)}static magnify(e){return new X().magnify(e)}static scale(e,r){return new X().scale(e,r)}translate(e){const r=this.new(),n=Oi(e);return n.type="translate",r.ops.push(n),r}magnify(e){const r=this.new(),n=Ti(e);return n.type="magnify",r.ops.push(n),r}scale(e,r){const n=m(e,r),s=this.new(),i=vi(n);return i.type="scale",s.ops.push(i),s}clamp(e,r){const n=m(e,r),s=this.new(),i=Si(n);return i.type="clamp",s.ops.push(i),s}reBound(e,r){const n=m(e,r),s=this.new(),i=$i(n);return i.type="re-bound",s.ops.push(i),s}invert(){const e=xi();e.type="invert";const r=this.new();return r.ops.push(e),r}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new X;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,r){return this.currBounds=null,this.ops.reduce(([n,s],i)=>i(n,e,s,this.reversed),[null,r])[1]}reverse(){const e=this.new();e.ops.reverse();const r=[];return e.ops.forEach((n,s)=>{if(n.type==="scale"||r.some(([o,c])=>s>=o&&s<=c))return;const i=e.ops.findIndex((o,c)=>o.type==="scale"&&c>s);i!==-1&&r.push([s,i])}),r.forEach(([n,s])=>{const i=e.ops.slice(n,s);i.unshift(e.ops[s]),e.ops.splice(n,s-n+1,...i)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}static IDENTITY=new X},Ni=class M{x;y;currRoot;constructor(e=new at,r=new at,n=null){this.x=e,this.y=r,this.currRoot=n}static translate(e,r){return new M().translate(e,r)}static translateX(e){return new M().translateX(e)}static translateY(e){return new M().translateY(e)}static clamp(e){return new M().clamp(e)}static magnify(e){return new M().magnify(e)}static scale(e){return new M().scale(e)}static reBound(e){return new M().reBound(e)}translate(e,r){const n=v(e,r),s=this.copy();return s.x=this.x.translate(n.x),s.y=this.y.translate(n.y),s}translateX(e){const r=this.copy();return r.x=this.x.translate(e),r}translateY(e){const r=this.copy();return r.y=this.y.translate(e),r}magnify(e){const r=this.copy();return r.x=this.x.magnify(e.x),r.y=this.y.magnify(e.y),r}scale(e){const r=this.copy();if(Sr(e)){const n=this.currRoot;return r.currRoot=e.root,n!=null&&!De(n,e.root)&&(n.x!==e.root.x&&(r.x=r.x.invert()),n.y!==e.root.y&&(r.y=r.y.invert())),r.x=r.x.scale(Se(e)),r.y=r.y.scale(Ne(e)),r}return r.x=r.x.scale(e.width),r.y=r.y.scale(e.height),r}reBound(e){const r=this.copy();return r.x=this.x.reBound(Se(e)),r.y=this.y.reBound(Ne(e)),r}clamp(e){const r=this.copy();return r.x=this.x.clamp(Se(e)),r.y=this.y.clamp(Ne(e)),r}copy(){const e=new M;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 O(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}static IDENTITY=new M};const Ii=Object.freeze(Object.defineProperty({__proto__:null,Scale:at,XY:Ni,crudeXYTransform:bi,transform:wi},Symbol.toStringTag,{value:"Module"}));let zi=(t,e=21)=>(r=e)=>{let n="",s=r|0;for(;s--;)n+=t[Math.random()*t.length|0];return n};const Mi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ar=11,Ei=zi(Mi,Ar),Et=()=>Ei(),Ai=Object.freeze(Object.defineProperty({__proto__:null,LENGTH:Ar,create:Et},Symbol.toStringTag,{value:"Module"})),Bi=(t,e)=>r=>r instanceof e||typeof r=="object"&&r!==null&&"discriminator"in r&&r.discriminator===t,Ui=a.z.enum(["static","dynamic"]),Ci=a.z.union([a.z.tuple([a.z.int()]),a.z.tuple([a.z.int(),a.z.int().min(1).max(12)]),a.z.tuple([a.z.int(),a.z.int().min(1).max(12),a.z.int().min(1).max(31)])]),Br=(t,e)=>{const r=new b(e);if(![h.DAY,h.HOUR,h.MINUTE,h.SECOND,h.MILLISECOND,h.MICROSECOND,h.NANOSECOND].some(s=>s.equals(r)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=t.valueOf()%r.valueOf();return t instanceof b?new b(n):new h(n)};let b=class d extends H{constructor(e,r="UTC"){if(e==null)super(d.now().valueOf());else if(e instanceof Date)super(BigInt(e.getTime())*d.MILLISECOND.valueOf());else if(typeof e=="string")super(d.parseDateTimeString(e,r).valueOf());else if(Array.isArray(e))super(d.parseDate(e));else{let n=0n;e instanceof Number&&(e=e.valueOf()),r==="local"&&(n=d.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=d.MAX:e=d.MIN)),super(BigInt(e.valueOf())+n)}}static parseDate([e=1970,r=1,n=1]){const s=new Date(e,r-1,n,0,0,0,0);return new d(BigInt(s.getTime())*d.MILLISECOND.valueOf()).truncate(d.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,r="UTC"){const[n,s,i]=e.split(":");let o="00",c="00";i!=null&&([o,c]=i.split("."));let l=d.hours(parseInt(n??"00")).add(d.minutes(parseInt(s??"00"))).add(d.seconds(parseInt(o??"00"))).add(d.milliseconds(parseInt(c??"00")));return r==="local"&&(l=l.add(d.utcOffset)),l.valueOf()}static parseDateTimeString(e,r="UTC"){if(!e.includes("/")&&!e.includes("-"))return d.parseTimeString(e,r);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new d(BigInt(n.getTime())*d.MILLISECOND.valueOf(),r).valueOf()}fString(e="ISO",r="UTC"){switch(e){case"ISODate":return this.toISOString(r).slice(0,10);case"ISOTime":return this.toISOString(r).slice(11,23);case"time":return this.timeString(!1,r);case"preciseTime":return this.timeString(!0,r);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,r)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,r)}`;default:return this.toISOString(r)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(d.utcOffset).date().toISOString()}timeString(e=!1,r="UTC"){const n=this.toISOString(r);return e?n.slice(11,23):n.slice(11,19)}dateString(){const e=this.date(),r=e.toLocaleString("default",{month:"short"}),n=e.toLocaleString("default",{day:"numeric"});return`${r} ${n}`}static get utcOffset(){return new h(BigInt(new Date().getTimezoneOffset())*d.MINUTE.valueOf())}static since(e){return new d().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new d(e).valueOf()}span(e){return this.range(e).span}range(e){return new q(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0n}after(e){return this.valueOf()>new d(e).valueOf()}afterEq(e){return this.valueOf()>=new d(e).valueOf()}before(e){return this.valueOf()<new d(e).valueOf()}beforeEq(e){return this.valueOf()<=new d(e).valueOf()}add(e){return new d(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new d(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(h.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(h.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(h.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(h.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(d.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(d.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}setYear(e){const r=this.date();return r.setUTCFullYear(e),new d(r)}get month(){return this.date().getUTCMonth()}setMonth(e){const r=this.date();return r.setUTCMonth(e),new d(r)}get day(){return this.date().getUTCDate()}setDay(e){const r=this.date();return r.setUTCDate(e),new d(r)}get hour(){return this.date().getUTCHours()}setHour(e){const r=this.date();return r.setUTCHours(e),new d(r,"UTC")}get minute(){return this.date().getUTCMinutes()}setMinute(e){const r=this.date();return r.setUTCMinutes(e),new d(r)}get second(){return this.date().getUTCSeconds()}setSecond(e){const r=this.date();return r.setUTCSeconds(e),new d(r)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(e){const r=this.date();return r.setUTCMilliseconds(e),new d(r)}toString(){return this.date().toISOString()}remainder(e){return Br(this,e)}get isToday(){return this.truncate(h.DAY).equals(d.now().truncate(h.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new d(new Date)}static max(...e){let r=d.MIN;for(const n of e){const s=new d(n);s.after(r)&&(r=s)}return r}static min(...e){let r=d.MAX;for(const n of e){const s=new d(n);s.before(r)&&(r=s)}return r}static nanoseconds(e,r="UTC"){return new d(e,r)}static NANOSECOND=d.nanoseconds(1);static microseconds(e,r="UTC"){return d.nanoseconds(e*1e3,r)}static MICROSECOND=d.microseconds(1);static milliseconds(e,r="UTC"){return d.microseconds(e*1e3,r)}static MILLISECOND=d.milliseconds(1);static seconds(e,r="UTC"){return d.milliseconds(e*1e3,r)}static SECOND=d.seconds(1);static minutes(e,r="UTC"){return d.seconds(e*60,r)}static MINUTE=d.minutes(1);static hours(e,r="UTC"){return d.minutes(e*60,r)}static HOUR=d.hours(1);static days(e,r="UTC"){return d.hours(e*24,r)}static DAY=d.days(1);static MAX=new d((1n<<63n)-1n);static MIN=new d(0);static ZERO=new d(0);static z=a.z.union([a.z.instanceof(d),a.z.object({value:a.z.bigint()}).transform(e=>new d(e.value)),a.z.string().transform(e=>new d(BigInt(e))),a.z.number().transform(e=>new d(e)),a.z.bigint().transform(e=>new d(e)),a.z.date().transform(e=>new d(e)),a.z.custom(e=>e instanceof h).transform(e=>new d(e)),Ci.transform(e=>new d(e))]);static sort(e,r){return Number(e.valueOf()-r.valueOf())}};class h extends H{constructor(e){typeof e=="number"&&(e=Math.trunc(e.valueOf())),super(BigInt(e.valueOf()))}static fromSeconds(e){return e instanceof h?e:e instanceof ot?e.period:e instanceof b?new h(e):["number","bigint"].includes(typeof e)?h.seconds(e):new h(e)}static fromMilliseconds(e){return e instanceof h?e:e instanceof ot?e.period:e instanceof b?new h(e):["number","bigint"].includes(typeof e)?h.milliseconds(e):new h(e)}valueOf(){return this.value}lessThan(e){return this.valueOf()<new h(e).valueOf()}greaterThan(e){return this.valueOf()>new h(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new h(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new h(e).valueOf()}remainder(e){return Br(this,e)}truncate(e){return new h(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(h.DAY),r=this.truncate(h.HOUR),n=this.truncate(h.MINUTE),s=this.truncate(h.SECOND),i=this.truncate(h.MILLISECOND),o=this.truncate(h.MICROSECOND),c=this.truncate(h.NANOSECOND),l=e,f=r.sub(e),g=n.sub(r),p=s.sub(n),x=i.sub(s),z=o.sub(i),te=c.sub(o);let L="";return l.isZero||(L+=`${l.days}d `),f.isZero||(L+=`${f.hours}h `),g.isZero||(L+=`${g.minutes}m `),p.isZero||(L+=`${p.seconds}s `),x.isZero||(L+=`${x.milliseconds}ms `),z.isZero||(L+=`${z.microseconds}µs `),te.isZero||(L+=`${te.nanoseconds}ns`),L.trim()}mult(e){return new h(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(h.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(h.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(h.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(h.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(h.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(h.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===0n}equals(e){return this.valueOf()===new h(e).valueOf()}add(e){return new h(this.valueOf()+new h(e).valueOf())}sub(e){return new h(this.valueOf()-new h(e).valueOf())}static nanoseconds(e=1){return new h(e)}static NANOSECOND=h.nanoseconds(1);static microseconds(e=1){return h.nanoseconds(Y(e,1e3))}static MICROSECOND=h.microseconds(1);static milliseconds(e=1){return h.microseconds(Y(e,1e3))}static MILLISECOND=h.milliseconds(1);static seconds(e=1){return h.milliseconds(Y(e,1e3))}static SECOND=h.seconds(1);static minutes(e=1){return h.seconds(Y(e,60))}static MINUTE=h.minutes(1);static hours(e){return h.minutes(Y(e,60))}static HOUR=h.hours(1);static days(e){return h.hours(Y(e,24))}static DAY=h.days(1);static MAX=new h((1n<<63n)-1n);static MIN=new h(0);static ZERO=new h(0);static z=a.z.union([a.z.object({value:a.z.bigint()}).transform(e=>new h(e.value)),a.z.string().transform(e=>new h(BigInt(e))),a.z.number().transform(e=>new h(e)),a.z.instanceof(h)])}let ot=class K extends H{constructor(e){super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new K(e).valueOf()}get period(){return h.seconds(1/this.valueOf())}sampleCount(e){return new h(e).seconds*this.valueOf()}byteCount(e,r){return this.sampleCount(e)*new S(r).valueOf()}span(e){return h.seconds(e/this.valueOf())}byteSpan(e,r){return this.span(e.valueOf()/r.valueOf())}static hz(e){return new K(e)}static khz(e){return K.hz(e*1e3)}static z=a.z.union([a.z.number().transform(e=>new K(e)),a.z.instanceof(K)])},S=class U extends H{constructor(e){super(e.valueOf())}length(e){return e.valueOf()/this.valueOf()}size(e){return new y(e*this.valueOf())}static UNKNOWN=new U(0);static BIT128=new U(16);static BIT64=new U(8);static BIT32=new U(4);static BIT16=new U(2);static BIT8=new U(1);static z=a.z.union([a.z.number().transform(e=>new U(e)),a.z.instanceof(U)])},q=class E{start;end;constructor(e,r){typeof e=="object"&&"start"in e?(this.start=new b(e.start),this.end=new b(e.end)):(this.start=new b(e),this.end=new b(r))}get span(){return new h(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 E(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,r=h.ZERO){if(r.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let n=this.start.sub(e.start).valueOf(),s=this.end.sub(e.end).valueOf();return n<0&&(n=-n),s<0&&(s=-s),n<=r.valueOf()&&s<=r.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,r=h.ZERO){e=e.makeValid();const n=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(n.start)||n.end.equals(e.start))return!1;const s=b.max(n.start,e.start),i=b.min(n.end,e.end);return i.before(s)?!1:new h(i.sub(s)).greaterThanOrEqual(r)}contains(e){return e instanceof E?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const r=new E(this.start,this.end);return e.start.after(this.start)&&(r.start=e.start),e.start.after(this.end)&&(r.end=e.start),e.end.before(this.end)&&(r.end=e.end),e.end.before(this.start)&&(r.start=e.end),r}static max(...e){return new E(b.min(...e.map(r=>r.start)),b.max(...e.map(r=>r.end)))}static MAX=new E(b.MIN,b.MAX);static MIN=new E(b.MAX,b.MIN);static ZERO=new E(b.ZERO,b.ZERO);static z=a.z.union([a.z.object({start:b.z,end:b.z}).transform(e=>new E(e.start,e.end)),a.z.instanceof(E)]);static sort(e,r){return b.sort(e.start,r.start)||b.sort(e.end,r.end)}},T=class u extends H{constructor(e){if(e instanceof u||typeof e=="string"||typeof e.valueOf()=="string")super(e.valueOf());else{const r=u.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(r==null)throw new Error(`unable to find data type for ${e.toString()}`);super(r.valueOf())}}get Array(){const e=u.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(r=>this.equals(r))}toString(){return this.valueOf()}get isVariable(){return this.equals(u.JSON)||this.equals(u.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(u.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=u.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsignedInteger(){return this.equals(u.UINT8)||this.equals(u.UINT16)||this.equals(u.UINT32)||this.equals(u.UINT64)}get isSignedInteger(){return this.equals(u.INT8)||this.equals(u.INT16)||this.equals(u.INT32)||this.equals(u.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsignedInteger&&e.isSignedInteger?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(u.INT32)&&e.equals(u.FLOAT64)||this.equals(u.INT8)&&e.equals(u.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsignedInteger===e.isUnsignedInteger:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}get usesBigInt(){return u.BIG_INT_TYPES.some(e=>e.equals(this))}static UNKNOWN=new u("unknown");static FLOAT64=new u("float64");static FLOAT32=new u("float32");static INT64=new u("int64");static INT32=new u("int32");static INT16=new u("int16");static INT8=new u("int8");static UINT64=new u("uint64");static UINT32=new u("uint32");static UINT16=new u("uint16");static UINT8=new u("uint8");static BOOLEAN=this.UINT8;static TIMESTAMP=new u("timestamp");static UUID=new u("uuid");static STRING=new u("string");static JSON=new u("json");static ARRAY_CONSTRUCTORS=new Map([[u.UINT8.toString(),Uint8Array],[u.UINT16.toString(),Uint16Array],[u.UINT32.toString(),Uint32Array],[u.UINT64.toString(),BigUint64Array],[u.FLOAT32.toString(),Float32Array],[u.FLOAT64.toString(),Float64Array],[u.INT8.toString(),Int8Array],[u.INT16.toString(),Int16Array],[u.INT32.toString(),Int32Array],[u.INT64.toString(),BigInt64Array],[u.TIMESTAMP.toString(),BigInt64Array],[u.STRING.toString(),Uint8Array],[u.JSON.toString(),Uint8Array],[u.UUID.toString(),Uint8Array]]);static ARRAY_CONSTRUCTOR_DATA_TYPES=new Map([[Uint8Array.name,u.UINT8],[Uint16Array.name,u.UINT16],[Uint32Array.name,u.UINT32],[BigUint64Array.name,u.UINT64],[Float32Array.name,u.FLOAT32],[Float64Array.name,u.FLOAT64],[Int8Array.name,u.INT8],[Int16Array.name,u.INT16],[Int32Array.name,u.INT32],[BigInt64Array.name,u.INT64]]);static DENSITIES=new Map([[u.UINT8.toString(),S.BIT8],[u.UINT16.toString(),S.BIT16],[u.UINT32.toString(),S.BIT32],[u.UINT64.toString(),S.BIT64],[u.FLOAT32.toString(),S.BIT32],[u.FLOAT64.toString(),S.BIT64],[u.INT8.toString(),S.BIT8],[u.INT16.toString(),S.BIT16],[u.INT32.toString(),S.BIT32],[u.INT64.toString(),S.BIT64],[u.TIMESTAMP.toString(),S.BIT64],[u.STRING.toString(),S.UNKNOWN],[u.JSON.toString(),S.UNKNOWN],[u.UUID.toString(),S.BIT128]]);static ALL=[u.UNKNOWN,u.FLOAT64,u.FLOAT32,u.INT64,u.INT32,u.INT16,u.INT8,u.UINT64,u.UINT32,u.UINT16,u.UINT8,u.TIMESTAMP,u.UUID,u.STRING,u.JSON];static BIG_INT_TYPES=[u.INT64,u.UINT64,u.TIMESTAMP];static z=a.z.union([a.z.string().transform(e=>new u(e)),a.z.instanceof(u)])};class y extends H{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return y.bytes(this.valueOf()+e.valueOf())}sub(e){return y.bytes(this.valueOf()-e.valueOf())}truncate(e){return new y(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return y.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/y.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/y.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/y.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/y.TERABYTE.valueOf()}toString(){const e=this.truncate(y.TERABYTE),r=this.truncate(y.GIGABYTE),n=this.truncate(y.MEGABYTE),s=this.truncate(y.KILOBYTE),i=this.truncate(y.BYTE),o=e,c=r.sub(e),l=n.sub(r),f=s.sub(n),g=i.sub(s);let p="";return o.isZero||(p+=`${o.terabytes}TB `),c.isZero||(p+=`${c.gigabytes}GB `),l.isZero||(p+=`${l.megabytes}MB `),f.isZero||(p+=`${f.kilobytes}KB `),(!g.isZero||p==="")&&(p+=`${g.valueOf()}B`),p.trim()}static bytes(e=1){return new y(e)}static BYTE=new y(1);static kilobytes(e=1){return y.bytes(e.valueOf()*1e3)}static KILOBYTE=y.kilobytes(1);static megabytes(e=1){return y.kilobytes(e.valueOf()*1e3)}static MEGABYTE=y.megabytes(1);static gigabytes(e=1){return y.megabytes(e.valueOf()*1e3)}static GIGABYTE=y.gigabytes(1);static terabytes(e){return y.gigabytes(e.valueOf()*1e3)}static TERABYTE=y.terabytes(1);static ZERO=new y(0);static z=a.z.union([a.z.number().transform(e=>new y(e)),a.z.instanceof(y)]);get isZero(){return this.valueOf()===0}}const ji=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)]),Ur=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof b||t instanceof h||t instanceof Date},Ri=(t,e,r,n=0)=>t.usesBigInt&&!e.usesBigInt?Number(r)-Number(n):!t.usesBigInt&&e.usesBigInt?BigInt(r.valueOf())-BigInt(n.valueOf()):Ie(r,-n),Ie=(t,e)=>e==0?t:t==0?e:typeof t=="bigint"&&typeof e=="bigint"||typeof t=="number"&&typeof e=="number"?t+e:Number(t)+Number(e),Li=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Di(t){return typeof t=="string"&&Li.test(t)}const $=[];for(let t=0;t<256;++t)$.push((t+256).toString(16).slice(1));function Pi(t,e=0){return($[t[e+0]]+$[t[e+1]]+$[t[e+2]]+$[t[e+3]]+"-"+$[t[e+4]]+$[t[e+5]]+"-"+$[t[e+6]]+$[t[e+7]]+"-"+$[t[e+8]]+$[t[e+9]]+"-"+$[t[e+10]]+$[t[e+11]]+$[t[e+12]]+$[t[e+13]]+$[t[e+14]]+$[t[e+15]]).toLowerCase()}function qi(t,e=0){const r=Pi(t,e);if(!Di(r))throw TypeError("Stringified UUID is invalid");return r}typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Cr=(t,e)=>qi(t,e),D=-1,ut={[Symbol.iterator]:()=>ut,next:()=>({done:!0,value:void 0})},ki=a.z.string().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer),Fi=a.z.union([a.z.null(),a.z.undefined()]).transform(()=>new Uint8Array().buffer),lt=10,jr=(t,e)=>{if(t==="number"&&!e.isNumeric)throw new Error(`cannot convert series of type ${e.toString()} to number`);if(t==="bigint"&&!e.usesBigInt)throw new Error(`cannot convert series of type ${e.toString()} to bigint`)},Rr="sy_x_telem_series";let At=class P{key;discriminator=Rr;dataType;sampleOffset;gl;_data;timeRange=q.ZERO;alignment=0n;cachedMin;cachedMax;writePos=D;_refCount=0;cachedLength;_cachedIndexes;static crudeZ=a.z.object({timeRange:q.z.optional(),dataType:T.z,alignment:a.z.coerce.bigint().optional(),data:a.z.union([ki,Fi,a.z.instanceof(ArrayBuffer),a.z.instanceof(Uint8Array)]),glBufferUsage:Ui.optional().default("static").optional()});static z=P.crudeZ.transform(e=>new P(e));constructor(e){Zi(e)&&(e={data:e}),e.data??=[];const{dataType:r,timeRange:n,sampleOffset:s=0,glBufferUsage:i="static",alignment:o=0n,key:c=Et(),data:l}=e;if(Lr(l)){const p=l;this.key=p.key,this.dataType=p.dataType,this.sampleOffset=p.sampleOffset,this.gl=p.gl,this._data=p._data,this.timeRange=p.timeRange,this.alignment=p.alignment,this.cachedMin=p.cachedMin,this.cachedMax=p.cachedMax,this.writePos=p.writePos,this._refCount=p._refCount,this.cachedLength=p.cachedLength;return}const f=Ur(l),g=Array.isArray(l);if(r!=null)this.dataType=new T(r);else{if(l instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(g||f){let p=l;if(!f){if(l.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");p=l[0]}if(typeof p=="string")this.dataType=T.STRING;else if(typeof p=="number")this.dataType=T.FLOAT64;else if(typeof p=="bigint")this.dataType=T.INT64;else if(typeof p=="boolean")this.dataType=T.BOOLEAN;else if(p instanceof b||p instanceof Date||p instanceof b)this.dataType=T.TIMESTAMP;else if(typeof p=="object")this.dataType=T.JSON;else throw new Error(`cannot infer data type of ${typeof p} when constructing a Series from a JS array`)}else this.dataType=new T(l)}if(!g&&!f)this._data=l;else if(g&&l.length===0)this._data=new this.dataType.Array([]).buffer;else{let p=f?[l]:l;const x=p[0];(x instanceof b||x instanceof Date||x instanceof h)&&(p=p.map(z=>new b(z).valueOf())),this.dataType.equals(T.STRING)?(this.cachedLength=p.length,this._data=new TextEncoder().encode(`${p.join(`
2
- `)}
3
- `).buffer):this.dataType.equals(T.JSON)?(this.cachedLength=p.length,this._data=new TextEncoder().encode(`${p.map(z=>Xe.encodeString(z)).join(`
4
- `)}
5
- `).buffer):this.dataType.usesBigInt&&typeof x=="number"?this._data=new this.dataType.Array(p.map(z=>BigInt(Math.round(z)))).buffer:!this.dataType.usesBigInt&&typeof x=="bigint"?this._data=new this.dataType.Array(p.map(Number)).buffer:this._data=new this.dataType.Array(p).buffer}this.key=c,this.alignment=o,this.sampleOffset=s??0,this.timeRange=n??q.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:i}}static alloc({capacity:e,dataType:r,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const s=new new T(r).Array(e),i=new P({data:s.buffer,dataType:r,...n});return i.writePos=0,i}get refCount(){return this._refCount}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){this._refCount--,this.refCount===0&&this.gl.control!=null?this.maybeGarbageCollectGLBuffer(this.gl.control):this.refCount<0&&console.warn("cannot release a series with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(e):this.writeFixed(e)}writeVariable(e){if(this.writePos===D)return 0;const r=this.byteCapacity.valueOf()-this.writePos,n=e.subBytes(0,r);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===D)return 0;const r=this.capacity-this.writePos,n=e.sub(0,r);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===D?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){return this.dataType.isVariable?new TextDecoder().decode(this.underlyingData).split(`
6
- `).slice(0,-1):Array.from(this).map(e=>e.toString())}parseJSON(e){if(!this.dataType.equals(T.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.toStrings().map(r=>e.parse(Xe.decodeString(r)))}get byteCapacity(){return new y(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===D?this.byteCapacity:this.dataType.isVariable?new y(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength!=null?this.cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===D?this.byteCapacity.valueOf()/this.dataType.density.valueOf():this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const r=[0];return this.data.forEach((n,s)=>{n===lt&&(e++,r.push(s+1))}),this._cachedIndexes=r,this.cachedLength=e,e}convert(e,r=0){if(this.dataType.equals(e))return this;const n=new e.Array(this.length);for(let s=0;s<this.length;s++)n[s]=Ri(this.dataType,e,this.data[s],r);return new P({data:n.buffer,dataType:e,timeRange:this.timeRange,sampleOffset:r,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(T.TIMESTAMP))this.cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMax=e.reduce((r,n)=>r>n?r:n)}else{const e=this.data;this.cachedMax=e.reduce((r,n)=>r>n?r:n)}return this.cachedMax}get max(){return this.calcMax()}calcMax(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this.cachedMax??=this.calcRawMax(),Ie(this.cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(T.TIMESTAMP))this.cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMin=e.reduce((r,n)=>r<n?r:n)}else{const e=this.data;this.cachedMin=e.reduce((r,n)=>r<n?r:n)}return this.cachedMin}get min(){return this.calcMin()}calcMin(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this.cachedMin??=this.calcRawMin(),Ie(this.cachedMin,this.sampleOffset))}get bounds(){return m(Number(this.min),Number(this.max),{makeValid:!1})}maybeRecomputeMinMax(e){if(this.cachedMin!=null){const r=e.cachedMin??e.calcRawMin();r<this.cachedMin&&(this.cachedMin=r)}if(this.cachedMax!=null){const r=e.cachedMax??e.calcRawMax();r>this.cachedMax&&(this.cachedMax=r)}}atAlignment(e,r){const n=Number(e-this.alignment);if(n<0||n>=this.length){if(r===!0)throw new Error(`[series] - no value at index ${n}`);return}return this.at(n,r)}at(e,r=!1){if(this.dataType.isVariable)return this.atVariable(e,r??!1);if(this.dataType.equals(T.UUID))return this.atUUID(e,r);e<0&&(e=this.length+e);const n=this.data[e];if(n==null){if(r===!0)throw new Error(`[series] - no value at index ${e}`);return}return Ie(n,this.sampleOffset)}atUUID(e,r){e<0&&(e=this.length+e);const n=Cr(new Uint8Array(this.buffer,e*this.dataType.density.valueOf()));if(n==null){if(r)throw new Error(`[series] - no value at index ${e}`);return}return n}atVariable(e,r){let n=0,s=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[e],s=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let o=0;o<this.data.length;o++)if(this.data[o]===lt){if(e===0){s=o;break}n=o+1,e--}if(s===0&&(s=this.data.length),n>=s||e>0){if(r)throw new Error(`[series] - no value at index ${e}`);return}}const i=this.data.slice(n,s);return this.dataType.equals(T.STRING)?new TextDecoder().decode(i):dt(JSON.parse(new TextDecoder().decode(i)))}binarySearch(e){let r=0,n=this.length-1;const s=Ee(e);for(;r<=n;){const i=Math.floor((r+n)/2),o=s(this.at(i,!0),e);if(o===0)return i;o<0?r=i+1:n=i-1}return r}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(T.FLOAT32)&&!this.dataType.equals(T.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:r,bufferUsage:n,prevBuffer:s}=this.gl;if(r==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==s)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==D){s===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const i=this.dataType.density.size(s).valueOf(),o=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,i,o.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,n==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=D}as(e){return jr(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:Pt(this.alignmentBounds.lower),upper:Pt(this.alignmentBounds.upper)},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}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 Yi(this);return this.dataType.equals(T.JSON)?new Vi(e):e}return this.dataType.equals(T.UUID)?new Wi(this):new Gi(this)}slice(e,r){return this.sliceSub(!1,e,r)}sub(e,r){return this.sliceSub(!0,e,r)}subIterator(e,r){return new Dt(this,e,r??this.length)}subAlignmentIterator(e,r){return new Dt(this,Number(e-this.alignment),Number(r-this.alignment))}subBytes(e,r){if(e>=0&&(r==null||r>=this.byteLength.valueOf()))return this;const n=this.data.subarray(e,r);return new P({data:n,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,r,n){if(r<=0&&(n==null||n>=this.length))return this;let s;return e?s=this.data.subarray(r,n):s=this.data.slice(r,n),new P({data:s,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(r)})}reAlign(e){return new P({data:this.buffer,dataType:this.dataType,timeRange:q.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){let e=`Series(${this.dataType.toString()} ${this.length} [`;if(this.length<=10)e+=Array.from(this).map(r=>r.toString());else{for(let r=0;r<5;r++)e+=`${this.at(r)?.toString()}`,e+=",";e+="...,";for(let r=-5;r<0;r++)e+=this.at(r)?.toString(),r<-1&&(e+=",")}return e+="])",e}};const Zi=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof At?!0:Ur(t),Lr=Bi(Rr,At);let Dt=class{series;end;index;constructor(e,r,n){this.series=e;const s=m(0,e.length);this.end=et(s,n),this.index=et(s,r)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}};class Yi{series;index;decoder;constructor(e){if(!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,r=this.series.data;for(;this.index<r.length&&r[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))})}}let Vi=class Dr{wrapped;static schema=a.z.record(a.z.string(),a.z.unknown());constructor(e){this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:Xe.decodeString(e.value,Dr.schema)}}},Wi=class{series;index;data;density;constructor(e){if(!e.dataType.equals(T.UUID))throw new Error("cannot create a UUID series iterator for a non-UUID series");this.series=e,this.index=0,this.data=new Uint8Array(e.buffer),this.density=T.UUID.density.valueOf()}next(){if(this.index>=this.series.length)return{done:!0,value:void 0};const e=Cr(this.data,this.index*this.density);return this.index++,{done:!1,value:e}}},Gi=class{series;index;constructor(e){this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},Hi=class{series;constructor(e=[]){if(e.length!==0){const r=e[0].dataType;for(let n=1;n<e.length;n++)if(!e[n].dataType.equals(r))throw new Error("[multi-series] - series must have the same data type")}this.series=e}as(e){return jr(e,this.dataType),this}get dataType(){return this.series.length===0?T.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?q.ZERO:new q(this.series[0].timeRange.start,this.series[this.series.length-1].timeRange.end)}get alignment(){return this.series.length===0?0n:this.series[0].alignment}get alignmentBounds(){return this.series.length===0?m(0n,0n):m(this.series[0].alignmentBounds.lower,this.series[this.series.length-1].alignmentBounds.upper)}push(e){const r=()=>new Error(`cannot push a ${e.dataType.toString()} series to a ${this.dataType.toString()} multi-series`),n=e.dataType.equals(this.dataType);if(Lr(e)){if(this.series.length!==0&&!n)throw r();this.series.push(e)}else{if(this.series.length!==0&&e.series.length!==0&&!n)throw r();this.series.push(...e.series)}}get length(){return this.series.reduce((e,r)=>e+r.length,0)}atAlignment(e,r){for(const n of this.series)if(N(n.alignmentBounds,e))return n.atAlignment(e,r);if(r)throw new Error(`[series] - no value at alignment ${e}`)}at(e,r=!1){e<0&&(e=this.length+e);for(const n of this.series){if(e<n.length)return n.at(e,r);e-=n.length}if(r)throw new Error(`[series] - no value at index ${e}`)}subIterator(e,r){return new We(this,e,r??this.length)}subAlignmentIterator(e,r){if(e>=this.alignmentBounds.upper||r<=this.alignmentBounds.lower)return ut;let n=0;for(let i=0;i<this.series.length;i++){const o=this.series[i];if(e<o.alignment)break;if(e>=o.alignmentBounds.upper)n+=o.length;else if(N(o.alignmentBounds,e)){n+=Number(e-o.alignment);break}}let s=0;for(let i=0;i<this.series.length;i++){const o=this.series[i];if(r<o.alignment)break;if(r>=o.alignmentBounds.upper)s+=o.length;else if(N(o.alignmentBounds,r)){s+=Number(r-o.alignment);break}}return new We(this,n,s)}subAlignmentSpanIterator(e,r){if(e>=this.alignmentBounds.upper)return ut;r=Math.min(r,Number(this.distance(e,this.alignmentBounds.upper)));let n=0;for(let s=0;s<this.series.length;s++){const i=this.series[s];if(e<i.alignment)break;if(e>=i.alignmentBounds.upper)n+=i.length;else if(N(i.alignmentBounds,e)){n+=Number(e-i.alignment);break}}return new We(this,n,n+r)}updateGLBuffer(e){this.series.forEach(r=>r.updateGLBuffer(e))}get bounds(){return sr(this.series.map(e=>e.bounds))}get byteLength(){return new y(this.series.reduce((e,r)=>e+r.byteLength.valueOf(),0))}get data(){const e=new this.dataType.Array(this.length);let r=0;for(const n of this.series)e.set(n.data,r),r+=n.length;return new this.dataType.Array(e.buffer)}traverseAlignment(e,r){const n=this.series.map(s=>s.alignmentBounds);return ir(n,e,r)}acquire(e){this.series.forEach(r=>r.acquire(e))}release(){this.series.forEach(e=>e.release())}distance(e,r){const n=this.series.map(s=>s.alignmentBounds);return ar(n,e,r)}parseJSON(e){if(!this.dataType.equals(T.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.series.flatMap(r=>r.parseJSON(e))}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new Ji(this.series)}toStrings(){return this.series.flatMap(e=>e.toStrings())}},Ji=class{series;seriesIndex;internal;constructor(e){this.series=e,this.seriesIndex=0,this.internal=e[0][Symbol.iterator]()}next(){const e=this.internal.next();return e.done===!1?e:this.seriesIndex===this.series.length-1?{done:!0,value:void 0}:(this.internal=this.series[++this.seriesIndex][Symbol.iterator](),this.next())}[Symbol.iterator](){return this}},We=class{series;index;end;constructor(e,r,n){this.series=e,this.end=n,this.index=r}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}};const Pt=t=>{const e=t>>32n,r=t&0xffffffffn;return{domain:e,sample:r}};a.z.object({key:a.z.string(),value:a.z.string()});const Xi=a.z.record(a.z.union([a.z.number(),a.z.string(),a.z.symbol()]),a.z.unknown()),Bt=t=>Object.entries(t),Ki=(t,e)=>Object.fromEntries(Bt(t).map(([r,n])=>[r,e(n,r)])),Qi=t=>Object.fromEntries(Bt(t).filter(([e,r])=>r!==void 0)),_i=Object.freeze(Object.defineProperty({__proto__:null,entries:Bt,map:Ki,purgeUndefined:Qi,unknownZ:Xi},Symbol.toStringTag,{value:"Module"})),Pr=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",ea=Pr(),qr=["macOS","Windows","Linux"],ta=["macos","windows","linux"],ra={macos:"macOS",windows:"Windows",linux:"Linux"},na=a.z.enum(qr).or(a.z.enum(ta).transform(t=>ra[t])),sa=()=>{if(typeof window>"u")return;const t=window.navigator.userAgent.toLowerCase();if(t.includes("mac"))return"macOS";if(t.includes("win"))return"Windows";if(t.includes("linux"))return"Linux"};let Ge;const ia=(t={})=>{const{force:e,default:r}=t;return e??Ge??(Ge=sa(),Ge??r)},aa=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:qr,RUNTIME:ea,detect:Pr,getOS:ia,osZ:na},Symbol.toStringTag,{value:"Module"})),oa=(...t)=>t.map(kr).join(""),kr=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),ua=t=>t.endsWith("/")?t.slice(0,-1):t;class ze{protocol;host;port;path;constructor({host:e,port:r,protocol:n="",pathPrefix:s=""}){this.protocol=n,this.host=e,this.port=r,this.path=kr(s)}replace(e){return new ze({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new ze({...this,pathPrefix:oa(this.path,e)})}toString(){return ua(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}static UNKNOWN=new ze({host:"unknown",port:0})}const la=2,ca=3,ha=2,fa=(t,e)=>{if(Number.isNaN(t)||!Number.isFinite(t))return t;const r=ye(e);if(r==0)return t;let n;r>=1e3?n=la:r>=1?n=ca:n=Math.ceil(-Math.log10(r))+ha;const s=10**n;return Math.round(t*s)/s},da=Object.freeze(Object.defineProperty({__proto__:null,abs:rr,add:er,closeTo:Zn,div:Wn,equal:_e,max:Vn,min:tr,mult:Y,roundBySpan:fa,roundToNearestMagnitude:Yn,sub:ae},Symbol.toStringTag,{value:"Module"}));a.z.object({baseInterval:h.z.optional(),maxRetries:a.z.number().optional(),scale:a.z.number().optional()});const ga=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,Fr=a.z.string().regex(ga),Q=a.z.number().min(0).max(255),Zr=a.z.number().min(0).max(1),ke=a.z.tuple([Q,Q,Q,Zr]),pa=a.z.tuple([Q,Q,Q]),ya=a.z.object({rgba255:ke}),ma=a.z.number().min(0).max(360),ba=a.z.number().min(0).max(100),wa=a.z.number().min(0).max(100),Yr=a.z.tuple([ma,ba,wa,Zr]),Fe=a.z.union([Fr,pa,ke,Yr,ya]),Ze=Fe.transform(t=>w(t)),Oa=t=>Ze.safeParse(t).success,Ta=t=>ke.safeParse(t).success,va=t=>{if(t==null)return;const e=Ze.safeParse(t);if(e.success)return Wr(e.data);if(typeof t=="string")return t;throw e.error},w=(t,e=1)=>{if(t=Fe.parse(t),typeof t=="string")return Ua(t,e);if(Array.isArray(t)){if(t.length<3||t.length>4)throw new Error(`Invalid color: [${t.join(", ")}]`);return t.length===3?[...t,e]:t}return t.rgba255},Vr=(t,e)=>{if(t==null||e==null)return t==e;const r=w(t),n=w(e);return r.every((s,i)=>s===n[i])},$a=t=>{if(t==null)return;const[e,r,n,s]=w(t);return`#${we(e)}${we(r)}${we(n)}${s===1?"":we(s*255)}`},Wr=t=>{const[e,r,n,s]=w(t);return`rgba(${e}, ${r}, ${n}, ${s})`},xa=t=>`rgb(${Gr(t)})`,Gr=t=>{const[e,r,n]=w(t);return`${e}, ${r}, ${n}`},Sa=t=>[...Ut(t),ce(t)],Ut=t=>[oe(t)/255,ue(t)/255,le(t)/255],oe=t=>w(t)[0],ue=t=>w(t)[1],le=t=>w(t)[2],ce=t=>w(t)[3],Na=t=>Vr(Ct,t),Ia=t=>Ra(w(t)),za=(t,e)=>{const[r,n,s]=w(t);if(e>100)throw new Error(`Color opacity must be between 0 and 100, got ${e}`);return e>1&&(e/=100),[r,n,s,e]},ge=t=>{const[e,r,n]=Ut(t).map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return Number((.2126*e+.7152*r+.0722*n).toFixed(3))},Ma=t=>{const[e,r,n]=Ut(t);return 1-(Math.max(e,r,n)-Math.min(e,r,n))},ct=(t,e)=>{const r=w(t),n=w(e),s=ge(r),i=ge(n);return(Math.max(s,i)+.5)/(Math.min(s,i)+.5)},Ea=(t,...e)=>{if(e.length===0)throw new Error("[Color.pickByContrast] - must provide at least one color");const r=w(t),[n]=e.sort((s,i)=>ct(r,i)-ct(r,s));return w(n)},Aa=t=>ge(t)<.5,Ba=t=>ge(t)>.5,Ua=(t,e=1)=>(t=Fr.parse(t),t=Ca(t),[Oe(t,0),Oe(t,2),Oe(t,4),t.length===8?Oe(t,6)/255:e]),Ct=[0,0,0,0],we=t=>Math.floor(t).toString(16).padStart(2,"0"),Oe=(t,e)=>parseInt(t.slice(e,e+2),16),Ca=t=>t.startsWith("#")?t.slice(1):t,ja=t=>{t=Yr.parse(t);let[e,r,n]=t;const s=t[3];e/=360,r/=100,n/=100;let i,o,c;if(r===0)i=o=c=n;else{const l=n<.5?n*(1+r):n+r-n*r,f=2*n-l;i=He(f,l,e+1/3),o=He(f,l,e),c=He(f,l,e-1/3)}return[Math.round(i*255),Math.round(o*255),Math.round(c*255),s]},He=(t,e,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t),Ra=t=>{t=ke.parse(t);let[e,r,n]=t;const s=t[3];e/=255,r/=255,n/=255;const i=Math.max(e,r,n),o=Math.min(e,r,n);let c,l,f=(i+o)/2;if(i===o)c=l=0;else{const g=i-o;l=f>.5?g/(2-i-o):g/(i+o),i===e?c=(r-n)/g+(r<n?6:0):i===r?c=(n-e)/g+2:c=(e-r)/g+4,c/=6}return c*=360,l*=100,f*=100,[Math.round(c),Math.round(l),Math.round(f),s]},La=w("#000000"),Da=w("#ffffff"),Hr=a.z.object({key:a.z.string(),color:Fe,position:a.z.number(),switched:a.z.boolean().optional()}),Pa=a.z.array(Hr),qa=(t,e)=>{if(t.length===0)return Ct;if(t=t.slice().sort((r,n)=>r.position-n.position),e<=t[0].position)return w(t[0].color);if(e>=t[t.length-1].position)return w(t[t.length-1].color);for(let r=0;r<t.length-1;r++){const n=t[r],s=t[r+1];if(e<n.position||e>s.position)continue;if(e===n.position)return w(n.color);if(e===s.position)return w(s.color);const i=(e-n.position)/(s.position-n.position),o=w(n.color),c=w(s.color),l=Math.round(oe(o)+i*(oe(c)-oe(o))),f=Math.round(ue(o)+i*(ue(c)-ue(o))),g=Math.round(le(o)+i*(le(c)-le(o))),p=ce(o)+i*(ce(c)-ce(o));return w([l,f,g,p])}return w(t[t.length-1].color)},ka=a.z.object({key:a.z.string(),name:a.z.string(),color:Ze}),Fa=a.z.object({key:a.z.string(),name:a.z.string(),swatches:a.z.array(ka)}),Jr=Object.freeze(Object.defineProperty({__proto__:null,BLACK:La,WHITE:Da,ZERO:Ct,aValue:ce,bValue:le,colorZ:Ze,construct:w,contrast:ct,crudeZ:Fe,cssString:va,equals:Vr,fromGradient:qa,fromHSLA:ja,gValue:ue,gradientZ:Pa,grayness:Ma,hex:$a,hsla:Ia,isColor:Ta,isCrude:Oa,isDark:Aa,isLight:Ba,isZero:Na,luminance:ge,paletteZ:Fa,pickByContrast:Ea,rValue:oe,rgbCSS:xa,rgbString:Gr,rgba1:Sa,rgbaCSS:Wr,setAlpha:za,stopZ:Hr},Symbol.toStringTag,{value:"Module"})),Xr=a.z.int().min(0).max(255),Kr=255,Qr=0,Za={lower:Qr,upper:Kr+1},_r=a.z.object({name:a.z.string(),key:a.z.string()}),pe=t=>a.z.object({subject:_r,resource:t,authority:Xr}),Ya=(...t)=>e=>e.filter(r=>{let n=!1;return r.to!=null&&(n=t.includes(r.to.resource)),r.from!=null&&!n&&(n=t.includes(r.from.resource)),n}),en=t=>a.z.object({from:pe(t),to:a.z.null()}),tn=t=>a.z.object({from:a.z.null(),to:pe(t)}),Va=t=>a.z.union([en(t),tn(t),a.z.object({from:pe(t),to:pe(t)})]),Wa=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:Kr,AUTHORITY_BOUNDS:Za,ZERO_AUTHORITY:Qr,acquireZ:tn,authorityZ:Xr,filterTransfersByChannelKey:Ya,releaseZ:en,stateZ:pe,subjectZ:_r,transferZ:Va},Symbol.toStringTag,{value:"Module"})),Ga=t=>Object.getOwnPropertySymbols(globalThis).includes(t),Ha=(t,e)=>{const r=Symbol.for(t);if(!Ga(r)){const n=e();Object.defineProperty(globalThis,r,{value:n})}return()=>globalThis[r]},rn="sy_x_error",Ja=t=>e=>e!=null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"?e.type.startsWith(t):e instanceof Error?e.message.startsWith(t):typeof e!="string"?!1:e.startsWith(t),nn=t=>class ie extends Error{static discriminator=rn;discriminator=ie.discriminator;static TYPE=t;type=ie.TYPE;static matches=Ja(t);matches=ie.matches;constructor(r,n){super(r,n),this.name=ie.TYPE}static sub(r){return nn(`${t}.${r}`)}},Xa=t=>{if(t==null||typeof t!="object")return!1;const e=t;if(e.discriminator!==rn)return!1;if(!("type"in e))throw new Error(`X Error is missing its type property: ${JSON.stringify(e)}`);return!0},re="unknown",qt="nil";class Ka{providers=[];register(e){this.providers.push(e)}encode(e){if(e==null)return{type:qt,data:""};if(Xa(e))for(const r of this.providers){const n=r.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:re,data:e.message};if(typeof e=="string")return{type:re,data:e};try{return{type:re,data:JSON.stringify(e)}}catch{return{type:re,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===qt)return null;if(e.type===re)return new kt(e.data);for(const r of this.providers){const n=r.decode(e);if(n!=null)return n}return new kt(e.data)}}Ha("synnax-error-registry",()=>new Ka);class kt extends nn("unknown"){}a.z.object({type:a.z.string(),data:a.z.string()});const Qa=()=>new Promise(t=>setTimeout(t,0)),_a=t=>t?-1:1,eo=a.object({jsonrpc:a.literal("2.0"),method:a.string(),params:a.any().optional(),id:a.union([a.string(),a.number(),a.null()]).optional()}),sn=a.object({jsonrpc:a.literal("2.0"),id:a.union([a.string(),a.number(),a.null()])}),to=sn.extend({result:a.json()}),ro=sn.extend({error:a.object({code:a.number().int(),message:a.string().optional(),data:a.json().optional()})}),no=a.union([to,ro]);a.union([eo,no]);const so=(t,e,r)=>{const n=t.get(e);return n===void 0?(t.set(e,r),r):n},io=Object.freeze(Object.defineProperty({__proto__:null,getOrSetDefault:so},Symbol.toStringTag,{value:"Module"})),ht=a.z.string().regex(/^\d+\.\d+\.\d+$/),me=(t,e,r={})=>{r.checkMajor??=!0,r.checkMinor??=!0,r.checkPatch??=!0;const n=ht.parse(t),s=ht.parse(e),[i,o,c]=n.split(".").map(Number),[l,f,g]=s.split(".").map(Number);if(r.checkMajor){if(i<l)return ve;if(i>l)return $e}if(r.checkMinor){if(o<f)return ve;if(o>f)return $e}if(r.checkPatch){if(c<g)return ve;if(c>g)return $e}return _},ao=(t,e,r={})=>Xt(me(t,e,r)),an=(t,e,r={})=>Jt(me(t,e,r)),oo=(t,e,r={})=>Ht(me(t,e,r)),uo=({name:t,migrate:e})=>r=>{try{const n=e(r);return console.log(`${t} migrated: ${r.version} -> ${n.version}`),n}catch(n){throw console.log(`${t} failed to migrate from ${r.version}`),console.error(n),n}},lo=({name:t,migrations:e,targetSchema:r,defaultVersion:n,def:s})=>{const i=Object.keys(e).sort(me).pop();if(i==null)return f=>{if(f.version??=n,f.version!==s.version)return console.log(`${t} version ${f.version} is newer than latest version of ${s.version}.
7
- Returning default instead.
8
- `),s;try{return r!=null?r.parse(f):f}catch(g){return console.log(`${t} failed to parse default. Exiting with default`),console.error(g),s}};const o=Object.keys(e).length;let c=!1;const l=f=>{try{if(o===0||an(f.version,i))return console.log(c?`${t} ${f.version} now up to date`:`${t} version ${f.version} is up to date with target version ${s.version}`),f;const g=f.version,p=e[g],x=p(f);return c=!0,l(x)}catch(g){return console.log(`${t} failed to migrate from ${f.version} to ${i}`),console.error(g),s}};return f=>{try{if(f.version==null)if(n!=null)console.log(`${t} version is null. Setting version to default of ${n}`),f.version=n;else return console.log(`${t} version is null and no default version set. Exiting with default`),s;return l(f)}catch(g){return console.log(`${t} failed to parse final result. Exiting with default`),console.error(g),s}}},co=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:me,createMigration:uo,migrator:lo,semVerNewer:an,semVerOlder:oo,semVerZ:ht,versionsEqual:ao},Symbol.toStringTag,{value:"Module"})),on=["standard","scientific","engineering"],ho=a.z.enum(on),fo=(t,e,r)=>{if(Number.isNaN(t))return"NaN";if(t===1/0)return"∞";if(t===-1/0)return"-∞";if(r==="standard")return t.toFixed(e);if(t===0)return e===0?"0ᴇ0":`0.${"0".repeat(e)}ᴇ0`;let n;return r==="scientific"?n=Math.floor(Math.log10(Math.abs(t))):n=Math.floor(Math.log10(Math.abs(t))/3)*3,`${(t/10**n).toFixed(e)}ᴇ${n}`},go=Object.freeze(Object.defineProperty({__proto__:null,NOTATIONS:on,notationZ:ho,stringifyNumber:fo},Symbol.toStringTag,{value:"Module"})),po=t=>Array.isArray(t)?[...t]:typeof t=="object"&&t!==null?{...t}:t,un=a.z.enum(["success","info","warning","error","loading","disabled"]),yo=t=>a.z.object({key:a.z.string(),variant:un,message:a.z.string(),description:a.z.string().optional(),time:b.z,details:t??a.z.unknown().optional()}),mo=(t,e)=>{if(!(t instanceof Error))throw t;return ln({variant:"error",message:e??t.message,description:e!=null?t.message:void 0,details:{stack:t.stack??""}})},ln=t=>({key:Et(),time:b.now(),...t}),bo=Object.freeze(Object.defineProperty({__proto__:null,create:ln,fromException:mo,statusZ:yo,variantZ:un},Symbol.toStringTag,{value:"Module"})),wo=(t,e="")=>{const r=t.length;return r===0?e:r===1?t[0]:r===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t[r-1]}`},Oo=t=>{const e=t.split(" "),r=new Set,n=e.map(o=>o.charAt(0).toLowerCase()).join("");r.add(n.replace(/-/g,"_")),r.add(n.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"));const s=/\d+/g;t.match(s)&&e.forEach((o,c)=>{if(s.test(o)){const l=e.map((f,g)=>g!==c?f.charAt(0).toLowerCase():f).join("");r.add(l.replace(/-/g,"_")),r.add(l.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"))}});const i=e.map(o=>(o.length>3?o.substring(0,3):o).toLowerCase());return r.add(i.join("").replace(/-/g,"_")),r.add(i.join("_").replace(/-/g,"_")),Array.from(r).filter(o=>o.length>=2&&o.length<=12&&!/^\d/.test(o))},To=(t,e)=>t.startsWith(e)?t.slice(e.length):t,vo=Object.freeze(Object.defineProperty({__proto__:null,createShortIdentifiers:Oo,naturalLanguageJoin:wo,trimPrefix:To},Symbol.toStringTag,{value:"Module"})),$o=new Error("request for lock canceled");var xo=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function c(g){try{f(n.next(g))}catch(p){o(p)}}function l(g){try{f(n.throw(g))}catch(p){o(p)}}function f(g){g.done?i(g.value):s(g.value).then(c,l)}f((n=n.apply(t,e||[])).next())})};class So{constructor(e,r=$o){this._value=e,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,s)=>{const i={resolve:n,reject:s,weight:e,priority:r},o=cn(this._queue,c=>r<=c.priority);o===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(o+1,0,i)})}runExclusive(e){return xo(this,arguments,void 0,function*(r,n=1,s=0){const[i,o]=yield this.acquire(n,s);try{return yield r(i)}finally{o()}})}waitForUnlock(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,r)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),No(this._weightedWaiters[e-1],{resolve:n,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const r=this._value;this._value-=e.weight,e.resolve([r,this._newReleaser(e.weight)])}_newReleaser(e){let r=!1;return()=>{r||(r=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const r=this._weightedWaiters[e-1];r&&(r.forEach(n=>n.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let r=this._value;r>0;r--){const n=this._weightedWaiters[r-1];if(!n)continue;const s=n.findIndex(i=>i.priority<=e);(s===-1?n:n.splice(0,s)).forEach(i=>i.resolve())}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}}function No(t,e){const r=cn(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function cn(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var Io=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function c(g){try{f(n.next(g))}catch(p){o(p)}}function l(g){try{f(n.throw(g))}catch(p){o(p)}}function f(g){g.done?i(g.value):s(g.value).then(c,l)}f((n=n.apply(t,e||[])).next())})};class zo{constructor(e){this._semaphore=new So(1,e)}acquire(){return Io(this,arguments,void 0,function*(e=0){const[,r]=yield this._semaphore.acquire(1,e);return r})}runExclusive(e,r=0){return this._semaphore.runExclusive(()=>e(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class hn extends zo{constructor(e){super(),Object.assign(this,e)}}const Mo=t=>new hn(t),Eo=Object.freeze(Object.defineProperty({__proto__:null,mutex:hn,newMutex:Mo},Symbol.toStringTag,{value:"Module"}));function fn(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(r=fn(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function dn(){for(var t,e,r=0,n="",s=arguments.length;r<s;r++)(t=arguments[r])&&(e=fn(t))&&(n&&(n+=" "),n+=e);return n}const Ao=dn,J="-",Ft="__",Te="--",jt=t=>{const e=(...r)=>Ao(...r);return e.B=(...r)=>t+J+r.join(J),e.E=r=>t+Ft+r,e.M=(...r)=>t+Te+r.join("-"),e.BM=(r,...n)=>e.B(r)+Te+n.join("-"),e.BE=(r,...n)=>e.B(r)+Ft+n.join(J),e.BEM=(r,n,...s)=>e.BE(r,n)+Te+s.join(J),e.extend=r=>jt(e.B(r)),e.var=(...r)=>Te+t+J+r.join(J),e};class Bo{rows=[];columns=[];prefix;constructor(e=""){this.prefix=e}row(e,r,n){const{prefix:s}=this;return this.rows.push({startLabel:s+e,endLabel:s+r,size:n}),this}col(e,r,n){const{prefix:s}=this;return this.columns.push({startLabel:s+e,endLabel:s+r,size:n}),this}build(){return{display:"grid",gridTemplateRows:this.rows.map((e,r)=>{let n=r===0?"[":"";return n+=`${e.startLabel}] ${e.size}${typeof e.size=="number"?"px":""} [${e.endLabel}`,n+=r===this.rows.length-1?"]":"",n}).join(" "),gridTemplateColumns:this.columns.map((e,r)=>{let n=r===0?"[":"";return n+=`${e.startLabel}] ${e.size}${typeof e.size=="number"?"px":""} [${e.endLabel}`,n+=r===this.columns.length-1?"]":"",n}).join(" ")}}}const Uo=(t,e)=>Object.entries(e).forEach(([r,n])=>n!=null&&t.style.setProperty(r,`${n}`)),Co=(t,e)=>Array.from(t.style).forEach(r=>{r.startsWith(e)&&t.style.removeProperty(r)}),jo=t=>{const e=jt(t);return e.visible=r=>e.M(r?"visible":"hidden"),e.expanded=r=>e.M(r?"expanded":"collapsed"),e.loc=r=>e.M("location",pr.construct(r)),e.disabled=r=>r===!0&&e.M("disabled"),e.align=r=>e.M(r),e.dir=r=>r!=null&&e.M("direction",ur.construct(r)),e.sharp=r=>r!==!1&&e.M("sharp"),e.rounded=r=>r!==!1&&e.M("rounded"),e.bordered=r=>typeof r=="boolean"?r&&e.M("bordered"):r!=null?e.M(`bordered-${r.toString()}`):e.M("bordered"),e.selected=r=>r&&e.M("selected"),e.altColor=r=>r&&e.M("alt-color"),e.editable=r=>r&&e.M("editable"),e.noSelect=e.M("no-select"),e.applyVars=Uo,e.removeVars=Co,e.newGridBuilder=r=>new Bo(r),e.dropRegion=r=>r&&e.B("haul-drop-region"),e.px=r=>`${r}px`,e.inheritDims=(r=!0)=>r&&e.M("inherit-dims"),e.shade=r=>r!=null&&e.M(`shade-${r}`),e.colorVar=r=>{if(!(r==null||r===!1))return typeof r=="number"?`var(--${t}-gray-l${r})`:Jr.cssString(r)},e.levelSizeVar=r=>`var(--${t}-${r}-size)`,e.level=r=>e.M(`level-${r}`),e},Ro=jo("pluto");exports.$=fr;exports.$t=Ai;exports.B=De;exports.Bo=zr;exports.C=Ii;exports.CSS=Ro;exports.D=dr;exports.E=ot;exports.Ho=ai;exports.I=At;exports.K=Cs;exports.K$1=pr;exports.Mo=Ir;exports.O=Sn;exports.Oo=Nr;exports.P=lr;exports.R=Er;exports.S=aa;exports.T=ee;exports.Vt=Hi;exports.W=as;exports.Yt=ji;exports._=mi;exports._r=bo;exports.a=h;exports.ar=Wa;exports.br=po;exports.c=$n;exports.c$1=O;exports.clsx=dn;exports.d=S;exports.d$1=j;exports.fr=_a;exports.g=ur;exports.h=y;exports.hr=io;exports.i=je;exports.ir=Jr;exports.k=Bn;exports.mr=go;exports.n=b;exports.newBEM=jt;exports.nr=da;exports.pr=co;exports.r=T;exports.t=R;exports.u=_i;exports.ur=Qa;exports.w=q;exports.w$1=cr;exports.w$2=C;exports.wr=Eo;exports.x=Le;exports.y=B;exports.yr=vo;exports.z=On;