@biongff/vizarr 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/biongff-vizarr.cjs.js +1 -1
- package/dist/biongff-vizarr.es.js +1 -1
- package/dist/{deflate-S7xbLfSs.cjs → deflate-CDNKi0Ty.cjs} +1 -1
- package/dist/{deflate-DXu_28mv.js → deflate-EUCpoeLy.js} +1 -1
- package/dist/{index--AwqafiW.cjs → index-BDDvUFxc.cjs} +3 -3
- package/dist/{index-1A0YtDpN.js → index-DmU6w2ak.js} +9 -9
- package/dist/{jpeg-CYZE8KIi.cjs → jpeg-DNqKm07P.cjs} +1 -1
- package/dist/{jpeg-C_9y-Trz.js → jpeg-D_Y1H-gH.js} +1 -1
- package/dist/{lerc-C-MYD14v.js → lerc-Ck7Ojtbb.js} +1 -1
- package/dist/{lerc-vOTtDjZs.cjs → lerc-pt3_s-G2.cjs} +1 -1
- package/dist/{lzw-DbiaNhue.js → lzw-5ykdy138.js} +1 -1
- package/dist/{lzw-ZT7VEqqB.cjs → lzw-CZPfIBvk.cjs} +1 -1
- package/dist/{packbits-fB9p028k.cjs → packbits-Dcq9Xl8T.cjs} +1 -1
- package/dist/{packbits-Dzelg0vK.js → packbits-TnW7FncW.js} +1 -1
- package/dist/{raw-BAVoArSO.js → raw-C6DT0DTv.js} +1 -1
- package/dist/{raw-WTo5b4ss.cjs → raw-CHi7PjRk.cjs} +1 -1
- package/dist/{ref-W1bFwlBa.js → ref-C6Hx8q8u.js} +1 -1
- package/dist/{ref-DIdrEHgO.cjs → ref-DDcdpHul.cjs} +1 -1
- package/dist/{webimage-wbmBu5Da.js → webimage-CoKhxnYQ.js} +1 -1
- package/dist/{webimage-RWZ2c6bg.cjs → webimage-Df8qZG7_.cjs} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var GA=Object.defineProperty;var O_=n=>{throw TypeError(n)};var JA=(n,e,t)=>e in n?GA(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var S=(n,e,t)=>JA(n,typeof e!="symbol"?e+"":e,t),jd=(n,e,t)=>e.has(n)||O_("Cannot "+t);var pe=(n,e,t)=>(jd(n,e,"read from private field"),t?t.call(n):e.get(n)),st=(n,e,t)=>e.has(n)?O_("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),$e=(n,e,t,r)=>(jd(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),St=(n,e,t)=>(jd(n,e,"access private method"),t);var zd=(n,e,t,r)=>({set _(s){$e(n,e,s,t)},get _(){return pe(n,e,r)}});const fe=require("react"),QA=require("@emotion/styled"),p0=require("@emotion/react"),ue=require("@mui/material"),nn=require("@mui/icons-material"),Fo=require("react-dom");function e4(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}function t4(n,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in n)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(n,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const Te=e4(fe),N2="1.4.
|
|
1
|
+
"use strict";var GA=Object.defineProperty;var O_=n=>{throw TypeError(n)};var JA=(n,e,t)=>e in n?GA(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var S=(n,e,t)=>JA(n,typeof e!="symbol"?e+"":e,t),jd=(n,e,t)=>e.has(n)||O_("Cannot "+t);var pe=(n,e,t)=>(jd(n,e,"read from private field"),t?t.call(n):e.get(n)),st=(n,e,t)=>e.has(n)?O_("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),$e=(n,e,t,r)=>(jd(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),St=(n,e,t)=>(jd(n,e,"access private method"),t);var zd=(n,e,t,r)=>({set _(s){$e(n,e,s,t)},get _(){return pe(n,e,r)}});const fe=require("react"),QA=require("@emotion/styled"),p0=require("@emotion/react"),ue=require("@mui/material"),nn=require("@mui/icons-material"),Fo=require("react-dom");function e4(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}function t4(n,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in n)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(n,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const Te=e4(fe),N2="1.4.1",Oc={black:"#000",white:"#fff"},fo={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},ho={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},po={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},mo={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},go={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},Da={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},vm={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};function Ys(n,...e){const t=new URL(`https://mui.com/production-error/?code=${n}`);return e.forEach(r=>t.searchParams.append("args[]",r)),`Minified MUI error #${n}; visit ${t} for the full message.`}const Ws="$$material";function n4(n){for(var e=0,t,r=0,s=n.length;s>=4;++r,s-=4)t=n.charCodeAt(r)&255|(n.charCodeAt(++r)&255)<<8|(n.charCodeAt(++r)&255)<<16|(n.charCodeAt(++r)&255)<<24,t=(t&65535)*1540483477+((t>>>16)*59797<<16),t^=t>>>24,e=(t&65535)*1540483477+((t>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(s){case 3:e^=(n.charCodeAt(r+2)&255)<<16;case 2:e^=(n.charCodeAt(r+1)&255)<<8;case 1:e^=n.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var r4={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function s4(n){var e=Object.create(null);return function(t){return e[t]===void 0&&(e[t]=n(t)),e[t]}}var i4=/[A-Z]|^ms/g,o4=/_EMO_([^_]+?)_([^]*?)_EMO_/g,D2=function(e){return e.charCodeAt(1)===45},k_=function(e){return e!=null&&typeof e!="boolean"},Wd=s4(function(n){return D2(n)?n:n.replace(i4,"-$&").toLowerCase()}),M_=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(o4,function(r,s,i){return Us={name:s,styles:i,next:Us},s})}return r4[e]!==1&&!D2(e)&&typeof t=="number"&&t!==0?t+"px":t};function ff(n,e,t){if(t==null)return"";var r=t;if(r.__emotion_styles!==void 0)return r;switch(typeof t){case"boolean":return"";case"object":{var s=t;if(s.anim===1)return Us={name:s.name,styles:s.styles,next:Us},s.name;var i=t;if(i.styles!==void 0){var o=i.next;if(o!==void 0)for(;o!==void 0;)Us={name:o.name,styles:o.styles,next:Us},o=o.next;var a=i.styles+";";return a}return a4(n,e,t)}}var c=t;return c}function a4(n,e,t){var r="";if(Array.isArray(t))for(var s=0;s<t.length;s++)r+=ff(n,e,t[s])+";";else for(var i in t){var o=t[i];if(typeof o!="object"){var a=o;k_(a)&&(r+=Wd(i)+":"+M_(i,a)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&e==null)for(var c=0;c<o.length;c++)k_(o[c])&&(r+=Wd(i)+":"+M_(i,o[c])+";");else{var l=ff(n,e,o);switch(i){case"animation":case"animationName":{r+=Wd(i)+":"+l+";";break}default:r+=i+"{"+l+"}"}}}return r}var N_=/label:\s*([^\s;{]+)\s*(;|$)/g,Us;function c4(n,e,t){if(n.length===1&&typeof n[0]=="object"&&n[0]!==null&&n[0].styles!==void 0)return n[0];var r=!0,s="";Us=void 0;var i=n[0];if(i==null||i.raw===void 0)r=!1,s+=ff(t,e,i);else{var o=i;s+=o[0]}for(var a=1;a<n.length;a++)if(s+=ff(t,e,n[a]),r){var c=i;s+=c[a]}N_.lastIndex=0;for(var l="",u;(u=N_.exec(s))!==null;)l+="-"+u[1];var h=n4(s)+l;return{name:h,styles:s,next:Us}}function wl(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function l4(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}),t}var iu={exports:{}},ou={exports:{}},pt={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|
|
@@ -118,7 +118,7 @@ theme.transitions = createTransitions(theme.transitions || {});
|
|
|
118
118
|
|
|
119
119
|
export default theme;`}function pv(n){return typeof n=="number"?`${(n*100).toFixed(0)}%`:`calc((${n}) * 100%)`}const PR=n=>{if(!Number.isNaN(+n))return+n;const e=n.match(/\d*\.?\d+/g);if(!e)return 0;let t=0;for(let r=0;r<e.length;r+=1)t+=+e[r];return t};function OR(n){Object.assign(n,{alpha(e,t){const r=this||n;return r.colorSpace?`oklch(from ${e} l c h / ${typeof t=="string"?`calc(${t})`:t})`:r.vars?`rgba(${e.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g,"var(--$1Channel)")} / ${typeof t=="string"?`calc(${t})`:t})`:K2(e,PR(t))},lighten(e,t){const r=this||n;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${e}, #fff ${pv(t)})`:td(e,t)},darken(e,t){const r=this||n;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${e}, #000 ${pv(t)})`:ed(e,t)}})}function Tm(n={},...e){const{breakpoints:t,mixins:r={},spacing:s,palette:i={},transitions:o={},typography:a={},shape:c,colorSpace:l,...u}=n;if(n.vars&&n.generateThemeVars===void 0)throw new Error(process.env.NODE_ENV!=="production"?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.":Ys(20));const h=R0({...i,colorSpace:l}),d=x0(n);let p=zn(d,{mixins:_R(d.breakpoints,r),palette:h,shadows:TR.slice(),typography:iw(h,a),transitions:CR(o),zIndex:{...RR}});if(p=zn(p,u),p=e.reduce((m,g)=>zn(m,g),p),process.env.NODE_ENV!=="production"){const m=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],g=(y,x)=>{let b;for(b in y){const v=y[b];if(m.includes(b)&&Object.keys(v).length>0){if(process.env.NODE_ENV!=="production"){const _=w0("",b);console.error([`MUI: The \`${x}\` component increases the CSS specificity of the \`${b}\` internal state.`,"You can not override it like this: ",JSON.stringify(y,null,2),"",`Instead, you need to use the '&.${_}' syntax:`,JSON.stringify({root:{[`&.${_}`]:v}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
|
|
120
120
|
`))}y[b]={}}}};Object.keys(p.components).forEach(y=>{const x=p.components[y].styleOverrides;x&&y.startsWith("Mui")&&g(x,y)})}return p.unstable_sxConfig={...Jh,...u==null?void 0:u.unstable_sxConfig},p.unstable_sx=function(g){return Vi({sx:g,theme:this})},p.toRuntimeSource=ow,OR(p),p}function kR(n){let e;return n<1?e=5.11916*n**2:e=4.5*Math.log(n+1)+2,Math.round(e*10)/1e3}const MR=[...Array(25)].map((n,e)=>{if(e===0)return"none";const t=kR(e);return`linear-gradient(rgba(255 255 255 / ${t}), rgba(255 255 255 / ${t}))`});function aw(n){return{inputPlaceholder:n==="dark"?.5:.42,inputUnderline:n==="dark"?.7:.42,switchTrackDisabled:n==="dark"?.2:.12,switchTrack:n==="dark"?.3:.38}}function cw(n){return n==="dark"?MR:[]}function NR(n){const{palette:e={mode:"light"},opacity:t,overlays:r,colorSpace:s,...i}=n,o=R0({...e,colorSpace:s});return{palette:o,opacity:{...aw(o.mode),...t},overlays:r||cw(o.mode),...i}}function DR(n){var e;return!!n[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!n[0].match(/sxConfig$/)||n[0]==="palette"&&!!((e=n[1])!=null&&e.match(/(mode|contrastThreshold|tonalOffset)/))}const LR=n=>[...[...Array(25)].map((e,t)=>`--${n?`${n}-`:""}overlays-${t}`),`--${n?`${n}-`:""}palette-AppBar-darkBg`,`--${n?`${n}-`:""}palette-AppBar-darkColor`],FR=n=>(e,t)=>{const r=n.rootSelector||":root",s=n.colorSchemeSelector;let i=s;if(s==="class"&&(i=".%s"),s==="data"&&(i="[data-%s]"),s!=null&&s.startsWith("data-")&&!s.includes("%s")&&(i=`[${s}="%s"]`),n.defaultColorScheme===e){if(e==="dark"){const o={};return LR(n.cssVarPrefix).forEach(a=>{o[a]=t[a],delete t[a]}),i==="media"?{[r]:t,"@media (prefers-color-scheme: dark)":{[r]:o}}:i?{[i.replace("%s",e)]:o,[`${r}, ${i.replace("%s",e)}`]:t}:{[r]:{...t,...o}}}if(i&&i!=="media")return`${r}, ${i.replace("%s",String(e))}`}else if(e){if(i==="media")return{[`@media (prefers-color-scheme: ${String(e)})`]:{[r]:t}};if(i)return i.replace("%s",String(e))}return r};function BR(n,e){e.forEach(t=>{n[t]||(n[t]={})})}function le(n,e,t){!n[e]&&t&&(n[e]=t)}function Qa(n){return typeof n!="string"||!n.startsWith("hsl")?n:Y2(n)}function Xr(n,e){`${e}Channel`in n||(n[`${e}Channel`]=Ja(Qa(n[e]),`MUI: Can't create \`palette.${e}Channel\` because \`palette.${e}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
|
|
121
|
-
To suppress this warning, you need to explicitly provide the \`palette.${e}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function UR(n){return typeof n=="number"?`${n}px`:typeof n=="string"||typeof n=="function"||Array.isArray(n)?n:"8px"}const Er=n=>{try{return n()}catch{}},$R=(n="mui")=>sR(n);function tp(n,e,t,r,s){if(!t)return;t=t===!0?{}:t;const i=s==="dark"?"dark":"light";if(!r){e[s]=NR({...t,palette:{mode:i,...t==null?void 0:t.palette},colorSpace:n});return}const{palette:o,...a}=Tm({...r,palette:{mode:i,...t==null?void 0:t.palette},colorSpace:n});return e[s]={...t,palette:o,opacity:{...aw(i),...t==null?void 0:t.opacity},overlays:(t==null?void 0:t.overlays)||cw(i)},a}function VR(n={},...e){const{colorSchemes:t={light:!0},defaultColorScheme:r,disableCssColorScheme:s=!1,cssVarPrefix:i="mui",nativeColor:o=!1,shouldSkipGeneratingVar:a=DR,colorSchemeSelector:c=t.light&&t.dark?"media":void 0,rootSelector:l=":root",...u}=n,h=Object.keys(t)[0],d=r||(t.light&&h!=="light"?"light":h),p=$R(i),{[d]:m,light:g,dark:y,...x}=t,b={...x};let v=m;if((d==="dark"&&!("dark"in t)||d==="light"&&!("light"in t))&&(v=!0),!v)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${d}\` option is either missing or invalid.`:Ys(21,d));let _;o&&(_="oklch");const w=tp(_,b,v,u,d);g&&!b.light&&tp(_,b,g,void 0,"light"),y&&!b.dark&&tp(_,b,y,void 0,"dark");let E={defaultColorScheme:d,...w,cssVarPrefix:i,colorSchemeSelector:c,rootSelector:l,getCssVar:p,colorSchemes:b,font:{...yR(w.typography),...w.font},spacing:UR(u.spacing)};Object.keys(E.colorSchemes).forEach(te=>{const R=E.colorSchemes[te].palette,re=de=>{const L=de.split("-"),j=L[1],H=L[2];return p(de,R[j][H])};R.mode==="light"&&(le(R.common,"background","#fff"),le(R.common,"onBackground","#000")),R.mode==="dark"&&(le(R.common,"background","#000"),le(R.common,"onBackground","#fff"));function q(de,L,j){if(_){let H;return de===pi&&(H=`transparent ${((1-j)*100).toFixed(0)}%`),de===xt&&(H=`#000 ${(j*100).toFixed(0)}%`),de===bt&&(H=`#fff ${(j*100).toFixed(0)}%`),`color-mix(in ${_}, ${L}, ${H})`}return de(L,j)}if(BR(R,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),R.mode==="light"){le(R.Alert,"errorColor",q(xt,R.error.light,.6)),le(R.Alert,"infoColor",q(xt,R.info.light,.6)),le(R.Alert,"successColor",q(xt,R.success.light,.6)),le(R.Alert,"warningColor",q(xt,R.warning.light,.6)),le(R.Alert,"errorFilledBg",re("palette-error-main")),le(R.Alert,"infoFilledBg",re("palette-info-main")),le(R.Alert,"successFilledBg",re("palette-success-main")),le(R.Alert,"warningFilledBg",re("palette-warning-main")),le(R.Alert,"errorFilledColor",Er(()=>R.getContrastText(R.error.main))),le(R.Alert,"infoFilledColor",Er(()=>R.getContrastText(R.info.main))),le(R.Alert,"successFilledColor",Er(()=>R.getContrastText(R.success.main))),le(R.Alert,"warningFilledColor",Er(()=>R.getContrastText(R.warning.main))),le(R.Alert,"errorStandardBg",q(bt,R.error.light,.9)),le(R.Alert,"infoStandardBg",q(bt,R.info.light,.9)),le(R.Alert,"successStandardBg",q(bt,R.success.light,.9)),le(R.Alert,"warningStandardBg",q(bt,R.warning.light,.9)),le(R.Alert,"errorIconColor",re("palette-error-main")),le(R.Alert,"infoIconColor",re("palette-info-main")),le(R.Alert,"successIconColor",re("palette-success-main")),le(R.Alert,"warningIconColor",re("palette-warning-main")),le(R.AppBar,"defaultBg",re("palette-grey-100")),le(R.Avatar,"defaultBg",re("palette-grey-400")),le(R.Button,"inheritContainedBg",re("palette-grey-300")),le(R.Button,"inheritContainedHoverBg",re("palette-grey-A100")),le(R.Chip,"defaultBorder",re("palette-grey-400")),le(R.Chip,"defaultAvatarColor",re("palette-grey-700")),le(R.Chip,"defaultIconColor",re("palette-grey-700")),le(R.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),le(R.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),le(R.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),le(R.LinearProgress,"primaryBg",q(bt,R.primary.main,.62)),le(R.LinearProgress,"secondaryBg",q(bt,R.secondary.main,.62)),le(R.LinearProgress,"errorBg",q(bt,R.error.main,.62)),le(R.LinearProgress,"infoBg",q(bt,R.info.main,.62)),le(R.LinearProgress,"successBg",q(bt,R.success.main,.62)),le(R.LinearProgress,"warningBg",q(bt,R.warning.main,.62)),le(R.Skeleton,"bg",_?q(pi,R.text.primary,.11):`rgba(${re("palette-text-primaryChannel")} / 0.11)`),le(R.Slider,"primaryTrack",q(bt,R.primary.main,.62)),le(R.Slider,"secondaryTrack",q(bt,R.secondary.main,.62)),le(R.Slider,"errorTrack",q(bt,R.error.main,.62)),le(R.Slider,"infoTrack",q(bt,R.info.main,.62)),le(R.Slider,"successTrack",q(bt,R.success.main,.62)),le(R.Slider,"warningTrack",q(bt,R.warning.main,.62));const de=_?q(xt,R.background.default,.6825):cu(R.background.default,.8);le(R.SnackbarContent,"bg",de),le(R.SnackbarContent,"color",Er(()=>_?wm.text.primary:R.getContrastText(de))),le(R.SpeedDialAction,"fabHoverBg",cu(R.background.paper,.15)),le(R.StepConnector,"border",re("palette-grey-400")),le(R.StepContent,"border",re("palette-grey-400")),le(R.Switch,"defaultColor",re("palette-common-white")),le(R.Switch,"defaultDisabledColor",re("palette-grey-100")),le(R.Switch,"primaryDisabledColor",q(bt,R.primary.main,.62)),le(R.Switch,"secondaryDisabledColor",q(bt,R.secondary.main,.62)),le(R.Switch,"errorDisabledColor",q(bt,R.error.main,.62)),le(R.Switch,"infoDisabledColor",q(bt,R.info.main,.62)),le(R.Switch,"successDisabledColor",q(bt,R.success.main,.62)),le(R.Switch,"warningDisabledColor",q(bt,R.warning.main,.62)),le(R.TableCell,"border",q(bt,q(pi,R.divider,1),.88)),le(R.Tooltip,"bg",q(pi,R.grey[700],.92))}if(R.mode==="dark"){le(R.Alert,"errorColor",q(bt,R.error.light,.6)),le(R.Alert,"infoColor",q(bt,R.info.light,.6)),le(R.Alert,"successColor",q(bt,R.success.light,.6)),le(R.Alert,"warningColor",q(bt,R.warning.light,.6)),le(R.Alert,"errorFilledBg",re("palette-error-dark")),le(R.Alert,"infoFilledBg",re("palette-info-dark")),le(R.Alert,"successFilledBg",re("palette-success-dark")),le(R.Alert,"warningFilledBg",re("palette-warning-dark")),le(R.Alert,"errorFilledColor",Er(()=>R.getContrastText(R.error.dark))),le(R.Alert,"infoFilledColor",Er(()=>R.getContrastText(R.info.dark))),le(R.Alert,"successFilledColor",Er(()=>R.getContrastText(R.success.dark))),le(R.Alert,"warningFilledColor",Er(()=>R.getContrastText(R.warning.dark))),le(R.Alert,"errorStandardBg",q(xt,R.error.light,.9)),le(R.Alert,"infoStandardBg",q(xt,R.info.light,.9)),le(R.Alert,"successStandardBg",q(xt,R.success.light,.9)),le(R.Alert,"warningStandardBg",q(xt,R.warning.light,.9)),le(R.Alert,"errorIconColor",re("palette-error-main")),le(R.Alert,"infoIconColor",re("palette-info-main")),le(R.Alert,"successIconColor",re("palette-success-main")),le(R.Alert,"warningIconColor",re("palette-warning-main")),le(R.AppBar,"defaultBg",re("palette-grey-900")),le(R.AppBar,"darkBg",re("palette-background-paper")),le(R.AppBar,"darkColor",re("palette-text-primary")),le(R.Avatar,"defaultBg",re("palette-grey-600")),le(R.Button,"inheritContainedBg",re("palette-grey-800")),le(R.Button,"inheritContainedHoverBg",re("palette-grey-700")),le(R.Chip,"defaultBorder",re("palette-grey-700")),le(R.Chip,"defaultAvatarColor",re("palette-grey-300")),le(R.Chip,"defaultIconColor",re("palette-grey-300")),le(R.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),le(R.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),le(R.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),le(R.LinearProgress,"primaryBg",q(xt,R.primary.main,.5)),le(R.LinearProgress,"secondaryBg",q(xt,R.secondary.main,.5)),le(R.LinearProgress,"errorBg",q(xt,R.error.main,.5)),le(R.LinearProgress,"infoBg",q(xt,R.info.main,.5)),le(R.LinearProgress,"successBg",q(xt,R.success.main,.5)),le(R.LinearProgress,"warningBg",q(xt,R.warning.main,.5)),le(R.Skeleton,"bg",_?q(pi,R.text.primary,.13):`rgba(${re("palette-text-primaryChannel")} / 0.13)`),le(R.Slider,"primaryTrack",q(xt,R.primary.main,.5)),le(R.Slider,"secondaryTrack",q(xt,R.secondary.main,.5)),le(R.Slider,"errorTrack",q(xt,R.error.main,.5)),le(R.Slider,"infoTrack",q(xt,R.info.main,.5)),le(R.Slider,"successTrack",q(xt,R.success.main,.5)),le(R.Slider,"warningTrack",q(xt,R.warning.main,.5));const de=_?q(bt,R.background.default,.985):cu(R.background.default,.98);le(R.SnackbarContent,"bg",de),le(R.SnackbarContent,"color",Er(()=>_?rw.text.primary:R.getContrastText(de))),le(R.SpeedDialAction,"fabHoverBg",cu(R.background.paper,.15)),le(R.StepConnector,"border",re("palette-grey-600")),le(R.StepContent,"border",re("palette-grey-600")),le(R.Switch,"defaultColor",re("palette-grey-300")),le(R.Switch,"defaultDisabledColor",re("palette-grey-600")),le(R.Switch,"primaryDisabledColor",q(xt,R.primary.main,.55)),le(R.Switch,"secondaryDisabledColor",q(xt,R.secondary.main,.55)),le(R.Switch,"errorDisabledColor",q(xt,R.error.main,.55)),le(R.Switch,"infoDisabledColor",q(xt,R.info.main,.55)),le(R.Switch,"successDisabledColor",q(xt,R.success.main,.55)),le(R.Switch,"warningDisabledColor",q(xt,R.warning.main,.55)),le(R.TableCell,"border",q(xt,q(pi,R.divider,1),.68)),le(R.Tooltip,"bg",q(pi,R.grey[700],.92))}Xr(R.background,"default"),Xr(R.background,"paper"),Xr(R.common,"background"),Xr(R.common,"onBackground"),Xr(R,"divider"),Object.keys(R).forEach(de=>{const L=R[de];de!=="tonalOffset"&&L&&typeof L=="object"&&(L.main&&le(R[de],"mainChannel",Ja(Qa(L.main))),L.light&&le(R[de],"lightChannel",Ja(Qa(L.light))),L.dark&&le(R[de],"darkChannel",Ja(Qa(L.dark))),L.contrastText&&le(R[de],"contrastTextChannel",Ja(Qa(L.contrastText))),de==="text"&&(Xr(R[de],"primary"),Xr(R[de],"secondary")),de==="action"&&(L.active&&Xr(R[de],"active"),L.selected&&Xr(R[de],"selected")))})}),E=e.reduce((te,R)=>zn(te,R),E);const N={prefix:i,disableCssColorScheme:s,shouldSkipGeneratingVar:a,getSelector:FR(E),enableContrastVars:o},{vars:F,generateThemeVars:$,generateStyleSheets:I}=aR(E,N);return E.vars=F,Object.entries(E.colorSchemes[E.defaultColorScheme]).forEach(([te,R])=>{E[te]=R}),E.generateThemeVars=$,E.generateStyleSheets=I,E.generateSpacing=function(){return U2(u.spacing,_0(this))},E.getColorSchemeSelector=cR(c),E.spacing=E.generateSpacing(),E.shouldSkipGeneratingVar=a,E.unstable_sxConfig={...Jh,...u==null?void 0:u.unstable_sxConfig},E.unstable_sx=function(R){return Vi({sx:R,theme:this})},E.toRuntimeSource=ow,E}function mv(n,e,t){n.colorSchemes&&t&&(n.colorSchemes[e]={...t!==!0&&t,palette:R0({...t===!0?{}:t.palette,mode:e})})}function I0(n={},...e){const{palette:t,cssVariables:r=!1,colorSchemes:s=t?void 0:{light:!0},defaultColorScheme:i=t==null?void 0:t.mode,...o}=n,a=i||"light",c=s==null?void 0:s[a],l={...s,...t?{[a]:{...typeof c!="boolean"&&c,palette:t}}:void 0};if(r===!1){if(!("colorSchemes"in n))return Tm(n,...e);let u=t;"palette"in n||l[a]&&(l[a]!==!0?u=l[a].palette:a==="dark"&&(u={mode:"dark"}));const h=Tm({...n,palette:u},...e);return h.defaultColorScheme=a,h.colorSchemes=l,h.palette.mode==="light"&&(h.colorSchemes.light={...l.light!==!0&&l.light,palette:h.palette},mv(h,"dark",l.dark)),h.palette.mode==="dark"&&(h.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:h.palette},mv(h,"light",l.light)),h}return!t&&!("light"in l)&&a==="light"&&(l.light=!0),VR({...o,colorSchemes:l,defaultColorScheme:a,...typeof r!="boolean"&&r},...e)}const lw=I0();function jR(){const n=$2(lw);return process.env.NODE_ENV!=="production"&&Te.useDebugValue(n),n[Ws]||n}function zR(n){return n!=="ownerState"&&n!=="theme"&&n!=="sx"&&n!=="as"}const WR=n=>zR(n)&&n!=="classes",P0=IC({themeId:Ws,defaultTheme:lw,rootShouldForwardProp:WR});function HR({theme:n,...e}){const t=Ws in n?n[Ws]:void 0;return U.jsx(kc,{...e,themeId:t?Ws:void 0,theme:t||n})}const lu={colorSchemeStorageKey:"mui-color-scheme",defaultLightColorScheme:"light",defaultDarkColorScheme:"dark",modeStorageKey:"mui-mode"};process.env.NODE_ENV!=="production"&&(oe.string,oe.string,oe.string,oe.string,oe.string,oe.oneOf(["dark","light","system"]),oe.string,oe.string);const{CssVarsProvider:XR}=rR({themeId:Ws,theme:()=>I0({cssVariables:!0}),colorSchemeStorageKey:lu.colorSchemeStorageKey,modeStorageKey:lu.modeStorageKey,defaultColorScheme:{light:lu.defaultLightColorScheme,dark:lu.defaultDarkColorScheme},resolveTheme:n=>{const e={...n,typography:iw(n.palette,n.typography)};return e.unstable_sx=function(r){return Vi({sx:r,theme:this})},e}}),ZR=XR;function qR({theme:n,...e}){const t=Te.useMemo(()=>{if(typeof n=="function")return n;const r=Ws in n?n[Ws]:n;return"colorSchemes"in r?null:"vars"in r?n:{...n,vars:null}},[n]);return t?U.jsx(HR,{theme:t,...e}):U.jsx(ZR,{theme:n,...e})}const gv="#151515",it={layout:{panelWidth:{xs:280,sm:340}},panel:{background:"rgba(0, 0, 0, 0.72)",border:"rgba(255, 255, 255, 0.38)",inset:"rgba(255, 255, 255, 0.18)",radius:8},overlay:{background:gv},rail:{background:gv,border:"#2a2a2a",hover:"#232323",active:"#2f2f2f",radius:8},scrollbarThumb:"rgba(255, 255, 255, 0.22)"},O0=I0({palette:{mode:"dark",primary:{main:vm[500]},secondary:{main:vm[500]},background:{default:"#000",paper:it.panel.background},divider:"rgba(255, 255, 255, 0.12)",text:{primary:"rgba(255, 255, 255, 0.95)",secondary:"rgba(255, 255, 255, 0.72)"}},typography:{fontFamily:'Inter, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", sans-serif'},components:{MuiButton:{defaultProps:{size:"small"},styleOverrides:{root:{textTransform:"none"},outlined:{color:"rgba(255, 255, 255, 0.95)",borderColor:"rgba(255, 255, 255, 0.35)","&:hover":{borderColor:"rgba(255, 255, 255, 0.65)",backgroundColor:"rgba(255, 255, 255, 0.08)"}}}},MuiButtonBase:{defaultProps:{disableRipple:!0}},MuiIconButton:{defaultProps:{size:"small"}},MuiSlider:{defaultProps:{size:"small"}},MuiInput:{styleOverrides:{underline:{"&&&&:hover:before":{borderBottom:"1px solid #fff"}}}},MuiPaper:{styleOverrides:{root:{backgroundColor:it.overlay.background}}},MuiSvgIcon:{defaultProps:{fontSize:"small"}}}}),YR=YC;process.env.NODE_ENV!=="production"&&(oe.node,oe.object.isRequired);function KR(n){return WC(n)}function GR(n){return w0("MuiSvgIcon",n)}SC("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const JR=n=>{const{color:e,fontSize:t,classes:r}=n,s={root:["root",e!=="inherit"&&`color${$i(e)}`,`fontSize${$i(t)}`]};return lR(s,GR,r)},QR=P0("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(n,e)=>{const{ownerState:t}=n;return[e.root,t.color!=="inherit"&&e[`color${$i(t.color)}`],e[`fontSize${$i(t.fontSize)}`]]}})(YR(({theme:n})=>{var e,t,r,s,i,o,a,c,l,u,h,d,p,m;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(s=(e=n.transitions)==null?void 0:e.create)==null?void 0:s.call(e,"fill",{duration:(r=(t=(n.vars??n).transitions)==null?void 0:t.duration)==null?void 0:r.shorter}),variants:[{props:g=>!g.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((o=(i=n.typography)==null?void 0:i.pxToRem)==null?void 0:o.call(i,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((c=(a=n.typography)==null?void 0:a.pxToRem)==null?void 0:c.call(a,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((u=(l=n.typography)==null?void 0:l.pxToRem)==null?void 0:u.call(l,35))||"2.1875rem"}},...Object.entries((n.vars??n).palette).filter(([,g])=>g&&g.main).map(([g])=>{var y,x;return{props:{color:g},style:{color:(x=(y=(n.vars??n).palette)==null?void 0:y[g])==null?void 0:x.main}}}),{props:{color:"action"},style:{color:(d=(h=(n.vars??n).palette)==null?void 0:h.action)==null?void 0:d.active}},{props:{color:"disabled"},style:{color:(m=(p=(n.vars??n).palette)==null?void 0:p.action)==null?void 0:m.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),mf=Te.forwardRef(function(e,t){const r=KR({props:e,name:"MuiSvgIcon"}),{children:s,className:i,color:o="inherit",component:a="svg",fontSize:c="medium",htmlColor:l,inheritViewBox:u=!1,titleAccess:h,viewBox:d="0 0 24 24",...p}=r,m=Te.isValidElement(s)&&s.type==="svg",g={...r,color:o,component:a,fontSize:c,instanceFontSize:e.fontSize,inheritViewBox:u,viewBox:d,hasSvgAsChild:m},y={};u||(y.viewBox=d);const x=JR(g);return U.jsxs(QR,{as:a,className:z2(x.root,i),focusable:"false",color:l,"aria-hidden":h?void 0:!0,role:h?"img":void 0,ref:t,...y,...p,...m&&s.props,ownerState:g,children:[m?s.props.children:s,h?U.jsx("title",{children:h}):null]})});process.env.NODE_ENV!=="production"&&(mf.propTypes={children:oe.node,classes:oe.object,className:oe.string,color:oe.oneOfType([oe.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),oe.string]),component:oe.elementType,fontSize:oe.oneOfType([oe.oneOf(["inherit","large","medium","small"]),oe.string]),htmlColor:oe.string,inheritViewBox:oe.bool,shapeRendering:oe.string,sx:oe.oneOfType([oe.arrayOf(oe.oneOfType([oe.func,oe.object,oe.bool])),oe.func,oe.object]),titleAccess:oe.string,viewBox:oe.string});mf.muiName="SvgIcon";function k0(n,e){function t(r,s){return U.jsx(mf,{"data-testid":process.env.NODE_ENV!=="production"?`${e}Icon`:void 0,ref:s,...r,children:n})}return process.env.NODE_ENV!=="production"&&(t.displayName=`${e}Icon`),t.muiName=mf.muiName,Te.memo(Te.forwardRef(t))}function eI(...n){const e=Te.useRef(void 0),t=Te.useCallback(r=>{const s=n.map(i=>{if(i==null)return null;if(typeof i=="function"){const o=i,a=o(r);return typeof a=="function"?a:()=>{o(null)}}return i.current=r,()=>{i.current=null}});return()=>{s.forEach(i=>i==null?void 0:i())}},n);return Te.useMemo(()=>n.every(r=>r==null)?null:r=>{e.current&&(e.current(),e.current=void 0),r!=null&&(e.current=t(r))},n)}const tI=k0(U.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutline"),nI=k0(U.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"InfoOutlined"),yv=k0(U.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"}),"OpenInNew");let rI=0;function sI(n,e){const t=`atom${++rI}`,r={toString:()=>t};return typeof n=="function"?r.read=n:(r.init=n,r.read=s=>s(r),r.write=(s,i,o)=>i(r,typeof o=="function"?o(s(r)):o)),e&&(r.write=e),r}const Un={},Gs=Symbol(),Sm=n=>!!n[Gs],uu=n=>!n[Gs].c,Ba=n=>{var e;const{b:t,c:r}=n[Gs];r&&(r(),(e=oI.get(t))==null||e())},Wu=(n,e)=>{const t=n[Gs].o,r=e[Gs].o;return t===r||n===r||Sm(t)&&Wu(t,e)},Em=(n,e)=>{const t={b:n,o:e,c:null},r=new Promise(s=>{t.c=()=>{t.c=null,s()},e.finally(t.c)});return r[Gs]=t,r},iI=n=>Em(n[Gs].b,n[Gs].o),oI=new WeakMap,fu=n=>"init"in n,Am="r",Cm="w",Mc="c",Rm="s",_v="h",aI="n",cI="l",lI="a",uI="m",fI=n=>{const e=new WeakMap,t=new WeakMap,r=new Map;let s,i;if((Un&&"production")!=="production"&&(s=new Set,i=new Set),n)for(const[P,O]of n){const D={v:O,r:0,y:!0,d:new Map};(Un&&"production")!=="production"&&(Object.freeze(D),fu(P)||console.warn("Found initial value for derived atom which can cause unexpected behavior",P)),e.set(P,D)}const o=new WeakMap,a=(P,O,D)=>{let X=o.get(O);X||(X=new Map,o.set(O,X)),D.then(()=>{X.get(P)===D&&(X.delete(P),X.size||o.delete(O))}),X.set(P,D)},c=P=>{const O=new Set,D=o.get(P);return D&&(o.delete(P),D.forEach((X,K)=>{Ba(X),O.add(K)})),O},l=new WeakMap,u=P=>{let O=l.get(P);return O||(O=new Map,l.set(P,O)),O},h=(P,O)=>{if(P){const D=u(P);let X=D.get(O);return X||(X=h(P.p,O),X&&"p"in X&&uu(X.p)&&(X=void 0),X&&D.set(O,X)),X}return e.get(O)},d=(P,O,D)=>{if((Un&&"production")!=="production"&&Object.freeze(D),P)u(P).set(O,D);else{const X=e.get(O);e.set(O,D),r.has(O)||r.set(O,X)}},p=(P,O=new Map,D)=>{if(!D)return O;const X=new Map;let K=!1;return D.forEach(Q=>{var ie;const ae=((ie=h(P,Q))==null?void 0:ie.r)||0;X.set(Q,ae),O.get(Q)!==ae&&(K=!0)}),O.size===X.size&&!K?O:X},m=(P,O,D,X,K)=>{const Q=h(P,O);if(Q){if(K&&(!("p"in Q)||!Wu(Q.p,K)))return Q;"p"in Q&&Ba(Q.p)}const ie={v:D,r:(Q==null?void 0:Q.r)||0,y:!0,d:p(P,Q==null?void 0:Q.d,X)};let ae=!(Q!=null&&Q.y);return!Q||!("v"in Q)||!Object.is(Q.v,D)?(ae=!0,++ie.r,ie.d.has(O)&&(ie.d=new Map(ie.d).set(O,ie.r))):ie.d!==Q.d&&(ie.d.size!==Q.d.size||!Array.from(ie.d.keys()).every(ye=>Q.d.has(ye)))&&(ae=!0,Promise.resolve().then(()=>{de(P)})),Q&&!ae?Q:(d(P,O,ie),ie)},g=(P,O,D,X,K)=>{const Q=h(P,O);if(Q){if(K&&(!("p"in Q)||!Wu(Q.p,K)))return Q;"p"in Q&&Ba(Q.p)}const ie={e:D,r:((Q==null?void 0:Q.r)||0)+1,y:!0,d:p(P,Q==null?void 0:Q.d,X)};return d(P,O,ie),ie},y=(P,O,D,X)=>{const K=h(P,O);if(K&&"p"in K){if(Wu(K.p,D)&&!uu(K.p))return K.y?K:{...K,y:!0};Ba(K.p)}a(P,O,D);const Q={p:D,r:((K==null?void 0:K.r)||0)+1,y:!0,d:p(P,K==null?void 0:K.d,X)};return d(P,O,Q),Q},x=(P,O,D,X)=>{if(D instanceof Promise){const K=Em(D,D.then(Q=>{m(P,O,Q,X,K)}).catch(Q=>{if(Q instanceof Promise)return Sm(Q)?Q.then(()=>{v(P,O,!0)}):Q;g(P,O,Q,X,K)}));return y(P,O,K,X)}return m(P,O,D,X)},b=(P,O)=>{const D=h(P,O);if(D){const X={...D,y:!1};d(P,O,X)}else(Un&&"production")!=="production"&&console.warn("[Bug] could not invalidate non existing atom",O)},v=(P,O,D)=>{if(!D){const K=h(P,O);if(K){if(K.y&&"p"in K&&!uu(K.p))return K;if(K.d.forEach((Q,ie)=>{if(ie!==O)if(!t.has(ie))v(P,ie);else{const ae=h(P,ie);ae&&!ae.y&&v(P,ie)}}),Array.from(K.d).every(([Q,ie])=>{const ae=h(P,Q);return ae&&!("p"in ae)&&ae.r===ie}))return K.y?K:{...K,y:!0}}}const X=new Set;try{const K=O.read(Q=>{X.add(Q);const ie=Q===O?h(P,Q):v(P,Q);if(ie){if("e"in ie)throw ie.e;if("p"in ie)throw ie.p;return ie.v}if(fu(Q))return Q.init;throw new Error("no atom init")});return x(P,O,K,X)}catch(K){if(K instanceof Promise){const Q=Sm(K)&&uu(K)?iI(K):Em(K,K);return y(P,O,Q,X)}return g(P,O,K,X)}},_=(P,O)=>v(O,P),w=(P,O)=>{let D=t.get(O);return D||(D=R(P,O)),D},E=(P,O)=>!O.l.size&&(!O.t.size||O.t.size===1&&O.t.has(P)),N=(P,O)=>{const D=t.get(O);D&&E(O,D)&&re(P,O)},F=(P,O)=>{const D=t.get(O);D==null||D.t.forEach(X=>{X!==O&&(b(P,X),F(P,X))})},$=(P,O,D)=>{let X=!0;const K=(ae,ye)=>{const ve=v(P,ae);if("e"in ve)throw ve.e;if("p"in ve){if(ye!=null&&ye.unstable_promise)return ve.p.then(()=>{const xe=h(P,ae);return xe&&"p"in xe&&xe.p===ve.p?new Promise(tt=>setTimeout(tt)).then(()=>K(ae,ye)):K(ae,ye)});throw(Un&&"production")!=="production"&&console.info("Reading pending atom state in write operation. We throw a promise for now.",ae),ve.p}if("v"in ve)return ve.v;throw(Un&&"production")!=="production"&&console.warn("[Bug] no value found while reading atom in write operation. This is probably a bug.",ae),new Error("no value found")},Q=(ae,ye)=>{let ve;if(ae===O){if(!fu(ae))throw new Error("atom not writable");c(ae).forEach(T=>{T!==P&&x(T,ae,ye)});const tt=h(P,ae),A=x(P,ae,ye);tt!==A&&F(P,ae)}else ve=$(P,ae,ye);return X||de(P),ve},ie=O.write(K,Q,D);return X=!1,ie},I=(P,O,D)=>{const X=$(D,P,O);return de(D),X},te=P=>!!P.write,R=(P,O,D)=>{const X={t:new Set(D&&[D]),l:new Set};if(t.set(O,X),(Un&&"production")!=="production"&&i.add(O),v(void 0,O).d.forEach((Q,ie)=>{const ae=t.get(ie);ae?ae.t.add(O):ie!==O&&R(P,ie,O)}),te(O)&&O.onMount){const Q=ae=>I(O,ae,P),ie=O.onMount(Q);P=void 0,ie&&(X.u=ie)}return X},re=(P,O)=>{var D;const X=(D=t.get(O))==null?void 0:D.u;X&&X(),t.delete(O),(Un&&"production")!=="production"&&i.delete(O);const K=h(P,O);K?("p"in K&&Ba(K.p),K.d.forEach((Q,ie)=>{if(ie!==O){const ae=t.get(ie);ae&&(ae.t.delete(O),E(ie,ae)&&re(P,ie))}})):(Un&&"production")!=="production"&&console.warn("[Bug] could not find atom state to unmount",O)},q=(P,O,D,X)=>{const K=new Set(D.d.keys());X==null||X.forEach((Q,ie)=>{if(K.has(ie)){K.delete(ie);return}const ae=t.get(ie);ae&&(ae.t.delete(O),E(ie,ae)&&re(P,ie))}),K.forEach(Q=>{const ie=t.get(Q);ie?ie.t.add(O):t.has(O)&&R(P,Q,O)})},de=P=>{if(P){u(P).forEach((D,X)=>{const K=e.get(X);if(D!==K){const Q=t.get(X);Q==null||Q.l.forEach(ie=>ie(P))}});return}for(;r.size;){const O=Array.from(r);r.clear(),O.forEach(([D,X])=>{const K=h(void 0,D);if(K&&K.d!==(X==null?void 0:X.d)&&q(void 0,D,K,X==null?void 0:X.d),X&&!X.y&&(K!=null&&K.y))return;const Q=t.get(D);Q==null||Q.l.forEach(ie=>ie())})}(Un&&"production")!=="production"&&s.forEach(O=>O())},L=P=>{u(P).forEach((D,X)=>{const K=e.get(X);(!K||D.r>K.r||D.y!==K.y||D.r===K.r&&D.d!==K.d)&&(e.set(X,D),D.d!==(K==null?void 0:K.d)&&q(P,X,D,K==null?void 0:K.d))})},j=(P,O)=>{O&&L(O),de(void 0)},H=(P,O,D)=>{const K=w(D,P).l;return K.add(O),()=>{K.delete(O),N(D,P)}},ce=(P,O)=>{for(const[D,X]of P)fu(D)&&(x(O,D,X),F(O,D));de(O)};return(Un&&"production")!=="production"?{[Am]:_,[Cm]:I,[Mc]:j,[Rm]:H,[_v]:ce,[aI]:P=>(s.add(P),()=>{s.delete(P)}),[cI]:()=>i.values(),[lI]:P=>e.get(P),[uI]:P=>t.get(P)}:{[Am]:_,[Cm]:I,[Mc]:j,[Rm]:H,[_v]:ce}},uw=(n,e)=>({s:e?e(n).SECRET_INTERNAL_store:fI(n)}),np=new Map,M0=n=>(np.has(n)||np.set(n,fe.createContext(uw())),np.get(n)),fw=({children:n,initialValues:e,scope:t,unstable_createStore:r,unstable_enableVersionedWrite:s})=>{const[i,o]=fe.useState({});fe.useEffect(()=>{const l=a.current;l.w&&(l.s[Mc](null,i),delete i.p,l.v=i)},[i]);const a=fe.useRef();if(!a.current){const l=uw(e,r);if(s){let u=0;l.w=h=>{o(d=>{const p=u?d:{p:d};return h(p),p})},l.v=i,l.r=h=>{++u,h(),--u}}a.current=l}const c=M0(t);return fe.createElement(c.Provider,{value:a.current},n)};function yt(n,e){return sI(n,e)}function ln(n,e){const t=M0(e),r=fe.useContext(t),{s,v:i}=r,o=d=>{const p=s[Am](n,d);if((Un&&"production")!=="production"&&!p.y)throw new Error("should not be invalidated");if("e"in p)throw p.e;if("p"in p)throw p.p;if("v"in p)return p.v;throw new Error("no atom value")},[[a,c,l],u]=fe.useReducer((d,p)=>{const m=o(p);return Object.is(d[1],m)&&d[2]===n?d:[p,m,n]},i,d=>{const p=o(d);return[d,p,n]});let h=c;return l!==n&&(u(a),h=o(a)),fe.useEffect(()=>{const{v:d}=r;d&&s[Mc](n,d);const p=s[Rm](n,u,d);return u(d),p},[s,n,r]),fe.useEffect(()=>{s[Mc](n,a)}),fe.useDebugValue(h),h}function qn(n,e){const t=M0(e),{s:r,w:s}=fe.useContext(t);return fe.useCallback(o=>{if((Un&&"production")!=="production"&&!("write"in n))throw new Error("not writable atom");const a=c=>r[Cm](n,o,c);return s?s(a):a()},[r,s,n])}function El(n,e){return"scope"in n&&(console.warn("atom.scope is deprecated. Please do useAtom(atom, scope) instead."),e=n.scope),[ln(n,e),qn(n,e)]}function Hu(n){return n.slice(1)}function hI(n){let[e,t]=(typeof n=="string"?n:n.href).split("://");if(e==="https"||e==="http")return n;if(e==="gc")return`https://storage.googleapis.com/${t}`;if(e==="s3")return`https://s3.amazonaws.com/${t}`;throw Error(`Protocol not supported, got: ${JSON.stringify(e)}`)}function nd(n,e,t,r={}){return e!==void 0&&t!==void 0&&(r={...r,headers:{...r.headers,Range:`bytes=${e}-${e+t-1}`}}),fetch(n,r)}function hw(n,e){return{...n,...e,headers:{...n.headers,...e.headers}}}function vv(n,e=""){if(!n)throw new Error(e)}function xv(n,e){const t=typeof n=="string"?new URL(n):n;t.pathname.endsWith("/")||(t.pathname+="/");const r=new URL(e.slice(1),t);return r.search=t.search,r}async function bv(n){if(n.status!==404){if(n.status===200||n.status===206)return new Uint8Array(await n.arrayBuffer());throw new Error(`Unexpected response status ${n.status} ${n.statusText}`)}}async function dI(n,e,t,r){if(r)return fetch(n,{...t,headers:{...t.headers,Range:`bytes=-${e}`}});let s=await fetch(n,{...t,method:"HEAD"});if(!s.ok)return s;let i=s.headers.get("Content-Length"),o=Number(i);return nd(n,o-e,o,t)}var ll,ul,fl,Im;class pI{constructor(e,t={}){st(this,fl);S(this,"url");st(this,ll);st(this,ul);this.url=e,$e(this,ll,t.overrides??{}),$e(this,ul,t.useSuffixRequest??!1)}async get(e,t={}){let r=xv(this.url,e).href,s=await fetch(r,St(this,fl,Im).call(this,t));return bv(s)}async getRange(e,t,r={}){let s=xv(this.url,e),i=St(this,fl,Im).call(this,r),o;return"suffixLength"in t?o=await dI(s,t.suffixLength,i,pe(this,ul)):o=await nd(s,t.offset,t.length,i),bv(o)}}ll=new WeakMap,ul=new WeakMap,fl=new WeakSet,Im=function(e){return hw(pe(this,ll),e)};var $n;class dw{constructor(e,t,r){st(this,$n);typeof e=="number"?$e(this,$n,new Uint8Array(e)):e instanceof ArrayBuffer?$e(this,$n,new Uint8Array(e,t,r)):$e(this,$n,new Uint8Array(Array.from(e,s=>s?1:0)))}get BYTES_PER_ELEMENT(){return 1}get byteOffset(){return pe(this,$n).byteOffset}get byteLength(){return pe(this,$n).byteLength}get buffer(){return pe(this,$n).buffer}get length(){return pe(this,$n).length}get(e){let t=pe(this,$n)[e];return typeof t=="number"?t!==0:t}set(e,t){pe(this,$n)[e]=t?1:0}fill(e){pe(this,$n).fill(e?1:0)}*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this.get(e)}}$n=new WeakMap;var ta;class N0{constructor(e,t,r,s){S(this,"_data");S(this,"chars");st(this,ta);if(this.chars=e,$e(this,ta,new TextEncoder),typeof t=="number")this._data=new Uint8Array(t*e);else if(t instanceof ArrayBuffer)s&&(s=s*e),this._data=new Uint8Array(t,r,s);else{let i=Array.from(t);this._data=new Uint8Array(i.length*e);for(let o=0;o<i.length;o++)this.set(o,i[o])}}get BYTES_PER_ELEMENT(){return this.chars}get byteOffset(){return this._data.byteOffset}get byteLength(){return this._data.byteLength}get buffer(){return this._data.buffer}get length(){return this.byteLength/this.BYTES_PER_ELEMENT}get(e){const t=new Uint8Array(this.buffer,this.byteOffset+this.chars*e,this.chars);return new TextDecoder().decode(t).replace(/\x00/g,"")}set(e,t){const r=new Uint8Array(this.buffer,this.byteOffset+this.chars*e,this.chars);r.fill(0),r.set(pe(this,ta).encode(t))}fill(e){const t=pe(this,ta).encode(e);for(let r=0;r<this.length;r++)this._data.set(t,r*this.chars)}*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this.get(e)}}ta=new WeakMap;var _n;const w_=class w_{constructor(e,t,r,s){st(this,_n);S(this,"chars");if(this.chars=e,typeof t=="number")$e(this,_n,new Int32Array(t*e));else if(t instanceof ArrayBuffer)s&&(s*=e),$e(this,_n,new Int32Array(t,r,s));else{const i=t,o=new w_(e,1);$e(this,_n,new Int32Array(function*(){for(let a of i)o.set(0,a),yield*pe(o,_n)}()))}}get BYTES_PER_ELEMENT(){return pe(this,_n).BYTES_PER_ELEMENT*this.chars}get byteLength(){return pe(this,_n).byteLength}get byteOffset(){return pe(this,_n).byteOffset}get buffer(){return pe(this,_n).buffer}get length(){return pe(this,_n).length/this.chars}get(e){const t=this.chars*e;let r="";for(let s=0;s<this.chars;s++)r+=String.fromCodePoint(pe(this,_n)[t+s]);return r.replace(/\u0000/g,"")}set(e,t){const r=this.chars*e,s=pe(this,_n).subarray(r,r+this.chars);s.fill(0);for(let i=0;i<this.chars;i++)s[i]=t.codePointAt(i)??0}fill(e){this.set(0,e);let t=pe(this,_n).subarray(0,this.chars);for(let r=1;r<this.length;r++)pe(this,_n).set(t,r*this.chars)}*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this.get(e)}};_n=new WeakMap;let Nc=w_;function Al(n){const e=new TextDecoder().decode(n);return JSON.parse(e)}function wv(n,e){const t=e/2,r=e-1;let s=0;for(let i=0;i<n.length;i+=e)for(let o=0;o<t;o+=1)s=n[i+o],n[i+o]=n[i+r-o],n[i+r-o]=s}function pw(n){if(n==="v2:object")return globalThis.Array;let e=n.match(/v2:([US])(\d+)/);if(e){let[,r,s]=e;return(r==="U"?Nc:N0).bind(null,Number(s))}if(n==="string")return globalThis.Array;let t={int8:Int8Array,int16:Int16Array,int32:Int32Array,int64:globalThis.BigInt64Array,uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,uint64:globalThis.BigUint64Array,float16:globalThis.Float16Array,float32:Float32Array,float64:Float64Array,bool:dw}[n];return rn(t,`Unknown or unsupported data_type: ${n}`),t}function ji(n,e){const t=n.length;typeof e=="string"&&(e=e==="C"?Array.from({length:t},(i,o)=>o):Array.from({length:t},(i,o)=>t-1-o)),rn(t===e.length,"Order length must match the number of dimensions.");let r=1,s=new Array(t);for(let i=e.length-1;i>=0;i--)s[e[i]]=r,r*=n[e[i]];return s}function mI({name:n,configuration:e}){if(n==="default"){const t=(e==null?void 0:e.separator)??"/";return r=>["c",...r].join(t)}if(n==="v2"){const t=(e==null?void 0:e.separator)??".";return r=>r.join(t)||"0"}throw new Error(`Unknown chunk key encoding: ${n}`)}function gI(n){if(n==="|O")return{data_type:"v2:object"};let e=n.match(/^([<|>])(.*)$/);rn(e,`Invalid dtype: ${n}`);let[,t,r]=e,s={b1:"bool",i1:"int8",u1:"uint8",i2:"int16",u2:"uint16",i4:"int32",u4:"uint32",i8:"int64",u8:"uint64",f2:"float16",f4:"float32",f8:"float64"}[r]??(r.startsWith("S")||r.startsWith("U")?`v2:${r}`:void 0);return rn(s,`Unsupported or unknown dtype: ${n}`),t==="|"?{data_type:s}:{data_type:s,endian:t==="<"?"little":"big"}}function yI(n,e={}){let t=[],r=gI(n.dtype);n.order==="F"&&t.push({name:"transpose",configuration:{order:"F"}}),"endian"in r&&r.endian==="big"&&t.push({name:"bytes",configuration:{endian:"big"}});for(let{id:s,...i}of n.filters??[])t.push({name:s,configuration:i});if(n.compressor){let{id:s,...i}=n.compressor;t.push({name:s,configuration:i})}return{zarr_format:3,node_type:"array",shape:n.shape,data_type:r.data_type,chunk_grid:{name:"regular",configuration:{chunk_shape:n.chunks}},chunk_key_encoding:{name:"v2",configuration:{separator:n.dimension_separator??"."}},codecs:t,fill_value:n.fill_value,attributes:e}}function _I(n,e={}){return{zarr_format:3,node_type:"group",attributes:e}}function vI(n,e){if(e!=="number"&&e!=="bigint"&&e!=="boolean"&&e!=="object"&&e!=="string")return n===e;let t=n==="bool";if(e==="boolean")return t;let r=n.startsWith("v2:U")||n.startsWith("v2:S")||n==="string";if(e==="string")return r;let s=n==="int64"||n==="uint64";if(e==="bigint")return s;let i=n==="v2:object";return e==="object"?i:!r&&!s&&!t&&!i}function xI(n){return(n==null?void 0:n.name)==="sharding_indexed"}function mw(n){return(n.data_type==="uint64"||n.data_type==="int64")&&n.fill_value!=null?BigInt(n.fill_value):n.fill_value}function gw(n,...e){if(!e.some(t=>n instanceof t))throw n}function rn(n,e=""){if(!n)throw new Error(e)}async function yw(n,{format:e,signal:t}){const r=n instanceof Response?n:new Response(n);rn(r.body,"Response does not contain body.");try{return await new Response(r.body.pipeThrough(new DecompressionStream(e),{signal:t})).arrayBuffer()}catch{throw t==null||t.throwIfAborted(),new Error(`Failed to decode ${e}`)}}class D0{constructor(e,t){S(this,"kind","array_to_array");rn(e.keepbits>=0,"keepbits must be zero or positive")}static fromConfig(e,t){return new D0(e,t)}encode(e){throw new Error("`BitroundCodec.encode` is not implemented. Please open an issue at https://github.com/manzt/zarrita.js/issues.")}decode(e){return e}}const Tv=bI();function bI(){const n=new Uint32Array([305419896]);return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)[0]!==18}function Sv(n){return"BYTES_PER_ELEMENT"in n?n.BYTES_PER_ELEMENT:4}var hl,Ds,dl,pl,na;const T_=class T_{constructor(e,t){S(this,"kind","array_to_bytes");st(this,hl);st(this,Ds);st(this,dl);st(this,pl);st(this,na);$e(this,na,e==null?void 0:e.endian),$e(this,Ds,pw(t.data_type)),$e(this,pl,t.shape),$e(this,hl,ji(t.shape,"C"));const r=new(pe(this,Ds))(0);$e(this,dl,r.BYTES_PER_ELEMENT)}static fromConfig(e,t){return new T_(e,t)}encode(e){let t=new Uint8Array(e.data.buffer);return Tv&&pe(this,na)==="big"&&wv(t,Sv(pe(this,Ds))),t}decode(e){return Tv&&pe(this,na)==="big"&&wv(e,Sv(pe(this,Ds))),{data:new(pe(this,Ds))(e.buffer,e.byteOffset,e.byteLength/pe(this,dl)),shape:pe(this,pl),stride:pe(this,hl)}}};hl=new WeakMap,Ds=new WeakMap,dl=new WeakMap,pl=new WeakMap,na=new WeakMap;let gf=T_;class L0{constructor(){S(this,"kind","bytes_to_bytes")}static fromConfig(){return new L0}encode(e){throw new Error("Not implemented")}decode(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength-4)}}class F0{constructor(){S(this,"kind","bytes_to_bytes")}static fromConfig(e){return new F0}encode(e){throw new Error("Gzip encoding is not enabled by default. Please register a custom codec with `numcodecs/gzip`.")}async decode(e){const t=await yw(e,{format:"gzip"});return new Uint8Array(t)}}function wI(n,e){return rn(!Number.isNaN(e),"JsonCodec allow_nan is false but NaN was encountered during encoding."),rn(e!==Number.POSITIVE_INFINITY,"JsonCodec allow_nan is false but Infinity was encountered during encoding."),rn(e!==Number.NEGATIVE_INFINITY,"JsonCodec allow_nan is false but -Infinity was encountered during encoding."),e}function TI(n,e){return e instanceof Object&&!Array.isArray(e)?Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}):e}var ml,gl;const S_=class S_{constructor(e={}){S(this,"configuration");S(this,"kind","array_to_bytes");st(this,ml);st(this,gl);this.configuration=e;const{encoding:t="utf-8",skipkeys:r=!1,ensure_ascii:s=!0,check_circular:i=!0,allow_nan:o=!0,sort_keys:a=!0,indent:c,strict:l=!0}=e;let u=e.separators;u||(c?u=[", ",": "]:u=[",",":"]),$e(this,ml,{encoding:t,skipkeys:r,ensure_ascii:s,check_circular:i,allow_nan:o,indent:c,separators:u,sort_keys:a}),$e(this,gl,{strict:l})}static fromConfig(e){return new S_(e)}encode(e){const{indent:t,encoding:r,ensure_ascii:s,check_circular:i,allow_nan:o,sort_keys:a}=pe(this,ml);rn(r==="utf-8","JsonCodec does not yet support non-utf-8 encoding.");const c=[];rn(i,"JsonCodec does not yet support skipping the check for circular references during encoding."),o||c.push(wI),a&&c.push(TI);const l=Array.from(e.data);l.push("|O"),l.push(e.shape);let u;c.length&&(u=(d,p)=>{let m=p;for(let g of c)m=g(d,m);return m});let h=JSON.stringify(l,u,t);return s&&(h=h.replace(/[\u007F-\uFFFF]/g,d=>{const p=`0000${d.charCodeAt(0).toString(16)}`;return`\\u${p.substring(p.length-4)}`})),new TextEncoder().encode(h)}decode(e){const{strict:t}=pe(this,gl);rn(t,"JsonCodec does not yet support non-strict decoding.");const r=Al(e),s=r.pop();r.pop(),rn(s,"0D not implemented for JsonCodec.");const i=ji(s,"C");return{data:r,shape:s,stride:i}}};ml=new WeakMap,gl=new WeakMap;let Pm=S_;function Ev(n){return n instanceof dw||n instanceof N0||n instanceof Nc?new Proxy(n,{get(t,r){return t.get(Number(r))},set(t,r,s){return t.set(Number(r),s),!0}}):n}function SI(n,e){let t;return n.data instanceof N0||n.data instanceof Nc?t=new n.constructor(n.data.length,n.data.chars):t=new n.constructor(n.data.length),{data:t,shape:n.shape,stride:ji(n.shape,e)}}function EI(n,e){let t=SI(n,e),r=n.shape.length,s=n.data.length,i=Array(r).fill(0),o=Ev(n.data),a=Ev(t.data);for(let c=0;c<s;c++){let l=0;for(let u=0;u<r;u++)l+=i[u]*t.stride[u];a[l]=o[c],i[0]+=1;for(let u=0;u<r;u++)if(i[u]===n.shape[u]){if(u+1===r)break;i[u]=0,i[u+1]+=1}}return t}function AI(n){let e=n.shape.length;return rn(e===n.stride.length,"Shape and stride must have the same length."),n.stride.map((t,r)=>({stride:t,index:r})).sort((t,r)=>r.stride-t.stride).map(t=>t.index)}function CI(n,e){let t=AI(n);return rn(t.length===e.length,"Orders must match"),t.every((r,s)=>r===e[s])}var yl,ra;const E_=class E_{constructor(e,t){S(this,"kind","array_to_array");st(this,yl);st(this,ra);let r=e.order??"C",s=t.shape.length,i=new Array(s),o=new Array(s);if(r==="C")for(let a=0;a<s;++a)i[a]=a,o[a]=a;else if(r==="F")for(let a=0;a<s;++a)i[a]=s-a-1,o[a]=s-a-1;else i=r,i.forEach((a,c)=>{rn(o[a]===void 0,`Invalid permutation: ${JSON.stringify(r)}`),o[a]=c});$e(this,yl,i),$e(this,ra,o)}static fromConfig(e,t){return new E_(e,t)}encode(e){return CI(e,pe(this,ra))?e:EI(e,pe(this,ra))}decode(e){return{data:e.data,shape:e.shape,stride:ji(e.shape,pe(this,yl))}}};yl=new WeakMap,ra=new WeakMap;let Om=E_;var _l,vl;const A_=class A_{constructor(e){S(this,"kind","array_to_bytes");st(this,_l);st(this,vl);$e(this,_l,e),$e(this,vl,ji(e,"C"))}static fromConfig(e,t){return new A_(t.shape)}encode(e){throw new Error("Method not implemented.")}decode(e){let t=new TextDecoder,r=new DataView(e.buffer),s=Array(r.getUint32(0,!0)),i=4;for(let o=0;o<s.length;o++){let a=r.getUint32(i,!0);i+=4,s[o]=t.decode(e.buffer.slice(i,i+a)),i+=a}return{data:s,shape:pe(this,_l),stride:pe(this,vl)}}};_l=new WeakMap,vl=new WeakMap;let km=A_;class B0{constructor(){S(this,"kind","bytes_to_bytes")}static fromConfig(e){return new B0}encode(e){throw new Error("Zlib encoding is not enabled by default. Please register a codec with `numcodecs/zlib`.")}async decode(e){const t=await yw(e,{format:"deflate"});return new Uint8Array(t)}}function RI(){return new Map().set("blosc",()=>Promise.resolve().then(()=>require("./blosc-CeItQ6qj.cjs")).then(n=>n.default)).set("lz4",()=>Promise.resolve().then(()=>require("./lz4-PFaIsPAh.cjs")).then(n=>n.default)).set("zstd",()=>Promise.resolve().then(()=>require("./zstd-_xUhkGOV.cjs")).then(n=>n.default)).set("gzip",()=>F0).set("zlib",()=>B0).set("transpose",()=>Om).set("bytes",()=>gf).set("crc32c",()=>L0).set("vlen-utf8",()=>km).set("json2",()=>Pm).set("bitround",()=>D0)}const _w=RI();function Mm(n){let e;return{async encode(t){e||(e=await Av(n));for(const s of e.array_to_array)t=await s.encode(t);let r=await e.array_to_bytes.encode(t);for(const s of e.bytes_to_bytes)r=await s.encode(r);return r},async decode(t){e||(e=await Av(n));for(let s=e.bytes_to_bytes.length-1;s>=0;s--)t=await e.bytes_to_bytes[s].decode(t);let r=await e.array_to_bytes.decode(t);for(let s=e.array_to_array.length-1;s>=0;s--)r=await e.array_to_array[s].decode(r);return r}}}async function Av(n){let e=n.codecs.map(async i=>{var a;let o=await((a=_w.get(i.name))==null?void 0:a());return rn(o,`Unknown codec: ${i.name}`),{Codec:o,meta:i}}),t=[],r,s=[];for await(let{Codec:i,meta:o}of e){let a=i.fromConfig(o.configuration,n);switch(a.kind){case"array_to_array":t.push(a);break;case"array_to_bytes":r=a;break;default:s.push(a)}}return r||(rn(II(n),`Cannot encode ${n.data_type} to bytes without a codec`),r=gf.fromConfig({endian:"little"},n)),{array_to_array:t,array_to_bytes:r,bytes_to_bytes:s}}function II(n){return n.data_type!=="v2:object"&&n.data_type!=="string"}class oi extends Error{constructor(e,t={}){super(`Node not found: ${e}`,t),this.name="NodeNotFoundError"}}class U0 extends Error{constructor(e){super(`Missing key: ${e}`),this.name="KeyError"}}const Cv=18446744073709551615n;function PI(n,e,t,r){rn(n.store.getRange,"Store does not support range requests");let s=n.store.getRange.bind(n.store),i=e.map((u,h)=>u/r.chunk_shape[h]),o=Mm({data_type:"uint64",shape:[...i,2],codecs:r.index_codecs}),a=4,c=16*i.reduce((u,h)=>u*h,1),l={};return async(u,h)=>{let d=u.map((w,E)=>Math.floor(w/i[E])),p=n.resolve(t(d)).path;p in l||(l[p]=(async()=>{let w=await s(p,{suffixLength:c+a},h);return w?await o.decode(w):null})().catch(w=>{throw delete l[p],w}));let m=await l[p];if(m===null)return;let{data:g,shape:y,stride:x}=m,b=u.map((w,E)=>w%y[E]).reduce((w,E,N)=>w+E*x[N],0),v=g[b],_=g[b+1];if(!(v===Cv&&_===Cv))return s(p,{offset:Number(v),length:Number(_)},h)}}class ai{constructor(e,t="/"){S(this,"store");S(this,"path");this.store=e,this.path=t}resolve(e){let t=new URL(`file://${this.path.endsWith("/")?this.path:`${this.path}/`}`);return new ai(this.store,decodeURIComponent(new URL(e,t).pathname))}}function vw(n){return new ai(n??new Map)}var xl;class rd extends ai{constructor(t,r,s){super(t,r);S(this,"kind","group");st(this,xl);$e(this,xl,s)}get attrs(){return pe(this,xl).attributes}}xl=new WeakMap;function Rv(n){var t;const e=n.find(r=>r.name==="transpose");return((t=e==null?void 0:e.configuration)==null?void 0:t.order)??"C"}const ec=Symbol("zarrita.context");function OI(n){return n[ec]}function kI(n,e){let{configuration:t}=e.codecs.find(xI)??{},r={encode_chunk_key:mI(e.chunk_key_encoding),TypedArray:pw(e.data_type),fill_value:e.fill_value};if(t){let i=Rv(t.codecs);return{...r,kind:"sharded",chunk_shape:t.chunk_shape,codec:Mm({data_type:e.data_type,shape:t.chunk_shape,codecs:t.codecs}),get_strides(o){return ji(o,i)},get_chunk_bytes:PI(n,e.chunk_grid.configuration.chunk_shape,r.encode_chunk_key,t)}}let s=Rv(e.codecs);return{...r,kind:"regular",chunk_shape:e.chunk_grid.configuration.chunk_shape,codec:Mm({data_type:e.data_type,shape:e.chunk_grid.configuration.chunk_shape,codecs:e.codecs}),get_strides(i){return ji(i,s)},async get_chunk_bytes(i,o){let a=r.encode_chunk_key(i),c=n.resolve(a).path;return n.store.get(c,o)}}}var P2,O2,Ls,k2;let yf=(k2=class extends(O2=ai,P2=ec,O2){constructor(t,r,s){super(t,r);S(this,"kind","array");st(this,Ls);S(this,P2);$e(this,Ls,{...s,fill_value:mw(s)}),this[ec]=kI(this,pe(this,Ls))}get attrs(){return pe(this,Ls).attributes}get shape(){return pe(this,Ls).shape}get chunks(){return this[ec].chunk_shape}get dtype(){return pe(this,Ls).data_type}async getChunk(t,r){let s=this[ec],i=await s.get_chunk_bytes(t,r);if(!i){let o=s.chunk_shape.reduce((c,l)=>c*l,1),a=new s.TypedArray(o);return a.fill(s.fill_value),{data:a,shape:s.chunk_shape,stride:s.get_strides(s.chunk_shape)}}return s.codec.decode(i)}is(t){return vI(this.dtype,t)}},Ls=new WeakMap,k2);function*MI(n,e,t=1){e===void 0&&(e=n,n=0);for(let r=n;r<e;r+=t)yield r}function*NI(...n){if(n.length===0)return;const e=n.map(r=>r[Symbol.iterator]()),t=e.map(r=>r.next());if(t.some(r=>r.done))throw new Error("Input contains an empty iterator.");for(let r=0;;){if(t[r].done){if(e[r]=n[r][Symbol.iterator](),t[r]=e[r].next(),++r>=e.length)return}else yield t.map(({value:s})=>s),r=0;t[r]=e[r].next()}}function DI({start:n,stop:e,step:t},r){if(t===0)throw new Error("slice step cannot be zero");t=t??1;const s=t<0,[i,o]=s?[-1,r-1]:[0,r];return n===null?n=s?o:i:n<0?(n+=r,n<i&&(n=i)):n>o&&(n=o),e===null?e=s?i:o:e<0?(e+=r,e<i&&(e=i)):e>o&&(e=o),[n,e,t]}function Si(n,e,t=null){return e===void 0&&(e=n,n=null),{start:n,stop:e,step:t}}function LI(){const n=[];return{add:e=>n.push(e()),onIdle:()=>Promise.all(n)}}class $0 extends Error{constructor(e){super(e),this.name="IndexError"}}function FI(n,e){throw new $0(`too many indicies for array; expected ${e.length}, got ${n.length}`)}function BI(n){throw new $0(`index out of bounds for dimension with length ${n}`)}function UI(){throw new $0("only slices with step >= 1 are supported")}function $I(n,e){n.length>e.length&&FI(n,e)}function VI(n,e){return n=Math.trunc(n),n<0&&(n=e+n),(n>=e||n<0)&&BI(e),n}class jI{constructor({dim_sel:e,dim_len:t,dim_chunk_len:r}){S(this,"dim_sel");S(this,"dim_len");S(this,"dim_chunk_len");S(this,"nitems");e=VI(e,t),this.dim_sel=e,this.dim_len=t,this.dim_chunk_len=r,this.nitems=1}*[Symbol.iterator](){const e=Math.floor(this.dim_sel/this.dim_chunk_len),t=e*this.dim_chunk_len,r=this.dim_sel-t;yield{dim_chunk_ix:e,dim_chunk_sel:r}}}class Iv{constructor({dim_sel:e,dim_len:t,dim_chunk_len:r}){S(this,"start");S(this,"stop");S(this,"step");S(this,"dim_len");S(this,"dim_chunk_len");S(this,"nitems");S(this,"nchunks");const[s,i,o]=DI(e,t);this.start=s,this.stop=i,this.step=o,this.step<1&&UI(),this.dim_len=t,this.dim_chunk_len=r,this.nitems=Math.max(0,Math.ceil((this.stop-this.start)/this.step)),this.nchunks=Math.ceil(this.dim_len/this.dim_chunk_len)}*[Symbol.iterator](){const e=Math.floor(this.start/this.dim_chunk_len),t=Math.ceil(this.stop/this.dim_chunk_len);for(const r of MI(e,t)){const s=r*this.dim_chunk_len,i=Math.min(this.dim_len,(r+1)*this.dim_chunk_len),o=i-s;let a=0,c=0;if(this.start<s){const p=(s-this.start)%this.step;p&&(c+=this.step-p),a=Math.ceil((s-this.start)/this.step)}else c=this.start-s;const l=this.stop>i?o:this.stop-s,u=[c,l,this.step],h=Math.ceil((l-c)/this.step),d=[a,a+h,1];yield{dim_chunk_ix:r,dim_chunk_sel:u,dim_out_sel:d}}}}function zI(n,e){let t=[];return n===null?t=e.map(r=>Si(null)):Array.isArray(n)&&(t=n.map(r=>r??Si(null))),$I(t,e),t}class WI{constructor({selection:e,shape:t,chunk_shape:r}){S(this,"dim_indexers");S(this,"shape");this.dim_indexers=zI(e,t).map((s,i)=>new(typeof s=="number"?jI:Iv)({dim_sel:s,dim_len:t[i],dim_chunk_len:r[i]})),this.shape=this.dim_indexers.filter(s=>s instanceof Iv).map(s=>s.nitems)}*[Symbol.iterator](){for(const e of NI(...this.dim_indexers)){const t=e.map(s=>s.dim_chunk_ix),r=e.map(s=>"dim_out_sel"in s?{from:s.dim_chunk_sel,to:s.dim_out_sel}:{from:s.dim_chunk_sel,to:null});yield{chunk_coords:t,mapping:r}}}}function HI(n,e){return"get"in n?n.get(e):n[e]}async function XI(n,e,t,r){var c;let s=OI(n),i=new WI({selection:e,shape:n.shape,chunk_shape:n.chunks}),o=r.prepare(new s.TypedArray(i.shape.reduce((l,u)=>l*u,1)),i.shape,s.get_strides(i.shape)),a=((c=t.create_queue)==null?void 0:c.call(t))??LI();for(const{chunk_coords:l,mapping:u}of i)a.add(async()=>{let{data:h,shape:d,stride:p}=await n.getChunk(l,t.opts),m=r.prepare(h,d,p);r.set_from_chunk(o,m,u)});return await a.onIdle(),i.shape.length===0?HI(o.data,0):o}function V0(n,e=0,t){let r=t??n.length-e;return{length:r,subarray(s,i=r){return V0(n,e+s,i-s)},set(s,i=0){for(let o=0;o<s.length;o++)n[e+i+o]=s.get(o)},get(s){return n[e+s]}}}function rp(n){return globalThis.Array.isArray(n.data)?{data:V0(n.data),stride:n.stride,bytes_per_element:1}:{data:new Uint8Array(n.data.buffer,n.data.byteOffset,n.data.byteLength),stride:n.stride,bytes_per_element:n.data.BYTES_PER_ELEMENT}}function ZI(n){return"chars"in n?n.constructor.bind(null,n.chars):n.constructor}function qI(n,e){if(globalThis.Array.isArray(n.data))return V0([e]);let t=ZI(n.data),r=new t([e]);return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}const YI={prepare(n,e,t){return{data:n,shape:e,stride:t}},set_scalar(n,e,t){let r=rp(n);Nm(r,e,qI(n,t),r.bytes_per_element)},set_from_chunk(n,e,t){let r=rp(n);Xu(r,rp(e),r.bytes_per_element,t)}};async function KI(n,e=null,t={}){return XI(n,e,t,YI)}function xw(n,e,t){return t<0&&e<n?Math.floor((n-e-1)/-t)+1:n<e?Math.floor((e-n-1)/t)+1:0}function Nm(n,e,t,r){if(e.length===0){n.data.set(t,0);return}const[s,...i]=e,[o,...a]=n.stride;if(typeof s=="number"){const d=n.data.subarray(o*s*r);Nm({data:d,stride:a},i,t,r);return}const[c,l,u]=s,h=xw(c,l,u);if(i.length===0){for(let d=0;d<h;d++)n.data.set(t,o*(c+u*d)*r);return}for(let d=0;d<h;d++){const p=n.data.subarray(o*(c+u*d)*r);Nm({data:p,stride:a},i,t,r)}}function Xu(n,e,t,r){const[s,...i]=r,[o,...a]=n.stride,[c,...l]=e.stride;if(s.from===null){if(i.length===0){n.data.set(e.data.subarray(0,t),s.to*t);return}Xu({data:n.data.subarray(o*s.to*t),stride:a},e,t,i);return}if(s.to===null){if(i.length===0){let x=s.from*t;n.data.set(e.data.subarray(x,x+t),0);return}Xu(n,{data:e.data.subarray(c*s.from*t),stride:l},t,i);return}const[u,h,d]=s.to,[p,m,g]=s.from,y=xw(u,h,d);if(i.length===0){if(d===1&&g===1&&o===1&&c===1){let x=p*t,b=y*t;n.data.set(e.data.subarray(x,x+b),u*t);return}for(let x=0;x<y;x++){let b=c*(p+g*x)*t;n.data.set(e.data.subarray(b,b+t),o*(u+d*x)*t)}return}for(let x=0;x<y;x++)Xu({data:n.data.subarray(o*(u+x*d)*t),stride:a},{data:e.data.subarray(c*(p+x*g)*t),stride:l},t,i)}let sd=GI();function GI(){let n=new WeakMap;function e(t){let r=n.get(t)??{v2:0,v3:0};return n.set(t,r),r}return{increment(t,r){e(t)[r]+=1},version_max(t){let r=e(t);return r.v3>r.v2?"v3":"v2"}}}async function JI(n){let e=await n.store.get(n.resolve(".zattrs").path);return e?Al(e):{}}async function QI(n,e={}){let t="store"in n?n:new ai(n),r={};return(e.attrs??!0)&&(r=await JI(t)),e.kind==="array"?Pv(t,r):e.kind==="group"?Ov(t,r):Pv(t,r).catch(s=>(gw(s,oi),Ov(t,r)))}async function Pv(n,e){let{path:t}=n.resolve(".zarray"),r=await n.store.get(t);if(!r)throw new oi("v2 array",{cause:new U0(t)});return sd.increment(n.store,"v2"),new yf(n.store,n.path,yI(Al(r),e))}async function Ov(n,e){let{path:t}=n.resolve(".zgroup"),r=await n.store.get(t);if(!r)throw new oi("v2 group",{cause:new U0(t)});return sd.increment(n.store,"v2"),new rd(n.store,n.path,_I(Al(r),e))}async function eP(n){let{store:e,path:t}=n.resolve("zarr.json"),r=await n.store.get(t);if(!r)throw new oi("v3 array or group",{cause:new U0(t)});let s=Al(r);return s.node_type==="array"&&(s.fill_value=mw(s)),s.node_type==="array"?new yf(e,n.path,s):new rd(e,n.path,s)}async function tP(n,e={}){let t="store"in n?n:new ai(n),r=await eP(t);if(sd.increment(t.store,"v3"),e.kind===void 0||e.kind==="array"&&r instanceof yf||e.kind==="group"&&r instanceof rd)return r;let s=r instanceof yf?"array":"group";throw new Error(`Expected node of kind ${e.kind}, found ${s}.`)}async function sn(n,e={}){let t="store"in n?n.store:n,r=sd.version_max(t),s=r==="v2"?sn.v2:sn.v3,i=r==="v2"?sn.v3:sn.v2;return s(n,e).catch(o=>(gw(o,oi),i(n,e)))}sn.v2=QI;sn.v3=tP;function bw(n){return n.arrayBuffer?n.arrayBuffer():new Promise((e,t)=>{const r=new FileReader;r.addEventListener("loadend",()=>{e(r.result)}),r.addEventListener("error",t),r.readAsArrayBuffer(n)})}async function nP(n){const e=await bw(n);return new Uint8Array(e)}function ww(n){return typeof Blob<"u"&&n instanceof Blob}function Dc(n){return typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}const rP=typeof process<"u"&&process.versions&&typeof process.versions.node<"u"&&typeof process.versions.electron>"u";function sP(n){return n.byteOffset===0&&n.byteLength===n.buffer.byteLength}class kv{constructor(e){this.typedArray=e instanceof ArrayBuffer||Dc(e)?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}async getLength(){return this.typedArray.byteLength}async read(e,t){return new Uint8Array(this.typedArray.buffer,this.typedArray.byteOffset+e,t)}}let Mv=class{constructor(e){this.blob=e}async getLength(){return this.blob.size}async read(e,t){const r=this.blob.slice(e,e+t),s=await bw(r);return new Uint8Array(s)}async sliceAsBlob(e,t,r=""){return this.blob.slice(e,e+t,r)}};function iP(n,e){var t=Uint8Array;if(n[0]==3&&n[1]==0)return e||new t(0);var r=aP,s=Tw,i=oP,o=Sw,a=e==null;a&&(e=new t(n.length>>>2<<3));for(var c=0,l=0,u=0,h=0,d=0,p=0,m=0,g=0,y=0,x,b;c==0;){if(c=r(n,y,1),l=r(n,y+1,2),y+=3,l==0){(y&7)!=0&&(y+=8-(y&7));var v=(y>>>3)+4,_=n[v-4]|n[v-3]<<8;a&&(e=sp(e,g+_)),e.set(new t(n.buffer,n.byteOffset+v,_),g),y=v+_<<3,g+=_;continue}if(a&&(e=sp(e,g+(1<<17))),l==1&&(x=Ne.flmap,b=Ne.fdmap,p=511,m=31),l==2){u=s(n,y,5)+257,h=s(n,y+5,5)+1,d=s(n,y+10,4)+4,y+=14;for(var w=0;w<38;w+=2)Ne.itree[w]=0,Ne.itree[w+1]=0;for(var E=1,w=0;w<d;w++){var N=s(n,y+w*3,3);Ne.itree[(Ne.ordr[w]<<1)+1]=N,N>E&&(E=N)}y+=3*d,pc(Ne.itree,E),mc(Ne.itree,E,Ne.imap),x=Ne.lmap,b=Ne.dmap,y=i(Ne.imap,(1<<E)-1,u+h,n,y,Ne.ttree);var F=Nv(Ne.ttree,0,u,Ne.ltree);p=(1<<F)-1;var $=Nv(Ne.ttree,u,h,Ne.dtree);m=(1<<$)-1,pc(Ne.ltree,F),mc(Ne.ltree,F,x),pc(Ne.dtree,$),mc(Ne.dtree,$,b)}for(;;){var I=x[o(n,y)&p];y+=I&15;var te=I>>>4;if(!(te>>>8))e[g++]=te;else{if(te==256)break;var R=g+te-254;if(te>264){var re=Ne.ldef[te-257];R=g+(re>>>3)+s(n,y,re&7),y+=re&7}var q=b[o(n,y)&m];y+=q&15;var de=q>>>4,L=Ne.ddef[de],j=(L>>>4)+r(n,y,L&15);for(y+=L&15,a&&(e=sp(e,g+(1<<17)));g<R;)e[g]=e[g++-j],e[g]=e[g++-j],e[g]=e[g++-j],e[g]=e[g++-j];g=R}}}return e.length==g?e:e.slice(0,g)}function sp(n,e){var t=n.length;if(e<=t)return n;var r=new Uint8Array(Math.max(t<<1,e));return r.set(n,0),r}function oP(n,e,t,r,s,i){for(var o=Tw,a=Sw,c=0;c<t;){var l=n[a(r,s)&e];s+=l&15;var u=l>>>4;if(u<=15)i[c]=u,c++;else{var h=0,d=0;u==16?(d=3+o(r,s,2),s+=2,h=i[c-1]):u==17?(d=3+o(r,s,3),s+=3):u==18&&(d=11+o(r,s,7),s+=7);for(var p=c+d;c<p;)i[c]=h,c++}}return s}function Nv(n,e,t,r){for(var s=0,i=0,o=r.length>>>1;i<t;){var a=n[i+e];r[i<<1]=0,r[(i<<1)+1]=a,a>s&&(s=a),i++}for(;i<o;)r[i<<1]=0,r[(i<<1)+1]=0,i++;return s}function pc(n,e){for(var t=n.length,r,s,i,o,a,c=Ne.bl_count,o=0;o<=e;o++)c[o]=0;for(o=1;o<t;o+=2)c[n[o]]++;var l=Ne.next_code;for(r=0,c[0]=0,s=1;s<=e;s++)r=r+c[s-1]<<1,l[s]=r;for(i=0;i<t;i+=2)a=n[i+1],a!=0&&(n[i]=l[a],l[a]++)}function mc(n,e,t){for(var r=n.length,s=Ne.rev15,i=0;i<r;i+=2)if(n[i+1]!=0)for(var o=i>>1,a=n[i+1],c=o<<4|a,l=e-a,u=n[i]<<l,h=u+(1<<l);u!=h;){var d=s[u]>>>15-e;t[d]=c,u++}}function Dv(n,e){for(var t=Ne.rev15,r=15-e,s=0;s<n.length;s+=2){var i=n[s]<<e-n[s+1];n[s]=t[i]>>>r}}function Tw(n,e,t){return(n[e>>>3]|n[(e>>>3)+1]<<8)>>>(e&7)&(1<<t)-1}function aP(n,e,t){return(n[e>>>3]|n[(e>>>3)+1]<<8|n[(e>>>3)+2]<<16)>>>(e&7)&(1<<t)-1}function Sw(n,e){return(n[e>>>3]|n[(e>>>3)+1]<<8|n[(e>>>3)+2]<<16)>>>(e&7)}const Ne=function(){var n=Uint16Array,e=Uint32Array;return{next_code:new n(16),bl_count:new n(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new n(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new e(32),flmap:new n(512),fltree:[],fdmap:new n(32),fdtree:[],lmap:new n(32768),ltree:[],ttree:[],dmap:new n(32768),dtree:[],imap:new n(512),itree:[],rev15:new n(32768),lhst:new e(286),dhst:new e(30),ihst:new e(19),lits:new e(15e3),strt:new n(65536),prev:new n(32768)}}();(function(){for(var n=32768,e=0;e<n;e++){var t=e;t=(t&2863311530)>>>1|(t&1431655765)<<1,t=(t&3435973836)>>>2|(t&858993459)<<2,t=(t&4042322160)>>>4|(t&252645135)<<4,t=(t&4278255360)>>>8|(t&16711935)<<8,Ne.rev15[e]=(t>>>16|t<<16)>>>17}function r(s,i,o){for(;i--!=0;)s.push(0,o)}for(var e=0;e<32;e++)Ne.ldef[e]=Ne.of0[e]<<3|Ne.exb[e],Ne.ddef[e]=Ne.df0[e]<<4|Ne.dxb[e];r(Ne.fltree,144,8),r(Ne.fltree,112,9),r(Ne.fltree,24,7),r(Ne.fltree,8,8),pc(Ne.fltree,9),mc(Ne.fltree,9,Ne.flmap),Dv(Ne.fltree,9),r(Ne.fdtree,32,5),pc(Ne.fdtree,5),mc(Ne.fdtree,5,Ne.fdmap),Dv(Ne.fdtree,5),r(Ne.itree,19,0),r(Ne.ltree,286,0),r(Ne.dtree,30,0),r(Ne.ttree,320,0)})();(function(){for(var n=new Uint32Array(256),e=0;e<256;e++){for(var t=e,r=0;r<8;r++)t&1?t=3988292384^t>>>1:t=t>>>1;n[e]=t}return n})();function cP(n,e){return iP(n,e)}const Lv={numWorkers:1,workerURL:"",useWorkers:!1};let lP=0;const Zu=[];function ip(n){return new Promise((e,t)=>{const r=new Worker(n);r.onmessage=s=>{s.data==="start"?(r.onerror=void 0,r.onmessage=void 0,e(r)):t(new Error(`unexpected message: ${s.data}`))},r.onerror=t})}function uP(n,e){return n.require?n.require(e):{}}(function(){if(rP){const{Worker:n}=uP(module,"worker_threads");return{async createWorker(e){return new n(e)},addEventListener(e,t){e.on("message",r=>{t({target:e,data:r})})},async terminate(e){await e.terminate()}}}else return{async createWorker(n){try{return await ip(n)}catch{console.warn("could not load worker:",n)}let e;try{const t=await fetch(n,{mode:"cors"});if(!t.ok)throw new Error(`could not load: ${n}`);e=await t.text(),n=URL.createObjectURL(new Blob([e],{type:"application/javascript"}));const r=await ip(n);return Lv.workerURL=n,r}catch{console.warn("could not load worker via fetch:",n)}if(e!==void 0)try{n=`data:application/javascript;base64,${btoa(e)}`;const t=await ip(n);return Lv.workerURL=n,t}catch{console.warn("could not load worker via dataURI")}throw console.warn("workers will not be used"),new Error("can not start workers")},addEventListener(n,e){n.addEventListener("message",e)},async terminate(n){n.terminate()}}})();function fP(n,e,t,r){const s=new Uint8Array(e);cP(n,s),r(t?new Blob([s],{type:t}):s.buffer)}async function hP(){if(Zu.length!==0)for(;Zu.length;){const{src:n,uncompressedSize:e,type:t,resolve:r}=Zu.shift();let s=n;ww(n)&&(s=await nP(n)),fP(s,e,t,r)}}function Ew(n,e,t){return new Promise((r,s)=>{Zu.push({src:n,uncompressedSize:e,type:t,resolve:r,reject:s,id:lP++}),hP()})}function dP(n,e){const t=n&31,r=(n>>5&15)-1,s=(n>>9&127)+1980,i=0,o=(e&31)*2,a=e>>5&63,c=e>>11&31;return new Date(s,r,t,c,a,o,i)}class pP{constructor(e,t){this._reader=e,this._rawEntry=t,this.name=t.name,this.nameBytes=t.nameBytes,this.size=t.uncompressedSize,this.compressedSize=t.compressedSize,this.comment=t.comment,this.commentBytes=t.commentBytes,this.compressionMethod=t.compressionMethod,this.lastModDate=dP(t.lastModFileDate,t.lastModFileTime),this.isDirectory=t.uncompressedSize===0&&t.name.endsWith("/"),this.encrypted=!!(t.generalPurposeBitFlag&1),this.externalFileAttributes=t.externalFileAttributes,this.versionMadeBy=t.versionMadeBy}async blob(e="application/octet-stream"){return await EP(this._reader,this._rawEntry,e)}async arrayBuffer(){return await SP(this._reader,this._rawEntry)}async text(){const e=await this.arrayBuffer();return gc(new Uint8Array(e))}async json(){const e=await this.text();return JSON.parse(e)}}const op=22,mP=65535,gP=101010256,yP=101075792;async function ca(n,e,t){return await n.read(e,t)}async function Dm(n,e,t,r){return n.sliceAsBlob?await n.sliceAsBlob(e,t,r):await n.read(e,t)}const _P={unsigned(){return 0}};function fn(n,e){return n[e]+n[e+1]*256}function Rn(n,e){return n[e]+n[e+1]*256+n[e+2]*65536+n[e+3]*16777216}function Ei(n,e){return Rn(n,e)+Rn(n,e+4)*4294967296}const vP=new TextDecoder;function gc(n,e){return Dc(n.buffer)&&(n=new Uint8Array(n)),vP.decode(n)}async function xP(n,e){const t=Math.min(op+mP,e),r=e-t,s=await ca(n,r,t);for(let i=t-op;i>=0;--i){if(Rn(s,i)!==gP)continue;const o=new Uint8Array(s.buffer,s.byteOffset+i,s.byteLength-i),a=fn(o,4);if(a!==0)throw new Error(`multi-volume zip files are not supported. This is volume: ${a}`);const c=fn(o,10),l=Rn(o,12),u=Rn(o,16),h=fn(o,20),d=o.length-op;if(h!==d)throw new Error(`invalid comment length. expected: ${d}, actual: ${h}`);const p=new Uint8Array(o.buffer,o.byteOffset+22,h),m=gc(p);return c===65535||u===4294967295?await wP(n,r+i,m,p):await Aw(n,u,l,c,m,p)}throw new Error("could not find end of central directory. maybe not zip file")}const bP=117853008;async function wP(n,e,t,r){const s=e-20,i=await ca(n,s,20);if(Rn(i,0)!==bP)throw new Error("invalid zip64 end of central directory locator signature");const o=Ei(i,8),a=await ca(n,o,56);if(Rn(a,0)!==yP)throw new Error("invalid zip64 end of central directory record signature");const c=Ei(a,32),l=Ei(a,40),u=Ei(a,48);return Aw(n,u,l,c,t,r)}const TP=33639248;async function Aw(n,e,t,r,s,i){let o=0;const a=await ca(n,e,t),c=[];for(let u=0;u<r;++u){const h=a.subarray(o,o+46),d=Rn(h,0);if(d!==TP)throw new Error(`invalid central directory file header signature: 0x${d.toString(16)}`);const p={versionMadeBy:fn(h,4),versionNeededToExtract:fn(h,6),generalPurposeBitFlag:fn(h,8),compressionMethod:fn(h,10),lastModFileTime:fn(h,12),lastModFileDate:fn(h,14),crc32:Rn(h,16),compressedSize:Rn(h,20),uncompressedSize:Rn(h,24),fileNameLength:fn(h,28),extraFieldLength:fn(h,30),fileCommentLength:fn(h,32),internalFileAttributes:fn(h,36),externalFileAttributes:Rn(h,38),relativeOffsetOfLocalHeader:Rn(h,42)};if(p.generalPurposeBitFlag&64)throw new Error("strong encryption is not supported");o+=46;const m=a.subarray(o,o+p.fileNameLength+p.extraFieldLength+p.fileCommentLength);p.nameBytes=m.slice(0,p.fileNameLength),p.name=gc(p.nameBytes);const g=p.fileNameLength+p.extraFieldLength,y=m.slice(p.fileNameLength,g);p.extraFields=[];let x=0;for(;x<y.length-3;){const v=fn(y,x+0),_=fn(y,x+2),w=x+4,E=w+_;if(E>y.length)throw new Error("extra field length exceeds extra field buffer size");p.extraFields.push({id:v,data:y.slice(w,E)}),x=E}if(p.commentBytes=m.slice(g,g+p.fileCommentLength),p.comment=gc(p.commentBytes),o+=m.length,p.uncompressedSize===4294967295||p.compressedSize===4294967295||p.relativeOffsetOfLocalHeader===4294967295){const v=p.extraFields.find(E=>E.id===1);if(!v)throw new Error("expected zip64 extended information extra field");const _=v.data;let w=0;if(p.uncompressedSize===4294967295){if(w+8>_.length)throw new Error("zip64 extended information extra field does not include uncompressed size");p.uncompressedSize=Ei(_,w),w+=8}if(p.compressedSize===4294967295){if(w+8>_.length)throw new Error("zip64 extended information extra field does not include compressed size");p.compressedSize=Ei(_,w),w+=8}if(p.relativeOffsetOfLocalHeader===4294967295){if(w+8>_.length)throw new Error("zip64 extended information extra field does not include relative header offset");p.relativeOffsetOfLocalHeader=Ei(_,w),w+=8}}const b=p.extraFields.find(v=>v.id===28789&&v.data.length>=6&&v.data[0]===1&&Rn(v.data,1),_P.unsigned(p.nameBytes));if(b&&(p.fileName=gc(b.data.slice(5))),p.compressionMethod===0){let v=p.uncompressedSize;if((p.generalPurposeBitFlag&1)!==0&&(v+=12),p.compressedSize!==v)throw new Error(`compressed size mismatch for stored file: ${p.compressedSize} != ${v}`)}c.push(p)}return{zip:{comment:s,commentBytes:i},entries:c.map(u=>new pP(n,u))}}async function Cw(n,e){if(e.generalPurposeBitFlag&1)throw new Error("encrypted entries not supported");const t=await ca(n,e.relativeOffsetOfLocalHeader,30),r=await n.getLength(),s=Rn(t,0);if(s!==67324752)throw new Error(`invalid local file header signature: 0x${s.toString(16)}`);const i=fn(t,26),o=fn(t,28),a=e.relativeOffsetOfLocalHeader+t.length+i+o;let c;if(e.compressionMethod===0)c=!1;else if(e.compressionMethod===8)c=!0;else throw new Error(`unsupported compression method: ${e.compressionMethod}`);const l=a,u=l+e.compressedSize;if(e.compressedSize!==0&&u>r)throw new Error(`file data overflows file bounds: ${l} + ${e.compressedSize} > ${r}`);return{decompress:c,fileDataStart:l}}async function SP(n,e){const{decompress:t,fileDataStart:r}=await Cw(n,e);if(!t){const o=await ca(n,r,e.compressedSize);return sP(o)?o.buffer:o.slice().buffer}const s=await Dm(n,r,e.compressedSize);return await Ew(s,e.uncompressedSize)}async function EP(n,e,t){const{decompress:r,fileDataStart:s}=await Cw(n,e);if(!r){const a=await Dm(n,s,e.compressedSize,t);return ww(a)?a:new Blob([Dc(a.buffer)?new Uint8Array(a):a],{type:t})}const i=await Dm(n,s,e.compressedSize);return await Ew(i,e.uncompressedSize,t)}async function AP(n){let e;if(typeof Blob<"u"&&n instanceof Blob)e=new Mv(n);else if(n instanceof ArrayBuffer||n&&n.buffer&&n.buffer instanceof ArrayBuffer)e=new kv(n);else if(Dc(n)||Dc(n.buffer))e=new kv(n);else if(typeof n=="string"){const r=await fetch(n);if(!r.ok)throw new Error(`failed http request ${n}, status: ${r.status}: ${r.statusText}`);const s=await r.blob();e=new Mv(s)}else if(typeof n.getLength=="function"&&typeof n.read=="function")e=n;else throw new Error("unsupported source type");const t=await e.getLength();if(t>Number.MAX_SAFE_INTEGER)throw new Error(`file too large. size: ${t}. Only file sizes up 4503599627370496 bytes are supported`);return await xP(e,t)}async function CP(n){const{zip:e,entries:t}=await AP(n);return{zip:e,entries:Object.fromEntries(t.map(r=>[r.name,r]))}}function RP(n){if(!("compressionMethod"in n)||!("_rawEntry"in n))return!1;const e=n._rawEntry;return typeof n.compressionMethod=="number"&&typeof e=="object"&&e!==null&&"relativeOffsetOfLocalHeader"in e&&typeof e.relativeOffsetOfLocalHeader=="number"}class IP{constructor(e){S(this,"blob");this.blob=e}async getLength(){return this.blob.size}async read(e,t){const r=this.blob.slice(e,e+t);return new Uint8Array(await r.arrayBuffer())}}var sa;class PP{constructor(e,t={}){S(this,"url");S(this,"length");st(this,sa);this.url=e,$e(this,sa,t.overrides??{})}async getLength(){if(this.length===void 0){const e=await fetch(this.url,{...pe(this,sa),method:"HEAD"});if(vv(e.ok,`failed http request ${this.url}, status: ${e.status}: ${e.statusText}`),this.length=Number(e.headers.get("content-length")),Number.isNaN(this.length))throw Error("could not get length")}return this.length}async read(e,t){if(t===0)return new Uint8Array(0);const r=await nd(this.url,e,t,pe(this,sa));return vv(r.ok,`failed http request ${this.url}, status: ${r.status} offset: ${e} size: ${t}: ${r.statusText}`),new Uint8Array(await r.arrayBuffer())}}sa=new WeakMap;class _f{constructor(e,t={}){S(this,"info");S(this,"reader");this.reader=e,this.info=CP(e).then(r=>(t.transformEntries&&(r.entries=t.transformEntries(r.entries)),r))}async getEntryDataOffset(e){const t=e._rawEntry.relativeOffsetOfLocalHeader,r=await this.reader.read(t,30),s=r[26]+r[27]*256,i=r[28]+r[29]*256;return t+30+s+i}async get(e){let t=(await this.info).entries[Hu(e)];if(t)return new Uint8Array(await t.arrayBuffer())}async getRange(e,t){const r=(await this.info).entries[Hu(e)];if(!r)return;if(!RP(r))throw new Error("ZipFileStore.getRange requires internal unzipit properties that are not available. This may indicate an incompatible version of unzipit.");if(r.compressionMethod!==0){const i=await this.get(e);return i?"suffixLength"in t?i.slice(-t.suffixLength):i.slice(t.offset,t.offset+t.length):void 0}const s=await this.getEntryDataOffset(r);if("suffixLength"in t){const i=s+r.size-t.suffixLength;return this.reader.read(i,t.suffixLength)}return this.reader.read(s+t.offset,t.length)}async has(e){return Hu(e)in(await this.info).entries}static fromUrl(e,t={}){return new _f(new PP(e,t),t)}static fromBlob(e,t={}){return new _f(new IP(e),t)}}var Xn,Dt,Ht,Fs,bl,Bs,lt,Lm,cr,Rw,Fm,Bm,Um,Iw,$m;class OP extends Map{constructor(t={}){super();st(this,lt);st(this,Xn,0);st(this,Dt,new Map);st(this,Ht,new Map);st(this,Fs);st(this,bl);st(this,Bs);if(!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof t.maxAge=="number"&&t.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");$e(this,Fs,t.maxSize),$e(this,bl,t.maxAge||Number.POSITIVE_INFINITY),$e(this,Bs,t.onEviction)}get __oldCache(){return pe(this,Ht)}get(t){if(pe(this,Dt).has(t)){const r=pe(this,Dt).get(t);return St(this,lt,Fm).call(this,t,r)}if(pe(this,Ht).has(t)){const r=pe(this,Ht).get(t);if(St(this,lt,cr).call(this,t,r)===!1)return St(this,lt,Iw).call(this,t,r),r.value}}set(t,r,{maxAge:s=pe(this,bl)}={}){const i=typeof s=="number"&&s!==Number.POSITIVE_INFINITY?Date.now()+s:void 0;return pe(this,Dt).has(t)?pe(this,Dt).set(t,{value:r,expiry:i}):St(this,lt,Um).call(this,t,{value:r,expiry:i}),this}has(t){return pe(this,Dt).has(t)?!St(this,lt,cr).call(this,t,pe(this,Dt).get(t)):pe(this,Ht).has(t)?!St(this,lt,cr).call(this,t,pe(this,Ht).get(t)):!1}peek(t){if(pe(this,Dt).has(t))return St(this,lt,Bm).call(this,t,pe(this,Dt));if(pe(this,Ht).has(t))return St(this,lt,Bm).call(this,t,pe(this,Ht))}delete(t){const r=pe(this,Dt).delete(t);return r&&zd(this,Xn)._--,pe(this,Ht).delete(t)||r}clear(){pe(this,Dt).clear(),pe(this,Ht).clear(),$e(this,Xn,0)}resize(t){if(!(t&&t>0))throw new TypeError("`maxSize` must be a number greater than 0");const r=[...St(this,lt,$m).call(this)],s=r.length-t;s<0?($e(this,Dt,new Map(r)),$e(this,Ht,new Map),$e(this,Xn,r.length)):(s>0&&St(this,lt,Lm).call(this,r.slice(0,s)),$e(this,Ht,new Map(r.slice(s))),$e(this,Dt,new Map),$e(this,Xn,0)),$e(this,Fs,t)}*keys(){for(const[t]of this)yield t}*values(){for(const[,t]of this)yield t}*[Symbol.iterator](){for(const t of pe(this,Dt)){const[r,s]=t;St(this,lt,cr).call(this,r,s)===!1&&(yield[r,s.value])}for(const t of pe(this,Ht)){const[r,s]=t;pe(this,Dt).has(r)||St(this,lt,cr).call(this,r,s)===!1&&(yield[r,s.value])}}*entriesDescending(){let t=[...pe(this,Dt)];for(let r=t.length-1;r>=0;--r){const s=t[r],[i,o]=s;St(this,lt,cr).call(this,i,o)===!1&&(yield[i,o.value])}t=[...pe(this,Ht)];for(let r=t.length-1;r>=0;--r){const s=t[r],[i,o]=s;pe(this,Dt).has(i)||St(this,lt,cr).call(this,i,o)===!1&&(yield[i,o.value])}}*entriesAscending(){for(const[t,r]of St(this,lt,$m).call(this))yield[t,r.value]}get size(){if(!pe(this,Xn))return pe(this,Ht).size;let t=0;for(const r of pe(this,Ht).keys())pe(this,Dt).has(r)||t++;return Math.min(pe(this,Xn)+t,pe(this,Fs))}get maxSize(){return pe(this,Fs)}entries(){return this.entriesAscending()}forEach(t,r=this){for(const[s,i]of this.entriesAscending())t.call(r,i,s,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}Xn=new WeakMap,Dt=new WeakMap,Ht=new WeakMap,Fs=new WeakMap,bl=new WeakMap,Bs=new WeakMap,lt=new WeakSet,Lm=function(t){if(typeof pe(this,Bs)=="function")for(const[r,s]of t)pe(this,Bs).call(this,r,s.value)},cr=function(t,r){return typeof r.expiry=="number"&&r.expiry<=Date.now()?(typeof pe(this,Bs)=="function"&&pe(this,Bs).call(this,t,r.value),this.delete(t)):!1},Rw=function(t,r){if(St(this,lt,cr).call(this,t,r)===!1)return r.value},Fm=function(t,r){return r.expiry?St(this,lt,Rw).call(this,t,r):r.value},Bm=function(t,r){const s=r.get(t);return St(this,lt,Fm).call(this,t,s)},Um=function(t,r){pe(this,Dt).set(t,r),zd(this,Xn)._++,pe(this,Xn)>=pe(this,Fs)&&($e(this,Xn,0),St(this,lt,Lm).call(this,pe(this,Ht)),$e(this,Ht,pe(this,Dt)),$e(this,Dt,new Map))},Iw=function(t,r){pe(this,Ht).delete(t),St(this,lt,Um).call(this,t,r)},$m=function*(){for(const t of pe(this,Ht)){const[r,s]=t;pe(this,Dt).has(r)||St(this,lt,cr).call(this,r,s)===!1&&(yield t)}for(const t of pe(this,Dt)){const[r,s]=t;St(this,lt,cr).call(this,r,s)===!1&&(yield t)}};function Fv(n,e){return e?"suffixLength"in e?`${n}:-${e.suffixLength}`:`${n}:${e.offset}:${e.offset+e.length-1}`:n}function Bv(n){var e;return(e=n.split("/")[1])!=null&&e.includes(":")?`/.${n}`:n}function kP(n,e=100){const t=new OP({maxSize:e});let r=n.getRange?n.getRange.bind(n):void 0;function s(...i){const[o,a]=i,c=Fv(o),l=t.get(c);if(l)return l;const u=Bv(o),h=Promise.resolve(n.get(u,a));return t.set(c,h),h}if(r){const i=r;r=(...o)=>{const[a,c,l]=o,u=Fv(a,c),h=t.get(u);if(h)return h;const d=Bv(a),p=Promise.resolve(i==null?void 0:i(d,c,l)).catch(m=>{throw t.delete(u),m});return t.set(u,p),p}}return new Proxy(n,{get(i,o,a){return o==="get"?s:o==="getRange"&&r?r:Reflect.get(i,o,a)}})}const MP={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...MP}};const Nn=globalThis.mathgl.config;function NP(n,{precision:e=Nn.precision}={}){return n=DP(n),`${parseFloat(n.toPrecision(e))}`}function zi(n){return Array.isArray(n)||ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Bt(n,e,t){return FP(n,r=>Math.max(e,Math.min(t,r)))}function Oi(n,e,t){return zi(n)?n.map((r,s)=>Oi(r,e[s],t)):t*e+(1-t)*n}function ss(n,e,t){const r=Nn.EPSILON;try{if(n===e)return!0;if(zi(n)&&zi(e)){if(n.length!==e.length)return!1;for(let s=0;s<n.length;++s)if(!ss(n[s],e[s]))return!1;return!0}return n&&n.equals?n.equals(e):e&&e.equals?e.equals(n):typeof n=="number"&&typeof e=="number"?Math.abs(n-e)<=Nn.EPSILON*Math.max(1,Math.abs(n),Math.abs(e)):!1}finally{Nn.EPSILON=r}}function DP(n){return Math.round(n/Nn.EPSILON)*Nn.EPSILON}function LP(n){return n.clone?n.clone():new Array(n.length)}function FP(n,e,t){if(zi(n)){const r=n;t=t||LP(r);for(let s=0;s<t.length&&s<r.length;++s){const i=typeof n=="number"?n:n[s];t[s]=e(i,s,t)}return t}return e(n)}class j0 extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,t=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=e[r+t];return this.check()}toArray(e=[],t=0){for(let r=0;r<this.ELEMENTS;++r)e[t+r]=this[r];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:zi(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Nn)}formatString(e){let t="";for(let r=0;r<this.ELEMENTS;++r)t+=(r>0?", ":"")+NP(this[r],e);return`${e.printTypes?this.constructor.name:""}[${t}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!ss(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,r){if(r===void 0)return this.lerp(this,e,t);for(let s=0;s<this.ELEMENTS;++s){const i=e[s],o=typeof t=="number"?t:t[s];this[s]=i+r*(o-i)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e[r]),t[r]);return this.check()}add(...e){for(const t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]+=t[r];return this.check()}subtract(...e){for(const t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]-=t[r];return this.check()}scale(e){if(typeof e=="number")for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;else for(let t=0;t<this.ELEMENTS&&t<e.length;++t)this[t]*=e[t];return this.check()}multiplyByScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}check(){if(Nn.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e),t);return this.check()}get elements(){return this}}function BP(n,e){if(n.length!==e)return!1;for(let t=0;t<n.length;++t)if(!Number.isFinite(n[t]))return!1;return!0}function Pt(n){if(!Number.isFinite(n))throw new Error(`Invalid number ${JSON.stringify(n)}`);return n}function yc(n,e,t=""){if(Nn.debug&&!BP(n,e))throw new Error(`math.gl: ${t} some fields set to invalid numbers'`);return n}function Lc(n,e){if(!n)throw new Error(`math.gl assertion ${e}`)}class Pw extends j0{get x(){return this[0]}set x(e){this[0]=Pt(e)}get y(){return this[1]}set y(e){this[1]=Pt(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let r=0;r<this.ELEMENTS;++r){const s=this[r]-e[r];t+=s*s}return Pt(t)}dot(e){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*e[r];return Pt(t)}normalize(){const e=this.magnitude();if(e!==0)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(const t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]*=t[r];return this.check()}divide(...e){for(const t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return Lc(e>=0&&e<this.ELEMENTS,"index is out of range"),Pt(this[e])}setComponent(e,t){return Lc(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}const _c=1e-6;let mr=typeof Float32Array<"u"?Float32Array:Array;function UP(){const n=new mr(2);return mr!=Float32Array&&(n[0]=0,n[1]=0),n}function vf(n,e,t){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n}function Ow(n,e){return n[0]=-e[0],n[1]=-e[1],n}function kw(n,e,t,r){const s=e[0],i=e[1];return n[0]=s+r*(t[0]-s),n[1]=i+r*(t[1]-i),n}function $P(n,e,t){const r=e[0],s=e[1];return n[0]=t[0]*r+t[3]*s+t[6],n[1]=t[1]*r+t[4]*s+t[7],n}function VP(n,e,t){const r=e[0],s=e[1];return n[0]=t[0]*r+t[4]*s+t[12],n[1]=t[1]*r+t[5]*s+t[13],n}(function(){const n=UP();return function(e,t,r,s,i,o){let a,c;for(t||(t=2),r||(r=0),s?c=Math.min(s*t+r,e.length):c=e.length,a=r;a<c;a+=t)n[0]=e[a],n[1]=e[a+1],i(n,n,o),e[a]=n[0],e[a+1]=n[1];return e}})();function jP(n,e,t){const r=e[0],s=e[1],i=t[3]*r+t[7]*s||1;return n[0]=(t[0]*r+t[4]*s)/i,n[1]=(t[1]*r+t[5]*s)/i,n}function Mw(n,e,t){const r=e[0],s=e[1],i=e[2],o=t[3]*r+t[7]*s+t[11]*i||1;return n[0]=(t[0]*r+t[4]*s+t[8]*i)/o,n[1]=(t[1]*r+t[5]*s+t[9]*i)/o,n[2]=(t[2]*r+t[6]*s+t[10]*i)/o,n}function zP(n,e,t){const r=e[0],s=e[1];return n[0]=t[0]*r+t[2]*s,n[1]=t[1]*r+t[3]*s,n[2]=e[2],n}function WP(n,e,t){const r=e[0],s=e[1];return n[0]=t[0]*r+t[2]*s,n[1]=t[1]*r+t[3]*s,n[2]=e[2],n[3]=e[3],n}function Nw(n,e,t){const r=e[0],s=e[1],i=e[2];return n[0]=t[0]*r+t[3]*s+t[6]*i,n[1]=t[1]*r+t[4]*s+t[7]*i,n[2]=t[2]*r+t[5]*s+t[8]*i,n[3]=e[3],n}function Dw(){const n=new mr(3);return mr!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function HP(n){const e=n[0],t=n[1],r=n[2];return Math.sqrt(e*e+t*t+r*r)}function Uv(n,e,t){const r=new mr(3);return r[0]=n,r[1]=e,r[2]=t,r}function XP(n,e,t){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n}function ZP(n){const e=n[0],t=n[1],r=n[2];return e*e+t*t+r*r}function qP(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n}function YP(n,e){const t=e[0],r=e[1],s=e[2];let i=t*t+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),n[0]=e[0]*i,n[1]=e[1]*i,n[2]=e[2]*i,n}function Lw(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]}function qu(n,e,t){const r=e[0],s=e[1],i=e[2],o=t[0],a=t[1],c=t[2];return n[0]=s*c-i*a,n[1]=i*o-r*c,n[2]=r*a-s*o,n}function KP(n,e,t,r){const s=e[0],i=e[1],o=e[2];return n[0]=s+r*(t[0]-s),n[1]=i+r*(t[1]-i),n[2]=o+r*(t[2]-o),n}function z0(n,e,t){const r=e[0],s=e[1],i=e[2];let o=t[3]*r+t[7]*s+t[11]*i+t[15];return o=o||1,n[0]=(t[0]*r+t[4]*s+t[8]*i+t[12])/o,n[1]=(t[1]*r+t[5]*s+t[9]*i+t[13])/o,n[2]=(t[2]*r+t[6]*s+t[10]*i+t[14])/o,n}function Fw(n,e,t){const r=e[0],s=e[1],i=e[2];return n[0]=r*t[0]+s*t[3]+i*t[6],n[1]=r*t[1]+s*t[4]+i*t[7],n[2]=r*t[2]+s*t[5]+i*t[8],n}function Bw(n,e,t){const r=t[0],s=t[1],i=t[2],o=t[3],a=e[0],c=e[1],l=e[2];let u=s*l-i*c,h=i*a-r*l,d=r*c-s*a,p=s*d-i*h,m=i*u-r*d,g=r*h-s*u;const y=o*2;return u*=y,h*=y,d*=y,p*=2,m*=2,g*=2,n[0]=a+u+p,n[1]=c+h+m,n[2]=l+d+g,n}function GP(n,e,t,r){const s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),n[0]=i[0]+t[0],n[1]=i[1]+t[1],n[2]=i[2]+t[2],n}function JP(n,e,t,r){const s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),n[0]=i[0]+t[0],n[1]=i[1]+t[1],n[2]=i[2]+t[2],n}function QP(n,e,t,r){const s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],n[0]=i[0]+t[0],n[1]=i[1]+t[1],n[2]=i[2]+t[2],n}function eO(n,e){const t=n[0],r=n[1],s=n[2],i=e[0],o=e[1],a=e[2],c=Math.sqrt((t*t+r*r+s*s)*(i*i+o*o+a*a)),l=c&&Lw(n,e)/c;return Math.acos(Math.min(Math.max(l,-1),1))}const Uw=XP,$w=HP,ap=ZP;(function(){const n=Dw();return function(e,t,r,s,i,o){let a,c;for(t||(t=3),r||(r=0),s?c=Math.min(s*t+r,e.length):c=e.length,a=r;a<c;a+=t)n[0]=e[a],n[1]=e[a+1],n[2]=e[a+2],i(n,n,o),e[a]=n[0],e[a+1]=n[1],e[a+2]=n[2];return e}})();const cp=[0,0,0];let hu;class Oe extends Pw{static get ZERO(){return hu||(hu=new Oe(0,0,0),Object.freeze(hu)),hu}constructor(e=0,t=0,r=0){super(-0,-0,-0),arguments.length===1&&zi(e)?this.copy(e):(Nn.debug&&(Pt(e),Pt(t),Pt(r)),this[0]=e,this[1]=t,this[2]=r)}set(e,t,r){return this[0]=e,this[1]=t,this[2]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return Nn.debug&&(Pt(e.x),Pt(e.y),Pt(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=Pt(e)}angle(e){return eO(this,e)}cross(e){return qu(this,this,e),this.check()}rotateX({radians:e,origin:t=cp}){return GP(this,this,t,e),this.check()}rotateY({radians:e,origin:t=cp}){return JP(this,this,t,e),this.check()}rotateZ({radians:e,origin:t=cp}){return QP(this,this,t,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return z0(this,this,e),this.check()}transformAsVector(e){return Mw(this,this,e),this.check()}transformByMatrix3(e){return Fw(this,this,e),this.check()}transformByMatrix2(e){return zP(this,this,e),this.check()}transformByQuaternion(e){return Bw(this,this,e),this.check()}}let du;class W0 extends Pw{static get ZERO(){return du||(du=new W0(0,0,0,0),Object.freeze(du)),du}constructor(e=0,t=0,r=0,s=0){super(-0,-0,-0,-0),zi(e)&&arguments.length===1?this.copy(e):(Nn.debug&&(Pt(e),Pt(t),Pt(r),Pt(s)),this[0]=e,this[1]=t,this[2]=r,this[3]=s)}set(e,t,r,s){return this[0]=e,this[1]=t,this[2]=r,this[3]=s,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return Nn.debug&&(Pt(e.x),Pt(e.y),Pt(e.z),Pt(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=Pt(e)}get w(){return this[3]}set w(e){this[3]=Pt(e)}transform(e){return z0(this,this,e),this.check()}transformByMatrix3(e){return Nw(this,this,e),this.check()}transformByMatrix2(e){return WP(this,this,e),this.check()}transformByQuaternion(e){return Bw(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}}class Vw extends j0{toString(){let e="[";if(Nn.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let r=0;r<this.RANK;++r)e+=` ${this[r*this.RANK+t]}`}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=` ${this[t]}`}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,r){return this[t*this.RANK+e]=Pt(r),this}getColumn(e,t=new Array(this.RANK).fill(-0)){const r=e*this.RANK;for(let s=0;s<this.RANK;++s)t[s]=this[r+s];return t}setColumn(e,t){const r=e*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=t[s];return this}}function tO(){const n=new mr(9);return mr!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function nO(n,e){if(n===e){const t=e[1],r=e[2],s=e[5];n[1]=e[3],n[2]=e[6],n[3]=t,n[5]=e[7],n[6]=r,n[7]=s}else n[0]=e[0],n[1]=e[3],n[2]=e[6],n[3]=e[1],n[4]=e[4],n[5]=e[7],n[6]=e[2],n[7]=e[5],n[8]=e[8];return n}function rO(n,e){const t=e[0],r=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=u*o-a*l,d=-u*i+a*c,p=l*i-o*c;let m=t*h+r*d+s*p;return m?(m=1/m,n[0]=h*m,n[1]=(-u*r+s*l)*m,n[2]=(a*r-s*o)*m,n[3]=d*m,n[4]=(u*t-s*c)*m,n[5]=(-a*t+s*i)*m,n[6]=p*m,n[7]=(-l*t+r*c)*m,n[8]=(o*t-r*i)*m,n):null}function sO(n){const e=n[0],t=n[1],r=n[2],s=n[3],i=n[4],o=n[5],a=n[6],c=n[7],l=n[8];return e*(l*i-o*c)+t*(-l*s+o*a)+r*(c*s-i*a)}function $v(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],d=t[0],p=t[1],m=t[2],g=t[3],y=t[4],x=t[5],b=t[6],v=t[7],_=t[8];return n[0]=d*r+p*o+m*l,n[1]=d*s+p*a+m*u,n[2]=d*i+p*c+m*h,n[3]=g*r+y*o+x*l,n[4]=g*s+y*a+x*u,n[5]=g*i+y*c+x*h,n[6]=b*r+v*o+_*l,n[7]=b*s+v*a+_*u,n[8]=b*i+v*c+_*h,n}function iO(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],d=t[0],p=t[1];return n[0]=r,n[1]=s,n[2]=i,n[3]=o,n[4]=a,n[5]=c,n[6]=d*r+p*o+l,n[7]=d*s+p*a+u,n[8]=d*i+p*c+h,n}function oO(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],d=Math.sin(t),p=Math.cos(t);return n[0]=p*r+d*o,n[1]=p*s+d*a,n[2]=p*i+d*c,n[3]=p*o-d*r,n[4]=p*a-d*s,n[5]=p*c-d*i,n[6]=l,n[7]=u,n[8]=h,n}function Vv(n,e,t){const r=t[0],s=t[1];return n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=s*e[3],n[4]=s*e[4],n[5]=s*e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n}function aO(n,e){const t=e[0],r=e[1],s=e[2],i=e[3],o=t+t,a=r+r,c=s+s,l=t*o,u=r*o,h=r*a,d=s*o,p=s*a,m=s*c,g=i*o,y=i*a,x=i*c;return n[0]=1-h-m,n[3]=u-x,n[6]=d+y,n[1]=u+x,n[4]=1-l-m,n[7]=p-g,n[2]=d-y,n[5]=p+g,n[8]=1-l-h,n}var Vm;(function(n){n[n.COL0ROW0=0]="COL0ROW0",n[n.COL0ROW1=1]="COL0ROW1",n[n.COL0ROW2=2]="COL0ROW2",n[n.COL1ROW0=3]="COL1ROW0",n[n.COL1ROW1=4]="COL1ROW1",n[n.COL1ROW2=5]="COL1ROW2",n[n.COL2ROW0=6]="COL2ROW0",n[n.COL2ROW1=7]="COL2ROW1",n[n.COL2ROW2=8]="COL2ROW2"})(Vm||(Vm={}));const cO=Object.freeze([1,0,0,0,1,0,0,0,1]);class dn extends Vw{static get IDENTITY(){return uO()}static get ZERO(){return lO()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Vm}constructor(e,...t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):t.length>0?this.copy([e,...t]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(cO)}fromObject(e){return this.check()}fromQuaternion(e){return aO(this,e),this.check()}set(e,t,r,s,i,o,a,c,l){return this[0]=e,this[1]=t,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(e,t,r,s,i,o,a,c,l){return this[0]=e,this[1]=s,this[2]=a,this[3]=t,this[4]=i,this[5]=c,this[6]=r,this[7]=o,this[8]=l,this.check()}determinant(){return sO(this)}transpose(){return nO(this,this),this.check()}invert(){return rO(this,this),this.check()}multiplyLeft(e){return $v(this,e,this),this.check()}multiplyRight(e){return $v(this,this,e),this.check()}rotate(e){return oO(this,this,e),this.check()}scale(e){return Array.isArray(e)?Vv(this,this,e):Vv(this,this,[e,e]),this.check()}translate(e){return iO(this,this,e),this.check()}transform(e,t){let r;switch(e.length){case 2:r=$P(t||[-0,-0],e,this);break;case 3:r=Fw(t||[-0,-0,-0],e,this);break;case 4:r=Nw(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return yc(r,e.length),r}transformVector(e,t){return this.transform(e,t)}transformVector2(e,t){return this.transform(e,t)}transformVector3(e,t){return this.transform(e,t)}}let pu,mu=null;function lO(){return pu||(pu=new dn([0,0,0,0,0,0,0,0,0]),Object.freeze(pu)),pu}function uO(){return mu||(mu=new dn,Object.freeze(mu)),mu}function fO(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function hO(n,e){if(n===e){const t=e[1],r=e[2],s=e[3],i=e[6],o=e[7],a=e[11];n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=t,n[6]=e[9],n[7]=e[13],n[8]=r,n[9]=i,n[11]=e[14],n[12]=s,n[13]=o,n[14]=a}else n[0]=e[0],n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=e[1],n[5]=e[5],n[6]=e[9],n[7]=e[13],n[8]=e[2],n[9]=e[6],n[10]=e[10],n[11]=e[14],n[12]=e[3],n[13]=e[7],n[14]=e[11],n[15]=e[15];return n}function jm(n,e){const t=e[0],r=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],p=e[11],m=e[12],g=e[13],y=e[14],x=e[15],b=t*a-r*o,v=t*c-s*o,_=t*l-i*o,w=r*c-s*a,E=r*l-i*a,N=s*l-i*c,F=u*g-h*m,$=u*y-d*m,I=u*x-p*m,te=h*y-d*g,R=h*x-p*g,re=d*x-p*y;let q=b*re-v*R+_*te+w*I-E*$+N*F;return q?(q=1/q,n[0]=(a*re-c*R+l*te)*q,n[1]=(s*R-r*re-i*te)*q,n[2]=(g*N-y*E+x*w)*q,n[3]=(d*E-h*N-p*w)*q,n[4]=(c*I-o*re-l*$)*q,n[5]=(t*re-s*I+i*$)*q,n[6]=(y*_-m*N-x*v)*q,n[7]=(u*N-d*_+p*v)*q,n[8]=(o*R-a*I+l*F)*q,n[9]=(r*I-t*R-i*F)*q,n[10]=(m*E-g*_+x*b)*q,n[11]=(h*_-u*E-p*b)*q,n[12]=(a*$-o*te-c*F)*q,n[13]=(t*te-r*$+s*F)*q,n[14]=(g*v-m*w-y*b)*q,n[15]=(u*w-h*v+d*b)*q,n):null}function dO(n){const e=n[0],t=n[1],r=n[2],s=n[3],i=n[4],o=n[5],a=n[6],c=n[7],l=n[8],u=n[9],h=n[10],d=n[11],p=n[12],m=n[13],g=n[14],y=n[15],x=e*o-t*i,b=e*a-r*i,v=t*a-r*o,_=l*m-u*p,w=l*g-h*p,E=u*g-h*m,N=e*E-t*w+r*_,F=i*E-o*w+a*_,$=l*v-u*b+h*x,I=p*v-m*b+g*x;return c*N-s*F+y*$-d*I}function ki(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],d=e[9],p=e[10],m=e[11],g=e[12],y=e[13],x=e[14],b=e[15];let v=t[0],_=t[1],w=t[2],E=t[3];return n[0]=v*r+_*a+w*h+E*g,n[1]=v*s+_*c+w*d+E*y,n[2]=v*i+_*l+w*p+E*x,n[3]=v*o+_*u+w*m+E*b,v=t[4],_=t[5],w=t[6],E=t[7],n[4]=v*r+_*a+w*h+E*g,n[5]=v*s+_*c+w*d+E*y,n[6]=v*i+_*l+w*p+E*x,n[7]=v*o+_*u+w*m+E*b,v=t[8],_=t[9],w=t[10],E=t[11],n[8]=v*r+_*a+w*h+E*g,n[9]=v*s+_*c+w*d+E*y,n[10]=v*i+_*l+w*p+E*x,n[11]=v*o+_*u+w*m+E*b,v=t[12],_=t[13],w=t[14],E=t[15],n[12]=v*r+_*a+w*h+E*g,n[13]=v*s+_*c+w*d+E*y,n[14]=v*i+_*l+w*p+E*x,n[15]=v*o+_*u+w*m+E*b,n}function xf(n,e,t){const r=t[0],s=t[1],i=t[2];let o,a,c,l,u,h,d,p,m,g,y,x;return e===n?(n[12]=e[0]*r+e[4]*s+e[8]*i+e[12],n[13]=e[1]*r+e[5]*s+e[9]*i+e[13],n[14]=e[2]*r+e[6]*s+e[10]*i+e[14],n[15]=e[3]*r+e[7]*s+e[11]*i+e[15]):(o=e[0],a=e[1],c=e[2],l=e[3],u=e[4],h=e[5],d=e[6],p=e[7],m=e[8],g=e[9],y=e[10],x=e[11],n[0]=o,n[1]=a,n[2]=c,n[3]=l,n[4]=u,n[5]=h,n[6]=d,n[7]=p,n[8]=m,n[9]=g,n[10]=y,n[11]=x,n[12]=o*r+u*s+m*i+e[12],n[13]=a*r+h*s+g*i+e[13],n[14]=c*r+d*s+y*i+e[14],n[15]=l*r+p*s+x*i+e[15]),n}function H0(n,e,t){const r=t[0],s=t[1],i=t[2];return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*r,n[4]=e[4]*s,n[5]=e[5]*s,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*i,n[9]=e[9]*i,n[10]=e[10]*i,n[11]=e[11]*i,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function pO(n,e,t,r){let s=r[0],i=r[1],o=r[2],a=Math.sqrt(s*s+i*i+o*o),c,l,u,h,d,p,m,g,y,x,b,v,_,w,E,N,F,$,I,te,R,re,q,de;return a<_c?null:(a=1/a,s*=a,i*=a,o*=a,l=Math.sin(t),c=Math.cos(t),u=1-c,h=e[0],d=e[1],p=e[2],m=e[3],g=e[4],y=e[5],x=e[6],b=e[7],v=e[8],_=e[9],w=e[10],E=e[11],N=s*s*u+c,F=i*s*u+o*l,$=o*s*u-i*l,I=s*i*u-o*l,te=i*i*u+c,R=o*i*u+s*l,re=s*o*u+i*l,q=i*o*u-s*l,de=o*o*u+c,n[0]=h*N+g*F+v*$,n[1]=d*N+y*F+_*$,n[2]=p*N+x*F+w*$,n[3]=m*N+b*F+E*$,n[4]=h*I+g*te+v*R,n[5]=d*I+y*te+_*R,n[6]=p*I+x*te+w*R,n[7]=m*I+b*te+E*R,n[8]=h*re+g*q+v*de,n[9]=d*re+y*q+_*de,n[10]=p*re+x*q+w*de,n[11]=m*re+b*q+E*de,e!==n&&(n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n)}function jw(n,e,t){const r=Math.sin(t),s=Math.cos(t),i=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],d=e[11];return e!==n&&(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[4]=i*s+l*r,n[5]=o*s+u*r,n[6]=a*s+h*r,n[7]=c*s+d*r,n[8]=l*s-i*r,n[9]=u*s-o*r,n[10]=h*s-a*r,n[11]=d*s-c*r,n}function mO(n,e,t){const r=Math.sin(t),s=Math.cos(t),i=e[0],o=e[1],a=e[2],c=e[3],l=e[8],u=e[9],h=e[10],d=e[11];return e!==n&&(n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=i*s-l*r,n[1]=o*s-u*r,n[2]=a*s-h*r,n[3]=c*s-d*r,n[8]=i*r+l*s,n[9]=o*r+u*s,n[10]=a*r+h*s,n[11]=c*r+d*s,n}function zw(n,e,t){const r=Math.sin(t),s=Math.cos(t),i=e[0],o=e[1],a=e[2],c=e[3],l=e[4],u=e[5],h=e[6],d=e[7];return e!==n&&(n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=i*s+l*r,n[1]=o*s+u*r,n[2]=a*s+h*r,n[3]=c*s+d*r,n[4]=l*s-i*r,n[5]=u*s-o*r,n[6]=h*s-a*r,n[7]=d*s-c*r,n}function gO(n,e){const t=e[0],r=e[1],s=e[2],i=e[4],o=e[5],a=e[6],c=e[8],l=e[9],u=e[10];return n[0]=Math.sqrt(t*t+r*r+s*s),n[1]=Math.sqrt(i*i+o*o+a*a),n[2]=Math.sqrt(c*c+l*l+u*u),n}function yO(n,e){const t=e[0],r=e[1],s=e[2],i=e[3],o=t+t,a=r+r,c=s+s,l=t*o,u=r*o,h=r*a,d=s*o,p=s*a,m=s*c,g=i*o,y=i*a,x=i*c;return n[0]=1-h-m,n[1]=u+x,n[2]=d-y,n[3]=0,n[4]=u-x,n[5]=1-l-m,n[6]=p+g,n[7]=0,n[8]=d+y,n[9]=p-g,n[10]=1-l-h,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function _O(n,e,t,r,s,i,o){const a=1/(t-e),c=1/(s-r),l=1/(i-o);return n[0]=i*2*a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i*2*c,n[6]=0,n[7]=0,n[8]=(t+e)*a,n[9]=(s+r)*c,n[10]=(o+i)*l,n[11]=-1,n[12]=0,n[13]=0,n[14]=o*i*2*l,n[15]=0,n}function vO(n,e,t,r,s){const i=1/Math.tan(e/2);if(n[0]=i/t,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,s!=null&&s!==1/0){const o=1/(r-s);n[10]=(s+r)*o,n[14]=2*s*r*o}else n[10]=-1,n[14]=-2*r;return n}const xO=vO;function bO(n,e,t,r,s,i,o){const a=1/(e-t),c=1/(r-s),l=1/(i-o);return n[0]=-2*a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*c,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*l,n[11]=0,n[12]=(e+t)*a,n[13]=(s+r)*c,n[14]=(o+i)*l,n[15]=1,n}const wO=bO;function TO(n,e,t,r){let s,i,o,a,c,l,u,h,d,p;const m=e[0],g=e[1],y=e[2],x=r[0],b=r[1],v=r[2],_=t[0],w=t[1],E=t[2];return Math.abs(m-_)<_c&&Math.abs(g-w)<_c&&Math.abs(y-E)<_c?fO(n):(h=m-_,d=g-w,p=y-E,s=1/Math.sqrt(h*h+d*d+p*p),h*=s,d*=s,p*=s,i=b*p-v*d,o=v*h-x*p,a=x*d-b*h,s=Math.sqrt(i*i+o*o+a*a),s?(s=1/s,i*=s,o*=s,a*=s):(i=0,o=0,a=0),c=d*a-p*o,l=p*i-h*a,u=h*o-d*i,s=Math.sqrt(c*c+l*l+u*u),s?(s=1/s,c*=s,l*=s,u*=s):(c=0,l=0,u=0),n[0]=i,n[1]=c,n[2]=h,n[3]=0,n[4]=o,n[5]=l,n[6]=d,n[7]=0,n[8]=a,n[9]=u,n[10]=p,n[11]=0,n[12]=-(i*m+o*g+a*y),n[13]=-(c*m+l*g+u*y),n[14]=-(h*m+d*g+p*y),n[15]=1,n)}function SO(){const n=new mr(4);return mr!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function EO(n,e,t){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n}function X0(n,e,t){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n}function AO(n){const e=n[0],t=n[1],r=n[2],s=n[3];return Math.sqrt(e*e+t*t+r*r+s*s)}function CO(n){const e=n[0],t=n[1],r=n[2],s=n[3];return e*e+t*t+r*r+s*s}function RO(n,e){const t=e[0],r=e[1],s=e[2],i=e[3];let o=t*t+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),n[0]=t*o,n[1]=r*o,n[2]=s*o,n[3]=i*o,n}function IO(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]*e[3]}function PO(n,e,t,r){const s=e[0],i=e[1],o=e[2],a=e[3];return n[0]=s+r*(t[0]-s),n[1]=i+r*(t[1]-i),n[2]=o+r*(t[2]-o),n[3]=a+r*(t[3]-a),n}function Aa(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3];return n[0]=t[0]*r+t[4]*s+t[8]*i+t[12]*o,n[1]=t[1]*r+t[5]*s+t[9]*i+t[13]*o,n[2]=t[2]*r+t[6]*s+t[10]*i+t[14]*o,n[3]=t[3]*r+t[7]*s+t[11]*i+t[15]*o,n}function OO(n,e,t){const r=e[0],s=e[1],i=e[2],o=t[0],a=t[1],c=t[2],l=t[3],u=l*r+a*i-c*s,h=l*s+c*r-o*i,d=l*i+o*s-a*r,p=-o*r-a*s-c*i;return n[0]=u*l+p*-o+h*-c-d*-a,n[1]=h*l+p*-a+d*-o-u*-c,n[2]=d*l+p*-c+u*-a-h*-o,n[3]=e[3],n}(function(){const n=SO();return function(e,t,r,s,i,o){let a,c;for(t||(t=4),r||(r=0),s?c=Math.min(s*t+r,e.length):c=e.length,a=r;a<c;a+=t)n[0]=e[a],n[1]=e[a+1],n[2]=e[a+2],n[3]=e[a+3],i(n,n,o),e[a]=n[0],e[a+1]=n[1],e[a+2]=n[2],e[a+3]=n[3];return e}})();var zm;(function(n){n[n.COL0ROW0=0]="COL0ROW0",n[n.COL0ROW1=1]="COL0ROW1",n[n.COL0ROW2=2]="COL0ROW2",n[n.COL0ROW3=3]="COL0ROW3",n[n.COL1ROW0=4]="COL1ROW0",n[n.COL1ROW1=5]="COL1ROW1",n[n.COL1ROW2=6]="COL1ROW2",n[n.COL1ROW3=7]="COL1ROW3",n[n.COL2ROW0=8]="COL2ROW0",n[n.COL2ROW1=9]="COL2ROW1",n[n.COL2ROW2=10]="COL2ROW2",n[n.COL2ROW3=11]="COL2ROW3",n[n.COL3ROW0=12]="COL3ROW0",n[n.COL3ROW1=13]="COL3ROW1",n[n.COL3ROW2=14]="COL3ROW2",n[n.COL3ROW3=15]="COL3ROW3"})(zm||(zm={}));const kO=45*Math.PI/180,MO=1,lp=.1,up=500,NO=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class Je extends Vw{static get IDENTITY(){return LO()}static get ZERO(){return DO()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return zm}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,r,s,i,o,a,c,l,u,h,d,p,m,g,y){return this[0]=e,this[1]=t,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this[9]=u,this[10]=h,this[11]=d,this[12]=p,this[13]=m,this[14]=g,this[15]=y,this.check()}setRowMajor(e,t,r,s,i,o,a,c,l,u,h,d,p,m,g,y){return this[0]=e,this[1]=i,this[2]=l,this[3]=p,this[4]=t,this[5]=o,this[6]=u,this[7]=m,this[8]=r,this[9]=a,this[10]=h,this[11]=g,this[12]=s,this[13]=c,this[14]=d,this[15]=y,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(NO)}fromObject(e){return this.check()}fromQuaternion(e){return yO(this,e),this.check()}frustum(e){const{left:t,right:r,bottom:s,top:i,near:o=lp,far:a=up}=e;return a===1/0?FO(this,t,r,s,i,o):_O(this,t,r,s,i,o,a),this.check()}lookAt(e){const{eye:t,center:r=[0,0,0],up:s=[0,1,0]}=e;return TO(this,t,r,s),this.check()}ortho(e){const{left:t,right:r,bottom:s,top:i,near:o=lp,far:a=up}=e;return wO(this,t,r,s,i,o,a),this.check()}orthographic(e){const{fovy:t=kO,aspect:r=MO,focalDistance:s=1,near:i=lp,far:o=up}=e;jv(t);const a=t/2,c=s*Math.tan(a),l=c*r;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:i,far:o})}perspective(e){const{fovy:t=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=e;return jv(t),xO(this,t,r,s,i),this.check()}determinant(){return dO(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const r=this.getScale(t),s=1/r[0],i=1/r[1],o=1/r[2];return e[0]=this[0]*s,e[1]=this[1]*i,e[2]=this[2]*o,e[3]=0,e[4]=this[4]*s,e[5]=this[5]*i,e[6]=this[6]*o,e[7]=0,e[8]=this[8]*s,e[9]=this[9]*i,e[10]=this[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const r=this.getScale(t),s=1/r[0],i=1/r[1],o=1/r[2];return e[0]=this[0]*s,e[1]=this[1]*i,e[2]=this[2]*o,e[3]=this[4]*s,e[4]=this[5]*i,e[5]=this[6]*o,e[6]=this[8]*s,e[7]=this[9]*i,e[8]=this[10]*o,e}transpose(){return hO(this,this),this.check()}invert(){return jm(this,this),this.check()}multiplyLeft(e){return ki(this,e,this),this.check()}multiplyRight(e){return ki(this,this,e),this.check()}rotateX(e){return jw(this,this,e),this.check()}rotateY(e){return mO(this,this,e),this.check()}rotateZ(e){return zw(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return pO(this,this,e,t),this.check()}scale(e){return H0(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return xf(this,this,e),this.check()}transform(e,t){return e.length===4?(t=Aa(t||[-0,-0,-0,-0],e,this),yc(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){const{length:r}=e;let s;switch(r){case 2:s=VP(t||[-0,-0],e,this);break;case 3:s=z0(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return yc(s,e.length),s}transformAsVector(e,t){let r;switch(e.length){case 2:r=jP(t||[-0,-0],e,this);break;case 3:r=Mw(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return yc(r,e.length),r}transformPoint(e,t){return this.transformAsPoint(e,t)}transformVector(e,t){return this.transformAsPoint(e,t)}transformDirection(e,t){return this.transformAsVector(e,t)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,r){return this.identity().translate([e,t,r])}}let gu,yu;function DO(){return gu||(gu=new Je([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(gu)),gu}function LO(){return yu||(yu=new Je,Object.freeze(yu)),yu}function jv(n){if(n>Math.PI*2)throw Error("expected radians")}function FO(n,e,t,r,s,i){const o=2*i/(t-e),a=2*i/(s-r),c=(t+e)/(t-e),l=(s+r)/(s-r),u=-1,h=-1,d=-2*i;return n[0]=o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=a,n[6]=0,n[7]=0,n[8]=c,n[9]=l,n[10]=u,n[11]=h,n[12]=0,n[13]=0,n[14]=d,n[15]=0,n}function zv(){const n=new mr(4);return mr!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function BO(n){return n[0]=0,n[1]=0,n[2]=0,n[3]=1,n}function Ww(n,e,t){t=t*.5;const r=Math.sin(t);return n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=Math.cos(t),n}function Wv(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3],a=t[0],c=t[1],l=t[2],u=t[3];return n[0]=r*u+o*a+s*l-i*c,n[1]=s*u+o*c+i*a-r*l,n[2]=i*u+o*l+r*c-s*a,n[3]=o*u-r*a-s*c-i*l,n}function UO(n,e,t){t*=.5;const r=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return n[0]=r*c+o*a,n[1]=s*c+i*a,n[2]=i*c-s*a,n[3]=o*c-r*a,n}function $O(n,e,t){t*=.5;const r=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return n[0]=r*c-i*a,n[1]=s*c+o*a,n[2]=i*c+r*a,n[3]=o*c-s*a,n}function VO(n,e,t){t*=.5;const r=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return n[0]=r*c+s*a,n[1]=s*c-r*a,n[2]=i*c+o*a,n[3]=o*c-i*a,n}function jO(n,e){const t=e[0],r=e[1],s=e[2];return n[0]=t,n[1]=r,n[2]=s,n[3]=Math.sqrt(Math.abs(1-t*t-r*r-s*s)),n}function Yu(n,e,t,r){const s=e[0],i=e[1],o=e[2],a=e[3];let c=t[0],l=t[1],u=t[2],h=t[3],d,p,m,g,y;return d=s*c+i*l+o*u+a*h,d<0&&(d=-d,c=-c,l=-l,u=-u,h=-h),1-d>_c?(p=Math.acos(d),y=Math.sin(p),m=Math.sin((1-r)*p)/y,g=Math.sin(r*p)/y):(m=1-r,g=r),n[0]=m*s+g*c,n[1]=m*i+g*l,n[2]=m*o+g*u,n[3]=m*a+g*h,n}function zO(n,e){const t=e[0],r=e[1],s=e[2],i=e[3],o=t*t+r*r+s*s+i*i,a=o?1/o:0;return n[0]=-t*a,n[1]=-r*a,n[2]=-s*a,n[3]=i*a,n}function WO(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n[3]=e[3],n}function Hw(n,e){const t=e[0]+e[4]+e[8];let r;if(t>0)r=Math.sqrt(t+1),n[3]=.5*r,r=.5/r,n[0]=(e[5]-e[7])*r,n[1]=(e[6]-e[2])*r,n[2]=(e[1]-e[3])*r;else{let s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);const i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(e[s*3+s]-e[i*3+i]-e[o*3+o]+1),n[s]=.5*r,r=.5/r,n[3]=(e[i*3+o]-e[o*3+i])*r,n[i]=(e[i*3+s]+e[s*3+i])*r,n[o]=(e[o*3+s]+e[s*3+o])*r}return n}const HO=EO,XO=X0,ZO=IO,qO=PO,YO=AO,KO=CO,Xw=RO,GO=function(){const n=Dw(),e=Uv(1,0,0),t=Uv(0,1,0);return function(r,s,i){const o=Lw(s,i);return o<-.999999?(qu(n,e,s),$w(n)<1e-6&&qu(n,t,s),YP(n,n),Ww(r,n,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(qu(n,s,i),r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=1+o,Xw(r,r))}}();(function(){const n=zv(),e=zv();return function(t,r,s,i,o,a){return Yu(n,r,o,a),Yu(e,s,i,a),Yu(t,n,e,2*a*(1-a)),t}})();(function(){const n=tO();return function(e,t,r,s){return n[0]=r[0],n[3]=r[1],n[6]=r[2],n[1]=s[0],n[4]=s[1],n[7]=s[2],n[2]=-t[0],n[5]=-t[1],n[8]=-t[2],Xw(e,Hw(e,n))}})();const JO=[0,0,0,1];class Hv extends j0{constructor(e=0,t=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,t,r,s)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,r,s){return this[0]=e,this[1]=t,this[2]=r,this[3]=s,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return Hw(this,e),this.check()}fromAxisRotation(e,t){return Ww(this,e,t),this.check()}identity(){return BO(this),this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=Pt(e)}get y(){return this[1]}set y(e){this[1]=Pt(e)}get z(){return this[2]}set z(e){this[2]=Pt(e)}get w(){return this[3]}set w(e){this[3]=Pt(e)}len(){return YO(this)}lengthSquared(){return KO(this)}dot(e){return ZO(this,e)}rotationTo(e,t){return GO(this,e,t),this.check()}add(e){return HO(this,this,e),this.check()}calculateW(){return jO(this,this),this.check()}conjugate(){return WO(this,this),this.check()}invert(){return zO(this,this),this.check()}lerp(e,t,r){return r===void 0?this.lerp(this,e,t):(qO(this,e,t,r),this.check())}multiplyRight(e){return Wv(this,this,e),this.check()}multiplyLeft(e){return Wv(this,e,this),this.check()}normalize(){const e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,e===0&&(this[3]=1),this.check()}rotateX(e){return UO(this,this,e),this.check()}rotateY(e){return $O(this,this,e),this.check()}rotateZ(e){return VO(this,this,e),this.check()}scale(e){return XO(this,this,e),this.check()}slerp(e,t,r){let s,i,o;switch(arguments.length){case 1:({start:s=JO,target:i,ratio:o}=e);break;case 2:s=this,i=e,o=t;break;default:s=e,i=t,o=r}return Yu(this,s,i,o),this.check()}transformVector4(e,t=new W0){return OO(t,e,this),yc(t,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}}const QO=1e-15,ek=1e-20,Xv=()=>{};function Zw(n){const e=`[${n}]`;return{debug:Xv,info:Xv,warn:(t,...r)=>console.warn(`${e} ${t}`,...r),error:(t,...r)=>console.error(`${e} ${t}`,...r)}}const qw=Zw("vizarr");let tc=qw;function Wm(n){tc=n??qw}const kt={debug:(n,...e)=>tc.debug(n,...e),info:(n,...e)=>tc.info(n,...e),warn:(n,...e)=>tc.warn(n,...e),error:(n,...e)=>tc.error(n,...e)},Mi=6;function tk(n,e,t,r=""){const s=`${n}\0${r}`;let i=2166136261;for(let o=0;o<s.length;o++)i^=s.charCodeAt(o),i=Math.imul(i,16777619);return`${(i>>>0).toString(36)}-${e}-${t}`}const bf="https://github.com/BioNGFF/vizarr",Lr={cyan:"#00FFFF",yellow:"#FFFF00",magenta:"#FF00FF",red:"#FF0000",green:"#00FF00",blue:"#0000FF",white:"#FFFFFF"},nk=[Lr.magenta,Lr.green],rk=[Lr.red,Lr.green,Lr.blue],Zv=Object.values(Lr).slice(0,Mi);async function Yw(n){if(typeof n=="string"){let e,t="/";if(n.endsWith(".json")){const[{default:s},i]=await Promise.all([Promise.resolve().then(()=>require("./ref-DIdrEHgO.cjs")),fetch(n).then(o=>o.json())]);e=s.fromSpec(i),kt.debug("Store resolved",{source:n,store:"ReferenceStore"})}else try{const s=_f.fromUrl(n);await s.has("/"),e=s,kt.debug("Store resolved",{source:n,store:"ZipFileStore"})}catch{const s=new URL(n);t=sk(s.pathname),s.pathname="/",e=new pI(s.href),kt.debug("Store resolved",{source:n,store:"FetchStore"})}return new ai(kP(e),t)}return vw(n)}function sk(n){return n==="/"||n.startsWith("/")?n:`/${n}`}async function fp(n,e){const t=new TextDecoder;if(e.path&&(n=n.resolve(e.path)),e.zarrVersion===3){const o=await sn.v3(n).then(a=>a.attrs);return la(o)}const r=n.resolve(".zattrs"),s=await n.store.get(r.path),i=s?JSON.parse(t.decode(s)):{};return la(i)}async function Z0(n,e){const{datasets:t}=e[0]||[{path:"0"}];return Promise.all(t.map(({path:r})=>sn(n.resolve(r),{kind:"array",attrs:!1})))}function q0(n){n.startsWith("#")&&(n=n.slice(1));const e=Number.parseInt(n.slice(0,2),16),t=Number.parseInt(n.slice(2,4),16),r=Number.parseInt(n.slice(4,6),16);return[e,t,r]}function Fc(n){return Array.from({length:n},(e,t)=>t)}function ik(n,e=" "){for(;n.length>0&&e.includes(n.charAt(n.length-1));)n=n.substr(0,n.length-1);return n}function Bo(...n){return n.filter(e=>e!==void 0).map(e=>ik(e,"/")).join("/")}function ok(n,e){return(!e||e.length!==n.shape.length)&&(e=n.shape.slice(0,-2).map((r,s)=>`${s}`).concat(["y","x"])),e}function Kw(n){return Fc(n).map(e=>`channel_${e}`)}function qv(n){return n==="t"?"time":n==="c"?"channel":"space"}function Y0(n){return typeof n[0]=="object"&&n[0]&&"axes"in n[0]&&Array.isArray(n[0].axes)?n[0].axes.map(t=>{if(typeof t=="string")return{name:t,type:qv(t)};const{name:r,type:s,unit:i}=t;return{name:r,type:s??qv(r),unit:i}}):[{type:"channel",name:"c"},{type:"space",name:"z"},{type:"space",name:"y"},{type:"space",name:"x"}]}function Cl(n){return n.map(t=>t.name)}function Gw(n,e){return e||(n<=Mi?e=Array(n).fill(!0):e=[...Array(Mi).fill(!0),...Array(n-Mi).fill(!1)]),e}function Jw(n,e){let t=[];if(n===1)t=[Lr.white];else if(n===2)t=nk;else if(n===3)t=rk;else if(n<=Mi)t=Zv.slice(0,n);else{t=Array(n).fill(Lr.white);const r=e.flatMap((s,i)=>s?i:[]);for(const[s,i]of r.entries())t[i]=Zv[s]}return t}function Qw(n){const e=n[n.length-1];return e===3||e===4}function Rl(n){const e=Qw(n.shape),[t,r]=n.chunks.slice(e?-3:-2),s=Math.min(t,r);return 2**Math.floor(Math.log2(s))}function K0(n){const{image:e,viewport:t,padding:r,matrix:s=new Je().identity()}=n,i=[[0,0,0],[e.width,0,0],[e.width,e.height,0],[0,e.height,0]].map(d=>s.transformAsPoint(d)),o=Math.min(...i.map(d=>d[0])),a=Math.max(...i.map(d=>d[0])),c=Math.min(...i.map(d=>d[1])),l=Math.max(...i.map(d=>d[1])),u=t.width-2*r,h=t.height-2*r;return{zoom:Math.log2(Math.min(u/(a-o),h/(l-c))),target:[(o+a)/2,(c+l)/2]}}function ak(n){return Array.isArray(n)?n.length===16&&n.every(e=>typeof e=="number"):!1}function id(n){if(!n)return Je.IDENTITY;const e=new Je;try{const t=typeof n=="string"?JSON.parse(n):n;wt(ak(t),"Invalid modelMatrix size. Must be 16."),e.setRowMajor(...t)}catch{kt.warn("Failed to parse modelMatrix, using identity.",{model_matrix:n})}return e}async function G0(n,e){const{data:t}=await n.getRaster({selection:e});let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(let i=0;i<t.length;i++)t[i]>s&&(s=t[i]),t[i]<r&&(r=t[i]);return r===s&&(r=0,s=1),[r,s]}async function eT(n,e,t,r){const s=n.shape.map(()=>0),i=n.shape[e];return e!==-1&&wt(i===t.length,"visibilities do not match number of channels"),Promise.all(t.map(async(o,a)=>{if(!o)return;const c=[...s];return e>-1&&(c[e]=a),G0(n,c)}))}function ck(){let n,e;return{promise:new Promise((r,s)=>{n=r,e=s}),resolve:n,reject:e}}function lk(){let n=new EventTarget;return{on:(e,t)=>{n.addEventListener(e,r=>t(r.detail))},emit:(e,t)=>{n.dispatchEvent(new CustomEvent(e,{detail:t}))}}}function la(n){return"omero"in n&&"ome"in n?{version:typeof n.ome=="object"&&n.ome!==null&&"version"in n.ome?n.ome.version:"",multiscales:typeof n.ome=="object"&&n.ome!==null&&"multiscales"in n.ome?n.ome.multiscales:{},omero:{channels:typeof n.omero=="object"&&n.omero!==null&&"channels"in n.omero?n.omero.channels:{}}}:"ome"in n?n.ome:n}class uk extends Error{constructor(e){super(e),this.name="AssertionError"}}class fk extends Error{constructor(t,r){super(t);S(this,"url");this.name="RedirectError",this.url=r}}function wt(n,e=""){if(!n)throw new uk(e)}async function hk(n){try{return await sn.v3(n),3}catch(e){if(!(e instanceof oi))throw e;return 2}}function Yv(n){return"plate"in n}function dk(n){return"well"in n}function tT(n){return"omero"in n&&wf(n)}function wf(n){return"multiscales"in n}/**
|
|
121
|
+
To suppress this warning, you need to explicitly provide the \`palette.${e}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function UR(n){return typeof n=="number"?`${n}px`:typeof n=="string"||typeof n=="function"||Array.isArray(n)?n:"8px"}const Er=n=>{try{return n()}catch{}},$R=(n="mui")=>sR(n);function tp(n,e,t,r,s){if(!t)return;t=t===!0?{}:t;const i=s==="dark"?"dark":"light";if(!r){e[s]=NR({...t,palette:{mode:i,...t==null?void 0:t.palette},colorSpace:n});return}const{palette:o,...a}=Tm({...r,palette:{mode:i,...t==null?void 0:t.palette},colorSpace:n});return e[s]={...t,palette:o,opacity:{...aw(i),...t==null?void 0:t.opacity},overlays:(t==null?void 0:t.overlays)||cw(i)},a}function VR(n={},...e){const{colorSchemes:t={light:!0},defaultColorScheme:r,disableCssColorScheme:s=!1,cssVarPrefix:i="mui",nativeColor:o=!1,shouldSkipGeneratingVar:a=DR,colorSchemeSelector:c=t.light&&t.dark?"media":void 0,rootSelector:l=":root",...u}=n,h=Object.keys(t)[0],d=r||(t.light&&h!=="light"?"light":h),p=$R(i),{[d]:m,light:g,dark:y,...x}=t,b={...x};let v=m;if((d==="dark"&&!("dark"in t)||d==="light"&&!("light"in t))&&(v=!0),!v)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${d}\` option is either missing or invalid.`:Ys(21,d));let _;o&&(_="oklch");const w=tp(_,b,v,u,d);g&&!b.light&&tp(_,b,g,void 0,"light"),y&&!b.dark&&tp(_,b,y,void 0,"dark");let E={defaultColorScheme:d,...w,cssVarPrefix:i,colorSchemeSelector:c,rootSelector:l,getCssVar:p,colorSchemes:b,font:{...yR(w.typography),...w.font},spacing:UR(u.spacing)};Object.keys(E.colorSchemes).forEach(te=>{const R=E.colorSchemes[te].palette,re=de=>{const L=de.split("-"),j=L[1],H=L[2];return p(de,R[j][H])};R.mode==="light"&&(le(R.common,"background","#fff"),le(R.common,"onBackground","#000")),R.mode==="dark"&&(le(R.common,"background","#000"),le(R.common,"onBackground","#fff"));function q(de,L,j){if(_){let H;return de===pi&&(H=`transparent ${((1-j)*100).toFixed(0)}%`),de===xt&&(H=`#000 ${(j*100).toFixed(0)}%`),de===bt&&(H=`#fff ${(j*100).toFixed(0)}%`),`color-mix(in ${_}, ${L}, ${H})`}return de(L,j)}if(BR(R,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),R.mode==="light"){le(R.Alert,"errorColor",q(xt,R.error.light,.6)),le(R.Alert,"infoColor",q(xt,R.info.light,.6)),le(R.Alert,"successColor",q(xt,R.success.light,.6)),le(R.Alert,"warningColor",q(xt,R.warning.light,.6)),le(R.Alert,"errorFilledBg",re("palette-error-main")),le(R.Alert,"infoFilledBg",re("palette-info-main")),le(R.Alert,"successFilledBg",re("palette-success-main")),le(R.Alert,"warningFilledBg",re("palette-warning-main")),le(R.Alert,"errorFilledColor",Er(()=>R.getContrastText(R.error.main))),le(R.Alert,"infoFilledColor",Er(()=>R.getContrastText(R.info.main))),le(R.Alert,"successFilledColor",Er(()=>R.getContrastText(R.success.main))),le(R.Alert,"warningFilledColor",Er(()=>R.getContrastText(R.warning.main))),le(R.Alert,"errorStandardBg",q(bt,R.error.light,.9)),le(R.Alert,"infoStandardBg",q(bt,R.info.light,.9)),le(R.Alert,"successStandardBg",q(bt,R.success.light,.9)),le(R.Alert,"warningStandardBg",q(bt,R.warning.light,.9)),le(R.Alert,"errorIconColor",re("palette-error-main")),le(R.Alert,"infoIconColor",re("palette-info-main")),le(R.Alert,"successIconColor",re("palette-success-main")),le(R.Alert,"warningIconColor",re("palette-warning-main")),le(R.AppBar,"defaultBg",re("palette-grey-100")),le(R.Avatar,"defaultBg",re("palette-grey-400")),le(R.Button,"inheritContainedBg",re("palette-grey-300")),le(R.Button,"inheritContainedHoverBg",re("palette-grey-A100")),le(R.Chip,"defaultBorder",re("palette-grey-400")),le(R.Chip,"defaultAvatarColor",re("palette-grey-700")),le(R.Chip,"defaultIconColor",re("palette-grey-700")),le(R.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),le(R.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),le(R.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),le(R.LinearProgress,"primaryBg",q(bt,R.primary.main,.62)),le(R.LinearProgress,"secondaryBg",q(bt,R.secondary.main,.62)),le(R.LinearProgress,"errorBg",q(bt,R.error.main,.62)),le(R.LinearProgress,"infoBg",q(bt,R.info.main,.62)),le(R.LinearProgress,"successBg",q(bt,R.success.main,.62)),le(R.LinearProgress,"warningBg",q(bt,R.warning.main,.62)),le(R.Skeleton,"bg",_?q(pi,R.text.primary,.11):`rgba(${re("palette-text-primaryChannel")} / 0.11)`),le(R.Slider,"primaryTrack",q(bt,R.primary.main,.62)),le(R.Slider,"secondaryTrack",q(bt,R.secondary.main,.62)),le(R.Slider,"errorTrack",q(bt,R.error.main,.62)),le(R.Slider,"infoTrack",q(bt,R.info.main,.62)),le(R.Slider,"successTrack",q(bt,R.success.main,.62)),le(R.Slider,"warningTrack",q(bt,R.warning.main,.62));const de=_?q(xt,R.background.default,.6825):cu(R.background.default,.8);le(R.SnackbarContent,"bg",de),le(R.SnackbarContent,"color",Er(()=>_?wm.text.primary:R.getContrastText(de))),le(R.SpeedDialAction,"fabHoverBg",cu(R.background.paper,.15)),le(R.StepConnector,"border",re("palette-grey-400")),le(R.StepContent,"border",re("palette-grey-400")),le(R.Switch,"defaultColor",re("palette-common-white")),le(R.Switch,"defaultDisabledColor",re("palette-grey-100")),le(R.Switch,"primaryDisabledColor",q(bt,R.primary.main,.62)),le(R.Switch,"secondaryDisabledColor",q(bt,R.secondary.main,.62)),le(R.Switch,"errorDisabledColor",q(bt,R.error.main,.62)),le(R.Switch,"infoDisabledColor",q(bt,R.info.main,.62)),le(R.Switch,"successDisabledColor",q(bt,R.success.main,.62)),le(R.Switch,"warningDisabledColor",q(bt,R.warning.main,.62)),le(R.TableCell,"border",q(bt,q(pi,R.divider,1),.88)),le(R.Tooltip,"bg",q(pi,R.grey[700],.92))}if(R.mode==="dark"){le(R.Alert,"errorColor",q(bt,R.error.light,.6)),le(R.Alert,"infoColor",q(bt,R.info.light,.6)),le(R.Alert,"successColor",q(bt,R.success.light,.6)),le(R.Alert,"warningColor",q(bt,R.warning.light,.6)),le(R.Alert,"errorFilledBg",re("palette-error-dark")),le(R.Alert,"infoFilledBg",re("palette-info-dark")),le(R.Alert,"successFilledBg",re("palette-success-dark")),le(R.Alert,"warningFilledBg",re("palette-warning-dark")),le(R.Alert,"errorFilledColor",Er(()=>R.getContrastText(R.error.dark))),le(R.Alert,"infoFilledColor",Er(()=>R.getContrastText(R.info.dark))),le(R.Alert,"successFilledColor",Er(()=>R.getContrastText(R.success.dark))),le(R.Alert,"warningFilledColor",Er(()=>R.getContrastText(R.warning.dark))),le(R.Alert,"errorStandardBg",q(xt,R.error.light,.9)),le(R.Alert,"infoStandardBg",q(xt,R.info.light,.9)),le(R.Alert,"successStandardBg",q(xt,R.success.light,.9)),le(R.Alert,"warningStandardBg",q(xt,R.warning.light,.9)),le(R.Alert,"errorIconColor",re("palette-error-main")),le(R.Alert,"infoIconColor",re("palette-info-main")),le(R.Alert,"successIconColor",re("palette-success-main")),le(R.Alert,"warningIconColor",re("palette-warning-main")),le(R.AppBar,"defaultBg",re("palette-grey-900")),le(R.AppBar,"darkBg",re("palette-background-paper")),le(R.AppBar,"darkColor",re("palette-text-primary")),le(R.Avatar,"defaultBg",re("palette-grey-600")),le(R.Button,"inheritContainedBg",re("palette-grey-800")),le(R.Button,"inheritContainedHoverBg",re("palette-grey-700")),le(R.Chip,"defaultBorder",re("palette-grey-700")),le(R.Chip,"defaultAvatarColor",re("palette-grey-300")),le(R.Chip,"defaultIconColor",re("palette-grey-300")),le(R.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),le(R.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),le(R.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),le(R.LinearProgress,"primaryBg",q(xt,R.primary.main,.5)),le(R.LinearProgress,"secondaryBg",q(xt,R.secondary.main,.5)),le(R.LinearProgress,"errorBg",q(xt,R.error.main,.5)),le(R.LinearProgress,"infoBg",q(xt,R.info.main,.5)),le(R.LinearProgress,"successBg",q(xt,R.success.main,.5)),le(R.LinearProgress,"warningBg",q(xt,R.warning.main,.5)),le(R.Skeleton,"bg",_?q(pi,R.text.primary,.13):`rgba(${re("palette-text-primaryChannel")} / 0.13)`),le(R.Slider,"primaryTrack",q(xt,R.primary.main,.5)),le(R.Slider,"secondaryTrack",q(xt,R.secondary.main,.5)),le(R.Slider,"errorTrack",q(xt,R.error.main,.5)),le(R.Slider,"infoTrack",q(xt,R.info.main,.5)),le(R.Slider,"successTrack",q(xt,R.success.main,.5)),le(R.Slider,"warningTrack",q(xt,R.warning.main,.5));const de=_?q(bt,R.background.default,.985):cu(R.background.default,.98);le(R.SnackbarContent,"bg",de),le(R.SnackbarContent,"color",Er(()=>_?rw.text.primary:R.getContrastText(de))),le(R.SpeedDialAction,"fabHoverBg",cu(R.background.paper,.15)),le(R.StepConnector,"border",re("palette-grey-600")),le(R.StepContent,"border",re("palette-grey-600")),le(R.Switch,"defaultColor",re("palette-grey-300")),le(R.Switch,"defaultDisabledColor",re("palette-grey-600")),le(R.Switch,"primaryDisabledColor",q(xt,R.primary.main,.55)),le(R.Switch,"secondaryDisabledColor",q(xt,R.secondary.main,.55)),le(R.Switch,"errorDisabledColor",q(xt,R.error.main,.55)),le(R.Switch,"infoDisabledColor",q(xt,R.info.main,.55)),le(R.Switch,"successDisabledColor",q(xt,R.success.main,.55)),le(R.Switch,"warningDisabledColor",q(xt,R.warning.main,.55)),le(R.TableCell,"border",q(xt,q(pi,R.divider,1),.68)),le(R.Tooltip,"bg",q(pi,R.grey[700],.92))}Xr(R.background,"default"),Xr(R.background,"paper"),Xr(R.common,"background"),Xr(R.common,"onBackground"),Xr(R,"divider"),Object.keys(R).forEach(de=>{const L=R[de];de!=="tonalOffset"&&L&&typeof L=="object"&&(L.main&&le(R[de],"mainChannel",Ja(Qa(L.main))),L.light&&le(R[de],"lightChannel",Ja(Qa(L.light))),L.dark&&le(R[de],"darkChannel",Ja(Qa(L.dark))),L.contrastText&&le(R[de],"contrastTextChannel",Ja(Qa(L.contrastText))),de==="text"&&(Xr(R[de],"primary"),Xr(R[de],"secondary")),de==="action"&&(L.active&&Xr(R[de],"active"),L.selected&&Xr(R[de],"selected")))})}),E=e.reduce((te,R)=>zn(te,R),E);const N={prefix:i,disableCssColorScheme:s,shouldSkipGeneratingVar:a,getSelector:FR(E),enableContrastVars:o},{vars:F,generateThemeVars:$,generateStyleSheets:I}=aR(E,N);return E.vars=F,Object.entries(E.colorSchemes[E.defaultColorScheme]).forEach(([te,R])=>{E[te]=R}),E.generateThemeVars=$,E.generateStyleSheets=I,E.generateSpacing=function(){return U2(u.spacing,_0(this))},E.getColorSchemeSelector=cR(c),E.spacing=E.generateSpacing(),E.shouldSkipGeneratingVar=a,E.unstable_sxConfig={...Jh,...u==null?void 0:u.unstable_sxConfig},E.unstable_sx=function(R){return Vi({sx:R,theme:this})},E.toRuntimeSource=ow,E}function mv(n,e,t){n.colorSchemes&&t&&(n.colorSchemes[e]={...t!==!0&&t,palette:R0({...t===!0?{}:t.palette,mode:e})})}function I0(n={},...e){const{palette:t,cssVariables:r=!1,colorSchemes:s=t?void 0:{light:!0},defaultColorScheme:i=t==null?void 0:t.mode,...o}=n,a=i||"light",c=s==null?void 0:s[a],l={...s,...t?{[a]:{...typeof c!="boolean"&&c,palette:t}}:void 0};if(r===!1){if(!("colorSchemes"in n))return Tm(n,...e);let u=t;"palette"in n||l[a]&&(l[a]!==!0?u=l[a].palette:a==="dark"&&(u={mode:"dark"}));const h=Tm({...n,palette:u},...e);return h.defaultColorScheme=a,h.colorSchemes=l,h.palette.mode==="light"&&(h.colorSchemes.light={...l.light!==!0&&l.light,palette:h.palette},mv(h,"dark",l.dark)),h.palette.mode==="dark"&&(h.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:h.palette},mv(h,"light",l.light)),h}return!t&&!("light"in l)&&a==="light"&&(l.light=!0),VR({...o,colorSchemes:l,defaultColorScheme:a,...typeof r!="boolean"&&r},...e)}const lw=I0();function jR(){const n=$2(lw);return process.env.NODE_ENV!=="production"&&Te.useDebugValue(n),n[Ws]||n}function zR(n){return n!=="ownerState"&&n!=="theme"&&n!=="sx"&&n!=="as"}const WR=n=>zR(n)&&n!=="classes",P0=IC({themeId:Ws,defaultTheme:lw,rootShouldForwardProp:WR});function HR({theme:n,...e}){const t=Ws in n?n[Ws]:void 0;return U.jsx(kc,{...e,themeId:t?Ws:void 0,theme:t||n})}const lu={colorSchemeStorageKey:"mui-color-scheme",defaultLightColorScheme:"light",defaultDarkColorScheme:"dark",modeStorageKey:"mui-mode"};process.env.NODE_ENV!=="production"&&(oe.string,oe.string,oe.string,oe.string,oe.string,oe.oneOf(["dark","light","system"]),oe.string,oe.string);const{CssVarsProvider:XR}=rR({themeId:Ws,theme:()=>I0({cssVariables:!0}),colorSchemeStorageKey:lu.colorSchemeStorageKey,modeStorageKey:lu.modeStorageKey,defaultColorScheme:{light:lu.defaultLightColorScheme,dark:lu.defaultDarkColorScheme},resolveTheme:n=>{const e={...n,typography:iw(n.palette,n.typography)};return e.unstable_sx=function(r){return Vi({sx:r,theme:this})},e}}),ZR=XR;function qR({theme:n,...e}){const t=Te.useMemo(()=>{if(typeof n=="function")return n;const r=Ws in n?n[Ws]:n;return"colorSchemes"in r?null:"vars"in r?n:{...n,vars:null}},[n]);return t?U.jsx(HR,{theme:t,...e}):U.jsx(ZR,{theme:n,...e})}const gv="#151515",it={layout:{panelWidth:{xs:280,sm:340}},panel:{background:"rgba(0, 0, 0, 0.72)",border:"rgba(255, 255, 255, 0.38)",inset:"rgba(255, 255, 255, 0.18)",radius:8},overlay:{background:gv},rail:{background:gv,border:"#2a2a2a",hover:"#232323",active:"#2f2f2f",radius:8},scrollbarThumb:"rgba(255, 255, 255, 0.22)"},O0=I0({palette:{mode:"dark",primary:{main:vm[500]},secondary:{main:vm[500]},background:{default:"#000",paper:it.panel.background},divider:"rgba(255, 255, 255, 0.12)",text:{primary:"rgba(255, 255, 255, 0.95)",secondary:"rgba(255, 255, 255, 0.72)"}},typography:{fontFamily:'Inter, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", sans-serif'},components:{MuiButton:{defaultProps:{size:"small"},styleOverrides:{root:{textTransform:"none"},outlined:{color:"rgba(255, 255, 255, 0.95)",borderColor:"rgba(255, 255, 255, 0.35)","&:hover":{borderColor:"rgba(255, 255, 255, 0.65)",backgroundColor:"rgba(255, 255, 255, 0.08)"}}}},MuiButtonBase:{defaultProps:{disableRipple:!0}},MuiIconButton:{defaultProps:{size:"small"}},MuiSlider:{defaultProps:{size:"small"}},MuiInput:{styleOverrides:{underline:{"&&&&:hover:before":{borderBottom:"1px solid #fff"}}}},MuiPaper:{styleOverrides:{root:{backgroundColor:it.overlay.background}}},MuiSvgIcon:{defaultProps:{fontSize:"small"}}}}),YR=YC;process.env.NODE_ENV!=="production"&&(oe.node,oe.object.isRequired);function KR(n){return WC(n)}function GR(n){return w0("MuiSvgIcon",n)}SC("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const JR=n=>{const{color:e,fontSize:t,classes:r}=n,s={root:["root",e!=="inherit"&&`color${$i(e)}`,`fontSize${$i(t)}`]};return lR(s,GR,r)},QR=P0("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(n,e)=>{const{ownerState:t}=n;return[e.root,t.color!=="inherit"&&e[`color${$i(t.color)}`],e[`fontSize${$i(t.fontSize)}`]]}})(YR(({theme:n})=>{var e,t,r,s,i,o,a,c,l,u,h,d,p,m;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(s=(e=n.transitions)==null?void 0:e.create)==null?void 0:s.call(e,"fill",{duration:(r=(t=(n.vars??n).transitions)==null?void 0:t.duration)==null?void 0:r.shorter}),variants:[{props:g=>!g.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((o=(i=n.typography)==null?void 0:i.pxToRem)==null?void 0:o.call(i,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((c=(a=n.typography)==null?void 0:a.pxToRem)==null?void 0:c.call(a,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((u=(l=n.typography)==null?void 0:l.pxToRem)==null?void 0:u.call(l,35))||"2.1875rem"}},...Object.entries((n.vars??n).palette).filter(([,g])=>g&&g.main).map(([g])=>{var y,x;return{props:{color:g},style:{color:(x=(y=(n.vars??n).palette)==null?void 0:y[g])==null?void 0:x.main}}}),{props:{color:"action"},style:{color:(d=(h=(n.vars??n).palette)==null?void 0:h.action)==null?void 0:d.active}},{props:{color:"disabled"},style:{color:(m=(p=(n.vars??n).palette)==null?void 0:p.action)==null?void 0:m.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),mf=Te.forwardRef(function(e,t){const r=KR({props:e,name:"MuiSvgIcon"}),{children:s,className:i,color:o="inherit",component:a="svg",fontSize:c="medium",htmlColor:l,inheritViewBox:u=!1,titleAccess:h,viewBox:d="0 0 24 24",...p}=r,m=Te.isValidElement(s)&&s.type==="svg",g={...r,color:o,component:a,fontSize:c,instanceFontSize:e.fontSize,inheritViewBox:u,viewBox:d,hasSvgAsChild:m},y={};u||(y.viewBox=d);const x=JR(g);return U.jsxs(QR,{as:a,className:z2(x.root,i),focusable:"false",color:l,"aria-hidden":h?void 0:!0,role:h?"img":void 0,ref:t,...y,...p,...m&&s.props,ownerState:g,children:[m?s.props.children:s,h?U.jsx("title",{children:h}):null]})});process.env.NODE_ENV!=="production"&&(mf.propTypes={children:oe.node,classes:oe.object,className:oe.string,color:oe.oneOfType([oe.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),oe.string]),component:oe.elementType,fontSize:oe.oneOfType([oe.oneOf(["inherit","large","medium","small"]),oe.string]),htmlColor:oe.string,inheritViewBox:oe.bool,shapeRendering:oe.string,sx:oe.oneOfType([oe.arrayOf(oe.oneOfType([oe.func,oe.object,oe.bool])),oe.func,oe.object]),titleAccess:oe.string,viewBox:oe.string});mf.muiName="SvgIcon";function k0(n,e){function t(r,s){return U.jsx(mf,{"data-testid":process.env.NODE_ENV!=="production"?`${e}Icon`:void 0,ref:s,...r,children:n})}return process.env.NODE_ENV!=="production"&&(t.displayName=`${e}Icon`),t.muiName=mf.muiName,Te.memo(Te.forwardRef(t))}function eI(...n){const e=Te.useRef(void 0),t=Te.useCallback(r=>{const s=n.map(i=>{if(i==null)return null;if(typeof i=="function"){const o=i,a=o(r);return typeof a=="function"?a:()=>{o(null)}}return i.current=r,()=>{i.current=null}});return()=>{s.forEach(i=>i==null?void 0:i())}},n);return Te.useMemo(()=>n.every(r=>r==null)?null:r=>{e.current&&(e.current(),e.current=void 0),r!=null&&(e.current=t(r))},n)}const tI=k0(U.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutline"),nI=k0(U.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"InfoOutlined"),yv=k0(U.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"}),"OpenInNew");let rI=0;function sI(n,e){const t=`atom${++rI}`,r={toString:()=>t};return typeof n=="function"?r.read=n:(r.init=n,r.read=s=>s(r),r.write=(s,i,o)=>i(r,typeof o=="function"?o(s(r)):o)),e&&(r.write=e),r}const Un={},Gs=Symbol(),Sm=n=>!!n[Gs],uu=n=>!n[Gs].c,Ba=n=>{var e;const{b:t,c:r}=n[Gs];r&&(r(),(e=oI.get(t))==null||e())},Wu=(n,e)=>{const t=n[Gs].o,r=e[Gs].o;return t===r||n===r||Sm(t)&&Wu(t,e)},Em=(n,e)=>{const t={b:n,o:e,c:null},r=new Promise(s=>{t.c=()=>{t.c=null,s()},e.finally(t.c)});return r[Gs]=t,r},iI=n=>Em(n[Gs].b,n[Gs].o),oI=new WeakMap,fu=n=>"init"in n,Am="r",Cm="w",Mc="c",Rm="s",_v="h",aI="n",cI="l",lI="a",uI="m",fI=n=>{const e=new WeakMap,t=new WeakMap,r=new Map;let s,i;if((Un&&"production")!=="production"&&(s=new Set,i=new Set),n)for(const[P,O]of n){const D={v:O,r:0,y:!0,d:new Map};(Un&&"production")!=="production"&&(Object.freeze(D),fu(P)||console.warn("Found initial value for derived atom which can cause unexpected behavior",P)),e.set(P,D)}const o=new WeakMap,a=(P,O,D)=>{let X=o.get(O);X||(X=new Map,o.set(O,X)),D.then(()=>{X.get(P)===D&&(X.delete(P),X.size||o.delete(O))}),X.set(P,D)},c=P=>{const O=new Set,D=o.get(P);return D&&(o.delete(P),D.forEach((X,K)=>{Ba(X),O.add(K)})),O},l=new WeakMap,u=P=>{let O=l.get(P);return O||(O=new Map,l.set(P,O)),O},h=(P,O)=>{if(P){const D=u(P);let X=D.get(O);return X||(X=h(P.p,O),X&&"p"in X&&uu(X.p)&&(X=void 0),X&&D.set(O,X)),X}return e.get(O)},d=(P,O,D)=>{if((Un&&"production")!=="production"&&Object.freeze(D),P)u(P).set(O,D);else{const X=e.get(O);e.set(O,D),r.has(O)||r.set(O,X)}},p=(P,O=new Map,D)=>{if(!D)return O;const X=new Map;let K=!1;return D.forEach(Q=>{var ie;const ae=((ie=h(P,Q))==null?void 0:ie.r)||0;X.set(Q,ae),O.get(Q)!==ae&&(K=!0)}),O.size===X.size&&!K?O:X},m=(P,O,D,X,K)=>{const Q=h(P,O);if(Q){if(K&&(!("p"in Q)||!Wu(Q.p,K)))return Q;"p"in Q&&Ba(Q.p)}const ie={v:D,r:(Q==null?void 0:Q.r)||0,y:!0,d:p(P,Q==null?void 0:Q.d,X)};let ae=!(Q!=null&&Q.y);return!Q||!("v"in Q)||!Object.is(Q.v,D)?(ae=!0,++ie.r,ie.d.has(O)&&(ie.d=new Map(ie.d).set(O,ie.r))):ie.d!==Q.d&&(ie.d.size!==Q.d.size||!Array.from(ie.d.keys()).every(ye=>Q.d.has(ye)))&&(ae=!0,Promise.resolve().then(()=>{de(P)})),Q&&!ae?Q:(d(P,O,ie),ie)},g=(P,O,D,X,K)=>{const Q=h(P,O);if(Q){if(K&&(!("p"in Q)||!Wu(Q.p,K)))return Q;"p"in Q&&Ba(Q.p)}const ie={e:D,r:((Q==null?void 0:Q.r)||0)+1,y:!0,d:p(P,Q==null?void 0:Q.d,X)};return d(P,O,ie),ie},y=(P,O,D,X)=>{const K=h(P,O);if(K&&"p"in K){if(Wu(K.p,D)&&!uu(K.p))return K.y?K:{...K,y:!0};Ba(K.p)}a(P,O,D);const Q={p:D,r:((K==null?void 0:K.r)||0)+1,y:!0,d:p(P,K==null?void 0:K.d,X)};return d(P,O,Q),Q},x=(P,O,D,X)=>{if(D instanceof Promise){const K=Em(D,D.then(Q=>{m(P,O,Q,X,K)}).catch(Q=>{if(Q instanceof Promise)return Sm(Q)?Q.then(()=>{v(P,O,!0)}):Q;g(P,O,Q,X,K)}));return y(P,O,K,X)}return m(P,O,D,X)},b=(P,O)=>{const D=h(P,O);if(D){const X={...D,y:!1};d(P,O,X)}else(Un&&"production")!=="production"&&console.warn("[Bug] could not invalidate non existing atom",O)},v=(P,O,D)=>{if(!D){const K=h(P,O);if(K){if(K.y&&"p"in K&&!uu(K.p))return K;if(K.d.forEach((Q,ie)=>{if(ie!==O)if(!t.has(ie))v(P,ie);else{const ae=h(P,ie);ae&&!ae.y&&v(P,ie)}}),Array.from(K.d).every(([Q,ie])=>{const ae=h(P,Q);return ae&&!("p"in ae)&&ae.r===ie}))return K.y?K:{...K,y:!0}}}const X=new Set;try{const K=O.read(Q=>{X.add(Q);const ie=Q===O?h(P,Q):v(P,Q);if(ie){if("e"in ie)throw ie.e;if("p"in ie)throw ie.p;return ie.v}if(fu(Q))return Q.init;throw new Error("no atom init")});return x(P,O,K,X)}catch(K){if(K instanceof Promise){const Q=Sm(K)&&uu(K)?iI(K):Em(K,K);return y(P,O,Q,X)}return g(P,O,K,X)}},_=(P,O)=>v(O,P),w=(P,O)=>{let D=t.get(O);return D||(D=R(P,O)),D},E=(P,O)=>!O.l.size&&(!O.t.size||O.t.size===1&&O.t.has(P)),N=(P,O)=>{const D=t.get(O);D&&E(O,D)&&re(P,O)},F=(P,O)=>{const D=t.get(O);D==null||D.t.forEach(X=>{X!==O&&(b(P,X),F(P,X))})},$=(P,O,D)=>{let X=!0;const K=(ae,ye)=>{const ve=v(P,ae);if("e"in ve)throw ve.e;if("p"in ve){if(ye!=null&&ye.unstable_promise)return ve.p.then(()=>{const xe=h(P,ae);return xe&&"p"in xe&&xe.p===ve.p?new Promise(tt=>setTimeout(tt)).then(()=>K(ae,ye)):K(ae,ye)});throw(Un&&"production")!=="production"&&console.info("Reading pending atom state in write operation. We throw a promise for now.",ae),ve.p}if("v"in ve)return ve.v;throw(Un&&"production")!=="production"&&console.warn("[Bug] no value found while reading atom in write operation. This is probably a bug.",ae),new Error("no value found")},Q=(ae,ye)=>{let ve;if(ae===O){if(!fu(ae))throw new Error("atom not writable");c(ae).forEach(T=>{T!==P&&x(T,ae,ye)});const tt=h(P,ae),A=x(P,ae,ye);tt!==A&&F(P,ae)}else ve=$(P,ae,ye);return X||de(P),ve},ie=O.write(K,Q,D);return X=!1,ie},I=(P,O,D)=>{const X=$(D,P,O);return de(D),X},te=P=>!!P.write,R=(P,O,D)=>{const X={t:new Set(D&&[D]),l:new Set};if(t.set(O,X),(Un&&"production")!=="production"&&i.add(O),v(void 0,O).d.forEach((Q,ie)=>{const ae=t.get(ie);ae?ae.t.add(O):ie!==O&&R(P,ie,O)}),te(O)&&O.onMount){const Q=ae=>I(O,ae,P),ie=O.onMount(Q);P=void 0,ie&&(X.u=ie)}return X},re=(P,O)=>{var D;const X=(D=t.get(O))==null?void 0:D.u;X&&X(),t.delete(O),(Un&&"production")!=="production"&&i.delete(O);const K=h(P,O);K?("p"in K&&Ba(K.p),K.d.forEach((Q,ie)=>{if(ie!==O){const ae=t.get(ie);ae&&(ae.t.delete(O),E(ie,ae)&&re(P,ie))}})):(Un&&"production")!=="production"&&console.warn("[Bug] could not find atom state to unmount",O)},q=(P,O,D,X)=>{const K=new Set(D.d.keys());X==null||X.forEach((Q,ie)=>{if(K.has(ie)){K.delete(ie);return}const ae=t.get(ie);ae&&(ae.t.delete(O),E(ie,ae)&&re(P,ie))}),K.forEach(Q=>{const ie=t.get(Q);ie?ie.t.add(O):t.has(O)&&R(P,Q,O)})},de=P=>{if(P){u(P).forEach((D,X)=>{const K=e.get(X);if(D!==K){const Q=t.get(X);Q==null||Q.l.forEach(ie=>ie(P))}});return}for(;r.size;){const O=Array.from(r);r.clear(),O.forEach(([D,X])=>{const K=h(void 0,D);if(K&&K.d!==(X==null?void 0:X.d)&&q(void 0,D,K,X==null?void 0:X.d),X&&!X.y&&(K!=null&&K.y))return;const Q=t.get(D);Q==null||Q.l.forEach(ie=>ie())})}(Un&&"production")!=="production"&&s.forEach(O=>O())},L=P=>{u(P).forEach((D,X)=>{const K=e.get(X);(!K||D.r>K.r||D.y!==K.y||D.r===K.r&&D.d!==K.d)&&(e.set(X,D),D.d!==(K==null?void 0:K.d)&&q(P,X,D,K==null?void 0:K.d))})},j=(P,O)=>{O&&L(O),de(void 0)},H=(P,O,D)=>{const K=w(D,P).l;return K.add(O),()=>{K.delete(O),N(D,P)}},ce=(P,O)=>{for(const[D,X]of P)fu(D)&&(x(O,D,X),F(O,D));de(O)};return(Un&&"production")!=="production"?{[Am]:_,[Cm]:I,[Mc]:j,[Rm]:H,[_v]:ce,[aI]:P=>(s.add(P),()=>{s.delete(P)}),[cI]:()=>i.values(),[lI]:P=>e.get(P),[uI]:P=>t.get(P)}:{[Am]:_,[Cm]:I,[Mc]:j,[Rm]:H,[_v]:ce}},uw=(n,e)=>({s:e?e(n).SECRET_INTERNAL_store:fI(n)}),np=new Map,M0=n=>(np.has(n)||np.set(n,fe.createContext(uw())),np.get(n)),fw=({children:n,initialValues:e,scope:t,unstable_createStore:r,unstable_enableVersionedWrite:s})=>{const[i,o]=fe.useState({});fe.useEffect(()=>{const l=a.current;l.w&&(l.s[Mc](null,i),delete i.p,l.v=i)},[i]);const a=fe.useRef();if(!a.current){const l=uw(e,r);if(s){let u=0;l.w=h=>{o(d=>{const p=u?d:{p:d};return h(p),p})},l.v=i,l.r=h=>{++u,h(),--u}}a.current=l}const c=M0(t);return fe.createElement(c.Provider,{value:a.current},n)};function yt(n,e){return sI(n,e)}function ln(n,e){const t=M0(e),r=fe.useContext(t),{s,v:i}=r,o=d=>{const p=s[Am](n,d);if((Un&&"production")!=="production"&&!p.y)throw new Error("should not be invalidated");if("e"in p)throw p.e;if("p"in p)throw p.p;if("v"in p)return p.v;throw new Error("no atom value")},[[a,c,l],u]=fe.useReducer((d,p)=>{const m=o(p);return Object.is(d[1],m)&&d[2]===n?d:[p,m,n]},i,d=>{const p=o(d);return[d,p,n]});let h=c;return l!==n&&(u(a),h=o(a)),fe.useEffect(()=>{const{v:d}=r;d&&s[Mc](n,d);const p=s[Rm](n,u,d);return u(d),p},[s,n,r]),fe.useEffect(()=>{s[Mc](n,a)}),fe.useDebugValue(h),h}function qn(n,e){const t=M0(e),{s:r,w:s}=fe.useContext(t);return fe.useCallback(o=>{if((Un&&"production")!=="production"&&!("write"in n))throw new Error("not writable atom");const a=c=>r[Cm](n,o,c);return s?s(a):a()},[r,s,n])}function El(n,e){return"scope"in n&&(console.warn("atom.scope is deprecated. Please do useAtom(atom, scope) instead."),e=n.scope),[ln(n,e),qn(n,e)]}function Hu(n){return n.slice(1)}function hI(n){let[e,t]=(typeof n=="string"?n:n.href).split("://");if(e==="https"||e==="http")return n;if(e==="gc")return`https://storage.googleapis.com/${t}`;if(e==="s3")return`https://s3.amazonaws.com/${t}`;throw Error(`Protocol not supported, got: ${JSON.stringify(e)}`)}function nd(n,e,t,r={}){return e!==void 0&&t!==void 0&&(r={...r,headers:{...r.headers,Range:`bytes=${e}-${e+t-1}`}}),fetch(n,r)}function hw(n,e){return{...n,...e,headers:{...n.headers,...e.headers}}}function vv(n,e=""){if(!n)throw new Error(e)}function xv(n,e){const t=typeof n=="string"?new URL(n):n;t.pathname.endsWith("/")||(t.pathname+="/");const r=new URL(e.slice(1),t);return r.search=t.search,r}async function bv(n){if(n.status!==404){if(n.status===200||n.status===206)return new Uint8Array(await n.arrayBuffer());throw new Error(`Unexpected response status ${n.status} ${n.statusText}`)}}async function dI(n,e,t,r){if(r)return fetch(n,{...t,headers:{...t.headers,Range:`bytes=-${e}`}});let s=await fetch(n,{...t,method:"HEAD"});if(!s.ok)return s;let i=s.headers.get("Content-Length"),o=Number(i);return nd(n,o-e,o,t)}var ll,ul,fl,Im;class pI{constructor(e,t={}){st(this,fl);S(this,"url");st(this,ll);st(this,ul);this.url=e,$e(this,ll,t.overrides??{}),$e(this,ul,t.useSuffixRequest??!1)}async get(e,t={}){let r=xv(this.url,e).href,s=await fetch(r,St(this,fl,Im).call(this,t));return bv(s)}async getRange(e,t,r={}){let s=xv(this.url,e),i=St(this,fl,Im).call(this,r),o;return"suffixLength"in t?o=await dI(s,t.suffixLength,i,pe(this,ul)):o=await nd(s,t.offset,t.length,i),bv(o)}}ll=new WeakMap,ul=new WeakMap,fl=new WeakSet,Im=function(e){return hw(pe(this,ll),e)};var $n;class dw{constructor(e,t,r){st(this,$n);typeof e=="number"?$e(this,$n,new Uint8Array(e)):e instanceof ArrayBuffer?$e(this,$n,new Uint8Array(e,t,r)):$e(this,$n,new Uint8Array(Array.from(e,s=>s?1:0)))}get BYTES_PER_ELEMENT(){return 1}get byteOffset(){return pe(this,$n).byteOffset}get byteLength(){return pe(this,$n).byteLength}get buffer(){return pe(this,$n).buffer}get length(){return pe(this,$n).length}get(e){let t=pe(this,$n)[e];return typeof t=="number"?t!==0:t}set(e,t){pe(this,$n)[e]=t?1:0}fill(e){pe(this,$n).fill(e?1:0)}*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this.get(e)}}$n=new WeakMap;var ta;class N0{constructor(e,t,r,s){S(this,"_data");S(this,"chars");st(this,ta);if(this.chars=e,$e(this,ta,new TextEncoder),typeof t=="number")this._data=new Uint8Array(t*e);else if(t instanceof ArrayBuffer)s&&(s=s*e),this._data=new Uint8Array(t,r,s);else{let i=Array.from(t);this._data=new Uint8Array(i.length*e);for(let o=0;o<i.length;o++)this.set(o,i[o])}}get BYTES_PER_ELEMENT(){return this.chars}get byteOffset(){return this._data.byteOffset}get byteLength(){return this._data.byteLength}get buffer(){return this._data.buffer}get length(){return this.byteLength/this.BYTES_PER_ELEMENT}get(e){const t=new Uint8Array(this.buffer,this.byteOffset+this.chars*e,this.chars);return new TextDecoder().decode(t).replace(/\x00/g,"")}set(e,t){const r=new Uint8Array(this.buffer,this.byteOffset+this.chars*e,this.chars);r.fill(0),r.set(pe(this,ta).encode(t))}fill(e){const t=pe(this,ta).encode(e);for(let r=0;r<this.length;r++)this._data.set(t,r*this.chars)}*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this.get(e)}}ta=new WeakMap;var _n;const w_=class w_{constructor(e,t,r,s){st(this,_n);S(this,"chars");if(this.chars=e,typeof t=="number")$e(this,_n,new Int32Array(t*e));else if(t instanceof ArrayBuffer)s&&(s*=e),$e(this,_n,new Int32Array(t,r,s));else{const i=t,o=new w_(e,1);$e(this,_n,new Int32Array(function*(){for(let a of i)o.set(0,a),yield*pe(o,_n)}()))}}get BYTES_PER_ELEMENT(){return pe(this,_n).BYTES_PER_ELEMENT*this.chars}get byteLength(){return pe(this,_n).byteLength}get byteOffset(){return pe(this,_n).byteOffset}get buffer(){return pe(this,_n).buffer}get length(){return pe(this,_n).length/this.chars}get(e){const t=this.chars*e;let r="";for(let s=0;s<this.chars;s++)r+=String.fromCodePoint(pe(this,_n)[t+s]);return r.replace(/\u0000/g,"")}set(e,t){const r=this.chars*e,s=pe(this,_n).subarray(r,r+this.chars);s.fill(0);for(let i=0;i<this.chars;i++)s[i]=t.codePointAt(i)??0}fill(e){this.set(0,e);let t=pe(this,_n).subarray(0,this.chars);for(let r=1;r<this.length;r++)pe(this,_n).set(t,r*this.chars)}*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this.get(e)}};_n=new WeakMap;let Nc=w_;function Al(n){const e=new TextDecoder().decode(n);return JSON.parse(e)}function wv(n,e){const t=e/2,r=e-1;let s=0;for(let i=0;i<n.length;i+=e)for(let o=0;o<t;o+=1)s=n[i+o],n[i+o]=n[i+r-o],n[i+r-o]=s}function pw(n){if(n==="v2:object")return globalThis.Array;let e=n.match(/v2:([US])(\d+)/);if(e){let[,r,s]=e;return(r==="U"?Nc:N0).bind(null,Number(s))}if(n==="string")return globalThis.Array;let t={int8:Int8Array,int16:Int16Array,int32:Int32Array,int64:globalThis.BigInt64Array,uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,uint64:globalThis.BigUint64Array,float16:globalThis.Float16Array,float32:Float32Array,float64:Float64Array,bool:dw}[n];return rn(t,`Unknown or unsupported data_type: ${n}`),t}function ji(n,e){const t=n.length;typeof e=="string"&&(e=e==="C"?Array.from({length:t},(i,o)=>o):Array.from({length:t},(i,o)=>t-1-o)),rn(t===e.length,"Order length must match the number of dimensions.");let r=1,s=new Array(t);for(let i=e.length-1;i>=0;i--)s[e[i]]=r,r*=n[e[i]];return s}function mI({name:n,configuration:e}){if(n==="default"){const t=(e==null?void 0:e.separator)??"/";return r=>["c",...r].join(t)}if(n==="v2"){const t=(e==null?void 0:e.separator)??".";return r=>r.join(t)||"0"}throw new Error(`Unknown chunk key encoding: ${n}`)}function gI(n){if(n==="|O")return{data_type:"v2:object"};let e=n.match(/^([<|>])(.*)$/);rn(e,`Invalid dtype: ${n}`);let[,t,r]=e,s={b1:"bool",i1:"int8",u1:"uint8",i2:"int16",u2:"uint16",i4:"int32",u4:"uint32",i8:"int64",u8:"uint64",f2:"float16",f4:"float32",f8:"float64"}[r]??(r.startsWith("S")||r.startsWith("U")?`v2:${r}`:void 0);return rn(s,`Unsupported or unknown dtype: ${n}`),t==="|"?{data_type:s}:{data_type:s,endian:t==="<"?"little":"big"}}function yI(n,e={}){let t=[],r=gI(n.dtype);n.order==="F"&&t.push({name:"transpose",configuration:{order:"F"}}),"endian"in r&&r.endian==="big"&&t.push({name:"bytes",configuration:{endian:"big"}});for(let{id:s,...i}of n.filters??[])t.push({name:s,configuration:i});if(n.compressor){let{id:s,...i}=n.compressor;t.push({name:s,configuration:i})}return{zarr_format:3,node_type:"array",shape:n.shape,data_type:r.data_type,chunk_grid:{name:"regular",configuration:{chunk_shape:n.chunks}},chunk_key_encoding:{name:"v2",configuration:{separator:n.dimension_separator??"."}},codecs:t,fill_value:n.fill_value,attributes:e}}function _I(n,e={}){return{zarr_format:3,node_type:"group",attributes:e}}function vI(n,e){if(e!=="number"&&e!=="bigint"&&e!=="boolean"&&e!=="object"&&e!=="string")return n===e;let t=n==="bool";if(e==="boolean")return t;let r=n.startsWith("v2:U")||n.startsWith("v2:S")||n==="string";if(e==="string")return r;let s=n==="int64"||n==="uint64";if(e==="bigint")return s;let i=n==="v2:object";return e==="object"?i:!r&&!s&&!t&&!i}function xI(n){return(n==null?void 0:n.name)==="sharding_indexed"}function mw(n){return(n.data_type==="uint64"||n.data_type==="int64")&&n.fill_value!=null?BigInt(n.fill_value):n.fill_value}function gw(n,...e){if(!e.some(t=>n instanceof t))throw n}function rn(n,e=""){if(!n)throw new Error(e)}async function yw(n,{format:e,signal:t}){const r=n instanceof Response?n:new Response(n);rn(r.body,"Response does not contain body.");try{return await new Response(r.body.pipeThrough(new DecompressionStream(e),{signal:t})).arrayBuffer()}catch{throw t==null||t.throwIfAborted(),new Error(`Failed to decode ${e}`)}}class D0{constructor(e,t){S(this,"kind","array_to_array");rn(e.keepbits>=0,"keepbits must be zero or positive")}static fromConfig(e,t){return new D0(e,t)}encode(e){throw new Error("`BitroundCodec.encode` is not implemented. Please open an issue at https://github.com/manzt/zarrita.js/issues.")}decode(e){return e}}const Tv=bI();function bI(){const n=new Uint32Array([305419896]);return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)[0]!==18}function Sv(n){return"BYTES_PER_ELEMENT"in n?n.BYTES_PER_ELEMENT:4}var hl,Ds,dl,pl,na;const T_=class T_{constructor(e,t){S(this,"kind","array_to_bytes");st(this,hl);st(this,Ds);st(this,dl);st(this,pl);st(this,na);$e(this,na,e==null?void 0:e.endian),$e(this,Ds,pw(t.data_type)),$e(this,pl,t.shape),$e(this,hl,ji(t.shape,"C"));const r=new(pe(this,Ds))(0);$e(this,dl,r.BYTES_PER_ELEMENT)}static fromConfig(e,t){return new T_(e,t)}encode(e){let t=new Uint8Array(e.data.buffer);return Tv&&pe(this,na)==="big"&&wv(t,Sv(pe(this,Ds))),t}decode(e){return Tv&&pe(this,na)==="big"&&wv(e,Sv(pe(this,Ds))),{data:new(pe(this,Ds))(e.buffer,e.byteOffset,e.byteLength/pe(this,dl)),shape:pe(this,pl),stride:pe(this,hl)}}};hl=new WeakMap,Ds=new WeakMap,dl=new WeakMap,pl=new WeakMap,na=new WeakMap;let gf=T_;class L0{constructor(){S(this,"kind","bytes_to_bytes")}static fromConfig(){return new L0}encode(e){throw new Error("Not implemented")}decode(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength-4)}}class F0{constructor(){S(this,"kind","bytes_to_bytes")}static fromConfig(e){return new F0}encode(e){throw new Error("Gzip encoding is not enabled by default. Please register a custom codec with `numcodecs/gzip`.")}async decode(e){const t=await yw(e,{format:"gzip"});return new Uint8Array(t)}}function wI(n,e){return rn(!Number.isNaN(e),"JsonCodec allow_nan is false but NaN was encountered during encoding."),rn(e!==Number.POSITIVE_INFINITY,"JsonCodec allow_nan is false but Infinity was encountered during encoding."),rn(e!==Number.NEGATIVE_INFINITY,"JsonCodec allow_nan is false but -Infinity was encountered during encoding."),e}function TI(n,e){return e instanceof Object&&!Array.isArray(e)?Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}):e}var ml,gl;const S_=class S_{constructor(e={}){S(this,"configuration");S(this,"kind","array_to_bytes");st(this,ml);st(this,gl);this.configuration=e;const{encoding:t="utf-8",skipkeys:r=!1,ensure_ascii:s=!0,check_circular:i=!0,allow_nan:o=!0,sort_keys:a=!0,indent:c,strict:l=!0}=e;let u=e.separators;u||(c?u=[", ",": "]:u=[",",":"]),$e(this,ml,{encoding:t,skipkeys:r,ensure_ascii:s,check_circular:i,allow_nan:o,indent:c,separators:u,sort_keys:a}),$e(this,gl,{strict:l})}static fromConfig(e){return new S_(e)}encode(e){const{indent:t,encoding:r,ensure_ascii:s,check_circular:i,allow_nan:o,sort_keys:a}=pe(this,ml);rn(r==="utf-8","JsonCodec does not yet support non-utf-8 encoding.");const c=[];rn(i,"JsonCodec does not yet support skipping the check for circular references during encoding."),o||c.push(wI),a&&c.push(TI);const l=Array.from(e.data);l.push("|O"),l.push(e.shape);let u;c.length&&(u=(d,p)=>{let m=p;for(let g of c)m=g(d,m);return m});let h=JSON.stringify(l,u,t);return s&&(h=h.replace(/[\u007F-\uFFFF]/g,d=>{const p=`0000${d.charCodeAt(0).toString(16)}`;return`\\u${p.substring(p.length-4)}`})),new TextEncoder().encode(h)}decode(e){const{strict:t}=pe(this,gl);rn(t,"JsonCodec does not yet support non-strict decoding.");const r=Al(e),s=r.pop();r.pop(),rn(s,"0D not implemented for JsonCodec.");const i=ji(s,"C");return{data:r,shape:s,stride:i}}};ml=new WeakMap,gl=new WeakMap;let Pm=S_;function Ev(n){return n instanceof dw||n instanceof N0||n instanceof Nc?new Proxy(n,{get(t,r){return t.get(Number(r))},set(t,r,s){return t.set(Number(r),s),!0}}):n}function SI(n,e){let t;return n.data instanceof N0||n.data instanceof Nc?t=new n.constructor(n.data.length,n.data.chars):t=new n.constructor(n.data.length),{data:t,shape:n.shape,stride:ji(n.shape,e)}}function EI(n,e){let t=SI(n,e),r=n.shape.length,s=n.data.length,i=Array(r).fill(0),o=Ev(n.data),a=Ev(t.data);for(let c=0;c<s;c++){let l=0;for(let u=0;u<r;u++)l+=i[u]*t.stride[u];a[l]=o[c],i[0]+=1;for(let u=0;u<r;u++)if(i[u]===n.shape[u]){if(u+1===r)break;i[u]=0,i[u+1]+=1}}return t}function AI(n){let e=n.shape.length;return rn(e===n.stride.length,"Shape and stride must have the same length."),n.stride.map((t,r)=>({stride:t,index:r})).sort((t,r)=>r.stride-t.stride).map(t=>t.index)}function CI(n,e){let t=AI(n);return rn(t.length===e.length,"Orders must match"),t.every((r,s)=>r===e[s])}var yl,ra;const E_=class E_{constructor(e,t){S(this,"kind","array_to_array");st(this,yl);st(this,ra);let r=e.order??"C",s=t.shape.length,i=new Array(s),o=new Array(s);if(r==="C")for(let a=0;a<s;++a)i[a]=a,o[a]=a;else if(r==="F")for(let a=0;a<s;++a)i[a]=s-a-1,o[a]=s-a-1;else i=r,i.forEach((a,c)=>{rn(o[a]===void 0,`Invalid permutation: ${JSON.stringify(r)}`),o[a]=c});$e(this,yl,i),$e(this,ra,o)}static fromConfig(e,t){return new E_(e,t)}encode(e){return CI(e,pe(this,ra))?e:EI(e,pe(this,ra))}decode(e){return{data:e.data,shape:e.shape,stride:ji(e.shape,pe(this,yl))}}};yl=new WeakMap,ra=new WeakMap;let Om=E_;var _l,vl;const A_=class A_{constructor(e){S(this,"kind","array_to_bytes");st(this,_l);st(this,vl);$e(this,_l,e),$e(this,vl,ji(e,"C"))}static fromConfig(e,t){return new A_(t.shape)}encode(e){throw new Error("Method not implemented.")}decode(e){let t=new TextDecoder,r=new DataView(e.buffer),s=Array(r.getUint32(0,!0)),i=4;for(let o=0;o<s.length;o++){let a=r.getUint32(i,!0);i+=4,s[o]=t.decode(e.buffer.slice(i,i+a)),i+=a}return{data:s,shape:pe(this,_l),stride:pe(this,vl)}}};_l=new WeakMap,vl=new WeakMap;let km=A_;class B0{constructor(){S(this,"kind","bytes_to_bytes")}static fromConfig(e){return new B0}encode(e){throw new Error("Zlib encoding is not enabled by default. Please register a codec with `numcodecs/zlib`.")}async decode(e){const t=await yw(e,{format:"deflate"});return new Uint8Array(t)}}function RI(){return new Map().set("blosc",()=>Promise.resolve().then(()=>require("./blosc-CeItQ6qj.cjs")).then(n=>n.default)).set("lz4",()=>Promise.resolve().then(()=>require("./lz4-PFaIsPAh.cjs")).then(n=>n.default)).set("zstd",()=>Promise.resolve().then(()=>require("./zstd-_xUhkGOV.cjs")).then(n=>n.default)).set("gzip",()=>F0).set("zlib",()=>B0).set("transpose",()=>Om).set("bytes",()=>gf).set("crc32c",()=>L0).set("vlen-utf8",()=>km).set("json2",()=>Pm).set("bitround",()=>D0)}const _w=RI();function Mm(n){let e;return{async encode(t){e||(e=await Av(n));for(const s of e.array_to_array)t=await s.encode(t);let r=await e.array_to_bytes.encode(t);for(const s of e.bytes_to_bytes)r=await s.encode(r);return r},async decode(t){e||(e=await Av(n));for(let s=e.bytes_to_bytes.length-1;s>=0;s--)t=await e.bytes_to_bytes[s].decode(t);let r=await e.array_to_bytes.decode(t);for(let s=e.array_to_array.length-1;s>=0;s--)r=await e.array_to_array[s].decode(r);return r}}}async function Av(n){let e=n.codecs.map(async i=>{var a;let o=await((a=_w.get(i.name))==null?void 0:a());return rn(o,`Unknown codec: ${i.name}`),{Codec:o,meta:i}}),t=[],r,s=[];for await(let{Codec:i,meta:o}of e){let a=i.fromConfig(o.configuration,n);switch(a.kind){case"array_to_array":t.push(a);break;case"array_to_bytes":r=a;break;default:s.push(a)}}return r||(rn(II(n),`Cannot encode ${n.data_type} to bytes without a codec`),r=gf.fromConfig({endian:"little"},n)),{array_to_array:t,array_to_bytes:r,bytes_to_bytes:s}}function II(n){return n.data_type!=="v2:object"&&n.data_type!=="string"}class oi extends Error{constructor(e,t={}){super(`Node not found: ${e}`,t),this.name="NodeNotFoundError"}}class U0 extends Error{constructor(e){super(`Missing key: ${e}`),this.name="KeyError"}}const Cv=18446744073709551615n;function PI(n,e,t,r){rn(n.store.getRange,"Store does not support range requests");let s=n.store.getRange.bind(n.store),i=e.map((u,h)=>u/r.chunk_shape[h]),o=Mm({data_type:"uint64",shape:[...i,2],codecs:r.index_codecs}),a=4,c=16*i.reduce((u,h)=>u*h,1),l={};return async(u,h)=>{let d=u.map((w,E)=>Math.floor(w/i[E])),p=n.resolve(t(d)).path;p in l||(l[p]=(async()=>{let w=await s(p,{suffixLength:c+a},h);return w?await o.decode(w):null})().catch(w=>{throw delete l[p],w}));let m=await l[p];if(m===null)return;let{data:g,shape:y,stride:x}=m,b=u.map((w,E)=>w%y[E]).reduce((w,E,N)=>w+E*x[N],0),v=g[b],_=g[b+1];if(!(v===Cv&&_===Cv))return s(p,{offset:Number(v),length:Number(_)},h)}}class ai{constructor(e,t="/"){S(this,"store");S(this,"path");this.store=e,this.path=t}resolve(e){let t=new URL(`file://${this.path.endsWith("/")?this.path:`${this.path}/`}`);return new ai(this.store,decodeURIComponent(new URL(e,t).pathname))}}function vw(n){return new ai(n??new Map)}var xl;class rd extends ai{constructor(t,r,s){super(t,r);S(this,"kind","group");st(this,xl);$e(this,xl,s)}get attrs(){return pe(this,xl).attributes}}xl=new WeakMap;function Rv(n){var t;const e=n.find(r=>r.name==="transpose");return((t=e==null?void 0:e.configuration)==null?void 0:t.order)??"C"}const ec=Symbol("zarrita.context");function OI(n){return n[ec]}function kI(n,e){let{configuration:t}=e.codecs.find(xI)??{},r={encode_chunk_key:mI(e.chunk_key_encoding),TypedArray:pw(e.data_type),fill_value:e.fill_value};if(t){let i=Rv(t.codecs);return{...r,kind:"sharded",chunk_shape:t.chunk_shape,codec:Mm({data_type:e.data_type,shape:t.chunk_shape,codecs:t.codecs}),get_strides(o){return ji(o,i)},get_chunk_bytes:PI(n,e.chunk_grid.configuration.chunk_shape,r.encode_chunk_key,t)}}let s=Rv(e.codecs);return{...r,kind:"regular",chunk_shape:e.chunk_grid.configuration.chunk_shape,codec:Mm({data_type:e.data_type,shape:e.chunk_grid.configuration.chunk_shape,codecs:e.codecs}),get_strides(i){return ji(i,s)},async get_chunk_bytes(i,o){let a=r.encode_chunk_key(i),c=n.resolve(a).path;return n.store.get(c,o)}}}var P2,O2,Ls,k2;let yf=(k2=class extends(O2=ai,P2=ec,O2){constructor(t,r,s){super(t,r);S(this,"kind","array");st(this,Ls);S(this,P2);$e(this,Ls,{...s,fill_value:mw(s)}),this[ec]=kI(this,pe(this,Ls))}get attrs(){return pe(this,Ls).attributes}get shape(){return pe(this,Ls).shape}get chunks(){return this[ec].chunk_shape}get dtype(){return pe(this,Ls).data_type}async getChunk(t,r){let s=this[ec],i=await s.get_chunk_bytes(t,r);if(!i){let o=s.chunk_shape.reduce((c,l)=>c*l,1),a=new s.TypedArray(o);return a.fill(s.fill_value),{data:a,shape:s.chunk_shape,stride:s.get_strides(s.chunk_shape)}}return s.codec.decode(i)}is(t){return vI(this.dtype,t)}},Ls=new WeakMap,k2);function*MI(n,e,t=1){e===void 0&&(e=n,n=0);for(let r=n;r<e;r+=t)yield r}function*NI(...n){if(n.length===0)return;const e=n.map(r=>r[Symbol.iterator]()),t=e.map(r=>r.next());if(t.some(r=>r.done))throw new Error("Input contains an empty iterator.");for(let r=0;;){if(t[r].done){if(e[r]=n[r][Symbol.iterator](),t[r]=e[r].next(),++r>=e.length)return}else yield t.map(({value:s})=>s),r=0;t[r]=e[r].next()}}function DI({start:n,stop:e,step:t},r){if(t===0)throw new Error("slice step cannot be zero");t=t??1;const s=t<0,[i,o]=s?[-1,r-1]:[0,r];return n===null?n=s?o:i:n<0?(n+=r,n<i&&(n=i)):n>o&&(n=o),e===null?e=s?i:o:e<0?(e+=r,e<i&&(e=i)):e>o&&(e=o),[n,e,t]}function Si(n,e,t=null){return e===void 0&&(e=n,n=null),{start:n,stop:e,step:t}}function LI(){const n=[];return{add:e=>n.push(e()),onIdle:()=>Promise.all(n)}}class $0 extends Error{constructor(e){super(e),this.name="IndexError"}}function FI(n,e){throw new $0(`too many indicies for array; expected ${e.length}, got ${n.length}`)}function BI(n){throw new $0(`index out of bounds for dimension with length ${n}`)}function UI(){throw new $0("only slices with step >= 1 are supported")}function $I(n,e){n.length>e.length&&FI(n,e)}function VI(n,e){return n=Math.trunc(n),n<0&&(n=e+n),(n>=e||n<0)&&BI(e),n}class jI{constructor({dim_sel:e,dim_len:t,dim_chunk_len:r}){S(this,"dim_sel");S(this,"dim_len");S(this,"dim_chunk_len");S(this,"nitems");e=VI(e,t),this.dim_sel=e,this.dim_len=t,this.dim_chunk_len=r,this.nitems=1}*[Symbol.iterator](){const e=Math.floor(this.dim_sel/this.dim_chunk_len),t=e*this.dim_chunk_len,r=this.dim_sel-t;yield{dim_chunk_ix:e,dim_chunk_sel:r}}}class Iv{constructor({dim_sel:e,dim_len:t,dim_chunk_len:r}){S(this,"start");S(this,"stop");S(this,"step");S(this,"dim_len");S(this,"dim_chunk_len");S(this,"nitems");S(this,"nchunks");const[s,i,o]=DI(e,t);this.start=s,this.stop=i,this.step=o,this.step<1&&UI(),this.dim_len=t,this.dim_chunk_len=r,this.nitems=Math.max(0,Math.ceil((this.stop-this.start)/this.step)),this.nchunks=Math.ceil(this.dim_len/this.dim_chunk_len)}*[Symbol.iterator](){const e=Math.floor(this.start/this.dim_chunk_len),t=Math.ceil(this.stop/this.dim_chunk_len);for(const r of MI(e,t)){const s=r*this.dim_chunk_len,i=Math.min(this.dim_len,(r+1)*this.dim_chunk_len),o=i-s;let a=0,c=0;if(this.start<s){const p=(s-this.start)%this.step;p&&(c+=this.step-p),a=Math.ceil((s-this.start)/this.step)}else c=this.start-s;const l=this.stop>i?o:this.stop-s,u=[c,l,this.step],h=Math.ceil((l-c)/this.step),d=[a,a+h,1];yield{dim_chunk_ix:r,dim_chunk_sel:u,dim_out_sel:d}}}}function zI(n,e){let t=[];return n===null?t=e.map(r=>Si(null)):Array.isArray(n)&&(t=n.map(r=>r??Si(null))),$I(t,e),t}class WI{constructor({selection:e,shape:t,chunk_shape:r}){S(this,"dim_indexers");S(this,"shape");this.dim_indexers=zI(e,t).map((s,i)=>new(typeof s=="number"?jI:Iv)({dim_sel:s,dim_len:t[i],dim_chunk_len:r[i]})),this.shape=this.dim_indexers.filter(s=>s instanceof Iv).map(s=>s.nitems)}*[Symbol.iterator](){for(const e of NI(...this.dim_indexers)){const t=e.map(s=>s.dim_chunk_ix),r=e.map(s=>"dim_out_sel"in s?{from:s.dim_chunk_sel,to:s.dim_out_sel}:{from:s.dim_chunk_sel,to:null});yield{chunk_coords:t,mapping:r}}}}function HI(n,e){return"get"in n?n.get(e):n[e]}async function XI(n,e,t,r){var c;let s=OI(n),i=new WI({selection:e,shape:n.shape,chunk_shape:n.chunks}),o=r.prepare(new s.TypedArray(i.shape.reduce((l,u)=>l*u,1)),i.shape,s.get_strides(i.shape)),a=((c=t.create_queue)==null?void 0:c.call(t))??LI();for(const{chunk_coords:l,mapping:u}of i)a.add(async()=>{let{data:h,shape:d,stride:p}=await n.getChunk(l,t.opts),m=r.prepare(h,d,p);r.set_from_chunk(o,m,u)});return await a.onIdle(),i.shape.length===0?HI(o.data,0):o}function V0(n,e=0,t){let r=t??n.length-e;return{length:r,subarray(s,i=r){return V0(n,e+s,i-s)},set(s,i=0){for(let o=0;o<s.length;o++)n[e+i+o]=s.get(o)},get(s){return n[e+s]}}}function rp(n){return globalThis.Array.isArray(n.data)?{data:V0(n.data),stride:n.stride,bytes_per_element:1}:{data:new Uint8Array(n.data.buffer,n.data.byteOffset,n.data.byteLength),stride:n.stride,bytes_per_element:n.data.BYTES_PER_ELEMENT}}function ZI(n){return"chars"in n?n.constructor.bind(null,n.chars):n.constructor}function qI(n,e){if(globalThis.Array.isArray(n.data))return V0([e]);let t=ZI(n.data),r=new t([e]);return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}const YI={prepare(n,e,t){return{data:n,shape:e,stride:t}},set_scalar(n,e,t){let r=rp(n);Nm(r,e,qI(n,t),r.bytes_per_element)},set_from_chunk(n,e,t){let r=rp(n);Xu(r,rp(e),r.bytes_per_element,t)}};async function KI(n,e=null,t={}){return XI(n,e,t,YI)}function xw(n,e,t){return t<0&&e<n?Math.floor((n-e-1)/-t)+1:n<e?Math.floor((e-n-1)/t)+1:0}function Nm(n,e,t,r){if(e.length===0){n.data.set(t,0);return}const[s,...i]=e,[o,...a]=n.stride;if(typeof s=="number"){const d=n.data.subarray(o*s*r);Nm({data:d,stride:a},i,t,r);return}const[c,l,u]=s,h=xw(c,l,u);if(i.length===0){for(let d=0;d<h;d++)n.data.set(t,o*(c+u*d)*r);return}for(let d=0;d<h;d++){const p=n.data.subarray(o*(c+u*d)*r);Nm({data:p,stride:a},i,t,r)}}function Xu(n,e,t,r){const[s,...i]=r,[o,...a]=n.stride,[c,...l]=e.stride;if(s.from===null){if(i.length===0){n.data.set(e.data.subarray(0,t),s.to*t);return}Xu({data:n.data.subarray(o*s.to*t),stride:a},e,t,i);return}if(s.to===null){if(i.length===0){let x=s.from*t;n.data.set(e.data.subarray(x,x+t),0);return}Xu(n,{data:e.data.subarray(c*s.from*t),stride:l},t,i);return}const[u,h,d]=s.to,[p,m,g]=s.from,y=xw(u,h,d);if(i.length===0){if(d===1&&g===1&&o===1&&c===1){let x=p*t,b=y*t;n.data.set(e.data.subarray(x,x+b),u*t);return}for(let x=0;x<y;x++){let b=c*(p+g*x)*t;n.data.set(e.data.subarray(b,b+t),o*(u+d*x)*t)}return}for(let x=0;x<y;x++)Xu({data:n.data.subarray(o*(u+x*d)*t),stride:a},{data:e.data.subarray(c*(p+x*g)*t),stride:l},t,i)}let sd=GI();function GI(){let n=new WeakMap;function e(t){let r=n.get(t)??{v2:0,v3:0};return n.set(t,r),r}return{increment(t,r){e(t)[r]+=1},version_max(t){let r=e(t);return r.v3>r.v2?"v3":"v2"}}}async function JI(n){let e=await n.store.get(n.resolve(".zattrs").path);return e?Al(e):{}}async function QI(n,e={}){let t="store"in n?n:new ai(n),r={};return(e.attrs??!0)&&(r=await JI(t)),e.kind==="array"?Pv(t,r):e.kind==="group"?Ov(t,r):Pv(t,r).catch(s=>(gw(s,oi),Ov(t,r)))}async function Pv(n,e){let{path:t}=n.resolve(".zarray"),r=await n.store.get(t);if(!r)throw new oi("v2 array",{cause:new U0(t)});return sd.increment(n.store,"v2"),new yf(n.store,n.path,yI(Al(r),e))}async function Ov(n,e){let{path:t}=n.resolve(".zgroup"),r=await n.store.get(t);if(!r)throw new oi("v2 group",{cause:new U0(t)});return sd.increment(n.store,"v2"),new rd(n.store,n.path,_I(Al(r),e))}async function eP(n){let{store:e,path:t}=n.resolve("zarr.json"),r=await n.store.get(t);if(!r)throw new oi("v3 array or group",{cause:new U0(t)});let s=Al(r);return s.node_type==="array"&&(s.fill_value=mw(s)),s.node_type==="array"?new yf(e,n.path,s):new rd(e,n.path,s)}async function tP(n,e={}){let t="store"in n?n:new ai(n),r=await eP(t);if(sd.increment(t.store,"v3"),e.kind===void 0||e.kind==="array"&&r instanceof yf||e.kind==="group"&&r instanceof rd)return r;let s=r instanceof yf?"array":"group";throw new Error(`Expected node of kind ${e.kind}, found ${s}.`)}async function sn(n,e={}){let t="store"in n?n.store:n,r=sd.version_max(t),s=r==="v2"?sn.v2:sn.v3,i=r==="v2"?sn.v3:sn.v2;return s(n,e).catch(o=>(gw(o,oi),i(n,e)))}sn.v2=QI;sn.v3=tP;function bw(n){return n.arrayBuffer?n.arrayBuffer():new Promise((e,t)=>{const r=new FileReader;r.addEventListener("loadend",()=>{e(r.result)}),r.addEventListener("error",t),r.readAsArrayBuffer(n)})}async function nP(n){const e=await bw(n);return new Uint8Array(e)}function ww(n){return typeof Blob<"u"&&n instanceof Blob}function Dc(n){return typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}const rP=typeof process<"u"&&process.versions&&typeof process.versions.node<"u"&&typeof process.versions.electron>"u";function sP(n){return n.byteOffset===0&&n.byteLength===n.buffer.byteLength}class kv{constructor(e){this.typedArray=e instanceof ArrayBuffer||Dc(e)?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}async getLength(){return this.typedArray.byteLength}async read(e,t){return new Uint8Array(this.typedArray.buffer,this.typedArray.byteOffset+e,t)}}let Mv=class{constructor(e){this.blob=e}async getLength(){return this.blob.size}async read(e,t){const r=this.blob.slice(e,e+t),s=await bw(r);return new Uint8Array(s)}async sliceAsBlob(e,t,r=""){return this.blob.slice(e,e+t,r)}};function iP(n,e){var t=Uint8Array;if(n[0]==3&&n[1]==0)return e||new t(0);var r=aP,s=Tw,i=oP,o=Sw,a=e==null;a&&(e=new t(n.length>>>2<<3));for(var c=0,l=0,u=0,h=0,d=0,p=0,m=0,g=0,y=0,x,b;c==0;){if(c=r(n,y,1),l=r(n,y+1,2),y+=3,l==0){(y&7)!=0&&(y+=8-(y&7));var v=(y>>>3)+4,_=n[v-4]|n[v-3]<<8;a&&(e=sp(e,g+_)),e.set(new t(n.buffer,n.byteOffset+v,_),g),y=v+_<<3,g+=_;continue}if(a&&(e=sp(e,g+(1<<17))),l==1&&(x=Ne.flmap,b=Ne.fdmap,p=511,m=31),l==2){u=s(n,y,5)+257,h=s(n,y+5,5)+1,d=s(n,y+10,4)+4,y+=14;for(var w=0;w<38;w+=2)Ne.itree[w]=0,Ne.itree[w+1]=0;for(var E=1,w=0;w<d;w++){var N=s(n,y+w*3,3);Ne.itree[(Ne.ordr[w]<<1)+1]=N,N>E&&(E=N)}y+=3*d,pc(Ne.itree,E),mc(Ne.itree,E,Ne.imap),x=Ne.lmap,b=Ne.dmap,y=i(Ne.imap,(1<<E)-1,u+h,n,y,Ne.ttree);var F=Nv(Ne.ttree,0,u,Ne.ltree);p=(1<<F)-1;var $=Nv(Ne.ttree,u,h,Ne.dtree);m=(1<<$)-1,pc(Ne.ltree,F),mc(Ne.ltree,F,x),pc(Ne.dtree,$),mc(Ne.dtree,$,b)}for(;;){var I=x[o(n,y)&p];y+=I&15;var te=I>>>4;if(!(te>>>8))e[g++]=te;else{if(te==256)break;var R=g+te-254;if(te>264){var re=Ne.ldef[te-257];R=g+(re>>>3)+s(n,y,re&7),y+=re&7}var q=b[o(n,y)&m];y+=q&15;var de=q>>>4,L=Ne.ddef[de],j=(L>>>4)+r(n,y,L&15);for(y+=L&15,a&&(e=sp(e,g+(1<<17)));g<R;)e[g]=e[g++-j],e[g]=e[g++-j],e[g]=e[g++-j],e[g]=e[g++-j];g=R}}}return e.length==g?e:e.slice(0,g)}function sp(n,e){var t=n.length;if(e<=t)return n;var r=new Uint8Array(Math.max(t<<1,e));return r.set(n,0),r}function oP(n,e,t,r,s,i){for(var o=Tw,a=Sw,c=0;c<t;){var l=n[a(r,s)&e];s+=l&15;var u=l>>>4;if(u<=15)i[c]=u,c++;else{var h=0,d=0;u==16?(d=3+o(r,s,2),s+=2,h=i[c-1]):u==17?(d=3+o(r,s,3),s+=3):u==18&&(d=11+o(r,s,7),s+=7);for(var p=c+d;c<p;)i[c]=h,c++}}return s}function Nv(n,e,t,r){for(var s=0,i=0,o=r.length>>>1;i<t;){var a=n[i+e];r[i<<1]=0,r[(i<<1)+1]=a,a>s&&(s=a),i++}for(;i<o;)r[i<<1]=0,r[(i<<1)+1]=0,i++;return s}function pc(n,e){for(var t=n.length,r,s,i,o,a,c=Ne.bl_count,o=0;o<=e;o++)c[o]=0;for(o=1;o<t;o+=2)c[n[o]]++;var l=Ne.next_code;for(r=0,c[0]=0,s=1;s<=e;s++)r=r+c[s-1]<<1,l[s]=r;for(i=0;i<t;i+=2)a=n[i+1],a!=0&&(n[i]=l[a],l[a]++)}function mc(n,e,t){for(var r=n.length,s=Ne.rev15,i=0;i<r;i+=2)if(n[i+1]!=0)for(var o=i>>1,a=n[i+1],c=o<<4|a,l=e-a,u=n[i]<<l,h=u+(1<<l);u!=h;){var d=s[u]>>>15-e;t[d]=c,u++}}function Dv(n,e){for(var t=Ne.rev15,r=15-e,s=0;s<n.length;s+=2){var i=n[s]<<e-n[s+1];n[s]=t[i]>>>r}}function Tw(n,e,t){return(n[e>>>3]|n[(e>>>3)+1]<<8)>>>(e&7)&(1<<t)-1}function aP(n,e,t){return(n[e>>>3]|n[(e>>>3)+1]<<8|n[(e>>>3)+2]<<16)>>>(e&7)&(1<<t)-1}function Sw(n,e){return(n[e>>>3]|n[(e>>>3)+1]<<8|n[(e>>>3)+2]<<16)>>>(e&7)}const Ne=function(){var n=Uint16Array,e=Uint32Array;return{next_code:new n(16),bl_count:new n(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new n(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new e(32),flmap:new n(512),fltree:[],fdmap:new n(32),fdtree:[],lmap:new n(32768),ltree:[],ttree:[],dmap:new n(32768),dtree:[],imap:new n(512),itree:[],rev15:new n(32768),lhst:new e(286),dhst:new e(30),ihst:new e(19),lits:new e(15e3),strt:new n(65536),prev:new n(32768)}}();(function(){for(var n=32768,e=0;e<n;e++){var t=e;t=(t&2863311530)>>>1|(t&1431655765)<<1,t=(t&3435973836)>>>2|(t&858993459)<<2,t=(t&4042322160)>>>4|(t&252645135)<<4,t=(t&4278255360)>>>8|(t&16711935)<<8,Ne.rev15[e]=(t>>>16|t<<16)>>>17}function r(s,i,o){for(;i--!=0;)s.push(0,o)}for(var e=0;e<32;e++)Ne.ldef[e]=Ne.of0[e]<<3|Ne.exb[e],Ne.ddef[e]=Ne.df0[e]<<4|Ne.dxb[e];r(Ne.fltree,144,8),r(Ne.fltree,112,9),r(Ne.fltree,24,7),r(Ne.fltree,8,8),pc(Ne.fltree,9),mc(Ne.fltree,9,Ne.flmap),Dv(Ne.fltree,9),r(Ne.fdtree,32,5),pc(Ne.fdtree,5),mc(Ne.fdtree,5,Ne.fdmap),Dv(Ne.fdtree,5),r(Ne.itree,19,0),r(Ne.ltree,286,0),r(Ne.dtree,30,0),r(Ne.ttree,320,0)})();(function(){for(var n=new Uint32Array(256),e=0;e<256;e++){for(var t=e,r=0;r<8;r++)t&1?t=3988292384^t>>>1:t=t>>>1;n[e]=t}return n})();function cP(n,e){return iP(n,e)}const Lv={numWorkers:1,workerURL:"",useWorkers:!1};let lP=0;const Zu=[];function ip(n){return new Promise((e,t)=>{const r=new Worker(n);r.onmessage=s=>{s.data==="start"?(r.onerror=void 0,r.onmessage=void 0,e(r)):t(new Error(`unexpected message: ${s.data}`))},r.onerror=t})}function uP(n,e){return n.require?n.require(e):{}}(function(){if(rP){const{Worker:n}=uP(module,"worker_threads");return{async createWorker(e){return new n(e)},addEventListener(e,t){e.on("message",r=>{t({target:e,data:r})})},async terminate(e){await e.terminate()}}}else return{async createWorker(n){try{return await ip(n)}catch{console.warn("could not load worker:",n)}let e;try{const t=await fetch(n,{mode:"cors"});if(!t.ok)throw new Error(`could not load: ${n}`);e=await t.text(),n=URL.createObjectURL(new Blob([e],{type:"application/javascript"}));const r=await ip(n);return Lv.workerURL=n,r}catch{console.warn("could not load worker via fetch:",n)}if(e!==void 0)try{n=`data:application/javascript;base64,${btoa(e)}`;const t=await ip(n);return Lv.workerURL=n,t}catch{console.warn("could not load worker via dataURI")}throw console.warn("workers will not be used"),new Error("can not start workers")},addEventListener(n,e){n.addEventListener("message",e)},async terminate(n){n.terminate()}}})();function fP(n,e,t,r){const s=new Uint8Array(e);cP(n,s),r(t?new Blob([s],{type:t}):s.buffer)}async function hP(){if(Zu.length!==0)for(;Zu.length;){const{src:n,uncompressedSize:e,type:t,resolve:r}=Zu.shift();let s=n;ww(n)&&(s=await nP(n)),fP(s,e,t,r)}}function Ew(n,e,t){return new Promise((r,s)=>{Zu.push({src:n,uncompressedSize:e,type:t,resolve:r,reject:s,id:lP++}),hP()})}function dP(n,e){const t=n&31,r=(n>>5&15)-1,s=(n>>9&127)+1980,i=0,o=(e&31)*2,a=e>>5&63,c=e>>11&31;return new Date(s,r,t,c,a,o,i)}class pP{constructor(e,t){this._reader=e,this._rawEntry=t,this.name=t.name,this.nameBytes=t.nameBytes,this.size=t.uncompressedSize,this.compressedSize=t.compressedSize,this.comment=t.comment,this.commentBytes=t.commentBytes,this.compressionMethod=t.compressionMethod,this.lastModDate=dP(t.lastModFileDate,t.lastModFileTime),this.isDirectory=t.uncompressedSize===0&&t.name.endsWith("/"),this.encrypted=!!(t.generalPurposeBitFlag&1),this.externalFileAttributes=t.externalFileAttributes,this.versionMadeBy=t.versionMadeBy}async blob(e="application/octet-stream"){return await EP(this._reader,this._rawEntry,e)}async arrayBuffer(){return await SP(this._reader,this._rawEntry)}async text(){const e=await this.arrayBuffer();return gc(new Uint8Array(e))}async json(){const e=await this.text();return JSON.parse(e)}}const op=22,mP=65535,gP=101010256,yP=101075792;async function ca(n,e,t){return await n.read(e,t)}async function Dm(n,e,t,r){return n.sliceAsBlob?await n.sliceAsBlob(e,t,r):await n.read(e,t)}const _P={unsigned(){return 0}};function fn(n,e){return n[e]+n[e+1]*256}function Rn(n,e){return n[e]+n[e+1]*256+n[e+2]*65536+n[e+3]*16777216}function Ei(n,e){return Rn(n,e)+Rn(n,e+4)*4294967296}const vP=new TextDecoder;function gc(n,e){return Dc(n.buffer)&&(n=new Uint8Array(n)),vP.decode(n)}async function xP(n,e){const t=Math.min(op+mP,e),r=e-t,s=await ca(n,r,t);for(let i=t-op;i>=0;--i){if(Rn(s,i)!==gP)continue;const o=new Uint8Array(s.buffer,s.byteOffset+i,s.byteLength-i),a=fn(o,4);if(a!==0)throw new Error(`multi-volume zip files are not supported. This is volume: ${a}`);const c=fn(o,10),l=Rn(o,12),u=Rn(o,16),h=fn(o,20),d=o.length-op;if(h!==d)throw new Error(`invalid comment length. expected: ${d}, actual: ${h}`);const p=new Uint8Array(o.buffer,o.byteOffset+22,h),m=gc(p);return c===65535||u===4294967295?await wP(n,r+i,m,p):await Aw(n,u,l,c,m,p)}throw new Error("could not find end of central directory. maybe not zip file")}const bP=117853008;async function wP(n,e,t,r){const s=e-20,i=await ca(n,s,20);if(Rn(i,0)!==bP)throw new Error("invalid zip64 end of central directory locator signature");const o=Ei(i,8),a=await ca(n,o,56);if(Rn(a,0)!==yP)throw new Error("invalid zip64 end of central directory record signature");const c=Ei(a,32),l=Ei(a,40),u=Ei(a,48);return Aw(n,u,l,c,t,r)}const TP=33639248;async function Aw(n,e,t,r,s,i){let o=0;const a=await ca(n,e,t),c=[];for(let u=0;u<r;++u){const h=a.subarray(o,o+46),d=Rn(h,0);if(d!==TP)throw new Error(`invalid central directory file header signature: 0x${d.toString(16)}`);const p={versionMadeBy:fn(h,4),versionNeededToExtract:fn(h,6),generalPurposeBitFlag:fn(h,8),compressionMethod:fn(h,10),lastModFileTime:fn(h,12),lastModFileDate:fn(h,14),crc32:Rn(h,16),compressedSize:Rn(h,20),uncompressedSize:Rn(h,24),fileNameLength:fn(h,28),extraFieldLength:fn(h,30),fileCommentLength:fn(h,32),internalFileAttributes:fn(h,36),externalFileAttributes:Rn(h,38),relativeOffsetOfLocalHeader:Rn(h,42)};if(p.generalPurposeBitFlag&64)throw new Error("strong encryption is not supported");o+=46;const m=a.subarray(o,o+p.fileNameLength+p.extraFieldLength+p.fileCommentLength);p.nameBytes=m.slice(0,p.fileNameLength),p.name=gc(p.nameBytes);const g=p.fileNameLength+p.extraFieldLength,y=m.slice(p.fileNameLength,g);p.extraFields=[];let x=0;for(;x<y.length-3;){const v=fn(y,x+0),_=fn(y,x+2),w=x+4,E=w+_;if(E>y.length)throw new Error("extra field length exceeds extra field buffer size");p.extraFields.push({id:v,data:y.slice(w,E)}),x=E}if(p.commentBytes=m.slice(g,g+p.fileCommentLength),p.comment=gc(p.commentBytes),o+=m.length,p.uncompressedSize===4294967295||p.compressedSize===4294967295||p.relativeOffsetOfLocalHeader===4294967295){const v=p.extraFields.find(E=>E.id===1);if(!v)throw new Error("expected zip64 extended information extra field");const _=v.data;let w=0;if(p.uncompressedSize===4294967295){if(w+8>_.length)throw new Error("zip64 extended information extra field does not include uncompressed size");p.uncompressedSize=Ei(_,w),w+=8}if(p.compressedSize===4294967295){if(w+8>_.length)throw new Error("zip64 extended information extra field does not include compressed size");p.compressedSize=Ei(_,w),w+=8}if(p.relativeOffsetOfLocalHeader===4294967295){if(w+8>_.length)throw new Error("zip64 extended information extra field does not include relative header offset");p.relativeOffsetOfLocalHeader=Ei(_,w),w+=8}}const b=p.extraFields.find(v=>v.id===28789&&v.data.length>=6&&v.data[0]===1&&Rn(v.data,1),_P.unsigned(p.nameBytes));if(b&&(p.fileName=gc(b.data.slice(5))),p.compressionMethod===0){let v=p.uncompressedSize;if((p.generalPurposeBitFlag&1)!==0&&(v+=12),p.compressedSize!==v)throw new Error(`compressed size mismatch for stored file: ${p.compressedSize} != ${v}`)}c.push(p)}return{zip:{comment:s,commentBytes:i},entries:c.map(u=>new pP(n,u))}}async function Cw(n,e){if(e.generalPurposeBitFlag&1)throw new Error("encrypted entries not supported");const t=await ca(n,e.relativeOffsetOfLocalHeader,30),r=await n.getLength(),s=Rn(t,0);if(s!==67324752)throw new Error(`invalid local file header signature: 0x${s.toString(16)}`);const i=fn(t,26),o=fn(t,28),a=e.relativeOffsetOfLocalHeader+t.length+i+o;let c;if(e.compressionMethod===0)c=!1;else if(e.compressionMethod===8)c=!0;else throw new Error(`unsupported compression method: ${e.compressionMethod}`);const l=a,u=l+e.compressedSize;if(e.compressedSize!==0&&u>r)throw new Error(`file data overflows file bounds: ${l} + ${e.compressedSize} > ${r}`);return{decompress:c,fileDataStart:l}}async function SP(n,e){const{decompress:t,fileDataStart:r}=await Cw(n,e);if(!t){const o=await ca(n,r,e.compressedSize);return sP(o)?o.buffer:o.slice().buffer}const s=await Dm(n,r,e.compressedSize);return await Ew(s,e.uncompressedSize)}async function EP(n,e,t){const{decompress:r,fileDataStart:s}=await Cw(n,e);if(!r){const a=await Dm(n,s,e.compressedSize,t);return ww(a)?a:new Blob([Dc(a.buffer)?new Uint8Array(a):a],{type:t})}const i=await Dm(n,s,e.compressedSize);return await Ew(i,e.uncompressedSize,t)}async function AP(n){let e;if(typeof Blob<"u"&&n instanceof Blob)e=new Mv(n);else if(n instanceof ArrayBuffer||n&&n.buffer&&n.buffer instanceof ArrayBuffer)e=new kv(n);else if(Dc(n)||Dc(n.buffer))e=new kv(n);else if(typeof n=="string"){const r=await fetch(n);if(!r.ok)throw new Error(`failed http request ${n}, status: ${r.status}: ${r.statusText}`);const s=await r.blob();e=new Mv(s)}else if(typeof n.getLength=="function"&&typeof n.read=="function")e=n;else throw new Error("unsupported source type");const t=await e.getLength();if(t>Number.MAX_SAFE_INTEGER)throw new Error(`file too large. size: ${t}. Only file sizes up 4503599627370496 bytes are supported`);return await xP(e,t)}async function CP(n){const{zip:e,entries:t}=await AP(n);return{zip:e,entries:Object.fromEntries(t.map(r=>[r.name,r]))}}function RP(n){if(!("compressionMethod"in n)||!("_rawEntry"in n))return!1;const e=n._rawEntry;return typeof n.compressionMethod=="number"&&typeof e=="object"&&e!==null&&"relativeOffsetOfLocalHeader"in e&&typeof e.relativeOffsetOfLocalHeader=="number"}class IP{constructor(e){S(this,"blob");this.blob=e}async getLength(){return this.blob.size}async read(e,t){const r=this.blob.slice(e,e+t);return new Uint8Array(await r.arrayBuffer())}}var sa;class PP{constructor(e,t={}){S(this,"url");S(this,"length");st(this,sa);this.url=e,$e(this,sa,t.overrides??{})}async getLength(){if(this.length===void 0){const e=await fetch(this.url,{...pe(this,sa),method:"HEAD"});if(vv(e.ok,`failed http request ${this.url}, status: ${e.status}: ${e.statusText}`),this.length=Number(e.headers.get("content-length")),Number.isNaN(this.length))throw Error("could not get length")}return this.length}async read(e,t){if(t===0)return new Uint8Array(0);const r=await nd(this.url,e,t,pe(this,sa));return vv(r.ok,`failed http request ${this.url}, status: ${r.status} offset: ${e} size: ${t}: ${r.statusText}`),new Uint8Array(await r.arrayBuffer())}}sa=new WeakMap;class _f{constructor(e,t={}){S(this,"info");S(this,"reader");this.reader=e,this.info=CP(e).then(r=>(t.transformEntries&&(r.entries=t.transformEntries(r.entries)),r))}async getEntryDataOffset(e){const t=e._rawEntry.relativeOffsetOfLocalHeader,r=await this.reader.read(t,30),s=r[26]+r[27]*256,i=r[28]+r[29]*256;return t+30+s+i}async get(e){let t=(await this.info).entries[Hu(e)];if(t)return new Uint8Array(await t.arrayBuffer())}async getRange(e,t){const r=(await this.info).entries[Hu(e)];if(!r)return;if(!RP(r))throw new Error("ZipFileStore.getRange requires internal unzipit properties that are not available. This may indicate an incompatible version of unzipit.");if(r.compressionMethod!==0){const i=await this.get(e);return i?"suffixLength"in t?i.slice(-t.suffixLength):i.slice(t.offset,t.offset+t.length):void 0}const s=await this.getEntryDataOffset(r);if("suffixLength"in t){const i=s+r.size-t.suffixLength;return this.reader.read(i,t.suffixLength)}return this.reader.read(s+t.offset,t.length)}async has(e){return Hu(e)in(await this.info).entries}static fromUrl(e,t={}){return new _f(new PP(e,t),t)}static fromBlob(e,t={}){return new _f(new IP(e),t)}}var Xn,Dt,Ht,Fs,bl,Bs,lt,Lm,cr,Rw,Fm,Bm,Um,Iw,$m;class OP extends Map{constructor(t={}){super();st(this,lt);st(this,Xn,0);st(this,Dt,new Map);st(this,Ht,new Map);st(this,Fs);st(this,bl);st(this,Bs);if(!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof t.maxAge=="number"&&t.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");$e(this,Fs,t.maxSize),$e(this,bl,t.maxAge||Number.POSITIVE_INFINITY),$e(this,Bs,t.onEviction)}get __oldCache(){return pe(this,Ht)}get(t){if(pe(this,Dt).has(t)){const r=pe(this,Dt).get(t);return St(this,lt,Fm).call(this,t,r)}if(pe(this,Ht).has(t)){const r=pe(this,Ht).get(t);if(St(this,lt,cr).call(this,t,r)===!1)return St(this,lt,Iw).call(this,t,r),r.value}}set(t,r,{maxAge:s=pe(this,bl)}={}){const i=typeof s=="number"&&s!==Number.POSITIVE_INFINITY?Date.now()+s:void 0;return pe(this,Dt).has(t)?pe(this,Dt).set(t,{value:r,expiry:i}):St(this,lt,Um).call(this,t,{value:r,expiry:i}),this}has(t){return pe(this,Dt).has(t)?!St(this,lt,cr).call(this,t,pe(this,Dt).get(t)):pe(this,Ht).has(t)?!St(this,lt,cr).call(this,t,pe(this,Ht).get(t)):!1}peek(t){if(pe(this,Dt).has(t))return St(this,lt,Bm).call(this,t,pe(this,Dt));if(pe(this,Ht).has(t))return St(this,lt,Bm).call(this,t,pe(this,Ht))}delete(t){const r=pe(this,Dt).delete(t);return r&&zd(this,Xn)._--,pe(this,Ht).delete(t)||r}clear(){pe(this,Dt).clear(),pe(this,Ht).clear(),$e(this,Xn,0)}resize(t){if(!(t&&t>0))throw new TypeError("`maxSize` must be a number greater than 0");const r=[...St(this,lt,$m).call(this)],s=r.length-t;s<0?($e(this,Dt,new Map(r)),$e(this,Ht,new Map),$e(this,Xn,r.length)):(s>0&&St(this,lt,Lm).call(this,r.slice(0,s)),$e(this,Ht,new Map(r.slice(s))),$e(this,Dt,new Map),$e(this,Xn,0)),$e(this,Fs,t)}*keys(){for(const[t]of this)yield t}*values(){for(const[,t]of this)yield t}*[Symbol.iterator](){for(const t of pe(this,Dt)){const[r,s]=t;St(this,lt,cr).call(this,r,s)===!1&&(yield[r,s.value])}for(const t of pe(this,Ht)){const[r,s]=t;pe(this,Dt).has(r)||St(this,lt,cr).call(this,r,s)===!1&&(yield[r,s.value])}}*entriesDescending(){let t=[...pe(this,Dt)];for(let r=t.length-1;r>=0;--r){const s=t[r],[i,o]=s;St(this,lt,cr).call(this,i,o)===!1&&(yield[i,o.value])}t=[...pe(this,Ht)];for(let r=t.length-1;r>=0;--r){const s=t[r],[i,o]=s;pe(this,Dt).has(i)||St(this,lt,cr).call(this,i,o)===!1&&(yield[i,o.value])}}*entriesAscending(){for(const[t,r]of St(this,lt,$m).call(this))yield[t,r.value]}get size(){if(!pe(this,Xn))return pe(this,Ht).size;let t=0;for(const r of pe(this,Ht).keys())pe(this,Dt).has(r)||t++;return Math.min(pe(this,Xn)+t,pe(this,Fs))}get maxSize(){return pe(this,Fs)}entries(){return this.entriesAscending()}forEach(t,r=this){for(const[s,i]of this.entriesAscending())t.call(r,i,s,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}Xn=new WeakMap,Dt=new WeakMap,Ht=new WeakMap,Fs=new WeakMap,bl=new WeakMap,Bs=new WeakMap,lt=new WeakSet,Lm=function(t){if(typeof pe(this,Bs)=="function")for(const[r,s]of t)pe(this,Bs).call(this,r,s.value)},cr=function(t,r){return typeof r.expiry=="number"&&r.expiry<=Date.now()?(typeof pe(this,Bs)=="function"&&pe(this,Bs).call(this,t,r.value),this.delete(t)):!1},Rw=function(t,r){if(St(this,lt,cr).call(this,t,r)===!1)return r.value},Fm=function(t,r){return r.expiry?St(this,lt,Rw).call(this,t,r):r.value},Bm=function(t,r){const s=r.get(t);return St(this,lt,Fm).call(this,t,s)},Um=function(t,r){pe(this,Dt).set(t,r),zd(this,Xn)._++,pe(this,Xn)>=pe(this,Fs)&&($e(this,Xn,0),St(this,lt,Lm).call(this,pe(this,Ht)),$e(this,Ht,pe(this,Dt)),$e(this,Dt,new Map))},Iw=function(t,r){pe(this,Ht).delete(t),St(this,lt,Um).call(this,t,r)},$m=function*(){for(const t of pe(this,Ht)){const[r,s]=t;pe(this,Dt).has(r)||St(this,lt,cr).call(this,r,s)===!1&&(yield t)}for(const t of pe(this,Dt)){const[r,s]=t;St(this,lt,cr).call(this,r,s)===!1&&(yield t)}};function Fv(n,e){return e?"suffixLength"in e?`${n}:-${e.suffixLength}`:`${n}:${e.offset}:${e.offset+e.length-1}`:n}function Bv(n){var e;return(e=n.split("/")[1])!=null&&e.includes(":")?`/.${n}`:n}function kP(n,e=100){const t=new OP({maxSize:e});let r=n.getRange?n.getRange.bind(n):void 0;function s(...i){const[o,a]=i,c=Fv(o),l=t.get(c);if(l)return l;const u=Bv(o),h=Promise.resolve(n.get(u,a));return t.set(c,h),h}if(r){const i=r;r=(...o)=>{const[a,c,l]=o,u=Fv(a,c),h=t.get(u);if(h)return h;const d=Bv(a),p=Promise.resolve(i==null?void 0:i(d,c,l)).catch(m=>{throw t.delete(u),m});return t.set(u,p),p}}return new Proxy(n,{get(i,o,a){return o==="get"?s:o==="getRange"&&r?r:Reflect.get(i,o,a)}})}const MP={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...MP}};const Nn=globalThis.mathgl.config;function NP(n,{precision:e=Nn.precision}={}){return n=DP(n),`${parseFloat(n.toPrecision(e))}`}function zi(n){return Array.isArray(n)||ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Bt(n,e,t){return FP(n,r=>Math.max(e,Math.min(t,r)))}function Oi(n,e,t){return zi(n)?n.map((r,s)=>Oi(r,e[s],t)):t*e+(1-t)*n}function ss(n,e,t){const r=Nn.EPSILON;try{if(n===e)return!0;if(zi(n)&&zi(e)){if(n.length!==e.length)return!1;for(let s=0;s<n.length;++s)if(!ss(n[s],e[s]))return!1;return!0}return n&&n.equals?n.equals(e):e&&e.equals?e.equals(n):typeof n=="number"&&typeof e=="number"?Math.abs(n-e)<=Nn.EPSILON*Math.max(1,Math.abs(n),Math.abs(e)):!1}finally{Nn.EPSILON=r}}function DP(n){return Math.round(n/Nn.EPSILON)*Nn.EPSILON}function LP(n){return n.clone?n.clone():new Array(n.length)}function FP(n,e,t){if(zi(n)){const r=n;t=t||LP(r);for(let s=0;s<t.length&&s<r.length;++s){const i=typeof n=="number"?n:n[s];t[s]=e(i,s,t)}return t}return e(n)}class j0 extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,t=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=e[r+t];return this.check()}toArray(e=[],t=0){for(let r=0;r<this.ELEMENTS;++r)e[t+r]=this[r];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:zi(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Nn)}formatString(e){let t="";for(let r=0;r<this.ELEMENTS;++r)t+=(r>0?", ":"")+NP(this[r],e);return`${e.printTypes?this.constructor.name:""}[${t}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!ss(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,r){if(r===void 0)return this.lerp(this,e,t);for(let s=0;s<this.ELEMENTS;++s){const i=e[s],o=typeof t=="number"?t:t[s];this[s]=i+r*(o-i)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e[r]),t[r]);return this.check()}add(...e){for(const t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]+=t[r];return this.check()}subtract(...e){for(const t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]-=t[r];return this.check()}scale(e){if(typeof e=="number")for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;else for(let t=0;t<this.ELEMENTS&&t<e.length;++t)this[t]*=e[t];return this.check()}multiplyByScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}check(){if(Nn.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e),t);return this.check()}get elements(){return this}}function BP(n,e){if(n.length!==e)return!1;for(let t=0;t<n.length;++t)if(!Number.isFinite(n[t]))return!1;return!0}function Pt(n){if(!Number.isFinite(n))throw new Error(`Invalid number ${JSON.stringify(n)}`);return n}function yc(n,e,t=""){if(Nn.debug&&!BP(n,e))throw new Error(`math.gl: ${t} some fields set to invalid numbers'`);return n}function Lc(n,e){if(!n)throw new Error(`math.gl assertion ${e}`)}class Pw extends j0{get x(){return this[0]}set x(e){this[0]=Pt(e)}get y(){return this[1]}set y(e){this[1]=Pt(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let r=0;r<this.ELEMENTS;++r){const s=this[r]-e[r];t+=s*s}return Pt(t)}dot(e){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*e[r];return Pt(t)}normalize(){const e=this.magnitude();if(e!==0)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(const t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]*=t[r];return this.check()}divide(...e){for(const t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return Lc(e>=0&&e<this.ELEMENTS,"index is out of range"),Pt(this[e])}setComponent(e,t){return Lc(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}const _c=1e-6;let mr=typeof Float32Array<"u"?Float32Array:Array;function UP(){const n=new mr(2);return mr!=Float32Array&&(n[0]=0,n[1]=0),n}function vf(n,e,t){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n}function Ow(n,e){return n[0]=-e[0],n[1]=-e[1],n}function kw(n,e,t,r){const s=e[0],i=e[1];return n[0]=s+r*(t[0]-s),n[1]=i+r*(t[1]-i),n}function $P(n,e,t){const r=e[0],s=e[1];return n[0]=t[0]*r+t[3]*s+t[6],n[1]=t[1]*r+t[4]*s+t[7],n}function VP(n,e,t){const r=e[0],s=e[1];return n[0]=t[0]*r+t[4]*s+t[12],n[1]=t[1]*r+t[5]*s+t[13],n}(function(){const n=UP();return function(e,t,r,s,i,o){let a,c;for(t||(t=2),r||(r=0),s?c=Math.min(s*t+r,e.length):c=e.length,a=r;a<c;a+=t)n[0]=e[a],n[1]=e[a+1],i(n,n,o),e[a]=n[0],e[a+1]=n[1];return e}})();function jP(n,e,t){const r=e[0],s=e[1],i=t[3]*r+t[7]*s||1;return n[0]=(t[0]*r+t[4]*s)/i,n[1]=(t[1]*r+t[5]*s)/i,n}function Mw(n,e,t){const r=e[0],s=e[1],i=e[2],o=t[3]*r+t[7]*s+t[11]*i||1;return n[0]=(t[0]*r+t[4]*s+t[8]*i)/o,n[1]=(t[1]*r+t[5]*s+t[9]*i)/o,n[2]=(t[2]*r+t[6]*s+t[10]*i)/o,n}function zP(n,e,t){const r=e[0],s=e[1];return n[0]=t[0]*r+t[2]*s,n[1]=t[1]*r+t[3]*s,n[2]=e[2],n}function WP(n,e,t){const r=e[0],s=e[1];return n[0]=t[0]*r+t[2]*s,n[1]=t[1]*r+t[3]*s,n[2]=e[2],n[3]=e[3],n}function Nw(n,e,t){const r=e[0],s=e[1],i=e[2];return n[0]=t[0]*r+t[3]*s+t[6]*i,n[1]=t[1]*r+t[4]*s+t[7]*i,n[2]=t[2]*r+t[5]*s+t[8]*i,n[3]=e[3],n}function Dw(){const n=new mr(3);return mr!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function HP(n){const e=n[0],t=n[1],r=n[2];return Math.sqrt(e*e+t*t+r*r)}function Uv(n,e,t){const r=new mr(3);return r[0]=n,r[1]=e,r[2]=t,r}function XP(n,e,t){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n}function ZP(n){const e=n[0],t=n[1],r=n[2];return e*e+t*t+r*r}function qP(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n}function YP(n,e){const t=e[0],r=e[1],s=e[2];let i=t*t+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),n[0]=e[0]*i,n[1]=e[1]*i,n[2]=e[2]*i,n}function Lw(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]}function qu(n,e,t){const r=e[0],s=e[1],i=e[2],o=t[0],a=t[1],c=t[2];return n[0]=s*c-i*a,n[1]=i*o-r*c,n[2]=r*a-s*o,n}function KP(n,e,t,r){const s=e[0],i=e[1],o=e[2];return n[0]=s+r*(t[0]-s),n[1]=i+r*(t[1]-i),n[2]=o+r*(t[2]-o),n}function z0(n,e,t){const r=e[0],s=e[1],i=e[2];let o=t[3]*r+t[7]*s+t[11]*i+t[15];return o=o||1,n[0]=(t[0]*r+t[4]*s+t[8]*i+t[12])/o,n[1]=(t[1]*r+t[5]*s+t[9]*i+t[13])/o,n[2]=(t[2]*r+t[6]*s+t[10]*i+t[14])/o,n}function Fw(n,e,t){const r=e[0],s=e[1],i=e[2];return n[0]=r*t[0]+s*t[3]+i*t[6],n[1]=r*t[1]+s*t[4]+i*t[7],n[2]=r*t[2]+s*t[5]+i*t[8],n}function Bw(n,e,t){const r=t[0],s=t[1],i=t[2],o=t[3],a=e[0],c=e[1],l=e[2];let u=s*l-i*c,h=i*a-r*l,d=r*c-s*a,p=s*d-i*h,m=i*u-r*d,g=r*h-s*u;const y=o*2;return u*=y,h*=y,d*=y,p*=2,m*=2,g*=2,n[0]=a+u+p,n[1]=c+h+m,n[2]=l+d+g,n}function GP(n,e,t,r){const s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),n[0]=i[0]+t[0],n[1]=i[1]+t[1],n[2]=i[2]+t[2],n}function JP(n,e,t,r){const s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),n[0]=i[0]+t[0],n[1]=i[1]+t[1],n[2]=i[2]+t[2],n}function QP(n,e,t,r){const s=[],i=[];return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],n[0]=i[0]+t[0],n[1]=i[1]+t[1],n[2]=i[2]+t[2],n}function eO(n,e){const t=n[0],r=n[1],s=n[2],i=e[0],o=e[1],a=e[2],c=Math.sqrt((t*t+r*r+s*s)*(i*i+o*o+a*a)),l=c&&Lw(n,e)/c;return Math.acos(Math.min(Math.max(l,-1),1))}const Uw=XP,$w=HP,ap=ZP;(function(){const n=Dw();return function(e,t,r,s,i,o){let a,c;for(t||(t=3),r||(r=0),s?c=Math.min(s*t+r,e.length):c=e.length,a=r;a<c;a+=t)n[0]=e[a],n[1]=e[a+1],n[2]=e[a+2],i(n,n,o),e[a]=n[0],e[a+1]=n[1],e[a+2]=n[2];return e}})();const cp=[0,0,0];let hu;class Oe extends Pw{static get ZERO(){return hu||(hu=new Oe(0,0,0),Object.freeze(hu)),hu}constructor(e=0,t=0,r=0){super(-0,-0,-0),arguments.length===1&&zi(e)?this.copy(e):(Nn.debug&&(Pt(e),Pt(t),Pt(r)),this[0]=e,this[1]=t,this[2]=r)}set(e,t,r){return this[0]=e,this[1]=t,this[2]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return Nn.debug&&(Pt(e.x),Pt(e.y),Pt(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=Pt(e)}angle(e){return eO(this,e)}cross(e){return qu(this,this,e),this.check()}rotateX({radians:e,origin:t=cp}){return GP(this,this,t,e),this.check()}rotateY({radians:e,origin:t=cp}){return JP(this,this,t,e),this.check()}rotateZ({radians:e,origin:t=cp}){return QP(this,this,t,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return z0(this,this,e),this.check()}transformAsVector(e){return Mw(this,this,e),this.check()}transformByMatrix3(e){return Fw(this,this,e),this.check()}transformByMatrix2(e){return zP(this,this,e),this.check()}transformByQuaternion(e){return Bw(this,this,e),this.check()}}let du;class W0 extends Pw{static get ZERO(){return du||(du=new W0(0,0,0,0),Object.freeze(du)),du}constructor(e=0,t=0,r=0,s=0){super(-0,-0,-0,-0),zi(e)&&arguments.length===1?this.copy(e):(Nn.debug&&(Pt(e),Pt(t),Pt(r),Pt(s)),this[0]=e,this[1]=t,this[2]=r,this[3]=s)}set(e,t,r,s){return this[0]=e,this[1]=t,this[2]=r,this[3]=s,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return Nn.debug&&(Pt(e.x),Pt(e.y),Pt(e.z),Pt(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=Pt(e)}get w(){return this[3]}set w(e){this[3]=Pt(e)}transform(e){return z0(this,this,e),this.check()}transformByMatrix3(e){return Nw(this,this,e),this.check()}transformByMatrix2(e){return WP(this,this,e),this.check()}transformByQuaternion(e){return Bw(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}}class Vw extends j0{toString(){let e="[";if(Nn.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let r=0;r<this.RANK;++r)e+=` ${this[r*this.RANK+t]}`}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=` ${this[t]}`}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,r){return this[t*this.RANK+e]=Pt(r),this}getColumn(e,t=new Array(this.RANK).fill(-0)){const r=e*this.RANK;for(let s=0;s<this.RANK;++s)t[s]=this[r+s];return t}setColumn(e,t){const r=e*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=t[s];return this}}function tO(){const n=new mr(9);return mr!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function nO(n,e){if(n===e){const t=e[1],r=e[2],s=e[5];n[1]=e[3],n[2]=e[6],n[3]=t,n[5]=e[7],n[6]=r,n[7]=s}else n[0]=e[0],n[1]=e[3],n[2]=e[6],n[3]=e[1],n[4]=e[4],n[5]=e[7],n[6]=e[2],n[7]=e[5],n[8]=e[8];return n}function rO(n,e){const t=e[0],r=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=u*o-a*l,d=-u*i+a*c,p=l*i-o*c;let m=t*h+r*d+s*p;return m?(m=1/m,n[0]=h*m,n[1]=(-u*r+s*l)*m,n[2]=(a*r-s*o)*m,n[3]=d*m,n[4]=(u*t-s*c)*m,n[5]=(-a*t+s*i)*m,n[6]=p*m,n[7]=(-l*t+r*c)*m,n[8]=(o*t-r*i)*m,n):null}function sO(n){const e=n[0],t=n[1],r=n[2],s=n[3],i=n[4],o=n[5],a=n[6],c=n[7],l=n[8];return e*(l*i-o*c)+t*(-l*s+o*a)+r*(c*s-i*a)}function $v(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],d=t[0],p=t[1],m=t[2],g=t[3],y=t[4],x=t[5],b=t[6],v=t[7],_=t[8];return n[0]=d*r+p*o+m*l,n[1]=d*s+p*a+m*u,n[2]=d*i+p*c+m*h,n[3]=g*r+y*o+x*l,n[4]=g*s+y*a+x*u,n[5]=g*i+y*c+x*h,n[6]=b*r+v*o+_*l,n[7]=b*s+v*a+_*u,n[8]=b*i+v*c+_*h,n}function iO(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],d=t[0],p=t[1];return n[0]=r,n[1]=s,n[2]=i,n[3]=o,n[4]=a,n[5]=c,n[6]=d*r+p*o+l,n[7]=d*s+p*a+u,n[8]=d*i+p*c+h,n}function oO(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],d=Math.sin(t),p=Math.cos(t);return n[0]=p*r+d*o,n[1]=p*s+d*a,n[2]=p*i+d*c,n[3]=p*o-d*r,n[4]=p*a-d*s,n[5]=p*c-d*i,n[6]=l,n[7]=u,n[8]=h,n}function Vv(n,e,t){const r=t[0],s=t[1];return n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=s*e[3],n[4]=s*e[4],n[5]=s*e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n}function aO(n,e){const t=e[0],r=e[1],s=e[2],i=e[3],o=t+t,a=r+r,c=s+s,l=t*o,u=r*o,h=r*a,d=s*o,p=s*a,m=s*c,g=i*o,y=i*a,x=i*c;return n[0]=1-h-m,n[3]=u-x,n[6]=d+y,n[1]=u+x,n[4]=1-l-m,n[7]=p-g,n[2]=d-y,n[5]=p+g,n[8]=1-l-h,n}var Vm;(function(n){n[n.COL0ROW0=0]="COL0ROW0",n[n.COL0ROW1=1]="COL0ROW1",n[n.COL0ROW2=2]="COL0ROW2",n[n.COL1ROW0=3]="COL1ROW0",n[n.COL1ROW1=4]="COL1ROW1",n[n.COL1ROW2=5]="COL1ROW2",n[n.COL2ROW0=6]="COL2ROW0",n[n.COL2ROW1=7]="COL2ROW1",n[n.COL2ROW2=8]="COL2ROW2"})(Vm||(Vm={}));const cO=Object.freeze([1,0,0,0,1,0,0,0,1]);class dn extends Vw{static get IDENTITY(){return uO()}static get ZERO(){return lO()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Vm}constructor(e,...t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):t.length>0?this.copy([e,...t]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(cO)}fromObject(e){return this.check()}fromQuaternion(e){return aO(this,e),this.check()}set(e,t,r,s,i,o,a,c,l){return this[0]=e,this[1]=t,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(e,t,r,s,i,o,a,c,l){return this[0]=e,this[1]=s,this[2]=a,this[3]=t,this[4]=i,this[5]=c,this[6]=r,this[7]=o,this[8]=l,this.check()}determinant(){return sO(this)}transpose(){return nO(this,this),this.check()}invert(){return rO(this,this),this.check()}multiplyLeft(e){return $v(this,e,this),this.check()}multiplyRight(e){return $v(this,this,e),this.check()}rotate(e){return oO(this,this,e),this.check()}scale(e){return Array.isArray(e)?Vv(this,this,e):Vv(this,this,[e,e]),this.check()}translate(e){return iO(this,this,e),this.check()}transform(e,t){let r;switch(e.length){case 2:r=$P(t||[-0,-0],e,this);break;case 3:r=Fw(t||[-0,-0,-0],e,this);break;case 4:r=Nw(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return yc(r,e.length),r}transformVector(e,t){return this.transform(e,t)}transformVector2(e,t){return this.transform(e,t)}transformVector3(e,t){return this.transform(e,t)}}let pu,mu=null;function lO(){return pu||(pu=new dn([0,0,0,0,0,0,0,0,0]),Object.freeze(pu)),pu}function uO(){return mu||(mu=new dn,Object.freeze(mu)),mu}function fO(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function hO(n,e){if(n===e){const t=e[1],r=e[2],s=e[3],i=e[6],o=e[7],a=e[11];n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=t,n[6]=e[9],n[7]=e[13],n[8]=r,n[9]=i,n[11]=e[14],n[12]=s,n[13]=o,n[14]=a}else n[0]=e[0],n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=e[1],n[5]=e[5],n[6]=e[9],n[7]=e[13],n[8]=e[2],n[9]=e[6],n[10]=e[10],n[11]=e[14],n[12]=e[3],n[13]=e[7],n[14]=e[11],n[15]=e[15];return n}function jm(n,e){const t=e[0],r=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],p=e[11],m=e[12],g=e[13],y=e[14],x=e[15],b=t*a-r*o,v=t*c-s*o,_=t*l-i*o,w=r*c-s*a,E=r*l-i*a,N=s*l-i*c,F=u*g-h*m,$=u*y-d*m,I=u*x-p*m,te=h*y-d*g,R=h*x-p*g,re=d*x-p*y;let q=b*re-v*R+_*te+w*I-E*$+N*F;return q?(q=1/q,n[0]=(a*re-c*R+l*te)*q,n[1]=(s*R-r*re-i*te)*q,n[2]=(g*N-y*E+x*w)*q,n[3]=(d*E-h*N-p*w)*q,n[4]=(c*I-o*re-l*$)*q,n[5]=(t*re-s*I+i*$)*q,n[6]=(y*_-m*N-x*v)*q,n[7]=(u*N-d*_+p*v)*q,n[8]=(o*R-a*I+l*F)*q,n[9]=(r*I-t*R-i*F)*q,n[10]=(m*E-g*_+x*b)*q,n[11]=(h*_-u*E-p*b)*q,n[12]=(a*$-o*te-c*F)*q,n[13]=(t*te-r*$+s*F)*q,n[14]=(g*v-m*w-y*b)*q,n[15]=(u*w-h*v+d*b)*q,n):null}function dO(n){const e=n[0],t=n[1],r=n[2],s=n[3],i=n[4],o=n[5],a=n[6],c=n[7],l=n[8],u=n[9],h=n[10],d=n[11],p=n[12],m=n[13],g=n[14],y=n[15],x=e*o-t*i,b=e*a-r*i,v=t*a-r*o,_=l*m-u*p,w=l*g-h*p,E=u*g-h*m,N=e*E-t*w+r*_,F=i*E-o*w+a*_,$=l*v-u*b+h*x,I=p*v-m*b+g*x;return c*N-s*F+y*$-d*I}function ki(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],d=e[9],p=e[10],m=e[11],g=e[12],y=e[13],x=e[14],b=e[15];let v=t[0],_=t[1],w=t[2],E=t[3];return n[0]=v*r+_*a+w*h+E*g,n[1]=v*s+_*c+w*d+E*y,n[2]=v*i+_*l+w*p+E*x,n[3]=v*o+_*u+w*m+E*b,v=t[4],_=t[5],w=t[6],E=t[7],n[4]=v*r+_*a+w*h+E*g,n[5]=v*s+_*c+w*d+E*y,n[6]=v*i+_*l+w*p+E*x,n[7]=v*o+_*u+w*m+E*b,v=t[8],_=t[9],w=t[10],E=t[11],n[8]=v*r+_*a+w*h+E*g,n[9]=v*s+_*c+w*d+E*y,n[10]=v*i+_*l+w*p+E*x,n[11]=v*o+_*u+w*m+E*b,v=t[12],_=t[13],w=t[14],E=t[15],n[12]=v*r+_*a+w*h+E*g,n[13]=v*s+_*c+w*d+E*y,n[14]=v*i+_*l+w*p+E*x,n[15]=v*o+_*u+w*m+E*b,n}function xf(n,e,t){const r=t[0],s=t[1],i=t[2];let o,a,c,l,u,h,d,p,m,g,y,x;return e===n?(n[12]=e[0]*r+e[4]*s+e[8]*i+e[12],n[13]=e[1]*r+e[5]*s+e[9]*i+e[13],n[14]=e[2]*r+e[6]*s+e[10]*i+e[14],n[15]=e[3]*r+e[7]*s+e[11]*i+e[15]):(o=e[0],a=e[1],c=e[2],l=e[3],u=e[4],h=e[5],d=e[6],p=e[7],m=e[8],g=e[9],y=e[10],x=e[11],n[0]=o,n[1]=a,n[2]=c,n[3]=l,n[4]=u,n[5]=h,n[6]=d,n[7]=p,n[8]=m,n[9]=g,n[10]=y,n[11]=x,n[12]=o*r+u*s+m*i+e[12],n[13]=a*r+h*s+g*i+e[13],n[14]=c*r+d*s+y*i+e[14],n[15]=l*r+p*s+x*i+e[15]),n}function H0(n,e,t){const r=t[0],s=t[1],i=t[2];return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*r,n[4]=e[4]*s,n[5]=e[5]*s,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*i,n[9]=e[9]*i,n[10]=e[10]*i,n[11]=e[11]*i,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function pO(n,e,t,r){let s=r[0],i=r[1],o=r[2],a=Math.sqrt(s*s+i*i+o*o),c,l,u,h,d,p,m,g,y,x,b,v,_,w,E,N,F,$,I,te,R,re,q,de;return a<_c?null:(a=1/a,s*=a,i*=a,o*=a,l=Math.sin(t),c=Math.cos(t),u=1-c,h=e[0],d=e[1],p=e[2],m=e[3],g=e[4],y=e[5],x=e[6],b=e[7],v=e[8],_=e[9],w=e[10],E=e[11],N=s*s*u+c,F=i*s*u+o*l,$=o*s*u-i*l,I=s*i*u-o*l,te=i*i*u+c,R=o*i*u+s*l,re=s*o*u+i*l,q=i*o*u-s*l,de=o*o*u+c,n[0]=h*N+g*F+v*$,n[1]=d*N+y*F+_*$,n[2]=p*N+x*F+w*$,n[3]=m*N+b*F+E*$,n[4]=h*I+g*te+v*R,n[5]=d*I+y*te+_*R,n[6]=p*I+x*te+w*R,n[7]=m*I+b*te+E*R,n[8]=h*re+g*q+v*de,n[9]=d*re+y*q+_*de,n[10]=p*re+x*q+w*de,n[11]=m*re+b*q+E*de,e!==n&&(n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n)}function jw(n,e,t){const r=Math.sin(t),s=Math.cos(t),i=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],d=e[11];return e!==n&&(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[4]=i*s+l*r,n[5]=o*s+u*r,n[6]=a*s+h*r,n[7]=c*s+d*r,n[8]=l*s-i*r,n[9]=u*s-o*r,n[10]=h*s-a*r,n[11]=d*s-c*r,n}function mO(n,e,t){const r=Math.sin(t),s=Math.cos(t),i=e[0],o=e[1],a=e[2],c=e[3],l=e[8],u=e[9],h=e[10],d=e[11];return e!==n&&(n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=i*s-l*r,n[1]=o*s-u*r,n[2]=a*s-h*r,n[3]=c*s-d*r,n[8]=i*r+l*s,n[9]=o*r+u*s,n[10]=a*r+h*s,n[11]=c*r+d*s,n}function zw(n,e,t){const r=Math.sin(t),s=Math.cos(t),i=e[0],o=e[1],a=e[2],c=e[3],l=e[4],u=e[5],h=e[6],d=e[7];return e!==n&&(n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=i*s+l*r,n[1]=o*s+u*r,n[2]=a*s+h*r,n[3]=c*s+d*r,n[4]=l*s-i*r,n[5]=u*s-o*r,n[6]=h*s-a*r,n[7]=d*s-c*r,n}function gO(n,e){const t=e[0],r=e[1],s=e[2],i=e[4],o=e[5],a=e[6],c=e[8],l=e[9],u=e[10];return n[0]=Math.sqrt(t*t+r*r+s*s),n[1]=Math.sqrt(i*i+o*o+a*a),n[2]=Math.sqrt(c*c+l*l+u*u),n}function yO(n,e){const t=e[0],r=e[1],s=e[2],i=e[3],o=t+t,a=r+r,c=s+s,l=t*o,u=r*o,h=r*a,d=s*o,p=s*a,m=s*c,g=i*o,y=i*a,x=i*c;return n[0]=1-h-m,n[1]=u+x,n[2]=d-y,n[3]=0,n[4]=u-x,n[5]=1-l-m,n[6]=p+g,n[7]=0,n[8]=d+y,n[9]=p-g,n[10]=1-l-h,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function _O(n,e,t,r,s,i,o){const a=1/(t-e),c=1/(s-r),l=1/(i-o);return n[0]=i*2*a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i*2*c,n[6]=0,n[7]=0,n[8]=(t+e)*a,n[9]=(s+r)*c,n[10]=(o+i)*l,n[11]=-1,n[12]=0,n[13]=0,n[14]=o*i*2*l,n[15]=0,n}function vO(n,e,t,r,s){const i=1/Math.tan(e/2);if(n[0]=i/t,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,s!=null&&s!==1/0){const o=1/(r-s);n[10]=(s+r)*o,n[14]=2*s*r*o}else n[10]=-1,n[14]=-2*r;return n}const xO=vO;function bO(n,e,t,r,s,i,o){const a=1/(e-t),c=1/(r-s),l=1/(i-o);return n[0]=-2*a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*c,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*l,n[11]=0,n[12]=(e+t)*a,n[13]=(s+r)*c,n[14]=(o+i)*l,n[15]=1,n}const wO=bO;function TO(n,e,t,r){let s,i,o,a,c,l,u,h,d,p;const m=e[0],g=e[1],y=e[2],x=r[0],b=r[1],v=r[2],_=t[0],w=t[1],E=t[2];return Math.abs(m-_)<_c&&Math.abs(g-w)<_c&&Math.abs(y-E)<_c?fO(n):(h=m-_,d=g-w,p=y-E,s=1/Math.sqrt(h*h+d*d+p*p),h*=s,d*=s,p*=s,i=b*p-v*d,o=v*h-x*p,a=x*d-b*h,s=Math.sqrt(i*i+o*o+a*a),s?(s=1/s,i*=s,o*=s,a*=s):(i=0,o=0,a=0),c=d*a-p*o,l=p*i-h*a,u=h*o-d*i,s=Math.sqrt(c*c+l*l+u*u),s?(s=1/s,c*=s,l*=s,u*=s):(c=0,l=0,u=0),n[0]=i,n[1]=c,n[2]=h,n[3]=0,n[4]=o,n[5]=l,n[6]=d,n[7]=0,n[8]=a,n[9]=u,n[10]=p,n[11]=0,n[12]=-(i*m+o*g+a*y),n[13]=-(c*m+l*g+u*y),n[14]=-(h*m+d*g+p*y),n[15]=1,n)}function SO(){const n=new mr(4);return mr!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function EO(n,e,t){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n}function X0(n,e,t){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n}function AO(n){const e=n[0],t=n[1],r=n[2],s=n[3];return Math.sqrt(e*e+t*t+r*r+s*s)}function CO(n){const e=n[0],t=n[1],r=n[2],s=n[3];return e*e+t*t+r*r+s*s}function RO(n,e){const t=e[0],r=e[1],s=e[2],i=e[3];let o=t*t+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),n[0]=t*o,n[1]=r*o,n[2]=s*o,n[3]=i*o,n}function IO(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]*e[3]}function PO(n,e,t,r){const s=e[0],i=e[1],o=e[2],a=e[3];return n[0]=s+r*(t[0]-s),n[1]=i+r*(t[1]-i),n[2]=o+r*(t[2]-o),n[3]=a+r*(t[3]-a),n}function Aa(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3];return n[0]=t[0]*r+t[4]*s+t[8]*i+t[12]*o,n[1]=t[1]*r+t[5]*s+t[9]*i+t[13]*o,n[2]=t[2]*r+t[6]*s+t[10]*i+t[14]*o,n[3]=t[3]*r+t[7]*s+t[11]*i+t[15]*o,n}function OO(n,e,t){const r=e[0],s=e[1],i=e[2],o=t[0],a=t[1],c=t[2],l=t[3],u=l*r+a*i-c*s,h=l*s+c*r-o*i,d=l*i+o*s-a*r,p=-o*r-a*s-c*i;return n[0]=u*l+p*-o+h*-c-d*-a,n[1]=h*l+p*-a+d*-o-u*-c,n[2]=d*l+p*-c+u*-a-h*-o,n[3]=e[3],n}(function(){const n=SO();return function(e,t,r,s,i,o){let a,c;for(t||(t=4),r||(r=0),s?c=Math.min(s*t+r,e.length):c=e.length,a=r;a<c;a+=t)n[0]=e[a],n[1]=e[a+1],n[2]=e[a+2],n[3]=e[a+3],i(n,n,o),e[a]=n[0],e[a+1]=n[1],e[a+2]=n[2],e[a+3]=n[3];return e}})();var zm;(function(n){n[n.COL0ROW0=0]="COL0ROW0",n[n.COL0ROW1=1]="COL0ROW1",n[n.COL0ROW2=2]="COL0ROW2",n[n.COL0ROW3=3]="COL0ROW3",n[n.COL1ROW0=4]="COL1ROW0",n[n.COL1ROW1=5]="COL1ROW1",n[n.COL1ROW2=6]="COL1ROW2",n[n.COL1ROW3=7]="COL1ROW3",n[n.COL2ROW0=8]="COL2ROW0",n[n.COL2ROW1=9]="COL2ROW1",n[n.COL2ROW2=10]="COL2ROW2",n[n.COL2ROW3=11]="COL2ROW3",n[n.COL3ROW0=12]="COL3ROW0",n[n.COL3ROW1=13]="COL3ROW1",n[n.COL3ROW2=14]="COL3ROW2",n[n.COL3ROW3=15]="COL3ROW3"})(zm||(zm={}));const kO=45*Math.PI/180,MO=1,lp=.1,up=500,NO=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class Je extends Vw{static get IDENTITY(){return LO()}static get ZERO(){return DO()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return zm}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,r,s,i,o,a,c,l,u,h,d,p,m,g,y){return this[0]=e,this[1]=t,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this[9]=u,this[10]=h,this[11]=d,this[12]=p,this[13]=m,this[14]=g,this[15]=y,this.check()}setRowMajor(e,t,r,s,i,o,a,c,l,u,h,d,p,m,g,y){return this[0]=e,this[1]=i,this[2]=l,this[3]=p,this[4]=t,this[5]=o,this[6]=u,this[7]=m,this[8]=r,this[9]=a,this[10]=h,this[11]=g,this[12]=s,this[13]=c,this[14]=d,this[15]=y,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(NO)}fromObject(e){return this.check()}fromQuaternion(e){return yO(this,e),this.check()}frustum(e){const{left:t,right:r,bottom:s,top:i,near:o=lp,far:a=up}=e;return a===1/0?FO(this,t,r,s,i,o):_O(this,t,r,s,i,o,a),this.check()}lookAt(e){const{eye:t,center:r=[0,0,0],up:s=[0,1,0]}=e;return TO(this,t,r,s),this.check()}ortho(e){const{left:t,right:r,bottom:s,top:i,near:o=lp,far:a=up}=e;return wO(this,t,r,s,i,o,a),this.check()}orthographic(e){const{fovy:t=kO,aspect:r=MO,focalDistance:s=1,near:i=lp,far:o=up}=e;jv(t);const a=t/2,c=s*Math.tan(a),l=c*r;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:i,far:o})}perspective(e){const{fovy:t=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=e;return jv(t),xO(this,t,r,s,i),this.check()}determinant(){return dO(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const r=this.getScale(t),s=1/r[0],i=1/r[1],o=1/r[2];return e[0]=this[0]*s,e[1]=this[1]*i,e[2]=this[2]*o,e[3]=0,e[4]=this[4]*s,e[5]=this[5]*i,e[6]=this[6]*o,e[7]=0,e[8]=this[8]*s,e[9]=this[9]*i,e[10]=this[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const r=this.getScale(t),s=1/r[0],i=1/r[1],o=1/r[2];return e[0]=this[0]*s,e[1]=this[1]*i,e[2]=this[2]*o,e[3]=this[4]*s,e[4]=this[5]*i,e[5]=this[6]*o,e[6]=this[8]*s,e[7]=this[9]*i,e[8]=this[10]*o,e}transpose(){return hO(this,this),this.check()}invert(){return jm(this,this),this.check()}multiplyLeft(e){return ki(this,e,this),this.check()}multiplyRight(e){return ki(this,this,e),this.check()}rotateX(e){return jw(this,this,e),this.check()}rotateY(e){return mO(this,this,e),this.check()}rotateZ(e){return zw(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return pO(this,this,e,t),this.check()}scale(e){return H0(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return xf(this,this,e),this.check()}transform(e,t){return e.length===4?(t=Aa(t||[-0,-0,-0,-0],e,this),yc(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){const{length:r}=e;let s;switch(r){case 2:s=VP(t||[-0,-0],e,this);break;case 3:s=z0(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return yc(s,e.length),s}transformAsVector(e,t){let r;switch(e.length){case 2:r=jP(t||[-0,-0],e,this);break;case 3:r=Mw(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return yc(r,e.length),r}transformPoint(e,t){return this.transformAsPoint(e,t)}transformVector(e,t){return this.transformAsPoint(e,t)}transformDirection(e,t){return this.transformAsVector(e,t)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,r){return this.identity().translate([e,t,r])}}let gu,yu;function DO(){return gu||(gu=new Je([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(gu)),gu}function LO(){return yu||(yu=new Je,Object.freeze(yu)),yu}function jv(n){if(n>Math.PI*2)throw Error("expected radians")}function FO(n,e,t,r,s,i){const o=2*i/(t-e),a=2*i/(s-r),c=(t+e)/(t-e),l=(s+r)/(s-r),u=-1,h=-1,d=-2*i;return n[0]=o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=a,n[6]=0,n[7]=0,n[8]=c,n[9]=l,n[10]=u,n[11]=h,n[12]=0,n[13]=0,n[14]=d,n[15]=0,n}function zv(){const n=new mr(4);return mr!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function BO(n){return n[0]=0,n[1]=0,n[2]=0,n[3]=1,n}function Ww(n,e,t){t=t*.5;const r=Math.sin(t);return n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=Math.cos(t),n}function Wv(n,e,t){const r=e[0],s=e[1],i=e[2],o=e[3],a=t[0],c=t[1],l=t[2],u=t[3];return n[0]=r*u+o*a+s*l-i*c,n[1]=s*u+o*c+i*a-r*l,n[2]=i*u+o*l+r*c-s*a,n[3]=o*u-r*a-s*c-i*l,n}function UO(n,e,t){t*=.5;const r=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return n[0]=r*c+o*a,n[1]=s*c+i*a,n[2]=i*c-s*a,n[3]=o*c-r*a,n}function $O(n,e,t){t*=.5;const r=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return n[0]=r*c-i*a,n[1]=s*c+o*a,n[2]=i*c+r*a,n[3]=o*c-s*a,n}function VO(n,e,t){t*=.5;const r=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(t),c=Math.cos(t);return n[0]=r*c+s*a,n[1]=s*c-r*a,n[2]=i*c+o*a,n[3]=o*c-i*a,n}function jO(n,e){const t=e[0],r=e[1],s=e[2];return n[0]=t,n[1]=r,n[2]=s,n[3]=Math.sqrt(Math.abs(1-t*t-r*r-s*s)),n}function Yu(n,e,t,r){const s=e[0],i=e[1],o=e[2],a=e[3];let c=t[0],l=t[1],u=t[2],h=t[3],d,p,m,g,y;return d=s*c+i*l+o*u+a*h,d<0&&(d=-d,c=-c,l=-l,u=-u,h=-h),1-d>_c?(p=Math.acos(d),y=Math.sin(p),m=Math.sin((1-r)*p)/y,g=Math.sin(r*p)/y):(m=1-r,g=r),n[0]=m*s+g*c,n[1]=m*i+g*l,n[2]=m*o+g*u,n[3]=m*a+g*h,n}function zO(n,e){const t=e[0],r=e[1],s=e[2],i=e[3],o=t*t+r*r+s*s+i*i,a=o?1/o:0;return n[0]=-t*a,n[1]=-r*a,n[2]=-s*a,n[3]=i*a,n}function WO(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n[3]=e[3],n}function Hw(n,e){const t=e[0]+e[4]+e[8];let r;if(t>0)r=Math.sqrt(t+1),n[3]=.5*r,r=.5/r,n[0]=(e[5]-e[7])*r,n[1]=(e[6]-e[2])*r,n[2]=(e[1]-e[3])*r;else{let s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);const i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(e[s*3+s]-e[i*3+i]-e[o*3+o]+1),n[s]=.5*r,r=.5/r,n[3]=(e[i*3+o]-e[o*3+i])*r,n[i]=(e[i*3+s]+e[s*3+i])*r,n[o]=(e[o*3+s]+e[s*3+o])*r}return n}const HO=EO,XO=X0,ZO=IO,qO=PO,YO=AO,KO=CO,Xw=RO,GO=function(){const n=Dw(),e=Uv(1,0,0),t=Uv(0,1,0);return function(r,s,i){const o=Lw(s,i);return o<-.999999?(qu(n,e,s),$w(n)<1e-6&&qu(n,t,s),YP(n,n),Ww(r,n,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(qu(n,s,i),r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=1+o,Xw(r,r))}}();(function(){const n=zv(),e=zv();return function(t,r,s,i,o,a){return Yu(n,r,o,a),Yu(e,s,i,a),Yu(t,n,e,2*a*(1-a)),t}})();(function(){const n=tO();return function(e,t,r,s){return n[0]=r[0],n[3]=r[1],n[6]=r[2],n[1]=s[0],n[4]=s[1],n[7]=s[2],n[2]=-t[0],n[5]=-t[1],n[8]=-t[2],Xw(e,Hw(e,n))}})();const JO=[0,0,0,1];class Hv extends j0{constructor(e=0,t=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,t,r,s)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,r,s){return this[0]=e,this[1]=t,this[2]=r,this[3]=s,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return Hw(this,e),this.check()}fromAxisRotation(e,t){return Ww(this,e,t),this.check()}identity(){return BO(this),this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=Pt(e)}get y(){return this[1]}set y(e){this[1]=Pt(e)}get z(){return this[2]}set z(e){this[2]=Pt(e)}get w(){return this[3]}set w(e){this[3]=Pt(e)}len(){return YO(this)}lengthSquared(){return KO(this)}dot(e){return ZO(this,e)}rotationTo(e,t){return GO(this,e,t),this.check()}add(e){return HO(this,this,e),this.check()}calculateW(){return jO(this,this),this.check()}conjugate(){return WO(this,this),this.check()}invert(){return zO(this,this),this.check()}lerp(e,t,r){return r===void 0?this.lerp(this,e,t):(qO(this,e,t,r),this.check())}multiplyRight(e){return Wv(this,this,e),this.check()}multiplyLeft(e){return Wv(this,e,this),this.check()}normalize(){const e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,e===0&&(this[3]=1),this.check()}rotateX(e){return UO(this,this,e),this.check()}rotateY(e){return $O(this,this,e),this.check()}rotateZ(e){return VO(this,this,e),this.check()}scale(e){return XO(this,this,e),this.check()}slerp(e,t,r){let s,i,o;switch(arguments.length){case 1:({start:s=JO,target:i,ratio:o}=e);break;case 2:s=this,i=e,o=t;break;default:s=e,i=t,o=r}return Yu(this,s,i,o),this.check()}transformVector4(e,t=new W0){return OO(t,e,this),yc(t,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}}const QO=1e-15,ek=1e-20,Xv=()=>{};function Zw(n){const e=`[${n}]`;return{debug:Xv,info:Xv,warn:(t,...r)=>console.warn(`${e} ${t}`,...r),error:(t,...r)=>console.error(`${e} ${t}`,...r)}}const qw=Zw("vizarr");let tc=qw;function Wm(n){tc=n??qw}const kt={debug:(n,...e)=>tc.debug(n,...e),info:(n,...e)=>tc.info(n,...e),warn:(n,...e)=>tc.warn(n,...e),error:(n,...e)=>tc.error(n,...e)},Mi=6;function tk(n,e,t,r=""){const s=`${n}\0${r}`;let i=2166136261;for(let o=0;o<s.length;o++)i^=s.charCodeAt(o),i=Math.imul(i,16777619);return`${(i>>>0).toString(36)}-${e}-${t}`}const bf="https://github.com/BioNGFF/vizarr",Lr={cyan:"#00FFFF",yellow:"#FFFF00",magenta:"#FF00FF",red:"#FF0000",green:"#00FF00",blue:"#0000FF",white:"#FFFFFF"},nk=[Lr.magenta,Lr.green],rk=[Lr.red,Lr.green,Lr.blue],Zv=Object.values(Lr).slice(0,Mi);async function Yw(n){if(typeof n=="string"){let e,t="/";if(n.endsWith(".json")){const[{default:s},i]=await Promise.all([Promise.resolve().then(()=>require("./ref-DDcdpHul.cjs")),fetch(n).then(o=>o.json())]);e=s.fromSpec(i),kt.debug("Store resolved",{source:n,store:"ReferenceStore"})}else try{const s=_f.fromUrl(n);await s.has("/"),e=s,kt.debug("Store resolved",{source:n,store:"ZipFileStore"})}catch{const s=new URL(n);t=sk(s.pathname),s.pathname="/",e=new pI(s.href),kt.debug("Store resolved",{source:n,store:"FetchStore"})}return new ai(kP(e),t)}return vw(n)}function sk(n){return n==="/"||n.startsWith("/")?n:`/${n}`}async function fp(n,e){const t=new TextDecoder;if(e.path&&(n=n.resolve(e.path)),e.zarrVersion===3){const o=await sn.v3(n).then(a=>a.attrs);return la(o)}const r=n.resolve(".zattrs"),s=await n.store.get(r.path),i=s?JSON.parse(t.decode(s)):{};return la(i)}async function Z0(n,e){const{datasets:t}=e[0]||[{path:"0"}];return Promise.all(t.map(({path:r})=>sn(n.resolve(r),{kind:"array",attrs:!1})))}function q0(n){n.startsWith("#")&&(n=n.slice(1));const e=Number.parseInt(n.slice(0,2),16),t=Number.parseInt(n.slice(2,4),16),r=Number.parseInt(n.slice(4,6),16);return[e,t,r]}function Fc(n){return Array.from({length:n},(e,t)=>t)}function ik(n,e=" "){for(;n.length>0&&e.includes(n.charAt(n.length-1));)n=n.substr(0,n.length-1);return n}function Bo(...n){return n.filter(e=>e!==void 0).map(e=>ik(e,"/")).join("/")}function ok(n,e){return(!e||e.length!==n.shape.length)&&(e=n.shape.slice(0,-2).map((r,s)=>`${s}`).concat(["y","x"])),e}function Kw(n){return Fc(n).map(e=>`channel_${e}`)}function qv(n){return n==="t"?"time":n==="c"?"channel":"space"}function Y0(n){return typeof n[0]=="object"&&n[0]&&"axes"in n[0]&&Array.isArray(n[0].axes)?n[0].axes.map(t=>{if(typeof t=="string")return{name:t,type:qv(t)};const{name:r,type:s,unit:i}=t;return{name:r,type:s??qv(r),unit:i}}):[{type:"channel",name:"c"},{type:"space",name:"z"},{type:"space",name:"y"},{type:"space",name:"x"}]}function Cl(n){return n.map(t=>t.name)}function Gw(n,e){return e||(n<=Mi?e=Array(n).fill(!0):e=[...Array(Mi).fill(!0),...Array(n-Mi).fill(!1)]),e}function Jw(n,e){let t=[];if(n===1)t=[Lr.white];else if(n===2)t=nk;else if(n===3)t=rk;else if(n<=Mi)t=Zv.slice(0,n);else{t=Array(n).fill(Lr.white);const r=e.flatMap((s,i)=>s?i:[]);for(const[s,i]of r.entries())t[i]=Zv[s]}return t}function Qw(n){const e=n[n.length-1];return e===3||e===4}function Rl(n){const e=Qw(n.shape),[t,r]=n.chunks.slice(e?-3:-2),s=Math.min(t,r);return 2**Math.floor(Math.log2(s))}function K0(n){const{image:e,viewport:t,padding:r,matrix:s=new Je().identity()}=n,i=[[0,0,0],[e.width,0,0],[e.width,e.height,0],[0,e.height,0]].map(d=>s.transformAsPoint(d)),o=Math.min(...i.map(d=>d[0])),a=Math.max(...i.map(d=>d[0])),c=Math.min(...i.map(d=>d[1])),l=Math.max(...i.map(d=>d[1])),u=t.width-2*r,h=t.height-2*r;return{zoom:Math.log2(Math.min(u/(a-o),h/(l-c))),target:[(o+a)/2,(c+l)/2]}}function ak(n){return Array.isArray(n)?n.length===16&&n.every(e=>typeof e=="number"):!1}function id(n){if(!n)return Je.IDENTITY;const e=new Je;try{const t=typeof n=="string"?JSON.parse(n):n;wt(ak(t),"Invalid modelMatrix size. Must be 16."),e.setRowMajor(...t)}catch{kt.warn("Failed to parse modelMatrix, using identity.",{model_matrix:n})}return e}async function G0(n,e){const{data:t}=await n.getRaster({selection:e});let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(let i=0;i<t.length;i++)t[i]>s&&(s=t[i]),t[i]<r&&(r=t[i]);return r===s&&(r=0,s=1),[r,s]}async function eT(n,e,t,r){const s=n.shape.map(()=>0),i=n.shape[e];return e!==-1&&wt(i===t.length,"visibilities do not match number of channels"),Promise.all(t.map(async(o,a)=>{if(!o)return;const c=[...s];return e>-1&&(c[e]=a),G0(n,c)}))}function ck(){let n,e;return{promise:new Promise((r,s)=>{n=r,e=s}),resolve:n,reject:e}}function lk(){let n=new EventTarget;return{on:(e,t)=>{n.addEventListener(e,r=>t(r.detail))},emit:(e,t)=>{n.dispatchEvent(new CustomEvent(e,{detail:t}))}}}function la(n){return"omero"in n&&"ome"in n?{version:typeof n.ome=="object"&&n.ome!==null&&"version"in n.ome?n.ome.version:"",multiscales:typeof n.ome=="object"&&n.ome!==null&&"multiscales"in n.ome?n.ome.multiscales:{},omero:{channels:typeof n.omero=="object"&&n.omero!==null&&"channels"in n.omero?n.omero.channels:{}}}:"ome"in n?n.ome:n}class uk extends Error{constructor(e){super(e),this.name="AssertionError"}}class fk extends Error{constructor(t,r){super(t);S(this,"url");this.name="RedirectError",this.url=r}}function wt(n,e=""){if(!n)throw new uk(e)}async function hk(n){try{return await sn.v3(n),3}catch(e){if(!(e instanceof oi))throw e;return 2}}function Yv(n){return"plate"in n}function dk(n){return"well"in n}function tT(n){return"omero"in n&&wf(n)}function wf(n){return"multiscales"in n}/**
|
|
122
122
|
* Ensures an error matches expected type(s), otherwise rethrows.
|
|
123
123
|
*
|
|
124
124
|
* Unmatched errors bubble up, like Python's `except`. Narrows error types for
|
|
@@ -3453,7 +3453,7 @@ vec4 colormap(float intensity, float opacity) {
|
|
|
3453
3453
|
rgbCombo += max(0.0, min(1.0, minVals[i])) * vec3(colors[i]);
|
|
3454
3454
|
}
|
|
3455
3455
|
color = vec4(rgbCombo, 1.0);
|
|
3456
|
-
`,rq=class extends Hl{constructor(n){super(n),this.rendering={_BEFORE_RENDER:eq,_RENDER:tq,_AFTER_RENDER:nq}}};rq.extensionName="MinimumIntensityProjectionExtension";const iA={AdditiveBlendExtension:sA},sq=new Map;function ms(n,e){Array.isArray(n)||(n=[n]),n.forEach(t=>sq.set(t,e))}ms([void 0,1],()=>Promise.resolve().then(()=>require("./raw-WTo5b4ss.cjs")).then(n=>n.default));ms(5,()=>Promise.resolve().then(()=>require("./lzw-ZT7VEqqB.cjs")).then(n=>n.default));ms(6,()=>{throw new Error("old style JPEG compression is not supported.")});ms(7,()=>Promise.resolve().then(()=>require("./jpeg-CYZE8KIi.cjs")).then(n=>n.default));ms([8,32946],()=>Promise.resolve().then(()=>require("./deflate-S7xbLfSs.cjs")).then(n=>n.default));ms(32773,()=>Promise.resolve().then(()=>require("./packbits-fB9p028k.cjs")).then(n=>n.default));ms(34887,()=>Promise.resolve().then(()=>require("./lerc-vOTtDjZs.cjs")).then(async n=>(await n.zstd.init(),n)).then(n=>n.default));ms(50001,()=>Promise.resolve().then(()=>require("./webimage-RWZ2c6bg.cjs")).then(n=>n.default));function iq(n,e){let t=n.length-e,r=0;do{for(let s=e;s>0;s--)n[r+e]+=n[r],r++;t-=e}while(t>0)}function oq(n,e,t){let r=0,s=n.length;const i=s/t;for(;s>e;){for(let a=e;a>0;--a)n[r+e]+=n[r],++r;s-=e}const o=n.slice();for(let a=0;a<i;++a)for(let c=0;c<t;++c)n[t*a+c]=o[(t-c-1)*i+a]}function aq(n,e,t,r,s,i){if(e===1)return n;for(let c=0;c<s.length;++c){if(s[c]%8!==0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(s[c]!==s[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const o=s[0]/8,a=i===2?1:s.length;for(let c=0;c<r&&!(c*a*t*o>=n.byteLength);++c){let l;if(e===2){switch(s[0]){case 8:l=new Uint8Array(n,c*a*t*o,a*t*o);break;case 16:l=new Uint16Array(n,c*a*t*o,a*t*o/2);break;case 32:l=new Uint32Array(n,c*a*t*o,a*t*o/4);break;default:throw new Error(`Predictor 2 not allowed with ${s[0]} bits per sample.`)}iq(l,a)}else e===3&&(l=new Uint8Array(n,c*a*t*o,a*t*o),oq(l,a,o))}return n}class oA{async decode(e,t){const r=await this.decodeBlock(t),s=e.Predictor||1;if(s!==1){const i=!e.StripOffsets,o=i?e.TileWidth:e.ImageWidth,a=i?e.TileLength:e.RowsPerStrip||e.ImageLength;return aq(r,s,o,a,e.BitsPerSample,e.PlanarConfiguration)}return r}}var ct;(function(n){n.assertEqual=s=>s;function e(s){}n.assertIs=e;function t(s){throw new Error}n.assertNever=t,n.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},n.getValidEnumValues=s=>{const i=n.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return n.objectValues(o)},n.objectValues=s=>n.objectKeys(s).map(function(i){return s[i]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},n.find=(s,i)=>{for(const o of s)if(i(o))return o},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}n.joinValues=r,n.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(ct||(ct={}));var t2;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(t2||(t2={}));const Ie=ct.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ks=n=>{switch(typeof n){case"undefined":return Ie.undefined;case"string":return Ie.string;case"number":return isNaN(n)?Ie.nan:Ie.number;case"boolean":return Ie.boolean;case"function":return Ie.function;case"bigint":return Ie.bigint;case"symbol":return Ie.symbol;case"object":return Array.isArray(n)?Ie.array:n===null?Ie.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Ie.promise:typeof Map<"u"&&n instanceof Map?Ie.map:typeof Set<"u"&&n instanceof Set?Ie.set:typeof Date<"u"&&n instanceof Date?Ie.date:Ie.object;default:return Ie.unknown}},_e=ct.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Qn extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let a=r,c=0;for(;c<o.path.length;){const l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return s(this),r}static assert(e){if(!(e instanceof Qn))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ct.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}Qn.create=n=>new Qn(n);const il=(n,e)=>{let t;switch(n.code){case _e.invalid_type:n.received===Ie.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case _e.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,ct.jsonStringifyReplacer)}`;break;case _e.unrecognized_keys:t=`Unrecognized key(s) in object: ${ct.joinValues(n.keys,", ")}`;break;case _e.invalid_union:t="Invalid input";break;case _e.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ct.joinValues(n.options)}`;break;case _e.invalid_enum_value:t=`Invalid enum value. Expected ${ct.joinValues(n.options)}, received '${n.received}'`;break;case _e.invalid_arguments:t="Invalid function arguments";break;case _e.invalid_return_type:t="Invalid function return type";break;case _e.invalid_date:t="Invalid date";break;case _e.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:ct.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case _e.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case _e.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case _e.custom:t="Invalid input";break;case _e.invalid_intersection_types:t="Intersection results could not be merged";break;case _e.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case _e.not_finite:t="Number must be finite";break;default:t=e.defaultError,ct.assertNever(n)}return{message:t}};let cq=il;function Yg(){return cq}const Kg=n=>{const{data:e,path:t,errorMaps:r,issueData:s}=n,i=[...t,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const c=r.filter(l=>!!l).slice().reverse();for(const l of c)a=l(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function Ae(n,e){const t=Yg(),r=Kg({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===il?void 0:il].filter(s=>!!s)});n.common.issues.push(r)}class Pn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const s of t){if(s.status==="aborted")return je;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const s of t){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return Pn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const s of t){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return je;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const je=Object.freeze({status:"aborted"}),lc=n=>({status:"dirty",value:n}),Ln=n=>({status:"valid",value:n}),n2=n=>n.status==="aborted",r2=n=>n.status==="dirty",ba=n=>n.status==="valid",hh=n=>typeof Promise<"u"&&n instanceof Promise;function dh(n,e,t,r){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function aA(n,e,t,r,s){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}var Me;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Me||(Me={}));var uc,fc;class Ur{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const s2=(n,e)=>{if(ba(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Qn(n.common.issues);return this._error=t,this._error}}};function He(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:s}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{var c,l;const{message:u}=n;return o.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(c=u??r)!==null&&c!==void 0?c:a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:(l=u??t)!==null&&l!==void 0?l:a.defaultError}},description:s}}class Qe{get description(){return this._def.description}_getType(e){return ks(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pn,ctx:{common:e.parent.common,data:e.data,parsedType:ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(hh(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const s={common:{issues:[],async:(r=t==null?void 0:t.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ks(e)},i=this._parseSync({data:e,path:s.path,parent:s});return s2(s,i)}"~validate"(e){var t,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ks(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:s});return ba(i)?{value:i.value}:{issues:s.common.issues}}catch(i){!((r=(t=i==null?void 0:i.message)===null||t===void 0?void 0:t.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(i=>ba(i)?{value:i.value}:{issues:s.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ks(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(hh(s)?s:Promise.resolve(s));return s2(r,i)}refine(e,t){const r=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:_e.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof t=="function"?t(r,s):t),!1))}_refinement(e){return new ps({schema:this,typeName:Ue.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return os.create(this,this._def)}nullable(){return eo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fr.create(this)}promise(){return ol.create(this,this._def)}or(e){return yh.create([this,e],this._def)}and(e){return _h.create(this,e,this._def)}transform(e){return new ps({...He(this._def),schema:this,typeName:Ue.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Th({...He(this._def),innerType:this,defaultValue:t,typeName:Ue.ZodDefault})}brand(){return new fA({typeName:Ue.ZodBranded,type:this,...He(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Sh({...He(this._def),innerType:this,catchValue:t,typeName:Ue.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Sd.create(this,e)}readonly(){return Eh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const lq=/^c[^\s-]{8,}$/i,uq=/^[0-9a-z]+$/,fq=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hq=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,dq=/^[a-z0-9_-]{21}$/i,pq=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mq=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,gq=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let um;const _q=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,vq=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,xq=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,bq=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wq=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tq=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cA="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Sq=new RegExp(`^${cA}$`);function lA(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Eq(n){return new RegExp(`^${lA(n)}$`)}function Aq(n){let e=`${cA}T${lA(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Cq(n,e){return!!((e==="v4"||!e)&&_q.test(n)||(e==="v6"||!e)&&xq.test(n))}function Rq(n,e){if(!pq.test(n))return!1;try{const[t]=n.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function Iq(n,e){return!!((e==="v4"||!e)&&vq.test(n)||(e==="v6"||!e)&&bq.test(n))}class Dr extends Qe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ie.string){const i=this._getOrReturnCtx(e);return Ae(i,{code:_e.invalid_type,expected:Ie.string,received:i.parsedType}),je}const r=new Pn;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?Ae(s,{code:_e.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Ae(s,{code:_e.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")gq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"email",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")um||(um=new RegExp(yq,"u")),um.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"emoji",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")hq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"uuid",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")dq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"nanoid",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")lq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"cuid",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")uq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"cuid2",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")fq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"ulid",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),Ae(s,{validation:"url",code:_e.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"regex",code:_e.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Aq(i).test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Sq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Eq(i).test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?mq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"duration",code:_e.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Cq(e.data,i.version)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"ip",code:_e.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Rq(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"jwt",code:_e.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Iq(e.data,i.version)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"cidr",code:_e.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?wq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"base64",code:_e.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Tq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"base64url",code:_e.invalid_string,message:i.message}),r.dirty()):ct.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(s=>e.test(s),{validation:t,code:_e.invalid_string,...Me.errToObj(r)})}_addCheck(e){return new Dr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Me.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Me.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Me.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Me.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Me.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Me.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Me.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Me.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Me.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Me.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Me.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Me.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Me.errToObj(e)})}datetime(e){var t,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...Me.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Me.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Me.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Me.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Me.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Me.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Me.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Me.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Me.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Me.errToObj(t)})}nonempty(e){return this.min(1,Me.errToObj(e))}trim(){return new Dr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Dr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Dr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Dr.create=n=>{var e;return new Dr({checks:[],typeName:Ue.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...He(n)})};function Pq(n,e){const t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=t>r?t:r,i=parseInt(n.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return i%o/Math.pow(10,s)}class Gi extends Qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ie.number){const i=this._getOrReturnCtx(e);return Ae(i,{code:_e.invalid_type,expected:Ie.number,received:i.parsedType}),je}let r;const s=new Pn;for(const i of this._def.checks)i.kind==="int"?ct.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?Pq(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.not_finite,message:i.message}),s.dirty()):ct.assertNever(i);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Me.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Me.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Me.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Me.toString(t))}setLimit(e,t,r,s){return new Gi({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Me.toString(s)}]})}_addCheck(e){return new Gi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Me.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Me.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Me.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Me.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Me.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Me.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Me.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Me.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Me.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ct.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Gi.create=n=>new Gi({checks:[],typeName:Ue.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...He(n)});class Ji extends Qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ie.bigint)return this._getInvalidInput(e);let r;const s=new Pn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):ct.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ae(t,{code:_e.invalid_type,expected:Ie.bigint,received:t.parsedType}),je}gte(e,t){return this.setLimit("min",e,!0,Me.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Me.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Me.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Me.toString(t))}setLimit(e,t,r,s){return new Ji({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Me.toString(s)}]})}_addCheck(e){return new Ji({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Me.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Me.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Me.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Me.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Me.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ji.create=n=>{var e;return new Ji({checks:[],typeName:Ue.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...He(n)})};class ph extends Qe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ie.boolean){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.boolean,received:r.parsedType}),je}return Ln(e.data)}}ph.create=n=>new ph({typeName:Ue.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...He(n)});class wa extends Qe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ie.date){const i=this._getOrReturnCtx(e);return Ae(i,{code:_e.invalid_type,expected:Ie.date,received:i.parsedType}),je}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return Ae(i,{code:_e.invalid_date}),je}const r=new Pn;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):ct.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new wa({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Me.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Me.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}wa.create=n=>new wa({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:Ue.ZodDate,...He(n)});class Gg extends Qe{_parse(e){if(this._getType(e)!==Ie.symbol){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.symbol,received:r.parsedType}),je}return Ln(e.data)}}Gg.create=n=>new Gg({typeName:Ue.ZodSymbol,...He(n)});class mh extends Qe{_parse(e){if(this._getType(e)!==Ie.undefined){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.undefined,received:r.parsedType}),je}return Ln(e.data)}}mh.create=n=>new mh({typeName:Ue.ZodUndefined,...He(n)});class gh extends Qe{_parse(e){if(this._getType(e)!==Ie.null){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.null,received:r.parsedType}),je}return Ln(e.data)}}gh.create=n=>new gh({typeName:Ue.ZodNull,...He(n)});class Jg extends Qe{constructor(){super(...arguments),this._any=!0}_parse(e){return Ln(e.data)}}Jg.create=n=>new Jg({typeName:Ue.ZodAny,...He(n)});class ea extends Qe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ln(e.data)}}ea.create=n=>new ea({typeName:Ue.ZodUnknown,...He(n)});class si extends Qe{_parse(e){const t=this._getOrReturnCtx(e);return Ae(t,{code:_e.invalid_type,expected:Ie.never,received:t.parsedType}),je}}si.create=n=>new si({typeName:Ue.ZodNever,...He(n)});class Qg extends Qe{_parse(e){if(this._getType(e)!==Ie.undefined){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.void,received:r.parsedType}),je}return Ln(e.data)}}Qg.create=n=>new Qg({typeName:Ue.ZodVoid,...He(n)});class Fr extends Qe{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==Ie.array)return Ae(t,{code:_e.invalid_type,expected:Ie.array,received:t.parsedType}),je;if(s.exactLength!==null){const o=t.data.length>s.exactLength.value,a=t.data.length<s.exactLength.value;(o||a)&&(Ae(t,{code:o?_e.too_big:_e.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(Ae(t,{code:_e.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(Ae(t,{code:_e.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>s.type._parseAsync(new Ur(t,o,t.path,a)))).then(o=>Pn.mergeArray(r,o));const i=[...t.data].map((o,a)=>s.type._parseSync(new Ur(t,o,t.path,a)));return Pn.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new Fr({...this._def,minLength:{value:e,message:Me.toString(t)}})}max(e,t){return new Fr({...this._def,maxLength:{value:e,message:Me.toString(t)}})}length(e,t){return new Fr({...this._def,exactLength:{value:e,message:Me.toString(t)}})}nonempty(e){return this.min(1,e)}}Fr.create=(n,e)=>new Fr({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Ue.ZodArray,...He(e)});function Do(n){if(n instanceof Zt){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=os.create(Do(r))}return new Zt({...n._def,shape:()=>e})}else return n instanceof Fr?new Fr({...n._def,type:Do(n.element)}):n instanceof os?os.create(Do(n.unwrap())):n instanceof eo?eo.create(Do(n.unwrap())):n instanceof ds?ds.create(n.items.map(e=>Do(e))):n}class Zt extends Qe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=ct.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Ie.object){const l=this._getOrReturnCtx(e);return Ae(l,{code:_e.invalid_type,expected:Ie.object,received:l.parsedType}),je}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof si&&this._def.unknownKeys==="strip"))for(const l in s.data)o.includes(l)||a.push(l);const c=[];for(const l of o){const u=i[l],h=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Ur(s,h,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof si){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(l==="strict")a.length>0&&(Ae(s,{code:_e.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of a){const h=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Ur(s,h,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const h=await u.key,d=await u.value;l.push({key:h,value:d,alwaysSet:u.alwaysSet})}return l}).then(l=>Pn.mergeObjectSync(r,l)):Pn.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return Me.errToObj,new Zt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var s,i,o,a;const c=(o=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.call(s,t,r).message)!==null&&o!==void 0?o:r.defaultError;return t.code==="unrecognized_keys"?{message:(a=Me.errToObj(e).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Zt({...this._def,unknownKeys:"strip"})}passthrough(){return new Zt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Zt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Zt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ue.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Zt({...this._def,catchall:e})}pick(e){const t={};return ct.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new Zt({...this._def,shape:()=>t})}omit(e){const t={};return ct.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new Zt({...this._def,shape:()=>t})}deepPartial(){return Do(this)}partial(e){const t={};return ct.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}),new Zt({...this._def,shape:()=>t})}required(e){const t={};return ct.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof os;)i=i._def.innerType;t[r]=i}}),new Zt({...this._def,shape:()=>t})}keyof(){return uA(ct.objectKeys(this.shape))}}Zt.create=(n,e)=>new Zt({shape:()=>n,unknownKeys:"strip",catchall:si.create(),typeName:Ue.ZodObject,...He(e)});Zt.strictCreate=(n,e)=>new Zt({shape:()=>n,unknownKeys:"strict",catchall:si.create(),typeName:Ue.ZodObject,...He(e)});Zt.lazycreate=(n,e)=>new Zt({shape:n,unknownKeys:"strip",catchall:si.create(),typeName:Ue.ZodObject,...He(e)});class yh extends Qe{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Qn(a.ctx.common.issues));return Ae(t,{code:_e.invalid_union,unionErrors:o}),je}if(t.common.async)return Promise.all(r.map(async i=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const c of r){const l={...t,common:{...t.common,issues:[]},parent:null},u=c._parseSync({data:t.data,path:t.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(c=>new Qn(c));return Ae(t,{code:_e.invalid_union,unionErrors:a}),je}}get options(){return this._def.options}}yh.create=(n,e)=>new yh({options:n,typeName:Ue.ZodUnion,...He(e)});const Kr=n=>n instanceof xh?Kr(n.schema):n instanceof ps?Kr(n.innerType()):n instanceof bh?[n.value]:n instanceof Qi?n.options:n instanceof wh?ct.objectValues(n.enum):n instanceof Th?Kr(n._def.innerType):n instanceof mh?[void 0]:n instanceof gh?[null]:n instanceof os?[void 0,...Kr(n.unwrap())]:n instanceof eo?[null,...Kr(n.unwrap())]:n instanceof fA||n instanceof Eh?Kr(n.unwrap()):n instanceof Sh?Kr(n._def.innerType):[];class c_ extends Qe{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.object)return Ae(t,{code:_e.invalid_type,expected:Ie.object,received:t.parsedType}),je;const r=this.discriminator,s=t.data[r],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Ae(t,{code:_e.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),je)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const s=new Map;for(const i of t){const o=Kr(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new c_({typeName:Ue.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...He(r)})}}function e0(n,e){const t=ks(n),r=ks(e);if(n===e)return{valid:!0,data:n};if(t===Ie.object&&r===Ie.object){const s=ct.objectKeys(e),i=ct.objectKeys(n).filter(a=>s.indexOf(a)!==-1),o={...n,...e};for(const a of i){const c=e0(n[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(t===Ie.array&&r===Ie.array){if(n.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<n.length;i++){const o=n[i],a=e[i],c=e0(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===Ie.date&&r===Ie.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class _h extends Qe{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(n2(i)||n2(o))return je;const a=e0(i.value,o.value);return a.valid?((r2(i)||r2(o))&&t.dirty(),{status:t.value,value:a.data}):(Ae(r,{code:_e.invalid_intersection_types}),je)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}_h.create=(n,e,t)=>new _h({left:n,right:e,typeName:Ue.ZodIntersection,...He(t)});class ds extends Qe{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ie.array)return Ae(r,{code:_e.invalid_type,expected:Ie.array,received:r.parsedType}),je;if(r.data.length<this._def.items.length)return Ae(r,{code:_e.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&r.data.length>this._def.items.length&&(Ae(r,{code:_e.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...r.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Ur(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Pn.mergeArray(t,o)):Pn.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new ds({...this._def,rest:e})}}ds.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ds({items:n,typeName:Ue.ZodTuple,rest:null,...He(e)})};class vh extends Qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ie.object)return Ae(r,{code:_e.invalid_type,expected:Ie.object,received:r.parsedType}),je;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new Ur(r,a,r.path,a)),value:o._parse(new Ur(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Pn.mergeObjectAsync(t,s):Pn.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof Qe?new vh({keyType:e,valueType:t,typeName:Ue.ZodRecord,...He(r)}):new vh({keyType:Dr.create(),valueType:e,typeName:Ue.ZodRecord,...He(t)})}}class t0 extends Qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ie.map)return Ae(r,{code:_e.invalid_type,expected:Ie.map,received:r.parsedType}),je;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,c],l)=>({key:s._parse(new Ur(r,a,r.path,[l,"key"])),value:i._parse(new Ur(r,c,r.path,[l,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return je;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(l.value,u.value)}return{status:t.value,value:a}})}else{const a=new Map;for(const c of o){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return je;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(l.value,u.value)}return{status:t.value,value:a}}}}t0.create=(n,e,t)=>new t0({valueType:e,keyType:n,typeName:Ue.ZodMap,...He(t)});class Ta extends Qe{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ie.set)return Ae(r,{code:_e.invalid_type,expected:Ie.set,received:r.parsedType}),je;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(Ae(r,{code:_e.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(Ae(r,{code:_e.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const i=this._def.valueType;function o(c){const l=new Set;for(const u of c){if(u.status==="aborted")return je;u.status==="dirty"&&t.dirty(),l.add(u.value)}return{status:t.value,value:l}}const a=[...r.data.values()].map((c,l)=>i._parse(new Ur(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,t){return new Ta({...this._def,minSize:{value:e,message:Me.toString(t)}})}max(e,t){return new Ta({...this._def,maxSize:{value:e,message:Me.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ta.create=(n,e)=>new Ta({valueType:n,minSize:null,maxSize:null,typeName:Ue.ZodSet,...He(e)});class Cc extends Qe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.function)return Ae(t,{code:_e.invalid_type,expected:Ie.function,received:t.parsedType}),je;function r(a,c){return Kg({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yg(),il].filter(l=>!!l),issueData:{code:_e.invalid_arguments,argumentsError:c}})}function s(a,c){return Kg({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yg(),il].filter(l=>!!l),issueData:{code:_e.invalid_return_type,returnTypeError:c}})}const i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof ol){const a=this;return Ln(async function(...c){const l=new Qn([]),u=await a._def.args.parseAsync(c,i).catch(p=>{throw l.addIssue(r(c,p)),l}),h=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(h,i).catch(p=>{throw l.addIssue(s(h,p)),l})})}else{const a=this;return Ln(function(...c){const l=a._def.args.safeParse(c,i);if(!l.success)throw new Qn([r(c,l.error)]);const u=Reflect.apply(o,this,l.data),h=a._def.returns.safeParse(u,i);if(!h.success)throw new Qn([s(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Cc({...this._def,args:ds.create(e).rest(ea.create())})}returns(e){return new Cc({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Cc({args:e||ds.create([]).rest(ea.create()),returns:t||ea.create(),typeName:Ue.ZodFunction,...He(r)})}}class xh extends Qe{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}xh.create=(n,e)=>new xh({getter:n,typeName:Ue.ZodLazy,...He(e)});class bh extends Qe{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ae(t,{received:t.data,code:_e.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:e.data}}get value(){return this._def.value}}bh.create=(n,e)=>new bh({value:n,typeName:Ue.ZodLiteral,...He(e)});function uA(n,e){return new Qi({values:n,typeName:Ue.ZodEnum,...He(e)})}class Qi extends Qe{constructor(){super(...arguments),uc.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return Ae(t,{expected:ct.joinValues(r),received:t.parsedType,code:_e.invalid_type}),je}if(dh(this,uc)||aA(this,uc,new Set(this._def.values)),!dh(this,uc).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return Ae(t,{received:t.data,code:_e.invalid_enum_value,options:r}),je}return Ln(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Qi.create(e,{...this._def,...t})}exclude(e,t=this._def){return Qi.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}uc=new WeakMap;Qi.create=uA;class wh extends Qe{constructor(){super(...arguments),fc.set(this,void 0)}_parse(e){const t=ct.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ie.string&&r.parsedType!==Ie.number){const s=ct.objectValues(t);return Ae(r,{expected:ct.joinValues(s),received:r.parsedType,code:_e.invalid_type}),je}if(dh(this,fc)||aA(this,fc,new Set(ct.getValidEnumValues(this._def.values))),!dh(this,fc).has(e.data)){const s=ct.objectValues(t);return Ae(r,{received:r.data,code:_e.invalid_enum_value,options:s}),je}return Ln(e.data)}get enum(){return this._def.values}}fc=new WeakMap;wh.create=(n,e)=>new wh({values:n,typeName:Ue.ZodNativeEnum,...He(e)});class ol extends Qe{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.promise&&t.common.async===!1)return Ae(t,{code:_e.invalid_type,expected:Ie.promise,received:t.parsedType}),je;const r=t.parsedType===Ie.promise?t.data:Promise.resolve(t.data);return Ln(r.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ol.create=(n,e)=>new ol({type:n,typeName:Ue.ZodPromise,...He(e)});class ps extends Qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ue.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{Ae(r,o),o.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return je;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?je:c.status==="dirty"||t.value==="dirty"?lc(c.value):c});{if(t.value==="aborted")return je;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?je:a.status==="dirty"||t.value==="dirty"?lc(a.value):a}}if(s.type==="refinement"){const o=a=>{const c=s.refinement(a,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?je:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?je:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ba(o))return o;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>ba(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:t.value,value:a})):o);ct.assertNever(s)}}ps.create=(n,e,t)=>new ps({schema:n,typeName:Ue.ZodEffects,effect:e,...He(t)});ps.createWithPreprocess=(n,e,t)=>new ps({schema:e,effect:{type:"preprocess",transform:n},typeName:Ue.ZodEffects,...He(t)});class os extends Qe{_parse(e){return this._getType(e)===Ie.undefined?Ln(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}os.create=(n,e)=>new os({innerType:n,typeName:Ue.ZodOptional,...He(e)});class eo extends Qe{_parse(e){return this._getType(e)===Ie.null?Ln(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eo.create=(n,e)=>new eo({innerType:n,typeName:Ue.ZodNullable,...He(e)});class Th extends Qe{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===Ie.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Th.create=(n,e)=>new Th({innerType:n,typeName:Ue.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...He(e)});class Sh extends Qe{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return hh(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Qn(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Qn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Sh.create=(n,e)=>new Sh({innerType:n,typeName:Ue.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...He(e)});class n0 extends Qe{_parse(e){if(this._getType(e)!==Ie.nan){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.nan,received:r.parsedType}),je}return{status:"valid",value:e.data}}}n0.create=n=>new n0({typeName:Ue.ZodNaN,...He(n)});class fA extends Qe{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Sd extends Qe{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?je:i.status==="dirty"?(t.dirty(),lc(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?je:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,t){return new Sd({in:e,out:t,typeName:Ue.ZodPipeline})}}class Eh extends Qe{_parse(e){const t=this._def.innerType._parse(e),r=s=>(ba(s)&&(s.value=Object.freeze(s.value)),s);return hh(t)?t.then(s=>r(s)):r(t)}unwrap(){return this._def.innerType}}Eh.create=(n,e)=>new Eh({innerType:n,typeName:Ue.ZodReadonly,...He(e)});Zt.lazycreate;var Ue;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(Ue||(Ue={}));const as=Dr.create;Gi.create;n0.create;Ji.create;ph.create;wa.create;Gg.create;mh.create;gh.create;Jg.create;const Oq=ea.create;si.create;Qg.create;Fr.create;const _r=Zt.create;Zt.strictCreate;yh.create;c_.create;_h.create;ds.create;vh.create;t0.create;Ta.create;Cc.create;xh.create;bh.create;const l_=Qi.create;wh.create;ol.create;ps.create;os.create;eo.create;const r0=ps.createWithPreprocess;Sd.create;const xn={string:n=>Dr.create({...n,coerce:!0}),number:n=>Gi.create({...n,coerce:!0}),boolean:n=>ph.create({...n,coerce:!0}),bigint:n=>Ji.create({...n,coerce:!0}),date:n=>wa.create({...n,coerce:!0})};var kq=Object.defineProperty,Mq=(n,e,t)=>e in n?kq(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Nq=(n,e,t)=>(Mq(n,e+"",t),t);class Dq extends oA{constructor(e){super(),Nq(this,"maxUncompressedSize");const t=e.TileWidth||e.ImageWidth,r=e.TileLength||e.ImageLength,s=e.BitsPerSample[0]/8;this.maxUncompressedSize=t*r*s}async decodeBlock(e){const t=new Uint8Array(e);return(await decompress(t,this.maxUncompressedSize)).buffer}}function Lq(n){if(!Number.isInteger(n))throw Error("Not an integer.");const e=new ArrayBuffer(4);new DataView(e).setInt32(0,n,!1);const r=new Uint8Array(e);return Array.from(r)}function al(n){const e=n[n.length-1];return e===3||e===4}function Ed(n){const e=al(n.shape),[t,r]=n.shape.slice(e?-3:-2);return{height:t,width:r}}const hA="__vivSignalAborted";function Xl({attr:n,...e}){return{...n,...e}}function s0(n){return Array.isArray(n)?n:[n]}const Fq=l_(["XYZCT","XYZTC","XYCTZ","XYCZT","XYTCZ","XYTZC"]),Bq=l_(["int8","int16","int32","uint8","uint16","uint32","float","bit","double","complex","double-complex"]),fm=l_(["Ym","Zm","Em","Pm","Tm","Gm","Mm","km","hm","dam","m","dm","cm","mm","µm","nm","pm","fm","am","zm","ym","Å","thou","li","in","ft","yd","mi","ua","ly","pc","pt","pixel","reference frame"]),Uq=_r({}).extend({attr:_r({ID:as(),SamplesPerPixel:xn.number().optional(),Name:as().optional(),Color:xn.number().transform(Lq).optional()})}).transform(Xl),$q=_r({}).extend({attr:_r({FileName:as()})}).transform(Xl),Vq=_r({UUID:$q.optional()}).extend({attr:_r({IFD:xn.number().default(0),PlaneCount:xn.number().default(1),FirstT:xn.number().optional(),FirstC:xn.number().optional(),FirstZ:xn.number().optional()})}).transform(Xl),jq=_r({Channel:r0(s0,Uq.array()),TiffData:r0(s0,Vq.array()).optional()}).extend({attr:_r({ID:as(),DimensionOrder:Fq,Type:Bq,SizeT:xn.number(),SizeC:xn.number(),SizeZ:xn.number(),SizeY:xn.number(),SizeX:xn.number(),PhysicalSizeX:xn.number().optional(),PhysicalSizeY:xn.number().optional(),PhysicalSizeZ:xn.number().optional(),SignificantBits:xn.number().optional(),PhysicalSizeXUnit:fm.optional().default("µm"),PhysicalSizeYUnit:fm.optional().default("µm"),PhysicalSizeZUnit:fm.optional().default("µm"),BigEndian:as().transform(n=>n.toLowerCase()==="true").optional(),Interleaved:as().transform(n=>n.toLowerCase()==="true").optional()})}).transform(Xl).transform(({Channel:n,...e})=>({Channels:n,...e})),zq=_r({AquisitionDate:as().optional().default(""),Description:Oq().optional().default(""),Pixels:jq}).extend({attr:_r({ID:as(),Name:as().optional()})}).transform(Xl);_r({Image:r0(s0,zq.array())});ms(5,()=>Dq);function Wq(n){return[...Array(n).keys()]}function dA(n,e,t){for(let r=0;r<t;r+=1)n.push(e);return n}function u_(n){const e=Q1[n];if(!e){const t=Object.keys(Q1);throw Error(`Dtype not supported, got ${n}. Must be one of ${t}.`)}return e}function pA({contrastLimits:n=[],channelsVisible:e,domain:t,dtype:r}){const s=(t==null?void 0:t[1])||u_(r).max,i=n.map((c,l)=>e[l]?c:[s,s]),o=JE-i.length;if(o<0)throw Error(`${i.lengths} channels passed in, but only 6 are allowed.`);return dA(i,[s,s],o).reduce((c,l)=>c.concat(l),[])}function Hq(n){var s;const{x:e,y:t,z:r}=((s=n==null?void 0:n.meta)==null?void 0:s.physicalSizes)??{};if(e!=null&&e.size&&(t!=null&&t.size)&&(r!=null&&r.size)){const i=Math.min(r.size,e.size,t.size),o=[e.size/i,t.size/i,r.size/i];return new Je().scale(o)}return new Je().identity()}function Xq(n){const e=new Zy().makeViewport({viewState:n,height:n.height,width:n.width});return[e.unproject([0,0]),e.unproject([e.width,0]),e.unproject([e.width,e.height]),e.unproject([0,e.height])]}const Ah=[1,2,3,4,5,10,20,25,50,100,200,250,500,1e3],Zq=Ah[0],qq=Ah[Ah.length-1],i0=[{symbol:"Y",exponent:24},{symbol:"Z",exponent:21},{symbol:"E",exponent:18},{symbol:"P",exponent:15},{symbol:"T",exponent:12},{symbol:"G",exponent:9},{symbol:"M",exponent:6},{symbol:"k",exponent:3},{symbol:"h",exponent:2},{symbol:"da",exponent:1},{symbol:"",exponent:0},{symbol:"d",exponent:-1},{symbol:"c",exponent:-2},{symbol:"m",exponent:-3},{symbol:"µ",exponent:-6},{symbol:"n",exponent:-9},{symbol:"p",exponent:-12},{symbol:"f",exponent:-15},{symbol:"a",exponent:-18},{symbol:"z",exponent:-21},{symbol:"y",exponent:-24}];function Yq(n,e){if(!e||e==="m")return n;if(e.length>1){let t=e.substring(0,e.length-1);t==="u"&&(t="µ");const r=i0.find(s=>s.symbol===t);if(r)return n*10**r.exponent}throw new Error("Received unknown unit")}function Kq(n){let e=0;(n<Zq||n>qq)&&(e=Math.floor(Math.log10(n)));let t=i0.find(o=>o.exponent%3===0&&o.exponent<=e),r=n/10**t.exponent;r>500&&r<=1e3&&(t=i0.find(o=>o.exponent%3===0&&o.exponent<=e+3),r=n/10**t.exponent);const s=Ah.find(o=>o>r);return[s*10**t.exponent,s,t.symbol]}function Gq(n){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");const e=new Uint8Array(n.length+n.length/3);for(let t=0;t<n.length/3;t+=1)e[t*4]=n[t*3],e[t*4+1]=n[t*3+1],e[t*4+2]=n[t*3+2],e[t*4+3]=255;return e}const rs={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},mA={...jl.defaultProps,pickable:{type:"boolean",value:!0,compare:!0},coordinateSystem:Ve.CARTESIAN},Jq=(n,e)=>{const t=e?"true":"false",r=`vec3(${(e||[0,0,0]).map(s=>String(s/255)).join(",")})`;switch(n){case rs.RGB:return`color[3] = (${t} && (color.rgb == ${r})) ? 0.0 : color.a;`;case rs.WhiteIsZero:return` float value = 1.0 - (color.r / 256.0);
|
|
3456
|
+
`,rq=class extends Hl{constructor(n){super(n),this.rendering={_BEFORE_RENDER:eq,_RENDER:tq,_AFTER_RENDER:nq}}};rq.extensionName="MinimumIntensityProjectionExtension";const iA={AdditiveBlendExtension:sA},sq=new Map;function ms(n,e){Array.isArray(n)||(n=[n]),n.forEach(t=>sq.set(t,e))}ms([void 0,1],()=>Promise.resolve().then(()=>require("./raw-CHi7PjRk.cjs")).then(n=>n.default));ms(5,()=>Promise.resolve().then(()=>require("./lzw-CZPfIBvk.cjs")).then(n=>n.default));ms(6,()=>{throw new Error("old style JPEG compression is not supported.")});ms(7,()=>Promise.resolve().then(()=>require("./jpeg-DNqKm07P.cjs")).then(n=>n.default));ms([8,32946],()=>Promise.resolve().then(()=>require("./deflate-CDNKi0Ty.cjs")).then(n=>n.default));ms(32773,()=>Promise.resolve().then(()=>require("./packbits-Dcq9Xl8T.cjs")).then(n=>n.default));ms(34887,()=>Promise.resolve().then(()=>require("./lerc-pt3_s-G2.cjs")).then(async n=>(await n.zstd.init(),n)).then(n=>n.default));ms(50001,()=>Promise.resolve().then(()=>require("./webimage-Df8qZG7_.cjs")).then(n=>n.default));function iq(n,e){let t=n.length-e,r=0;do{for(let s=e;s>0;s--)n[r+e]+=n[r],r++;t-=e}while(t>0)}function oq(n,e,t){let r=0,s=n.length;const i=s/t;for(;s>e;){for(let a=e;a>0;--a)n[r+e]+=n[r],++r;s-=e}const o=n.slice();for(let a=0;a<i;++a)for(let c=0;c<t;++c)n[t*a+c]=o[(t-c-1)*i+a]}function aq(n,e,t,r,s,i){if(e===1)return n;for(let c=0;c<s.length;++c){if(s[c]%8!==0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(s[c]!==s[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const o=s[0]/8,a=i===2?1:s.length;for(let c=0;c<r&&!(c*a*t*o>=n.byteLength);++c){let l;if(e===2){switch(s[0]){case 8:l=new Uint8Array(n,c*a*t*o,a*t*o);break;case 16:l=new Uint16Array(n,c*a*t*o,a*t*o/2);break;case 32:l=new Uint32Array(n,c*a*t*o,a*t*o/4);break;default:throw new Error(`Predictor 2 not allowed with ${s[0]} bits per sample.`)}iq(l,a)}else e===3&&(l=new Uint8Array(n,c*a*t*o,a*t*o),oq(l,a,o))}return n}class oA{async decode(e,t){const r=await this.decodeBlock(t),s=e.Predictor||1;if(s!==1){const i=!e.StripOffsets,o=i?e.TileWidth:e.ImageWidth,a=i?e.TileLength:e.RowsPerStrip||e.ImageLength;return aq(r,s,o,a,e.BitsPerSample,e.PlanarConfiguration)}return r}}var ct;(function(n){n.assertEqual=s=>s;function e(s){}n.assertIs=e;function t(s){throw new Error}n.assertNever=t,n.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},n.getValidEnumValues=s=>{const i=n.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return n.objectValues(o)},n.objectValues=s=>n.objectKeys(s).map(function(i){return s[i]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},n.find=(s,i)=>{for(const o of s)if(i(o))return o},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}n.joinValues=r,n.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(ct||(ct={}));var t2;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(t2||(t2={}));const Ie=ct.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ks=n=>{switch(typeof n){case"undefined":return Ie.undefined;case"string":return Ie.string;case"number":return isNaN(n)?Ie.nan:Ie.number;case"boolean":return Ie.boolean;case"function":return Ie.function;case"bigint":return Ie.bigint;case"symbol":return Ie.symbol;case"object":return Array.isArray(n)?Ie.array:n===null?Ie.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Ie.promise:typeof Map<"u"&&n instanceof Map?Ie.map:typeof Set<"u"&&n instanceof Set?Ie.set:typeof Date<"u"&&n instanceof Date?Ie.date:Ie.object;default:return Ie.unknown}},_e=ct.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Qn extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let a=r,c=0;for(;c<o.path.length;){const l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return s(this),r}static assert(e){if(!(e instanceof Qn))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ct.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}Qn.create=n=>new Qn(n);const il=(n,e)=>{let t;switch(n.code){case _e.invalid_type:n.received===Ie.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case _e.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,ct.jsonStringifyReplacer)}`;break;case _e.unrecognized_keys:t=`Unrecognized key(s) in object: ${ct.joinValues(n.keys,", ")}`;break;case _e.invalid_union:t="Invalid input";break;case _e.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ct.joinValues(n.options)}`;break;case _e.invalid_enum_value:t=`Invalid enum value. Expected ${ct.joinValues(n.options)}, received '${n.received}'`;break;case _e.invalid_arguments:t="Invalid function arguments";break;case _e.invalid_return_type:t="Invalid function return type";break;case _e.invalid_date:t="Invalid date";break;case _e.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:ct.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case _e.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case _e.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case _e.custom:t="Invalid input";break;case _e.invalid_intersection_types:t="Intersection results could not be merged";break;case _e.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case _e.not_finite:t="Number must be finite";break;default:t=e.defaultError,ct.assertNever(n)}return{message:t}};let cq=il;function Yg(){return cq}const Kg=n=>{const{data:e,path:t,errorMaps:r,issueData:s}=n,i=[...t,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const c=r.filter(l=>!!l).slice().reverse();for(const l of c)a=l(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function Ae(n,e){const t=Yg(),r=Kg({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===il?void 0:il].filter(s=>!!s)});n.common.issues.push(r)}class Pn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const s of t){if(s.status==="aborted")return je;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const s of t){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return Pn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const s of t){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return je;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const je=Object.freeze({status:"aborted"}),lc=n=>({status:"dirty",value:n}),Ln=n=>({status:"valid",value:n}),n2=n=>n.status==="aborted",r2=n=>n.status==="dirty",ba=n=>n.status==="valid",hh=n=>typeof Promise<"u"&&n instanceof Promise;function dh(n,e,t,r){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function aA(n,e,t,r,s){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}var Me;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Me||(Me={}));var uc,fc;class Ur{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const s2=(n,e)=>{if(ba(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Qn(n.common.issues);return this._error=t,this._error}}};function He(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:s}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{var c,l;const{message:u}=n;return o.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(c=u??r)!==null&&c!==void 0?c:a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:(l=u??t)!==null&&l!==void 0?l:a.defaultError}},description:s}}class Qe{get description(){return this._def.description}_getType(e){return ks(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pn,ctx:{common:e.parent.common,data:e.data,parsedType:ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(hh(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const s={common:{issues:[],async:(r=t==null?void 0:t.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ks(e)},i=this._parseSync({data:e,path:s.path,parent:s});return s2(s,i)}"~validate"(e){var t,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ks(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:s});return ba(i)?{value:i.value}:{issues:s.common.issues}}catch(i){!((r=(t=i==null?void 0:i.message)===null||t===void 0?void 0:t.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(i=>ba(i)?{value:i.value}:{issues:s.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ks(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(hh(s)?s:Promise.resolve(s));return s2(r,i)}refine(e,t){const r=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:_e.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof t=="function"?t(r,s):t),!1))}_refinement(e){return new ps({schema:this,typeName:Ue.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return os.create(this,this._def)}nullable(){return eo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fr.create(this)}promise(){return ol.create(this,this._def)}or(e){return yh.create([this,e],this._def)}and(e){return _h.create(this,e,this._def)}transform(e){return new ps({...He(this._def),schema:this,typeName:Ue.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Th({...He(this._def),innerType:this,defaultValue:t,typeName:Ue.ZodDefault})}brand(){return new fA({typeName:Ue.ZodBranded,type:this,...He(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Sh({...He(this._def),innerType:this,catchValue:t,typeName:Ue.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Sd.create(this,e)}readonly(){return Eh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const lq=/^c[^\s-]{8,}$/i,uq=/^[0-9a-z]+$/,fq=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hq=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,dq=/^[a-z0-9_-]{21}$/i,pq=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mq=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,gq=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let um;const _q=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,vq=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,xq=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,bq=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wq=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tq=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cA="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Sq=new RegExp(`^${cA}$`);function lA(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Eq(n){return new RegExp(`^${lA(n)}$`)}function Aq(n){let e=`${cA}T${lA(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Cq(n,e){return!!((e==="v4"||!e)&&_q.test(n)||(e==="v6"||!e)&&xq.test(n))}function Rq(n,e){if(!pq.test(n))return!1;try{const[t]=n.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function Iq(n,e){return!!((e==="v4"||!e)&&vq.test(n)||(e==="v6"||!e)&&bq.test(n))}class Dr extends Qe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ie.string){const i=this._getOrReturnCtx(e);return Ae(i,{code:_e.invalid_type,expected:Ie.string,received:i.parsedType}),je}const r=new Pn;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?Ae(s,{code:_e.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Ae(s,{code:_e.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")gq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"email",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")um||(um=new RegExp(yq,"u")),um.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"emoji",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")hq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"uuid",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")dq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"nanoid",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")lq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"cuid",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")uq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"cuid2",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")fq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"ulid",code:_e.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),Ae(s,{validation:"url",code:_e.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"regex",code:_e.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Aq(i).test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Sq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Eq(i).test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?mq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"duration",code:_e.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Cq(e.data,i.version)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"ip",code:_e.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Rq(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"jwt",code:_e.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Iq(e.data,i.version)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"cidr",code:_e.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?wq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"base64",code:_e.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Tq.test(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{validation:"base64url",code:_e.invalid_string,message:i.message}),r.dirty()):ct.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(s=>e.test(s),{validation:t,code:_e.invalid_string,...Me.errToObj(r)})}_addCheck(e){return new Dr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Me.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Me.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Me.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Me.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Me.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Me.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Me.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Me.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Me.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Me.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Me.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Me.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Me.errToObj(e)})}datetime(e){var t,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...Me.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Me.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Me.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Me.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Me.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Me.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Me.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Me.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Me.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Me.errToObj(t)})}nonempty(e){return this.min(1,Me.errToObj(e))}trim(){return new Dr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Dr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Dr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Dr.create=n=>{var e;return new Dr({checks:[],typeName:Ue.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...He(n)})};function Pq(n,e){const t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=t>r?t:r,i=parseInt(n.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return i%o/Math.pow(10,s)}class Gi extends Qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ie.number){const i=this._getOrReturnCtx(e);return Ae(i,{code:_e.invalid_type,expected:Ie.number,received:i.parsedType}),je}let r;const s=new Pn;for(const i of this._def.checks)i.kind==="int"?ct.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?Pq(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.not_finite,message:i.message}),s.dirty()):ct.assertNever(i);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Me.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Me.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Me.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Me.toString(t))}setLimit(e,t,r,s){return new Gi({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Me.toString(s)}]})}_addCheck(e){return new Gi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Me.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Me.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Me.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Me.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Me.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Me.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Me.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Me.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Me.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ct.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Gi.create=n=>new Gi({checks:[],typeName:Ue.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...He(n)});class Ji extends Qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ie.bigint)return this._getInvalidInput(e);let r;const s=new Pn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Ae(r,{code:_e.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):ct.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ae(t,{code:_e.invalid_type,expected:Ie.bigint,received:t.parsedType}),je}gte(e,t){return this.setLimit("min",e,!0,Me.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Me.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Me.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Me.toString(t))}setLimit(e,t,r,s){return new Ji({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Me.toString(s)}]})}_addCheck(e){return new Ji({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Me.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Me.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Me.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Me.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Me.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ji.create=n=>{var e;return new Ji({checks:[],typeName:Ue.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...He(n)})};class ph extends Qe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ie.boolean){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.boolean,received:r.parsedType}),je}return Ln(e.data)}}ph.create=n=>new ph({typeName:Ue.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...He(n)});class wa extends Qe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ie.date){const i=this._getOrReturnCtx(e);return Ae(i,{code:_e.invalid_type,expected:Ie.date,received:i.parsedType}),je}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return Ae(i,{code:_e.invalid_date}),je}const r=new Pn;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:_e.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):ct.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new wa({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Me.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Me.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}wa.create=n=>new wa({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:Ue.ZodDate,...He(n)});class Gg extends Qe{_parse(e){if(this._getType(e)!==Ie.symbol){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.symbol,received:r.parsedType}),je}return Ln(e.data)}}Gg.create=n=>new Gg({typeName:Ue.ZodSymbol,...He(n)});class mh extends Qe{_parse(e){if(this._getType(e)!==Ie.undefined){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.undefined,received:r.parsedType}),je}return Ln(e.data)}}mh.create=n=>new mh({typeName:Ue.ZodUndefined,...He(n)});class gh extends Qe{_parse(e){if(this._getType(e)!==Ie.null){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.null,received:r.parsedType}),je}return Ln(e.data)}}gh.create=n=>new gh({typeName:Ue.ZodNull,...He(n)});class Jg extends Qe{constructor(){super(...arguments),this._any=!0}_parse(e){return Ln(e.data)}}Jg.create=n=>new Jg({typeName:Ue.ZodAny,...He(n)});class ea extends Qe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ln(e.data)}}ea.create=n=>new ea({typeName:Ue.ZodUnknown,...He(n)});class si extends Qe{_parse(e){const t=this._getOrReturnCtx(e);return Ae(t,{code:_e.invalid_type,expected:Ie.never,received:t.parsedType}),je}}si.create=n=>new si({typeName:Ue.ZodNever,...He(n)});class Qg extends Qe{_parse(e){if(this._getType(e)!==Ie.undefined){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.void,received:r.parsedType}),je}return Ln(e.data)}}Qg.create=n=>new Qg({typeName:Ue.ZodVoid,...He(n)});class Fr extends Qe{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==Ie.array)return Ae(t,{code:_e.invalid_type,expected:Ie.array,received:t.parsedType}),je;if(s.exactLength!==null){const o=t.data.length>s.exactLength.value,a=t.data.length<s.exactLength.value;(o||a)&&(Ae(t,{code:o?_e.too_big:_e.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(Ae(t,{code:_e.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(Ae(t,{code:_e.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>s.type._parseAsync(new Ur(t,o,t.path,a)))).then(o=>Pn.mergeArray(r,o));const i=[...t.data].map((o,a)=>s.type._parseSync(new Ur(t,o,t.path,a)));return Pn.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new Fr({...this._def,minLength:{value:e,message:Me.toString(t)}})}max(e,t){return new Fr({...this._def,maxLength:{value:e,message:Me.toString(t)}})}length(e,t){return new Fr({...this._def,exactLength:{value:e,message:Me.toString(t)}})}nonempty(e){return this.min(1,e)}}Fr.create=(n,e)=>new Fr({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Ue.ZodArray,...He(e)});function Do(n){if(n instanceof Zt){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=os.create(Do(r))}return new Zt({...n._def,shape:()=>e})}else return n instanceof Fr?new Fr({...n._def,type:Do(n.element)}):n instanceof os?os.create(Do(n.unwrap())):n instanceof eo?eo.create(Do(n.unwrap())):n instanceof ds?ds.create(n.items.map(e=>Do(e))):n}class Zt extends Qe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=ct.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Ie.object){const l=this._getOrReturnCtx(e);return Ae(l,{code:_e.invalid_type,expected:Ie.object,received:l.parsedType}),je}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof si&&this._def.unknownKeys==="strip"))for(const l in s.data)o.includes(l)||a.push(l);const c=[];for(const l of o){const u=i[l],h=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Ur(s,h,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof si){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(l==="strict")a.length>0&&(Ae(s,{code:_e.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of a){const h=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Ur(s,h,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const h=await u.key,d=await u.value;l.push({key:h,value:d,alwaysSet:u.alwaysSet})}return l}).then(l=>Pn.mergeObjectSync(r,l)):Pn.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return Me.errToObj,new Zt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var s,i,o,a;const c=(o=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.call(s,t,r).message)!==null&&o!==void 0?o:r.defaultError;return t.code==="unrecognized_keys"?{message:(a=Me.errToObj(e).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Zt({...this._def,unknownKeys:"strip"})}passthrough(){return new Zt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Zt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Zt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ue.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Zt({...this._def,catchall:e})}pick(e){const t={};return ct.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new Zt({...this._def,shape:()=>t})}omit(e){const t={};return ct.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new Zt({...this._def,shape:()=>t})}deepPartial(){return Do(this)}partial(e){const t={};return ct.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}),new Zt({...this._def,shape:()=>t})}required(e){const t={};return ct.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof os;)i=i._def.innerType;t[r]=i}}),new Zt({...this._def,shape:()=>t})}keyof(){return uA(ct.objectKeys(this.shape))}}Zt.create=(n,e)=>new Zt({shape:()=>n,unknownKeys:"strip",catchall:si.create(),typeName:Ue.ZodObject,...He(e)});Zt.strictCreate=(n,e)=>new Zt({shape:()=>n,unknownKeys:"strict",catchall:si.create(),typeName:Ue.ZodObject,...He(e)});Zt.lazycreate=(n,e)=>new Zt({shape:n,unknownKeys:"strip",catchall:si.create(),typeName:Ue.ZodObject,...He(e)});class yh extends Qe{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Qn(a.ctx.common.issues));return Ae(t,{code:_e.invalid_union,unionErrors:o}),je}if(t.common.async)return Promise.all(r.map(async i=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const c of r){const l={...t,common:{...t.common,issues:[]},parent:null},u=c._parseSync({data:t.data,path:t.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(c=>new Qn(c));return Ae(t,{code:_e.invalid_union,unionErrors:a}),je}}get options(){return this._def.options}}yh.create=(n,e)=>new yh({options:n,typeName:Ue.ZodUnion,...He(e)});const Kr=n=>n instanceof xh?Kr(n.schema):n instanceof ps?Kr(n.innerType()):n instanceof bh?[n.value]:n instanceof Qi?n.options:n instanceof wh?ct.objectValues(n.enum):n instanceof Th?Kr(n._def.innerType):n instanceof mh?[void 0]:n instanceof gh?[null]:n instanceof os?[void 0,...Kr(n.unwrap())]:n instanceof eo?[null,...Kr(n.unwrap())]:n instanceof fA||n instanceof Eh?Kr(n.unwrap()):n instanceof Sh?Kr(n._def.innerType):[];class c_ extends Qe{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.object)return Ae(t,{code:_e.invalid_type,expected:Ie.object,received:t.parsedType}),je;const r=this.discriminator,s=t.data[r],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Ae(t,{code:_e.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),je)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const s=new Map;for(const i of t){const o=Kr(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new c_({typeName:Ue.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...He(r)})}}function e0(n,e){const t=ks(n),r=ks(e);if(n===e)return{valid:!0,data:n};if(t===Ie.object&&r===Ie.object){const s=ct.objectKeys(e),i=ct.objectKeys(n).filter(a=>s.indexOf(a)!==-1),o={...n,...e};for(const a of i){const c=e0(n[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(t===Ie.array&&r===Ie.array){if(n.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<n.length;i++){const o=n[i],a=e[i],c=e0(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===Ie.date&&r===Ie.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class _h extends Qe{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(n2(i)||n2(o))return je;const a=e0(i.value,o.value);return a.valid?((r2(i)||r2(o))&&t.dirty(),{status:t.value,value:a.data}):(Ae(r,{code:_e.invalid_intersection_types}),je)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}_h.create=(n,e,t)=>new _h({left:n,right:e,typeName:Ue.ZodIntersection,...He(t)});class ds extends Qe{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ie.array)return Ae(r,{code:_e.invalid_type,expected:Ie.array,received:r.parsedType}),je;if(r.data.length<this._def.items.length)return Ae(r,{code:_e.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&r.data.length>this._def.items.length&&(Ae(r,{code:_e.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...r.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Ur(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Pn.mergeArray(t,o)):Pn.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new ds({...this._def,rest:e})}}ds.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ds({items:n,typeName:Ue.ZodTuple,rest:null,...He(e)})};class vh extends Qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ie.object)return Ae(r,{code:_e.invalid_type,expected:Ie.object,received:r.parsedType}),je;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new Ur(r,a,r.path,a)),value:o._parse(new Ur(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Pn.mergeObjectAsync(t,s):Pn.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof Qe?new vh({keyType:e,valueType:t,typeName:Ue.ZodRecord,...He(r)}):new vh({keyType:Dr.create(),valueType:e,typeName:Ue.ZodRecord,...He(t)})}}class t0 extends Qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ie.map)return Ae(r,{code:_e.invalid_type,expected:Ie.map,received:r.parsedType}),je;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,c],l)=>({key:s._parse(new Ur(r,a,r.path,[l,"key"])),value:i._parse(new Ur(r,c,r.path,[l,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return je;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(l.value,u.value)}return{status:t.value,value:a}})}else{const a=new Map;for(const c of o){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return je;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(l.value,u.value)}return{status:t.value,value:a}}}}t0.create=(n,e,t)=>new t0({valueType:e,keyType:n,typeName:Ue.ZodMap,...He(t)});class Ta extends Qe{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ie.set)return Ae(r,{code:_e.invalid_type,expected:Ie.set,received:r.parsedType}),je;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(Ae(r,{code:_e.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(Ae(r,{code:_e.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const i=this._def.valueType;function o(c){const l=new Set;for(const u of c){if(u.status==="aborted")return je;u.status==="dirty"&&t.dirty(),l.add(u.value)}return{status:t.value,value:l}}const a=[...r.data.values()].map((c,l)=>i._parse(new Ur(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,t){return new Ta({...this._def,minSize:{value:e,message:Me.toString(t)}})}max(e,t){return new Ta({...this._def,maxSize:{value:e,message:Me.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ta.create=(n,e)=>new Ta({valueType:n,minSize:null,maxSize:null,typeName:Ue.ZodSet,...He(e)});class Cc extends Qe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.function)return Ae(t,{code:_e.invalid_type,expected:Ie.function,received:t.parsedType}),je;function r(a,c){return Kg({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yg(),il].filter(l=>!!l),issueData:{code:_e.invalid_arguments,argumentsError:c}})}function s(a,c){return Kg({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yg(),il].filter(l=>!!l),issueData:{code:_e.invalid_return_type,returnTypeError:c}})}const i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof ol){const a=this;return Ln(async function(...c){const l=new Qn([]),u=await a._def.args.parseAsync(c,i).catch(p=>{throw l.addIssue(r(c,p)),l}),h=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(h,i).catch(p=>{throw l.addIssue(s(h,p)),l})})}else{const a=this;return Ln(function(...c){const l=a._def.args.safeParse(c,i);if(!l.success)throw new Qn([r(c,l.error)]);const u=Reflect.apply(o,this,l.data),h=a._def.returns.safeParse(u,i);if(!h.success)throw new Qn([s(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Cc({...this._def,args:ds.create(e).rest(ea.create())})}returns(e){return new Cc({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Cc({args:e||ds.create([]).rest(ea.create()),returns:t||ea.create(),typeName:Ue.ZodFunction,...He(r)})}}class xh extends Qe{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}xh.create=(n,e)=>new xh({getter:n,typeName:Ue.ZodLazy,...He(e)});class bh extends Qe{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ae(t,{received:t.data,code:_e.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:e.data}}get value(){return this._def.value}}bh.create=(n,e)=>new bh({value:n,typeName:Ue.ZodLiteral,...He(e)});function uA(n,e){return new Qi({values:n,typeName:Ue.ZodEnum,...He(e)})}class Qi extends Qe{constructor(){super(...arguments),uc.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return Ae(t,{expected:ct.joinValues(r),received:t.parsedType,code:_e.invalid_type}),je}if(dh(this,uc)||aA(this,uc,new Set(this._def.values)),!dh(this,uc).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return Ae(t,{received:t.data,code:_e.invalid_enum_value,options:r}),je}return Ln(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Qi.create(e,{...this._def,...t})}exclude(e,t=this._def){return Qi.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}uc=new WeakMap;Qi.create=uA;class wh extends Qe{constructor(){super(...arguments),fc.set(this,void 0)}_parse(e){const t=ct.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ie.string&&r.parsedType!==Ie.number){const s=ct.objectValues(t);return Ae(r,{expected:ct.joinValues(s),received:r.parsedType,code:_e.invalid_type}),je}if(dh(this,fc)||aA(this,fc,new Set(ct.getValidEnumValues(this._def.values))),!dh(this,fc).has(e.data)){const s=ct.objectValues(t);return Ae(r,{received:r.data,code:_e.invalid_enum_value,options:s}),je}return Ln(e.data)}get enum(){return this._def.values}}fc=new WeakMap;wh.create=(n,e)=>new wh({values:n,typeName:Ue.ZodNativeEnum,...He(e)});class ol extends Qe{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.promise&&t.common.async===!1)return Ae(t,{code:_e.invalid_type,expected:Ie.promise,received:t.parsedType}),je;const r=t.parsedType===Ie.promise?t.data:Promise.resolve(t.data);return Ln(r.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ol.create=(n,e)=>new ol({type:n,typeName:Ue.ZodPromise,...He(e)});class ps extends Qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ue.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{Ae(r,o),o.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return je;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?je:c.status==="dirty"||t.value==="dirty"?lc(c.value):c});{if(t.value==="aborted")return je;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?je:a.status==="dirty"||t.value==="dirty"?lc(a.value):a}}if(s.type==="refinement"){const o=a=>{const c=s.refinement(a,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?je:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?je:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ba(o))return o;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>ba(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:t.value,value:a})):o);ct.assertNever(s)}}ps.create=(n,e,t)=>new ps({schema:n,typeName:Ue.ZodEffects,effect:e,...He(t)});ps.createWithPreprocess=(n,e,t)=>new ps({schema:e,effect:{type:"preprocess",transform:n},typeName:Ue.ZodEffects,...He(t)});class os extends Qe{_parse(e){return this._getType(e)===Ie.undefined?Ln(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}os.create=(n,e)=>new os({innerType:n,typeName:Ue.ZodOptional,...He(e)});class eo extends Qe{_parse(e){return this._getType(e)===Ie.null?Ln(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eo.create=(n,e)=>new eo({innerType:n,typeName:Ue.ZodNullable,...He(e)});class Th extends Qe{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===Ie.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Th.create=(n,e)=>new Th({innerType:n,typeName:Ue.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...He(e)});class Sh extends Qe{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return hh(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Qn(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Qn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Sh.create=(n,e)=>new Sh({innerType:n,typeName:Ue.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...He(e)});class n0 extends Qe{_parse(e){if(this._getType(e)!==Ie.nan){const r=this._getOrReturnCtx(e);return Ae(r,{code:_e.invalid_type,expected:Ie.nan,received:r.parsedType}),je}return{status:"valid",value:e.data}}}n0.create=n=>new n0({typeName:Ue.ZodNaN,...He(n)});class fA extends Qe{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Sd extends Qe{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?je:i.status==="dirty"?(t.dirty(),lc(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?je:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,t){return new Sd({in:e,out:t,typeName:Ue.ZodPipeline})}}class Eh extends Qe{_parse(e){const t=this._def.innerType._parse(e),r=s=>(ba(s)&&(s.value=Object.freeze(s.value)),s);return hh(t)?t.then(s=>r(s)):r(t)}unwrap(){return this._def.innerType}}Eh.create=(n,e)=>new Eh({innerType:n,typeName:Ue.ZodReadonly,...He(e)});Zt.lazycreate;var Ue;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(Ue||(Ue={}));const as=Dr.create;Gi.create;n0.create;Ji.create;ph.create;wa.create;Gg.create;mh.create;gh.create;Jg.create;const Oq=ea.create;si.create;Qg.create;Fr.create;const _r=Zt.create;Zt.strictCreate;yh.create;c_.create;_h.create;ds.create;vh.create;t0.create;Ta.create;Cc.create;xh.create;bh.create;const l_=Qi.create;wh.create;ol.create;ps.create;os.create;eo.create;const r0=ps.createWithPreprocess;Sd.create;const xn={string:n=>Dr.create({...n,coerce:!0}),number:n=>Gi.create({...n,coerce:!0}),boolean:n=>ph.create({...n,coerce:!0}),bigint:n=>Ji.create({...n,coerce:!0}),date:n=>wa.create({...n,coerce:!0})};var kq=Object.defineProperty,Mq=(n,e,t)=>e in n?kq(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Nq=(n,e,t)=>(Mq(n,e+"",t),t);class Dq extends oA{constructor(e){super(),Nq(this,"maxUncompressedSize");const t=e.TileWidth||e.ImageWidth,r=e.TileLength||e.ImageLength,s=e.BitsPerSample[0]/8;this.maxUncompressedSize=t*r*s}async decodeBlock(e){const t=new Uint8Array(e);return(await decompress(t,this.maxUncompressedSize)).buffer}}function Lq(n){if(!Number.isInteger(n))throw Error("Not an integer.");const e=new ArrayBuffer(4);new DataView(e).setInt32(0,n,!1);const r=new Uint8Array(e);return Array.from(r)}function al(n){const e=n[n.length-1];return e===3||e===4}function Ed(n){const e=al(n.shape),[t,r]=n.shape.slice(e?-3:-2);return{height:t,width:r}}const hA="__vivSignalAborted";function Xl({attr:n,...e}){return{...n,...e}}function s0(n){return Array.isArray(n)?n:[n]}const Fq=l_(["XYZCT","XYZTC","XYCTZ","XYCZT","XYTCZ","XYTZC"]),Bq=l_(["int8","int16","int32","uint8","uint16","uint32","float","bit","double","complex","double-complex"]),fm=l_(["Ym","Zm","Em","Pm","Tm","Gm","Mm","km","hm","dam","m","dm","cm","mm","µm","nm","pm","fm","am","zm","ym","Å","thou","li","in","ft","yd","mi","ua","ly","pc","pt","pixel","reference frame"]),Uq=_r({}).extend({attr:_r({ID:as(),SamplesPerPixel:xn.number().optional(),Name:as().optional(),Color:xn.number().transform(Lq).optional()})}).transform(Xl),$q=_r({}).extend({attr:_r({FileName:as()})}).transform(Xl),Vq=_r({UUID:$q.optional()}).extend({attr:_r({IFD:xn.number().default(0),PlaneCount:xn.number().default(1),FirstT:xn.number().optional(),FirstC:xn.number().optional(),FirstZ:xn.number().optional()})}).transform(Xl),jq=_r({Channel:r0(s0,Uq.array()),TiffData:r0(s0,Vq.array()).optional()}).extend({attr:_r({ID:as(),DimensionOrder:Fq,Type:Bq,SizeT:xn.number(),SizeC:xn.number(),SizeZ:xn.number(),SizeY:xn.number(),SizeX:xn.number(),PhysicalSizeX:xn.number().optional(),PhysicalSizeY:xn.number().optional(),PhysicalSizeZ:xn.number().optional(),SignificantBits:xn.number().optional(),PhysicalSizeXUnit:fm.optional().default("µm"),PhysicalSizeYUnit:fm.optional().default("µm"),PhysicalSizeZUnit:fm.optional().default("µm"),BigEndian:as().transform(n=>n.toLowerCase()==="true").optional(),Interleaved:as().transform(n=>n.toLowerCase()==="true").optional()})}).transform(Xl).transform(({Channel:n,...e})=>({Channels:n,...e})),zq=_r({AquisitionDate:as().optional().default(""),Description:Oq().optional().default(""),Pixels:jq}).extend({attr:_r({ID:as(),Name:as().optional()})}).transform(Xl);_r({Image:r0(s0,zq.array())});ms(5,()=>Dq);function Wq(n){return[...Array(n).keys()]}function dA(n,e,t){for(let r=0;r<t;r+=1)n.push(e);return n}function u_(n){const e=Q1[n];if(!e){const t=Object.keys(Q1);throw Error(`Dtype not supported, got ${n}. Must be one of ${t}.`)}return e}function pA({contrastLimits:n=[],channelsVisible:e,domain:t,dtype:r}){const s=(t==null?void 0:t[1])||u_(r).max,i=n.map((c,l)=>e[l]?c:[s,s]),o=JE-i.length;if(o<0)throw Error(`${i.lengths} channels passed in, but only 6 are allowed.`);return dA(i,[s,s],o).reduce((c,l)=>c.concat(l),[])}function Hq(n){var s;const{x:e,y:t,z:r}=((s=n==null?void 0:n.meta)==null?void 0:s.physicalSizes)??{};if(e!=null&&e.size&&(t!=null&&t.size)&&(r!=null&&r.size)){const i=Math.min(r.size,e.size,t.size),o=[e.size/i,t.size/i,r.size/i];return new Je().scale(o)}return new Je().identity()}function Xq(n){const e=new Zy().makeViewport({viewState:n,height:n.height,width:n.width});return[e.unproject([0,0]),e.unproject([e.width,0]),e.unproject([e.width,e.height]),e.unproject([0,e.height])]}const Ah=[1,2,3,4,5,10,20,25,50,100,200,250,500,1e3],Zq=Ah[0],qq=Ah[Ah.length-1],i0=[{symbol:"Y",exponent:24},{symbol:"Z",exponent:21},{symbol:"E",exponent:18},{symbol:"P",exponent:15},{symbol:"T",exponent:12},{symbol:"G",exponent:9},{symbol:"M",exponent:6},{symbol:"k",exponent:3},{symbol:"h",exponent:2},{symbol:"da",exponent:1},{symbol:"",exponent:0},{symbol:"d",exponent:-1},{symbol:"c",exponent:-2},{symbol:"m",exponent:-3},{symbol:"µ",exponent:-6},{symbol:"n",exponent:-9},{symbol:"p",exponent:-12},{symbol:"f",exponent:-15},{symbol:"a",exponent:-18},{symbol:"z",exponent:-21},{symbol:"y",exponent:-24}];function Yq(n,e){if(!e||e==="m")return n;if(e.length>1){let t=e.substring(0,e.length-1);t==="u"&&(t="µ");const r=i0.find(s=>s.symbol===t);if(r)return n*10**r.exponent}throw new Error("Received unknown unit")}function Kq(n){let e=0;(n<Zq||n>qq)&&(e=Math.floor(Math.log10(n)));let t=i0.find(o=>o.exponent%3===0&&o.exponent<=e),r=n/10**t.exponent;r>500&&r<=1e3&&(t=i0.find(o=>o.exponent%3===0&&o.exponent<=e+3),r=n/10**t.exponent);const s=Ah.find(o=>o>r);return[s*10**t.exponent,s,t.symbol]}function Gq(n){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");const e=new Uint8Array(n.length+n.length/3);for(let t=0;t<n.length/3;t+=1)e[t*4]=n[t*3],e[t*4+1]=n[t*3+1],e[t*4+2]=n[t*3+2],e[t*4+3]=255;return e}const rs={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},mA={...jl.defaultProps,pickable:{type:"boolean",value:!0,compare:!0},coordinateSystem:Ve.CARTESIAN},Jq=(n,e)=>{const t=e?"true":"false",r=`vec3(${(e||[0,0,0]).map(s=>String(s/255)).join(",")})`;switch(n){case rs.RGB:return`color[3] = (${t} && (color.rgb == ${r})) ? 0.0 : color.a;`;case rs.WhiteIsZero:return` float value = 1.0 - (color.r / 256.0);
|
|
3457
3457
|
color = vec4(value, value, value, (${t} && vec3(value, value, value) == ${r}) ? 0.0 : color.a);
|
|
3458
3458
|
`;case rs.BlackIsZero:return` float value = (color.r / 256.0);
|
|
3459
3459
|
color = vec4(value, value, value, (${t} && vec3(value, value, value) == ${r}) ? 0.0 : color.a);
|