modern-canvas 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +3 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -256,6 +256,7 @@ interface CoreObject {
|
|
|
256
256
|
declare class CoreObject extends Reactivable {
|
|
257
257
|
readonly instanceId: number;
|
|
258
258
|
get json(): Record<string, any>;
|
|
259
|
+
set json(val: Record<string, any>);
|
|
259
260
|
protected _nextTick(): Promise<void>;
|
|
260
261
|
equal(target: CoreObject | undefined | null): boolean;
|
|
261
262
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -256,6 +256,7 @@ interface CoreObject {
|
|
|
256
256
|
declare class CoreObject extends Reactivable {
|
|
257
257
|
readonly instanceId: number;
|
|
258
258
|
get json(): Record<string, any>;
|
|
259
|
+
set json(val: Record<string, any>);
|
|
259
260
|
protected _nextTick(): Promise<void>;
|
|
260
261
|
equal(target: CoreObject | undefined | null): boolean;
|
|
261
262
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -256,6 +256,7 @@ interface CoreObject {
|
|
|
256
256
|
declare class CoreObject extends Reactivable {
|
|
257
257
|
readonly instanceId: number;
|
|
258
258
|
get json(): Record<string, any>;
|
|
259
|
+
set json(val: Record<string, any>);
|
|
259
260
|
protected _nextTick(): Promise<void>;
|
|
260
261
|
equal(target: CoreObject | undefined | null): boolean;
|
|
261
262
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(u,Tr){typeof exports=="object"&&typeof module<"u"?Tr(exports):typeof define=="function"&&define.amd?define(["exports"],Tr):(u=typeof globalThis<"u"?globalThis:u||self,Tr(u.modernCanvas={}))})(this,(function(u){"use strict";var Tr={grad:.9,turn:360,rad:360/(2*Math.PI)},xt=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},pe=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*s)/t+0},He=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),s>t?t:s>e?s:e},Zn=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},Jn=function(s){return{r:He(s.r,0,255),g:He(s.g,0,255),b:He(s.b,0,255),a:He(s.a)}},cs=function(s){return{r:pe(s.r),g:pe(s.g),b:pe(s.b),a:pe(s.a,3)}},mc=/^#([0-9a-f]{3,8})$/i,mi=function(s){var e=s.toString(16);return e.length<2?"0"+e:e},Qn=function(s){var e=s.r,t=s.g,r=s.b,i=s.a,n=Math.max(e,t,r),o=n-Math.min(e,t,r),a=o?n===e?(t-r)/o:n===t?2+(r-e)/o:4+(e-t)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:i}},eo=function(s){var e=s.h,t=s.s,r=s.v,i=s.a;e=e/360*6,t/=100,r/=100;var n=Math.floor(e),o=r*(1-t),a=r*(1-(e-n)*t),l=r*(1-(1-e+n)*t),c=n%6;return{r:255*[r,a,o,o,l,r][c],g:255*[l,r,r,a,o,o][c],b:255*[o,o,l,r,r,a][c],a:i}},to=function(s){return{h:Zn(s.h),s:He(s.s,0,100),l:He(s.l,0,100),a:He(s.a)}},ro=function(s){return{h:pe(s.h),s:pe(s.s),l:pe(s.l),a:pe(s.a,3)}},io=function(s){return eo((t=(e=s).s,{h:e.h,s:(t*=((r=e.l)<50?r:100-r)/100)>0?2*t/(r+t)*100:0,v:r+t,a:e.a}));var e,t,r},Er=function(s){return{h:(e=Qn(s)).h,s:(i=(200-(t=e.s))*(r=e.v)/100)>0&&i<200?t*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,t,r,i},yc=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_c=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,bc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hs={string:[[function(s){var e=mc.exec(s);return e?(s=e[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?pe(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?pe(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var e=vc.exec(s)||bc.exec(s);return e?e[2]!==e[4]||e[4]!==e[6]?null:Jn({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(s){var e=yc.exec(s)||_c.exec(s);if(!e)return null;var t,r,i=to({h:(t=e[1],r=e[2],r===void 0&&(r="deg"),Number(t)*(Tr[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return io(i)},"hsl"]],object:[[function(s){var e=s.r,t=s.g,r=s.b,i=s.a,n=i===void 0?1:i;return xt(e)&&xt(t)&&xt(r)?Jn({r:Number(e),g:Number(t),b:Number(r),a:Number(n)}):null},"rgb"],[function(s){var e=s.h,t=s.s,r=s.l,i=s.a,n=i===void 0?1:i;if(!xt(e)||!xt(t)||!xt(r))return null;var o=to({h:Number(e),s:Number(t),l:Number(r),a:Number(n)});return io(o)},"hsl"],[function(s){var e=s.h,t=s.s,r=s.v,i=s.a,n=i===void 0?1:i;if(!xt(e)||!xt(t)||!xt(r))return null;var o=(function(a){return{h:Zn(a.h),s:He(a.s,0,100),v:He(a.v,0,100),a:He(a.a)}})({h:Number(e),s:Number(t),v:Number(r),a:Number(n)});return eo(o)},"hsv"]]},so=function(s,e){for(var t=0;t<e.length;t++){var r=e[t][0](s);if(r)return[r,e[t][1]]}return[null,void 0]},wc=function(s){return typeof s=="string"?so(s.trim(),hs.string):typeof s=="object"&&s!==null?so(s,hs.object):[null,void 0]},us=function(s,e){var t=Er(s);return{h:t.h,s:He(t.s+100*e,0,100),l:t.l,a:t.a}},fs=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},no=function(s,e){var t=Er(s);return{h:t.h,s:t.s,l:He(t.l+100*e,0,100),a:t.a}},ds=(function(){function s(e){this.parsed=wc(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return s.prototype.isValid=function(){return this.parsed!==null},s.prototype.brightness=function(){return pe(fs(this.rgba),2)},s.prototype.isDark=function(){return fs(this.rgba)<.5},s.prototype.isLight=function(){return fs(this.rgba)>=.5},s.prototype.toHex=function(){return e=cs(this.rgba),t=e.r,r=e.g,i=e.b,o=(n=e.a)<1?mi(pe(255*n)):"","#"+mi(t)+mi(r)+mi(i)+o;var e,t,r,i,n,o},s.prototype.toRgb=function(){return cs(this.rgba)},s.prototype.toRgbString=function(){return e=cs(this.rgba),t=e.r,r=e.g,i=e.b,(n=e.a)<1?"rgba("+t+", "+r+", "+i+", "+n+")":"rgb("+t+", "+r+", "+i+")";var e,t,r,i,n},s.prototype.toHsl=function(){return ro(Er(this.rgba))},s.prototype.toHslString=function(){return e=ro(Er(this.rgba)),t=e.h,r=e.s,i=e.l,(n=e.a)<1?"hsla("+t+", "+r+"%, "+i+"%, "+n+")":"hsl("+t+", "+r+"%, "+i+"%)";var e,t,r,i,n},s.prototype.toHsv=function(){return e=Qn(this.rgba),{h:pe(e.h),s:pe(e.s),v:pe(e.v),a:pe(e.a,3)};var e},s.prototype.invert=function(){return lt({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},s.prototype.saturate=function(e){return e===void 0&&(e=.1),lt(us(this.rgba,e))},s.prototype.desaturate=function(e){return e===void 0&&(e=.1),lt(us(this.rgba,-e))},s.prototype.grayscale=function(){return lt(us(this.rgba,-1))},s.prototype.lighten=function(e){return e===void 0&&(e=.1),lt(no(this.rgba,e))},s.prototype.darken=function(e){return e===void 0&&(e=.1),lt(no(this.rgba,-e))},s.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},s.prototype.alpha=function(e){return typeof e=="number"?lt({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):pe(this.rgba.a,3);var t},s.prototype.hue=function(e){var t=Er(this.rgba);return typeof e=="number"?lt({h:e,s:t.s,l:t.l,a:t.a}):pe(t.h)},s.prototype.isEqual=function(e){return this.toHex()===lt(e).toHex()},s})(),lt=function(s){return s instanceof ds?s:new ds(s)},oo=[],xc=function(s){s.forEach(function(e){oo.indexOf(e)<0&&(e(ds,hs),oo.push(e))})};const Pc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Sc=(s=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(s|=0));for(;s--;)e+=Pc[t[s]&63];return e};function K(s){return s==null||s==="none"}function or(s,e=0,t=10**e){return Math.round(t*s)/t+0}function Ve(s,e=!1){if(typeof s!="object"||!s)return s;if(Array.isArray(s))return e?s.map(r=>Ve(r,e)):s;const t={};for(const r in s){const i=s[r];i!=null&&(e?t[r]=Ve(i,e):t[r]=i)}return t}function ar(s,e){const t={};return e.forEach(r=>{r in s&&(t[r]=s[r])}),t}function ps(s,e){if(s===e)return!0;if(s&&e&&typeof s=="object"&&typeof e=="object"){const t=Array.from(new Set([...Object.keys(s),...Object.keys(e)]));return!t.length||t.every(r=>s[r]===e[r])}return!1}function Cc(s,e,t){const r=e.length-1;if(r<0)return s===void 0?t:s;for(let i=0;i<r;i++){if(s==null)return t;s=s[e[i]]}return s==null||s[e[r]]===void 0?t:s[e[r]]}function Tc(s,e,t){const r=e.length-1;for(let i=0;i<r;i++)typeof s[e[i]]!="object"&&(s[e[i]]={}),s=s[e[i]];s[e[r]]=t}function Ec(s,e,t){return s==null||!e||typeof e!="string"?t:s[e]!==void 0?s[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Cc(s,e.split("."),t))}function Mc(s,e,t){if(!(typeof s!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Tc(s,e.split("."),t)}class Dt{_observers=new Map;on(e,t){let r=this._observers.get(e);return r===void 0&&this._observers.set(e,r=new Set),r.add(t),this}once(e,t){const r=(...i)=>{this.off(e,r),t(...i)};return this.on(e,r),this}off(e,t){const r=this._observers.get(e);return r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e)),this}emit(e,...t){return Array.from((this._observers.get(e)||new Map).values()).forEach(r=>r(...t)),this}destroy(){this._observers=new Map}}let ao=class{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const t=e.__v_raw;t&&(e=this._toRaw(t))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,t){return this._map.set(this._toRaw(e),this._toRaw(t)),this}};const gs=Symbol("properties"),lo=Symbol("inited");function ms(s){let e;if(Object.hasOwn(s,gs))e=s[gs];else{const t=Object.getPrototypeOf(s);e=new Map(t?ms(t):void 0),s[gs]=e}return e}function co(s,e,t,r){const{alias:i,internalKey:n}=r,o=s[e];i?Mc(s,i,t):s[n]=t,s.onUpdateProperty?.(e,t,o)}function ho(s,e,t){const{alias:r,internalKey:i}=t;let n;return r?n=Ec(s,r):n=s[i],n=n??uo(s,e,t),n}function uo(s,e,t){const{default:r,fallback:i}=t;let n;if(r!==void 0&&!s[lo]){s[lo]=!0;const o=typeof r=="function"?r():r;o!==void 0&&(s[e]=o,n=o)}return n=n??(typeof i=="function"?i():i),n}function Ac(s,e){function t(){return typeof this.getProperty<"u"?this.getProperty(s):ho(this,s,e)}function r(i){typeof this.setProperty<"u"?this.setProperty(s,i):co(this,s,i,e)}return{get:t,set:r}}function yi(s,e,t={}){const r={...t,internalKey:Symbol(e)};ms(s).set(e,r);const i=Ac(e,r);Object.defineProperty(s.prototype,e,{get(){return i.get.call(this)},set(n){i.set.call(this,n)},configurable:!0,enumerable:!0})}function w(s){return function(e,t){if(typeof t!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");yi(e.constructor,t,s)}}class fo extends Dt{_propertyAccessor;_properties=new Map;_updatedProperties=new Map;_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?this._updatedProperties.has(e):this._updatedProperties.size>0}getProperty(e){const t=this.getPropertyDeclaration(e);if(t){if(t.internal||t.alias)return ho(this,e,t);{let r;return this._propertyAccessor?.getProperty?r=this._propertyAccessor.getProperty(e):r=this._properties.get(e),r??uo(this,e,t)}}}setProperty(e,t){const r=this.getPropertyDeclaration(e);if(r)if(r.internal||r.alias)co(this,e,t,r);else{const i=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,t),this._properties.set(e,t),this.onUpdateProperty?.(e,t,i)}}getProperties(e){const t={};for(const[r,i]of this.getPropertyDeclarations())!i.internal&&!i.alias&&(!e||e.includes(r))&&(t[r]=this.getProperty(r));return t}setProperties(e){if(e&&typeof e=="object")for(const t in e)this.setProperty(t,e[t]);return this}resetProperties(){for(const[e,t]of this.getPropertyDeclarations())this.setProperty(e,typeof t.default=="function"?t.default():t.default);return this}getPropertyDeclarations(){return ms(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations().get(e)}setPropertyAccessor(e){const t=this.getPropertyDeclarations();this._propertyAccessor=void 0;const r={};return t.forEach((i,n)=>{r[n]=this.getProperty(n)}),this._propertyAccessor=e,t.forEach((i,n)=>{const o=this.getProperty(n),a=r[n];o!==void 0&&!Object.is(o,a)&&(this.setProperty(n,o),!i.internal&&!i.alias&&this.requestUpdate(n,o,a))}),this}async _nextTick(){return"requestAnimationFrame"in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&(this.onUpdate(),this._updating=!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties=new Map}onUpdateProperty(e,t,r){Object.is(t,r)||this.requestUpdate(e,t,r)}requestUpdate(e,t,r){e!==void 0&&(this._updatedProperties.set(e,r),this._changedProperties.add(e),this._updateProperty(e,t,r),this.emit("updateProperty",e,t,r)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,t,r){}toJSON(){const e={};return this._properties.forEach((t,r)=>{t!==void 0&&(t&&typeof t=="object"?"toJSON"in t&&typeof t.toJSON=="function"?e[r]=t.toJSON():Array.isArray(t)?e[r]=[...t]:e[r]={...t}:e[r]=t)}),e}clone(){return new this.constructor(this.toJSON())}}function ys(s){let e;return typeof s=="number"?e={r:s>>24&255,g:s>>16&255,b:s>>8&255,a:(s&255)/255}:e=s,lt(e)}function Oc(s){return{r:or(s.r),g:or(s.g),b:or(s.b),a:or(s.a,3)}}function _i(s){const e=s.toString(16);return e.length<2?`0${e}`:e}const po="#000000FF";function kc(s){return ys(s).isValid()}function Le(s,e=!1){const t=ys(s);if(!t.isValid()){if(typeof s=="string")return s;const a=`Failed to normalizeColor ${s}`;if(e)throw new Error(a);return console.warn(a),po}const{r,g:i,b:n,a:o}=Oc(t.rgba);return`#${_i(r)}${_i(i)}${_i(n)}${_i(or(o*255))}`}var vi=vi||{};vi.parse=(function(){const s={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function t(A){const M=new Error(`${e}: ${A}`);throw M.source=e,M}function r(){const A=i();return e.length>0&&t("Invalid input not EOF"),A}function i(){return x(n)}function n(){return o("linear-gradient",s.linearGradient,l)||o("repeating-linear-gradient",s.repeatingLinearGradient,l)||o("radial-gradient",s.radialGradient,f)||o("repeating-radial-gradient",s.repeatingRadialGradient,f)}function o(A,M,F){return a(M,z=>{const Y=F();return Y&&(O(s.comma)||t("Missing comma before color stops")),{type:A,orientation:Y,colorStops:x(S)}})}function a(A,M){const F=O(A);if(F){O(s.startCall)||t("Missing (");const z=M(F);return O(s.endCall)||t("Missing )"),z}}function l(){const A=c();if(A)return A;const M=$("position-keyword",s.positionKeywords,1);return M?{type:"directional",value:M.value}:h()}function c(){return $("directional",s.sideOrCorner,1)}function h(){return $("angular",s.angleValue,1)||$("angular",s.radianValue,1)}function f(){let A,M=d(),F;return M&&(A=[],A.push(M),F=e,O(s.comma)&&(M=d(),M?A.push(M):e=F)),A}function d(){let A=g()||p();if(A)A.at=m();else{const M=y();if(M){A=M;const F=m();F&&(A.at=F)}else{const F=m();if(F)A={type:"default-radial",at:F};else{const z=P();z&&(A={type:"default-radial",at:z})}}}return A}function g(){const A=$("shape",/^(circle)/i,0);return A&&(A.style=N()||y()),A}function p(){const A=$("shape",/^(ellipse)/i,0);return A&&(A.style=P()||D()||y()),A}function y(){return $("extent-keyword",s.extentKeywords,1)}function m(){if($("position",/^at/,0)){const A=P();return A||t("Missing positioning value"),A}}function P(){const A=E();if(A.x||A.y)return{type:"position",value:A}}function E(){return{x:D(),y:D()}}function x(A){let M=A();const F=[];if(M)for(F.push(M);O(s.comma);)M=A(),M?F.push(M):t("One extra comma");return F}function S(){const A=_();return A||t("Expected color definition"),A.length=D(),A}function _(){return C()||U()||R()||B()||T()||G()||b()}function b(){return $("literal",s.literalColor,0)}function C(){return $("hex",s.hexColor,1)}function T(){return a(s.rgbColor,()=>({type:"rgb",value:x(L)}))}function B(){return a(s.rgbaColor,()=>({type:"rgba",value:x(L)}))}function G(){return a(s.varColor,()=>({type:"var",value:V()}))}function R(){return a(s.hslColor,()=>{O(s.percentageValue)&&t("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const M=L();O(s.comma);let F=O(s.percentageValue);const z=F?F[1]:null;O(s.comma),F=O(s.percentageValue);const Y=F?F[1]:null;return(!z||!Y)&&t("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[M,z,Y]}})}function U(){return a(s.hslaColor,()=>{const A=L();O(s.comma);let M=O(s.percentageValue);const F=M?M[1]:null;O(s.comma),M=O(s.percentageValue);const z=M?M[1]:null;O(s.comma);const Y=L();return(!F||!z)&&t("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[A,F,z,Y]}})}function V(){return O(s.variableName)[1]}function L(){return O(s.number)[1]}function D(){return $("%",s.percentageValue,1)||H()||I()||N()}function H(){return $("position-keyword",s.positionKeywords,1)}function I(){return a(s.calcValue,()=>{let A=1,M=0;for(;A>0&&M<e.length;){const z=e.charAt(M);z==="("?A++:z===")"&&A--,M++}A>0&&t("Missing closing parenthesis in calc() expression");const F=e.substring(0,M-1);return j(M-1),{type:"calc",value:F}})}function N(){return $("px",s.pixelValue,1)||$("em",s.emValue,1)}function $(A,M,F){const z=O(M);if(z)return{type:A,value:z[F]}}function O(A){let M,F;return F=/^\s+/.exec(e),F&&j(F[0].length),M=A.exec(e),M&&j(M[0].length),M}function j(A){e=e.substr(A)}return function(A){return e=A.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),r()}})();const Dc=vi.parse.bind(vi);var bi=bi||{};bi.stringify=(function(){var s={"visit_linear-gradient":function(e){return s.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return s.visit_gradient(e)},"visit_radial-gradient":function(e){return s.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return s.visit_gradient(e)},visit_gradient:function(e){var t=s.visit(e.orientation);return t&&(t+=", "),e.type+"("+t+s.visit(e.colorStops)+")"},visit_shape:function(e){var t=e.value,r=s.visit(e.at),i=s.visit(e.style);return i&&(t+=" "+i),r&&(t+=" at "+r),t},"visit_default-radial":function(e){var t="",r=s.visit(e.at);return r&&(t+=r),t},"visit_extent-keyword":function(e){var t=e.value,r=s.visit(e.at);return r&&(t+=" at "+r),t},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return s.visit(e.value.x)+" "+s.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return s.visit_color(e.value,e)},visit_hex:function(e){return s.visit_color("#"+e.value,e)},visit_rgb:function(e){return s.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return s.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return s.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return s.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return s.visit_color("var("+e.value+")",e)},visit_color:function(e,t){var r=e,i=s.visit(t.length);return i&&(r+=" "+i),r},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var t="",r=e.length;return e.forEach(function(i,n){t+=s.visit(i),n<r-1&&(t+=", ")}),t},visit_object:function(e){return e.width&&e.height?s.visit(e.width)+" "+s.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return s.visit_array(e);if(typeof e=="object"&&!e.type)return s.visit_object(e);if(e.type){var t=s["visit_"+e.type];if(t)return t(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return s.visit(e)}})(),bi.stringify.bind(bi);function go(s){const e=s.length-1;return s.map((t,r)=>{const i=t.value;let n=or(r/e,3),o="#00000000";switch(t.type){case"rgb":o=Le({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":o=Le({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":o=Le(t.value);break;case"hex":o=Le(`#${t.value}`);break}switch(t.length?.type){case"%":n=Number(t.length.value)/100;break}return{offset:n,color:o}})}function mo(s){let e=0;switch(s.orientation?.type){case"angular":e=Number(s.orientation.value);break}return{type:"linear-gradient",angle:e,stops:go(s.colorStops)}}function yo(s){return s.orientation?.map(e=>{switch(e?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:go(s.colorStops)}}function Mr(s){return s.startsWith("linear-gradient(")||s.startsWith("radial-gradient(")}function Ic(s){return Dc(s).map(e=>{switch(e?.type){case"linear-gradient":return mo(e);case"repeating-linear-gradient":return{...mo(e),repeat:!0};case"radial-gradient":return yo(e);case"repeating-radial-gradient":return{...yo(e),repeat:!0};default:return}}).filter(Boolean)}function Rc(s){let e;return typeof s=="string"?e={color:s}:e={...s},{color:Le(e.color)}}function Uc(s){let e;if(typeof s=="string"?e={image:s}:e={...s},e.image){const{type:t,...r}=Ic(e.image)[0]??{};switch(t){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return ar(e,["linearGradient","radialGradient","rotateWithShape"])}function Bc(s){let e;return typeof s=="string"?e={image:s}:e={...s},ar(e,["image","cropRect","stretchRect","tile","dpi","opacity","rotateWithShape"])}function Lc(s){let e;return typeof s=="string"?e={preset:s}:e={...s},K(e.foregroundColor)?delete e.foregroundColor:e.foregroundColor=Le(e.foregroundColor),K(e.backgroundColor)?delete e.backgroundColor:e.backgroundColor=Le(e.backgroundColor),ar(e,["preset","foregroundColor","backgroundColor"])}function _s(s){return!K(s.color)}function Nc(s){return typeof s=="string"?kc(s):_s(s)}function Fc(s){return!K(s.image)&&Mr(s.image)||!!s.linearGradient||!!s.radialGradient}function $c(s){return typeof s=="string"?Mr(s):Fc(s)}function zc(s){return!K(s.image)&&!Mr(s.image)}function Vc(s){return typeof s=="string"?!Mr(s):zc(s)}function Gc(s){return!K(s.preset)}function jc(s){return typeof s=="string"?!1:Gc(s)}function ct(s){const e=s&&typeof s=="object"?s.enabled:void 0;return Nc(s)?Ve({enabled:e,...Rc(s)}):$c(s)?Ve({enabled:e,...Uc(s)}):Vc(s)?Ve({enabled:e,...Bc(s)}):jc(s)?Ve({enabled:e,...Lc(s)}):{}}function Wc(s){return typeof s=="string"?{...ct(s)}:{...ct(s),...ar(s,["fillWithShape"])}}function qc(s){return typeof s=="string"?{...ct(s)}:{...ct(s),...ar(s,["fillWithShape"])}}const _o=()=>Sc(10);function wi(s){return typeof s=="string"?{...ct(s)}:{...ct(s),...ar(s,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function Xc(s){return typeof s=="string"?{color:Le(s)}:{...s,color:K(s.color)?po:Le(s.color)}}function Hc(){return{boxShadow:"none"}}function Yc(s){return typeof s=="string"?s.startsWith("<svg")?{svg:s}:{paths:[{data:s}]}:Array.isArray(s)?{paths:s.map(e=>typeof e=="string"?{data:e}:e)}:s}function Kc(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function Zc(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function Jc(){return{...Kc(),...Zc(),...Hc(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function Qc(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function eh(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function th(){return{...Qc(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function rh(){return{...eh(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function ih(){return{...rh(),...th(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function xi(s){return Ve({...s,color:K(s.color)?void 0:Le(s.color),backgroundColor:K(s.backgroundColor)?void 0:Le(s.backgroundColor),borderColor:K(s.borderColor)?void 0:Le(s.borderColor),outlineColor:K(s.outlineColor)?void 0:Le(s.outlineColor),shadowColor:K(s.shadowColor)?void 0:Le(s.shadowColor)})}function vo(){return{...Jc(),...ih()}}const sh=/\r\n|\n\r|\n|\r/,nh=new RegExp(`^(${sh.source})$`),oh=`
|
|
2
|
-
`;function ah(s){return nh.test(s)}function vs(s){const e=[];function t(){return e[e.length-1]}function r(a,l,c){const h=a?xi(a):{},f=l?ct(l):void 0,d=c?wi(c):void 0,g=Ve({...h,fill:f,outline:d,fragments:[]});return e[e.length-1]?.fragments.length===0?e[e.length-1]=g:e.push(g),g}function i(a="",l,c,h){const f=l?xi(l):{},d=c?ct(c):void 0,g=h?wi(h):void 0;Array.from(a).forEach(p=>{if(ah(p)){const{fragments:y,fill:m,outline:P,...E}=t()||r();y.length||y.push(Ve({...f,fill:d,outline:g,content:oh})),r(E,m,P)}else{const y=t()||r(),m=y.fragments[y.fragments.length-1];if(m){const{content:P,fill:E,outline:x,...S}=m;if(ps(d,E)&&ps(g,x)&&ps(f,S)){m.content=`${P}${p}`;return}}y.fragments.push(Ve({...f,fill:d,outline:g,content:p}))}})}(Array.isArray(s)?s:[s]).forEach(a=>{if(typeof a=="string")r(),i(a);else if(bo(a)){const{content:l,fill:c,outline:h,...f}=a;r(f,c,h),i(l)}else if(lh(a)){const{fragments:l,fill:c,outline:h,...f}=a;r(f,c,h),l.forEach(d=>{const{content:g,fill:p,outline:y,...m}=d;i(g,m,p,y)})}else Array.isArray(a)?(r(),a.forEach(l=>{if(typeof l=="string")i(l);else if(bo(l)){const{content:c,fill:h,outline:f,...d}=l;i(c,d,h,f)}})):console.warn("Failed to parse text content",a)});const o=t();return o&&!o.fragments.length&&o.fragments.push({content:""}),e}function lh(s){return s&&typeof s=="object"&&"fragments"in s&&Array.isArray(s.fragments)}function bo(s){return s&&typeof s=="object"&&"content"in s&&typeof s.content=="string"}function wo(s){return typeof s=="string"||Array.isArray(s)?{content:vs(s)}:Ve({...s,content:vs(s.content??""),style:s.style?xi(s.style):void 0,effects:s.effects?s.effects.map(e=>xi(e)):void 0,measureDom:s.measureDom,fonts:s.fonts,fill:s.fill?ct(s.fill):void 0,outline:s.outline?wi(s.outline):void 0})}const Pi=new Map;function W(s,e){return function(t){Object.defineProperty(t.prototype,"is",{value:s,enumerable:!0,configurable:!0}),e&&Object.keys(e).forEach(r=>{yi(t,r,{fallback:e[r]})}),Pi.set(s,t)}}function ch(s="node",e={}){const t=Pi.get(s);if(!t)throw new Error(`Failed to createNode, tag: ${s}`);return new t().setProperties(e)}class Ce{static _queue=[];static _currentTime=0;static _elapsed=0;static _requestId;static get currentTime(){return this._currentTime}static get elapsed(){return this._elapsed}static on(e,t={}){const{sort:r=0,once:i=!1}=t;this._queue[r]||(this._queue[r]=[]),this._queue[r].push({cb:e,once:i})}static off(e,t={}){const{sort:r=0}=t,i=this._queue[r];if(!i)return;const n=[];for(let o=i.length,a=0;a<o;a++){const l=i[a];l.cb!==e&&n.push(l)}n.length?this._queue[r]=n:this._queue.splice(r,1)}static start(){"requestAnimationFrame"in globalThis&&(this._currentTime=performance.now(),this._requestId=requestAnimationFrame(e=>this._update(e)))}static stop(){this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=void 0)}static _update(e){this._elapsed=e-this._currentTime,this._currentTime=e,this._requestId=requestAnimationFrame(t=>this._update(t)),this._performUpdate()}static _performUpdate(){const e=this._queue,t=[];for(let r=e.length,i=r;i>=0;i--){const n=e[i];if(!n)continue;const o=[];for(let a=n.length,l=0;l<a;l++){const c=n[l];try{c.cb()}catch(h){console.warn(h)}c.once||o.push(c)}o.length&&(t[i]=o)}this._queue=t}}Ce.start();async function bs(s){return new Promise(e=>{Ce.on(()=>{s?.(),e()},{sort:1,once:!0})})}const Si=Math.PI,Ne=Si*2;let hh=0;function xo(s){return s?.__SPECTOR_Object_TAG?.id??++hh}function ws(s){return!(s&s-1)&&!!s}const uh=/([\w-]+)\((.+?)\)/g,fh=/[^,]+/g,dh=/([-e.\d]+)(.*)/;function xs(s){return Array.isArray(s)?s.map(e=>({name:e.name,args:e.args.map(t=>({...t,normalizedIntValue:t.normalizedDefaultIntValue}))})):{...s,normalizedIntValue:s.normalizedDefaultIntValue}}function Ar(s,e,t={}){const r=Or(e,t);return r.length?r:Po(s,e,t)}function Or(s,e={}){const t=[];let r;for(;(r=uh.exec(s))!==null;){const[,i,n]=r;i&&t.push({name:i,args:ph(i,n,e)})}return t}function ph(s,e,t={}){const r=[];let i,n=0;for(;(i=fh.exec(e))!==null;)r.push(Po(s,i[0],{...t,index:n++}));return r}function Po(s,e,t={}){const{width:r=1,height:i=1,index:n=0}=t,o=e.match(dh),a={unit:o?.[2]??null,value:e,intValue:Number(o?.[1]),normalizedIntValue:0,normalizedDefaultIntValue:0};switch(s){case"scale":case"scaleX":case"scaleY":case"scale3d":a.normalizedDefaultIntValue=1;break}switch(a.unit){case"%":a.normalizedIntValue=a.intValue/100;break;case"rad":a.normalizedIntValue=a.intValue/Ne;break;case"deg":a.normalizedIntValue=a.intValue/360;break;case"px":switch(n){case 0:a.normalizedIntValue=a.intValue/r;break;case 1:a.normalizedIntValue=a.intValue/i;break}break;case"turn":case"em":case"rem":default:a.normalizedIntValue=a.intValue;break}return a}const So="WebGL2RenderingContext"in globalThis,Co="ImageBitmap"in globalThis,To="ResizeObserver"in globalThis,lr="PointerEvent"in globalThis,Eo="WheelEvent"in globalThis,gh="MouseEvent"in globalThis,Pt="ontouchstart"in globalThis,Mo="onclick"in globalThis,Ps="createImageBitmap"in globalThis,Ss="AudioContext"in globalThis,Cs="webkitAudioContext"in globalThis,Ts="OfflineAudioContext"in globalThis,Ao="webkitOfflineAudioContext"in globalThis,Oo=Ss||Cs,kr=typeof window<"u",Es=globalThis.devicePixelRatio||1,Ms=s=>s!==null&&typeof s=="object"&&s.nodeType===1,ko=s=>Ms(s)&&s.tagName==="VIDEO",mh=s=>Ms(s)&&s.tagName==="IMG";function Do(s){return typeof s=="object"&&s!==null&&s.nodeType===1&&s.tagName==="CANVAS"}function Io(s){return So&&s instanceof globalThis.WebGL2RenderingContext}function Ro(){if(kr)return globalThis.document.createElement("canvas")}function Uo(s,e=globalThis.location){if(s.startsWith("data:"))return"";e=e||globalThis.location;const t=new URL(s,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}function Bo(s,e,t){t===null&&!e.startsWith("data:")?s.crossOrigin=Uo(e):t!==!1&&(s.crossOrigin=typeof t=="string"?t:"anonymous")}class As{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const t=e.__v_raw;t&&(e=this._toRaw(t))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,t){return this._map.set(this._toRaw(e),this._toRaw(t)),this}}class Dr{cursor;bubbles=!1;cancelBubble=!1;cancelable=!1;composed=!1;defaultPrevented=!1;eventPhase=Dr.prototype.NONE;isTrusted=!1;timeStamp=0;type="";composedPath(){return this.path}initEvent(...e){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){"preventDefault"in this.nativeEvent&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}propagationImmediatelyStopped=!1;stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}propagationStopped=!1;stopPropagation(){"stopPropagation"in this.nativeEvent&&this.nativeEvent.stopPropagation(),this.propagationStopped=!0}NONE=0;CAPTURING_PHASE=1;AT_TARGET=2;BUBBLING_PHASE=3;initUIEvent(...e){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}}class Lo extends Dr{getModifierState(...e){throw new Error("getModifierState() is a legacy DOM API. It is not implemented in the Federated Events API.")}initKeyboardEvent(...e){throw new Error("initKeyboardEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}}class Os extends Dr{client={x:0,y:0};get clientX(){return this.client.x}get clientY(){return this.client.y}layer={x:0,y:0};get layerX(){return this.layer.x}get layerY(){return this.layer.y}movement={x:0,y:0};get movementX(){return this.movement.x}get movementY(){return this.movement.y}offset={x:0,y:0};get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}page={x:0,y:0};get pageX(){return this.page.x}get pageY(){return this.page.y}screen={x:0,y:0};get screenX(){return this.screen.x}get screenY(){return this.screen.y}get x(){return this.clientX}get y(){return this.clientY}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(...e){throw new Error("Method not implemented.")}global={x:0,y:0};get globalX(){return this.global.x}get globalY(){return this.global.y}}class No extends Os{width=0;height=0;isPrimary=!1;getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Fo extends Os{static DOM_DELTA_PIXEL=0;DOM_DELTA_PIXEL=0;static DOM_DELTA_LINE=1;DOM_DELTA_LINE=1;static DOM_DELTA_PAGE=2;DOM_DELTA_PAGE=2}const yh={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class $o extends Dt{event;target;cursor="default";cursorStyles={default:"inherit",pointer:"pointer"};setuped=!1;enableMoveEvent=!0;enableWheelEvent=!0;enableClickEvent=!0;setTarget(e){this.removeEventListeners(),this.target=e,this.addEventListeners()}removeEventListeners(){if(!this.setuped||!this.target)return;const e=this.target.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):lr&&(e.touchAction=""),lr?(this.target.removeEventListener("pointerdown",this._onPointerDown),this.target.removeEventListener("pointerleave",this._onPointerOver),this.target.removeEventListener("pointerover",this._onPointerOver),this.target.removeEventListener("pointermove",this._onPointerMove),this.target.removeEventListener("pointerup",this._onPointerUp)):(this.target.removeEventListener("mousedown",this._onPointerDown),this.target.removeEventListener("mouseout",this._onPointerOver),this.target.removeEventListener("mouseover",this._onPointerOver),this.target.removeEventListener("mousemove",this._onPointerMove),this.target.removeEventListener("mouseup",this._onPointerUp)),Pt&&(this.target.removeEventListener("touchstart",this._onPointerDown),this.target.removeEventListener("touchmove",this._onPointerMove),this.target.removeEventListener("touchend",this._onPointerUp)),this.target.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keypress",this._onKeyPress),document.removeEventListener("keyup",this._onKeyUp),this.target=void 0,this.setuped=!1}addEventListeners(){if(this.setuped||!this.target)return;const e=this.target.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):lr&&(e.touchAction="none")),lr?(this.target.addEventListener("pointerdown",this._onPointerDown),this.target.addEventListener("pointerleave",this._onPointerOver),this.target.addEventListener("pointerover",this._onPointerOver),this.target.addEventListener("pointermove",this._onPointerMove),this.target.addEventListener("pointerup",this._onPointerUp)):(this.target.addEventListener("mousedown",this._onPointerDown),this.target.addEventListener("mouseout",this._onPointerOver),this.target.addEventListener("mouseover",this._onPointerOver),this.target.addEventListener("mousemove",this._onPointerMove),this.target.addEventListener("mouseup",this._onPointerUp)),Pt&&(this.target.addEventListener("touchstart",this._onPointerDown),this.target.addEventListener("touchmove",this._onPointerMove),this.target.addEventListener("touchend",this._onPointerUp)),this.target.addEventListener("wheel",this._onWheel),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("keypress",this._onKeyPress),document.addEventListener("keyup",this._onKeyUp),this.setuped=!0}normalize(e){const t=[];if(Pt&&e instanceof globalThis.TouchEvent)for(let r=0,i=e.changedTouches.length;r<i;r++){const n=e.changedTouches[r];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.type=e.type,t.push(n)}else if(Eo&&e instanceof globalThis.WheelEvent)t.push(e);else if(lr&&e instanceof globalThis.PointerEvent)t.push(e);else{const r=e;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=1),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),t.push(r)}return t}_clonePointerEvent(e){const t=new No;return t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,t.isTrusted=e.isTrusted,this._copyMouseEvent(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.x=t.screen.x,t.global.y=t.screen.y,t.offset.x=t.screen.x,t.offset.y=t.screen.y,t.type==="pointerleave"?t.type="pointerout":t.type.startsWith("mouse")?t.type=t.type.replace("mouse","pointer"):t.type.startsWith("touch")&&(t.type=yh[t.type]||t.type),t}_copyInputEvent(e,t){e.nativeEvent=t,e.bubbles=t.bubbles,e.cancelBubble=t.cancelBubble,e.cancelable=t.cancelable,e.composed=t.composed,e.currentTarget=t.currentTarget,e.defaultPrevented=t.defaultPrevented,e.eventPhase=t.eventPhase,e.isTrusted=t.isTrusted,e.returnValue=t.returnValue,e.srcElement=t.srcElement,e.timeStamp=t.timeStamp,e.type=t.type}_copyMouseEvent(e,t){this._copyInputEvent(e,t),e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}_cloneWheelEvent(e){const t=new Fo;return this._copyMouseEvent(t,e),t.wheelDeltaY=e.wheelDeltaY,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.x=t.screen.x,t.global.y=t.screen.y,t.offset.x=t.screen.x,t.offset.y=t.screen.y,t}_cloneKeyboardEvent(e){const t=new Lo;return this._copyInputEvent(t,e),t.altKey=e.altKey,t.charCode=e.charCode,t.code=e.code,t.ctrlKey=e.ctrlKey,t.isComposing=e.isComposing,t.key=e.key,t.keyCode=e.keyCode,t.location=e.location,t.metaKey=e.metaKey,t.repeat=e.repeat,t.shiftKey=e.shiftKey,t}setCursor(e="default"){if(!this.target||this.cursor===e)return;this.cursor=e;const t=!(globalThis.OffscreenCanvas&&this.target instanceof OffscreenCanvas),r=this.cursorStyles[e];if(r)switch(typeof r){case"string":t&&(this.target.style.cursor=r);break;case"function":r(e);break;case"object":t&&Object.assign(this.target.style,r);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.target.style.cursor=e)}mapPositionToPoint(e,t,r){if(!this.target)return;const i=this.target.isConnected?this.target.getBoundingClientRect():void 0,n=Number(this.target.getAttribute("data-pixel-ratio"))||1,o=Number(this.target.getAttribute("width"))||(i?i.width*n:0),a=Number(this.target.getAttribute("height"))||(i?i.height*n:0),l=i??{width:o,height:a,left:0,top:0},c=1/n;e.x=(t-l.left)*(o/l.width)*c,e.y=(r-l.top)*(a/l.height)*c}_onKeyDown=e=>{const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("keydown",this.event=this._cloneKeyboardEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onKeyPress=e=>{const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("keypress",this.event=this._cloneKeyboardEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onKeyUp=e=>{const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("keyup",this.event=this._cloneKeyboardEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onPointerDown=e=>{if(Pt&&e.pointerType==="touch")return;const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("pointerdown",this.event=this._clonePointerEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onPointerOver=e=>{if(!this.enableClickEvent||Pt&&e.pointerType==="touch")return;const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("pointerover",this.event=this._clonePointerEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onPointerMove=e=>{if(!this.enableMoveEvent||Pt&&e.pointerType==="touch")return;const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("pointermove",this.event=this._clonePointerEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onPointerUp=e=>{if(!this.enableClickEvent||Pt&&e.pointerType==="touch")return;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const r=t!==this.target?"outside":"",i=this.normalize(e);for(let n=0,o=i.length;n<o;n++){const a=this._clonePointerEvent(i[n]);a.type+=r,this.emit("pointerup",this.event=a)}this.event?.cursor&&this.setCursor(this.event.cursor)};_onWheel=e=>{if(!this.enableWheelEvent)return;const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("wheel",this.event=this._cloneWheelEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)}}let _h=0;class It extends fo{instanceId=++_h;get json(){return this.toJSON()}_nextTick(){return bs()}equal(e){return!!(e&&this.instanceId===e.instanceId)}}class zo extends It{}class St extends zo{}function vh(s,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var i in t)r[t[i]]=i;var n={};s.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(o?.closest){var h=this.toRgb(),f=1/0,d="black";if(!n.length)for(var g in t)n[g]=new s(t[g]).toRgb();for(var p in t){var y=(a=h,l=n[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));y<f&&(f=y,d=p)}return d}},e.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":t[a];return l?new s(l).toRgb():null},"name"])}xc([vh]);class Qe{get value(){return this._value}set value(e){this._colord=ys(e??"none")}get r8(){return this._colord.rgba.r}get g8(){return this._colord.rgba.g}get b8(){return this._colord.rgba.b}get a8(){return this._colord.rgba.a*255&255}get r(){return this.r8/255}get g(){return this.g8/255}get b(){return this.b8/255}get a(){return this._colord.rgba.a}get rgb(){return(this.r8<<16)+(this.g8<<8)+this.b8}get bgr(){return(this.b8<<16)+(this.g8<<8)+this.r8}get abgr(){return(this.a8<<24)+this.bgr}constructor(e=0){this.value=e}toHex(){return this._colord.toHex()}toRgb(){return this._colord.toRgb()}toRgbString(){return this._colord.toRgbString()}toHsl(){return this._colord.toHsl()}toHslString(){return this._colord.toHslString()}toHsv(){return this._colord.toHsv()}toArgb(e=this.a,t=!0){if(e===1)return(255<<24)+this.rgb;if(e===0)return t?0:this.rgb;let r=this.r8,i=this.g8,n=this.b8;return t&&(r=r*e+.5|0,i=i*e+.5|0,n=n*e+.5|0),(e*255<<24)+(r<<16)+(i<<8)+n}toInt8Array(){return[this.r8,this.g8,this.b8,this.a8]}toArray(){return[this.r,this.g,this.b,this.a]}}class et extends Dt{constructor(e){super(),this.dim=e}_array=[];get length(){return this.dim}operate(e,t,r){const{dim:i,_array:n}=this;let o;typeof t=="number"?o=Array.from({length:i},()=>t):t instanceof ht||t instanceof et?o=t.toArray():o=t;let a,l=[];if(r?r instanceof et?a=r:l=r:a=this,t instanceof ht){const{cols:c}=t;switch(e){case"*":for(let h=0;h<i;h++){let f=0;for(let d=0;d<i;d++)f+=n[h]*o[d*c+h];l[h]=f}break;default:throw new Error(`Not support operator in '${this.toName()} ${e} ${t.toName()}'`)}}else switch(e){case"+":for(let c=0;c<i;c++)l[c]=n[c]+o[c];break;case"-":for(let c=0;c<i;c++)l[c]=n[c]-o[c];break;case"*":for(let c=0;c<i;c++)l[c]=n[c]*o[c];break;case"/":for(let c=0;c<i;c++)l[c]=n[c]/o[c];break;case"rot":{const c=Math.cos(o[0]),h=Math.sin(o[0]);l[0]=n[0]*c-n[1]*h,l[1]=n[1]*c+n[0]*h;break}case"==":{let c=!0;for(let h=0;h<i;h++)c=c&&n[h]===o[h];return c}case"=":for(let c=0;c<i;c++){const h=o[c];h!==void 0&&(n[c]=h)}return this._onUpdate(n),this.emit("update",n),this;default:throw new Error(`Not support operator in '${this.toName()} ${e} Vector'`)}return a?.set(l)??l}add(e,...t){return t.length&&typeof e=="number"&&(e=[e,...t]),this.operate("+",e)}sub(e,...t){return t.length&&typeof e=="number"&&(e=[e,...t]),this.operate("-",e)}multiply(e,...t){return t.length&&typeof e=="number"&&(e=[e,...t]),this.operate("*",e)}divide(e,...t){return t.length&&typeof e=="number"&&(e=[e,...t]),this.operate("/",e)}rotate(e){return this.operate("rot",e)}set(e,...t){return t.length&&typeof e=="number"&&(e=[e,...t]),this.operate("=",e)}equals(e){return this.operate("==",e)}copy(e){return this.set(e)}clone(){const e=new this.constructor;return e.set(this.toArray()),e}_onUpdate(e){}toName(){return`Vector${this.dim}`}toArray(){return this._array.slice()}toJSON(){return this.toArray()}}class ht extends Dt{constructor(e,t,r){super(),this.rows=e,this.cols=t,r?this.set(r):this.identity()}_array=[];dirtyId=0;get length(){return this.cols*this.rows}operate(e,t,r){const{cols:i,rows:n,length:o,_array:a}=this;let l;typeof t=="number"?l=Array.from({length:o},()=>t):t instanceof et||t instanceof ht?l=t.toArray():l=t;let c,h=[];if(r?r instanceof et||r instanceof ht?c=r:h=r:t instanceof et?c=new t.constructor:c=this,t instanceof et){const{dim:f}=t;switch(e){case"*":for(let d=0;d<f;d++){let g=0;for(let p=0;p<i;p++)p<f&&(g+=a[d*i+p]*(l[p]??0));h[d]=g}break;default:throw new Error(`Not support operator in '${this.toName()} ${e} ${t.toName()}'`)}}else switch(e){case"*":for(let f=0;f<i;f++)for(let d=0;d<n;d++){const g=d*i;let p=0;for(let y=0;y<n;y++){const m=g+y,P=y*i+f;p+=a[m]*(l[P]??0)}h[g+f]=p}break;case"=":for(let f=0;f<o;f++){const d=l[f];d!==void 0&&(a[f]=d)}return this._onUpdate(a),this.emit("update",a),this;default:throw new Error(`Not support operator in '${this.toName()} ${e} Matrix2'`)}return c?.set(h)??h}identity(){const{cols:e,rows:t}=this,r=[];for(let i=0;i<e;i++)for(let n=0;n<t;n++){const o=n*e,a=i+o;r[a]=n+o===a?1:0}return this.set(r)}set(e){return this.operate("=",e)}copy(e){return this.set(e)}clone(){const e=new this.constructor;return e.set(this.toArray()),e}multiply(e,t){return this.operate("*",e,t)}_onUpdate(e){this.dirtyId++}toArray(e=!1){const{cols:t,rows:r,_array:i}=this;if(e){const n=[];for(let o=0;o<r;o++)for(let a=0;a<t;a++)n[o+a*t]=i[a+o*t];return n}return i.slice()}toName(){return`Matrix${this.rows}(${this.rows}x${this.cols})`}toJSON(){return this._array.slice()}}class Vo extends ht{constructor(e){super(4,4,e)}}const Go=Si/180,bh=180/Si;function Ge(s,e,t){return Math.max(e,Math.min(s,t))}function he(s,e,t){return(1-t)*s+t*e}const wh={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(s,e=20){if(!this.adaptive||!s||Number.isNaN(s))return e;let t=Math.ceil(s/this.maxLength);return t<this.minSegments?t=this.minSegments:t>this.maxSegments&&(t=this.maxSegments),t}};class jo extends et{constructor(e=0,t=0,r=0,i=0){super(4),this.set(e,t,r,i)}}class ks extends ht{constructor(e){super(4,5,e)}hueRotate(e=0){const t=Math.sin(e),r=Math.cos(e),i=.213,n=.715,o=.072;return this.multiply([i+r*(1-i)+t*-i,n+r*-n+t*-n,o+r*-o+t*(1-o),0,0,i+r*-i+t*.143,n+r*(1-n)+t*.14,o+r*-o+t*-.283,0,0,i+r*-i+t*-.787,n+r*-n+t*n,o+r*(1-o)+t*o,0,0,0,0,0,1,0])}saturate(e=1){const t=(e-1)*2/3+1,r=(t-1)*-.5;return this.multiply([t,r,r,0,0,r,t,r,0,0,r,r,t,0,0,0,0,0,1,0])}brightness(e=1){const t=e;return this.multiply([t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0])}contrast(e=1){const t=e,r=-128*(t-1);return this.multiply([t,0,0,0,r,0,t,0,0,r,0,0,t,0,r,0,0,0,1,0])}invert(e=1){const t=he(1,-1,e),r=he(0,255,e);return this.multiply([t,0,0,0,r,0,t,0,0,r,0,0,t,0,r,0,0,0,1,0])}sepia(e=1){const t=Ge(e,0,1);return this.multiply([he(1,.393,t),he(0,.7689999,t),he(0,.18899999,t),0,0,he(0,.349,t),he(1,.6859999,t),he(0,.16799999,t),0,0,he(0,.272,t),he(0,.5339999,t),he(1,.13099999,t),0,0,0,0,0,1,0])}opacity(e=1){return this.multiply([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,e,0])}grayscale(e=1){const t=Ge(e,0,1),r=he(1,.3,t),i=he(0,.3,t),n=he(1,.59,t),o=he(0,.59,t),a=he(1,.11,t),l=he(0,.11,t);return this.multiply([r,o,l,0,0,i,n,l,0,0,i,o,a,0,0,0,0,0,1,0])}multiply(e){const t=e,r=this._array;return this.set([r[0]*t[0]+r[1]*t[5]+r[2]*t[10]+r[3]*t[15],r[0]*t[1]+r[1]*t[6]+r[2]*t[11]+r[3]*t[16],r[0]*t[2]+r[1]*t[7]+r[2]*t[12]+r[3]*t[17],r[0]*t[3]+r[1]*t[8]+r[2]*t[13]+r[3]*t[18],r[0]*t[4]+r[1]*t[9]+r[2]*t[14]+r[3]*t[19]+r[4],r[5]*t[0]+r[6]*t[5]+r[7]*t[10]+r[8]*t[15],r[5]*t[1]+r[6]*t[6]+r[7]*t[11]+r[8]*t[16],r[5]*t[2]+r[6]*t[7]+r[7]*t[12]+r[8]*t[17],r[5]*t[3]+r[6]*t[8]+r[7]*t[13]+r[8]*t[18],r[5]*t[4]+r[6]*t[9]+r[7]*t[14]+r[8]*t[19]+r[9],r[10]*t[0]+r[11]*t[5]+r[12]*t[10]+r[13]*t[15],r[10]*t[1]+r[11]*t[6]+r[12]*t[11]+r[13]*t[16],r[10]*t[2]+r[11]*t[7]+r[12]*t[12]+r[13]*t[17],r[10]*t[3]+r[11]*t[8]+r[12]*t[13]+r[13]*t[18],r[10]*t[4]+r[11]*t[9]+r[12]*t[14]+r[13]*t[19]+r[14],r[15]*t[0]+r[16]*t[5]+r[17]*t[10]+r[18]*t[15],r[15]*t[1]+r[16]*t[6]+r[17]*t[11]+r[18]*t[16],r[15]*t[2]+r[16]*t[7]+r[17]*t[12]+r[18]*t[17],r[15]*t[3]+r[16]*t[8]+r[17]*t[13]+r[18]*t[18],r[15]*t[4]+r[16]*t[9]+r[17]*t[14]+r[18]*t[19]+r[19]])}toMatrix4(){const e=this._array;return new Vo([e[0],e[1],e[2],e[3],e[5],e[6],e[7],e[8],e[10],e[11],e[12],e[13],e[15],e[16],e[17],e[18]])}toVector4(){const e=this._array;return new jo(e[4]/255,e[9]/255,e[14]/255,e[19]/255)}}class xh extends ht{constructor(e){super(2,2,e)}}let Ds=class extends ht{constructor(e){super(3,3,e)}affineInvert(){const[e,t,r,i,n,o,a,l,c]=this._array,h=c*n-o*l,f=o*a-c*i,d=l*i-n*a,g=e*h+t*f+r*d;if(g===0)return this.set([0,0,0,0,0,0,0,0,0]);const p=1/g;return this.set([h*p,(r*l-c*t)*p,(o*t-r*n)*p,f*p,(c*e-r*a)*p,(r*i-o*e)*p,d*p,(t*a-l*e)*p,(n*e-t*i)*p])}};class Wo extends Ds{constructor(e=0,t=0,r=0,i=0,n=!1){super(),this._x=e,this._y=t,this._width=r,this._height=i,this._flipY=n,this._performUpdateArray()}flipY(e){return this._flipY!==e&&(this._flipY=e,this._performUpdateArray()),this}translate(e,t){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._performUpdateArray()),this}resize(e,t){return(this._width!==e||this._height!==t)&&(this._width=e,this._height=t,this._performUpdateArray()),this}_performUpdateArray(){const e=this._width,t=this._height;if(!e||!t)return;const r=this._x,i=this._y,n=this._flipY?-1:1,o=1/e*2,a=n*(1/t*2),l=-1-r*o,c=-n-i*a;this.set([o,0,l,0,a,c,0,0,1])}}let de=class hc extends et{get x(){return this._array[0]}set x(e){const[t,r]=this._array;t!==e&&this.set(e,r)}get y(){return this._array[1]}set y(e){const[t,r]=this._array;r!==e&&this.set(t,e)}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}get left(){return this.x}set left(e){this.x=e}get top(){return this.y}set top(e){this.y=e}constructor(e=0,t){super(2),this.set(typeof e=="number"?[e,t??e]:e)}update(e,t){const[r,i]=this._array;return(r!==e||i!==t)&&this.set(e,t),this}getLength(){const[e,t]=this._array;return Math.sqrt(e*e+t*t)}getAngle(){const[e,t]=this._array;return Math.atan2(-e,-t)+Math.PI}distanceTo(e){return Math.hypot(e.x-this.x,e.y-this.y)}normalize(){const[e,t]=this._array,r=1/(this.getLength()||1);return this.set(e*r,t*r),this}static lerp(e,t,r){return new hc(t).clone().sub(e).multiply(r).add(e)}};class Rt{get x(){return this.position.x}get y(){return this.position.y}get left(){return this.position.x}get top(){return this.position.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get width(){return this.size.x}get height(){return this.size.y}end=new de;position;size;constructor(...e){const t=new de,r=new de;switch(e.length){case 0:break;case 1:{const i=e[0];if(i instanceof Rt)t.set(i.position),r.set(i.size);else{const n=i.map(f=>f.x),o=i.map(f=>f.y),a=Math.min(...n),l=Math.max(...n),c=Math.min(...o),h=Math.max(...o);t.set(a,c),r.set(l-a,h-c)}break}case 2:t.set(e[0]),r.set(e[1]);break;default:t.set(e[0],e[1]),r.set(e[2],e[3]);break}this.update=this.update.bind(this),this.position=t.on("update",this.update),this.size=r.on("update",this.update),this.update()}update(){return this.end.set(this.position.x+this.size.x,this.position.y+this.size.y),this}toMinmax(){return{minX:this.position.x,minY:this.position.y,maxX:this.end.x,maxY:this.end.y}}toArray(){return[this.x,this.y,this.width,this.height]}toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height}}}class ve extends Ds{static _t2d=new ve;premultiply(e){return e.multiply(this,this)}skewX(e){return this.skew(e,0)}skewY(e){return this.skew(0,e)}skew(e,t){return this.premultiply(ve._t2d.makeSkew(e,t))}makeSkew(e,t){const r=Math.tan(e),i=Math.tan(t);return this.set([1,i,0,r,1,0,0,0,1]),this}translateX(e){return this.translate(e,0)}translateY(e){return this.translate(0,e)}translateZ(e){return this.translate(0,0,e)}translate3d(e,t,r){return this.translate(e,t,r)}translate(e,t,r=0){return this.premultiply(ve._t2d.makeTranslation(e,t,r))}makeTranslation(e,t,r=0){return this.set([1,0,e,0,1,t,0,0,1]),this}scaleX(e){return this.scale(e,1)}scaleY(e){return this.scale(1,e)}scale3d(e,t,r=1){return this.scale(e,t,r)}scale(e,t,r=1){return this.premultiply(ve._t2d.makeScale(e,t,r))}makeScale(e,t,r=1){return this.set([e,0,0,0,t,0,0,0,1]),this}rotateX(e){return this.scaleY(this._rotateToScale(e))}rotateY(e){return this.scaleX(this._rotateToScale(e))}rotateZ(e){return this.rotate(e)}rotate(e){return this.premultiply(ve._t2d.makeRotation(e))}rotate3d(e,t,r,i){const[n,o,a]=this._rotate3d(e,t,r,i);return n&&this.rotateX(n),o&&this.rotateY(o),a&&this.rotateZ(a),this}_rotateToScale(e){const t=e/Ne;return t<=.5?t*-4+1:(t-1)*4+1}_rotate3d(e,t,r,i){if(e===1&&t===0&&r===0)return[i,0,0];if(e===0&&t===1&&r===0)return[0,i,0];if(e===0&&t===0)return[0,0,i];{const n=Math.cos(i),o=Math.sin(i),a=n+e*e*(1-n),l=e*t*(1-n)-r*o,c=e*r*(1-n)+t*o,h=n+t*t*(1-n),f=t*r*(1-n)-e*o,d=n+r*r*(1-n),g=-Math.atan2(-f,h),p=-Math.atan2(c,Math.sqrt(f*f+d*d)),y=-Math.atan2(-l,a);return[g,p,y]}}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set([t,-r,0,r,t,0,0,0,1]),this}decompose(e={x:0,y:0},t={position:{x:0,y:0},scale:{x:0,y:0},skew:{x:0,y:0},rotation:0}){const{a:r,b:i,c:n,d:o,tx:a,ty:l}=this.toObject(),c=-Math.atan2(-n,o),h=Math.atan2(i,r),f=Math.abs(c+h);return f<1e-5||Math.abs(Ne-f)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=c,t.skew.y=h),t.scale.x=Math.sqrt(r*r+i*i),t.scale.y=Math.sqrt(n*n+o*o),t.position.x=a+(e.x*r+e.y*n),t.position.y=l+(e.x*i+e.y*o),t}apply(e,t){t=t||new de;const{a:r,c:i,tx:n,b:o,d:a,ty:l}=this.toObject(),c=e.x,h=e.y;return t.x=r*c+i*h+n,t.y=o*c+a*h+l,t}affineInverse(){return this.clone().affineInvert()}applyAffineInverse(e,t){t=t||new de;const{a:r,b:i,c:n,d:o,tx:a,ty:l}=this.toObject(),c=1/(r*o+n*-i),h=e.x,f=e.y;return t.x=o*c*h+-n*c*f+(l*n-a*o)*c,t.y=r*c*f+-i*c*h+(-l*r+a*i)*c,t}isIdentity(){const{a:e,b:t,c:r,d:i,tx:n,ty:o}=this.toObject();return e===1&&t===0&&r===0&&i===1&&n===0&&o===0}toObject(){const[e,t,r,i,n,o,,,a]=this._array;return{a:e,c:t,tx:r,b:i,d:n,ty:o,tz:a}}}class Ph extends et{constructor(){super(3)}}var Sh=Object.defineProperty,qo=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&Sh(e,t,i),i};class Ci extends It{_starting=!1;_nextDeltaTime=0;_startedProcess;get starting(){return this._starting}get spf(){return this.fps?Math.floor(1e3/this.fps):0}constructor(){super(),this._onNextTick=this._onNextTick.bind(this)}start(e){this._starting||(this._starting=!0,this._startedProcess&&this.off("process",this._startedProcess),this._startedProcess=e,this.on("process",e),Ce.on(this._onNextTick,{sort:0}))}stop(){this._starting&&(this._starting=!1,Ce.off(this._onNextTick,{sort:0}))}_onNextTick(){const e=Ce.elapsed*this.speed;if((this._nextDeltaTime-=e)<=0){const r=(this._nextDeltaTime=this.spf)||e;this.emit("process",r)}}destroy(){super.destroy(),this.stop()}}qo([w({fallback:60})],Ci.prototype,"fps"),qo([w({fallback:1})],Ci.prototype,"speed");class Xo{view;pixelRatio=Es;screen={x:0,y:0,width:0,height:0};related=new As;getRelated(e,t){let r=this.related.get(e);return r||(t?(this.related.set(e,r=t()),r):(console.warn("Failed to get related",e),null))}resize(e,t,r=!0){this.view&&(this.view.width=Math.floor(e*this.pixelRatio),this.view.height=Math.floor(t*this.pixelRatio)),this.screen.width=e,this.screen.height=t,r&&this.view&&(this.view.style.width=`${e}px`,this.view.style.height=`${t}px`)}}var cr=(s=>(s.NORMAL="normal",s.ADD="add",s.MULTIPLY="multiply",s.SCREEN="screen",s.NONE="none",s.NORMAL_NPM="normal_npm",s.ADD_NPM="add_npm",s.SCREEN_NPM="screen_npm",s.SRC_IN="src_in",s.SRC_OUT="src_out",s.SRC_ATOP="src_atop",s.DST_OVER="dst_over",s.DST_IN="dst_in",s.DST_OUT="dst_out",s.DST_ATOP="dst_atop",s.XOR="xor",s.SUBTRACT="subtract",s))(cr||{});function Ho(s){return{normal:[s.ONE,s.ONE_MINUS_SRC_ALPHA],add:[s.ONE,s.ONE],multiply:[s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],screen:[s.ONE,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],none:[0,0],normal_npm:[s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],add_npm:[s.SRC_ALPHA,s.ONE,s.ONE,s.ONE],screen_npm:[s.SRC_ALPHA,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],src_in:[s.DST_ALPHA,s.ZERO],src_out:[s.ONE_MINUS_DST_ALPHA,s.ZERO],src_atop:[s.DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],dst_over:[s.ONE_MINUS_DST_ALPHA,s.ONE],dst_in:[s.ZERO,s.SRC_ALPHA],dst_out:[s.ZERO,s.ONE_MINUS_SRC_ALPHA],dst_atop:[s.ONE_MINUS_DST_ALPHA,s.SRC_ALPHA],xor:[s.ONE_MINUS_DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],subtract:[s.ONE,s.ONE,s.ONE,s.ONE,s.FUNC_REVERSE_SUBTRACT,s.FUNC_ADD]}}class Ye{get gl(){return this._renderer.gl}install(e){this._renderer=e}onUpdateContext(){}flush(){}reset(){}destroy(){}}class Xt{static _properties=["blend","offsets","culling","depthTest","clockwiseFrontFace","depthMask"];static _init(){this._properties.forEach((e,t)=>{Object.defineProperty(this.prototype,e,{get(){return!!(this.bitmap&1<<t)},set(r){!!(this.bitmap&1<<t)!==r&&(this.bitmap^=1<<t)},enumerable:!0,configurable:!0})})}static for2D(){const e=new Xt;return e.depthTest=!1,e.blend=!0,e}_blendMode=cr.NORMAL;_polygonOffset=0;bitmap=0;get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==cr.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}constructor(e){if(e)for(const t in e)this[t]=e[t]}}Xt._init();class Yo extends Ye{install(e){super.install(e),e.state=this}_blendEq=!1;_setters=Xt._properties.map(e=>this[`set${e.replace(/^\S/,t=>t.toUpperCase())}`]);boundStateBitmap=0;boundBlendMode;blendModes;defaultState=new Xt({blend:!0});onUpdateContext(){super.onUpdateContext(),this.blendModes=Ho(this._renderer.gl)}toggle(e,t){this._renderer.gl[t?"enable":"disable"](e)}setBlend(e){this.toggle(this._renderer.gl.BLEND,e)}setOffsets(e){this.toggle(this._renderer.gl.POLYGON_OFFSET_FILL,e)}setCulling(e){this.toggle(this._renderer.gl.CULL_FACE,e)}setDepthTest(e){this.toggle(this._renderer.gl.DEPTH_TEST,e)}setDepthMask(e){this._renderer.gl.depthMask(e)}setClockwiseFrontFace(e){const t=this._renderer.gl;t.frontFace(t[e?"CW":"CCW"])}setBlendMode(e){if(e===this.boundBlendMode)return;this.boundBlendMode=e;const t=this.blendModes[e],r=this._renderer.gl;t.length===2?r.blendFunc(t[0],t[1]):r.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,r.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(e,t){this._renderer.gl.polygonOffset(e,t)}bind(e){if(this.boundStateBitmap!==e.bitmap){let t=this.boundStateBitmap^e.bitmap,r=0;for(;t;)t&1&&this._setters[r]?.call(this,!!(e.bitmap&1<<r)),t=t>>1,r++;this.boundStateBitmap=e.bitmap}e.blend&&this.setBlendMode(e.blendMode),e.offsets&&this.setPolygonOffset(1,e.polygonOffset)}reset(){super.reset();const e=this._renderer.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),this.bind(this.defaultState),this._blendEq=!0,this.setBlendMode(cr.NORMAL)}}class Ko extends Ye{install(e){super.install(e),e.batch2D=this}_state=Xt.for2D();_batchSize=4096*4;_drawCallUid=0;_defaultModulate=[255,255,255,255];_defaultBackgroundColor=[0,0,0,0];_batchables=[];_vertexCount=0;_indexCount=0;_attributeBuffer=[];_indexBuffers=[];_shaders=new Map;_attributes={aTextureId:{size:1,normalized:!0,type:"float"},aPosition:{size:2,normalized:!1,type:"float"},aUv:{size:2,normalized:!1,type:"float"},aModulate:{size:4,normalized:!0,type:"unsigned_byte"},aBackgroundColor:{size:4,normalized:!0,type:"unsigned_byte"},aDisableWrapMode:{size:1,normalized:!0,type:"float"}};_vertexSize=8;_getShader(e){let t=this._shaders.get(e);return t||this._shaders.set(e,t=this._createShader(e)),t}_createShader(e){const t=this._renderer,r=t.program.create({vert:`precision highp float;
|
|
2
|
+
`;function ah(s){return nh.test(s)}function vs(s){const e=[];function t(){return e[e.length-1]}function r(a,l,c){const h=a?xi(a):{},f=l?ct(l):void 0,d=c?wi(c):void 0,g=Ve({...h,fill:f,outline:d,fragments:[]});return e[e.length-1]?.fragments.length===0?e[e.length-1]=g:e.push(g),g}function i(a="",l,c,h){const f=l?xi(l):{},d=c?ct(c):void 0,g=h?wi(h):void 0;Array.from(a).forEach(p=>{if(ah(p)){const{fragments:y,fill:m,outline:P,...E}=t()||r();y.length||y.push(Ve({...f,fill:d,outline:g,content:oh})),r(E,m,P)}else{const y=t()||r(),m=y.fragments[y.fragments.length-1];if(m){const{content:P,fill:E,outline:x,...S}=m;if(ps(d,E)&&ps(g,x)&&ps(f,S)){m.content=`${P}${p}`;return}}y.fragments.push(Ve({...f,fill:d,outline:g,content:p}))}})}(Array.isArray(s)?s:[s]).forEach(a=>{if(typeof a=="string")r(),i(a);else if(bo(a)){const{content:l,fill:c,outline:h,...f}=a;r(f,c,h),i(l)}else if(lh(a)){const{fragments:l,fill:c,outline:h,...f}=a;r(f,c,h),l.forEach(d=>{const{content:g,fill:p,outline:y,...m}=d;i(g,m,p,y)})}else Array.isArray(a)?(r(),a.forEach(l=>{if(typeof l=="string")i(l);else if(bo(l)){const{content:c,fill:h,outline:f,...d}=l;i(c,d,h,f)}})):console.warn("Failed to parse text content",a)});const o=t();return o&&!o.fragments.length&&o.fragments.push({content:""}),e}function lh(s){return s&&typeof s=="object"&&"fragments"in s&&Array.isArray(s.fragments)}function bo(s){return s&&typeof s=="object"&&"content"in s&&typeof s.content=="string"}function wo(s){return typeof s=="string"||Array.isArray(s)?{content:vs(s)}:Ve({...s,content:vs(s.content??""),style:s.style?xi(s.style):void 0,effects:s.effects?s.effects.map(e=>xi(e)):void 0,measureDom:s.measureDom,fonts:s.fonts,fill:s.fill?ct(s.fill):void 0,outline:s.outline?wi(s.outline):void 0})}const Pi=new Map;function W(s,e){return function(t){Object.defineProperty(t.prototype,"is",{value:s,enumerable:!0,configurable:!0}),e&&Object.keys(e).forEach(r=>{yi(t,r,{fallback:e[r]})}),Pi.set(s,t)}}function ch(s="node",e={}){const t=Pi.get(s);if(!t)throw new Error(`Failed to createNode, tag: ${s}`);return new t().setProperties(e)}class Ce{static _queue=[];static _currentTime=0;static _elapsed=0;static _requestId;static get currentTime(){return this._currentTime}static get elapsed(){return this._elapsed}static on(e,t={}){const{sort:r=0,once:i=!1}=t;this._queue[r]||(this._queue[r]=[]),this._queue[r].push({cb:e,once:i})}static off(e,t={}){const{sort:r=0}=t,i=this._queue[r];if(!i)return;const n=[];for(let o=i.length,a=0;a<o;a++){const l=i[a];l.cb!==e&&n.push(l)}n.length?this._queue[r]=n:this._queue.splice(r,1)}static start(){"requestAnimationFrame"in globalThis&&(this._currentTime=performance.now(),this._requestId=requestAnimationFrame(e=>this._update(e)))}static stop(){this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=void 0)}static _update(e){this._elapsed=e-this._currentTime,this._currentTime=e,this._requestId=requestAnimationFrame(t=>this._update(t)),this._performUpdate()}static _performUpdate(){const e=this._queue,t=[];for(let r=e.length,i=r;i>=0;i--){const n=e[i];if(!n)continue;const o=[];for(let a=n.length,l=0;l<a;l++){const c=n[l];try{c.cb()}catch(h){console.warn(h)}c.once||o.push(c)}o.length&&(t[i]=o)}this._queue=t}}Ce.start();async function bs(s){return new Promise(e=>{Ce.on(()=>{s?.(),e()},{sort:1,once:!0})})}const Si=Math.PI,Ne=Si*2;let hh=0;function xo(s){return s?.__SPECTOR_Object_TAG?.id??++hh}function ws(s){return!(s&s-1)&&!!s}const uh=/([\w-]+)\((.+?)\)/g,fh=/[^,]+/g,dh=/([-e.\d]+)(.*)/;function xs(s){return Array.isArray(s)?s.map(e=>({name:e.name,args:e.args.map(t=>({...t,normalizedIntValue:t.normalizedDefaultIntValue}))})):{...s,normalizedIntValue:s.normalizedDefaultIntValue}}function Ar(s,e,t={}){const r=Or(e,t);return r.length?r:Po(s,e,t)}function Or(s,e={}){const t=[];let r;for(;(r=uh.exec(s))!==null;){const[,i,n]=r;i&&t.push({name:i,args:ph(i,n,e)})}return t}function ph(s,e,t={}){const r=[];let i,n=0;for(;(i=fh.exec(e))!==null;)r.push(Po(s,i[0],{...t,index:n++}));return r}function Po(s,e,t={}){const{width:r=1,height:i=1,index:n=0}=t,o=e.match(dh),a={unit:o?.[2]??null,value:e,intValue:Number(o?.[1]),normalizedIntValue:0,normalizedDefaultIntValue:0};switch(s){case"scale":case"scaleX":case"scaleY":case"scale3d":a.normalizedDefaultIntValue=1;break}switch(a.unit){case"%":a.normalizedIntValue=a.intValue/100;break;case"rad":a.normalizedIntValue=a.intValue/Ne;break;case"deg":a.normalizedIntValue=a.intValue/360;break;case"px":switch(n){case 0:a.normalizedIntValue=a.intValue/r;break;case 1:a.normalizedIntValue=a.intValue/i;break}break;case"turn":case"em":case"rem":default:a.normalizedIntValue=a.intValue;break}return a}const So="WebGL2RenderingContext"in globalThis,Co="ImageBitmap"in globalThis,To="ResizeObserver"in globalThis,lr="PointerEvent"in globalThis,Eo="WheelEvent"in globalThis,gh="MouseEvent"in globalThis,Pt="ontouchstart"in globalThis,Mo="onclick"in globalThis,Ps="createImageBitmap"in globalThis,Ss="AudioContext"in globalThis,Cs="webkitAudioContext"in globalThis,Ts="OfflineAudioContext"in globalThis,Ao="webkitOfflineAudioContext"in globalThis,Oo=Ss||Cs,kr=typeof window<"u",Es=globalThis.devicePixelRatio||1,Ms=s=>s!==null&&typeof s=="object"&&s.nodeType===1,ko=s=>Ms(s)&&s.tagName==="VIDEO",mh=s=>Ms(s)&&s.tagName==="IMG";function Do(s){return typeof s=="object"&&s!==null&&s.nodeType===1&&s.tagName==="CANVAS"}function Io(s){return So&&s instanceof globalThis.WebGL2RenderingContext}function Ro(){if(kr)return globalThis.document.createElement("canvas")}function Uo(s,e=globalThis.location){if(s.startsWith("data:"))return"";e=e||globalThis.location;const t=new URL(s,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}function Bo(s,e,t){t===null&&!e.startsWith("data:")?s.crossOrigin=Uo(e):t!==!1&&(s.crossOrigin=typeof t=="string"?t:"anonymous")}class As{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const t=e.__v_raw;t&&(e=this._toRaw(t))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,t){return this._map.set(this._toRaw(e),this._toRaw(t)),this}}class Dr{cursor;bubbles=!1;cancelBubble=!1;cancelable=!1;composed=!1;defaultPrevented=!1;eventPhase=Dr.prototype.NONE;isTrusted=!1;timeStamp=0;type="";composedPath(){return this.path}initEvent(...e){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){"preventDefault"in this.nativeEvent&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}propagationImmediatelyStopped=!1;stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}propagationStopped=!1;stopPropagation(){"stopPropagation"in this.nativeEvent&&this.nativeEvent.stopPropagation(),this.propagationStopped=!0}NONE=0;CAPTURING_PHASE=1;AT_TARGET=2;BUBBLING_PHASE=3;initUIEvent(...e){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}}class Lo extends Dr{getModifierState(...e){throw new Error("getModifierState() is a legacy DOM API. It is not implemented in the Federated Events API.")}initKeyboardEvent(...e){throw new Error("initKeyboardEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}}class Os extends Dr{client={x:0,y:0};get clientX(){return this.client.x}get clientY(){return this.client.y}layer={x:0,y:0};get layerX(){return this.layer.x}get layerY(){return this.layer.y}movement={x:0,y:0};get movementX(){return this.movement.x}get movementY(){return this.movement.y}offset={x:0,y:0};get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}page={x:0,y:0};get pageX(){return this.page.x}get pageY(){return this.page.y}screen={x:0,y:0};get screenX(){return this.screen.x}get screenY(){return this.screen.y}get x(){return this.clientX}get y(){return this.clientY}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(...e){throw new Error("Method not implemented.")}global={x:0,y:0};get globalX(){return this.global.x}get globalY(){return this.global.y}}class No extends Os{width=0;height=0;isPrimary=!1;getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Fo extends Os{static DOM_DELTA_PIXEL=0;DOM_DELTA_PIXEL=0;static DOM_DELTA_LINE=1;DOM_DELTA_LINE=1;static DOM_DELTA_PAGE=2;DOM_DELTA_PAGE=2}const yh={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class $o extends Dt{event;target;cursor="default";cursorStyles={default:"inherit",pointer:"pointer"};setuped=!1;enableMoveEvent=!0;enableWheelEvent=!0;enableClickEvent=!0;setTarget(e){this.removeEventListeners(),this.target=e,this.addEventListeners()}removeEventListeners(){if(!this.setuped||!this.target)return;const e=this.target.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):lr&&(e.touchAction=""),lr?(this.target.removeEventListener("pointerdown",this._onPointerDown),this.target.removeEventListener("pointerleave",this._onPointerOver),this.target.removeEventListener("pointerover",this._onPointerOver),this.target.removeEventListener("pointermove",this._onPointerMove),this.target.removeEventListener("pointerup",this._onPointerUp)):(this.target.removeEventListener("mousedown",this._onPointerDown),this.target.removeEventListener("mouseout",this._onPointerOver),this.target.removeEventListener("mouseover",this._onPointerOver),this.target.removeEventListener("mousemove",this._onPointerMove),this.target.removeEventListener("mouseup",this._onPointerUp)),Pt&&(this.target.removeEventListener("touchstart",this._onPointerDown),this.target.removeEventListener("touchmove",this._onPointerMove),this.target.removeEventListener("touchend",this._onPointerUp)),this.target.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keypress",this._onKeyPress),document.removeEventListener("keyup",this._onKeyUp),this.target=void 0,this.setuped=!1}addEventListeners(){if(this.setuped||!this.target)return;const e=this.target.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):lr&&(e.touchAction="none")),lr?(this.target.addEventListener("pointerdown",this._onPointerDown),this.target.addEventListener("pointerleave",this._onPointerOver),this.target.addEventListener("pointerover",this._onPointerOver),this.target.addEventListener("pointermove",this._onPointerMove),this.target.addEventListener("pointerup",this._onPointerUp)):(this.target.addEventListener("mousedown",this._onPointerDown),this.target.addEventListener("mouseout",this._onPointerOver),this.target.addEventListener("mouseover",this._onPointerOver),this.target.addEventListener("mousemove",this._onPointerMove),this.target.addEventListener("mouseup",this._onPointerUp)),Pt&&(this.target.addEventListener("touchstart",this._onPointerDown),this.target.addEventListener("touchmove",this._onPointerMove),this.target.addEventListener("touchend",this._onPointerUp)),this.target.addEventListener("wheel",this._onWheel),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("keypress",this._onKeyPress),document.addEventListener("keyup",this._onKeyUp),this.setuped=!0}normalize(e){const t=[];if(Pt&&e instanceof globalThis.TouchEvent)for(let r=0,i=e.changedTouches.length;r<i;r++){const n=e.changedTouches[r];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.type=e.type,t.push(n)}else if(Eo&&e instanceof globalThis.WheelEvent)t.push(e);else if(lr&&e instanceof globalThis.PointerEvent)t.push(e);else{const r=e;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=1),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),t.push(r)}return t}_clonePointerEvent(e){const t=new No;return t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,t.isTrusted=e.isTrusted,this._copyMouseEvent(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.x=t.screen.x,t.global.y=t.screen.y,t.offset.x=t.screen.x,t.offset.y=t.screen.y,t.type==="pointerleave"?t.type="pointerout":t.type.startsWith("mouse")?t.type=t.type.replace("mouse","pointer"):t.type.startsWith("touch")&&(t.type=yh[t.type]||t.type),t}_copyInputEvent(e,t){e.nativeEvent=t,e.bubbles=t.bubbles,e.cancelBubble=t.cancelBubble,e.cancelable=t.cancelable,e.composed=t.composed,e.currentTarget=t.currentTarget,e.defaultPrevented=t.defaultPrevented,e.eventPhase=t.eventPhase,e.isTrusted=t.isTrusted,e.returnValue=t.returnValue,e.srcElement=t.srcElement,e.timeStamp=t.timeStamp,e.type=t.type}_copyMouseEvent(e,t){this._copyInputEvent(e,t),e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}_cloneWheelEvent(e){const t=new Fo;return this._copyMouseEvent(t,e),t.wheelDeltaY=e.wheelDeltaY,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.x=t.screen.x,t.global.y=t.screen.y,t.offset.x=t.screen.x,t.offset.y=t.screen.y,t}_cloneKeyboardEvent(e){const t=new Lo;return this._copyInputEvent(t,e),t.altKey=e.altKey,t.charCode=e.charCode,t.code=e.code,t.ctrlKey=e.ctrlKey,t.isComposing=e.isComposing,t.key=e.key,t.keyCode=e.keyCode,t.location=e.location,t.metaKey=e.metaKey,t.repeat=e.repeat,t.shiftKey=e.shiftKey,t}setCursor(e="default"){if(!this.target||this.cursor===e)return;this.cursor=e;const t=!(globalThis.OffscreenCanvas&&this.target instanceof OffscreenCanvas),r=this.cursorStyles[e];if(r)switch(typeof r){case"string":t&&(this.target.style.cursor=r);break;case"function":r(e);break;case"object":t&&Object.assign(this.target.style,r);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.target.style.cursor=e)}mapPositionToPoint(e,t,r){if(!this.target)return;const i=this.target.isConnected?this.target.getBoundingClientRect():void 0,n=Number(this.target.getAttribute("data-pixel-ratio"))||1,o=Number(this.target.getAttribute("width"))||(i?i.width*n:0),a=Number(this.target.getAttribute("height"))||(i?i.height*n:0),l=i??{width:o,height:a,left:0,top:0},c=1/n;e.x=(t-l.left)*(o/l.width)*c,e.y=(r-l.top)*(a/l.height)*c}_onKeyDown=e=>{const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("keydown",this.event=this._cloneKeyboardEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onKeyPress=e=>{const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("keypress",this.event=this._cloneKeyboardEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onKeyUp=e=>{const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("keyup",this.event=this._cloneKeyboardEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onPointerDown=e=>{if(Pt&&e.pointerType==="touch")return;const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("pointerdown",this.event=this._clonePointerEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onPointerOver=e=>{if(!this.enableClickEvent||Pt&&e.pointerType==="touch")return;const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("pointerover",this.event=this._clonePointerEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onPointerMove=e=>{if(!this.enableMoveEvent||Pt&&e.pointerType==="touch")return;const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("pointermove",this.event=this._clonePointerEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)};_onPointerUp=e=>{if(!this.enableClickEvent||Pt&&e.pointerType==="touch")return;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const r=t!==this.target?"outside":"",i=this.normalize(e);for(let n=0,o=i.length;n<o;n++){const a=this._clonePointerEvent(i[n]);a.type+=r,this.emit("pointerup",this.event=a)}this.event?.cursor&&this.setCursor(this.event.cursor)};_onWheel=e=>{if(!this.enableWheelEvent)return;const t=this.normalize(e);for(let r=0,i=t.length;r<i;r++)this.emit("wheel",this.event=this._cloneWheelEvent(t[r]));this.event?.cursor&&this.setCursor(this.event.cursor)}}let _h=0;class It extends fo{instanceId=++_h;get json(){return this.toJSON()}set json(e){this.setProperties(e)}_nextTick(){return bs()}equal(e){return!!(e&&this.instanceId===e.instanceId)}}class zo extends It{}class St extends zo{}function vh(s,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var i in t)r[t[i]]=i;var n={};s.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(o?.closest){var h=this.toRgb(),f=1/0,d="black";if(!n.length)for(var g in t)n[g]=new s(t[g]).toRgb();for(var p in t){var y=(a=h,l=n[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));y<f&&(f=y,d=p)}return d}},e.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":t[a];return l?new s(l).toRgb():null},"name"])}xc([vh]);class Qe{get value(){return this._value}set value(e){this._colord=ys(e??"none")}get r8(){return this._colord.rgba.r}get g8(){return this._colord.rgba.g}get b8(){return this._colord.rgba.b}get a8(){return this._colord.rgba.a*255&255}get r(){return this.r8/255}get g(){return this.g8/255}get b(){return this.b8/255}get a(){return this._colord.rgba.a}get rgb(){return(this.r8<<16)+(this.g8<<8)+this.b8}get bgr(){return(this.b8<<16)+(this.g8<<8)+this.r8}get abgr(){return(this.a8<<24)+this.bgr}constructor(e=0){this.value=e}toHex(){return this._colord.toHex()}toRgb(){return this._colord.toRgb()}toRgbString(){return this._colord.toRgbString()}toHsl(){return this._colord.toHsl()}toHslString(){return this._colord.toHslString()}toHsv(){return this._colord.toHsv()}toArgb(e=this.a,t=!0){if(e===1)return(255<<24)+this.rgb;if(e===0)return t?0:this.rgb;let r=this.r8,i=this.g8,n=this.b8;return t&&(r=r*e+.5|0,i=i*e+.5|0,n=n*e+.5|0),(e*255<<24)+(r<<16)+(i<<8)+n}toInt8Array(){return[this.r8,this.g8,this.b8,this.a8]}toArray(){return[this.r,this.g,this.b,this.a]}}class et extends Dt{constructor(e){super(),this.dim=e}_array=[];get length(){return this.dim}operate(e,t,r){const{dim:i,_array:n}=this;let o;typeof t=="number"?o=Array.from({length:i},()=>t):t instanceof ht||t instanceof et?o=t.toArray():o=t;let a,l=[];if(r?r instanceof et?a=r:l=r:a=this,t instanceof ht){const{cols:c}=t;switch(e){case"*":for(let h=0;h<i;h++){let f=0;for(let d=0;d<i;d++)f+=n[h]*o[d*c+h];l[h]=f}break;default:throw new Error(`Not support operator in '${this.toName()} ${e} ${t.toName()}'`)}}else switch(e){case"+":for(let c=0;c<i;c++)l[c]=n[c]+o[c];break;case"-":for(let c=0;c<i;c++)l[c]=n[c]-o[c];break;case"*":for(let c=0;c<i;c++)l[c]=n[c]*o[c];break;case"/":for(let c=0;c<i;c++)l[c]=n[c]/o[c];break;case"rot":{const c=Math.cos(o[0]),h=Math.sin(o[0]);l[0]=n[0]*c-n[1]*h,l[1]=n[1]*c+n[0]*h;break}case"==":{let c=!0;for(let h=0;h<i;h++)c=c&&n[h]===o[h];return c}case"=":for(let c=0;c<i;c++){const h=o[c];h!==void 0&&(n[c]=h)}return this._onUpdate(n),this.emit("update",n),this;default:throw new Error(`Not support operator in '${this.toName()} ${e} Vector'`)}return a?.set(l)??l}add(e,...t){return t.length&&typeof e=="number"&&(e=[e,...t]),this.operate("+",e)}sub(e,...t){return t.length&&typeof e=="number"&&(e=[e,...t]),this.operate("-",e)}multiply(e,...t){return t.length&&typeof e=="number"&&(e=[e,...t]),this.operate("*",e)}divide(e,...t){return t.length&&typeof e=="number"&&(e=[e,...t]),this.operate("/",e)}rotate(e){return this.operate("rot",e)}set(e,...t){return t.length&&typeof e=="number"&&(e=[e,...t]),this.operate("=",e)}equals(e){return this.operate("==",e)}copy(e){return this.set(e)}clone(){const e=new this.constructor;return e.set(this.toArray()),e}_onUpdate(e){}toName(){return`Vector${this.dim}`}toArray(){return this._array.slice()}toJSON(){return this.toArray()}}class ht extends Dt{constructor(e,t,r){super(),this.rows=e,this.cols=t,r?this.set(r):this.identity()}_array=[];dirtyId=0;get length(){return this.cols*this.rows}operate(e,t,r){const{cols:i,rows:n,length:o,_array:a}=this;let l;typeof t=="number"?l=Array.from({length:o},()=>t):t instanceof et||t instanceof ht?l=t.toArray():l=t;let c,h=[];if(r?r instanceof et||r instanceof ht?c=r:h=r:t instanceof et?c=new t.constructor:c=this,t instanceof et){const{dim:f}=t;switch(e){case"*":for(let d=0;d<f;d++){let g=0;for(let p=0;p<i;p++)p<f&&(g+=a[d*i+p]*(l[p]??0));h[d]=g}break;default:throw new Error(`Not support operator in '${this.toName()} ${e} ${t.toName()}'`)}}else switch(e){case"*":for(let f=0;f<i;f++)for(let d=0;d<n;d++){const g=d*i;let p=0;for(let y=0;y<n;y++){const m=g+y,P=y*i+f;p+=a[m]*(l[P]??0)}h[g+f]=p}break;case"=":for(let f=0;f<o;f++){const d=l[f];d!==void 0&&(a[f]=d)}return this._onUpdate(a),this.emit("update",a),this;default:throw new Error(`Not support operator in '${this.toName()} ${e} Matrix2'`)}return c?.set(h)??h}identity(){const{cols:e,rows:t}=this,r=[];for(let i=0;i<e;i++)for(let n=0;n<t;n++){const o=n*e,a=i+o;r[a]=n+o===a?1:0}return this.set(r)}set(e){return this.operate("=",e)}copy(e){return this.set(e)}clone(){const e=new this.constructor;return e.set(this.toArray()),e}multiply(e,t){return this.operate("*",e,t)}_onUpdate(e){this.dirtyId++}toArray(e=!1){const{cols:t,rows:r,_array:i}=this;if(e){const n=[];for(let o=0;o<r;o++)for(let a=0;a<t;a++)n[o+a*t]=i[a+o*t];return n}return i.slice()}toName(){return`Matrix${this.rows}(${this.rows}x${this.cols})`}toJSON(){return this._array.slice()}}class Vo extends ht{constructor(e){super(4,4,e)}}const Go=Si/180,bh=180/Si;function Ge(s,e,t){return Math.max(e,Math.min(s,t))}function he(s,e,t){return(1-t)*s+t*e}const wh={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(s,e=20){if(!this.adaptive||!s||Number.isNaN(s))return e;let t=Math.ceil(s/this.maxLength);return t<this.minSegments?t=this.minSegments:t>this.maxSegments&&(t=this.maxSegments),t}};class jo extends et{constructor(e=0,t=0,r=0,i=0){super(4),this.set(e,t,r,i)}}class ks extends ht{constructor(e){super(4,5,e)}hueRotate(e=0){const t=Math.sin(e),r=Math.cos(e),i=.213,n=.715,o=.072;return this.multiply([i+r*(1-i)+t*-i,n+r*-n+t*-n,o+r*-o+t*(1-o),0,0,i+r*-i+t*.143,n+r*(1-n)+t*.14,o+r*-o+t*-.283,0,0,i+r*-i+t*-.787,n+r*-n+t*n,o+r*(1-o)+t*o,0,0,0,0,0,1,0])}saturate(e=1){const t=(e-1)*2/3+1,r=(t-1)*-.5;return this.multiply([t,r,r,0,0,r,t,r,0,0,r,r,t,0,0,0,0,0,1,0])}brightness(e=1){const t=e;return this.multiply([t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0])}contrast(e=1){const t=e,r=-128*(t-1);return this.multiply([t,0,0,0,r,0,t,0,0,r,0,0,t,0,r,0,0,0,1,0])}invert(e=1){const t=he(1,-1,e),r=he(0,255,e);return this.multiply([t,0,0,0,r,0,t,0,0,r,0,0,t,0,r,0,0,0,1,0])}sepia(e=1){const t=Ge(e,0,1);return this.multiply([he(1,.393,t),he(0,.7689999,t),he(0,.18899999,t),0,0,he(0,.349,t),he(1,.6859999,t),he(0,.16799999,t),0,0,he(0,.272,t),he(0,.5339999,t),he(1,.13099999,t),0,0,0,0,0,1,0])}opacity(e=1){return this.multiply([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,e,0])}grayscale(e=1){const t=Ge(e,0,1),r=he(1,.3,t),i=he(0,.3,t),n=he(1,.59,t),o=he(0,.59,t),a=he(1,.11,t),l=he(0,.11,t);return this.multiply([r,o,l,0,0,i,n,l,0,0,i,o,a,0,0,0,0,0,1,0])}multiply(e){const t=e,r=this._array;return this.set([r[0]*t[0]+r[1]*t[5]+r[2]*t[10]+r[3]*t[15],r[0]*t[1]+r[1]*t[6]+r[2]*t[11]+r[3]*t[16],r[0]*t[2]+r[1]*t[7]+r[2]*t[12]+r[3]*t[17],r[0]*t[3]+r[1]*t[8]+r[2]*t[13]+r[3]*t[18],r[0]*t[4]+r[1]*t[9]+r[2]*t[14]+r[3]*t[19]+r[4],r[5]*t[0]+r[6]*t[5]+r[7]*t[10]+r[8]*t[15],r[5]*t[1]+r[6]*t[6]+r[7]*t[11]+r[8]*t[16],r[5]*t[2]+r[6]*t[7]+r[7]*t[12]+r[8]*t[17],r[5]*t[3]+r[6]*t[8]+r[7]*t[13]+r[8]*t[18],r[5]*t[4]+r[6]*t[9]+r[7]*t[14]+r[8]*t[19]+r[9],r[10]*t[0]+r[11]*t[5]+r[12]*t[10]+r[13]*t[15],r[10]*t[1]+r[11]*t[6]+r[12]*t[11]+r[13]*t[16],r[10]*t[2]+r[11]*t[7]+r[12]*t[12]+r[13]*t[17],r[10]*t[3]+r[11]*t[8]+r[12]*t[13]+r[13]*t[18],r[10]*t[4]+r[11]*t[9]+r[12]*t[14]+r[13]*t[19]+r[14],r[15]*t[0]+r[16]*t[5]+r[17]*t[10]+r[18]*t[15],r[15]*t[1]+r[16]*t[6]+r[17]*t[11]+r[18]*t[16],r[15]*t[2]+r[16]*t[7]+r[17]*t[12]+r[18]*t[17],r[15]*t[3]+r[16]*t[8]+r[17]*t[13]+r[18]*t[18],r[15]*t[4]+r[16]*t[9]+r[17]*t[14]+r[18]*t[19]+r[19]])}toMatrix4(){const e=this._array;return new Vo([e[0],e[1],e[2],e[3],e[5],e[6],e[7],e[8],e[10],e[11],e[12],e[13],e[15],e[16],e[17],e[18]])}toVector4(){const e=this._array;return new jo(e[4]/255,e[9]/255,e[14]/255,e[19]/255)}}class xh extends ht{constructor(e){super(2,2,e)}}let Ds=class extends ht{constructor(e){super(3,3,e)}affineInvert(){const[e,t,r,i,n,o,a,l,c]=this._array,h=c*n-o*l,f=o*a-c*i,d=l*i-n*a,g=e*h+t*f+r*d;if(g===0)return this.set([0,0,0,0,0,0,0,0,0]);const p=1/g;return this.set([h*p,(r*l-c*t)*p,(o*t-r*n)*p,f*p,(c*e-r*a)*p,(r*i-o*e)*p,d*p,(t*a-l*e)*p,(n*e-t*i)*p])}};class Wo extends Ds{constructor(e=0,t=0,r=0,i=0,n=!1){super(),this._x=e,this._y=t,this._width=r,this._height=i,this._flipY=n,this._performUpdateArray()}flipY(e){return this._flipY!==e&&(this._flipY=e,this._performUpdateArray()),this}translate(e,t){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._performUpdateArray()),this}resize(e,t){return(this._width!==e||this._height!==t)&&(this._width=e,this._height=t,this._performUpdateArray()),this}_performUpdateArray(){const e=this._width,t=this._height;if(!e||!t)return;const r=this._x,i=this._y,n=this._flipY?-1:1,o=1/e*2,a=n*(1/t*2),l=-1-r*o,c=-n-i*a;this.set([o,0,l,0,a,c,0,0,1])}}let de=class hc extends et{get x(){return this._array[0]}set x(e){const[t,r]=this._array;t!==e&&this.set(e,r)}get y(){return this._array[1]}set y(e){const[t,r]=this._array;r!==e&&this.set(t,e)}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}get left(){return this.x}set left(e){this.x=e}get top(){return this.y}set top(e){this.y=e}constructor(e=0,t){super(2),this.set(typeof e=="number"?[e,t??e]:e)}update(e,t){const[r,i]=this._array;return(r!==e||i!==t)&&this.set(e,t),this}getLength(){const[e,t]=this._array;return Math.sqrt(e*e+t*t)}getAngle(){const[e,t]=this._array;return Math.atan2(-e,-t)+Math.PI}distanceTo(e){return Math.hypot(e.x-this.x,e.y-this.y)}normalize(){const[e,t]=this._array,r=1/(this.getLength()||1);return this.set(e*r,t*r),this}static lerp(e,t,r){return new hc(t).clone().sub(e).multiply(r).add(e)}};class Rt{get x(){return this.position.x}get y(){return this.position.y}get left(){return this.position.x}get top(){return this.position.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get width(){return this.size.x}get height(){return this.size.y}end=new de;position;size;constructor(...e){const t=new de,r=new de;switch(e.length){case 0:break;case 1:{const i=e[0];if(i instanceof Rt)t.set(i.position),r.set(i.size);else{const n=i.map(f=>f.x),o=i.map(f=>f.y),a=Math.min(...n),l=Math.max(...n),c=Math.min(...o),h=Math.max(...o);t.set(a,c),r.set(l-a,h-c)}break}case 2:t.set(e[0]),r.set(e[1]);break;default:t.set(e[0],e[1]),r.set(e[2],e[3]);break}this.update=this.update.bind(this),this.position=t.on("update",this.update),this.size=r.on("update",this.update),this.update()}update(){return this.end.set(this.position.x+this.size.x,this.position.y+this.size.y),this}toMinmax(){return{minX:this.position.x,minY:this.position.y,maxX:this.end.x,maxY:this.end.y}}toArray(){return[this.x,this.y,this.width,this.height]}toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height}}}class ve extends Ds{static _t2d=new ve;premultiply(e){return e.multiply(this,this)}skewX(e){return this.skew(e,0)}skewY(e){return this.skew(0,e)}skew(e,t){return this.premultiply(ve._t2d.makeSkew(e,t))}makeSkew(e,t){const r=Math.tan(e),i=Math.tan(t);return this.set([1,i,0,r,1,0,0,0,1]),this}translateX(e){return this.translate(e,0)}translateY(e){return this.translate(0,e)}translateZ(e){return this.translate(0,0,e)}translate3d(e,t,r){return this.translate(e,t,r)}translate(e,t,r=0){return this.premultiply(ve._t2d.makeTranslation(e,t,r))}makeTranslation(e,t,r=0){return this.set([1,0,e,0,1,t,0,0,1]),this}scaleX(e){return this.scale(e,1)}scaleY(e){return this.scale(1,e)}scale3d(e,t,r=1){return this.scale(e,t,r)}scale(e,t,r=1){return this.premultiply(ve._t2d.makeScale(e,t,r))}makeScale(e,t,r=1){return this.set([e,0,0,0,t,0,0,0,1]),this}rotateX(e){return this.scaleY(this._rotateToScale(e))}rotateY(e){return this.scaleX(this._rotateToScale(e))}rotateZ(e){return this.rotate(e)}rotate(e){return this.premultiply(ve._t2d.makeRotation(e))}rotate3d(e,t,r,i){const[n,o,a]=this._rotate3d(e,t,r,i);return n&&this.rotateX(n),o&&this.rotateY(o),a&&this.rotateZ(a),this}_rotateToScale(e){const t=e/Ne;return t<=.5?t*-4+1:(t-1)*4+1}_rotate3d(e,t,r,i){if(e===1&&t===0&&r===0)return[i,0,0];if(e===0&&t===1&&r===0)return[0,i,0];if(e===0&&t===0)return[0,0,i];{const n=Math.cos(i),o=Math.sin(i),a=n+e*e*(1-n),l=e*t*(1-n)-r*o,c=e*r*(1-n)+t*o,h=n+t*t*(1-n),f=t*r*(1-n)-e*o,d=n+r*r*(1-n),g=-Math.atan2(-f,h),p=-Math.atan2(c,Math.sqrt(f*f+d*d)),y=-Math.atan2(-l,a);return[g,p,y]}}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set([t,-r,0,r,t,0,0,0,1]),this}decompose(e={x:0,y:0},t={position:{x:0,y:0},scale:{x:0,y:0},skew:{x:0,y:0},rotation:0}){const{a:r,b:i,c:n,d:o,tx:a,ty:l}=this.toObject(),c=-Math.atan2(-n,o),h=Math.atan2(i,r),f=Math.abs(c+h);return f<1e-5||Math.abs(Ne-f)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=c,t.skew.y=h),t.scale.x=Math.sqrt(r*r+i*i),t.scale.y=Math.sqrt(n*n+o*o),t.position.x=a+(e.x*r+e.y*n),t.position.y=l+(e.x*i+e.y*o),t}apply(e,t){t=t||new de;const{a:r,c:i,tx:n,b:o,d:a,ty:l}=this.toObject(),c=e.x,h=e.y;return t.x=r*c+i*h+n,t.y=o*c+a*h+l,t}affineInverse(){return this.clone().affineInvert()}applyAffineInverse(e,t){t=t||new de;const{a:r,b:i,c:n,d:o,tx:a,ty:l}=this.toObject(),c=1/(r*o+n*-i),h=e.x,f=e.y;return t.x=o*c*h+-n*c*f+(l*n-a*o)*c,t.y=r*c*f+-i*c*h+(-l*r+a*i)*c,t}isIdentity(){const{a:e,b:t,c:r,d:i,tx:n,ty:o}=this.toObject();return e===1&&t===0&&r===0&&i===1&&n===0&&o===0}toObject(){const[e,t,r,i,n,o,,,a]=this._array;return{a:e,c:t,tx:r,b:i,d:n,ty:o,tz:a}}}class Ph extends et{constructor(){super(3)}}var Sh=Object.defineProperty,qo=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&Sh(e,t,i),i};class Ci extends It{_starting=!1;_nextDeltaTime=0;_startedProcess;get starting(){return this._starting}get spf(){return this.fps?Math.floor(1e3/this.fps):0}constructor(){super(),this._onNextTick=this._onNextTick.bind(this)}start(e){this._starting||(this._starting=!0,this._startedProcess&&this.off("process",this._startedProcess),this._startedProcess=e,this.on("process",e),Ce.on(this._onNextTick,{sort:0}))}stop(){this._starting&&(this._starting=!1,Ce.off(this._onNextTick,{sort:0}))}_onNextTick(){const e=Ce.elapsed*this.speed;if((this._nextDeltaTime-=e)<=0){const r=(this._nextDeltaTime=this.spf)||e;this.emit("process",r)}}destroy(){super.destroy(),this.stop()}}qo([w({fallback:60})],Ci.prototype,"fps"),qo([w({fallback:1})],Ci.prototype,"speed");class Xo{view;pixelRatio=Es;screen={x:0,y:0,width:0,height:0};related=new As;getRelated(e,t){let r=this.related.get(e);return r||(t?(this.related.set(e,r=t()),r):(console.warn("Failed to get related",e),null))}resize(e,t,r=!0){this.view&&(this.view.width=Math.floor(e*this.pixelRatio),this.view.height=Math.floor(t*this.pixelRatio)),this.screen.width=e,this.screen.height=t,r&&this.view&&(this.view.style.width=`${e}px`,this.view.style.height=`${t}px`)}}var cr=(s=>(s.NORMAL="normal",s.ADD="add",s.MULTIPLY="multiply",s.SCREEN="screen",s.NONE="none",s.NORMAL_NPM="normal_npm",s.ADD_NPM="add_npm",s.SCREEN_NPM="screen_npm",s.SRC_IN="src_in",s.SRC_OUT="src_out",s.SRC_ATOP="src_atop",s.DST_OVER="dst_over",s.DST_IN="dst_in",s.DST_OUT="dst_out",s.DST_ATOP="dst_atop",s.XOR="xor",s.SUBTRACT="subtract",s))(cr||{});function Ho(s){return{normal:[s.ONE,s.ONE_MINUS_SRC_ALPHA],add:[s.ONE,s.ONE],multiply:[s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],screen:[s.ONE,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],none:[0,0],normal_npm:[s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],add_npm:[s.SRC_ALPHA,s.ONE,s.ONE,s.ONE],screen_npm:[s.SRC_ALPHA,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],src_in:[s.DST_ALPHA,s.ZERO],src_out:[s.ONE_MINUS_DST_ALPHA,s.ZERO],src_atop:[s.DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],dst_over:[s.ONE_MINUS_DST_ALPHA,s.ONE],dst_in:[s.ZERO,s.SRC_ALPHA],dst_out:[s.ZERO,s.ONE_MINUS_SRC_ALPHA],dst_atop:[s.ONE_MINUS_DST_ALPHA,s.SRC_ALPHA],xor:[s.ONE_MINUS_DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],subtract:[s.ONE,s.ONE,s.ONE,s.ONE,s.FUNC_REVERSE_SUBTRACT,s.FUNC_ADD]}}class Ye{get gl(){return this._renderer.gl}install(e){this._renderer=e}onUpdateContext(){}flush(){}reset(){}destroy(){}}class Xt{static _properties=["blend","offsets","culling","depthTest","clockwiseFrontFace","depthMask"];static _init(){this._properties.forEach((e,t)=>{Object.defineProperty(this.prototype,e,{get(){return!!(this.bitmap&1<<t)},set(r){!!(this.bitmap&1<<t)!==r&&(this.bitmap^=1<<t)},enumerable:!0,configurable:!0})})}static for2D(){const e=new Xt;return e.depthTest=!1,e.blend=!0,e}_blendMode=cr.NORMAL;_polygonOffset=0;bitmap=0;get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==cr.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}constructor(e){if(e)for(const t in e)this[t]=e[t]}}Xt._init();class Yo extends Ye{install(e){super.install(e),e.state=this}_blendEq=!1;_setters=Xt._properties.map(e=>this[`set${e.replace(/^\S/,t=>t.toUpperCase())}`]);boundStateBitmap=0;boundBlendMode;blendModes;defaultState=new Xt({blend:!0});onUpdateContext(){super.onUpdateContext(),this.blendModes=Ho(this._renderer.gl)}toggle(e,t){this._renderer.gl[t?"enable":"disable"](e)}setBlend(e){this.toggle(this._renderer.gl.BLEND,e)}setOffsets(e){this.toggle(this._renderer.gl.POLYGON_OFFSET_FILL,e)}setCulling(e){this.toggle(this._renderer.gl.CULL_FACE,e)}setDepthTest(e){this.toggle(this._renderer.gl.DEPTH_TEST,e)}setDepthMask(e){this._renderer.gl.depthMask(e)}setClockwiseFrontFace(e){const t=this._renderer.gl;t.frontFace(t[e?"CW":"CCW"])}setBlendMode(e){if(e===this.boundBlendMode)return;this.boundBlendMode=e;const t=this.blendModes[e],r=this._renderer.gl;t.length===2?r.blendFunc(t[0],t[1]):r.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,r.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(e,t){this._renderer.gl.polygonOffset(e,t)}bind(e){if(this.boundStateBitmap!==e.bitmap){let t=this.boundStateBitmap^e.bitmap,r=0;for(;t;)t&1&&this._setters[r]?.call(this,!!(e.bitmap&1<<r)),t=t>>1,r++;this.boundStateBitmap=e.bitmap}e.blend&&this.setBlendMode(e.blendMode),e.offsets&&this.setPolygonOffset(1,e.polygonOffset)}reset(){super.reset();const e=this._renderer.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),this.bind(this.defaultState),this._blendEq=!0,this.setBlendMode(cr.NORMAL)}}class Ko extends Ye{install(e){super.install(e),e.batch2D=this}_state=Xt.for2D();_batchSize=4096*4;_drawCallUid=0;_defaultModulate=[255,255,255,255];_defaultBackgroundColor=[0,0,0,0];_batchables=[];_vertexCount=0;_indexCount=0;_attributeBuffer=[];_indexBuffers=[];_shaders=new Map;_attributes={aTextureId:{size:1,normalized:!0,type:"float"},aPosition:{size:2,normalized:!1,type:"float"},aUv:{size:2,normalized:!1,type:"float"},aModulate:{size:4,normalized:!0,type:"unsigned_byte"},aBackgroundColor:{size:4,normalized:!0,type:"unsigned_byte"},aDisableWrapMode:{size:1,normalized:!0,type:"float"}};_vertexSize=8;_getShader(e){let t=this._shaders.get(e);return t||this._shaders.set(e,t=this._createShader(e)),t}_createShader(e){const t=this._renderer,r=t.program.create({vert:`precision highp float;
|
|
3
3
|
attribute float aTextureId;
|
|
4
4
|
attribute vec2 aPosition;
|
|
5
5
|
attribute vec2 aUv;
|
package/dist/index.mjs
CHANGED