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