@atlas-viewer/atlas 2.0.16 → 2.0.17

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.
@@ -1,4 +1,4 @@
1
- "use strict";var t,e;Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=require("react-dom"),n=require("react"),s=require("react-reconciler");function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function o(t){if(t&&t.__esModule)return t;var e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var a=r(i),l=o(n),h=r(n),c=r(s);const d=["onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onScroll","onWheel","onClick","onDragStart","onDragEnd","onDragEnter","onDragExit","onDrag","onDragOver"];function u(){return d.reduce(((t,e)=>(t[e]=[],t)),{})}const p=d.reduce(((t,e)=>(t[e.slice(2).toLowerCase()]=e,t[e]=e,t)),{}),f=(t,e,i)=>{const n=t.length,s=i||g(n);for(let r=0;r<n;r++)s[r]=r%5==0?t[r+1]<e[3]&&t[r+3]>e[1]&&t[r+2]<e[4]&&t[r+4]>e[2]?1:0:t[r];return s};function g(t,e,i){return new Float32Array(t,e,i)}const m=(t,e,i)=>{const n=i||g(9);return n[0]=t[0]*e[0]+t[1]*e[3]+t[2]*e[6],n[1]=t[0]*e[1]+t[1]*e[4]+t[2]*e[7],n[2]=t[0]*e[2]+t[1]*e[5]+t[2]*e[8],n[3]=t[3]*e[0]+t[4]*e[3]+t[5]*e[6],n[4]=t[3]*e[1]+t[4]*e[4]+t[5]*e[7],n[5]=t[3]*e[2]+t[4]*e[5]+t[5]*e[8],n[6]=t[6]*e[0]+t[7]*e[3]+t[8]*e[6],n[7]=t[6]*e[1]+t[7]*e[4]+t[8]*e[7],n[8]=t[6]*e[2]+t[7]*e[5]+t[8]*e[8],n};class v{constructor(t){this.index=0,this.length=t,this.points=g(this.length)}static grid(t=1,e=1){return new v(5*t*e)}static point(t,e){const i=g(5);return i[0]=1,i[1]=t,i[2]=e,i[3]=t,i[4]=e,i}static positionPair(t){const e=g(5);return e[0]=1,e[1]=t.x1,e[2]=t.y1,e[3]=t.x2,e[4]=t.y2,e}static projection(t){return v.singleBox(t.width,t.height,t.x,t.y)}static singleBox(t,e,i=0,n=0){const s=g(5);return s[0]=1,s[1]=i,s[2]=n,s[3]=t+i,s[4]=e+n,s}row(t){return t(this)}addPoints(t,e,i,n){return this.points[this.index]=1,this.points[1+this.index]=t,this.points[2+this.index]=e,this.points[3+this.index]=i,this.points[4+this.index]=n,this.index+=5,this}addBox(t,e,i,n){return this.addPoints(t,e,t+i,e+n),this}build(){return this.points}}const y=(t,e)=>{const i=t.length;for(let n=0;n<i;n++)t[n]=n%5==0?e[6]*t[n+1]+e[7]*t[n+2]+e[8]*t[n]:n%5%2==1?e[0]*t[n]+e[1]*t[n+1]+e[2]:e[3]*t[n-1]+e[4]*t[n]+e[5];return t},w=t=>{const e=g(9);return e[0]=t,e[4]=t,e[8]=1,e},b=(t,e)=>{const i=g(9);return i[0]=1,i[2]=t,i[4]=1,i[5]=e,i[8]=1,i},x=(t,e,i)=>m(b((1-t)*e,(1-t)*i),w(t)),E=(t,e,i)=>{const n=t.length,s=i&&i.length>=n?i.slice(0,n):g(n);for(let r=0;r<n;r++)s[r]=r%5==0?e[6]*t[r+1]+e[7]*t[r+2]+e[8]*t[r]:r%5%2==1?e[0]*t[r]+e[1]*t[r+1]+e[2]:e[3]*t[r-1]+e[4]*t[r]+e[5];return s};let S=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_"),"");class _{constructor(){this.__revision=0,this.__owner={value:void 0},this.__state={},this.scale=1,this.layers=[],this.time=[],this.addEventListener=(t,e,i)=>{const n=p[t];if(!this.eventHandlers[n])throw new Error(`Unknown event ${n}`);-1===this.eventHandlers[n].indexOf(e)&&this.eventHandlers[n].push(e)},this.removeEventListener=(t,e)=>{const i=p[t];this.eventHandlers[i]?-1!==this.eventHandlers[i].indexOf(e)&&(this.eventHandlers[i]=this.eventHandlers[i].filter((t=>t!==e))):console.warn(`Unknown event ${i}`)},this.id=this.__id=S(),this.eventHandlers=u()}get crop(){return this._crop}set crop(t){this._crop=t}getObjectsAt(t){return[]}getAllPointsAt(t,e,i){return[]}getScheduledUpdates(t,e){return[]}dispatchEvent(t,e){const i=this.eventHandlers[t],n=i?i.length:0;let s=!1;if(n)for(let o=0;o<n;o++)try{i[o](e),s=!0}catch(r){console.error(t,r)}return s}get x(){return this.points[1]}get y(){return this.points[2]}get width(){return this.points[3]-this.points[1]}get height(){return this.points[4]-this.points[2]}translate(t,e){y(this.points,b(t,e))}atScale(t){y(this.points,x(t,this.x,this.y)),this.scale*=t}transform(t){y(this.points,t)}applyProps(t){this.__revision++}appendChild(t){}removeChild(t){}insertBefore(t,e){}hideInstance(){}}class T extends _{constructor(t){if(super(),this.type="spacial-content",this.style={opacity:1},t){const e=t.scale||1;this.id=t.id||t.uri,this.uri=t.uri,this.points=v.singleBox(t.width,t.height,t.x,t.y),this.display={x:0,y:0,scale:e,width:t.width/e,height:t.height/e,points:v.singleBox(t.width/e,t.height/e),rotation:null==t?void 0:t.rotation}}else this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:g(5)},this.points=g(5)}applyProps(t){const e=t.display?t.display.width:t.target.width,i=t.target.width/e;if(this.id=t.id||t.uri,this.uri=t.uri,this.points.set(v.singleBox(t.target.width,t.target.height,t.target.x,t.target.y)),t.style&&void 0!==t.style.opacity&&(this.style.opacity=t.style.opacity),t.crop){this.cropData=t.crop;const e=v.singleBox(t.crop.width,t.crop.height,t.crop.x,t.crop.y);y(e,b(-t.crop.x,-t.crop.y)),this.crop?this.crop.set(e):this.crop=g(e)}t.display?(this.display.scale=i,this.display.width=t.display.width,this.display.height=t.display.height,this.display.rotation=t.display.rotation,this.display.points=v.singleBox(t.display.width,t.display.height)):(this.display.scale=i,this.display.width=t.target.width/i,this.display.height=t.target.height/i,this.display.points=v.singleBox(t.target.width/i,t.target.height/i))}getAllPointsAt(t,e,i){return[[this,this.crop||this.points,e]]}static fromSvg(t,e,i,n){return T.fromImage("data:image/svg+xml;base64,"+btoa(t),e,i,n)}static fromImage(t,e,i,n){const s=new T;return s.applyProps({uri:t,id:n,display:i,target:e}),s}getImageUrl(){return this.uri}}class C extends _{constructor(t){if(super(),this.type="spacial-content",this.getTexture=()=>({source:void 0,hash:-1}),t){const e=t.scale||1;this.id=t.id||t.uri,this.uri=t.uri,this.points=v.singleBox(t.width,t.height),this.display={x:0,y:0,scale:e,width:t.width/e,height:t.height/e,points:1!==e?v.singleBox(t.width/e,t.height/e):this.points}}else this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:g(5)},this.points=g(5)}applyProps(t){const e=t.display?t.display.width:t.target.width,i=t.target.width/e;this.id=t.id,this.points.set(v.singleBox(t.target.width,t.target.height)),this.display.scale=i,this.display.width=t.target.width/i,this.display.height=t.target.height/i,this.getTexture=t.getTexture,this.display.points=1!==i?v.singleBox(t.target.width/i,t.target.height/i):this.points}getAllPointsAt(t,e,i){return[[this,this.points,e]]}}function P(t,e){return Math.abs(t-e)}function k(t,e){const i=P(t.x,e.x),n=P(t.y,e.y);return Math.sqrt(Math.pow(i,2)+Math.pow(n,2))}function O(...t){return e=>t.forEach((t=>{return n=e,void("function"==typeof(i=t)?i(n):null!=i&&(i.current=n));var i,n}))}function R(...t){return l.useCallback(O(...t),t)}function A(){return A=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},A.apply(this,arguments)}const I=l.forwardRef(((t,e)=>{const{children:i,...n}=t;return l.Children.toArray(i).some(M)?l.createElement(l.Fragment,null,l.Children.map(i,(t=>M(t)?l.createElement(L,A({},n,{ref:e}),t.props.children):t))):l.createElement(L,A({},n,{ref:e}),i)}));I.displayName="Slot";const L=l.forwardRef(((t,e)=>{const{children:i,...n}=t;return l.isValidElement(i)?l.cloneElement(i,{...z(n,i.props),ref:O(e,i.ref)}):l.Children.count(i)>1?l.Children.only(null):null}));L.displayName="SlotClone";const $=({children:t})=>l.createElement(l.Fragment,null,t);function M(t){return l.isValidElement(t)&&t.type===$}function z(t,e){const i={...e};for(const n in e){const s=t[n],r=e[n];/^on[A-Z]/.test(n)?i[n]=(...t)=>{null==r||r(...t),null==s||s(...t)}:"style"===n?i[n]={...s,...r}:"className"===n&&(i[n]=[s,r].filter(Boolean).join(" "))}return{...t,...i}}const B=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?l.useLayoutEffect:()=>{};var F=function(t,e,i,n){this.name=t,this.fn=e,this.args=i,this.modifiers=n};function D(t,e){return void 0===e&&(e="simple"),"object"==typeof t?t[e]:t}function j(t,e,i){if(t.length){var n=t.shift(),s=j(t,e,i);return n.perform(s,i)}return D(e)}function N(t,e,i){if(t.length){var n=t.shift(),s=N(t,e,i);return n.performAsync(s,i)}return function(t){return Promise.resolve(D(e,"async")(t))}}F.prototype._test=function(t){var e=this.fn;try{j(this.modifiers.slice(),e,this)(t)}catch(i){e=function(){return!1}}try{return j(this.modifiers.slice(),e,this)(t)}catch(n){return!1}},F.prototype._check=function(t){try{j(this.modifiers.slice(),this.fn,this)(t)}catch(e){if(j(this.modifiers.slice(),(function(t){return t}),this)(!1))return}if(!j(this.modifiers.slice(),this.fn,this)(t))throw null},F.prototype._testAsync=function(t){var e=this;return new Promise((function(i,n){N(e.modifiers.slice(),e.fn,e)(t).then((function(e){e?i(t):n(null)})).catch((function(t){return n(t)}))}))};var W=function(t,e,i){this.name=t,this.perform=e,this.performAsync=i},U=function(t){function e(i,n,s,r){for(var o=[],a=arguments.length-4;a-- >0;)o[a]=arguments[a+4];t.call(this,o),t.captureStackTrace&&t.captureStackTrace(this,e),this.rule=i,this.value=n,this.cause=s,this.target=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),H=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=[]),this.chain=t,this.nextRuleModifiers=e};function V(t,e,i,n){if(e.length){var s=e.shift();s._testAsync(t).then((function(){V(t,e,i,n)}),(function(e){n(new U(s,t,e))}))}else i(t)}H.prototype._applyRule=function(t,e){var i=this;return function(){for(var n=[],s=arguments.length;s--;)n[s]=arguments[s];return i.chain.push(new F(e,t.apply(i,n),n,i.nextRuleModifiers)),i.nextRuleModifiers=[],i}},H.prototype._applyModifier=function(t,e){return this.nextRuleModifiers.push(new W(e,t.simple,t.async)),this},H.prototype._clone=function(){return new H(this.chain.slice(),this.nextRuleModifiers.slice())},H.prototype.test=function(t){return this.chain.every((function(e){return e._test(t)}))},H.prototype.testAll=function(t){var e=[];return this.chain.forEach((function(i){try{i._check(t)}catch(n){e.push(new U(i,t,n))}})),e},H.prototype.check=function(t){this.chain.forEach((function(e){try{e._check(t)}catch(i){throw new U(e,t,i)}}))},H.prototype.testAsync=function(t){var e=this;return new Promise((function(i,n){V(t,e.chain.slice(),i,n)}))};var G=function(t,e){return!(!e||"string"!=typeof t||0!==t.trim().length)||null==t};function X(){return"undefined"!=typeof Proxy?K(new H):Q(new H)}var Y={};function K(t){return new Proxy(t,{get:function(e,i){if(i in e)return e[i];var n=K(t._clone());return i in q?n._applyModifier(q[i],i):i in Y?n._applyRule(Y[i],i):i in tt?n._applyRule(tt[i],i):void 0}})}function Q(t){var e=function(t,e){return Object.keys(t).forEach((function(i){e[i]=function(){for(var n=[],s=arguments.length;s--;)n[s]=arguments[s];var r=Q(e._clone()),o=r._applyRule(t[i],i).apply(void 0,n);return o}})),e},i=e(tt,t),n=e(Y,i);return Object.keys(q).forEach((function(t){Object.defineProperty(n,t,{get:function(){return Q(n._clone())._applyModifier(q[t],t)}})})),n}X.extend=function(t){Object.assign(Y,t)},X.clearCustomRules=function(){Y={}};var q={not:{simple:function(t){return function(e){return!t(e)}},async:function(t){return function(e){return Promise.resolve(t(e)).then((function(t){return!t})).catch((function(){return!0}))}}},some:{simple:function(t){return function(e){return J(e).some((function(e){try{return t(e)}catch(i){return!1}}))}},async:function(t){return function(e){return Promise.all(J(e).map((function(e){try{return t(e).catch((function(){return!1}))}catch(i){return!1}}))).then((function(t){return t.some(Boolean)}))}}},every:{simple:function(t){return function(e){return!1!==e&&J(e).every(t)}},async:function(t){return function(e){return Promise.all(J(e).map(t)).then((function(t){return t.every(Boolean)}))}}},strict:{simple:function(t,e){return function(i){return Z(e)&&i&&"object"==typeof i?Object.keys(e.args[0]).length===Object.keys(i).length&&t(i):t(i)}},async:function(t,e){return function(i){return Promise.resolve(t(i)).then((function(t){return Z(e)&&i&&"object"==typeof i?Object.keys(e.args[0]).length===Object.keys(i).length&&t:t})).catch((function(){return!1}))}}}};function Z(t){return t&&"schema"===t.name&&t.args.length>0&&"object"==typeof t.args[0]}function J(t){return"string"==typeof t?t.split(""):t}var tt={equal:function(t){return function(e){return e==t}},exact:function(t){return function(e){return e===t}},number:function(t){return void 0===t&&(t=!0),function(e){return"number"==typeof e&&(t||isFinite(e))}},integer:function(){return function(t){return(Number.isInteger||it)(t)}},numeric:function(){return function(t){return!isNaN(parseFloat(t))&&isFinite(t)}},string:function(){return et("string")},boolean:function(){return et("boolean")},undefined:function(){return et("undefined")},null:function(){return et("null")},array:function(){return et("array")},object:function(){return et("object")},instanceOf:function(t){return function(e){return e instanceof t}},pattern:function(t){return function(e){return t.test(e)}},lowercase:function(){return function(t){return"boolean"==typeof t||t===t.toLowerCase()&&""!==t.trim()}},uppercase:function(){return function(t){return t===t.toUpperCase()&&""!==t.trim()}},vowel:function(){return function(t){return/^[aeiou]+$/i.test(t)}},consonant:function(){return function(t){return/^(?=[^aeiou])([a-z]+)$/i.test(t)}},first:function(t){return function(e){return e[0]==t}},last:function(t){return function(e){return e[e.length-1]==t}},empty:function(){return function(t){return 0===t.length}},length:function(t,e){return function(i){return i.length>=t&&i.length<=(e||t)}},minLength:function(t){return function(e){return e.length>=t}},maxLength:function(t){return function(e){return e.length<=t}},negative:function(){return function(t){return t<0}},positive:function(){return function(t){return t>=0}},between:function(t,e){return function(i){return i>=t&&i<=e}},range:function(t,e){return function(i){return i>=t&&i<=e}},lessThan:function(t){return function(e){return e<t}},lessThanOrEqual:function(t){return function(e){return e<=t}},greaterThan:function(t){return function(e){return e>t}},greaterThanOrEqual:function(t){return function(e){return e>=t}},even:function(){return function(t){return t%2==0}},odd:function(){return function(t){return t%2!=0}},includes:function(t){return function(e){return~e.indexOf(t)}},schema:function(t){return function(t){return{simple:function(e){var i=[];if(Object.keys(t).forEach((function(n){var s=t[n];try{s.check((e||{})[n])}catch(r){r.target=n,i.push(r)}})),i.length>0)throw i;return!0},async:function(e){var i=[],n=Object.keys(t).map((function(n){return t[n].testAsync((e||{})[n]).catch((function(t){t.target=n,i.push(t)}))}));return Promise.all(n).then((function(){if(i.length>0)throw i;return!0}))}}}(t)},passesAnyOf:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e){return t.some((function(t){return t.test(e)}))}},optional:function(t,e){return void 0===e&&(e=!1),{simple:function(i){return G(i,e)||void 0===t.check(i)},async:function(i){return G(i,e)||t.testAsync(i)}}}};function et(t){return function(e){return Array.isArray(e)&&"array"===t||null===e&&"null"===t||typeof e===t}}function it(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}var nt="colors",st="sizes",rt="space",ot={gap:rt,gridGap:rt,columnGap:rt,gridColumnGap:rt,rowGap:rt,gridRowGap:rt,inset:rt,insetBlock:rt,insetBlockEnd:rt,insetBlockStart:rt,insetInline:rt,insetInlineEnd:rt,insetInlineStart:rt,margin:rt,marginTop:rt,marginRight:rt,marginBottom:rt,marginLeft:rt,marginBlock:rt,marginBlockEnd:rt,marginBlockStart:rt,marginInline:rt,marginInlineEnd:rt,marginInlineStart:rt,padding:rt,paddingTop:rt,paddingRight:rt,paddingBottom:rt,paddingLeft:rt,paddingBlock:rt,paddingBlockEnd:rt,paddingBlockStart:rt,paddingInline:rt,paddingInlineEnd:rt,paddingInlineStart:rt,top:rt,right:rt,bottom:rt,left:rt,scrollMargin:rt,scrollMarginTop:rt,scrollMarginRight:rt,scrollMarginBottom:rt,scrollMarginLeft:rt,scrollMarginX:rt,scrollMarginY:rt,scrollMarginBlock:rt,scrollMarginBlockEnd:rt,scrollMarginBlockStart:rt,scrollMarginInline:rt,scrollMarginInlineEnd:rt,scrollMarginInlineStart:rt,scrollPadding:rt,scrollPaddingTop:rt,scrollPaddingRight:rt,scrollPaddingBottom:rt,scrollPaddingLeft:rt,scrollPaddingX:rt,scrollPaddingY:rt,scrollPaddingBlock:rt,scrollPaddingBlockEnd:rt,scrollPaddingBlockStart:rt,scrollPaddingInline:rt,scrollPaddingInlineEnd:rt,scrollPaddingInlineStart:rt,fontSize:"fontSizes",background:nt,backgroundColor:nt,backgroundImage:nt,borderImage:nt,border:nt,borderBlock:nt,borderBlockEnd:nt,borderBlockStart:nt,borderBottom:nt,borderBottomColor:nt,borderColor:nt,borderInline:nt,borderInlineEnd:nt,borderInlineStart:nt,borderLeft:nt,borderLeftColor:nt,borderRight:nt,borderRightColor:nt,borderTop:nt,borderTopColor:nt,caretColor:nt,color:nt,columnRuleColor:nt,fill:nt,outline:nt,outlineColor:nt,stroke:nt,textDecorationColor:nt,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:st,minBlockSize:st,maxBlockSize:st,inlineSize:st,minInlineSize:st,maxInlineSize:st,width:st,minWidth:st,maxWidth:st,height:st,minHeight:st,maxHeight:st,flexBasis:st,gridTemplateColumns:st,gridTemplateRows:st,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderLeftWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",transition:"transitions",zIndex:"zIndices"},at=(t,e)=>"function"==typeof e?{"()":Function.prototype.toString.call(e)}:e,lt=()=>{const t=Object.create(null);return(e,i,...n)=>{const s=(r=e,JSON.stringify(r,at));var r;return s in t?t[s]:t[s]=i(e,...n)}},ht=Symbol.for("sxs.internal"),ct=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),dt=t=>{for(const e in t)return!0;return!1},{hasOwnProperty:ut}=Object.prototype,pt=t=>t.includes("-")?t:t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())),ft=/\s+(?![^()]*\))/,gt=t=>e=>t(..."string"==typeof e?String(e).split(ft):[e]),mt={appearance:t=>({WebkitAppearance:t,appearance:t}),backfaceVisibility:t=>({WebkitBackfaceVisibility:t,backfaceVisibility:t}),backdropFilter:t=>({WebkitBackdropFilter:t,backdropFilter:t}),backgroundClip:t=>({WebkitBackgroundClip:t,backgroundClip:t}),boxDecorationBreak:t=>({WebkitBoxDecorationBreak:t,boxDecorationBreak:t}),clipPath:t=>({WebkitClipPath:t,clipPath:t}),content:t=>({content:t.includes('"')||t.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(t)?t:`"${t}"`}),hyphens:t=>({WebkitHyphens:t,hyphens:t}),maskImage:t=>({WebkitMaskImage:t,maskImage:t}),maskSize:t=>({WebkitMaskSize:t,maskSize:t}),tabSize:t=>({MozTabSize:t,tabSize:t}),textSizeAdjust:t=>({WebkitTextSizeAdjust:t,textSizeAdjust:t}),userSelect:t=>({WebkitUserSelect:t,userSelect:t}),marginBlock:gt(((t,e)=>({marginBlockStart:t,marginBlockEnd:e||t}))),marginInline:gt(((t,e)=>({marginInlineStart:t,marginInlineEnd:e||t}))),maxSize:gt(((t,e)=>({maxBlockSize:t,maxInlineSize:e||t}))),minSize:gt(((t,e)=>({minBlockSize:t,minInlineSize:e||t}))),paddingBlock:gt(((t,e)=>({paddingBlockStart:t,paddingBlockEnd:e||t}))),paddingInline:gt(((t,e)=>({paddingInlineStart:t,paddingInlineEnd:e||t})))},vt=/([\d.]+)([^]*)/,yt=(t,e)=>t.length?t.reduce(((t,i)=>(t.push(...e.map((t=>t.includes("&")?t.replace(/&/g,/[ +>|~]/.test(i)&&/&.*&/.test(t)?`:is(${i})`:i):i+" "+t))),t)),[]):e,wt=(t,e)=>t in bt&&"string"==typeof e?e.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,((e,i,n,s)=>i+("stretch"===n?`-moz-available${s};${pt(t)}:${i}-webkit-fill-available`:`-moz-fit-content${s};${pt(t)}:${i}fit-content`)+s)):String(e),bt={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},xt=t=>t?t+"-":"",Et=(t,e,i)=>t.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,((t,n,s,r,o)=>"$"==r==!!s?t:(n||"--"==r?"calc(":"")+"var(--"+("$"===r?xt(e)+(o.includes("$")?"":xt(i))+o.replace(/\$/g,"-"):o)+")"+(n||"--"==r?"*"+(n||"")+(s||"1")+")":""))),St=/\s*,\s*(?![^()]*\))/,_t=Object.prototype.toString,Tt=(t,e,i,n,s)=>{let r,o,a;const l=(t,e,i)=>{let h,c;const d=t=>{for(h in t){const f=64===h.charCodeAt(0),g=f&&Array.isArray(t[h])?t[h]:[t[h]];for(c of g){const t=/[A-Z]/.test(p=h)?p:p.replace(/-[^]/g,(t=>t[1].toUpperCase())),g="object"==typeof c&&c&&c.toString===_t&&(!n.utils[t]||!e.length);if(t in n.utils&&!g){const e=n.utils[t];if(e!==o){o=e,d(e(c)),o=null;continue}}else if(t in mt){const e=mt[t];if(e!==a){a=e,d(e(c)),a=null;continue}}if(f&&(u=h.slice(1)in n.media?"@media "+n.media[h.slice(1)]:h,h=u.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,((t,e,i,n,s,r)=>{const o=vt.test(e),a=.0625*(o?-1:1),[l,h]=o?[n,e]:[e,n];return"("+("="===i[0]?"":">"===i[0]===o?"max-":"min-")+l+":"+("="!==i[0]&&1===i.length?h.replace(vt,((t,e,n)=>Number(e)+a*(">"===i?1:-1)+n)):h)+(s?") and ("+(">"===s[0]?"min-":"max-")+l+":"+(1===s.length?r.replace(vt,((t,e,i)=>Number(e)+a*(">"===s?-1:1)+i)):r):"")+")"}))),g){const t=f?i.concat(h):[...i],n=f?[...e]:yt(e,h.split(St));void 0!==r&&s(Ct(...r)),r=void 0,l(c,n,t)}else void 0===r&&(r=[[],e,i]),h=f||36!==h.charCodeAt(0)?h:`--${xt(n.prefix)}${h.slice(1).replace(/\$/g,"-")}`,c=g?c:"number"==typeof c?c&&t in Pt?String(c)+"px":String(c):Et(wt(t,null==c?"":c),n.prefix,n.themeMap[t]),r[0].push(`${f?`${h} `:`${pt(h)}:`}${c}`)}}var u,p};d(t),void 0!==r&&s(Ct(...r)),r=void 0};l(t,e,i)},Ct=(t,e,i)=>`${i.map((t=>`${t}{`)).join("")}${e.length?`${e.join(",")}{`:""}${t.join(";")}${e.length?"}":""}${Array(i.length?i.length+1:0).join("}")}`,Pt={animationDelay:1,animationDuration:1,backgroundSize:1,blockSize:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockEndWidth:1,borderBlockStart:1,borderBlockStartWidth:1,borderBlockWidth:1,borderBottom:1,borderBottomLeftRadius:1,borderBottomRightRadius:1,borderBottomWidth:1,borderEndEndRadius:1,borderEndStartRadius:1,borderInlineEnd:1,borderInlineEndWidth:1,borderInlineStart:1,borderInlineStartWidth:1,borderInlineWidth:1,borderLeft:1,borderLeftWidth:1,borderRadius:1,borderRight:1,borderRightWidth:1,borderSpacing:1,borderStartEndRadius:1,borderStartStartRadius:1,borderTop:1,borderTopLeftRadius:1,borderTopRightRadius:1,borderTopWidth:1,borderWidth:1,bottom:1,columnGap:1,columnRule:1,columnRuleWidth:1,columnWidth:1,containIntrinsicSize:1,flexBasis:1,fontSize:1,gap:1,gridAutoColumns:1,gridAutoRows:1,gridTemplateColumns:1,gridTemplateRows:1,height:1,inlineSize:1,inset:1,insetBlock:1,insetBlockEnd:1,insetBlockStart:1,insetInline:1,insetInlineEnd:1,insetInlineStart:1,left:1,letterSpacing:1,margin:1,marginBlock:1,marginBlockEnd:1,marginBlockStart:1,marginBottom:1,marginInline:1,marginInlineEnd:1,marginInlineStart:1,marginLeft:1,marginRight:1,marginTop:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,offsetDistance:1,offsetRotate:1,outline:1,outlineOffset:1,outlineWidth:1,overflowClipMargin:1,padding:1,paddingBlock:1,paddingBlockEnd:1,paddingBlockStart:1,paddingBottom:1,paddingInline:1,paddingInlineEnd:1,paddingInlineStart:1,paddingLeft:1,paddingRight:1,paddingTop:1,perspective:1,right:1,rowGap:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginBlockEnd:1,scrollMarginBlockStart:1,scrollMarginBottom:1,scrollMarginInline:1,scrollMarginInlineEnd:1,scrollMarginInlineStart:1,scrollMarginLeft:1,scrollMarginRight:1,scrollMarginTop:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingBlockEnd:1,scrollPaddingBlockStart:1,scrollPaddingBottom:1,scrollPaddingInline:1,scrollPaddingInlineEnd:1,scrollPaddingInlineStart:1,scrollPaddingLeft:1,scrollPaddingRight:1,scrollPaddingTop:1,shapeMargin:1,textDecoration:1,textDecorationThickness:1,textIndent:1,textUnderlineOffset:1,top:1,transitionDelay:1,transitionDuration:1,verticalAlign:1,width:1,wordSpacing:1},kt=t=>String.fromCharCode(t+(t>25?39:97)),Ot=t=>(t=>{let e,i="";for(e=Math.abs(t);e>52;e=e/52|0)i=kt(e%52)+i;return kt(e%52)+i})(((t,e)=>{let i=e.length;for(;i;)t=33*t^e.charCodeAt(--i);return t})(5381,JSON.stringify(t))>>>0),Rt=["themed","global","styled","onevar","resonevar","allvar","inline"],At=t=>{if(t.href&&!t.href.startsWith(location.origin))return!1;try{return!!t.cssRules}catch(e){return!1}},It=t=>{let e;const i=()=>{const{cssRules:t}=e.sheet;return[].map.call(t,((i,n)=>{const{cssText:s}=i;let r="";if(s.startsWith("--sxs"))return"";if(t[n-1]&&(r=t[n-1].cssText).startsWith("--sxs")){if(!i.cssRules.length)return"";for(const t in e.rules)if(e.rules[t].group===i)return`--sxs{--sxs:${[...e.rules[t].cache].join(" ")}}${s}`;return i.cssRules.length?`${r}${s}`:""}return s})).join("")},n=()=>{if(e){const{rules:t,sheet:i}=e;if(!i.deleteRule){for(;3===Object(Object(i.cssRules)[0]).type;)i.cssRules.splice(0,1);i.cssRules=[]}for(const e in t)delete t[e]}const s=Object(t).styleSheets||[];for(const t of s)if(At(t)){for(let s=0,r=t.cssRules;r[s];++s){const o=Object(r[s]);if(1!==o.type)continue;const a=Object(r[s+1]);if(4!==a.type)continue;++s;const{cssText:l}=o;if(!l.startsWith("--sxs"))continue;const h=l.slice(14,-3).trim().split(/\s+/),c=Rt[h[0]];c&&(e||(e={sheet:t,reset:n,rules:{},toString:i}),e.rules[c]={group:a,index:s,cache:new Set(h)})}if(e)break}if(!e){const s=(t,e)=>({type:e,cssRules:[],insertRule(t,e){this.cssRules.splice(e,0,s(t,{import:3,undefined:1}[(t.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return"@media{}"===t?`@media{${[].map.call(this.cssRules,(t=>t.cssText)).join("")}}`:t}});e={sheet:t?(t.head||t).appendChild(document.createElement("style")).sheet:s("","text/css"),rules:{},reset:n,toString:i}}const{sheet:r,rules:o}=e;for(let t=Rt.length-1;t>=0;--t){const e=Rt[t];if(!o[e]){const i=Rt[t+1],n=o[i]?o[i].index:r.cssRules.length;r.insertRule("@media{}",n),r.insertRule(`--sxs{--sxs:${t}}`,n),o[e]={group:r.cssRules[n+1],index:n,cache:new Set([t])}}Lt(o[e])}};return n(),e},Lt=t=>{const e=t.group;let i=e.cssRules.length;t.apply=t=>{try{e.insertRule(t,i),++i}catch(n){}}},$t=Symbol(),Mt=lt(),zt=(t,e)=>Mt(t,(()=>(...i)=>{let n={type:null,composers:new Set};for(const e of i)if(null!=e)if(e[ht]){null==n.type&&(n.type=e[ht].type);for(const t of e[ht].composers)n.composers.add(t)}else e.constructor!==Object||e.$$typeof?null==n.type&&(n.type=e):n.composers.add(Bt(e,t));return null==n.type&&(n.type="span"),n.composers.size||n.composers.add(["PJLV",{},[],[],{},[]]),Ft(t,n,e)})),Bt=({variants:t,compoundVariants:e,defaultVariants:i,...n},s)=>{const r=`${xt(s.prefix)}c-${Ot(n)}`,o=[],a=[],l=Object.create(null),h=[];for(const u in i)l[u]=String(i[u]);if("object"==typeof t&&t)for(const u in t){c=l,d=u,ut.call(c,d)||(l[u]="undefined");const e=t[u];for(const t in e){const i={[u]:String(t)};"undefined"===String(t)&&h.push(u);const n=e[t],s=[i,n,!dt(n)];o.push(s)}}var c,d;if("object"==typeof e&&e)for(const u of e){let{css:t,...e}=u;t="object"==typeof t&&t||{};for(const n in e)e[n]=String(e[n]);const i=[e,t,!dt(t)];a.push(i)}return[r,n,o,a,l,h]},Ft=(t,e,i)=>{const[n,s,r,o]=Dt(e.composers),a="function"==typeof e.type||e.type.$$typeof?(t=>{function e(){for(let i=0;i<e[$t].length;i++){const[n,s]=e[$t][i];t.rules[n].apply(s)}return e[$t]=[],null}return e[$t]=[],e.rules={},Rt.forEach((t=>e.rules[t]={apply:i=>e[$t].push([t,i])})),e})(i):null,l=(a||i).rules,h=`.${n}${s.length>1?`:where(.${s.slice(1).join(".")})`:""}`,c=c=>{c="object"==typeof c&&c||Nt;const{css:d,...u}=c,p={};for(const t in r)if(delete u[t],t in c){let e=c[t];"object"==typeof e&&e?p[t]={"@initial":r[t],...e}:(e=String(e),p[t]="undefined"!==e||o.has(t)?e:r[t])}else p[t]=r[t];const f=new Set([...s]);for(const[n,s,r,o]of e.composers){i.rules.styled.cache.has(n)||(i.rules.styled.cache.add(n),Tt(s,[`.${n}`],[],t,(t=>{l.styled.apply(t)})));const e=jt(r,p,t.media),a=jt(o,p,t.media,!0);for(const s of e)if(void 0!==s)for(const[e,r,o]of s){const s=`${n}-${Ot(r)}-${e}`;f.add(s);const a=(o?i.rules.resonevar:i.rules.onevar).cache,h=o?l.resonevar:l.onevar;a.has(s)||(a.add(s),Tt(r,[`.${s}`],[],t,(t=>{h.apply(t)})))}for(const s of a)if(void 0!==s)for(const[e,r]of s){const s=`${n}-${Ot(r)}-${e}`;f.add(s),i.rules.allvar.cache.has(s)||(i.rules.allvar.cache.add(s),Tt(r,[`.${s}`],[],t,(t=>{l.allvar.apply(t)})))}}if("object"==typeof d&&d){const e=`${n}-i${Ot(d)}-css`;f.add(e),i.rules.inline.cache.has(e)||(i.rules.inline.cache.add(e),Tt(d,[`.${e}`],[],t,(t=>{l.inline.apply(t)})))}for(const t of String(c.className||"").trim().split(/\s+/))t&&f.add(t);const g=u.className=[...f].join(" ");return{type:e.type,className:g,selector:h,props:u,toString:()=>g,deferredInjector:a}};return ct(c,{className:n,selector:h,[ht]:e,toString:()=>(i.rules.styled.cache.has(n)||c(),n)})},Dt=t=>{let e="";const i=[],n={},s=[];for(const[r,,,,o,a]of t){""===e&&(e=r),i.push(r),s.push(...a);for(const t in o){const e=o[t];(void 0===n[t]||"undefined"!==e||a.includes(e))&&(n[t]=e)}}return[e,i,n,new Set(s)]},jt=(t,e,i,n)=>{const s=[];t:for(let[r,o,a]of t){if(a)continue;let t,l=0,h=!1;for(t in r){const n=r[t];let s=e[t];if(s!==n){if("object"!=typeof s||!s)continue t;{let t,e,r=0;for(const o in s){if(n===String(s[o])){if("@initial"!==o){const t=o.slice(1);(e=e||[]).push(t in i?i[t]:o.replace(/^@media ?/,"")),h=!0}l+=r,t=!0}++r}if(e&&e.length&&(o={["@media "+e.join(", ")]:o}),!t)continue t}}}(s[l]=s[l]||[]).push([n?"cv":`${t}-${r[t]}`,o,h])}return s},Nt={},Wt=lt(),Ut=(t,e)=>Wt(t,(()=>(...i)=>{const n=()=>{for(let n of i){n="object"==typeof n&&n||{};let i=Ot(n);if(!e.rules.global.cache.has(i)){if(e.rules.global.cache.add(i),"@import"in n){let t=[].indexOf.call(e.sheet.cssRules,e.rules.themed.group)-1;for(let i of[].concat(n["@import"]))i=i.includes('"')||i.includes("'")?i:`"${i}"`,e.sheet.insertRule(`@import ${i};`,t++);delete n["@import"]}Tt(n,[],[],t,(t=>{e.rules.global.apply(t)}))}}return""};return ct(n,{toString:n})})),Ht=lt(),Vt=(t,e)=>Ht(t,(()=>i=>{const n=`${xt(t.prefix)}k-${Ot(i)}`,s=()=>{if(!e.rules.global.cache.has(n)){e.rules.global.cache.add(n);const s=[];Tt(i,[],[],t,(t=>s.push(t)));const r=`@keyframes ${n}{${s.join("")}}`;e.rules.global.apply(r)}return n};return ct(s,{get name(){return s()},toString:s})})),Gt=class{constructor(t,e,i,n){this.token=null==t?"":String(t),this.value=null==e?"":String(e),this.scale=null==i?"":String(i),this.prefix=null==n?"":String(n)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+xt(this.prefix)+xt(this.scale)+this.token}toString(){return this.computedValue}},Xt=lt(),Yt=(t,e)=>Xt(t,(()=>(i,n)=>{n="object"==typeof i&&i||Object(n);const s=`.${i=(i="string"==typeof i?i:"")||`${xt(t.prefix)}t-${Ot(n)}`}`,r={},o=[];for(const e in n){r[e]={};for(const i in n[e]){const s=`--${xt(t.prefix)}${e}-${i}`,a=Et(String(n[e][i]),t.prefix,e);r[e][i]=new Gt(i,a,e,t.prefix),o.push(`${s}:${a}`)}}const a=()=>{if(o.length&&!e.rules.themed.cache.has(i)){e.rules.themed.cache.add(i);const s=`${n===t.theme?":root,":""}.${i}{${o.join(";")}}`;e.rules.themed.apply(s)}return i};return{...r,get className(){return a()},selector:s,toString:a}})),Kt=lt(),Qt=lt();const qt={toVector:(t,e)=>(void 0===t&&(t=e),Array.isArray(t)?t:[t,t]),add:(t,e)=>[t[0]+e[0],t[1]+e[1]],sub:(t,e)=>[t[0]-e[0],t[1]-e[1]],addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Zt(t,e,i){return 0===e||Math.abs(e)===1/0?Math.pow(t,5*i):t*e*i/(e+i*t)}function Jt(t,e,i,n=.15){return 0===n?function(t,e,i){return Math.max(e,Math.min(t,i))}(t,e,i):t<e?-Zt(e-t,i-e,n)+e:t>i?+Zt(t-i,i-e,n)+i:t}function te(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function ee(t,e,i){return(e=te(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ie(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function ne(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ie(Object(i),!0).forEach((function(e){ee(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ie(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}const se={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function re(t){return t?t[0].toUpperCase()+t.slice(1):""}const oe=["enter","leave"];function ae(t,e="",i=!1){const n=se[t],s=n&&n[e]||e;return"on"+re(t)+re(s)+(function(t=!1,e){return t&&!oe.includes(e)}(i,s)?"Capture":"")}const le=["gotpointercapture","lostpointercapture"];function he(t){let e=t.substring(2).toLowerCase();const i=!!~e.indexOf("passive");i&&(e=e.replace("passive",""));const n=le.includes(e)?"capturecapture":"capture",s=!!~e.indexOf(n);return s&&(e=e.replace("capture","")),{device:e,capture:s,passive:i}}function ce(t){return"touches"in t}function de(t){return ce(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function ue(t){return ce(t)?function(t){return"touchend"===t.type||"touchcancel"===t.type?t.changedTouches:t.targetTouches}(t)[0]:t}function pe(t){return function(t){return Array.from(t.touches).filter((e=>{var i,n;return e.target===t.currentTarget||(null===(i=t.currentTarget)||void 0===i||null===(n=i.contains)||void 0===n?void 0:n.call(i,e.target))}))}(t).map((t=>t.identifier))}function fe(t){const e=ue(t);return ce(t)?e.identifier:e.pointerId}function ge(t){const e=ue(t);return[e.clientX,e.clientY]}function me(t,...e){return"function"==typeof t?t(...e):t}function ve(){}function ye(...t){return 0===t.length?ve:1===t.length?t[0]:function(){let e;for(const i of t)e=i.apply(this,arguments)||e;return e}}function we(t,e){return Object.assign({},e,t||{})}const be=t=>t,xe={enabled:(t=!0)=>t,eventOptions:(t,e,i)=>ne(ne({},i.shared.eventOptions),t),preventDefault:(t=!1)=>t,triggerAllEvents:(t=!1)=>t,rubberband(t=0){switch(t){case!0:return[.15,.15];case!1:return[0,0];default:return qt.toVector(t)}},from:t=>"function"==typeof t?t:null!=t?qt.toVector(t):void 0,transform(t,e,i){const n=t||i.shared.transform;return this.hasCustomTransform=!!n,n||be},threshold:t=>qt.toVector(t,0)},Ee=ne(ne({},xe),{},{axis(t,e,{axis:i}){if(this.lockDirection="lock"===i,!this.lockDirection)return i},axisThreshold:(t=0)=>t,bounds(t={}){if("function"==typeof t)return e=>Ee.bounds(t(e));if("current"in t)return()=>t.current;if("function"==typeof HTMLElement&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:i=1/0,top:n=-1/0,bottom:s=1/0}=t;return[[e,i],[n,s]]}}),Se={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};const _e="undefined"!=typeof window&&window.document&&window.document.createElement;function Te(){return _e&&"ontouchstart"in window||_e&&window.navigator.maxTouchPoints>1}const Ce={isBrowser:_e,gesture:function(){try{return"constructor"in GestureEvent}catch(t){return!1}}(),touch:Te(),touchscreen:Te(),pointer:_e&&"onpointerdown"in window,pointerLock:_e&&"exitPointerLock"in window.document},Pe={mouse:0,touch:0,pen:8},ke=ne(ne({},Ee),{},{device(t,e,{pointer:{touch:i=!1,lock:n=!1,mouse:s=!1}={}}){return this.pointerLock=n&&Ce.pointerLock,Ce.touch&&i?"touch":this.pointerLock?"mouse":Ce.pointer&&!s?"pointer":Ce.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:i}){if(this.preventScrollDelay="number"==typeof i?i:i||void 0===i&&t?250:void 0,Ce.touchscreen&&!1!==i)return t||(void 0!==i?"y":void 0)},pointerCapture(t,e,{pointer:{capture:i=!0,buttons:n=1,keys:s=!0}={}}){return this.pointerButtons=n,this.keys=s,!this.pointerLock&&"pointer"===this.device&&i},threshold(t,e,{filterTaps:i=!1,tapsThreshold:n=3,axis:s}){const r=qt.toVector(t,i?n:s?1:0);return this.filterTaps=i,this.tapsThreshold=n,r},swipe({velocity:t=.5,distance:e=50,duration:i=250}={}){return{velocity:this.transform(qt.toVector(t)),distance:this.transform(qt.toVector(e)),duration:i}},delay(t=0){switch(t){case!0:return 180;case!1:return 0;default:return t}},axisThreshold:t=>t?ne(ne({},Pe),t):Pe,keyboardDisplacement:(t=10)=>t});ne(ne({},xe),{},{device(t,e,{shared:i,pointer:{touch:n=!1}={}}){if(i.target&&!Ce.touch&&Ce.gesture)return"gesture";if(Ce.touch&&n)return"touch";if(Ce.touchscreen){if(Ce.pointer)return"pointer";if(Ce.touch)return"touch"}},bounds(t,e,{scaleBounds:i={},angleBounds:n={}}){const s=t=>{const e=we(me(i,t),{min:-1/0,max:1/0});return[e.min,e.max]},r=t=>{const e=we(me(n,t),{min:-1/0,max:1/0});return[e.min,e.max]};return"function"!=typeof i&&"function"!=typeof n?[s(),r()]:t=>[s(t),r(t)]},threshold(t,e,i){this.lockDirection="lock"===i.axis;return qt.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey:t=>void 0===t?"ctrlKey":t,pinchOnWheel:(t=!0)=>t}),ne(ne({},Ee),{},{mouseOnly:(t=!0)=>t}),ne(ne({},Ee),{},{mouseOnly:(t=!0)=>t});const Oe=new Map,Re=new Map;const Ae={key:"drag",engine:class extends class extends class{constructor(t,e,i){this.ctrl=t,this.args=e,this.key=i,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(t){this.ctrl.state[this.key]=t}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:t,shared:e,ingKey:i,args:n}=this;e[i]=t._active=t.active=t._blocked=t._force=!1,t._step=[!1,!1],t.intentional=!1,t._movement=[0,0],t._distance=[0,0],t._direction=[0,0],t._delta=[0,0],t._bounds=[[-1/0,1/0],[-1/0,1/0]],t.args=n,t.axis=void 0,t.memo=void 0,t.elapsedTime=0,t.direction=[0,0],t.distance=[0,0],t.overflow=[0,0],t._movementBound=[!1,!1],t.velocity=[0,0],t.movement=[0,0],t.delta=[0,0],t.timeStamp=0}start(t){const e=this.state,i=this.config;e._active||(this.reset(),this.computeInitial(),e._active=!0,e.target=t.target,e.currentTarget=t.currentTarget,e.lastOffset=i.from?me(i.from,e):e.offset,e.offset=e.lastOffset),e.startTime=e.timeStamp=t.timeStamp}computeValues(t){const e=this.state;e._values=t,e.values=this.config.transform(t)}computeInitial(){const t=this.state;t._initial=t._values,t.initial=t.values}compute(t){const{state:e,config:i,shared:n}=this;e.args=this.args;let s=0;if(t&&(e.event=t,i.preventDefault&&t.cancelable&&e.event.preventDefault(),e.type=t.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,function(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:i,altKey:n,metaKey:s,ctrlKey:r}=t;Object.assign(e,{shiftKey:i,altKey:n,metaKey:s,ctrlKey:r})}return e}(t)),n.down=n.pressed=n.buttons%2==1||n.touches>0,s=t.timeStamp-e.timeStamp,e.timeStamp=t.timeStamp,e.elapsedTime=e.timeStamp-e.startTime),e._active){const t=e._delta.map(Math.abs);qt.addTo(e._distance,t)}this.axisIntent&&this.axisIntent(t);const[r,o]=e._movement,[a,l]=i.threshold,{_step:h,values:c}=e;if(i.hasCustomTransform?(!1===h[0]&&(h[0]=Math.abs(r)>=a&&c[0]),!1===h[1]&&(h[1]=Math.abs(o)>=l&&c[1])):(!1===h[0]&&(h[0]=Math.abs(r)>=a&&Math.sign(r)*a),!1===h[1]&&(h[1]=Math.abs(o)>=l&&Math.sign(o)*l)),e.intentional=!1!==h[0]||!1!==h[1],!e.intentional)return;const d=[0,0];if(i.hasCustomTransform){const[t,e]=c;d[0]=!1!==h[0]?t-h[0]:0,d[1]=!1!==h[1]?e-h[1]:0}else d[0]=!1!==h[0]?r-h[0]:0,d[1]=!1!==h[1]?o-h[1]:0;this.restrictToAxis&&!e._blocked&&this.restrictToAxis(d);const u=e.offset,p=e._active&&!e._blocked||e.active;p&&(e.first=e._active&&!e.active,e.last=!e._active&&e.active,e.active=n[this.ingKey]=e._active,t&&(e.first&&("bounds"in i&&(e._bounds=me(i.bounds,e)),this.setup&&this.setup()),e.movement=d,this.computeOffset()));const[f,g]=e.offset,[[m,v],[y,w]]=e._bounds;e.overflow=[f<m?-1:f>v?1:0,g<y?-1:g>w?1:0],e._movementBound[0]=!!e.overflow[0]&&(!1===e._movementBound[0]?e._movement[0]:e._movementBound[0]),e._movementBound[1]=!!e.overflow[1]&&(!1===e._movementBound[1]?e._movement[1]:e._movementBound[1]);const b=e._active&&i.rubberband||[0,0];if(e.offset=function(t,[e,i],[n,s]){const[[r,o],[a,l]]=t;return[Jt(e,r,o,n),Jt(i,a,l,s)]}(e._bounds,e.offset,b),e.delta=qt.sub(e.offset,u),this.computeMovement(),p&&(!e.last||s>32)){e.delta=qt.sub(e.offset,u);const t=e.delta.map(Math.abs);qt.addTo(e.distance,t),e.direction=e.delta.map(Math.sign),e._direction=e._delta.map(Math.sign),!e.first&&s>0&&(e.velocity=[t[0]/s,t[1]/s])}}emit(){const t=this.state,e=this.shared,i=this.config;if(t._active||this.clean(),(t._blocked||!t.intentional)&&!t._force&&!i.triggerAllEvents)return;const n=this.handler(ne(ne(ne({},e),t),{},{[this.aliasKey]:t.values}));void 0!==n&&(t.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}{constructor(...t){super(...t),ee(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=qt.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=qt.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const e=this.state,i=this.config;if(!e.axis&&t){const n="object"==typeof i.axisThreshold?i.axisThreshold[de(t)]:i.axisThreshold;e.axis=function([t,e],i){const n=Math.abs(t),s=Math.abs(e);return n>s&&n>i?"x":s>n&&s>i?"y":void 0}(e._movement,n)}e._blocked=(i.lockDirection||!!i.axis)&&!e.axis||!!i.axis&&i.axis!==e.axis}restrictToAxis(t){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":t[1]=0;break;case"y":t[0]=0}}}{constructor(...t){super(...t),ee(this,"ingKey","dragging")}reset(){super.reset();const t=this.state;t._pointerId=void 0,t._pointerActive=!1,t._keyboardActive=!1,t._preventScroll=!1,t._delayed=!1,t.swipe=[0,0],t.tap=!1,t.canceled=!1,t.cancel=this.cancel.bind(this)}setup(){const t=this.state;if(t._bounds instanceof HTMLElement){const e=t._bounds.getBoundingClientRect(),i=t.currentTarget.getBoundingClientRect(),n={left:e.left-i.left+t.offset[0],right:e.right-i.right+t.offset[0],top:e.top-i.top+t.offset[1],bottom:e.bottom-i.bottom+t.offset[1]};t._bounds=Ee.bounds(n)}}cancel(){const t=this.state;t.canceled||(t.canceled=!0,t._active=!1,setTimeout((()=>{this.compute(),this.emit()}),0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(t){const e=this.config,i=this.state;if(null!=t.buttons&&(Array.isArray(e.pointerButtons)?!e.pointerButtons.includes(t.buttons):-1!==e.pointerButtons&&e.pointerButtons!==t.buttons))return;const n=this.ctrl.setEventIds(t);e.pointerCapture&&t.target.setPointerCapture(t.pointerId),n&&n.size>1&&i._pointerActive||(this.start(t),this.setupPointer(t),i._pointerId=fe(t),i._pointerActive=!0,this.computeValues(ge(t)),this.computeInitial(),e.preventScrollAxis&&"mouse"!==de(t)?(i._active=!1,this.setupScrollPrevention(t)):e.delay>0?(this.setupDelayTrigger(t),e.triggerAllEvents&&(this.compute(t),this.emit())):this.startPointerDrag(t))}startPointerDrag(t){const e=this.state;e._active=!0,e._preventScroll=!0,e._delayed=!1,this.compute(t),this.emit()}pointerMove(t){const e=this.state,i=this.config;if(!e._pointerActive)return;if(e.type===t.type&&t.timeStamp===e.timeStamp)return;const n=fe(t);if(void 0!==e._pointerId&&n!==e._pointerId)return;const s=ge(t);return document.pointerLockElement===t.target?e._delta=[t.movementX,t.movementY]:(e._delta=qt.sub(s,e._values),this.computeValues(s)),qt.addTo(e._movement,e._delta),this.compute(t),e._delayed&&e.intentional?(this.timeoutStore.remove("dragDelay"),e.active=!1,void this.startPointerDrag(t)):i.preventScrollAxis&&!e._preventScroll?e.axis?e.axis===i.preventScrollAxis||"xy"===i.preventScrollAxis?(e._active=!1,void this.clean()):(this.timeoutStore.remove("startPointerDrag"),void this.startPointerDrag(t)):void 0:void this.emit()}pointerUp(t){this.ctrl.setEventIds(t);try{this.config.pointerCapture&&t.target.hasPointerCapture(t.pointerId)&&t.target.releasePointerCapture(t.pointerId)}catch(o){}const e=this.state,i=this.config;if(!e._active||!e._pointerActive)return;const n=fe(t);if(void 0!==e._pointerId&&n!==e._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[s,r]=e._distance;if(e.tap=s<=i.tapsThreshold&&r<=i.tapsThreshold,e.tap&&i.filterTaps)e._force=!0;else{const[t,n]=e.direction,[s,r]=e.velocity,[o,a]=e.movement,[l,h]=i.swipe.velocity,[c,d]=i.swipe.distance,u=i.swipe.duration;e.elapsedTime<u&&(Math.abs(s)>l&&Math.abs(o)>c&&(e.swipe[0]=t),Math.abs(r)>h&&Math.abs(a)>d&&(e.swipe[1]=n))}this.emit()}pointerClick(t){!this.state.tap&&t.detail>0&&(t.preventDefault(),t.stopPropagation())}setupPointer(t){const e=this.config,i=e.device;e.pointerLock&&t.currentTarget.requestPointerLock(),e.pointerCapture||(this.eventStore.add(this.sharedConfig.window,i,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,i,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,i,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(t){this.state._preventScroll&&t.cancelable&&t.preventDefault()}setupScrollPrevention(t){this.state._preventScroll=!1,function(t){"persist"in t&&"function"==typeof t.persist&&t.persist()}(t);const e=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",e),this.eventStore.add(this.sharedConfig.window,"touch","cancel",e),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,t)}setupDelayTrigger(t){this.state._delayed=!0,this.timeoutStore.add("dragDelay",(()=>{this.state._step=[0,0],this.startPointerDrag(t)}),this.config.delay)}keyDown(t){const e=Se[t.key];if(e){const i=this.state,n=t.shiftKey?10:t.altKey?.1:1;this.start(t),i._delta=e(this.config.keyboardDisplacement,n),i._keyboardActive=!0,qt.addTo(i._movement,i._delta),this.compute(t),this.emit()}}keyUp(t){t.key in Se&&(this.state._keyboardActive=!1,this.setActive(),this.compute(t),this.emit())}bind(t){const e=this.config.device;t(e,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(t(e,"change",this.pointerMove.bind(this)),t(e,"end",this.pointerUp.bind(this)),t(e,"cancel",this.pointerUp.bind(this)),t("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(t("key","down",this.keyDown.bind(this)),t("key","up",this.keyUp.bind(this))),this.config.filterTaps&&t("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}},resolver:ke};function Ie(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i,n,s={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(s[i]=t[i]);return s}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}const Le={target(t){if(t)return()=>"current"in t?t.current:t},enabled:(t=!0)=>t,window:(t=(Ce.isBrowser?window:void 0))=>t,eventOptions:({passive:t=!0,capture:e=!1}={})=>({passive:t,capture:e}),transform:t=>t},$e=["target","eventOptions","window","enabled","transform"];function Me(t={},e){const i={};for(const[n,s]of Object.entries(e))switch(typeof s){case"function":i[n]=s.call(i,t[n],n,t);break;case"object":i[n]=Me(t[n],s);break;case"boolean":s&&(i[n]=t[n])}return i}class ze{constructor(t,e){ee(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=e}add(t,e,i,n,s){const r=this._listeners,o=function(t,e=""){const i=se[t];return t+(i&&i[e]||e)}(e,i),a=ne(ne({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),s);t.addEventListener(o,n,a);const l=()=>{t.removeEventListener(o,n,a),r.delete(l)};return r.add(l),l}clean(){this._listeners.forEach((t=>t())),this._listeners.clear()}}class Be{constructor(){ee(this,"_timeouts",new Map)}add(t,e,i=140,...n){this.remove(t),this._timeouts.set(t,window.setTimeout(e,i,...n))}remove(t){const e=this._timeouts.get(t);e&&window.clearTimeout(e)}clean(){this._timeouts.forEach((t=>{window.clearTimeout(t)})),this._timeouts.clear()}}class Fe{constructor(t){ee(this,"gestures",new Set),ee(this,"_targetEventStore",new ze(this)),ee(this,"gestureEventStores",{}),ee(this,"gestureTimeoutStores",{}),ee(this,"handlers",{}),ee(this,"config",{}),ee(this,"pointerIds",new Set),ee(this,"touchIds",new Set),ee(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),function(t,e){e.drag&&De(t,"drag");e.wheel&&De(t,"wheel");e.scroll&&De(t,"scroll");e.move&&De(t,"move");e.pinch&&De(t,"pinch");e.hover&&De(t,"hover")}(this,t)}setEventIds(t){return ce(t)?(this.touchIds=new Set(pe(t)),this.touchIds):"pointerId"in t?("pointerup"===t.type||"pointercancel"===t.type?this.pointerIds.delete(t.pointerId):"pointerdown"===t.type&&this.pointerIds.add(t.pointerId),this.pointerIds):void 0}applyHandlers(t,e){this.handlers=t,this.nativeHandlers=e}applyConfig(t,e){this.config=function(t,e,i={}){const n=t,{target:s,eventOptions:r,window:o,enabled:a,transform:l}=n,h=Ie(n,$e);if(i.shared=Me({target:s,eventOptions:r,window:o,enabled:a,transform:l},Le),e){const t=Re.get(e);i[e]=Me(ne({shared:i.shared},h),t)}else for(const c in h){const t=Re.get(c);t&&(i[c]=Me(ne({shared:i.shared},h[c]),t))}return i}(t,e,this.config)}clean(){this._targetEventStore.clean();for(const t of this.gestures)this.gestureEventStores[t].clean(),this.gestureTimeoutStores[t].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...t){const e=this.config.shared,i={};let n;if(!e.target||(n=e.target(),n)){if(e.enabled){for(const e of this.gestures){const s=this.config[e],r=je(i,s.eventOptions,!!n);if(s.enabled){new(Oe.get(e))(this,t,e).bind(r)}}const s=je(i,e.eventOptions,!!n);for(const e in this.nativeHandlers)s(e,"",(i=>this.nativeHandlers[e](ne(ne({},this.state.shared),{},{event:i,args:t}))),void 0,!0)}for(const t in i)i[t]=ye(...i[t]);if(!n)return i;for(const t in i){const{device:e,capture:s,passive:r}=he(t);this._targetEventStore.add(n,e,"",i[t],{capture:s,passive:r})}}}}function De(t,e){t.gestures.add(e),t.gestureEventStores[e]=new ze(t,e),t.gestureTimeoutStores[e]=new Be}const je=(t,e,i)=>(n,s,r,o={},a=!1)=>{var l,h;const c=null!==(l=o.capture)&&void 0!==l?l:e.capture,d=null!==(h=o.passive)&&void 0!==h?h:e.passive;let u=a?n:ae(n,s,c);i&&d&&(u+="Passive"),t[u]=t[u]||[],t[u].push(r)};function Ne(t,e){var i;return i=Ae,Oe.set(i.key,i.engine),Re.set(i.key,i.resolver),function(t,e={},i,n){const s=h.default.useMemo((()=>new Fe(t)),[]);if(s.applyHandlers(t,n),s.applyConfig(e,i),h.default.useEffect(s.effect.bind(s)),h.default.useEffect((()=>s.clean.bind(s)),[]),void 0===e.target)return s.bind.bind(s)}({drag:t},e||{},"drag")}const We=l["useId".toString()]||(()=>{});let Ue=0;const He=["a","button","div","h2","h3","img","li","nav","p","span","svg","ul"].reduce(((t,e)=>({...t,[e]:l.forwardRef(((t,i)=>{const{asChild:n,...s}=t,r=n?I:e;return l.useEffect((()=>{window[Symbol.for("radix-ui")]=!0}),[]),t.as&&console.error(Ve),l.createElement(r,A({},s,{ref:i}))}))})),{}),Ve="Warning: The `as` prop has been removed in favour of `asChild`. For details, see https://radix-ui.com/docs/primitives/overview/styling#changing-the-rendered-element",Ge=l.forwardRef(((t,e)=>l.createElement(He.span,A({},t,{ref:e,style:{...t.style,position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}})))),Xe=l.forwardRef(((t,e)=>{var i,n;const{containerRef:s,style:r,...o}=t,h=null!==(i=null==s?void 0:s.current)&&void 0!==i?i:null===globalThis||void 0===globalThis||null===(n=globalThis.document)||void 0===n?void 0:n.body,[,c]=l.useState({});return B((()=>{c({})}),[]),h?a.default.createPortal(l.createElement(He.div,A({"data-radix-portal":""},o,{ref:e,style:h===document.body?{position:"absolute",top:0,left:0,zIndex:2147483647,...r}:void 0})),h):null})),Ye=l.forwardRef(((t,e)=>{const{children:i,width:n=10,height:s=5,...r}=t;return l.createElement(He.svg,A({},r,{ref:e,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),t.asChild?i:l.createElement("polygon",{points:"0,0 30,0 15,10"}))}));function Ke(t){const[e,i]=l.useState(void 0);return l.useEffect((()=>{if(t){const e=new ResizeObserver((e=>{if(!Array.isArray(e))return;if(!e.length)return;const n=e[0];let s,r;if("borderBoxSize"in n){const t=n.borderBoxSize,e=Array.isArray(t)?t[0]:t;s=e.inlineSize,r=e.blockSize}else{const e=t.getBoundingClientRect();s=e.width,r=e.height}i({width:s,height:r})}));return e.observe(t,{box:"border-box"}),()=>{i(void 0),e.unobserve(t)}}}),[t]),e}let Qe;const qe=new Map;function Ze(){const t=[];qe.forEach(((e,i)=>{const n=i.getBoundingClientRect();var s,r;r=n,((s=e.rect).width!==r.width||s.height!==r.height||s.top!==r.top||s.right!==r.right||s.bottom!==r.bottom||s.left!==r.left)&&(e.rect=n,t.push(e))})),t.forEach((t=>{t.callbacks.forEach((e=>e(t.rect)))})),Qe=requestAnimationFrame(Ze)}function Je(t){const[e,i]=l.useState();return l.useEffect((()=>{if(t){const e=function(t,e){const i=qe.get(t);return void 0===i?(qe.set(t,{rect:{},callbacks:[e]}),1===qe.size&&(Qe=requestAnimationFrame(Ze))):(i.callbacks.push(e),e(t.getBoundingClientRect())),()=>{const i=qe.get(t);if(void 0===i)return;const n=i.callbacks.indexOf(e);n>-1&&i.callbacks.splice(n,1),0===i.callbacks.length&&(qe.delete(t),0===qe.size&&cancelAnimationFrame(Qe))}}(t,i);return()=>{i(void 0),e()}}}),[t]),e}function ti(t,e=[]){let i=[];const n=()=>{const e=i.map((t=>l.createContext(t)));return function(i){const n=(null==i?void 0:i[t])||e;return l.useMemo((()=>({[`__scope${t}`]:{...i,[t]:n}})),[i,n])}};return n.scopeName=t,[function(e,n){const s=l.createContext(n),r=i.length;function o(e){const{scope:i,children:n,...o}=e,a=(null==i?void 0:i[t][r])||s,h=l.useMemo((()=>o),Object.values(o));return l.createElement(a.Provider,{value:h},n)}return i=[...i,n],o.displayName=e+"Provider",[o,function(i,o){const a=(null==o?void 0:o[t][r])||s,h=l.useContext(a);if(h)return h;if(void 0!==n)return n;throw new Error(`\`${i}\` must be used within \`${e}\``)}]},ei(n,...e)]}function ei(...t){const e=t[0];if(1===t.length)return e;const i=()=>{const i=t.map((t=>({useScope:t(),scopeName:t.scopeName})));return function(t){const n=i.reduce(((e,{useScope:i,scopeName:n})=>({...e,...i(t)[`__scope${n}`]})),{});return l.useMemo((()=>({[`__scope${e.scopeName}`]:n})),[n])}};return i.scopeName=e.scopeName,i}function ii(t,e,i){const n=t["x"===i?"left":"top"],s="x"===i?"width":"height",r=t[s],o=e[s];return{before:n-o,start:n,center:n+(r-o)/2,end:n+r-o,after:n+r}}function ni(t){return{position:"absolute",top:0,left:0,minWidth:"max-content",willChange:"transform",transform:`translate3d(${Math.round(t.x+window.scrollX)}px, ${Math.round(t.y+window.scrollY)}px, 0)`}}function si(t,e,i,n,s){const r="top"===e||"bottom"===e,o=s?s.width:0,a=s?s.height:0,l=o/2+n;let h="",c="";return r?(h={start:`${l}px`,center:"center",end:t.width-l+"px"}[i],c="top"===e?`${t.height+a}px`:-a+"px"):(h="left"===e?`${t.width+a}px`:-a+"px",c={start:`${l}px`,center:"center",end:t.height-l+"px"}[i]),`${h} ${c}`}const ri={position:"fixed",top:0,left:0,opacity:0,transform:"translate3d(0, -200%, 0)"},oi={position:"absolute",opacity:0};function ai({popperSize:t,arrowSize:e,arrowOffset:i,side:n,align:s}){const r=(t.width-e.width)/2,o=(t.height-e.width)/2,a={top:0,right:90,bottom:180,left:-90}[n],l=Math.max(e.width,e.height),h={width:`${l}px`,height:`${l}px`,transform:`rotate(${a}deg)`,willChange:"transform",position:"absolute",[n]:"100%",direction:li(n,s)};return"top"!==n&&"bottom"!==n||("start"===s&&(h.left=`${i}px`),"center"===s&&(h.left=`${r}px`),"end"===s&&(h.right=`${i}px`)),"left"!==n&&"right"!==n||("start"===s&&(h.top=`${i}px`),"center"===s&&(h.top=`${o}px`),"end"===s&&(h.bottom=`${i}px`)),h}function li(t,e){return("top"!==t&&"right"!==t||"end"!==e)&&("bottom"!==t&&"left"!==t||"end"===e)?"ltr":"rtl"}function hi(t){return{top:"bottom",right:"left",bottom:"top",left:"right"}[t]}function ci(t,e){return{top:t.top<e.top,right:t.right>e.right,bottom:t.bottom>e.bottom,left:t.left<e.left}}const[di,ui]=ti("Popper"),[pi,fi]=di("Popper"),gi=l.forwardRef(((t,e)=>{const{__scopePopper:i,virtualRef:n,...s}=t,r=fi("PopperAnchor",i),o=l.useRef(null),a=R(e,o);return l.useEffect((()=>{r.onAnchorChange((null==n?void 0:n.current)||o.current)})),n?null:l.createElement(He.div,A({},s,{ref:a}))})),[mi,vi]=di("PopperContent"),yi=t=>{const{__scopePopper:e,children:i}=t,[n,s]=l.useState(null);return l.createElement(pi,{scope:e,anchor:n,onAnchorChange:s},i)},wi=gi,bi=l.forwardRef(((t,e)=>{const{__scopePopper:i,side:n="bottom",sideOffset:s,align:r="center",alignOffset:o,collisionTolerance:a,avoidCollisions:h=!0,...c}=t,d=fi("PopperContent",i),[u,p]=l.useState(),f=Je(d.anchor),[g,m]=l.useState(null),v=Ke(g),[y,w]=l.useState(null),b=Ke(y),x=R(e,(t=>m(t))),E=function(){const[t,e]=l.useState(void 0);return l.useEffect((()=>{let t;function i(){e({width:window.innerWidth,height:window.innerHeight})}function n(){window.clearTimeout(t),t=window.setTimeout(i,100)}return i(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}),[]),t}(),S=E?DOMRect.fromRect({...E,x:0,y:0}):void 0,{popperStyles:_,arrowStyles:T,placedSide:C,placedAlign:P}=function({anchorRect:t,popperSize:e,arrowSize:i,arrowOffset:n=0,side:s,sideOffset:r=0,align:o,alignOffset:a=0,shouldAvoidCollisions:l=!0,collisionBoundariesRect:h,collisionTolerance:c=0}){if(!t||!e||!h)return{popperStyles:ri,arrowStyles:oi};const d=function(t,e,i=0,n=0,s){const r=s?s.height:0,o=ii(e,t,"x"),a=ii(e,t,"y"),l=a.before-i-r,h=a.after+i+r,c=o.before-i-r,d=o.after+i+r;return{top:{start:{x:o.start+n,y:l},center:{x:o.center,y:l},end:{x:o.end-n,y:l}},right:{start:{x:d,y:a.start+n},center:{x:d,y:a.center},end:{x:d,y:a.end-n}},bottom:{start:{x:o.start+n,y:h},center:{x:o.center,y:h},end:{x:o.end-n,y:h}},left:{start:{x:c,y:a.start+n},center:{x:c,y:a.center},end:{x:c,y:a.end-n}}}}(e,t,r,a,i),u=d[s][o];if(!1===l){const t=ni(u);let r=oi;return i&&(r=ai({popperSize:e,arrowSize:i,arrowOffset:n,side:s,align:o})),{popperStyles:{...t,"--radix-popper-transform-origin":si(e,s,o,n,i)},arrowStyles:r,placedSide:s,placedAlign:o}}const p=DOMRect.fromRect({...e,...u}),f=(g=h,m=c,DOMRect.fromRect({width:g.width-2*m,height:g.height-2*m,x:g.left+m,y:g.top+m}));var g,m;const v=ci(p,f),y=d[hi(s)][o],w=function(t,e,i){const n=hi(t);return e[t]&&!i[n]?n:t}(s,v,ci(DOMRect.fromRect({...e,...y}),f)),b=function(t,e,i,n,s){const r="top"===i||"bottom"===i,o=r?"left":"top",a=r?"right":"bottom",l=r?"width":"height",h=e[l]>t[l];return"start"!==n&&"center"!==n||!(s[o]&&h||s[a]&&!h)?"end"!==n&&"center"!==n||!(s[a]&&h||s[o]&&!h)?n:"start":"end"}(e,t,s,o,v),x=ni(d[w][b]);let E=oi;return i&&(E=ai({popperSize:e,arrowSize:i,arrowOffset:n,side:w,align:b})),{popperStyles:{...x,"--radix-popper-transform-origin":si(e,w,b,n,i)},arrowStyles:E,placedSide:w,placedAlign:b}}({anchorRect:f,popperSize:v,arrowSize:b,arrowOffset:u,side:n,sideOffset:s,align:r,alignOffset:o,shouldAvoidCollisions:h,collisionBoundariesRect:S,collisionTolerance:a}),k=void 0!==C;return l.createElement("div",{style:_,"data-radix-popper-content-wrapper":""},l.createElement(mi,{scope:i,arrowStyles:T,onArrowChange:w,onArrowOffsetChange:p},l.createElement(He.div,A({"data-side":C,"data-align":P},c,{style:{...c.style,animation:k?void 0:"none"},ref:x}))))})),xi=l.forwardRef((function(t,e){const{__scopePopper:i,offset:n,...s}=t,r=vi("PopperArrow",i),{onArrowOffsetChange:o}=r;return l.useEffect((()=>o(n)),[o,n]),l.createElement("span",{style:{...r.arrowStyles,pointerEvents:"none"}},l.createElement("span",{ref:r.onArrowChange,style:{display:"inline-block",verticalAlign:"top",pointerEvents:"auto"}},l.createElement(Ye,A({},s,{ref:e,style:{...s.style,display:"block"}}))))})),Ei=t=>{const{present:e,children:i}=t,n=function(t){const[e,i]=l.useState(),n=l.useRef({}),s=l.useRef(t),r=l.useRef("none"),o=t?"mounted":"unmounted",[a,h]=(c=o,d={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},l.useReducer(((t,e)=>{const i=d[t][e];return null!=i?i:t}),c));var c,d;return l.useEffect((()=>{const t=Si(n.current);r.current="mounted"===a?t:"none"}),[a]),B((()=>{const e=n.current,i=s.current;if(i!==t){const n=r.current,o=Si(e);if(t)h("MOUNT");else if("none"===o||"none"===(null==e?void 0:e.display))h("UNMOUNT");else{const t=n!==o;h(i&&t?"ANIMATION_OUT":"UNMOUNT")}s.current=t}}),[t,h]),B((()=>{if(e){const t=t=>{const i=Si(n.current).includes(t.animationName);t.target===e&&i&&h("ANIMATION_END")},i=t=>{t.target===e&&(r.current=Si(n.current))};return e.addEventListener("animationstart",i),e.addEventListener("animationcancel",t),e.addEventListener("animationend",t),()=>{e.removeEventListener("animationstart",i),e.removeEventListener("animationcancel",t),e.removeEventListener("animationend",t)}}}),[e,h]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:l.useCallback((t=>{t&&(n.current=getComputedStyle(t)),i(t)}),[])}}(e),s="function"==typeof i?i({present:n.isPresent}):l.Children.only(i),r=R(n.ref,s.ref);return"function"==typeof i||n.isPresent?l.cloneElement(s,{ref:r}):null};function Si(t){return(null==t?void 0:t.animationName)||"none"}function _i(t){const e=l.useRef(t);return l.useEffect((()=>{e.current=t}),[t]),e.current}function Ti(t){const e=l.useRef(t);return l.useEffect((()=>{e.current=t})),l.useMemo((()=>(...t)=>{var i;return null===(i=e.current)||void 0===i?void 0:i.call(e,...t)}),[])}function Ci(t,e,{checkForDefaultPrevented:i=!0}={}){return function(n){if(null==t||t(n),!1===i||!n.defaultPrevented)return null==e?void 0:e(n)}}Ei.displayName="Presence";const[Pi,ki]=ti("Tooltip",[ui]),Oi=ui(),[Ri,Ai]=Pi("TooltipProvider",{isOpenDelayed:!0,delayDuration:700,onOpen:()=>{},onClose:()=>{}}),[Ii,Li]=Pi("Tooltip"),$i=l.forwardRef(((t,e)=>{const{__scopeTooltip:i,...n}=t,s=Li("TooltipTrigger",i),r=Oi(i),o=R(e,s.onTriggerChange),a=l.useRef(!1),h=l.useCallback((()=>a.current=!1),[]);return l.useEffect((()=>()=>document.removeEventListener("mouseup",h)),[h]),l.createElement(wi,A({asChild:!0},r),l.createElement(He.button,A({"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute},n,{ref:o,onMouseEnter:Ci(t.onMouseEnter,s.onTriggerEnter),onMouseLeave:Ci(t.onMouseLeave,s.onClose),onMouseDown:Ci(t.onMouseDown,(()=>{s.onClose(),a.current=!0,document.addEventListener("mouseup",h,{once:!0})})),onFocus:Ci(t.onFocus,(()=>{a.current||s.onOpen()})),onBlur:Ci(t.onBlur,s.onClose),onClick:Ci(t.onClick,s.onClose)})))})),Mi=l.forwardRef(((t,e)=>{const{forceMount:i,...n}=t,s=Li("TooltipContent",t.__scopeTooltip);return l.createElement(Ei,{present:i||s.open},l.createElement(zi,A({ref:e},n)))})),zi=l.forwardRef(((t,e)=>{const{__scopeTooltip:i,children:n,"aria-label":s,portalled:r=!0,...o}=t,a=Li("TooltipContent",i),h=Oi(i),c=r?Xe:l.Fragment,{onClose:d}=a;return function(t){const e=Ti(t);l.useEffect((()=>{const t=t=>{"Escape"===t.key&&e(t)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)}),[e])}((()=>d())),l.useEffect((()=>(document.addEventListener("tooltip.open",d),()=>document.removeEventListener("tooltip.open",d))),[d]),l.createElement(c,null,l.createElement(Bi,{__scopeTooltip:i}),l.createElement(bi,A({"data-state":a.stateAttribute},h,o,{ref:e,style:{...o.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)"}}),l.createElement($,null,n),l.createElement(Ge,{id:a.contentId,role:"tooltip"},s||n)))}));function Bi(t){const{__scopeTooltip:e}=t,i=Li("CheckTriggerMoved",e),n=Je(i.trigger),s=null==n?void 0:n.left,r=_i(s),o=null==n?void 0:n.top,a=_i(o),h=i.onClose;return l.useEffect((()=>{(void 0!==r&&r!==s||void 0!==a&&a!==o)&&h()}),[h,r,a,s,o]),null}const Fi=t=>{const{__scopeTooltip:e,children:i,open:n,defaultOpen:s=!1,onOpenChange:r,delayDuration:o}=t,a=Ai("Tooltip",e),h=Oi(e),[c,d]=l.useState(null),u=function(t){const[e,i]=l.useState(We());return B((()=>{t||i((t=>null!=t?t:String(Ue++)))}),[t]),t||(e?`radix-${e}`:"")}(),p=l.useRef(0),f=null!=o?o:a.delayDuration,g=l.useRef(!1),{onOpen:m,onClose:v}=a,[y=!1,w]=function({prop:t,defaultProp:e,onChange:i=(()=>{})}){const[n,s]=function({defaultProp:t,onChange:e}){const i=l.useState(t),[n]=i,s=l.useRef(n),r=Ti(e);return l.useEffect((()=>{s.current!==n&&(r(n),s.current=n)}),[n,s,r]),i}({defaultProp:e,onChange:i}),r=void 0!==t,o=r?t:n,a=Ti(i);return[o,l.useCallback((e=>{if(r){const i=e,n="function"==typeof e?i(t):e;n!==t&&a(n)}else s(e)}),[r,t,s,a])]}({prop:n,defaultProp:s,onChange:t=>{t&&(document.dispatchEvent(new CustomEvent("tooltip.open")),m()),null==r||r(t)}}),b=l.useMemo((()=>y?g.current?"delayed-open":"instant-open":"closed"),[y]),x=l.useCallback((()=>{window.clearTimeout(p.current),g.current=!1,w(!0)}),[w]),E=l.useCallback((()=>{window.clearTimeout(p.current),p.current=window.setTimeout((()=>{g.current=!0,w(!0)}),f)}),[f,w]);return l.useEffect((()=>()=>window.clearTimeout(p.current)),[]),l.createElement(yi,h,l.createElement(Ii,{scope:e,contentId:u,open:y,stateAttribute:b,trigger:c,onTriggerChange:d,onTriggerEnter:l.useCallback((()=>{a.isOpenDelayed?E():x()}),[a.isOpenDelayed,E,x]),onOpen:l.useCallback(x,[x]),onClose:l.useCallback((()=>{window.clearTimeout(p.current),w(!1),v()}),[w,v])},i))},Di=$i,ji=Mi,Ni=l.forwardRef(((t,e)=>{const{__scopeTooltip:i,...n}=t,s=Oi(i);return l.createElement(xi,A({},s,n,{ref:e}))}));function Wi(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i,n,s={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(s[i]=t[i]);return s}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}let Ui;var Hi;(Hi=Ui||(Ui={}))[Hi.UNSUPPORTED_INPUT=0]="UNSUPPORTED_INPUT",Hi[Hi.NO_COMPONENT_FOR_TYPE=1]="NO_COMPONENT_FOR_TYPE",Hi[Hi.UNKNOWN_INPUT=2]="UNKNOWN_INPUT",Hi[Hi.DUPLICATE_KEYS=3]="DUPLICATE_KEYS",Hi[Hi.ALREADY_REGISTERED_TYPE=4]="ALREADY_REGISTERED_TYPE",Hi[Hi.CLIPBOARD_ERROR=5]="CLIPBOARD_ERROR",Hi[Hi.THEME_ERROR=6]="THEME_ERROR",Hi[Hi.PATH_DOESNT_EXIST=7]="PATH_DOESNT_EXIST",Hi[Hi.INPUT_TYPE_OVERRIDE=8]="INPUT_TYPE_OVERRIDE",Hi[Hi.EMPTY_KEY=9]="EMPTY_KEY";const Vi={[Ui.UNSUPPORTED_INPUT]:(t,e)=>[`An input with type \`${t}\` input was found at path \`${e}\` but it's not supported yet.`],[Ui.NO_COMPONENT_FOR_TYPE]:(t,e)=>[`Type \`${t}\` found at path \`${e}\` can't be displayed in panel because no component supports it yet.`],[Ui.UNKNOWN_INPUT]:(t,e)=>[`input at path \`${t}\` is not recognized.`,e],[Ui.DUPLICATE_KEYS]:(t,e,i)=>[`Key \`${t}\` of path \`${e}\` already exists at path \`${i}\`. Even nested keys need to be unique. Rename one of the keys.`],[Ui.ALREADY_REGISTERED_TYPE]:t=>[`Type ${t} has already been registered. You can't register a component with the same type.`],[Ui.CLIPBOARD_ERROR]:t=>["Error copying the value",t],[Ui.THEME_ERROR]:(t,e)=>[`Error accessing the theme \`${t}.${e}\` value.`],[Ui.PATH_DOESNT_EXIST]:t=>[`Error getting the value at path \`${t}\`. There is probably an error in your \`render\` function.`],[Ui.PATH_DOESNT_EXIST]:t=>[`Error accessing the value at path \`${t}\``],[Ui.INPUT_TYPE_OVERRIDE]:(t,e,i)=>[`Input at path \`${t}\` already exists with type: \`${e}\`. Its type cannot be overridden with type \`${i}\`.`],[Ui.EMPTY_KEY]:()=>["Keys can not be empty, if you want to hide a label use whitespace."]};function Gi(t,e,...i){const[n,...s]=Vi[e](...i);console[t]("LEVA: "+n,...s)}const Xi=Gi.bind(null,"warn");function Yi(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ki(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Qi(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ki(Object(i),!0).forEach((function(e){Yi(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ki(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}Gi.bind(null,"log");const qi=(t,e,i)=>t>i?i:t<e?e:t,Zi=t=>{if(""===t||"number"==typeof t)return t;try{const e=hn(t);if(!isNaN(e))return e}catch(e){}return parseFloat(t)},Ji=Math.log(10);function tn(t){let e=Math.abs(+String(t).replace(".",""));if(0===e)return.01;for(;0!==e&&e%10==0;)e/=10;const i=Math.floor(Math.log(e)/Ji)+1,n=Math.floor(Math.log10(Math.abs(t))),s=Math.pow(10,n-i);return Math.max(s,.001)}const en=(t,e,i)=>t*(i-e)+e,nn=/\(([0-9+\-*/^ .]+)\)/,sn=/(\d+(?:\.\d+)?) ?\^ ?(\d+(?:\.\d+)?)/,rn=/(\d+(?:\.\d+)?) ?\* ?(\d+(?:\.\d+)?)/,on=/(\d+(?:\.\d+)?) ?\/ ?(\d+(?:\.\d+)?)/,an=/(\d+(?:\.\d+)?) ?\+ ?(\d+(?:\.\d+)?)/,ln=/(\d+(?:\.\d+)?) ?- ?(\d+(?:\.\d+)?)/;function hn(t){if(isNaN(Number(t))){if(nn.test(t)){const e=t.replace(nn,((t,e)=>String(hn(e))));return hn(e)}if(sn.test(t)){return hn(t.replace(sn,((t,e,i)=>String(Math.pow(Number(e),Number(i))))))}if(rn.test(t)){return hn(t.replace(rn,((t,e,i)=>String(Number(e)*Number(i)))))}if(on.test(t)){return hn(t.replace(on,((t,e,i)=>{if(0!=i)return String(Number(e)/Number(i));throw new Error("Division by zero")})))}if(an.test(t)){return hn(t.replace(an,((t,e,i)=>String(Number(e)+Number(i)))))}if(ln.test(t)){return hn(t.replace(ln,((t,e,i)=>String(Number(e)-Number(i)))))}return Number(t)}return Number(t)}let cn;var dn;let un;var pn;(dn=cn||(cn={})).BUTTON="BUTTON",dn.BUTTON_GROUP="BUTTON_GROUP",dn.MONITOR="MONITOR",dn.FOLDER="FOLDER",(pn=un||(un={})).SELECT="SELECT",pn.IMAGE="IMAGE",pn.NUMBER="NUMBER",pn.COLOR="COLOR",pn.STRING="STRING",pn.BOOLEAN="BOOLEAN",pn.INTERVAL="INTERVAL",pn.VECTOR3D="VECTOR3D",pn.VECTOR2D="VECTOR2D";const fn=["value"],gn=["min","max"],mn=(t,{step:e,initialValue:i})=>i+Math.round((t-i)/e)*e;var vn=Object.freeze({__proto__:null,schema:t=>{if("number"==typeof t)return!0;if("string"==typeof t){const e=parseFloat(t);if(isNaN(e))return!1;return t.substring((""+e).length).trim().length<4}return!1},sanitize:(t,{min:e=-1/0,max:i=1/0,suffix:n})=>{const s=parseFloat(t);if(""===t||isNaN(s))throw Error("Invalid number");const r=qi(s,e,i);return n?r+n:r},format:(t,{pad:e=0,suffix:i})=>{const n=parseFloat(t).toFixed(e);return i?n+i:n},normalize:t=>{let{value:e}=t,i=Wi(t,fn);const{min:n=-1/0,max:s=1/0}=i,r=Wi(i,gn);let o=parseFloat(e);const a="string"==typeof e?e.substring((""+o).length):void 0;o=qi(o,n,s);let l=i.step;l||(Number.isFinite(n)?l=Number.isFinite(s)?+(Math.abs(s-n)/100).toPrecision(1):+(Math.abs(o-n)/100).toPrecision(1):Number.isFinite(s)&&(l=+(Math.abs(s-o)/100).toPrecision(1)));const h=l?10*tn(l):tn(o);l=l||h/10;return{value:a?o+a:o,settings:Qi({initialValue:o,step:l,pad:Math.round(qi(Math.log10(1/h),0,2)),min:n,max:s,suffix:a},r)}},sanitizeStep:mn});function yn(){return yn=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},yn.apply(this,arguments)}const wn=n.createContext({});function bn(){return n.useContext(wn)}const xn=n.createContext(null);n.createContext(null);const En=n.createContext(null);function Sn(t,e){const[i,n]=t.split(" "),s={};return"none"!==i&&(s.boxShadow=`${e.inset?"inset ":""}0 0 0 $borderWidths${[e.key]} $colors${"default"!==i&&i||e.borderColor}`),n&&(s.backgroundColor=n),s}const _n={$inputStyle:()=>t=>Sn(t,{key:"$input",borderColor:"$highlight1",inset:!0}),$focusStyle:()=>t=>Sn(t,{key:"$focus",borderColor:"$accent2"}),$hoverStyle:()=>t=>Sn(t,{key:"$hover",borderColor:"$accent1",inset:!0}),$activeStyle:()=>t=>Sn(t,{key:"$active",borderColor:"$accent1",inset:!0})},{styled:Tn,css:Cn,createTheme:Pn,globalCss:kn,keyframes:On}=(t=>{const e=(t=>{let e=!1;const i=Kt(t,(t=>{e=!0;const i="prefix"in(t="object"==typeof t&&t||{})?String(t.prefix):"",n="object"==typeof t.media&&t.media||{},s="object"==typeof t.root?t.root||null:globalThis.document||null,r="object"==typeof t.theme&&t.theme||{},o={prefix:i,media:n,theme:r,themeMap:"object"==typeof t.themeMap&&t.themeMap||{...ot},utils:"object"==typeof t.utils&&t.utils||{}},a=It(s),l={css:zt(o,a),globalCss:Ut(o,a),keyframes:Vt(o,a),createTheme:Yt(o,a),reset(){a.reset(),l.theme.toString()},theme:{},sheet:a,config:o,prefix:i,getCssText:a.toString,toString:a.toString};return String(l.theme=l.createTheme(r)),l}));return e||i.reset(),i})(t);return e.styled=(({config:t,sheet:e})=>Qt(t,(()=>{const i=zt(t,e);return(...t)=>{const e=i(...t),n=e[ht].type,s=h.default.forwardRef(((t,i)=>{const s=t&&t.as||n,{props:r,deferredInjector:o}=e(t);return delete r.as,r.ref=i,o?h.default.createElement(h.default.Fragment,null,h.default.createElement(s,r),h.default.createElement(o,null)):h.default.createElement(s,r)}));return s.className=e.className,s.displayName=`Styled.${n.displayName||n.name||n}`,s.selector=e.selector,s.toString=()=>e.selector,s[ht]=e[ht],s}})))(e),e})({prefix:"leva",theme:{colors:{elevation1:"#292d39",elevation2:"#181c20",elevation3:"#373c4b",accent1:"#0066dc",accent2:"#007bff",accent3:"#3c93ff",highlight1:"#535760",highlight2:"#8c92a4",highlight3:"#fefefe",vivid1:"#ffcc00",folderWidgetColor:"$highlight2",folderTextColor:"$highlight3",toolTipBackground:"$highlight3",toolTipText:"$elevation2"},radii:{xs:"2px",sm:"3px",lg:"10px"},space:{xs:"3px",sm:"6px",md:"10px",rowGap:"7px",colGap:"7px"},fonts:{mono:"ui-monospace, SFMono-Regular, Menlo, 'Roboto Mono', monospace",sans:"system-ui, sans-serif"},fontSizes:{root:"11px",toolTip:"$root"},sizes:{rootWidth:"280px",controlWidth:"160px",numberInputMinWidth:"38px",scrubberWidth:"8px",scrubberHeight:"16px",rowHeight:"24px",folderTitleHeight:"20px",checkboxSize:"16px",joystickWidth:"100px",joystickHeight:"100px",colorPickerWidth:"$controlWidth",colorPickerHeight:"100px",imagePreviewWidth:"$controlWidth",imagePreviewHeight:"100px",monitorHeight:"60px",titleBarHeight:"39px"},shadows:{level1:"0 0 9px 0 #00000088",level2:"0 4px 14px #00000033"},borderWidths:{root:"0px",input:"1px",focus:"1px",hover:"1px",active:"1px",folder:"1px"},fontWeights:{label:"normal",folder:"normal",button:"normal"}},utils:Qi(Qi({},_n),{},{$flex:()=>({display:"flex",alignItems:"center"}),$flexCenter:()=>({display:"flex",alignItems:"center",justifyContent:"center"}),$reset:()=>({outline:"none",fontSize:"inherit",fontWeight:"inherit",color:"inherit",fontFamily:"inherit",border:"none",backgroundColor:"transparent",appearance:"none"}),$draggable:()=>({touchAction:"none",WebkitUserDrag:"none",userSelect:"none"}),$focus:t=>({"&:focus":_n.$focusStyle()(t)}),$focusWithin:t=>({"&:focus-within":_n.$focusStyle()(t)}),$hover:t=>({"&:hover":_n.$hoverStyle()(t)}),$active:t=>({"&:active":_n.$activeStyle()(t)})})});kn({".leva__panel__dragged":{WebkitUserDrag:"none",userSelect:"none",input:{userSelect:"none"},"*":{cursor:"ew-resize !important"}}});const Rn=Tn("input",{$reset:"",padding:"0 $sm",width:0,minWidth:0,flex:1,height:"100%",variants:{levaType:{number:{textAlign:"right"}},as:{textarea:{padding:"$sm"}}}}),An=Tn("div",{$draggable:"",height:"100%",$flexCenter:"",position:"relative",padding:"0 $xs",fontSize:"0.8em",opacity:.8,cursor:"default",touchAction:"none",[`& + ${Rn}`]:{paddingLeft:0}}),In=Tn(An,{cursor:"ew-resize",marginRight:"-$xs",textTransform:"uppercase",opacity:.3,"&:hover":{opacity:1},variants:{dragging:{true:{backgroundColor:"$accent2",opacity:1}}}}),Ln=Tn("div",{$flex:"",position:"relative",borderRadius:"$sm",overflow:"hidden",color:"inherit",height:"$rowHeight",backgroundColor:"$elevation3",$inputStyle:"$elevation1",$hover:"",$focusWithin:"",variants:{textArea:{true:{height:"auto"}}}}),$n=["innerLabel","value","onUpdate","onChange","onKeyDown","type","id","inputType","rows"],Mn=["onUpdate"];function zn(t){let{innerLabel:e,value:i,onUpdate:s,onChange:r,onKeyDown:o,type:a,id:l,inputType:c="text",rows:d=0}=t,u=Wi(t,$n);const{id:p,emitOnEditStart:f,emitOnEditEnd:g,disabled:m}=bn(),v=l||p,y=n.useRef(null),w=d>0,b=w?"textarea":"input",x=n.useCallback((t=>e=>{const i=e.currentTarget.value;t(i)}),[]);h.default.useEffect((()=>{const t=y.current,e=x((t=>{s(t),g()}));return null==t||t.addEventListener("blur",e),()=>null==t?void 0:t.removeEventListener("blur",e)}),[x,s,g]);const E=n.useCallback((t=>{"Enter"===t.key&&x(s)(t)}),[x,s]),S=Object.assign({as:b},w?{rows:d}:{},u);return h.default.createElement(Ln,{textArea:w},e&&"string"==typeof e?h.default.createElement(An,null,e):e,h.default.createElement(Rn,yn({levaType:a,ref:y,id:v,type:c,autoComplete:"off",spellCheck:"false",value:i,onChange:x(r),onFocus:()=>f(),onKeyPress:E,onKeyDown:o,disabled:m},S)))}function Bn(t){let{onUpdate:e}=t,i=Wi(t,Mn);const s=n.useCallback((t=>e(Zi(t))),[e]),r=n.useCallback((t=>{const i="ArrowUp"===t.key?1:"ArrowDown"===t.key?-1:0;if(i){t.preventDefault();const n=t.altKey?.1:t.shiftKey?10:1;e((t=>parseFloat(t)+i*n))}}),[e]);return h.default.createElement(zn,yn({},i,{onUpdate:s,onKeyDown:r,type:"number"}))}const Fn=Tn("div",{}),Dn=Tn("div",{position:"relative",background:"$elevation2",transition:"height 300ms ease",variants:{fill:{true:{},false:{}},flat:{false:{},true:{}},isRoot:{true:{},false:{paddingLeft:"$md","&::after":{content:'""',position:"absolute",left:0,top:0,width:"$borderWidths$folder",height:"100%",backgroundColor:"$folderWidgetColor",opacity:.4,transform:"translateX(-50%)"}}}},compoundVariants:[{isRoot:!0,fill:!1,css:{overflowY:"auto",maxHeight:"calc(100vh - 20px - $$titleBarHeight)"}},{isRoot:!0,flat:!1,css:{borderRadius:"$lg"}}]});Tn("div",{$flex:"",color:"$folderTextColor",userSelect:"none",cursor:"pointer",height:"$folderTitleHeight",fontWeight:"$folder","> svg":{marginLeft:-4,marginRight:4,cursor:"pointer",fill:"$folderWidgetColor",opacity:.6},"&:hover > svg":{fill:"$folderWidgetColor"},[`&:hover + ${Dn}::after`]:{opacity:.6},[`${Fn}:hover > & + ${Dn}::after`]:{opacity:.6},[`${Fn}:hover > & > svg`]:{opacity:1}});const jn=Tn("div",{position:"relative",display:"grid",gridTemplateColumns:"100%",rowGap:"$rowGap",transition:"opacity 250ms ease",variants:{toggled:{true:{opacity:1,transitionDelay:"250ms"},false:{opacity:0,transitionDelay:"0ms",pointerEvents:"none"}},isRoot:{true:{"& > div":{paddingLeft:"$md",paddingRight:"$md"},"& > div:first-of-type":{paddingTop:"$sm"},"& > div:last-of-type":{paddingBottom:"$sm"},[`> ${Fn}:not(:first-of-type)`]:{paddingTop:"$sm",marginTop:"$md",borderTop:"$borderWidths$folder solid $colors$elevation1"}}}}}),Nn=Tn("div",{position:"relative",zIndex:100,display:"grid",rowGap:"$rowGap",gridTemplateRows:"minmax($sizes$rowHeight, max-content)",alignItems:"center",color:"$highlight2",[`${jn} > &`]:{"&:first-of-type":{marginTop:"$rowGap"},"&:last-of-type":{marginBottom:"$rowGap"}},variants:{disabled:{true:{pointerEvents:"none"},false:{"&:hover,&:focus-within":{color:"$highlight3"}}}}}),Wn=Tn(Nn,{gridTemplateColumns:"auto $sizes$controlWidth",columnGap:"$colGap"}),Un=Tn("div",{$flex:"",height:"100%",position:"relative",overflow:"hidden","& > div":{marginLeft:"$colGap",padding:"0 $xs",opacity:.4},"& > div:hover":{opacity:.8},"& > div > svg":{display:"none",cursor:"pointer",width:13,minWidth:13,height:13,backgroundColor:"$elevation2"},"&:hover > div > svg":{display:"block"},variants:{align:{top:{height:"100%",alignItems:"flex-start",paddingTop:"$sm"}}}}),Hn=Tn("input",{$reset:"",height:0,width:0,opacity:0,margin:0,"& + label":{position:"relative",$flexCenter:"",height:"100%",userSelect:"none",cursor:"pointer",paddingLeft:2,paddingRight:"$sm",pointerEvents:"auto"},"& + label:after":{content:'""',width:6,height:6,backgroundColor:"$elevation3",borderRadius:"50%",$activeStyle:""},"&:focus + label:after":{$focusStyle:""},"& + label:active:after":{backgroundColor:"$accent1",$focusStyle:""},"&:checked + label:after":{backgroundColor:"$accent1"}}),Vn=Tn("label",{fontWeight:"$label",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","& > svg":{display:"block"}});Tn("div",{opacity:1,variants:{disabled:{true:{opacity:.6,pointerEvents:"none",[`& ${Vn}`]:{pointerEvents:"auto"}}}}}),Tn("div",{position:"fixed",top:0,bottom:0,right:0,left:0,zIndex:1e3,userSelect:"none"});const Gn=Tn("div",{background:"$toolTipBackground",fontFamily:"$sans",fontSize:"$toolTip",padding:"$xs $sm",color:"$toolTipText",borderRadius:"$xs",boxShadow:"$level2",maxWidth:260}),Xn=Tn(Ni,{fill:"$toolTipBackground"}),Yn=["align"];function Kn(){const{id:t,disable:e,disabled:i}=bn();return h.default.createElement(h.default.Fragment,null,h.default.createElement(Hn,{id:t+"__disable",type:"checkbox",checked:!i,onChange:()=>e(!i)}),h.default.createElement("label",{htmlFor:t+"__disable"}))}function Qn(t){const{id:e,optional:i,hint:n}=bn(),s=t.htmlFor||(e?{htmlFor:e}:null),r=n||"string"!=typeof t.children?null:{title:t.children};return h.default.createElement(h.default.Fragment,null,i&&h.default.createElement(Kn,null),void 0!==n?h.default.createElement(Fi,null,h.default.createElement(Di,{asChild:!0},h.default.createElement(Vn,yn({},s,t))),h.default.createElement(ji,{side:"top",sideOffset:2},h.default.createElement(Gn,null,n,h.default.createElement(Xn,null)))):h.default.createElement(Vn,yn({},s,r,t)))}function qn(t){let{align:e}=t,i=Wi(t,Yn);const{value:s,label:r,key:o,disabled:a}=bn(),{hideCopyButton:l}=n.useContext(En),c=!l&&void 0!==o,[d,u]=n.useState(!1);return h.default.createElement(Un,{align:e,onPointerLeave:()=>u(!1)},h.default.createElement(Qn,i),c&&!a&&h.default.createElement("div",{title:`Click to copy ${"string"==typeof r?r:o} value`},d?h.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},h.default.createElement("path",{d:"M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"}),h.default.createElement("path",{fillRule:"evenodd",d:"M4 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v11a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm9.707 5.707a1 1 0 00-1.414-1.414L9 12.586l-1.293-1.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})):h.default.createElement("svg",{onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify({[o]:null!=s?s:""})),u(!0)}catch(t){Xi(Ui.CLIPBOARD_ERROR,{[o]:s})}},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},h.default.createElement("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),h.default.createElement("path",{d:"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"}))))}const Zn=["toggled"],Jn=Tn("svg",{fill:"currentColor",transition:"transform 350ms ease, fill 250ms ease"});function ts(t){let{toggled:e}=t,i=Wi(t,Zn);return h.default.createElement(Jn,yn({width:"9",height:"5",viewBox:"0 0 9 5",xmlns:"http://www.w3.org/2000/svg",style:{transform:`rotate(${e?0:-90}deg)`}},i),h.default.createElement("path",{d:"M3.8 4.4c.4.3 1 .3 1.4 0L8 1.7A1 1 0 007.4 0H1.6a1 1 0 00-.7 1.7l3 2.7z"}))}const es=["input"];function is(t){let{input:e}=t,i=Wi(t,es);return e?h.default.createElement(Wn,i):h.default.createElement(Nn,i)}function ns(t,e){const{emitOnEditStart:i,emitOnEditEnd:n}=bn();return Ne((e=>{e.first&&(document.body.classList.add("leva__panel__dragged"),null==i||i());const s=t(e);return e.last&&(document.body.classList.remove("leva__panel__dragged"),null==n||n()),s}),e)}const ss=Tn("div",{variants:{hasRange:{true:{position:"relative",display:"grid",gridTemplateColumns:"auto $sizes$numberInputMinWidth",columnGap:"$colGap",alignItems:"center"}}}}),rs=Tn("div",{position:"relative",width:"100%",height:2,borderRadius:"$xs",backgroundColor:"$elevation1"}),os=Tn("div",{position:"absolute",width:"$scrubberWidth",height:"$scrubberHeight",borderRadius:"$xs",boxShadow:"0 0 0 2px $colors$elevation2",backgroundColor:"$accent2",cursor:"pointer",$active:"none $accent1",$hover:"none $accent3",variants:{position:{left:{borderTopRightRadius:0,borderBottomRightRadius:0,transform:"translateX(calc(-0.5 * ($sizes$scrubberWidth + 4px)))"},right:{borderTopLeftRadius:0,borderBottomLeftRadius:0,transform:"translateX(calc(0.5 * ($sizes$scrubberWidth + 4px)))"}}}}),as=Tn("div",{position:"relative",$flex:"",height:"100%",cursor:"pointer",touchAction:"none"}),ls=Tn("div",{position:"absolute",height:"100%",backgroundColor:"$accent2"});function hs({value:t,min:e,max:i,onDrag:s,step:r,initialValue:o}){const a=n.useRef(null),l=n.useRef(null),c=n.useRef(0),d=function(t,e){const{theme:i}=n.useContext(xn);if(!(t in i)||!(e in i[t]))return Xi(Ui.THEME_ERROR,t,e),"";let s=e;for(;;){let e=i[t][s];if("string"!=typeof e||"$"!==e.charAt(0))return e;s=e.substr(1)}}("sizes","scrubberWidth"),u=ns((({event:n,first:h,xy:[u],movement:[p],memo:f})=>{if(h){const{width:s,left:r}=a.current.getBoundingClientRect();c.current=s-parseFloat(d);f=(null==n?void 0:n.target)===l.current?t:en((u-r)/s,e,i)}const g=f+en(p/c.current,0,i-e);return s(mn(g,{step:r,initialValue:o})),f})),p=((t,e,i)=>i===e?0:(qi(t,e,i)-e)/(i-e))(t,e,i);return h.default.createElement(as,yn({ref:a},u()),h.default.createElement(rs,null,h.default.createElement(ls,{style:{left:0,right:100*(1-p)+"%"}})),h.default.createElement(os,{ref:l,style:{left:`calc(${p} * (100% - ${d}))`}}))}const cs=h.default.memo((({label:t,onUpdate:e,step:i,innerLabelTrim:s})=>{const[r,o]=n.useState(!1),a=ns((({active:t,delta:[n],event:s,memo:r=0})=>(o(t),r+=n/2,Math.abs(r)>=1&&(e((t=>parseFloat(t)+Math.floor(r)*i*(t=>t.shiftKey?5:t.altKey?.2:1)(s))),r=0),r)));return h.default.createElement(In,yn({dragging:r,title:t.length>1?t:""},a()),t.slice(0,s))}));function ds({label:t,id:e,displayValue:i,onUpdate:n,onChange:s,settings:r,innerLabelTrim:o=1}){const a=o>0&&h.default.createElement(cs,{label:t,step:r.step,onUpdate:n,innerLabelTrim:o});return h.default.createElement(Bn,{id:e,value:String(i),onUpdate:n,onChange:s,innerLabel:a})}Qi({component:function(){const t=bn(),{label:e,value:i,onUpdate:n,settings:s,id:r}=t,{min:o,max:a}=s,l=a!==1/0&&o!==-1/0;return h.default.createElement(is,{input:!0},h.default.createElement(qn,null,e),h.default.createElement(ss,{hasRange:l},l&&h.default.createElement(hs,yn({value:parseFloat(i),onDrag:n},s)),h.default.createElement(ds,yn({},t,{id:r,label:"value",innerLabelTrim:l?0:1}))))}},Wi(vn,["sanitizeStep"]));var us=Object.freeze({__proto__:null,schema:(t,e)=>X().schema({options:X().passesAnyOf(X().object(),X().array())}).test(e),sanitize:(t,{values:e})=>{if(e.indexOf(t)<0)throw Error("Selected value doesn't match Select options");return t},format:(t,{values:e})=>e.indexOf(t),normalize:t=>{let e,i,{value:n,options:s}=t;return Array.isArray(s)?(i=s,e=s.map((t=>String(t)))):(i=Object.values(s),e=Object.keys(s)),"value"in t?i.includes(n)||(e.unshift(String(n)),i.unshift(n)):n=i[0],Object.values(s).includes(n)||(s[String(n)]=n),{value:n,settings:{keys:e,values:i}}}});const ps=Tn("div",{$flexCenter:"",position:"relative","> svg":{pointerEvents:"none",position:"absolute",right:"$md"}}),fs=Tn("select",{position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:0}),gs=Tn("div",{display:"flex",alignItems:"center",width:"100%",height:"$rowHeight",backgroundColor:"$elevation3",borderRadius:"$sm",padding:"0 $sm",cursor:"pointer",[`${fs}:focus + &`]:{$focusStyle:""},[`${fs}:hover + &`]:{$hoverStyle:""}});function ms({displayValue:t,value:e,onUpdate:i,id:s,settings:r,disabled:o}){const{keys:a,values:l}=r,c=n.useRef();return e===l[t]&&(c.current=a[t]),h.default.createElement(ps,null,h.default.createElement(fs,{id:s,value:t,onChange:t=>i(l[Number(t.currentTarget.value)]),disabled:o},a.map(((t,e)=>h.default.createElement("option",{key:t,value:e},t)))),h.default.createElement(gs,null,c.current),h.default.createElement(ts,{toggled:!0}))}Qi({component:function(){const{label:t,value:e,displayValue:i,onUpdate:n,id:s,disabled:r,settings:o}=bn();return h.default.createElement(is,{input:!0},h.default.createElement(qn,null,t),h.default.createElement(ms,{id:s,value:e,displayValue:i,onUpdate:n,settings:o,disabled:r}))}},us);var vs=Object.freeze({__proto__:null,schema:t=>X().string().test(t),sanitize:t=>{if("string"!=typeof t)throw Error("Invalid string");return t},normalize:({value:t,editable:e=!0,rows:i=!1})=>({value:t,settings:{editable:e,rows:"number"==typeof i?i:i?5:0}})});const ys=["displayValue","onUpdate","onChange","editable"],ws=Tn("div",{whiteSpace:"pre-wrap"});function bs(t){let{displayValue:e,onUpdate:i,onChange:n,editable:s=!0}=t,r=Wi(t,ys);return s?h.default.createElement(zn,yn({value:e,onUpdate:i,onChange:n},r)):h.default.createElement(ws,null,e)}Qi({component:function(){const{label:t,settings:e,displayValue:i,onUpdate:n,onChange:s}=bn();return h.default.createElement(is,{input:!0},h.default.createElement(qn,null,t),h.default.createElement(bs,yn({displayValue:i,onUpdate:n,onChange:s},e)))}},vs);var xs=Object.freeze({__proto__:null,schema:t=>X().boolean().test(t),sanitize:t=>{if("boolean"!=typeof t)throw Error("Invalid boolean");return t}});const Es=Tn("div",{position:"relative",$flex:"",height:"$rowHeight",input:{$reset:"",height:0,width:0,opacity:0,margin:0},label:{position:"relative",$flexCenter:"",userSelect:"none",cursor:"pointer",height:"$checkboxSize",width:"$checkboxSize",backgroundColor:"$elevation3",borderRadius:"$sm",$hover:""},"input:focus + label":{$focusStyle:""},"input:focus:checked + label, input:checked + label:hover":{$hoverStyle:"$accent3"},"input + label:active":{backgroundColor:"$accent1"},"input:checked + label:active":{backgroundColor:"$accent1"},"label > svg":{display:"none",width:"90%",height:"90%",stroke:"$highlight3"},"input:checked + label":{backgroundColor:"$accent2"},"input:checked + label > svg":{display:"block"}});function Ss({value:t,onUpdate:e,id:i,disabled:n}){return h.default.createElement(Es,null,h.default.createElement("input",{id:i,type:"checkbox",checked:t,onChange:t=>e(t.currentTarget.checked),disabled:n}),h.default.createElement("label",{htmlFor:i},h.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},h.default.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))))}Qi({component:function(){const{label:t,value:e,onUpdate:i,disabled:n,id:s}=bn();return h.default.createElement(is,{input:!0},h.default.createElement(qn,null,t),h.default.createElement(Ss,{value:e,onUpdate:i,id:s,disabled:n}))}},xs),Tn("div",{display:"grid",columnGap:"$colGap",gridAutoFlow:"column dense",alignItems:"center",variants:{withLock:{true:{gridTemplateColumns:"10px auto","> svg":{cursor:"pointer"}}}}});class _s extends _{constructor(t){super(),this.type="spacial-content",this.style={opacity:1},this.format="jpg",this.tileUrl=function(t){const e=t.length;return t.indexOf("/info.json")===e-10?t.slice(0,-10):t}(t.url),this.id=t.id||`${this.tileUrl}--${t.scaleFactor}`,this.points=t.displayPoints?t.displayPoints:E(t.points,w(t.scaleFactor)),this.tileWidth=t.tileWidth,this.display={x:0,y:0,width:t.width/t.scaleFactor,height:t.height/t.scaleFactor,points:t.points,scale:t.scaleFactor},t.format&&(this.format=t.format)}applyProps(t){if(t.style&&void 0!==t.style.opacity&&(this.style.opacity=t.style.opacity),t.service!==this.service&&(this.service=t.service),t.format?this.format=t.format:this.format="jpg",t.crop){this.cropData=t.crop;const e=g([...this.points]),i=e.length/5,n=t.crop.x||0,s=t.crop.y||0,r=t.crop.x+t.crop.width,o=t.crop.y+t.crop.height;for(let t=0;t<i;t++){const i=5*t;e[i+1]<r&&e[i+3]>n&&e[i+2]<o&&e[i+4]>s?(e[i+1]=qi(e[i+1],n,r),e[i+3]=qi(e[i+3],n,r),e[i+2]=qi(e[i+2],s,o),e[i+4]=qi(e[i+4],s,o)):e[i]=0}y(e,b(-t.crop.x,-t.crop.y)),this.crop?this.crop.set(e):this.crop=e}}static fromTile(t,e,i,n,s,r){i.height=i.height?i.height:i.width;const o=Math.ceil(e.width/n),a=Math.ceil(e.height/n),l=Math.ceil(o/i.width),h=Math.ceil(a/i.height),c=v.grid(l,h),d=v.grid(l,h);for(let p=0;p<h;p++)for(let t=0;t<l;t++){const s=t*i.width,r=p*i.height;d.addPoints(s*n,r*n,t===l-1?e.width:(s+i.width)*n,p===h-1?e.height:(r+i.height)*n),c.addPoints(s,r,t===l-1?o:s+i.width,p===h-1?a:r+i.height)}const u=new _s({url:t,scaleFactor:n,points:c.build(),displayPoints:d.build(),width:e.width,height:e.height,tileWidth:i.width,format:r});return u.applyProps({service:s}),u}getImageUrl(t){const e=this.points.slice(5*t,5*t+5),i=e[3]-e[1],n=e[4]-e[2],s=Math.ceil(i/this.display.scale);return`${this.tileUrl}/${e[1]},${e[2]},${i},${n}/${s>this.tileWidth?this.tileWidth:s},/0/default.${this.format||"jpg"}`}getAllPointsAt(t,e,i){return[[this,f(this.crop||this.points,t),e]]}transform(t){y(this.points,t)}getScheduledUpdates(t,e){return[]}}class Ts extends _{constructor(){super(...arguments),this.type="spacial-content"}getAllPointsAt(t,e,i){return[[this,this.points,e]]}}class Cs extends Ts{constructor(t){super(),this.images=[],this.allImages=[],this.scaleFactors=[],this.aggregateBuffer=g(9),this.isFullyLoaded=!1,this.maxScaleFactor=0,this._scheduleSortByScales=!1,this._sortByScales=()=>{this._scheduleSortByScales=!1,this.allImages.sort(((t,e)=>e.display.width-t.display.width)),this.images=[];let t=.1;for(const e of this.allImages){if(e.display.width<this.renderOptions.minSize&&e.display.height<this.renderOptions.minSize&&!e.priority)continue;if(e instanceof T&&(e.display.width>this.renderOptions.maxImageSize||e.display.height>this.renderOptions.maxImageSize)&&!e.priority)continue;if(Math.abs(e.display.scale-t)<.25||e.priority){const t=this.images.pop();t&&(t instanceof T||t.priority)?(e.priority&&this.images.push(e),this.images.push(t)):e&&this.images.push(e)}else e&&this.images.push(e);t=e.display.scale}0===this.images.length&&(this.images=[...this.allImages]),this.scaleFactors=this.images.map((t=>t.display.scale)),this.maxScaleFactor=Math.max(...this.scaleFactors)},this.loadFullResource=async()=>{if(!this.isFullyLoaded&&this.lazyLoader){this.isFullyLoaded=!0;const t=await this.lazyLoader();this.addImages(t)}},this.fallback=[this.loadFullResource],this.id=t.id,this.points=v.singleBox(t.width,t.height),this.lazyLoader=t.loadFullImages,t.loadFullImages||(this.isFullyLoaded=!0),this.display={x:0,y:0,points:v.singleBox(t.width,t.height),height:t.height,width:t.width,scale:1},this.renderOptions={renderSmallestFallback:!0,renderLayers:2,minSize:255,maxImageSize:1024,quality:1.75,...t.renderOptions||{}},this.addImages(t.images)}applyProps(t){void 0!==t.renderSmallestFallback&&t.renderSmallestFallback!==this.renderOptions.renderSmallestFallback&&(this.renderOptions.renderSmallestFallback=t.renderSmallestFallback),void 0!==t.renderLayers&&t.renderLayers!==this.renderOptions.renderLayers&&(this.renderOptions.renderLayers=t.renderLayers),void 0!==t.minSize&&t.minSize!==this.renderOptions.minSize&&(this.renderOptions.minSize=t.minSize),void 0!==t.maxImageSize&&t.maxImageSize!==this.renderOptions.maxImageSize&&(this.renderOptions.maxImageSize=t.maxImageSize),void 0!==t.quality&&t.quality!==this.renderOptions.quality&&(this.renderOptions.quality=t.quality)}appendChild(t){this.addImages([t])}removeChild(t){-1!==this.images.indexOf(t)&&(this.images=this.images.filter((e=>e!==t)),this.sortByScales())}insertBefore(t,e){this.addImages([t])}hideInstance(){}addImages(t){for(const e of t)e.__parent=this,e.__owner=this.__owner;this.allImages.push(...t.filter(Boolean)),this.sortByScales()}sortByScales(){this._scheduleSortByScales=!0}getScheduledUpdates(t,e){return this._scheduleSortByScales?[this._sortByScales]:this.isFullyLoaded?[]:e>1/this.maxScaleFactor?this.fallback:[]}getAllPointsAt(t,e,i){if(0===this.images.length)return[];const n=function(t,e,i=1){const n=e.length;if(0===n)throw new Error("No resources passed in.");let s=0;for(let r=0;r<n&&e[r]&&e[r].display;r++)s=Math.abs(e[r].display.scale-t)*i<Math.abs(e[s].display.scale-t)?r:s;return s}(1/(i||1)/(window.devicePixelRatio||1),this.images,this.renderOptions.quality),s=this.images.length,r=e?m(e,b(this.x,this.y)):b(this.x,this.y);if(n!==this.images.length-1&&this.images[n+1]){let e=[];for(let t=s-1;t>=n;t--)e.push(t);const o=e[0];this.renderOptions.renderLayers&&(e=e.slice(-Math.min(e.length,this.renderOptions.renderLayers))),this.renderOptions.renderSmallestFallback&&-1===e.indexOf(o)&&e.unshift(o);const a=[];for(let n=0;n<e.length;n++)a.push(...this.images[e[n]].getAllPointsAt(t,r,i));return a}return this.images[n].getAllPointsAt(t,r,i)}}function Ps(t,e,i,n,s){const r=Math.PI/180*s,o=Math.cos(r),a=Math.sin(r);return[o*(i-t)+a*(n-e)+t,o*(n-e)-a*(i-t)+e]}class ks extends _{constructor(t,e){super(),this.type="world-object",this.intersectionBuffer=g(5),this.aggregateBuffer=g(9),this.invertedBuffer=g(9),this.rotation=0,this._updatedList=[];const{x:i=0,y:n=0}=e||{};t?(this.id=t.id||"",this.scale=1,this.layers=t.layers,this.points=g([1,i,n,i+t.width,n+t.height]),this.worldPoints=g([1,i,n,i+t.width,n+t.height]),this.filteredPointsBuffer=g(5*t.layers.length)):(this.id="",this.scale=1,this.layers=[],this.points=g(5),this.worldPoints=g(5),this.filteredPointsBuffer=g(5))}static createWithProps(t){const e=new ks;return e.applyProps(t),e}applyProps(t){const e=t.x||0,i=t.y||0;this.id=t.id;const n=void 0!==t.scale?t.scale:this.scale;this.points[0]=1,this.points[1]=e,this.points[2]=i,this.points[3]=e+t.width,this.points[4]=i+t.height,this.rotation=t.rotation||0,this.worldPoints[3]=this.worldPoints[1]+t.width,this.worldPoints[4]=this.worldPoints[2]+t.height,t.scale&&1!==t.scale&&this.atScale(n),this.scale=n}appendChild(t){0===t.points[0]&&t.points.set(this.points),t.__owner.value=this,this.addLayers([t])}removeChild(t){this.layers=this.layers.filter((e=>e!==t)),this.filteredPointsBuffer=g(5*this.layers.length)}insertBefore(t,e){const i=this.layers.indexOf(e);if(-1===i)return;if(-1!==this.layers.indexOf(t))return;const n=this.layers.slice(0,i),s=this.layers.slice(i);this.layers=[...n,t,...s]}hideInstance(){console.warn("hideInstance: not yet implemented")}getObjectsAt(t,e){this.rotation&&(t=this.applyRotation(t));if(0===f(this.points,t,this.filteredPointsBuffer)[0])return[];const i=this.layers.length,n=[];for(let s=0;s<i;s++){const i=this.layers[s];if(e&&i.isShape){const e=E(i.points,b(this.x,this.y));if(!i.intersects([t[1]-e[1],t[2]-e[2]]))continue}if(0!==f(E(i.points,b(this.x,this.y)),t,this.filteredPointsBuffer)[0]&&n.push(i),e){const s=i;n.push(...s.getObjectsAt(t,e))}}return n}applyRotation(t){if(this.rotation){const e={x:t[1],y:t[2]},i={x:t[1],y:t[4]},n={x:t[3],y:t[2]},s={x:t[3],y:t[4]},r=this.points[1]+(this.points[3]-this.points[1])/2,o=this.points[2]+(this.points[4]-this.points[2])/2,[a,l]=Ps(r,o,e.x,e.y,this.rotation),[h,c]=Ps(r,o,i.x,i.y,this.rotation),[d,u]=Ps(r,o,n.x,n.y,this.rotation),[p,f]=Ps(r,o,s.x,s.y,this.rotation),m=Math.min(a,h,d,p),v=Math.max(a,h,d,p),y=Math.min(l,c,u,f),w=Math.max(l,c,u,f);return g([t[0],m,y,v,w])}return t}getAllPointsAt(t,e,i){const n=m(b(this.x,this.y),w(this.scale),this.aggregateBuffer);this.rotation&&(t=this.applyRotation(t));const s=((t,e,i)=>{const n=t[1]<=e[3]&&t[3]>=e[1]&&t[2]<=e[4]&&t[4]>=e[2],s=i||g(5);return n?(s[0]=1,s[1]=Math.max(t[1],e[1]),s[2]=Math.max(t[2],e[2]),s[3]=Math.min(t[3],e[3]),s[4]=Math.min(t[4],e[4]),s):(s[0]=0,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s)})(t,this.points,this.intersectionBuffer),r=this.layers.length,o=[],a=E(s,m(w(1/this.scale),b(-this.x,-this.y),this.invertedBuffer)),l=e?m(e,n,this.aggregateBuffer):n,h=i*this.scale;for(let c=0;c<r;c++)o.push(...this.layers[c].getAllPointsAt(a,l,h));return o}addLayers(t){const e=[];for(const i of t)-1===this.layers.indexOf(i)&&(e.push(i),5===i.points.length&&(i.points[1]<this.worldPoints[1]/this.scale||i.points[2]<this.worldPoints[2]/this.scale||i.points[3]>this.worldPoints[3]/this.scale||i.points[4]>this.worldPoints[4]/this.scale)&&(i.crop=i.crop||g([1,Math.max(this.worldPoints[1]/this.scale,i.points[1]),Math.max(this.worldPoints[2]/this.scale,i.points[2]),Math.min(this.worldPoints[3]/this.scale,i.points[3]),Math.min(this.worldPoints[4]/this.scale,i.points[4])])));this.layers=this.layers.concat(e),this.filteredPointsBuffer=g(5*this.layers.length)}getScheduledUpdates(t,e){const i=this.layers.length;this._updatedList=[];const n=e*this.scale;for(let s=0;s<i;s++){const e=this.layers[s].getScheduledUpdates(t,n);e&&this._updatedList.push(...e)}return this._updatedList}}class Os extends _{constructor(t=0,e=0,i=100,n="left-to-right"){super(),this.id="world",this.aggregateBuffer=g(9),this.isDirty=!1,this.zones=[],this.triggerQueue=[],this.activatedEvents=[],this._updatedList=[],this.translationBuffer=g(9),this.needsRecalculate=!0,this.emptyPaintables=[],this.renderOrder=[],this.objects=[],this.subscriptions=[],this._propagateEventTargets=[],this._alreadyFlushed=[],this._width=t,this._height=e,this.aspectRatio=Number.isNaN(t/e)?1:t/e,this.viewingDirection=n,this.points=g(5*i),this.filteredPointsBuffer=g(5*i)}get x(){return 0}get y(){return 0}get width(){return this._width}get height(){return this._height}static withProps(t){const e=new Os;return e.applyProps(t),e}applyProps(t){void 0===t.width||void 0===t.height||t.width===this._width&&t.height===this._height||this.resize(t.width,t.height),t.viewingDirection!==this.viewingDirection&&(this.viewingDirection=t.viewingDirection,this.triggerRepaint())}propagateTouchEvent(t,e,i){const n=[];for(const s of i)if(s.x&&s.y){const t=v.singleBox(1,1,s.x,s.y);n.push(this.getObjectsAt(t,!0).reverse())}return n.map((i=>this.propagateEvent(t,e,i,{bubbles:!0,cancelable:!0})))}propagatePointerEvent(t,e,i,n,s={}){const r=v.singleBox(1,1,i,n),o=this.getObjectsAt(r,!0).reverse();return this.propagateEvent(t,e,o,s)}propagateEvent(t,e,i,{bubbles:n=!1,cancelable:s=!1}={}){e.atlasTarget=this,this._propagateEventTargets.length=1,this._propagateEventTargets[0]=this;let r=!1;e.stopPropagation=()=>{r=!0};for(let l=i.length-1;l>=0;l--){this._propagateEventTargets.unshift(i[l][0]);const t=i[l][1].length;if(t)for(let e=0;e<t;e++)this._propagateEventTargets.unshift(i[l][1][e])}const o=this._propagateEventTargets.length;let a=!1;for(let l=0;l<o&&(e.atlasTarget=this._propagateEventTargets[l],e.atlasWorld=this,a=this._propagateEventTargets[l].dispatchEvent(t,e)||a,!r);l++);return a&&this.triggerRepaint(),this._propagateEventTargets}appendChild(t){const e=this.appendWorldObject(t);this.renderOrder.push(e/5)}removeChild(t){const e=this.objects.indexOf(t);if(-1!==e)this.objects[e]=null,this.renderOrder=this.renderOrder.filter((t=>t!==e)),this.points[5*e]=0,this.triggerRepaint(),this.needsRecalculate=!0;else for(const i of this.objects)if(i&&i.id===t.id)return void this.removeChild(i)}insertBefore(t,e){const i=this.objects.indexOf(e);if(-1===i)return;const n=this.appendWorldObject(t);this.renderOrder.splice(i-1,0,n/5)}hideInstance(){}asWorldObject(){return null}addZone(t){this.zones.push(t)}selectZone(t){if("string"==typeof t){const e=this.zones.length;for(let i=0;i<e;i++)if(this.zones[i].id===t)return this.selectedZone=i,void this.trigger("zone-changed")}else this.zones[t]&&(this.selectedZone=t,this.trigger("zone-changed"))}deselectZone(){this.selectedZone=void 0}getActiveZone(){if(this.selectedZone)return this.zones[this.selectedZone]}hasActiveZone(){return void 0!==this.selectedZone}checkResizeInternalBuffer(){if(this.points.length/5===this.objects.length){const t=this.points,e=g(2*this.points.length);e.set(t,0),this.points=e}}appendWorldObject(t){this.checkResizeInternalBuffer();const e=5*this.objects.length,i=t.points;return t.points=this.points.subarray(5*this.objects.length,5*this.objects.length+5),t.points[1]=i[1],t.points[2]=i[2],t.points[3]=i[3],t.points[4]=i[4],this.objects.push(t),this.filteredPointsBuffer=g(5*this.objects.length),this.needsRecalculate=!0,this.triggerRepaint(),e}recalculateWorldSize(){let t=!1;if(this.needsRecalculate){const e=new Int32Array(this.objects.length),i=new Int32Array(this.objects.length),n=this.renderOrder.length;for(let t=0;t<n;t++){const n=this.renderOrder[t];this.objects[n]&&(e[t]=this.points[5*n+3],i[t]=this.points[5*n+4])}const s=Math.max(...e);s!==this._width&&(this._width=s,t=!0);const r=Math.max(...i);r!==this._height&&(this._height=r,t=!0),t&&this.trigger("recalculate-world-size",{width:s,height:r}),this.needsRecalculate=!1}return t}addObjectAt(t,e){e.width&&!e.height?e.height=e.width/t.width*t.height:e.height&&!e.width&&(e.width=e.height/t.height*t.width),e&&e.width&&e.height||(e.width=t.width,e.height=t.height);const{width:i,x:n,y:s}=e,r=i/t.width;this.checkResizeInternalBuffer(),this.points.set(v.singleBox(t.width,t.height,0,0),5*this.objects.length);const o=new ks(t);return o.points=this.points.subarray(5*this.objects.length,5*this.objects.length+5),this.objects.push(o),this.scaleWorldObject(this.objects.length-1,r),this.translateWorldObject(this.objects.length-1,n,s),this.filteredPointsBuffer=g(2*this.points.length),this.triggerRepaint(),this.needsRecalculate=!0,o}scaleWorldObject(t,e){y(this.points.subarray(5*t,5*t+5),x(e,this.points[5*t+1],this.points[5*t+2]));const i=this.objects[t];i&&(i.atScale(e),this.triggerRepaint())}translateWorldObject(t,e,i){y(this.points.subarray(5*t,5*t+5),b(e,i));const n=this.objects[t];n&&(n.translate(e,i),this.triggerRepaint())}resize(t,e){return this._width=t,this._height=e,this.aspectRatio=t/e,this.triggerRepaint(),this}getObjects(){return this.objects}getPoints(){return this.points}getPointsFromViewer(t,e){const i=v.singleBox(t.width,t.height,t.x,t.y);return this.getPointsAt(i,e,t.scale)}addLayoutSubscriber(t){return this.subscriptions.push(t),()=>{this.subscriptions.splice(this.subscriptions.indexOf(t),1)}}getScheduledUpdates(t,e){const i=f(this.points,t,this.filteredPointsBuffer),n=this.objects.length;this._updatedList=[];for(let s=0;s<n;s++)if(0!==i[5*s]){if(!this.objects[s])continue;this._updatedList.push(...this.objects[s].getScheduledUpdates(t,e))}return this._updatedList}getObjectsAt(t,e=!1){const i=this.getActiveZone(),n=f(this.points,t,this.filteredPointsBuffer),s=this.renderOrder.length,r=[];for(let o=0;o<s;o++){const s=this.renderOrder[o];if(0!==n[5*s]){const n=this.objects[s];if(!n||i&&-1===i.objects.indexOf(n))continue;if("world-object"!==n.type){r.push([n,[n]]);continue}e?r.push([n,n.getObjectsAt(t,e)]):r.push([n,this.emptyPaintables])}}return r}getPointsAt(t,e,i=1){const n=this.getObjectsAt(t),s=m(w(i),b(-t[1],-t[2]),this.translationBuffer),r=e?m(e,s,this.aggregateBuffer):s,o=n.length,a=[];for(let l=0;l<o;l++)n[l]&&a.push(...n[l][0].getAllPointsAt(t,r,i));return a}flushSubscriptions(){if(this.triggerQueue.length){this._alreadyFlushed=[];const t=this.triggerQueue.length;for(let e=0;e<t;e++){if(-1!==this._alreadyFlushed.indexOf(this.triggerQueue[e][0]))continue;void 0===this.triggerQueue[e][1]&&this._alreadyFlushed.push(this.triggerQueue[e][0]);const t=this.subscriptions.length;for(let i=0;i<t;i++)this.subscriptions[i].apply(null,this.triggerQueue[e])}this.triggerQueue=[]}}trigger(t,e){this.triggerQueue.push([t,e])}triggerEventActivation(){this.trigger("event-activation")}triggerRepaint(){this.trigger("repaint")}gotoRegion(t){this.trigger("goto-region",t)}goHome(t=!1){this.trigger("go-home",{immediate:t})}zoomTo(t,e,i){this.trigger("zoom-to",{point:e,factor:t,stream:i})}zoomIn(t){this.trigger("zoom-to",{point:t,factor:.5})}zoomOut(t){this.trigger("zoom-to",{point:t,factor:2})}constraintBounds(t){this.trigger("constrain-bounds",{immediate:t})}}const Rs={margin:0};const As=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,Is={},Ls=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"];class $s extends _{constructor(){super(),this.type="spacial-content",this.hoverEvents=!1,this.activeEvents=!1,this.display={x:0,y:0,scale:1,width:-1,height:-1,points:g(5)},this._parsed={border:{id:null,match:[]},outline:{id:null,match:[]}},this.props={},this.addHover=()=>{this.hovering=!0,this.__revision++},this.removeHover=()=>{this.hovering=!1,this.pressing=!1,this.__revision++},this.addPress=()=>{this.pressing=!0,this.__revision++},this.removePress=()=>{this.pressing=!1,this.__revision++},this.id=S(12),this.points=g(5)}getAllPointsAt(t,e){return[[this,this.points,e]]}applyProps(t={}){let e=!1;if(t.interactive!==this.props.interactive&&(e=!0,this.props.interactive=t.interactive),t.style){const i=t.border||t.style.border;if(i!==this._parsed.border.id)if(i){const t=Is[i]||As.exec(i)||As.exec(i);t&&(this._parsed.border.id=i,this._parsed.border.match=Is[i]=t)}else this._parsed.border.id=null,this._parsed.border.match=[];if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(t.style.outline){const e=Is[t.style.outline]||As.exec(t.style.outline)||As.exec(t.style.outline);e&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=Is[t.style.outline]=e)}else this._parsed.outline.id=null,this._parsed.outline.match=[];this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,e=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,e=!0);for(const n of Ls)if(this.props.style[n]!==t.style[n]){e=!0;break}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0)}t.href!==this.props.href&&(this.props.href=t.href,e=!0),t.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=t.hrefTarget,e=!0),t.title!==this.props.title&&(this.props.title=t.title,e=!0),t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,e=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,e=!0),t.html!==this.props.html&&(this.props.html=t.html,e=!0),t.target&&(t.target.width===this.display.width&&t.target.height===this.display.height&&t.target.x===this.points[1]&&t.target.y===this.points[2]||(e=!0,this.points=v.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=v.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height)),e&&this.__revision++}}const Ms=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,zs={},Bs=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"];class Fs extends _{constructor(){super(),this.type="spacial-content",this.isShape=!0,this.hoverEvents=!1,this.activeEvents=!1,this.display={x:0,y:0,scale:1,width:-1,height:-1,points:g(5)},this.boundingBox=null,this._parsed={border:{id:null,match:[]},outline:{id:null,match:[]}},this.props={},this.shape={type:"none"},this.addHover=()=>{this.hovering=!0,this.__revision++},this.removeHover=()=>{this.hovering=!1,this.pressing=!1,this.__revision++},this.addPress=()=>{this.pressing=!0,this.__revision++},this.removePress=()=>{this.pressing=!1,this.__revision++},this.id=S(12),this.points=g(5),this.shape={type:"none"}}updateBoundingBox(){if("none"===this.shape.type)return;const t=this.shape.points;if(this.shape.points.length>2){const e=Math.min(...t.map((t=>t[0]))),i=Math.min(...t.map((t=>t[1]))),n=Math.max(0,...t.map((t=>t[0]))),s=Math.max(0,...t.map((t=>t[1])));this.boundingBox={x:e,y:i,width:n-e,height:s-i}}else this.boundingBox=null}intersects(t){if(!t||"none"===this.shape.type)return!1;const[e,i]=t,n=this.shape.points;let s=this.boundingBox;if(s||(this.updateBoundingBox(),s=this.boundingBox),!s)return!1;if(e<s.x||e>s.x+s.width||i<s.y||i>s.height+s.y)return!1;let r=!1;for(let o=0,a=n.length-1;o<n.length;a=o++)n[o][1]>i!=n[a][1]>i&&e<(n[a][0]-n[o][0])*(i-n[o][1])/(n[a][1]-n[o][1])+n[o][0]&&(r=!r);return r}getAllPointsAt(t,e){return t[3]-t[1]==1&&t[4]-t[2]==1?this.intersects([t[1],t[2]])?[[this,this.points,e]]:[]:[[this,this.points,e]]}applyProps(t={}){let e=!1;if(t.points)if("polygon"!==this.shape.type||this.shape.points.length!==t.points.length)this.shape={type:"polygon",points:t.points,open:t.open},this.updateBoundingBox();else{let e=!1;const i=t.points.length;for(let n=0;n<i;n++)if(t.points[n][0]!==this.shape.points[n][0]||t.points[n][1]!==this.shape.points[n][1]){e=!0;break}e&&(this.shape={type:"polygon",points:t.points,open:t.open},this.updateBoundingBox())}if(t.interactive!==this.props.interactive&&(e=!0,this.props.interactive=t.interactive),(t.open||!1===t.open)&&(e=!0,this.shape.open=t.open),t.style){const i=t.border||t.style.border;if(i!==this._parsed.border.id)if(i){const t=zs[i]||Ms.exec(i)||Ms.exec(i);t&&(this._parsed.border.id=i,this._parsed.border.match=zs[i]=t)}else this._parsed.border.id=null,this._parsed.border.match=[];if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(t.style.outline){const e=zs[t.style.outline]||Ms.exec(t.style.outline)||Ms.exec(t.style.outline);e&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=zs[t.style.outline]=e)}else this._parsed.outline.id=null,this._parsed.outline.match=[];this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,e=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,e=!0);for(const n of Bs)if(this.props.style[n]!==t.style[n]){e=!0;break}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0)}t.href!==this.props.href&&(this.props.href=t.href,e=!0),t.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=t.hrefTarget,e=!0),t.title!==this.props.title&&(this.props.title=t.title,e=!0),t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,e=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,e=!0),t.html!==this.props.html&&(this.props.html=t.html,e=!0),t.target&&(t.target.width===this.display.width&&t.target.height===this.display.height&&t.target.x===this.points[1]&&t.target.y===this.points[2]||(e=!0,this.points=v.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=v.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height)),e&&this.__revision++}}class Ds extends _{constructor(){super(),this.type="spacial-content",this.color="#000",this.text="",this.display={x:0,y:0,scale:1,width:100,height:100,points:g(5)},this.interactive=!1,this.props={font:"18px Arial, sans-serif",lineHeight:1,textAlign:"left",verticalAlign:"top",paddingX:0,paddingY:0,fitParent:!1,lineBreak:"auto",strokeText:!1,sizeToFill:!1,maxFontSizeToFill:void 0,allowNewLine:!0,justifyLines:!1,renderHDPI:!1,textDecoration:"none",interactive:!1,relativeSize:!1},this.id="",this.points=g(5)}getAllPointsAt(t,e){return[[this,this.points,e]]}applyProps({id:t,target:e,text:i,color:n,backgroundColor:s,fontSize:r=18,interactive:o,fontFamily:a="Arial, sans-serif",...l}){l.font=`${r}px ${a}`,this.interactive=o||!1,void 0!==i&&(this.text=i||""),n&&(this.color=n),s&&(this.backgroundColor=s),t&&(this.id=t),e&&(this.points=v.singleBox(e.width,e.height,e.x,e.y),this.display.points=this.points,this.display.width=e.width,this.display.height=e.height),this.props={...this.props,...l},this.__revision++}}const js=Math.pow,Ns=Math.sqrt,Ws=Math.sin,Us=Math.cos,Hs=Math.PI,Vs=1.70158,Gs=1.525*Vs,Xs=2*Hs/3,Ys=2*Hs/4.5,Ks=function(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},Qs={linear:t=>t,easeInQuad:function(t){return t*t},easeOutQuad:function(t){return 1-(1-t)*(1-t)},easeInOutQuad:function(t){return t<.5?2*t*t:1-js(-2*t+2,2)/2},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1-js(1-t,3)},easeInOutCubic:function(t){return t<.5?4*t*t*t:1-js(-2*t+2,3)/2},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1-js(1-t,4)},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-js(-2*t+2,4)/2},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1-js(1-t,5)},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1-js(-2*t+2,5)/2},easeInSine:function(t){return 1-Us(t*Hs/2)},easeOutSine:function(t){return Ws(t*Hs/2)},easeInOutSine:function(t){return-(Us(Hs*t)-1)/2},easeInExpo:function(t){return 0===t?0:js(2,10*t-10)},easeOutExpo:function(t){return 1===t?1:1-js(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:t<.5?js(2,20*t-10)/2:(2-js(2,-20*t+10))/2},easeInCirc:function(t){return 1-Ns(1-js(t,2))},easeOutCirc:function(t){return Ns(1-js(t-1,2))},easeInOutCirc:function(t){return t<.5?(1-Ns(1-js(2*t,2)))/2:(Ns(1-js(-2*t+2,2))+1)/2},easeInBack:function(t){return 2.70158*t*t*t-Vs*t*t},easeOutBack:function(t){return 1+2.70158*js(t-1,3)+Vs*js(t-1,2)},easeInOutBack:function(t){return t<.5?js(2*t,2)*(7.189819*t-Gs)/2:(js(2*t-2,2)*((Gs+1)*(2*t-2)+Gs)+2)/2},easeInElastic:function(t){return 0===t?0:1===t?1:-js(2,10*t-10)*Ws((10*t-10.75)*Xs)},easeOutElastic:function(t){return 0===t?0:1===t?1:js(2,-10*t)*Ws((10*t-.75)*Xs)+1},easeInOutElastic:function(t){return 0===t?0:1===t?1:t<.5?-js(2,20*t-10)*Ws((20*t-11.125)*Ys)/2:js(2,-20*t+10)*Ws((20*t-11.125)*Ys)/2+1},easeInBounce:function(t){return 1-Ks(1-t)},easeOutBounce:Ks,easeInOutBounce:function(t){return t<.5?(1-Ks(1-2*t))/2:(1+Ks(2*t-1))/2}};class qs{constructor(t){this.runtime=t,this.pendingTransition={from:g(5),to:g(5),elapsed_time:0,done:!0,total_time:0,timingFunction:Qs.easeInOutQuad,constrain:!1}}hasPending(){return!this.pendingTransition.done}getPendingTransition(){return this.pendingTransition}getPendingFrom(){return this.pendingTransition.from}customTransition(t){t(this.pendingTransition)}stopTransition(){this.pendingTransition.from=g(this.runtime.target),this.pendingTransition.to=g(this.runtime.target),this.pendingTransition.done=!0,this.pendingTransition.elapsed_time=0,this.pendingTransition.total_time=0}runTransition(t,e){if(!this.pendingTransition.done){const i=this.pendingTransition,n=0===i.total_time?0:(i.elapsed_time+e)/i.total_time,s=0===i.total_time?1:0===n?0:i.timingFunction(n);t[1]=i.from[1]+(i.to[1]-i.from[1])*s,t[2]=i.from[2]+(i.to[2]-i.from[2])*s,t[3]=i.from[3]+(i.to[3]-i.from[3])*s,t[4]=i.from[4]+(i.to[4]-i.from[4])*s,this.pendingTransition.elapsed_time+=e,this.pendingTransition.elapsed_time>=this.pendingTransition.total_time&&(this.pendingTransition.done=!0,this.pendingTransition.constrain&&this.constrainBounds({transition:{duration:0===this.pendingTransition.total_time?0:500,easing:Qs.easeOutExpo}}))}}zoomTo(t,{origin:e,stream:i=!1,transition:n}={}){const s=this.runtime.getZoomedPosition(t,{origin:e}),r=Math.abs(1-t);this.applyTransition(s,n,{duration:2e3*r,easing:Qs.easeOutExpo,constrain:!0},{stream:!1})}constrainBounds({transition:t,panPadding:e=0}={}){const[i,n]=this.runtime.constrainBounds(this.runtime.target,{panPadding:e});i&&(this.applyTransition(n,t,{duration:500,easing:Qs.easeOutQuart,constrain:!1}),this.runtime.updateNextFrame())}applyTransition(t,e,i,{stream:n}={}){this.pendingTransition.from=g(this.runtime.target),this.pendingTransition.to=t,n||(this.pendingTransition.elapsed_time=0),this.pendingTransition.done=!1,this.pendingTransition.total_time=void 0!==(null==e?void 0:e.duration)?e.duration:void 0!==(null==i?void 0:i.duration)?i.duration:1e3,this.pendingTransition.constrain=void 0!==(null==e?void 0:e.constrain)?e.constrain:void 0!==(null==i?void 0:i.constrain)&&i.constrain,this.pendingTransition.timingFunction=(null==e?void 0:e.easing)||(null==i?void 0:i.easing)||Qs.easeInOutSine}goToRegion(t,{transition:e}={}){const i=this.runtime.clampRegion(t);this.applyTransition(v.singleBox(i.width,i.height,i.x,i.y),e,{duration:1e3,easing:Qs.easeOutExpo,constrain:!0}),this.runtime.updateNextFrame()}}class Zs{constructor(t,e,i,n=[],s){this.id=S(),this.ready=!1,this.transformBuffer=g(500),this.lastTarget=g(5),this.zoomBuffer=g(5),this.logNextRender=!1,this.pendingUpdate=!0,this.isCommitting=!1,this.firstRender=!0,this.mode="explore",this.controllers=[],this.controllersRunning=!1,this.controllerStopFunctions=[],this.maxScaleFactor=1,this._viewerToWorld={x:0,y:0},this._lastGoodScale=1,this.hooks={useFrame:[],useBeforeFrame:[],useAfterPaint:[],useAfterFrame:[]},this.hookOptions={filters:{grayscale:0,contrast:0,brightness:0,saturate:0,sepia:0,invert:0,hueRotate:0,blur:0}},this._viewport={x:0,y:0,width:0,height:0},this.setViewport=t=>{const e=Math.round(void 0===t.x?this.target[1]:t.x),i=Math.round(void 0===t.y?this.target[2]:t.y);t.width?this.target[3]=e+t.width:this.target[3]=this.target[3]-this.target[1]+e,t.height?this.target[4]=i+t.height:this.target[4]=this.target[4]-this.target[2]+i,Math.abs(this.target[1]-e)>.01&&(this.target[1]=e),Math.abs(this.target[2]-i)>.01&&(this.target[2]=i),this.pendingUpdate=!0},this.render=t=>{const e=t-this.lastTime;if(this.isCommitting||this.fpsLimit&&e<1e3/this.fpsLimit)return void(this.stopId=window.requestAnimationFrame(this.render));this.lastTime=t,this.world.flushSubscriptions(),this.stopId=window.requestAnimationFrame(this.render),this.hook("useFrame",e);const i=this.pendingUpdate,n=this.renderer.pendingUpdate();if(this.transitionManager.hasPending()&&(this.transitionManager.runTransition(this.target,e),this.pendingUpdate=!0,this.updateControllerPosition()),!this.firstRender&&!i&&!n&&this.target[0]===this.lastTarget[0]&&this.target[1]===this.lastTarget[1]&&this.target[2]===this.lastTarget[2]&&this.target[3]===this.lastTarget[3]&&this.target[4]===this.lastTarget[4])return;this.hook("useBeforeFrame",e),this.renderer.beforeFrame(this.world,e,this.target,this.hookOptions);const s=this.getScaleFactor(),r=this.renderer.getPointsAt(this.world,this.target,this.aggregate,s),o=r.length;for(let h=0;h<o;h++){const t=r[h][0],e=r[h][1],i=r[h][2],n=i?E(e,i,this.transformBuffer):e;this.renderer.prepareLayer(t,t.__parent&&i?E(t.__parent.crop||t.__parent.points,i):n);const s=n.length/5;for(let r=0;r<s;r++){const e=5*r;0!==n[e]&&(this.renderer.paint(t,r,n[e+1],n[e+2],n[e+3]-n[e+1],n[e+4]-n[e+2]),this.hook("useAfterPaint",t))}this.renderer.finishLayer(t,e)}this.renderer.afterFrame(this.world,e,this.target,this.hookOptions),this.hook("useAfterFrame",e),this.lastTarget[0]=this.target[0],this.lastTarget[1]=this.target[1],this.lastTarget[2]=this.target[2],this.lastTarget[3]=this.target[3],this.lastTarget[4]=this.target[4],this.firstRender=!1,this.pendingUpdate=!1,this.logNextRender=!1,this.renderer.isReady()&&(this.ready=!0,this.world.trigger("ready")),this.world.flushSubscriptions();const a=this.world.getScheduledUpdates(this.target,s),l=a.length;if(l>0)for(let h=0;h<l;h++){const t=a[l-h-1]();t?t.then((()=>{this.pendingUpdate=!0})):this.pendingUpdate=!0}},this.renderer=t,this.world=e,this.options={maxOverZoom:1,maxUnderZoom:1,visibilityRatio:1.5,...s||{}},this.target=v.projection(i),this.manualHomePosition=!1,this.pendingUpdate=!0,this.homePosition=v.projection(this.world),this.manualFocalPosition=!1,this.focalPosition=this.target,this.updateFocalPosition(),this.transitionManager=new qs(this),this.aggregate=w(1),this.world.addLayoutSubscriber((t=>{"repaint"===t&&(this.pendingUpdate=!0),"recalculate-world-size"===t&&(this.manualHomePosition||(this.setHomePosition(),this.goHome()),this.updateFocalPosition())})),this.lastTime=performance.now(),this.controllers=n,this.render(this.lastTime),this.startControllers()}get x(){return this.target[1]}set x(t){this.target[1]=t}get y(){return this.target[2]}set y(t){this.target[2]=t}get x2(){return this.target[3]}set x2(t){this.target[3]=t}get y2(){return this.target[4]}set y2(t){this.target[4]=t}get width(){return this.target[3]-this.target[1]}set width(t){this.target[3]=this.target[1]+t}get height(){return this.target[4]-this.target[2]}set height(t){this.target[4]=this.target[2]=t}setHomePosition(t){this.homePosition.set(v.projection(t||this.world)),this.pendingUpdate=!0}startControllers(){if(!this.controllersRunning){for(const t of this.controllers)this.controllerStopFunctions.push(t.start(this));this.controllersRunning=!0}}stopControllers(){if(this.controllersRunning){for(const t of this.controllerStopFunctions)t();this.controllersRunning=!1,this.controllerStopFunctions=[]}}updateControllerPosition(){for(const t of this.controllers)t.updatePosition(this.x,this.y,this.width,this.height)}triggerResize(){this.renderer.triggerResize&&this.renderer.triggerResize(),this.pendingUpdate=!0}addController(t){this.controllers.push(t),this.controllersRunning&&t.start(this),this.pendingUpdate=!0}cover(){return this.goHome({cover:!0})}getRendererScreenPosition(){return this.renderer.getRendererScreenPosition()}updateRendererScreenPosition(){this.pendingUpdate=!0,this.renderer.resize()}setOptions(t){this.options={...this.options,...t}}goHome(t={}){if(this.world.width<=0||this.world.height<=0)return;const e=this.getScaleFactor(),i=t.position?{x:t.position[1],y:t.position[2],width:t.position[3]-t.position[1],height:t.position[4]-t.position[2]}:{x:this.homePosition[1],y:this.homePosition[2],width:this.homePosition[3]-this.homePosition[1],height:this.homePosition[4]-this.homePosition[2]},n=this.width*e,s=this.height*e,r=i.width/n,o=i.height/s,a=n/s;if(t.cover?r>o:r<o){const t=a*i.height,e=(t-i.width)/2;this.target[1]=Math.round(-e+i.x),this.target[2]=Math.round(i.y),this.target[3]=Math.round(t-e+i.x),this.target[4]=Math.round(i.height+i.y)}else{const t=i.width/a,e=(t-i.height)/2;this.target[1]=Math.round(i.x),this.target[2]=Math.round(i.y-e),this.target[3]=Math.round(i.x+i.width),this.target[4]=Math.round(i.y+t-e)}this.constrainBounds(this.target),this.updateControllerPosition()}resize(t,e,i,n){this.updateFocalPosition(t-e,i-n);const s=e/t,r=n/i;this.target[3]=this.target[1]+(this.target[3]-this.target[1])*s,this.target[4]=this.target[2]+(this.target[4]-this.target[2])*r,this.goHome({position:this.focalPosition}),this.renderer.resize(e,n),this.pendingUpdate=!0}updateFocalPosition(t,e){if(!this.manualFocalPosition){const t=this.width,e=this.height,i=Math.min(t,e),n=0,s=0,r=this.x+n,o=this.y+s;if(t<e){const t=this.height-this.width;this.focalPosition=v.projection({x:r,y:o+t/2,width:i-2*n,height:i-2*s}),this.pendingUpdate=!0}else{const t=this.width-this.height;this.focalPosition=v.projection({x:r+t/2,y:o,width:i-2*n,height:i-2*s}),this.pendingUpdate=!0}}}getViewport(){return this._viewport.x=this.target[1],this._viewport.y=this.target[2],this._viewport.width=this.target[3]-this.target[1],this._viewport.height=this.target[4]-this.target[2],this._viewport}constrainBounds(t,{panPadding:e=0,ref:i=!1}={}){const{minX:n,maxX:s,minY:r,maxY:o}=this.getBounds({target:t,padding:e});let a=!1;const l=i?t:g(t),h=Math.round(t[3]-t[1]),c=Math.round(t[4]-t[2]);return n>t[1]&&(a=!0,l[1]=n,l[3]=n+h),r>t[2]&&(a=!0,l[2]=r,l[4]=r+c),s<t[1]&&(a=!0,l[1]=s,l[3]=s+h),o<t[2]&&(a=!0,l[2]=o,l[4]=o+c),[a,l]}getBounds(t){const e=t.target||this.target,i=t.padding,n=this.options.visibilityRatio,s=Math.abs(1-n);if(this.world.hasActiveZone()){const t=this.world.getActiveZone();if(t){const n=e[3]-e[1]<t.points[3]-t.points[1],s=e[4]-e[2]<t.points[4]-t.points[2];return{minX:n?t.points[1]-i:t.points[1]+(t.points[3]-t.points[1])/2-(e[3]-e[1])/2,maxX:s?t.points[2]-i:t.points[2]+(t.points[4]-t.points[2])/2-(e[4]-e[2])/2,minY:n?t.points[3]+i:t.points[1]+(t.points[3]-t.points[1])/2-(e[3]-e[1])/2,maxY:s?t.points[4]+i:t.points[2]+(t.points[4]-t.points[2])/2-(e[4]-e[2])/2}}}const r=e[3]-e[1],o=-r*s,a=this.world.width-r-o,l=e[4]-e[2],h=-l*s,c=this.world.height-l-h,d=Math.round(Math.max(o,a)),u=Math.round(Math.min(o,a)),p=Math.round(Math.max(h,c));return{minX:u,maxX:d,minY:Math.round(Math.min(h,c)),maxY:p}}getScaleFactor(t=!1){const e=this.renderer.getScale(this.target[3]-this.target[1],this.target[4]-this.target[2],t);return 0===e?this._lastGoodScale:(this._lastGoodScale=e,e)}getZoomedPosition(t,{origin:e,fromPos:i}){var n;const s=i?{width:i[3]-i[1],height:i[4]-i[2]}:void 0,r=s?this.renderer.getScale(s.width,s.height):this.getScaleFactor(),o=s?s.width:this.width,a=s?s.height:this.height,l=null==(n=this.getRendererScreenPosition())?void 0:n.width,h=this.world.width,c=l?l/h:1,d=this.options.maxUnderZoom,u=Math.max(c||1,this.options.maxOverZoom),p=1/t,f=r*p;if(p<1){const e=o*r,i=a*r;if(this.world.width/e>this.world.height/i){this.world.width*f<~~(o*r)*d&&(t=this.world.width*r/(o*r*d))}else{this.world.height*f<~~(a*r)*d&&(t=this.world.height*r/(a*r*d))}}else f>u&&(t=r/u);const g=E(this.target,x(t,e?e.x:this.target[1]+(this.target[3]-this.target[1])/2,e?e.y:this.target[2]+(this.target[4]-this.target[2])/2),this.zoomBuffer);return this.constrainBounds(g,{ref:!0,panPadding:100}),g}clampRegion({x:t,y:e,width:i,height:n,padding:s=0}){const r=this.width,o=this.height,a=t-s,l=e-s,h=i+2*s,c=n+2*s;if(i/r<n/o){const t=c/o*r;return{x:a-(t-h)/2,y:l,width:t,height:c}}const d=h/r*o;return{x:a,y:l-(d-c)/2,width:h,height:d}}viewerToWorld(t,e){const i=this.getScaleFactor();return this._viewerToWorld.x=this.target[1]+t/i,this._viewerToWorld.y=this.target[2]+e/i,this._viewerToWorld}worldToViewer(t,e,i,n){const s=v.singleBox(i,n,t,e);return y(s,m(w(this.getScaleFactor()),b(-this.target[1],-this.target[2]))),{x:s[1],y:s[2],width:s[3]-s[1],height:s[4]-s[2],strand:s}}setScale(t,e){y(this.target,x(t,e?e.x:this.target[1]+(this.target[3]-this.target[1])/2,e?e.y:this.target[2]+(this.target[4]-this.target[2])/2)),this.pendingUpdate=!0}syncTo(t){const e=this.target;return this.target=t.target,this.pendingUpdate=!0,()=>{this.target=e}}stop(){return void 0!==this.stopId&&(window.cancelAnimationFrame(this.stopId),this.stopId=void 0),()=>{this.render(performance.now())}}reset(){this.renderer.reset()}selectZone(t){this.world.selectZone(t),this.pendingUpdate=!0}deselectZone(){this.world.deselectZone(),this.pendingUpdate=!0}hook(t,e){const i=this.hooks[t].length;if(0!==i)for(let n=0;n<i;n++)this.hooks[t][n](e)}registerHook(t,e){return this.hooks[t].push(e),()=>{this.hooks[t]=this.hooks[t].filter((t=>t!==e))}}updateNextFrame(){this.pendingUpdate=!0}}const Js="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,tr="function"==typeof AbortController?AbortController:class{constructor(){this.signal=new nr}abort(t=new Error("This operation was aborted")){this.signal.reason=t,this.signal.dispatchEvent({type:"abort",target:this.signal})}},er="function"==typeof AbortSignal,ir="function"==typeof tr.AbortSignal,nr=er?AbortSignal:ir?tr.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(t){"abort"===t.type&&(this.aborted=!0,this.onabort(t),this._listeners.forEach((e=>e(t)),this))}onabort(){}addEventListener(t,e){"abort"===t&&this._listeners.push(e)}removeEventListener(t,e){"abort"===t&&(this._listeners=this._listeners.filter((t=>t!==e)))}},sr=new Set,rr=(t,e)=>{const i=`LRU_CACHE_OPTION_${t}`;lr(i)&&hr(i,`${t} option`,`options.${e}`,fr)},or=(t,e)=>{const i=`LRU_CACHE_METHOD_${t}`;if(lr(i)){const{prototype:n}=fr,{get:s}=Object.getOwnPropertyDescriptor(n,t);hr(i,`${t} method`,`cache.${e}()`,s)}},ar=(...t)=>{"object"==typeof process&&process&&"function"==typeof process.emitWarning?process.emitWarning(...t):console.error(...t)},lr=t=>!sr.has(t),hr=(t,e,i,n)=>{sr.add(t);ar(`The ${e} is deprecated. Please use ${i} instead.`,"DeprecationWarning",t,n)},cr=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),dr=t=>cr(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ur:null:null;class ur extends Array{constructor(t){super(t),this.fill(0)}}class pr{constructor(t){if(0===t)return[];const e=dr(t);this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class fr{constructor(t={}){const{max:e=0,ttl:i,ttlResolution:n=1,ttlAutopurge:s,updateAgeOnGet:r,updateAgeOnHas:o,allowStale:a,dispose:l,disposeAfter:h,noDisposeOnSet:c,noUpdateTTL:d,maxSize:u=0,maxEntrySize:p=0,sizeCalculation:f,fetchMethod:g,fetchContext:m,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:y,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:b,ignoreFetchAbort:x}=t,{length:E,maxAge:S,stale:_}=t instanceof fr?{}:t;if(0!==e&&!cr(e))throw new TypeError("max option must be a nonnegative integer");const T=e?dr(e):Array;if(!T)throw new Error("invalid max value: "+e);if(this.max=e,this.maxSize=u,this.maxEntrySize=p||this.maxSize,this.sizeCalculation=f||E,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=g||null,this.fetchMethod&&"function"!=typeof this.fetchMethod)throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=m,!this.fetchMethod&&void 0!==m)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(e).fill(null),this.valList=new Array(e).fill(null),this.next=new T(e),this.prev=new T(e),this.head=0,this.tail=0,this.free=new pr(e),this.initialFill=1,this.size=0,"function"==typeof l&&(this.dispose=l),"function"==typeof h?(this.disposeAfter=h,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!c,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!x,0!==this.maxEntrySize){if(0!==this.maxSize&&!cr(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!cr(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!a||!!_,this.noDeleteOnStaleGet=!!y,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!o,this.ttlResolution=cr(n)||0===n?n:1,this.ttlAutopurge=!!s,this.ttl=i||S||0,this.ttl){if(!cr(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(0===this.max&&0===this.ttl&&0===this.maxSize)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){const t="LRU_CACHE_UNBOUNDED";if(lr(t)){sr.add(t);ar("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,fr)}}_&&rr("stale","allowStale"),S&&rr("maxAge","ttl"),E&&rr("length","sizeCalculation")}getRemainingTTL(t){return this.has(t,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new ur(this.max),this.starts=new ur(this.max),this.setItemTTL=(t,e,i=Js.now())=>{if(this.starts[t]=0!==e?i:0,this.ttls[t]=e,0!==e&&this.ttlAutopurge){const i=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),e+1);i.unref&&i.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?Js.now():0};let t=0;const e=()=>{const e=Js.now();if(this.ttlResolution>0){t=e;const i=setTimeout((()=>t=0),this.ttlResolution);i.unref&&i.unref()}return e};this.getRemainingTTL=i=>{const n=this.keyMap.get(i);return void 0===n?0:0===this.ttls[n]||0===this.starts[n]?1/0:this.starts[n]+this.ttls[n]-(t||e())},this.isStale=i=>0!==this.ttls[i]&&0!==this.starts[i]&&(t||e())-this.starts[i]>this.ttls[i]}updateItemAge(t){}setItemTTL(t,e,i){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new ur(this.max),this.removeItemSize=t=>{this.calculatedSize-=this.sizes[t],this.sizes[t]=0},this.requireSize=(t,e,i,n)=>{if(this.isBackgroundFetch(e))return 0;if(!cr(i)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(i=n(e,t),!cr(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return i},this.addItemSize=(t,e)=>{if(this.sizes[t]=e,this.maxSize){const e=this.maxSize-this.sizes[t];for(;this.calculatedSize>e;)this.evict(!0)}this.calculatedSize+=this.sizes[t]}}removeItemSize(t){}addItemSize(t,e){}requireSize(t,e,i,n){if(i||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:t=this.allowStale}={}){if(this.size)for(let e=this.tail;this.isValidIndex(e)&&(!t&&this.isStale(e)||(yield e),e!==this.head);)e=this.prev[e]}*rindexes({allowStale:t=this.allowStale}={}){if(this.size)for(let e=this.head;this.isValidIndex(e)&&(!t&&this.isStale(e)||(yield e),e!==this.tail);)e=this.next[e]}isValidIndex(t){return this.keyMap.get(this.keyList[t])===t}*entries(){for(const t of this.indexes())this.isBackgroundFetch(this.valList[t])||(yield[this.keyList[t],this.valList[t]])}*rentries(){for(const t of this.rindexes())this.isBackgroundFetch(this.valList[t])||(yield[this.keyList[t],this.valList[t]])}*keys(){for(const t of this.indexes())this.isBackgroundFetch(this.valList[t])||(yield this.keyList[t])}*rkeys(){for(const t of this.rindexes())this.isBackgroundFetch(this.valList[t])||(yield this.keyList[t])}*values(){for(const t of this.indexes())this.isBackgroundFetch(this.valList[t])||(yield this.valList[t])}*rvalues(){for(const t of this.rindexes())this.isBackgroundFetch(this.valList[t])||(yield this.valList[t])}[Symbol.iterator](){return this.entries()}find(t,e={}){for(const i of this.indexes())if(t(this.valList[i],this.keyList[i],this))return this.get(this.keyList[i],e)}forEach(t,e=this){for(const i of this.indexes())t.call(e,this.valList[i],this.keyList[i],this)}rforEach(t,e=this){for(const i of this.rindexes())t.call(e,this.valList[i],this.keyList[i],this)}get prune(){return or("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;for(const e of this.rindexes({allowStale:!0}))this.isStale(e)&&(this.delete(this.keyList[e]),t=!0);return t}dump(){const t=[];for(const e of this.indexes({allowStale:!0})){const i=this.keyList[e],n=this.valList[e],s=this.isBackgroundFetch(n)?n.__staleWhileFetching:n;if(void 0===s)continue;const r={value:s};if(this.ttls){r.ttl=this.ttls[e];const t=Js.now()-this.starts[e];r.start=Math.floor(Date.now()-t)}this.sizes&&(r.size=this.sizes[e]),t.unshift([i,r])}return t}load(t){this.clear();for(const[e,i]of t){if(i.start){const t=Date.now()-i.start;i.start=Js.now()-t}this.set(e,i.value,i)}}dispose(t,e,i){}set(t,e,{ttl:i=this.ttl,start:n,noDisposeOnSet:s=this.noDisposeOnSet,size:r=0,sizeCalculation:o=this.sizeCalculation,noUpdateTTL:a=this.noUpdateTTL}={}){if(r=this.requireSize(t,e,r,o),this.maxEntrySize&&r>this.maxEntrySize)return this.delete(t),this;let l=0===this.size?void 0:this.keyMap.get(t);if(void 0===l)l=this.newIndex(),this.keyList[l]=t,this.valList[l]=e,this.keyMap.set(t,l),this.next[this.tail]=l,this.prev[l]=this.tail,this.tail=l,this.size++,this.addItemSize(l,r),a=!1;else{this.moveToTail(l);const i=this.valList[l];e!==i&&(this.isBackgroundFetch(i)?i.__abortController.abort(new Error("replaced")):s||(this.dispose(i,t,"set"),this.disposeAfter&&this.disposed.push([i,t,"set"])),this.removeItemSize(l),this.valList[l]=e,this.addItemSize(l,r))}if(0===i||0!==this.ttl||this.ttls||this.initializeTTLTracking(),a||this.setItemTTL(l,i,n),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max&&0!==this.max?this.evict(!1):0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(!0),t}}evict(t){const e=this.head,i=this.keyList[e],n=this.valList[e];return this.isBackgroundFetch(n)?n.__abortController.abort(new Error("evicted")):(this.dispose(n,i,"evict"),this.disposeAfter&&this.disposed.push([n,i,"evict"])),this.removeItemSize(e),t&&(this.keyList[e]=null,this.valList[e]=null,this.free.push(e)),this.head=this.next[e],this.keyMap.delete(i),this.size--,e}has(t,{updateAgeOnHas:e=this.updateAgeOnHas}={}){const i=this.keyMap.get(t);return void 0!==i&&!this.isStale(i)&&(e&&this.updateItemAge(i),!0)}peek(t,{allowStale:e=this.allowStale}={}){const i=this.keyMap.get(t);if(void 0!==i&&(e||!this.isStale(i))){const t=this.valList[i];return this.isBackgroundFetch(t)?t.__staleWhileFetching:t}}backgroundFetch(t,e,i,n){const s=void 0===e?void 0:this.valList[e];if(this.isBackgroundFetch(s))return s;const r=new tr;i.signal&&i.signal.addEventListener("abort",(()=>r.abort(i.signal.reason)));const o={signal:r.signal,options:i,context:n},a=(n,s=!1)=>{const{aborted:a}=r.signal,c=i.ignoreFetchAbort&&void 0!==n;return!a||c||s?(this.valList[e]===h&&(void 0===n?h.__staleWhileFetching?this.valList[e]=h.__staleWhileFetching:this.delete(t):this.set(t,n,o.options)),n):l(r.signal.reason)},l=n=>{const{aborted:s}=r.signal,o=s&&i.allowStaleOnFetchAbort,a=o||i.allowStaleOnFetchRejection,l=a||i.noDeleteOnFetchRejection;if(this.valList[e]===h){!l||void 0===h.__staleWhileFetching?this.delete(t):o||(this.valList[e]=h.__staleWhileFetching)}if(a)return h.__staleWhileFetching;if(h.__returned===h)throw n},h=new Promise(((e,n)=>{this.fetchMethod(t,s,o).then((t=>e(t)),n),r.signal.addEventListener("abort",(()=>{i.ignoreFetchAbort&&!i.allowStaleOnFetchAbort||(e(),i.allowStaleOnFetchAbort&&(e=t=>a(t,!0)))}))})).then(a,l);return h.__abortController=r,h.__staleWhileFetching=s,h.__returned=null,void 0===e?(this.set(t,h,o.options),e=this.keyMap.get(t)):this.valList[e]=h,h}isBackgroundFetch(t){return t&&"object"==typeof t&&"function"==typeof t.then&&Object.prototype.hasOwnProperty.call(t,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(t,"__returned")&&(t.__returned===t||null===t.__returned)}async fetch(t,{allowStale:e=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:r=this.noDisposeOnSet,size:o=0,sizeCalculation:a=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,fetchContext:p=this.fetchContext,forceRefresh:f=!1,signal:g}={}){if(!this.fetchMethod)return this.get(t,{allowStale:e,updateAgeOnGet:i,noDeleteOnStaleGet:n});const m={allowStale:e,updateAgeOnGet:i,noDeleteOnStaleGet:n,ttl:s,noDisposeOnSet:r,size:o,sizeCalculation:a,noUpdateTTL:l,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:u,ignoreFetchAbort:d,signal:g};let v=this.keyMap.get(t);if(void 0===v){const e=this.backgroundFetch(t,v,m,p);return e.__returned=e}{const n=this.valList[v];if(this.isBackgroundFetch(n))return e&&void 0!==n.__staleWhileFetching?n.__staleWhileFetching:n.__returned=n;if(!f&&!this.isStale(v))return this.moveToTail(v),i&&this.updateItemAge(v),n;const s=this.backgroundFetch(t,v,m,p);return e&&void 0!==s.__staleWhileFetching?s.__staleWhileFetching:s.__returned=s}}get(t,{allowStale:e=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet}={}){const s=this.keyMap.get(t);if(void 0!==s){const r=this.valList[s],o=this.isBackgroundFetch(r);if(this.isStale(s))return o?e?r.__staleWhileFetching:void 0:(n||this.delete(t),e?r:void 0);if(o)return;return this.moveToTail(s),i&&this.updateItemAge(s),r}}connect(t,e){this.prev[e]=t,this.next[t]=e}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return or("del","delete"),this.delete}delete(t){let e=!1;if(0!==this.size){const i=this.keyMap.get(t);if(void 0!==i)if(e=!0,1===this.size)this.clear();else{this.removeItemSize(i);const e=this.valList[i];this.isBackgroundFetch(e)?e.__abortController.abort(new Error("deleted")):(this.dispose(e,t,"delete"),this.disposeAfter&&this.disposed.push([e,t,"delete"])),this.keyMap.delete(t),this.keyList[i]=null,this.valList[i]=null,i===this.tail?this.tail=this.prev[i]:i===this.head?this.head=this.next[i]:(this.next[this.prev[i]]=this.next[i],this.prev[this.next[i]]=this.prev[i]),this.size--,this.free.push(i)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return e}clear(){for(const t of this.rindexes({allowStale:!0})){const e=this.valList[t];if(this.isBackgroundFetch(e))e.__abortController.abort(new Error("deleted"));else{const i=this.keyList[t];this.dispose(e,i,"delete"),this.disposeAfter&&this.disposed.push([e,i,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return or("reset","clear"),this.clear}get length(){return((t,e)=>{const i=`LRU_CACHE_PROPERTY_${t}`;if(lr(i)){const{prototype:n}=fr,{get:s}=Object.getOwnPropertyDescriptor(n,t);hr(i,`${t} property`,`cache.${e}`,s)}})("length","size"),this.size}static get AbortController(){return tr}static get AbortSignal(){return nr}}var gr=fr;const mr=/(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)?(-?[0-9]+(px|em)\s+|0\s+)?(.*)/g,vr={},yr="undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes("firefox"),wr={};class br{constructor(t,e){this.imagesPending=0,this.imagesLoaded=0,this.imageIdsLoaded=[],this.frameIsRendering=!1,this.pendingDrawCall=!1,this.firstMeaningfulPaint=!1,this.parallelTasks=8,this.frameTasks=0,this.loadingQueueOrdered=!0,this.loadingQueue=[],this.currentTask=Promise.resolve(),this.tasksRunning=0,this.averageJobTime=64,this.lastKnownScale=1,this.visible=[],this.previousVisible=[],this.drawCalls=[],this.invalidated=[],this._worker=()=>{if(this.loadingQueue.length){const t=this.loadingQueue.pop();t&&(this.tasksRunning++,this.frameTasks++,this.currentTask=t.task().then((()=>{this.tasksRunning--})).catch((()=>{this.tasksRunning--})))}},this._scheduled=0,this._doWork=()=>{0===this.loadingQueue.length&&0===this.tasksRunning&&this._scheduled&&(clearInterval(this._scheduled),this._scheduled=0);let t=this.parallelTasks||1;!this.firstMeaningfulPaint&&this.loadingQueue.length&&(t=this.loadingQueue.length);for(let e=0;e<=t;e++)this._worker()},this.canvas=t,this.rendererPosition=t.getBoundingClientRect(),this.ctx=t.getContext("2d",{alpha:!0}),this.ctx.imageSmoothingEnabled=!0,this.options=e||{},this.canvas.style.opacity="0",this.canvas.style.transition="opacity .3s",this.dpi=(null==e?void 0:e.dpi)||1,this.hostCache=(null==e?void 0:e.lruCache)?new gr({maxSize:268435456,dispose:(t,e,i)=>{this.invalidated.push(e),t.width=0,t.height=0},sizeCalculation:(t,e)=>t.width*t.height}):{store:{},get(t){return this.store[t]},set(t,e){this.store[t]=e}}}getCanvasDims(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}}resize(){this.rendererPosition=this.canvas.getBoundingClientRect()}isReady(){return this.firstMeaningfulPaint}afterFrame(t){if(this.clearTransform(),this.lastPaintedObject=void 0,this.frameIsRendering=!1,this.imagesPending=Math.max(0,this.imagesPending-this.imagesLoaded),this.imagesLoaded=0,this.loadingQueueOrdered||(this.loadingQueue=this.loadingQueue.sort(((t,e)=>t.network&&t.scale===e.scale?e.distance-t.distance:t.scale<e.scale?-1:1)),this.loadingQueueOrdered=!0),this.previousVisible=this.visible,this.pendingDrawCall=!!this.drawCalls.length,this.pendingDrawCall)for(let e=0;e<this.drawCalls.length;e++){const t=this.drawCalls.shift();t&&t()}this.doOffscreenWork(),this.options.debug&&this.stats&&this.stats.end()}doOffscreenWork(){this.frameTasks=0,this.loadingQueue.length&&(this._worker(),this.loadingQueue.length&&(this._scheduled||(this._scheduled=setInterval(this._doWork,0))))}getScale(t,e,i){if(Number.isNaN(t)||Number.isNaN(e))return this.lastKnownScale;const n=this.getCanvasDims(),s=n.width/t,r=n.height/e,o=(s<r?r:s)*(i&&this.dpi||1);return Number.isNaN(o)||(this.lastKnownScale=o),this.lastKnownScale}beforeFrame(t,e,i,n){var s;this.options.debug&&this.stats&&this.stats.begin(),this.frameIsRendering=!0,this.visible=[],this.options.beforeFrame&&this.options.beforeFrame(e);const r=this.getCanvasDims();if(this.ctx.globalAlpha=1,this.ctx.fillStyle=null!=(s=this.canvas.dataset.background)?s:"rgb(0, 0, 0)",this.ctx.fillRect(0,0,r.width,r.height),n.enableFilters&&(n.filters.brightness||n.filters.contrast||n.filters.grayscale||n.filters.invert||n.filters.sepia||n.filters.saturate||n.filters.hueRotate||n.filters.blur)){let t="";n.filters.brightness&&(t+=`brightness(${~~(100+100*n.filters.brightness)}%) `),n.filters.contrast&&(t+=`contrast(${~~(100+100*n.filters.contrast)}%) `),n.filters.grayscale&&(t+=`grayscale(${~~(100*n.filters.grayscale)}%) `),n.filters.invert&&(t+=`invert(${~~(100*n.filters.invert)}%) `),n.filters.sepia&&(t+=`sepia(${~~(100*n.filters.sepia)}%) `),n.filters.saturate&&(t+=`saturate(${~~(100+100*n.filters.saturate)}%) `),n.filters.hueRotate&&(t+=`hue-rotate(${n.filters.hueRotate}deg) `),n.filters.blur&&(t+=`blur(${n.filters.blur}px) `),this.ctx.filter=t}else this.ctx.filter="none"}applyTransform(t,e,i,n,s){const r=t.__owner.value;if(r&&r.rotation){this.ctx.save();const t=e+n/2,o=i+s/2;this.ctx.translate(t,o),this.ctx.rotate(r.rotation*Math.PI/180),this.ctx.translate(-t,-o),this.lastPaintedObject=r}}clearTransform(){this.lastPaintedObject&&(this.lastPaintedObject.rotation&&this.ctx.restore(),this.lastPaintedObject=void 0)}paint(t,e,i,n,s,r){const o=this.ctx.globalAlpha;if(t instanceof T||t instanceof _s){if(t.display.rotation){this.ctx.save();let o=i+s/2,a=n+r/2;t.crop&&(o-=t.crop[5*e+1],a-=t.crop[5*e+2]),this.ctx.translate(o,a),this.ctx.rotate(t.display.rotation*Math.PI/180),this.ctx.translate(-o,-a)}if(this.visible.push(t),t.style,"undefined"!==t.style.opacity){if(!t.style.opacity)return;this.ctx.globalAlpha=t.style.opacity}try{const o=t.__host.canvas,a=this.getCanvasDims();if(-1!==o.indices.indexOf(e)&&-1===this.invalidated.indexOf(o.canvases[e])||this.schedulePaintToCanvas(o,t,e,k({x:i+s/2,y:n+s/2},{x:a.width/2,y:a.height/2})),!this.firstMeaningfulPaint)return;const l=this.hostCache.get(o.canvases[e]);if(l)if(t.crop&&t.cropData){if(t.crop[5*e]){const o=[t.crop[5*e+1]/t.display.scale-t.display.points[5*e+1],t.crop[5*e+2]/t.display.scale-t.display.points[5*e+2],1+(t.crop[5*e+3]-t.crop[5*e+1])/t.display.scale,1+(t.crop[5*e+4]-t.crop[5*e+2])/t.display.scale];o[0]+=t.cropData.x/t.display.scale,o[1]+=t.cropData.y/t.display.scale;const a=t.x*this.lastKnownScale,h=t.y*this.lastKnownScale,c=[i+a,n+h,s,r];c[0]+=a,c[1]+=h,this.ctx.drawImage(l,o[0],o[1],o[2],o[3],c[0],c[1],c[2]+1,c[3]+1)}}else yr?this.ctx.drawImage(l,0,0,t.display.points[5*e+3]-t.display.points[5*e+1],t.display.points[5*e+4]-t.display.points[5*e+2],i,n,s+1,r+1):this.ctx.drawImage(l,0,0,t.display.points[5*e+3]-t.display.points[5*e+1],t.display.points[5*e+4]-t.display.points[5*e+2],i,n,s+Number.MIN_VALUE+.5,r+Number.MIN_VALUE+.5)}catch(h){}t.display.rotation&&this.ctx.restore()}const a=t instanceof $s&&this.options.box,l=t instanceof Fs&&this.options.polygon;if((a||l)&&!t.props.className&&!t.props.html&&!t.props.href){if(this.visible.push(t),t.props.style){const e=Object.assign({},t.props.style||{},t.hovering?t.props.hoverStyles:{},t.pressing?t.props.pressStyles:{}),o=t.props.relativeStyle?1:s/t.width;void 0!==e.opacity&&(this.ctx.globalAlpha=e.opacity);let a=0;void 0!==e.borderWidth&&(a=parseInt(e.borderWidth,10)*o);let h=0;void 0!==e.outlineWidth&&(h=parseInt(e.outlineWidth,10)*o);let c=0;if(void 0!==e.outlineOffset&&(c=parseInt(e.outlineOffset,10)*o),e.borderColor&&(this.ctx.strokeStyle=e.borderColor),e.boxShadow){const t=e.boxShadow.split(/,(?![^(]*\))/);for(const e of t){const t=vr[e]||mr.exec(e)||mr.exec(e);vr[e]=t,t&&(this.ctx.save(),this.ctx.shadowOffsetX=parseInt(t[1])*this.dpi*o,this.ctx.shadowOffsetY=parseInt(t[3])*this.dpi*o,this.ctx.shadowBlur=parseInt(t[5])*this.dpi*o,this.ctx.shadowColor=t[9],this.ctx.fillStyle="rgba(0,0,0,1)",this.ctx.fillRect(i+a,n+a,s,r),this.ctx.restore())}}if(this.ctx.fillStyle=e.backgroundColor||"transparent",this.ctx.lineWidth=a,l){const e=t.shape,s=e.points||[],r=s.length;this.ctx.beginPath();for(let t=0;t<r;t++)this.ctx.lineTo(i+s[t][0]*this.lastKnownScale,n+s[t][1]*this.lastKnownScale);e.open||this.ctx.closePath(),a&&this.ctx.stroke(),e.open||this.ctx.fill()}else a&&this.ctx.strokeRect(i+a/2,n+a/2,s+a,r+a),this.ctx.fillRect(i+a,n+a,s,r);h&&(e.outlineColor&&(this.ctx.strokeStyle=e.outlineColor),this.ctx.lineWidth=h,this.ctx.strokeRect(i-h/2-c,n-h/2-c,s+2*a+h+2*c,r+2*a+h+2*c))}this.ctx.globalAlpha=o}}loadImage(t,e,i,n=!1){if(wr[t]&&wr[t].naturalWidth>0)e(wr[t]);else try{let s=!1;n||setTimeout((()=>{s||this.loadImage(t,e,i,!0)}),3e3);const r=document.createElement("img");r.decoding="auto",r.onload=function(){s=!0,e(r),wr[t]=r,r.onload=null},this.options.crossOrigin&&(r.crossOrigin="anonymous"),r.src=t,r.complete&&r.onload({}),r.width}catch(s){console.log("image error",s),i(s)}}schedulePaintToCanvas(t,e,i,n){this.imagesPending++,t.indices.push(i);const s=`${e.id}--${e.display.scale}-${i}`,r=this.invalidated.indexOf(s);-1!==r&&this.invalidated.splice(r,1),t.canvases[i]=s,e.__host.canvas.loading=!0,this.loadingQueueOrdered=!1,this.loadingQueue.push({id:s,scale:e.display.scale,network:!0,distance:n,task:()=>new Promise((r=>{if(-1===this.visible.indexOf(e))return this.imagesPending--,t.indices.splice(t.indices.indexOf(i),1),void r();const o=e.getImageUrl(i);this.loadImage(o,(o=>{this.loadingQueue.push({id:s,scale:e.display.scale,distance:n,task:()=>new Promise((n=>{this.imageIdsLoaded.includes(s)||(this.imagesLoaded++,this.imageIdsLoaded.push(s)),t.loaded.push(i),t.loaded.length===t.indices.length&&(t.loading=!1);const r=e.display.points.slice(5*i,5*i+5),a=document.createElement("canvas"),l=a.getContext("2d");a.width=r[3]-r[1],a.height=r[4]-r[2],this.hostCache.set(t.canvases[i],a),this.drawCalls.push((()=>{l.drawImage(o,0,0,r[3]-r[1],r[4]-r[2]),n()}))}))}),r()}),(e=>{this.imagesPending--,t.indices.splice(t.indices.indexOf(i),1),r()}))}))})}afterPaintLayer(t,e){}prepareLayer(t,e){t.__owner.value&&(t.cropData?(this.lastKnownScale,t.display.scale,this.applyTransform(t,e[1],e[2],e[3]-e[1],e[4]-e[2])):this.applyTransform(t,e[1],e[2],e[3]-e[1],e[4]-e[2])),t.__host&&t.__host.canvas||(t instanceof T||t instanceof _s)&&this.createImageHost(t)}finishLayer(){this.lastPaintedObject&&this.clearTransform()}createImageHost(t){t.__host=t.__host?t.__host:{},t.__host.canvas={canvas:void 0,canvases:[],indices:[],loaded:[],loading:!1}}getPointsAt(t,e,i,n){return t.getPointsAt(e,i,n)}getViewportBounds(t,e,i){const n=t.getActiveZone();if(n){const t=e[3]-e[1]<n.points[3]-n.points[1],s=e[4]-e[2]<n.points[4]-n.points[2];return{x1:t?n.points[1]-i:n.points[1]+(n.points[3]-n.points[1])/2-(e[3]-e[1])/2,y1:s?n.points[2]-i:n.points[2]+(n.points[4]-n.points[2])/2-(e[4]-e[2])/2,x2:t?n.points[3]+i:n.points[1]+(n.points[3]-n.points[1])/2-(e[3]-e[1])/2,y2:s?n.points[4]+i:n.points[2]+(n.points[4]-n.points[2])/2-(e[4]-e[2])/2}}return null}pendingUpdate(){const t=!this.pendingDrawCall&&0===this.drawCalls.length&&0===this.imagesPending&&0===this.loadingQueue.length&&0===this.tasksRunning;return t||0!==this.visible.length||setTimeout((()=>{this.canvas.style.opacity="1",this.firstMeaningfulPaint=!0}),500),!this.firstMeaningfulPaint&&t&&this.visible.length?(this.canvas.style.opacity="1",this.firstMeaningfulPaint=t,!0):!!this.options.debug||!t}getRendererScreenPosition(){return this.rendererPosition}reset(){this.loadingQueue=[],this.drawCalls=[]}}class xr{constructor(t){this.renderers=[];for(const e of t)e&&this.renderers.push(e);this.length=this.renderers.length}afterFrame(t,e,i,n){for(let s=0;s<this.length;s++)this.renderers[s].afterFrame(t,e,i,n)}afterPaintLayer(t,e){for(let i=0;i<this.length;i++)this.renderers[i].afterPaintLayer(t,e)}beforeFrame(t,e,i,n){for(let s=0;s<this.length;s++)this.renderers[s].beforeFrame(t,e,i,n)}triggerResize(){for(let t=0;t<this.length;t++){const e=this.renderers[t];e.triggerResize&&e.triggerResize()}}getPointsAt(t,e,i,n){return this.renderers[0].getPointsAt(t,e,i,n)}getScale(t,e){return this.renderers[0].getScale(t,e)}getViewportBounds(t,e,i){return this.renderers[0].getViewportBounds(t,e,i)}getRendererScreenPosition(){return this.renderers[0].getRendererScreenPosition()}isReady(){for(let t=0;t<this.length;t++)if(!this.renderers[t].isReady())return!1;return!0}paint(t,e,i,n,s,r){for(let o=0;o<this.length;o++)this.renderers[o].paint(t,e,i,n,s,r)}pendingUpdate(){for(let t=0;t<this.length;t++)if(this.renderers[t].pendingUpdate())return!0;return!1}prepareLayer(t,e){for(let i=0;i<this.length;i++)this.renderers[i].prepareLayer(t,e)}finishLayer(t,e){for(let i=0;i<this.length;i++)this.renderers[i].finishLayer(t,e)}resize(t,e){for(let i=0;i<this.length;i++)this.renderers[i].resize(t,e)}reset(){for(let t=0;t<this.length;t++)this.renderers[t].reset()}}class Er{constructor(t){this.heightRatio=1,this.widthRatio=1,this.target=new Float32Array(5),this.delta=0,this.renderNextFrame=!0,this.canvas=t,this.initialWidth=t.width,this.initialHeight=t.height,this.context=t.getContext("2d"),this.context.globalAlpha=.5,this.aggregate=w(1)}isReady(){return!0}resize(){this.initialWidth=this.canvas.width,this.initialHeight=this.canvas.height,this.renderNextFrame=!0}afterFrame(t,e,i){if(this.renderNextFrame){this.context.clearRect(0,0,this.canvas.width,this.canvas.height);const e=this.initialWidth/t.width,n=this.initialHeight/t.height,s=this.widthRatio>this.heightRatio?e:n;if(this.target=i,this.bounds){const e=t.getPointsAt(this.bounds,this.aggregate,s);for(const[t,i]of e)if(t instanceof T&&t.__host.canvas){const e=i.length/5;for(let n=0;n<e;n++){t.__host.canvas.canvases[n]&&(i[n+1],i[n+2],i[n+3],i[n+1],i[n+4],i[n+2])}}}t.getPoints().forEach(((t,e,i)=>{if(e%5==0&&t){const t={x1:i[e+1]*s,y1:i[e+2]*s,x2:i[e+3]*s,y2:i[e+4]*s,width:(i[e+3]-i[e+1])*s,height:(i[e+4]-i[e+2])*s};this.context.strokeStyle="red",this.context.strokeRect(t.x1,t.y1,t.width,t.height)}})),i&&(this.context.strokeStyle="red",this.context.lineWidth=window.devicePixelRatio||1,this.context.strokeRect(i[1]*s,i[2]*s,(i[3]-i[1])*s,(i[4]-i[2])*s))}}getActiveZone(t){return null}getPointsAt(t,e,i,n){return t.getPointsAt(e,i,n)}getScale(t,e){return 1}beforeFrame(t,e){this.bounds=v.singleBox(t.width,t.height)}drawImage(){}afterPaintLayer(t,e){}paint(t,e,i,n,s,r){this.renderNextFrame=!0}prepareLayer(t){}pendingUpdate(){return!1}hasActiveZone(){return!1}getViewportBounds(t,e,i){return null}getRendererScreenPosition(){return this.canvas.getBoundingClientRect()}finishLayer(){}reset(){}}var Sr,_r,Tr,Cr,Pr,kr,Or,Rr,Ar,Ir,Lr,$r,Mr,zr,Br,Fr=!1;function Dr(){if(!Fr){Fr=!0;var t=navigator.userAgent,e=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(t),i=/(Mac OS X)|(Windows)|(Linux)/.exec(t);if($r=/\b(iPhone|iP[ao]d)/.exec(t),Mr=/\b(iP[ao]d)/.exec(t),Ir=/Android/i.exec(t),zr=/FBAN\/\w+;/i.exec(t),Br=/Mobile/i.exec(t),Lr=!!/Win64/.exec(t),e){(Sr=e[1]?parseFloat(e[1]):e[5]?parseFloat(e[5]):NaN)&&document&&document.documentMode&&(Sr=document.documentMode);var n=/(?:Trident\/(\d+.\d+))/.exec(t);kr=n?parseFloat(n[1])+4:Sr,_r=e[2]?parseFloat(e[2]):NaN,Tr=e[3]?parseFloat(e[3]):NaN,(Cr=e[4]?parseFloat(e[4]):NaN)?(e=/(?:Chrome\/(\d+\.\d+))/.exec(t),Pr=e&&e[1]?parseFloat(e[1]):NaN):Pr=NaN}else Sr=_r=Tr=Pr=Cr=NaN;if(i){if(i[1]){var s=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(t);Or=!s||parseFloat(s[1].replace("_","."))}else Or=!1;Rr=!!i[2],Ar=!!i[3]}else Or=Rr=Ar=!1}}var jr,Nr={ie:function(){return Dr()||Sr},ieCompatibilityMode:function(){return Dr()||kr>Sr},ie64:function(){return Nr.ie()&&Lr},firefox:function(){return Dr()||_r},opera:function(){return Dr()||Tr},webkit:function(){return Dr()||Cr},safari:function(){return Nr.webkit()},chrome:function(){return Dr()||Pr},windows:function(){return Dr()||Rr},osx:function(){return Dr()||Or},linux:function(){return Dr()||Ar},iphone:function(){return Dr()||$r},mobile:function(){return Dr()||$r||Mr||Ir||Br},nativeApp:function(){return Dr()||zr},android:function(){return Dr()||Ir},ipad:function(){return Dr()||Mr}},Wr=Nr,Ur=!("undefined"==typeof window||!window.document||!window.document.createElement),Hr={canUseDOM:Ur,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:Ur&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:Ur&&!!window.screen,isInWorker:!Ur};Hr.canUseDOM&&(jr=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""))
1
+ "use strict";var t,e;Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=require("react-dom"),n=require("react"),s=require("react-reconciler");function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function o(t){if(t&&t.__esModule)return t;var e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var a=r(i),l=o(n),h=r(n),c=r(s);const d=["onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onScroll","onWheel","onClick","onDragStart","onDragEnd","onDragEnter","onDragExit","onDrag","onDragOver"];function u(){return d.reduce(((t,e)=>(t[e]=[],t)),{})}const p=d.reduce(((t,e)=>(t[e.slice(2).toLowerCase()]=e,t[e]=e,t)),{}),f=(t,e,i)=>{const n=t.length,s=i||g(n);for(let r=0;r<n;r++)s[r]=r%5==0?t[r+1]<e[3]&&t[r+3]>e[1]&&t[r+2]<e[4]&&t[r+4]>e[2]?1:0:t[r];return s};function g(t,e,i){return new Float32Array(t,e,i)}const m=(t,e,i)=>{const n=i||g(9);return n[0]=t[0]*e[0]+t[1]*e[3]+t[2]*e[6],n[1]=t[0]*e[1]+t[1]*e[4]+t[2]*e[7],n[2]=t[0]*e[2]+t[1]*e[5]+t[2]*e[8],n[3]=t[3]*e[0]+t[4]*e[3]+t[5]*e[6],n[4]=t[3]*e[1]+t[4]*e[4]+t[5]*e[7],n[5]=t[3]*e[2]+t[4]*e[5]+t[5]*e[8],n[6]=t[6]*e[0]+t[7]*e[3]+t[8]*e[6],n[7]=t[6]*e[1]+t[7]*e[4]+t[8]*e[7],n[8]=t[6]*e[2]+t[7]*e[5]+t[8]*e[8],n};class v{constructor(t){this.index=0,this.length=t,this.points=g(this.length)}static grid(t=1,e=1){return new v(5*t*e)}static point(t,e){const i=g(5);return i[0]=1,i[1]=t,i[2]=e,i[3]=t,i[4]=e,i}static positionPair(t){const e=g(5);return e[0]=1,e[1]=t.x1,e[2]=t.y1,e[3]=t.x2,e[4]=t.y2,e}static projection(t){return v.singleBox(t.width,t.height,t.x,t.y)}static singleBox(t,e,i=0,n=0){const s=g(5);return s[0]=1,s[1]=i,s[2]=n,s[3]=t+i,s[4]=e+n,s}row(t){return t(this)}addPoints(t,e,i,n){return this.points[this.index]=1,this.points[1+this.index]=t,this.points[2+this.index]=e,this.points[3+this.index]=i,this.points[4+this.index]=n,this.index+=5,this}addBox(t,e,i,n){return this.addPoints(t,e,t+i,e+n),this}build(){return this.points}}const y=(t,e)=>{const i=t.length;for(let n=0;n<i;n++)t[n]=n%5==0?e[6]*t[n+1]+e[7]*t[n+2]+e[8]*t[n]:n%5%2==1?e[0]*t[n]+e[1]*t[n+1]+e[2]:e[3]*t[n-1]+e[4]*t[n]+e[5];return t},w=t=>{const e=g(9);return e[0]=t,e[4]=t,e[8]=1,e},b=(t,e)=>{const i=g(9);return i[0]=1,i[2]=t,i[4]=1,i[5]=e,i[8]=1,i},x=(t,e,i)=>m(b((1-t)*e,(1-t)*i),w(t)),E=(t,e,i)=>{const n=t.length,s=i&&i.length>=n?i.slice(0,n):g(n);for(let r=0;r<n;r++)s[r]=r%5==0?e[6]*t[r+1]+e[7]*t[r+2]+e[8]*t[r]:r%5%2==1?e[0]*t[r]+e[1]*t[r+1]+e[2]:e[3]*t[r-1]+e[4]*t[r]+e[5];return s};let S=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_"),"");class _{constructor(){this.__revision=0,this.__owner={value:void 0},this.__state={},this.scale=1,this.layers=[],this.time=[],this.addEventListener=(t,e,i)=>{const n=p[t];if(!this.eventHandlers[n])throw new Error(`Unknown event ${n}`);-1===this.eventHandlers[n].indexOf(e)&&this.eventHandlers[n].push(e)},this.removeEventListener=(t,e)=>{const i=p[t];this.eventHandlers[i]?-1!==this.eventHandlers[i].indexOf(e)&&(this.eventHandlers[i]=this.eventHandlers[i].filter((t=>t!==e))):console.warn(`Unknown event ${i}`)},this.id=this.__id=S(),this.eventHandlers=u()}get crop(){return this._crop}set crop(t){this._crop=t}getObjectsAt(t){return[]}getAllPointsAt(t,e,i){return[]}getScheduledUpdates(t,e){return[]}dispatchEvent(t,e){const i=this.eventHandlers[t],n=i?i.length:0;let s=!1;if(n)for(let o=0;o<n;o++)try{i[o](e),s=!0}catch(r){console.error(t,r)}return s}get x(){return this.points[1]}get y(){return this.points[2]}get width(){return this.points[3]-this.points[1]}get height(){return this.points[4]-this.points[2]}translate(t,e){y(this.points,b(t,e))}atScale(t){y(this.points,x(t,this.x,this.y)),this.scale*=t}transform(t){y(this.points,t)}applyProps(t){this.__revision++}appendChild(t){}removeChild(t){}insertBefore(t,e){}hideInstance(){}}class T extends _{constructor(t){if(super(),this.type="spacial-content",this.style={opacity:1},t){const e=t.scale||1;this.id=t.id||t.uri,this.uri=t.uri,this.points=v.singleBox(t.width,t.height,t.x,t.y),this.display={x:0,y:0,scale:e,width:t.width/e,height:t.height/e,points:v.singleBox(t.width/e,t.height/e),rotation:null==t?void 0:t.rotation}}else this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:g(5)},this.points=g(5)}applyProps(t){const e=t.display?t.display.width:t.target.width,i=t.target.width/e;if(this.id=t.id||t.uri,this.uri=t.uri,this.points.set(v.singleBox(t.target.width,t.target.height,t.target.x,t.target.y)),t.style&&void 0!==t.style.opacity&&(this.style.opacity=t.style.opacity),t.crop){this.cropData=t.crop;const e=v.singleBox(t.crop.width,t.crop.height,t.crop.x,t.crop.y);y(e,b(-t.crop.x,-t.crop.y)),this.crop?this.crop.set(e):this.crop=g(e)}t.display?(this.display.scale=i,this.display.width=t.display.width,this.display.height=t.display.height,this.display.rotation=t.display.rotation,this.display.points=v.singleBox(t.display.width,t.display.height)):(this.display.scale=i,this.display.width=t.target.width/i,this.display.height=t.target.height/i,this.display.points=v.singleBox(t.target.width/i,t.target.height/i))}getAllPointsAt(t,e,i){return[[this,this.crop||this.points,e]]}static fromSvg(t,e,i,n){return T.fromImage("data:image/svg+xml;base64,"+btoa(t),e,i,n)}static fromImage(t,e,i,n){const s=new T;return s.applyProps({uri:t,id:n,display:i,target:e}),s}getImageUrl(){return this.uri}}class C extends _{constructor(t){if(super(),this.type="spacial-content",this.getTexture=()=>({source:void 0,hash:-1}),t){const e=t.scale||1;this.id=t.id||t.uri,this.uri=t.uri,this.points=v.singleBox(t.width,t.height),this.display={x:0,y:0,scale:e,width:t.width/e,height:t.height/e,points:1!==e?v.singleBox(t.width/e,t.height/e):this.points}}else this.id="",this.uri="",this.display={x:0,y:0,scale:1,width:0,height:0,points:g(5)},this.points=g(5)}applyProps(t){const e=t.display?t.display.width:t.target.width,i=t.target.width/e;this.id=t.id,this.points.set(v.singleBox(t.target.width,t.target.height)),this.display.scale=i,this.display.width=t.target.width/i,this.display.height=t.target.height/i,this.getTexture=t.getTexture,this.display.points=1!==i?v.singleBox(t.target.width/i,t.target.height/i):this.points}getAllPointsAt(t,e,i){return[[this,this.points,e]]}}function P(t,e){return Math.abs(t-e)}function k(t,e){const i=P(t.x,e.x),n=P(t.y,e.y);return Math.sqrt(Math.pow(i,2)+Math.pow(n,2))}function O(...t){return e=>t.forEach((t=>{return n=e,void("function"==typeof(i=t)?i(n):null!=i&&(i.current=n));var i,n}))}function R(...t){return l.useCallback(O(...t),t)}function A(){return A=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},A.apply(this,arguments)}const I=l.forwardRef(((t,e)=>{const{children:i,...n}=t;return l.Children.toArray(i).some(M)?l.createElement(l.Fragment,null,l.Children.map(i,(t=>M(t)?l.createElement(L,A({},n,{ref:e}),t.props.children):t))):l.createElement(L,A({},n,{ref:e}),i)}));I.displayName="Slot";const L=l.forwardRef(((t,e)=>{const{children:i,...n}=t;return l.isValidElement(i)?l.cloneElement(i,{...z(n,i.props),ref:O(e,i.ref)}):l.Children.count(i)>1?l.Children.only(null):null}));L.displayName="SlotClone";const $=({children:t})=>l.createElement(l.Fragment,null,t);function M(t){return l.isValidElement(t)&&t.type===$}function z(t,e){const i={...e};for(const n in e){const s=t[n],r=e[n];/^on[A-Z]/.test(n)?i[n]=(...t)=>{null==r||r(...t),null==s||s(...t)}:"style"===n?i[n]={...s,...r}:"className"===n&&(i[n]=[s,r].filter(Boolean).join(" "))}return{...t,...i}}const B=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?l.useLayoutEffect:()=>{};var F=function(t,e,i,n){this.name=t,this.fn=e,this.args=i,this.modifiers=n};function D(t,e){return void 0===e&&(e="simple"),"object"==typeof t?t[e]:t}function j(t,e,i){if(t.length){var n=t.shift(),s=j(t,e,i);return n.perform(s,i)}return D(e)}function N(t,e,i){if(t.length){var n=t.shift(),s=N(t,e,i);return n.performAsync(s,i)}return function(t){return Promise.resolve(D(e,"async")(t))}}F.prototype._test=function(t){var e=this.fn;try{j(this.modifiers.slice(),e,this)(t)}catch(i){e=function(){return!1}}try{return j(this.modifiers.slice(),e,this)(t)}catch(n){return!1}},F.prototype._check=function(t){try{j(this.modifiers.slice(),this.fn,this)(t)}catch(e){if(j(this.modifiers.slice(),(function(t){return t}),this)(!1))return}if(!j(this.modifiers.slice(),this.fn,this)(t))throw null},F.prototype._testAsync=function(t){var e=this;return new Promise((function(i,n){N(e.modifiers.slice(),e.fn,e)(t).then((function(e){e?i(t):n(null)})).catch((function(t){return n(t)}))}))};var W=function(t,e,i){this.name=t,this.perform=e,this.performAsync=i},U=function(t){function e(i,n,s,r){for(var o=[],a=arguments.length-4;a-- >0;)o[a]=arguments[a+4];t.call(this,o),t.captureStackTrace&&t.captureStackTrace(this,e),this.rule=i,this.value=n,this.cause=s,this.target=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),H=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=[]),this.chain=t,this.nextRuleModifiers=e};function V(t,e,i,n){if(e.length){var s=e.shift();s._testAsync(t).then((function(){V(t,e,i,n)}),(function(e){n(new U(s,t,e))}))}else i(t)}H.prototype._applyRule=function(t,e){var i=this;return function(){for(var n=[],s=arguments.length;s--;)n[s]=arguments[s];return i.chain.push(new F(e,t.apply(i,n),n,i.nextRuleModifiers)),i.nextRuleModifiers=[],i}},H.prototype._applyModifier=function(t,e){return this.nextRuleModifiers.push(new W(e,t.simple,t.async)),this},H.prototype._clone=function(){return new H(this.chain.slice(),this.nextRuleModifiers.slice())},H.prototype.test=function(t){return this.chain.every((function(e){return e._test(t)}))},H.prototype.testAll=function(t){var e=[];return this.chain.forEach((function(i){try{i._check(t)}catch(n){e.push(new U(i,t,n))}})),e},H.prototype.check=function(t){this.chain.forEach((function(e){try{e._check(t)}catch(i){throw new U(e,t,i)}}))},H.prototype.testAsync=function(t){var e=this;return new Promise((function(i,n){V(t,e.chain.slice(),i,n)}))};var G=function(t,e){return!(!e||"string"!=typeof t||0!==t.trim().length)||null==t};function X(){return"undefined"!=typeof Proxy?K(new H):Q(new H)}var Y={};function K(t){return new Proxy(t,{get:function(e,i){if(i in e)return e[i];var n=K(t._clone());return i in q?n._applyModifier(q[i],i):i in Y?n._applyRule(Y[i],i):i in tt?n._applyRule(tt[i],i):void 0}})}function Q(t){var e=function(t,e){return Object.keys(t).forEach((function(i){e[i]=function(){for(var n=[],s=arguments.length;s--;)n[s]=arguments[s];var r=Q(e._clone()),o=r._applyRule(t[i],i).apply(void 0,n);return o}})),e},i=e(tt,t),n=e(Y,i);return Object.keys(q).forEach((function(t){Object.defineProperty(n,t,{get:function(){return Q(n._clone())._applyModifier(q[t],t)}})})),n}X.extend=function(t){Object.assign(Y,t)},X.clearCustomRules=function(){Y={}};var q={not:{simple:function(t){return function(e){return!t(e)}},async:function(t){return function(e){return Promise.resolve(t(e)).then((function(t){return!t})).catch((function(){return!0}))}}},some:{simple:function(t){return function(e){return J(e).some((function(e){try{return t(e)}catch(i){return!1}}))}},async:function(t){return function(e){return Promise.all(J(e).map((function(e){try{return t(e).catch((function(){return!1}))}catch(i){return!1}}))).then((function(t){return t.some(Boolean)}))}}},every:{simple:function(t){return function(e){return!1!==e&&J(e).every(t)}},async:function(t){return function(e){return Promise.all(J(e).map(t)).then((function(t){return t.every(Boolean)}))}}},strict:{simple:function(t,e){return function(i){return Z(e)&&i&&"object"==typeof i?Object.keys(e.args[0]).length===Object.keys(i).length&&t(i):t(i)}},async:function(t,e){return function(i){return Promise.resolve(t(i)).then((function(t){return Z(e)&&i&&"object"==typeof i?Object.keys(e.args[0]).length===Object.keys(i).length&&t:t})).catch((function(){return!1}))}}}};function Z(t){return t&&"schema"===t.name&&t.args.length>0&&"object"==typeof t.args[0]}function J(t){return"string"==typeof t?t.split(""):t}var tt={equal:function(t){return function(e){return e==t}},exact:function(t){return function(e){return e===t}},number:function(t){return void 0===t&&(t=!0),function(e){return"number"==typeof e&&(t||isFinite(e))}},integer:function(){return function(t){return(Number.isInteger||it)(t)}},numeric:function(){return function(t){return!isNaN(parseFloat(t))&&isFinite(t)}},string:function(){return et("string")},boolean:function(){return et("boolean")},undefined:function(){return et("undefined")},null:function(){return et("null")},array:function(){return et("array")},object:function(){return et("object")},instanceOf:function(t){return function(e){return e instanceof t}},pattern:function(t){return function(e){return t.test(e)}},lowercase:function(){return function(t){return"boolean"==typeof t||t===t.toLowerCase()&&""!==t.trim()}},uppercase:function(){return function(t){return t===t.toUpperCase()&&""!==t.trim()}},vowel:function(){return function(t){return/^[aeiou]+$/i.test(t)}},consonant:function(){return function(t){return/^(?=[^aeiou])([a-z]+)$/i.test(t)}},first:function(t){return function(e){return e[0]==t}},last:function(t){return function(e){return e[e.length-1]==t}},empty:function(){return function(t){return 0===t.length}},length:function(t,e){return function(i){return i.length>=t&&i.length<=(e||t)}},minLength:function(t){return function(e){return e.length>=t}},maxLength:function(t){return function(e){return e.length<=t}},negative:function(){return function(t){return t<0}},positive:function(){return function(t){return t>=0}},between:function(t,e){return function(i){return i>=t&&i<=e}},range:function(t,e){return function(i){return i>=t&&i<=e}},lessThan:function(t){return function(e){return e<t}},lessThanOrEqual:function(t){return function(e){return e<=t}},greaterThan:function(t){return function(e){return e>t}},greaterThanOrEqual:function(t){return function(e){return e>=t}},even:function(){return function(t){return t%2==0}},odd:function(){return function(t){return t%2!=0}},includes:function(t){return function(e){return~e.indexOf(t)}},schema:function(t){return function(t){return{simple:function(e){var i=[];if(Object.keys(t).forEach((function(n){var s=t[n];try{s.check((e||{})[n])}catch(r){r.target=n,i.push(r)}})),i.length>0)throw i;return!0},async:function(e){var i=[],n=Object.keys(t).map((function(n){return t[n].testAsync((e||{})[n]).catch((function(t){t.target=n,i.push(t)}))}));return Promise.all(n).then((function(){if(i.length>0)throw i;return!0}))}}}(t)},passesAnyOf:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e){return t.some((function(t){return t.test(e)}))}},optional:function(t,e){return void 0===e&&(e=!1),{simple:function(i){return G(i,e)||void 0===t.check(i)},async:function(i){return G(i,e)||t.testAsync(i)}}}};function et(t){return function(e){return Array.isArray(e)&&"array"===t||null===e&&"null"===t||typeof e===t}}function it(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}var nt="colors",st="sizes",rt="space",ot={gap:rt,gridGap:rt,columnGap:rt,gridColumnGap:rt,rowGap:rt,gridRowGap:rt,inset:rt,insetBlock:rt,insetBlockEnd:rt,insetBlockStart:rt,insetInline:rt,insetInlineEnd:rt,insetInlineStart:rt,margin:rt,marginTop:rt,marginRight:rt,marginBottom:rt,marginLeft:rt,marginBlock:rt,marginBlockEnd:rt,marginBlockStart:rt,marginInline:rt,marginInlineEnd:rt,marginInlineStart:rt,padding:rt,paddingTop:rt,paddingRight:rt,paddingBottom:rt,paddingLeft:rt,paddingBlock:rt,paddingBlockEnd:rt,paddingBlockStart:rt,paddingInline:rt,paddingInlineEnd:rt,paddingInlineStart:rt,top:rt,right:rt,bottom:rt,left:rt,scrollMargin:rt,scrollMarginTop:rt,scrollMarginRight:rt,scrollMarginBottom:rt,scrollMarginLeft:rt,scrollMarginX:rt,scrollMarginY:rt,scrollMarginBlock:rt,scrollMarginBlockEnd:rt,scrollMarginBlockStart:rt,scrollMarginInline:rt,scrollMarginInlineEnd:rt,scrollMarginInlineStart:rt,scrollPadding:rt,scrollPaddingTop:rt,scrollPaddingRight:rt,scrollPaddingBottom:rt,scrollPaddingLeft:rt,scrollPaddingX:rt,scrollPaddingY:rt,scrollPaddingBlock:rt,scrollPaddingBlockEnd:rt,scrollPaddingBlockStart:rt,scrollPaddingInline:rt,scrollPaddingInlineEnd:rt,scrollPaddingInlineStart:rt,fontSize:"fontSizes",background:nt,backgroundColor:nt,backgroundImage:nt,borderImage:nt,border:nt,borderBlock:nt,borderBlockEnd:nt,borderBlockStart:nt,borderBottom:nt,borderBottomColor:nt,borderColor:nt,borderInline:nt,borderInlineEnd:nt,borderInlineStart:nt,borderLeft:nt,borderLeftColor:nt,borderRight:nt,borderRightColor:nt,borderTop:nt,borderTopColor:nt,caretColor:nt,color:nt,columnRuleColor:nt,fill:nt,outline:nt,outlineColor:nt,stroke:nt,textDecorationColor:nt,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:st,minBlockSize:st,maxBlockSize:st,inlineSize:st,minInlineSize:st,maxInlineSize:st,width:st,minWidth:st,maxWidth:st,height:st,minHeight:st,maxHeight:st,flexBasis:st,gridTemplateColumns:st,gridTemplateRows:st,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderLeftWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",transition:"transitions",zIndex:"zIndices"},at=(t,e)=>"function"==typeof e?{"()":Function.prototype.toString.call(e)}:e,lt=()=>{const t=Object.create(null);return(e,i,...n)=>{const s=(r=e,JSON.stringify(r,at));var r;return s in t?t[s]:t[s]=i(e,...n)}},ht=Symbol.for("sxs.internal"),ct=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),dt=t=>{for(const e in t)return!0;return!1},{hasOwnProperty:ut}=Object.prototype,pt=t=>t.includes("-")?t:t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())),ft=/\s+(?![^()]*\))/,gt=t=>e=>t(..."string"==typeof e?String(e).split(ft):[e]),mt={appearance:t=>({WebkitAppearance:t,appearance:t}),backfaceVisibility:t=>({WebkitBackfaceVisibility:t,backfaceVisibility:t}),backdropFilter:t=>({WebkitBackdropFilter:t,backdropFilter:t}),backgroundClip:t=>({WebkitBackgroundClip:t,backgroundClip:t}),boxDecorationBreak:t=>({WebkitBoxDecorationBreak:t,boxDecorationBreak:t}),clipPath:t=>({WebkitClipPath:t,clipPath:t}),content:t=>({content:t.includes('"')||t.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(t)?t:`"${t}"`}),hyphens:t=>({WebkitHyphens:t,hyphens:t}),maskImage:t=>({WebkitMaskImage:t,maskImage:t}),maskSize:t=>({WebkitMaskSize:t,maskSize:t}),tabSize:t=>({MozTabSize:t,tabSize:t}),textSizeAdjust:t=>({WebkitTextSizeAdjust:t,textSizeAdjust:t}),userSelect:t=>({WebkitUserSelect:t,userSelect:t}),marginBlock:gt(((t,e)=>({marginBlockStart:t,marginBlockEnd:e||t}))),marginInline:gt(((t,e)=>({marginInlineStart:t,marginInlineEnd:e||t}))),maxSize:gt(((t,e)=>({maxBlockSize:t,maxInlineSize:e||t}))),minSize:gt(((t,e)=>({minBlockSize:t,minInlineSize:e||t}))),paddingBlock:gt(((t,e)=>({paddingBlockStart:t,paddingBlockEnd:e||t}))),paddingInline:gt(((t,e)=>({paddingInlineStart:t,paddingInlineEnd:e||t})))},vt=/([\d.]+)([^]*)/,yt=(t,e)=>t.length?t.reduce(((t,i)=>(t.push(...e.map((t=>t.includes("&")?t.replace(/&/g,/[ +>|~]/.test(i)&&/&.*&/.test(t)?`:is(${i})`:i):i+" "+t))),t)),[]):e,wt=(t,e)=>t in bt&&"string"==typeof e?e.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,((e,i,n,s)=>i+("stretch"===n?`-moz-available${s};${pt(t)}:${i}-webkit-fill-available`:`-moz-fit-content${s};${pt(t)}:${i}fit-content`)+s)):String(e),bt={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},xt=t=>t?t+"-":"",Et=(t,e,i)=>t.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,((t,n,s,r,o)=>"$"==r==!!s?t:(n||"--"==r?"calc(":"")+"var(--"+("$"===r?xt(e)+(o.includes("$")?"":xt(i))+o.replace(/\$/g,"-"):o)+")"+(n||"--"==r?"*"+(n||"")+(s||"1")+")":""))),St=/\s*,\s*(?![^()]*\))/,_t=Object.prototype.toString,Tt=(t,e,i,n,s)=>{let r,o,a;const l=(t,e,i)=>{let h,c;const d=t=>{for(h in t){const f=64===h.charCodeAt(0),g=f&&Array.isArray(t[h])?t[h]:[t[h]];for(c of g){const t=/[A-Z]/.test(p=h)?p:p.replace(/-[^]/g,(t=>t[1].toUpperCase())),g="object"==typeof c&&c&&c.toString===_t&&(!n.utils[t]||!e.length);if(t in n.utils&&!g){const e=n.utils[t];if(e!==o){o=e,d(e(c)),o=null;continue}}else if(t in mt){const e=mt[t];if(e!==a){a=e,d(e(c)),a=null;continue}}if(f&&(u=h.slice(1)in n.media?"@media "+n.media[h.slice(1)]:h,h=u.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,((t,e,i,n,s,r)=>{const o=vt.test(e),a=.0625*(o?-1:1),[l,h]=o?[n,e]:[e,n];return"("+("="===i[0]?"":">"===i[0]===o?"max-":"min-")+l+":"+("="!==i[0]&&1===i.length?h.replace(vt,((t,e,n)=>Number(e)+a*(">"===i?1:-1)+n)):h)+(s?") and ("+(">"===s[0]?"min-":"max-")+l+":"+(1===s.length?r.replace(vt,((t,e,i)=>Number(e)+a*(">"===s?-1:1)+i)):r):"")+")"}))),g){const t=f?i.concat(h):[...i],n=f?[...e]:yt(e,h.split(St));void 0!==r&&s(Ct(...r)),r=void 0,l(c,n,t)}else void 0===r&&(r=[[],e,i]),h=f||36!==h.charCodeAt(0)?h:`--${xt(n.prefix)}${h.slice(1).replace(/\$/g,"-")}`,c=g?c:"number"==typeof c?c&&t in Pt?String(c)+"px":String(c):Et(wt(t,null==c?"":c),n.prefix,n.themeMap[t]),r[0].push(`${f?`${h} `:`${pt(h)}:`}${c}`)}}var u,p};d(t),void 0!==r&&s(Ct(...r)),r=void 0};l(t,e,i)},Ct=(t,e,i)=>`${i.map((t=>`${t}{`)).join("")}${e.length?`${e.join(",")}{`:""}${t.join(";")}${e.length?"}":""}${Array(i.length?i.length+1:0).join("}")}`,Pt={animationDelay:1,animationDuration:1,backgroundSize:1,blockSize:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockEndWidth:1,borderBlockStart:1,borderBlockStartWidth:1,borderBlockWidth:1,borderBottom:1,borderBottomLeftRadius:1,borderBottomRightRadius:1,borderBottomWidth:1,borderEndEndRadius:1,borderEndStartRadius:1,borderInlineEnd:1,borderInlineEndWidth:1,borderInlineStart:1,borderInlineStartWidth:1,borderInlineWidth:1,borderLeft:1,borderLeftWidth:1,borderRadius:1,borderRight:1,borderRightWidth:1,borderSpacing:1,borderStartEndRadius:1,borderStartStartRadius:1,borderTop:1,borderTopLeftRadius:1,borderTopRightRadius:1,borderTopWidth:1,borderWidth:1,bottom:1,columnGap:1,columnRule:1,columnRuleWidth:1,columnWidth:1,containIntrinsicSize:1,flexBasis:1,fontSize:1,gap:1,gridAutoColumns:1,gridAutoRows:1,gridTemplateColumns:1,gridTemplateRows:1,height:1,inlineSize:1,inset:1,insetBlock:1,insetBlockEnd:1,insetBlockStart:1,insetInline:1,insetInlineEnd:1,insetInlineStart:1,left:1,letterSpacing:1,margin:1,marginBlock:1,marginBlockEnd:1,marginBlockStart:1,marginBottom:1,marginInline:1,marginInlineEnd:1,marginInlineStart:1,marginLeft:1,marginRight:1,marginTop:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,offsetDistance:1,offsetRotate:1,outline:1,outlineOffset:1,outlineWidth:1,overflowClipMargin:1,padding:1,paddingBlock:1,paddingBlockEnd:1,paddingBlockStart:1,paddingBottom:1,paddingInline:1,paddingInlineEnd:1,paddingInlineStart:1,paddingLeft:1,paddingRight:1,paddingTop:1,perspective:1,right:1,rowGap:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginBlockEnd:1,scrollMarginBlockStart:1,scrollMarginBottom:1,scrollMarginInline:1,scrollMarginInlineEnd:1,scrollMarginInlineStart:1,scrollMarginLeft:1,scrollMarginRight:1,scrollMarginTop:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingBlockEnd:1,scrollPaddingBlockStart:1,scrollPaddingBottom:1,scrollPaddingInline:1,scrollPaddingInlineEnd:1,scrollPaddingInlineStart:1,scrollPaddingLeft:1,scrollPaddingRight:1,scrollPaddingTop:1,shapeMargin:1,textDecoration:1,textDecorationThickness:1,textIndent:1,textUnderlineOffset:1,top:1,transitionDelay:1,transitionDuration:1,verticalAlign:1,width:1,wordSpacing:1},kt=t=>String.fromCharCode(t+(t>25?39:97)),Ot=t=>(t=>{let e,i="";for(e=Math.abs(t);e>52;e=e/52|0)i=kt(e%52)+i;return kt(e%52)+i})(((t,e)=>{let i=e.length;for(;i;)t=33*t^e.charCodeAt(--i);return t})(5381,JSON.stringify(t))>>>0),Rt=["themed","global","styled","onevar","resonevar","allvar","inline"],At=t=>{if(t.href&&!t.href.startsWith(location.origin))return!1;try{return!!t.cssRules}catch(e){return!1}},It=t=>{let e;const i=()=>{const{cssRules:t}=e.sheet;return[].map.call(t,((i,n)=>{const{cssText:s}=i;let r="";if(s.startsWith("--sxs"))return"";if(t[n-1]&&(r=t[n-1].cssText).startsWith("--sxs")){if(!i.cssRules.length)return"";for(const t in e.rules)if(e.rules[t].group===i)return`--sxs{--sxs:${[...e.rules[t].cache].join(" ")}}${s}`;return i.cssRules.length?`${r}${s}`:""}return s})).join("")},n=()=>{if(e){const{rules:t,sheet:i}=e;if(!i.deleteRule){for(;3===Object(Object(i.cssRules)[0]).type;)i.cssRules.splice(0,1);i.cssRules=[]}for(const e in t)delete t[e]}const s=Object(t).styleSheets||[];for(const t of s)if(At(t)){for(let s=0,r=t.cssRules;r[s];++s){const o=Object(r[s]);if(1!==o.type)continue;const a=Object(r[s+1]);if(4!==a.type)continue;++s;const{cssText:l}=o;if(!l.startsWith("--sxs"))continue;const h=l.slice(14,-3).trim().split(/\s+/),c=Rt[h[0]];c&&(e||(e={sheet:t,reset:n,rules:{},toString:i}),e.rules[c]={group:a,index:s,cache:new Set(h)})}if(e)break}if(!e){const s=(t,e)=>({type:e,cssRules:[],insertRule(t,e){this.cssRules.splice(e,0,s(t,{import:3,undefined:1}[(t.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return"@media{}"===t?`@media{${[].map.call(this.cssRules,(t=>t.cssText)).join("")}}`:t}});e={sheet:t?(t.head||t).appendChild(document.createElement("style")).sheet:s("","text/css"),rules:{},reset:n,toString:i}}const{sheet:r,rules:o}=e;for(let t=Rt.length-1;t>=0;--t){const e=Rt[t];if(!o[e]){const i=Rt[t+1],n=o[i]?o[i].index:r.cssRules.length;r.insertRule("@media{}",n),r.insertRule(`--sxs{--sxs:${t}}`,n),o[e]={group:r.cssRules[n+1],index:n,cache:new Set([t])}}Lt(o[e])}};return n(),e},Lt=t=>{const e=t.group;let i=e.cssRules.length;t.apply=t=>{try{e.insertRule(t,i),++i}catch(n){}}},$t=Symbol(),Mt=lt(),zt=(t,e)=>Mt(t,(()=>(...i)=>{let n={type:null,composers:new Set};for(const e of i)if(null!=e)if(e[ht]){null==n.type&&(n.type=e[ht].type);for(const t of e[ht].composers)n.composers.add(t)}else e.constructor!==Object||e.$$typeof?null==n.type&&(n.type=e):n.composers.add(Bt(e,t));return null==n.type&&(n.type="span"),n.composers.size||n.composers.add(["PJLV",{},[],[],{},[]]),Ft(t,n,e)})),Bt=({variants:t,compoundVariants:e,defaultVariants:i,...n},s)=>{const r=`${xt(s.prefix)}c-${Ot(n)}`,o=[],a=[],l=Object.create(null),h=[];for(const u in i)l[u]=String(i[u]);if("object"==typeof t&&t)for(const u in t){c=l,d=u,ut.call(c,d)||(l[u]="undefined");const e=t[u];for(const t in e){const i={[u]:String(t)};"undefined"===String(t)&&h.push(u);const n=e[t],s=[i,n,!dt(n)];o.push(s)}}var c,d;if("object"==typeof e&&e)for(const u of e){let{css:t,...e}=u;t="object"==typeof t&&t||{};for(const n in e)e[n]=String(e[n]);const i=[e,t,!dt(t)];a.push(i)}return[r,n,o,a,l,h]},Ft=(t,e,i)=>{const[n,s,r,o]=Dt(e.composers),a="function"==typeof e.type||e.type.$$typeof?(t=>{function e(){for(let i=0;i<e[$t].length;i++){const[n,s]=e[$t][i];t.rules[n].apply(s)}return e[$t]=[],null}return e[$t]=[],e.rules={},Rt.forEach((t=>e.rules[t]={apply:i=>e[$t].push([t,i])})),e})(i):null,l=(a||i).rules,h=`.${n}${s.length>1?`:where(.${s.slice(1).join(".")})`:""}`,c=c=>{c="object"==typeof c&&c||Nt;const{css:d,...u}=c,p={};for(const t in r)if(delete u[t],t in c){let e=c[t];"object"==typeof e&&e?p[t]={"@initial":r[t],...e}:(e=String(e),p[t]="undefined"!==e||o.has(t)?e:r[t])}else p[t]=r[t];const f=new Set([...s]);for(const[n,s,r,o]of e.composers){i.rules.styled.cache.has(n)||(i.rules.styled.cache.add(n),Tt(s,[`.${n}`],[],t,(t=>{l.styled.apply(t)})));const e=jt(r,p,t.media),a=jt(o,p,t.media,!0);for(const s of e)if(void 0!==s)for(const[e,r,o]of s){const s=`${n}-${Ot(r)}-${e}`;f.add(s);const a=(o?i.rules.resonevar:i.rules.onevar).cache,h=o?l.resonevar:l.onevar;a.has(s)||(a.add(s),Tt(r,[`.${s}`],[],t,(t=>{h.apply(t)})))}for(const s of a)if(void 0!==s)for(const[e,r]of s){const s=`${n}-${Ot(r)}-${e}`;f.add(s),i.rules.allvar.cache.has(s)||(i.rules.allvar.cache.add(s),Tt(r,[`.${s}`],[],t,(t=>{l.allvar.apply(t)})))}}if("object"==typeof d&&d){const e=`${n}-i${Ot(d)}-css`;f.add(e),i.rules.inline.cache.has(e)||(i.rules.inline.cache.add(e),Tt(d,[`.${e}`],[],t,(t=>{l.inline.apply(t)})))}for(const t of String(c.className||"").trim().split(/\s+/))t&&f.add(t);const g=u.className=[...f].join(" ");return{type:e.type,className:g,selector:h,props:u,toString:()=>g,deferredInjector:a}};return ct(c,{className:n,selector:h,[ht]:e,toString:()=>(i.rules.styled.cache.has(n)||c(),n)})},Dt=t=>{let e="";const i=[],n={},s=[];for(const[r,,,,o,a]of t){""===e&&(e=r),i.push(r),s.push(...a);for(const t in o){const e=o[t];(void 0===n[t]||"undefined"!==e||a.includes(e))&&(n[t]=e)}}return[e,i,n,new Set(s)]},jt=(t,e,i,n)=>{const s=[];t:for(let[r,o,a]of t){if(a)continue;let t,l=0,h=!1;for(t in r){const n=r[t];let s=e[t];if(s!==n){if("object"!=typeof s||!s)continue t;{let t,e,r=0;for(const o in s){if(n===String(s[o])){if("@initial"!==o){const t=o.slice(1);(e=e||[]).push(t in i?i[t]:o.replace(/^@media ?/,"")),h=!0}l+=r,t=!0}++r}if(e&&e.length&&(o={["@media "+e.join(", ")]:o}),!t)continue t}}}(s[l]=s[l]||[]).push([n?"cv":`${t}-${r[t]}`,o,h])}return s},Nt={},Wt=lt(),Ut=(t,e)=>Wt(t,(()=>(...i)=>{const n=()=>{for(let n of i){n="object"==typeof n&&n||{};let i=Ot(n);if(!e.rules.global.cache.has(i)){if(e.rules.global.cache.add(i),"@import"in n){let t=[].indexOf.call(e.sheet.cssRules,e.rules.themed.group)-1;for(let i of[].concat(n["@import"]))i=i.includes('"')||i.includes("'")?i:`"${i}"`,e.sheet.insertRule(`@import ${i};`,t++);delete n["@import"]}Tt(n,[],[],t,(t=>{e.rules.global.apply(t)}))}}return""};return ct(n,{toString:n})})),Ht=lt(),Vt=(t,e)=>Ht(t,(()=>i=>{const n=`${xt(t.prefix)}k-${Ot(i)}`,s=()=>{if(!e.rules.global.cache.has(n)){e.rules.global.cache.add(n);const s=[];Tt(i,[],[],t,(t=>s.push(t)));const r=`@keyframes ${n}{${s.join("")}}`;e.rules.global.apply(r)}return n};return ct(s,{get name(){return s()},toString:s})})),Gt=class{constructor(t,e,i,n){this.token=null==t?"":String(t),this.value=null==e?"":String(e),this.scale=null==i?"":String(i),this.prefix=null==n?"":String(n)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+xt(this.prefix)+xt(this.scale)+this.token}toString(){return this.computedValue}},Xt=lt(),Yt=(t,e)=>Xt(t,(()=>(i,n)=>{n="object"==typeof i&&i||Object(n);const s=`.${i=(i="string"==typeof i?i:"")||`${xt(t.prefix)}t-${Ot(n)}`}`,r={},o=[];for(const e in n){r[e]={};for(const i in n[e]){const s=`--${xt(t.prefix)}${e}-${i}`,a=Et(String(n[e][i]),t.prefix,e);r[e][i]=new Gt(i,a,e,t.prefix),o.push(`${s}:${a}`)}}const a=()=>{if(o.length&&!e.rules.themed.cache.has(i)){e.rules.themed.cache.add(i);const s=`${n===t.theme?":root,":""}.${i}{${o.join(";")}}`;e.rules.themed.apply(s)}return i};return{...r,get className(){return a()},selector:s,toString:a}})),Kt=lt(),Qt=lt();const qt={toVector:(t,e)=>(void 0===t&&(t=e),Array.isArray(t)?t:[t,t]),add:(t,e)=>[t[0]+e[0],t[1]+e[1]],sub:(t,e)=>[t[0]-e[0],t[1]-e[1]],addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Zt(t,e,i){return 0===e||Math.abs(e)===1/0?Math.pow(t,5*i):t*e*i/(e+i*t)}function Jt(t,e,i,n=.15){return 0===n?function(t,e,i){return Math.max(e,Math.min(t,i))}(t,e,i):t<e?-Zt(e-t,i-e,n)+e:t>i?+Zt(t-i,i-e,n)+i:t}function te(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function ee(t,e,i){return(e=te(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ie(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function ne(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ie(Object(i),!0).forEach((function(e){ee(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ie(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}const se={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function re(t){return t?t[0].toUpperCase()+t.slice(1):""}const oe=["enter","leave"];function ae(t,e="",i=!1){const n=se[t],s=n&&n[e]||e;return"on"+re(t)+re(s)+(function(t=!1,e){return t&&!oe.includes(e)}(i,s)?"Capture":"")}const le=["gotpointercapture","lostpointercapture"];function he(t){let e=t.substring(2).toLowerCase();const i=!!~e.indexOf("passive");i&&(e=e.replace("passive",""));const n=le.includes(e)?"capturecapture":"capture",s=!!~e.indexOf(n);return s&&(e=e.replace("capture","")),{device:e,capture:s,passive:i}}function ce(t){return"touches"in t}function de(t){return ce(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function ue(t){return ce(t)?function(t){return"touchend"===t.type||"touchcancel"===t.type?t.changedTouches:t.targetTouches}(t)[0]:t}function pe(t){return function(t){return Array.from(t.touches).filter((e=>{var i,n;return e.target===t.currentTarget||(null===(i=t.currentTarget)||void 0===i||null===(n=i.contains)||void 0===n?void 0:n.call(i,e.target))}))}(t).map((t=>t.identifier))}function fe(t){const e=ue(t);return ce(t)?e.identifier:e.pointerId}function ge(t){const e=ue(t);return[e.clientX,e.clientY]}function me(t,...e){return"function"==typeof t?t(...e):t}function ve(){}function ye(...t){return 0===t.length?ve:1===t.length?t[0]:function(){let e;for(const i of t)e=i.apply(this,arguments)||e;return e}}function we(t,e){return Object.assign({},e,t||{})}const be=t=>t,xe={enabled:(t=!0)=>t,eventOptions:(t,e,i)=>ne(ne({},i.shared.eventOptions),t),preventDefault:(t=!1)=>t,triggerAllEvents:(t=!1)=>t,rubberband(t=0){switch(t){case!0:return[.15,.15];case!1:return[0,0];default:return qt.toVector(t)}},from:t=>"function"==typeof t?t:null!=t?qt.toVector(t):void 0,transform(t,e,i){const n=t||i.shared.transform;return this.hasCustomTransform=!!n,n||be},threshold:t=>qt.toVector(t,0)},Ee=ne(ne({},xe),{},{axis(t,e,{axis:i}){if(this.lockDirection="lock"===i,!this.lockDirection)return i},axisThreshold:(t=0)=>t,bounds(t={}){if("function"==typeof t)return e=>Ee.bounds(t(e));if("current"in t)return()=>t.current;if("function"==typeof HTMLElement&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:i=1/0,top:n=-1/0,bottom:s=1/0}=t;return[[e,i],[n,s]]}}),Se={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};const _e="undefined"!=typeof window&&window.document&&window.document.createElement;function Te(){return _e&&"ontouchstart"in window||_e&&window.navigator.maxTouchPoints>1}const Ce={isBrowser:_e,gesture:function(){try{return"constructor"in GestureEvent}catch(t){return!1}}(),touch:Te(),touchscreen:Te(),pointer:_e&&"onpointerdown"in window,pointerLock:_e&&"exitPointerLock"in window.document},Pe={mouse:0,touch:0,pen:8},ke=ne(ne({},Ee),{},{device(t,e,{pointer:{touch:i=!1,lock:n=!1,mouse:s=!1}={}}){return this.pointerLock=n&&Ce.pointerLock,Ce.touch&&i?"touch":this.pointerLock?"mouse":Ce.pointer&&!s?"pointer":Ce.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:i}){if(this.preventScrollDelay="number"==typeof i?i:i||void 0===i&&t?250:void 0,Ce.touchscreen&&!1!==i)return t||(void 0!==i?"y":void 0)},pointerCapture(t,e,{pointer:{capture:i=!0,buttons:n=1,keys:s=!0}={}}){return this.pointerButtons=n,this.keys=s,!this.pointerLock&&"pointer"===this.device&&i},threshold(t,e,{filterTaps:i=!1,tapsThreshold:n=3,axis:s}){const r=qt.toVector(t,i?n:s?1:0);return this.filterTaps=i,this.tapsThreshold=n,r},swipe({velocity:t=.5,distance:e=50,duration:i=250}={}){return{velocity:this.transform(qt.toVector(t)),distance:this.transform(qt.toVector(e)),duration:i}},delay(t=0){switch(t){case!0:return 180;case!1:return 0;default:return t}},axisThreshold:t=>t?ne(ne({},Pe),t):Pe,keyboardDisplacement:(t=10)=>t});ne(ne({},xe),{},{device(t,e,{shared:i,pointer:{touch:n=!1}={}}){if(i.target&&!Ce.touch&&Ce.gesture)return"gesture";if(Ce.touch&&n)return"touch";if(Ce.touchscreen){if(Ce.pointer)return"pointer";if(Ce.touch)return"touch"}},bounds(t,e,{scaleBounds:i={},angleBounds:n={}}){const s=t=>{const e=we(me(i,t),{min:-1/0,max:1/0});return[e.min,e.max]},r=t=>{const e=we(me(n,t),{min:-1/0,max:1/0});return[e.min,e.max]};return"function"!=typeof i&&"function"!=typeof n?[s(),r()]:t=>[s(t),r(t)]},threshold(t,e,i){this.lockDirection="lock"===i.axis;return qt.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey:t=>void 0===t?"ctrlKey":t,pinchOnWheel:(t=!0)=>t}),ne(ne({},Ee),{},{mouseOnly:(t=!0)=>t}),ne(ne({},Ee),{},{mouseOnly:(t=!0)=>t});const Oe=new Map,Re=new Map;const Ae={key:"drag",engine:class extends class extends class{constructor(t,e,i){this.ctrl=t,this.args=e,this.key=i,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(t){this.ctrl.state[this.key]=t}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:t,shared:e,ingKey:i,args:n}=this;e[i]=t._active=t.active=t._blocked=t._force=!1,t._step=[!1,!1],t.intentional=!1,t._movement=[0,0],t._distance=[0,0],t._direction=[0,0],t._delta=[0,0],t._bounds=[[-1/0,1/0],[-1/0,1/0]],t.args=n,t.axis=void 0,t.memo=void 0,t.elapsedTime=0,t.direction=[0,0],t.distance=[0,0],t.overflow=[0,0],t._movementBound=[!1,!1],t.velocity=[0,0],t.movement=[0,0],t.delta=[0,0],t.timeStamp=0}start(t){const e=this.state,i=this.config;e._active||(this.reset(),this.computeInitial(),e._active=!0,e.target=t.target,e.currentTarget=t.currentTarget,e.lastOffset=i.from?me(i.from,e):e.offset,e.offset=e.lastOffset),e.startTime=e.timeStamp=t.timeStamp}computeValues(t){const e=this.state;e._values=t,e.values=this.config.transform(t)}computeInitial(){const t=this.state;t._initial=t._values,t.initial=t.values}compute(t){const{state:e,config:i,shared:n}=this;e.args=this.args;let s=0;if(t&&(e.event=t,i.preventDefault&&t.cancelable&&e.event.preventDefault(),e.type=t.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,function(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:i,altKey:n,metaKey:s,ctrlKey:r}=t;Object.assign(e,{shiftKey:i,altKey:n,metaKey:s,ctrlKey:r})}return e}(t)),n.down=n.pressed=n.buttons%2==1||n.touches>0,s=t.timeStamp-e.timeStamp,e.timeStamp=t.timeStamp,e.elapsedTime=e.timeStamp-e.startTime),e._active){const t=e._delta.map(Math.abs);qt.addTo(e._distance,t)}this.axisIntent&&this.axisIntent(t);const[r,o]=e._movement,[a,l]=i.threshold,{_step:h,values:c}=e;if(i.hasCustomTransform?(!1===h[0]&&(h[0]=Math.abs(r)>=a&&c[0]),!1===h[1]&&(h[1]=Math.abs(o)>=l&&c[1])):(!1===h[0]&&(h[0]=Math.abs(r)>=a&&Math.sign(r)*a),!1===h[1]&&(h[1]=Math.abs(o)>=l&&Math.sign(o)*l)),e.intentional=!1!==h[0]||!1!==h[1],!e.intentional)return;const d=[0,0];if(i.hasCustomTransform){const[t,e]=c;d[0]=!1!==h[0]?t-h[0]:0,d[1]=!1!==h[1]?e-h[1]:0}else d[0]=!1!==h[0]?r-h[0]:0,d[1]=!1!==h[1]?o-h[1]:0;this.restrictToAxis&&!e._blocked&&this.restrictToAxis(d);const u=e.offset,p=e._active&&!e._blocked||e.active;p&&(e.first=e._active&&!e.active,e.last=!e._active&&e.active,e.active=n[this.ingKey]=e._active,t&&(e.first&&("bounds"in i&&(e._bounds=me(i.bounds,e)),this.setup&&this.setup()),e.movement=d,this.computeOffset()));const[f,g]=e.offset,[[m,v],[y,w]]=e._bounds;e.overflow=[f<m?-1:f>v?1:0,g<y?-1:g>w?1:0],e._movementBound[0]=!!e.overflow[0]&&(!1===e._movementBound[0]?e._movement[0]:e._movementBound[0]),e._movementBound[1]=!!e.overflow[1]&&(!1===e._movementBound[1]?e._movement[1]:e._movementBound[1]);const b=e._active&&i.rubberband||[0,0];if(e.offset=function(t,[e,i],[n,s]){const[[r,o],[a,l]]=t;return[Jt(e,r,o,n),Jt(i,a,l,s)]}(e._bounds,e.offset,b),e.delta=qt.sub(e.offset,u),this.computeMovement(),p&&(!e.last||s>32)){e.delta=qt.sub(e.offset,u);const t=e.delta.map(Math.abs);qt.addTo(e.distance,t),e.direction=e.delta.map(Math.sign),e._direction=e._delta.map(Math.sign),!e.first&&s>0&&(e.velocity=[t[0]/s,t[1]/s])}}emit(){const t=this.state,e=this.shared,i=this.config;if(t._active||this.clean(),(t._blocked||!t.intentional)&&!t._force&&!i.triggerAllEvents)return;const n=this.handler(ne(ne(ne({},e),t),{},{[this.aliasKey]:t.values}));void 0!==n&&(t.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}{constructor(...t){super(...t),ee(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=qt.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=qt.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const e=this.state,i=this.config;if(!e.axis&&t){const n="object"==typeof i.axisThreshold?i.axisThreshold[de(t)]:i.axisThreshold;e.axis=function([t,e],i){const n=Math.abs(t),s=Math.abs(e);return n>s&&n>i?"x":s>n&&s>i?"y":void 0}(e._movement,n)}e._blocked=(i.lockDirection||!!i.axis)&&!e.axis||!!i.axis&&i.axis!==e.axis}restrictToAxis(t){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":t[1]=0;break;case"y":t[0]=0}}}{constructor(...t){super(...t),ee(this,"ingKey","dragging")}reset(){super.reset();const t=this.state;t._pointerId=void 0,t._pointerActive=!1,t._keyboardActive=!1,t._preventScroll=!1,t._delayed=!1,t.swipe=[0,0],t.tap=!1,t.canceled=!1,t.cancel=this.cancel.bind(this)}setup(){const t=this.state;if(t._bounds instanceof HTMLElement){const e=t._bounds.getBoundingClientRect(),i=t.currentTarget.getBoundingClientRect(),n={left:e.left-i.left+t.offset[0],right:e.right-i.right+t.offset[0],top:e.top-i.top+t.offset[1],bottom:e.bottom-i.bottom+t.offset[1]};t._bounds=Ee.bounds(n)}}cancel(){const t=this.state;t.canceled||(t.canceled=!0,t._active=!1,setTimeout((()=>{this.compute(),this.emit()}),0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(t){const e=this.config,i=this.state;if(null!=t.buttons&&(Array.isArray(e.pointerButtons)?!e.pointerButtons.includes(t.buttons):-1!==e.pointerButtons&&e.pointerButtons!==t.buttons))return;const n=this.ctrl.setEventIds(t);e.pointerCapture&&t.target.setPointerCapture(t.pointerId),n&&n.size>1&&i._pointerActive||(this.start(t),this.setupPointer(t),i._pointerId=fe(t),i._pointerActive=!0,this.computeValues(ge(t)),this.computeInitial(),e.preventScrollAxis&&"mouse"!==de(t)?(i._active=!1,this.setupScrollPrevention(t)):e.delay>0?(this.setupDelayTrigger(t),e.triggerAllEvents&&(this.compute(t),this.emit())):this.startPointerDrag(t))}startPointerDrag(t){const e=this.state;e._active=!0,e._preventScroll=!0,e._delayed=!1,this.compute(t),this.emit()}pointerMove(t){const e=this.state,i=this.config;if(!e._pointerActive)return;if(e.type===t.type&&t.timeStamp===e.timeStamp)return;const n=fe(t);if(void 0!==e._pointerId&&n!==e._pointerId)return;const s=ge(t);return document.pointerLockElement===t.target?e._delta=[t.movementX,t.movementY]:(e._delta=qt.sub(s,e._values),this.computeValues(s)),qt.addTo(e._movement,e._delta),this.compute(t),e._delayed&&e.intentional?(this.timeoutStore.remove("dragDelay"),e.active=!1,void this.startPointerDrag(t)):i.preventScrollAxis&&!e._preventScroll?e.axis?e.axis===i.preventScrollAxis||"xy"===i.preventScrollAxis?(e._active=!1,void this.clean()):(this.timeoutStore.remove("startPointerDrag"),void this.startPointerDrag(t)):void 0:void this.emit()}pointerUp(t){this.ctrl.setEventIds(t);try{this.config.pointerCapture&&t.target.hasPointerCapture(t.pointerId)&&t.target.releasePointerCapture(t.pointerId)}catch(o){}const e=this.state,i=this.config;if(!e._active||!e._pointerActive)return;const n=fe(t);if(void 0!==e._pointerId&&n!==e._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[s,r]=e._distance;if(e.tap=s<=i.tapsThreshold&&r<=i.tapsThreshold,e.tap&&i.filterTaps)e._force=!0;else{const[t,n]=e.direction,[s,r]=e.velocity,[o,a]=e.movement,[l,h]=i.swipe.velocity,[c,d]=i.swipe.distance,u=i.swipe.duration;e.elapsedTime<u&&(Math.abs(s)>l&&Math.abs(o)>c&&(e.swipe[0]=t),Math.abs(r)>h&&Math.abs(a)>d&&(e.swipe[1]=n))}this.emit()}pointerClick(t){!this.state.tap&&t.detail>0&&(t.preventDefault(),t.stopPropagation())}setupPointer(t){const e=this.config,i=e.device;e.pointerLock&&t.currentTarget.requestPointerLock(),e.pointerCapture||(this.eventStore.add(this.sharedConfig.window,i,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,i,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,i,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(t){this.state._preventScroll&&t.cancelable&&t.preventDefault()}setupScrollPrevention(t){this.state._preventScroll=!1,function(t){"persist"in t&&"function"==typeof t.persist&&t.persist()}(t);const e=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",e),this.eventStore.add(this.sharedConfig.window,"touch","cancel",e),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,t)}setupDelayTrigger(t){this.state._delayed=!0,this.timeoutStore.add("dragDelay",(()=>{this.state._step=[0,0],this.startPointerDrag(t)}),this.config.delay)}keyDown(t){const e=Se[t.key];if(e){const i=this.state,n=t.shiftKey?10:t.altKey?.1:1;this.start(t),i._delta=e(this.config.keyboardDisplacement,n),i._keyboardActive=!0,qt.addTo(i._movement,i._delta),this.compute(t),this.emit()}}keyUp(t){t.key in Se&&(this.state._keyboardActive=!1,this.setActive(),this.compute(t),this.emit())}bind(t){const e=this.config.device;t(e,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(t(e,"change",this.pointerMove.bind(this)),t(e,"end",this.pointerUp.bind(this)),t(e,"cancel",this.pointerUp.bind(this)),t("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(t("key","down",this.keyDown.bind(this)),t("key","up",this.keyUp.bind(this))),this.config.filterTaps&&t("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}},resolver:ke};function Ie(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i,n,s={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(s[i]=t[i]);return s}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}const Le={target(t){if(t)return()=>"current"in t?t.current:t},enabled:(t=!0)=>t,window:(t=(Ce.isBrowser?window:void 0))=>t,eventOptions:({passive:t=!0,capture:e=!1}={})=>({passive:t,capture:e}),transform:t=>t},$e=["target","eventOptions","window","enabled","transform"];function Me(t={},e){const i={};for(const[n,s]of Object.entries(e))switch(typeof s){case"function":i[n]=s.call(i,t[n],n,t);break;case"object":i[n]=Me(t[n],s);break;case"boolean":s&&(i[n]=t[n])}return i}class ze{constructor(t,e){ee(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=e}add(t,e,i,n,s){const r=this._listeners,o=function(t,e=""){const i=se[t];return t+(i&&i[e]||e)}(e,i),a=ne(ne({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),s);t.addEventListener(o,n,a);const l=()=>{t.removeEventListener(o,n,a),r.delete(l)};return r.add(l),l}clean(){this._listeners.forEach((t=>t())),this._listeners.clear()}}class Be{constructor(){ee(this,"_timeouts",new Map)}add(t,e,i=140,...n){this.remove(t),this._timeouts.set(t,window.setTimeout(e,i,...n))}remove(t){const e=this._timeouts.get(t);e&&window.clearTimeout(e)}clean(){this._timeouts.forEach((t=>{window.clearTimeout(t)})),this._timeouts.clear()}}class Fe{constructor(t){ee(this,"gestures",new Set),ee(this,"_targetEventStore",new ze(this)),ee(this,"gestureEventStores",{}),ee(this,"gestureTimeoutStores",{}),ee(this,"handlers",{}),ee(this,"config",{}),ee(this,"pointerIds",new Set),ee(this,"touchIds",new Set),ee(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),function(t,e){e.drag&&De(t,"drag");e.wheel&&De(t,"wheel");e.scroll&&De(t,"scroll");e.move&&De(t,"move");e.pinch&&De(t,"pinch");e.hover&&De(t,"hover")}(this,t)}setEventIds(t){return ce(t)?(this.touchIds=new Set(pe(t)),this.touchIds):"pointerId"in t?("pointerup"===t.type||"pointercancel"===t.type?this.pointerIds.delete(t.pointerId):"pointerdown"===t.type&&this.pointerIds.add(t.pointerId),this.pointerIds):void 0}applyHandlers(t,e){this.handlers=t,this.nativeHandlers=e}applyConfig(t,e){this.config=function(t,e,i={}){const n=t,{target:s,eventOptions:r,window:o,enabled:a,transform:l}=n,h=Ie(n,$e);if(i.shared=Me({target:s,eventOptions:r,window:o,enabled:a,transform:l},Le),e){const t=Re.get(e);i[e]=Me(ne({shared:i.shared},h),t)}else for(const c in h){const t=Re.get(c);t&&(i[c]=Me(ne({shared:i.shared},h[c]),t))}return i}(t,e,this.config)}clean(){this._targetEventStore.clean();for(const t of this.gestures)this.gestureEventStores[t].clean(),this.gestureTimeoutStores[t].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...t){const e=this.config.shared,i={};let n;if(!e.target||(n=e.target(),n)){if(e.enabled){for(const e of this.gestures){const s=this.config[e],r=je(i,s.eventOptions,!!n);if(s.enabled){new(Oe.get(e))(this,t,e).bind(r)}}const s=je(i,e.eventOptions,!!n);for(const e in this.nativeHandlers)s(e,"",(i=>this.nativeHandlers[e](ne(ne({},this.state.shared),{},{event:i,args:t}))),void 0,!0)}for(const t in i)i[t]=ye(...i[t]);if(!n)return i;for(const t in i){const{device:e,capture:s,passive:r}=he(t);this._targetEventStore.add(n,e,"",i[t],{capture:s,passive:r})}}}}function De(t,e){t.gestures.add(e),t.gestureEventStores[e]=new ze(t,e),t.gestureTimeoutStores[e]=new Be}const je=(t,e,i)=>(n,s,r,o={},a=!1)=>{var l,h;const c=null!==(l=o.capture)&&void 0!==l?l:e.capture,d=null!==(h=o.passive)&&void 0!==h?h:e.passive;let u=a?n:ae(n,s,c);i&&d&&(u+="Passive"),t[u]=t[u]||[],t[u].push(r)};function Ne(t,e){var i;return i=Ae,Oe.set(i.key,i.engine),Re.set(i.key,i.resolver),function(t,e={},i,n){const s=h.default.useMemo((()=>new Fe(t)),[]);if(s.applyHandlers(t,n),s.applyConfig(e,i),h.default.useEffect(s.effect.bind(s)),h.default.useEffect((()=>s.clean.bind(s)),[]),void 0===e.target)return s.bind.bind(s)}({drag:t},e||{},"drag")}const We=l["useId".toString()]||(()=>{});let Ue=0;const He=["a","button","div","h2","h3","img","li","nav","p","span","svg","ul"].reduce(((t,e)=>({...t,[e]:l.forwardRef(((t,i)=>{const{asChild:n,...s}=t,r=n?I:e;return l.useEffect((()=>{window[Symbol.for("radix-ui")]=!0}),[]),t.as&&console.error(Ve),l.createElement(r,A({},s,{ref:i}))}))})),{}),Ve="Warning: The `as` prop has been removed in favour of `asChild`. For details, see https://radix-ui.com/docs/primitives/overview/styling#changing-the-rendered-element",Ge=l.forwardRef(((t,e)=>l.createElement(He.span,A({},t,{ref:e,style:{...t.style,position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}})))),Xe=l.forwardRef(((t,e)=>{var i,n;const{containerRef:s,style:r,...o}=t,h=null!==(i=null==s?void 0:s.current)&&void 0!==i?i:null===globalThis||void 0===globalThis||null===(n=globalThis.document)||void 0===n?void 0:n.body,[,c]=l.useState({});return B((()=>{c({})}),[]),h?a.default.createPortal(l.createElement(He.div,A({"data-radix-portal":""},o,{ref:e,style:h===document.body?{position:"absolute",top:0,left:0,zIndex:2147483647,...r}:void 0})),h):null})),Ye=l.forwardRef(((t,e)=>{const{children:i,width:n=10,height:s=5,...r}=t;return l.createElement(He.svg,A({},r,{ref:e,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),t.asChild?i:l.createElement("polygon",{points:"0,0 30,0 15,10"}))}));function Ke(t){const[e,i]=l.useState(void 0);return l.useEffect((()=>{if(t){const e=new ResizeObserver((e=>{if(!Array.isArray(e))return;if(!e.length)return;const n=e[0];let s,r;if("borderBoxSize"in n){const t=n.borderBoxSize,e=Array.isArray(t)?t[0]:t;s=e.inlineSize,r=e.blockSize}else{const e=t.getBoundingClientRect();s=e.width,r=e.height}i({width:s,height:r})}));return e.observe(t,{box:"border-box"}),()=>{i(void 0),e.unobserve(t)}}}),[t]),e}let Qe;const qe=new Map;function Ze(){const t=[];qe.forEach(((e,i)=>{const n=i.getBoundingClientRect();var s,r;r=n,((s=e.rect).width!==r.width||s.height!==r.height||s.top!==r.top||s.right!==r.right||s.bottom!==r.bottom||s.left!==r.left)&&(e.rect=n,t.push(e))})),t.forEach((t=>{t.callbacks.forEach((e=>e(t.rect)))})),Qe=requestAnimationFrame(Ze)}function Je(t){const[e,i]=l.useState();return l.useEffect((()=>{if(t){const e=function(t,e){const i=qe.get(t);return void 0===i?(qe.set(t,{rect:{},callbacks:[e]}),1===qe.size&&(Qe=requestAnimationFrame(Ze))):(i.callbacks.push(e),e(t.getBoundingClientRect())),()=>{const i=qe.get(t);if(void 0===i)return;const n=i.callbacks.indexOf(e);n>-1&&i.callbacks.splice(n,1),0===i.callbacks.length&&(qe.delete(t),0===qe.size&&cancelAnimationFrame(Qe))}}(t,i);return()=>{i(void 0),e()}}}),[t]),e}function ti(t,e=[]){let i=[];const n=()=>{const e=i.map((t=>l.createContext(t)));return function(i){const n=(null==i?void 0:i[t])||e;return l.useMemo((()=>({[`__scope${t}`]:{...i,[t]:n}})),[i,n])}};return n.scopeName=t,[function(e,n){const s=l.createContext(n),r=i.length;function o(e){const{scope:i,children:n,...o}=e,a=(null==i?void 0:i[t][r])||s,h=l.useMemo((()=>o),Object.values(o));return l.createElement(a.Provider,{value:h},n)}return i=[...i,n],o.displayName=e+"Provider",[o,function(i,o){const a=(null==o?void 0:o[t][r])||s,h=l.useContext(a);if(h)return h;if(void 0!==n)return n;throw new Error(`\`${i}\` must be used within \`${e}\``)}]},ei(n,...e)]}function ei(...t){const e=t[0];if(1===t.length)return e;const i=()=>{const i=t.map((t=>({useScope:t(),scopeName:t.scopeName})));return function(t){const n=i.reduce(((e,{useScope:i,scopeName:n})=>({...e,...i(t)[`__scope${n}`]})),{});return l.useMemo((()=>({[`__scope${e.scopeName}`]:n})),[n])}};return i.scopeName=e.scopeName,i}function ii(t,e,i){const n=t["x"===i?"left":"top"],s="x"===i?"width":"height",r=t[s],o=e[s];return{before:n-o,start:n,center:n+(r-o)/2,end:n+r-o,after:n+r}}function ni(t){return{position:"absolute",top:0,left:0,minWidth:"max-content",willChange:"transform",transform:`translate3d(${Math.round(t.x+window.scrollX)}px, ${Math.round(t.y+window.scrollY)}px, 0)`}}function si(t,e,i,n,s){const r="top"===e||"bottom"===e,o=s?s.width:0,a=s?s.height:0,l=o/2+n;let h="",c="";return r?(h={start:`${l}px`,center:"center",end:t.width-l+"px"}[i],c="top"===e?`${t.height+a}px`:-a+"px"):(h="left"===e?`${t.width+a}px`:-a+"px",c={start:`${l}px`,center:"center",end:t.height-l+"px"}[i]),`${h} ${c}`}const ri={position:"fixed",top:0,left:0,opacity:0,transform:"translate3d(0, -200%, 0)"},oi={position:"absolute",opacity:0};function ai({popperSize:t,arrowSize:e,arrowOffset:i,side:n,align:s}){const r=(t.width-e.width)/2,o=(t.height-e.width)/2,a={top:0,right:90,bottom:180,left:-90}[n],l=Math.max(e.width,e.height),h={width:`${l}px`,height:`${l}px`,transform:`rotate(${a}deg)`,willChange:"transform",position:"absolute",[n]:"100%",direction:li(n,s)};return"top"!==n&&"bottom"!==n||("start"===s&&(h.left=`${i}px`),"center"===s&&(h.left=`${r}px`),"end"===s&&(h.right=`${i}px`)),"left"!==n&&"right"!==n||("start"===s&&(h.top=`${i}px`),"center"===s&&(h.top=`${o}px`),"end"===s&&(h.bottom=`${i}px`)),h}function li(t,e){return("top"!==t&&"right"!==t||"end"!==e)&&("bottom"!==t&&"left"!==t||"end"===e)?"ltr":"rtl"}function hi(t){return{top:"bottom",right:"left",bottom:"top",left:"right"}[t]}function ci(t,e){return{top:t.top<e.top,right:t.right>e.right,bottom:t.bottom>e.bottom,left:t.left<e.left}}const[di,ui]=ti("Popper"),[pi,fi]=di("Popper"),gi=l.forwardRef(((t,e)=>{const{__scopePopper:i,virtualRef:n,...s}=t,r=fi("PopperAnchor",i),o=l.useRef(null),a=R(e,o);return l.useEffect((()=>{r.onAnchorChange((null==n?void 0:n.current)||o.current)})),n?null:l.createElement(He.div,A({},s,{ref:a}))})),[mi,vi]=di("PopperContent"),yi=t=>{const{__scopePopper:e,children:i}=t,[n,s]=l.useState(null);return l.createElement(pi,{scope:e,anchor:n,onAnchorChange:s},i)},wi=gi,bi=l.forwardRef(((t,e)=>{const{__scopePopper:i,side:n="bottom",sideOffset:s,align:r="center",alignOffset:o,collisionTolerance:a,avoidCollisions:h=!0,...c}=t,d=fi("PopperContent",i),[u,p]=l.useState(),f=Je(d.anchor),[g,m]=l.useState(null),v=Ke(g),[y,w]=l.useState(null),b=Ke(y),x=R(e,(t=>m(t))),E=function(){const[t,e]=l.useState(void 0);return l.useEffect((()=>{let t;function i(){e({width:window.innerWidth,height:window.innerHeight})}function n(){window.clearTimeout(t),t=window.setTimeout(i,100)}return i(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}),[]),t}(),S=E?DOMRect.fromRect({...E,x:0,y:0}):void 0,{popperStyles:_,arrowStyles:T,placedSide:C,placedAlign:P}=function({anchorRect:t,popperSize:e,arrowSize:i,arrowOffset:n=0,side:s,sideOffset:r=0,align:o,alignOffset:a=0,shouldAvoidCollisions:l=!0,collisionBoundariesRect:h,collisionTolerance:c=0}){if(!t||!e||!h)return{popperStyles:ri,arrowStyles:oi};const d=function(t,e,i=0,n=0,s){const r=s?s.height:0,o=ii(e,t,"x"),a=ii(e,t,"y"),l=a.before-i-r,h=a.after+i+r,c=o.before-i-r,d=o.after+i+r;return{top:{start:{x:o.start+n,y:l},center:{x:o.center,y:l},end:{x:o.end-n,y:l}},right:{start:{x:d,y:a.start+n},center:{x:d,y:a.center},end:{x:d,y:a.end-n}},bottom:{start:{x:o.start+n,y:h},center:{x:o.center,y:h},end:{x:o.end-n,y:h}},left:{start:{x:c,y:a.start+n},center:{x:c,y:a.center},end:{x:c,y:a.end-n}}}}(e,t,r,a,i),u=d[s][o];if(!1===l){const t=ni(u);let r=oi;return i&&(r=ai({popperSize:e,arrowSize:i,arrowOffset:n,side:s,align:o})),{popperStyles:{...t,"--radix-popper-transform-origin":si(e,s,o,n,i)},arrowStyles:r,placedSide:s,placedAlign:o}}const p=DOMRect.fromRect({...e,...u}),f=(g=h,m=c,DOMRect.fromRect({width:g.width-2*m,height:g.height-2*m,x:g.left+m,y:g.top+m}));var g,m;const v=ci(p,f),y=d[hi(s)][o],w=function(t,e,i){const n=hi(t);return e[t]&&!i[n]?n:t}(s,v,ci(DOMRect.fromRect({...e,...y}),f)),b=function(t,e,i,n,s){const r="top"===i||"bottom"===i,o=r?"left":"top",a=r?"right":"bottom",l=r?"width":"height",h=e[l]>t[l];return"start"!==n&&"center"!==n||!(s[o]&&h||s[a]&&!h)?"end"!==n&&"center"!==n||!(s[a]&&h||s[o]&&!h)?n:"start":"end"}(e,t,s,o,v),x=ni(d[w][b]);let E=oi;return i&&(E=ai({popperSize:e,arrowSize:i,arrowOffset:n,side:w,align:b})),{popperStyles:{...x,"--radix-popper-transform-origin":si(e,w,b,n,i)},arrowStyles:E,placedSide:w,placedAlign:b}}({anchorRect:f,popperSize:v,arrowSize:b,arrowOffset:u,side:n,sideOffset:s,align:r,alignOffset:o,shouldAvoidCollisions:h,collisionBoundariesRect:S,collisionTolerance:a}),k=void 0!==C;return l.createElement("div",{style:_,"data-radix-popper-content-wrapper":""},l.createElement(mi,{scope:i,arrowStyles:T,onArrowChange:w,onArrowOffsetChange:p},l.createElement(He.div,A({"data-side":C,"data-align":P},c,{style:{...c.style,animation:k?void 0:"none"},ref:x}))))})),xi=l.forwardRef((function(t,e){const{__scopePopper:i,offset:n,...s}=t,r=vi("PopperArrow",i),{onArrowOffsetChange:o}=r;return l.useEffect((()=>o(n)),[o,n]),l.createElement("span",{style:{...r.arrowStyles,pointerEvents:"none"}},l.createElement("span",{ref:r.onArrowChange,style:{display:"inline-block",verticalAlign:"top",pointerEvents:"auto"}},l.createElement(Ye,A({},s,{ref:e,style:{...s.style,display:"block"}}))))})),Ei=t=>{const{present:e,children:i}=t,n=function(t){const[e,i]=l.useState(),n=l.useRef({}),s=l.useRef(t),r=l.useRef("none"),o=t?"mounted":"unmounted",[a,h]=(c=o,d={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},l.useReducer(((t,e)=>{const i=d[t][e];return null!=i?i:t}),c));var c,d;return l.useEffect((()=>{const t=Si(n.current);r.current="mounted"===a?t:"none"}),[a]),B((()=>{const e=n.current,i=s.current;if(i!==t){const n=r.current,o=Si(e);if(t)h("MOUNT");else if("none"===o||"none"===(null==e?void 0:e.display))h("UNMOUNT");else{const t=n!==o;h(i&&t?"ANIMATION_OUT":"UNMOUNT")}s.current=t}}),[t,h]),B((()=>{if(e){const t=t=>{const i=Si(n.current).includes(t.animationName);t.target===e&&i&&h("ANIMATION_END")},i=t=>{t.target===e&&(r.current=Si(n.current))};return e.addEventListener("animationstart",i),e.addEventListener("animationcancel",t),e.addEventListener("animationend",t),()=>{e.removeEventListener("animationstart",i),e.removeEventListener("animationcancel",t),e.removeEventListener("animationend",t)}}}),[e,h]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:l.useCallback((t=>{t&&(n.current=getComputedStyle(t)),i(t)}),[])}}(e),s="function"==typeof i?i({present:n.isPresent}):l.Children.only(i),r=R(n.ref,s.ref);return"function"==typeof i||n.isPresent?l.cloneElement(s,{ref:r}):null};function Si(t){return(null==t?void 0:t.animationName)||"none"}function _i(t){const e=l.useRef(t);return l.useEffect((()=>{e.current=t}),[t]),e.current}function Ti(t){const e=l.useRef(t);return l.useEffect((()=>{e.current=t})),l.useMemo((()=>(...t)=>{var i;return null===(i=e.current)||void 0===i?void 0:i.call(e,...t)}),[])}function Ci(t,e,{checkForDefaultPrevented:i=!0}={}){return function(n){if(null==t||t(n),!1===i||!n.defaultPrevented)return null==e?void 0:e(n)}}Ei.displayName="Presence";const[Pi,ki]=ti("Tooltip",[ui]),Oi=ui(),[Ri,Ai]=Pi("TooltipProvider",{isOpenDelayed:!0,delayDuration:700,onOpen:()=>{},onClose:()=>{}}),[Ii,Li]=Pi("Tooltip"),$i=l.forwardRef(((t,e)=>{const{__scopeTooltip:i,...n}=t,s=Li("TooltipTrigger",i),r=Oi(i),o=R(e,s.onTriggerChange),a=l.useRef(!1),h=l.useCallback((()=>a.current=!1),[]);return l.useEffect((()=>()=>document.removeEventListener("mouseup",h)),[h]),l.createElement(wi,A({asChild:!0},r),l.createElement(He.button,A({"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute},n,{ref:o,onMouseEnter:Ci(t.onMouseEnter,s.onTriggerEnter),onMouseLeave:Ci(t.onMouseLeave,s.onClose),onMouseDown:Ci(t.onMouseDown,(()=>{s.onClose(),a.current=!0,document.addEventListener("mouseup",h,{once:!0})})),onFocus:Ci(t.onFocus,(()=>{a.current||s.onOpen()})),onBlur:Ci(t.onBlur,s.onClose),onClick:Ci(t.onClick,s.onClose)})))})),Mi=l.forwardRef(((t,e)=>{const{forceMount:i,...n}=t,s=Li("TooltipContent",t.__scopeTooltip);return l.createElement(Ei,{present:i||s.open},l.createElement(zi,A({ref:e},n)))})),zi=l.forwardRef(((t,e)=>{const{__scopeTooltip:i,children:n,"aria-label":s,portalled:r=!0,...o}=t,a=Li("TooltipContent",i),h=Oi(i),c=r?Xe:l.Fragment,{onClose:d}=a;return function(t){const e=Ti(t);l.useEffect((()=>{const t=t=>{"Escape"===t.key&&e(t)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)}),[e])}((()=>d())),l.useEffect((()=>(document.addEventListener("tooltip.open",d),()=>document.removeEventListener("tooltip.open",d))),[d]),l.createElement(c,null,l.createElement(Bi,{__scopeTooltip:i}),l.createElement(bi,A({"data-state":a.stateAttribute},h,o,{ref:e,style:{...o.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)"}}),l.createElement($,null,n),l.createElement(Ge,{id:a.contentId,role:"tooltip"},s||n)))}));function Bi(t){const{__scopeTooltip:e}=t,i=Li("CheckTriggerMoved",e),n=Je(i.trigger),s=null==n?void 0:n.left,r=_i(s),o=null==n?void 0:n.top,a=_i(o),h=i.onClose;return l.useEffect((()=>{(void 0!==r&&r!==s||void 0!==a&&a!==o)&&h()}),[h,r,a,s,o]),null}const Fi=t=>{const{__scopeTooltip:e,children:i,open:n,defaultOpen:s=!1,onOpenChange:r,delayDuration:o}=t,a=Ai("Tooltip",e),h=Oi(e),[c,d]=l.useState(null),u=function(t){const[e,i]=l.useState(We());return B((()=>{t||i((t=>null!=t?t:String(Ue++)))}),[t]),t||(e?`radix-${e}`:"")}(),p=l.useRef(0),f=null!=o?o:a.delayDuration,g=l.useRef(!1),{onOpen:m,onClose:v}=a,[y=!1,w]=function({prop:t,defaultProp:e,onChange:i=(()=>{})}){const[n,s]=function({defaultProp:t,onChange:e}){const i=l.useState(t),[n]=i,s=l.useRef(n),r=Ti(e);return l.useEffect((()=>{s.current!==n&&(r(n),s.current=n)}),[n,s,r]),i}({defaultProp:e,onChange:i}),r=void 0!==t,o=r?t:n,a=Ti(i);return[o,l.useCallback((e=>{if(r){const i=e,n="function"==typeof e?i(t):e;n!==t&&a(n)}else s(e)}),[r,t,s,a])]}({prop:n,defaultProp:s,onChange:t=>{t&&(document.dispatchEvent(new CustomEvent("tooltip.open")),m()),null==r||r(t)}}),b=l.useMemo((()=>y?g.current?"delayed-open":"instant-open":"closed"),[y]),x=l.useCallback((()=>{window.clearTimeout(p.current),g.current=!1,w(!0)}),[w]),E=l.useCallback((()=>{window.clearTimeout(p.current),p.current=window.setTimeout((()=>{g.current=!0,w(!0)}),f)}),[f,w]);return l.useEffect((()=>()=>window.clearTimeout(p.current)),[]),l.createElement(yi,h,l.createElement(Ii,{scope:e,contentId:u,open:y,stateAttribute:b,trigger:c,onTriggerChange:d,onTriggerEnter:l.useCallback((()=>{a.isOpenDelayed?E():x()}),[a.isOpenDelayed,E,x]),onOpen:l.useCallback(x,[x]),onClose:l.useCallback((()=>{window.clearTimeout(p.current),w(!1),v()}),[w,v])},i))},Di=$i,ji=Mi,Ni=l.forwardRef(((t,e)=>{const{__scopeTooltip:i,...n}=t,s=Oi(i);return l.createElement(xi,A({},s,n,{ref:e}))}));function Wi(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i,n,s={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(s[i]=t[i]);return s}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}let Ui;var Hi;(Hi=Ui||(Ui={}))[Hi.UNSUPPORTED_INPUT=0]="UNSUPPORTED_INPUT",Hi[Hi.NO_COMPONENT_FOR_TYPE=1]="NO_COMPONENT_FOR_TYPE",Hi[Hi.UNKNOWN_INPUT=2]="UNKNOWN_INPUT",Hi[Hi.DUPLICATE_KEYS=3]="DUPLICATE_KEYS",Hi[Hi.ALREADY_REGISTERED_TYPE=4]="ALREADY_REGISTERED_TYPE",Hi[Hi.CLIPBOARD_ERROR=5]="CLIPBOARD_ERROR",Hi[Hi.THEME_ERROR=6]="THEME_ERROR",Hi[Hi.PATH_DOESNT_EXIST=7]="PATH_DOESNT_EXIST",Hi[Hi.INPUT_TYPE_OVERRIDE=8]="INPUT_TYPE_OVERRIDE",Hi[Hi.EMPTY_KEY=9]="EMPTY_KEY";const Vi={[Ui.UNSUPPORTED_INPUT]:(t,e)=>[`An input with type \`${t}\` input was found at path \`${e}\` but it's not supported yet.`],[Ui.NO_COMPONENT_FOR_TYPE]:(t,e)=>[`Type \`${t}\` found at path \`${e}\` can't be displayed in panel because no component supports it yet.`],[Ui.UNKNOWN_INPUT]:(t,e)=>[`input at path \`${t}\` is not recognized.`,e],[Ui.DUPLICATE_KEYS]:(t,e,i)=>[`Key \`${t}\` of path \`${e}\` already exists at path \`${i}\`. Even nested keys need to be unique. Rename one of the keys.`],[Ui.ALREADY_REGISTERED_TYPE]:t=>[`Type ${t} has already been registered. You can't register a component with the same type.`],[Ui.CLIPBOARD_ERROR]:t=>["Error copying the value",t],[Ui.THEME_ERROR]:(t,e)=>[`Error accessing the theme \`${t}.${e}\` value.`],[Ui.PATH_DOESNT_EXIST]:t=>[`Error getting the value at path \`${t}\`. There is probably an error in your \`render\` function.`],[Ui.PATH_DOESNT_EXIST]:t=>[`Error accessing the value at path \`${t}\``],[Ui.INPUT_TYPE_OVERRIDE]:(t,e,i)=>[`Input at path \`${t}\` already exists with type: \`${e}\`. Its type cannot be overridden with type \`${i}\`.`],[Ui.EMPTY_KEY]:()=>["Keys can not be empty, if you want to hide a label use whitespace."]};function Gi(t,e,...i){const[n,...s]=Vi[e](...i);console[t]("LEVA: "+n,...s)}const Xi=Gi.bind(null,"warn");function Yi(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ki(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Qi(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ki(Object(i),!0).forEach((function(e){Yi(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ki(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}Gi.bind(null,"log");const qi=(t,e,i)=>t>i?i:t<e?e:t,Zi=t=>{if(""===t||"number"==typeof t)return t;try{const e=hn(t);if(!isNaN(e))return e}catch(e){}return parseFloat(t)},Ji=Math.log(10);function tn(t){let e=Math.abs(+String(t).replace(".",""));if(0===e)return.01;for(;0!==e&&e%10==0;)e/=10;const i=Math.floor(Math.log(e)/Ji)+1,n=Math.floor(Math.log10(Math.abs(t))),s=Math.pow(10,n-i);return Math.max(s,.001)}const en=(t,e,i)=>t*(i-e)+e,nn=/\(([0-9+\-*/^ .]+)\)/,sn=/(\d+(?:\.\d+)?) ?\^ ?(\d+(?:\.\d+)?)/,rn=/(\d+(?:\.\d+)?) ?\* ?(\d+(?:\.\d+)?)/,on=/(\d+(?:\.\d+)?) ?\/ ?(\d+(?:\.\d+)?)/,an=/(\d+(?:\.\d+)?) ?\+ ?(\d+(?:\.\d+)?)/,ln=/(\d+(?:\.\d+)?) ?- ?(\d+(?:\.\d+)?)/;function hn(t){if(isNaN(Number(t))){if(nn.test(t)){const e=t.replace(nn,((t,e)=>String(hn(e))));return hn(e)}if(sn.test(t)){return hn(t.replace(sn,((t,e,i)=>String(Math.pow(Number(e),Number(i))))))}if(rn.test(t)){return hn(t.replace(rn,((t,e,i)=>String(Number(e)*Number(i)))))}if(on.test(t)){return hn(t.replace(on,((t,e,i)=>{if(0!=i)return String(Number(e)/Number(i));throw new Error("Division by zero")})))}if(an.test(t)){return hn(t.replace(an,((t,e,i)=>String(Number(e)+Number(i)))))}if(ln.test(t)){return hn(t.replace(ln,((t,e,i)=>String(Number(e)-Number(i)))))}return Number(t)}return Number(t)}let cn;var dn;let un;var pn;(dn=cn||(cn={})).BUTTON="BUTTON",dn.BUTTON_GROUP="BUTTON_GROUP",dn.MONITOR="MONITOR",dn.FOLDER="FOLDER",(pn=un||(un={})).SELECT="SELECT",pn.IMAGE="IMAGE",pn.NUMBER="NUMBER",pn.COLOR="COLOR",pn.STRING="STRING",pn.BOOLEAN="BOOLEAN",pn.INTERVAL="INTERVAL",pn.VECTOR3D="VECTOR3D",pn.VECTOR2D="VECTOR2D";const fn=["value"],gn=["min","max"],mn=(t,{step:e,initialValue:i})=>i+Math.round((t-i)/e)*e;var vn=Object.freeze({__proto__:null,schema:t=>{if("number"==typeof t)return!0;if("string"==typeof t){const e=parseFloat(t);if(isNaN(e))return!1;return t.substring((""+e).length).trim().length<4}return!1},sanitize:(t,{min:e=-1/0,max:i=1/0,suffix:n})=>{const s=parseFloat(t);if(""===t||isNaN(s))throw Error("Invalid number");const r=qi(s,e,i);return n?r+n:r},format:(t,{pad:e=0,suffix:i})=>{const n=parseFloat(t).toFixed(e);return i?n+i:n},normalize:t=>{let{value:e}=t,i=Wi(t,fn);const{min:n=-1/0,max:s=1/0}=i,r=Wi(i,gn);let o=parseFloat(e);const a="string"==typeof e?e.substring((""+o).length):void 0;o=qi(o,n,s);let l=i.step;l||(Number.isFinite(n)?l=Number.isFinite(s)?+(Math.abs(s-n)/100).toPrecision(1):+(Math.abs(o-n)/100).toPrecision(1):Number.isFinite(s)&&(l=+(Math.abs(s-o)/100).toPrecision(1)));const h=l?10*tn(l):tn(o);l=l||h/10;return{value:a?o+a:o,settings:Qi({initialValue:o,step:l,pad:Math.round(qi(Math.log10(1/h),0,2)),min:n,max:s,suffix:a},r)}},sanitizeStep:mn});function yn(){return yn=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},yn.apply(this,arguments)}const wn=n.createContext({});function bn(){return n.useContext(wn)}const xn=n.createContext(null);n.createContext(null);const En=n.createContext(null);function Sn(t,e){const[i,n]=t.split(" "),s={};return"none"!==i&&(s.boxShadow=`${e.inset?"inset ":""}0 0 0 $borderWidths${[e.key]} $colors${"default"!==i&&i||e.borderColor}`),n&&(s.backgroundColor=n),s}const _n={$inputStyle:()=>t=>Sn(t,{key:"$input",borderColor:"$highlight1",inset:!0}),$focusStyle:()=>t=>Sn(t,{key:"$focus",borderColor:"$accent2"}),$hoverStyle:()=>t=>Sn(t,{key:"$hover",borderColor:"$accent1",inset:!0}),$activeStyle:()=>t=>Sn(t,{key:"$active",borderColor:"$accent1",inset:!0})},{styled:Tn,css:Cn,createTheme:Pn,globalCss:kn,keyframes:On}=(t=>{const e=(t=>{let e=!1;const i=Kt(t,(t=>{e=!0;const i="prefix"in(t="object"==typeof t&&t||{})?String(t.prefix):"",n="object"==typeof t.media&&t.media||{},s="object"==typeof t.root?t.root||null:globalThis.document||null,r="object"==typeof t.theme&&t.theme||{},o={prefix:i,media:n,theme:r,themeMap:"object"==typeof t.themeMap&&t.themeMap||{...ot},utils:"object"==typeof t.utils&&t.utils||{}},a=It(s),l={css:zt(o,a),globalCss:Ut(o,a),keyframes:Vt(o,a),createTheme:Yt(o,a),reset(){a.reset(),l.theme.toString()},theme:{},sheet:a,config:o,prefix:i,getCssText:a.toString,toString:a.toString};return String(l.theme=l.createTheme(r)),l}));return e||i.reset(),i})(t);return e.styled=(({config:t,sheet:e})=>Qt(t,(()=>{const i=zt(t,e);return(...t)=>{const e=i(...t),n=e[ht].type,s=h.default.forwardRef(((t,i)=>{const s=t&&t.as||n,{props:r,deferredInjector:o}=e(t);return delete r.as,r.ref=i,o?h.default.createElement(h.default.Fragment,null,h.default.createElement(s,r),h.default.createElement(o,null)):h.default.createElement(s,r)}));return s.className=e.className,s.displayName=`Styled.${n.displayName||n.name||n}`,s.selector=e.selector,s.toString=()=>e.selector,s[ht]=e[ht],s}})))(e),e})({prefix:"leva",theme:{colors:{elevation1:"#292d39",elevation2:"#181c20",elevation3:"#373c4b",accent1:"#0066dc",accent2:"#007bff",accent3:"#3c93ff",highlight1:"#535760",highlight2:"#8c92a4",highlight3:"#fefefe",vivid1:"#ffcc00",folderWidgetColor:"$highlight2",folderTextColor:"$highlight3",toolTipBackground:"$highlight3",toolTipText:"$elevation2"},radii:{xs:"2px",sm:"3px",lg:"10px"},space:{xs:"3px",sm:"6px",md:"10px",rowGap:"7px",colGap:"7px"},fonts:{mono:"ui-monospace, SFMono-Regular, Menlo, 'Roboto Mono', monospace",sans:"system-ui, sans-serif"},fontSizes:{root:"11px",toolTip:"$root"},sizes:{rootWidth:"280px",controlWidth:"160px",numberInputMinWidth:"38px",scrubberWidth:"8px",scrubberHeight:"16px",rowHeight:"24px",folderTitleHeight:"20px",checkboxSize:"16px",joystickWidth:"100px",joystickHeight:"100px",colorPickerWidth:"$controlWidth",colorPickerHeight:"100px",imagePreviewWidth:"$controlWidth",imagePreviewHeight:"100px",monitorHeight:"60px",titleBarHeight:"39px"},shadows:{level1:"0 0 9px 0 #00000088",level2:"0 4px 14px #00000033"},borderWidths:{root:"0px",input:"1px",focus:"1px",hover:"1px",active:"1px",folder:"1px"},fontWeights:{label:"normal",folder:"normal",button:"normal"}},utils:Qi(Qi({},_n),{},{$flex:()=>({display:"flex",alignItems:"center"}),$flexCenter:()=>({display:"flex",alignItems:"center",justifyContent:"center"}),$reset:()=>({outline:"none",fontSize:"inherit",fontWeight:"inherit",color:"inherit",fontFamily:"inherit",border:"none",backgroundColor:"transparent",appearance:"none"}),$draggable:()=>({touchAction:"none",WebkitUserDrag:"none",userSelect:"none"}),$focus:t=>({"&:focus":_n.$focusStyle()(t)}),$focusWithin:t=>({"&:focus-within":_n.$focusStyle()(t)}),$hover:t=>({"&:hover":_n.$hoverStyle()(t)}),$active:t=>({"&:active":_n.$activeStyle()(t)})})});kn({".leva__panel__dragged":{WebkitUserDrag:"none",userSelect:"none",input:{userSelect:"none"},"*":{cursor:"ew-resize !important"}}});const Rn=Tn("input",{$reset:"",padding:"0 $sm",width:0,minWidth:0,flex:1,height:"100%",variants:{levaType:{number:{textAlign:"right"}},as:{textarea:{padding:"$sm"}}}}),An=Tn("div",{$draggable:"",height:"100%",$flexCenter:"",position:"relative",padding:"0 $xs",fontSize:"0.8em",opacity:.8,cursor:"default",touchAction:"none",[`& + ${Rn}`]:{paddingLeft:0}}),In=Tn(An,{cursor:"ew-resize",marginRight:"-$xs",textTransform:"uppercase",opacity:.3,"&:hover":{opacity:1},variants:{dragging:{true:{backgroundColor:"$accent2",opacity:1}}}}),Ln=Tn("div",{$flex:"",position:"relative",borderRadius:"$sm",overflow:"hidden",color:"inherit",height:"$rowHeight",backgroundColor:"$elevation3",$inputStyle:"$elevation1",$hover:"",$focusWithin:"",variants:{textArea:{true:{height:"auto"}}}}),$n=["innerLabel","value","onUpdate","onChange","onKeyDown","type","id","inputType","rows"],Mn=["onUpdate"];function zn(t){let{innerLabel:e,value:i,onUpdate:s,onChange:r,onKeyDown:o,type:a,id:l,inputType:c="text",rows:d=0}=t,u=Wi(t,$n);const{id:p,emitOnEditStart:f,emitOnEditEnd:g,disabled:m}=bn(),v=l||p,y=n.useRef(null),w=d>0,b=w?"textarea":"input",x=n.useCallback((t=>e=>{const i=e.currentTarget.value;t(i)}),[]);h.default.useEffect((()=>{const t=y.current,e=x((t=>{s(t),g()}));return null==t||t.addEventListener("blur",e),()=>null==t?void 0:t.removeEventListener("blur",e)}),[x,s,g]);const E=n.useCallback((t=>{"Enter"===t.key&&x(s)(t)}),[x,s]),S=Object.assign({as:b},w?{rows:d}:{},u);return h.default.createElement(Ln,{textArea:w},e&&"string"==typeof e?h.default.createElement(An,null,e):e,h.default.createElement(Rn,yn({levaType:a,ref:y,id:v,type:c,autoComplete:"off",spellCheck:"false",value:i,onChange:x(r),onFocus:()=>f(),onKeyPress:E,onKeyDown:o,disabled:m},S)))}function Bn(t){let{onUpdate:e}=t,i=Wi(t,Mn);const s=n.useCallback((t=>e(Zi(t))),[e]),r=n.useCallback((t=>{const i="ArrowUp"===t.key?1:"ArrowDown"===t.key?-1:0;if(i){t.preventDefault();const n=t.altKey?.1:t.shiftKey?10:1;e((t=>parseFloat(t)+i*n))}}),[e]);return h.default.createElement(zn,yn({},i,{onUpdate:s,onKeyDown:r,type:"number"}))}const Fn=Tn("div",{}),Dn=Tn("div",{position:"relative",background:"$elevation2",transition:"height 300ms ease",variants:{fill:{true:{},false:{}},flat:{false:{},true:{}},isRoot:{true:{},false:{paddingLeft:"$md","&::after":{content:'""',position:"absolute",left:0,top:0,width:"$borderWidths$folder",height:"100%",backgroundColor:"$folderWidgetColor",opacity:.4,transform:"translateX(-50%)"}}}},compoundVariants:[{isRoot:!0,fill:!1,css:{overflowY:"auto",maxHeight:"calc(100vh - 20px - $$titleBarHeight)"}},{isRoot:!0,flat:!1,css:{borderRadius:"$lg"}}]});Tn("div",{$flex:"",color:"$folderTextColor",userSelect:"none",cursor:"pointer",height:"$folderTitleHeight",fontWeight:"$folder","> svg":{marginLeft:-4,marginRight:4,cursor:"pointer",fill:"$folderWidgetColor",opacity:.6},"&:hover > svg":{fill:"$folderWidgetColor"},[`&:hover + ${Dn}::after`]:{opacity:.6},[`${Fn}:hover > & + ${Dn}::after`]:{opacity:.6},[`${Fn}:hover > & > svg`]:{opacity:1}});const jn=Tn("div",{position:"relative",display:"grid",gridTemplateColumns:"100%",rowGap:"$rowGap",transition:"opacity 250ms ease",variants:{toggled:{true:{opacity:1,transitionDelay:"250ms"},false:{opacity:0,transitionDelay:"0ms",pointerEvents:"none"}},isRoot:{true:{"& > div":{paddingLeft:"$md",paddingRight:"$md"},"& > div:first-of-type":{paddingTop:"$sm"},"& > div:last-of-type":{paddingBottom:"$sm"},[`> ${Fn}:not(:first-of-type)`]:{paddingTop:"$sm",marginTop:"$md",borderTop:"$borderWidths$folder solid $colors$elevation1"}}}}}),Nn=Tn("div",{position:"relative",zIndex:100,display:"grid",rowGap:"$rowGap",gridTemplateRows:"minmax($sizes$rowHeight, max-content)",alignItems:"center",color:"$highlight2",[`${jn} > &`]:{"&:first-of-type":{marginTop:"$rowGap"},"&:last-of-type":{marginBottom:"$rowGap"}},variants:{disabled:{true:{pointerEvents:"none"},false:{"&:hover,&:focus-within":{color:"$highlight3"}}}}}),Wn=Tn(Nn,{gridTemplateColumns:"auto $sizes$controlWidth",columnGap:"$colGap"}),Un=Tn("div",{$flex:"",height:"100%",position:"relative",overflow:"hidden","& > div":{marginLeft:"$colGap",padding:"0 $xs",opacity:.4},"& > div:hover":{opacity:.8},"& > div > svg":{display:"none",cursor:"pointer",width:13,minWidth:13,height:13,backgroundColor:"$elevation2"},"&:hover > div > svg":{display:"block"},variants:{align:{top:{height:"100%",alignItems:"flex-start",paddingTop:"$sm"}}}}),Hn=Tn("input",{$reset:"",height:0,width:0,opacity:0,margin:0,"& + label":{position:"relative",$flexCenter:"",height:"100%",userSelect:"none",cursor:"pointer",paddingLeft:2,paddingRight:"$sm",pointerEvents:"auto"},"& + label:after":{content:'""',width:6,height:6,backgroundColor:"$elevation3",borderRadius:"50%",$activeStyle:""},"&:focus + label:after":{$focusStyle:""},"& + label:active:after":{backgroundColor:"$accent1",$focusStyle:""},"&:checked + label:after":{backgroundColor:"$accent1"}}),Vn=Tn("label",{fontWeight:"$label",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","& > svg":{display:"block"}});Tn("div",{opacity:1,variants:{disabled:{true:{opacity:.6,pointerEvents:"none",[`& ${Vn}`]:{pointerEvents:"auto"}}}}}),Tn("div",{position:"fixed",top:0,bottom:0,right:0,left:0,zIndex:1e3,userSelect:"none"});const Gn=Tn("div",{background:"$toolTipBackground",fontFamily:"$sans",fontSize:"$toolTip",padding:"$xs $sm",color:"$toolTipText",borderRadius:"$xs",boxShadow:"$level2",maxWidth:260}),Xn=Tn(Ni,{fill:"$toolTipBackground"}),Yn=["align"];function Kn(){const{id:t,disable:e,disabled:i}=bn();return h.default.createElement(h.default.Fragment,null,h.default.createElement(Hn,{id:t+"__disable",type:"checkbox",checked:!i,onChange:()=>e(!i)}),h.default.createElement("label",{htmlFor:t+"__disable"}))}function Qn(t){const{id:e,optional:i,hint:n}=bn(),s=t.htmlFor||(e?{htmlFor:e}:null),r=n||"string"!=typeof t.children?null:{title:t.children};return h.default.createElement(h.default.Fragment,null,i&&h.default.createElement(Kn,null),void 0!==n?h.default.createElement(Fi,null,h.default.createElement(Di,{asChild:!0},h.default.createElement(Vn,yn({},s,t))),h.default.createElement(ji,{side:"top",sideOffset:2},h.default.createElement(Gn,null,n,h.default.createElement(Xn,null)))):h.default.createElement(Vn,yn({},s,r,t)))}function qn(t){let{align:e}=t,i=Wi(t,Yn);const{value:s,label:r,key:o,disabled:a}=bn(),{hideCopyButton:l}=n.useContext(En),c=!l&&void 0!==o,[d,u]=n.useState(!1);return h.default.createElement(Un,{align:e,onPointerLeave:()=>u(!1)},h.default.createElement(Qn,i),c&&!a&&h.default.createElement("div",{title:`Click to copy ${"string"==typeof r?r:o} value`},d?h.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},h.default.createElement("path",{d:"M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"}),h.default.createElement("path",{fillRule:"evenodd",d:"M4 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v11a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm9.707 5.707a1 1 0 00-1.414-1.414L9 12.586l-1.293-1.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})):h.default.createElement("svg",{onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify({[o]:null!=s?s:""})),u(!0)}catch(t){Xi(Ui.CLIPBOARD_ERROR,{[o]:s})}},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},h.default.createElement("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),h.default.createElement("path",{d:"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"}))))}const Zn=["toggled"],Jn=Tn("svg",{fill:"currentColor",transition:"transform 350ms ease, fill 250ms ease"});function ts(t){let{toggled:e}=t,i=Wi(t,Zn);return h.default.createElement(Jn,yn({width:"9",height:"5",viewBox:"0 0 9 5",xmlns:"http://www.w3.org/2000/svg",style:{transform:`rotate(${e?0:-90}deg)`}},i),h.default.createElement("path",{d:"M3.8 4.4c.4.3 1 .3 1.4 0L8 1.7A1 1 0 007.4 0H1.6a1 1 0 00-.7 1.7l3 2.7z"}))}const es=["input"];function is(t){let{input:e}=t,i=Wi(t,es);return e?h.default.createElement(Wn,i):h.default.createElement(Nn,i)}function ns(t,e){const{emitOnEditStart:i,emitOnEditEnd:n}=bn();return Ne((e=>{e.first&&(document.body.classList.add("leva__panel__dragged"),null==i||i());const s=t(e);return e.last&&(document.body.classList.remove("leva__panel__dragged"),null==n||n()),s}),e)}const ss=Tn("div",{variants:{hasRange:{true:{position:"relative",display:"grid",gridTemplateColumns:"auto $sizes$numberInputMinWidth",columnGap:"$colGap",alignItems:"center"}}}}),rs=Tn("div",{position:"relative",width:"100%",height:2,borderRadius:"$xs",backgroundColor:"$elevation1"}),os=Tn("div",{position:"absolute",width:"$scrubberWidth",height:"$scrubberHeight",borderRadius:"$xs",boxShadow:"0 0 0 2px $colors$elevation2",backgroundColor:"$accent2",cursor:"pointer",$active:"none $accent1",$hover:"none $accent3",variants:{position:{left:{borderTopRightRadius:0,borderBottomRightRadius:0,transform:"translateX(calc(-0.5 * ($sizes$scrubberWidth + 4px)))"},right:{borderTopLeftRadius:0,borderBottomLeftRadius:0,transform:"translateX(calc(0.5 * ($sizes$scrubberWidth + 4px)))"}}}}),as=Tn("div",{position:"relative",$flex:"",height:"100%",cursor:"pointer",touchAction:"none"}),ls=Tn("div",{position:"absolute",height:"100%",backgroundColor:"$accent2"});function hs({value:t,min:e,max:i,onDrag:s,step:r,initialValue:o}){const a=n.useRef(null),l=n.useRef(null),c=n.useRef(0),d=function(t,e){const{theme:i}=n.useContext(xn);if(!(t in i)||!(e in i[t]))return Xi(Ui.THEME_ERROR,t,e),"";let s=e;for(;;){let e=i[t][s];if("string"!=typeof e||"$"!==e.charAt(0))return e;s=e.substr(1)}}("sizes","scrubberWidth"),u=ns((({event:n,first:h,xy:[u],movement:[p],memo:f})=>{if(h){const{width:s,left:r}=a.current.getBoundingClientRect();c.current=s-parseFloat(d);f=(null==n?void 0:n.target)===l.current?t:en((u-r)/s,e,i)}const g=f+en(p/c.current,0,i-e);return s(mn(g,{step:r,initialValue:o})),f})),p=((t,e,i)=>i===e?0:(qi(t,e,i)-e)/(i-e))(t,e,i);return h.default.createElement(as,yn({ref:a},u()),h.default.createElement(rs,null,h.default.createElement(ls,{style:{left:0,right:100*(1-p)+"%"}})),h.default.createElement(os,{ref:l,style:{left:`calc(${p} * (100% - ${d}))`}}))}const cs=h.default.memo((({label:t,onUpdate:e,step:i,innerLabelTrim:s})=>{const[r,o]=n.useState(!1),a=ns((({active:t,delta:[n],event:s,memo:r=0})=>(o(t),r+=n/2,Math.abs(r)>=1&&(e((t=>parseFloat(t)+Math.floor(r)*i*(t=>t.shiftKey?5:t.altKey?.2:1)(s))),r=0),r)));return h.default.createElement(In,yn({dragging:r,title:t.length>1?t:""},a()),t.slice(0,s))}));function ds({label:t,id:e,displayValue:i,onUpdate:n,onChange:s,settings:r,innerLabelTrim:o=1}){const a=o>0&&h.default.createElement(cs,{label:t,step:r.step,onUpdate:n,innerLabelTrim:o});return h.default.createElement(Bn,{id:e,value:String(i),onUpdate:n,onChange:s,innerLabel:a})}Qi({component:function(){const t=bn(),{label:e,value:i,onUpdate:n,settings:s,id:r}=t,{min:o,max:a}=s,l=a!==1/0&&o!==-1/0;return h.default.createElement(is,{input:!0},h.default.createElement(qn,null,e),h.default.createElement(ss,{hasRange:l},l&&h.default.createElement(hs,yn({value:parseFloat(i),onDrag:n},s)),h.default.createElement(ds,yn({},t,{id:r,label:"value",innerLabelTrim:l?0:1}))))}},Wi(vn,["sanitizeStep"]));var us=Object.freeze({__proto__:null,schema:(t,e)=>X().schema({options:X().passesAnyOf(X().object(),X().array())}).test(e),sanitize:(t,{values:e})=>{if(e.indexOf(t)<0)throw Error("Selected value doesn't match Select options");return t},format:(t,{values:e})=>e.indexOf(t),normalize:t=>{let e,i,{value:n,options:s}=t;return Array.isArray(s)?(i=s,e=s.map((t=>String(t)))):(i=Object.values(s),e=Object.keys(s)),"value"in t?i.includes(n)||(e.unshift(String(n)),i.unshift(n)):n=i[0],Object.values(s).includes(n)||(s[String(n)]=n),{value:n,settings:{keys:e,values:i}}}});const ps=Tn("div",{$flexCenter:"",position:"relative","> svg":{pointerEvents:"none",position:"absolute",right:"$md"}}),fs=Tn("select",{position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:0}),gs=Tn("div",{display:"flex",alignItems:"center",width:"100%",height:"$rowHeight",backgroundColor:"$elevation3",borderRadius:"$sm",padding:"0 $sm",cursor:"pointer",[`${fs}:focus + &`]:{$focusStyle:""},[`${fs}:hover + &`]:{$hoverStyle:""}});function ms({displayValue:t,value:e,onUpdate:i,id:s,settings:r,disabled:o}){const{keys:a,values:l}=r,c=n.useRef();return e===l[t]&&(c.current=a[t]),h.default.createElement(ps,null,h.default.createElement(fs,{id:s,value:t,onChange:t=>i(l[Number(t.currentTarget.value)]),disabled:o},a.map(((t,e)=>h.default.createElement("option",{key:t,value:e},t)))),h.default.createElement(gs,null,c.current),h.default.createElement(ts,{toggled:!0}))}Qi({component:function(){const{label:t,value:e,displayValue:i,onUpdate:n,id:s,disabled:r,settings:o}=bn();return h.default.createElement(is,{input:!0},h.default.createElement(qn,null,t),h.default.createElement(ms,{id:s,value:e,displayValue:i,onUpdate:n,settings:o,disabled:r}))}},us);var vs=Object.freeze({__proto__:null,schema:t=>X().string().test(t),sanitize:t=>{if("string"!=typeof t)throw Error("Invalid string");return t},normalize:({value:t,editable:e=!0,rows:i=!1})=>({value:t,settings:{editable:e,rows:"number"==typeof i?i:i?5:0}})});const ys=["displayValue","onUpdate","onChange","editable"],ws=Tn("div",{whiteSpace:"pre-wrap"});function bs(t){let{displayValue:e,onUpdate:i,onChange:n,editable:s=!0}=t,r=Wi(t,ys);return s?h.default.createElement(zn,yn({value:e,onUpdate:i,onChange:n},r)):h.default.createElement(ws,null,e)}Qi({component:function(){const{label:t,settings:e,displayValue:i,onUpdate:n,onChange:s}=bn();return h.default.createElement(is,{input:!0},h.default.createElement(qn,null,t),h.default.createElement(bs,yn({displayValue:i,onUpdate:n,onChange:s},e)))}},vs);var xs=Object.freeze({__proto__:null,schema:t=>X().boolean().test(t),sanitize:t=>{if("boolean"!=typeof t)throw Error("Invalid boolean");return t}});const Es=Tn("div",{position:"relative",$flex:"",height:"$rowHeight",input:{$reset:"",height:0,width:0,opacity:0,margin:0},label:{position:"relative",$flexCenter:"",userSelect:"none",cursor:"pointer",height:"$checkboxSize",width:"$checkboxSize",backgroundColor:"$elevation3",borderRadius:"$sm",$hover:""},"input:focus + label":{$focusStyle:""},"input:focus:checked + label, input:checked + label:hover":{$hoverStyle:"$accent3"},"input + label:active":{backgroundColor:"$accent1"},"input:checked + label:active":{backgroundColor:"$accent1"},"label > svg":{display:"none",width:"90%",height:"90%",stroke:"$highlight3"},"input:checked + label":{backgroundColor:"$accent2"},"input:checked + label > svg":{display:"block"}});function Ss({value:t,onUpdate:e,id:i,disabled:n}){return h.default.createElement(Es,null,h.default.createElement("input",{id:i,type:"checkbox",checked:t,onChange:t=>e(t.currentTarget.checked),disabled:n}),h.default.createElement("label",{htmlFor:i},h.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},h.default.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))))}Qi({component:function(){const{label:t,value:e,onUpdate:i,disabled:n,id:s}=bn();return h.default.createElement(is,{input:!0},h.default.createElement(qn,null,t),h.default.createElement(Ss,{value:e,onUpdate:i,id:s,disabled:n}))}},xs),Tn("div",{display:"grid",columnGap:"$colGap",gridAutoFlow:"column dense",alignItems:"center",variants:{withLock:{true:{gridTemplateColumns:"10px auto","> svg":{cursor:"pointer"}}}}});class _s extends _{constructor(t){super(),this.type="spacial-content",this.style={opacity:1},this.format="jpg",this.tileUrl=function(t){const e=t.length;return t.indexOf("/info.json")===e-10?t.slice(0,-10):t}(t.url),this.id=t.id||`${this.tileUrl}--${t.scaleFactor}`,this.points=t.displayPoints?t.displayPoints:E(t.points,w(t.scaleFactor)),this.tileWidth=t.tileWidth,this.display={x:0,y:0,width:t.width/t.scaleFactor,height:t.height/t.scaleFactor,points:t.points,scale:t.scaleFactor},t.format&&(this.format=t.format)}applyProps(t){if(t.style&&void 0!==t.style.opacity&&(this.style.opacity=t.style.opacity),t.service!==this.service&&(this.service=t.service),t.format?this.format=t.format:this.format="jpg",t.crop){this.cropData=t.crop;const e=g([...this.points]),i=e.length/5,n=t.crop.x||0,s=t.crop.y||0,r=t.crop.x+t.crop.width,o=t.crop.y+t.crop.height;for(let t=0;t<i;t++){const i=5*t;e[i+1]<r&&e[i+3]>n&&e[i+2]<o&&e[i+4]>s?(e[i+1]=qi(e[i+1],n,r),e[i+3]=qi(e[i+3],n,r),e[i+2]=qi(e[i+2],s,o),e[i+4]=qi(e[i+4],s,o)):e[i]=0}y(e,b(-t.crop.x,-t.crop.y)),this.crop?this.crop.set(e):this.crop=e}}static fromTile(t,e,i,n,s,r,o){i.height=i.height?i.height:i.width;const a=o?Math.floor(e.width/n):Math.ceil(e.width/n),l=o?Math.floor(e.height/n):Math.ceil(e.height/n),h=Math.ceil(a/i.width),c=Math.ceil(l/i.height),d=v.grid(h,c),u=v.grid(h,c);for(let f=0;f<c;f++)for(let t=0;t<h;t++){const s=t*i.width,r=f*i.height;u.addPoints(s*n,r*n,t===h-1?e.width:(s+i.width)*n,f===c-1?e.height:(r+i.height)*n),d.addPoints(s,r,t===h-1?a:s+i.width,f===c-1?l:r+i.height)}const p=new _s({url:t,scaleFactor:n,points:d.build(),displayPoints:u.build(),width:e.width,height:e.height,tileWidth:i.width,format:r});return p.applyProps({service:s}),p}getImageUrl(t){const e=this.points.slice(5*t,5*t+5),i=e[3]-e[1],n=e[4]-e[2],s=Math.ceil(i/this.display.scale);return`${this.tileUrl}/${e[1]},${e[2]},${i},${n}/${s>this.tileWidth?this.tileWidth:s},/0/default.${this.format||"jpg"}`}getAllPointsAt(t,e,i){return[[this,f(this.crop||this.points,t),e]]}transform(t){y(this.points,t)}getScheduledUpdates(t,e){return[]}}class Ts extends _{constructor(){super(...arguments),this.type="spacial-content"}getAllPointsAt(t,e,i){return[[this,this.points,e]]}}class Cs extends Ts{constructor(t){super(),this.images=[],this.allImages=[],this.scaleFactors=[],this.aggregateBuffer=g(9),this.isFullyLoaded=!1,this.maxScaleFactor=0,this._scheduleSortByScales=!1,this._sortByScales=()=>{this._scheduleSortByScales=!1,this.allImages.sort(((t,e)=>e.display.width-t.display.width)),this.images=[];let t=.1;for(const e of this.allImages){if(e.display.width<this.renderOptions.minSize&&e.display.height<this.renderOptions.minSize&&!e.priority)continue;if(e instanceof T&&(e.display.width>this.renderOptions.maxImageSize||e.display.height>this.renderOptions.maxImageSize)&&!e.priority)continue;if(Math.abs(e.display.scale-t)<.25||e.priority){const t=this.images.pop();t&&(t instanceof T||t.priority)?(e.priority&&this.images.push(e),this.images.push(t)):e&&this.images.push(e)}else e&&this.images.push(e);t=e.display.scale}0===this.images.length&&(this.images=[...this.allImages]),this.scaleFactors=this.images.map((t=>t.display.scale)),this.maxScaleFactor=Math.max(...this.scaleFactors)},this.loadFullResource=async()=>{if(!this.isFullyLoaded&&this.lazyLoader){this.isFullyLoaded=!0;const t=await this.lazyLoader();this.addImages(t)}},this.fallback=[this.loadFullResource],this.id=t.id,this.points=v.singleBox(t.width,t.height),this.lazyLoader=t.loadFullImages,t.loadFullImages||(this.isFullyLoaded=!0),this.display={x:0,y:0,points:v.singleBox(t.width,t.height),height:t.height,width:t.width,scale:1},this.renderOptions={renderSmallestFallback:!0,renderLayers:2,minSize:255,maxImageSize:1024,quality:1.75,...t.renderOptions||{}},this.addImages(t.images)}applyProps(t){void 0!==t.renderSmallestFallback&&t.renderSmallestFallback!==this.renderOptions.renderSmallestFallback&&(this.renderOptions.renderSmallestFallback=t.renderSmallestFallback),void 0!==t.renderLayers&&t.renderLayers!==this.renderOptions.renderLayers&&(this.renderOptions.renderLayers=t.renderLayers),void 0!==t.minSize&&t.minSize!==this.renderOptions.minSize&&(this.renderOptions.minSize=t.minSize),void 0!==t.maxImageSize&&t.maxImageSize!==this.renderOptions.maxImageSize&&(this.renderOptions.maxImageSize=t.maxImageSize),void 0!==t.quality&&t.quality!==this.renderOptions.quality&&(this.renderOptions.quality=t.quality)}appendChild(t){this.addImages([t])}removeChild(t){-1!==this.images.indexOf(t)&&(this.images=this.images.filter((e=>e!==t)),this.sortByScales())}insertBefore(t,e){this.addImages([t])}hideInstance(){}addImages(t){for(const e of t)e.__parent=this,e.__owner=this.__owner;this.allImages.push(...t.filter(Boolean)),this.sortByScales()}sortByScales(){this._scheduleSortByScales=!0}getScheduledUpdates(t,e){return this._scheduleSortByScales?[this._sortByScales]:this.isFullyLoaded?[]:e>1/this.maxScaleFactor?this.fallback:[]}getAllPointsAt(t,e,i){if(0===this.images.length)return[];const n=function(t,e,i=1){const n=e.length;if(0===n)throw new Error("No resources passed in.");let s=0;for(let r=0;r<n&&e[r]&&e[r].display;r++)s=Math.abs(e[r].display.scale-t)*i<Math.abs(e[s].display.scale-t)?r:s;return s}(1/(i||1)/(window.devicePixelRatio||1),this.images,this.renderOptions.quality),s=this.images.length,r=e?m(e,b(this.x,this.y)):b(this.x,this.y);if(n!==this.images.length-1&&this.images[n+1]){let e=[];for(let t=s-1;t>=n;t--)e.push(t);const o=e[0];this.renderOptions.renderLayers&&(e=e.slice(-Math.min(e.length,this.renderOptions.renderLayers))),this.renderOptions.renderSmallestFallback&&-1===e.indexOf(o)&&e.unshift(o);const a=[];for(let n=0;n<e.length;n++)a.push(...this.images[e[n]].getAllPointsAt(t,r,i));return a}return this.images[n].getAllPointsAt(t,r,i)}}function Ps(t,e,i,n,s){const r=Math.PI/180*s,o=Math.cos(r),a=Math.sin(r);return[o*(i-t)+a*(n-e)+t,o*(n-e)-a*(i-t)+e]}class ks extends _{constructor(t,e){super(),this.type="world-object",this.intersectionBuffer=g(5),this.aggregateBuffer=g(9),this.invertedBuffer=g(9),this.rotation=0,this._updatedList=[];const{x:i=0,y:n=0}=e||{};t?(this.id=t.id||"",this.scale=1,this.layers=t.layers,this.points=g([1,i,n,i+t.width,n+t.height]),this.worldPoints=g([1,i,n,i+t.width,n+t.height]),this.filteredPointsBuffer=g(5*t.layers.length)):(this.id="",this.scale=1,this.layers=[],this.points=g(5),this.worldPoints=g(5),this.filteredPointsBuffer=g(5))}static createWithProps(t){const e=new ks;return e.applyProps(t),e}applyProps(t){const e=t.x||0,i=t.y||0;this.id=t.id;const n=void 0!==t.scale?t.scale:this.scale;this.points[0]=1,this.points[1]=e,this.points[2]=i,this.points[3]=e+t.width,this.points[4]=i+t.height,this.rotation=t.rotation||0,this.worldPoints[3]=this.worldPoints[1]+t.width,this.worldPoints[4]=this.worldPoints[2]+t.height,t.scale&&1!==t.scale&&this.atScale(n),this.scale=n}appendChild(t){0===t.points[0]&&t.points.set(this.points),t.__owner.value=this,this.addLayers([t])}removeChild(t){this.layers=this.layers.filter((e=>e!==t)),this.filteredPointsBuffer=g(5*this.layers.length)}insertBefore(t,e){const i=this.layers.indexOf(e);if(-1===i)return;if(-1!==this.layers.indexOf(t))return;const n=this.layers.slice(0,i),s=this.layers.slice(i);this.layers=[...n,t,...s]}hideInstance(){console.warn("hideInstance: not yet implemented")}getObjectsAt(t,e){this.rotation&&(t=this.applyRotation(t));if(0===f(this.points,t,this.filteredPointsBuffer)[0])return[];const i=this.layers.length,n=[];for(let s=0;s<i;s++){const i=this.layers[s];if(e&&i.isShape){const e=E(i.points,b(this.x,this.y));if(!i.intersects([t[1]-e[1],t[2]-e[2]]))continue}if(0!==f(E(i.points,b(this.x,this.y)),t,this.filteredPointsBuffer)[0]&&n.push(i),e){const s=i;n.push(...s.getObjectsAt(t,e))}}return n}applyRotation(t){if(this.rotation){const e={x:t[1],y:t[2]},i={x:t[1],y:t[4]},n={x:t[3],y:t[2]},s={x:t[3],y:t[4]},r=this.points[1]+(this.points[3]-this.points[1])/2,o=this.points[2]+(this.points[4]-this.points[2])/2,[a,l]=Ps(r,o,e.x,e.y,this.rotation),[h,c]=Ps(r,o,i.x,i.y,this.rotation),[d,u]=Ps(r,o,n.x,n.y,this.rotation),[p,f]=Ps(r,o,s.x,s.y,this.rotation),m=Math.min(a,h,d,p),v=Math.max(a,h,d,p),y=Math.min(l,c,u,f),w=Math.max(l,c,u,f);return g([t[0],m,y,v,w])}return t}getAllPointsAt(t,e,i){const n=m(b(this.x,this.y),w(this.scale),this.aggregateBuffer);this.rotation&&(t=this.applyRotation(t));const s=((t,e,i)=>{const n=t[1]<=e[3]&&t[3]>=e[1]&&t[2]<=e[4]&&t[4]>=e[2],s=i||g(5);return n?(s[0]=1,s[1]=Math.max(t[1],e[1]),s[2]=Math.max(t[2],e[2]),s[3]=Math.min(t[3],e[3]),s[4]=Math.min(t[4],e[4]),s):(s[0]=0,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s)})(t,this.points,this.intersectionBuffer),r=this.layers.length,o=[],a=E(s,m(w(1/this.scale),b(-this.x,-this.y),this.invertedBuffer)),l=e?m(e,n,this.aggregateBuffer):n,h=i*this.scale;for(let c=0;c<r;c++)o.push(...this.layers[c].getAllPointsAt(a,l,h));return o}addLayers(t){const e=[];for(const i of t)-1===this.layers.indexOf(i)&&(e.push(i),5===i.points.length&&(i.points[1]<this.worldPoints[1]/this.scale||i.points[2]<this.worldPoints[2]/this.scale||i.points[3]>this.worldPoints[3]/this.scale||i.points[4]>this.worldPoints[4]/this.scale)&&(i.crop=i.crop||g([1,Math.max(this.worldPoints[1]/this.scale,i.points[1]),Math.max(this.worldPoints[2]/this.scale,i.points[2]),Math.min(this.worldPoints[3]/this.scale,i.points[3]),Math.min(this.worldPoints[4]/this.scale,i.points[4])])));this.layers=this.layers.concat(e),this.filteredPointsBuffer=g(5*this.layers.length)}getScheduledUpdates(t,e){const i=this.layers.length;this._updatedList=[];const n=e*this.scale;for(let s=0;s<i;s++){const e=this.layers[s].getScheduledUpdates(t,n);e&&this._updatedList.push(...e)}return this._updatedList}}class Os extends _{constructor(t=0,e=0,i=100,n="left-to-right"){super(),this.id="world",this.aggregateBuffer=g(9),this.isDirty=!1,this.zones=[],this.triggerQueue=[],this.activatedEvents=[],this._updatedList=[],this.translationBuffer=g(9),this.needsRecalculate=!0,this.emptyPaintables=[],this.renderOrder=[],this.objects=[],this.subscriptions=[],this._propagateEventTargets=[],this._alreadyFlushed=[],this._width=t,this._height=e,this.aspectRatio=Number.isNaN(t/e)?1:t/e,this.viewingDirection=n,this.points=g(5*i),this.filteredPointsBuffer=g(5*i)}get x(){return 0}get y(){return 0}get width(){return this._width}get height(){return this._height}static withProps(t){const e=new Os;return e.applyProps(t),e}applyProps(t){void 0===t.width||void 0===t.height||t.width===this._width&&t.height===this._height||this.resize(t.width,t.height),t.viewingDirection!==this.viewingDirection&&(this.viewingDirection=t.viewingDirection,this.triggerRepaint())}propagateTouchEvent(t,e,i){const n=[];for(const s of i)if(s.x&&s.y){const t=v.singleBox(1,1,s.x,s.y);n.push(this.getObjectsAt(t,!0).reverse())}return n.map((i=>this.propagateEvent(t,e,i,{bubbles:!0,cancelable:!0})))}propagatePointerEvent(t,e,i,n,s={}){const r=v.singleBox(1,1,i,n),o=this.getObjectsAt(r,!0).reverse();return this.propagateEvent(t,e,o,s)}propagateEvent(t,e,i,{bubbles:n=!1,cancelable:s=!1}={}){e.atlasTarget=this,this._propagateEventTargets.length=1,this._propagateEventTargets[0]=this;let r=!1;e.stopPropagation=()=>{r=!0};for(let l=i.length-1;l>=0;l--){this._propagateEventTargets.unshift(i[l][0]);const t=i[l][1].length;if(t)for(let e=0;e<t;e++)this._propagateEventTargets.unshift(i[l][1][e])}const o=this._propagateEventTargets.length;let a=!1;for(let l=0;l<o&&(e.atlasTarget=this._propagateEventTargets[l],e.atlasWorld=this,a=this._propagateEventTargets[l].dispatchEvent(t,e)||a,!r);l++);return a&&this.triggerRepaint(),this._propagateEventTargets}appendChild(t){const e=this.appendWorldObject(t);this.renderOrder.push(e/5)}removeChild(t){const e=this.objects.indexOf(t);if(-1!==e)this.objects[e]=null,this.renderOrder=this.renderOrder.filter((t=>t!==e)),this.points[5*e]=0,this.triggerRepaint(),this.needsRecalculate=!0;else for(const i of this.objects)if(i&&i.id===t.id)return void this.removeChild(i)}insertBefore(t,e){const i=this.objects.indexOf(e);if(-1===i)return;const n=this.appendWorldObject(t);this.renderOrder.splice(i-1,0,n/5)}hideInstance(){}asWorldObject(){return null}addZone(t){this.zones.push(t)}selectZone(t){if("string"==typeof t){const e=this.zones.length;for(let i=0;i<e;i++)if(this.zones[i].id===t)return this.selectedZone=i,void this.trigger("zone-changed")}else this.zones[t]&&(this.selectedZone=t,this.trigger("zone-changed"))}deselectZone(){this.selectedZone=void 0}getActiveZone(){if(this.selectedZone)return this.zones[this.selectedZone]}hasActiveZone(){return void 0!==this.selectedZone}checkResizeInternalBuffer(){if(this.points.length/5===this.objects.length){const t=this.points,e=g(2*this.points.length);e.set(t,0),this.points=e}}appendWorldObject(t){this.checkResizeInternalBuffer();const e=5*this.objects.length,i=t.points;return t.points=this.points.subarray(5*this.objects.length,5*this.objects.length+5),t.points[1]=i[1],t.points[2]=i[2],t.points[3]=i[3],t.points[4]=i[4],this.objects.push(t),this.filteredPointsBuffer=g(5*this.objects.length),this.needsRecalculate=!0,this.triggerRepaint(),e}recalculateWorldSize(){let t=!1;if(this.needsRecalculate){const e=new Int32Array(this.objects.length),i=new Int32Array(this.objects.length),n=this.renderOrder.length;for(let t=0;t<n;t++){const n=this.renderOrder[t];this.objects[n]&&(e[t]=this.points[5*n+3],i[t]=this.points[5*n+4])}const s=Math.max(...e);s!==this._width&&(this._width=s,t=!0);const r=Math.max(...i);r!==this._height&&(this._height=r,t=!0),t&&this.trigger("recalculate-world-size",{width:s,height:r}),this.needsRecalculate=!1}return t}addObjectAt(t,e){e.width&&!e.height?e.height=e.width/t.width*t.height:e.height&&!e.width&&(e.width=e.height/t.height*t.width),e&&e.width&&e.height||(e.width=t.width,e.height=t.height);const{width:i,x:n,y:s}=e,r=i/t.width;this.checkResizeInternalBuffer(),this.points.set(v.singleBox(t.width,t.height,0,0),5*this.objects.length);const o=new ks(t);return o.points=this.points.subarray(5*this.objects.length,5*this.objects.length+5),this.objects.push(o),this.scaleWorldObject(this.objects.length-1,r),this.translateWorldObject(this.objects.length-1,n,s),this.filteredPointsBuffer=g(2*this.points.length),this.triggerRepaint(),this.needsRecalculate=!0,o}scaleWorldObject(t,e){y(this.points.subarray(5*t,5*t+5),x(e,this.points[5*t+1],this.points[5*t+2]));const i=this.objects[t];i&&(i.atScale(e),this.triggerRepaint())}translateWorldObject(t,e,i){y(this.points.subarray(5*t,5*t+5),b(e,i));const n=this.objects[t];n&&(n.translate(e,i),this.triggerRepaint())}resize(t,e){return this._width=t,this._height=e,this.aspectRatio=t/e,this.triggerRepaint(),this}getObjects(){return this.objects}getPoints(){return this.points}getPointsFromViewer(t,e){const i=v.singleBox(t.width,t.height,t.x,t.y);return this.getPointsAt(i,e,t.scale)}addLayoutSubscriber(t){return this.subscriptions.push(t),()=>{this.subscriptions.splice(this.subscriptions.indexOf(t),1)}}getScheduledUpdates(t,e){const i=f(this.points,t,this.filteredPointsBuffer),n=this.objects.length;this._updatedList=[];for(let s=0;s<n;s++)if(0!==i[5*s]){if(!this.objects[s])continue;this._updatedList.push(...this.objects[s].getScheduledUpdates(t,e))}return this._updatedList}getObjectsAt(t,e=!1){const i=this.getActiveZone(),n=f(this.points,t,this.filteredPointsBuffer),s=this.renderOrder.length,r=[];for(let o=0;o<s;o++){const s=this.renderOrder[o];if(0!==n[5*s]){const n=this.objects[s];if(!n||i&&-1===i.objects.indexOf(n))continue;if("world-object"!==n.type){r.push([n,[n]]);continue}e?r.push([n,n.getObjectsAt(t,e)]):r.push([n,this.emptyPaintables])}}return r}getPointsAt(t,e,i=1){const n=this.getObjectsAt(t),s=m(w(i),b(-t[1],-t[2]),this.translationBuffer),r=e?m(e,s,this.aggregateBuffer):s,o=n.length,a=[];for(let l=0;l<o;l++)n[l]&&a.push(...n[l][0].getAllPointsAt(t,r,i));return a}flushSubscriptions(){if(this.triggerQueue.length){this._alreadyFlushed=[];const t=this.triggerQueue.length;for(let e=0;e<t;e++){if(-1!==this._alreadyFlushed.indexOf(this.triggerQueue[e][0]))continue;void 0===this.triggerQueue[e][1]&&this._alreadyFlushed.push(this.triggerQueue[e][0]);const t=this.subscriptions.length;for(let i=0;i<t;i++)this.subscriptions[i].apply(null,this.triggerQueue[e])}this.triggerQueue=[]}}trigger(t,e){this.triggerQueue.push([t,e])}triggerEventActivation(){this.trigger("event-activation")}triggerRepaint(){this.trigger("repaint")}gotoRegion(t){this.trigger("goto-region",t)}goHome(t=!1){this.trigger("go-home",{immediate:t})}zoomTo(t,e,i){this.trigger("zoom-to",{point:e,factor:t,stream:i})}zoomIn(t){this.trigger("zoom-to",{point:t,factor:.5})}zoomOut(t){this.trigger("zoom-to",{point:t,factor:2})}constraintBounds(t){this.trigger("constrain-bounds",{immediate:t})}}const Rs={margin:0};const As=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,Is={},Ls=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"];class $s extends _{constructor(){super(),this.type="spacial-content",this.hoverEvents=!1,this.activeEvents=!1,this.display={x:0,y:0,scale:1,width:-1,height:-1,points:g(5)},this._parsed={border:{id:null,match:[]},outline:{id:null,match:[]}},this.props={},this.addHover=()=>{this.hovering=!0,this.__revision++},this.removeHover=()=>{this.hovering=!1,this.pressing=!1,this.__revision++},this.addPress=()=>{this.pressing=!0,this.__revision++},this.removePress=()=>{this.pressing=!1,this.__revision++},this.id=S(12),this.points=g(5)}getAllPointsAt(t,e){return[[this,this.points,e]]}applyProps(t={}){let e=!1;if(t.interactive!==this.props.interactive&&(e=!0,this.props.interactive=t.interactive),t.style){const i=t.border||t.style.border;if(i!==this._parsed.border.id)if(i){const t=Is[i]||As.exec(i)||As.exec(i);t&&(this._parsed.border.id=i,this._parsed.border.match=Is[i]=t)}else this._parsed.border.id=null,this._parsed.border.match=[];if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(t.style.outline){const e=Is[t.style.outline]||As.exec(t.style.outline)||As.exec(t.style.outline);e&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=Is[t.style.outline]=e)}else this._parsed.outline.id=null,this._parsed.outline.match=[];this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,e=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,e=!0);for(const n of Ls)if(this.props.style[n]!==t.style[n]){e=!0;break}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0)}t.href!==this.props.href&&(this.props.href=t.href,e=!0),t.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=t.hrefTarget,e=!0),t.title!==this.props.title&&(this.props.title=t.title,e=!0),t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,e=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,e=!0),t.html!==this.props.html&&(this.props.html=t.html,e=!0),t.target&&(t.target.width===this.display.width&&t.target.height===this.display.height&&t.target.x===this.points[1]&&t.target.y===this.points[2]||(e=!0,this.points=v.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=v.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height)),e&&this.__revision++}}const Ms=/([0-9]+(px|em)\s+)+(solid)\s+(.*)/g,zs={},Bs=["backgroundColor","opacity","boxShadow","borderColor","borderWidth","borderStyle","outlineColor","outlineWidth","outlineOffset","outlineStyle"];class Fs extends _{constructor(){super(),this.type="spacial-content",this.isShape=!0,this.hoverEvents=!1,this.activeEvents=!1,this.display={x:0,y:0,scale:1,width:-1,height:-1,points:g(5)},this.boundingBox=null,this._parsed={border:{id:null,match:[]},outline:{id:null,match:[]}},this.props={},this.shape={type:"none"},this.addHover=()=>{this.hovering=!0,this.__revision++},this.removeHover=()=>{this.hovering=!1,this.pressing=!1,this.__revision++},this.addPress=()=>{this.pressing=!0,this.__revision++},this.removePress=()=>{this.pressing=!1,this.__revision++},this.id=S(12),this.points=g(5),this.shape={type:"none"}}updateBoundingBox(){if("none"===this.shape.type)return;const t=this.shape.points;if(this.shape.points.length>2){const e=Math.min(...t.map((t=>t[0]))),i=Math.min(...t.map((t=>t[1]))),n=Math.max(0,...t.map((t=>t[0]))),s=Math.max(0,...t.map((t=>t[1])));this.boundingBox={x:e,y:i,width:n-e,height:s-i}}else this.boundingBox=null}intersects(t){if(!t||"none"===this.shape.type)return!1;const[e,i]=t,n=this.shape.points;let s=this.boundingBox;if(s||(this.updateBoundingBox(),s=this.boundingBox),!s)return!1;if(e<s.x||e>s.x+s.width||i<s.y||i>s.height+s.y)return!1;let r=!1;for(let o=0,a=n.length-1;o<n.length;a=o++)n[o][1]>i!=n[a][1]>i&&e<(n[a][0]-n[o][0])*(i-n[o][1])/(n[a][1]-n[o][1])+n[o][0]&&(r=!r);return r}getAllPointsAt(t,e){return t[3]-t[1]==1&&t[4]-t[2]==1?this.intersects([t[1],t[2]])?[[this,this.points,e]]:[]:[[this,this.points,e]]}applyProps(t={}){let e=!1;if(t.points)if("polygon"!==this.shape.type||this.shape.points.length!==t.points.length)this.shape={type:"polygon",points:t.points,open:t.open},this.updateBoundingBox();else{let e=!1;const i=t.points.length;for(let n=0;n<i;n++)if(t.points[n][0]!==this.shape.points[n][0]||t.points[n][1]!==this.shape.points[n][1]){e=!0;break}e&&(this.shape={type:"polygon",points:t.points,open:t.open},this.updateBoundingBox())}if(t.interactive!==this.props.interactive&&(e=!0,this.props.interactive=t.interactive),(t.open||!1===t.open)&&(e=!0,this.shape.open=t.open),t.style){const i=t.border||t.style.border;if(i!==this._parsed.border.id)if(i){const t=zs[i]||Ms.exec(i)||Ms.exec(i);t&&(this._parsed.border.id=i,this._parsed.border.match=zs[i]=t)}else this._parsed.border.id=null,this._parsed.border.match=[];if(this._parsed.border.id&&(t.style.borderWidth=this._parsed.border.match[1],t.style.borderStyle="solid",t.style.borderColor=this._parsed.border.match[4]),t.style.outline!==this._parsed.outline.id)if(t.style.outline){const e=zs[t.style.outline]||Ms.exec(t.style.outline)||Ms.exec(t.style.outline);e&&(this._parsed.outline.id=t.style.outline,this._parsed.outline.match=zs[t.style.outline]=e)}else this._parsed.outline.id=null,this._parsed.outline.match=[];this._parsed.outline.id&&(t.style.outlineWidth=this._parsed.outline.match[1],t.style.outlineStyle="solid",t.style.outlineColor=this._parsed.outline.match[4]),this.props.style=t.style,t.backgroundColor&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.backgroundColor,e=!0),t.style.background&&!this.props.style.backgroundColor&&(this.props.style.backgroundColor=t.style.background,e=!0);for(const n of Bs)if(this.props.style[n]!==t.style[n]){e=!0;break}t.style[":hover"]!==this.props.hoverStyles&&(this.props.hoverStyles=t.style[":hover"],this.hoverEvents||(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),e=!0),t.style[":active"]!==this.props.pressStyles&&(this.props.pressStyles=t.style[":active"],this.activeEvents||(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0)}t.href!==this.props.href&&(this.props.href=t.href,e=!0),t.hrefTarget!==this.props.hrefTarget&&(this.props.hrefTarget=t.hrefTarget,e=!0),t.title!==this.props.title&&(this.props.title=t.title,e=!0),t.className!==this.props.className&&(this.props.className=t.className,t.className&&!this.hoverEvents&&(this.hoverEvents=!0,this.addEventListener("pointerenter",this.addHover),this.addEventListener("pointerleave",this.removeHover)),t.className&&!this.activeEvents&&(this.activeEvents=!0,this.addEventListener("mousedown",this.addPress),this.addEventListener("mouseup",this.removePress)),e=!0),t.relativeSize!==this.props.relativeSize&&(this.props.relativeSize=t.relativeSize,e=!0),t.relativeStyle!==this.props.relativeStyle&&(this.props.relativeStyle=t.relativeStyle,e=!0),t.html!==this.props.html&&(this.props.html=t.html,e=!0),t.target&&(t.target.width===this.display.width&&t.target.height===this.display.height&&t.target.x===this.points[1]&&t.target.y===this.points[2]||(e=!0,this.points=v.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.points=v.singleBox(t.target.width,t.target.height,t.target.x,t.target.y),this.display.width=t.target.width,this.display.height=t.target.height)),e&&this.__revision++}}class Ds extends _{constructor(){super(),this.type="spacial-content",this.color="#000",this.text="",this.display={x:0,y:0,scale:1,width:100,height:100,points:g(5)},this.interactive=!1,this.props={font:"18px Arial, sans-serif",lineHeight:1,textAlign:"left",verticalAlign:"top",paddingX:0,paddingY:0,fitParent:!1,lineBreak:"auto",strokeText:!1,sizeToFill:!1,maxFontSizeToFill:void 0,allowNewLine:!0,justifyLines:!1,renderHDPI:!1,textDecoration:"none",interactive:!1,relativeSize:!1},this.id="",this.points=g(5)}getAllPointsAt(t,e){return[[this,this.points,e]]}applyProps({id:t,target:e,text:i,color:n,backgroundColor:s,fontSize:r=18,interactive:o,fontFamily:a="Arial, sans-serif",...l}){l.font=`${r}px ${a}`,this.interactive=o||!1,void 0!==i&&(this.text=i||""),n&&(this.color=n),s&&(this.backgroundColor=s),t&&(this.id=t),e&&(this.points=v.singleBox(e.width,e.height,e.x,e.y),this.display.points=this.points,this.display.width=e.width,this.display.height=e.height),this.props={...this.props,...l},this.__revision++}}const js=Math.pow,Ns=Math.sqrt,Ws=Math.sin,Us=Math.cos,Hs=Math.PI,Vs=1.70158,Gs=1.525*Vs,Xs=2*Hs/3,Ys=2*Hs/4.5,Ks=function(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},Qs={linear:t=>t,easeInQuad:function(t){return t*t},easeOutQuad:function(t){return 1-(1-t)*(1-t)},easeInOutQuad:function(t){return t<.5?2*t*t:1-js(-2*t+2,2)/2},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1-js(1-t,3)},easeInOutCubic:function(t){return t<.5?4*t*t*t:1-js(-2*t+2,3)/2},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1-js(1-t,4)},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-js(-2*t+2,4)/2},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1-js(1-t,5)},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1-js(-2*t+2,5)/2},easeInSine:function(t){return 1-Us(t*Hs/2)},easeOutSine:function(t){return Ws(t*Hs/2)},easeInOutSine:function(t){return-(Us(Hs*t)-1)/2},easeInExpo:function(t){return 0===t?0:js(2,10*t-10)},easeOutExpo:function(t){return 1===t?1:1-js(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:t<.5?js(2,20*t-10)/2:(2-js(2,-20*t+10))/2},easeInCirc:function(t){return 1-Ns(1-js(t,2))},easeOutCirc:function(t){return Ns(1-js(t-1,2))},easeInOutCirc:function(t){return t<.5?(1-Ns(1-js(2*t,2)))/2:(Ns(1-js(-2*t+2,2))+1)/2},easeInBack:function(t){return 2.70158*t*t*t-Vs*t*t},easeOutBack:function(t){return 1+2.70158*js(t-1,3)+Vs*js(t-1,2)},easeInOutBack:function(t){return t<.5?js(2*t,2)*(7.189819*t-Gs)/2:(js(2*t-2,2)*((Gs+1)*(2*t-2)+Gs)+2)/2},easeInElastic:function(t){return 0===t?0:1===t?1:-js(2,10*t-10)*Ws((10*t-10.75)*Xs)},easeOutElastic:function(t){return 0===t?0:1===t?1:js(2,-10*t)*Ws((10*t-.75)*Xs)+1},easeInOutElastic:function(t){return 0===t?0:1===t?1:t<.5?-js(2,20*t-10)*Ws((20*t-11.125)*Ys)/2:js(2,-20*t+10)*Ws((20*t-11.125)*Ys)/2+1},easeInBounce:function(t){return 1-Ks(1-t)},easeOutBounce:Ks,easeInOutBounce:function(t){return t<.5?(1-Ks(1-2*t))/2:(1+Ks(2*t-1))/2}};class qs{constructor(t){this.runtime=t,this.pendingTransition={from:g(5),to:g(5),elapsed_time:0,done:!0,total_time:0,timingFunction:Qs.easeInOutQuad,constrain:!1}}hasPending(){return!this.pendingTransition.done}getPendingTransition(){return this.pendingTransition}getPendingFrom(){return this.pendingTransition.from}customTransition(t){t(this.pendingTransition)}stopTransition(){this.pendingTransition.from=g(this.runtime.target),this.pendingTransition.to=g(this.runtime.target),this.pendingTransition.done=!0,this.pendingTransition.elapsed_time=0,this.pendingTransition.total_time=0}runTransition(t,e){if(!this.pendingTransition.done){const i=this.pendingTransition,n=0===i.total_time?0:(i.elapsed_time+e)/i.total_time,s=0===i.total_time?1:0===n?0:i.timingFunction(n);t[1]=i.from[1]+(i.to[1]-i.from[1])*s,t[2]=i.from[2]+(i.to[2]-i.from[2])*s,t[3]=i.from[3]+(i.to[3]-i.from[3])*s,t[4]=i.from[4]+(i.to[4]-i.from[4])*s,this.pendingTransition.elapsed_time+=e,this.pendingTransition.elapsed_time>=this.pendingTransition.total_time&&(this.pendingTransition.done=!0,this.pendingTransition.constrain&&this.constrainBounds({transition:{duration:0===this.pendingTransition.total_time?0:500,easing:Qs.easeOutExpo}}))}}zoomTo(t,{origin:e,stream:i=!1,transition:n}={}){const s=this.runtime.getZoomedPosition(t,{origin:e}),r=Math.abs(1-t);this.applyTransition(s,n,{duration:2e3*r,easing:Qs.easeOutExpo,constrain:!0},{stream:!1})}constrainBounds({transition:t,panPadding:e=0}={}){const[i,n]=this.runtime.constrainBounds(this.runtime.target,{panPadding:e});i&&(this.applyTransition(n,t,{duration:500,easing:Qs.easeOutQuart,constrain:!1}),this.runtime.updateNextFrame())}applyTransition(t,e,i,{stream:n}={}){this.pendingTransition.from=g(this.runtime.target),this.pendingTransition.to=t,n||(this.pendingTransition.elapsed_time=0),this.pendingTransition.done=!1,this.pendingTransition.total_time=void 0!==(null==e?void 0:e.duration)?e.duration:void 0!==(null==i?void 0:i.duration)?i.duration:1e3,this.pendingTransition.constrain=void 0!==(null==e?void 0:e.constrain)?e.constrain:void 0!==(null==i?void 0:i.constrain)&&i.constrain,this.pendingTransition.timingFunction=(null==e?void 0:e.easing)||(null==i?void 0:i.easing)||Qs.easeInOutSine}goToRegion(t,{transition:e}={}){const i=this.runtime.clampRegion(t);this.applyTransition(v.singleBox(i.width,i.height,i.x,i.y),e,{duration:1e3,easing:Qs.easeOutExpo,constrain:!0}),this.runtime.updateNextFrame()}}class Zs{constructor(t,e,i,n=[],s){this.id=S(),this.ready=!1,this.transformBuffer=g(500),this.lastTarget=g(5),this.zoomBuffer=g(5),this.logNextRender=!1,this.pendingUpdate=!0,this.isCommitting=!1,this.firstRender=!0,this.mode="explore",this.controllers=[],this.controllersRunning=!1,this.controllerStopFunctions=[],this.maxScaleFactor=1,this._viewerToWorld={x:0,y:0},this._lastGoodScale=1,this.hooks={useFrame:[],useBeforeFrame:[],useAfterPaint:[],useAfterFrame:[]},this.hookOptions={filters:{grayscale:0,contrast:0,brightness:0,saturate:0,sepia:0,invert:0,hueRotate:0,blur:0}},this._viewport={x:0,y:0,width:0,height:0},this.setViewport=t=>{const e=Math.round(void 0===t.x?this.target[1]:t.x),i=Math.round(void 0===t.y?this.target[2]:t.y);t.width?this.target[3]=e+t.width:this.target[3]=this.target[3]-this.target[1]+e,t.height?this.target[4]=i+t.height:this.target[4]=this.target[4]-this.target[2]+i,Math.abs(this.target[1]-e)>.01&&(this.target[1]=e),Math.abs(this.target[2]-i)>.01&&(this.target[2]=i),this.pendingUpdate=!0},this.render=t=>{const e=t-this.lastTime;if(this.isCommitting||this.fpsLimit&&e<1e3/this.fpsLimit)return void(this.stopId=window.requestAnimationFrame(this.render));this.lastTime=t,this.world.flushSubscriptions(),this.stopId=window.requestAnimationFrame(this.render),this.hook("useFrame",e);const i=this.pendingUpdate,n=this.renderer.pendingUpdate();if(this.transitionManager.hasPending()&&(this.transitionManager.runTransition(this.target,e),this.pendingUpdate=!0,this.updateControllerPosition()),!this.firstRender&&!i&&!n&&this.target[0]===this.lastTarget[0]&&this.target[1]===this.lastTarget[1]&&this.target[2]===this.lastTarget[2]&&this.target[3]===this.lastTarget[3]&&this.target[4]===this.lastTarget[4])return;this.hook("useBeforeFrame",e),this.renderer.beforeFrame(this.world,e,this.target,this.hookOptions);const s=this.getScaleFactor(),r=this.renderer.getPointsAt(this.world,this.target,this.aggregate,s),o=r.length;for(let h=0;h<o;h++){const t=r[h][0],e=r[h][1],i=r[h][2],n=i?E(e,i,this.transformBuffer):e;this.renderer.prepareLayer(t,t.__parent&&i?E(t.__parent.crop||t.__parent.points,i):n);const s=n.length/5;for(let r=0;r<s;r++){const e=5*r;0!==n[e]&&(this.renderer.paint(t,r,n[e+1],n[e+2],n[e+3]-n[e+1],n[e+4]-n[e+2]),this.hook("useAfterPaint",t))}this.renderer.finishLayer(t,e)}this.renderer.afterFrame(this.world,e,this.target,this.hookOptions),this.hook("useAfterFrame",e),this.lastTarget[0]=this.target[0],this.lastTarget[1]=this.target[1],this.lastTarget[2]=this.target[2],this.lastTarget[3]=this.target[3],this.lastTarget[4]=this.target[4],this.firstRender=!1,this.pendingUpdate=!1,this.logNextRender=!1,this.renderer.isReady()&&(this.ready=!0,this.world.trigger("ready")),this.world.flushSubscriptions();const a=this.world.getScheduledUpdates(this.target,s),l=a.length;if(l>0)for(let h=0;h<l;h++){const t=a[l-h-1]();t?t.then((()=>{this.pendingUpdate=!0})):this.pendingUpdate=!0}},this.renderer=t,this.world=e,this.options={maxOverZoom:1,maxUnderZoom:1,visibilityRatio:1.5,...s||{}},this.target=v.projection(i),this.manualHomePosition=!1,this.pendingUpdate=!0,this.homePosition=v.projection(this.world),this.manualFocalPosition=!1,this.focalPosition=this.target,this.updateFocalPosition(),this.transitionManager=new qs(this),this.aggregate=w(1),this.world.addLayoutSubscriber((t=>{"repaint"===t&&(this.pendingUpdate=!0),"recalculate-world-size"===t&&(this.manualHomePosition||(this.setHomePosition(),this.goHome()),this.updateFocalPosition())})),this.lastTime=performance.now(),this.controllers=n,this.render(this.lastTime),this.startControllers()}get x(){return this.target[1]}set x(t){this.target[1]=t}get y(){return this.target[2]}set y(t){this.target[2]=t}get x2(){return this.target[3]}set x2(t){this.target[3]=t}get y2(){return this.target[4]}set y2(t){this.target[4]=t}get width(){return this.target[3]-this.target[1]}set width(t){this.target[3]=this.target[1]+t}get height(){return this.target[4]-this.target[2]}set height(t){this.target[4]=this.target[2]=t}setHomePosition(t){this.homePosition.set(v.projection(t||this.world)),this.pendingUpdate=!0}startControllers(){if(!this.controllersRunning){for(const t of this.controllers)this.controllerStopFunctions.push(t.start(this));this.controllersRunning=!0}}stopControllers(){if(this.controllersRunning){for(const t of this.controllerStopFunctions)t();this.controllersRunning=!1,this.controllerStopFunctions=[]}}updateControllerPosition(){for(const t of this.controllers)t.updatePosition(this.x,this.y,this.width,this.height)}triggerResize(){this.renderer.triggerResize&&this.renderer.triggerResize(),this.pendingUpdate=!0}addController(t){this.controllers.push(t),this.controllersRunning&&t.start(this),this.pendingUpdate=!0}cover(){return this.goHome({cover:!0})}getRendererScreenPosition(){return this.renderer.getRendererScreenPosition()}updateRendererScreenPosition(){this.pendingUpdate=!0,this.renderer.resize()}setOptions(t){this.options={...this.options,...t}}goHome(t={}){if(this.world.width<=0||this.world.height<=0)return;const e=this.getScaleFactor(),i=t.position?{x:t.position[1],y:t.position[2],width:t.position[3]-t.position[1],height:t.position[4]-t.position[2]}:{x:this.homePosition[1],y:this.homePosition[2],width:this.homePosition[3]-this.homePosition[1],height:this.homePosition[4]-this.homePosition[2]},n=this.width*e,s=this.height*e,r=i.width/n,o=i.height/s,a=n/s;if(t.cover?r>o:r<o){const t=a*i.height,e=(t-i.width)/2;this.target[1]=Math.round(-e+i.x),this.target[2]=Math.round(i.y),this.target[3]=Math.round(t-e+i.x),this.target[4]=Math.round(i.height+i.y)}else{const t=i.width/a,e=(t-i.height)/2;this.target[1]=Math.round(i.x),this.target[2]=Math.round(i.y-e),this.target[3]=Math.round(i.x+i.width),this.target[4]=Math.round(i.y+t-e)}this.constrainBounds(this.target),this.updateControllerPosition()}resize(t,e,i,n){this.updateFocalPosition(t-e,i-n);const s=e/t,r=n/i;this.target[3]=this.target[1]+(this.target[3]-this.target[1])*s,this.target[4]=this.target[2]+(this.target[4]-this.target[2])*r,this.goHome({position:this.focalPosition}),this.renderer.resize(e,n),this.pendingUpdate=!0}updateFocalPosition(t,e){if(!this.manualFocalPosition){const t=this.width,e=this.height,i=Math.min(t,e),n=0,s=0,r=this.x+n,o=this.y+s;if(t<e){const t=this.height-this.width;this.focalPosition=v.projection({x:r,y:o+t/2,width:i-2*n,height:i-2*s}),this.pendingUpdate=!0}else{const t=this.width-this.height;this.focalPosition=v.projection({x:r+t/2,y:o,width:i-2*n,height:i-2*s}),this.pendingUpdate=!0}}}getViewport(){return this._viewport.x=this.target[1],this._viewport.y=this.target[2],this._viewport.width=this.target[3]-this.target[1],this._viewport.height=this.target[4]-this.target[2],this._viewport}constrainBounds(t,{panPadding:e=0,ref:i=!1}={}){const{minX:n,maxX:s,minY:r,maxY:o}=this.getBounds({target:t,padding:e});let a=!1;const l=i?t:g(t),h=Math.round(t[3]-t[1]),c=Math.round(t[4]-t[2]);return n>t[1]&&(a=!0,l[1]=n,l[3]=n+h),r>t[2]&&(a=!0,l[2]=r,l[4]=r+c),s<t[1]&&(a=!0,l[1]=s,l[3]=s+h),o<t[2]&&(a=!0,l[2]=o,l[4]=o+c),[a,l]}getBounds(t){const e=t.target||this.target,i=t.padding,n=this.options.visibilityRatio,s=Math.abs(1-n);if(this.world.hasActiveZone()){const t=this.world.getActiveZone();if(t){const n=e[3]-e[1]<t.points[3]-t.points[1],s=e[4]-e[2]<t.points[4]-t.points[2];return{minX:n?t.points[1]-i:t.points[1]+(t.points[3]-t.points[1])/2-(e[3]-e[1])/2,maxX:s?t.points[2]-i:t.points[2]+(t.points[4]-t.points[2])/2-(e[4]-e[2])/2,minY:n?t.points[3]+i:t.points[1]+(t.points[3]-t.points[1])/2-(e[3]-e[1])/2,maxY:s?t.points[4]+i:t.points[2]+(t.points[4]-t.points[2])/2-(e[4]-e[2])/2}}}const r=e[3]-e[1],o=-r*s,a=this.world.width-r-o,l=e[4]-e[2],h=-l*s,c=this.world.height-l-h,d=Math.round(Math.max(o,a)),u=Math.round(Math.min(o,a)),p=Math.round(Math.max(h,c));return{minX:u,maxX:d,minY:Math.round(Math.min(h,c)),maxY:p}}getScaleFactor(t=!1){const e=this.renderer.getScale(this.target[3]-this.target[1],this.target[4]-this.target[2],t);return 0===e?this._lastGoodScale:(this._lastGoodScale=e,e)}getZoomedPosition(t,{origin:e,fromPos:i}){var n;const s=i?{width:i[3]-i[1],height:i[4]-i[2]}:void 0,r=s?this.renderer.getScale(s.width,s.height):this.getScaleFactor(),o=s?s.width:this.width,a=s?s.height:this.height,l=null==(n=this.getRendererScreenPosition())?void 0:n.width,h=this.world.width,c=l?l/h:1,d=this.options.maxUnderZoom,u=Math.max(c||1,this.options.maxOverZoom),p=1/t,f=r*p;if(p<1){const e=o*r,i=a*r;if(this.world.width/e>this.world.height/i){this.world.width*f<~~(o*r)*d&&(t=this.world.width*r/(o*r*d))}else{this.world.height*f<~~(a*r)*d&&(t=this.world.height*r/(a*r*d))}}else f>u&&(t=r/u);const g=E(this.target,x(t,e?e.x:this.target[1]+(this.target[3]-this.target[1])/2,e?e.y:this.target[2]+(this.target[4]-this.target[2])/2),this.zoomBuffer);return this.constrainBounds(g,{ref:!0,panPadding:100}),g}clampRegion({x:t,y:e,width:i,height:n,padding:s=0}){const r=this.width,o=this.height,a=t-s,l=e-s,h=i+2*s,c=n+2*s;if(i/r<n/o){const t=c/o*r;return{x:a-(t-h)/2,y:l,width:t,height:c}}const d=h/r*o;return{x:a,y:l-(d-c)/2,width:h,height:d}}viewerToWorld(t,e){const i=this.getScaleFactor();return this._viewerToWorld.x=this.target[1]+t/i,this._viewerToWorld.y=this.target[2]+e/i,this._viewerToWorld}worldToViewer(t,e,i,n){const s=v.singleBox(i,n,t,e);return y(s,m(w(this.getScaleFactor()),b(-this.target[1],-this.target[2]))),{x:s[1],y:s[2],width:s[3]-s[1],height:s[4]-s[2],strand:s}}setScale(t,e){y(this.target,x(t,e?e.x:this.target[1]+(this.target[3]-this.target[1])/2,e?e.y:this.target[2]+(this.target[4]-this.target[2])/2)),this.pendingUpdate=!0}syncTo(t){const e=this.target;return this.target=t.target,this.pendingUpdate=!0,()=>{this.target=e}}stop(){return void 0!==this.stopId&&(window.cancelAnimationFrame(this.stopId),this.stopId=void 0),()=>{this.render(performance.now())}}reset(){this.renderer.reset()}selectZone(t){this.world.selectZone(t),this.pendingUpdate=!0}deselectZone(){this.world.deselectZone(),this.pendingUpdate=!0}hook(t,e){const i=this.hooks[t].length;if(0!==i)for(let n=0;n<i;n++)this.hooks[t][n](e)}registerHook(t,e){return this.hooks[t].push(e),()=>{this.hooks[t]=this.hooks[t].filter((t=>t!==e))}}updateNextFrame(){this.pendingUpdate=!0}}const Js="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,tr="function"==typeof AbortController?AbortController:class{constructor(){this.signal=new nr}abort(t=new Error("This operation was aborted")){this.signal.reason=t,this.signal.dispatchEvent({type:"abort",target:this.signal})}},er="function"==typeof AbortSignal,ir="function"==typeof tr.AbortSignal,nr=er?AbortSignal:ir?tr.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(t){"abort"===t.type&&(this.aborted=!0,this.onabort(t),this._listeners.forEach((e=>e(t)),this))}onabort(){}addEventListener(t,e){"abort"===t&&this._listeners.push(e)}removeEventListener(t,e){"abort"===t&&(this._listeners=this._listeners.filter((t=>t!==e)))}},sr=new Set,rr=(t,e)=>{const i=`LRU_CACHE_OPTION_${t}`;lr(i)&&hr(i,`${t} option`,`options.${e}`,fr)},or=(t,e)=>{const i=`LRU_CACHE_METHOD_${t}`;if(lr(i)){const{prototype:n}=fr,{get:s}=Object.getOwnPropertyDescriptor(n,t);hr(i,`${t} method`,`cache.${e}()`,s)}},ar=(...t)=>{"object"==typeof process&&process&&"function"==typeof process.emitWarning?process.emitWarning(...t):console.error(...t)},lr=t=>!sr.has(t),hr=(t,e,i,n)=>{sr.add(t);ar(`The ${e} is deprecated. Please use ${i} instead.`,"DeprecationWarning",t,n)},cr=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),dr=t=>cr(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ur:null:null;class ur extends Array{constructor(t){super(t),this.fill(0)}}class pr{constructor(t){if(0===t)return[];const e=dr(t);this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class fr{constructor(t={}){const{max:e=0,ttl:i,ttlResolution:n=1,ttlAutopurge:s,updateAgeOnGet:r,updateAgeOnHas:o,allowStale:a,dispose:l,disposeAfter:h,noDisposeOnSet:c,noUpdateTTL:d,maxSize:u=0,maxEntrySize:p=0,sizeCalculation:f,fetchMethod:g,fetchContext:m,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:y,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:b,ignoreFetchAbort:x}=t,{length:E,maxAge:S,stale:_}=t instanceof fr?{}:t;if(0!==e&&!cr(e))throw new TypeError("max option must be a nonnegative integer");const T=e?dr(e):Array;if(!T)throw new Error("invalid max value: "+e);if(this.max=e,this.maxSize=u,this.maxEntrySize=p||this.maxSize,this.sizeCalculation=f||E,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=g||null,this.fetchMethod&&"function"!=typeof this.fetchMethod)throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=m,!this.fetchMethod&&void 0!==m)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(e).fill(null),this.valList=new Array(e).fill(null),this.next=new T(e),this.prev=new T(e),this.head=0,this.tail=0,this.free=new pr(e),this.initialFill=1,this.size=0,"function"==typeof l&&(this.dispose=l),"function"==typeof h?(this.disposeAfter=h,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!c,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!x,0!==this.maxEntrySize){if(0!==this.maxSize&&!cr(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!cr(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!a||!!_,this.noDeleteOnStaleGet=!!y,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!o,this.ttlResolution=cr(n)||0===n?n:1,this.ttlAutopurge=!!s,this.ttl=i||S||0,this.ttl){if(!cr(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(0===this.max&&0===this.ttl&&0===this.maxSize)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){const t="LRU_CACHE_UNBOUNDED";if(lr(t)){sr.add(t);ar("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,fr)}}_&&rr("stale","allowStale"),S&&rr("maxAge","ttl"),E&&rr("length","sizeCalculation")}getRemainingTTL(t){return this.has(t,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new ur(this.max),this.starts=new ur(this.max),this.setItemTTL=(t,e,i=Js.now())=>{if(this.starts[t]=0!==e?i:0,this.ttls[t]=e,0!==e&&this.ttlAutopurge){const i=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),e+1);i.unref&&i.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?Js.now():0};let t=0;const e=()=>{const e=Js.now();if(this.ttlResolution>0){t=e;const i=setTimeout((()=>t=0),this.ttlResolution);i.unref&&i.unref()}return e};this.getRemainingTTL=i=>{const n=this.keyMap.get(i);return void 0===n?0:0===this.ttls[n]||0===this.starts[n]?1/0:this.starts[n]+this.ttls[n]-(t||e())},this.isStale=i=>0!==this.ttls[i]&&0!==this.starts[i]&&(t||e())-this.starts[i]>this.ttls[i]}updateItemAge(t){}setItemTTL(t,e,i){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new ur(this.max),this.removeItemSize=t=>{this.calculatedSize-=this.sizes[t],this.sizes[t]=0},this.requireSize=(t,e,i,n)=>{if(this.isBackgroundFetch(e))return 0;if(!cr(i)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(i=n(e,t),!cr(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return i},this.addItemSize=(t,e)=>{if(this.sizes[t]=e,this.maxSize){const e=this.maxSize-this.sizes[t];for(;this.calculatedSize>e;)this.evict(!0)}this.calculatedSize+=this.sizes[t]}}removeItemSize(t){}addItemSize(t,e){}requireSize(t,e,i,n){if(i||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:t=this.allowStale}={}){if(this.size)for(let e=this.tail;this.isValidIndex(e)&&(!t&&this.isStale(e)||(yield e),e!==this.head);)e=this.prev[e]}*rindexes({allowStale:t=this.allowStale}={}){if(this.size)for(let e=this.head;this.isValidIndex(e)&&(!t&&this.isStale(e)||(yield e),e!==this.tail);)e=this.next[e]}isValidIndex(t){return this.keyMap.get(this.keyList[t])===t}*entries(){for(const t of this.indexes())this.isBackgroundFetch(this.valList[t])||(yield[this.keyList[t],this.valList[t]])}*rentries(){for(const t of this.rindexes())this.isBackgroundFetch(this.valList[t])||(yield[this.keyList[t],this.valList[t]])}*keys(){for(const t of this.indexes())this.isBackgroundFetch(this.valList[t])||(yield this.keyList[t])}*rkeys(){for(const t of this.rindexes())this.isBackgroundFetch(this.valList[t])||(yield this.keyList[t])}*values(){for(const t of this.indexes())this.isBackgroundFetch(this.valList[t])||(yield this.valList[t])}*rvalues(){for(const t of this.rindexes())this.isBackgroundFetch(this.valList[t])||(yield this.valList[t])}[Symbol.iterator](){return this.entries()}find(t,e={}){for(const i of this.indexes())if(t(this.valList[i],this.keyList[i],this))return this.get(this.keyList[i],e)}forEach(t,e=this){for(const i of this.indexes())t.call(e,this.valList[i],this.keyList[i],this)}rforEach(t,e=this){for(const i of this.rindexes())t.call(e,this.valList[i],this.keyList[i],this)}get prune(){return or("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;for(const e of this.rindexes({allowStale:!0}))this.isStale(e)&&(this.delete(this.keyList[e]),t=!0);return t}dump(){const t=[];for(const e of this.indexes({allowStale:!0})){const i=this.keyList[e],n=this.valList[e],s=this.isBackgroundFetch(n)?n.__staleWhileFetching:n;if(void 0===s)continue;const r={value:s};if(this.ttls){r.ttl=this.ttls[e];const t=Js.now()-this.starts[e];r.start=Math.floor(Date.now()-t)}this.sizes&&(r.size=this.sizes[e]),t.unshift([i,r])}return t}load(t){this.clear();for(const[e,i]of t){if(i.start){const t=Date.now()-i.start;i.start=Js.now()-t}this.set(e,i.value,i)}}dispose(t,e,i){}set(t,e,{ttl:i=this.ttl,start:n,noDisposeOnSet:s=this.noDisposeOnSet,size:r=0,sizeCalculation:o=this.sizeCalculation,noUpdateTTL:a=this.noUpdateTTL}={}){if(r=this.requireSize(t,e,r,o),this.maxEntrySize&&r>this.maxEntrySize)return this.delete(t),this;let l=0===this.size?void 0:this.keyMap.get(t);if(void 0===l)l=this.newIndex(),this.keyList[l]=t,this.valList[l]=e,this.keyMap.set(t,l),this.next[this.tail]=l,this.prev[l]=this.tail,this.tail=l,this.size++,this.addItemSize(l,r),a=!1;else{this.moveToTail(l);const i=this.valList[l];e!==i&&(this.isBackgroundFetch(i)?i.__abortController.abort(new Error("replaced")):s||(this.dispose(i,t,"set"),this.disposeAfter&&this.disposed.push([i,t,"set"])),this.removeItemSize(l),this.valList[l]=e,this.addItemSize(l,r))}if(0===i||0!==this.ttl||this.ttls||this.initializeTTLTracking(),a||this.setItemTTL(l,i,n),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max&&0!==this.max?this.evict(!1):0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(!0),t}}evict(t){const e=this.head,i=this.keyList[e],n=this.valList[e];return this.isBackgroundFetch(n)?n.__abortController.abort(new Error("evicted")):(this.dispose(n,i,"evict"),this.disposeAfter&&this.disposed.push([n,i,"evict"])),this.removeItemSize(e),t&&(this.keyList[e]=null,this.valList[e]=null,this.free.push(e)),this.head=this.next[e],this.keyMap.delete(i),this.size--,e}has(t,{updateAgeOnHas:e=this.updateAgeOnHas}={}){const i=this.keyMap.get(t);return void 0!==i&&!this.isStale(i)&&(e&&this.updateItemAge(i),!0)}peek(t,{allowStale:e=this.allowStale}={}){const i=this.keyMap.get(t);if(void 0!==i&&(e||!this.isStale(i))){const t=this.valList[i];return this.isBackgroundFetch(t)?t.__staleWhileFetching:t}}backgroundFetch(t,e,i,n){const s=void 0===e?void 0:this.valList[e];if(this.isBackgroundFetch(s))return s;const r=new tr;i.signal&&i.signal.addEventListener("abort",(()=>r.abort(i.signal.reason)));const o={signal:r.signal,options:i,context:n},a=(n,s=!1)=>{const{aborted:a}=r.signal,c=i.ignoreFetchAbort&&void 0!==n;return!a||c||s?(this.valList[e]===h&&(void 0===n?h.__staleWhileFetching?this.valList[e]=h.__staleWhileFetching:this.delete(t):this.set(t,n,o.options)),n):l(r.signal.reason)},l=n=>{const{aborted:s}=r.signal,o=s&&i.allowStaleOnFetchAbort,a=o||i.allowStaleOnFetchRejection,l=a||i.noDeleteOnFetchRejection;if(this.valList[e]===h){!l||void 0===h.__staleWhileFetching?this.delete(t):o||(this.valList[e]=h.__staleWhileFetching)}if(a)return h.__staleWhileFetching;if(h.__returned===h)throw n},h=new Promise(((e,n)=>{this.fetchMethod(t,s,o).then((t=>e(t)),n),r.signal.addEventListener("abort",(()=>{i.ignoreFetchAbort&&!i.allowStaleOnFetchAbort||(e(),i.allowStaleOnFetchAbort&&(e=t=>a(t,!0)))}))})).then(a,l);return h.__abortController=r,h.__staleWhileFetching=s,h.__returned=null,void 0===e?(this.set(t,h,o.options),e=this.keyMap.get(t)):this.valList[e]=h,h}isBackgroundFetch(t){return t&&"object"==typeof t&&"function"==typeof t.then&&Object.prototype.hasOwnProperty.call(t,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(t,"__returned")&&(t.__returned===t||null===t.__returned)}async fetch(t,{allowStale:e=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:r=this.noDisposeOnSet,size:o=0,sizeCalculation:a=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,fetchContext:p=this.fetchContext,forceRefresh:f=!1,signal:g}={}){if(!this.fetchMethod)return this.get(t,{allowStale:e,updateAgeOnGet:i,noDeleteOnStaleGet:n});const m={allowStale:e,updateAgeOnGet:i,noDeleteOnStaleGet:n,ttl:s,noDisposeOnSet:r,size:o,sizeCalculation:a,noUpdateTTL:l,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:u,ignoreFetchAbort:d,signal:g};let v=this.keyMap.get(t);if(void 0===v){const e=this.backgroundFetch(t,v,m,p);return e.__returned=e}{const n=this.valList[v];if(this.isBackgroundFetch(n))return e&&void 0!==n.__staleWhileFetching?n.__staleWhileFetching:n.__returned=n;if(!f&&!this.isStale(v))return this.moveToTail(v),i&&this.updateItemAge(v),n;const s=this.backgroundFetch(t,v,m,p);return e&&void 0!==s.__staleWhileFetching?s.__staleWhileFetching:s.__returned=s}}get(t,{allowStale:e=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet}={}){const s=this.keyMap.get(t);if(void 0!==s){const r=this.valList[s],o=this.isBackgroundFetch(r);if(this.isStale(s))return o?e?r.__staleWhileFetching:void 0:(n||this.delete(t),e?r:void 0);if(o)return;return this.moveToTail(s),i&&this.updateItemAge(s),r}}connect(t,e){this.prev[e]=t,this.next[t]=e}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return or("del","delete"),this.delete}delete(t){let e=!1;if(0!==this.size){const i=this.keyMap.get(t);if(void 0!==i)if(e=!0,1===this.size)this.clear();else{this.removeItemSize(i);const e=this.valList[i];this.isBackgroundFetch(e)?e.__abortController.abort(new Error("deleted")):(this.dispose(e,t,"delete"),this.disposeAfter&&this.disposed.push([e,t,"delete"])),this.keyMap.delete(t),this.keyList[i]=null,this.valList[i]=null,i===this.tail?this.tail=this.prev[i]:i===this.head?this.head=this.next[i]:(this.next[this.prev[i]]=this.next[i],this.prev[this.next[i]]=this.prev[i]),this.size--,this.free.push(i)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return e}clear(){for(const t of this.rindexes({allowStale:!0})){const e=this.valList[t];if(this.isBackgroundFetch(e))e.__abortController.abort(new Error("deleted"));else{const i=this.keyList[t];this.dispose(e,i,"delete"),this.disposeAfter&&this.disposed.push([e,i,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return or("reset","clear"),this.clear}get length(){return((t,e)=>{const i=`LRU_CACHE_PROPERTY_${t}`;if(lr(i)){const{prototype:n}=fr,{get:s}=Object.getOwnPropertyDescriptor(n,t);hr(i,`${t} property`,`cache.${e}`,s)}})("length","size"),this.size}static get AbortController(){return tr}static get AbortSignal(){return nr}}var gr=fr;const mr=/(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)(-?[0-9]+(px|em)\s+|0\s+)?(-?[0-9]+(px|em)\s+|0\s+)?(.*)/g,vr={},yr="undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes("firefox"),wr={};class br{constructor(t,e){this.imagesPending=0,this.imagesLoaded=0,this.imageIdsLoaded=[],this.frameIsRendering=!1,this.pendingDrawCall=!1,this.firstMeaningfulPaint=!1,this.parallelTasks=8,this.frameTasks=0,this.loadingQueueOrdered=!0,this.loadingQueue=[],this.currentTask=Promise.resolve(),this.tasksRunning=0,this.averageJobTime=64,this.lastKnownScale=1,this.visible=[],this.previousVisible=[],this.drawCalls=[],this.invalidated=[],this._worker=()=>{if(this.loadingQueue.length){const t=this.loadingQueue.pop();t&&(this.tasksRunning++,this.frameTasks++,this.currentTask=t.task().then((()=>{this.tasksRunning--})).catch((()=>{this.tasksRunning--})))}},this._scheduled=0,this._doWork=()=>{0===this.loadingQueue.length&&0===this.tasksRunning&&this._scheduled&&(clearInterval(this._scheduled),this._scheduled=0);let t=this.parallelTasks||1;!this.firstMeaningfulPaint&&this.loadingQueue.length&&(t=this.loadingQueue.length);for(let e=0;e<=t;e++)this._worker()},this.canvas=t,this.rendererPosition=t.getBoundingClientRect(),this.ctx=t.getContext("2d",{alpha:!0}),this.ctx.imageSmoothingEnabled=!0,this.options=e||{},this.canvas.style.opacity="0",this.canvas.style.transition="opacity .3s",this.dpi=(null==e?void 0:e.dpi)||1,this.hostCache=(null==e?void 0:e.lruCache)?new gr({maxSize:268435456,dispose:(t,e,i)=>{this.invalidated.push(e),t.width=0,t.height=0},sizeCalculation:(t,e)=>t.width*t.height}):{store:{},get(t){return this.store[t]},set(t,e){this.store[t]=e}}}getCanvasDims(){return{width:this.canvas.width/this.dpi,height:this.canvas.height/this.dpi}}resize(){this.rendererPosition=this.canvas.getBoundingClientRect()}isReady(){return this.firstMeaningfulPaint}afterFrame(t){if(this.clearTransform(),this.lastPaintedObject=void 0,this.frameIsRendering=!1,this.imagesPending=Math.max(0,this.imagesPending-this.imagesLoaded),this.imagesLoaded=0,this.loadingQueueOrdered||(this.loadingQueue=this.loadingQueue.sort(((t,e)=>t.network&&t.scale===e.scale?e.distance-t.distance:t.scale<e.scale?-1:1)),this.loadingQueueOrdered=!0),this.previousVisible=this.visible,this.pendingDrawCall=!!this.drawCalls.length,this.pendingDrawCall)for(let e=0;e<this.drawCalls.length;e++){const t=this.drawCalls.shift();t&&t()}this.doOffscreenWork(),this.options.debug&&this.stats&&this.stats.end()}doOffscreenWork(){this.frameTasks=0,this.loadingQueue.length&&(this._worker(),this.loadingQueue.length&&(this._scheduled||(this._scheduled=setInterval(this._doWork,0))))}getScale(t,e,i){if(Number.isNaN(t)||Number.isNaN(e))return this.lastKnownScale;const n=this.getCanvasDims(),s=n.width/t,r=n.height/e,o=(s<r?r:s)*(i&&this.dpi||1);return Number.isNaN(o)||(this.lastKnownScale=o),this.lastKnownScale}beforeFrame(t,e,i,n){var s;this.options.debug&&this.stats&&this.stats.begin(),this.frameIsRendering=!0,this.visible=[],this.options.beforeFrame&&this.options.beforeFrame(e);const r=this.getCanvasDims();if(this.ctx.globalAlpha=1,this.ctx.fillStyle=null!=(s=this.canvas.dataset.background)?s:"rgb(0, 0, 0)",this.ctx.fillRect(0,0,r.width,r.height),n.enableFilters&&(n.filters.brightness||n.filters.contrast||n.filters.grayscale||n.filters.invert||n.filters.sepia||n.filters.saturate||n.filters.hueRotate||n.filters.blur)){let t="";n.filters.brightness&&(t+=`brightness(${~~(100+100*n.filters.brightness)}%) `),n.filters.contrast&&(t+=`contrast(${~~(100+100*n.filters.contrast)}%) `),n.filters.grayscale&&(t+=`grayscale(${~~(100*n.filters.grayscale)}%) `),n.filters.invert&&(t+=`invert(${~~(100*n.filters.invert)}%) `),n.filters.sepia&&(t+=`sepia(${~~(100*n.filters.sepia)}%) `),n.filters.saturate&&(t+=`saturate(${~~(100+100*n.filters.saturate)}%) `),n.filters.hueRotate&&(t+=`hue-rotate(${n.filters.hueRotate}deg) `),n.filters.blur&&(t+=`blur(${n.filters.blur}px) `),this.ctx.filter=t}else this.ctx.filter="none"}applyTransform(t,e,i,n,s){const r=t.__owner.value;if(r&&r.rotation){this.ctx.save();const t=e+n/2,o=i+s/2;this.ctx.translate(t,o),this.ctx.rotate(r.rotation*Math.PI/180),this.ctx.translate(-t,-o),this.lastPaintedObject=r}}clearTransform(){this.lastPaintedObject&&(this.lastPaintedObject.rotation&&this.ctx.restore(),this.lastPaintedObject=void 0)}paint(t,e,i,n,s,r){const o=this.ctx.globalAlpha;if(t instanceof T||t instanceof _s){if(t.display.rotation){this.ctx.save();let o=i+s/2,a=n+r/2;t.crop&&(o-=t.crop[5*e+1],a-=t.crop[5*e+2]),this.ctx.translate(o,a),this.ctx.rotate(t.display.rotation*Math.PI/180),this.ctx.translate(-o,-a)}if(this.visible.push(t),t.style,"undefined"!==t.style.opacity){if(!t.style.opacity)return;this.ctx.globalAlpha=t.style.opacity}try{const o=t.__host.canvas,a=this.getCanvasDims();if(-1!==o.indices.indexOf(e)&&-1===this.invalidated.indexOf(o.canvases[e])||this.schedulePaintToCanvas(o,t,e,k({x:i+s/2,y:n+s/2},{x:a.width/2,y:a.height/2})),!this.firstMeaningfulPaint)return;const l=this.hostCache.get(o.canvases[e]);if(l)if(t.crop&&t.cropData){if(t.crop[5*e]){const o=[t.crop[5*e+1]/t.display.scale-t.display.points[5*e+1],t.crop[5*e+2]/t.display.scale-t.display.points[5*e+2],1+(t.crop[5*e+3]-t.crop[5*e+1])/t.display.scale,1+(t.crop[5*e+4]-t.crop[5*e+2])/t.display.scale];o[0]+=t.cropData.x/t.display.scale,o[1]+=t.cropData.y/t.display.scale;const a=t.x*this.lastKnownScale,h=t.y*this.lastKnownScale,c=[i+a,n+h,s,r];c[0]+=a,c[1]+=h,this.ctx.drawImage(l,o[0],o[1],o[2],o[3],c[0],c[1],c[2]+1,c[3]+1)}}else yr?this.ctx.drawImage(l,0,0,t.display.points[5*e+3]-t.display.points[5*e+1],t.display.points[5*e+4]-t.display.points[5*e+2],i,n,s+1,r+1):this.ctx.drawImage(l,0,0,t.display.points[5*e+3]-t.display.points[5*e+1],t.display.points[5*e+4]-t.display.points[5*e+2],i,n,s+Number.MIN_VALUE+.5,r+Number.MIN_VALUE+.5)}catch(h){}t.display.rotation&&this.ctx.restore()}const a=t instanceof $s&&this.options.box,l=t instanceof Fs&&this.options.polygon;if((a||l)&&!t.props.className&&!t.props.html&&!t.props.href){if(this.visible.push(t),t.props.style){const e=Object.assign({},t.props.style||{},t.hovering?t.props.hoverStyles:{},t.pressing?t.props.pressStyles:{}),o=t.props.relativeStyle?1:s/t.width;void 0!==e.opacity&&(this.ctx.globalAlpha=e.opacity);let a=0;void 0!==e.borderWidth&&(a=parseInt(e.borderWidth,10)*o);let h=0;void 0!==e.outlineWidth&&(h=parseInt(e.outlineWidth,10)*o);let c=0;if(void 0!==e.outlineOffset&&(c=parseInt(e.outlineOffset,10)*o),e.borderColor&&(this.ctx.strokeStyle=e.borderColor),e.boxShadow){const t=e.boxShadow.split(/,(?![^(]*\))/);for(const e of t){const t=vr[e]||mr.exec(e)||mr.exec(e);vr[e]=t,t&&(this.ctx.save(),this.ctx.shadowOffsetX=parseInt(t[1])*this.dpi*o,this.ctx.shadowOffsetY=parseInt(t[3])*this.dpi*o,this.ctx.shadowBlur=parseInt(t[5])*this.dpi*o,this.ctx.shadowColor=t[9],this.ctx.fillStyle="rgba(0,0,0,1)",this.ctx.fillRect(i+a,n+a,s,r),this.ctx.restore())}}if(this.ctx.fillStyle=e.backgroundColor||"transparent",this.ctx.lineWidth=a,l){const e=t.shape,s=e.points||[],r=s.length;this.ctx.beginPath();for(let t=0;t<r;t++)this.ctx.lineTo(i+s[t][0]*this.lastKnownScale,n+s[t][1]*this.lastKnownScale);e.open||this.ctx.closePath(),a&&this.ctx.stroke(),e.open||this.ctx.fill()}else a&&this.ctx.strokeRect(i+a/2,n+a/2,s+a,r+a),this.ctx.fillRect(i+a,n+a,s,r);h&&(e.outlineColor&&(this.ctx.strokeStyle=e.outlineColor),this.ctx.lineWidth=h,this.ctx.strokeRect(i-h/2-c,n-h/2-c,s+2*a+h+2*c,r+2*a+h+2*c))}this.ctx.globalAlpha=o}}loadImage(t,e,i,n=!1){if(wr[t]&&wr[t].naturalWidth>0)e(wr[t]);else try{let s=!1;n||setTimeout((()=>{s||this.loadImage(t,e,i,!0)}),3e3);const r=document.createElement("img");r.decoding="auto",r.onload=function(){s=!0,e(r),wr[t]=r,r.onload=null},this.options.crossOrigin&&(r.crossOrigin="anonymous"),r.src=t,r.complete&&r.onload({}),r.width}catch(s){console.log("image error",s),i(s)}}schedulePaintToCanvas(t,e,i,n){this.imagesPending++,t.indices.push(i);const s=`${e.id}--${e.display.scale}-${i}`,r=this.invalidated.indexOf(s);-1!==r&&this.invalidated.splice(r,1),t.canvases[i]=s,e.__host.canvas.loading=!0,this.loadingQueueOrdered=!1,this.loadingQueue.push({id:s,scale:e.display.scale,network:!0,distance:n,task:()=>new Promise((r=>{if(-1===this.visible.indexOf(e))return this.imagesPending--,t.indices.splice(t.indices.indexOf(i),1),void r();const o=e.getImageUrl(i);this.loadImage(o,(o=>{this.loadingQueue.push({id:s,scale:e.display.scale,distance:n,task:()=>new Promise((n=>{this.imageIdsLoaded.includes(s)||(this.imagesLoaded++,this.imageIdsLoaded.push(s)),t.loaded.push(i),t.loaded.length===t.indices.length&&(t.loading=!1);const r=e.display.points.slice(5*i,5*i+5),a=document.createElement("canvas"),l=a.getContext("2d");a.width=r[3]-r[1],a.height=r[4]-r[2],this.hostCache.set(t.canvases[i],a),this.drawCalls.push((()=>{l.drawImage(o,0,0,r[3]-r[1],r[4]-r[2]),n()}))}))}),r()}),(e=>{this.imagesPending--,t.indices.splice(t.indices.indexOf(i),1),r()}))}))})}afterPaintLayer(t,e){}prepareLayer(t,e){t.__owner.value&&(t.cropData?(this.lastKnownScale,t.display.scale,this.applyTransform(t,e[1],e[2],e[3]-e[1],e[4]-e[2])):this.applyTransform(t,e[1],e[2],e[3]-e[1],e[4]-e[2])),t.__host&&t.__host.canvas||(t instanceof T||t instanceof _s)&&this.createImageHost(t)}finishLayer(){this.lastPaintedObject&&this.clearTransform()}createImageHost(t){t.__host=t.__host?t.__host:{},t.__host.canvas={canvas:void 0,canvases:[],indices:[],loaded:[],loading:!1}}getPointsAt(t,e,i,n){return t.getPointsAt(e,i,n)}getViewportBounds(t,e,i){const n=t.getActiveZone();if(n){const t=e[3]-e[1]<n.points[3]-n.points[1],s=e[4]-e[2]<n.points[4]-n.points[2];return{x1:t?n.points[1]-i:n.points[1]+(n.points[3]-n.points[1])/2-(e[3]-e[1])/2,y1:s?n.points[2]-i:n.points[2]+(n.points[4]-n.points[2])/2-(e[4]-e[2])/2,x2:t?n.points[3]+i:n.points[1]+(n.points[3]-n.points[1])/2-(e[3]-e[1])/2,y2:s?n.points[4]+i:n.points[2]+(n.points[4]-n.points[2])/2-(e[4]-e[2])/2}}return null}pendingUpdate(){const t=!this.pendingDrawCall&&0===this.drawCalls.length&&0===this.imagesPending&&0===this.loadingQueue.length&&0===this.tasksRunning;return t||0!==this.visible.length||setTimeout((()=>{this.canvas.style.opacity="1",this.firstMeaningfulPaint=!0}),500),!this.firstMeaningfulPaint&&t&&this.visible.length?(this.canvas.style.opacity="1",this.firstMeaningfulPaint=t,!0):!!this.options.debug||!t}getRendererScreenPosition(){return this.rendererPosition}reset(){this.loadingQueue=[],this.drawCalls=[]}}class xr{constructor(t){this.renderers=[];for(const e of t)e&&this.renderers.push(e);this.length=this.renderers.length}afterFrame(t,e,i,n){for(let s=0;s<this.length;s++)this.renderers[s].afterFrame(t,e,i,n)}afterPaintLayer(t,e){for(let i=0;i<this.length;i++)this.renderers[i].afterPaintLayer(t,e)}beforeFrame(t,e,i,n){for(let s=0;s<this.length;s++)this.renderers[s].beforeFrame(t,e,i,n)}triggerResize(){for(let t=0;t<this.length;t++){const e=this.renderers[t];e.triggerResize&&e.triggerResize()}}getPointsAt(t,e,i,n){return this.renderers[0].getPointsAt(t,e,i,n)}getScale(t,e){return this.renderers[0].getScale(t,e)}getViewportBounds(t,e,i){return this.renderers[0].getViewportBounds(t,e,i)}getRendererScreenPosition(){return this.renderers[0].getRendererScreenPosition()}isReady(){for(let t=0;t<this.length;t++)if(!this.renderers[t].isReady())return!1;return!0}paint(t,e,i,n,s,r){for(let o=0;o<this.length;o++)this.renderers[o].paint(t,e,i,n,s,r)}pendingUpdate(){for(let t=0;t<this.length;t++)if(this.renderers[t].pendingUpdate())return!0;return!1}prepareLayer(t,e){for(let i=0;i<this.length;i++)this.renderers[i].prepareLayer(t,e)}finishLayer(t,e){for(let i=0;i<this.length;i++)this.renderers[i].finishLayer(t,e)}resize(t,e){for(let i=0;i<this.length;i++)this.renderers[i].resize(t,e)}reset(){for(let t=0;t<this.length;t++)this.renderers[t].reset()}}class Er{constructor(t){this.heightRatio=1,this.widthRatio=1,this.target=new Float32Array(5),this.delta=0,this.renderNextFrame=!0,this.canvas=t,this.initialWidth=t.width,this.initialHeight=t.height,this.context=t.getContext("2d"),this.context.globalAlpha=.5,this.aggregate=w(1)}isReady(){return!0}resize(){this.initialWidth=this.canvas.width,this.initialHeight=this.canvas.height,this.renderNextFrame=!0}afterFrame(t,e,i){if(this.renderNextFrame){this.context.clearRect(0,0,this.canvas.width,this.canvas.height);const e=this.initialWidth/t.width,n=this.initialHeight/t.height,s=this.widthRatio>this.heightRatio?e:n;if(this.target=i,this.bounds){const e=t.getPointsAt(this.bounds,this.aggregate,s);for(const[t,i]of e)if(t instanceof T&&t.__host.canvas){const e=i.length/5;for(let n=0;n<e;n++){t.__host.canvas.canvases[n]&&(i[n+1],i[n+2],i[n+3],i[n+1],i[n+4],i[n+2])}}}t.getPoints().forEach(((t,e,i)=>{if(e%5==0&&t){const t={x1:i[e+1]*s,y1:i[e+2]*s,x2:i[e+3]*s,y2:i[e+4]*s,width:(i[e+3]-i[e+1])*s,height:(i[e+4]-i[e+2])*s};this.context.strokeStyle="red",this.context.strokeRect(t.x1,t.y1,t.width,t.height)}})),i&&(this.context.strokeStyle="red",this.context.lineWidth=window.devicePixelRatio||1,this.context.strokeRect(i[1]*s,i[2]*s,(i[3]-i[1])*s,(i[4]-i[2])*s))}}getActiveZone(t){return null}getPointsAt(t,e,i,n){return t.getPointsAt(e,i,n)}getScale(t,e){return 1}beforeFrame(t,e){this.bounds=v.singleBox(t.width,t.height)}drawImage(){}afterPaintLayer(t,e){}paint(t,e,i,n,s,r){this.renderNextFrame=!0}prepareLayer(t){}pendingUpdate(){return!1}hasActiveZone(){return!1}getViewportBounds(t,e,i){return null}getRendererScreenPosition(){return this.canvas.getBoundingClientRect()}finishLayer(){}reset(){}}var Sr,_r,Tr,Cr,Pr,kr,Or,Rr,Ar,Ir,Lr,$r,Mr,zr,Br,Fr=!1;function Dr(){if(!Fr){Fr=!0;var t=navigator.userAgent,e=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(t),i=/(Mac OS X)|(Windows)|(Linux)/.exec(t);if($r=/\b(iPhone|iP[ao]d)/.exec(t),Mr=/\b(iP[ao]d)/.exec(t),Ir=/Android/i.exec(t),zr=/FBAN\/\w+;/i.exec(t),Br=/Mobile/i.exec(t),Lr=!!/Win64/.exec(t),e){(Sr=e[1]?parseFloat(e[1]):e[5]?parseFloat(e[5]):NaN)&&document&&document.documentMode&&(Sr=document.documentMode);var n=/(?:Trident\/(\d+.\d+))/.exec(t);kr=n?parseFloat(n[1])+4:Sr,_r=e[2]?parseFloat(e[2]):NaN,Tr=e[3]?parseFloat(e[3]):NaN,(Cr=e[4]?parseFloat(e[4]):NaN)?(e=/(?:Chrome\/(\d+\.\d+))/.exec(t),Pr=e&&e[1]?parseFloat(e[1]):NaN):Pr=NaN}else Sr=_r=Tr=Pr=Cr=NaN;if(i){if(i[1]){var s=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(t);Or=!s||parseFloat(s[1].replace("_","."))}else Or=!1;Rr=!!i[2],Ar=!!i[3]}else Or=Rr=Ar=!1}}var jr,Nr={ie:function(){return Dr()||Sr},ieCompatibilityMode:function(){return Dr()||kr>Sr},ie64:function(){return Nr.ie()&&Lr},firefox:function(){return Dr()||_r},opera:function(){return Dr()||Tr},webkit:function(){return Dr()||Cr},safari:function(){return Nr.webkit()},chrome:function(){return Dr()||Pr},windows:function(){return Dr()||Rr},osx:function(){return Dr()||Or},linux:function(){return Dr()||Ar},iphone:function(){return Dr()||$r},mobile:function(){return Dr()||$r||Mr||Ir||Br},nativeApp:function(){return Dr()||zr},android:function(){return Dr()||Ir},ipad:function(){return Dr()||Mr}},Wr=Nr,Ur=!("undefined"==typeof window||!window.document||!window.document.createElement),Hr={canUseDOM:Ur,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:Ur&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:Ur&&!!window.screen,isInWorker:!Ur};Hr.canUseDOM&&(jr=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""))
2
2
  /**
3
3
  * Checks if an event is supported in the current execution environment.
4
4
  *