@synnaxlabs/pluto 0.46.2 → 0.46.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 (87) hide show
  1. package/dist/{Toggle-Djy3iEFS.js → Toggle-BvHOvpZl.js} +1 -1
  2. package/dist/{Toggle-D7uuc8BY.cjs → Toggle-YrCaaWoP.cjs} +1 -1
  3. package/dist/{Video-Com7iIjJ.js → Video-B3mUCF7w.js} +1 -1
  4. package/dist/{Video-BgaQjOlJ.cjs → Video-PX9PWa1_.cjs} +1 -1
  5. package/dist/button.cjs +1 -1
  6. package/dist/button.js +1 -1
  7. package/dist/color.cjs +1 -1
  8. package/dist/color.js +1 -1
  9. package/dist/css-BJh3xDSW.cjs +8 -0
  10. package/dist/{css-qKD7ZG81.js → css-C24hS2UX.js} +903 -875
  11. package/dist/css.cjs +1 -1
  12. package/dist/css.js +2 -2
  13. package/dist/dialog.cjs +1 -1
  14. package/dist/dialog.js +1 -1
  15. package/dist/ether.cjs +1 -1
  16. package/dist/ether.js +6 -6
  17. package/dist/{external-CfY-kR5_.js → external-1ucYXJx8.js} +2 -2
  18. package/dist/{external-Bfddv9ir.cjs → external-BwkIuXvQ.cjs} +1 -1
  19. package/dist/{external-CG-WeHt1.js → external-C-ExavVe.js} +3 -3
  20. package/dist/{external-C0szVQZ4.js → external-CC9QgzfY.js} +3 -3
  21. package/dist/{external-BwAIT4Et.js → external-Cg3K8ETl.js} +4 -4
  22. package/dist/{external-Bp0LGk7L.cjs → external-ChJFeBx4.cjs} +1 -1
  23. package/dist/{external-BwzXukg6.js → external-ChfziUeG.js} +2 -2
  24. package/dist/{external-fThC1Pt0.js → external-Ck9vwLNn.js} +3 -3
  25. package/dist/{external-iLU86byd.cjs → external-Clg5_LVL.cjs} +1 -1
  26. package/dist/{external-BatQDwpn.cjs → external-CtPQhs2L.cjs} +1 -1
  27. package/dist/{external-R1DnhHJ8.cjs → external-D-7LQcc1.cjs} +1 -1
  28. package/dist/{external-ok-onqCX.cjs → external-D7ez6YFA.cjs} +1 -1
  29. package/dist/{external-CtIn5ns5.js → external-DSC98ftR.js} +3 -3
  30. package/dist/{external-JI_JLXE9.cjs → external-DcJjrD1A.cjs} +2 -2
  31. package/dist/{external-qAqWNZPd.cjs → external-DfxokOST.cjs} +1 -1
  32. package/dist/{external-DPsERPGZ.js → external-Dia3MCeO.js} +3 -3
  33. package/dist/external-Dxu0KYI_.cjs +1 -0
  34. package/dist/{external-BH7AW9vg.cjs → external-NOoRXXaT.cjs} +1 -1
  35. package/dist/{external-B_BNwXoG.js → external-RDyCOmKR.js} +21 -21
  36. package/dist/{external-BXAiwKcS.js → external-S4v-IR_C.js} +3 -3
  37. package/dist/{external-CaehDJtX.cjs → external-VIR_Vvod.cjs} +1 -1
  38. package/dist/{external-BqSq3_g3.js → external-mtaOrZVh.js} +2 -2
  39. package/dist/{external-DZ9ZLLOd.cjs → external-orHcg1KY.cjs} +1 -1
  40. package/dist/{external-CM-K5NTq.js → external-ree9J7kb.js} +1 -1
  41. package/dist/{external-DLIuO7_6.cjs → external-s4B9EjQm.cjs} +1 -1
  42. package/dist/{external-CwtqVaYf.js → external-wP76ag3P.js} +4 -6
  43. package/dist/flex.cjs +1 -1
  44. package/dist/flex.js +1 -1
  45. package/dist/{fontString-BpD7ezh8.cjs → fontString-BMITZjR-.cjs} +1 -1
  46. package/dist/{fontString-CpT1noV1.js → fontString-CNdpxtJg.js} +2 -2
  47. package/dist/header.cjs +1 -1
  48. package/dist/header.js +1 -1
  49. package/dist/index.cjs +12 -12
  50. package/dist/index.js +4689 -4692
  51. package/dist/input.cjs +1 -1
  52. package/dist/input.js +1 -1
  53. package/dist/list.cjs +1 -1
  54. package/dist/list.js +1 -1
  55. package/dist/{main-DCwBsS0F.js → main-9Dw_ngUE.js} +3 -3
  56. package/dist/{main-20msMsI6.cjs → main-rewFivKu.cjs} +30 -30
  57. package/dist/menu.cjs +1 -1
  58. package/dist/menu.js +1 -1
  59. package/dist/pluto.css +1 -1
  60. package/dist/{provider-B-VPfAGa.js → provider-BMcIM58p.js} +3 -3
  61. package/dist/{provider-D295Uocj.cjs → provider-CedWF-id.cjs} +3 -3
  62. package/dist/{provider-qIzR8Puy.js → provider-DXuSQEu0.js} +2816 -2791
  63. package/dist/provider-DshN-WBB.cjs +83 -0
  64. package/dist/src/color/GradientPicker.d.ts.map +1 -1
  65. package/dist/src/ontology/queries.d.ts +3 -10
  66. package/dist/src/ontology/queries.d.ts.map +1 -1
  67. package/dist/src/schematic/symbol/queries.d.ts +1 -3
  68. package/dist/src/schematic/symbol/queries.d.ts.map +1 -1
  69. package/dist/tabs.cjs +1 -1
  70. package/dist/tabs.js +1 -1
  71. package/dist/text.cjs +1 -1
  72. package/dist/text.js +2 -2
  73. package/dist/theming.cjs +1 -1
  74. package/dist/theming.js +2 -2
  75. package/dist/tree.cjs +1 -1
  76. package/dist/tree.js +1 -1
  77. package/dist/triggers.cjs +1 -1
  78. package/dist/triggers.js +1 -1
  79. package/dist/{units-WtYBE1br.js → units-BfWwpiDe.js} +1 -1
  80. package/dist/units-DOj-2MGY.cjs +1 -0
  81. package/dist/video.cjs +1 -1
  82. package/dist/video.js +1 -1
  83. package/package.json +3 -3
  84. package/dist/css-DA2F4zE4.cjs +0 -8
  85. package/dist/external-BaO1j7U1.cjs +0 -1
  86. package/dist/provider-DVqod4rl.cjs +0 -83
  87. package/dist/units-CLbZ5ejs.cjs +0 -1
@@ -1,5 +1,5 @@
1
1
  import { j as p } from "./jsx-runtime-OVHDjVDe.js";
2
- import { B as a } from "./main-DCwBsS0F.js";
2
+ import { B as a } from "./main-9Dw_ngUE.js";
3
3
  const u = ({
4
4
  value: o,
5
5
  onClick: s,
@@ -1 +1 @@
1
- "use strict";const f=require("./jsx-runtime-Dszzpdy0.cjs"),x=require("./main-20msMsI6.cjs"),a=({value:n,onClick:o,onChange:e,checkedVariant:s="filled",uncheckedVariant:i,rightClickToggle:r=!1,...u})=>f.jsxRuntimeExports.jsx(x.Button,{onClick:t=>{o?.(t),!r&&e(!n)},onContextMenu:t=>{r&&(t.preventDefault(),t.stopPropagation(),e(!n))},variant:n?s:i,...u});exports.Toggle=a;
1
+ "use strict";const f=require("./jsx-runtime-Dszzpdy0.cjs"),x=require("./main-rewFivKu.cjs"),a=({value:n,onClick:o,onChange:e,checkedVariant:s="filled",uncheckedVariant:i,rightClickToggle:r=!1,...u})=>f.jsxRuntimeExports.jsx(x.Button,{onClick:t=>{o?.(t),!r&&e(!n)},onContextMenu:t=>{r&&(t.preventDefault(),t.stopPropagation(),e(!n))},variant:n?s:i,...u});exports.Toggle=a;
@@ -1,5 +1,5 @@
1
1
  import { j as o } from "./jsx-runtime-OVHDjVDe.js";
2
- import { C as t } from "./css-qKD7ZG81.js";
2
+ import { C as t } from "./css-C24hS2UX.js";
3
3
  const i = ({ href: e, className: r, ...s }) => /* @__PURE__ */ o.jsx("video", { className: t(t.B("video"), r), ...s, children: /* @__PURE__ */ o.jsx("source", { id: e, src: e, type: "video/mp4" }) }), m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4
4
  __proto__: null,
5
5
  Video: i
@@ -1 +1 @@
1
- "use strict";const o=require("./jsx-runtime-Dszzpdy0.cjs"),s=require("./css-DA2F4zE4.cjs"),r=({href:e,className:t,...i})=>o.jsxRuntimeExports.jsx("video",{className:s.CSS(s.CSS.B("video"),t),...i,children:o.jsxRuntimeExports.jsx("source",{id:e,src:e,type:"video/mp4"})}),c=Object.freeze(Object.defineProperty({__proto__:null,Video:r},Symbol.toStringTag,{value:"Module"}));exports.Video=c;
1
+ "use strict";const o=require("./jsx-runtime-Dszzpdy0.cjs"),s=require("./css-BJh3xDSW.cjs"),r=({href:e,className:t,...i})=>o.jsxRuntimeExports.jsx("video",{className:s.CSS(s.CSS.B("video"),t),...i,children:o.jsxRuntimeExports.jsx("source",{id:e,src:e,type:"video/mp4"})}),c=Object.freeze(Object.defineProperty({__proto__:null,Video:r},Symbol.toStringTag,{value:"Module"}));exports.Video=c;
package/dist/button.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-BaO1j7U1.cjs");exports.Button=e.external;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-Dxu0KYI_.cjs");exports.Button=e.external;
package/dist/button.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e } from "./external-BqSq3_g3.js";
1
+ import { e } from "./external-mtaOrZVh.js";
2
2
  export {
3
3
  e as Button
4
4
  };
package/dist/color.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-JI_JLXE9.cjs");exports.Color=e.external;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-DcJjrD1A.cjs");exports.Color=e.external;
package/dist/color.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e } from "./external-CwtqVaYf.js";
1
+ import { e } from "./external-wP76ag3P.js";
2
2
  export {
3
3
  e as Color
4
4
  };
@@ -0,0 +1,8 @@
1
+ "use strict";const a=require("zod"),lr=t=>a.union([a.union([a.null(),a.undefined()]).transform(()=>[]),t.array()]),Bn=t=>Array.isArray(t)?t:t==null?[]:[t],cr=(t,e)=>{if(Array.isArray(e))return e.reduce((i,s)=>cr(i,s),t??[]);if(t==null)return[e];const r=t.findIndex(i=>i==e),n=[...t];return r===-1?n.push(e):n[r]=e,n},jn=((t,e)=>{if(t!=null)return Array.isArray(e)?t.filter(r=>!e.includes(r)):t.filter(r=>r!=e)}),hr=(t,e)=>{if(Array.isArray(e))return e.reduce((i,s)=>hr(i,s),t??[]);if(t==null)return[e];const r=t.findIndex(i=>i.key===e.key),n=[...t];return r===-1?n.push(e):n[r]=e,n},Cn=((t,e)=>{if(t!=null)return Array.isArray(e)?t.filter(r=>!e.includes(r.key)):t.filter(r=>r.key!==e)}),Rn=Object.freeze(Object.defineProperty({__proto__:null,nullableZ:lr,remove:jn,removeKeyed:Cn,toArray:Bn,upsert:cr,upsertKeyed:hr},Symbol.toStringTag,{value:"Module"})),Ln=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)},Ye=t=>{const e=(r,n=ut)=>{if(typeof r=="string")return t(r);if(Array.isArray(r))return r.map(o=>e(o,n));if(!rt(r))return r;n=kn(n);const i={},s=r;return"toJSON"in s&&typeof s.toJSON=="function"?e(s.toJSON(),n):(Object.keys(s).forEach(o=>{let l=s[o];const f=t(o);n.recursive&&(rt(l)?er(l)||(l=e(l,n)):n.recursiveInArray&&_t(l)&&(l=[...l].map(c=>{let d=c;return rt(c)?er(d)||(d=e(c,n)):_t(c)&&(d=e({key:c},n).key),d}))),i[f]=l}),i)};return e},Nt=Ye(Ln),Dn=t=>t.replace(/([a-z0-9])([A-Z])/g,(e,r,n)=>`${r}_${n.toLowerCase()}`),fr=Ye(Dn),dr=t=>t.length===0?t:t[0].toUpperCase()+t.slice(1),Pn=[Number,String,Uint8Array],ut={recursive:!0,recursiveInArray:!0},kn=(t=ut)=>(t.recursive==null?t=ut:t.recursiveInArray??=!1,t),_t=t=>t!=null&&Array.isArray(t),rt=t=>t!=null&&typeof t=="object"&&!Array.isArray(t),er=t=>Pn.some(e=>t instanceof e),qn=t=>t.replace(/[\s_]+/g,"-").replace(/([a-z0-9])([A-Z])/g,(e,r,n)=>`${r}-${n.toLowerCase()}`).toLowerCase(),Zn=Ye(qn),Fn=t=>{if(t.length===0)return t;let e=t.replace(/[_-]/g," ");return e=e.replace(/([a-z0-9])([A-Z])/g,(r,n,i)=>`${n} ${i}`),e=e.replace(/([A-Z]+)([A-Z][a-z])/g,(r,n,i)=>`${n} ${i}`),e=e.replace(/\s+/g," ").trim(),e=e.replace(/\b\w/g,r=>r.toUpperCase()),e},Yn=Ye(Fn),Wn=Object.freeze(Object.defineProperty({__proto__:null,camelToSnake:fr,capitalize:dr,snakeToCamel:Nt,toKebab:Zn,toProperNoun:Yn},Symbol.toStringTag,{value:"Module"}));let Vn=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),i=Nt(n);return r!=null?r.parse(i):i}encodeString(e){const r=fr(e);return JSON.stringify(r,(n,i)=>ArrayBuffer.isView(i)?Array.from(i):typeof i=="bigint"?i.toString():i)}};const lt=new Vn,ct=t=>[...new Set(t)],Gn=(t,e,r=!0)=>{const n=new Map;return t.forEach(i=>{const s=e(i);if(n.has(s)){if(r)return;n.delete(s)}n.set(s,i)}),Array.from(n.values())},Hn=Object.freeze(Object.defineProperty({__proto__:null,by:Gn,unique:ct},Symbol.toStringTag,{value:"Module"})),E=t=>t!=null&&typeof t=="object"&&"value"in t;let te=class{value;constructor(e){this.value=e}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const It=t=>t!=null&&typeof t=="object"&&"toString"in t,gr=t=>{if(It(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=>!gr(t),Jn=Object.freeze(Object.defineProperty({__proto__:null,ValueExtension:te,isCrudeValueExtension:E,isNonZero:Xn,isStringer:It,isZero:gr},Symbol.toStringTag,{value:"Module"})),We=(t,e=!1)=>{const r=It(t)?"stringer":typeof t;let n;switch(r){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 ${r}`),()=>-1}return e?mr(n):n},Kn=(t,e,r)=>{const n=We(e[t],r);return(i,s)=>n(i[t],s[t])},Qn=(t,e)=>t.length!==e.length?t.length-e.length:t.every((r,n)=>r===e[n])?0:-1,pr=(t,e)=>{if(t.length!==e.length)return t.length-e.length;if(t.length===0)return 0;const r=We(t[0]),n=[...t].sort(r),i=[...e].sort(r);return n.every((s,o)=>s===i[o])?0:-1},_n=(t,e)=>{const r=ct(t),n=ct(e);return pr(r,n)},ei=(t,e)=>t===e?0:t==="first"&&e==="last"?1:-1,mr=t=>(e,r)=>t(r,e),se=0,Ee=-1,Ue=1,yr=t=>t<se,br=t=>t>se,ti=t=>t>=se,wr=t=>t===se,ri=(t,e)=>{const r=/([a-zA-Z]+)|(\d+)/g,n=t.replace(/[\s_.-]+/g,"").match(r),i=e.replace(/[\s_.-]+/g,"").match(r);if(!n||!i)return 0;for(let s=0;s<Math.min(n.length,i.length);s++){const o=n[s],l=i[s];if(isNaN(Number(o))&&isNaN(Number(l))){const f=o.localeCompare(l);if(f!==0)return f}else if(!isNaN(Number(o))&&!isNaN(Number(l))){const f=Number(o)-Number(l);if(f!==0)return f}else return isNaN(Number(o))?-1:1}return n.length-i.length},ni=Object.freeze(Object.defineProperty({__proto__:null,EQUAL:se,GREATER_THAN:Ue,LESS_THAN:Ee,isEqualTo:wr,isGreaterThan:br,isGreaterThanEqual:ti,isLessThan:yr,newF:We,newFieldF:Kn,order:ei,primitiveArrays:Qn,reverseF:mr,stringsWithNumbers:ri,uniqueUnorderedPrimitiveArrays:_n,unorderedPrimitiveArrays:pr},Symbol.toStringTag,{value:"Module"})),Ve=a.z.tuple([a.z.number(),a.z.number()]);a.z.tuple([a.z.bigint(),a.z.bigint()]);const Mt=a.z.object({width:a.z.number(),height:a.z.number()}),ii=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()}),si=["width","height"];a.z.enum(si);const ai=["start","center","end"],oi=["signedWidth","signedHeight"];a.z.enum(oi);const ye=a.z.object({x:a.z.number(),y:a.z.number()}),$r=a.z.object({clientX:a.z.number(),clientY:a.z.number()}),Ge=["x","y"],zt=a.z.enum(Ge),At=["top","right","bottom","left"],ui=a.z.enum(At),He=["left","right"],Et=a.z.enum(He),Xe=["top","bottom"],Ut=a.z.enum(Xe),Bt=["center"],ht=a.z.enum(Bt),li=[...At,...Bt],jt=a.z.enum(li);a.z.enum(ai);const ci=["first","last"];a.z.enum(ci);const Or=a.z.object({lower:a.z.number(),upper:a.z.number()}),hi=a.z.object({lower:a.z.bigint(),upper:a.z.bigint()});a.z.union([Or,Ve]);a.z.union([hi,Ve]);const fi=a.z.enum([...zt.options,...jt.options]);a.z.enum(["x","left","right"]);a.z.enum(["y","top","bottom"]);const di=a.z.union([zt,jt,a.z.instanceof(String)]),ae=t=>(e,r)=>{if(typeof e=="bigint"){if(ke(r))return t(e,BigInt(r));const n=t(Number(e),Number(r));return typeof n=="number"?BigInt(Math.round(n)):n}return t(Number(e),Number(r))},q=ae((t,e)=>t-e),oe=ae((t,e)=>t+e),gi=(t,e,r=1e-4)=>Math.abs(t-e)<r,ft=(t,e)=>{const r=typeof t=="bigint",n=typeof e=="bigint";return r&&n?t===e:r&&ke(e)?t===BigInt(e):n&&ke(t)?e===BigInt(t):t===e},pi=t=>{const e=10**Math.floor(Math.log10(t));return Math.round(t/e)*e},vr=ae((t,e)=>t<=e?t:e),ke=t=>typeof t=="bigint"?!0:Number.isInteger(t),mi=ae((t,e)=>t>=e?t:e),Tr=t=>typeof t=="bigint"?t<0n?-t:t:t<0?-t:t,j=ae((t,e)=>t*e),Te=ae((t,e)=>t/e),b=(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?xr(n):n},yi=Object.freeze({lower:0,upper:0}),bi=Object.freeze({lower:-1/0,upper:1/0}),wi=Object.freeze({lower:0,upper:1}),$i=Object.freeze({lower:-1,upper:1}),Oi=(t,e)=>{if(t==null&&e==null)return!0;if(t==null||e==null)return!1;const r=b(t),n=b(e);return r?.lower===n?.lower&&r?.upper===n?.upper},xr=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t,dt=(t,e)=>{const r=b(t);return e<r.lower?r.lower:e>=r.upper?r.upper-(typeof r.upper=="number"?1:1n):e},C=(t,e)=>{const r=b(t);if(typeof e=="number"||typeof e=="bigint")return e>=r.lower&&e<r.upper;const n=b(e);return n.lower>=r.lower&&n.upper<=r.upper},vi=(t,e)=>{const r=b(t),n=b(e);return r.lower===n.lower?!0:n.upper===r.lower||n.lower===r.upper?!1:C(r,n.upper)||C(r,n.lower)||C(n,r.upper)||C(n,r.lower)},ue=t=>{const e=b(t);return e.upper-e.lower},Ti=t=>{const e=b(t);return typeof e.lower=="bigint"?e.lower===0n&&e.upper===0n:e.lower===0&&e.upper===0},xi=t=>{const e=ue(t);return typeof e=="number"?e===0:e===0n},Si=t=>{const e=b(t);return typeof e.lower=="bigint"?!0:Number.isFinite(e.lower)&&Number.isFinite(e.upper)},Ni=t=>{const e=b(t);return(e.upper+e.lower)/2},Sr=t=>({lower:Math.min(...t.map(e=>b(e).lower)),upper:Math.max(...t.map(e=>b(e).upper))}),Ii=t=>({lower:Math.max(...t.map(e=>b(e).lower)),upper:Math.min(...t.map(e=>b(e).upper))}),Mi=t=>{const e=b(t),r=typeof e.lower=="bigint";return Array.from({length:Number(ue(t))},(n,i)=>r?e.lower+BigInt(i):e.lower+i)},gt=(t,e)=>{const r=t.map(s=>b(s)),n=r.findIndex(s=>C(s,e)||e<s.lower);if(n===-1)return{index:t.length,position:0};const i=r[n];return C(i,e)?{index:n,position:Number(e-i.lower)}:{index:n,position:0}},nt={removeBefore:0,removeAfter:0,insertInto:0,deleteInBetween:0},zi=(t,e)=>{const r=t.map(c=>b(c)),n=b(e);if(r.length===0)return nt;const i=gt(r,n.lower),s=gt(r,n.upper);if(i.index===t.length)return{...nt,insertInto:t.length};if(s.index===0)return{...nt,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,l=i.index,f=q(Number(ue(r[i.index])),i.position);return i.position!==0?(o-=1,l+=1):f=0,{removeBefore:f,removeAfter:s.position,insertInto:l,deleteInBetween:o}},Nr=(t,e,r)=>{const n=t.map(l=>b(l)),i=r>0?1:r<0?-1:0;if(i===0)return e;let s=r,o=e;for(;ft(s,0)===!1;){const l=n.findIndex(f=>i>0?o>=f.lower&&o<f.upper:o>f.lower&&o<=f.upper);if(l!==-1){const f=n[l];let c;if(i>0?c=q(f.upper,o):c=q(o,f.lower),c>0){const d=vr(Tr(s),c);if(o=oe(o,i>0?d:-d),s=q(s,i>0?d:-d),ft(s,0))return o;continue}}if(i>0){const f=n.filter(c=>c.lower>o);if(f.length>0)o=f[0].lower;else return o}else{const f=n.filter(c=>c.upper<o);if(f.length>0)o=f[f.length-1].upper;else return o}}return o},Ir=(t,e,r)=>{const n=t.map(o=>b(o));if(e===r)return typeof e=="bigint"?0n:0;const i=e<r?b([e,r]):b([r,e]);let s=typeof e=="bigint"?0n:0;for(const o of n){const l=o.lower>i.lower?o.lower:i.lower,f=o.upper<i.upper?o.upper:i.upper;if(l<f){const c=f-l;s=s+c}}return s},Ai=Object.freeze(Object.defineProperty({__proto__:null,CLIP:$i,DECIMAL:wi,INFINITE:bi,ZERO:yi,bounds:Or,buildInsertionPlan:zi,clamp:dt,construct:b,contains:C,distance:Ir,equals:Oi,findInsertPosition:gt,isFinite:Si,isZero:Ti,linspace:Mi,makeValid:xr,max:Sr,mean:Ni,min:Ii,overlapsWith:vi,span:ue,spanIsZero:xi,traverse:Nr},Symbol.toStringTag,{value:"Module"})),Mr=fi,k=t=>Ge.includes(t)?t:Xe.includes(t)?"y":"x",Ei=t=>k(t)==="x"?"y":"x",Ui=t=>k(t)==="x"?"width":"height",Bi=t=>k(t)==="x"?"left":"top",ji=t=>Mr.safeParse(t).success,Ci=t=>k(t)==="x"?"signedWidth":"signedHeight",Ri=t=>t==="center"?!1:k(t)==="x",Li=t=>k(t)==="y",zr=Object.freeze(Object.defineProperty({__proto__:null,DIRECTIONS:Ge,construct:k,crude:Mr,dimension:Ui,direction:zt,isDirection:ji,isX:Ri,isY:Li,location:Bi,signedDimension:Ci,swap:Ei},Symbol.toStringTag,{value:"Module"})),Di=Et,Pi=Ut,ki=ht,qi={top:"bottom",right:"left",bottom:"top",left:"right",center:"center"},Zi={top:"left",right:"top",bottom:"right",left:"bottom",center:"center"},Fi=di,H=t=>t instanceof String||!Ge.includes(t)?t:t==="x"?"left":"top",Yi=t=>qi[H(t)],Wi=t=>Zi[H(t)],be=t=>{const e=H(t);return e==="top"||e==="bottom"?"y":"x"},Vi=a.z.object({x:Et.or(ht),y:Ut.or(ht)}),Ar=a.z.object({x:Et,y:Ut}),xe=Object.freeze({x:"left",y:"top"}),Ct=Object.freeze({x:"right",y:"top"}),Je=Object.freeze({x:"left",y:"bottom"}),Rt=Object.freeze({x:"right",y:"bottom"}),Lt=Object.freeze({x:"center",y:"center"}),Dt=Object.freeze({x:"center",y:"top"}),Pt=Object.freeze({x:"center",y:"bottom"}),kt=Object.freeze({x:"right",y:"center"}),qt=Object.freeze({x:"left",y:"center"}),Gi=Object.freeze([qt,kt,Dt,Pt,xe,Ct,Je,Rt,Lt]),Zt=(t,e)=>t.x===e.x&&t.y===e.y,Hi=(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},Er=t=>[t.x,t.y],Be=t=>be(H(t))==="x",Xi=t=>be(H(t))==="y",Ji=t=>`${t.x}${dr(t.y)}`,Ki=(t,e)=>{let r,n;if(typeof t=="object"&&"x"in t?(r=t.x,n=t.y):(r=H(t),n=H(e??t)),be(r)===be(n)&&r!=="center"&&n!=="center")throw new Error(`[XYLocation] - encountered two locations with the same direction: ${r.toString()} - ${n.toString()}`);const i={...Lt};return r==="center"?Be(n)?[i.x,i.y]=[n,r]:[i.x,i.y]=[r,n]:n==="center"?Be(r)?[i.x,i.y]=[r,n]:[i.x,i.y]=[n,r]:Be(r)?[i.x,i.y]=[r,n]:[i.x,i.y]=[n,r],i},Ur=Object.freeze(Object.defineProperty({__proto__:null,BOTTOM_CENTER:Pt,BOTTOM_LEFT:Je,BOTTOM_RIGHT:Rt,CENTER:Lt,CENTER_LEFT:qt,CENTER_LOCATIONS:Bt,CENTER_RIGHT:kt,OUTER_LOCATIONS:At,TOP_CENTER:Dt,TOP_LEFT:xe,TOP_RIGHT:Ct,XY_LOCATIONS:Gi,X_LOCATIONS:He,Y_LOCATIONS:Xe,center:ki,construct:H,constructXY:Ki,corner:Ar,crude:Fi,direction:be,isX:Be,isY:Xi,location:jt,outer:ui,rotate90:Wi,swap:Yi,x:Di,xy:Vi,xyCouple:Er,xyEquals:Zt,xyMatches:Hi,xyToString:Ji,y:Pi},Symbol.toStringTag,{value:"Module"})),pt=a.z.union([a.z.number(),ye,Ve,Mt,ii,$r]),O=(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}},P=Object.freeze({x:0,y:0}),Br=Object.freeze({x:1,y:1}),Qi=Object.freeze({x:1/0,y:1/0}),_i=Object.freeze({x:NaN,y:NaN}),qe=(t,e,r=0)=>{const n=O(t),i=O(e);return r===0?n.x===i.x&&n.y===i.y:Math.abs(n.x-i.x)<=r&&Math.abs(n.y-i.y)<=r},es=t=>qe(t,P),Ft=(t,e,r)=>{const n=O(t),i=O(e,r);return{x:n.x*i.x,y:n.y*i.y}},jr=(t,e)=>{const r=O(t);return{x:r.x+e,y:r.y}},Cr=(t,e)=>{const r=O(t);return{x:r.x,y:r.y+e}},we=(t,e,r,...n)=>{if(typeof e=="string"){if(typeof r!="number")throw new Error("The value must be a number.");return e==="x"?jr(t,r):Cr(t,r)}if(typeof e=="object"&&"x"in e&&typeof e.x=="string"){const i=O(r),s=O(t);return e.x==="left"?i.x=-i.x:e.x==="center"&&(i.x=0),e.y==="top"?i.y=-i.y:e.y==="center"&&(i.y=0),{x:s.x+i.x,y:s.y+i.y}}return[t,e,r??P,...n].reduce((i,s)=>{const o=O(s);return{x:i.x+o.x,y:i.y+o.y}},P)},ts=(t,e,r)=>{const n=O(t);return e==="x"?{x:r,y:n.y}:{x:n.x,y:r}},rs=(t,e)=>{const r=O(t),n=O(e);return Math.sqrt((r.x-n.x)**2+(r.y-n.y)**2)},ns=(t,e)=>{const r=O(t),n=O(e);return{x:n.x-r.x,y:n.y-r.y}},is=t=>{const e=O(t);return Number.isNaN(e.x)||Number.isNaN(e.y)},ss=t=>{const e=O(t);return Number.isFinite(e.x)&&Number.isFinite(e.y)},as=t=>{const e=O(t);return[e.x,e.y]},os=t=>{const e=O(t);return{left:e.x,top:e.y}},mt=(t,e=0)=>{const r=O(t);return{x:Number(r.x.toFixed(e)),y:Number(r.y.toFixed(e))}},ce=(t,e)=>{const r=O(t),n=O(e);return{x:r.x-n.x,y:r.y-n.y}},he=t=>{const e=O(t),r=Math.hypot(e.x,e.y);return r===0?{x:0,y:0}:{x:-e.y/r,y:e.x/r}},Rr=t=>{const e=O(t),r=Math.hypot(e.x,e.y);return r===0?{x:0,y:0}:{x:e.x/r,y:e.y/r}},Lr=(...t)=>{const e=t.reduce((r,n)=>we(r,n),P);return Ft(e,1/t.length)},us=(t,e)=>{const r=[];for(let n=0;n<t.length;n++){const i=t[n];let s,o,l,f;if(n===0){const c=t[n+1],d=ce(c,i);o=he(d),l=o,f=e}else if(n===t.length-1){const c=t[n-1],d=ce(i,c);s=he(d),l=s,f=e}else{const c=t[n-1],d=t[n+1],m=ce(i,c),p=ce(d,i);s=he(m),o=he(p);const M=Math.acos((m.x*p.x+m.y*p.y)/(Math.hypot(m.x,m.y)*Math.hypot(p.x,p.y))),A=Math.sin(M/2);A===0?f=e:f=e/A,l=Rr(Lr(s,o))}r.push(Ft(l,f))}return r},ls=t=>{const e=O(t);return{x:e.y,y:e.x}},yt=t=>{const e=O(t);return{x:Math.round(e.x),y:Math.round(e.y)}},cs=t=>{const e=O(t);return{x:1/e.x,y:1/e.y}},hs=Object.freeze(Object.defineProperty({__proto__:null,INFINITY:Qi,NAN:_i,ONE:Br,ZERO:P,average:Lr,calculateMiters:us,clientXY:$r,construct:O,couple:as,crudeZ:pt,css:os,distance:rs,equals:qe,isFinite:ss,isNan:is,isZero:es,normal:he,normalize:Rr,reciprocal:cs,round:yt,scale:Ft,set:ts,sub:ce,swap:ls,translate:we,translateX:jr,translateY:Cr,translation:ns,truncate:mt,xy:ye},Symbol.toStringTag,{value:"Module"})),Ne=a.z.union([a.z.number(),a.z.string()]),fs=a.z.object({top:Ne,left:Ne,width:Ne,height:Ne}),ds=a.z.object({left:a.z.number(),top:a.z.number(),right:a.z.number(),bottom:a.z.number()}),gs=a.z.object({one:ye,two:ye,root:Ar}),Dr={one:P,two:P,root:xe},ps={one:P,two:Br,root:Je},Pr=(t,e)=>({one:t.one,two:t.two,root:e??t.root}),x=(t,e,r=0,n=0,i)=>{const s={one:{...P},two:{...P},root:i??xe};if(typeof t=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return s.one={x:t,y:e},s.two={x:s.one.x+r,y:s.one.y+n},s}return"one"in t&&"two"in t&&"root"in t?{...t,root:i??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(s.one={x:t.left,y:t.top},s.two={x:t.right,y:t.bottom},s):(s.one=t,e==null?s.two={x:s.one.x+r,y:s.one.y+n}:typeof e=="number"?s.two={x:s.one.x+e,y:s.one.y+r}:"width"in e?s.two={x:s.one.x+e.width,y:s.one.y+e.height}:"signedWidth"in e?s.two={x:s.one.x+e.signedWidth,y:s.one.y+e.signedHeight}:s.two=e,s))},ms=(t,e,r)=>{const n=x(t);if(typeof e=="string"){if(r==null)throw new Error("Invalid arguments for resize");const i=k(e);return x(n.one,void 0,i==="x"?r:X(n),i==="y"?r:J(n),n.root)}return x(n.one,e,void 0,void 0,n.root)},ys=(t,e,r=!0)=>{const n=x(t);let i=(s,o)=>s<o;return r&&(i=(s,o)=>s<=o),"one"in e?i(V(n),V(e))&&i(Q(e),Q(n))&&i(G(n),G(e))&&i(_(e),_(n)):i(V(n),e.x)&&i(e.x,Q(n))&&i(G(n),e.y)&&i(e.y,_(n))},bs=(t,e)=>qe(t.one,e.one)&&qe(t.two,e.two)&&Zt(t.root,e.root),kr=t=>({width:X(t),height:J(t)}),ws=t=>({signedWidth:Ke(t),signedHeight:Qe(t)}),$s=t=>({top:G(t),left:V(t),width:X(t),height:J(t)}),Yt=(t,e,r=!1)=>{const n=k(e)==="y"?Qe(t):Ke(t);return r?n:Math.abs(n)},Z=(t,e)=>{const r=x(t);return{x:e.x==="center"?bt(r).x:ee(r,e.x),y:e.y==="center"?bt(r).y:ee(r,e.y)}},ee=(t,e)=>{const r=x(t),n=Er(r.root).includes(e)?Math.min:Math.max;return He.includes(e)?n(r.one.x,r.two.x):n(r.one.y,r.two.y)},Os=t=>Fr(t)===0,X=t=>Yt(t,"x"),J=t=>Yt(t,"y"),Ke=t=>{const e=x(t);return e.two.x-e.one.x},Qe=t=>{const e=x(t);return e.two.y-e.one.y},qr=t=>Z(t,xe),vs=t=>Z(t,Dt),Ts=t=>Z(t,Ct),xs=t=>Z(t,Je),Ss=t=>Z(t,Pt),Ns=t=>Z(t,Rt),Is=t=>Z(t,qt),Ms=t=>Z(t,kt),Q=t=>ee(t,"right"),_=t=>ee(t,"bottom"),V=t=>ee(t,"left"),G=t=>ee(t,"top"),bt=t=>we(qr(t),{x:Ke(t)/2,y:Qe(t)/2}),Wt=t=>{const e=x(t);return e.root.x==="left"?V(e):Q(e)},Vt=t=>{const e=x(t);return e.root.y==="top"?G(e):_(e)},zs=t=>({x:Wt(t),y:Vt(t)}),je=t=>{const e=x(t);return{lower:e.one.x,upper:e.two.x}},Ce=t=>{const e=x(t);return{lower:e.one.y,upper:e.two.y}},As=(t,e)=>Pr(t,e),Es=(t,e)=>{const r=x(t),n=He.includes(e)?"x":Xe.includes(e)?"y":null;if(n===null)throw new Error(`Invalid location: ${e}`);const i=e==="top"||e==="left"?Math.min:Math.max,s={...r.one},o={...r.two};return s[n]=i(r.one[n],r.two[n]),o[n]=i(r.one[n],r.two[n]),[s,o]},Us=(t,e)=>{const r=x(t),n=x(e),i=Wt(n)+(X(n)-X(r))/2,s=Vt(n)+(J(n)-J(r))/2;return x({x:i,y:s},kr(r))},Zr=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,Bs=t=>X(t)/J(t),js=(t,e,r)=>{if(typeof e=="string"){if(r==null)throw new Error("Undefined amount passed into box.translate");const i=k(e);e=O(i,r)}const n=x(t);return x(we(n.one,e),we(n.two,e),void 0,void 0,n.root)},Cs=(t,e)=>{const r=Math.max(V(t),V(e)),n=Math.max(G(t),G(e)),i=Math.min(Q(t),Q(e)),s=Math.min(_(t),_(e));return r>i||n>s?Dr:x({x:r,y:n},{x:i,y:s},void 0,void 0,t.root)},Fr=t=>X(t)*J(t),Rs=(t,e)=>{const r=x(t);return x(mt(r.one,e),mt(r.two,e),void 0,void 0,r.root)},Ls=(t,e,r,n,i,s)=>{const o={x:t,y:e},l={x:t+r,y:e+n};return i.x!==s.x&&(i.x==="center"?(o.x-=r/2,l.x-=r/2):(o.x-=r,l.x-=r)),i.y!==s.y&&(i.y==="center"?(o.y-=n/2,l.y-=n/2):(o.y-=n,l.y-=n)),x(o,l,void 0,void 0,s)},Ds=t=>{const e=x(t);return x(yt(e.one),yt(e.two),void 0,void 0,e.root)},Ps=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:ps,ZERO:Dr,area:Fr,areaIsZero:Os,aspect:Bs,bottom:_,bottomCenter:Ss,bottomLeft:xs,bottomRight:Ns,box:gs,center:bt,centerLeft:Is,centerRight:Ms,construct:x,constructWithAlternateRoot:Ls,contains:ys,copy:Pr,css:$s,cssBox:fs,dim:Yt,dims:kr,domRect:ds,edgePoints:Es,equals:bs,height:J,intersection:Cs,isBox:Zr,left:V,loc:ee,positionInCenter:Us,reRoot:As,resize:ms,right:Q,root:zs,round:Ds,signedDims:ws,signedHeight:Qe,signedWidth:Ke,top:G,topCenter:vs,topLeft:qr,topRight:Ts,translate:js,truncate:Rs,width:X,x:Wt,xBounds:je,xyLoc:Z,y:Vt,yBounds:Ce},Symbol.toStringTag,{value:"Module"})),Yr=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()}),ks=a.z.union([Mt,Yr,ye,Ve]),qs={width:0,height:0},Zs={width:1,height:1},R=(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},Fs=(t,e)=>{if(e==null)return!1;const r=R(t),n=R(e);return r.width===n.width&&r.height===n.height},Ys=t=>{const e=R(t);return{width:e.height,height:e.width}},Ws=t=>{const e=R(t);return`0 0 ${e.width} ${e.height}`},Vs=t=>{const e=R(t);return[e.width,e.height]},Gs=t=>({width:Math.max(...t.map(e=>R(e).width)),height:Math.max(...t.map(e=>R(e).height))}),Hs=t=>({width:Math.min(...t.map(e=>R(e).width)),height:Math.min(...t.map(e=>R(e).height))}),Xs=(t,e)=>{const r=R(t);return{width:r.width*e,height:r.height*e}},Js=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:Zs,ZERO:qs,construct:R,couple:Vs,crude:ks,dimensions:Mt,equals:Fs,max:Gs,min:Hs,scale:Xs,signed:Yr,svgViewBox:Ws,swap:Ys},Symbol.toStringTag,{value:"Module"})),Wr=(t,e,r)=>e!==void 0&&t<e?e:r!==void 0&&t>r?r:t,Ks=a.z.object({offset:pt,scale:pt}),Qs=a.z.object({offset:a.z.number(),scale:a.z.number()}),_s=t=>(e,r,n,i)=>r==="dimension"?[e,n]:[e,i?n-t:n+t],ea=t=>(e,r,n,i)=>[e,i?n/t:n*t],ta=t=>(e,r,n)=>{if(e===null)return[t,n];const{lower:i,upper:s}=e,{lower:o,upper:l}=t,f=s-i,c=l-o;if(r==="dimension")return[t,n*(c/f)];const d=(n-i)*(c/f)+o;return[t,d]},ra=t=>(e,r,n)=>[t,n],na=()=>(t,e,r)=>{if(t===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[t,r];const{lower:n,upper:i}=t;return[t,i-(r-n)]},ia=t=>(e,r,n)=>{const{lower:i,upper:s}=t;return n=Wr(n,i,s),[e,n]};let wt=class ne{ops=[];currBounds=null;currType=null;reversed=!1;constructor(){this.ops=[]}static translate(e){return new ne().translate(e)}static magnify(e){return new ne().magnify(e)}static scale(e,r){return new ne().scale(e,r)}translate(e){const r=this.new(),n=_s(e);return n.type="translate",r.ops.push(n),r}magnify(e){const r=this.new(),n=ea(e);return n.type="magnify",r.ops.push(n),r}scale(e,r){const n=b(e,r),i=this.new(),s=ta(n);return s.type="scale",i.ops.push(s),i}clamp(e,r){const n=b(e,r),i=this.new(),s=ia(n);return s.type="clamp",i.ops.push(s),i}reBound(e,r){const n=b(e,r),i=this.new(),s=ra(n);return s.type="re-bound",i.ops.push(s),i}invert(){const e=na();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 ne;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,r){return this.currBounds=null,this.ops.reduce(([n,i],s)=>s(n,e,i,this.reversed),[null,r])[1]}reverse(){const e=this.new();e.ops.reverse();const r=[];return e.ops.forEach((n,i)=>{if(n.type==="scale"||r.some(([o,l])=>i>=o&&i<=l))return;const s=e.ops.findIndex((o,l)=>o.type==="scale"&&l>i);s!==-1&&r.push([i,s])}),r.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)}}static IDENTITY=new ne},sa=class L{x;y;currRoot;constructor(e=new wt,r=new wt,n=null){this.x=e,this.y=r,this.currRoot=n}static translate(e,r){return new L().translate(e,r)}static translateX(e){return new L().translateX(e)}static translateY(e){return new L().translateY(e)}static clamp(e){return new L().clamp(e)}static magnify(e){return new L().magnify(e)}static scale(e){return new L().scale(e)}static reBound(e){return new L().reBound(e)}translate(e,r){const n=O(e,r),i=this.copy();return i.x=this.x.translate(n.x),i.y=this.y.translate(n.y),i}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(Zr(e)){const n=this.currRoot;return r.currRoot=e.root,n!=null&&!Zt(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(je(e)),r.y=r.y.scale(Ce(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(je(e)),r.y=this.y.reBound(Ce(e)),r}clamp(e){const r=this.copy();return r.x=this.x.clamp(je(e)),r.y=this.y.clamp(Ce(e)),r}copy(){const e=new L;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 x(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 L};const aa=Object.freeze(Object.defineProperty({__proto__:null,Scale:wt,XY:sa,crudeXYTransform:Ks,transform:Qs},Symbol.toStringTag,{value:"Module"}));let Vr=(t,e=21)=>(r=e)=>{let n="",i=r|0;for(;i--;)n+=t[Math.random()*t.length|0];return n};const Gr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",oa=`0123456789${Gr}`,Hr=11,ua=Vr(Gr,1),la=Vr(oa,Hr-1),Gt=()=>`${ua()}${la()}`,ca=Object.freeze(Object.defineProperty({__proto__:null,LENGTH:Hr,create:Gt},Symbol.toStringTag,{value:"Module"})),ha=(t,e)=>r=>r instanceof e||typeof r=="object"&&r!==null&&"discriminator"in r&&r.discriminator===t,fa=2**8-1,da=2**16-1,ga=2**32-1,pa=2n**64n-1n,ma=2**64-1,ya=-128,ba=2**7-1,wa=-32768,$a=2**15-1,Oa=-2147483648,va=2**31-1,Ta=-(2n**63n),Ze=2n**63n-1n,xa=-9223372036854776e3,Xr=2**63-1,Sa=a.z.enum(["static","dynamic"]),tr=365,Ie=30,Na=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)])]),Jr=(t,e)=>{const r=new $(e);if(![h.DAY,h.HOUR,h.MINUTE,h.SECOND,h.MILLISECOND,h.MICROSECOND,h.NANOSECOND].some(i=>i.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 $?new $(n):new h(n)};let $=class g extends te{constructor(e,r="UTC"){if(e==null)super(g.now().valueOf());else if(e instanceof Date)super(BigInt(e.getTime())*g.MILLISECOND.valueOf());else if(typeof e=="string")super(g.parseDateTimeString(e,r).valueOf());else if(Array.isArray(e))super(g.parseDate(e));else{let n=0n;e instanceof Number&&(e=e.valueOf()),r==="local"&&(n=g.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e===Xr?e=Ze:e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=g.MAX:e=g.MIN)),E(e)&&(e=e.value),super(BigInt(e.valueOf())+n)}}static parseDate([e=1970,r=1,n=1]){const i=new Date(e,r-1,n,0,0,0,0);return new g(BigInt(i.getTime())*g.MILLISECOND.valueOf()).truncate(g.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,r="UTC"){const[n,i,s]=e.split(":");let o="00",l="00";s!=null&&([o,l]=s.split("."));let f=g.hours(parseInt(n??"00")).add(g.minutes(parseInt(i??"00"))).add(g.seconds(parseInt(o??"00"))).add(g.milliseconds(parseInt(l??"00")));return r==="local"&&(f=f.add(g.utcOffset)),f.valueOf()}static parseDateTimeString(e,r="UTC"){if(!e.includes("/")&&!e.includes("-"))return g.parseTimeString(e,r);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new g(BigInt(n.getTime())*g.MILLISECOND.valueOf(),r).valueOf()}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(g.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())*g.MINUTE.valueOf())}static since(e){return new g().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new g(e).valueOf()}span(e){return this.range(e).span}range(e){return new W(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0n}after(e){return this.valueOf()>new g(e).valueOf()}afterEq(e){return this.valueOf()>=new g(e).valueOf()}before(e){return this.valueOf()<new g(e).valueOf()}beforeEq(e){return this.valueOf()<=new g(e).valueOf()}add(e){return new g(oe(this.valueOf(),new h(e).valueOf()))}sub(e){return new g(q(this.valueOf(),new h(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(g.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(g.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 g(r)}get month(){return this.date().getUTCMonth()}setMonth(e){const r=this.date();return r.setUTCMonth(e),new g(r)}get day(){return this.date().getUTCDate()}setDay(e){const r=this.date();return r.setUTCDate(e),new g(r)}get hour(){return this.date().getUTCHours()}get localHour(){return this.date().getHours()}setLocalHour(e){const r=this.date();return r.setHours(e),new g(r)}setHour(e){const r=this.date();return r.setUTCHours(e),new g(r)}get minute(){return this.date().getUTCMinutes()}setMinute(e){const r=this.date();return r.setUTCMinutes(e),new g(r)}get second(){return this.date().getUTCSeconds()}setSecond(e){const r=this.date();return r.setUTCSeconds(e),new g(r)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(e){const r=this.date();return r.setUTCMilliseconds(e),new g(r)}toString(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)}}remainder(e){return Jr(this,e)}get isToday(){return this.truncate(h.DAY).equals(g.now().truncate(h.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new g(new Date)}static max(...e){let r=g.MIN;for(const n of e){const i=new g(n);i.after(r)&&(r=i)}return r}static min(...e){let r=g.MAX;for(const n of e){const i=new g(n);i.before(r)&&(r=i)}return r}static nanoseconds(e,r="UTC"){return new g(e,r)}static NANOSECOND=g.nanoseconds(1);static microseconds(e,r="UTC"){return g.nanoseconds(e*1e3,r)}static MICROSECOND=g.microseconds(1);static milliseconds(e,r="UTC"){return g.microseconds(e*1e3,r)}static MILLISECOND=g.milliseconds(1);static seconds(e,r="UTC"){return g.milliseconds(e*1e3,r)}static SECOND=g.seconds(1);static minutes(e,r="UTC"){return g.seconds(e*60,r)}static MINUTE=g.minutes(1);static hours(e,r="UTC"){return g.minutes(e*60,r)}static HOUR=g.hours(1);static days(e,r="UTC"){return g.hours(e*24,r)}static DAY=g.days(1);static MAX=new g(Ze);static MIN=new g(0);static ZERO=new g(0);static z=a.z.union([a.z.instanceof(g),a.z.object({value:a.z.bigint()}).transform(e=>new g(e.value)),a.z.string().transform(e=>new g(BigInt(e))),a.z.number().transform(e=>new g(e)),a.z.bigint().transform(e=>new g(e)),a.z.date().transform(e=>new g(e)),a.z.custom(e=>e instanceof h).transform(e=>new g(e)),Na.transform(e=>new g(e))]);static sort(e,r){return Number(e.valueOf()-r.valueOf())}};class h extends te{constructor(e){typeof e=="number"&&(e=Math.trunc(e.valueOf())),E(e)&&(e=e.value),super(BigInt(e.valueOf()))}static fromSeconds(e){return e instanceof h?e:e instanceof Re?e.period:e instanceof $?new h(e):(E(e)&&(e=e.value),["number","bigint"].includes(typeof e)?h.seconds(e):new h(e))}static fromMilliseconds(e){return e instanceof h?e:e instanceof Re?e.period:e instanceof $?new h(e):(E(e)&&(e=e.value),["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 Jr(this,e)}truncate(e){return new h(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(e="full"){if(e==="semantic")return this.toSemanticString();const r=this.truncate(h.DAY),n=this.truncate(h.HOUR),i=this.truncate(h.MINUTE),s=this.truncate(h.SECOND),o=this.truncate(h.MILLISECOND),l=this.truncate(h.MICROSECOND),f=this.truncate(h.NANOSECOND),c=r,d=n.sub(r),m=i.sub(n),p=s.sub(i),M=o.sub(s),A=l.sub(o),B=f.sub(l);let w="";return c.isZero||(w+=`${c.days}d `),d.isZero||(w+=`${d.hours}h `),m.isZero||(w+=`${m.minutes}m `),p.isZero||(w+=`${p.seconds}s `),M.isZero||(w+=`${M.milliseconds}ms `),A.isZero||(w+=`${A.microseconds}µs `),B.isZero||(w+=`${B.nanoseconds}ns`),w.trim()}toSemanticString(){const e=this.valueOf()<0n?-this.valueOf():this.valueOf(),r=new h(e),n=this.valueOf()<0n;if(r.valueOf()===0n)return"0s";if(r.lessThan(h.SECOND))return"< 1s";const i=r.days,s=r.hours,o=r.minutes,l=r.seconds,f=Math.floor(i/tr),c=Math.floor(i/Ie),d=Math.floor(i/7),m=Math.floor(i),p=Math.floor(s),M=Math.floor(o),A=Math.floor(l),B=n?"-":"";if(f>=1){let w=`${f}y`;if(f<2){const S=Math.floor(i%tr/Ie);S>0&&(w+=` ${S}mo`)}return B+w}if(d>=1&&i<Ie&&i%7===0){let w=`${d}w`;const S=Math.floor(i%7),K=Math.floor(s-d*7*24);return d<2&&(S>0?w+=` ${S}d`:K>0&&K<24&&(w+=` ${K}h`)),B+w}if(c>=1){let w=`${c}mo`;if(c<3){const S=Math.floor(i%Ie);S>0&&(w+=` ${S}d`)}return B+w}if(d>=1){let w=`${d}w`;const S=Math.floor(i%7),K=Math.floor(s-d*7*24);return d<2&&(S>0?w+=` ${S}d`:K>0&&K<24&&(w+=` ${K}h`)),B+w}if(m>=1){let w=`${m}d`;const S=Math.floor(s-m*24);return m<2&&S>0&&(w+=` ${S}h`),B+w}if(p>=1){let w=`${p}h`;if(p<3){const S=Math.floor(o-p*60);S>0&&(w+=` ${S}m`)}return B+w}if(M>=1){let w=`${M}m`;if(M<5){const S=Math.floor(l-M*60);S>0&&(w+=` ${S}s`)}return B+w}return`${B}${A}s`}mult(e){return new h(j(this.valueOf(),e))}div(e){return new h(Te(this.valueOf(),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(j(e,1e3))}static MICROSECOND=h.microseconds(1);static milliseconds(e=1){return h.microseconds(j(e,1e3))}static MILLISECOND=h.milliseconds(1);static seconds(e=1){return h.milliseconds(j(e,1e3))}static SECOND=h.seconds(1);static minutes(e=1){return h.seconds(j(e,60))}static MINUTE=h.minutes(1);static hours(e){return h.minutes(j(e,60))}static HOUR=h.hours(1);static days(e){return h.hours(j(e,24))}static DAY=h.days(1);static MAX=new h(Ze);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.bigint().transform(e=>new h(e)),a.z.instanceof(h),a.z.instanceof($).transform(e=>new h(e)),a.z.custom(e=>e instanceof Re).transform(e=>new h(e))])}let Re=class U extends te{constructor(e){E(e)&&(e=e.value),super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new U(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 I(r).valueOf()}span(e){return h.seconds(e/this.valueOf())}byteSpan(e,r){return this.span(e.valueOf()/new I(r).valueOf())}add(e){return new U(oe(this.valueOf(),new U(e).valueOf()))}sub(e){return new U(q(this.valueOf(),new U(e).valueOf()))}mult(e){return new U(j(this.valueOf(),e))}div(e){return new U(Te(this.valueOf(),e))}static hz(e){return new U(e)}static khz(e){return U.hz(e*1e3)}static z=a.z.union([a.z.number().transform(e=>new U(e)),a.z.instanceof(U)])},I=class z extends te{constructor(e){E(e)&&(e=e.value),super(e.valueOf())}length(e){return e.valueOf()/this.valueOf()}size(e){return new $e(e*this.valueOf())}add(e){return new z(oe(this.valueOf(),new z(e).valueOf()))}sub(e){return new z(q(this.valueOf(),new z(e).valueOf()))}mult(e){return new z(j(this.valueOf(),e))}div(e){return new z(Te(this.valueOf(),e))}static UNKNOWN=new z(0);static BIT128=new z(16);static BIT64=new z(8);static BIT32=new z(4);static BIT16=new z(2);static BIT8=new z(1);static z=a.z.union([a.z.number().transform(e=>new z(e)),a.z.instanceof(z)])},W=class D{start;end;constructor(e,r){typeof e=="object"&&"start"in e?(this.start=new $(e.start),this.end=new $(e.end)):(this.start=new $(e),this.end=new $(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.start.isZero&&this.end.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new D(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(),i=this.end.sub(e.end).valueOf();return n<0&&(n=-n),i<0&&(i=-i),n<=r.valueOf()&&i<=r.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.toString("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 i=$.max(n.start,e.start),s=$.min(n.end,e.end);return s.before(i)?!1:new h(s.sub(i)).greaterThanOrEqual(r)}contains(e){return e instanceof D?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const r=new D(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 D($.min(...e.map(r=>r.start)),$.max(...e.map(r=>r.end)))}static MAX=new D($.MIN,$.MAX);static ZERO=new D($.ZERO,$.ZERO);static z=a.z.union([a.z.object({start:$.z,end:$.z}).transform(e=>new D(e.start,e.end)),a.z.instanceof(D)]);static sort(e,r){return $.sort(e.start,r.start)||$.sort(e.end,r.end)}static simplify(e){return e.map(r=>r.makeValid()).sort((r,n)=>D.sort(r,n)).reduce((r,n)=>{if(n.span.isZero)return r;if(r.length===0)return r.push(n),r;const i=r[r.length-1];return i.overlapsWith(n)||i.end.equals(n.start)?i.end=$.max(i.end,n.end):r.push(n),r},[])}},T=class u extends te{constructor(e){if(E(e)&&(e=e.value),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(e=!1){return e?u.SHORT_STRINGS.get(this.valueOf())??this.valueOf():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=new u("boolean");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(),I.BIT8],[u.UINT16.toString(),I.BIT16],[u.UINT32.toString(),I.BIT32],[u.UINT64.toString(),I.BIT64],[u.FLOAT32.toString(),I.BIT32],[u.FLOAT64.toString(),I.BIT64],[u.INT8.toString(),I.BIT8],[u.INT16.toString(),I.BIT16],[u.INT32.toString(),I.BIT32],[u.INT64.toString(),I.BIT64],[u.TIMESTAMP.toString(),I.BIT64],[u.STRING.toString(),I.UNKNOWN],[u.JSON.toString(),I.UNKNOWN],[u.UUID.toString(),I.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 SHORT_STRINGS=new Map([[u.UINT8.toString(),"u8"],[u.UINT16.toString(),"u16"],[u.UINT32.toString(),"u32"],[u.UINT64.toString(),"u64"],[u.INT8.toString(),"i8"],[u.INT16.toString(),"i16"],[u.INT32.toString(),"i32"],[u.INT64.toString(),"i64"],[u.FLOAT32.toString(),"f32"],[u.FLOAT64.toString(),"f64"],[u.BOOLEAN.toString(),"bool"],[u.TIMESTAMP.toString(),"ts"],[u.UUID.toString(),"uuid"],[u.STRING.toString(),"str"],[u.JSON.toString(),"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)])},$e=class y extends te{constructor(e){E(e)&&(e=e.value),super(e.valueOf())}largerThan(e){return E(e)&&(e=e.value),this.valueOf()>e.valueOf()}smallerThan(e){return E(e)&&(e=e.value),this.valueOf()<e.valueOf()}add(e){return E(e)&&(e=e.value),new y(oe(this.valueOf(),e.valueOf()))}sub(e){return E(e)&&(e=e.value),new y(q(this.valueOf(),e.valueOf()))}mult(e){return new y(j(this.valueOf(),e))}div(e){return new y(Te(this.valueOf(),e))}truncate(e){return new y(Math.trunc(this.valueOf()/new y(e).valueOf())*new y(e).valueOf())}remainder(e){return y.bytes(this.valueOf()%new y(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),i=this.truncate(y.KILOBYTE),s=this.truncate(y.BYTE),o=e,l=r.sub(e),f=n.sub(r),c=i.sub(n),d=s.sub(i);let m="";return o.isZero||(m+=`${o.terabytes}TB `),l.isZero||(m+=`${l.gigabytes}GB `),f.isZero||(m+=`${f.megabytes}MB `),c.isZero||(m+=`${c.kilobytes}KB `),(!d.isZero||m==="")&&(m+=`${d.valueOf()}B`),m.trim()}static bytes(e=1){return new y(e)}static BYTE=new y(1);static kilobytes(e=1){return y.bytes(new y(e).valueOf()*1e3)}static KILOBYTE=y.kilobytes(1);static megabytes(e=1){return y.kilobytes(new y(e).valueOf()*1e3)}static MEGABYTE=y.megabytes(1);static gigabytes(e=1){return y.megabytes(new y(e).valueOf()*1e3)}static GIGABYTE=y.gigabytes(1);static terabytes(e){return y.gigabytes(new y(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}};a.z.object({start:a.z.number(),end:a.z.number()});const Ia=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)]),Kr=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof $||t instanceof h||t instanceof Date},Ma=(t,e,r,n=0)=>t.usesBigInt&&!e.usesBigInt?Number(r)-Number(n):!t.usesBigInt&&e.usesBigInt?BigInt(r.valueOf())-BigInt(n.valueOf()):Le(r,-n),Le=(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),za="00000000-0000-0000-0000-000000000000",Aa=/^(?:[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 Ea(t){return typeof t=="string"&&Aa.test(t)}const N=[];for(let t=0;t<256;++t)N.push((t+256).toString(16).slice(1));function Qr(t,e=0){return(N[t[e+0]]+N[t[e+1]]+N[t[e+2]]+N[t[e+3]]+"-"+N[t[e+4]]+N[t[e+5]]+"-"+N[t[e+6]]+N[t[e+7]]+"-"+N[t[e+8]]+N[t[e+9]]+"-"+N[t[e+10]]+N[t[e+11]]+N[t[e+12]]+N[t[e+13]]+N[t[e+14]]+N[t[e+15]]).toLowerCase()}function Ua(t,e=0){const r=Qr(t,e);if(!Ea(r))throw TypeError("Stringified UUID is invalid");return r}let it;const Ba=new Uint8Array(16);function ja(){if(!it){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");it=crypto.getRandomValues.bind(crypto)}return it(Ba)}const Ca=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),rr={randomUUID:Ca};function Ra(t,e,r){t=t||{};const n=t.random??t.rng?.()??ja();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Qr(n)}function La(t,e,r){return rr.randomUUID&&!t?rr.randomUUID():Ra(t)}const Da=()=>La(),Ht=(t,e)=>Ua(t,e),Pa=za,ka=Object.freeze(Object.defineProperty({__proto__:null,ZERO:Pa,create:Da,parse:Ht},Symbol.toStringTag,{value:"Module"})),F=-1,$t={[Symbol.iterator]:()=>$t,next:()=>({done:!0,value:void 0})},qa=a.z.string().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer),Za=a.z.union([a.z.null(),a.z.undefined()]).transform(()=>new Uint8Array().buffer),Ot=10,_r=(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`)},en="sy_x_telem_series";let Xt=class Y{key;discriminator=en;dataType;sampleOffset;gl;_data;timeRange=W.ZERO;alignment=0n;alignmentMultiple=1n;cachedMin;cachedMax;writePos=F;_refCount=0;cachedLength;_cachedIndexes;static crudeZ=a.z.object({timeRange:W.z.optional(),dataType:T.z,alignment:a.z.coerce.bigint().optional(),data:a.z.union([qa,Za,a.z.instanceof(ArrayBuffer),a.z.instanceof(Uint8Array)]),glBufferUsage:Sa.optional().default("static").optional()});static z=Y.crudeZ.transform(e=>new Y(e));constructor(e){Fa(e)&&(e={data:e}),e.data??=[];const{dataType:r,timeRange:n,sampleOffset:i=0,glBufferUsage:s="static",alignment:o=0n,alignmentMultiple:l=1n,key:f=Gt(),data:c}=e;if(tn(c)){const p=c;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.alignmentMultiple=p.alignmentMultiple,this.cachedMin=p.cachedMin,this.cachedMax=p.cachedMax,this.writePos=p.writePos,this._refCount=p._refCount,this.cachedLength=p.cachedLength;return}const d=Kr(c),m=Array.isArray(c);if(r!=null)this.dataType=new T(r);else{if(c instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(m||d){let p=c;if(!d){if(c.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=c[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 $||p instanceof Date||p instanceof $)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(c)}if(!m&&!d)this._data=c;else if(m&&c.length===0)this._data=new this.dataType.Array([]).buffer;else{let p=d?[c]:c;const M=p[0];(M instanceof $||M instanceof Date||M instanceof h)&&(p=p.map(A=>new $(A).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(A=>lt.encodeString(A)).join(`
4
+ `)}
5
+ `).buffer):this.dataType.usesBigInt&&typeof M=="number"?this._data=new this.dataType.Array(p.map(A=>BigInt(Math.round(A)))).buffer:!this.dataType.usesBigInt&&typeof M=="bigint"?this._data=new this.dataType.Array(p.map(Number)).buffer:this._data=new this.dataType.Array(p).buffer}this.key=f,this.alignment=o,this.alignmentMultiple=l,this.sampleOffset=i??0,this.timeRange=n??W.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:s}}static alloc({capacity:e,dataType:r,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const i=new new T(r).Array(e),s=new Y({data:i.buffer,dataType:r,...n});return s.writePos=0,s}get refCount(){return this._refCount}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){this._refCount--,this.refCount===0&&this.gl.control!=null?this.maybeGarbageCollectGLBuffer(this.gl.control):this.refCount<0&&console.warn("cannot release a series with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(e):this.writeFixed(e)}writeVariable(e){if(this.writePos===F)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===F)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===F?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(lt.decodeString(r)))}get byteCapacity(){return new $e(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===F?this.byteCapacity:this.dataType.isVariable?new $e(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength!=null?this.cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===F?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,i)=>{n===Ot&&(e++,r.push(i+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 i=0;i<this.length;i++)n[i]=Ma(this.dataType,e,this.data[i],r);return new Y({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(),Le(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(),Le(this.cachedMin,this.sampleOffset))}get bounds(){return b(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)/this.alignmentMultiple);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 Le(n,this.sampleOffset)}atUUID(e,r){e<0&&(e=this.length+e);const n=Ht(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,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]===Ot){if(e===0){i=o;break}n=o+1,e--}if(i===0&&(i=this.data.length),n>=i||e>0){if(r)throw new Error(`[series] - no value at index ${e}`);return}}const s=this.data.slice(n,i);return this.dataType.equals(T.STRING)?new TextDecoder().decode(s):Nt(JSON.parse(new TextDecoder().decode(s)))}binarySearch(e){let r=0,n=this.length-1;const i=We(e);for(;r<=n;){const s=Math.floor((r+n)/2),o=i(this.at(s,!0),e);if(o===0)return s;o<0?r=s+1:n=s-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:i}=this.gl;if(r==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==i)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==F){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=F}as(e){return _r(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:ir(this.alignmentBounds.lower),upper:ir(this.alignmentBounds.upper),multiple:this.alignmentMultiple},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}get alignmentBounds(){return b(this.alignment,this.alignment+BigInt(this.length)*this.alignmentMultiple)}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 Ya(this);return this.dataType.equals(T.JSON)?new Wa(e):e}return this.dataType.equals(T.UUID)?new Va(this):new Ga(this)}slice(e,r){return this.sliceSub(!1,e,r)}sub(e,r){return this.sliceSub(!0,e,r)}subIterator(e,r){return new nr(this,e,r??this.length)}subAlignmentIterator(e,r){const n=Math.ceil(Number(e-this.alignment)/Number(this.alignmentMultiple)),i=Math.ceil(Number(r-this.alignment)/Number(this.alignmentMultiple));return new nr(this,n,i)}subBytes(e,r){if(e>=0&&(r==null||r>=this.byteLength.valueOf()))return this;const n=this.data.subarray(e,r);return new Y({data:n,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,r,n){if(r<=0&&(n==null||n>=this.length))return this;let i;return e?i=this.data.subarray(r,n):i=this.data.slice(r,n),new Y({data:i,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(r)})}reAlign(e){return new Y({data:this.buffer,dataType:this.dataType,timeRange:W.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 Fa=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof Xt?!0:Kr(t),tn=ha(en,Xt);let nr=class{series;end;index;constructor(e,r,n){this.series=e;const i=b(0,e.length+1);this.end=dt(i,n),this.index=dt(i,r)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},Ya=class{series;index;decoder;constructor(e){if(!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,r=this.series.data;for(;this.index<r.length&&r[this.index]!==Ot;)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))})}},Wa=class rn{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:lt.decodeString(e.value,rn.schema)}}},Va=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=Ht(this.data,this.index*this.density);return this.index++,{done:!1,value:e}}};class Ga{series;index;constructor(e){this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}}class Ha{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 _r(e,this.dataType),this}get dataType(){return this.series.length===0?T.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?W.ZERO:new W(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?b(0n,0n):b(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(tn(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(C(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 st(this,e,r??this.length)}subAlignmentIterator(e,r){if(e>=this.alignmentBounds.upper||r<=this.alignmentBounds.lower)return $t;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(C(o.alignmentBounds,e)){n+=Math.ceil(Number(e-o.alignment)/Number(o.alignmentMultiple));break}}let i=0;for(let s=0;s<this.series.length;s++){const o=this.series[s];if(r<o.alignment)break;if(r>=o.alignmentBounds.upper)i+=o.length;else if(C(o.alignmentBounds,r)){i+=Math.ceil(Number(r-o.alignment)/Number(o.alignmentMultiple));break}}return new st(this,n,i)}subAlignmentSpanIterator(e,r){if(e>=this.alignmentBounds.upper)return $t;r=Math.min(r,Number(this.distance(e,this.alignmentBounds.upper)));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(C(s.alignmentBounds,e)){n+=Number(e-s.alignment);break}}return new st(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 $e(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(i=>i.alignmentBounds);return Nr(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(i=>i.alignmentBounds);return Ir(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 Xa(this.series)}toStrings(){return this.series.flatMap(e=>e.toStrings())}}let Xa=class{series;seriesIndex;internal;constructor(e){this.series=e,this.seriesIndex=0,this.internal=e[0][Symbol.iterator]()}next(){const e=this.internal.next();return e.done===!1?e:this.seriesIndex===this.series.length-1?{done:!0,value:void 0}:(this.internal=this.series[++this.seriesIndex][Symbol.iterator](),this.next())}[Symbol.iterator](){return this}};class st{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 ir=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 Ja=a.z.record(a.z.union([a.z.number(),a.z.string(),a.z.symbol()]),a.z.unknown()),Jt=t=>Object.entries(t),Ka=(t,e)=>Object.fromEntries(Jt(t).map(([r,n])=>[r,e(n,r)])),Qa=t=>Object.fromEntries(Jt(t).filter(([e,r])=>r!==void 0)),_a=(t,...e)=>{const r={...t};for(const n of e)delete r[n];return r},eo=Object.freeze(Object.defineProperty({__proto__:null,entries:Jt,map:Ka,omit:_a,purgeUndefined:Qa,unknownZ:Ja},Symbol.toStringTag,{value:"Module"})),nn=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",to=nn(),sn=["macOS","Windows","Linux"],ro=["macos","windows","linux"],no={macos:"macOS",windows:"Windows",linux:"Linux"},io=a.z.enum(sn).or(a.z.enum(ro).transform(t=>no[t])),so=()=>{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 at;const ao=((t={})=>{const{force:e,default:r}=t;return e??at??(at=so(),at??r)}),oo=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:sn,RUNTIME:to,detect:nn,getOS:ao,osZ:io},Symbol.toStringTag,{value:"Module"})),uo=(...t)=>t.map(an).join(""),an=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),lo=t=>t.endsWith("/")?t.slice(0,-1):t;class De{protocol;host;port;path;constructor({host:e,port:r,protocol:n="",pathPrefix:i=""}){this.protocol=n,this.host=e,this.port=r,this.path=an(i)}replace(e){return new De({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new De({...this,pathPrefix:uo(this.path,e)})}toString(){return lo(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}static UNKNOWN=new De({host:"unknown",port:0})}const vt=2,Tt=3,on=2,co=(t,e)=>{if(Number.isNaN(t)||!Number.isFinite(t))return t;const r=ue(e);if(r==0)return t;let n;r>=1e3?n=vt:r>=1?n=Tt:n=Math.ceil(-Math.log10(r))+on;const i=10**n;return Math.round(t*i)/i},ho=5,fo=1e-10,go=(t,e)=>{if(Number.isNaN(t)||!Number.isFinite(t))return t;const r=Math.abs(t);if(r===0)return 0;let n=!1,i=0;if(e!=null){i=ue(e);const l=i/r;n=i>0&&l>fo}if(n){let l;i>=1e3?l=vt:i>=1?l=Tt:l=Math.ceil(-Math.log10(i))+on;const f=10**l;return Math.round(t*f)/f}if(r>=1e3){const l=10**vt;return Math.round(t*l)/l}if(r>=1){const l=10**Tt;return Math.round(t*l)/l}const s=Math.floor(Math.log10(r)),o=10**(ho-s-1);return Math.round(t*o)/o},po=Object.freeze(Object.defineProperty({__proto__:null,MAX_INT16:$a,MAX_INT32:va,MAX_INT64:Ze,MAX_INT64_NUMBER:Xr,MAX_INT8:ba,MAX_UINT16:da,MAX_UINT32:ga,MAX_UINT64:pa,MAX_UINT64_NUMBER:ma,MAX_UINT8:fa,MIN_INT16:wa,MIN_INT32:Oa,MIN_INT64:Ta,MIN_INT64_NUMBER:xa,MIN_INT8:ya,abs:Tr,add:oe,closeTo:gi,div:Te,equal:ft,isInteger:ke,max:mi,min:vr,mult:j,roundBySpan:co,roundToNearestMagnitude:pi,smartRound:go,sub:q},Symbol.toStringTag,{value:"Module"}));a.z.object({baseInterval:h.z.optional(),maxRetries:a.z.number().optional(),scale:a.z.number().optional()});const mo=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,Fe=a.z.string().regex(mo),ie=a.z.number().min(0).max(255),un=a.z.number().min(0).max(1),_e=a.z.tuple([ie,ie,ie,un]),yo=a.z.tuple([ie,ie,ie]),bo=a.z.object({rgba255:_e}),wo=a.z.number().min(0).max(360),$o=a.z.number().min(0).max(100),Oo=a.z.number().min(0).max(100),ln=a.z.tuple([wo,$o,Oo,un]),et=a.z.union([Fe,yo,_e,ln,bo]),tt=et.transform(t=>v(t)),vo=t=>tt.safeParse(t).success,To=t=>_e.safeParse(t).success,xo=(t=>{if(t==null)return;const e=tt.safeParse(t);if(e.success)return hn(e.data);if(typeof t=="string")return t;throw e.error}),v=(t,e=1)=>{if(t=et.parse(t),typeof t=="string")return Pe(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},cn=(t,e)=>{if(t==null||e==null)return t==e;const r=v(t),n=v(e);return r.every((i,s)=>i===n[s])},So=(t=>{if(t==null)return;const[e,r,n,i]=v(t);return`#${Me(e)}${Me(r)}${Me(n)}${i===1?"":Me(i*255)}`}),hn=t=>{const[e,r,n,i]=v(t);return`rgba(${e}, ${r}, ${n}, ${i})`},No=t=>`rgb(${fn(t)})`,fn=t=>{const[e,r,n]=v(t);return`${e}, ${r}, ${n}`},Io=t=>[...Kt(t),me(t)],Kt=t=>[de(t)/255,ge(t)/255,pe(t)/255],de=t=>v(t)[0],ge=t=>v(t)[1],pe=t=>v(t)[2],me=t=>v(t)[3],Mo=t=>cn(Qt,t),zo=t=>Do(v(t)),Ao=(t,e)=>{const[r,n,i]=v(t);if(e>100)throw new Error(`Color opacity must be between 0 and 100, got ${e}`);return e>1&&(e/=100),[r,n,i,e]},Oe=t=>{const[e,r,n]=Kt(t).map(i=>i<=.03928?i/12.92:((i+.055)/1.055)**2.4);return Number((.2126*e+.7152*r+.0722*n).toFixed(3))},Eo=t=>{const[e,r,n]=Kt(t);return 1-(Math.max(e,r,n)-Math.min(e,r,n))},xt=(t,e)=>{const r=v(t),n=v(e),i=Oe(r),s=Oe(n);return(Math.max(i,s)+.5)/(Math.min(i,s)+.5)},Uo=(t,...e)=>{if(e.length===0)throw new Error("[Color.pickByContrast] - must provide at least one color");const r=v(t),[n]=e.sort((i,s)=>xt(r,s)-xt(r,i));return v(n)},Bo=t=>Oe(t)<.5,jo=t=>Oe(t)>.5,Pe=(t,e=1)=>(t=Fe.parse(t),t=Co(t),[ze(t,0),ze(t,2),ze(t,4),t.length===8?ze(t,6)/255:e]),Qt=[0,0,0,0],Me=t=>Math.floor(t).toString(16).padStart(2,"0"),ze=(t,e)=>parseInt(t.slice(e,e+2),16),Co=t=>t.startsWith("#")?t.slice(1):t,sr={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#008000",blue:"#0000ff",yellow:"#ffff00",cyan:"#00ffff",magenta:"#ff00ff",silver:"#c0c0c0",gray:"#808080",grey:"#808080",maroon:"#800000",olive:"#808000",lime:"#00ff00",aqua:"#00ffff",teal:"#008080",navy:"#000080",fuchsia:"#ff00ff",purple:"#800080",orange:"#ffa500",brown:"#a52a2a",tan:"#d2b48c",gold:"#ffd700",indigo:"#4b0082",violet:"#ee82ee",pink:"#ffc0cb",coral:"#ff7f50",salmon:"#fa8072",khaki:"#f0e68c",crimson:"#dc143c",transparent:"transparent"},Ro=t=>{if(!t)return;const e=t.trim().toLowerCase();if(!(e==="transparent"||e==="none")){if(e.startsWith("#")){if(e.length===4){const r=e[1],n=e[2],i=e[3],s=`#${r}${r}${n}${n}${i}${i}`;if(Fe.safeParse(s).success)return Pe(s)}return(e.length===7||e.length===9)&&Fe.safeParse(e).success?Pe(e):void 0}if(e.startsWith("rgb")){const r=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);if(r){const[,n,i,s,o]=r;return[parseInt(n),parseInt(i),parseInt(s),o?parseFloat(o):1]}}if(sr[e])return Pe(sr[e])}},Lo=t=>{t=ln.parse(t);let[e,r,n]=t;const i=t[3];e/=360,r/=100,n/=100;let s,o,l;if(r===0)s=o=l=n;else{const f=n<.5?n*(1+r):n+r-n*r,c=2*n-f;s=ot(c,f,e+1/3),o=ot(c,f,e),l=ot(c,f,e-1/3)}return[Math.round(s*255),Math.round(o*255),Math.round(l*255),i]},ot=(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),Do=t=>{t=_e.parse(t);let[e,r,n]=t;const i=t[3];e/=255,r/=255,n/=255;const s=Math.max(e,r,n),o=Math.min(e,r,n);let l,f,c=(s+o)/2;if(s===o)l=f=0;else{const d=s-o;f=c>.5?d/(2-s-o):d/(s+o),s===e?l=(r-n)/d+(r<n?6:0):s===r?l=(n-e)/d+2:l=(e-r)/d+4,l/=6}return l*=360,f*=100,c*=100,[Math.round(l),Math.round(f),Math.round(c),i]},Po=v("#000000"),ko=v("#ffffff"),dn=a.z.object({key:a.z.string(),color:et,position:a.z.number(),switched:a.z.boolean().optional()}),qo=a.z.array(dn),Zo=(t,e)=>{if(t.length===0)return Qt;if(t=t.slice().sort((r,n)=>r.position-n.position),e<=t[0].position)return v(t[0].color);if(e>=t[t.length-1].position)return v(t[t.length-1].color);for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];if(e<n.position||e>i.position)continue;if(e===n.position)return v(n.color);if(e===i.position)return v(i.color);const s=(e-n.position)/(i.position-n.position),o=v(n.color),l=v(i.color),f=Math.round(de(o)+s*(de(l)-de(o))),c=Math.round(ge(o)+s*(ge(l)-ge(o))),d=Math.round(pe(o)+s*(pe(l)-pe(o))),m=me(o)+s*(me(l)-me(o));return v([f,c,d,m])}return v(t[t.length-1].color)},Fo=a.z.object({key:a.z.string(),name:a.z.string(),color:tt}),Yo=a.z.object({key:a.z.string(),name:a.z.string(),swatches:a.z.array(Fo)}),gn=Object.freeze(Object.defineProperty({__proto__:null,BLACK:Po,WHITE:ko,ZERO:Qt,aValue:me,bValue:pe,colorZ:tt,construct:v,contrast:xt,crudeZ:et,cssString:xo,equals:cn,fromCSS:Ro,fromGradient:Zo,fromHSLA:Lo,gValue:ge,gradientZ:qo,grayness:Eo,hex:So,hsla:zo,isColor:To,isCrude:vo,isDark:Bo,isLight:jo,isZero:Mo,luminance:Oe,paletteZ:Yo,pickByContrast:Uo,rValue:de,rgbCSS:No,rgbString:fn,rgba1:Io,rgbaCSS:hn,setAlpha:Ao,stopZ:dn},Symbol.toStringTag,{value:"Module"})),pn=a.z.int().min(0).max(255),mn=255,yn=0,Wo={lower:yn,upper:mn+1},bn=a.z.object({name:a.z.string(),key:a.z.string()}),ve=t=>a.z.object({subject:bn,resource:t,authority:pn}),Vo=(...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}),wn=t=>a.z.object({from:ve(t),to:a.z.null()}),$n=t=>a.z.object({from:a.z.null(),to:ve(t)}),Go=t=>a.z.union([wn(t),$n(t),a.z.object({from:ve(t),to:ve(t)})]),Ho=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:mn,AUTHORITY_BOUNDS:Wo,ZERO_AUTHORITY:yn,acquireZ:$n,authorityZ:pn,filterTransfersByChannelKey:Vo,releaseZ:wn,stateZ:ve,subjectZ:bn,transferZ:Go},Symbol.toStringTag,{value:"Module"})),Xo=t=>Object.getOwnPropertySymbols(globalThis).includes(t),Jo=(t,e)=>{const r=Symbol.for(t);if(!Xo(r)){const n=e();Object.defineProperty(globalThis,r,{value:n})}return()=>globalThis[r]},On="sy_x_error",Ko=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),vn=t=>class fe extends Error{static discriminator=On;discriminator=fe.discriminator;static TYPE=t;type=fe.TYPE;static matches=Ko(t);matches=fe.matches;constructor(r,n){super(r,n),this.name=fe.TYPE}static sub(r){return vn(`${t}.${r}`)}},Qo=t=>{if(t==null||typeof t!="object")return!1;const e=t;if(e.discriminator!==On)return!1;if(!("type"in e))throw new Error(`X Error is missing its type property: ${JSON.stringify(e)}`);return!0},le="unknown",ar="nil";class _o{providers=[];register(e){this.providers.push(e)}encode(e){if(e==null)return{type:ar,data:""};if(Qo(e))for(const r of this.providers){const n=r.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:le,data:e.message};if(typeof e=="string")return{type:le,data:e};try{return{type:le,data:JSON.stringify(e)}}catch{return{type:le,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===ar)return null;if(e.type===le)return new or(e.data);for(const r of this.providers){const n=r.decode(e);if(n!=null)return n}return new or(e.data)}}Jo("synnax-error-registry",()=>new _o);class or extends vn("unknown"){}a.z.object({type:a.z.string(),data:a.z.string()});const eu=()=>new Promise(t=>setTimeout(t,0)),tu=a.object({jsonrpc:a.literal("2.0"),method:a.string(),params:a.any().optional(),id:a.union([a.string(),a.number(),a.null()]).optional()}),Tn=a.object({jsonrpc:a.literal("2.0"),id:a.union([a.string(),a.number(),a.null()])}),ru=Tn.extend({result:a.json()}),nu=Tn.extend({error:a.object({code:a.number().int(),message:a.string().optional(),data:a.json().optional()})}),iu=a.union([ru,nu]);a.union([tu,iu]);const su=a.uuid(),au=a.object({key:su,name:a.string().min(1),color:a.string()}),ou=(t,e,r)=>{const n=t.get(e);return n===void 0?(t.set(e,r),r):n},uu=Object.freeze(Object.defineProperty({__proto__:null,getOrSetDefault:ou},Symbol.toStringTag,{value:"Module"})),St=a.z.string().regex(/^\d+\.\d+\.\d+$/),Se=((t,e,r={})=>{r.checkMajor??=!0,r.checkMinor??=!0,r.checkPatch??=!0;const n=St.parse(t),i=St.parse(e),[s,o,l]=n.split(".").map(Number),[f,c,d]=i.split(".").map(Number);if(r.checkMajor){if(s<f)return Ee;if(s>f)return Ue}if(r.checkMinor){if(o<c)return Ee;if(o>c)return Ue}if(r.checkPatch){if(l<d)return Ee;if(l>d)return Ue}return se}),lu=(t,e,r={})=>wr(Se(t,e,r)),xn=(t,e,r={})=>br(Se(t,e,r)),cu=(t,e,r={})=>yr(Se(t,e,r)),hu=({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}},fu=({name:t,migrations:e,targetSchema:r,defaultVersion:n,def:i})=>{const s=Object.keys(e).sort(Se).pop();if(s==null)return c=>{if(c.version??=n,c.version!==i.version)return console.log(`${t} version ${c.version} is newer than latest version of ${i.version}.
7
+ Returning default instead.
8
+ `),i;try{return r!=null?r.parse(c):c}catch(d){return console.log(`${t} failed to parse default. Exiting with default`),console.error(d),i}};const o=Object.keys(e).length;let l=!1;const f=c=>{try{if(o===0||xn(c.version,s))return console.log(l?`${t} ${c.version} now up to date`:`${t} version ${c.version} is up to date with target version ${i.version}`),c;const d=c.version,m=e[d],p=m(c);return l=!0,f(p)}catch(d){return console.log(`${t} failed to migrate from ${c.version} to ${s}`),console.error(d),i}};return c=>{try{if(c.version==null)if(n!=null)console.log(`${t} version is null. Setting version to default of ${n}`),c.version=n;else return console.log(`${t} version is null and no default version set. Exiting with default`),i;return f(c)}catch(d){return console.log(`${t} failed to parse final result. Exiting with default`),console.error(d),i}}},du=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:Se,createMigration:hu,migrator:fu,semVerNewer:xn,semVerOlder:cu,semVerZ:St,versionsEqual:lu},Symbol.toStringTag,{value:"Module"})),Sn=["standard","scientific","engineering"],gu=a.z.enum(Sn),pu=(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}`},mu=Object.freeze(Object.defineProperty({__proto__:null,NOTATIONS:Sn,notationZ:gu,stringifyNumber:pu},Symbol.toStringTag,{value:"Module"})),yu=t=>Array.isArray(t)?[...t]:typeof t=="object"&&t!==null?{...t}:t,Nn=a.z.enum(["success","info","warning","error","loading","disabled"]),bu=t=>a.z.object({key:a.z.string(),name:a.z.string().default(""),variant:Nn,message:a.z.string(),description:a.z.string().optional(),time:$.z,labels:lr(au).optional(),details:t??a.z.unknown().optional()}),wu=a.z.object({stack:a.z.string()}),$u=(t,e)=>{if(!(t instanceof Error))throw t;return In({variant:"error",message:e??t.message,description:e!=null?t.message:void 0,details:{stack:t.stack??""}})},In=t=>({key:Gt(),time:$.now(),name:"",...t}),Ou=(t,e=[])=>{if(t!=null)return Array.isArray(e)?e.includes(t)?t:void 0:e===t?t:void 0},vu=(t,e=[])=>{if(t!=null)return Array.isArray(e)?e.includes(t)?void 0:t:e===t?void 0:t},Tu=Object.freeze(Object.defineProperty({__proto__:null,create:In,exceptionDetailsSchema:wu,fromException:$u,keepVariants:Ou,removeVariants:vu,statusZ:bu,variantZ:Nn},Symbol.toStringTag,{value:"Module"})),xu=(t,e="")=>{if(typeof t=="string")return t;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]}`},Su=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 i=/\d+/g;t.match(i)&&e.forEach((o,l)=>{if(i.test(o)){const f=e.map((c,d)=>d!==l?c.charAt(0).toLowerCase():c).join("");r.add(f.replace(/-/g,"_")),r.add(f.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"))}});const s=e.map(o=>(o.length>3?o.substring(0,3):o).toLowerCase());return r.add(s.join("").replace(/-/g,"_")),r.add(s.join("_").replace(/-/g,"_")),Array.from(r).filter(o=>o.length>=2&&o.length<=12&&!/^\d/.test(o))},Nu=(t,e)=>t.startsWith(e)?t.slice(e.length):t,Iu=t=>t.length===0?t:t[t.length-1]==="y"?`${t.slice(0,-1)}ies`:t[t.length-1]==="s"||t[t.length-1]==="x"||t[t.length-1]==="z"||t.endsWith("ch")||t.endsWith("sh")?`${t}es`:`${t}s`,Mu=Object.freeze(Object.defineProperty({__proto__:null,createShortIdentifiers:Su,naturalLanguageJoin:xu,pluralName:Iu,trimPrefix:Nu},Symbol.toStringTag,{value:"Module"})),zu=new Error("request for lock canceled");var Au=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function l(d){try{c(n.next(d))}catch(m){o(m)}}function f(d){try{c(n.throw(d))}catch(m){o(m)}}function c(d){d.done?s(d.value):i(d.value).then(l,f)}c((n=n.apply(t,e||[])).next())})};class Eu{constructor(e,r=zu){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,i)=>{const s={resolve:n,reject:i,weight:e,priority:r},o=Mn(this._queue,l=>r<=l.priority);o===-1&&e<=this._value?this._dispatchItem(s):this._queue.splice(o+1,0,s)})}runExclusive(e){return Au(this,arguments,void 0,function*(r,n=1,i=0){const[s,o]=yield this.acquire(n,i);try{return yield r(s)}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]=[]),Uu(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 i=n.findIndex(s=>s.priority<=e);(i===-1?n:n.splice(0,i)).forEach((s=>s.resolve()))}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}}function Uu(t,e){const r=Mn(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function Mn(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var Bu=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function l(d){try{c(n.next(d))}catch(m){o(m)}}function f(d){try{c(n.throw(d))}catch(m){o(m)}}function c(d){d.done?s(d.value):i(d.value).then(l,f)}c((n=n.apply(t,e||[])).next())})};class ju{constructor(e){this._semaphore=new Eu(1,e)}acquire(){return Bu(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 zn extends ju{constructor(e){super(),Object.assign(this,e)}}const Cu=t=>new zn(t),Ru=Object.freeze(Object.defineProperty({__proto__:null,mutex:zn,newMutex:Cu},Symbol.toStringTag,{value:"Module"}));function An(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=An(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function En(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=An(t))&&(n&&(n+=" "),n+=e);return n}const Lu=En,re="-",ur="__",Ae="--",Un=t=>{const e=(...r)=>Lu(...r);return e.B=(...r)=>t+re+r.join(re),e.E=r=>t+ur+r,e.M=(...r)=>t+Ae+r.join("-"),e.BM=(r,...n)=>e.B(r)+Ae+n.join("-"),e.BE=(r,...n)=>e.B(r)+ur+n.join(re),e.BEM=(r,n,...i)=>e.BE(r,n)+Ae+i.join(re),e.var=(...r)=>Ae+t+re+r.join(re),e};class Du{rows=[];columns=[];prefix;constructor(e=""){this.prefix=e}row(e,r,n){const{prefix:i}=this;return this.rows.push({startLabel:i+e,endLabel:i+r,size:n}),this}col(e,r,n){const{prefix:i}=this;return this.columns.push({startLabel:i+e,endLabel:i+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 Pu=(t,e)=>Object.entries(e).forEach(([r,n])=>n!=null&&t.style.setProperty(r,`${n}`)),ku=(t,e)=>Array.from(t.style).forEach(r=>{r.startsWith(e)&&t.style.removeProperty(r)}),qu=t=>{const e=Un(t);return e.visible=r=>e.M(r?"visible":"hidden"),e.expanded=r=>e.M(r?"expanded":"collapsed"),e.loc=r=>e.M("location",Ur.construct(r)),e.disabled=r=>r===!0&&e.M("disabled"),e.align=r=>e.M(r),e.dir=r=>r!=null&&e.M("direction",zr.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=Pu,e.removeVars=ku,e.newGridBuilder=r=>new Du(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})`:gn.cssString(r)},e.levelSizeVar=r=>`var(--${t}-${r}-size)`,e.level=r=>e.M(`level-${r}`),e},Zu=qu("pluto");exports.Ar=po;exports.Br=du;exports.C=aa;exports.CSS=Zu;exports.Dr=uu;exports.Dt=ca;exports.Fr=mu;exports.Gr=Mu;exports.H=Ai;exports.Hr=yu;exports.Jr=Ru;exports.K=Ur;exports.O=Jn;exports.Oe=Ha;exports.Q=hs;exports.R=Wr;exports.Rr=gn;exports.S=oo;exports.U=Wn;exports.Ur=eu;exports.Xr=Tu;exports.Zr=Ho;exports._=Js;exports.a=Rn;exports.a$1=h;exports.c=Hn;exports.c$1=$e;exports.clsx=En;exports.de=Ia;exports.g=I;exports.ge=ka;exports.jt=Ps;exports.k=ni;exports.l=eo;exports.m=W;exports.n=T;exports.newBEM=Un;exports.p=zr;exports.r=$;exports.v=Re;exports.x=Xt;