@synnaxlabs/x 0.54.2 → 0.55.0
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/.turbo/turbo-build.log +8 -8
- package/dist/src/strings/strings.d.ts +9 -0
- package/dist/src/strings/strings.d.ts.map +1 -1
- package/dist/src/telem/clockSkew.d.ts +17 -0
- package/dist/src/telem/clockSkew.d.ts.map +1 -0
- package/dist/src/telem/clockSkew.spec.d.ts +2 -0
- package/dist/src/telem/clockSkew.spec.d.ts.map +1 -0
- package/dist/src/telem/external.d.ts +1 -0
- package/dist/src/telem/external.d.ts.map +1 -1
- package/dist/src/telem/series.d.ts +1 -1
- package/dist/src/telem/series.d.ts.map +1 -1
- package/dist/src/telem/telem.d.ts +6 -5
- package/dist/src/telem/telem.d.ts.map +1 -1
- package/dist/x.cjs +10 -13
- package/dist/x.js +2060 -1996
- package/package.json +10 -10
- package/src/strings/strings.spec.ts +19 -0
- package/src/strings/strings.ts +16 -0
- package/src/telem/clockSkew.spec.ts +58 -0
- package/src/telem/clockSkew.ts +46 -0
- package/src/telem/external.ts +1 -0
- package/src/telem/series.spec.ts +52 -4
- package/src/telem/series.ts +118 -42
- package/src/telem/telem.spec.ts +19 -0
- package/src/telem/telem.ts +10 -5
- package/tsconfig.tsbuildinfo +1 -1
package/dist/x.cjs
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`zod`);l=c(l);var u=e=>l.default.union([l.default.union([l.default.null(),l.default.undefined()]).transform(()=>[]),e.array()]),d=e=>Array.isArray(e)?e:e==null?[]:[e],f=(e,t)=>{if(Array.isArray(t))return t.reduce((e,t)=>f(e,t),e??[]);if(e==null)return[t];let n=e.findIndex(e=>e==t),r=[...e];return n===-1?r.push(t):r[n]=t,r},p=((e,t)=>{if(e!=null)return Array.isArray(t)?e.filter(e=>!t.includes(e)):e.filter(e=>e!=t)}),m=(e,t)=>{if(Array.isArray(t))return t.reduce((e,t)=>m(e,t),e??[]);if(e==null)return[t];let n=e.findIndex(e=>e.key===t.key),r=[...e];return n===-1?r.push(t):r[n]=t,r},ee=((e,t)=>{if(e!=null)return Array.isArray(t)?e.filter(e=>!t.includes(e.key)):e.filter(e=>e.key!==t)}),h=o({nullishToEmpty:()=>u,remove:()=>p,removeKeyed:()=>ee,toArray:()=>d,upsert:()=>f,upsertKeyed:()=>m}),te=o({camelToSnake:()=>ue,capitalize:()=>de,preserveCase:()=>re,snakeToCamel:()=>le,toKebab:()=>he,toProperNoun:()=>ge}),ne=`synnax.caseconv.preserveCase`,re=e=>(e[ne]=!0,e),ie=e=>{if(typeof e!=`object`||!e)return!1;if(ne in e)return!0;let t=e._zod?.def;return t==null?!1:t.innerType&&ie(t.innerType)?!0:t.type===`union`&&Array.isArray(t.options)?t.options.some(ie):t.type===`pipe`?ie(t.in)||ie(t.out):!1},ae=e=>{if(e==null)return;let t=e._zod?.def;if(t?.type===`array`&&t.element!=null)return t.element;if(t?.type===`union`&&Array.isArray(t.options))for(let e of t.options){let t=ae(e);if(t!=null)return t}},oe=e=>{if(e==null)return null;let t=e;if(t.shape!=null)return t.shape;if(typeof t.sourceType==`function`){let e=t.sourceType();if(e?.shape!=null)return e.shape}let n=t._zod?.def;if(n==null)return null;if(n.innerType!=null)return oe(n.innerType);if(n.type===`union`&&Array.isArray(n.options))for(let e of n.options){let t=oe(e);if(t!=null)return t}return n.type===`pipe`?oe(n.in)??oe(n.out):null},se=e=>{if(e.length===0)return e;let t=e.indexOf(`_`)===-1?e:e.replace(/_[a-z]/g,e=>e[1].toUpperCase()),n=t.charCodeAt(0);return n<65||n>90||t.length>1&&t.charCodeAt(1)>=65&&t.charCodeAt(1)<=90?t:String.fromCharCode(n+32)+t.slice(1)},ce=e=>{let t=(n,r=fe)=>{if(typeof n==`string`)return e(n);if(Array.isArray(n)){let e=ae(r.schema),i={recursive:r.recursive,recursiveInArray:r.recursiveInArray,schema:e};return n.map(e=>t(e,i))}if(!pe(n)||r.schema!=null&&ie(r.schema))return n;let i=r.recursive??!0,a=r.recursiveInArray??i,o=r.schema,s={},c=n;if(`toJSON`in c&&typeof c.toJSON==`function`)return t(c.toJSON(),r);let l=oe(o),u={recursive:i,recursiveInArray:a,schema:void 0},d=Object.keys(c);for(let n=0;n<d.length;n++){let r=d[n],o=c[r],f=e(r),p=l==null?void 0:l[r]??l[f]??void 0;i&&(pe(o)?me(o)||(u.schema=p,o=t(o,u)):a&&Array.isArray(o)&&(u.schema=ae(p),o=o.map(e=>{if(pe(e)){if(!me(e))return t(e,u)}else if(Array.isArray(e))return t({key:e},u).key;return e}))),s[f]=o}return s};return t},le=ce(se),ue=ce(e=>e.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`)),de=e=>e.length===0?e:e[0].toUpperCase()+e.slice(1),fe={recursive:!0,recursiveInArray:!0,schema:void 0},pe=e=>typeof e==`object`&&!!e&&!Array.isArray(e),me=e=>e instanceof Uint8Array||e instanceof Number||e instanceof String,he=ce(e=>e.replace(/[\s_]+/g,`-`).replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}-${n.toLowerCase()}`).toLowerCase()),ge=ce(e=>{if(e.length===0)return e;let t=e.replace(/[_-]/g,` `);return t=t.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t} ${n}`),t=t.replace(/([A-Z]+)([A-Z][a-z])/g,(e,t,n)=>`${t} ${n}`),t=t.replace(/\s+/g,` `).trim(),t=t.replace(/\b\w/g,e=>e.toUpperCase()),t}),_e=o({isObject:()=>g,isPlainObject:()=>ve}),g=e=>typeof e==`object`&&!!e&&!Array.isArray(e),ve=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},ye=e=>e.nullable().transform(e=>e===null?void 0:e).optional(),be=(e,t)=>{let n=e;for(let e of t){if(typeof n!=`object`||!n)return{present:!1,value:void 0};let t=n;if(!(e in t))return{present:!1,value:void 0};n=t[e]}return{present:!0,value:n}},xe=e=>{try{return structuredClone(e)}catch{return console.warn(`Failed to deep copy object, falling back to JSON.parse(JSON.stringify)`,e),console.trace(),JSON.parse(JSON.stringify(e))}},Se=(e,t,n=``)=>{let r={},i=(e,t,n)=>{if(typeof e!=typeof t||e===null||t===null){r[n]=[e,t];return}if(typeof e==`object`&&typeof t==`object`)if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length){r[n]=[e,t];return}for(let r=0;r<e.length;r++)i(e[r],t[r],`${n}[${r}]`)}else new Set([...Object.keys(e),...Object.keys(t)]).forEach(r=>{i(e[r],t[r],n===``?r:`${n}.${r}`)});else e!==t&&(r[n]=[e,t])};return i(e,t,n),r},Ce=(e,t)=>{let n=Array.isArray(e),r=Array.isArray(t);if(n!==r)return!1;if(n&&r){let n=e,r=t;if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++)if(!Ce(n[e],r[e]))return!1;return!0}if(e==null||t==null||typeof e!=`object`||typeof t!=`object`)return e===t;if(`equals`in e)return e.equals(t);let i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(let n of i){let r=e[n],i=t[n];if(typeof r==`object`&&typeof i==`object`){if(!Ce(r,i))return!1}else if(r!==i)return!1}return!0},we=(e,t)=>{if(typeof e!=`object`||!e)return e===t;let n=Object.keys(e),r=Object.keys(t);if(r.length>n.length)return!1;for(let n of r){let r=e[n],i=t[n];if(typeof r==`object`&&typeof i==`object`){if(!we(r,i))return!1}else if(r!==i)return!1}return!0},Te=(e,t,n=`.`)=>{let r=e.split(n);return r.map((e,i)=>{let a=t(e,i,r);return a==null?null:typeof a==`string`?a:a.join(n)}).filter(e=>e!=null).join(n)},_=(e,t)=>{if(!Array.isArray(e))return e[t];let n=e[t];if(n!=null||e.length==0)return n;let r=e[0];if(typeof r==`object`&&`key`in r)return e.find(e=>e.key===t)},Ee=(e,t)=>{let n=e.split(`.`);return n.forEach((e,r)=>{t=_(t,e),typeof t==`object`&&t&&`key`in t&&(n[r]=t.key)}),n.join(`.`)},De=(e,t)=>{let n=e.split(`.`);return t<0?n[n.length+t]:n[t]},Oe=(e,t)=>{if(t.length===0)return!0;let n=e.split(`.`),r=t.split(`.`);if(r.length>n.length)return!1;for(let e=0;e<r.length;e++){let t=n[e],i=r[e];if(i!==`*`&&t!==i)return!1}return!0},v=e=>{let t=parseInt(e,10);return isNaN(t)||t<0||t.toString()!==e?null:t},ke=(e,t)=>{for(let n=1;n<=t.length;n++){let r=t.slice(0,n).join(`.`);if(_(e,r)!=null)return[r,n]}return null},Ae=((e,t,n={optional:!1})=>{let{optional:r,getter:i=_}=n;if(t===``)return e;let a=t.split(`.`);if(a.length===1){let n=i(e,a[0]);if(n===void 0){if(r)return null;throw Error(`Path ${t} does not exist. ${a[0]} is undefined`)}return n}let o=(e,n)=>{if(n>=a.length)return e;for(let s=a.length-n;s>=1;s--){let c=a.slice(n,n+s).join(`.`),l=i(e,c);if(l!==void 0){if(n+s===a.length)return l;if(l===null){if(r)return null;throw Error(`Path ${t} does not exist. ${c} is null`)}return o(l,n+s)}}if(r)return null;throw Error(`Path ${t} does not exist. ${a[n]} is undefined`)};return o(e,0)}),je=(e,t)=>Ae(e,t,{optional:!0})!==null,Me=(e,...t)=>{if(t.length===0)return e;let n=t.shift();if(g(e)&&g(n))for(let t in n)try{g(n[t])?(t in e||Object.assign(e,{[t]:{}}),Me(e[t],n[t])):Object.assign(e,{[t]:n[t]})}catch(e){throw e instanceof TypeError?TypeError(`.${t}: ${e.message}`,{cause:e}):e}return Me(e,...t)},Ne=(e,t,n)=>{let r=(e,t,n)=>{if(n.def?.type===`union`)return n.def.options.reduce((e,n)=>r(e,t,n),e);if(n.def?.type===`intersection`)return r(r(e,t,n.def.left),t,n.def.right);for(let i in t){let a=t[i],o=n?.shape;if(o!=null)for(;o!=null;){if(o[i]!=null){let t=o[i].safeParse(a);if(t.success){e[i]=t.data;break}}o=o.def?.shape}typeof a==`object`&&!Array.isArray(a)&&a!==null&&n&&n.shape&&n.shape[i]&&(e[i]||={},r(e[i],a,n.shape[i]))}return e};return r({...e},t,n)},Pe=(e,t)=>{let n=t.split(`.`),r=e,i=0;for(;i<n.length;){if(i===n.length-1){let e=n[i];if(Array.isArray(r)){let t=parseInt(e,10);if(!isNaN(t)&&t<r.length){r.splice(t,1);return}let n=r[0];if(typeof n==`object`&&`key`in n){let t=r.findIndex(t=>t.key===e);if(t!==-1){r.splice(t,1);return}}return}delete r[e];return}let e=!1;if(Array.isArray(r)&&r.length>0){let t=r[0];if(typeof t==`object`&&`key`in t)for(let t=n.length-i;t>=1;t--){let a=n.slice(i,i+t).join(`.`),o=r.find(e=>e.key===a);if(o!=null){if(i+t===n.length){let e=r.findIndex(e=>e.key===a);e!==-1&&r.splice(e,1);return}r=o,i+=t,e=!0;break}}}if(!e)for(let t=n.length-i;t>=1;t--){let a=n.slice(i,i+t).join(`.`);if(!Array.isArray(r)&&typeof r==`object`&&r&&a in r){if(i+t===n.length){delete r[a];return}r=r[a],i+=t,e=!0;break}}if(!e){let e=_(r,n[i]);if(e==null)return;r=e,i++}}},Fe=(e,t,n)=>{let r=t.split(`.`),i=e,a=0;for(;a<r.length-1;){let e=ke(i,r.slice(a,r.length-1)),t;e==null?(t=r[a],a++):[t,a]=[e[0],a+e[1]];let n=_(i,t);if(n==null){let e=r[a],o=v(e);o==null&&e.startsWith(`-`)&&v(e.substring(1))!=null&&(o=0),n=o==null?{}:[],i[t]=n}i=n}try{let e=r[r.length-1];if(Array.isArray(i)){let t=v(e);if(t==null){if(e.startsWith(`-`)){let n=v(e.substring(1));n!=null&&(t=i.length-n)}if(t==null){if(i.length===0){let t=v(e);if(t!=null){i[t]=n;return}}let t=i[0];if(typeof t==`object`&&`key`in t){let t=i.findIndex(t=>t.key===e);if(t!==-1){i[t]=n;return}}return}}i[t]=n;return}let t=ke(i,[e]);if(t!=null){i[t[0]]=n;return}i[e]=n}catch(r){throw console.error(`failed to set value`,n,`at path`,t,`on object`,e),r}},Ie=o({SEPARATOR:()=>`.`,atKeys:()=>be,copy:()=>xe,defaultGetter:()=>_,difference:()=>Se,element:()=>De,equal:()=>Ce,findBestKey:()=>ke,get:()=>Ae,getIndex:()=>v,has:()=>je,override:()=>Me,overrideValidItems:()=>Ne,partialEqual:()=>we,pathsMatch:()=>Oe,remove:()=>Pe,resolvePath:()=>Ee,set:()=>Fe,transformPath:()=>Te}),Le=e=>Object.getOwnPropertySymbols(globalThis).includes(e),Re=(e,t)=>{let n=Symbol.for(e);if(!Le(n)){let e=t();Object.defineProperty(globalThis,n,{value:e})}return()=>globalThis[n]},ze=o({Canceled:()=>Ze,NONE:()=>`nil`,NotImplemented:()=>Qe,UNKNOWN:()=>Ue,Unknown:()=>Ye,createTyped:()=>y,decode:()=>Je,encode:()=>qe,isTyped:()=>He,payloadZ:()=>Xe,register:()=>Ke}),Be=`sy_x_error`,Ve=e=>t=>typeof t==`object`&&t&&`type`in t&&typeof t.type==`string`?t.type.startsWith(e):t instanceof Error?t.message.startsWith(e):typeof t==`string`?t.startsWith(e):!1,y=e=>class t extends Error{static discriminator=Be;discriminator=t.discriminator;static TYPE=e;type=t.TYPE;static matches=Ve(e);matches=t.matches;constructor(e,n){super(e,n),this.name=t.TYPE}static sub(t){return y(`${e}.${t}`)}},He=e=>{if(typeof e!=`object`||!e)return!1;let t=e;if(t.discriminator!==Be)return!1;if(!(`type`in t))throw Error(`X Error is missing its type property: ${JSON.stringify(t)}`);return!0},Ue=`unknown`,We=class{providers=[];register(e){this.providers.push(e)}encode(e){if(e==null)return{type:`nil`,data:``};if(He(e))for(let t of this.providers){let n=t.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:Ue,data:e.message};if(typeof e==`string`)return{type:Ue,data:e};try{return{type:Ue,data:JSON.stringify(e)}}catch{return{type:Ue,data:`unable to encode error information`}}}decode(e){if(e==null||e.type===`nil`)return null;if(e.type===`unknown`)return new Ye(e.data);for(let t of this.providers){let n=t.decode(e);if(n!=null)return n}return new Ye(e.data)}},Ge=Re(`synnax-error-registry`,()=>new We),Ke=({encode:e,decode:t})=>Ge().register({encode:e,decode:t}),qe=e=>Ge().encode(e),Je=e=>e==null?null:Ge().decode(e),Ye=class extends y(`unknown`){},Xe=l.z.object({type:l.z.string(),data:l.z.string()}),Ze=class extends y(`canceled`){},Qe=class extends y(`not_implemented`){},$e=e=>{if(e.length===0)return`<root>`;let t=``;return e.forEach((e,n)=>{typeof e==`number`?t+=`[${e}]`:n===0?t+=String(e):t+=`.${String(e)}`}),t},et=200,tt=10,nt=8,b=(e,t={})=>{let n=t.maxStringLength??et,r=t.maxArrayLength??tt,i=t.maxDepth??nt,a=(e,t)=>{if(e===null)return null;if(e===void 0)return`[undefined]`;let o=typeof e;if(o===`string`){let t=e;return t.length>n?`${t.slice(0,n)}…(+${t.length-n} chars)`:t}if(o===`number`||o===`boolean`)return e;if(o===`bigint`)return`${e.toString()}n`;if(o===`symbol`||o===`function`)return`[${o}]`;if(Array.isArray(e)){if(t>=i)return`[Array(${e.length})]`;let n=e.slice(0,r).map(e=>a(e,t+1));return e.length>r&&n.push(`…(+${e.length-r} more)`),n}if(ve(e)){if(t>=i)return`[Object]`;let n={};for(let[r,i]of Object.entries(e))n[r]=a(i,t+1);return n}if(e instanceof Date)return e.toISOString();if(e instanceof Error)return`[Error: ${e.message}]`;try{return`[${Object.prototype.toString.call(e)}]`}catch{return`[unknown]`}};return a(e,0)},rt=(e,t={})=>JSON.stringify(b(e,t),null,2),it=o({path:()=>$e,stringify:()=>rt,value:()=>b}),at=o({ValueExtension:()=>S,is:()=>lt,isCrudeValueExtension:()=>x,isNonZero:()=>ct,isStringer:()=>ot,isZero:()=>st}),x=e=>typeof e==`object`&&!!e&&`value`in e,S=class{value;constructor(e){this.value=e}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}},ot=e=>typeof e==`object`&&!!e&&`toString`in e,st=e=>{if(ot(e))return e?.toString().length===0;switch(typeof e){case`string`:return e.length===0;case`number`:return e===0;case`bigint`:return e===0n;case`boolean`:return!e;case`undefined`:return!0;case`object`:return e==null;default:return!1}},ct=e=>!st(e),lt=e=>e==null||typeof e!=`object`&&typeof e!=`function`,ut=`value`,dt=`zod.parse`,ft=`✗`,pt=60,mt={maxStringLength:60,maxArrayLength:3,maxDepth:3},ht=e=>e.slice(0,-1),gt=e=>{switch(e.code){case`invalid_type`:return`expected ${e.expected}`;case`invalid_value`:return`expected one of ${JSON.stringify(e.values)}`;case`unrecognized_keys`:return`unexpected key`;case`too_small`:{let t=e.inclusive===!1?`>`:`>=`;return`${e.origin} too small: expected ${t}${e.minimum}`}case`too_big`:{let t=e.inclusive===!1?`<`:`<=`;return`${e.origin} too large: expected ${t}${e.maximum}`}case`invalid_format`:return`expected ${e.format} format`;case`not_multiple_of`:return`expected multiple of ${e.divisor}`;case`custom`:return e.message||`custom validation failed`;default:return e.message}},_t=(e,t,n)=>{let r=JSON.stringify(b(t,n));return`${gt(e)}, received ${r}`},vt=e=>{let t=0;for(let n of e){if(n.path.length>t&&(t=n.path.length),n.code===`invalid_union`&&`errors`in n)for(let e of n.errors){let n=vt(e);n>t&&(t=n)}if((n.code===`invalid_key`||n.code===`invalid_element`)&&`issues`in n){let e=vt(n.issues);e>t&&(t=e)}}return t},yt=(e,t=[])=>{let n=[];for(let r of e){let e=[...t,...r.path];if(r.code===`invalid_union`&&`errors`in r&&r.errors.length>0){let t=r.errors[0],i=vt(t);for(let e=1;e<r.errors.length;e++){let n=vt(r.errors[e]);n>i&&(t=r.errors[e],i=n)}n.push(...yt(t,e));continue}if(r.code===`invalid_element`&&`issues`in r&&`key`in r&&(typeof r.key==`string`||typeof r.key==`number`)){n.push(...yt(r.issues,[...e,r.key]));continue}if(r.code===`invalid_key`&&`issues`in r){n.push(...yt(r.issues,e));continue}n.push({...r,path:e})}return n},bt=e=>{let t=[];for(let n of e){if(n.code===`unrecognized_keys`&&`keys`in n&&Array.isArray(n.keys)){for(let e of n.keys)t.push({...n,path:[...n.path,e]});continue}t.push(n)}return t},xt=(e,t,n,r)=>{let i=`${n} `,a=`${n+ft} `,o={...mt,...r};if(Array.isArray(e)){let e=-1;for(let n of t.keys()){let t=Number(n);Number.isInteger(t)&&t>e&&(e=t)}let n=o.maxArrayLength??3;e>=n&&(o={...o,maxArrayLength:e+2})}let s=b(e,o);if(typeof s!=`object`||!s){let e=JSON.stringify(s),n=t.values().next().value;return[`${a}${e}${n?` × ${n.reason}`:``}`]}let c=[],l=Array.isArray(s);c.push(`${n}${l?`[`:`{`}`);let u=[];if(l){let e=s;for(let n=0;n<e.length;n++){let r=t.get(String(n));u.push({content:JSON.stringify(e[n]),mark:r&&!r.missing?r:void 0})}}else{let e=s;for(let n of Object.keys(e)){let r=t.get(n);u.push({content:`"${n}": ${JSON.stringify(e[n])}`,mark:r&&!r.missing?r:void 0})}for(let[e,n]of t.entries())n.missing&&u.push({content:`"${e}": <missing>`,mark:n})}let d=0;return u.forEach((e,t)=>{if(e.mark==null)return;let n=t<u.length-1?1:0,r=e.content.length+n;r>d&&r<=pt&&(d=r)}),u.forEach((e,t)=>{let n=t<u.length-1?`,`:``,r=e.content+n;if(e.mark!=null){let t=` `.repeat(Math.max(2,d-r.length+2));c.push(`${a}${r}${t}× ${e.mark.reason}`)}else c.push(`${i}${r}`)}),c.push(n+(l?`]`:`}`)),c},St=`__root__`,Ct=(e,t,n)=>{let r=new Map;for(let t of e){let e=t.path.length===0?St:`::${$e(ht(t.path))}`,n=r.get(e);n==null?r.set(e,[t]):n.push(t)}let i=[];for(let[e,a]of r){if(e===St){i.push(a.map(e=>` × ${_t(e,t,n)}`).join(`
|
|
2
|
-
`));continue}let r=
|
|
3
|
-
`));continue}let c=new Map;for(let e of a){let n=String(e.path[e.path.length-1]),r=
|
|
4
|
-
`)):i.push([` at ${
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`zod`);l=c(l,1);var u=e=>l.default.union([l.default.union([l.default.null(),l.default.undefined()]).transform(()=>[]),e.array()]),d=e=>Array.isArray(e)?e:e==null?[]:[e],f=(e,t)=>{if(Array.isArray(t))return t.reduce((e,t)=>f(e,t),e??[]);if(e==null)return[t];let n=e.findIndex(e=>e==t),r=[...e];return n===-1?r.push(t):r[n]=t,r},p=((e,t)=>{if(e!=null)return Array.isArray(t)?e.filter(e=>!t.includes(e)):e.filter(e=>e!=t)}),m=(e,t)=>{if(Array.isArray(t))return t.reduce((e,t)=>m(e,t),e??[]);if(e==null)return[t];let n=e.findIndex(e=>e.key===t.key),r=[...e];return n===-1?r.push(t):r[n]=t,r},ee=((e,t)=>{if(e!=null)return Array.isArray(t)?e.filter(e=>!t.includes(e.key)):e.filter(e=>e.key!==t)}),h=o({nullishToEmpty:()=>u,remove:()=>p,removeKeyed:()=>ee,toArray:()=>d,upsert:()=>f,upsertKeyed:()=>m}),te=o({camelToSnake:()=>ue,capitalize:()=>de,preserveCase:()=>re,snakeToCamel:()=>le,toKebab:()=>he,toProperNoun:()=>ge}),ne=`synnax.caseconv.preserveCase`,re=e=>(e[ne]=!0,e),ie=e=>{if(typeof e!=`object`||!e)return!1;if(ne in e)return!0;let t=e._zod?.def;return t==null?!1:t.innerType&&ie(t.innerType)?!0:t.type===`union`&&Array.isArray(t.options)?t.options.some(ie):t.type===`pipe`?ie(t.in)||ie(t.out):!1},ae=e=>{if(e==null)return;let t=e._zod?.def;if(t?.type===`array`&&t.element!=null)return t.element;if(t?.type===`union`&&Array.isArray(t.options))for(let e of t.options){let t=ae(e);if(t!=null)return t}},oe=e=>{if(e==null)return null;let t=e;if(t.shape!=null)return t.shape;if(typeof t.sourceType==`function`){let e=t.sourceType();if(e?.shape!=null)return e.shape}let n=t._zod?.def;if(n==null)return null;if(n.innerType!=null)return oe(n.innerType);if(n.type===`union`&&Array.isArray(n.options))for(let e of n.options){let t=oe(e);if(t!=null)return t}return n.type===`pipe`?oe(n.in)??oe(n.out):null},se=e=>{if(e.length===0)return e;let t=e.indexOf(`_`)===-1?e:e.replace(/_[a-z]/g,e=>e[1].toUpperCase()),n=t.charCodeAt(0);return n<65||n>90||t.length>1&&t.charCodeAt(1)>=65&&t.charCodeAt(1)<=90?t:String.fromCharCode(n+32)+t.slice(1)},ce=e=>{let t=(n,r=fe)=>{if(typeof n==`string`)return e(n);if(Array.isArray(n)){let e=ae(r.schema),i={recursive:r.recursive,recursiveInArray:r.recursiveInArray,schema:e};return n.map(e=>t(e,i))}if(!pe(n)||r.schema!=null&&ie(r.schema))return n;let i=r.recursive??!0,a=r.recursiveInArray??i,o=r.schema,s={},c=n;if(`toJSON`in c&&typeof c.toJSON==`function`)return t(c.toJSON(),r);let l=oe(o),u={recursive:i,recursiveInArray:a,schema:void 0},d=Object.keys(c);for(let n=0;n<d.length;n++){let r=d[n],o=c[r],f=e(r),p=l==null?void 0:l[r]??l[f]??void 0;i&&(pe(o)?me(o)||(u.schema=p,o=t(o,u)):a&&Array.isArray(o)&&(u.schema=ae(p),o=o.map(e=>{if(pe(e)){if(!me(e))return t(e,u)}else if(Array.isArray(e))return t({key:e},u).key;return e}))),s[f]=o}return s};return t},le=ce(se),ue=ce(e=>e.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`)),de=e=>e.length===0?e:e[0].toUpperCase()+e.slice(1),fe={recursive:!0,recursiveInArray:!0,schema:void 0},pe=e=>typeof e==`object`&&!!e&&!Array.isArray(e),me=e=>e instanceof Uint8Array||e instanceof Number||e instanceof String,he=ce(e=>e.replace(/[\s_]+/g,`-`).replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}-${n.toLowerCase()}`).toLowerCase()),ge=ce(e=>{if(e.length===0)return e;let t=e.replace(/[_-]/g,` `);return t=t.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t} ${n}`),t=t.replace(/([A-Z]+)([A-Z][a-z])/g,(e,t,n)=>`${t} ${n}`),t=t.replace(/\s+/g,` `).trim(),t=t.replace(/\b\w/g,e=>e.toUpperCase()),t}),_e=o({isObject:()=>ve,isPlainObject:()=>ye}),ve=e=>typeof e==`object`&&!!e&&!Array.isArray(e),ye=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},be=e=>e.nullable().transform(e=>e===null?void 0:e).optional(),xe=(e,t)=>{let n=e;for(let e of t){if(typeof n!=`object`||!n)return{present:!1,value:void 0};let t=n;if(!(e in t))return{present:!1,value:void 0};n=t[e]}return{present:!0,value:n}},Se=e=>{try{return structuredClone(e)}catch{return console.warn(`Failed to deep copy object, falling back to JSON.parse(JSON.stringify)`,e),console.trace(),JSON.parse(JSON.stringify(e))}},Ce=(e,t,n=``)=>{let r={},i=(e,t,n)=>{if(typeof e!=typeof t||e===null||t===null){r[n]=[e,t];return}if(typeof e==`object`&&typeof t==`object`)if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length){r[n]=[e,t];return}for(let r=0;r<e.length;r++)i(e[r],t[r],`${n}[${r}]`)}else new Set([...Object.keys(e),...Object.keys(t)]).forEach(r=>{i(e[r],t[r],n===``?r:`${n}.${r}`)});else e!==t&&(r[n]=[e,t])};return i(e,t,n),r},we=(e,t)=>{let n=Array.isArray(e),r=Array.isArray(t);if(n!==r)return!1;if(n&&r){let n=e,r=t;if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++)if(!we(n[e],r[e]))return!1;return!0}if(e==null||t==null||typeof e!=`object`||typeof t!=`object`)return e===t;if(`equals`in e)return e.equals(t);let i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(let n of i){let r=e[n],i=t[n];if(typeof r==`object`&&typeof i==`object`){if(!we(r,i))return!1}else if(r!==i)return!1}return!0},Te=(e,t)=>{if(typeof e!=`object`||!e)return e===t;let n=Object.keys(e),r=Object.keys(t);if(r.length>n.length)return!1;for(let n of r){let r=e[n],i=t[n];if(typeof r==`object`&&typeof i==`object`){if(!Te(r,i))return!1}else if(r!==i)return!1}return!0},Ee=(e,t,n=`.`)=>{let r=e.split(n);return r.map((e,i)=>{let a=t(e,i,r);return a==null?null:typeof a==`string`?a:a.join(n)}).filter(e=>e!=null).join(n)},De=(e,t)=>{if(!Array.isArray(e))return e[t];let n=e[t];if(n!=null||e.length==0)return n;let r=e[0];if(typeof r==`object`&&`key`in r)return e.find(e=>e.key===t)},Oe=(e,t)=>{let n=e.split(`.`);return n.forEach((e,r)=>{t=De(t,e),typeof t==`object`&&t&&`key`in t&&(n[r]=t.key)}),n.join(`.`)},ke=(e,t)=>{let n=e.split(`.`);return t<0?n[n.length+t]:n[t]},Ae=(e,t)=>{if(t.length===0)return!0;let n=e.split(`.`),r=t.split(`.`);if(r.length>n.length)return!1;for(let e=0;e<r.length;e++){let t=n[e],i=r[e];if(i!==`*`&&t!==i)return!1}return!0},g=e=>{let t=parseInt(e,10);return isNaN(t)||t<0||t.toString()!==e?null:t},je=(e,t)=>{for(let n=1;n<=t.length;n++){let r=t.slice(0,n).join(`.`);if(De(e,r)!=null)return[r,n]}return null},Me=((e,t,n={optional:!1})=>{let{optional:r,getter:i=De}=n;if(t===``)return e;let a=t.split(`.`);if(a.length===1){let n=i(e,a[0]);if(n===void 0){if(r)return null;throw Error(`Path ${t} does not exist. ${a[0]} is undefined`)}return n}let o=(e,n)=>{if(n>=a.length)return e;for(let s=a.length-n;s>=1;s--){let c=a.slice(n,n+s).join(`.`),l=i(e,c);if(l!==void 0){if(n+s===a.length)return l;if(l===null){if(r)return null;throw Error(`Path ${t} does not exist. ${c} is null`)}return o(l,n+s)}}if(r)return null;throw Error(`Path ${t} does not exist. ${a[n]} is undefined`)};return o(e,0)}),Ne=(e,t)=>Me(e,t,{optional:!0})!==null,Pe=(e,...t)=>{if(t.length===0)return e;let n=t.shift();if(ve(e)&&ve(n))for(let t in n)try{ve(n[t])?(t in e||Object.assign(e,{[t]:{}}),Pe(e[t],n[t])):Object.assign(e,{[t]:n[t]})}catch(e){throw e instanceof TypeError?TypeError(`.${t}: ${e.message}`,{cause:e}):e}return Pe(e,...t)},Fe=(e,t,n)=>{let r=(e,t,n)=>{if(n.def?.type===`union`)return n.def.options.reduce((e,n)=>r(e,t,n),e);if(n.def?.type===`intersection`)return r(r(e,t,n.def.left),t,n.def.right);for(let i in t){let a=t[i],o=n?.shape;if(o!=null)for(;o!=null;){if(o[i]!=null){let t=o[i].safeParse(a);if(t.success){e[i]=t.data;break}}o=o.def?.shape}typeof a==`object`&&!Array.isArray(a)&&a!==null&&n&&n.shape&&n.shape[i]&&(e[i]||={},r(e[i],a,n.shape[i]))}return e};return r({...e},t,n)},Ie=(e,t)=>{let n=t.split(`.`),r=e,i=0;for(;i<n.length;){if(i===n.length-1){let e=n[i];if(Array.isArray(r)){let t=parseInt(e,10);if(!isNaN(t)&&t<r.length){r.splice(t,1);return}let n=r[0];if(typeof n==`object`&&`key`in n){let t=r.findIndex(t=>t.key===e);if(t!==-1){r.splice(t,1);return}}return}delete r[e];return}let e=!1;if(Array.isArray(r)&&r.length>0){let t=r[0];if(typeof t==`object`&&`key`in t)for(let t=n.length-i;t>=1;t--){let a=n.slice(i,i+t).join(`.`),o=r.find(e=>e.key===a);if(o!=null){if(i+t===n.length){let e=r.findIndex(e=>e.key===a);e!==-1&&r.splice(e,1);return}r=o,i+=t,e=!0;break}}}if(!e)for(let t=n.length-i;t>=1;t--){let a=n.slice(i,i+t).join(`.`);if(!Array.isArray(r)&&typeof r==`object`&&r&&a in r){if(i+t===n.length){delete r[a];return}r=r[a],i+=t,e=!0;break}}if(!e){let e=De(r,n[i]);if(e==null)return;r=e,i++}}},Le=(e,t,n)=>{let r=t.split(`.`),i=e,a=0;for(;a<r.length-1;){let e=je(i,r.slice(a,r.length-1)),t;e==null?(t=r[a],a++):[t,a]=[e[0],a+e[1]];let n=De(i,t);if(n==null){let e=r[a],o=g(e);o==null&&e.startsWith(`-`)&&g(e.substring(1))!=null&&(o=0),n=o==null?{}:[],i[t]=n}i=n}try{let e=r[r.length-1];if(Array.isArray(i)){let t=g(e);if(t==null){if(e.startsWith(`-`)){let n=g(e.substring(1));n!=null&&(t=i.length-n)}if(t==null){if(i.length===0){let t=g(e);if(t!=null){i[t]=n;return}}let t=i[0];if(typeof t==`object`&&`key`in t){let t=i.findIndex(t=>t.key===e);if(t!==-1){i[t]=n;return}}return}}i[t]=n;return}let t=je(i,[e]);if(t!=null){i[t[0]]=n;return}i[e]=n}catch(r){throw console.error(`failed to set value`,n,`at path`,t,`on object`,e),r}},Re=o({SEPARATOR:()=>`.`,atKeys:()=>xe,copy:()=>Se,defaultGetter:()=>De,difference:()=>Ce,element:()=>ke,equal:()=>we,findBestKey:()=>je,get:()=>Me,getIndex:()=>g,has:()=>Ne,override:()=>Pe,overrideValidItems:()=>Fe,partialEqual:()=>Te,pathsMatch:()=>Ae,remove:()=>Ie,resolvePath:()=>Oe,set:()=>Le,transformPath:()=>Ee}),ze=e=>Object.getOwnPropertySymbols(globalThis).includes(e),Be=(e,t)=>{let n=Symbol.for(e);if(!ze(n)){let e=t();Object.defineProperty(globalThis,n,{value:e})}return()=>globalThis[n]},Ve=o({Canceled:()=>$e,NONE:()=>`nil`,NotImplemented:()=>et,UNKNOWN:()=>Ge,Unknown:()=>Ze,createTyped:()=>_,decode:()=>Xe,encode:()=>Ye,isTyped:()=>We,payloadZ:()=>Qe,register:()=>Je}),He=`sy_x_error`,Ue=e=>t=>typeof t==`object`&&t&&`type`in t&&typeof t.type==`string`?t.type.startsWith(e):t instanceof Error?t.message.startsWith(e):typeof t==`string`?t.startsWith(e):!1,_=e=>class t extends Error{static discriminator=He;discriminator=t.discriminator;static TYPE=e;type=t.TYPE;static matches=Ue(e);matches=t.matches;constructor(e,n){super(e,n),this.name=t.TYPE}static sub(t){return _(`${e}.${t}`)}},We=e=>{if(typeof e!=`object`||!e)return!1;let t=e;if(t.discriminator!==He)return!1;if(!(`type`in t))throw Error(`X Error is missing its type property: ${JSON.stringify(t)}`);return!0},Ge=`unknown`,Ke=class{providers=[];register(e){this.providers.push(e)}encode(e){if(e==null)return{type:`nil`,data:``};if(We(e))for(let t of this.providers){let n=t.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:Ge,data:e.message};if(typeof e==`string`)return{type:Ge,data:e};try{return{type:Ge,data:JSON.stringify(e)}}catch{return{type:Ge,data:`unable to encode error information`}}}decode(e){if(e==null||e.type===`nil`)return null;if(e.type===`unknown`)return new Ze(e.data);for(let t of this.providers){let n=t.decode(e);if(n!=null)return n}return new Ze(e.data)}},qe=Be(`synnax-error-registry`,()=>new Ke),Je=({encode:e,decode:t})=>qe().register({encode:e,decode:t}),Ye=e=>qe().encode(e),Xe=e=>e==null?null:qe().decode(e),Ze=class extends _(`unknown`){},Qe=l.z.object({type:l.z.string(),data:l.z.string()}),$e=class extends _(`canceled`){},et=class extends _(`not_implemented`){},tt=e=>{if(e.length===0)return`<root>`;let t=``;return e.forEach((e,n)=>{typeof e==`number`?t+=`[${e}]`:n===0?t+=String(e):t+=`.${String(e)}`}),t},nt=200,rt=10,it=8,v=(e,t={})=>{let n=t.maxStringLength??nt,r=t.maxArrayLength??rt,i=t.maxDepth??it,a=(e,t)=>{if(e===null)return null;if(e===void 0)return`[undefined]`;let o=typeof e;if(o===`string`){let t=e;return t.length>n?`${t.slice(0,n)}…(+${t.length-n} chars)`:t}if(o===`number`||o===`boolean`)return e;if(o===`bigint`)return`${e.toString()}n`;if(o===`symbol`||o===`function`)return`[${o}]`;if(Array.isArray(e)){if(t>=i)return`[Array(${e.length})]`;let n=e.slice(0,r).map(e=>a(e,t+1));return e.length>r&&n.push(`…(+${e.length-r} more)`),n}if(ye(e)){if(t>=i)return`[Object]`;let n={};for(let[r,i]of Object.entries(e))n[r]=a(i,t+1);return n}if(e instanceof Date)return e.toISOString();if(e instanceof Error)return`[Error: ${e.message}]`;try{return`[${Object.prototype.toString.call(e)}]`}catch{return`[unknown]`}};return a(e,0)},at=(e,t={})=>JSON.stringify(v(e,t),null,2),ot=o({path:()=>tt,stringify:()=>at,value:()=>v}),st=o({ValueExtension:()=>b,is:()=>dt,isCrudeValueExtension:()=>y,isNonZero:()=>ut,isStringer:()=>ct,isZero:()=>lt}),y=e=>typeof e==`object`&&!!e&&`value`in e,b=class{value;constructor(e){this.value=e}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}},ct=e=>typeof e==`object`&&!!e&&`toString`in e,lt=e=>{if(ct(e))return e?.toString().length===0;switch(typeof e){case`string`:return e.length===0;case`number`:return e===0;case`bigint`:return e===0n;case`boolean`:return!e;case`undefined`:return!0;case`object`:return e==null;default:return!1}},ut=e=>!lt(e),dt=e=>e==null||typeof e!=`object`&&typeof e!=`function`,ft=`value`,pt=`zod.parse`,mt=`✗`,ht=60,gt={maxStringLength:60,maxArrayLength:3,maxDepth:3},_t=e=>e.slice(0,-1),vt=e=>{switch(e.code){case`invalid_type`:return`expected ${e.expected}`;case`invalid_value`:return`expected one of ${JSON.stringify(e.values)}`;case`unrecognized_keys`:return`unexpected key`;case`too_small`:{let t=e.inclusive===!1?`>`:`>=`;return`${e.origin} too small: expected ${t}${e.minimum}`}case`too_big`:{let t=e.inclusive===!1?`<`:`<=`;return`${e.origin} too large: expected ${t}${e.maximum}`}case`invalid_format`:return`expected ${e.format} format`;case`not_multiple_of`:return`expected multiple of ${e.divisor}`;case`custom`:return e.message||`custom validation failed`;default:return e.message}},yt=(e,t,n)=>{let r=JSON.stringify(v(t,n));return`${vt(e)}, received ${r}`},bt=e=>{let t=0;for(let n of e){if(n.path.length>t&&(t=n.path.length),n.code===`invalid_union`&&`errors`in n)for(let e of n.errors){let n=bt(e);n>t&&(t=n)}if((n.code===`invalid_key`||n.code===`invalid_element`)&&`issues`in n){let e=bt(n.issues);e>t&&(t=e)}}return t},xt=(e,t=[])=>{let n=[];for(let r of e){let e=[...t,...r.path];if(r.code===`invalid_union`&&`errors`in r&&r.errors.length>0){let t=r.errors[0],i=bt(t);for(let e=1;e<r.errors.length;e++){let n=bt(r.errors[e]);n>i&&(t=r.errors[e],i=n)}n.push(...xt(t,e));continue}if(r.code===`invalid_element`&&`issues`in r&&`key`in r&&(typeof r.key==`string`||typeof r.key==`number`)){n.push(...xt(r.issues,[...e,r.key]));continue}if(r.code===`invalid_key`&&`issues`in r){n.push(...xt(r.issues,e));continue}n.push({...r,path:e})}return n},St=e=>{let t=[];for(let n of e){if(n.code===`unrecognized_keys`&&`keys`in n&&Array.isArray(n.keys)){for(let e of n.keys)t.push({...n,path:[...n.path,e]});continue}t.push(n)}return t},Ct=(e,t,n,r)=>{let i=`${n} `,a=`${n+mt} `,o={...gt,...r};if(Array.isArray(e)){let e=-1;for(let n of t.keys()){let t=Number(n);Number.isInteger(t)&&t>e&&(e=t)}let n=o.maxArrayLength??3;e>=n&&(o={...o,maxArrayLength:e+2})}let s=v(e,o);if(typeof s!=`object`||!s){let e=JSON.stringify(s),n=t.values().next().value;return[`${a}${e}${n?` × ${n.reason}`:``}`]}let c=[],l=Array.isArray(s);c.push(`${n}${l?`[`:`{`}`);let u=[];if(l){let e=s;for(let n=0;n<e.length;n++){let r=t.get(String(n));u.push({content:JSON.stringify(e[n]),mark:r&&!r.missing?r:void 0})}}else{let e=s;for(let n of Object.keys(e)){let r=t.get(n);u.push({content:`"${n}": ${JSON.stringify(e[n])}`,mark:r&&!r.missing?r:void 0})}for(let[e,n]of t.entries())n.missing&&u.push({content:`"${e}": <missing>`,mark:n})}let d=0;return u.forEach((e,t)=>{if(e.mark==null)return;let n=+(t<u.length-1),r=e.content.length+n;r>d&&r<=ht&&(d=r)}),u.forEach((e,t)=>{let n=t<u.length-1?`,`:``,r=e.content+n;if(e.mark!=null){let t=` `.repeat(Math.max(2,d-r.length+2));c.push(`${a}${r}${t}× ${e.mark.reason}`)}else c.push(`${i}${r}`)}),c.push(n+(l?`]`:`}`)),c},wt=`__root__`,Tt=(e,t,n)=>{let r=new Map;for(let t of e){let e=t.path.length===0?wt:`::${tt(_t(t.path))}`,n=r.get(e);n==null?r.set(e,[t]):n.push(t)}let i=[];for(let[e,a]of r){if(e===wt){i.push(a.map(e=>` × ${yt(e,t,n)}`).join(`
|
|
2
|
+
`));continue}let r=_t(a[0].path),{present:o,value:s}=xe(t,r);if(!o){i.push(a.map(e=>` at ${tt(e.path)}\n × ${yt(e,t,n)}`).join(`
|
|
3
|
+
`));continue}let c=new Map;for(let e of a){let n=String(e.path[e.path.length-1]),r=xe(t,e.path);c.set(n,{reason:vt(e),missing:!r.present})}let l=r.length===0,u=Ct(s,c,l?` `:` `,n);l?i.push(u.join(`
|
|
4
|
+
`)):i.push([` at ${tt(r)}`,...u].join(`
|
|
5
5
|
`))}return i.join(`
|
|
6
6
|
|
|
7
|
-
`)},
|
|
7
|
+
`)},Et=(e,t)=>{let n=Object.entries(e);return n.every(([,e])=>dt(e))?n.map(([e,t])=>`${e}=${typeof t==`string`?t:String(t)}`).join(`, `):at(e,t)},Dt=({issues:e,input:t,label:n,context:r,formatOptions:i})=>{let a=i??{},o=St(xt(e)),s=[`Failed to parse ${n} (${o.length===1?`1 issue`:`${o.length} issues`})`];return s.push(Tt(o,t,a)),r!=null&&Object.keys(r).length>0&&s.push(` context: ${Et(r,a)}`),s.join(`
|
|
8
8
|
|
|
9
|
-
`)},
|
|
9
|
+
`)},Ot=class extends _(pt){issues;input;label;context;constructor({issues:e,input:t,label:n,context:r,cause:i,formatOptions:a}){super(Dt({issues:e,input:t,label:n,context:r,formatOptions:a}),{cause:i}),this.issues=e,this.input=t,this.label=n,this.context=r}toStatus(){let e={input:v(this.input),issues:this.issues};return this.context!=null&&(e.context=this.context),{message:`Failed to parse ${this.label}`,description:this.message,details:e}}};Je({encode:e=>{if(!Ot.matches(e))return null;let t=e,n={label:t.label,context:t.context,issues:t.issues,input:v(t.input)};return{type:pt,data:JSON.stringify(n)}},decode:e=>{if(e.type!==pt)return null;let t=JSON.parse(e.data);return new Ot({issues:t.issues,input:t.input,label:t.label,context:t.context})}});var kt=(e,t,n={})=>{let r=e.safeParse(t);if(r.success)return r.data;throw new Ot({issues:r.error.issues,input:t,label:n.label??ft,context:n.context,cause:r.error})},At=2**12-1,jt=2**16-1,Mt=2**20-1,Nt=2**32-1,Pt=2n**64n-1n,Ft=2**64-1,It=-128,Lt=-(2**15),Rt=2**15-1,zt=-(2**31),Bt=2**31-1,Vt=-(2n**63n),Ht=2n**63n-1n,Ut=-(2**63),Wt=2**63-1,Gt=e=>(t,n)=>{if(typeof t==`bigint`){if(Xt(n))return e(t,BigInt(n));let r=e(Number(t),Number(n));return typeof r==`number`?BigInt(Math.round(r)):r}return e(Number(t),Number(n))},x=Gt((e,t)=>e-t),S=Gt((e,t)=>e+t),Kt=(e,t,n=1e-4)=>Math.abs(e-t)<n,qt=(e,t)=>{let n=typeof e==`bigint`,r=typeof t==`bigint`;return n&&r?e===t:n&&Xt(t)?e===BigInt(t):r&&Xt(e)?t===BigInt(e):e===t},Jt=e=>{let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t},Yt=Gt((e,t)=>e<=t?e:t),Xt=e=>typeof e==`bigint`?!0:Number.isInteger(e),Zt=Gt((e,t)=>e>=t?e:t),Qt=e=>typeof e==`bigint`?e<0n?-e:e:e<0?-e:e,C=Gt((e,t)=>e*t),$t=Gt((e,t)=>e/t),en=l.z.tuple([l.z.number(),l.z.number()]),tn=[`x`,`y`],nn=l.z.enum(tn),rn=[`top`,`right`,`bottom`,`left`],an=l.z.enum(rn),on=[`left`,`right`],sn=l.z.enum(on),cn=[`top`,`bottom`],ln=l.z.enum(cn),un=[`center`],dn=l.z.enum(un),fn=[`top`,`right`,`bottom`,`left`,`center`],pn=l.z.enum(fn),mn=[`start`,`center`,`end`],hn=l.z.enum(mn),gn=[`first`,`last`],_n=l.z.enum(gn),vn=l.z.object({clientX:l.z.number(),clientY:l.z.number()}),yn=l.z.object({width:l.z.number(),height:l.z.number()}),bn=l.z.object({signedWidth:l.z.number(),signedHeight:l.z.number()}),xn=l.z.object({lower:l.z.number(),upper:l.z.number()}),Sn=l.z.enum([`x`,`y`,...rn,...un]),Cn=l.z.union([nn,l.z.enum([...rn,...un]),l.z.instanceof(String)]),wn=o({CLIP:()=>On,DECIMAL:()=>Dn,INFINITE:()=>En,ZERO:()=>Tn,boundsZ:()=>xn,buildInsertionPlan:()=>Un,clamp:()=>jn,construct:()=>w,contains:()=>T,distance:()=>Gn,equals:()=>kn,findInsertPosition:()=>Vn,isFinite:()=>In,isZero:()=>Pn,linspace:()=>Bn,makeValid:()=>An,max:()=>Rn,mean:()=>Ln,min:()=>zn,overlapsWith:()=>Mn,span:()=>Nn,spanIsZero:()=>Fn,traverse:()=>Wn}),w=(e,t,n)=>{let r={};if(typeof t==`object`&&(n=t,t=void 0),n={makeValid:!0,...n},typeof e==`number`||typeof e==`bigint`)t==null?(r.lower=typeof e==`bigint`?0n:0,r.upper=e):(r.lower=e,r.upper=t);else if(Array.isArray(e)){if(e.length!==2)throw Error(`bounds: expected array of length 2`);[r.lower,r.upper]=e}else r.lower=e.lower,r.upper=e.upper;return n?.makeValid?An(r):r},Tn=Object.freeze({lower:0,upper:0}),En=Object.freeze({lower:-1/0,upper:1/0}),Dn=Object.freeze({lower:0,upper:1}),On=Object.freeze({lower:-1,upper:1}),kn=(e,t)=>{if(e==null&&t==null)return!0;if(e==null||t==null)return!1;let n=w(e),r=w(t);return n?.lower===r?.lower&&n?.upper===r?.upper},An=e=>e.lower>e.upper?{lower:e.upper,upper:e.lower}:e,jn=(e,t)=>{let n=w(e);return t<n.lower?n.lower:t>=n.upper?n.upper-(typeof n.upper==`number`?1:1n):t},T=(e,t)=>{let n=w(e);if(typeof t==`number`||typeof t==`bigint`)return t>=n.lower&&t<n.upper;let r=w(t);return r.lower>=n.lower&&r.upper<=n.upper},Mn=(e,t)=>{let n=w(e),r=w(t);return n.lower===r.lower?!0:r.upper===n.lower||r.lower===n.upper?!1:T(n,r.upper)||T(n,r.lower)||T(r,n.upper)||T(r,n.lower)},Nn=e=>{let t=w(e);return t.upper-t.lower},Pn=e=>{let t=w(e);return typeof t.lower==`bigint`?t.lower===0n&&t.upper===0n:t.lower===0&&t.upper===0},Fn=e=>{let t=Nn(e);return typeof t==`number`?t===0:t===0n},In=e=>{let t=w(e);return typeof t.lower==`bigint`?!0:Number.isFinite(t.lower)&&Number.isFinite(t.upper)},Ln=e=>{let t=w(e);return(t.upper+t.lower)/2},Rn=e=>({lower:Math.min(...e.map(e=>w(e).lower)),upper:Math.max(...e.map(e=>w(e).upper))}),zn=e=>({lower:Math.max(...e.map(e=>w(e).lower)),upper:Math.min(...e.map(e=>w(e).upper))}),Bn=e=>{let t=w(e),n=typeof t.lower==`bigint`;return Array.from({length:Number(Nn(e))},(e,r)=>n?t.lower+BigInt(r):t.lower+r)},Vn=(e,t)=>{let n=e.map(e=>w(e)),r=n.findIndex(e=>T(e,t)||t<e.lower);if(r===-1)return{index:e.length,position:0};let i=n[r];return T(i,t)?{index:r,position:Number(t-i.lower)}:{index:r,position:0}},Hn={removeBefore:0,removeAfter:0,insertInto:0,deleteInBetween:0},Un=(e,t)=>{let n=e.map(e=>w(e)),r=w(t);if(n.length===0)return Hn;let i=Vn(n,r.lower),a=Vn(n,r.upper);if(i.index===e.length)return{...Hn,insertInto:e.length};if(a.index===0)return{...Hn,removeAfter:a.position};if(i.index===a.index)return i.position!==0&&a.position!==0?null:{removeAfter:a.position,removeBefore:i.position,insertInto:i.index,deleteInBetween:0};let o=a.index-i.index,s=i.index,c=x(Number(Nn(n[i.index])),i.position);return i.position===0?c=0:(--o,s+=1),{removeBefore:c,removeAfter:a.position,insertInto:s,deleteInBetween:o}},Wn=(e,t,n)=>{let r=e.map(e=>w(e)),i=n>0?1:n<0?-1:0;if(i===0)return t;let a=n,o=t;for(;qt(a,0)===!1;){let e=r.findIndex(e=>i>0?o>=e.lower&&o<e.upper:o>e.lower&&o<=e.upper);if(e!==-1){let t=r[e],n;if(n=i>0?x(t.upper,o):x(o,t.lower),n>0){let e=Yt(Qt(a),n);if(o=S(o,i>0?e:-e),a=x(a,i>0?e:-e),qt(a,0))return o;continue}}if(i>0){let e=r.filter(e=>e.lower>o);if(e.length>0)o=e[0].lower;else return o}else{let e=r.filter(e=>e.upper<o);if(e.length>0)o=e[e.length-1].upper;else return o}}return o},Gn=(e,t,n)=>{let r=e.map(e=>w(e));if(t===n)return typeof t==`bigint`?0n:0;let i=w(t<n?[t,n]:[n,t]),a=typeof t==`bigint`?0n:0;for(let e of r){let t=e.lower>i.lower?e.lower:i.lower,n=e.upper<i.upper?e.upper:i.upper;if(t<n){let e=n-t;a+=e}}return a},Kn=2,qn=3,Jn=2,Yn=5,Xn=1e-10,Zn=(e,t)=>{if(Number.isNaN(e)||!Number.isFinite(e))return e;let n=Math.abs(e);if(n===0)return 0;let r=!1,i=0;if(t!=null){i=Nn(t);let e=i/n;r=i>0&&e>Xn}if(r){let t;t=i>=1e3?Kn:i>=1?qn:Math.ceil(-Math.log10(i))+Jn;let n=10**t;return Math.round(e*n)/n}if(n>=1e3){let t=10**Kn;return Math.round(e*t)/t}if(n>=1){let t=10**qn;return Math.round(e*t)/t}let a=10**(Yn-Math.floor(Math.log10(n))-1);return Math.round(e*a)/a},Qn=o({MAX_INT16:()=>Rt,MAX_INT32:()=>Bt,MAX_INT64:()=>Ht,MAX_INT64_NUMBER:()=>Wt,MAX_INT8:()=>127,MAX_UINT12:()=>At,MAX_UINT16:()=>jt,MAX_UINT20:()=>Mt,MAX_UINT32:()=>Nt,MAX_UINT64:()=>Pt,MAX_UINT64_NUMBER:()=>Ft,MAX_UINT8:()=>255,MIN_INT16:()=>Lt,MIN_INT32:()=>zt,MIN_INT64:()=>Vt,MIN_INT64_NUMBER:()=>Ut,MIN_INT8:()=>It,abs:()=>Qt,add:()=>S,closeTo:()=>Kt,div:()=>$t,equal:()=>qt,isInteger:()=>Xt,max:()=>Zt,min:()=>Yt,mult:()=>C,roundToNearestMagnitude:()=>Jt,smartRound:()=>Zn,sub:()=>x}),$n=l.z.int().min(It).max(127),er=l.z.int().min(Lt).max(Rt),tr=l.z.int().min(Ut).max(Wt),nr=l.z.int().min(0).max(255),rr=l.z.int().min(0).max(At),ir=l.z.int().min(0).max(jt),ar=l.z.int().min(0).max(Mt),or=e=>l.default.array(e).or(e.transform(e=>[e])),sr=e=>e._zod.def.output,cr=e=>Ee(e,(e,t,n)=>{let r=t===n.length-1,i=!isNaN(parseInt(e,10)),a=!isNaN(parseInt(n[t+1],10));return i&&(e=`element`),r||a?e:[e,`shape`]}),lr=(e,t)=>{if(e==null)return null;let n=e[t];return n==null&&typeof e==`object`&&`sourceType`in e?e.sourceType()[t]:n},ur=((e,t,n)=>t===``?e:Me(lr(e,`shape`),cr(t),{...n,getter:lr})),dr=o({ParseError:()=>Ot,functionOutput:()=>sr,getFieldSchema:()=>ur,getFieldSchemaPath:()=>cr,int16:()=>er,int64:()=>tr,int8:()=>$n,nullToUndefined:()=>be,parse:()=>kt,toArray:()=>or,uint12:()=>rr,uint16:()=>ir,uint20:()=>ar,uint8:()=>nr}),fr=o({CSVCodec:()=>mr,CSV_CODEC:()=>_r,ENCODERS:()=>yr,JSONCodec:()=>pr,JSON_CODEC:()=>gr,TEXT_CODEC:()=>vr,TextCodec:()=>hr}),pr=class{contentType=`application/json`;decoder;encoder;constructor(){this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(e,t){return this.encoder.encode(this.encodeString(e,t))}decode(e,t){return this.decodeString(this.decoder.decode(e),t)}decodeString(e,t){let n=le(JSON.parse(e),{schema:t});return t==null?n:kt(t,n)}encodeString(e,t){let n=ue((t==null?e:kt(t,e))??{},{schema:t});return JSON.stringify(n,(e,t)=>ArrayBuffer.isView(t)?Array.from(t):typeof t==`bigint`?t.toString():t)}},mr=class{contentType=`text/csv`;encode(e){let t=this.encodeString(e);return new TextEncoder().encode(t)}decode(e,t){let n=new TextDecoder().decode(e);return this.decodeString(n,t)}encodeString(e){if(!Array.isArray(e)||e.length===0||!ve(e[0]))throw Error(`Payload must be an array of objects`);let t=Object.keys(e[0]),n=[t.join(`,`)];return e.forEach(e=>{let r=t.map(t=>JSON.stringify(e[t]??``));n.push(r.join(`,`))}),n.join(`
|
|
10
10
|
`)}decodeString(e,t){let[n,...r]=e.trim().split(`
|
|
11
|
-
`).map(e=>e.trim());if(n.length===0)return t==null?{}:t.parse({});let i=n.split(`,`).map(e=>e.trim()),a={};return i.forEach(e=>{a[e]=[]}),r.forEach(e=>{let t=e.split(`,`).map(e=>e.trim());i.forEach((e,n)=>{let r=this.parseValue(t[n]);r!=null&&a[e].push(r)})}),t==null?a:t.parse(a)}parseValue(e){if(e==null||e.length===0)return null;let t=Number(e);return isNaN(t)?e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e:t}},pr=class{contentType=`text/plain`;encode(e){if(typeof e!=`string`)throw Error(`TextCodec.encode payload must be a string`);return new TextEncoder().encode(e)}decode(e,t){let n=new TextDecoder().decode(e);return t==null?n:t.parse(n)}},mr=new dr,hr=new fr,gr=new pr,_r=[mr],vr=o({by:()=>br,unique:()=>yr}),yr=e=>[...new Set(e)],br=(e,t,n=!0)=>{let r=new Map;return e.forEach(e=>{let i=t(e);if(r.has(i)){if(n)return;r.delete(i)}r.set(i,e)}),Array.from(r.values())},xr=(e,t=!1)=>{let n=ot(e)?`stringer`:typeof e,r;switch(n){case`string`:r=(e,t)=>e.localeCompare(t);break;case`stringer`:r=(e,t)=>e.toString().localeCompare(t.toString());break;case`number`:r=(e,t)=>Number(e)-Number(t);break;case`bigint`:r=(e,t)=>BigInt(e)-BigInt(t)>0n?1:-1;break;case`boolean`:r=(e,t)=>Number(e)-Number(t);break;case`undefined`:r=()=>0;break;default:return console.warn(`sortFunc: unknown type ${n}`),()=>-1}return t?Dr(r):r},Sr=(e,t,n)=>{let r=xr(t[e],n);return(t,n)=>r(t[e],n[e])},Cr=(e,t)=>e.length===t.length?e.every((e,n)=>e===t[n])?0:-1:e.length-t.length,wr=(e,t)=>{if(e.length!==t.length)return e.length-t.length;if(e.length===0)return 0;let n=xr(e[0]),r=[...e].sort(n),i=[...t].sort(n);return r.every((e,t)=>e===i[t])?0:-1},Tr=(e,t)=>wr(yr(e),yr(t)),Er=(e,t)=>e===t?0:e===`first`&&t===`last`?1:-1,Dr=e=>(t,n)=>e(n,t),Or=e=>e<0,kr=e=>e>0,Ar=e=>e>=0,jr=e=>e===0,Mr=(e,t)=>{let n=/([a-zA-Z]+)|(\d+)/g,r=e.replace(/[\s_.-]+/g,``).match(n),i=t.replace(/[\s_.-]+/g,``).match(n);if(!r||!i)return 0;for(let e=0;e<Math.min(r.length,i.length);e++){let t=r[e],n=i[e];if(isNaN(Number(t))&&isNaN(Number(n))){let e=t.localeCompare(n);if(e!==0)return e}else if(!isNaN(Number(t))&&!isNaN(Number(n))){let e=Number(t)-Number(n);if(e!==0)return e}else return isNaN(Number(t))?-1:1}return r.length-i.length},Nr=(e,t,n)=>{let r=0,i=e.length,a=n??xr(t);for(;r<i;){let n=Math.floor((r+i)/2),o=a(e[n],t);if(o===0)return n;o<0?r=n+1:i=n}return r},Pr=(e,t,n)=>{let r=Nr(e,t,n);e.splice(r,0,t)},Fr=o({EQUAL:()=>0,GREATER_THAN:()=>1,LESS_THAN:()=>-1,insert:()=>Pr,isEqualTo:()=>jr,isGreaterThan:()=>kr,isGreaterThanEqual:()=>Ar,isLessThan:()=>Or,newF:()=>xr,newFieldF:()=>Sr,order:()=>Er,primitiveArrays:()=>Cr,reverseF:()=>Dr,search:()=>Nr,stringsWithNumbers:()=>Mr,uniqueUnorderedPrimitiveArrays:()=>Tr,unorderedPrimitiveArrays:()=>wr}),Ir=(e,t=21)=>(n=t)=>{let r=``,i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r},Lr=o({LENGTH:()=>11,create:()=>Hr}),Rr=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,zr=`0123456789${Rr}`,Br=Ir(Rr,1),Vr=Ir(zr,10),Hr=()=>`${Br()}${Vr()}`,Ur=o({createMatcher:()=>Wr}),Wr=(e,t)=>n=>n instanceof t||typeof n==`object`&&!!n&&`discriminator`in n&&n.discriminator===e,Gr=o({DIRECTIONS:()=>$t,construct:()=>O,crude:()=>Kr,dimension:()=>Jr,directionZ:()=>en,isDirection:()=>Xr,isX:()=>Qr,isY:()=>$r,location:()=>Yr,signedDimension:()=>Zr,swap:()=>qr}),Kr=bn,O=e=>$t.includes(e)?e:on.includes(e)?`y`:`x`,qr=e=>O(e)===`x`?`y`:`x`,Jr=e=>O(e)===`x`?`width`:`height`,Yr=e=>O(e)===`x`?`left`:`top`,Xr=e=>Kr.safeParse(e).success,Zr=e=>O(e)===`x`?`signedWidth`:`signedHeight`,Qr=e=>e===`center`?!1:O(e)===`x`,$r=e=>O(e)===`y`,ei=o({BOTTOM_CENTER:()=>vi,BOTTOM_LEFT:()=>mi,BOTTOM_RIGHT:()=>hi,CENTER:()=>gi,CENTER_LEFT:()=>bi,CENTER_LOCATIONS:()=>cn,CENTER_RIGHT:()=>yi,LOCATIONS:()=>un,OUTER_LOCATIONS:()=>tn,TOP_CENTER:()=>_i,TOP_LEFT:()=>A,TOP_RIGHT:()=>pi,XY_LOCATIONS:()=>xi,X_LOCATIONS:()=>rn,Y_LOCATIONS:()=>on,center:()=>ri,construct:()=>k,constructXY:()=>Oi,corner:()=>fi,crude:()=>si,direction:()=>ui,isX:()=>Ti,isY:()=>Ei,locationZ:()=>dn,outerZ:()=>ii,rotate:()=>li,swap:()=>ci,x:()=>ti,xy:()=>di,xyCouple:()=>wi,xyEquals:()=>Si,xyMatches:()=>Ci,xyToString:()=>Di,y:()=>ni}),ti=an,ni=sn,ri=ln,ii=nn,ai={top:`bottom`,right:`left`,bottom:`top`,left:`right`,center:`center`},oi={top:{clockwise:`left`,counterclockwise:`right`},right:{clockwise:`top`,counterclockwise:`bottom`},bottom:{clockwise:`right`,counterclockwise:`left`},left:{clockwise:`bottom`,counterclockwise:`top`}},si=xn,k=e=>e instanceof String||!$t.includes(e)?e:e===`x`?`left`:`top`,ci=e=>ai[k(e)],li=(e,t)=>oi[e][t],ui=e=>{let t=k(e);return t===`top`||t===`bottom`?`y`:`x`},di=l.z.object({x:an.or(ln),y:sn.or(ln)}),fi=l.z.object({x:an,y:sn}),A=Object.freeze({x:`left`,y:`top`}),pi=Object.freeze({x:`right`,y:`top`}),mi=Object.freeze({x:`left`,y:`bottom`}),hi=Object.freeze({x:`right`,y:`bottom`}),gi=Object.freeze({x:`center`,y:`center`}),_i=Object.freeze({x:`center`,y:`top`}),vi=Object.freeze({x:`center`,y:`bottom`}),yi=Object.freeze({x:`right`,y:`center`}),bi=Object.freeze({x:`left`,y:`center`}),xi=Object.freeze([bi,yi,_i,vi,A,pi,mi,hi,gi]),Si=(e,t)=>e.x===t.x&&e.y===t.y,Ci=(e,t)=>{if(typeof t==`object`){let n=!0;return`x`in t&&e.x!==t.x&&(n=!1),`y`in t&&e.y!==t.y&&(n=!1),n}return e.x===t||e.y===t},wi=e=>[e.x,e.y],Ti=e=>ui(k(e))===`x`,Ei=e=>ui(k(e))===`y`,Di=e=>`${e.x}${de(e.y)}`,Oi=(e,t)=>{let n,r;if(typeof e==`object`&&`x`in e?(n=e.x,r=e.y):(n=k(e),r=k(t??e)),ui(n)===ui(r)&&n!==`center`&&r!==`center`)throw Error(`[XYLocation] - encountered two locations with the same direction: ${n.toString()} - ${r.toString()}`);let i={...gi};return n===`center`?Ti(r)?[i.x,i.y]=[r,n]:[i.x,i.y]=[n,r]:Ti(n)?[i.x,i.y]=[n,r]:[i.x,i.y]=[r,n],i},ki=[`top`,`right`,`bottom`,`left`],Ai=l.z.enum(ki),j=l.z.object({x:l.z.number(),y:l.z.number()}),ji=o({INFINITY:()=>Pi,NAN:()=>Fi,ONE:()=>Ni,ZERO:()=>N,average:()=>$i,calculateMiters:()=>ea,clientXyZ:()=>gn,construct:()=>M,couple:()=>qi,crudeZ:()=>Mi,css:()=>Ji,distance:()=>Ui,equals:()=>Ii,isFinite:()=>Ki,isNan:()=>Gi,isZero:()=>Li,normal:()=>Zi,normalize:()=>Qi,reciprocal:()=>ra,rotate:()=>ia,round:()=>na,scale:()=>Ri,set:()=>Hi,sub:()=>Xi,swap:()=>ta,translate:()=>Vi,translateX:()=>zi,translateY:()=>Bi,translation:()=>Wi,truncate:()=>Yi,xyZ:()=>j}),Mi=l.z.union([l.z.number(),j,Qt,_n,vn,gn]),M=(e,t)=>{if(typeof e==`string`){if(t===void 0)throw Error(`The y coordinate must be given.`);return e===`x`?{x:t,y:0}:{x:0,y:t}}return typeof e==`number`?{x:e,y:t??e}:Array.isArray(e)?{x:e[0],y:e[1]}:`signedWidth`in e?{x:e.signedWidth,y:e.signedHeight}:`clientX`in e?{x:e.clientX,y:e.clientY}:`width`in e?{x:e.width,y:e.height}:{x:e.x,y:e.y}},N=Object.freeze({x:0,y:0}),Ni=Object.freeze({x:1,y:1}),Pi=Object.freeze({x:1/0,y:1/0}),Fi=Object.freeze({x:NaN,y:NaN}),Ii=(e,t,n=0)=>{let r=M(e),i=M(t);return n===0?r.x===i.x&&r.y===i.y:Math.abs(r.x-i.x)<=n&&Math.abs(r.y-i.y)<=n},Li=e=>Ii(e,N),Ri=(e,t,n)=>{let r=M(e),i=M(t,n);return{x:r.x*i.x,y:r.y*i.y}},zi=(e,t)=>{let n=M(e);return{x:n.x+t,y:n.y}},Bi=(e,t)=>{let n=M(e);return{x:n.x,y:n.y+t}},Vi=(e,t,n,...r)=>{if(typeof t==`string`){if(typeof n!=`number`)throw Error(`The value must be a number.`);return t===`x`?zi(e,n):Bi(e,n)}if(typeof t==`object`&&`x`in t&&typeof t.x==`string`){let r=M(n),i=M(e);return t.x===`left`?r.x=-r.x:t.x===`center`&&(r.x=0),t.y===`top`?r.y=-r.y:t.y===`center`&&(r.y=0),{x:i.x+r.x,y:i.y+r.y}}return[e,t,n??N,...r].reduce((e,t)=>{let n=M(t);return{x:e.x+n.x,y:e.y+n.y}},N)},Hi=(e,t,n)=>{let r=M(e);return O(t)===`x`?{x:n,y:r.y}:{x:r.x,y:n}},Ui=(e,t)=>{let n=M(e),r=M(t);return Math.sqrt((n.x-r.x)**2+(n.y-r.y)**2)},Wi=(e,t)=>{let n=M(e),r=M(t);return{x:r.x-n.x,y:r.y-n.y}},Gi=e=>{let t=M(e);return Number.isNaN(t.x)||Number.isNaN(t.y)},Ki=e=>{let t=M(e);return Number.isFinite(t.x)&&Number.isFinite(t.y)},qi=e=>{let t=M(e);return[t.x,t.y]},Ji=e=>{let t=M(e);return{left:t.x,top:t.y}},Yi=(e,t=0)=>{let n=M(e);return{x:Number(n.x.toFixed(t)),y:Number(n.y.toFixed(t))}},Xi=(e,t)=>{let n=M(e),r=M(t);return{x:n.x-r.x,y:n.y-r.y}},Zi=e=>{let t=M(e),n=Math.hypot(t.x,t.y);return n===0?{x:0,y:0}:{x:-t.y/n,y:t.x/n}},Qi=e=>{let t=M(e),n=Math.hypot(t.x,t.y);return n===0?{x:0,y:0}:{x:t.x/n,y:t.y/n}},$i=(...e)=>Ri(e.reduce((e,t)=>Vi(e,t),N),1/e.length),ea=(e,t)=>{let n=[];for(let r=0;r<e.length;r++){let i=e[r],a,o,s,c;if(r===0){let n=e[r+1];o=Zi(Xi(n,i)),s=o,c=t}else if(r===e.length-1){let n=e[r-1];a=Zi(Xi(i,n)),s=a,c=t}else{let n=e[r-1],l=e[r+1],u=Xi(i,n),d=Xi(l,i);a=Zi(u),o=Zi(d);let f=Math.acos((u.x*d.x+u.y*d.y)/(Math.hypot(u.x,u.y)*Math.hypot(d.x,d.y))),p=Math.sin(f/2);c=p===0?t:t/p,s=Qi($i(a,o))}n.push(Ri(s,c))}return n},ta=e=>{let t=M(e);return{x:t.y,y:t.x}},na=e=>{let t=M(e);return{x:Math.round(t.x),y:Math.round(t.y)}},ra=e=>{let t=M(e);return{x:1/t.x,y:1/t.y}},ia=(e,t,n)=>{let r=M(e),i=M(t),a=n===`clockwise`?Math.PI/2:-Math.PI/2,o=r.x-i.x,s=r.y-i.y,c=o*Math.cos(a)-s*Math.sin(a),l=o*Math.sin(a)+s*Math.cos(a);return{x:c+i.x,y:l+i.y}},aa=o({DECIMAL:()=>da,ZERO:()=>ua,area:()=>Wa,areaIsZero:()=>ba,aspect:()=>Va,bottom:()=>B,bottomCenter:()=>Da,bottomLeft:()=>Ea,bottomRight:()=>Oa,box:()=>la,center:()=>ja,centerLeft:()=>ka,centerRight:()=>Aa,construct:()=>P,constructWithAlternateRoot:()=>Ka,contains:()=>ma,copy:()=>fa,css:()=>va,cssBox:()=>sa,dim:()=>ya,dims:()=>ga,domRect:()=>ca,edgePoints:()=>Ra,equals:()=>ha,height:()=>R,intersection:()=>Ua,isBox:()=>Ba,left:()=>V,loc:()=>I,positionInCenter:()=>za,reRoot:()=>La,resize:()=>pa,right:()=>z,root:()=>Pa,round:()=>qa,signedDims:()=>_a,signedHeight:()=>Sa,signedWidth:()=>xa,top:()=>H,topCenter:()=>wa,topLeft:()=>Ca,topRight:()=>Ta,translate:()=>Ha,truncate:()=>Ga,width:()=>L,x:()=>Ma,xBounds:()=>Fa,xyLoc:()=>F,y:()=>Na,yBounds:()=>Ia}),oa=l.z.union([l.z.number(),l.z.string()]),sa=l.z.object({top:oa,left:oa,width:oa,height:oa}),ca=l.z.object({left:l.z.number(),top:l.z.number(),right:l.z.number(),bottom:l.z.number()}),la=l.z.object({one:j,two:j,root:fi}),ua={one:N,two:N,root:A},da={one:N,two:Ni,root:mi},fa=(e,t)=>({one:e.one,two:e.two,root:t??e.root}),P=(e,t,n=0,r=0,i)=>{let a={one:{...N},two:{...N},root:i??A};if(typeof e==`number`){if(typeof t!=`number`)throw Error(`Box constructor called with invalid arguments`);return a.one={x:e,y:t},a.two={x:a.one.x+n,y:a.one.y+r},a}return`one`in e&&`two`in e&&`root`in e?{...e,root:i??e.root}:(`getBoundingClientRect`in e&&(e=e.getBoundingClientRect()),`left`in e?(a.one={x:e.left,y:e.top},a.two={x:e.right,y:e.bottom},a):(a.one=e,t==null?a.two={x:a.one.x+n,y:a.one.y+r}:typeof t==`number`?a.two={x:a.one.x+t,y:a.one.y+n}:`width`in t?a.two={x:a.one.x+t.width,y:a.one.y+t.height}:`signedWidth`in t?a.two={x:a.one.x+t.signedWidth,y:a.one.y+t.signedHeight}:a.two=t,a))},pa=(e,t,n)=>{let r=P(e);if(typeof t==`string`){if(n==null)throw Error(`Invalid arguments for resize`);let e=O(t);return P(r.one,void 0,e===`x`?n:L(r),e===`y`?n:R(r),r.root)}return P(r.one,t,void 0,void 0,r.root)},ma=(e,t,n=!0)=>{let r=P(e),i=(e,t)=>e<t;return n&&(i=(e,t)=>e<=t),`one`in t?i(V(r),V(t))&&i(z(t),z(r))&&i(H(r),H(t))&&i(B(t),B(r)):i(V(r),t.x)&&i(t.x,z(r))&&i(H(r),t.y)&&i(t.y,B(r))},ha=(e,t)=>Ii(e.one,t.one)&&Ii(e.two,t.two)&&Si(e.root,t.root),ga=e=>({width:L(e),height:R(e)}),_a=e=>({signedWidth:xa(e),signedHeight:Sa(e)}),va=e=>({top:H(e),left:V(e),width:L(e),height:R(e)}),ya=(e,t,n=!1)=>{let r=O(t)===`y`?Sa(e):xa(e);return n?r:Math.abs(r)},F=(e,t)=>{let n=P(e);return{x:t.x===`center`?ja(n).x:I(n,t.x),y:t.y===`center`?ja(n).y:I(n,t.y)}},I=(e,t)=>{let n=P(e),r=wi(n.root).includes(t)?Math.min:Math.max;return rn.includes(t)?r(n.one.x,n.two.x):r(n.one.y,n.two.y)},ba=e=>Wa(e)===0,L=e=>ya(e,`x`),R=e=>ya(e,`y`),xa=e=>{let t=P(e);return t.two.x-t.one.x},Sa=e=>{let t=P(e);return t.two.y-t.one.y},Ca=e=>F(e,A),wa=e=>F(e,_i),Ta=e=>F(e,pi),Ea=e=>F(e,mi),Da=e=>F(e,vi),Oa=e=>F(e,hi),ka=e=>F(e,bi),Aa=e=>F(e,yi),z=e=>I(e,`right`),B=e=>I(e,`bottom`),V=e=>I(e,`left`),H=e=>I(e,`top`),ja=e=>Vi(Ca(e),{x:xa(e)/2,y:Sa(e)/2}),Ma=e=>{let t=P(e);return t.root.x===`left`?V(t):z(t)},Na=e=>{let t=P(e);return t.root.y===`top`?H(t):B(t)},Pa=e=>({x:Ma(e),y:Na(e)}),Fa=e=>{let t=P(e);return{lower:t.one.x,upper:t.two.x}},Ia=e=>{let t=P(e);return{lower:t.one.y,upper:t.two.y}},La=(e,t)=>fa(e,t),Ra=(e,t)=>{let n=P(e),r=rn.includes(t)?`x`:on.includes(t)?`y`:null;if(r===null)throw Error(`Invalid location: ${t}`);let i=t===`top`||t===`left`?Math.min:Math.max,a={...n.one},o={...n.two};return a[r]=i(n.one[r],n.two[r]),o[r]=i(n.one[r],n.two[r]),[a,o]},za=(e,t)=>{let n=P(e),r=P(t);return P({x:Ma(r)+(L(r)-L(n))/2,y:Na(r)+(R(r)-R(n))/2},ga(n))},Ba=e=>typeof e!=`object`||!e?!1:`one`in e&&`two`in e&&`root`in e,Va=e=>L(e)/R(e),Ha=(e,t,n)=>{if(typeof t==`string`){if(n==null)throw Error(`Undefined amount passed into box.translate`);t=M(O(t),n)}let r=P(e);return P(Vi(r.one,t),Vi(r.two,t),void 0,void 0,r.root)},Ua=(e,t)=>{let n=Math.max(V(e),V(t)),r=Math.max(H(e),H(t)),i=Math.min(z(e),z(t)),a=Math.min(B(e),B(t));return n>i||r>a?ua:P({x:n,y:r},{x:i,y:a},void 0,void 0,e.root)},Wa=e=>L(e)*R(e),Ga=(e,t)=>{let n=P(e);return P(Yi(n.one,t),Yi(n.two,t),void 0,void 0,n.root)},Ka=(e,t,n,r,i,a)=>{let o={x:e,y:t},s={x:e+n,y:t+r};return i.x!==a.x&&(i.x===`center`?(o.x-=n/2,s.x-=n/2):(o.x-=n,s.x-=n)),i.y!==a.y&&(i.y===`center`?(o.y-=r/2,s.y-=r/2):(o.y-=r,s.y-=r)),P(o,s,void 0,void 0,a)},qa=e=>{let t=P(e);return P(na(t.one),na(t.two),void 0,void 0,t.root)},Ja=o({DECIMAL:()=>Za,ZERO:()=>Xa,construct:()=>U,couple:()=>to,crude:()=>Ya,dimensionsZ:()=>_n,equals:()=>Qa,max:()=>no,min:()=>ro,scale:()=>io,signedDimensionsZ:()=>vn,svgViewBox:()=>eo,swap:()=>$a}),Ya=l.z.union([_n,vn,j,Qt]),Xa={width:0,height:0},Za={width:1,height:1},U=(e,t)=>typeof e==`number`?{width:e,height:t??e}:Array.isArray(e)?{width:e[0],height:e[1]}:`x`in e?{width:e.x,height:e.y}:`signedWidth`in e?{width:e.signedWidth,height:e.signedHeight}:{...e},Qa=(e,t)=>{if(t==null)return!1;let n=U(e),r=U(t);return n.width===r.width&&n.height===r.height},$a=e=>{let t=U(e);return{width:t.height,height:t.width}},eo=e=>{let t=U(e);return`0 0 ${t.width} ${t.height}`},to=e=>{let t=U(e);return[t.width,t.height]},no=e=>({width:Math.max(...e.map(e=>U(e).width)),height:Math.max(...e.map(e=>U(e).height))}),ro=e=>({width:Math.min(...e.map(e=>U(e).width)),height:Math.min(...e.map(e=>U(e).height))}),io=(e,t)=>{let n=U(e);return{width:n.width*t,height:n.height*t}},ao=(e,t,n)=>t!==void 0&&e<t?t:n!==void 0&&e>n?n:e,oo=o({Scale:()=>go,XY:()=>_o,crudeXYTransform:()=>so,transform:()=>co}),so=l.z.object({offset:Mi,scale:Mi}),co=l.z.object({offset:l.z.number(),scale:l.z.number()}),lo=e=>(t,n,r,i)=>n===`dimension`?[t,r]:[t,i?r-e:r+e],uo=e=>(t,n,r,i)=>[t,i?r/e:r*e],fo=e=>(t,n,r)=>{if(t===null)return[e,r];let{lower:i,upper:a}=t,{lower:o,upper:s}=e,c=a-i,l=s-o;return n===`dimension`?[e,l/c*r]:[e,(r-i)*(l/c)+o]},po=e=>(t,n,r)=>[e,r],mo=()=>(e,t,n)=>{if(e===null)throw Error(`cannot invert without bounds`);if(t===`dimension`)return[e,n];let{lower:r,upper:i}=e;return[e,i-(n-r)]},ho=e=>(t,n,r)=>{let{lower:i,upper:a}=e;return r=ao(r,i,a),[t,r]},go=class e{ops=[];currBounds=null;currType=null;reversed=!1;constructor(){this.ops=[]}static translate(t){return new e().translate(t)}static magnify(t){return new e().magnify(t)}static scale(t,n){return new e().scale(t,n)}translate(e){let t=this.new(),n=lo(e);return n.type=`translate`,t.ops.push(n),t}magnify(e){let t=this.new(),n=uo(e);return n.type=`magnify`,t.ops.push(n),t}scale(e,t){let n=E(e,t),r=this.new(),i=fo(n);return i.type=`scale`,r.ops.push(i),r}clamp(e,t){let n=E(e,t),r=this.new(),i=ho(n);return i.type=`clamp`,r.ops.push(i),r}reBound(e,t){let n=E(e,t),r=this.new(),i=po(n);return i.type=`re-bound`,r.ops.push(i),r}invert(){let e=mo();e.type=`invert`;let t=this.new();return t.ops.push(e),t}pos(e){return this.exec(`position`,e)}dim(e){return this.exec(`dimension`,e)}new(){let t=new e;return t.ops=this.ops.slice(),t.reversed=this.reversed,t}exec(e,t){return this.currBounds=null,this.ops.reduce(([t,n],r)=>r(t,e,n,this.reversed),[null,t])[1]}reverse(){let e=this.new();e.ops.reverse();let t=[];return e.ops.forEach((n,r)=>{if(n.type===`scale`||t.some(([e,t])=>r>=e&&r<=t))return;let i=e.ops.findIndex((e,t)=>e.type===`scale`&&t>r);i!==-1&&t.push([r,i])}),t.forEach(([t,n])=>{let r=e.ops.slice(t,n);r.unshift(e.ops[n]),e.ops.splice(t,n-t+1,...r)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}static IDENTITY=new e},_o=class e{x;y;currRoot;constructor(e=new go,t=new go,n=null){this.x=e,this.y=t,this.currRoot=n}static translate(t,n){return new e().translate(t,n)}static translateX(t){return new e().translateX(t)}static translateY(t){return new e().translateY(t)}static clamp(t){return new e().clamp(t)}static magnify(t){return new e().magnify(t)}static scale(t){return new e().scale(t)}static reBound(t){return new e().reBound(t)}translate(e,t){let n=M(e,t),r=this.copy();return r.x=this.x.translate(n.x),r.y=this.y.translate(n.y),r}translateX(e){let t=this.copy();return t.x=this.x.translate(e),t}translateY(e){let t=this.copy();return t.y=this.y.translate(e),t}magnify(e){let t=this.copy();return t.x=this.x.magnify(e.x),t.y=this.y.magnify(e.y),t}scale(e){let t=this.copy();if(Ba(e)){let n=this.currRoot;return t.currRoot=e.root,n!=null&&!Si(n,e.root)&&(n.x!==e.root.x&&(t.x=t.x.invert()),n.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(Fa(e)),t.y=t.y.scale(Ia(e)),t}return t.x=t.x.scale(e.width),t.y=t.y.scale(e.height),t}reBound(e){let t=this.copy();return t.x=this.x.reBound(Fa(e)),t.y=this.y.reBound(Ia(e)),t}clamp(e){let t=this.copy();return t.x=this.x.clamp(Fa(e)),t.y=this.y.clamp(Ia(e)),t}copy(){let t=new e;return t.currRoot=this.currRoot,t.x=this.x,t.y=this.y,t}reverse(){let 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 P(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 e},vo=o({ALIGNMENTS:()=>fn,CENTER_LOCATIONS:()=>cn,DIRECTIONS:()=>$t,LOCATIONS:()=>un,ORDERS:()=>mn,OUTER_LOCATIONS:()=>tn,X_LOCATIONS:()=>rn,Y_LOCATIONS:()=>on,alignmentZ:()=>pn,boundsZ:()=>yn,centerLocationZ:()=>ln,clientXyZ:()=>gn,dimensionsZ:()=>_n,directionZ:()=>en,locationZ:()=>dn,orderZ:()=>hn,outerLocationZ:()=>nn,signedDimensionsZ:()=>vn,xLocationZ:()=>an,xyZ:()=>j,yLocationZ:()=>sn}),yo=o({calculate:()=>wo,completeXY:()=>bo,toCSS:()=>So,toDecimal:()=>Co,xy:()=>xo}),bo=j.extend({root:fi,units:l.default.object({x:l.default.enum([`px`,`decimal`]),y:l.default.enum([`px`,`decimal`])})}),xo=bo.partial({root:!0,units:!0}),So=e=>{let t={};return t[e.root?.x??`left`]=e?.units?.x===`px`?`${e.x}px`:`${e.x*100}%`,t[e.root?.y??`top`]=e?.units?.y===`px`?`${e.y}px`:`${e.y*100}%`,t},Co=({position:e,element:t,container:n})=>{let r={x:e.x,y:e.y};return e.units?.x===`decimal`?e.root?.x===`right`&&(r.x=1-e.x):e.root?.x===`right`?r.x=1-(e.x+L(t))/L(n):r.x/=L(n),e.units?.y===`decimal`?e.root?.y===`bottom`&&(r.y=1-e.y):e.root?.y===`bottom`?r.y=1-(e.y+R(t))/R(n):r.y/=R(n),r},wo=({position:e,element:t,container:n,lowerThreshold:r=.2,upperThreshold:i=.8})=>{let a={x:e.x,y:e.y,root:{...A},units:{x:`px`,y:`px`}};return e.x>i?(a.x=(1-e.x)*L(n)-L(t),a.root.x=`right`):e.x<r?a.x=e.x*L(n):a.units.x=`decimal`,e.y>i?(a.y=(1-e.y)*R(n)-R(t),a.root.y=`bottom`):e.y<r?a.y=e.y*R(n):a.units.y=`decimal`,a.x=Math.round(a.x*100)/100,{...a,...Yi(a,3)}},To=l.z.enum([`static`,`dynamic`]),Eo=365,Do=30,Oo=l.z.union([l.z.tuple([l.z.int()]),l.z.tuple([l.z.int(),l.z.int().min(1).max(12)]),l.z.tuple([l.z.int(),l.z.int().min(1).max(12),l.z.int().min(1).max(31)])]),ko=(e,t)=>{let n=new W(t);if(![G.DAY,G.HOUR,G.MINUTE,G.SECOND,G.MILLISECOND,G.MICROSECOND,G.NANOSECOND].some(e=>e.equals(n)))throw Error(`Invalid argument for remainder. Must be an even TimeSpan or Timestamp`);let r=e.valueOf()%n.valueOf();return e instanceof W?new W(r):new G(r)},W=class e extends S{constructor(t,n=`UTC`){if(t==null)super(e.now().valueOf());else if(t instanceof Date)super(BigInt(t.getTime())*e.MILLISECOND.valueOf());else if(typeof t==`string`)super(e.parseDateTimeString(t,n).valueOf());else if(Array.isArray(t))super(e.parseDate(t));else{let r=0n;t instanceof Number&&(t=t.valueOf()),n===`local`&&(r=e.utcOffset.valueOf()),typeof t==`number`&&(isFinite(t)?t=t===Ht?Bt:Math.trunc(t):(isNaN(t)&&(t=0),t=t===1/0?e.MAX:e.MIN)),x(t)&&(t=t.value),super(BigInt(t.valueOf())+r)}}static parseDate([t=1970,n=1,r=1]){let i=new Date(t,n-1,r,0,0,0,0);return new e(BigInt(i.getTime())*e.MILLISECOND.valueOf()).truncate(e.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(t,n=`UTC`){let[r,i,a]=t.split(`:`),o=`00`,s=`00`;a!=null&&([o,s]=a.split(`.`));let c=e.hours(parseInt(r??`00`,10)).add(e.minutes(parseInt(i??`00`,10))).add(e.seconds(parseInt(o??`00`,10))).add(e.milliseconds(parseInt(s??`00`,10)));return n===`local`&&(c=c.add(e.utcOffset)),c.valueOf()}static parseDateTimeString(t,n=`UTC`){if(!t.includes(`/`)&&!t.includes(`-`))return e.parseTimeString(t,n);if(t.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?$/)!=null){let r=t,i=0;if(t.includes(`.`)){let e=t.split(`.`);r=e[0];let n=e[1]||`0`;i=parseInt(n.padEnd(3,`0`).slice(0,3),10)}let a=n===`local`?new Date(r.replace(`T`,` `)):new Date(`${r}Z`);return BigInt(a.getTime())*e.MILLISECOND.valueOf()+BigInt(i)*e.MILLISECOND.valueOf()}let r=new Date(t);return t.includes(`:`)||r.setUTCHours(0,0,0,0),new e(BigInt(r.getTime())*e.MILLISECOND.valueOf(),n).valueOf()}toISOString(t=`UTC`){if(t===`UTC`)return this.date().toISOString();let n=this.date(),r=new G(BigInt(n.getTimezoneOffset())*e.MINUTE.valueOf());return this.sub(r).date().toISOString()}timeString(e=!1,t=`UTC`){let n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(){let e=this.date();return`${e.toLocaleString(`default`,{month:`short`})} ${e.toLocaleString(`default`,{day:`numeric`})}`}static get utcOffset(){return new G(BigInt(new Date().getTimezoneOffset())*e.MINUTE.valueOf())}static since(t){return new e().span(t)}date(){return new Date(this.milliseconds)}equals(t){return this.valueOf()===new e(t).valueOf()}span(e){return this.range(e).span}range(e){return new q(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0n}after(t){return this.valueOf()>new e(t).valueOf()}afterEq(t){return this.valueOf()>=new e(t).valueOf()}before(t){return this.valueOf()<new e(t).valueOf()}beforeEq(t){return this.valueOf()<=new e(t).valueOf()}add(t){return new e(w(this.valueOf(),new G(t).valueOf()))}sub(t){return new e(C(this.valueOf(),new G(t).valueOf()))}get hours(){return Number(this.valueOf())/Number(G.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(G.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(G.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(G.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(e.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(e.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}get localYear(){return this.date().getFullYear()}setYear(t){let n=this.date();return n.setUTCFullYear(t),new e(n)}setLocalYear(t){let n=this.date();return n.setFullYear(t),new e(n)}get month(){return this.date().getUTCMonth()}get localMonth(){return this.date().getMonth()}setMonth(t){let n=this.date();return n.setUTCMonth(t),new e(n)}setLocalMonth(t){let n=this.date();return n.setMonth(t),new e(n)}get day(){return this.date().getUTCDate()}get localDay(){return this.date().getDate()}setDay(t){let n=this.date();return n.setUTCDate(t),new e(n)}setLocalDay(t){let n=this.date();return n.setDate(t),new e(n)}get hour(){return this.date().getUTCHours()}get localHour(){return this.date().getHours()}setLocalHour(t){let n=this.date();return n.setHours(t),new e(n)}setHour(t){let n=this.date();return n.setUTCHours(t),new e(n)}get minute(){return this.date().getUTCMinutes()}get localMinute(){return this.date().getMinutes()}setMinute(t){let n=this.date();return n.setUTCMinutes(t),new e(n)}setLocalMinute(t){let n=this.date();return n.setMinutes(t),new e(n)}get second(){return this.date().getUTCSeconds()}get localSecond(){return this.date().getSeconds()}setSecond(t){let n=this.date();return n.setUTCSeconds(t),new e(n)}setLocalSecond(t){let n=this.date();return n.setSeconds(t),new e(n)}get millisecond(){return this.date().getUTCMilliseconds()}get localMillisecond(){return this.date().getMilliseconds()}setMillisecond(t){let n=this.date();return n.setUTCMilliseconds(t),new e(n)}setLocalMillisecond(t){let n=this.date();return n.setMilliseconds(t),new e(n)}toString(e=`ISO`,t=`UTC`){switch(e){case`ISODate`:return this.toISOString(t).slice(0,10);case`ISOTime`:return this.toISOString(t).slice(11,23);case`time`:return this.timeString(!1,t);case`preciseTime`:return this.timeString(!0,t);case`date`:return this.dateString();case`preciseDate`:return`${this.dateString()} ${this.timeString(!0,t)}`;case`dateTime`:return`${this.dateString()} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}remainder(e){return ko(this,e)}get isToday(){return this.truncate(G.DAY).equals(e.now().truncate(G.DAY))}truncate(e){return this.sub(this.remainder(e))}formatBySpan(e){return e.greaterThanOrEqual(G.days(30))?`shortDate`:e.greaterThanOrEqual(G.DAY)?`dateTime`:e.greaterThanOrEqual(G.HOUR)?`time`:e.greaterThanOrEqual(G.SECOND)?`preciseTime`:`ISOTime`}static now(){return new e(new Date)}static max(...t){let n=e.MIN;for(let r of t){let t=new e(r);t.after(n)&&(n=t)}return n}static min(...t){let n=e.MAX;for(let r of t){let t=new e(r);t.before(n)&&(n=t)}return n}static nanoseconds(t,n=`UTC`){return new e(t,n)}static NANOSECOND=e.nanoseconds(1);static microseconds(t,n=`UTC`){return e.nanoseconds(t*1e3,n)}static MICROSECOND=e.microseconds(1);static milliseconds(t,n=`UTC`){return e.microseconds(t*1e3,n)}static MILLISECOND=e.milliseconds(1);static seconds(t,n=`UTC`){return e.milliseconds(t*1e3,n)}static SECOND=e.seconds(1);static minutes(t,n=`UTC`){return e.seconds(t*60,n)}static MINUTE=e.minutes(1);static hours(t,n=`UTC`){return e.minutes(t*60,n)}static HOUR=e.hours(1);static days(t,n=`UTC`){return e.hours(t*24,n)}static DAY=e.days(1);static MAX=new e(Bt);static MIN=new e(0);static ZERO=new e(0);static z=l.z.union([l.z.instanceof(e),l.z.object({value:l.z.bigint()}).transform(t=>new e(t.value)),l.z.string().transform(t=>new e(BigInt(t))),l.z.number().transform(t=>new e(t)),l.z.bigint().transform(t=>new e(t)),l.z.date().transform(t=>new e(t)),l.z.custom(e=>e instanceof G).transform(t=>new e(t)),Oo.transform(t=>new e(t))]);static sort(e,t){return Number(e.valueOf()-t.valueOf())}},G=class e extends S{constructor(e){typeof e==`number`&&(e=Math.trunc(e.valueOf())),x(e)&&(e=e.value),super(BigInt(e.valueOf()))}static fromSeconds(t){return t instanceof e?t:t instanceof Ao?t.period:t instanceof W?new e(t):(x(t)&&(t=t.value),[`number`,`bigint`].includes(typeof t)?e.seconds(t):new e(t))}static fromMilliseconds(t){return t instanceof e?t:t instanceof Ao?t.period:t instanceof W?new e(t):(x(t)&&(t=t.value),[`number`,`bigint`].includes(typeof t)?e.milliseconds(t):new e(t))}valueOf(){return this.value}lessThan(t){return this.valueOf()<new e(t).valueOf()}greaterThan(t){return this.valueOf()>new e(t).valueOf()}lessThanOrEqual(t){return this.valueOf()<=new e(t).valueOf()}greaterThanOrEqual(t){return this.valueOf()>=new e(t).valueOf()}remainder(e){return ko(this,e)}truncate(t){return new e(BigInt(Math.trunc(Number(this.valueOf()/t.valueOf())))*t.valueOf())}toString(t=`full`){if(t===`semantic`)return this.toSemanticString();let n=this.truncate(e.DAY),r=this.truncate(e.HOUR),i=this.truncate(e.MINUTE),a=this.truncate(e.SECOND),o=this.truncate(e.MILLISECOND),s=this.truncate(e.MICROSECOND),c=this.truncate(e.NANOSECOND),l=n,u=r.sub(n),d=i.sub(r),f=a.sub(i),p=o.sub(a),m=s.sub(o),ee=c.sub(s),h=``;return l.isZero||(h+=`${l.days}d `),u.isZero||(h+=`${u.hours}h `),d.isZero||(h+=`${d.minutes}m `),f.isZero||(h+=`${f.seconds}s `),p.isZero||(h+=`${p.milliseconds}ms `),m.isZero||(h+=`${m.microseconds}µs `),ee.isZero||(h+=`${ee.nanoseconds}ns`),h.trim()}toSemanticString(){let t=new e(this.valueOf()<0n?-this.valueOf():this.valueOf()),n=this.valueOf()<0n;if(t.valueOf()===0n)return`0s`;if(t.lessThan(e.SECOND))return`< 1s`;let r=t.days,i=t.hours,a=t.minutes,o=t.seconds,s=Math.floor(r/Eo),c=Math.floor(r/Do),l=Math.floor(r/7),u=Math.floor(r),d=Math.floor(i),f=Math.floor(a),p=Math.floor(o),m=n?`-`:``;if(s>=1){let e=`${s}y`;if(s<2){let t=Math.floor(r%Eo/Do);t>0&&(e+=` ${t}mo`)}return m+e}if(l>=1&&r<Do&&r%7==0){let e=`${l}w`,t=Math.floor(r%7),n=Math.floor(i-l*7*24);return l<2&&(t>0?e+=` ${t}d`:n>0&&n<24&&(e+=` ${n}h`)),m+e}if(c>=1){let e=`${c}mo`;if(c<3){let t=Math.floor(r%Do);t>0&&(e+=` ${t}d`)}return m+e}if(l>=1){let e=`${l}w`,t=Math.floor(r%7),n=Math.floor(i-l*7*24);return l<2&&(t>0?e+=` ${t}d`:n>0&&n<24&&(e+=` ${n}h`)),m+e}if(u>=1){let e=`${u}d`,t=Math.floor(i-u*24);return u<2&&t>0&&(e+=` ${t}h`),m+e}if(d>=1){let e=`${d}h`;if(d<3){let t=Math.floor(a-d*60);t>0&&(e+=` ${t}m`)}return m+e}if(f>=1){let e=`${f}m`;if(f<5){let t=Math.floor(o-f*60);t>0&&(e+=` ${t}s`)}return m+e}return`${m}${p}s`}mult(t){return new e(T(this.valueOf(),t))}div(t){return new e(Zt(this.valueOf(),t))}get days(){return Number(this.valueOf())/Number(e.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(e.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(e.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(e.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(e.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(e.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===0n}equals(t){return this.valueOf()===new e(t).valueOf()}add(t){return new e(this.valueOf()+new e(t).valueOf())}sub(t){return new e(this.valueOf()-new e(t).valueOf())}static nanoseconds(t=1){return new e(t)}static NANOSECOND=e.nanoseconds(1);static microseconds(t=1){return e.nanoseconds(T(t,1e3))}static MICROSECOND=e.microseconds(1);static milliseconds(t=1){return e.microseconds(T(t,1e3))}static MILLISECOND=e.milliseconds(1);static seconds(t=1){return e.milliseconds(T(t,1e3))}static SECOND=e.seconds(1);static minutes(t=1){return e.seconds(T(t,60))}static MINUTE=e.minutes(1);static hours(t){return e.minutes(T(t,60))}static HOUR=e.hours(1);static days(t){return e.hours(T(t,24))}static DAY=e.days(1);static MAX=new e(Bt);static MIN=new e(0);static ZERO=new e(0);static z=l.z.union([l.z.object({value:l.z.bigint()}).transform(t=>new e(t.value)),l.z.string().transform(t=>new e(BigInt(t))),l.z.number().transform(t=>new e(t)),l.z.bigint().transform(t=>new e(t)),l.z.instanceof(e),l.z.instanceof(W).transform(t=>new e(t)),l.z.custom(e=>e instanceof Ao).transform(t=>new e(t))])},Ao=class e extends S{constructor(e){x(e)&&(e=e.value),super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(t){return this.valueOf()===new e(t).valueOf()}get period(){return G.seconds(1/this.valueOf())}sampleCount(e){return new G(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new K(t).valueOf()}span(e){return G.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/new K(t).valueOf())}add(t){return new e(w(this.valueOf(),new e(t).valueOf()))}sub(t){return new e(C(this.valueOf(),new e(t).valueOf()))}mult(t){return new e(T(this.valueOf(),t))}div(t){return new e(Zt(this.valueOf(),t))}static hz(t){return new e(t)}static khz(t){return e.hz(t*1e3)}static z=l.z.union([l.z.number().transform(t=>new e(t)),l.z.instanceof(e)])},K=class e extends S{constructor(e){x(e)&&(e=e.value),super(e.valueOf())}length(e){return e.valueOf()/this.valueOf()}size(e){return new Y(e*this.valueOf())}add(t){return new e(w(this.valueOf(),new e(t).valueOf()))}sub(t){return new e(C(this.valueOf(),new e(t).valueOf()))}mult(t){return new e(T(this.valueOf(),t))}div(t){return new e(Zt(this.valueOf(),t))}static UNKNOWN=new e(0);static BIT128=new e(16);static BIT64=new e(8);static BIT32=new e(4);static BIT16=new e(2);static BIT8=new e(1);static z=l.z.union([l.z.number().transform(t=>new e(t)),l.z.instanceof(e)])},q=class e{start;end;constructor(e,t){typeof e==`object`&&`start`in e?(this.start=new W(e.start),this.end=new W(e.end)):(this.start=new W(e),this.end=new W(t))}get span(){return new G(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 e(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,t=G.ZERO){if(t.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let n=this.start.sub(e.start).valueOf(),r=this.end.sub(e.end).valueOf();return n<0&&(n=-n),r<0&&(r=-r),n<=t.valueOf()&&r<=t.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.toString(`preciseDate`)} - ${this.span.toString()}`}overlapsWith(e,t=G.ZERO){e=e.makeValid();let n=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(n.start)||n.end.equals(e.start))return!1;let r=W.max(n.start,e.start),i=W.min(n.end,e.end);return i.before(r)?!1:new G(i.sub(r)).greaterThanOrEqual(t)}contains(t){return t instanceof e?this.contains(t.start)&&this.contains(t.end):this.start.beforeEq(t)&&this.end.after(t)}boundBy(t){let n=new e(this.start,this.end);return t.start.after(this.start)&&(n.start=t.start),t.start.after(this.end)&&(n.end=t.start),t.end.before(this.end)&&(n.end=t.end),t.end.before(this.start)&&(n.start=t.end),n}static max(...t){return new e(W.min(...t.map(e=>e.start)),W.max(...t.map(e=>e.end)))}static MAX=new e(W.MIN,W.MAX);static ZERO=new e(W.ZERO,W.ZERO);static z=l.z.union([l.z.object({start:W.z,end:W.z}).transform(t=>new e(t.start,t.end)),l.z.instanceof(e)]);static boundedZ=e.z.refine(({isValid:e})=>e,{message:`Time range start time must be before or equal to time range end time`}).refine(({end:e})=>e.valueOf()<=Bt,{message:`Time range end time must be less than or equal to the maximum value of an int64`}).refine(({start:e})=>e.valueOf()>=zt,{message:`Time range start time must be greater than or equal to the minimum value of an int64`});static sort(e,t){return W.sort(e.start,t.start)||W.sort(e.end,t.end)}static merge(...t){return e.max(...t.map(t=>new e(t).makeValid()))}},J=class e extends S{constructor(t){if(x(t)&&(t=t.value),t instanceof e||typeof t==`string`||typeof t.valueOf()==`string`)super(t.valueOf());else{let n=e.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);if(n==null)throw Error(`unable to find data type for ${t.toString()}`);super(n.valueOf())}}get Array(){let t=e.ARRAY_CONSTRUCTORS.get(this.toString());if(t==null)throw Error(`unable to find array constructor for ${this.valueOf()}`);return t}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(e=>this.equals(e))}toString(t=!1){return t?e.SHORT_STRINGS.get(this.valueOf())??this.valueOf():this.valueOf()}get isVariable(){return this.equals(e.JSON)||this.equals(e.STRING)||this.equals(e.BYTES)}get isNumeric(){return!this.isVariable&&!this.equals(e.UUID)}get isInteger(){let e=this.toString();return e.startsWith(`int`)||e.startsWith(`uint`)}get isFloat(){return this.toString().startsWith(`float`)}get density(){let t=e.DENSITIES.get(this.toString());if(t==null)throw Error(`unable to find density for ${this.valueOf()}`);return t}get isUnsignedInteger(){return this.equals(e.UINT8)||this.equals(e.UINT16)||this.equals(e.UINT32)||this.equals(e.UINT64)}get isSignedInteger(){return this.equals(e.INT8)||this.equals(e.INT16)||this.equals(e.INT32)||this.equals(e.INT64)}canSafelyCastTo(t){return this.equals(t)?!0:!this.isNumeric||!t.isNumeric||this.isVariable||t.isVariable||this.isUnsignedInteger&&t.isSignedInteger?!1:this.isFloat?t.isFloat&&this.density.valueOf()<=t.density.valueOf():this.equals(e.INT32)&&t.equals(e.FLOAT64)||this.equals(e.INT8)&&t.equals(e.FLOAT32)?!0:this.isInteger&&t.isInteger?this.density.valueOf()<=t.density.valueOf()&&this.isUnsignedInteger===t.isUnsignedInteger:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}get usesBigInt(){return e.BIG_INT_TYPES.some(e=>e.equals(this))}static UNKNOWN=new e(`unknown`);static FLOAT64=new e(`float64`);static FLOAT32=new e(`float32`);static INT64=new e(`int64`);static INT32=new e(`int32`);static INT16=new e(`int16`);static INT8=new e(`int8`);static UINT64=new e(`uint64`);static UINT32=new e(`uint32`);static UINT16=new e(`uint16`);static UINT8=new e(`uint8`);static TIMESTAMP=new e(`timestamp`);static UUID=new e(`uuid`);static STRING=new e(`string`);static JSON=new e(`json`);static BYTES=new e(`bytes`);static ARRAY_CONSTRUCTORS=new Map([[e.UINT8.toString(),Uint8Array],[e.UINT16.toString(),Uint16Array],[e.UINT32.toString(),Uint32Array],[e.UINT64.toString(),BigUint64Array],[e.FLOAT32.toString(),Float32Array],[e.FLOAT64.toString(),Float64Array],[e.INT8.toString(),Int8Array],[e.INT16.toString(),Int16Array],[e.INT32.toString(),Int32Array],[e.INT64.toString(),BigInt64Array],[e.TIMESTAMP.toString(),BigInt64Array],[e.STRING.toString(),Uint8Array],[e.JSON.toString(),Uint8Array],[e.UUID.toString(),Uint8Array],[e.BYTES.toString(),Uint8Array]]);static ARRAY_CONSTRUCTOR_DATA_TYPES=new Map([[Uint8Array.name,e.UINT8],[Uint16Array.name,e.UINT16],[Uint32Array.name,e.UINT32],[BigUint64Array.name,e.UINT64],[Float32Array.name,e.FLOAT32],[Float64Array.name,e.FLOAT64],[Int8Array.name,e.INT8],[Int16Array.name,e.INT16],[Int32Array.name,e.INT32],[BigInt64Array.name,e.INT64]]);static DENSITIES=new Map([[e.UINT8.toString(),K.BIT8],[e.UINT16.toString(),K.BIT16],[e.UINT32.toString(),K.BIT32],[e.UINT64.toString(),K.BIT64],[e.FLOAT32.toString(),K.BIT32],[e.FLOAT64.toString(),K.BIT64],[e.INT8.toString(),K.BIT8],[e.INT16.toString(),K.BIT16],[e.INT32.toString(),K.BIT32],[e.INT64.toString(),K.BIT64],[e.TIMESTAMP.toString(),K.BIT64],[e.STRING.toString(),K.UNKNOWN],[e.JSON.toString(),K.UNKNOWN],[e.UUID.toString(),K.BIT128],[e.BYTES.toString(),K.UNKNOWN]]);static ALL=[e.UNKNOWN,e.UINT8,e.UINT16,e.UINT32,e.UINT64,e.INT8,e.INT16,e.INT32,e.INT64,e.FLOAT32,e.FLOAT64,e.TIMESTAMP,e.UUID,e.STRING,e.JSON,e.BYTES];static SHORT_STRINGS=new Map([[e.UINT8.toString(),`u8`],[e.UINT16.toString(),`u16`],[e.UINT32.toString(),`u32`],[e.UINT64.toString(),`u64`],[e.INT8.toString(),`i8`],[e.INT16.toString(),`i16`],[e.INT32.toString(),`i32`],[e.INT64.toString(),`i64`],[e.FLOAT32.toString(),`f32`],[e.FLOAT64.toString(),`f64`],[e.TIMESTAMP.toString(),`ts`],[e.UUID.toString(),`uuid`],[e.STRING.toString(),`str`],[e.JSON.toString(),`json`],[e.BYTES.toString(),`bytes`]]);static BIG_INT_TYPES=[e.INT64,e.UINT64,e.TIMESTAMP];static z=l.z.union([l.z.string().transform(t=>new e(t)),l.z.instanceof(e)])},Y=class e extends S{constructor(e){x(e)&&(e=e.value),super(e.valueOf())}largerThan(e){return x(e)&&(e=e.value),this.valueOf()>e.valueOf()}smallerThan(e){return x(e)&&(e=e.value),this.valueOf()<e.valueOf()}add(t){return x(t)&&(t=t.value),new e(w(this.valueOf(),t.valueOf()))}sub(t){return x(t)&&(t=t.value),new e(C(this.valueOf(),t.valueOf()))}mult(t){return new e(T(this.valueOf(),t))}div(t){return new e(Zt(this.valueOf(),t))}truncate(t){return new e(Math.trunc(this.valueOf()/new e(t).valueOf())*new e(t).valueOf())}remainder(t){return e.bytes(this.valueOf()%new e(t).valueOf())}get gigabytes(){return this.valueOf()/e.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/e.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/e.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/e.TERABYTE.valueOf()}toString(){let t=this.truncate(e.TERABYTE),n=this.truncate(e.GIGABYTE),r=this.truncate(e.MEGABYTE),i=this.truncate(e.KILOBYTE),a=this.truncate(e.BYTE),o=t,s=n.sub(t),c=r.sub(n),l=i.sub(r),u=a.sub(i),d=``;return o.isZero||(d+=`${o.terabytes}TB `),s.isZero||(d+=`${s.gigabytes}GB `),c.isZero||(d+=`${c.megabytes}MB `),l.isZero||(d+=`${l.kilobytes}KB `),(!u.isZero||d===``)&&(d+=`${u.valueOf()}B`),d.trim()}static bytes(t=1){return new e(t)}static BYTE=new e(1);static kilobytes(t=1){return e.bytes(new e(t).valueOf()*1e3)}static KILOBYTE=e.kilobytes(1);static megabytes(t=1){return e.kilobytes(new e(t).valueOf()*1e3)}static MEGABYTE=e.megabytes(1);static gigabytes(t=1){return e.megabytes(new e(t).valueOf()*1e3)}static GIGABYTE=e.gigabytes(1);static terabytes(t){return e.gigabytes(new e(t).valueOf()*1e3)}static TERABYTE=e.terabytes(1);static ZERO=new e(0);static z=l.z.union([l.z.number().transform(t=>new e(t)),l.z.instanceof(e)]);get isZero(){return this.valueOf()===0}},jo=l.z.object({start:l.z.number(),end:l.z.number()}),Mo=l.z.union([l.z.instanceof(Uint8Array),l.z.instanceof(Uint16Array),l.z.instanceof(Uint32Array),l.z.instanceof(BigUint64Array),l.z.instanceof(Float32Array),l.z.instanceof(Float64Array),l.z.instanceof(Int8Array),l.z.instanceof(Int16Array),l.z.instanceof(Int32Array),l.z.instanceof(BigInt64Array)]),No=e=>{let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===`bigint`||e instanceof W||e instanceof G||e instanceof Date},Po=(e,t,n,r=0)=>e.usesBigInt&&!t.usesBigInt?Number(n)-Number(r):!e.usesBigInt&&t.usesBigInt?BigInt(n.valueOf())-BigInt(r.valueOf()):C(n,r),Fo=q.z,Io=W.z,Lo=G.z,Ro=Ao.z,zo=Y.z,Bo=J.z,Vo=q.boundedZ,Ho=`00000000-0000-0000-0000-000000000000`,Uo=/^(?:[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 Wo(e){return typeof e==`string`&&Uo.test(e)}var X=[];for(let e=0;e<256;++e)X.push((e+256).toString(16).slice(1));function Go(e,t=0){return(X[e[t+0]]+X[e[t+1]]+X[e[t+2]]+X[e[t+3]]+`-`+X[e[t+4]]+X[e[t+5]]+`-`+X[e[t+6]]+X[e[t+7]]+`-`+X[e[t+8]]+X[e[t+9]]+`-`+X[e[t+10]]+X[e[t+11]]+X[e[t+12]]+X[e[t+13]]+X[e[t+14]]+X[e[t+15]]).toLowerCase()}function Ko(e,t=0){let n=Go(e,t);if(!Wo(n))throw TypeError(`Stringified UUID is invalid`);return n}var qo,Jo=new Uint8Array(16);function Yo(){if(!qo){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);qo=crypto.getRandomValues.bind(crypto)}return qo(Jo)}var Xo={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Zo(e,t,n){e||={};let r=e.random??e.rng?.()??Yo();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Go(r)}function Qo(e,t,n){return Xo.randomUUID&&!t&&!e?Xo.randomUUID():Zo(e,t,n)}var $o=o({ZERO:()=>ns,create:()=>es,parse:()=>ts}),es=()=>Qo(),ts=(e,t)=>Ko(e,t),ns=Ho,Z=-1,rs={[Symbol.iterator]:()=>rs,next:()=>({done:!0,value:void 0})},is=l.z.string().transform(e=>new Uint8Array(atob(e).split(``).map(e=>e.charCodeAt(0))).buffer),as=l.z.union([l.z.null(),l.z.undefined()]).transform(()=>new Uint8Array().buffer),os=10,ss=(e,t)=>{if(e===`number`&&!t.isNumeric)throw Error(`cannot convert series of type ${t.toString()} to number`);if(e===`bigint`&&!t.usesBigInt)throw Error(`cannot convert series of type ${t.toString()} to bigint`)},cs=`sy_x_telem_series`,ls=class e{key;discriminator=cs;dataType;sampleOffset;gl;_data;timeRange=q.ZERO;alignment=0n;alignmentMultiple=1n;cachedMin;cachedMax;writePos=Z;_refCount=0;cachedLength;_cachedIndexes;static crudeZ=l.z.object({timeRange:q.z.optional(),dataType:J.z,alignment:l.z.coerce.bigint().optional(),data:l.z.union([is,as,l.z.instanceof(ArrayBuffer),l.z.instanceof(Uint8Array)]),glBufferUsage:To.default(`static`).optional()});static z=e.crudeZ.transform(t=>new e(t));constructor(e){us(e)&&(e={data:e}),e.data??=[];let{dataType:t,timeRange:n,sampleOffset:r=0,glBufferUsage:i=`static`,alignment:a=0n,alignmentMultiple:o=1n,key:s=Hr(),data:c}=e;if(ds(c)){let e=c;this.key=e.key,this.dataType=e.dataType,this.sampleOffset=e.sampleOffset,this.gl=e.gl,this._data=e._data,this.timeRange=e.timeRange,this.alignment=e.alignment,this.alignmentMultiple=e.alignmentMultiple,this.cachedMin=e.cachedMin,this.cachedMax=e.cachedMax,this.writePos=e.writePos,this._refCount=e._refCount,this.cachedLength=e.cachedLength;return}let l=No(c),u=Array.isArray(c);if(t!=null)this.dataType=new J(t);else if(c instanceof ArrayBuffer)throw Error(`cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.`);else if(u||l){let e=c;if(!l){if(c.length===0)throw Error(`cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.`);e=c[0]}if(typeof e==`string`)this.dataType=J.STRING;else if(typeof e==`number`)this.dataType=J.FLOAT64;else if(typeof e==`bigint`)this.dataType=J.INT64;else if(typeof e==`boolean`)this.dataType=J.UINT8;else if(e instanceof W||e instanceof Date||e instanceof W)this.dataType=J.TIMESTAMP;else if(typeof e==`object`)this.dataType=J.JSON;else throw Error(`cannot infer data type of ${typeof e} when constructing a Series from a JS array`)}else this.dataType=new J(c);if(!u&&!l)this._data=c;else if(u&&c.length===0)this._data=new this.dataType.Array([]).buffer;else{let e=l?[c]:c,t=e[0];(t instanceof W||t instanceof Date||t instanceof G)&&(e=e.map(e=>new W(e).valueOf())),this.dataType.equals(J.STRING)?(this.cachedLength=e.length,this._data=new TextEncoder().encode(`${e.join(`
|
|
12
|
-
`)}\n`).buffer):this.dataType.equals(J.JSON)?(this.cachedLength=e.length,this._data=new TextEncoder().encode(`${e.map(e=>mr.encodeString(e)).join(`
|
|
13
|
-
`)}\n`).buffer):this.dataType.usesBigInt&&typeof t==`number`?this._data=new this.dataType.Array(e.map(e=>BigInt(Math.round(e)))).buffer:!this.dataType.usesBigInt&&typeof t==`bigint`?this._data=new this.dataType.Array(e.map(Number)).buffer:this._data=new this.dataType.Array(e).buffer}this.key=s,this.alignment=a,this.alignmentMultiple=o,this.sampleOffset=r??0,this.timeRange=n??q.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:i}}static alloc({capacity:t,dataType:n,...r}){if(t===0)throw Error(`[Series] - cannot allocate an array of length 0`);let i=new e({data:new new J(n).Array(t).buffer,dataType:n,...r});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 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;let t=this.byteCapacity.valueOf()-this.writePos,n=e.subBytes(0,t);return this.writeToUnderlyingData(n),this.writePos+=n.byteLength.valueOf(),this.cachedLength!=null&&(this.cachedLength+=n.length,this.calculateCachedLength()),n.length}writeFixed(e){if(this.writePos===Z)return 0;let t=this.capacity-this.writePos,n=e.sub(0,t);return this.writeToUnderlyingData(n),this.cachedLength=void 0,this.maybeRecomputeMinMax(n),this.writePos+=n.length,n.length}writeToUnderlyingData(e){this.underlyingData.set(e.data,this.writePos)}get buffer(){return typeof this._data==`object`&&`buffer`in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===Z?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){return this.dataType.isVariable?new TextDecoder().decode(this.underlyingData).split(`
|
|
14
|
-
`).slice(0,-1):Array.from(this).map(e=>e.toString())}parseJSON(e){if(!this.dataType.equals(J.JSON))throw Error(`cannot parse non-JSON series as JSON`);return this.toStrings().map(t=>e.parse(mr.decodeString(t)))}get byteCapacity(){return new Y(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===Z?this.byteCapacity:this.dataType.isVariable?new Y(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength==null?this.dataType.isVariable?this.calculateCachedLength():this.writePos===Z?this.byteCapacity.valueOf()/this.dataType.density.valueOf():this.writePos:this.cachedLength}calculateCachedLength(){if(!this.dataType.isVariable)throw Error(`cannot calculate length of a non-variable length data type`);let e=0,t=[0];return this.data.forEach((n,r)=>{n===os&&(e++,t.push(r+1))}),this._cachedIndexes=t,this.cachedLength=e,e}convert(t,n=0){if(this.dataType.equals(t))return this;let r=new t.Array(this.length);for(let e=0;e<this.length;e++)r[e]=Po(this.dataType,t,this.data[e],n);return new e({data:r.buffer,dataType:t,timeRange:this.timeRange,sampleOffset:n,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){return this.length===0?-1/0:(this.dataType.equals(J.TIMESTAMP)?this.cachedMax=this.data[this.data.length-1]:(this.dataType.usesBigInt,this.cachedMax=this.data.reduce((e,t)=>e>t?e:t)),this.cachedMax)}get max(){return this.calcMax()}calcMax(){if(this.dataType.isVariable)throw Error(`cannot calculate maximum on a variable length data type`);return this.writePos===0?-1/0:(this.cachedMax??=this.calcRawMax(),w(this.cachedMax,this.sampleOffset))}calcRawMin(){return this.length===0?1/0:(this.dataType.equals(J.TIMESTAMP)?this.cachedMin=this.data[0]:(this.dataType.usesBigInt,this.cachedMin=this.data.reduce((e,t)=>e<t?e:t)),this.cachedMin)}get min(){return this.calcMin()}calcMin(){if(this.dataType.isVariable)throw Error(`cannot calculate minimum on a variable length data type`);return this.writePos===0?1/0:(this.cachedMin??=this.calcRawMin(),w(this.cachedMin,this.sampleOffset))}get bounds(){return E(Number(this.min),Number(this.max),{makeValid:!1})}maybeRecomputeMinMax(e){if(this.cachedMin!=null){let t=e.cachedMin??e.calcRawMin();t<this.cachedMin&&(this.cachedMin=t)}if(this.cachedMax!=null){let t=e.cachedMax??e.calcRawMax();t>this.cachedMax&&(this.cachedMax=t)}}atAlignment(e,t){let n=Number((e-this.alignment)/this.alignmentMultiple);if(n<0||n>=this.length){if(t===!0)throw Error(`[series] - no value at index ${n}`);return}return this.at(n,t)}at(e,t=!1){if(this.dataType.isVariable)return this.atVariable(e,t??!1);if(this.dataType.equals(J.UUID))return this.atUUID(e,t);e<0&&(e=this.length+e);let n=this.data[e];if(n==null){if(t===!0)throw Error(`[series] - no value at index ${e}`);return}return w(n,this.sampleOffset)}atUUID(e,t){e<0&&(e=this.length+e);let n=ts(new Uint8Array(this.buffer,e*this.dataType.density.valueOf()));if(n==null){if(t)throw Error(`[series] - no value at index ${e}`);return}return n}atVariable(e,t){let n=0,r=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[e],r=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let t=0;t<this.data.length;t++)if(this.data[t]===os){if(e===0){r=t;break}n=t+1,e--}if(r===0&&(r=this.data.length),n>=r||e>0){if(t)throw Error(`[series] - no value at index ${e}`);return}}let i=this.data.slice(n,r);return this.dataType.equals(J.STRING)?new TextDecoder().decode(i):le(JSON.parse(new TextDecoder().decode(i)))}binarySearch(e){let t=0,n=this.length-1,r=xr(e);for(;t<=n;){let i=Math.floor((t+n)/2),a=r(this.at(i,!0),e);if(a===0)return i;a<0?t=i+1:n=i-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(J.FLOAT32)&&!this.dataType.equals(J.UINT8))throw Error(`Only FLOAT32 and UINT8 arrays can be used in WebGL`);let{buffer:t,bufferUsage:n,prevBuffer:r}=this.gl;if(t??(this.gl.buffer=e.createBuffer()),this.writePos!==r)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Z){r===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);let t=this.dataType.density.size(r).valueOf(),n=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,t,n.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 ss(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:bs(this.alignmentBounds.lower),upper:bs(this.alignmentBounds.upper),multiple:this.alignmentMultiple},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}get alignmentBounds(){return E(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 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){let e=new ps(this);return this.dataType.equals(J.JSON)?new ms(e):e}return this.dataType.equals(J.UUID)?new hs(this):new gs(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new fs(this,e,t??this.length)}subAlignmentIterator(e,t){let n=Math.ceil(Number(e-this.alignment)/Number(this.alignmentMultiple)),r=Math.ceil(Number(t-this.alignment)/Number(this.alignmentMultiple));return new fs(this,n,r)}subBytes(t,n){return t>=0&&(n==null||n>=this.byteLength.valueOf())?this:new e({data:this.data.subarray(t,n),dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}sliceSub(t,n,r){if(n<=0&&(r==null||r>=this.length))return this;let i;return i=t?this.data.subarray(n,r):this.data.slice(n,r),new e({data:i,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(n)})}reAlign(t){return new e({data:this.buffer,dataType:this.dataType,timeRange:q.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:`static`,alignment:t})}toString(){let e=`Series(${this.dataType.toString()} ${this.length} [`;if(this.length<=10)e+=Array.from(this).map(e=>e.toString());else{for(let t=0;t<5;t++)e+=`${this.at(t)?.toString()}`,e+=`,`;e+=`...,`;for(let t=-5;t<0;t++)e+=this.at(t)?.toString(),t<-1&&(e+=`,`)}return e+=`])`,e}},us=e=>e==null?!1:Array.isArray(e)||e instanceof ArrayBuffer||ArrayBuffer.isView(e)&&!(e instanceof DataView)||e instanceof ls?!0:No(e),ds=Wr(cs,ls),fs=class{series;end;index;constructor(e,t,n){this.series=e;let r=E(0,e.length+1);this.end=kn(r,n),this.index=kn(r,t)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},ps=class{series;index;decoder;constructor(e){if(!e.dataType.isVariable)throw Error(`cannot create a variable series iterator for a non-variable series`);this.series=e,this.index=0,this.decoder=new TextDecoder}next(){let e=this.index,t=this.series.data;for(;this.index<t.length&&t[this.index]!==os;)this.index++;let 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))})}},ms=class e{wrapped;static schema=l.z.record(l.z.string(),l.z.unknown());constructor(e){this.wrapped=e}next(){let t=this.wrapped.next();return t.done===!0?{done:!0,value:void 0}:{done:!1,value:mr.decodeString(t.value,e.schema)}}},hs=class{series;index;data;density;constructor(e){if(!e.dataType.equals(J.UUID))throw 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=J.UUID.density.valueOf()}next(){if(this.index>=this.series.length)return{done:!0,value:void 0};let e=ts(this.data,this.index*this.density);return this.index++,{done:!1,value:e}}},gs=class{series;index;constructor(e){this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},_s=class{series;constructor(e=[]){if(e.length!==0){let t=e[0].dataType;for(let n=1;n<e.length;n++)if(!e[n].dataType.equals(t))throw Error(`[multi-series] - series must have the same data type`)}this.series=e}as(e){return ss(e,this.dataType),this}get dataType(){return this.series.length===0?J.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?q.ZERO:new q(this.series[0].timeRange.start,this.series[this.series.length-1].timeRange.end)}get alignment(){return this.series.length===0?0n:this.series[0].alignment}get alignmentBounds(){return this.series.length===0?E(0n,0n):E(this.series[0].alignmentBounds.lower,this.series[this.series.length-1].alignmentBounds.upper)}push(e){let t=()=>Error(`cannot push a ${e.dataType.toString()} series to a ${this.dataType.toString()} multi-series`),n=e.dataType.equals(this.dataType);if(ds(e)){if(this.series.length!==0&&!n)throw t();this.series.push(e)}else{if(this.series.length!==0&&e.series.length!==0&&!n)throw t();this.series.push(...e.series)}}get length(){return this.series.reduce((e,t)=>e+t.length,0)}atAlignment(e,t){for(let n of this.series)if(D(n.alignmentBounds,e))return n.atAlignment(e,t);if(t)throw Error(`[series] - no value at alignment ${e}`)}at(e,t=!1){e<0&&(e=this.length+e);for(let n of this.series){if(e<n.length)return n.at(e,t);e-=n.length}if(t)throw Error(`[series] - no value at index ${e}`)}subIterator(e,t){return new ys(this,e,t??this.length)}subAlignmentIterator(e,t){if(e>=this.alignmentBounds.upper||t<=this.alignmentBounds.lower)return rs;let n=0;for(let t=0;t<this.series.length;t++){let r=this.series[t];if(e<r.alignment)break;if(e>=r.alignmentBounds.upper)n+=r.length;else if(D(r.alignmentBounds,e)){n+=Math.ceil(Number(e-r.alignment)/Number(r.alignmentMultiple));break}}let r=0;for(let e=0;e<this.series.length;e++){let n=this.series[e];if(t<n.alignment)break;if(t>=n.alignmentBounds.upper)r+=n.length;else if(D(n.alignmentBounds,t)){r+=Math.ceil(Number(t-n.alignment)/Number(n.alignmentMultiple));break}}return new ys(this,n,r)}subAlignmentSpanIterator(e,t){if(e>=this.alignmentBounds.upper)return rs;t=Math.min(t,Number(this.distance(e,this.alignmentBounds.upper)));let n=0;for(let t=0;t<this.series.length;t++){let r=this.series[t];if(e<r.alignment)break;if(e>=r.alignmentBounds.upper)n+=r.length;else if(D(r.alignmentBounds,e)){n+=Number(e-r.alignment);break}}return new ys(this,n,n+t)}updateGLBuffer(e){this.series.forEach(t=>t.updateGLBuffer(e))}get bounds(){return In(this.series.map(e=>e.bounds))}get byteLength(){return new Y(this.series.reduce((e,t)=>e+t.byteLength.valueOf(),0))}get data(){let e=new this.dataType.Array(this.length),t=0;for(let n of this.series)e.set(n.data,t),t+=n.length;return new this.dataType.Array(e.buffer)}traverseAlignment(e,t){return Hn(this.series.map(e=>e.alignmentBounds),e,t)}acquire(e){this.series.forEach(t=>t.acquire(e))}release(){this.series.forEach(e=>e.release())}distance(e,t){return Un(this.series.map(e=>e.alignmentBounds),e,t)}parseJSON(e){if(!this.dataType.equals(J.JSON))throw Error(`cannot parse non-JSON series as JSON`);return this.series.flatMap(t=>t.parseJSON(e))}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new vs(this.series)}toStrings(){return this.series.flatMap(e=>e.toStrings())}},vs=class{series;seriesIndex;internal;constructor(e){this.series=e,this.seriesIndex=0,this.internal=e[0][Symbol.iterator]()}next(){let 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}},ys=class{series;index;end;constructor(e,t,n){this.series=e,this.end=n,this.index=t}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}},bs=e=>({domain:e>>32n,sample:e&4294967295n}),xs=o({DataType:()=>J,Density:()=>K,MultiSeries:()=>_s,Rate:()=>Ao,Series:()=>ls,Size:()=>Y,TimeRange:()=>q,TimeSpan:()=>G,TimeStamp:()=>W,convertDataType:()=>Po,dataTypeZ:()=>Bo,isCrudeSeries:()=>us,isTelemValue:()=>No,numericTimeRangeZ:()=>jo,rateZ:()=>Ro,sizeZ:()=>zo,timeRangeBoundedZ:()=>Vo,timeRangeZ:()=>Fo,timeSpanZ:()=>Lo,timeStampZ:()=>Io,typedArrayZ:()=>Mo}),Ss=o({sleep:()=>Cs}),Cs=async e=>await new Promise(t=>setTimeout(t,G.fromMilliseconds(e).milliseconds)),ws=o({Breaker:()=>Ts,breakerConfigZ:()=>Es}),Ts=class{config;retries;interval;constructor(e){this.config={baseInterval:new G(e?.baseInterval??G.seconds(1)),maxRetries:e?.maxRetries??5,scale:e?.scale??1,sleepFn:e?.sleepFn??Cs},this.retries=0,this.interval=new G(this.config.baseInterval)}async wait(){let{maxRetries:e,scale:t,sleepFn:n}=this.config;return this.retries>=e?!1:(await n(this.interval),this.interval=this.interval.mult(t),this.retries++,!0)}get retryMessage(){return`breaker triggered ${this.retries+1}/${this.config.maxRetries} times, retrying in ${this.interval.toString()}`}reset(){this.retries=0,this.interval=this.config.baseInterval}},Es=l.z.object({baseInterval:G.z.optional(),maxRetries:l.z.number().optional(),scale:l.z.number().optional()}),Ds=o({Z:()=>Os}),Os=e=>l.z.object({variant:l.z.enum([`set`,`delete`]),key:l.z.string(),value:e}),ks=l.z.string().regex(/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i),Q=er,As=l.z.number().min(0).max(1),js=l.z.tuple([Q,Q,Q,As]),Ms=l.z.tuple([Q,Q,Q]),Ns=l.z.object({rgba255:js}),Ps=l.z.object({r:Q,g:Q,b:Q,a:As}),Fs=l.z.number().min(0).max(360),Is=l.z.number().min(0).max(100),Ls=l.z.number().min(0).max(100),Rs=l.z.tuple([Fs,Is,Ls,As]),zs=l.z.union([ks,Ms,js,Rs,Ns,Ps]),Bs=zs.transform(e=>$(e)),Vs=e=>Bs.safeParse(e).success,Hs=e=>js.safeParse(e).success,Us=(e=>{if(e==null)return;let t=Bs.safeParse(e);if(t.success)return Ks(t.data);if(typeof e==`string`)return e;throw t.error}),$=(e,t=1)=>{if(e=zs.parse(e),typeof e==`string`)return uc(e,t);if(Array.isArray(e)){if(e.length<3||e.length>4)throw Error(`Invalid color: [${e.join(`, `)}]`);return e.length===3?[...e,t]:e}return`a`in e&&`r`in e?[e.r,e.g,e.b,e.a]:e.rgba255},Ws=(e,t)=>{if(e==null||t==null)return e==t;let n=$(e),r=$(t);return n.every((e,t)=>e===r[t])},Gs=(e=>{if(e==null)return;let[t,n,r,i]=$(e),a=Math.round(i*255);return`#${fc(t)}${fc(n)}${fc(r)}${a===255?``:fc(a)}`}),Ks=e=>{let[t,n,r,i]=$(e);return`rgba(${t}, ${n}, ${r}, ${i})`},qs=e=>`rgb(${Js(e)})`,Js=e=>{let[t,n,r]=$(e);return`${t}, ${n}, ${r}`},Ys=e=>[...Xs(e),ec(e)],Xs=e=>[Zs(e)/255,Qs(e)/255,$s(e)/255],Zs=e=>$(e)[0],Qs=e=>$(e)[1],$s=e=>$(e)[2],ec=e=>$(e)[3],tc=e=>Ws(dc,e),nc=e=>yc($(e)),rc=(e,t)=>{let[n,r,i]=$(e);if(t>100)throw Error(`Color opacity must be between 0 and 100, got ${t}`);return t>1&&(t/=100),[n,r,i,t]},ic=e=>{let[t,n,r]=Xs(e).map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4);return Number((.2126*t+.7152*n+.0722*r).toFixed(3))},ac=e=>{let[t,n,r]=Xs(e);return 1-(Math.max(t,n,r)-Math.min(t,n,r))},oc=(e,t)=>{let n=$(e),r=$(t),i=ic(n),a=ic(r);return(Math.max(i,a)+.5)/(Math.min(i,a)+.5)},sc=(e,...t)=>{if(t.length===0)throw Error(`[Color.pickByContrast] - must provide at least one color`);let n=$(e),[r]=t.sort((e,t)=>oc(n,t)-oc(n,e));return $(r)},cc=e=>ic(e)<.5,lc=e=>ic(e)>.5,uc=(e,t=1)=>(e=ks.parse(e),e=mc(e),[pc(e,0),pc(e,2),pc(e,4),e.length===8?pc(e,6)/255:t]),dc=[0,0,0,0],fc=e=>Math.floor(e).toString(16).padStart(2,`0`),pc=(e,t)=>parseInt(e.slice(t,t+2),16),mc=e=>e.startsWith(`#`)?e.slice(1):e,hc={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`},gc=e=>{if(!e)return;let t=e.trim().toLowerCase();if(!(t===`transparent`||t===`none`)){if(t.startsWith(`#`)){if(t.length===4){let e=t[1],n=t[2],r=t[3],i=`#${e}${e}${n}${n}${r}${r}`;if(ks.safeParse(i).success)return uc(i)}return(t.length===7||t.length===9)&&ks.safeParse(t).success?uc(t):void 0}if(t.startsWith(`rgb`)){let e=t.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);if(e){let[,t,n,r,i]=e;return[parseInt(t,10),parseInt(n,10),parseInt(r,10),i?parseFloat(i):1]}}if(hc[t])return uc(hc[t])}},_c=e=>{e=Rs.parse(e);let[t,n,r]=e,i=e[3];t/=360,n/=100,r/=100;let a,o,s;if(n===0)a=o=s=r;else{let e=r<.5?r*(1+n):r+n-r*n,i=2*r-e;a=vc(i,e,t+1/3),o=vc(i,e,t),s=vc(i,e,t-1/3)}return[Math.round(a*255),Math.round(o*255),Math.round(s*255),i]},vc=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),yc=e=>{e=js.parse(e);let[t,n,r]=e,i=e[3];t/=255,n/=255,r/=255;let a=Math.max(t,n,r),o=Math.min(t,n,r),s,c,l=(a+o)/2;if(a===o)s=c=0;else{let e=a-o;c=l>.5?e/(2-a-o):e/(a+o),s=a===t?(n-r)/e+(n<r?6:0):a===n?(r-t)/e+2:(t-n)/e+4,s/=6}return s*=360,c*=100,l*=100,[Math.round(s),Math.round(c),Math.round(l),i]},bc=$(`#000000`),xc=$(`#ffffff`),Sc=l.z.object({key:l.z.string(),color:zs,position:l.z.number(),switched:l.z.boolean().optional()}),Cc=l.z.array(Sc),wc=(e,t)=>{if(e.length===0)return dc;if(e=e.slice().sort((e,t)=>e.position-t.position),t<=e[0].position)return $(e[0].color);if(t>=e[e.length-1].position)return $(e[e.length-1].color);for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1];if(t<r.position||t>i.position)continue;if(t===r.position)return $(r.color);if(t===i.position)return $(i.color);let a=(t-r.position)/(i.position-r.position),o=$(r.color),s=$(i.color);return $([Math.round(Zs(o)+a*(Zs(s)-Zs(o))),Math.round(Qs(o)+a*(Qs(s)-Qs(o))),Math.round($s(o)+a*($s(s)-$s(o))),ec(o)+a*(ec(s)-ec(o))])}return $(e[e.length-1].color)},Tc=l.z.object({key:l.z.string(),name:l.z.string(),color:Bs}),Ec=l.z.object({key:l.z.string(),name:l.z.string(),swatches:l.z.array(Tc)}),Dc=o({BLACK:()=>bc,WHITE:()=>xc,ZERO:()=>dc,aValue:()=>ec,bValue:()=>$s,colorZ:()=>Bs,construct:()=>$,contrast:()=>oc,crudeZ:()=>zs,cssString:()=>Us,equals:()=>Ws,fromCSS:()=>gc,fromGradient:()=>wc,fromHSLA:()=>_c,gValue:()=>Qs,gradientZ:()=>Cc,grayness:()=>ac,hex:()=>Gs,hsla:()=>nc,isColor:()=>Hs,isCrude:()=>Vs,isDark:()=>cc,isLight:()=>lc,isZero:()=>tc,luminance:()=>ic,paletteZ:()=>Ec,pickByContrast:()=>sc,rValue:()=>Zs,rgbCSS:()=>qs,rgbString:()=>Js,rgba1:()=>Ys,rgbaCSS:()=>Ks,setAlpha:()=>rc,stopZ:()=>Sc}),Oc=er,kc=function(e){return e[e.exclusive=0]=`exclusive`,e[e.shared=1]=`shared`,e}({}),Ac=l.z.enum(kc),jc=l.z.object({key:l.z.string(),name:l.z.string(),group:l.z.uint32().optional()}),Mc=e=>l.z.object({subject:jc,resource:e,authority:Oc}),Nc={lower:0,upper:256},Pc=(...e)=>t=>t.filter(t=>{let n=!1;return t.to!=null&&(n=e.includes(t.to.resource)),t.from!=null&&!n&&(n=e.includes(t.from.resource)),n}),Fc=e=>l.z.object({from:Mc(e),to:l.z.null().optional()}),Ic=e=>l.z.object({from:l.z.null().optional(),to:Mc(e)}),Lc=e=>l.z.union([Fc(e),Ic(e),l.z.object({from:Mc(e),to:Mc(e)})]),Rc=o({ABSOLUTE_AUTHORITY:()=>255,AUTHORITY_BOUNDS:()=>Nc,Concurrency:()=>kc,ZERO_AUTHORITY:()=>0,acquireZ:()=>Ic,authorityZ:()=>Oc,concurrencyZ:()=>Ac,filterTransfersByChannelKey:()=>Pc,releaseZ:()=>Fc,stateZ:()=>Mc,subjectZ:()=>jc,transferZ:()=>Lc}),zc=o({formatValue:()=>Bc}),Bc=e=>{switch(typeof e){case`bigint`:case`number`:return e.toString();case`boolean`:return e?`1`:`0`;case`undefined`:return``;case`string`:case`symbol`:case`function`:return Hc(e.toString());case`object`:return e==null?``:Hc(JSON.stringify(e))}},Vc=/[",\n]/,Hc=e=>Vc.test(e)?`"${e.replace(/"/g,`""`)}"`:e,Uc=(e,t)=>{let n=null;return t===0?e:(...r)=>{n!==null&&(clearTimeout(n),n=null),n=setTimeout(()=>e(...r),t)}},Wc=(e,t)=>{let n=null;return t===0?e:(...r)=>{n===null&&(n=setTimeout(()=>{e(...r),n=null},t))}},Gc=o({}),Kc=o({ZERO_PRIMITIVES:()=>Xc,pointerZ:()=>qc,primitiveTypeZ:()=>Yc,primitiveZ:()=>Jc}),qc=l.z.string().regex(/^(?:$|(?:\/(?:[^~/]|~0|~1)*)+)$/,`must be a valid JSON pointer (RFC 6901)`),Jc=l.z.union([l.z.string(),l.z.number(),l.z.boolean(),l.z.null()]),Yc=l.z.enum([`string`,`number`,`boolean`,`null`]),Xc={string:``,number:0,boolean:!1,null:null},Zc=class{store=new Map;async get(e){return this.store.get(e)??null}async set(e,t){this.store.set(e,t)}async delete(e){this.store.delete(e)}async length(){return this.store.size}async clear(){this.store.clear()}},Qc=class{store=new Map;get(e){return this.store.get(e)??null}set(e,t){this.store.set(e,t)}delete(e){this.store.delete(e)}},$c=l.z.object({key:l.z.string(),value:l.z.string()}),el=o({MockAsync:()=>Zc,MockSync:()=>Qc,stringPairZ:()=>$c}),tl=o({keyZ:()=>nl,labelZ:()=>rl,newZ:()=>il}),nl=l.z.uuid(),rl=l.z.object({key:nl,name:l.z.string().min(1),color:Bs}),il=rl.partial({key:!0}),al=o({is:()=>sl}),ol=RegExp(`^(https?:\\/\\/)?((([a-zA-Z0-9][a-zA-Z0-9-]*\\.)+[a-zA-Z]{2,})|localhost|(\\d{1,3}\\.){3}\\d{1,3})(\\:\\d+)?(\\/[-a-zA-Z0-9@:%._\\+~#=]*)*(\\?[;&a-zA-Z0-9%_.,~+=-]*)?(#[-a-zA-Z0-9_]*)?$`),sl=e=>ol.test(e),cl=o({getOrSetDefault:()=>ll}),ll=(e,t,n)=>{let r=e.get(t);return r===void 0?(e.set(t,n),n):r},ul=o({compareSemVer:()=>pl,createMigration:()=>_l,migrator:()=>vl,semVerNewer:()=>hl,semVerOlder:()=>gl,semVerZ:()=>dl,versionsEqual:()=>ml}),dl=l.z.string().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/),fl=(e,t)=>{let n=e.split(`.`),r=t.split(`.`),i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=n[e],i=r[e];if(t===void 0)return-1;if(i===void 0)return 1;let a=/^\d+$/.test(t),o=/^\d+$/.test(i);if(a&&!o)return-1;if(!a&&o)return 1;if(a&&o){let e=parseInt(t,10),n=parseInt(i,10);if(e<n)return-1;if(e>n)return 1}else{if(t<i)return-1;if(t>i)return 1}}return 0},pl=((e,t,n={})=>{n.checkMajor??=!0,n.checkMinor??=!0,n.checkPatch??=!0;let r=dl.parse(e),i=dl.parse(t),[a,o]=r.split(`-`),[s,c]=i.split(`-`),[l,u,d]=a.split(`.`).map(Number),[f,p,m]=s.split(`.`).map(Number);if(n.checkMajor){if(l<f)return-1;if(l>f)return 1}if(n.checkMinor){if(u<p)return-1;if(u>p)return 1}if(n.checkPatch){if(d<m)return-1;if(d>m)return 1}return o===void 0&&c===void 0?0:o===void 0?1:c===void 0?-1:fl(o,c)}),ml=(e,t,n={})=>jr(pl(e,t,n)),hl=(e,t,n={})=>kr(pl(e,t,n)),gl=(e,t,n={})=>Or(pl(e,t,n)),_l=({name:e,migrate:t})=>n=>{try{let r=t(n);return console.log(`${e} migrated: ${n.version} -> ${r.version}`),r}catch(t){throw console.log(`${e} failed to migrate from ${n.version}`),console.error(t),t}},vl=({name:e,migrations:t,targetSchema:n,defaultVersion:r,def:i})=>{let a=Object.keys(t).sort(pl).pop();if(a==null)return t=>{if(t.version??=r,t.version!==i.version)return console.log(`${e} version ${t.version} is newer than latest version of ${i.version}.
|
|
11
|
+
`).map(e=>e.trim());if(n.length===0)return t==null?{}:t.parse({});let i=n.split(`,`).map(e=>e.trim()),a={};return i.forEach(e=>{a[e]=[]}),r.forEach(e=>{let t=e.split(`,`).map(e=>e.trim());i.forEach((e,n)=>{let r=this.parseValue(t[n]);r!=null&&a[e].push(r)})}),t==null?a:t.parse(a)}parseValue(e){if(e==null||e.length===0)return null;let t=Number(e);return isNaN(t)?e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e:t}},hr=class{contentType=`text/plain`;encode(e){if(typeof e!=`string`)throw Error(`TextCodec.encode payload must be a string`);return new TextEncoder().encode(e)}decode(e,t){let n=new TextDecoder().decode(e);return t==null?n:t.parse(n)}},gr=new pr,_r=new mr,vr=new hr,yr=[gr],br=365,xr=30,Sr=l.z.union([l.z.tuple([l.z.int()]),l.z.tuple([l.z.int(),l.z.int().min(1).max(12)]),l.z.tuple([l.z.int(),l.z.int().min(1).max(12),l.z.int().min(1).max(31)])]),Cr=(e,t)=>{let n=new E(t);if(![D.DAY,D.HOUR,D.MINUTE,D.SECOND,D.MILLISECOND,D.MICROSECOND,D.NANOSECOND].some(e=>e.equals(n)))throw Error(`Invalid argument for remainder. Must be an even TimeSpan or Timestamp`);let r=e.valueOf()%n.valueOf();return e instanceof E?new E(r):new D(r)},E=class e extends b{constructor(t,n=`UTC`){if(t==null)super(e.now().valueOf());else if(t instanceof Date)super(BigInt(t.getTime())*e.MILLISECOND.valueOf());else if(typeof t==`string`)super(e.parseDateTimeString(t,n).valueOf());else if(Array.isArray(t))super(e.parseDate(t));else{let r=0n;t instanceof Number&&(t=t.valueOf()),n===`local`&&(r=e.utcOffset.valueOf()),typeof t==`number`&&(isFinite(t)?t=t===Wt?Ht:Math.trunc(t):(isNaN(t)&&(t=0),t=t===1/0?e.MAX:e.MIN)),y(t)&&(t=t.value),super(BigInt(t.valueOf())+r)}}static parseDate([t=1970,n=1,r=1]){let i=new Date(t,n-1,r,0,0,0,0);return new e(BigInt(i.getTime())*e.MILLISECOND.valueOf()).truncate(e.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(t,n=`UTC`){let[r,i,a]=t.split(`:`),o=`00`,s=`00`;a!=null&&([o,s]=a.split(`.`));let c=e.hours(parseInt(r??`00`,10)).add(e.minutes(parseInt(i??`00`,10))).add(e.seconds(parseInt(o??`00`,10))).add(e.milliseconds(parseInt(s??`00`,10)));return n===`local`&&(c=c.add(e.utcOffset)),c.valueOf()}static parseDateTimeString(t,n=`UTC`){if(!t.includes(`/`)&&!t.includes(`-`))return e.parseTimeString(t,n);if(t.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?$/)!=null){let r=t,i=0;if(t.includes(`.`)){let e=t.split(`.`);r=e[0];let n=e[1]||`0`;i=parseInt(n.padEnd(3,`0`).slice(0,3),10)}let a=n===`local`?new Date(r.replace(`T`,` `)):new Date(`${r}Z`);return BigInt(a.getTime())*e.MILLISECOND.valueOf()+BigInt(i)*e.MILLISECOND.valueOf()}let r=new Date(t);return t.includes(`:`)||r.setUTCHours(0,0,0,0),new e(BigInt(r.getTime())*e.MILLISECOND.valueOf(),n).valueOf()}toISOString(t=`UTC`){if(t===`UTC`)return this.date().toISOString();let n=this.date(),r=new D(BigInt(n.getTimezoneOffset())*e.MINUTE.valueOf());return this.sub(r).date().toISOString()}timeString(e=!1,t=`UTC`){let n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(){let e=this.date();return`${e.toLocaleString(`default`,{month:`short`})} ${e.toLocaleString(`default`,{day:`numeric`})}`}static get utcOffset(){return new D(BigInt(new Date().getTimezoneOffset())*e.MINUTE.valueOf())}static since(t){return new e().span(t)}date(){return new Date(this.milliseconds)}equals(t){return this.valueOf()===new e(t).valueOf()}span(e){return this.range(e).span}range(e){return new A(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0n}after(t){return this.valueOf()>new e(t).valueOf()}afterEq(t){return this.valueOf()>=new e(t).valueOf()}before(t){return this.valueOf()<new e(t).valueOf()}beforeEq(t){return this.valueOf()<=new e(t).valueOf()}add(t){return new e(S(this.valueOf(),new D(t).valueOf()))}sub(t){return new e(x(this.valueOf(),new D(t).valueOf()))}get hours(){return Number(this.valueOf())/Number(D.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(D.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(D.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(D.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(e.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(e.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}get localYear(){return this.date().getFullYear()}setYear(t){let n=this.date();return n.setUTCFullYear(t),new e(n)}setLocalYear(t){let n=this.date();return n.setFullYear(t),new e(n)}get month(){return this.date().getUTCMonth()}get localMonth(){return this.date().getMonth()}setMonth(t){let n=this.date();return n.setUTCMonth(t),new e(n)}setLocalMonth(t){let n=this.date();return n.setMonth(t),new e(n)}get day(){return this.date().getUTCDate()}get localDay(){return this.date().getDate()}setDay(t){let n=this.date();return n.setUTCDate(t),new e(n)}setLocalDay(t){let n=this.date();return n.setDate(t),new e(n)}get hour(){return this.date().getUTCHours()}get localHour(){return this.date().getHours()}setLocalHour(t){let n=this.date();return n.setHours(t),new e(n)}setHour(t){let n=this.date();return n.setUTCHours(t),new e(n)}get minute(){return this.date().getUTCMinutes()}get localMinute(){return this.date().getMinutes()}setMinute(t){let n=this.date();return n.setUTCMinutes(t),new e(n)}setLocalMinute(t){let n=this.date();return n.setMinutes(t),new e(n)}get second(){return this.date().getUTCSeconds()}get localSecond(){return this.date().getSeconds()}setSecond(t){let n=this.date();return n.setUTCSeconds(t),new e(n)}setLocalSecond(t){let n=this.date();return n.setSeconds(t),new e(n)}get millisecond(){return this.date().getUTCMilliseconds()}get localMillisecond(){return this.date().getMilliseconds()}setMillisecond(t){let n=this.date();return n.setUTCMilliseconds(t),new e(n)}setLocalMillisecond(t){let n=this.date();return n.setMilliseconds(t),new e(n)}toString(e=`ISO`,t=`UTC`){switch(e){case`ISODate`:return this.toISOString(t).slice(0,10);case`ISOTime`:return this.toISOString(t).slice(11,23);case`time`:return this.timeString(!1,t);case`preciseTime`:return this.timeString(!0,t);case`date`:return this.dateString();case`preciseDate`:return`${this.dateString()} ${this.timeString(!0,t)}`;case`dateTime`:return`${this.dateString()} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}remainder(e){return Cr(this,e)}get isToday(){return this.truncate(D.DAY).equals(e.now().truncate(D.DAY))}truncate(e){return this.sub(this.remainder(e))}formatBySpan(e){return e.greaterThanOrEqual(D.days(30))?`shortDate`:e.greaterThanOrEqual(D.DAY)?`dateTime`:e.greaterThanOrEqual(D.HOUR)?`time`:e.greaterThanOrEqual(D.SECOND)?`preciseTime`:`ISOTime`}static now(){return new e(new Date)}static max(...t){let n=e.MIN;for(let r of t){let t=new e(r);t.after(n)&&(n=t)}return n}static min(...t){let n=e.MAX;for(let r of t){let t=new e(r);t.before(n)&&(n=t)}return n}static nanoseconds(t,n=`UTC`){return new e(t,n)}static NANOSECOND=e.nanoseconds(1);static microseconds(t,n=`UTC`){return e.nanoseconds(t*1e3,n)}static MICROSECOND=e.microseconds(1);static milliseconds(t,n=`UTC`){return e.microseconds(t*1e3,n)}static MILLISECOND=e.milliseconds(1);static seconds(t,n=`UTC`){return e.milliseconds(t*1e3,n)}static SECOND=e.seconds(1);static minutes(t,n=`UTC`){return e.seconds(t*60,n)}static MINUTE=e.minutes(1);static hours(t,n=`UTC`){return e.minutes(t*60,n)}static HOUR=e.hours(1);static days(t,n=`UTC`){return e.hours(t*24,n)}static DAY=e.days(1);static MAX=new e(Ht);static MIN=new e(0);static ZERO=new e(0);static z=l.z.union([l.z.instanceof(e),l.z.object({value:l.z.bigint()}).transform(t=>new e(t.value)),l.z.string().transform(t=>new e(BigInt(t))),l.z.number().transform(t=>new e(t)),l.z.bigint().transform(t=>new e(t)),l.z.date().transform(t=>new e(t)),l.z.custom(e=>e instanceof D).transform(t=>new e(t)),Sr.transform(t=>new e(t))]);static sort(e,t){return Number(e.valueOf()-t.valueOf())}},D=class e extends b{constructor(e){typeof e==`number`&&(e=Math.trunc(e.valueOf())),y(e)&&(e=e.value),super(BigInt(e.valueOf()))}static fromSeconds(t){return t instanceof e?t:t instanceof O?t.period:t instanceof E?new e(t):(y(t)&&(t=t.value),[`number`,`bigint`].includes(typeof t)?e.seconds(t):new e(t))}static fromMilliseconds(t){return t instanceof e?t:t instanceof O?t.period:t instanceof E?new e(t):(y(t)&&(t=t.value),[`number`,`bigint`].includes(typeof t)?e.milliseconds(t):new e(t))}valueOf(){return this.value}lessThan(t){return this.valueOf()<new e(t).valueOf()}greaterThan(t){return this.valueOf()>new e(t).valueOf()}lessThanOrEqual(t){return this.valueOf()<=new e(t).valueOf()}greaterThanOrEqual(t){return this.valueOf()>=new e(t).valueOf()}remainder(e){return Cr(this,e)}truncate(t){return new e(BigInt(Math.trunc(Number(this.valueOf()/t.valueOf())))*t.valueOf())}toString(t=`full`){if(t===`semantic`)return this.toSemanticString();let n=this.truncate(e.DAY),r=this.truncate(e.HOUR),i=this.truncate(e.MINUTE),a=this.truncate(e.SECOND),o=this.truncate(e.MILLISECOND),s=this.truncate(e.MICROSECOND),c=this.truncate(e.NANOSECOND),l=n,u=r.sub(n),d=i.sub(r),f=a.sub(i),p=o.sub(a),m=s.sub(o),ee=c.sub(s),h=``;return l.isZero||(h+=`${l.days}d `),u.isZero||(h+=`${u.hours}h `),d.isZero||(h+=`${d.minutes}m `),f.isZero||(h+=`${f.seconds}s `),p.isZero||(h+=`${p.milliseconds}ms `),m.isZero||(h+=`${m.microseconds}µs `),ee.isZero||(h+=`${ee.nanoseconds}ns`),h.trim()}toSemanticString(){let t=new e(this.valueOf()<0n?-this.valueOf():this.valueOf()),n=this.valueOf()<0n;if(t.valueOf()===0n)return`0s`;if(t.lessThan(e.SECOND))return`< 1s`;let r=t.days,i=t.hours,a=t.minutes,o=t.seconds,s=Math.floor(r/br),c=Math.floor(r/xr),l=Math.floor(r/7),u=Math.floor(r),d=Math.floor(i),f=Math.floor(a),p=Math.floor(o),m=n?`-`:``;if(s>=1){let e=`${s}y`;if(s<2){let t=Math.floor(r%br/xr);t>0&&(e+=` ${t}mo`)}return m+e}if(l>=1&&r<xr&&r%7==0){let e=`${l}w`,t=Math.floor(r%7),n=Math.floor(i-l*7*24);return l<2&&(t>0?e+=` ${t}d`:n>0&&n<24&&(e+=` ${n}h`)),m+e}if(c>=1){let e=`${c}mo`;if(c<3){let t=Math.floor(r%xr);t>0&&(e+=` ${t}d`)}return m+e}if(l>=1){let e=`${l}w`,t=Math.floor(r%7),n=Math.floor(i-l*7*24);return l<2&&(t>0?e+=` ${t}d`:n>0&&n<24&&(e+=` ${n}h`)),m+e}if(u>=1){let e=`${u}d`,t=Math.floor(i-u*24);return u<2&&t>0&&(e+=` ${t}h`),m+e}if(d>=1){let e=`${d}h`;if(d<3){let t=Math.floor(a-d*60);t>0&&(e+=` ${t}m`)}return m+e}if(f>=1){let e=`${f}m`;if(f<5){let t=Math.floor(o-f*60);t>0&&(e+=` ${t}s`)}return m+e}return`${m}${p}s`}mult(t){return new e(C(this.valueOf(),t))}div(t){return new e($t(this.valueOf(),t))}get days(){return Number(this.valueOf())/Number(e.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(e.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(e.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(e.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(e.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(e.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===0n}equals(t){return this.valueOf()===new e(t).valueOf()}add(t){return new e(this.valueOf()+new e(t).valueOf())}sub(t){return new e(this.valueOf()-new e(t).valueOf())}abs(){let t=this.valueOf();return new e(t<0n?-t:t)}static nanoseconds(t=1){return new e(t)}static NANOSECOND=e.nanoseconds(1);static microseconds(t=1){return e.nanoseconds(C(t,1e3))}static MICROSECOND=e.microseconds(1);static milliseconds(t=1){return e.microseconds(C(t,1e3))}static MILLISECOND=e.milliseconds(1);static seconds(t=1){return e.milliseconds(C(t,1e3))}static SECOND=e.seconds(1);static minutes(t=1){return e.seconds(C(t,60))}static MINUTE=e.minutes(1);static hours(t){return e.minutes(C(t,60))}static HOUR=e.hours(1);static days(t){return e.hours(C(t,24))}static DAY=e.days(1);static MAX=new e(Ht);static MIN=new e(0);static ZERO=new e(0);static z=l.z.union([l.z.object({value:l.z.bigint()}).transform(t=>new e(t.value)),l.z.string().transform(t=>new e(BigInt(t))),l.z.number().transform(t=>new e(t)),l.z.bigint().transform(t=>new e(t)),l.z.instanceof(e),l.z.instanceof(E).transform(t=>new e(t)),l.z.custom(e=>e instanceof O).transform(t=>new e(t))])},O=class e extends b{constructor(e){y(e)&&(e=e.value),super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(t){return this.valueOf()===new e(t).valueOf()}get period(){return D.seconds(1/this.valueOf())}sampleCount(e){return new D(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new k(t).valueOf()}span(e){return D.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/new k(t).valueOf())}add(t){return new e(S(this.valueOf(),new e(t).valueOf()))}sub(t){return new e(x(this.valueOf(),new e(t).valueOf()))}mult(t){return new e(C(this.valueOf(),t))}div(t){return new e($t(this.valueOf(),t))}static hz(t){return new e(t)}static khz(t){return e.hz(t*1e3)}static z=l.z.union([l.z.number().transform(t=>new e(t)),l.z.instanceof(e)])},k=class e extends b{constructor(e){y(e)&&(e=e.value),super(e.valueOf())}length(e){return e.valueOf()/this.valueOf()}size(e){return new M(e*this.valueOf())}add(t){return new e(S(this.valueOf(),new e(t).valueOf()))}sub(t){return new e(x(this.valueOf(),new e(t).valueOf()))}mult(t){return new e(C(this.valueOf(),t))}div(t){return new e($t(this.valueOf(),t))}static UNKNOWN=new e(0);static BIT128=new e(16);static BIT64=new e(8);static BIT32=new e(4);static BIT16=new e(2);static BIT8=new e(1);static z=l.z.union([l.z.number().transform(t=>new e(t)),l.z.instanceof(e)])},A=class e{start;end;constructor(e,t){typeof e==`object`&&`start`in e?(this.start=new E(e.start),this.end=new E(e.end)):(this.start=new E(e),this.end=new E(t))}get span(){return new D(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 e(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,t=D.ZERO){if(t.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let n=this.start.sub(e.start).valueOf(),r=this.end.sub(e.end).valueOf();return n<0&&(n=-n),r<0&&(r=-r),n<=t.valueOf()&&r<=t.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.toString(`preciseDate`)} - ${this.span.toString()}`}overlapsWith(e,t=D.ZERO){e=e.makeValid();let n=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(n.start)||n.end.equals(e.start))return!1;let r=E.max(n.start,e.start),i=E.min(n.end,e.end);return i.before(r)?!1:new D(i.sub(r)).greaterThanOrEqual(t)}contains(t){return t instanceof e?this.contains(t.start)&&this.contains(t.end):this.start.beforeEq(t)&&this.end.after(t)}boundBy(t){let n=new e(this.start,this.end);return t.start.after(this.start)&&(n.start=t.start),t.start.after(this.end)&&(n.end=t.start),t.end.before(this.end)&&(n.end=t.end),t.end.before(this.start)&&(n.start=t.end),n}static max(...t){return new e(E.min(...t.map(e=>e.start)),E.max(...t.map(e=>e.end)))}static MAX=new e(E.MIN,E.MAX);static ZERO=new e(E.ZERO,E.ZERO);static z=l.z.union([l.z.object({start:E.z,end:E.z}).transform(t=>new e(t.start,t.end)),l.z.instanceof(e)]);static boundedZ=e.z.refine(({isValid:e})=>e,{message:`Time range start time must be before or equal to time range end time`}).refine(({end:e})=>e.valueOf()<=Ht,{message:`Time range end time must be less than or equal to the maximum value of an int64`}).refine(({start:e})=>e.valueOf()>=Vt,{message:`Time range start time must be greater than or equal to the minimum value of an int64`});static sort(e,t){return E.sort(e.start,t.start)||E.sort(e.end,t.end)}static merge(...t){return e.max(...t.map(t=>new e(t).makeValid()))}},j=class e extends b{constructor(t){if(y(t)&&(t=t.value),t instanceof e||typeof t==`string`||typeof t.valueOf()==`string`)super(t.valueOf());else{let n=e.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);if(n==null)throw Error(`unable to find data type for ${t.toString()}`);super(n.valueOf())}}get Array(){let t=e.ARRAY_CONSTRUCTORS.get(this.toString());if(t==null)throw Error(`unable to find array constructor for ${this.valueOf()}`);return t}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(e=>this.equals(e))}toString(t=!1){return t?e.SHORT_STRINGS.get(this.valueOf())??this.valueOf():this.valueOf()}get isVariable(){return this.equals(e.JSON)||this.equals(e.STRING)||this.equals(e.BYTES)}get isNumeric(){return!this.isVariable&&!this.equals(e.UUID)}get isInteger(){let e=this.toString();return e.startsWith(`int`)||e.startsWith(`uint`)}get isFloat(){return this.toString().startsWith(`float`)}get density(){let t=e.DENSITIES.get(this.toString());if(t==null)throw Error(`unable to find density for ${this.valueOf()}`);return t}get isUnsignedInteger(){return this.equals(e.UINT8)||this.equals(e.UINT16)||this.equals(e.UINT32)||this.equals(e.UINT64)}get isSignedInteger(){return this.equals(e.INT8)||this.equals(e.INT16)||this.equals(e.INT32)||this.equals(e.INT64)}canSafelyCastTo(t){return this.equals(t)?!0:!this.isNumeric||!t.isNumeric||this.isVariable||t.isVariable||this.isUnsignedInteger&&t.isSignedInteger?!1:this.isFloat?t.isFloat&&this.density.valueOf()<=t.density.valueOf():this.equals(e.INT32)&&t.equals(e.FLOAT64)||this.equals(e.INT8)&&t.equals(e.FLOAT32)?!0:this.isInteger&&t.isInteger?this.density.valueOf()<=t.density.valueOf()&&this.isUnsignedInteger===t.isUnsignedInteger:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}get usesBigInt(){return e.BIG_INT_TYPES.some(e=>e.equals(this))}static UNKNOWN=new e(`unknown`);static FLOAT64=new e(`float64`);static FLOAT32=new e(`float32`);static INT64=new e(`int64`);static INT32=new e(`int32`);static INT16=new e(`int16`);static INT8=new e(`int8`);static UINT64=new e(`uint64`);static UINT32=new e(`uint32`);static UINT16=new e(`uint16`);static UINT8=new e(`uint8`);static TIMESTAMP=new e(`timestamp`);static UUID=new e(`uuid`);static STRING=new e(`string`);static JSON=new e(`json`);static BYTES=new e(`bytes`);static ARRAY_CONSTRUCTORS=new Map([[e.UINT8.toString(),Uint8Array],[e.UINT16.toString(),Uint16Array],[e.UINT32.toString(),Uint32Array],[e.UINT64.toString(),BigUint64Array],[e.FLOAT32.toString(),Float32Array],[e.FLOAT64.toString(),Float64Array],[e.INT8.toString(),Int8Array],[e.INT16.toString(),Int16Array],[e.INT32.toString(),Int32Array],[e.INT64.toString(),BigInt64Array],[e.TIMESTAMP.toString(),BigInt64Array],[e.STRING.toString(),Uint8Array],[e.JSON.toString(),Uint8Array],[e.UUID.toString(),Uint8Array],[e.BYTES.toString(),Uint8Array]]);static ARRAY_CONSTRUCTOR_DATA_TYPES=new Map([[Uint8Array.name,e.UINT8],[Uint16Array.name,e.UINT16],[Uint32Array.name,e.UINT32],[BigUint64Array.name,e.UINT64],[Float32Array.name,e.FLOAT32],[Float64Array.name,e.FLOAT64],[Int8Array.name,e.INT8],[Int16Array.name,e.INT16],[Int32Array.name,e.INT32],[BigInt64Array.name,e.INT64]]);static DENSITIES=new Map([[e.UINT8.toString(),k.BIT8],[e.UINT16.toString(),k.BIT16],[e.UINT32.toString(),k.BIT32],[e.UINT64.toString(),k.BIT64],[e.FLOAT32.toString(),k.BIT32],[e.FLOAT64.toString(),k.BIT64],[e.INT8.toString(),k.BIT8],[e.INT16.toString(),k.BIT16],[e.INT32.toString(),k.BIT32],[e.INT64.toString(),k.BIT64],[e.TIMESTAMP.toString(),k.BIT64],[e.STRING.toString(),k.UNKNOWN],[e.JSON.toString(),k.UNKNOWN],[e.UUID.toString(),k.BIT128],[e.BYTES.toString(),k.UNKNOWN]]);static ALL=[e.UNKNOWN,e.UINT8,e.UINT16,e.UINT32,e.UINT64,e.INT8,e.INT16,e.INT32,e.INT64,e.FLOAT32,e.FLOAT64,e.TIMESTAMP,e.UUID,e.STRING,e.JSON,e.BYTES];static SHORT_STRINGS=new Map([[e.UINT8.toString(),`u8`],[e.UINT16.toString(),`u16`],[e.UINT32.toString(),`u32`],[e.UINT64.toString(),`u64`],[e.INT8.toString(),`i8`],[e.INT16.toString(),`i16`],[e.INT32.toString(),`i32`],[e.INT64.toString(),`i64`],[e.FLOAT32.toString(),`f32`],[e.FLOAT64.toString(),`f64`],[e.TIMESTAMP.toString(),`ts`],[e.UUID.toString(),`uuid`],[e.STRING.toString(),`str`],[e.JSON.toString(),`json`],[e.BYTES.toString(),`bytes`]]);static BIG_INT_TYPES=[e.INT64,e.UINT64,e.TIMESTAMP];static z=l.z.union([l.z.string().transform(t=>new e(t)),l.z.instanceof(e)])},M=class e extends b{constructor(e){y(e)&&(e=e.value),super(e.valueOf())}largerThan(e){return y(e)&&(e=e.value),this.valueOf()>e.valueOf()}smallerThan(e){return y(e)&&(e=e.value),this.valueOf()<e.valueOf()}add(t){return y(t)&&(t=t.value),new e(S(this.valueOf(),t.valueOf()))}sub(t){return y(t)&&(t=t.value),new e(x(this.valueOf(),t.valueOf()))}mult(t){return new e(C(this.valueOf(),t))}div(t){return new e($t(this.valueOf(),t))}truncate(t){return new e(Math.trunc(this.valueOf()/new e(t).valueOf())*new e(t).valueOf())}remainder(t){return e.bytes(this.valueOf()%new e(t).valueOf())}get gigabytes(){return this.valueOf()/e.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/e.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/e.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/e.TERABYTE.valueOf()}toString(){let t=this.truncate(e.TERABYTE),n=this.truncate(e.GIGABYTE),r=this.truncate(e.MEGABYTE),i=this.truncate(e.KILOBYTE),a=this.truncate(e.BYTE),o=t,s=n.sub(t),c=r.sub(n),l=i.sub(r),u=a.sub(i),d=``;return o.isZero||(d+=`${o.terabytes}TB `),s.isZero||(d+=`${s.gigabytes}GB `),c.isZero||(d+=`${c.megabytes}MB `),l.isZero||(d+=`${l.kilobytes}KB `),(!u.isZero||d===``)&&(d+=`${u.valueOf()}B`),d.trim()}static bytes(t=1){return new e(t)}static BYTE=new e(1);static kilobytes(t=1){return e.bytes(new e(t).valueOf()*1e3)}static KILOBYTE=e.kilobytes(1);static megabytes(t=1){return e.kilobytes(new e(t).valueOf()*1e3)}static MEGABYTE=e.megabytes(1);static gigabytes(t=1){return e.megabytes(new e(t).valueOf()*1e3)}static GIGABYTE=e.gigabytes(1);static terabytes(t){return e.gigabytes(new e(t).valueOf()*1e3)}static TERABYTE=e.terabytes(1);static ZERO=new e(0);static z=l.z.union([l.z.number().transform(t=>new e(t)),l.z.instanceof(e)]);get isZero(){return this.valueOf()===0}},wr=l.z.object({start:l.z.number(),end:l.z.number()}),Tr=l.z.union([l.z.instanceof(Uint8Array),l.z.instanceof(Uint16Array),l.z.instanceof(Uint32Array),l.z.instanceof(BigUint64Array),l.z.instanceof(Float32Array),l.z.instanceof(Float64Array),l.z.instanceof(Int8Array),l.z.instanceof(Int16Array),l.z.instanceof(Int32Array),l.z.instanceof(BigInt64Array)]),Er=e=>{let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===`bigint`||e instanceof E||e instanceof D||e instanceof Date},Dr=(e,t,n,r=0)=>e.usesBigInt&&!t.usesBigInt?Number(n)-Number(r):!e.usesBigInt&&t.usesBigInt?BigInt(n.valueOf())-BigInt(r.valueOf()):x(n,r),Or=A.z,kr=E.z,Ar=D.z,jr=O.z,Mr=M.z,Nr=j.z,Pr=A.boundedZ,Fr=class{now;localStartT=new E(0);lastSkew=D.ZERO;constructor(e=()=>E.now()){this.now=e}start(){this.localStartT=this.now()}end(e){let t=this.now().span(this.localStartT).valueOf()/2n;this.lastSkew=new D(this.localStartT.add(t).valueOf()-e.valueOf())}get skew(){return this.lastSkew}exceeds(e){let t=this.skew.valueOf();return(t<0n?-t:t)>new D(e).valueOf()}},Ir=o({by:()=>Rr,unique:()=>Lr}),Lr=e=>[...new Set(e)],Rr=(e,t,n=!0)=>{let r=new Map;return e.forEach(e=>{let i=t(e);if(r.has(i)){if(n)return;r.delete(i)}r.set(i,e)}),Array.from(r.values())},zr=(e,t=!1)=>{let n=ct(e)?`stringer`:typeof e,r;switch(n){case`string`:r=(e,t)=>e.localeCompare(t);break;case`stringer`:r=(e,t)=>e.toString().localeCompare(t.toString());break;case`number`:r=(e,t)=>Number(e)-Number(t);break;case`bigint`:r=(e,t)=>BigInt(e)-BigInt(t)>0n?1:-1;break;case`boolean`:r=(e,t)=>Number(e)-Number(t);break;case`undefined`:r=()=>0;break;default:return console.warn(`sortFunc: unknown type ${n}`),()=>-1}return t?Gr(r):r},Br=(e,t,n)=>{let r=zr(t[e],n);return(t,n)=>r(t[e],n[e])},Vr=(e,t)=>e.length===t.length?e.every((e,n)=>e===t[n])?0:-1:e.length-t.length,Hr=(e,t)=>{if(e.length!==t.length)return e.length-t.length;if(e.length===0)return 0;let n=zr(e[0]),r=[...e].sort(n),i=[...t].sort(n);return r.every((e,t)=>e===i[t])?0:-1},Ur=(e,t)=>Hr(Lr(e),Lr(t)),Wr=(e,t)=>e===t?0:e===`first`&&t===`last`?1:-1,Gr=e=>(t,n)=>e(n,t),Kr=e=>e<0,qr=e=>e>0,Jr=e=>e>=0,Yr=e=>e===0,Xr=(e,t)=>{let n=/([a-zA-Z]+)|(\d+)/g,r=e.replace(/[\s_.-]+/g,``).match(n),i=t.replace(/[\s_.-]+/g,``).match(n);if(!r||!i)return 0;for(let e=0;e<Math.min(r.length,i.length);e++){let t=r[e],n=i[e];if(isNaN(Number(t))&&isNaN(Number(n))){let e=t.localeCompare(n);if(e!==0)return e}else if(!isNaN(Number(t))&&!isNaN(Number(n))){let e=Number(t)-Number(n);if(e!==0)return e}else return isNaN(Number(t))?-1:1}return r.length-i.length},Zr=(e,t,n)=>{let r=0,i=e.length,a=n??zr(t);for(;r<i;){let n=Math.floor((r+i)/2),o=a(e[n],t);if(o===0)return n;o<0?r=n+1:i=n}return r},Qr=(e,t,n)=>{let r=Zr(e,t,n);e.splice(r,0,t)},$r=o({EQUAL:()=>0,GREATER_THAN:()=>1,LESS_THAN:()=>-1,insert:()=>Qr,isEqualTo:()=>Yr,isGreaterThan:()=>qr,isGreaterThanEqual:()=>Jr,isLessThan:()=>Kr,newF:()=>zr,newFieldF:()=>Br,order:()=>Wr,primitiveArrays:()=>Vr,reverseF:()=>Gr,search:()=>Zr,stringsWithNumbers:()=>Xr,uniqueUnorderedPrimitiveArrays:()=>Ur,unorderedPrimitiveArrays:()=>Hr}),ei=(e,t=21)=>(n=t)=>{let r=``,i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r},ti=o({LENGTH:()=>11,create:()=>oi}),ni=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,ri=`0123456789${ni}`,ii=ei(ni,1),ai=ei(ri,10),oi=()=>`${ii()}${ai()}`,si=o({createMatcher:()=>ci}),ci=(e,t)=>n=>n instanceof t||typeof n==`object`&&!!n&&`discriminator`in n&&n.discriminator===e,li=o({DIRECTIONS:()=>tn,construct:()=>N,crude:()=>ui,dimension:()=>fi,directionZ:()=>nn,isDirection:()=>mi,isX:()=>gi,isY:()=>_i,location:()=>pi,signedDimension:()=>hi,swap:()=>di}),ui=Sn,N=e=>tn.includes(e)?e:cn.includes(e)?`y`:`x`,di=e=>N(e)===`x`?`y`:`x`,fi=e=>N(e)===`x`?`width`:`height`,pi=e=>N(e)===`x`?`left`:`top`,mi=e=>ui.safeParse(e).success,hi=e=>N(e)===`x`?`signedWidth`:`signedHeight`,gi=e=>e===`center`?!1:N(e)===`x`,_i=e=>N(e)===`y`,vi=o({BOTTOM_CENTER:()=>Ii,BOTTOM_LEFT:()=>Mi,BOTTOM_RIGHT:()=>Ni,CENTER:()=>Pi,CENTER_LEFT:()=>Ri,CENTER_LOCATIONS:()=>un,CENTER_RIGHT:()=>Li,LOCATIONS:()=>fn,OUTER_LOCATIONS:()=>rn,TOP_CENTER:()=>Fi,TOP_LEFT:()=>F,TOP_RIGHT:()=>ji,XY_LOCATIONS:()=>zi,X_LOCATIONS:()=>on,Y_LOCATIONS:()=>cn,center:()=>xi,construct:()=>P,constructXY:()=>Ki,corner:()=>Ai,crude:()=>Ti,direction:()=>Oi,isX:()=>Ui,isY:()=>Wi,locationZ:()=>pn,outerZ:()=>Si,rotate:()=>Di,swap:()=>Ei,x:()=>yi,xy:()=>ki,xyCouple:()=>Hi,xyEquals:()=>Bi,xyMatches:()=>Vi,xyToString:()=>Gi,y:()=>bi}),yi=sn,bi=ln,xi=dn,Si=an,Ci={top:`bottom`,right:`left`,bottom:`top`,left:`right`,center:`center`},wi={top:{clockwise:`left`,counterclockwise:`right`},right:{clockwise:`top`,counterclockwise:`bottom`},bottom:{clockwise:`right`,counterclockwise:`left`},left:{clockwise:`bottom`,counterclockwise:`top`}},Ti=Cn,P=e=>e instanceof String||!tn.includes(e)?e:e===`x`?`left`:`top`,Ei=e=>Ci[P(e)],Di=(e,t)=>wi[e][t],Oi=e=>{let t=P(e);return t===`top`||t===`bottom`?`y`:`x`},ki=l.z.object({x:sn.or(dn),y:ln.or(dn)}),Ai=l.z.object({x:sn,y:ln}),F=Object.freeze({x:`left`,y:`top`}),ji=Object.freeze({x:`right`,y:`top`}),Mi=Object.freeze({x:`left`,y:`bottom`}),Ni=Object.freeze({x:`right`,y:`bottom`}),Pi=Object.freeze({x:`center`,y:`center`}),Fi=Object.freeze({x:`center`,y:`top`}),Ii=Object.freeze({x:`center`,y:`bottom`}),Li=Object.freeze({x:`right`,y:`center`}),Ri=Object.freeze({x:`left`,y:`center`}),zi=Object.freeze([Ri,Li,Fi,Ii,F,ji,Mi,Ni,Pi]),Bi=(e,t)=>e.x===t.x&&e.y===t.y,Vi=(e,t)=>{if(typeof t==`object`){let n=!0;return`x`in t&&e.x!==t.x&&(n=!1),`y`in t&&e.y!==t.y&&(n=!1),n}return e.x===t||e.y===t},Hi=e=>[e.x,e.y],Ui=e=>Oi(P(e))===`x`,Wi=e=>Oi(P(e))===`y`,Gi=e=>`${e.x}${de(e.y)}`,Ki=(e,t)=>{let n,r;if(typeof e==`object`&&`x`in e?(n=e.x,r=e.y):(n=P(e),r=P(t??e)),Oi(n)===Oi(r)&&n!==`center`&&r!==`center`)throw Error(`[XYLocation] - encountered two locations with the same direction: ${n.toString()} - ${r.toString()}`);let i={...Pi};return n===`center`?Ui(r)?[i.x,i.y]=[r,n]:[i.x,i.y]=[n,r]:Ui(n)?[i.x,i.y]=[n,r]:[i.x,i.y]=[r,n],i},qi=[`top`,`right`,`bottom`,`left`],Ji=l.z.enum(qi),I=l.z.object({x:l.z.number(),y:l.z.number()}),Yi=o({INFINITY:()=>Qi,NAN:()=>$i,ONE:()=>Zi,ZERO:()=>R,average:()=>_a,calculateMiters:()=>va,clientXyZ:()=>vn,construct:()=>L,couple:()=>da,crudeZ:()=>Xi,css:()=>fa,distance:()=>sa,equals:()=>ea,isFinite:()=>ua,isNan:()=>la,isZero:()=>ta,normal:()=>ha,normalize:()=>ga,reciprocal:()=>xa,rotate:()=>Sa,round:()=>ba,scale:()=>na,set:()=>oa,sub:()=>ma,swap:()=>ya,translate:()=>aa,translateX:()=>ra,translateY:()=>ia,translation:()=>ca,truncate:()=>pa,xyZ:()=>I}),Xi=l.z.union([l.z.number(),I,en,yn,bn,vn]),L=(e,t)=>{if(typeof e==`string`){if(t===void 0)throw Error(`The y coordinate must be given.`);return e===`x`?{x:t,y:0}:{x:0,y:t}}return typeof e==`number`?{x:e,y:t??e}:Array.isArray(e)?{x:e[0],y:e[1]}:`signedWidth`in e?{x:e.signedWidth,y:e.signedHeight}:`clientX`in e?{x:e.clientX,y:e.clientY}:`width`in e?{x:e.width,y:e.height}:{x:e.x,y:e.y}},R=Object.freeze({x:0,y:0}),Zi=Object.freeze({x:1,y:1}),Qi=Object.freeze({x:1/0,y:1/0}),$i=Object.freeze({x:NaN,y:NaN}),ea=(e,t,n=0)=>{let r=L(e),i=L(t);return n===0?r.x===i.x&&r.y===i.y:Math.abs(r.x-i.x)<=n&&Math.abs(r.y-i.y)<=n},ta=e=>ea(e,R),na=(e,t,n)=>{let r=L(e),i=L(t,n);return{x:r.x*i.x,y:r.y*i.y}},ra=(e,t)=>{let n=L(e);return{x:n.x+t,y:n.y}},ia=(e,t)=>{let n=L(e);return{x:n.x,y:n.y+t}},aa=(e,t,n,...r)=>{if(typeof t==`string`){if(typeof n!=`number`)throw Error(`The value must be a number.`);return t===`x`?ra(e,n):ia(e,n)}if(typeof t==`object`&&`x`in t&&typeof t.x==`string`){let r=L(n),i=L(e);return t.x===`left`?r.x=-r.x:t.x===`center`&&(r.x=0),t.y===`top`?r.y=-r.y:t.y===`center`&&(r.y=0),{x:i.x+r.x,y:i.y+r.y}}return[e,t,n??R,...r].reduce((e,t)=>{let n=L(t);return{x:e.x+n.x,y:e.y+n.y}},R)},oa=(e,t,n)=>{let r=L(e);return N(t)===`x`?{x:n,y:r.y}:{x:r.x,y:n}},sa=(e,t)=>{let n=L(e),r=L(t);return Math.sqrt((n.x-r.x)**2+(n.y-r.y)**2)},ca=(e,t)=>{let n=L(e),r=L(t);return{x:r.x-n.x,y:r.y-n.y}},la=e=>{let t=L(e);return Number.isNaN(t.x)||Number.isNaN(t.y)},ua=e=>{let t=L(e);return Number.isFinite(t.x)&&Number.isFinite(t.y)},da=e=>{let t=L(e);return[t.x,t.y]},fa=e=>{let t=L(e);return{left:t.x,top:t.y}},pa=(e,t=0)=>{let n=L(e);return{x:Number(n.x.toFixed(t)),y:Number(n.y.toFixed(t))}},ma=(e,t)=>{let n=L(e),r=L(t);return{x:n.x-r.x,y:n.y-r.y}},ha=e=>{let t=L(e),n=Math.hypot(t.x,t.y);return n===0?{x:0,y:0}:{x:-t.y/n,y:t.x/n}},ga=e=>{let t=L(e),n=Math.hypot(t.x,t.y);return n===0?{x:0,y:0}:{x:t.x/n,y:t.y/n}},_a=(...e)=>na(e.reduce((e,t)=>aa(e,t),R),1/e.length),va=(e,t)=>{let n=[];for(let r=0;r<e.length;r++){let i=e[r],a,o,s,c;if(r===0){let n=e[r+1];o=ha(ma(n,i)),s=o,c=t}else if(r===e.length-1){let n=e[r-1];a=ha(ma(i,n)),s=a,c=t}else{let n=e[r-1],l=e[r+1],u=ma(i,n),d=ma(l,i);a=ha(u),o=ha(d);let f=Math.acos((u.x*d.x+u.y*d.y)/(Math.hypot(u.x,u.y)*Math.hypot(d.x,d.y))),p=Math.sin(f/2);c=p===0?t:t/p,s=ga(_a(a,o))}n.push(na(s,c))}return n},ya=e=>{let t=L(e);return{x:t.y,y:t.x}},ba=e=>{let t=L(e);return{x:Math.round(t.x),y:Math.round(t.y)}},xa=e=>{let t=L(e);return{x:1/t.x,y:1/t.y}},Sa=(e,t,n)=>{let r=L(e),i=L(t),a=n===`clockwise`?Math.PI/2:-Math.PI/2,o=r.x-i.x,s=r.y-i.y,c=o*Math.cos(a)-s*Math.sin(a),l=o*Math.sin(a)+s*Math.cos(a);return{x:c+i.x,y:l+i.y}},Ca=o({DECIMAL:()=>ka,ZERO:()=>Oa,area:()=>co,areaIsZero:()=>Ra,aspect:()=>ao,bottom:()=>G,bottomCenter:()=>Ga,bottomLeft:()=>Wa,bottomRight:()=>Ka,box:()=>Da,center:()=>Ya,centerLeft:()=>qa,centerRight:()=>Ja,construct:()=>z,constructWithAlternateRoot:()=>uo,contains:()=>Ma,copy:()=>Aa,css:()=>Ia,cssBox:()=>Ta,dim:()=>La,dims:()=>Pa,domRect:()=>Ea,edgePoints:()=>no,equals:()=>Na,height:()=>U,intersection:()=>so,isBox:()=>io,left:()=>K,loc:()=>V,positionInCenter:()=>ro,reRoot:()=>to,resize:()=>ja,right:()=>W,root:()=>Qa,round:()=>fo,signedDims:()=>Fa,signedHeight:()=>Ba,signedWidth:()=>za,top:()=>q,topCenter:()=>Ha,topLeft:()=>Va,topRight:()=>Ua,translate:()=>oo,truncate:()=>lo,width:()=>H,x:()=>Xa,xBounds:()=>$a,xyLoc:()=>B,y:()=>Za,yBounds:()=>eo}),wa=l.z.union([l.z.number(),l.z.string()]),Ta=l.z.object({top:wa,left:wa,width:wa,height:wa}),Ea=l.z.object({left:l.z.number(),top:l.z.number(),right:l.z.number(),bottom:l.z.number()}),Da=l.z.object({one:I,two:I,root:Ai}),Oa={one:R,two:R,root:F},ka={one:R,two:Zi,root:Mi},Aa=(e,t)=>({one:e.one,two:e.two,root:t??e.root}),z=(e,t,n=0,r=0,i)=>{let a={one:{...R},two:{...R},root:i??F};if(typeof e==`number`){if(typeof t!=`number`)throw Error(`Box constructor called with invalid arguments`);return a.one={x:e,y:t},a.two={x:a.one.x+n,y:a.one.y+r},a}return`one`in e&&`two`in e&&`root`in e?{...e,root:i??e.root}:(`getBoundingClientRect`in e&&(e=e.getBoundingClientRect()),`left`in e?(a.one={x:e.left,y:e.top},a.two={x:e.right,y:e.bottom},a):(a.one=e,t==null?a.two={x:a.one.x+n,y:a.one.y+r}:typeof t==`number`?a.two={x:a.one.x+t,y:a.one.y+n}:`width`in t?a.two={x:a.one.x+t.width,y:a.one.y+t.height}:`signedWidth`in t?a.two={x:a.one.x+t.signedWidth,y:a.one.y+t.signedHeight}:a.two=t,a))},ja=(e,t,n)=>{let r=z(e);if(typeof t==`string`){if(n==null)throw Error(`Invalid arguments for resize`);let e=N(t);return z(r.one,void 0,e===`x`?n:H(r),e===`y`?n:U(r),r.root)}return z(r.one,t,void 0,void 0,r.root)},Ma=(e,t,n=!0)=>{let r=z(e),i=(e,t)=>e<t;return n&&(i=(e,t)=>e<=t),`one`in t?i(K(r),K(t))&&i(W(t),W(r))&&i(q(r),q(t))&&i(G(t),G(r)):i(K(r),t.x)&&i(t.x,W(r))&&i(q(r),t.y)&&i(t.y,G(r))},Na=(e,t)=>ea(e.one,t.one)&&ea(e.two,t.two)&&Bi(e.root,t.root),Pa=e=>({width:H(e),height:U(e)}),Fa=e=>({signedWidth:za(e),signedHeight:Ba(e)}),Ia=e=>({top:q(e),left:K(e),width:H(e),height:U(e)}),La=(e,t,n=!1)=>{let r=N(t)===`y`?Ba(e):za(e);return n?r:Math.abs(r)},B=(e,t)=>{let n=z(e);return{x:t.x===`center`?Ya(n).x:V(n,t.x),y:t.y===`center`?Ya(n).y:V(n,t.y)}},V=(e,t)=>{let n=z(e),r=Hi(n.root).includes(t)?Math.min:Math.max;return on.includes(t)?r(n.one.x,n.two.x):r(n.one.y,n.two.y)},Ra=e=>co(e)===0,H=e=>La(e,`x`),U=e=>La(e,`y`),za=e=>{let t=z(e);return t.two.x-t.one.x},Ba=e=>{let t=z(e);return t.two.y-t.one.y},Va=e=>B(e,F),Ha=e=>B(e,Fi),Ua=e=>B(e,ji),Wa=e=>B(e,Mi),Ga=e=>B(e,Ii),Ka=e=>B(e,Ni),qa=e=>B(e,Ri),Ja=e=>B(e,Li),W=e=>V(e,`right`),G=e=>V(e,`bottom`),K=e=>V(e,`left`),q=e=>V(e,`top`),Ya=e=>aa(Va(e),{x:za(e)/2,y:Ba(e)/2}),Xa=e=>{let t=z(e);return t.root.x===`left`?K(t):W(t)},Za=e=>{let t=z(e);return t.root.y===`top`?q(t):G(t)},Qa=e=>({x:Xa(e),y:Za(e)}),$a=e=>{let t=z(e);return{lower:t.one.x,upper:t.two.x}},eo=e=>{let t=z(e);return{lower:t.one.y,upper:t.two.y}},to=(e,t)=>Aa(e,t),no=(e,t)=>{let n=z(e),r=on.includes(t)?`x`:cn.includes(t)?`y`:null;if(r===null)throw Error(`Invalid location: ${t}`);let i=t===`top`||t===`left`?Math.min:Math.max,a={...n.one},o={...n.two};return a[r]=i(n.one[r],n.two[r]),o[r]=i(n.one[r],n.two[r]),[a,o]},ro=(e,t)=>{let n=z(e),r=z(t);return z({x:Xa(r)+(H(r)-H(n))/2,y:Za(r)+(U(r)-U(n))/2},Pa(n))},io=e=>typeof e!=`object`||!e?!1:`one`in e&&`two`in e&&`root`in e,ao=e=>H(e)/U(e),oo=(e,t,n)=>{if(typeof t==`string`){if(n==null)throw Error(`Undefined amount passed into box.translate`);t=L(N(t),n)}let r=z(e);return z(aa(r.one,t),aa(r.two,t),void 0,void 0,r.root)},so=(e,t)=>{let n=Math.max(K(e),K(t)),r=Math.max(q(e),q(t)),i=Math.min(W(e),W(t)),a=Math.min(G(e),G(t));return n>i||r>a?Oa:z({x:n,y:r},{x:i,y:a},void 0,void 0,e.root)},co=e=>H(e)*U(e),lo=(e,t)=>{let n=z(e);return z(pa(n.one,t),pa(n.two,t),void 0,void 0,n.root)},uo=(e,t,n,r,i,a)=>{let o={x:e,y:t},s={x:e+n,y:t+r};return i.x!==a.x&&(i.x===`center`?(o.x-=n/2,s.x-=n/2):(o.x-=n,s.x-=n)),i.y!==a.y&&(i.y===`center`?(o.y-=r/2,s.y-=r/2):(o.y-=r,s.y-=r)),z(o,s,void 0,void 0,a)},fo=e=>{let t=z(e);return z(ba(t.one),ba(t.two),void 0,void 0,t.root)},po=o({DECIMAL:()=>go,ZERO:()=>ho,construct:()=>J,couple:()=>bo,crude:()=>mo,dimensionsZ:()=>yn,equals:()=>_o,max:()=>xo,min:()=>So,scale:()=>Co,signedDimensionsZ:()=>bn,svgViewBox:()=>yo,swap:()=>vo}),mo=l.z.union([yn,bn,I,en]),ho={width:0,height:0},go={width:1,height:1},J=(e,t)=>typeof e==`number`?{width:e,height:t??e}:Array.isArray(e)?{width:e[0],height:e[1]}:`x`in e?{width:e.x,height:e.y}:`signedWidth`in e?{width:e.signedWidth,height:e.signedHeight}:{...e},_o=(e,t)=>{if(t==null)return!1;let n=J(e),r=J(t);return n.width===r.width&&n.height===r.height},vo=e=>{let t=J(e);return{width:t.height,height:t.width}},yo=e=>{let t=J(e);return`0 0 ${t.width} ${t.height}`},bo=e=>{let t=J(e);return[t.width,t.height]},xo=e=>({width:Math.max(...e.map(e=>J(e).width)),height:Math.max(...e.map(e=>J(e).height))}),So=e=>({width:Math.min(...e.map(e=>J(e).width)),height:Math.min(...e.map(e=>J(e).height))}),Co=(e,t)=>{let n=J(e);return{width:n.width*t,height:n.height*t}},wo=(e,t,n)=>t!==void 0&&e<t?t:n!==void 0&&e>n?n:e,To=o({Scale:()=>Po,XY:()=>Fo,crudeXYTransform:()=>Eo,transform:()=>Do}),Eo=l.z.object({offset:Xi,scale:Xi}),Do=l.z.object({offset:l.z.number(),scale:l.z.number()}),Oo=e=>(t,n,r,i)=>n===`dimension`?[t,r]:[t,i?r-e:r+e],ko=e=>(t,n,r,i)=>[t,i?r/e:r*e],Ao=e=>(t,n,r)=>{if(t===null)return[e,r];let{lower:i,upper:a}=t,{lower:o,upper:s}=e,c=a-i,l=s-o;return n===`dimension`?[e,l/c*r]:[e,(r-i)*(l/c)+o]},jo=e=>(t,n,r)=>[e,r],Mo=()=>(e,t,n)=>{if(e===null)throw Error(`cannot invert without bounds`);if(t===`dimension`)return[e,n];let{lower:r,upper:i}=e;return[e,i-(n-r)]},No=e=>(t,n,r)=>{let{lower:i,upper:a}=e;return r=wo(r,i,a),[t,r]},Po=class e{ops=[];currBounds=null;currType=null;reversed=!1;constructor(){this.ops=[]}static translate(t){return new e().translate(t)}static magnify(t){return new e().magnify(t)}static scale(t,n){return new e().scale(t,n)}translate(e){let t=this.new(),n=Oo(e);return n.type=`translate`,t.ops.push(n),t}magnify(e){let t=this.new(),n=ko(e);return n.type=`magnify`,t.ops.push(n),t}scale(e,t){let n=w(e,t),r=this.new(),i=Ao(n);return i.type=`scale`,r.ops.push(i),r}clamp(e,t){let n=w(e,t),r=this.new(),i=No(n);return i.type=`clamp`,r.ops.push(i),r}reBound(e,t){let n=w(e,t),r=this.new(),i=jo(n);return i.type=`re-bound`,r.ops.push(i),r}invert(){let e=Mo();e.type=`invert`;let t=this.new();return t.ops.push(e),t}pos(e){return this.exec(`position`,e)}dim(e){return this.exec(`dimension`,e)}new(){let t=new e;return t.ops=this.ops.slice(),t.reversed=this.reversed,t}exec(e,t){return this.currBounds=null,this.ops.reduce(([t,n],r)=>r(t,e,n,this.reversed),[null,t])[1]}reverse(){let e=this.new();e.ops.reverse();let t=[];return e.ops.forEach((n,r)=>{if(n.type===`scale`||t.some(([e,t])=>r>=e&&r<=t))return;let i=e.ops.findIndex((e,t)=>e.type===`scale`&&t>r);i!==-1&&t.push([r,i])}),t.forEach(([t,n])=>{let r=e.ops.slice(t,n);r.unshift(e.ops[n]),e.ops.splice(t,n-t+1,...r)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}static IDENTITY=new e},Fo=class e{x;y;currRoot;constructor(e=new Po,t=new Po,n=null){this.x=e,this.y=t,this.currRoot=n}static translate(t,n){return new e().translate(t,n)}static translateX(t){return new e().translateX(t)}static translateY(t){return new e().translateY(t)}static clamp(t){return new e().clamp(t)}static magnify(t){return new e().magnify(t)}static scale(t){return new e().scale(t)}static reBound(t){return new e().reBound(t)}translate(e,t){let n=L(e,t),r=this.copy();return r.x=this.x.translate(n.x),r.y=this.y.translate(n.y),r}translateX(e){let t=this.copy();return t.x=this.x.translate(e),t}translateY(e){let t=this.copy();return t.y=this.y.translate(e),t}magnify(e){let t=this.copy();return t.x=this.x.magnify(e.x),t.y=this.y.magnify(e.y),t}scale(e){let t=this.copy();if(io(e)){let n=this.currRoot;return t.currRoot=e.root,n!=null&&!Bi(n,e.root)&&(n.x!==e.root.x&&(t.x=t.x.invert()),n.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale($a(e)),t.y=t.y.scale(eo(e)),t}return t.x=t.x.scale(e.width),t.y=t.y.scale(e.height),t}reBound(e){let t=this.copy();return t.x=this.x.reBound($a(e)),t.y=this.y.reBound(eo(e)),t}clamp(e){let t=this.copy();return t.x=this.x.clamp($a(e)),t.y=this.y.clamp(eo(e)),t}copy(){let t=new e;return t.currRoot=this.currRoot,t.x=this.x,t.y=this.y,t}reverse(){let 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 z(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 e},Io=o({ALIGNMENTS:()=>mn,CENTER_LOCATIONS:()=>un,DIRECTIONS:()=>tn,LOCATIONS:()=>fn,ORDERS:()=>gn,OUTER_LOCATIONS:()=>rn,X_LOCATIONS:()=>on,Y_LOCATIONS:()=>cn,alignmentZ:()=>hn,boundsZ:()=>xn,centerLocationZ:()=>dn,clientXyZ:()=>vn,dimensionsZ:()=>yn,directionZ:()=>nn,locationZ:()=>pn,orderZ:()=>_n,outerLocationZ:()=>an,signedDimensionsZ:()=>bn,xLocationZ:()=>sn,xyZ:()=>I,yLocationZ:()=>ln}),Lo=o({calculate:()=>Ho,completeXY:()=>Ro,toCSS:()=>Bo,toDecimal:()=>Vo,xy:()=>zo}),Ro=I.extend({root:Ai,units:l.default.object({x:l.default.enum([`px`,`decimal`]),y:l.default.enum([`px`,`decimal`])})}),zo=Ro.partial({root:!0,units:!0}),Bo=e=>{let t={};return t[e.root?.x??`left`]=e?.units?.x===`px`?`${e.x}px`:`${e.x*100}%`,t[e.root?.y??`top`]=e?.units?.y===`px`?`${e.y}px`:`${e.y*100}%`,t},Vo=({position:e,element:t,container:n})=>{let r={x:e.x,y:e.y};return e.units?.x===`decimal`?e.root?.x===`right`&&(r.x=1-e.x):e.root?.x===`right`?r.x=1-(e.x+H(t))/H(n):r.x/=H(n),e.units?.y===`decimal`?e.root?.y===`bottom`&&(r.y=1-e.y):e.root?.y===`bottom`?r.y=1-(e.y+U(t))/U(n):r.y/=U(n),r},Ho=({position:e,element:t,container:n,lowerThreshold:r=.2,upperThreshold:i=.8})=>{let a={x:e.x,y:e.y,root:{...F},units:{x:`px`,y:`px`}};return e.x>i?(a.x=(1-e.x)*H(n)-H(t),a.root.x=`right`):e.x<r?a.x=e.x*H(n):a.units.x=`decimal`,e.y>i?(a.y=(1-e.y)*U(n)-U(t),a.root.y=`bottom`):e.y<r?a.y=e.y*U(n):a.units.y=`decimal`,a.x=Math.round(a.x*100)/100,{...a,...pa(a,3)}},Uo=l.z.enum([`static`,`dynamic`]),Wo=`00000000-0000-0000-0000-000000000000`,Go=/^(?:[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 Ko(e){return typeof e==`string`&&Go.test(e)}var Y=[];for(let e=0;e<256;++e)Y.push((e+256).toString(16).slice(1));function qo(e,t=0){return(Y[e[t+0]]+Y[e[t+1]]+Y[e[t+2]]+Y[e[t+3]]+`-`+Y[e[t+4]]+Y[e[t+5]]+`-`+Y[e[t+6]]+Y[e[t+7]]+`-`+Y[e[t+8]]+Y[e[t+9]]+`-`+Y[e[t+10]]+Y[e[t+11]]+Y[e[t+12]]+Y[e[t+13]]+Y[e[t+14]]+Y[e[t+15]]).toLowerCase()}function Jo(e,t=0){let n=qo(e,t);if(!Ko(n))throw TypeError(`Stringified UUID is invalid`);return n}var Yo,Xo=new Uint8Array(16);function Zo(){if(!Yo){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);Yo=crypto.getRandomValues.bind(crypto)}return Yo(Xo)}var Qo={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function $o(e,t,n){e||={};let r=e.random??e.rng?.()??Zo();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return qo(r)}function es(e,t,n){return Qo.randomUUID&&!t&&!e?Qo.randomUUID():$o(e,t,n)}var ts=o({ZERO:()=>is,create:()=>ns,parse:()=>rs}),ns=()=>es(),rs=(e,t)=>Jo(e,t),is=Wo,X=-1,as={[Symbol.iterator]:()=>as,next:()=>({done:!0,value:void 0})},os=l.z.string().transform(e=>new Uint8Array(atob(e).split(``).map(e=>e.charCodeAt(0))).buffer),ss=l.z.union([l.z.null(),l.z.undefined()]).transform(()=>new Uint8Array().buffer),Z=4,cs=(e,t)=>{if(e===`number`&&!t.isNumeric)throw Error(`cannot convert series of type ${t.toString()} to number`);if(e===`bigint`&&!t.usesBigInt)throw Error(`cannot convert series of type ${t.toString()} to bigint`)},ls=`sy_x_telem_series`,us=class e{key;discriminator=ls;dataType;sampleOffset;gl;_data;timeRange=A.ZERO;alignment=0n;alignmentMultiple=1n;cachedMin;cachedMax;writePos=X;_refCount=0;cachedLength;_cachedIndexes;static crudeZ=l.z.object({timeRange:A.z.optional(),dataType:j.z,alignment:l.z.coerce.bigint().optional(),data:l.z.union([os,ss,l.z.instanceof(ArrayBuffer),l.z.instanceof(Uint8Array)]),glBufferUsage:Uo.default(`static`).optional()});static z=e.crudeZ.transform(t=>new e(t));constructor(e){ds(e)&&(e={data:e}),e.data??=[];let{dataType:t,timeRange:n,sampleOffset:r=0,glBufferUsage:i=`static`,alignment:a=0n,alignmentMultiple:o=1n,key:s=oi(),data:c}=e;if(fs(c)){let e=c;this.key=e.key,this.dataType=e.dataType,this.sampleOffset=e.sampleOffset,this.gl=e.gl,this._data=e._data,this.timeRange=e.timeRange,this.alignment=e.alignment,this.alignmentMultiple=e.alignmentMultiple,this.cachedMin=e.cachedMin,this.cachedMax=e.cachedMax,this.writePos=e.writePos,this._refCount=e._refCount,this.cachedLength=e.cachedLength;return}let l=Er(c),u=Array.isArray(c);if(t!=null)this.dataType=new j(t);else if(c instanceof ArrayBuffer)throw Error(`cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.`);else if(u||l){let e=c;if(!l){if(c.length===0)throw Error(`cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.`);e=c[0]}if(typeof e==`string`)this.dataType=j.STRING;else if(typeof e==`number`)this.dataType=j.FLOAT64;else if(typeof e==`bigint`)this.dataType=j.INT64;else if(typeof e==`boolean`)this.dataType=j.UINT8;else if(e instanceof E||e instanceof Date||e instanceof E)this.dataType=j.TIMESTAMP;else if(typeof e==`object`)this.dataType=j.JSON;else throw Error(`cannot infer data type of ${typeof e} when constructing a Series from a JS array`)}else this.dataType=new j(c);if(!u&&!l)this._data=c;else if(u&&c.length===0)this._data=new this.dataType.Array([]).buffer;else{let e=l?[c]:c,t=e[0];if((t instanceof E||t instanceof Date||t instanceof D)&&(e=e.map(e=>new E(e).valueOf())),this.dataType.equals(j.STRING)){this.cachedLength=e.length;let t=e.map(e=>new TextEncoder().encode(e)),n=t.reduce((e,t)=>e+Z+t.byteLength,0),r=new ArrayBuffer(n),i=new DataView(r),a=new Uint8Array(r),o=0;for(let e of t)i.setUint32(o,e.byteLength,!0),o+=Z,a.set(e,o),o+=e.byteLength;this._data=r}else if(this.dataType.equals(j.JSON)){this.cachedLength=e.length;let t=e.map(e=>new TextEncoder().encode(gr.encodeString(e))),n=t.reduce((e,t)=>e+Z+t.byteLength,0),r=new ArrayBuffer(n),i=new DataView(r),a=new Uint8Array(r),o=0;for(let e of t)i.setUint32(o,e.byteLength,!0),o+=Z,a.set(e,o),o+=e.byteLength;this._data=r}else this.dataType.usesBigInt&&typeof t==`number`?this._data=new this.dataType.Array(e.map(e=>BigInt(Math.round(e)))).buffer:!this.dataType.usesBigInt&&typeof t==`bigint`?this._data=new this.dataType.Array(e.map(Number)).buffer:this._data=new this.dataType.Array(e).buffer}this.key=s,this.alignment=a,this.alignmentMultiple=o,this.sampleOffset=r??0,this.timeRange=n??A.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:i}}static alloc({capacity:t,dataType:n,...r}){if(t===0)throw Error(`[Series] - cannot allocate an array of length 0`);let i=new e({data:new new j(n).Array(t).buffer,dataType:n,...r});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 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===X)return 0;let t=this.byteCapacity.valueOf()-this.writePos,n=e.buffer,r=e.byteLength.valueOf(),i=new DataView(n),a=0,o=0;for(;a+Z<=r;){let e=Z+i.getUint32(a,!0);if(a+e>t)break;a+=e,o++}if(a===0)return 0;let s=e.subBytes(0,a);return this.writeToUnderlyingData(s),this.writePos+=a,this.cachedLength=(this.cachedLength??0)+o,this._cachedIndexes=void 0,o}writeFixed(e){if(this.writePos===X)return 0;let t=this.capacity-this.writePos,n=e.sub(0,t);return this.writeToUnderlyingData(n),this.cachedLength=void 0,this.maybeRecomputeMinMax(n),this.writePos+=n.length,n.length}writeToUnderlyingData(e){this.underlyingData.set(e.data,this.writePos)}get buffer(){return typeof this._data==`object`&&`buffer`in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===X?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(this.dataType.isVariable){let e=[],t=this.buffer,n=this.byteLength.valueOf(),r=new DataView(t),i=new TextDecoder,a=0;for(;a+Z<=n;){let n=r.getUint32(a,!0);a+=Z,e.push(i.decode(new Uint8Array(t,a,n))),a+=n}return e}return Array.from(this).map(e=>e.toString())}parseJSON(e){if(!this.dataType.equals(j.JSON))throw Error(`cannot parse non-JSON series as JSON`);return this.toStrings().map(t=>e.parse(gr.decodeString(t)))}get byteCapacity(){return new M(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===X?this.byteCapacity:this.dataType.isVariable?new M(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength==null?this.dataType.isVariable?this.calculateCachedLength():this.writePos===X?this.byteCapacity.valueOf()/this.dataType.density.valueOf():this.writePos:this.cachedLength}calculateCachedLength(){if(!this.dataType.isVariable)throw Error(`cannot calculate length of a non-variable length data type`);let e=0,t=[],n=this.buffer,r=this.byteLength.valueOf(),i=new DataView(n),a=0;for(;a+Z<=r;){let n=i.getUint32(a,!0);a+=Z,t.push(a),a+=n,e++}return this._cachedIndexes=t,this.cachedLength=e,e}convert(t,n=0){if(this.dataType.equals(t))return this;let r=new t.Array(this.length);for(let e=0;e<this.length;e++)r[e]=Dr(this.dataType,t,this.data[e],n);return new e({data:r.buffer,dataType:t,timeRange:this.timeRange,sampleOffset:n,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){return this.length===0?-1/0:(this.dataType.equals(j.TIMESTAMP)?this.cachedMax=this.data[this.data.length-1]:(this.dataType.usesBigInt,this.cachedMax=this.data.reduce((e,t)=>e>t?e:t)),this.cachedMax)}get max(){return this.calcMax()}calcMax(){if(this.dataType.isVariable)throw Error(`cannot calculate maximum on a variable length data type`);return this.writePos===0?-1/0:(this.cachedMax??=this.calcRawMax(),S(this.cachedMax,this.sampleOffset))}calcRawMin(){return this.length===0?1/0:(this.dataType.equals(j.TIMESTAMP)?this.cachedMin=this.data[0]:(this.dataType.usesBigInt,this.cachedMin=this.data.reduce((e,t)=>e<t?e:t)),this.cachedMin)}get min(){return this.calcMin()}calcMin(){if(this.dataType.isVariable)throw Error(`cannot calculate minimum on a variable length data type`);return this.writePos===0?1/0:(this.cachedMin??=this.calcRawMin(),S(this.cachedMin,this.sampleOffset))}get bounds(){return w(Number(this.min),Number(this.max),{makeValid:!1})}maybeRecomputeMinMax(e){if(this.cachedMin!=null){let t=e.cachedMin??e.calcRawMin();t<this.cachedMin&&(this.cachedMin=t)}if(this.cachedMax!=null){let t=e.cachedMax??e.calcRawMax();t>this.cachedMax&&(this.cachedMax=t)}}atAlignment(e,t){let n=Number((e-this.alignment)/this.alignmentMultiple);if(n<0||n>=this.length){if(t===!0)throw Error(`[series] - no value at index ${n}`);return}return this.at(n,t)}at(e,t=!1){if(this.dataType.isVariable)return this.atVariable(e,t??!1);if(this.dataType.equals(j.UUID))return this.atUUID(e,t);e<0&&(e=this.length+e);let n=this.data[e];if(n==null){if(t===!0)throw Error(`[series] - no value at index ${e}`);return}return S(n,this.sampleOffset)}atUUID(e,t){e<0&&(e=this.length+e);let n=rs(new Uint8Array(this.buffer,e*this.dataType.density.valueOf()));if(n==null){if(t)throw Error(`[series] - no value at index ${e}`);return}return n}atVariable(e,t){let n=0,r=0,i=this.buffer,a=new DataView(i);if(this._cachedIndexes!=null){if(e<0&&(e=this._cachedIndexes.length+e),e<0||e>=this._cachedIndexes.length){if(t)throw Error(`[series] - no value at index ${e}`);return}n=this._cachedIndexes[e],r=a.getUint32(n-Z,!0)}else{e<0&&(e=this.length+e);let i=this.byteLength.valueOf(),o=0,s=!1;for(;o+Z<=i;){let t=a.getUint32(o,!0);if(o+=Z,e===0){n=o,r=t,s=!0;break}o+=t,e--}if(!s){if(t)throw Error(`[series] - no value at index ${e}`);return}}let o=new Uint8Array(i,n,r);return this.dataType.equals(j.STRING)?new TextDecoder().decode(o):le(JSON.parse(new TextDecoder().decode(o)))}binarySearch(e){let t=0,n=this.length-1,r=zr(e);for(;t<=n;){let i=Math.floor((t+n)/2),a=r(this.at(i,!0),e);if(a===0)return i;a<0?t=i+1:n=i-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(j.FLOAT32)&&!this.dataType.equals(j.UINT8))throw Error(`Only FLOAT32 and UINT8 arrays can be used in WebGL`);let{buffer:t,bufferUsage:n,prevBuffer:r}=this.gl;if(t??(this.gl.buffer=e.createBuffer()),this.writePos!==r)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==X){r===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);let t=this.dataType.density.size(r).valueOf(),n=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,t,n.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=X}as(e){return cs(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:xs(this.alignmentBounds.lower),upper:xs(this.alignmentBounds.upper),multiple:this.alignmentMultiple},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}get alignmentBounds(){return w(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 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){let e=new ms(this);return this.dataType.equals(j.JSON)?new hs(e):e}return this.dataType.equals(j.UUID)?new gs(this):new _s(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new ps(this,e,t??this.length)}subAlignmentIterator(e,t){let n=Math.ceil(Number(e-this.alignment)/Number(this.alignmentMultiple)),r=Math.ceil(Number(t-this.alignment)/Number(this.alignmentMultiple));return new ps(this,n,r)}subBytes(t,n){return t>=0&&(n==null||n>=this.byteLength.valueOf())?this:new e({data:this.data.subarray(t,n),dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}sliceSub(t,n,r){if(n<=0&&(r==null||r>=this.length))return this;let i;return i=t?this.data.subarray(n,r):this.data.slice(n,r),new e({data:i,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(n)})}reAlign(t){return new e({data:this.buffer,dataType:this.dataType,timeRange:A.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:`static`,alignment:t})}toString(){let e=`Series(${this.dataType.toString()} ${this.length} [`;if(this.length<=10)e+=Array.from(this).map(e=>e.toString());else{for(let t=0;t<5;t++)e+=`${this.at(t)?.toString()}`,e+=`,`;e+=`...,`;for(let t=-5;t<0;t++)e+=this.at(t)?.toString(),t<-1&&(e+=`,`)}return e+=`])`,e}},ds=e=>e==null?!1:Array.isArray(e)||e instanceof ArrayBuffer||ArrayBuffer.isView(e)&&!(e instanceof DataView)||e instanceof us?!0:Er(e),fs=ci(ls,us),ps=class{series;end;index;constructor(e,t,n){this.series=e;let r=w(0,e.length+1);this.end=jn(r,n),this.index=jn(r,t)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},ms=class{series;byteOffset;decoder;view;constructor(e){if(!e.dataType.isVariable)throw Error(`cannot create a variable series iterator for a non-variable series`);this.series=e,this.byteOffset=0,this.decoder=new TextDecoder,this.view=new DataView(e.buffer)}next(){let e=this.series.byteLength.valueOf();if(this.byteOffset+Z>e)return{done:!0,value:void 0};let t=this.view.getUint32(this.byteOffset,!0);this.byteOffset+=Z;let n=this.decoder.decode(new Uint8Array(this.series.buffer,this.byteOffset,t));return this.byteOffset+=t,{done:!1,value:n}}},hs=class e{wrapped;static schema=l.z.record(l.z.string(),l.z.unknown());constructor(e){this.wrapped=e}next(){let t=this.wrapped.next();return t.done===!0?{done:!0,value:void 0}:{done:!1,value:gr.decodeString(t.value,e.schema)}}},gs=class{series;index;data;density;constructor(e){if(!e.dataType.equals(j.UUID))throw 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=j.UUID.density.valueOf()}next(){if(this.index>=this.series.length)return{done:!0,value:void 0};let e=rs(this.data,this.index*this.density);return this.index++,{done:!1,value:e}}},_s=class{series;index;constructor(e){this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},vs=class{series;constructor(e=[]){if(e.length!==0){let t=e[0].dataType;for(let n=1;n<e.length;n++)if(!e[n].dataType.equals(t))throw Error(`[multi-series] - series must have the same data type`)}this.series=e}as(e){return cs(e,this.dataType),this}get dataType(){return this.series.length===0?j.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?A.ZERO:new A(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?w(0n,0n):w(this.series[0].alignmentBounds.lower,this.series[this.series.length-1].alignmentBounds.upper)}push(e){let t=()=>Error(`cannot push a ${e.dataType.toString()} series to a ${this.dataType.toString()} multi-series`),n=e.dataType.equals(this.dataType);if(fs(e)){if(this.series.length!==0&&!n)throw t();this.series.push(e)}else{if(this.series.length!==0&&e.series.length!==0&&!n)throw t();this.series.push(...e.series)}}get length(){return this.series.reduce((e,t)=>e+t.length,0)}atAlignment(e,t){for(let n of this.series)if(T(n.alignmentBounds,e))return n.atAlignment(e,t);if(t)throw Error(`[series] - no value at alignment ${e}`)}at(e,t=!1){e<0&&(e=this.length+e);for(let n of this.series){if(e<n.length)return n.at(e,t);e-=n.length}if(t)throw Error(`[series] - no value at index ${e}`)}subIterator(e,t){return new bs(this,e,t??this.length)}subAlignmentIterator(e,t){if(e>=this.alignmentBounds.upper||t<=this.alignmentBounds.lower)return as;let n=0;for(let t=0;t<this.series.length;t++){let r=this.series[t];if(e<r.alignment)break;if(e>=r.alignmentBounds.upper)n+=r.length;else if(T(r.alignmentBounds,e)){n+=Math.ceil(Number(e-r.alignment)/Number(r.alignmentMultiple));break}}let r=0;for(let e=0;e<this.series.length;e++){let n=this.series[e];if(t<n.alignment)break;if(t>=n.alignmentBounds.upper)r+=n.length;else if(T(n.alignmentBounds,t)){r+=Math.ceil(Number(t-n.alignment)/Number(n.alignmentMultiple));break}}return new bs(this,n,r)}subAlignmentSpanIterator(e,t){if(e>=this.alignmentBounds.upper)return as;t=Math.min(t,Number(this.distance(e,this.alignmentBounds.upper)));let n=0;for(let t=0;t<this.series.length;t++){let r=this.series[t];if(e<r.alignment)break;if(e>=r.alignmentBounds.upper)n+=r.length;else if(T(r.alignmentBounds,e)){n+=Number(e-r.alignment);break}}return new bs(this,n,n+t)}updateGLBuffer(e){this.series.forEach(t=>t.updateGLBuffer(e))}get bounds(){return Rn(this.series.map(e=>e.bounds))}get byteLength(){return new M(this.series.reduce((e,t)=>e+t.byteLength.valueOf(),0))}get data(){let e=new this.dataType.Array(this.length),t=0;for(let n of this.series)e.set(n.data,t),t+=n.length;return new this.dataType.Array(e.buffer)}traverseAlignment(e,t){return Wn(this.series.map(e=>e.alignmentBounds),e,t)}acquire(e){this.series.forEach(t=>t.acquire(e))}release(){this.series.forEach(e=>e.release())}distance(e,t){return Gn(this.series.map(e=>e.alignmentBounds),e,t)}parseJSON(e){if(!this.dataType.equals(j.JSON))throw Error(`cannot parse non-JSON series as JSON`);return this.series.flatMap(t=>t.parseJSON(e))}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new ys(this.series)}toStrings(){return this.series.flatMap(e=>e.toStrings())}},ys=class{series;seriesIndex;internal;constructor(e){this.series=e,this.seriesIndex=0,this.internal=e[0][Symbol.iterator]()}next(){let 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}},bs=class{series;index;end;constructor(e,t,n){this.series=e,this.end=n,this.index=t}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}},xs=e=>({domain:e>>32n,sample:e&4294967295n}),Ss=o({ClockSkewCalculator:()=>Fr,DataType:()=>j,Density:()=>k,MultiSeries:()=>vs,Rate:()=>O,Series:()=>us,Size:()=>M,TimeRange:()=>A,TimeSpan:()=>D,TimeStamp:()=>E,convertDataType:()=>Dr,dataTypeZ:()=>Nr,isCrudeSeries:()=>ds,isTelemValue:()=>Er,numericTimeRangeZ:()=>wr,rateZ:()=>jr,sizeZ:()=>Mr,timeRangeBoundedZ:()=>Pr,timeRangeZ:()=>Or,timeSpanZ:()=>Ar,timeStampZ:()=>kr,typedArrayZ:()=>Tr}),Cs=o({sleep:()=>ws}),ws=async e=>await new Promise(t=>setTimeout(t,D.fromMilliseconds(e).milliseconds)),Ts=o({Breaker:()=>Es,breakerConfigZ:()=>Ds}),Es=class{config;retries;interval;constructor(e){this.config={baseInterval:new D(e?.baseInterval??D.seconds(1)),maxRetries:e?.maxRetries??5,scale:e?.scale??1,sleepFn:e?.sleepFn??ws},this.retries=0,this.interval=new D(this.config.baseInterval)}async wait(){let{maxRetries:e,scale:t,sleepFn:n}=this.config;return this.retries>=e?!1:(await n(this.interval),this.interval=this.interval.mult(t),this.retries++,!0)}get retryMessage(){return`breaker triggered ${this.retries+1}/${this.config.maxRetries} times, retrying in ${this.interval.toString()}`}reset(){this.retries=0,this.interval=this.config.baseInterval}},Ds=l.z.object({baseInterval:D.z.optional(),maxRetries:l.z.number().optional(),scale:l.z.number().optional()}),Os=o({Z:()=>ks}),ks=e=>l.z.object({variant:l.z.enum([`set`,`delete`]),key:l.z.string(),value:e}),As=l.z.string().regex(/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i),Q=nr,js=l.z.number().min(0).max(1),Ms=l.z.tuple([Q,Q,Q,js]),Ns=l.z.tuple([Q,Q,Q]),Ps=l.z.object({rgba255:Ms}),Fs=l.z.object({r:Q,g:Q,b:Q,a:js}),Is=l.z.number().min(0).max(360),Ls=l.z.number().min(0).max(100),Rs=l.z.number().min(0).max(100),zs=l.z.tuple([Is,Ls,Rs,js]),Bs=l.z.union([As,Ns,Ms,zs,Ps,Fs]),Vs=Bs.transform(e=>$(e)),Hs=e=>Vs.safeParse(e).success,Us=e=>Ms.safeParse(e).success,Ws=(e=>{if(e==null)return;let t=Vs.safeParse(e);if(t.success)return qs(t.data);if(typeof e==`string`)return e;throw t.error}),$=(e,t=1)=>{if(e=Bs.parse(e),typeof e==`string`)return dc(e,t);if(Array.isArray(e)){if(e.length<3||e.length>4)throw Error(`Invalid color: [${e.join(`, `)}]`);return e.length===3?[...e,t]:e}return`a`in e&&`r`in e?[e.r,e.g,e.b,e.a]:e.rgba255},Gs=(e,t)=>{if(e==null||t==null)return e==t;let n=$(e),r=$(t);return n.every((e,t)=>e===r[t])},Ks=(e=>{if(e==null)return;let[t,n,r,i]=$(e),a=Math.round(i*255);return`#${pc(t)}${pc(n)}${pc(r)}${a===255?``:pc(a)}`}),qs=e=>{let[t,n,r,i]=$(e);return`rgba(${t}, ${n}, ${r}, ${i})`},Js=e=>`rgb(${Ys(e)})`,Ys=e=>{let[t,n,r]=$(e);return`${t}, ${n}, ${r}`},Xs=e=>[...Zs(e),tc(e)],Zs=e=>[Qs(e)/255,$s(e)/255,ec(e)/255],Qs=e=>$(e)[0],$s=e=>$(e)[1],ec=e=>$(e)[2],tc=e=>$(e)[3],nc=e=>Gs(fc,e),rc=e=>bc($(e)),ic=(e,t)=>{let[n,r,i]=$(e);if(t>100)throw Error(`Color opacity must be between 0 and 100, got ${t}`);return t>1&&(t/=100),[n,r,i,t]},ac=e=>{let[t,n,r]=Zs(e).map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4);return Number((.2126*t+.7152*n+.0722*r).toFixed(3))},oc=e=>{let[t,n,r]=Zs(e);return 1-(Math.max(t,n,r)-Math.min(t,n,r))},sc=(e,t)=>{let n=$(e),r=$(t),i=ac(n),a=ac(r);return(Math.max(i,a)+.5)/(Math.min(i,a)+.5)},cc=(e,...t)=>{if(t.length===0)throw Error(`[Color.pickByContrast] - must provide at least one color`);let n=$(e),[r]=t.sort((e,t)=>sc(n,t)-sc(n,e));return $(r)},lc=e=>ac(e)<.5,uc=e=>ac(e)>.5,dc=(e,t=1)=>(e=As.parse(e),e=hc(e),[mc(e,0),mc(e,2),mc(e,4),e.length===8?mc(e,6)/255:t]),fc=[0,0,0,0],pc=e=>Math.floor(e).toString(16).padStart(2,`0`),mc=(e,t)=>parseInt(e.slice(t,t+2),16),hc=e=>e.startsWith(`#`)?e.slice(1):e,gc={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`},_c=e=>{if(!e)return;let t=e.trim().toLowerCase();if(!(t===`transparent`||t===`none`)){if(t.startsWith(`#`)){if(t.length===4){let e=t[1],n=t[2],r=t[3],i=`#${e}${e}${n}${n}${r}${r}`;if(As.safeParse(i).success)return dc(i)}return(t.length===7||t.length===9)&&As.safeParse(t).success?dc(t):void 0}if(t.startsWith(`rgb`)){let e=t.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);if(e){let[,t,n,r,i]=e;return[parseInt(t,10),parseInt(n,10),parseInt(r,10),i?parseFloat(i):1]}}if(gc[t])return dc(gc[t])}},vc=e=>{e=zs.parse(e);let[t,n,r]=e,i=e[3];t/=360,n/=100,r/=100;let a,o,s;if(n===0)a=o=s=r;else{let e=r<.5?r*(1+n):r+n-r*n,i=2*r-e;a=yc(i,e,t+1/3),o=yc(i,e,t),s=yc(i,e,t-1/3)}return[Math.round(a*255),Math.round(o*255),Math.round(s*255),i]},yc=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),bc=e=>{e=Ms.parse(e);let[t,n,r]=e,i=e[3];t/=255,n/=255,r/=255;let a=Math.max(t,n,r),o=Math.min(t,n,r),s,c,l=(a+o)/2;if(a===o)s=c=0;else{let e=a-o;c=l>.5?e/(2-a-o):e/(a+o),s=a===t?(n-r)/e+(n<r?6:0):a===n?(r-t)/e+2:(t-n)/e+4,s/=6}return s*=360,c*=100,l*=100,[Math.round(s),Math.round(c),Math.round(l),i]},xc=$(`#000000`),Sc=$(`#ffffff`),Cc=l.z.object({key:l.z.string(),color:Bs,position:l.z.number(),switched:l.z.boolean().optional()}),wc=l.z.array(Cc),Tc=(e,t)=>{if(e.length===0)return fc;if(e=e.slice().sort((e,t)=>e.position-t.position),t<=e[0].position)return $(e[0].color);if(t>=e[e.length-1].position)return $(e[e.length-1].color);for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1];if(t<r.position||t>i.position)continue;if(t===r.position)return $(r.color);if(t===i.position)return $(i.color);let a=(t-r.position)/(i.position-r.position),o=$(r.color),s=$(i.color);return $([Math.round(Qs(o)+a*(Qs(s)-Qs(o))),Math.round($s(o)+a*($s(s)-$s(o))),Math.round(ec(o)+a*(ec(s)-ec(o))),tc(o)+a*(tc(s)-tc(o))])}return $(e[e.length-1].color)},Ec=l.z.object({key:l.z.string(),name:l.z.string(),color:Vs}),Dc=l.z.object({key:l.z.string(),name:l.z.string(),swatches:l.z.array(Ec)}),Oc=o({BLACK:()=>xc,WHITE:()=>Sc,ZERO:()=>fc,aValue:()=>tc,bValue:()=>ec,colorZ:()=>Vs,construct:()=>$,contrast:()=>sc,crudeZ:()=>Bs,cssString:()=>Ws,equals:()=>Gs,fromCSS:()=>_c,fromGradient:()=>Tc,fromHSLA:()=>vc,gValue:()=>$s,gradientZ:()=>wc,grayness:()=>oc,hex:()=>Ks,hsla:()=>rc,isColor:()=>Us,isCrude:()=>Hs,isDark:()=>lc,isLight:()=>uc,isZero:()=>nc,luminance:()=>ac,paletteZ:()=>Dc,pickByContrast:()=>cc,rValue:()=>Qs,rgbCSS:()=>Js,rgbString:()=>Ys,rgba1:()=>Xs,rgbaCSS:()=>qs,setAlpha:()=>ic,stopZ:()=>Cc}),kc=nr,Ac=function(e){return e[e.exclusive=0]=`exclusive`,e[e.shared=1]=`shared`,e}({}),jc=l.z.enum(Ac),Mc=l.z.object({key:l.z.string(),name:l.z.string(),group:l.z.uint32().optional()}),Nc=e=>l.z.object({subject:Mc,resource:e,authority:kc}),Pc={lower:0,upper:256},Fc=(...e)=>t=>t.filter(t=>{let n=!1;return t.to!=null&&(n=e.includes(t.to.resource)),t.from!=null&&!n&&(n=e.includes(t.from.resource)),n}),Ic=e=>l.z.object({from:Nc(e),to:l.z.null().optional()}),Lc=e=>l.z.object({from:l.z.null().optional(),to:Nc(e)}),Rc=e=>l.z.union([Ic(e),Lc(e),l.z.object({from:Nc(e),to:Nc(e)})]),zc=o({ABSOLUTE_AUTHORITY:()=>255,AUTHORITY_BOUNDS:()=>Pc,Concurrency:()=>Ac,ZERO_AUTHORITY:()=>0,acquireZ:()=>Lc,authorityZ:()=>kc,concurrencyZ:()=>jc,filterTransfersByChannelKey:()=>Fc,releaseZ:()=>Ic,stateZ:()=>Nc,subjectZ:()=>Mc,transferZ:()=>Rc}),Bc=o({formatValue:()=>Vc}),Vc=e=>{switch(typeof e){case`bigint`:case`number`:return e.toString();case`boolean`:return e?`1`:`0`;case`undefined`:return``;case`string`:case`symbol`:case`function`:return Uc(e.toString());case`object`:return e==null?``:Uc(JSON.stringify(e))}},Hc=/[",\n]/,Uc=e=>Hc.test(e)?`"${e.replace(/"/g,`""`)}"`:e,Wc=(e,t)=>{let n=null;return t===0?e:(...r)=>{n!==null&&(clearTimeout(n),n=null),n=setTimeout(()=>e(...r),t)}},Gc=(e,t)=>{let n=null;return t===0?e:(...r)=>{n===null&&(n=setTimeout(()=>{e(...r),n=null},t))}},Kc=o({}),qc=o({ZERO_PRIMITIVES:()=>Zc,pointerZ:()=>Jc,primitiveTypeZ:()=>Xc,primitiveZ:()=>Yc}),Jc=l.z.string().regex(/^(?:$|(?:\/(?:[^~/]|~0|~1)*)+)$/,`must be a valid JSON pointer (RFC 6901)`),Yc=l.z.union([l.z.string(),l.z.number(),l.z.boolean(),l.z.null()]),Xc=l.z.enum([`string`,`number`,`boolean`,`null`]),Zc={string:``,number:0,boolean:!1,null:null},Qc=class{store=new Map;async get(e){return this.store.get(e)??null}async set(e,t){this.store.set(e,t)}async delete(e){this.store.delete(e)}async length(){return this.store.size}async clear(){this.store.clear()}},$c=class{store=new Map;get(e){return this.store.get(e)??null}set(e,t){this.store.set(e,t)}delete(e){this.store.delete(e)}},el=l.z.object({key:l.z.string(),value:l.z.string()}),tl=o({MockAsync:()=>Qc,MockSync:()=>$c,stringPairZ:()=>el}),nl=o({keyZ:()=>rl,labelZ:()=>il,newZ:()=>al}),rl=l.z.uuid(),il=l.z.object({key:rl,name:l.z.string().min(1),color:Vs}),al=il.partial({key:!0}),ol=o({is:()=>cl}),sl=RegExp(`^(https?:\\/\\/)?((([a-zA-Z0-9][a-zA-Z0-9-]*\\.)+[a-zA-Z]{2,})|localhost|(\\d{1,3}\\.){3}\\d{1,3})(\\:\\d+)?(\\/[-a-zA-Z0-9@:%._\\+~#=]*)*(\\?[;&a-zA-Z0-9%_.,~+=-]*)?(#[-a-zA-Z0-9_]*)?$`),cl=e=>sl.test(e),ll=o({getOrSetDefault:()=>ul}),ul=(e,t,n)=>{let r=e.get(t);return r===void 0?(e.set(t,n),n):r},dl=o({compareSemVer:()=>ml,createMigration:()=>vl,migrator:()=>yl,semVerNewer:()=>gl,semVerOlder:()=>_l,semVerZ:()=>fl,versionsEqual:()=>hl}),fl=l.z.string().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/),pl=(e,t)=>{let n=e.split(`.`),r=t.split(`.`),i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=n[e],i=r[e];if(t===void 0)return-1;if(i===void 0)return 1;let a=/^\d+$/.test(t),o=/^\d+$/.test(i);if(a&&!o)return-1;if(!a&&o)return 1;if(a&&o){let e=parseInt(t,10),n=parseInt(i,10);if(e<n)return-1;if(e>n)return 1}else{if(t<i)return-1;if(t>i)return 1}}return 0},ml=((e,t,n={})=>{n.checkMajor??=!0,n.checkMinor??=!0,n.checkPatch??=!0;let r=fl.parse(e),i=fl.parse(t),[a,o]=r.split(`-`),[s,c]=i.split(`-`),[l,u,d]=a.split(`.`).map(Number),[f,p,m]=s.split(`.`).map(Number);if(n.checkMajor){if(l<f)return-1;if(l>f)return 1}if(n.checkMinor){if(u<p)return-1;if(u>p)return 1}if(n.checkPatch){if(d<m)return-1;if(d>m)return 1}return o===void 0&&c===void 0?0:o===void 0?1:c===void 0?-1:pl(o,c)}),hl=(e,t,n={})=>Yr(ml(e,t,n)),gl=(e,t,n={})=>qr(ml(e,t,n)),_l=(e,t,n={})=>Kr(ml(e,t,n)),vl=({name:e,migrate:t})=>n=>{try{let r=t(n);return console.log(`${e} migrated: ${n.version} -> ${r.version}`),r}catch(t){throw console.log(`${e} failed to migrate from ${n.version}`),console.error(t),t}},yl=({name:e,migrations:t,targetSchema:n,defaultVersion:r,def:i})=>{let a=Object.keys(t).sort(ml).pop();if(a==null)return t=>{if(t.version??=r,t.version!==i.version)return console.log(`${e} version ${t.version} is newer than latest version of ${i.version}.
|
|
15
12
|
Returning default instead.
|
|
16
|
-
`),i;try{return n==null?t:n.parse(t)}catch(t){return console.log(`${e} failed to parse default. Exiting with default`),console.error(t),i}};let o=Object.keys(t).length,s=!1,c=n=>{try{if(o===0||
|
|
17
|
-
`))return`Description:\n${e}`;try{let t=JSON.parse(e);return`Description:\n${JSON.stringify(t,null,2)}`}catch{return`Description: ${e}`}},
|
|
13
|
+
`),i;try{return n==null?t:n.parse(t)}catch(t){return console.log(`${e} failed to parse default. Exiting with default`),console.error(t),i}};let o=Object.keys(t).length,s=!1,c=n=>{try{if(o===0||gl(n.version,a))return console.log(s?`${e} ${n.version} now up to date`:`${e} version ${n.version} is up to date with target version ${i.version}`),n;let r=t[n.version],l=r(n);return s=!0,c(l)}catch(t){return console.log(`${e} failed to migrate from ${n.version} to ${a}`),console.error(t),i}};return t=>{try{if(t.version==null)if(r!=null)console.log(`${e} version is null. Setting version to default of ${r}`),t.version=r;else return console.log(`${e} version is null and no default version set. Exiting with default`),i;return c(t)}catch(t){return console.log(`${e} failed to parse final result. Exiting with default`),console.error(t),i}}},bl=o({NOTATIONS:()=>xl,notationZ:()=>Sl,stringifyNumber:()=>Cl}),xl=[`standard`,`scientific`,`engineering`],Sl=l.z.enum(xl),Cl=(e,t,n)=>{if(Number.isNaN(e))return`NaN`;if(e===1/0)return`∞`;if(e===-1/0)return`-∞`;if(n===`standard`)return e.toFixed(t);if(e===0)return t===0?`0ᴇ0`:`0.${`0`.repeat(t)}ᴇ0`;let r;return r=n===`scientific`?Math.floor(Math.log10(Math.abs(e))):Math.floor(Math.log10(Math.abs(e))/3)*3,`${(e/10**r).toFixed(t)}ᴇ${r}`},wl=o({BaseObserver:()=>El,Observer:()=>Tl}),Tl=class{handlers;transform;closer;constructor(e,t){this.transform=e,this.handlers=t??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){let t=e;if(this.transform!=null){let[n,r]=this.transform(e);if(!r)return;t=n}this.handlers.forEach((e,n)=>n(t))}setCloser(e){this.closer=e}async close(){return await this.closer?.()}},El=class{handlers;constructor(e){this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((t,n)=>n(e))}},Dl=o({}),Ol=o({entries:()=>jl,keyZ:()=>kl,map:()=>Ml,nullishToEmpty:()=>Fl,omit:()=>Pl,purgeUndefined:()=>Nl,unknownZ:()=>Al}),kl=l.z.union([l.z.string(),l.z.number()]),Al=()=>l.z.record(kl,l.z.unknown()),jl=e=>Object.entries(e),Ml=(e,t)=>Object.fromEntries(jl(e).map(([e,n])=>[e,t(n,e)])),Nl=e=>Object.fromEntries(jl(e).filter(([e,t])=>t!==void 0)),Pl=(e,...t)=>{let n={...e};for(let e of t)delete n[e];return n},Fl=()=>l.z.union([l.z.union([l.z.null(),l.z.undefined()]).transform(()=>({})),Al()]),Il=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null?`node`:typeof window>`u`||window.document===void 0?`webworker`:`browser`,Ll=Il(),Rl=[`macOS`,`Windows`,`Linux`],zl=[`macos`,`windows`,`linux`],Bl={macos:`macOS`,windows:`Windows`,linux:`Linux`},Vl=l.z.enum(Rl).or(l.z.enum(zl).transform(e=>Bl[e])),Hl=()=>{if(typeof window>`u`)return;let e=window.navigator.userAgent.toLowerCase();if(e.includes(`mac`))return`macOS`;if(e.includes(`win`))return`Windows`;if(e.includes(`linux`))return`Linux`},Ul,Wl=((e={})=>{let{force:t,default:n}=e;return t??Ul??(Ul=Hl(),Ul??n)}),Gl=o({OPERATING_SYSTEMS:()=>Rl,RUNTIME:()=>Ll,detect:()=>Il,getOS:()=>Wl,osZ:()=>Vl}),Kl=o({flushMicrotasks:()=>ql,flushTaskQueue:()=>Jl}),ql=()=>Promise.resolve(),Jl=()=>new Promise(e=>setTimeout(e,0)),Yl=o({copy:()=>Xl}),Xl=e=>Array.isArray(e)?[...e]:typeof e==`object`&&e?{...e}:e,Zl=l.z.object({message:l.z.string().optional(),description:l.z.string().optional(),details:Al().optional()}),Ql=e=>`toStatus`in e&&typeof e.toStatus==`function`,$l=e=>{if(!Ql(e))return;let t;try{t=e.toStatus()}catch{return}let n=Zl.safeParse(t);return n.success?n.data:void 0},eu=l.z.object({stack:l.z.string(),error:l.z.instanceof(Error)}).and(Al()),tu=(e,t)=>{if(!(e instanceof Error))throw e;let n={variant:`error`,message:t??e.message,description:t==null?void 0:e.message,details:{stack:e.stack??``,error:e}},r=$l(e);return r!=null&&(t!=null&&r.message!=null?n.message=`${t}: ${r.message}`:r.message!=null&&(n.message=r.message),r.description!=null&&(n.description=r.description),r.details!=null&&n.details!=null&&(n.details={...n.details,...r.details})),nu(n)},nu=e=>({key:oi(),time:E.now(),name:``,...e}),ru=(e,t=[])=>{if(e!=null)return Array.isArray(t)?t.includes(e)?e:void 0:t===e?e:void 0},iu=(e,t=[])=>{if(e!=null)return Array.isArray(t)?t.includes(e)?void 0:e:t===e?void 0:e},au={includeTimestamp:!1,includeName:!0},ou=e=>{if(e.includes(`
|
|
14
|
+
`))return`Description:\n${e}`;try{let t=JSON.parse(e);return`Description:\n${JSON.stringify(t,null,2)}`}catch{return`Description: ${e}`}},su=(e,t={})=>{let n={...au,...t},r=[],i=e.variant.toUpperCase();if(n.includeName&&ut(e.name)&&(i+=` [${e.name}]`),i+=`: ${e.message}`,n.includeTimestamp&&(i+=` (${e.time.toString(`dateTime`,`local`)})`),r.push(i),e.description!=null&&r.push(ou(e.description)),`details`in e&&ve(e.details)){let t=e.details;`stack`in t&&typeof t.stack==`string`&&t.stack!==``&&r.push(`Stack Trace:\n${t.stack}`);let n=Object.fromEntries(Object.entries(t).filter(([e])=>e!==`stack`&&e!==`error`));Object.keys(n).length>0&&r.push(`Details:\n${JSON.stringify(n,null,2)}`)}return r.join(`
|
|
18
15
|
|
|
19
|
-
`)},su=[`success`,`info`,`warning`,`error`,`loading`,`disabled`],cu=l.z.enum(su),lu=l.z.literal(`success`),uu=l.z.literal(`info`),du=l.z.literal(`warning`),fu=l.z.literal(`error`),pu=l.z.literal(`loading`),mu=l.z.literal(`disabled`),hu=({details:e,v:t}={})=>l.z.object({key:l.z.string().default(()=>Hr()),name:l.z.string().default(``),variant:t??cu,message:l.z.string(),description:l.z.string().optional(),time:Io.default(()=>W.now()),details:e??l.z.unknown().optional(),labels:ye(rl.array())}),gu=({details:e,v:t}={})=>hu({details:e,v:t}).partial({key:!0,name:!0,time:!0}),_u=o({VARIANTS:()=>su,create:()=>tu,disabledVariantZ:()=>mu,errorVariantZ:()=>fu,exceptionDetailsSchema:()=>$l,fromException:()=>eu,infoVariantZ:()=>uu,keepVariants:()=>nu,loadingVariantZ:()=>pu,newZ:()=>gu,removeVariants:()=>ru,statusZ:()=>hu,successVariantZ:()=>lu,toString:()=>ou,variantZ:()=>cu,warningVariantZ:()=>du}),vu=(e,t)=>{if(!t.has(e))return e;let n,r,i=e;for(;t.has(i);){let e=i.match(yu);e?(n=i.slice(0,e.index).trim(),r=parseInt(e[1],10)+1):(n=i,r=1),i=`${n} (${r})`}return i},yu=/\((\d+)\)$/,bu=(e,t=``)=>{if(typeof e==`string`)return e;let n=e.length;return n===0?t:n===1?e[0]:n===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(`, `)}, and ${e[n-1]}`},xu=e=>{let t=e.split(` `),n=new Set,r=t.map(e=>e.charAt(0).toLowerCase()).join(``);n.add(r.replace(/-/g,`_`)),n.add(r.replace(/(.)(.)/g,`$1_$2`).replace(/-/g,`_`));let i=/\d+/g;e.match(i)&&t.forEach((e,r)=>{if(i.test(e)){let e=t.map((e,t)=>t===r?e:e.charAt(0).toLowerCase()).join(``);n.add(e.replace(/-/g,`_`)),n.add(e.replace(/(.)(.)/g,`$1_$2`).replace(/-/g,`_`))}});let a=t.map(e=>(e.length>3?e.substring(0,3):e).toLowerCase());return n.add(a.join(``).replace(/-/g,`_`)),n.add(a.join(`_`).replace(/-/g,`_`)),Array.from(n).filter(e=>e.length>=2&&e.length<=12&&!/^\d/.test(e))},Su=(e,t)=>e.startsWith(t)?e.slice(t.length):e,Cu=o({createShortIdentifiers:()=>xu,deduplicateFileName:()=>vu,naturalLanguageJoin:()=>bu,trimPrefix:()=>Su}),wu=Error(`request for lock canceled`),Tu=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},Eu=class{constructor(e,t=wu){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);return new Promise((n,r)=>{let i={resolve:n,reject:r,weight:e,priority:t},a=Ou(this._queue,e=>t<=e.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return Tu(this,arguments,void 0,function*(e,t=1,n=0){let[r,i]=yield this.acquire(t,n);try{return yield e(r)}finally{i()}})}waitForUnlock(e=1,t=0){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),Du(this._weightedWaiters[e-1],{resolve:n,priority:t})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw 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){let t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){let t=this._weightedWaiters[e-1];t&&(t.forEach(e=>e.resolve()),this._weightedWaiters[e-1]=[])}else{let e=this._queue[0].priority;for(let t=this._value;t>0;t--){let n=this._weightedWaiters[t-1];if(!n)continue;let r=n.findIndex(t=>t.priority<=e);(r===-1?n:n.splice(0,r)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}};function Du(e,t){let n=Ou(e,e=>t.priority<=e.priority);e.splice(n+1,0,t)}function Ou(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}var ku=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},Au=class{constructor(e){this._semaphore=new Eu(1,e)}acquire(){return ku(this,arguments,void 0,function*(e=0){let[,t]=yield this._semaphore.acquire(1,e);return t})}runExclusive(e,t=0){return this._semaphore.runExclusive(()=>e(),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}},ju=o({mutex:()=>Mu,newMutex:()=>Nu}),Mu=class extends Au{constructor(e){super(),Object.assign(this,e)}},Nu=e=>new Mu(e),Pu=o({expectAlways:()=>Iu,toString:()=>Fu}),Fu=e=>JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t),Iu=async(e,t=200,n=20)=>{let r=Date.now();for(;Date.now()-r<t;)await e(),await new Promise(e=>setTimeout(e,n))},Lu=(...e)=>e.map(Ru).join(``),Ru=e=>(e.endsWith(`/`)||(e+=`/`),e.startsWith(`/`)&&(e=e.slice(1)),e),zu=e=>e.endsWith(`/`)?e.slice(0,-1):e,Bu=(e,t=``)=>e===null?``:`?${Object.entries(e).filter(([,e])=>e==null?!1:Array.isArray(e)?e.length>0:!0).map(([e,n])=>`${t}${e}=${n}`).join(`&`)}`,Vu=class e{protocol;host;port;path;constructor({host:e,port:t,protocol:n=``,pathPrefix:r=``}){this.protocol=n,this.host=e,this.port=t,this.path=Ru(r)}replace(t){return new e({host:t.host??this.host,port:t.port??this.port,protocol:t.protocol??this.protocol,pathPrefix:t.pathPrefix??this.path})}child(t){return new e({...this,pathPrefix:Lu(this.path,t)})}toString(){return zu(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}static UNKNOWN=new e({host:`unknown`,port:0})},Hu=class{sender;handlers;constructor(e){this.sender=e,this.handlers=new Map}handle({data:e}){let t=this.handlers.get(e.type)?.handler;t==null?console.warn(`No handler for ${e.type}`):t(e.payload)}route(e){let t=new Wu(Uu(e,this.sender));return this.handlers.set(e,t),t}},Uu=(e,t)=>(n,r)=>t({type:e,payload:n},r),Wu=class{_send;handler;constructor(e){this._send=e,this.handler=null}send(e,t=[]){this._send(e,t)}handle(e){this.handler=e}},Gu=()=>{let e,t;return e=new Hu(e=>{t.handle({data:e})}),t=new Hu(t=>{e.handle({data:t})}),[e,t]};exports.DataType=J,exports.Density=K,exports.MultiSeries=_s,exports.OUTER_LOCATIONS=ki,exports.Rate=Ao,exports.RoutedWorker=Hu,exports.Series=ls,exports.Size=Y,exports.TimeRange=q,exports.TimeSpan=G,exports.TimeStamp=W,exports.TypedWorker=Wu,exports.URL=Vu,Object.defineProperty(exports,`array`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`binary`,{enumerable:!0,get:function(){return ur}}),Object.defineProperty(exports,`bounds`,{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(exports,`box`,{enumerable:!0,get:function(){return aa}}),Object.defineProperty(exports,`breaker`,{enumerable:!0,get:function(){return ws}}),exports.buildQueryString=Bu,Object.defineProperty(exports,`caseconv`,{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,`change`,{enumerable:!0,get:function(){return Ds}}),exports.clamp=ao,Object.defineProperty(exports,`color`,{enumerable:!0,get:function(){return Dc}}),Object.defineProperty(exports,`compare`,{enumerable:!0,get:function(){return Fr}}),Object.defineProperty(exports,`control`,{enumerable:!0,get:function(){return Rc}}),exports.convertDataType=Po,exports.createMockWorkers=Gu,Object.defineProperty(exports,`csv`,{enumerable:!0,get:function(){return zc}}),exports.dataTypeZ=Bo,exports.debounce=Uc,Object.defineProperty(exports,`deep`,{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,`destructor`,{enumerable:!0,get:function(){return Gc}}),Object.defineProperty(exports,`dimensions`,{enumerable:!0,get:function(){return Ja}}),Object.defineProperty(exports,`direction`,{enumerable:!0,get:function(){return Gr}}),Object.defineProperty(exports,`errors`,{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,`fmt`,{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,`id`,{enumerable:!0,get:function(){return Lr}}),Object.defineProperty(exports,`instance`,{enumerable:!0,get:function(){return Ur}}),exports.isCrudeSeries=us,exports.isTelemValue=No,Object.defineProperty(exports,`json`,{enumerable:!0,get:function(){return Kc}}),Object.defineProperty(exports,`kv`,{enumerable:!0,get:function(){return el}}),Object.defineProperty(exports,`label`,{enumerable:!0,get:function(){return tl}}),Object.defineProperty(exports,`link`,{enumerable:!0,get:function(){return al}}),Object.defineProperty(exports,`location`,{enumerable:!0,get:function(){return ei}}),Object.defineProperty(exports,`map`,{enumerable:!0,get:function(){return cl}}),Object.defineProperty(exports,`math`,{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(exports,`migrate`,{enumerable:!0,get:function(){return ul}}),Object.defineProperty(exports,`narrow`,{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,`notation`,{enumerable:!0,get:function(){return yl}}),exports.numericTimeRangeZ=jo,Object.defineProperty(exports,`observe`,{enumerable:!0,get:function(){return Cl}}),Object.defineProperty(exports,`optional`,{enumerable:!0,get:function(){return El}}),exports.outerLocationZ=Ai,Object.defineProperty(exports,`primitive`,{enumerable:!0,get:function(){return at}}),exports.rateZ=Ro,Object.defineProperty(exports,`record`,{enumerable:!0,get:function(){return Dl}}),Object.defineProperty(exports,`runtime`,{enumerable:!0,get:function(){return Wl}}),Object.defineProperty(exports,`scale`,{enumerable:!0,get:function(){return oo}}),Object.defineProperty(exports,`scheduler`,{enumerable:!0,get:function(){return Gl}}),Object.defineProperty(exports,`shallow`,{enumerable:!0,get:function(){return Jl}}),exports.sizeZ=zo,Object.defineProperty(exports,`sleep`,{enumerable:!0,get:function(){return Ss}}),Object.defineProperty(exports,`spatial`,{enumerable:!0,get:function(){return vo}}),Object.defineProperty(exports,`status`,{enumerable:!0,get:function(){return _u}}),Object.defineProperty(exports,`sticky`,{enumerable:!0,get:function(){return yo}}),Object.defineProperty(exports,`strings`,{enumerable:!0,get:function(){return Cu}}),Object.defineProperty(exports,`sync`,{enumerable:!0,get:function(){return ju}}),Object.defineProperty(exports,`telem`,{enumerable:!0,get:function(){return xs}}),Object.defineProperty(exports,`testutil`,{enumerable:!0,get:function(){return Pu}}),exports.throttle=Wc,exports.timeRangeBoundedZ=Vo,exports.timeRangeZ=Fo,exports.timeSpanZ=Lo,exports.timeStampZ=Io,exports.typedArrayZ=Mo,Object.defineProperty(exports,`unique`,{enumerable:!0,get:function(){return vr}}),Object.defineProperty(exports,`uuid`,{enumerable:!0,get:function(){return $o}}),Object.defineProperty(exports,`xy`,{enumerable:!0,get:function(){return ji}}),exports.xyZ=j,Object.defineProperty(exports,`zod`,{enumerable:!0,get:function(){return lr}});
|
|
16
|
+
`)},cu=[`success`,`info`,`warning`,`error`,`loading`,`disabled`],lu=l.z.enum(cu),uu=l.z.literal(`success`),du=l.z.literal(`info`),fu=l.z.literal(`warning`),pu=l.z.literal(`error`),mu=l.z.literal(`loading`),hu=l.z.literal(`disabled`),gu=({details:e,v:t}={})=>l.z.object({key:l.z.string().default(()=>oi()),name:l.z.string().default(``),variant:t??lu,message:l.z.string(),description:l.z.string().optional(),time:kr.default(()=>E.now()),details:e??l.z.unknown().optional(),labels:be(il.array())}),_u=({details:e,v:t}={})=>gu({details:e,v:t}).partial({key:!0,name:!0,time:!0}),vu=o({VARIANTS:()=>cu,create:()=>nu,disabledVariantZ:()=>hu,errorVariantZ:()=>pu,exceptionDetailsSchema:()=>eu,fromException:()=>tu,infoVariantZ:()=>du,keepVariants:()=>ru,loadingVariantZ:()=>mu,newZ:()=>_u,removeVariants:()=>iu,statusZ:()=>gu,successVariantZ:()=>uu,toString:()=>su,variantZ:()=>lu,warningVariantZ:()=>fu}),yu=(e,t)=>{if(!t.has(e))return e;let n,r,i=e;for(;t.has(i);){let e=i.match(bu);e?(n=i.slice(0,e.index).trim(),r=parseInt(e[1],10)+1):(n=i,r=1),i=`${n} (${r})`}return i},bu=/\((\d+)\)$/,xu=(e,t=``)=>{if(typeof e==`string`)return e;let n=e.length;return n===0?t:n===1?e[0]:n===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(`, `)}, and ${e[n-1]}`},Su=e=>{let t=e.split(` `),n=new Set,r=t.map(e=>e.charAt(0).toLowerCase()).join(``);n.add(r.replace(/-/g,`_`)),n.add(r.replace(/(.)(.)/g,`$1_$2`).replace(/-/g,`_`));let i=/\d+/g;e.match(i)&&t.forEach((e,r)=>{if(i.test(e)){let e=t.map((e,t)=>t===r?e:e.charAt(0).toLowerCase()).join(``);n.add(e.replace(/-/g,`_`)),n.add(e.replace(/(.)(.)/g,`$1_$2`).replace(/-/g,`_`))}});let a=t.map(e=>(e.length>3?e.substring(0,3):e).toLowerCase());return n.add(a.join(``).replace(/-/g,`_`)),n.add(a.join(`_`).replace(/-/g,`_`)),Array.from(n).filter(e=>e.length>=2&&e.length<=12&&!/^\d/.test(e))},Cu=(e,t)=>e.startsWith(t)?e.slice(t.length):e,wu=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),Tu=o({createShortIdentifiers:()=>Su,deduplicateFileName:()=>yu,escapeHTML:()=>wu,naturalLanguageJoin:()=>xu,trimPrefix:()=>Cu}),Eu=Error(`request for lock canceled`),Du=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},Ou=class{constructor(e,t=Eu){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);return new Promise((n,r)=>{let i={resolve:n,reject:r,weight:e,priority:t},a=Au(this._queue,e=>t<=e.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return Du(this,arguments,void 0,function*(e,t=1,n=0){let[r,i]=yield this.acquire(t,n);try{return yield e(r)}finally{i()}})}waitForUnlock(e=1,t=0){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),ku(this._weightedWaiters[e-1],{resolve:n,priority:t})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw 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){let t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){let t=this._weightedWaiters[e-1];t&&(t.forEach(e=>e.resolve()),this._weightedWaiters[e-1]=[])}else{let e=this._queue[0].priority;for(let t=this._value;t>0;t--){let n=this._weightedWaiters[t-1];if(!n)continue;let r=n.findIndex(t=>t.priority<=e);(r===-1?n:n.splice(0,r)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}};function ku(e,t){let n=Au(e,e=>t.priority<=e.priority);e.splice(n+1,0,t)}function Au(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}var ju=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},Mu=class{constructor(e){this._semaphore=new Ou(1,e)}acquire(){return ju(this,arguments,void 0,function*(e=0){let[,t]=yield this._semaphore.acquire(1,e);return t})}runExclusive(e,t=0){return this._semaphore.runExclusive(()=>e(),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}},Nu=o({mutex:()=>Pu,newMutex:()=>Fu}),Pu=class extends Mu{constructor(e){super(),Object.assign(this,e)}},Fu=e=>new Pu(e),Iu=o({expectAlways:()=>Ru,toString:()=>Lu}),Lu=e=>JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t),Ru=async(e,t=200,n=20)=>{let r=Date.now();for(;Date.now()-r<t;)await e(),await new Promise(e=>setTimeout(e,n))},zu=(...e)=>e.map(Bu).join(``),Bu=e=>(e.endsWith(`/`)||(e+=`/`),e.startsWith(`/`)&&(e=e.slice(1)),e),Vu=e=>e.endsWith(`/`)?e.slice(0,-1):e,Hu=(e,t=``)=>e===null?``:`?${Object.entries(e).filter(([,e])=>e==null?!1:Array.isArray(e)?e.length>0:!0).map(([e,n])=>`${t}${e}=${n}`).join(`&`)}`,Uu=class e{protocol;host;port;path;constructor({host:e,port:t,protocol:n=``,pathPrefix:r=``}){this.protocol=n,this.host=e,this.port=t,this.path=Bu(r)}replace(t){return new e({host:t.host??this.host,port:t.port??this.port,protocol:t.protocol??this.protocol,pathPrefix:t.pathPrefix??this.path})}child(t){return new e({...this,pathPrefix:zu(this.path,t)})}toString(){return Vu(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}static UNKNOWN=new e({host:`unknown`,port:0})},Wu=class{sender;handlers;constructor(e){this.sender=e,this.handlers=new Map}handle({data:e}){let t=this.handlers.get(e.type)?.handler;t==null?console.warn(`No handler for ${e.type}`):t(e.payload)}route(e){let t=new Ku(Gu(e,this.sender));return this.handlers.set(e,t),t}},Gu=(e,t)=>(n,r)=>t({type:e,payload:n},r),Ku=class{_send;handler;constructor(e){this._send=e,this.handler=null}send(e,t=[]){this._send(e,t)}handle(e){this.handler=e}},qu=()=>{let e,t;return e=new Wu(e=>{t.handle({data:e})}),t=new Wu(t=>{e.handle({data:t})}),[e,t]};exports.ClockSkewCalculator=Fr,exports.DataType=j,exports.Density=k,exports.MultiSeries=vs,exports.OUTER_LOCATIONS=qi,exports.Rate=O,exports.RoutedWorker=Wu,exports.Series=us,exports.Size=M,exports.TimeRange=A,exports.TimeSpan=D,exports.TimeStamp=E,exports.TypedWorker=Ku,exports.URL=Uu,Object.defineProperty(exports,`array`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`binary`,{enumerable:!0,get:function(){return fr}}),Object.defineProperty(exports,`bounds`,{enumerable:!0,get:function(){return wn}}),Object.defineProperty(exports,`box`,{enumerable:!0,get:function(){return Ca}}),Object.defineProperty(exports,`breaker`,{enumerable:!0,get:function(){return Ts}}),exports.buildQueryString=Hu,Object.defineProperty(exports,`caseconv`,{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,`change`,{enumerable:!0,get:function(){return Os}}),exports.clamp=wo,Object.defineProperty(exports,`color`,{enumerable:!0,get:function(){return Oc}}),Object.defineProperty(exports,`compare`,{enumerable:!0,get:function(){return $r}}),Object.defineProperty(exports,`control`,{enumerable:!0,get:function(){return zc}}),exports.convertDataType=Dr,exports.createMockWorkers=qu,Object.defineProperty(exports,`csv`,{enumerable:!0,get:function(){return Bc}}),exports.dataTypeZ=Nr,exports.debounce=Wc,Object.defineProperty(exports,`deep`,{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,`destructor`,{enumerable:!0,get:function(){return Kc}}),Object.defineProperty(exports,`dimensions`,{enumerable:!0,get:function(){return po}}),Object.defineProperty(exports,`direction`,{enumerable:!0,get:function(){return li}}),Object.defineProperty(exports,`errors`,{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,`fmt`,{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,`id`,{enumerable:!0,get:function(){return ti}}),Object.defineProperty(exports,`instance`,{enumerable:!0,get:function(){return si}}),exports.isCrudeSeries=ds,exports.isTelemValue=Er,Object.defineProperty(exports,`json`,{enumerable:!0,get:function(){return qc}}),Object.defineProperty(exports,`kv`,{enumerable:!0,get:function(){return tl}}),Object.defineProperty(exports,`label`,{enumerable:!0,get:function(){return nl}}),Object.defineProperty(exports,`link`,{enumerable:!0,get:function(){return ol}}),Object.defineProperty(exports,`location`,{enumerable:!0,get:function(){return vi}}),Object.defineProperty(exports,`map`,{enumerable:!0,get:function(){return ll}}),Object.defineProperty(exports,`math`,{enumerable:!0,get:function(){return Qn}}),Object.defineProperty(exports,`migrate`,{enumerable:!0,get:function(){return dl}}),Object.defineProperty(exports,`narrow`,{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,`notation`,{enumerable:!0,get:function(){return bl}}),exports.numericTimeRangeZ=wr,Object.defineProperty(exports,`observe`,{enumerable:!0,get:function(){return wl}}),Object.defineProperty(exports,`optional`,{enumerable:!0,get:function(){return Dl}}),exports.outerLocationZ=Ji,Object.defineProperty(exports,`primitive`,{enumerable:!0,get:function(){return st}}),exports.rateZ=jr,Object.defineProperty(exports,`record`,{enumerable:!0,get:function(){return Ol}}),Object.defineProperty(exports,`runtime`,{enumerable:!0,get:function(){return Gl}}),Object.defineProperty(exports,`scale`,{enumerable:!0,get:function(){return To}}),Object.defineProperty(exports,`scheduler`,{enumerable:!0,get:function(){return Kl}}),Object.defineProperty(exports,`shallow`,{enumerable:!0,get:function(){return Yl}}),exports.sizeZ=Mr,Object.defineProperty(exports,`sleep`,{enumerable:!0,get:function(){return Cs}}),Object.defineProperty(exports,`spatial`,{enumerable:!0,get:function(){return Io}}),Object.defineProperty(exports,`status`,{enumerable:!0,get:function(){return vu}}),Object.defineProperty(exports,`sticky`,{enumerable:!0,get:function(){return Lo}}),Object.defineProperty(exports,`strings`,{enumerable:!0,get:function(){return Tu}}),Object.defineProperty(exports,`sync`,{enumerable:!0,get:function(){return Nu}}),Object.defineProperty(exports,`telem`,{enumerable:!0,get:function(){return Ss}}),Object.defineProperty(exports,`testutil`,{enumerable:!0,get:function(){return Iu}}),exports.throttle=Gc,exports.timeRangeBoundedZ=Pr,exports.timeRangeZ=Or,exports.timeSpanZ=Ar,exports.timeStampZ=kr,exports.typedArrayZ=Tr,Object.defineProperty(exports,`unique`,{enumerable:!0,get:function(){return Ir}}),Object.defineProperty(exports,`uuid`,{enumerable:!0,get:function(){return ts}}),Object.defineProperty(exports,`xy`,{enumerable:!0,get:function(){return Yi}}),exports.xyZ=I,Object.defineProperty(exports,`zod`,{enumerable:!0,get:function(){return dr}});
|