laymur 0.13.6 → 0.13.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,2 +1,2 @@
1
- import{MathUtils as t,Color as i,Vector4 as s,Texture as e,Vector2 as h,Vector3 as r,Matrix3 as n,Matrix4 as o,PlaneGeometry as l,InstancedBufferGeometry as a,ShaderMaterial as u,InstancedBufferAttribute as c,Mesh as d,Scene as f,OrthographicCamera as v,Quaternion as p,CanvasTexture as w,SRGBColorSpace as g,LinearFilter as y,WebGLRenderTarget as m,UnsignedByteType as b,RGBAFormat as _,PerspectiveCamera as x,Ray as S}from"three";class I{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:0;this.t=new WeakMap,this.i=new Map,void 0!==t&&(void 0===i?this.i.set(t,e):this.t.set(i,new Map([[t,e]])))}insert(t,i,s){let e=arguments.length>2&&void 0!==s?s:0;if(void 0===i){if(this.i.has(t))return;return void this.i.set(t,e)}const h=this.t.get(i);void 0===h?this.t.set(i,new Map([[t,e]])):h.has(t)||h.set(t,e)}remove(t,i){if(void 0===i)return void this.i.delete(t);const s=this.t.get(i);void 0!==s&&(s.delete(t),0===s.size&&this.t.delete(i))}has(t,i){if(void 0===i)return this.i.has(t);const s=this.t.get(i);return void 0!==s&&s.has(t)}getPriority(t,i){if(void 0===i)return this.i.get(t);const s=this.t.get(i);return void 0!==s?s.get(t):void 0}}class E{constructor(){this.o=new Map}on(t,i,s,e){return this.h(t,!1,arguments.length>3&&void 0!==e?e:0,i,s),this}once(t,i,s,e){return this.h(t,!0,arguments.length>3&&void 0!==e?e:0,i,s),this}off(t,i,s){const e=this.o.get(t);if(void 0===e)return this;e.u&&(e.u=!1,e.v=e.v.slice());const h=e.v;if(0===h.length)return this.o.delete(t),this;if(void 0===i){this.o.delete(t);for(let t=0;h.length>t;t++){const i=h[t];e.l.remove(i._,i.p)}return this}{const r=h.length;if(h[0]._===i&&h[0].p===s)return 1===r?this.o.delete(t):h.shift(),this;const n=r-1;if(h[n]._===i&&h[n].p===s)return h.pop(),this;if(10>r||h[0].M===h[n].M)for(let t=1;n>t;t++){const e=h[t];if(e._===i&&e.p===s)return h.splice(t,1),this}else{const t=e.l.getPriority(i,s);if(void 0===t)return this;let r=0,n=h.length-1;for(;n>=r;){const i=r+n>>>1;t>h[i].M?r=i+1:n=i-1}const o=r;for(n=h.length-1;n>=r;){const i=r+n>>>1;h[i].M>t?n=i-1:r=i+1}const l=n;for(let t=o;l>=t;t++)if(h[t]._===i&&h[t].p===s)return h.splice(t,1),this}}return this}emit(t){const i=this.o.get(t);if(void 0===i)return!1;if(0===i.v.length)return!1;i.u?i.v=i.v.slice():i.u=!0;const s=i.v;let e=!1;for(var h=arguments.length,r=Array(h>1?h-1:0),n=1;h>n;n++)r[n-1]=arguments[n];for(let t=0;s.length>t;t++){const i=s[t];i._.apply(i.p,r),i.k&&(e=!0,i.m=!0)}const o=this.o.get(t);if(void 0===o)return!0;o.v===s&&(o.u=!1);const l=o.v;if(e){let i=0;for(let t=0;l.length>t;t++){const s=l[t];s.m?o.l.remove(s._,s.p):l[i++]=s}0===i?this.o.delete(t):l.length=i}return!0}h(t,i,s,e,h){let r=this.o.get(t);if(void 0===r)return void this.o.set(t,{v:[{_:e,p:h,M:s,k:i,m:!1}],u:!1,l:new I(e,h,s)});if(r.l.has(e,h))throw Error("Event listener already exists");r.l.insert(e,h,s);const n={_:e,p:h,M:s,k:i,m:!1};r.u&&(r.u=!1,r.v=r.v.slice());{const t=r.v,i=n.M;if(0===t.length||i>=t[t.length-1].M)return void t.push(n);if(t[0].M>=i)return void t.unshift(n);{let s=0,e=t.length;for(;e>s;){const h=s+e>>>1;i>t[h].M?s=h+1:e=h}t.splice(s,0,n)}}}}var M,C;function T(t){return t===M.INTERACTIVE||t===M.INTERACTIVE_TRANSPARENT}function P(t){return t!==M.HIDDEN}function H(t,i,s){return(i=(t=>{var i=(t=>{if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return t+""})(t);return"symbol"==typeof i?i:i+""})(i))in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s,t}function A(){return new U}(t=>{t[t.HIDDEN=0]="HIDDEN",t[t.VISIBLE=1]="VISIBLE",t[t.INTERACTIVE=2]="INTERACTIVE",t[t.INTERACTIVE_TRANSPARENT=3]="INTERACTIVE_TRANSPARENT"})(M||(M={})),(t=>{t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.ALWAYS=2]="ALWAYS"})(C||(C={}));class U{constructor(){H(this,"index",{}),H(this,"array",[])}size(){return this.array.length}empty(){return 0===this.array.length}itemAt(t){return this.array[t]}contains(t){return void 0!==this.index[t.id()]}find(t){const i=this.index[t.id()];return void 0===i?void 0:this.array[i]}setDefault(t,i){const s=this.index[t.id()];if(void 0===s){const s=new V(t,i());return this.index[t.id()]=this.array.length,this.array.push(s),s}return this.array[s]}insert(t,i){const s=new V(t,i),e=this.index[t.id()];return void 0===e?(this.index[t.id()]=this.array.length,this.array.push(s)):this.array[e]=s,s}erase(t){const i=this.index[t.id()];if(void 0===i)return;this.index[t.id()]=void 0;const s=this.array[i],e=this.array.pop();return s!==e&&(this.array[i]=e,this.index[e.first.id()]=i),s}copy(){const t=new U;for(let i=0;this.array.length>i;i++){const s=this.array[i].copy();t.array[i]=s,t.index[s.first.id()]=i}return t}}class V{constructor(t,i){H(this,"first",void 0),H(this,"second",void 0),this.first=t,this.second=i}copy(){return new V(this.first,this.second)}}class R{constructor(t){let i=arguments.length>0&&void 0!==t?t:"";H(this,"_name",void 0),H(this,"_value",0),H(this,"_context",null),H(this,"_id",B++),this._name=i}id(){return this._id}name(){return this._name}setName(t){this._name=t}context(){return this._context}setContext(t){this._context=t}value(){return this._value}setValue(t){this._value=t}plus(t){return new L(this,t)}minus(t){return new L(this,"number"==typeof t?-t:[-1,t])}multiply(t){return new L([t,this])}divide(t){return new L([1/t,this])}toJSON(){return{name:this._name,value:this._value}}toString(){return this._context+"["+this._name+":"+this._value+"]"}}let B=0;class L{constructor(){H(this,"_terms",void 0),H(this,"_constant",void 0);let t=(t=>{let i=0,s=()=>0,e=A();for(let h=0,r=t.length;r>h;++h){let r=t[h];if("number"==typeof r)i+=r;else if(r instanceof R)e.setDefault(r,s).second+=1;else if(r instanceof L){i+=r.constant();let t=r.terms();for(let i=0,h=t.size();h>i;i++){let h=t.itemAt(i);e.setDefault(h.first,s).second+=h.second}}else{if(!(r instanceof Array))throw Error("invalid Expression argument: "+r);{if(2!==r.length)throw Error("array must have length 2");let t=r[0],h=r[1];if("number"!=typeof t)throw Error("array item 0 must be a number");if(h instanceof R)e.setDefault(h,s).second+=t;else{if(!(h instanceof L))throw Error("array item 1 must be a variable or expression");{i+=h.constant()*t;let r=h.terms();for(let i=0,h=r.size();h>i;i++){let h=r.itemAt(i);e.setDefault(h.first,s).second+=h.second*t}}}}}}return{terms:e,constant:i}})(arguments);this._terms=t.terms,this._constant=t.constant}terms(){return this._terms}constant(){return this._constant}value(){let t=this._constant;for(let i=0,s=this._terms.size();s>i;i++){let s=this._terms.itemAt(i);t+=s.first.value()*s.second}return t}plus(t){return new L(this,t)}minus(t){return new L(this,"number"==typeof t?-t:[-1,t])}multiply(t){return new L([t,this])}divide(t){return new L([1/t,this])}isConstant(){return 0==this._terms.size()}toString(){let t=this._terms.array.map(t=>t.second+"*"+t.first).join(" + ");return this.isConstant()||0===this._constant||(t+=" + "),t+=this._constant,t}}var D,k;class O{static create(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:1,r=0;return r+=1e6*Math.max(0,Math.min(1e3,t*h)),r+=1e3*Math.max(0,Math.min(1e3,i*h)),r+=Math.max(0,Math.min(1e3,s*h)),r}static clip(t){return Math.max(0,Math.min(O.required,t))}}H(O,"required",(D=O).create(1e3,1e3,1e3)),H(O,"strong",D.create(1,0,0)),H(O,"medium",D.create(0,1,0)),H(O,"weak",D.create(0,0,1)),(t=>{t[t.Le=0]="Le",t[t.Ge=1]="Ge",t[t.Eq=2]="Eq"})(k||(k={}));class W{constructor(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:O.required;H(this,"_expression",void 0),H(this,"_operator",void 0),H(this,"_strength",void 0),H(this,"_id",N++),this._operator=i,this._strength=O.clip(h),this._expression=void 0===s&&t instanceof L?t:t.minus(s)}id(){return this._id}expression(){return this._expression}op(){return this._operator}strength(){return this._strength}toString(){return this._expression+" "+["<=",">=","="][this._operator]+" 0 ("+this._strength+")"}}let N=0;class j{constructor(){H(this,"maxIterations",1e3),H(this,"_cnMap",A()),H(this,"_rowMap",A()),H(this,"_varMap",A()),H(this,"_editMap",A()),H(this,"_infeasibleRows",[]),H(this,"_objective",new Y),H(this,"_artificial",null),H(this,"_idTick",0)}createConstraint(t,i,s,e){let h=new W(t,i,s,arguments.length>3&&void 0!==e?e:O.required);return this.addConstraint(h),h}addConstraint(t){if(void 0!==this._cnMap.find(t))throw Error("duplicate constraint");let i=this._createRow(t),s=i.row,e=i.tag,h=this._chooseSubject(s,e);if(h.type()===F.Invalid&&s.allDummies()){if(!z(s.constant()))throw Error("unsatisfiable constraint");h=e.marker}if(h.type()===F.Invalid){if(!this._addWithArtificialVariable(s))throw Error("unsatisfiable constraint")}else s.solveFor(h),this._substitute(h,s),this._rowMap.insert(h,s);this._cnMap.insert(t,e),this._optimize(this._objective)}removeConstraint(t){let i=this._cnMap.erase(t);if(void 0===i)throw Error("unknown constraint");this._removeConstraintEffects(t,i.second);let s=i.second.marker,e=this._rowMap.erase(s);if(void 0===e){let t=this._getMarkerLeavingSymbol(s);if(t.type()===F.Invalid)throw Error("failed to find leaving row");e=this._rowMap.erase(t),e.second.solveForEx(t,s),this._substitute(s,e.second)}this._optimize(this._objective)}hasConstraint(t){return this._cnMap.contains(t)}getConstraints(){return this._cnMap.array.map(t=>{let{first:i}=t;return i})}addEditVariable(t,i){if(void 0!==this._editMap.find(t))throw Error("duplicate edit variable");if((i=O.clip(i))===O.required)throw Error("bad required strength");let s=new L(t),e=new W(s,k.Eq,void 0,i);this.addConstraint(e);let h=this._cnMap.find(e).second;this._editMap.insert(t,{tag:h,constraint:e,constant:0})}removeEditVariable(t){let i=this._editMap.erase(t);if(void 0===i)throw Error("unknown edit variable");this.removeConstraint(i.second.constraint)}hasEditVariable(t){return this._editMap.contains(t)}suggestValue(t,i){let s=this._editMap.find(t);if(void 0===s)throw Error("unknown edit variable");let e=this._rowMap,h=s.second,r=i-h.constant;h.constant=i;let n=h.tag.marker,o=e.find(n);if(void 0!==o)return 0>o.second.add(-r)&&this._infeasibleRows.push(n),void this._dualOptimize();let l=h.tag.other;if(o=e.find(l),void 0!==o)return 0>o.second.add(r)&&this._infeasibleRows.push(l),void this._dualOptimize();for(let t=0,i=e.size();i>t;++t){let i=e.itemAt(t),s=i.second,h=s.coefficientFor(n);0!==h&&0>s.add(r*h)&&i.first.type()!==F.External&&this._infeasibleRows.push(i.first)}this._dualOptimize()}updateVariables(){let t=this._varMap,i=this._rowMap;for(let s=0,e=t.size();e>s;++s){let e=t.itemAt(s),h=i.find(e.second);e.first.setValue(void 0!==h?h.second.constant():0)}}_getVarSymbol(t){return this._varMap.setDefault(t,()=>this._makeSymbol(F.External)).second}_createRow(t){let i=t.expression(),s=new Y(i.constant()),e=i.terms();for(let t=0,i=e.size();i>t;++t){let i=e.itemAt(t);if(!z(i.second)){let t=this._getVarSymbol(i.first),e=this._rowMap.find(t);void 0!==e?s.insertRow(e.second,i.second):s.insertSymbol(t,i.second)}}let h=this._objective,r=t.strength(),n={marker:G,other:G};switch(t.op()){case k.Le:case k.Ge:{let i=t.op()===k.Le?1:-1,e=this._makeSymbol(F.Slack);if(n.marker=e,s.insertSymbol(e,i),O.required>r){let t=this._makeSymbol(F.Error);n.other=t,s.insertSymbol(t,-i),h.insertSymbol(t,r)}break}case k.Eq:if(O.required>r){let t=this._makeSymbol(F.Error),i=this._makeSymbol(F.Error);n.marker=t,n.other=i,s.insertSymbol(t,-1),s.insertSymbol(i,1),h.insertSymbol(t,r),h.insertSymbol(i,r)}else{let t=this._makeSymbol(F.Dummy);n.marker=t,s.insertSymbol(t)}}return 0>s.constant()&&s.reverseSign(),{row:s,tag:n}}_chooseSubject(t,i){let s=t.cells();for(let t=0,i=s.size();i>t;++t){let i=s.itemAt(t);if(i.first.type()===F.External)return i.first}let e=i.marker.type();return e!==F.Slack&&e!==F.Error||t.coefficientFor(i.marker)>=0?(e=i.other.type(),e!==F.Slack&&e!==F.Error||t.coefficientFor(i.other)>=0?G:i.other):i.marker}_addWithArtificialVariable(t){let i=this._makeSymbol(F.Slack);this._rowMap.insert(i,t.copy()),this._artificial=t.copy(),this._optimize(this._artificial);let s=z(this._artificial.constant());this._artificial=null;let e=this._rowMap.erase(i);if(void 0!==e){let t=e.second;if(t.isConstant())return s;let h=this._anyPivotableSymbol(t);if(h.type()===F.Invalid)return!1;t.solveForEx(i,h),this._substitute(h,t),this._rowMap.insert(h,t)}let h=this._rowMap;for(let t=0,s=h.size();s>t;++t)h.itemAt(t).second.removeSymbol(i);return this._objective.removeSymbol(i),s}_substitute(t,i){let s=this._rowMap;for(let e=0,h=s.size();h>e;++e){let h=s.itemAt(e);h.second.substitute(t,i),0>h.second.constant()&&h.first.type()!==F.External&&this._infeasibleRows.push(h.first)}this._objective.substitute(t,i),this._artificial&&this._artificial.substitute(t,i)}_optimize(t){let i=0;for(;this.maxIterations>i;){let s=this._getEnteringSymbol(t);if(s.type()===F.Invalid)return;let e=this._getLeavingSymbol(s);if(e.type()===F.Invalid)throw Error("the objective is unbounded");let h=this._rowMap.erase(e).second;h.solveForEx(e,s),this._substitute(s,h),this._rowMap.insert(s,h),i++}throw Error("solver iterations exceeded")}_dualOptimize(){let t=this._rowMap,i=this._infeasibleRows;for(;0!==i.length;){let s=i.pop(),e=t.find(s);if(void 0!==e&&0>e.second.constant()){let i=this._getDualEnteringSymbol(e.second);if(i.type()===F.Invalid)throw Error("dual optimize failed");let h=e.second;t.erase(s),h.solveForEx(s,i),this._substitute(i,h),t.insert(i,h)}}}_getEnteringSymbol(t){let i=t.cells();for(let t=0,s=i.size();s>t;++t){let s=i.itemAt(t),e=s.first;if(0>s.second&&e.type()!==F.Dummy)return e}return G}_getDualEnteringSymbol(t){let i=Number.MAX_VALUE,s=G,e=t.cells();for(let t=0,h=e.size();h>t;++t){let h=e.itemAt(t),r=h.first,n=h.second;if(n>0&&r.type()!==F.Dummy){let t=this._objective.coefficientFor(r)/n;i>t&&(i=t,s=r)}}return s}_getLeavingSymbol(t){let i=Number.MAX_VALUE,s=G,e=this._rowMap;for(let h=0,r=e.size();r>h;++h){let r=e.itemAt(h),n=r.first;if(n.type()!==F.External){let e=r.second,h=e.coefficientFor(t);if(0>h){let t=-e.constant()/h;i>t&&(i=t,s=n)}}}return s}_getMarkerLeavingSymbol(t){let i=Number.MAX_VALUE,s=i,e=i,h=G,r=h,n=h,o=h,l=this._rowMap;for(let i=0,h=l.size();h>i;++i){let h=l.itemAt(i),a=h.second,u=a.coefficientFor(t);if(0===u)continue;let c=h.first;if(c.type()===F.External)o=c;else if(0>u){let t=-a.constant()/u;s>t&&(s=t,r=c)}else{let t=a.constant()/u;e>t&&(e=t,n=c)}}return r!==h?r:n!==h?n:o}_removeConstraintEffects(t,i){i.marker.type()===F.Error&&this._removeMarkerEffects(i.marker,t.strength()),i.other.type()===F.Error&&this._removeMarkerEffects(i.other,t.strength())}_removeMarkerEffects(t,i){let s=this._rowMap.find(t);void 0!==s?this._objective.insertRow(s.second,-i):this._objective.insertSymbol(t,-i)}_anyPivotableSymbol(t){let i=t.cells();for(let t=0,s=i.size();s>t;++t){let s=i.itemAt(t),e=s.first.type();if(e===F.Slack||e===F.Error)return s.first}return G}_makeSymbol(t){return new $(t,this._idTick++)}}function z(t){return 0>t?1e-8>-t:1e-8>t}var F;(t=>{t[t.Invalid=0]="Invalid",t[t.External=1]="External",t[t.Slack=2]="Slack",t[t.Error=3]="Error",t[t.Dummy=4]="Dummy"})(F||(F={}));let $=class{constructor(t,i){H(this,"_id",void 0),H(this,"_type",void 0),this._id=i,this._type=t}id(){return this._id}type(){return this._type}},G=new $(F.Invalid,-1);class Y{constructor(t){let i=arguments.length>0&&void 0!==t?t:0;H(this,"_cellMap",A()),H(this,"_constant",void 0),this._constant=i}cells(){return this._cellMap}constant(){return this._constant}isConstant(){return this._cellMap.empty()}allDummies(){let t=this._cellMap;for(let i=0,s=t.size();s>i;++i)if(t.itemAt(i).first.type()!==F.Dummy)return!1;return!0}copy(){let t=new Y(this._constant);return t._cellMap=this._cellMap.copy(),t}add(t){return this._constant+=t}insertSymbol(t,i){let s=arguments.length>1&&void 0!==i?i:1;z(this._cellMap.setDefault(t,()=>0).second+=s)&&this._cellMap.erase(t)}insertRow(t,i){let s=arguments.length>1&&void 0!==i?i:1;this._constant+=t._constant*s;let e=t._cellMap;for(let t=0,i=e.size();i>t;++t){let i=e.itemAt(t);this.insertSymbol(i.first,i.second*s)}}removeSymbol(t){this._cellMap.erase(t)}reverseSign(){this._constant=-this._constant;let t=this._cellMap;for(let i=0,s=t.size();s>i;++i){let s=t.itemAt(i);s.second=-s.second}}solveFor(t){let i=this._cellMap,s=-1/i.erase(t).second;this._constant*=s;for(let t=0,e=i.size();e>t;++t)i.itemAt(t).second*=s}solveForEx(t,i){this.insertSymbol(t,-1),this.solveFor(i)}coefficientFor(t){let i=this._cellMap.find(t);return void 0!==i?i.second:0}substitute(t,i){let s=this._cellMap.erase(t);void 0!==s&&this.insertRow(i,s.second)}}const q=1e3;var X;function Z(t){switch(t){case X.P0:return O.create(q,q,q);case X.P1:return O.create(100,0,0);case X.P2:return O.create(10,0,0);case X.P3:return O.create(0,100,0);case X.P4:return O.create(0,10,0);case X.P5:return O.create(0,0,100);case X.P6:return O.create(0,0,10);case X.P7:return O.create(0,0,1);default:throw Error("convertPriority.priority: invalid priority")}}(t=>{t[t.P0=0]="P0",t[t.P1=1]="P1",t[t.P2=2]="P2",t[t.P3=3]="P3",t[t.P4=4]="P4",t[t.P5=5]="P5",t[t.P6=6]="P6",t[t.P7=7]="P7"})(X||(X={}));class J{constructor(){this.dirty=!1,this.S=!1,this.I=[],this.C=0}createInputCatcher(t,i,s,e){const h=this.C++;return this.I.push({handler:h,catchPointerDown:t,catchPointerMove:i,catchPointerUp:s,zIndex:e,active:!0}),this.S=!0,this.dirty=!0,h}destroyInputCatcher(t){const i=this.I.findIndex(i=>i.handler===t);if(-1===i)throw Error("UIInputWrapper.destroyInputCatcher.handler: handler not found");this.I.splice(i,1)}getZIndex(t){this.T();const i=this.I.find(i=>i.handler===t);if(!i)throw Error("UIInputWrapper.getZIndex.handler: handler not found");return i.zIndex}setZIndex(t,i){const s=this.I.find(i=>i.handler===t);if(!s)throw Error("UIInputWrapper.setZIndex.handler: handler not found");s.zIndex!==i&&(s.zIndex=i,this.S=!0,this.dirty=!0)}getActive(t){const i=this.I.find(i=>i.handler===t);if(!i)throw Error("UIInputWrapper.getActive.handler: handler not found");return i.active}setActive(t,i){const s=this.I.find(i=>i.handler===t);if(!s)throw Error("UIInputWrapper.setActive.handler: handler not found");s.active!==i&&(s.active=i)}onPointerDown(t,i,s){this.T();for(let e=this.I.length-1;e>=0;e--){const h=this.I[e];if(h.active&&h.catchPointerDown(t,i,s))break}}onPointerMove(t,i,s){this.T();for(let e=this.I.length-1;e>=0;e--){const h=this.I[e];if(h.active&&h.catchPointerMove(t,i,s))break}}onPointerUp(t,i,s){this.T();for(let e=this.I.length-1;e>=0;e--){const h=this.I[e];if(h.active&&h.catchPointerUp(t,i,s))break}}T(){if(this.S){this.I.sort((t,i)=>t.zIndex-i.zIndex);const t=this.I.length,i=1024>t?1:1024/t;for(let s=0;t>s;s++)this.I[s].zIndex=s*i;this.S=!1}}}function K(t){return.04045>t?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Q(t){return.0031308>t?12.92*t:1.055*Math.pow(t,.41666)-.055}const tt={black:0,white:16777215,red:16711680,green:32768,blue:255,yellow:16776960,cyan:65535,magenta:16711935,gray:8421504,grey:8421504,silver:12632256,maroon:8388608,olive:8421376,lime:65280,aqua:65535,teal:32896,navy:128,fuchsia:16711935,purple:8388736,orange:16753920,pink:16761035,brown:10824234,gold:16766720,violet:15631086,indigo:4915330,coral:16744272,salmon:16416882,khaki:15787660,plum:14524637,orchid:14315734,tan:13808780,beige:16119260,mint:10025880,lavender:15132410,crimson:14423100,azure:15794175,ivory:16777200,snow:16775930};class it{constructor(){this.P=1,this.H=1,this.A=1,this.U=1,this.V=0,this.R=0,this.B=1,this.L=!1,this.D=!1,this.O=!1,arguments.length>0&&this.set(...arguments)}static get black(){return new it("black")}static get white(){return new it("white")}static get red(){return new it("red")}static get green(){return new it("green")}static get blue(){return new it("blue")}static get yellow(){return new it("yellow")}static get cyan(){return new it("cyan")}static get magenta(){return new it("magenta")}static get gray(){return new it("gray")}static get grey(){return new it("grey")}static get silver(){return new it("silver")}static get maroon(){return new it("maroon")}static get olive(){return new it("olive")}static get lime(){return new it("lime")}static get aqua(){return new it("aqua")}static get teal(){return new it("teal")}static get navy(){return new it("navy")}static get fuchsia(){return new it("fuchsia")}static get purple(){return new it("purple")}static get orange(){return new it("orange")}static get pink(){return new it("pink")}static get brown(){return new it("brown")}static get gold(){return new it("gold")}static get violet(){return new it("violet")}static get indigo(){return new it("indigo")}static get coral(){return new it("coral")}static get salmon(){return new it("salmon")}static get khaki(){return new it("khaki")}static get plum(){return new it("plum")}static get orchid(){return new it("orchid")}static get tan(){return new it("tan")}static get beige(){return new it("beige")}static get mint(){return new it("mint")}static get lavender(){return new it("lavender")}static get crimson(){return new it("crimson")}static get azure(){return new it("azure")}static get ivory(){return new it("ivory")}static get snow(){return new it("snow")}get r(){return this.W(),this.P}get g(){return this.W(),this.H}get b(){return this.W(),this.A}get a(){return this.U}get hue(){return this.N(),this.V}get saturation(){return this.N(),this.R}get lightness(){return this.N(),this.B}get dirty(){return this.L}set r(i){i=t.clamp(i,0,1),this.W(),i!==this.P&&(this.P=i,this.O=!0,this.L=!0)}set g(i){i=t.clamp(i,0,1),this.W(),i!==this.H&&(this.H=i,this.O=!0,this.L=!0)}set b(i){i=t.clamp(i,0,1),this.W(),i!==this.A&&(this.A=i,this.O=!0,this.L=!0)}set a(i){(i=t.clamp(i,0,1))!==this.U&&(this.U=i,this.L=!0)}set hue(i){i=t.clamp(i,0,360),this.N(),i!==this.V&&(this.V=i,this.D=!0,this.L=!0)}set saturation(i){i=t.clamp(i,0,1),this.N(),i!==this.R&&(this.R=i,this.D=!0,this.L=!0)}set lightness(i){i=t.clamp(i,0,1),this.N(),i!==this.B&&(this.B=i,this.D=!0,this.L=!0)}setDirtyFalse(){this.L=!1}set(){for(var t=arguments.length,s=Array(t),e=0;t>e;e++)s[e]=arguments[e];if(0===s.length||void 0===s[0])return this.setRGBA(1,1,1,1);if(s.length>=3&&"number"==typeof s[0]){const[t,i,e,h=1]=s;return this.setRGBA(t,i,e,h)}const[h,r=1]=s;if("string"==typeof h)return h.startsWith("#")?this.setHexString(h):this.setColorName(h,r);if(h instanceof it)return this.copy(h);if(h instanceof i)return this.setThreeColor(h,r);if("number"==typeof h)return this.setHexRGB(h,r);throw Error("UIColor.set: cannot create color from provided arguments")}setRGBA(i,s,e,h){let r=arguments.length>3&&void 0!==h?h:this.U;return i=t.clamp(i,0,1),s=t.clamp(s,0,1),e=t.clamp(e,0,1),r=t.clamp(r,0,1),this.W(),i===this.P&&s===this.H&&e===this.A&&r===this.U||(this.P=i,this.H=s,this.A=e,this.U=r,this.O=!0,this.L=!0),this}getHexRGBA(){return this.W(),Math.round(255*this.P)<<24|Math.round(255*this.H)<<16|Math.round(255*this.A)<<8|Math.round(255*this.U)}getHexRGB(){return this.W(),Math.round(255*this.P)<<16|Math.round(255*this.H)<<8|Math.round(255*this.A)}getHexStringRGB(){return"#"+this.getHexRGB().toString(16).padStart(6,"0")}getHexStringRGBA(){return"#"+this.getHexRGBA().toString(16).padStart(8,"0")}setHexRGBA(t){this.W();const i=(t>>16&255)/255,s=(t>>8&255)/255,e=(255&t)/255,h=(t>>24&255)/255;return i===this.P&&s===this.H&&e===this.A&&h===this.U||(this.P=i,this.H=s,this.A=e,this.U=h,this.O=!0,this.L=!0),this}setHexRGB(i,s){let e=arguments.length>1&&void 0!==s?s:this.U;e=t.clamp(e,0,1),this.W();const h=(i>>16&255)/255,r=(i>>8&255)/255,n=(255&i)/255;return h===this.P&&r===this.H&&n===this.A&&e===this.U||(this.P=h,this.H=r,this.A=n,this.U=e,this.O=!0,this.L=!0),this}setHexString(t){if(!t.startsWith("#"))throw Error('UIColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"');const i=t.slice(1);if(6===i.length){const t=parseInt(i,16);if(isNaN(t))throw Error('UIColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"');return this.setHexRGB(t)}if(8===i.length){const t=parseInt(i,16);if(isNaN(t))throw Error('UIColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"');return this.setHexRGBA(t)}throw Error('UIColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"')}setHSL(i,s,e,h){let r=arguments.length>3&&void 0!==h?h:this.U;return i=t.clamp(i,0,360),s=t.clamp(s,0,1),e=t.clamp(e,0,1),r=t.clamp(r,0,1),this.N(),i===this.V&&s===this.R&&e===this.B&&r===this.U||(this.V=i,this.R=s,this.B=e,this.U=r,this.D=!0,this.L=!0),this}setColorName(i,s){let e=arguments.length>1&&void 0!==s?s:this.U;e=t.clamp(e,0,1);const h=i.toLowerCase().trim(),r=tt[h];if(void 0===r)throw Error("UIColor.setColorName.colorName: unknown color name");return this.setHexRGB(r,e)}setGLSLColor(i,s,e,h){let r=arguments.length>3&&void 0!==h?h:this.U;r=t.clamp(r,0,1),this.W();const n=Q(i),o=Q(s),l=Q(e);return n===this.P&&o===this.H&&l===this.A&&r===this.U||(this.P=n,this.H=o,this.A=l,this.U=r,this.O=!0,this.L=!0),this}setThreeColor(i,s){let e=arguments.length>1&&void 0!==s?s:this.U;return e=t.clamp(e,0,1),this.W(),i.r===this.P&&i.g===this.H&&i.b===this.A&&e===this.U||(this.P=i.r,this.H=i.g,this.A=i.b,this.U=e,this.O=!0,this.L=!0),this}toCSSColor(){return this.W(),`rgba(${Math.round(255*this.P)}, ${Math.round(255*this.H)}, ${Math.round(255*this.A)}, ${this.U})`}toGLSLColor(t){let i=arguments.length>0&&void 0!==t?t:new s;return this.W(),i.x=K(this.P),i.y=K(this.H),i.z=K(this.A),i.w=this.U,i}toThreeColor(t){let s=arguments.length>0&&void 0!==t?t:new i;return this.W(),s.r=this.P,s.g=this.H,s.b=this.A,s}copy(t){return t instanceof it?(this.W(),t.W(),this.P===t.P&&this.H===t.H&&this.A===t.A&&this.U===t.U||(this.P=t.P,this.H=t.H,this.A=t.A,this.U=t.U,this.O=!0,this.L=!0)):(this.W(),this.P===t.r&&this.H===t.g&&this.A===t.b&&1===this.U||(this.P=t.r,this.H=t.g,this.A=t.b,this.U=1,this.O=!0,this.L=!0)),this}clone(){return this.W(),new it(this.P,this.H,this.A,this.U)}W(){if(this.D){const{V:t,R:i,B:s}=this,e=(1-Math.abs(2*s-1))*i,h=t/60,r=e*(1-Math.abs(h%2-1));let[n,o,l]=1>h?[e,r,0]:2>h?[r,e,0]:3>h?[0,e,r]:4>h?[0,r,e]:5>h?[r,0,e]:[e,0,r];const a=s-e/2;this.P=n+a,this.H=o+a,this.A=l+a,this.D=!1}}N(){if(this.O){const{P:t,H:i,A:s}=this,e=Math.max(t,i,s),h=Math.min(t,i,s),r=e-h,n=(e+h)/2;let o=0;0!==r&&(o=e===t?(i-s)/r+(s>i?6:0):e===i?(s-t)/r+2:(t-i)/r+4,o*=60);const l=0===r?0:r/(1-Math.abs(2*n-1));this.V=o,this.R=l,this.B=n,this.O=!1}}}const st=Object.freeze({glslTypeName:"float",bufferSize:1,instantiable:!0}),et=Object.freeze({glslTypeName:"sampler2D",bufferSize:-1,instantiable:!1}),ht=Object.freeze({glslTypeName:"vec2",bufferSize:2,instantiable:!0}),rt=Object.freeze({glslTypeName:"vec3",bufferSize:3,instantiable:!0}),nt=Object.freeze({glslTypeName:"vec4",bufferSize:4,instantiable:!0}),ot=Object.freeze({glslTypeName:"mat3",bufferSize:9,instantiable:!0}),lt=Object.freeze({glslTypeName:"mat4",bufferSize:16,instantiable:!0});function at(t){if("string"==typeof t)switch(t){case"number":return st;case"Texture":return et;case"UIColor":case"Vector4":return nt;case"Vector2":return ht;case"Vector3":return rt;case"Matrix3":return ot;case"Matrix4":return lt;default:throw Error("resolveGLSLTypeInfo.value: unsupported property type name")}if("function"==typeof t){if(t===Number)return st;if(t===e)return et;if(t===it)return nt;if(t===h)return ht;if(t===r)return rt;if(t===s)return nt;if(t===n)return ot;if(t===o)return lt;throw Error("resolveGLSLTypeInfo.value: unsupported property type constructor")}if("number"==typeof t)return st;if(t instanceof e)return et;if(t instanceof it)return nt;if(t instanceof h)return ht;if(t instanceof r)return rt;if(t instanceof s)return nt;if(t instanceof n)return ot;if(t instanceof o)return lt;throw Error("resolveGLSLTypeInfo.value: unsupported property type")}function ut(t,i){const s=i.uniforms["p_"+t];if(void 0===s)throw Error("resolvePropertyUniform.name: unknown uniform");return s}function ct(t,i){for(const s in i){if(!(s in t))return!1;const e=t[s].glslTypeInfo;if(e.glslTypeName!==i[s].glslTypeInfo.glslTypeName)return!1;if(!e.instantiable&&t[s]!==i[s])return!1}return!0}function dt(t){const i={};for(const s in t){const e=t[s];i[s]={value:e,glslTypeInfo:at(e)}}return i}function ft(t){return"number"==typeof t||t instanceof e?t:t.clone()}function vt(t){const i={};for(const s in t)i[s]=ft(t[s]);return i}function pt(t,i,s){return`\n // Defines\n #define PI 3.14159265359\n\n // Uniforms\n ${t.join("\n")}\n\n // Builtin varyings\n varying vec3 p_position;\n varying vec2 p_uv;\n\n // User varyings\n ${i.join("\n")}\n\n #include <alphahash_pars_fragment>\n\n // Source must define vec4 draw() function\n ${s}\n\n void main() {\n vec4 diffuseColor = draw();\n\n #ifdef USE_ALPHATEST\n if (diffuseColor.a < 0.50) {\n discard;\n }\n #endif\n\n #ifdef USE_ALPHAHASH\n if (diffuseColor.a < getAlphaHashThreshold(p_position)) {\n discard;\n }\n #endif\n\n gl_FragColor = linearToOutputTexel(diffuseColor);\n }\n `}var wt;(t=>{t[t.CLIP=0]="CLIP",t[t.HASH=1]="HASH",t[t.BLEND=2]="BLEND"})(wt||(wt={}));const gt=(()=>{const t=new l(1,1);t.translate(.5,.5,0);const i=new a;return i.index=t.index,i.setAttribute("position",t.attributes.position),i.setAttribute("uv",t.attributes.uv),t.dispose(),i})(),yt=new s,mt=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function bt(t,i,e){if(t instanceof it)t.toGLSLColor(yt),i[e]=yt.x,i[e+1]=yt.y,i[e+2]=yt.z,i[e+3]=yt.w;else if(t instanceof h)i[e]=t.x,i[e+1]=t.y;else if(t instanceof r)i[e]=t.x,i[e+1]=t.y,i[e+2]=t.z;else if(t instanceof s)i[e]=t.x,i[e+1]=t.y,i[e+2]=t.z,i[e+3]=t.w;else if(t instanceof n||t instanceof o){const s=t.elements;for(let t=0;s.length>t;t++)i[e+t]=s[t]}else"number"==typeof t&&(i[e]=t)}function _t(t,i){const s=at(t);if(!s.instantiable)throw Error("buildEmptyInstancedBufferAttribute.value: cannot create instanced attribute for non-instantiable type");return new c(new Float32Array(i*s.bufferSize),s.bufferSize)}function xt(t,i,e){if("number"==typeof t)return i[e];if(t instanceof h)return new h(i[e],i[e+1]);if(t instanceof r)return new r(i[e],i[e+1],i[e+2]);if(t instanceof s)return new s(i[e],i[e+1],i[e+2],i[e+3]);if(t instanceof it)return(new it).setGLSLColor(i[e],i[e+1],i[e+2],i[e+3]);if(t instanceof n){const t=new n;return t.fromArray(i,e),t}if(t instanceof o){const t=new o;return t.fromArray(i,e),t}throw Error("reconstructValue.referenceValue: cannot reconstruct value for type")}class St extends d{constructor(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:4;const r={},n={instanceVisibility:{value:1,glslTypeInfo:at("number")},instanceTransform:{value:(new o).identity(),glslTypeInfo:at("Matrix4")}};for(const t in i){const s=i[t];s.glslTypeInfo.instantiable?n[t]=s:r[t]=s}const l=gt.clone(),a=((t,i,s,e)=>{const h={},r=[],n=[],o=[],l=[];for(const t in i){const{value:s,glslTypeInfo:e}=i[t];h["p_"+t]={value:s instanceof it?s.toGLSLColor():s},r.push(`uniform ${e.glslTypeName} p_${t};`)}for(const t in s){const{glslTypeInfo:i}=s[t];n.push(`attribute ${i.glslTypeName} a_${t};`),o.push(`varying ${i.glslTypeName} p_${t};`),l.push(`p_${t} = a_${t};`)}const a=`\n // User attributes\n ${n.join("\n")}\n\n // Uniforms\n ${r.join("\n")}\n\n // Builtin varyings\n varying vec3 p_position;\n varying vec2 p_uv;\n\n // User varyings\n ${o.join("\n")}\n\n void main() {\n if (a_instanceVisibility < 0.5) {\n gl_Position = vec4(2.0, 2.0, 2.0, 1.0);\n return;\n }\n\n ${l.join("\n")}\n\n p_position = position;\n p_uv = uv;\n\n gl_Position = projectionMatrix * a_instanceTransform * vec4(position, 1.0);\n }\n `,c=pt(r,o,t);return new u({uniforms:h,vertexShader:a,fragmentShader:c,transparent:e===wt.BLEND,alphaTest:e===wt.CLIP?.5:0,alphaHash:e===wt.HASH,depthWrite:e!==wt.BLEND,depthTest:!0})})(t,r,n,s);super(l,a),this.source=t,this.transparency=s,this.j=new Map,this.F=new Map,this.C=0,this.frustumCulled=!1,this.matrixAutoUpdate=!1,this.matrixWorldAutoUpdate=!1,this.$=l,this.$.instanceCount=0,this.G=a,this.Y=r,this.q=n,this.X=Math.max(4*Math.ceil(h/4),4);for(const t in this.q){const{value:i}=this.q[t],s=_t(i,this.X);this.$.setAttribute("a_"+t,s),this.F.set(t,s)}for(const t in this.Y){const{value:i}=this.Y[t];ut(t,this.G).value=i}this.G.uniformsNeedUpdate=!0}get instanceCount(){return this.$.instanceCount}createInstance(){const t=this.C++,i=this.$.instanceCount;this.Z(i+1),this.j.set(t,i),this.$.instanceCount++;{const t=this.F.get("instanceVisibility"),s=this.F.get("instanceTransform");((t,i,s)=>{t[s]=1;const e=16*s;for(let t=0;16>t;t++)i[e+t]=mt[t]})(t.array,s.array,i),t.needsUpdate=!0,s.needsUpdate=!0}return t}destroyInstance(t){const i=this.J(t);this.j.delete(t);const s=this.$.instanceCount-1;s>i&&(this.K(s,i),this.tt(s,i)),this.$.instanceCount--}setProperties(t,i){const s=this.J(t);for(const t in i){const{value:e,glslTypeInfo:h}=i[t];if(h.instantiable){const i=this.it(t);bt(e,i.array,s*i.itemSize),i.needsUpdate=!0}else ut(t,this.G).value=e,this.G.uniformsNeedUpdate=!0}}setTransform(t,i){const s=this.J(t),e=this.it("instanceTransform"),h=e.array,r=16*s,n=i.elements;for(let t=0;16>t;t++)h[r+t]=n[t];e.needsUpdate=!0}setVisibility(t,i){const s=this.J(t),e=this.it("instanceVisibility");e.array[s]=i?1:0,e.needsUpdate=!0}isPartiallyCompatible(t,i,s){return this.transparency===(arguments.length>2&&void 0!==s?s:wt.BLEND)&&this.source===t&&ct(Object.assign(Object.assign({},this.Y),this.q),i)}arePropertiesPartiallyCompatible(t){return ct(Object.assign(Object.assign({},this.Y),this.q),t)}extractInstanceData(t){return{source:this.source,properties:this.st(t),transparency:this.transparency,transform:this.et(t),visibility:this.ht(t)}}destroy(){this.$.dispose(),this.G.dispose(),this.F.clear(),this.j.clear()}st(t){const i=this.J(t),s={};for(const t in this.Y)s[t]=this.Y[t];for(const t in this.q){const{value:e,glslTypeInfo:h}=this.q[t],r=this.F.get(t);s[t]={value:xt(e,r.array,i*r.itemSize),glslTypeInfo:h}}return s}et(t){const i=this.J(t),s=this.F.get("instanceTransform").array,e=new o;return e.fromArray(s,16*i),e}ht(t){const i=this.J(t);return this.F.get("instanceVisibility").array[i]>=.5}Z(t){if(this.X>=t)return;const i=4*Math.ceil(t/4);for(const[t,s]of this.F){const e=s.itemSize,h=new Float32Array(i*e);h.set(s.array);const r=new c(h,e);this.$.setAttribute("a_"+t,r),this.F.set(t,r)}this.X=i}K(t,i){for(const s of this.F.values()){const e=s.array,h=s.itemSize,r=t*h,n=i*h;for(let t=0;h>t;t++)e[n+t]=e[r+t];s.needsUpdate=!0}}tt(t,i){for(const[s,e]of this.j)if(e===t){this.j.set(s,i);break}}J(t){const i=this.j.get(t);if(void 0===i)throw Error("UIGenericInstancedPlane.resolveIndex.handler: invalid handler");return i}it(t){const i=this.F.get(t);if(void 0===i)throw Error("UIGenericInstancedPlane.resolveAttribute.name: unknown attribute");return i}}const It=new l(1,1).translate(.5,.5,0);class Et extends d{constructor(t,i,s,e,h){const r=((t,i,s,e)=>{const h={p_transform:{value:e}},r=[];for(const t in i){const{value:s,glslTypeInfo:e}=i[t];h["p_"+t]={value:s instanceof it?s.toGLSLColor():s},r.push(`uniform ${e.glslTypeName} p_${t};`)}const n=`\n // Default uniform declarations\n uniform mat4 p_transform;\n\n // Custom uniform declarations\n ${r.join("\n")}\n\n // Default varying declarations\n varying vec3 p_position;\n varying vec2 p_uv;\n\n void main() {\n p_position = position;\n p_uv = uv;\n\n gl_Position = projectionMatrix * p_transform * vec4(position, 1.0);\n }\n `,o=pt(r,[],t);return new u({uniforms:h,vertexShader:n,fragmentShader:o,transparent:s===wt.BLEND,alphaTest:s===wt.CLIP?.5:0,alphaHash:s===wt.HASH,depthWrite:s!==wt.BLEND,depthTest:!0})})(t,i,h,s);super(It,r),this.rt=t,this.G=r,this.nt=i,this.ot=h,this.lt=s,this.visible=e,this.frustumCulled=!1,this.matrixAutoUpdate=!1,this.matrixWorldAutoUpdate=!1}get transparency(){return this.ot}setProperties(t){for(const i in t){const s=t[i],h=ut(i,this.G),r=s.value;if(s.value instanceof it)s.value.toGLSLColor(h.value),this.nt[i].value.copy(s.value);else if("number"==typeof r||r instanceof e)h.value=s.value,this.nt[i].value=s.value;else{const t=s.value;h.value.copy(t),this.nt[i].value.copy(t)}}this.G.uniformsNeedUpdate=!0}setTransform(t){ut("transform",this.G).value.copy(t),this.G.uniformsNeedUpdate=!0,this.lt.copy(t)}setVisibility(t){this.visible=t}setTransparency(t){this.ot!==t&&(this.G.transparent=t===wt.BLEND,this.G.alphaTest=t===wt.CLIP?.5:0,this.G.alphaHash=t===wt.HASH,this.G.depthWrite=t!==wt.BLEND,this.G.needsUpdate=!0,this.ot=t)}extractPlaneData(){return{source:this.rt,properties:Object.assign({},this.nt),transform:this.lt.clone(),visibility:this.visible,transparency:this.ot}}isPartiallyCompatible(t,i,s){return this.ot===s&&this.rt===t&&ct(this.nt,i)}arePropertiesPartiallyCompatible(t){return ct(this.nt,t)}destroy(){this.G.dispose()}}function Mt(t){return!("instanceHandler"in t)}function Ct(t){return"instanceHandler"in t}class Tt{constructor(t){this.ut=t,this.C=0,this.ct=new Map}createPlane(t,i,s,e,h){const r=this.C++;return this.dt(r,{source:t,properties:dt(vt(i)),transform:s.clone(),visibility:e,transparency:h}),r}destroyPlane(t){const i=this.ft(t);if(Mt(i))this.ut.remove(i.plane),i.plane.destroy();else{const t=i.plane;1===t.instanceCount?(this.ut.remove(t),t.destroy()):2===t.instanceCount?this.vt(t,i):t.destroyInstance(i.instanceHandler)}this.ct.delete(t)}setProperties(t,i){const s=this.ft(t),e=dt(i);if(Mt(s))return void s.plane.setProperties(e);if(s.plane.arePropertiesPartiallyCompatible(e))return void s.plane.setProperties(s.instanceHandler,e);const h=s.plane.extractInstanceData(s.instanceHandler);for(const t in e)h.properties[t]={value:ft(e[t].value),glslTypeInfo:e[t].glslTypeInfo};this.destroyPlane(t),this.dt(t,h)}setTransform(t,i){const s=this.ft(t);Mt(s)?s.plane.setTransform(i):s.plane.setTransform(s.instanceHandler,i)}setVisibility(t,i){const s=this.ft(t);Mt(s)?s.plane.setVisibility(i):s.plane.setVisibility(s.instanceHandler,i)}setTransparency(t,i){const s=this.ft(t);if(s.plane.transparency===i)return;if(Mt(s))return void s.plane.setTransparency(i);const e=s.plane.extractInstanceData(s.instanceHandler);this.destroyPlane(t),this.dt(t,Object.assign(Object.assign({},e),{transparency:i}))}wt(t,i){const{source:s,properties:e,transform:h,visibility:r,transparency:n}=i.plane.extractPlaneData();this.destroyPlane(t);const o=new St(s,e,n),l=o.createInstance();return o.setProperties(l,e),o.setTransform(l,h),o.setVisibility(l,r),this.ut.add(o),this.ct.set(t,{plane:o,instanceHandler:l}),o}vt(t,i){let s;for(const[e,h]of this.ct)if(Ct(h)&&h!==i&&h.plane===t){s=[e,h];break}if(!s)throw Error("UIGenericPlaneRegistry.demoteInstancedPlaneToSinglePlane.instancedPlane: remaining pair not found");const{source:e,properties:h,transform:r,visibility:n,transparency:o}=t.extractInstanceData(s[1].instanceHandler);this.ut.remove(t),t.destroy();const l=new Et(e,h,r,n,o);this.ut.add(l),this.ct.set(s[0],{plane:l})}gt(t,i,s,e,h){const r=i.createInstance();i.setProperties(r,s),i.setTransform(r,e),i.setVisibility(r,h),this.ct.set(t,{plane:i,instanceHandler:r})}dt(t,i){const{source:s,properties:e,transparency:h,transform:r,visibility:n}=i,o=this.yt(s,e,h);if(o)return void this.gt(t,o,e,r,n);const l=this.bt(s,e,h);if(l){const i=this.wt(l[0],l[1]);return void this.gt(t,i,e,r,n)}const a=new Et(s,e,r,n,h);this.ut.add(a),this.ct.set(t,{plane:a})}bt(t,i,s){for(const e of this.ct){const h=e[1];if(Mt(h)&&h.plane.isPartiallyCompatible(t,i,s))return[e[0],h]}}yt(t,i,s){for(const e of this.ct){const h=e[1];if(Ct(h)&&h.plane.isPartiallyCompatible(t,i,s))return h.plane}}ft(t){const i=this.ct.get(t);if(!i)throw Error("UIGenericPlaneRegistry.resolvePlaneDescriptor.handler: descriptor not found");return i}}let Pt=new i,Ht=0,At=!1,Ut=!1,Vt=!1,Rt=!1;class Bt{constructor(t,i){this.ut=new f,this._t=new Tt(this.ut),this.xt=new v(0,t,i,0,-1024,1024)}createPlane(t,i,s,e,h){return this._t.createPlane(t,i,s,e,h)}destroyPlane(t){this._t.destroyPlane(t)}setTransform(t,i){this._t.setTransform(t,i)}setProperties(t,i){this._t.setProperties(t,i)}setVisibility(t,i){this._t.setVisibility(t,i)}setTransparency(t,i){this._t.setTransparency(t,i)}insertCustomObject(t){return this.ut.add(t),this}removeCustomObject(t){return this.ut.remove(t),this}resize(t,i){return this.xt.right=t,this.xt.top=i,this.xt.updateProjectionMatrix(),this}render(t){return Pt=t.getClearColor(Pt),Ht=t.getClearAlpha(),At=t.autoClear,Ut=t.autoClearColor,Vt=t.autoClearDepth,Rt=t.autoClearStencil,t.autoClear=!1,t.autoClearColor=!1,t.autoClearDepth=!1,t.autoClearStencil=!1,t.setClearColor(0,1),t.clear(!1,!0,!0),t.render(this.ut,this.xt),t.setClearColor(Pt),t.setClearAlpha(Ht),t.autoClear=At,t.autoClearColor=Ut,t.autoClearDepth=Vt,t.autoClearStencil=Rt,this}}class Lt{constructor(t,i){let s=arguments.length>1?i:void 0;if(this.constant=arguments.length>0&&void 0!==t?t:0,this.St=s?new Map(s):new Map,s)for(let t=0;s.length>t;t++)Gt()}static plus(t,i){const s=new Lt(t.constant+i.constant,Array.from(t.St.entries()));for(const[t,e]of i.St)s.plus(t,e);return s}static minus(t,i){const s=new Lt(t.constant-i.constant,Array.from(t.St.entries()));for(const[t,e]of i.St)s.minus(t,e);return s}plus(t,i){var s;return this.St.set(t,(null!==(s=this.St.get(t))&&void 0!==s?s:0)+i),this}minus(t,i){return this.plus(t,-i)}multiply(t){this.constant*=t;for(const[i,s]of this.St)this.St.set(i,s*t);return this}divide(t){if(0===t)throw Error("UIExpression.divide.value: cannot divide by zero");return this.multiply(1/t)}hasTerm(t){return this.St.has(t)}copy(t){this.constant=t.constant,this.St.clear();for(const[i,s]of t.St)this.St.set(i,s);return this}clone(){return new Lt(this.constant,Array.from(this.St.entries()))}prepareTerms(){return Array.from(this.St.entries())}}var Dt,kt;(t=>{t[t.EQUAL=0]="EQUAL",t[t.LESS_THAN=1]="LESS_THAN",t[t.GREATER_THAN=2]="GREATER_THAN"})(Dt||(Dt={}));class Ot{constructor(){this.dirty=!1,this.It=new j,this.Et=!1,this.Mt=new Map,this.Ct=0,this.Tt=new Map,this.Pt=0}createVariable(t,i){var s,e,h;const r=this.Ct++,n=new R;if(i===X.P0){const e={variable:n,priority:i,value:t};this.Mt.set(r,e),e.constraint=this.Ht(new Lt(0,[[r,1]]),new Lt(t),Dt.EQUAL,i);try{null===(s=this.It)||void 0===s||s.addConstraint(e.constraint)}catch(t){this.It=void 0}}else{this.Mt.set(r,{variable:n,priority:i,value:t});try{null===(e=this.It)||void 0===e||e.addEditVariable(n,Z(i)),null===(h=this.It)||void 0===h||h.suggestValue(n,t)}catch(t){this.It=void 0}}return this.Et=!0,this.dirty=!0,r}removeVariable(t){var i,s;const e=this.Mt.get(t);if(void 0===e)throw Error("UISolverWrapper.removeVariable.index: variable does not exist");for(const i of this.Tt.values())if(i.lhs.hasTerm(t)||i.rhs.hasTerm(t))throw Error("UISolverWrapper.removeVariable.index: variable is used in constraint");try{e.constraint?null===(i=this.It)||void 0===i||i.removeConstraint(e.constraint):null===(s=this.It)||void 0===s||s.removeEditVariable(e.variable)}catch(t){this.It=void 0}this.Mt.delete(t),this.Et=!0,this.dirty=!0}suggestVariableValue(t,i){var s;const e=this.Mt.get(t);if(void 0===e)throw Error("UISolverWrapper.suggestVariableValue.index: variable does not exist");e.value!==i&&(e.value=i,e.constraint?e.constraint=this.At(e.constraint,(new Lt).plus(t,1),new Lt(e.value),Dt.EQUAL,e.priority):null===(s=this.It)||void 0===s||s.suggestValue(e.variable,i),this.Et=!0,this.dirty=!0)}setVariablePriority(t,i){var s,e;const h=this.Mt.get(t);if(void 0===h)throw Error("UISolverWrapper.setVariablePriority.index: variable does not exist");if(i!==h.priority){if(h.priority=i,h.priority===X.P0){const i=(new Lt).plus(t,1),e=new Lt(h.value);h.constraint=this.Ht(i,e,Dt.EQUAL,h.priority);try{null===(s=this.It)||void 0===s||s.addConstraint(h.constraint)}catch(t){this.It=void 0}}else{if(h.constraint)try{null===(e=this.It)||void 0===e||e.removeConstraint(h.constraint)}catch(t){this.It=void 0}h.constraint=void 0,this.Ut(t,h)}this.Et=!0,this.dirty=!0}}readVariableValue(t){var i;const s=this.Mt.get(t);if(void 0===s)throw Error("UISolverWrapper.readVariableValue.index: variable does not exist");return void 0===this.It&&this.Vt(),this.Et&&(null===(i=this.It)||void 0===i||i.updateVariables(),this.Et=!1),s.variable.value()}createConstraint(t,i,s,e,h){var r;const n=this.Pt++,o=this.Ht(t,i,s,e);if(this.Tt.set(n,{constraint:o,lhs:t.clone(),rhs:i.clone(),priority:e,relation:s,enabled:h}),h){try{null===(r=this.It)||void 0===r||r.addConstraint(o)}catch(t){this.It=void 0}this.Et=!0,this.dirty=!0}return n}removeConstraint(t){var i;const s=this.Tt.get(t);if(void 0===s)throw Error("UISolverWrapper.removeConstraint.index: constraint does not exist");if(s.enabled)try{null===(i=this.It)||void 0===i||i.removeConstraint(s.constraint)}catch(t){this.It=void 0}this.Tt.delete(t),this.Et=!0,this.dirty=!0}setConstraintLHS(t,i){const s=this.Tt.get(t);if(void 0===s)throw Error("UISolverWrapper.setConstraintLHS.index: constraint does not exist");s.lhs.copy(i),this.Rt(s),this.Et=!0,this.dirty=!0}setConstraintRHS(t,i){const s=this.Tt.get(t);if(void 0===s)throw Error("UISolverWrapper.setConstraintRHS.index: constraint does not exist");s.rhs.copy(i),this.Rt(s),this.Et=!0,this.dirty=!0}setConstraintRelation(t,i){const s=this.Tt.get(t);if(void 0===s)throw Error("UISolverWrapper.setConstraintRelation.index: constraint does not exist");s.relation!==i&&(s.relation=i,this.Rt(s),this.Et=!0,this.dirty=!0)}setConstraintPriority(t,i){const s=this.Tt.get(t);if(void 0===s)throw Error("UISolverWrapper.setConstraintPriority.index: constraint does not exist");s.priority!==i&&(s.priority=i,this.Rt(s),this.Et=!0,this.dirty=!0)}setConstraintEnabled(t,i){var s,e;const h=this.Tt.get(t);if(void 0===h)throw Error("UISolverWrapper.setConstraintEnabled.index: constraint does not exist");if(i!==h.enabled){h.enabled=i;try{h.enabled?null===(s=this.It)||void 0===s||s.addConstraint(h.constraint):null===(e=this.It)||void 0===e||e.removeConstraint(h.constraint)}catch(t){this.It=void 0}this.Et=!0,this.dirty=!0}}Ut(t,i){var s,e,h,r;const n=[];for(const i of this.Tt.values())if(i.lhs.hasTerm(t)||i.rhs.hasTerm(t)){try{null===(s=this.It)||void 0===s||s.removeConstraint(i.constraint)}catch(t){this.It=void 0}n.push(i)}null===(e=this.It)||void 0===e||e.removeEditVariable(i.variable),null===(h=this.It)||void 0===h||h.addEditVariable(i.variable,Z(i.priority));for(const t of n)t.constraint=this.Ht(t.lhs,t.rhs,t.relation,t.priority);for(const t of n)try{null===(r=this.It)||void 0===r||r.addConstraint(t.constraint)}catch(t){this.It=void 0;break}}Rt(t){t.constraint=t.enabled?this.At(t.constraint,t.lhs,t.rhs,t.relation,t.priority):this.Ht(t.lhs,t.rhs,t.relation,t.priority)}At(t,i,s,e,h){var r,n;try{null===(r=this.It)||void 0===r||r.removeConstraint(t)}catch(t){this.It=void 0}const o=this.Ht(i,s,e,h);try{null===(n=this.It)||void 0===n||n.addConstraint(o)}catch(t){this.It=void 0}return o}Ht(t,i,s,e){return new W(this.Bt(t),(t=>{switch(t){case Dt.EQUAL:return k.Eq;case Dt.LESS_THAN:return k.Le;case Dt.GREATER_THAN:return k.Ge;default:throw Error("convertRelation.relation: invalid relation")}})(s),this.Bt(i),Z(e))}Bt(t){return new L(...t.prepareTerms().map(t=>{let[i,s]=t;const e=this.Mt.get(i);if(void 0===e)throw Error("UISolverWrapper.convertExpression.expression: variable does not exist");return[s,e.variable]}),t.constant)}Vt(){if(this.It)throw Error("UISolverWrapper.rebuildSolver: solver already exists");this.It=new j;for(const t of this.Mt.values())t.constraint?this.It.addConstraint(t.constraint):(this.It.addEditVariable(t.variable,Z(t.priority)),this.It.suggestValue(t.variable,t.value));for(const t of this.Tt.values())t.enabled&&this.It.addConstraint(t.constraint);this.Et=!0,this.dirty=!0}}(t=>{t.ORIENTATION_CHANGED="orientation_changed",t.MODE_CHANGED="mode_changed",t.RENDERING="rendering"})(kt||(kt={}));const Wt=M.VISIBLE;class Nt extends E{constructor(t){var i,s,e,h;super(),this.name="",this.inputWrapperInternal=new J,this.Lt=new Ot;const r=null!==(i=t.width)&&void 0!==i?i:1024,n=null!==(s=t.height)&&void 0!==s?s:1024;this.Dt=new Bt(r,n),this.name=null!==(e=t.name)&&void 0!==e?e:"",this.kt=null!==(h=t.mode)&&void 0!==h?h:Wt,this.Ot=r>n?C.HORIZONTAL:C.VERTICAL,this.xVariable=this.Lt.createVariable(0,X.P0),this.yVariable=this.Lt.createVariable(0,X.P0),this.wVariable=this.Lt.createVariable(r,X.P0),this.hVariable=this.Lt.createVariable(n,X.P0)}get sceneWrapper(){return this.Dt}get solverWrapper(){return this.Lt}get inputWrapper(){return this.inputWrapperInternal}get x(){return this.Lt.readVariableValue(this.xVariable)}get y(){return this.Lt.readVariableValue(this.yVariable)}get width(){return this.Lt.readVariableValue(this.wVariable)}get height(){return this.Lt.readVariableValue(this.hVariable)}get mode(){return this.kt}get orientation(){return this.Ot}set mode(t){t!==this.kt&&(this.kt=t,this.emit(kt.MODE_CHANGED,this.kt,this))}resizeInternal(t,i){this.Lt.suggestVariableValue(this.wVariable,t),this.Lt.suggestVariableValue(this.hVariable,i),this.Dt.resize(t,i);const s=t>i?C.HORIZONTAL:C.VERTICAL;s!==this.Ot&&(this.Ot=s,this.emit(kt.ORIENTATION_CHANGED,this.Ot,this))}renderInternal(t,i){P(this.mode)&&(this.emit(kt.RENDERING,t,i,this),this.Dt.render(t)),this.Lt.dirty=!1,this.inputWrapperInternal.dirty=!1}}function jt(t){return"object"==typeof t&&null!==t&&"layer"in t&&t.layer instanceof Nt}function zt(t){return"object"==typeof t&&null!==t&&"xVariable"in t&&"number"==typeof t.xVariable&&"yVariable"in t&&"number"==typeof t.yVariable&&"width"in t&&"number"==typeof t.width&&"height"in t&&"number"==typeof t.height}function Ft(t){return"object"==typeof t&&null!==t&&"wVariable"in t&&"number"==typeof t.wVariable&&"hVariable"in t&&"number"==typeof t.hVariable&&"width"in t&&"number"==typeof t.width&&"height"in t&&"number"==typeof t.height}const $t=1e-6;function Gt(){}function Yt(t,i,s){if(t instanceof Nt)return t;if(jt(t))return t.layer;if(i instanceof Nt)return i;if(jt(i))return i.layer;throw Error(s+": no valid subjects found")}function qt(t,i,s){if(jt(i))return i.layer;if(jt(s))return s.layer;if(i instanceof Nt)return i;if(s instanceof Nt)return s;throw Error(t+": no valid subjects found")}class Xt{constructor(t,i){this.layer=t,this.solverWrapper=this.layer.solverWrapper,this.name=null!=i?i:""}}class Zt extends Xt{constructor(t,i){var s,e,h;super(t,null==i?void 0:i.name),this.Wt=()=>{this.solverWrapper.setConstraintEnabled(this.constraint,this.isConstraintEnabled())},this.Nt=null!=(s=null==i?void 0:i.priority)?s:X.P0,this.jt=null!=(e=null==i?void 0:i.relation)?e:Dt.EQUAL,this.Ot=null!=(h=null==i?void 0:i.orientation)?h:C.ALWAYS,this.layer.on(kt.ORIENTATION_CHANGED,this.Wt)}get priority(){return this.Nt}get relation(){return this.jt}get orientation(){return this.Ot}set priority(t){t!==this.Nt&&(this.Nt=t,this.solverWrapper.setConstraintPriority(this.constraint,this.Nt))}set relation(t){t!==this.jt&&(this.jt=t,this.solverWrapper.setConstraintRelation(this.constraint,this.jt))}set orientation(t){t!==this.Ot&&(this.Ot=t,this.Wt())}destroy(){this.layer.off(kt.ORIENTATION_CHANGED,this.Wt),this.solverWrapper.removeConstraint(this.constraint)}isConstraintEnabled(){return this.Ot===C.ALWAYS||this.Ot===this.layer.orientation}}class Jt extends Zt{constructor(t,i){let s=arguments.length>1&&void 0!==i?i:{};var e;super(t.layer,s),this.zt=t,this.Ft=null!==(e=s.height)&&void 0!==e?e:t.height,this.constraint=this.solverWrapper.createConstraint(new Lt(0,[[this.zt.hVariable,1]]),new Lt(this.Ft),this.relation,this.priority,this.isConstraintEnabled())}get height(){return this.Ft}set height(t){this.Ft!==t&&(this.Ft=t,this.solverWrapper.setConstraintRHS(this.constraint,new Lt(t)))}}class Kt extends Zt{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r,n;super(Yt(t,i,"UIHorizontalDistanceConstraint.constructor"),e),this.$t=t,this.Gt=i,this.Yt=null!==(h=e.anchorA)&&void 0!==h?h:.5,this.qt=null!==(r=e.anchorB)&&void 0!==r?r:.5,this.Xt=null!==(n=e.distance)&&void 0!==n?n:0,this.constraint=this.solverWrapper.createConstraint(this.Zt(),new Lt(this.Xt),this.relation,this.priority,this.isConstraintEnabled())}get distance(){return this.Xt}get anchorA(){return this.Yt}get anchorB(){return this.qt}set distance(t){this.Xt!==t&&(this.Xt=t,this.solverWrapper.setConstraintRHS(this.constraint,new Lt(this.Xt)))}set anchorA(t){this.Yt!==t&&(this.Yt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorB(t){this.qt!==t&&(this.qt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}Zt(){let t,i;if(Ft(this.$t))t=new Lt(0,[[this.$t.xVariable,1],[this.$t.wVariable,this.Yt]]);else{if(!zt(this.$t))throw Error("UIHorizontalDistanceConstraint.buildLHS.a: invalid element type");t=(new Lt).plus(this.$t.xVariable,1)}if(Ft(this.Gt))i=new Lt(0,[[this.Gt.xVariable,1],[this.Gt.wVariable,this.qt]]);else{if(!zt(this.Gt))throw Error("UIHorizontalDistanceConstraint.buildLHS.b: invalid element type");i=(new Lt).plus(this.Gt.xVariable,1)}return Lt.minus(i,t)}}class Qt extends Zt{constructor(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:{};var r,n,o;const l=null!==(r=h.anchorA)&&void 0!==r?r:.5;super(qt("UIHorizontalInterpolationConstraint.constructor",t,i),h),this.$t=t,this.Gt=i,this.Jt=s,this.Yt=l,this.qt=l,this.Kt=null!==(n=h.anchorC)&&void 0!==n?n:.5,this.Qt=null!==(o=h.t)&&void 0!==o?o:.5,this.constraint=this.solverWrapper.createConstraint(this.Zt(),new Lt(0),this.relation,this.priority,this.isConstraintEnabled())}get t(){return this.Qt}get anchorA(){return this.Yt}get anchorB(){return this.qt}get anchorC(){return this.Kt}set t(t){this.Qt!==t&&(this.Qt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorA(t){this.Yt!==t&&(this.Yt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorB(t){this.qt!==t&&(this.qt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorC(t){this.Kt!==t&&(this.Kt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}Zt(){let t,i,s;if(Ft(this.$t))t=new Lt(0,[[this.$t.xVariable,1],[this.$t.wVariable,this.Yt]]);else{if(!zt(this.$t))throw Error("UIHorizontalInterpolationConstraint.buildLHS.a: invalid element type");t=(new Lt).plus(this.$t.xVariable,1)}if(Ft(this.Gt))i=new Lt(0,[[this.Gt.xVariable,1],[this.Gt.wVariable,this.qt]]);else{if(!zt(this.Gt))throw Error("UIHorizontalInterpolationConstraint.buildLHS.b: invalid element type");i=(new Lt).plus(this.Gt.xVariable,1)}if(Ft(this.Jt))s=new Lt(0,[[this.Jt.xVariable,1],[this.Jt.wVariable,this.Kt]]);else{if(!zt(this.Jt))throw Error("UIHorizontalInterpolationConstraint.buildLHS.c: invalid element type");s=(new Lt).plus(this.Jt.xVariable,1)}const e=t.clone().multiply(1-this.Qt),h=i.clone().multiply(this.Qt);return Lt.minus(Lt.minus(s,e),h)}}class ti extends Zt{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h;super(Yt(t,i,"UIHorizontalProportionConstraint.constructor"),e),this.$t=t,this.Gt=i,this.ti=null!==(h=e.proportion)&&void 0!==h?h:1,this.constraint=this.solverWrapper.createConstraint(new Lt(0),this.ii(),this.relation,this.priority,this.isConstraintEnabled())}get proportion(){return this.ti}set proportion(t){this.ti!==t&&(this.ti=t,this.solverWrapper.setConstraintRHS(this.constraint,this.ii()))}ii(){return Lt.minus(new Lt(0,[[this.$t.wVariable,this.ti]]),new Lt(0,[[this.Gt.wVariable,1]]))}}class ii extends Zt{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r,n;super(Yt(t,i,"UIVerticalDistanceConstraint.constructor"),e),this.$t=t,this.Gt=i,this.Yt=null!==(h=e.anchorA)&&void 0!==h?h:.5,this.qt=null!==(r=e.anchorB)&&void 0!==r?r:.5,this.Xt=null!==(n=e.distance)&&void 0!==n?n:0,this.constraint=this.solverWrapper.createConstraint(this.Zt(),new Lt(this.Xt),this.relation,this.priority,this.isConstraintEnabled())}get distance(){return this.Xt}get anchorA(){return this.Yt}get anchorB(){return this.qt}set distance(t){this.Xt!==t&&(this.Xt=t,this.solverWrapper.setConstraintRHS(this.constraint,new Lt(this.Xt)))}set anchorA(t){this.Yt!==t&&(this.Yt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorB(t){this.qt!==t&&(this.qt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}Zt(){let t,i;if(Ft(this.$t))t=new Lt(0,[[this.$t.yVariable,1],[this.$t.hVariable,this.Yt]]);else{if(!zt(this.$t))throw Error("UIVerticalDistanceConstraint.buildLHS.a: invalid element type");t=(new Lt).plus(this.$t.yVariable,1)}if(Ft(this.Gt))i=new Lt(0,[[this.Gt.yVariable,1],[this.Gt.hVariable,this.qt]]);else{if(!zt(this.Gt))throw Error("UIVerticalDistanceConstraint.buildLHS.b: invalid element type");i=(new Lt).plus(this.Gt.yVariable,1)}return Lt.minus(i,t)}}class si extends Zt{constructor(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:{};var r,n,o;const l=null!==(r=h.anchorA)&&void 0!==r?r:.5;super(qt("UIVerticalInterpolationConstraint.constructor",t,i),h),this.$t=t,this.Gt=i,this.Jt=s,this.Yt=l,this.qt=l,this.Kt=null!==(n=h.anchorC)&&void 0!==n?n:.5,this.Qt=null!==(o=h.t)&&void 0!==o?o:.5,this.constraint=this.solverWrapper.createConstraint(this.Zt(),new Lt(0),this.relation,this.priority,this.isConstraintEnabled())}get t(){return this.Qt}get anchorA(){return this.Yt}get anchorB(){return this.qt}get anchorC(){return this.Kt}set t(t){this.Qt!==t&&(this.Qt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorA(t){this.Yt!==t&&(this.Yt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorB(t){this.qt!==t&&(this.qt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorC(t){this.Kt!==t&&(this.Kt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}Zt(){let t,i,s;if(Ft(this.$t))t=new Lt(0,[[this.$t.yVariable,1],[this.$t.hVariable,this.Yt]]);else{if(!zt(this.$t))throw Error("UIVerticalInterpolationConstraint.buildLHS.a: invalid element type");t=(new Lt).plus(this.$t.yVariable,1)}if(Ft(this.Gt))i=new Lt(0,[[this.Gt.yVariable,1],[this.Gt.hVariable,this.qt]]);else{if(!zt(this.Gt))throw Error("UIVerticalInterpolationConstraint.buildLHS.b: invalid element type");i=(new Lt).plus(this.Gt.yVariable,1)}if(Ft(this.Jt))s=new Lt(0,[[this.Jt.yVariable,1],[this.Jt.hVariable,this.Kt]]);else{if(!zt(this.Jt))throw Error("UIVerticalInterpolationConstraint.buildLHS.c: invalid element type");s=(new Lt).plus(this.Jt.yVariable,1)}const e=t.clone().multiply(1-this.Qt),h=i.clone().multiply(this.Qt);return Lt.minus(Lt.minus(s,e),h)}}class ei extends Zt{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h;super(Yt(t,i,"UIVerticalProportionConstraint.constructor"),e),this.$t=t,this.Gt=i,this.ti=null!==(h=e.proportion)&&void 0!==h?h:1,this.constraint=this.solverWrapper.createConstraint(new Lt(0),this.ii(),this.relation,this.priority,this.isConstraintEnabled())}get proportion(){return this.ti}set proportion(t){this.ti!==t&&(this.ti=t,this.solverWrapper.setConstraintRHS(this.constraint,this.ii()))}ii(){return Lt.minus(new Lt(0,[[this.$t.hVariable,this.ti]]),new Lt(0,[[this.Gt.hVariable,1]]))}}class hi extends Zt{constructor(t,i){let s=arguments.length>1&&void 0!==i?i:{};var e;super(t.layer,s),this.zt=t,this.si=null!==(e=s.width)&&void 0!==e?e:t.width,this.constraint=this.solverWrapper.createConstraint(new Lt(0,[[this.zt.wVariable,1]]),new Lt(this.si),this.relation,this.priority,this.isConstraintEnabled())}get width(){return this.si}set width(t){this.si!==t&&(this.si=t,this.solverWrapper.setConstraintRHS(this.constraint,new Lt(t)))}}function ri(t){return void 0===t?{}:Array.isArray(t)?{h:t[0],v:t[1]}:"object"==typeof t&&null!==t&&("h"in t||"v"in t)?t:{h:t,v:t}}class ni{static size(t,i){let s=arguments.length>1&&void 0!==i?i:{};const e=ri(s.size),h=ri(s.priority),r=ri(s.relation),n=ri(s.orientation);return{h:new hi(t,{width:e.h,priority:h.h,relation:r.h,orientation:n.h}),v:new Jt(t,{height:e.v,priority:h.v,relation:r.v,orientation:n.v})}}static distance(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};const h=ri(e.anchorA),r=ri(e.anchorB),n=ri(e.distance),o=ri(e.priority),l=ri(e.relation),a=ri(e.orientation);return{h:new Kt(t,i,{anchorA:h.h,anchorB:r.h,distance:n.h,priority:o.h,relation:l.h,orientation:a.h}),v:new ii(t,i,{anchorA:h.v,anchorB:r.v,distance:n.v,priority:o.v,relation:l.v,orientation:a.v})}}static proportion(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};const h=ri(e.proportion),r=ri(e.priority),n=ri(e.relation),o=ri(e.orientation);return{h:new ti(t,i,{proportion:h.h,priority:r.h,relation:n.h,orientation:o.h}),v:new ei(t,i,{proportion:h.v,priority:r.v,relation:n.v,orientation:o.v})}}static interpolation(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:{};const r=ri(h.anchorA),n=ri(h.anchorB),o=ri(h.anchorC),l=ri(h.t),a=ri(h.priority),u=ri(h.relation),c=ri(h.orientation);return{h:new Qt(t,i,s,{anchorA:r.h,anchorB:n.h,anchorC:o.h,t:l.h,priority:a.h,relation:u.h,orientation:c.h}),v:new si(t,i,s,{anchorA:r.v,anchorB:n.v,anchorC:o.v,t:l.v,priority:a.v,relation:u.v,orientation:c.v})}}}class oi extends Zt{constructor(t,i){let s=arguments.length>1&&void 0!==i?i:{};var e;super(t.layer,s),this.zt=t,this.ei=null!==(e=s.aspect)&&void 0!==e?e:t.width/t.height,this.constraint=this.solverWrapper.createConstraint(this.Zt(),new Lt(0),this.relation,this.priority,this.isConstraintEnabled())}get aspect(){return this.ei}set aspect(t){this.ei!==t&&(this.ei=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}Zt(){return new Lt(0,[[this.zt.wVariable,1],[this.zt.hVariable,-this.ei]])}}const li=.5;class ai{static build(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r,n,o;let l;return!0===e.keepActiveAspect&&(l=new oi(i,{orientation:e.orientation})),{activeAspectConstraint:l,xConstraint:new Kt(t,i,{anchorA:null!==(h=e.anchorH)&&void 0!==h?h:li,anchorB:null!==(r=e.anchorH)&&void 0!==r?r:li,orientation:e.orientation}),yConstraint:new ii(t,i,{anchorA:null!==(n=e.anchorV)&&void 0!==n?n:li,anchorB:null!==(o=e.anchorV)&&void 0!==o?o:li,orientation:e.orientation}),widthConstraint:new ti(t,i,{proportion:1,relation:Dt.GREATER_THAN,orientation:e.orientation}),heightConstraint:new ei(t,i,{proportion:1,priority:X.P1,orientation:e.orientation})}}}const ui=.5;class ci{static build(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r,n,o;let l;return!0===e.keepActiveAspect&&(l=new oi(i,{orientation:e.orientation})),{activeAspectConstraint:l,xConstraint:new Kt(t,i,{anchorA:null!==(h=e.anchorH)&&void 0!==h?h:ui,anchorB:null!==(r=e.anchorH)&&void 0!==r?r:ui,orientation:e.orientation}),yConstraint:new ii(t,i,{anchorA:null!==(n=e.anchorV)&&void 0!==n?n:ui,anchorB:null!==(o=e.anchorV)&&void 0!==o?o:ui,orientation:e.orientation}),widthConstraint:new ti(t,i,{proportion:1,relation:Dt.LESS_THAN,orientation:e.orientation}),heightConstraint:new ei(t,i,{proportion:1,priority:X.P1,orientation:e.orientation})}}}class di extends Zt{constructor(t,i,s,e){super(t,arguments.length>3&&void 0!==e?e:{}),this.hi=i,this.ri=s,this.constraint=this.solverWrapper.createConstraint(this.hi,this.ri,this.relation,this.priority,this.isConstraintEnabled())}get lhs(){return this.hi}get rhs(){return this.ri}setLHS(t){this.hi=t,this.solverWrapper.setConstraintLHS(this.constraint,this.hi)}setRHS(t){this.ri=t,this.solverWrapper.setConstraintRHS(this.constraint,this.ri)}}class fi extends E{constructor(t,i){var s,e;const h=null!==(s=null==i?void 0:i.x)&&void 0!==s?s:0,r=null!==(e=null==i?void 0:i.y)&&void 0!==e?e:0;super(),this.layer=t,this.name="",this.solverWrapper=this.layer.solverWrapper,this.xVariable=this.solverWrapper.createVariable(h,X.P7),this.yVariable=this.solverWrapper.createVariable(r,X.P7)}get x(){return this.solverWrapper.readVariableValue(this.xVariable)}get y(){return this.solverWrapper.readVariableValue(this.yVariable)}set x(t){this.solverWrapper.suggestVariableValue(this.xVariable,t)}set y(t){this.solverWrapper.suggestVariableValue(this.yVariable,t)}destroy(){this.solverWrapper.removeVariable(this.yVariable),this.solverWrapper.removeVariable(this.xVariable)}}var vi;(t=>{t[t.ROTATION_SCALE=0]="ROTATION_SCALE",t[t.POSITION_ROTATION_SCALE=1]="POSITION_ROTATION_SCALE"})(vi||(vi={}));const pi=.5,wi=vi.ROTATION_SCALE,gi=new r,yi=new p,mi=new r,bi=new o,_i=new r(0,0,1);function xi(t,i,s,e,h,r,n,o,l,a,u,c,d,f,v,p,w){const g=s-f-v,y=e-p-w,m=o*s*a,b=l*e*u,_=Math.cos(c),x=Math.sin(c),S=m*_-b*x,I=m*x+b*_,E=f*a,M=w*u,C=E*_-M*x,T=E*x+M*_;if(d===vi.POSITION_ROTATION_SCALE)gi.x=t+r-S+C,gi.y=i+n-I+T;else{const h=l*e;gi.x=t+o*s-S+r+C,gi.y=i+h-I+n+T}return gi.z=h,mi.x=g*a,mi.y=y*u,yi.setFromAxisAngle(_i,c),bi.compose(gi,yi,mi),bi}const Si=new e;var Ii;(t=>{t[t.DIMENSIONS_CHANGED=0]="DIMENSIONS_CHANGED"})(Ii||(Ii={}));class Ei extends E{constructor(t){super(),this.ni=Si,this.oi=2,this.li=2,this.ai=0,this.ui=0,this.ci=2,this.di=2,this.fi=!1,this.pi=1,this.wi=0,this.gi=0,this.yi=0,this.mi=0,this.bi=!1,this._i=!1,this.xi=!1,void 0!==t&&this.set(t)}get width(){return this.oi/this.pi}get height(){return this.li/this.pi}get trimmedWidth(){return(this.fi?this.di:this.ci)/this.pi}get trimmedHeight(){return(this.fi?this.ci:this.di)/this.pi}get texture(){return this.ni}get rotated(){return this.fi}get scale(){return this.pi}get trim(){const t=this.pi;return{left:this.wi/t,right:this.gi/t,top:this.yi/t,bottom:this.mi/t}}get textureDirty(){return this.bi}get uvTransformDirty(){return this._i}get trimDirty(){return this.xi}setTextureDirtyFalse(){this.bi=!1}setUVTransformDirtyFalse(){this._i=!1}setTrimDirtyFalse(){this.xi=!1}calculateUVTransform(t){let i=arguments.length>0&&void 0!==t?t:new n;var s,e,h,r;const o=null!==(e=null===(s=this.ni.image)||void 0===s?void 0:s.naturalWidth)&&void 0!==e?e:2,l=null!==(r=null===(h=this.ni.image)||void 0===h?void 0:h.naturalHeight)&&void 0!==r?r:2;if(this.fi){const t=this.ci,s=t/l;i.set(0,this.di/o,this.ai/o,-s,0,(l-this.ui-t)/l+s,0,0,1)}else i.set(this.ci/o,0,this.ai/o,0,this.di/l,(l-this.ui-this.di)/l,0,0,1);return i}getResolution(t){return(arguments.length>0&&void 0!==t?t:new h).set(this.width,this.height)}set(t){const i=this.width,s=this.height;t instanceof e?this.Si(t):this.Ii(t),this.width===i&&this.height===s||this.emit(Ii.DIMENSIONS_CHANGED,this.width,this.height,this)}Si(t){var i,s,e,h;const r=null!==(s=null===(i=t.image)||void 0===i?void 0:i.naturalWidth)&&void 0!==s?s:2,n=null!==(h=null===(e=t.image)||void 0===e?void 0:e.naturalHeight)&&void 0!==h?h:2;this.oi=r,this.li=n,this.texture!==t&&(this.ni=t,this.bi=!0),(0!==this.ai||0!==this.ui||this.ci!==r||this.di!==n||1!==this.pi||this.fi)&&(this.ai=0,this.ui=0,this.ci=r,this.di=n,this.fi=!1,this.pi=1,this._i=!0),0===this.wi&&0===this.gi&&0===this.yi&&0===this.mi||(this.wi=0,this.gi=0,this.yi=0,this.mi=0,this.xi=!0)}Ii(t){var i,s;this.oi=t.sourceSize.w,this.li=t.sourceSize.h,this.texture!==t.texture&&(this.ni=t.texture,this.bi=!0);const e=null!==(i=t.scale)&&void 0!==i?i:1,h=null!==(s=t.rotated)&&void 0!==s&&s;0===this.ai&&0===this.ui&&this.ci===t.frame.w&&this.di===t.frame.h&&this.pi===e&&this.fi===h||(this.ai=t.frame.x,this.ui=t.frame.y,this.ci=t.frame.w,this.di=t.frame.h,this.pi=e,this.fi=h,this._i=!0);const r=t.spriteSourceSize,n=r.x,o=r.y,l=this.oi-r.x-r.w,a=this.li-r.y-r.h;this.wi===n&&this.gi===l&&this.yi===o&&this.mi===a||(this.wi=n,this.gi=l,this.yi=o,this.mi=a,this.xi=!0)}}var Mi,Ci="vec4 draw(){vec2 transformedUV=(p_textureTransform*vec3(p_uv,1.0)).xy;return texture2D(p_texture,transformedUV)*p_color;}";class Ti{constructor(t){var i,s,e,h,r,n,o,l;this.L=!0,this.Ei=null!==(i=null==t?void 0:t.x)&&void 0!==i?i:0,this.Mi=null!==(s=null==t?void 0:t.y)&&void 0!==s?s:0,this.Ci=null!==(e=null==t?void 0:t.anchorX)&&void 0!==e?e:pi,this.Ti=null!==(h=null==t?void 0:t.anchorY)&&void 0!==h?h:pi,this.Pi=null!==(r=null==t?void 0:t.scaleX)&&void 0!==r?r:1,this.Hi=null!==(n=null==t?void 0:t.scaleY)&&void 0!==n?n:1,this.Ai=null!==(o=null==t?void 0:t.rotation)&&void 0!==o?o:0,this.Ui=null!==(l=null==t?void 0:t.anchorMode)&&void 0!==l?l:wi}get x(){return this.Ei}get y(){return this.Mi}get anchorX(){return this.Ci}get anchorY(){return this.Ti}get scaleX(){return this.Pi}get scaleY(){return this.Hi}get angle(){return t.radToDeg(this.Ai)}get anchorMode(){return this.Ui}get rotation(){return this.Ai}get dirty(){return this.L}set x(t){t!==this.Ei&&(this.Ei=t,this.L=!0)}set y(t){t!==this.Mi&&(this.Mi=t,this.L=!0)}set anchorX(t){t!==this.Ci&&(this.Ci=t,this.L=!0)}set anchorY(t){t!==this.Ti&&(this.Ti=t,this.L=!0)}set scaleX(t){t!==this.Pi&&(this.Pi=t,this.L=!0)}set scaleY(t){t!==this.Hi&&(this.Hi=t,this.L=!0)}set angle(i){const s=t.degToRad(i);s!==this.Ai&&(this.Ai=s,this.L=!0)}set rotation(t){t!==this.Ai&&(this.Ai=t,this.L=!0)}set anchorMode(t){t!==this.Ui&&(this.Ui=t,this.L=!0)}setDirtyFalse(){this.L=!1}reset(){0===this.Ei&&0===this.Mi&&this.Ci===pi&&this.Ti===pi&&1===this.Pi&&1===this.Hi&&0===this.Ai||(this.Ei=0,this.Mi=0,this.Ci=pi,this.Ti=pi,this.Pi=1,this.Hi=1,this.Ai=0,this.L=!0)}copy(t){this.Ei===t.Ei&&this.Mi===t.Mi&&this.Ci===t.Ci&&this.Ti===t.Ti&&this.Pi===t.Pi&&this.Hi===t.Hi&&this.Ai===t.Ai&&this.Ui===t.Ui||(this.Ei=t.Ei,this.Mi=t.Mi,this.Ci=t.Ci,this.Ti=t.Ti,this.Pi=t.Pi,this.Hi=t.Hi,this.Ai=t.Ai,this.Ui=t.Ui,this.L=!0)}}class Pi{}class Hi extends Pi{constructor(t,i,s,e){super(),this.x=t,this.y=i,this.width=s,this.height=e}contains(t,i){return!(this.x>t||t>this.x+this.width||this.y>i||i>this.y+this.height)}}(t=>{t.PRESSED="pointerdown",t.MOVED="pointermove",t.RELEASED="pointerup",t.ENTERED="pointerenter",t.LEFT="pointerleave"})(Mi||(Mi={}));const Ai=M.VISIBLE;class Ui extends fi{constructor(t,i){var s,e,h,r;const n=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:64,o=null!==(e=null==i?void 0:i.height)&&void 0!==e?e:32;super(t,i),this.Vi=!1,this.catchPointerDown=(t,i,s)=>this.handleInputEvent(t,i,s,Mi.PRESSED),this.catchPointerMove=(t,i,s)=>this.handleInputEvent(t,i,s,Mi.MOVED),this.catchPointerUp=(t,i,s)=>this.handleInputEvent(t,i,s,Mi.RELEASED),this.interactionArea=null!==(h=null==i?void 0:i.interactionArea)&&void 0!==h?h:new Hi(0,0,1,1),this.modeInternal=null!==(r=null==i?void 0:i.mode)&&void 0!==r?r:Ai,this.inputWrapper=this.layer.inputWrapper,this.wVariable=this.solverWrapper.createVariable(n,X.P6),this.hVariable=this.solverWrapper.createVariable(o,X.P6),this.Ri=this.inputWrapper.createInputCatcher(this.catchPointerDown,this.catchPointerMove,this.catchPointerUp,0),this.inputWrapper.setActive(this.Ri,T(this.modeInternal))}get width(){return this.solverWrapper.readVariableValue(this.wVariable)}get height(){return this.solverWrapper.readVariableValue(this.hVariable)}get oppositeX(){return this.x+this.width}get oppositeY(){return this.y+this.height}get centerX(){return this.x+this.width/2}get centerY(){return this.y+this.height/2}get mode(){return this.modeInternal}get zIndex(){return this.inputWrapper.getZIndex(this.Ri)}set width(t){this.solverWrapper.suggestVariableValue(this.wVariable,t)}set height(t){this.solverWrapper.suggestVariableValue(this.hVariable,t)}set oppositeX(t){this.x=t-this.width}set oppositeY(t){this.y=t-this.height}set centerX(t){this.x=t-this.width/2}set centerY(t){this.y=t-this.height/2}set mode(t){if(this.modeInternal!==t){const i=T(t);this.inputWrapper.setActive(this.Ri,i),this.modeInternal=t}}set zIndex(t){this.inputWrapper.setZIndex(this.Ri,t)}destroy(){this.solverWrapper.removeVariable(this.hVariable),this.solverWrapper.removeVariable(this.wVariable),this.inputWrapper.destroyInputCatcher(this.Ri),super.destroy()}handleInputEvent(i,s,e,h){const r=this.interactionArea.contains(t.mapLinear(i,this.x,this.oppositeX,0,1),t.mapLinear(s,this.y,this.oppositeY,0,1));return r&&this.emit(h,i,s,e,this),this.Vi&&!r?this.emit(Mi.LEFT,i,s,e,this):!this.Vi&&r&&this.emit(Mi.ENTERED,i,s,e,this),this.Vi=r,this.modeInternal!==M.INTERACTIVE_TRANSPARENT&&r}}const Vi=wt.BLEND;class Ri extends Ui{constructor(t,i,s,e){var h,r;super(t,e),this.Bi=!1,this.Li=!1,this.micro=new Ti(null==e?void 0:e.micro),this.Di=null!==(h=null==e?void 0:e.transparencyMode)&&void 0!==h?h:Vi,this.sceneWrapper=this.layer.sceneWrapper,this.planeHandler=this.sceneWrapper.createPlane(i,s,(new o).identity(),P(null!==(r=null==e?void 0:e.mode)&&void 0!==r?r:this.mode),this.Di),this.layer.on(kt.RENDERING,this.onWillRender,this)}get transparencyMode(){return this.Di}set transparencyMode(t){this.Di!==t&&(this.Di=t,this.Bi=!0)}set mode(t){this.modeInternal!==t&&(this.Li=P(this.modeInternal)!==P(t),super.mode=t)}destroy(){this.layer.off(kt.RENDERING,this.onWillRender,this),this.sceneWrapper.destroyPlane(this.planeHandler),super.destroy()}setPlaneTransform(){(this.micro.dirty||this.inputWrapper.dirty||this.solverWrapper.dirty)&&(this.sceneWrapper.setTransform(this.planeHandler,((t,i,s,e,h,r,n,o,l,a,u,c,d)=>{const f=s*this.micro.scaleX,v=e*this.micro.scaleY,p=o*f,w=l*v,g=Math.cos(c),y=Math.sin(c),m=p*g-w*y,b=p*y+w*g;if(d===vi.POSITION_ROTATION_SCALE)gi.x=t+r-m,gi.y=i+n-b;else{const h=l*e;gi.x=t+o*s-m+r,gi.y=i+h-b+n}return gi.z=h,mi.x=f,mi.y=v,yi.setFromAxisAngle(_i,c),bi.compose(gi,yi,mi),bi})(this.x,this.y,this.width,this.height,this.zIndex,this.micro.x,this.micro.y,this.micro.anchorX,this.micro.anchorY,0,0,this.micro.rotation,this.micro.anchorMode)),this.micro.setDirtyFalse())}onWillRender(t,i){this.Bi&&(this.sceneWrapper.setTransparency(this.planeHandler,this.Di),this.Bi=!1),this.Li&&(this.sceneWrapper.setVisibility(this.planeHandler,P(this.modeInternal)),this.Li=!1),this.setPlaneTransform()}}var Bi,Li;(t=>{t[t.PLAYED=0]="PLAYED",t[t.PAUSED=1]="PAUSED",t[t.STOPPED=2]="STOPPED"})(Bi||(Bi={})),(t=>{t[t.NONE=0]="NONE",t[t.LOOP=1]="LOOP",t[t.PING_PONG=2]="PING_PONG"})(Li||(Li={}));const Di=Li.LOOP;class ki extends Ri{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r,n,o,l;const a=new it(e.color),u=i.map(t=>new Ei(t)),c=u[0];e.width=null!==(h=e.width)&&void 0!==h?h:c.width,e.height=null!==(r=e.height)&&void 0!==r?r:c.height;const d=c.calculateUVTransform();super(t,Ci,{texture:c.texture,textureTransform:d,color:a},e),this.ki=!1,this.Oi=0,this.Wi=!1,this.Ni=0,this.ji=(t,i,s)=>{this.zi[this.Oi]===s&&(this.width=t,this.height=i)},this.Fi=a,this.zi=u,this.$i=d,this.Gi=null!==(n=e.frameRate)&&void 0!==n?n:24,this.Yi=null!==(o=e.timeScale)&&void 0!==o?o:1,this.qi=null!==(l=e.loopMode)&&void 0!==l?l:Di,this.Xi(),!0===e.playByDefault&&this.play()}get color(){return this.Fi}get duration(){return this.zi.length/this.Gi}get frameRate(){return this.Gi}get loopMode(){return this.qi}get sequence(){return this.zi}get timeScale(){return this.Yi}set color(t){this.Fi.set(t)}set frameRate(t){this.Gi=t}set loopMode(t){this.qi=t}set sequence(t){this.stop(),this.Zi();const i=t.length,s=this.zi.length;for(let e=0;Math.min(i,s)>e;e++)this.zi[e].set(t[e]);if(s>i)this.zi.length=i;else if(i>s)for(let e=s;i>e;e++)this.zi.push(new Ei(t[e]));this.Xi()}set timeScale(t){this.Yi=t}destroy(){this.Zi(),super.destroy()}play(){this.ki||(this.ki=!0,this.emit(Bi.PLAYED))}pause(){this.ki&&(this.ki=!1,this.emit(Bi.PAUSED))}stop(){(this.ki||this.Ni>0||this.Oi>0)&&(this.ki=!1,this.Ni=0,this.Oi=0,this.Wi=!0,this.emit(Bi.STOPPED))}onWillRender(t,i){if(this.ki&&0!==this.Yi){this.Ni+=i*this.Yi;const t=1/this.Gi,s=this.zi.length,e=s-1;if(this.Yi>0)for(;this.Ni>=t;){if(this.Ni-=t,this.Oi+=1,this.Oi>=s)if(this.qi===Li.LOOP)this.Oi=0;else{if(this.qi!==Li.PING_PONG){this.Oi=e,this.ki=!1,this.emit(Bi.PAUSED);break}this.Oi=e,this.Yi=-this.Yi}this.Wi=!0}else for(;-t>=this.Ni;){if(this.Ni+=t,this.Oi-=1,0>this.Oi)if(this.qi===Li.LOOP)this.Oi=e;else{if(this.qi!==Li.PING_PONG){this.Oi=0,this.ki=!1,this.emit(Bi.PAUSED);break}this.Oi=0,this.Yi=-this.Yi}this.Wi=!0}}super.onWillRender(t,i)}setPlaneTransform(){let t;this.Fi.dirty&&(null!=t||(t={}),t.color=this.Fi,this.Fi.setDirtyFalse());const i=this.zi[this.Oi];if((i.textureDirty||this.Wi)&&(null!=t||(t={}),t.texture=i.texture,i.setTextureDirtyFalse()),(i.uvTransformDirty||this.Wi)&&(null!=t||(t={}),t.textureTransform=i.calculateUVTransform(this.$i),i.setUVTransformDirtyFalse()),t&&this.sceneWrapper.setProperties(this.planeHandler,t),this.Wi||this.micro.dirty||i.trimDirty||this.inputWrapper.dirty||this.solverWrapper.dirty){const t=this.micro,s=i.trim;this.sceneWrapper.setTransform(this.planeHandler,xi(this.x,this.y,this.width,this.height,this.zIndex,t.x,t.y,t.anchorX,t.anchorY,t.scaleX,t.scaleY,t.rotation,t.anchorMode,s.left,s.right,s.top,s.bottom)),this.Wi=!1,this.micro.setDirtyFalse(),i.setTrimDirtyFalse()}}Xi(){for(const t of this.zi)t.on(Ii.DIMENSIONS_CHANGED,this.ji)}Zi(){for(const t of this.zi)t.off(Ii.DIMENSIONS_CHANGED,this.ji)}}function Oi(t,i){if("undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,i);const s=document.createElement("canvas");return s.width=t,s.height=i,s}const Wi=new it;class Ni extends Ri{constructor(t,i){var s,e;const h=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:2,r=null!==(e=null==i?void 0:i.height)&&void 0!==e?e:2,o=new it(null==i?void 0:i.color),l=Oi(h,r),a=l.getContext("2d");if(!a)throw Error("UIGraphics.constructor: failed to get 2D context from canvas");const u=new w(l);u.colorSpace=g,u.minFilter=y,u.magFilter=y,u.needsUpdate=!0,super(t,Ci,{texture:u,textureTransform:new n,color:o},i),this.Ji=l,this.Ki=a,this.Qi=u,this.Fi=o}get color(){return this.Fi}set color(t){this.Fi.set(t)}clear(t){return this.Ki.clearRect(0,0,this.Ji.width,this.Ji.height),void 0!==t&&(this.Ki.fillStyle=Wi.set(t).toCSSColor(),this.Ki.fillRect(0,0,this.Ji.width,this.Ji.height)),this.Qi.needsUpdate=!0,this}drawRect(t,i,s,e,h){return this.Ki.fillStyle=Wi.set(h).toCSSColor(),this.Ki.fillRect(t,i,s,e),this.Qi.needsUpdate=!0,this}drawCircle(t,i,s,e){return this.Ki.fillStyle=Wi.set(e).toCSSColor(),this.Ki.beginPath(),this.Ki.arc(t,i,s,0,2*Math.PI),this.Ki.fill(),this.Qi.needsUpdate=!0,this}drawArc(t,i,s,e,h,r){return this.Ki.fillStyle=Wi.set(r).toCSSColor(),this.Ki.beginPath(),this.Ki.arc(t,i,s,e,h),this.Ki.fill(),this.Qi.needsUpdate=!0,this}drawPolyline(t,i,s){let e=arguments.length>2&&void 0!==s?s:1;if(2>t.length)return this;this.Ki.strokeStyle=Wi.set(i).toCSSColor(),this.Ki.lineWidth=e,this.Ki.beginPath(),this.Ki.moveTo(t[0][0],t[0][1]);for(let i=1;t.length>i;i++)this.Ki.lineTo(t[i][0],t[i][1]);return this.Ki.stroke(),this.Qi.needsUpdate=!0,this}destroy(){this.Qi.dispose(),super.destroy()}onWillRender(t,i){this.Fi.dirty&&(this.sceneWrapper.setProperties(this.planeHandler,{color:this.Fi}),this.Fi.setDirtyFalse()),super.onWillRender(t,i)}}class ji extends Ri{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r;const n=new it(e.color),o=new Ei(i),l=o.calculateUVTransform();e.width=null!==(h=e.width)&&void 0!==h?h:o.width,e.height=null!==(r=e.height)&&void 0!==r?r:o.height,super(t,Ci,{texture:o.texture,textureTransform:l,color:n},e),this.ji=(t,i)=>{this.width=t,this.height=i},this.texture=o,this.$i=l,this.Fi=n,this.texture.on(Ii.DIMENSIONS_CHANGED,this.ji)}get color(){return this.Fi}set color(t){this.Fi.set(t)}destroy(){this.texture.off(Ii.DIMENSIONS_CHANGED,this.ji),super.destroy()}setPlaneTransform(){let t;if(this.Fi.dirty&&(null!=t||(t={}),t.color=this.Fi,this.Fi.setDirtyFalse()),this.texture.textureDirty&&(null!=t||(t={}),t.texture=this.texture.texture,this.texture.setTextureDirtyFalse()),this.texture.uvTransformDirty&&(null!=t||(t={}),t.textureTransform=this.texture.calculateUVTransform(this.$i),this.texture.setUVTransformDirtyFalse()),t&&this.sceneWrapper.setProperties(this.planeHandler,t),this.micro.dirty||this.texture.trimDirty||this.inputWrapper.dirty||this.solverWrapper.dirty){const t=this.micro,i=this.texture.trim;this.sceneWrapper.setTransform(this.planeHandler,xi(this.x,this.y,this.width,this.height,this.zIndex,t.x,t.y,t.anchorX,t.anchorY,t.scaleX,t.scaleY,t.rotation,t.anchorMode,i.left,i.right,i.top,i.bottom)),this.micro.setDirtyFalse(),this.texture.setTrimDirtyFalse()}}}class zi{constructor(t){this.B=0,this.P=0,this.Qt=0,this.A=0,this.L=!1,this.set(t)}get left(){return this.B}get right(){return this.P}get top(){return this.Qt}get bottom(){return this.A}get dirty(){return this.L}set left(t){this.B!==t&&(this.B=t,this.L=!0)}set right(t){this.P!==t&&(this.P=t,this.L=!0)}set top(t){this.Qt!==t&&(this.Qt=t,this.L=!0)}set bottom(t){this.A!==t&&(this.A=t,this.L=!0)}setHorizontal(t){this.B===t&&this.P===t||(this.B=t,this.P=t,this.L=!0)}setVertical(t){this.Qt===t&&this.A===t||(this.Qt=t,this.A=t,this.L=!0)}setUnified(t){this.B===t&&this.P===t&&this.Qt===t&&this.A===t||(this.B=t,this.P=t,this.Qt=t,this.A=t,this.L=!0)}set(t){const i=this.B,s=this.P,e=this.Qt,h=this.A;if(void 0===t)this.B=0,this.P=0,this.Qt=0,this.A=0;else if("number"==typeof t)this.B=t,this.P=t,this.Qt=t,this.A=t;else if(Array.isArray(t))if(2===t.length){const i=t[0],s=t[1];this.B=i,this.P=i,this.Qt=s,this.A=s}else{const i=t[1],s=t[2],e=t[3];this.B=t[0],this.P=i,this.Qt=s,this.A=e}else if("left"in t){const i=t.right,s=t.top,e=t.bottom;this.B=t.left,this.P=i,this.Qt=s,this.A=e}else{const i=t.horizontal,s=t.vertical;this.B=i,this.P=i,this.Qt=s,this.A=s}this.B===i&&this.P===s&&this.Qt===e&&this.A===h||(this.L=!0)}setVector4(t){this.B===t.x&&this.P===t.y&&this.Qt===t.z&&this.A===t.w||(this.B=t.x,this.P=t.y,this.Qt=t.z,this.A=t.w,this.L=!0)}toVector4(t){return(arguments.length>0&&void 0!==t?t:new s).set(this.B,this.P,this.Qt,this.A)}reset(){this.setUnified(0)}copy(t){this.B===t.B&&this.P===t.P&&this.Qt===t.Qt&&this.A===t.A||(this.B=t.B,this.P=t.P,this.Qt=t.Qt,this.A=t.A,this.L=!0)}setDirtyFalse(){this.L=!1}}var Fi;(t=>{t[t.NORMALIZED=0]="NORMALIZED",t[t.WORLD=1]="WORLD"})(Fi||(Fi={}));const $i=Fi.WORLD;class Gi extends Ri{constructor(t,i,e){let h=arguments.length>2&&void 0!==e?e:{};var r,n,o,l,a;const u=new it(h.color),c=new Ei(i),d=c.calculateUVTransform();h.width=null!==(r=h.width)&&void 0!==r?r:c.width,h.height=null!==(n=h.height)&&void 0!==n?n:c.height;const f=new zi(null!==(o=h.sliceBorders)&&void 0!==o?o:.1),v=new zi(null!==(l=h.sliceRegions)&&void 0!==l?l:.1),p=null!==(a=h.regionMode)&&void 0!==a?a:$i,w=new s,g=new s;super(t,"vec4 draw(){vec2 localUV=p_uv;float left=p_sliceBorders.x;float right=p_sliceBorders.y;float top=p_sliceBorders.z;float bottom=p_sliceBorders.w;float leftFill=p_sliceRegions.x;float rightFill=p_sliceRegions.y;float topFill=p_sliceRegions.z;float bottomFill=p_sliceRegions.w;float lB=leftFill;float rB=1.0-rightFill;float bB=bottomFill;float tB=1.0-topFill;{float regionL=step(p_uv.x,lB);float regionR=step(rB,p_uv.x);float regionM=1.0-regionL-regionR;float xL=(p_uv.x/lB)*left;float xR=1.0-right+((p_uv.x-rB)/rightFill)*right;float xM=left+((p_uv.x-lB)/(rB-lB))*(1.0-left-right);localUV.x=regionL*xL+regionM*xM+regionR*xR;}{float regionB=step(p_uv.y,bB);float regionT=step(tB,p_uv.y);float regionC=1.0-regionB-regionT;float yB=(p_uv.y/bB)*bottom;float yT=1.0-top+((p_uv.y-tB)/topFill)*top;float yC=bottom+((p_uv.y-bB)/(tB-bB))*(1.0-bottom-top);localUV.y=regionB*yB+regionC*yC+regionT*yT;}vec2 transformedUV=(p_textureTransform*vec3(localUV,1.0)).xy;return texture2D(p_texture,transformedUV)*p_color;}",{texture:c.texture,textureTransform:d,color:u,sliceBorders:w,sliceRegions:g},h),this.ts=!0,this.ss=new s,this.es=new s,this.hs=!0,this.ji=()=>{this.hs=!0},this.texture=c,this.$i=d,this.Fi=u,this.rs=f,this.ns=v,this.ls=p,this.ss=w,this.es=g,this.us=this.width,this.cs=this.height,this.texture.on(Ii.DIMENSIONS_CHANGED,this.ji)}get color(){return this.Fi}get regionMode(){return this.ls}get sliceBorders(){return this.rs}get sliceRegions(){return this.ns}set color(t){this.Fi.set(t)}set regionMode(t){this.ls!==t&&(this.ls=t,this.ts=!0)}set sliceBorders(t){this.rs.set(t)}set sliceRegions(t){this.ns.set(t)}destroy(){this.texture.off(Ii.DIMENSIONS_CHANGED,this.ji),super.destroy()}setPlaneTransform(){let t;if((this.hs||this.rs.dirty||this.texture.trimDirty)&&(null!=t||(t={}),t.sliceBorders=this.ds(this.ss),this.rs.setDirtyFalse(),this.hs=!1),(this.ns.dirty||this.ts||this.ls===Fi.WORLD&&this.fs())&&(null!=t||(t={}),t.sliceRegions=this.vs(this.es),this.ns.setDirtyFalse(),this.ts=!1,this.ps()),this.Fi.dirty&&(null!=t||(t={}),t.color=this.Fi,this.Fi.setDirtyFalse()),this.texture.textureDirty&&(null!=t||(t={}),t.texture=this.texture.texture,this.texture.setTextureDirtyFalse()),this.texture.uvTransformDirty&&(null!=t||(t={}),t.textureTransform=this.texture.calculateUVTransform(this.$i),this.texture.setUVTransformDirtyFalse()),t&&this.sceneWrapper.setProperties(this.planeHandler,t),this.micro.dirty||this.texture.trimDirty||this.inputWrapper.dirty||this.solverWrapper.dirty){const t=this.micro,i=this.texture.trim;this.sceneWrapper.setTransform(this.planeHandler,xi(this.x,this.y,this.width,this.height,this.zIndex,t.x,t.y,t.anchorX,t.anchorY,t.scaleX,t.scaleY,t.rotation,t.anchorMode,i.left,i.right,i.top,i.bottom)),this.micro.setDirtyFalse(),this.texture.setTrimDirtyFalse()}}ds(t){const i=this.texture.width,s=this.texture.height,e=this.texture.trim,h=e.right/i,r=e.top/s,n=e.bottom/s,o=(i-e.left-e.right)/i,l=(s-e.top-e.bottom)/s,a=this.rs.right,u=this.rs.top,c=this.rs.bottom,d=Math.max(0,this.rs.left-e.left/i)/o,f=Math.max(0,a-h)/o,v=Math.max(0,u-r)/l,p=Math.max(0,c-n)/l;return t.set(Math.min(1,d),Math.min(1,f),Math.min(1,v),Math.min(1,p))}vs(t){if(this.ls===Fi.NORMALIZED)return t.set(this.ns.left,this.ns.right,this.ns.top,this.ns.bottom);const i=this.width,s=this.height;return t.set(this.ns.left/i,this.ns.right/i,this.ns.top/s,this.ns.bottom/s)}fs(){return this.solverWrapper.dirty&&(this.us!==Math.round(this.width)||this.cs!==Math.round(this.height))}ps(){this.us=Math.round(this.width),this.cs=Math.round(this.height)}}class Yi{constructor(t){this.source=t,this.dirtyInternal=!1}get dirty(){return this.dirtyInternal}setDirtyFalse(){this.dirtyInternal=!1}}class qi extends Yi{constructor(t){let i=arguments.length>0&&void 0!==t?t:{x:1,y:0};super("float calculateMask(){float aspect=p_textureResolution.x/p_textureResolution.y;vec2 halfExtents=vec2(aspect,1.0)*0.5;float maxProjection=dot(halfExtents,abs(p_direction));vec2 correctedUV=(p_uv-0.5)*vec2(aspect,1.0);float projection=dot(correctedUV,p_direction);float offset=(projection/maxProjection+1.0)*0.5;return step(offset,p_progress);}"),this.direction=new h,this.ws=new h,this.direction.copy(i).normalize(),this.ws.copy(this.direction)}get dirty(){return this.gs(),this.dirtyInternal||!this.ws.equals(this.direction)}setDirtyFalse(){this.gs(),this.ws.copy(this.direction),super.setDirtyFalse()}enumerateProperties(){return this.gs(),{direction:this.direction}}gs(){const t=this.direction.lengthSq();Math.abs(t)>$t?Math.abs(t-1)>$t&&this.direction.divideScalar(t):this.direction.set(1,0)}}var Xi,Zi="vec4 draw(){vec2 transformedUV=(p_textureTransform*vec3(p_uv,1.0)).xy;vec4 diffuseColor=texture2D(p_texture,transformedUV)*p_color;diffuseColor.a*=calculateMask();return diffuseColor;}";class Ji extends Ri{constructor(i,s,e){let h=arguments.length>2&&void 0!==e?e:{};var r,n,o,l;const a=new it(h.color),u=new Ei(s),c=u.calculateUVTransform(),d=u.getResolution();h.width=null!==(r=h.width)&&void 0!==r?r:u.width,h.height=null!==(n=h.height)&&void 0!==n?n:u.height;const f=t.clamp(null!==(o=h.progress)&&void 0!==o?o:1,0,1),v=null!==(l=h.maskFunction)&&void 0!==l?l:new qi;super(i,v.source+Zi,Object.assign({texture:u.texture,textureTransform:c,textureResolution:d,color:a,progress:f},v.enumerateProperties()),h),this.ys=!1,this.bs=!1,this.ji=(t,i)=>{this.width===t&&this.height===i||(this.width=t,this.height=i,this.bs=!0)},this.texture=u,this.$i=c,this._s=d,this.Fi=a,this.xs=f,this.Ss=v,this.texture.on(Ii.DIMENSIONS_CHANGED,this.ji)}get color(){return this.Fi}get maskFunction(){return this.Ss}get progress(){return this.xs}set color(t){this.Fi.set(t)}set maskFunction(t){this.Ss!==t&&(this.Ss=t,this.Is())}set progress(i){i=t.clamp(i,0,1),this.xs!==i&&(this.xs=i,this.ys=!0)}setPlaneTransform(){let t;if(this.Fi.dirty&&(null!=t||(t={}),t.color=this.Fi,this.Fi.setDirtyFalse()),this.texture.textureDirty&&(null!=t||(t={}),t.texture=this.texture.texture,this.texture.setTextureDirtyFalse()),this.texture.uvTransformDirty&&(null!=t||(t={}),t.textureTransform=this.texture.calculateUVTransform(this.$i),this.texture.setUVTransformDirtyFalse()),this.ys&&(null!=t||(t={}),t.progress=this.xs,this.ys=!1),this.bs&&(null!=t||(t={}),t.textureResolution=this.texture.getResolution(this._s),this.bs=!1),this.maskFunction.dirty){null!=t||(t={});const i=this.maskFunction.enumerateProperties();for(const s in i)t[s]=i[s];this.maskFunction.setDirtyFalse()}if(t&&this.sceneWrapper.setProperties(this.planeHandler,t),this.micro.dirty||this.texture.trimDirty||this.inputWrapper.dirty||this.solverWrapper.dirty){const t=this.micro,i=this.texture.trim;this.sceneWrapper.setTransform(this.planeHandler,xi(this.x,this.y,this.width,this.height,this.zIndex,t.x,t.y,t.anchorX,t.anchorY,t.scaleX,t.scaleY,t.rotation,t.anchorMode,i.left,i.right,i.top,i.bottom)),this.micro.setDirtyFalse(),this.texture.setTrimDirtyFalse()}}Is(){this.sceneWrapper.destroyPlane(this.planeHandler);const t=this.micro,i=this.texture.trim;this.planeHandler=this.sceneWrapper.createPlane(this.Ss.source+Zi,Object.assign({texture:this.texture.texture,textureTransform:this.texture.calculateUVTransform(this.$i),textureResolution:this.texture.getResolution(this._s),color:this.Fi,progress:this.xs},this.Ss.enumerateProperties()),xi(this.x,this.y,this.width,this.height,this.zIndex,t.x,t.y,t.anchorX,t.anchorY,t.scaleX,t.scaleY,t.rotation,t.anchorMode,i.left,i.right,i.top,i.bottom),P(this.mode),this.transparencyMode),this.Fi.setDirtyFalse(),this.texture.setTextureDirtyFalse(),this.texture.setUVTransformDirtyFalse(),this.texture.setTrimDirtyFalse(),this.ys=!1,this.bs=!1,this.Ss.setDirtyFalse(),this.micro.setDirtyFalse()}}(t=>{t[t.EVERY_FRAME=1]="EVERY_FRAME",t[t.EVERY_SECOND_FRAME=2]="EVERY_SECOND_FRAME",t[t.ON_PROPERTIES_CHANGE=3]="ON_PROPERTIES_CHANGE",t[t.ON_DIMENSIONS_CHANGE=4]="ON_DIMENSIONS_CHANGE",t[t.MANUAL=5]="MANUAL"})(Xi||(Xi={}));const Ki=Xi.ON_PROPERTIES_CHANGE,Qi=new it(0,0,0,1);class ts extends Ri{constructor(i,s){let e=arguments.length>1&&void 0!==s?s:{};var h,r,o,l,a,u,c,d;const v=t.clamp(null!==(h=e.resolutionFactor)&&void 0!==h?h:.5,.1,2),p=null!==(r=e.width)&&void 0!==r?r:64,w=null!==(o=e.height)&&void 0!==o?o:32,g=new m(p*v,w*v,{format:_,minFilter:y,magFilter:y,type:b,depthBuffer:null===(l=e.enableDepthBuffer)||void 0===l||l,stencilBuffer:!1}),S=new it(e.color);super(i,Ci,{texture:g.texture,textureTransform:new n,color:S},e),this.Es=!0,this.Ms=!1,this.Cs=!1,this.Ts=!1,this.Fi=S,this.Ps=new it(null!==(a=e.clearColor)&&void 0!==a?a:Qi),this.Hs=g,this.As=null!==(u=e.scene)&&void 0!==u?u:new f,this.Us=null!==(c=e.camera)&&void 0!==c?c:new x(60,p/w,.1,100),this.Vs=v,this.Rs=null!==(d=e.updateMode)&&void 0!==d?d:Ki,this.Ts=e.updateMode!==Xi.MANUAL}get camera(){return this.Us}get clearColor(){return this.Ps}get color(){return this.Fi}get resolutionFactor(){return this.Vs}get scene(){return this.As}get updateMode(){return this.Rs}set camera(t){this.Us!==t&&(this.Us=t,this.Ts=!0)}set clearColor(t){this.Ps.set(t)}set color(t){this.Fi.set(t)}set resolutionFactor(i){i=t.clamp(i,.1,2),this.Vs!==i&&(this.Vs=i,this.Cs=!0)}set scene(t){this.As!==t&&(this.As=t,this.Ts=!0)}set updateMode(t){this.Rs!==t&&(this.Rs=t,this.Ts=!0)}destroy(){this.Hs.dispose(),super.destroy()}requestUpdate(){this.Ms=!0}onWillRender(t,i){this.Es=!this.Es,(this.Ms||this.Rs===Xi.EVERY_FRAME||this.Rs===Xi.EVERY_SECOND_FRAME&&this.Es||this.Rs===Xi.ON_PROPERTIES_CHANGE&&this.Ts||this.Fi.dirty||this.Ps.dirty||this.Rs===Xi.ON_DIMENSIONS_CHANGE&&(this.Cs||this.solverWrapper.dirty))&&((this.Cs||this.solverWrapper.dirty)&&(this.Hs.setSize(this.width*this.Vs,this.height*this.Vs),this.Cs=!1),this.Fi.dirty&&(this.sceneWrapper.setProperties(this.planeHandler,{color:this.Fi}),this.Fi.setDirtyFalse()),t.setClearColor(this.Ps.getHexRGB(),this.Ps.a),t.setRenderTarget(this.Hs),t.clear(!0,!0,!1),t.render(this.As,this.Us),this.Ts=!1,this.Ms=!1),super.onWillRender(t,i)}}const is="#000000",ss="left",es="Arial",hs="normal",rs="normal",ns=!1,os="transparent",ls=!1,as="#000000";class us{constructor(t){this.L=!0,this.Fi=null==t?void 0:t.color,this.Bs=null==t?void 0:t.align,this.Ls=null==t?void 0:t.fontFamily,this.Ds=null==t?void 0:t.fontSize,this.ks=null==t?void 0:t.fontStyle,this.Os=null==t?void 0:t.fontWeight,this.Ws=null==t?void 0:t.lineHeight,this.Ns=null==t?void 0:t.enableShadow,this.js=null==t?void 0:t.shadowOffsetX,this.zs=null==t?void 0:t.shadowOffsetY,this.Fs=null==t?void 0:t.shadowBlur,this.$s=null==t?void 0:t.shadowColor,this.Gs=null==t?void 0:t.enableStroke,this.Ys=null==t?void 0:t.strokeColor,this.qs=null==t?void 0:t.strokeThickness}get color(){return this.Fi}get align(){return this.Bs}get fontFamily(){return this.Ls}get fontSize(){return this.Ds}get fontStyle(){return this.ks}get fontWeight(){return this.Os}get lineHeight(){return this.Ws}get enableShadow(){return this.Ns}get shadowOffsetX(){return this.js}get shadowOffsetY(){return this.zs}get shadowBlur(){return this.Fs}get shadowColor(){return this.$s}get enableStroke(){return this.Gs}get strokeColor(){return this.Ys}get strokeThickness(){return this.qs}get dirty(){return this.L}set color(t){t!==this.Fi&&(this.Fi=t,this.L=!0)}set align(t){t!==this.Bs&&(this.Bs=t,this.L=!0)}set fontFamily(t){t!==this.Ls&&(this.Ls=t,this.L=!0)}set fontSize(t){t!==this.Ds&&(this.Ds=t,this.L=!0)}set fontStyle(t){t!==this.ks&&(this.ks=t,this.L=!0)}set fontWeight(t){t!==this.Os&&(this.Os=t,this.L=!0)}set lineHeight(t){t!==this.Ws&&(this.Ws=t,this.L=!0)}set enableShadow(t){t!==this.Ns&&(this.Ns=t,this.L=!0)}set shadowOffsetX(t){t!==this.js&&(this.js=t,this.L=!0)}set shadowOffsetY(t){t!==this.zs&&(this.zs=t,this.L=!0)}set shadowBlur(t){t!==this.Fs&&(this.Fs=t,this.L=!0)}set shadowColor(t){t!==this.$s&&(this.$s=t,this.L=!0)}set enableStroke(t){t!==this.Gs&&(this.Gs=t,this.L=!0)}set strokeColor(t){t!==this.Ys&&(this.Ys=t,this.L=!0)}set strokeThickness(t){t!==this.qs&&(this.qs=t,this.L=!0)}static resolve(t,i){var s,e,h,r,n,o,l,a,u,c,d,f,v,p,w,g,y,m,b,_,x,S,I,E,M,C,T,P,H,A;const U=null!==(e=null!==(s=t.Ds)&&void 0!==s?s:i.Ds)&&void 0!==e?e:16;return{color:null!==(r=null!==(h=t.Fi)&&void 0!==h?h:i.Fi)&&void 0!==r?r:is,align:null!==(o=null!==(n=t.Bs)&&void 0!==n?n:i.Bs)&&void 0!==o?o:ss,fontFamily:null!==(a=null!==(l=t.Ls)&&void 0!==l?l:i.Ls)&&void 0!==a?a:es,fontSize:U,fontStyle:null!==(c=null!==(u=t.ks)&&void 0!==u?u:i.ks)&&void 0!==c?c:hs,fontWeight:null!==(f=null!==(d=t.Os)&&void 0!==d?d:i.Os)&&void 0!==f?f:rs,lineHeight:null!==(p=null!==(v=t.Ws)&&void 0!==v?v:i.Ws)&&void 0!==p?p:1.2*U,enableShadow:null!==(g=null!==(w=t.Ns)&&void 0!==w?w:i.Ns)&&void 0!==g?g:ns,shadowOffsetX:null!==(m=null!==(y=t.js)&&void 0!==y?y:i.js)&&void 0!==m?m:0,shadowOffsetY:null!==(_=null!==(b=t.zs)&&void 0!==b?b:i.zs)&&void 0!==_?_:0,shadowBlur:null!==(S=null!==(x=t.Fs)&&void 0!==x?x:i.Fs)&&void 0!==S?S:0,shadowColor:null!==(E=null!==(I=t.$s)&&void 0!==I?I:i.$s)&&void 0!==E?E:os,enableStroke:null!==(C=null!==(M=t.Gs)&&void 0!==M?M:i.Gs)&&void 0!==C?C:ls,strokeColor:null!==(P=null!==(T=t.Ys)&&void 0!==T?T:i.Ys)&&void 0!==P?P:as,strokeThickness:null!==(A=null!==(H=t.qs)&&void 0!==H?H:i.qs)&&void 0!==A?A:0}}setDirtyFalse(){this.L=!1}setDefaults(){this.Fi===is&&this.Bs===ss&&this.Ls===es&&16===this.Ds&&this.ks===hs&&this.Os===rs&&19.2===this.Ws&&this.Ns===ns&&0===this.js&&0===this.zs&&0===this.Fs&&this.$s===os&&this.Gs===ls&&this.Ys===as&&0===this.qs||(this.Fi=is,this.Bs=ss,this.Ls=es,this.Ds=16,this.ks=hs,this.Os=rs,this.Ws=19.2,this.Ns=ns,this.js=0,this.zs=0,this.Fs=0,this.$s=os,this.Gs=ls,this.Ys=as,this.qs=0,this.L=!0)}clear(){void 0===this.Fi&&void 0===this.Bs&&void 0===this.Ls&&void 0===this.Ds&&void 0===this.ks&&void 0===this.Os&&void 0===this.Ws&&void 0===this.Ns&&void 0===this.js&&void 0===this.zs&&void 0===this.Fs&&void 0===this.$s&&void 0===this.Gs&&void 0===this.Ys&&void 0===this.qs||(this.Fi=void 0,this.Bs=void 0,this.Ls=void 0,this.Ds=void 0,this.ks=void 0,this.Os=void 0,this.Ws=void 0,this.Ns=void 0,this.js=void 0,this.zs=void 0,this.Fs=void 0,this.$s=void 0,this.Gs=void 0,this.Ys=void 0,this.qs=void 0,this.L=!0)}copy(t){this.Fi===t.Fi&&this.Bs===t.Bs&&this.Ls===t.Ls&&this.Ds===t.Ds&&this.ks===t.ks&&this.Os===t.Os&&this.Ws===t.Ws&&this.Ns===t.Ns&&this.js===t.js&&this.zs===t.zs&&this.Fs===t.Fs&&this.$s===t.$s&&this.Gs===t.Gs&&this.Ys===t.Ys&&this.qs===t.qs||(this.Fi=t.Fi,this.Bs=t.Bs,this.Ls=t.Ls,this.Ds=t.Ds,this.ks=t.ks,this.Os=t.Os,this.Ws=t.Ws,this.Ns=t.Ns,this.js=t.js,this.zs=t.zs,this.Fs=t.Fs,this.$s=t.$s,this.Gs=t.Gs,this.Ys=t.Ys,this.qs=t.qs,this.L=!0)}calculatePadding(){var t,i,s,e;let h=0;if(void 0!==this.Gs&&(h+=null!==(t=this.qs)&&void 0!==t?t:0),void 0!==this.Ns){const t=null!==(i=this.Fs)&&void 0!==i?i:0,r=null!==(s=this.js)&&void 0!==s?s:0,n=null!==(e=this.zs)&&void 0!==e?e:0,o=2*t;h+=Math.max(Math.abs(r)+o,Math.abs(n)+o)}return Math.ceil(h)}}class cs{constructor(t){this.L=!0,this.Xs=t.text,this.style=new us(t.style)}get text(){return this.Xs}get dirty(){return this.L||this.style.dirty}set text(t){t!==this.Xs&&(this.Xs=t,this.L=!0)}setDirtyFalse(){this.L=!1,this.style.setDirtyFalse()}}var ds;(t=>{t[t.BREAK=0]="BREAK",t[t.SCALE=1]="SCALE"})(ds||(ds={}));const fs=ds.SCALE;function vs(t){var i;return null!==(i=t.match(/\S+|\s|\n/g))&&void 0!==i?i:[]}function ps(t,i,s){if(t.font=`${s.fontStyle} ${s.fontWeight} ${s.fontSize}px "${s.fontFamily}"`,"\n"===i)return{width:1,height:s.lineHeight,baseline:0,lineHeight:s.lineHeight};const e=t.measureText(i);return{width:Math.ceil(e.width),height:Math.ceil(e.actualBoundingBoxAscent+e.actualBoundingBoxDescent),baseline:e.actualBoundingBoxDescent,lineHeight:s.lineHeight}}function ws(t,i){const s=((t,i)=>{const s=[];let e=[],h=0,r=0,n=0,o=0;for(const l of i)"\n"!==l.text?0!==e.length&&h+l.metrics.width>t?(s.push({chunks:e,width:h,height:r,baseline:n,lineHeight:o}),e=[l],h=l.metrics.width,r=l.metrics.height,n=l.metrics.baseline,o=l.metrics.lineHeight):(e.push(l),h+=l.metrics.width,r=Math.max(r,l.metrics.height),n=Math.max(n,l.metrics.baseline),o=Math.max(o,l.metrics.lineHeight)):(e.length>0&&s.push({chunks:e,width:h,height:r,baseline:n,lineHeight:o}),e=[],h=0,r=0,n=0,o=0);return e.length>0&&s.push({chunks:e,width:h,height:r,baseline:n,lineHeight:o}),s})(i,t),e=(t=>{if(0===t.length)return{width:0,height:0};const i=Math.max(...t.map(t=>t.width));let s=0;for(let i=0;t.length>i;i++){const e=t[i];s+=0===i?e.height:e.lineHeight}return{width:i,height:s}})(s);return{lines:s,size:e}}function gs(t,i,s,e,h){h.font=`${e.fontStyle} ${e.fontWeight} ${e.fontSize}px "${e.fontFamily}"`,e.enableShadow&&(h.shadowOffsetX=e.shadowOffsetX,h.shadowOffsetY=e.shadowOffsetY,h.shadowBlur=e.shadowBlur,h.shadowColor=e.shadowColor),e.enableStroke&&(h.strokeStyle=e.strokeColor,h.lineWidth=e.strokeThickness,h.strokeText(s,t,i)),h.fillStyle=e.color,h.fillText(s,t,i)}function ys(t,i,s,e){var h,r;let n=t,o=0;for(const t of s)o=Math.max(t.width,o);for(let t=0;s.length>t;t++){const l=s[t],a=null!==(r=null===(h=l.chunks[0])||void 0===h?void 0:h.style.align)&&void 0!==r?r:ss,u=l.chunks.every(t=>t.style.align===a)?a:ss;let c=0;"center"===u?c=(o-l.width)/2:"right"===u&&(c=o-l.width);let d=i+c;n+=0===t?l.height:l.lineHeight;for(const t of l.chunks)gs(d,n,t.text,t.style,e),d+=t.metrics.width}}class ms extends Ri{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r;const o=Oi(2,2),l=o.getContext("2d");if(!l)throw Error("UIText.constructor: failed to create canvas context");const a=new w(o);a.colorSpace=g,a.needsUpdate=!0;const u=new it(e.color);switch(super(t,Ci,{texture:a,textureTransform:new n,color:u}),this.Zs=[],this.Js=!1,this.Ks=!1,this.Qs=!1,this.te=[],this.ie=!1,this.Fi=u,this.se=new zi(e.padding),this.commonStyle=new us(e.commonStyle),this.ee=null!==(h=e.maxLineWidth)&&void 0!==h?h:1024,this.he=null!==(r=e.resizeMode)&&void 0!==r?r:fs,this.Ji=o,this.Ki=l,this.Qi=a,this.content=i,this.re=this.width,this.ne=this.height,void 0===e.padding&&this.se.setUnified(this.content.reduce((t,i)=>Math.max(t,i.style.calculatePadding()),this.commonStyle.calculatePadding())),this.he){case ds.SCALE:this.oe();break;case ds.BREAK:this.le()}}get color(){return this.Fi}get content(){return this.Zs}get maxLineWidth(){return this.ee}get padding(){return this.se}get resizeMode(){return this.he}set color(t){this.Fi.set(t)}set content(t){this.Zs!==t&&(this.Zs="string"==typeof t?[new cs({text:t,style:new us})]:Array.isArray(t)?t.map(t=>new cs("string"==typeof t?{text:t,style:new us}:{text:t.text,style:new us(t.style)})):[new cs({text:t.text,style:new us(t.style)})],this.Js=!0,this.ie=!0)}set maxLineWidth(t){this.ee!==t&&(this.ee=t,this.Ks=!0)}set padding(t){this.se.set(t)}set resizeMode(t){this.he!==t&&(this.he=t,this.Qs=!0)}destroy(){this.Qi.dispose(),super.destroy()}onWillRender(t,i){switch(this.he){case ds.SCALE:this.oe();break;case ds.BREAK:this.le()}super.onWillRender(t,i)}oe(){if(!(this.Fi.dirty||this.Qs||this.Ks||this.se.dirty||this.solverWrapper.dirty&&this.re/this.ne!==Math.round(this.width)/Math.round(this.height)||this.ae()))return;const t=this.ue(),{lines:i,size:s}=ws(t,this.ee),e=s.height+(this.se.top+this.se.bottom),h=s.width+(this.se.left+this.se.right);this.width=h,this.height=e/h*Math.round(this.width),this.width=h/e*Math.round(this.height);const r=this.re!==e||this.ne!==h;r&&(this.Ji.height=e,this.Ji.width=h),ys(this.se.top,this.se.left,i,this.Ki),this.ce(r),this.Qs=!1,this.Ks=!1,this.se.setDirtyFalse(),this.de(),this.fe()}le(){if(!(this.Fi.dirty||this.Qs||this.Ks||this.se.dirty||this.ve()||this.ae()))return;const t=this.ue(),{size:i}=ws(t,this.ee),s=this.se.top+this.se.bottom,e=this.se.left+this.se.right;this.height=i.height+s,this.width=i.width+e;const{lines:h,size:r}=ws(t,Math.round(this.width)-e);this.height=r.height+s,this.width=r.width+e;const n=Math.max(Math.round(this.width),2),o=Math.max(Math.round(this.height),2),l=this.re!==n||this.ne!==o;l&&(this.Ji.width=n,this.Ji.height=o),ys(this.se.top,this.se.left,h,this.Ki),this.ce(l),this.Qs=!1,this.Ks=!1,this.se.setDirtyFalse(),this.de(),this.fe()}ce(t){let i;this.Fi.dirty&&(null!=i||(i={}),i.color=this.Fi,this.Fi.setDirtyFalse()),t&&(this.Qi.dispose(),this.Qi=new w(this.Ji),this.Qi.colorSpace=g,this.Qi.needsUpdate=!0,null!=i||(i={}),i.texture=this.Qi),i&&this.sceneWrapper.setProperties(this.planeHandler,i)}ue(){return this.ie&&(this.te=((t,i,s)=>{const e=[];for(const h of i){const i=us.resolve(h.style,s);for(const s of vs(h.text)){const h=ps(t,s,i);e.push({text:s,style:i,metrics:h})}}return e})(this.Ki,this.Zs,this.commonStyle),this.ie=!1),this.te}ve(){return this.solverWrapper.dirty&&(this.re!==Math.round(this.width)||this.ne!==Math.round(this.height))}de(){this.re=Math.round(this.width),this.ne=Math.round(this.height)}ae(){return this.Js||this.content.some(t=>t.dirty)}fe(){this.Js=!1;for(const t of this.content)t.setDirtyFalse()}}class bs{constructor(){this.dirty=!1}}class _s extends bs{calculateScale(t,i){return 1}}const xs=new _s;class Ss extends Nt{constructor(t){var i;const s=null!==(i=null==t?void 0:t.resizePolicy)&&void 0!==i?i:xs,e=s.calculateScale(window.innerWidth,window.innerHeight);super(Object.assign({width:window.innerWidth*e,height:window.innerHeight*e},t)),this.pe=!1,this.we=()=>{const t=this.resizePolicy.calculateScale(window.innerWidth,window.innerHeight);this.resizePolicy.dirty=!1,this.pe=!1,this.resizeInternal(window.innerWidth*t,window.innerHeight*t)},this.ge=t=>{this.ye(t,"onPointerDown",Mi.PRESSED)},this.me=t=>{this.ye(t,"onPointerMove",Mi.MOVED)},this.be=t=>{this.ye(t,"onPointerUp",Mi.RELEASED)},this._e=s,window.addEventListener("resize",this.we),window.addEventListener("pointerdown",this.ge),window.addEventListener("pointermove",this.me),window.addEventListener("pointerup",this.be)}get resizePolicy(){return this._e}set resizePolicy(t){this._e!==t&&(this._e=t,this.pe=!0)}destroy(){window.removeEventListener("resize",this.we),window.removeEventListener("pointerdown",this.ge),window.removeEventListener("pointermove",this.me),window.removeEventListener("pointerup",this.be)}render(t,i){(this.resizePolicy.dirty||this.pe)&&this.we(),super.renderInternal(t,i)}projectWorldPosition(i,s,e){let h=arguments.length>2&&void 0!==e?e:new r;return h.copy(i).project(s),h.x=t.mapLinear(h.x,-1,1,this.x,this.width),h.y=t.mapLinear(h.y,-1,1,this.y,this.height),h}projectLayerPosition(i,s,e,h){let n=arguments.length>2&&void 0!==e?e:-1;return(arguments.length>3&&void 0!==h?h:new r).set(t.mapLinear(i.x,this.x,this.width,-1,1),t.mapLinear(i.y,this.y,this.height,-1,1),n).unproject(s)}buildRay(i,s,e){let h=arguments.length>2&&void 0!==e?e:new S;const n=new r(t.mapLinear(i.x,this.x,this.width,-1,1),t.mapLinear(i.y,this.y,this.height,-1,1),-1).unproject(s),o=new r(t.mapLinear(i.x,this.x,this.width,-1,1),t.mapLinear(i.y,this.y,this.height,-1,1),1).unproject(s).sub(n).normalize();return h.set(n,o)}ye(t,i,s){const e=t.target instanceof HTMLElement?t.target.getBoundingClientRect():null,h=e?t.clientX-e.left:t.clientX,r=e?e.bottom-t.clientY:window.innerHeight-t.clientY,n=this.resizePolicy.calculateScale(window.innerWidth,window.innerHeight),o=h*n,l=r*n;T(this.mode)&&(this.emit(s,o,l,t.pointerId),this.inputWrapperInternal[i](o,l,t.pointerId))}}class Is extends Pi{constructor(t,i,s){super(),this.centerX=t,this.centerY=i,this.radius=s}contains(t,i){const s=t-this.centerX,e=i-this.centerY;return this.radius*this.radius>=s*s+e*e}}class Es extends Pi{constructor(t){super(),this.vertices=t}contains(t,i){const s=this.vertices.length;if(3>s)return!1;let e=!1;for(let h=0,r=s-1;s>h;r=h++){const s=this.vertices[h],n=this.vertices[r],o=s.x,l=s.y,a=n.y;l>i!=a>i&&(n.x-o)*(i-l)/(a-l)+o>t&&(e=!e)}return e}}class Ms extends Pi{constructor(t,i,s,e,h){super(),this.x=t,this.y=i,this.width=s,this.height=e,this.radius=h,this.radius=Math.min(h,Math.min(s,e)/2)}contains(t,i){const s=this.x,e=this.x+this.width,h=this.y,r=this.y+this.height;if(s>t||t>e||h>i||i>r)return!1;const n=s+this.radius,o=e-this.radius,l=h+this.radius,a=r-this.radius;if(t>=n&&o>=t)return!0;if(i>=l&&a>=i)return!0;let u,c;u=n>t?n:o,c=l>i?l:a;const d=t-u,f=i-c;return this.radius*this.radius>=d*d+f*f}}class Cs extends Yi{constructor(t,i){let s=arguments.length>0&&void 0!==t?t:0,e=arguments.length>1&&void 0!==i&&i;super("float calculateMask(){float aspect=p_textureResolution.x/p_textureResolution.y;vec2 p=(p_uv-0.5)*vec2(aspect,1.0);float angle=atan(p.y,p.x);angle=(angle+PI)/(2.0*PI);float adjusted=angle-p_startAngle;adjusted=p_direction>0.0 ? adjusted :-adjusted;adjusted=fract(adjusted);return step(adjusted,p_progress);}"),this.xe=s,this.Se=e}get startAngle(){return this.xe}get inverseDirection(){return this.Se}set startAngle(t){this.xe!==t&&(this.xe=t,this.dirtyInternal=!0)}set inverseDirection(t){this.Se!==t&&(this.Se=t,this.dirtyInternal=!0)}enumerateProperties(){return{direction:this.Se?-1:1,startAngle:this.xe}}}class Ts extends bs{constructor(t,i){super(),this.Ie=t,this.Ee=i}get rectWidth(){return this.Ie}get rectHeight(){return this.Ee}set rectWidth(t){t!==this.Ie&&(this.Ie=t,this.dirty=!0)}set rectHeight(t){t!==this.Ee&&(this.Ee=t,this.dirty=!0)}calculateScale(t,i){return Math.min(this.Ie/t,this.Ee/i)}}class Ps extends bs{constructor(t,i){super(),this.Me=t,this.Ce=i}get fixedWidthLandscape(){return this.Me}get fixedHeightPortrait(){return this.Ce}set fixedWidthLandscape(t){t!==this.Me&&(this.Me=t,this.dirty=!0)}set fixedHeightPortrait(t){t!==this.Ce&&(this.Ce=t,this.dirty=!0)}calculateScale(t,i){return t>i?this.Me/t:this.Ce/i}}class Hs extends bs{constructor(t,i){super(),this.Te=t,this.Pe=i}get fixedHeightLandscape(){return this.Te}get fixedWidthPortrait(){return this.Pe}set fixedHeightLandscape(t){t!==this.Te&&(this.Te=t,this.dirty=!0)}set fixedWidthPortrait(t){t!==this.Pe&&(this.Pe=t,this.dirty=!0)}calculateScale(t,i){return t>i?this.Te/i:this.Pe/t}}class As extends bs{constructor(t,i){super(),this.Ie=t,this.Ee=i}get rectWidth(){return this.Ie}get rectHeight(){return this.Ee}set rectWidth(t){t!==this.Ie&&(this.Ie=t,this.dirty=!0)}set rectHeight(t){t!==this.Ee&&(this.Ee=t,this.dirty=!0)}calculateScale(t,i){return Math.max(this.Ie/t,this.Ee/i)}}class Us extends bs{constructor(t,i){super(),this.Te=t,this.Ce=i}get fixedHeightLandscape(){return this.Te}get fixedHeightPortrait(){return this.Ce}set fixedHeightLandscape(t){t!==this.Te&&(this.Te=t,this.dirty=!0)}set fixedHeightPortrait(t){t!==this.Ce&&(this.Ce=t,this.dirty=!0)}calculateScale(t,i){return t>i?this.Te/i:this.Ce/i}}class Vs extends bs{constructor(t,i){super(),this.Me=t,this.Pe=i}get fixedWidthLandscape(){return this.Me}get fixedWidthPortrait(){return this.Pe}set fixedWidthLandscape(t){t!==this.Me&&(this.Me=t,this.dirty=!0)}set fixedWidthPortrait(t){t!==this.Pe&&(this.Pe=t,this.dirty=!0)}calculateScale(t,i){return t>i?this.Me/t:this.Pe/t}}export{fi as UIAnchor,ki as UIAnimatedImage,Li as UIAnimatedImageLoopMode,Is as UIAreaCircle,Es as UIAreaPolygon,Hi as UIAreaRectangle,Ms as UIAreaRoundedRectangle,oi as UIAspectConstraint,it as UIColor,ni as UIConstraint2DBuilder,ai as UICoverConstraintBuilder,di as UICustomConstraint,Lt as UIExpression,ci as UIFitConstraintBuilder,Ss as UIFullscreenLayer,Ni as UIGraphics,Jt as UIHeightConstraint,Kt as UIHorizontalDistanceConstraint,Qt as UIHorizontalInterpolationConstraint,ti as UIHorizontalProportionConstraint,ji as UIImage,Ui as UIInputDummy,Mi as UIInputEvent,Ti as UIMicro,vi as UIMicroAnchorMode,M as UIMode,Gi as UINineSlice,Fi as UINineSliceRegionMode,C as UIOrientation,X as UIPriority,Ji as UIProgress,Cs as UIProgressMaskFunctionCircular,qi as UIProgressMaskFunctionDirectional,Dt as UIRelation,Ts as UIResizePolicyCover,Ps as UIResizePolicyCross,Hs as UIResizePolicyCrossInverted,As as UIResizePolicyFit,Us as UIResizePolicyFixedHeight,Vs as UIResizePolicyFixedWidth,_s as UIResizePolicyNone,ts as UIScene,Xi as UISceneUpdateMode,Zt as UISingleParameterConstraint,ms as UIText,ds as UITextResizeMode,wt as UITransparencyMode,ii as UIVerticalDistanceConstraint,si as UIVerticalInterpolationConstraint,ei as UIVerticalProportionConstraint,hi as UIWidthConstraint};
1
+ import{MathUtils as t,Color as i,Vector4 as s,Texture as e,Vector2 as h,Vector3 as r,Matrix3 as n,Matrix4 as o,PlaneGeometry as l,InstancedBufferGeometry as a,ShaderMaterial as u,InstancedBufferAttribute as c,Mesh as d,Scene as f,OrthographicCamera as v,Quaternion as p,CanvasTexture as w,SRGBColorSpace as g,NoColorSpace as y,LinearFilter as m,WebGLRenderTarget as b,UnsignedByteType as _,RGBAFormat as x,PerspectiveCamera as S,Ray as E}from"three";class I{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:0;this.t=new WeakMap,this.i=new Map,void 0!==t&&(void 0===i?this.i.set(t,e):this.t.set(i,new Map([[t,e]])))}insert(t,i,s){let e=arguments.length>2&&void 0!==s?s:0;if(void 0===i){if(this.i.has(t))return;return void this.i.set(t,e)}const h=this.t.get(i);void 0===h?this.t.set(i,new Map([[t,e]])):h.has(t)||h.set(t,e)}remove(t,i){if(void 0===i)return void this.i.delete(t);const s=this.t.get(i);void 0!==s&&(s.delete(t),0===s.size&&this.t.delete(i))}has(t,i){if(void 0===i)return this.i.has(t);const s=this.t.get(i);return void 0!==s&&s.has(t)}getPriority(t,i){if(void 0===i)return this.i.get(t);const s=this.t.get(i);return void 0!==s?s.get(t):void 0}}class M{constructor(){this.o=new Map}on(t,i,s,e){return this.h(t,!1,arguments.length>3&&void 0!==e?e:0,i,s),this}once(t,i,s,e){return this.h(t,!0,arguments.length>3&&void 0!==e?e:0,i,s),this}off(t,i,s){const e=this.o.get(t);if(void 0===e)return this;e.u&&(e.u=!1,e.v=e.v.slice());const h=e.v;if(0===h.length)return this.o.delete(t),this;if(void 0===i){this.o.delete(t);for(let t=0;h.length>t;t++){const i=h[t];e.l.remove(i._,i.p)}return this}{const r=h.length;if(h[0]._===i&&h[0].p===s)return 1===r?this.o.delete(t):h.shift(),this;const n=r-1;if(h[n]._===i&&h[n].p===s)return h.pop(),this;if(10>r||h[0].M===h[n].M)for(let t=1;n>t;t++){const e=h[t];if(e._===i&&e.p===s)return h.splice(t,1),this}else{const t=e.l.getPriority(i,s);if(void 0===t)return this;let r=0,n=h.length-1;for(;n>=r;){const i=r+n>>>1;t>h[i].M?r=i+1:n=i-1}const o=r;for(n=h.length-1;n>=r;){const i=r+n>>>1;h[i].M>t?n=i-1:r=i+1}const l=n;for(let t=o;l>=t;t++)if(h[t]._===i&&h[t].p===s)return h.splice(t,1),this}}return this}emit(t){const i=this.o.get(t);if(void 0===i)return!1;if(0===i.v.length)return!1;i.u?i.v=i.v.slice():i.u=!0;const s=i.v;let e=!1;for(var h=arguments.length,r=Array(h>1?h-1:0),n=1;h>n;n++)r[n-1]=arguments[n];for(let t=0;s.length>t;t++){const i=s[t];i._.apply(i.p,r),i.k&&(e=!0,i.m=!0)}const o=this.o.get(t);if(void 0===o)return!0;o.v===s&&(o.u=!1);const l=o.v;if(e){let i=0;for(let t=0;l.length>t;t++){const s=l[t];s.m?o.l.remove(s._,s.p):l[i++]=s}0===i?this.o.delete(t):l.length=i}return!0}h(t,i,s,e,h){let r=this.o.get(t);if(void 0===r)return void this.o.set(t,{v:[{_:e,p:h,M:s,k:i,m:!1}],u:!1,l:new I(e,h,s)});if(r.l.has(e,h))throw Error("Event listener already exists");r.l.insert(e,h,s);const n={_:e,p:h,M:s,k:i,m:!1};r.u&&(r.u=!1,r.v=r.v.slice());{const t=r.v,i=n.M;if(0===t.length||i>=t[t.length-1].M)return void t.push(n);if(t[0].M>=i)return void t.unshift(n);{let s=0,e=t.length;for(;e>s;){const h=s+e>>>1;i>t[h].M?s=h+1:e=h}t.splice(s,0,n)}}}}var C,T;function P(t){return t===C.INTERACTIVE||t===C.INTERACTIVE_TRANSPARENT}function H(t){return t!==C.HIDDEN}function A(t,i,s){return(i=(t=>{var i=(t=>{if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return t+""})(t);return"symbol"==typeof i?i:i+""})(i))in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s,t}function U(){return new R}(t=>{t[t.HIDDEN=0]="HIDDEN",t[t.VISIBLE=1]="VISIBLE",t[t.INTERACTIVE=2]="INTERACTIVE",t[t.INTERACTIVE_TRANSPARENT=3]="INTERACTIVE_TRANSPARENT"})(C||(C={})),(t=>{t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.ALWAYS=2]="ALWAYS"})(T||(T={}));class R{constructor(){A(this,"index",{}),A(this,"array",[])}size(){return this.array.length}empty(){return 0===this.array.length}itemAt(t){return this.array[t]}contains(t){return void 0!==this.index[t.id()]}find(t){const i=this.index[t.id()];return void 0===i?void 0:this.array[i]}setDefault(t,i){const s=this.index[t.id()];if(void 0===s){const s=new V(t,i());return this.index[t.id()]=this.array.length,this.array.push(s),s}return this.array[s]}insert(t,i){const s=new V(t,i),e=this.index[t.id()];return void 0===e?(this.index[t.id()]=this.array.length,this.array.push(s)):this.array[e]=s,s}erase(t){const i=this.index[t.id()];if(void 0===i)return;this.index[t.id()]=void 0;const s=this.array[i],e=this.array.pop();return s!==e&&(this.array[i]=e,this.index[e.first.id()]=i),s}copy(){const t=new R;for(let i=0;this.array.length>i;i++){const s=this.array[i].copy();t.array[i]=s,t.index[s.first.id()]=i}return t}}class V{constructor(t,i){A(this,"first",void 0),A(this,"second",void 0),this.first=t,this.second=i}copy(){return new V(this.first,this.second)}}class B{constructor(t){let i=arguments.length>0&&void 0!==t?t:"";A(this,"_name",void 0),A(this,"_value",0),A(this,"_context",null),A(this,"_id",D++),this._name=i}id(){return this._id}name(){return this._name}setName(t){this._name=t}context(){return this._context}setContext(t){this._context=t}value(){return this._value}setValue(t){this._value=t}plus(t){return new L(this,t)}minus(t){return new L(this,"number"==typeof t?-t:[-1,t])}multiply(t){return new L([t,this])}divide(t){return new L([1/t,this])}toJSON(){return{name:this._name,value:this._value}}toString(){return this._context+"["+this._name+":"+this._value+"]"}}let D=0;class L{constructor(){A(this,"_terms",void 0),A(this,"_constant",void 0);let t=(t=>{let i=0,s=()=>0,e=U();for(let h=0,r=t.length;r>h;++h){let r=t[h];if("number"==typeof r)i+=r;else if(r instanceof B)e.setDefault(r,s).second+=1;else if(r instanceof L){i+=r.constant();let t=r.terms();for(let i=0,h=t.size();h>i;i++){let h=t.itemAt(i);e.setDefault(h.first,s).second+=h.second}}else{if(!(r instanceof Array))throw Error("invalid Expression argument: "+r);{if(2!==r.length)throw Error("array must have length 2");let t=r[0],h=r[1];if("number"!=typeof t)throw Error("array item 0 must be a number");if(h instanceof B)e.setDefault(h,s).second+=t;else{if(!(h instanceof L))throw Error("array item 1 must be a variable or expression");{i+=h.constant()*t;let r=h.terms();for(let i=0,h=r.size();h>i;i++){let h=r.itemAt(i);e.setDefault(h.first,s).second+=h.second*t}}}}}}return{terms:e,constant:i}})(arguments);this._terms=t.terms,this._constant=t.constant}terms(){return this._terms}constant(){return this._constant}value(){let t=this._constant;for(let i=0,s=this._terms.size();s>i;i++){let s=this._terms.itemAt(i);t+=s.first.value()*s.second}return t}plus(t){return new L(this,t)}minus(t){return new L(this,"number"==typeof t?-t:[-1,t])}multiply(t){return new L([t,this])}divide(t){return new L([1/t,this])}isConstant(){return 0==this._terms.size()}toString(){let t=this._terms.array.map(t=>t.second+"*"+t.first).join(" + ");return this.isConstant()||0===this._constant||(t+=" + "),t+=this._constant,t}}var k,O;class W{static create(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:1,r=0;return r+=1e6*Math.max(0,Math.min(1e3,t*h)),r+=1e3*Math.max(0,Math.min(1e3,i*h)),r+=Math.max(0,Math.min(1e3,s*h)),r}static clip(t){return Math.max(0,Math.min(W.required,t))}}A(W,"required",(k=W).create(1e3,1e3,1e3)),A(W,"strong",k.create(1,0,0)),A(W,"medium",k.create(0,1,0)),A(W,"weak",k.create(0,0,1)),(t=>{t[t.Le=0]="Le",t[t.Ge=1]="Ge",t[t.Eq=2]="Eq"})(O||(O={}));class N{constructor(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:W.required;A(this,"_expression",void 0),A(this,"_operator",void 0),A(this,"_strength",void 0),A(this,"_id",j++),this._operator=i,this._strength=W.clip(h),this._expression=void 0===s&&t instanceof L?t:t.minus(s)}id(){return this._id}expression(){return this._expression}op(){return this._operator}strength(){return this._strength}toString(){return this._expression+" "+["<=",">=","="][this._operator]+" 0 ("+this._strength+")"}}let j=0;class z{constructor(){A(this,"maxIterations",1e3),A(this,"_cnMap",U()),A(this,"_rowMap",U()),A(this,"_varMap",U()),A(this,"_editMap",U()),A(this,"_infeasibleRows",[]),A(this,"_objective",new X),A(this,"_artificial",null),A(this,"_idTick",0)}createConstraint(t,i,s,e){let h=new N(t,i,s,arguments.length>3&&void 0!==e?e:W.required);return this.addConstraint(h),h}addConstraint(t){if(void 0!==this._cnMap.find(t))throw Error("duplicate constraint");let i=this._createRow(t),s=i.row,e=i.tag,h=this._chooseSubject(s,e);if(h.type()===G.Invalid&&s.allDummies()){if(!F(s.constant()))throw Error("unsatisfiable constraint");h=e.marker}if(h.type()===G.Invalid){if(!this._addWithArtificialVariable(s))throw Error("unsatisfiable constraint")}else s.solveFor(h),this._substitute(h,s),this._rowMap.insert(h,s);this._cnMap.insert(t,e),this._optimize(this._objective)}removeConstraint(t){let i=this._cnMap.erase(t);if(void 0===i)throw Error("unknown constraint");this._removeConstraintEffects(t,i.second);let s=i.second.marker,e=this._rowMap.erase(s);if(void 0===e){let t=this._getMarkerLeavingSymbol(s);if(t.type()===G.Invalid)throw Error("failed to find leaving row");e=this._rowMap.erase(t),e.second.solveForEx(t,s),this._substitute(s,e.second)}this._optimize(this._objective)}hasConstraint(t){return this._cnMap.contains(t)}getConstraints(){return this._cnMap.array.map(t=>{let{first:i}=t;return i})}addEditVariable(t,i){if(void 0!==this._editMap.find(t))throw Error("duplicate edit variable");if((i=W.clip(i))===W.required)throw Error("bad required strength");let s=new L(t),e=new N(s,O.Eq,void 0,i);this.addConstraint(e);let h=this._cnMap.find(e).second;this._editMap.insert(t,{tag:h,constraint:e,constant:0})}removeEditVariable(t){let i=this._editMap.erase(t);if(void 0===i)throw Error("unknown edit variable");this.removeConstraint(i.second.constraint)}hasEditVariable(t){return this._editMap.contains(t)}suggestValue(t,i){let s=this._editMap.find(t);if(void 0===s)throw Error("unknown edit variable");let e=this._rowMap,h=s.second,r=i-h.constant;h.constant=i;let n=h.tag.marker,o=e.find(n);if(void 0!==o)return 0>o.second.add(-r)&&this._infeasibleRows.push(n),void this._dualOptimize();let l=h.tag.other;if(o=e.find(l),void 0!==o)return 0>o.second.add(r)&&this._infeasibleRows.push(l),void this._dualOptimize();for(let t=0,i=e.size();i>t;++t){let i=e.itemAt(t),s=i.second,h=s.coefficientFor(n);0!==h&&0>s.add(r*h)&&i.first.type()!==G.External&&this._infeasibleRows.push(i.first)}this._dualOptimize()}updateVariables(){let t=this._varMap,i=this._rowMap;for(let s=0,e=t.size();e>s;++s){let e=t.itemAt(s),h=i.find(e.second);e.first.setValue(void 0!==h?h.second.constant():0)}}_getVarSymbol(t){return this._varMap.setDefault(t,()=>this._makeSymbol(G.External)).second}_createRow(t){let i=t.expression(),s=new X(i.constant()),e=i.terms();for(let t=0,i=e.size();i>t;++t){let i=e.itemAt(t);if(!F(i.second)){let t=this._getVarSymbol(i.first),e=this._rowMap.find(t);void 0!==e?s.insertRow(e.second,i.second):s.insertSymbol(t,i.second)}}let h=this._objective,r=t.strength(),n={marker:Y,other:Y};switch(t.op()){case O.Le:case O.Ge:{let i=t.op()===O.Le?1:-1,e=this._makeSymbol(G.Slack);if(n.marker=e,s.insertSymbol(e,i),W.required>r){let t=this._makeSymbol(G.Error);n.other=t,s.insertSymbol(t,-i),h.insertSymbol(t,r)}break}case O.Eq:if(W.required>r){let t=this._makeSymbol(G.Error),i=this._makeSymbol(G.Error);n.marker=t,n.other=i,s.insertSymbol(t,-1),s.insertSymbol(i,1),h.insertSymbol(t,r),h.insertSymbol(i,r)}else{let t=this._makeSymbol(G.Dummy);n.marker=t,s.insertSymbol(t)}}return 0>s.constant()&&s.reverseSign(),{row:s,tag:n}}_chooseSubject(t,i){let s=t.cells();for(let t=0,i=s.size();i>t;++t){let i=s.itemAt(t);if(i.first.type()===G.External)return i.first}let e=i.marker.type();return e!==G.Slack&&e!==G.Error||t.coefficientFor(i.marker)>=0?(e=i.other.type(),e!==G.Slack&&e!==G.Error||t.coefficientFor(i.other)>=0?Y:i.other):i.marker}_addWithArtificialVariable(t){let i=this._makeSymbol(G.Slack);this._rowMap.insert(i,t.copy()),this._artificial=t.copy(),this._optimize(this._artificial);let s=F(this._artificial.constant());this._artificial=null;let e=this._rowMap.erase(i);if(void 0!==e){let t=e.second;if(t.isConstant())return s;let h=this._anyPivotableSymbol(t);if(h.type()===G.Invalid)return!1;t.solveForEx(i,h),this._substitute(h,t),this._rowMap.insert(h,t)}let h=this._rowMap;for(let t=0,s=h.size();s>t;++t)h.itemAt(t).second.removeSymbol(i);return this._objective.removeSymbol(i),s}_substitute(t,i){let s=this._rowMap;for(let e=0,h=s.size();h>e;++e){let h=s.itemAt(e);h.second.substitute(t,i),0>h.second.constant()&&h.first.type()!==G.External&&this._infeasibleRows.push(h.first)}this._objective.substitute(t,i),this._artificial&&this._artificial.substitute(t,i)}_optimize(t){let i=0;for(;this.maxIterations>i;){let s=this._getEnteringSymbol(t);if(s.type()===G.Invalid)return;let e=this._getLeavingSymbol(s);if(e.type()===G.Invalid)throw Error("the objective is unbounded");let h=this._rowMap.erase(e).second;h.solveForEx(e,s),this._substitute(s,h),this._rowMap.insert(s,h),i++}throw Error("solver iterations exceeded")}_dualOptimize(){let t=this._rowMap,i=this._infeasibleRows;for(;0!==i.length;){let s=i.pop(),e=t.find(s);if(void 0!==e&&0>e.second.constant()){let i=this._getDualEnteringSymbol(e.second);if(i.type()===G.Invalid)throw Error("dual optimize failed");let h=e.second;t.erase(s),h.solveForEx(s,i),this._substitute(i,h),t.insert(i,h)}}}_getEnteringSymbol(t){let i=t.cells();for(let t=0,s=i.size();s>t;++t){let s=i.itemAt(t),e=s.first;if(0>s.second&&e.type()!==G.Dummy)return e}return Y}_getDualEnteringSymbol(t){let i=Number.MAX_VALUE,s=Y,e=t.cells();for(let t=0,h=e.size();h>t;++t){let h=e.itemAt(t),r=h.first,n=h.second;if(n>0&&r.type()!==G.Dummy){let t=this._objective.coefficientFor(r)/n;i>t&&(i=t,s=r)}}return s}_getLeavingSymbol(t){let i=Number.MAX_VALUE,s=Y,e=this._rowMap;for(let h=0,r=e.size();r>h;++h){let r=e.itemAt(h),n=r.first;if(n.type()!==G.External){let e=r.second,h=e.coefficientFor(t);if(0>h){let t=-e.constant()/h;i>t&&(i=t,s=n)}}}return s}_getMarkerLeavingSymbol(t){let i=Number.MAX_VALUE,s=i,e=i,h=Y,r=h,n=h,o=h,l=this._rowMap;for(let i=0,h=l.size();h>i;++i){let h=l.itemAt(i),a=h.second,u=a.coefficientFor(t);if(0===u)continue;let c=h.first;if(c.type()===G.External)o=c;else if(0>u){let t=-a.constant()/u;s>t&&(s=t,r=c)}else{let t=a.constant()/u;e>t&&(e=t,n=c)}}return r!==h?r:n!==h?n:o}_removeConstraintEffects(t,i){i.marker.type()===G.Error&&this._removeMarkerEffects(i.marker,t.strength()),i.other.type()===G.Error&&this._removeMarkerEffects(i.other,t.strength())}_removeMarkerEffects(t,i){let s=this._rowMap.find(t);void 0!==s?this._objective.insertRow(s.second,-i):this._objective.insertSymbol(t,-i)}_anyPivotableSymbol(t){let i=t.cells();for(let t=0,s=i.size();s>t;++t){let s=i.itemAt(t),e=s.first.type();if(e===G.Slack||e===G.Error)return s.first}return Y}_makeSymbol(t){return new $(t,this._idTick++)}}function F(t){return 0>t?1e-8>-t:1e-8>t}var G;(t=>{t[t.Invalid=0]="Invalid",t[t.External=1]="External",t[t.Slack=2]="Slack",t[t.Error=3]="Error",t[t.Dummy=4]="Dummy"})(G||(G={}));let $=class{constructor(t,i){A(this,"_id",void 0),A(this,"_type",void 0),this._id=i,this._type=t}id(){return this._id}type(){return this._type}},Y=new $(G.Invalid,-1);class X{constructor(t){let i=arguments.length>0&&void 0!==t?t:0;A(this,"_cellMap",U()),A(this,"_constant",void 0),this._constant=i}cells(){return this._cellMap}constant(){return this._constant}isConstant(){return this._cellMap.empty()}allDummies(){let t=this._cellMap;for(let i=0,s=t.size();s>i;++i)if(t.itemAt(i).first.type()!==G.Dummy)return!1;return!0}copy(){let t=new X(this._constant);return t._cellMap=this._cellMap.copy(),t}add(t){return this._constant+=t}insertSymbol(t,i){let s=arguments.length>1&&void 0!==i?i:1;F(this._cellMap.setDefault(t,()=>0).second+=s)&&this._cellMap.erase(t)}insertRow(t,i){let s=arguments.length>1&&void 0!==i?i:1;this._constant+=t._constant*s;let e=t._cellMap;for(let t=0,i=e.size();i>t;++t){let i=e.itemAt(t);this.insertSymbol(i.first,i.second*s)}}removeSymbol(t){this._cellMap.erase(t)}reverseSign(){this._constant=-this._constant;let t=this._cellMap;for(let i=0,s=t.size();s>i;++i){let s=t.itemAt(i);s.second=-s.second}}solveFor(t){let i=this._cellMap,s=-1/i.erase(t).second;this._constant*=s;for(let t=0,e=i.size();e>t;++t)i.itemAt(t).second*=s}solveForEx(t,i){this.insertSymbol(t,-1),this.solveFor(i)}coefficientFor(t){let i=this._cellMap.find(t);return void 0!==i?i.second:0}substitute(t,i){let s=this._cellMap.erase(t);void 0!==s&&this.insertRow(i,s.second)}}const q=1e3;var Z;function J(t){switch(t){case Z.P0:return W.create(q,q,q);case Z.P1:return W.create(100,0,0);case Z.P2:return W.create(10,0,0);case Z.P3:return W.create(0,100,0);case Z.P4:return W.create(0,10,0);case Z.P5:return W.create(0,0,100);case Z.P6:return W.create(0,0,10);case Z.P7:return W.create(0,0,1);default:throw Error("convertPriority.priority: invalid priority")}}(t=>{t[t.P0=0]="P0",t[t.P1=1]="P1",t[t.P2=2]="P2",t[t.P3=3]="P3",t[t.P4=4]="P4",t[t.P5=5]="P5",t[t.P6=6]="P6",t[t.P7=7]="P7"})(Z||(Z={}));class K{constructor(){this.dirty=!1,this.S=!1,this.I=[],this.C=0}createInputCatcher(t,i,s,e){const h=this.C++;return this.I.push({handler:h,catchPointerDown:t,catchPointerMove:i,catchPointerUp:s,zIndex:e,active:!0}),this.S=!0,this.dirty=!0,h}destroyInputCatcher(t){const i=this.I.findIndex(i=>i.handler===t);if(-1===i)throw Error("UIInputWrapper.destroyInputCatcher.handler: handler not found");this.I.splice(i,1)}getZIndex(t){this.T();const i=this.I.find(i=>i.handler===t);if(!i)throw Error("UIInputWrapper.getZIndex.handler: handler not found");return i.zIndex}setZIndex(t,i){const s=this.I.find(i=>i.handler===t);if(!s)throw Error("UIInputWrapper.setZIndex.handler: handler not found");s.zIndex!==i&&(s.zIndex=i,this.S=!0,this.dirty=!0)}getActive(t){const i=this.I.find(i=>i.handler===t);if(!i)throw Error("UIInputWrapper.getActive.handler: handler not found");return i.active}setActive(t,i){const s=this.I.find(i=>i.handler===t);if(!s)throw Error("UIInputWrapper.setActive.handler: handler not found");s.active!==i&&(s.active=i)}onPointerDown(t,i,s){this.T();for(let e=this.I.length-1;e>=0;e--){const h=this.I[e];if(h.active&&h.catchPointerDown(t,i,s))break}}onPointerMove(t,i,s){this.T();for(let e=this.I.length-1;e>=0;e--){const h=this.I[e];if(h.active&&h.catchPointerMove(t,i,s))break}}onPointerUp(t,i,s){this.T();for(let e=this.I.length-1;e>=0;e--){const h=this.I[e];if(h.active&&h.catchPointerUp(t,i,s))break}}T(){if(this.S){this.I.sort((t,i)=>t.zIndex-i.zIndex);const t=this.I.length,i=1024>t?1:1024/t;for(let s=0;t>s;s++)this.I[s].zIndex=s*i;this.S=!1}}}function Q(t){return.04045>t?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function tt(t){return.0031308>t?12.92*t:1.055*Math.pow(t,.41666)-.055}const it={black:0,white:16777215,red:16711680,green:32768,blue:255,yellow:16776960,cyan:65535,magenta:16711935,gray:8421504,grey:8421504,silver:12632256,maroon:8388608,olive:8421376,lime:65280,aqua:65535,teal:32896,navy:128,fuchsia:16711935,purple:8388736,orange:16753920,pink:16761035,brown:10824234,gold:16766720,violet:15631086,indigo:4915330,coral:16744272,salmon:16416882,khaki:15787660,plum:14524637,orchid:14315734,tan:13808780,beige:16119260,mint:10025880,lavender:15132410,crimson:14423100,azure:15794175,ivory:16777200,snow:16775930};class st{constructor(){this.P=1,this.H=1,this.A=1,this.U=1,this.R=0,this.V=0,this.B=1,this.D=!1,this.L=!1,this.O=!1,arguments.length>0&&this.set(...arguments)}static get black(){return new st("black")}static get white(){return new st("white")}static get red(){return new st("red")}static get green(){return new st("green")}static get blue(){return new st("blue")}static get yellow(){return new st("yellow")}static get cyan(){return new st("cyan")}static get magenta(){return new st("magenta")}static get gray(){return new st("gray")}static get grey(){return new st("grey")}static get silver(){return new st("silver")}static get maroon(){return new st("maroon")}static get olive(){return new st("olive")}static get lime(){return new st("lime")}static get aqua(){return new st("aqua")}static get teal(){return new st("teal")}static get navy(){return new st("navy")}static get fuchsia(){return new st("fuchsia")}static get purple(){return new st("purple")}static get orange(){return new st("orange")}static get pink(){return new st("pink")}static get brown(){return new st("brown")}static get gold(){return new st("gold")}static get violet(){return new st("violet")}static get indigo(){return new st("indigo")}static get coral(){return new st("coral")}static get salmon(){return new st("salmon")}static get khaki(){return new st("khaki")}static get plum(){return new st("plum")}static get orchid(){return new st("orchid")}static get tan(){return new st("tan")}static get beige(){return new st("beige")}static get mint(){return new st("mint")}static get lavender(){return new st("lavender")}static get crimson(){return new st("crimson")}static get azure(){return new st("azure")}static get ivory(){return new st("ivory")}static get snow(){return new st("snow")}get r(){return this.W(),this.P}get g(){return this.W(),this.H}get b(){return this.W(),this.A}get a(){return this.U}get hue(){return this.N(),this.R}get saturation(){return this.N(),this.V}get lightness(){return this.N(),this.B}get dirty(){return this.D}set r(i){i=t.clamp(i,0,1),this.W(),i!==this.P&&(this.P=i,this.O=!0,this.D=!0)}set g(i){i=t.clamp(i,0,1),this.W(),i!==this.H&&(this.H=i,this.O=!0,this.D=!0)}set b(i){i=t.clamp(i,0,1),this.W(),i!==this.A&&(this.A=i,this.O=!0,this.D=!0)}set a(i){(i=t.clamp(i,0,1))!==this.U&&(this.U=i,this.D=!0)}set hue(i){i=t.clamp(i,0,360),this.N(),i!==this.R&&(this.R=i,this.L=!0,this.D=!0)}set saturation(i){i=t.clamp(i,0,1),this.N(),i!==this.V&&(this.V=i,this.L=!0,this.D=!0)}set lightness(i){i=t.clamp(i,0,1),this.N(),i!==this.B&&(this.B=i,this.L=!0,this.D=!0)}setDirtyFalse(){this.D=!1}set(){for(var t=arguments.length,s=Array(t),e=0;t>e;e++)s[e]=arguments[e];if(0===s.length||void 0===s[0])return this.setRGBA(1,1,1,1);if(s.length>=3&&"number"==typeof s[0]){const[t,i,e,h=1]=s;return this.setRGBA(t,i,e,h)}const[h,r=1]=s;if("string"==typeof h)return h.startsWith("#")?this.setHexString(h):this.setColorName(h,r);if(h instanceof st)return this.copy(h);if(h instanceof i)return this.setThreeColor(h,r);if("number"==typeof h)return this.setHexRGB(h,r);throw Error("UIColor.set: cannot create color from provided arguments")}setRGBA(i,s,e,h){let r=arguments.length>3&&void 0!==h?h:this.U;return i=t.clamp(i,0,1),s=t.clamp(s,0,1),e=t.clamp(e,0,1),r=t.clamp(r,0,1),this.W(),i===this.P&&s===this.H&&e===this.A&&r===this.U||(this.P=i,this.H=s,this.A=e,this.U=r,this.O=!0,this.D=!0),this}getHexRGBA(){return this.W(),Math.round(255*this.P)<<24|Math.round(255*this.H)<<16|Math.round(255*this.A)<<8|Math.round(255*this.U)}getHexRGB(){return this.W(),Math.round(255*this.P)<<16|Math.round(255*this.H)<<8|Math.round(255*this.A)}getHexStringRGB(){return"#"+this.getHexRGB().toString(16).padStart(6,"0")}getHexStringRGBA(){return"#"+this.getHexRGBA().toString(16).padStart(8,"0")}setHexRGBA(t){this.W();const i=(t>>16&255)/255,s=(t>>8&255)/255,e=(255&t)/255,h=(t>>24&255)/255;return i===this.P&&s===this.H&&e===this.A&&h===this.U||(this.P=i,this.H=s,this.A=e,this.U=h,this.O=!0,this.D=!0),this}setHexRGB(i,s){let e=arguments.length>1&&void 0!==s?s:this.U;e=t.clamp(e,0,1),this.W();const h=(i>>16&255)/255,r=(i>>8&255)/255,n=(255&i)/255;return h===this.P&&r===this.H&&n===this.A&&e===this.U||(this.P=h,this.H=r,this.A=n,this.U=e,this.O=!0,this.D=!0),this}setHexString(t){if(!t.startsWith("#"))throw Error('UIColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"');const i=t.slice(1);if(6===i.length){const t=parseInt(i,16);if(isNaN(t))throw Error('UIColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"');return this.setHexRGB(t)}if(8===i.length){const t=parseInt(i,16);if(isNaN(t))throw Error('UIColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"');return this.setHexRGBA(t)}throw Error('UIColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"')}setHSL(i,s,e,h){let r=arguments.length>3&&void 0!==h?h:this.U;return i=t.clamp(i,0,360),s=t.clamp(s,0,1),e=t.clamp(e,0,1),r=t.clamp(r,0,1),this.N(),i===this.R&&s===this.V&&e===this.B&&r===this.U||(this.R=i,this.V=s,this.B=e,this.U=r,this.L=!0,this.D=!0),this}setColorName(i,s){let e=arguments.length>1&&void 0!==s?s:this.U;e=t.clamp(e,0,1);const h=i.toLowerCase().trim(),r=it[h];if(void 0===r)throw Error("UIColor.setColorName.colorName: unknown color name");return this.setHexRGB(r,e)}setGLSLColor(i,s,e,h){let r=arguments.length>3&&void 0!==h?h:this.U;r=t.clamp(r,0,1),this.W();const n=tt(i),o=tt(s),l=tt(e);return n===this.P&&o===this.H&&l===this.A&&r===this.U||(this.P=n,this.H=o,this.A=l,this.U=r,this.O=!0,this.D=!0),this}setThreeColor(i,s){let e=arguments.length>1&&void 0!==s?s:this.U;return e=t.clamp(e,0,1),this.W(),i.r===this.P&&i.g===this.H&&i.b===this.A&&e===this.U||(this.P=i.r,this.H=i.g,this.A=i.b,this.U=e,this.O=!0,this.D=!0),this}toCSSColor(){return this.W(),`rgba(${Math.round(255*this.P)}, ${Math.round(255*this.H)}, ${Math.round(255*this.A)}, ${this.U})`}toGLSLColor(t){let i=arguments.length>0&&void 0!==t?t:new s;return this.W(),i.x=Q(this.P),i.y=Q(this.H),i.z=Q(this.A),i.w=this.U,i}toThreeColor(t){let s=arguments.length>0&&void 0!==t?t:new i;return this.W(),s.r=this.P,s.g=this.H,s.b=this.A,s}copy(t){return t instanceof st?(this.W(),t.W(),this.P===t.P&&this.H===t.H&&this.A===t.A&&this.U===t.U||(this.P=t.P,this.H=t.H,this.A=t.A,this.U=t.U,this.O=!0,this.D=!0)):(this.W(),this.P===t.r&&this.H===t.g&&this.A===t.b&&1===this.U||(this.P=t.r,this.H=t.g,this.A=t.b,this.U=1,this.O=!0,this.D=!0)),this}clone(){return this.W(),new st(this.P,this.H,this.A,this.U)}W(){if(this.L){const{R:t,V:i,B:s}=this,e=(1-Math.abs(2*s-1))*i,h=t/60,r=e*(1-Math.abs(h%2-1));let[n,o,l]=1>h?[e,r,0]:2>h?[r,e,0]:3>h?[0,e,r]:4>h?[0,r,e]:5>h?[r,0,e]:[e,0,r];const a=s-e/2;this.P=n+a,this.H=o+a,this.A=l+a,this.L=!1}}N(){if(this.O){const{P:t,H:i,A:s}=this,e=Math.max(t,i,s),h=Math.min(t,i,s),r=e-h,n=(e+h)/2;let o=0;0!==r&&(o=e===t?(i-s)/r+(s>i?6:0):e===i?(s-t)/r+2:(t-i)/r+4,o*=60);const l=0===r?0:r/(1-Math.abs(2*n-1));this.R=o,this.V=l,this.B=n,this.O=!1}}}const et=(()=>{var t;const i=document.createElement("canvas"),s=null!==(t=i.getContext("webgl2"))&&void 0!==t?t:i.getContext("webgl");return!!s&&(s instanceof WebGL2RenderingContext||null!==s.getExtension("EXT_sRGB"))})(),ht=Object.freeze({glslTypeName:"float",bufferSize:1,instantiable:!0}),rt=Object.freeze({glslTypeName:"sampler2D",bufferSize:-1,instantiable:!1}),nt=Object.freeze({glslTypeName:"vec2",bufferSize:2,instantiable:!0}),ot=Object.freeze({glslTypeName:"vec3",bufferSize:3,instantiable:!0}),lt=Object.freeze({glslTypeName:"vec4",bufferSize:4,instantiable:!0}),at=Object.freeze({glslTypeName:"mat3",bufferSize:9,instantiable:!0}),ut=Object.freeze({glslTypeName:"mat4",bufferSize:16,instantiable:!0});function ct(t){if("string"==typeof t)switch(t){case"number":return ht;case"Texture":return rt;case"UIColor":case"Vector4":return lt;case"Vector2":return nt;case"Vector3":return ot;case"Matrix3":return at;case"Matrix4":return ut;default:throw Error("resolveGLSLTypeInfo.value: unsupported property type name")}if("function"==typeof t){if(t===Number)return ht;if(t===e)return rt;if(t===st)return lt;if(t===h)return nt;if(t===r)return ot;if(t===s)return lt;if(t===n)return at;if(t===o)return ut;throw Error("resolveGLSLTypeInfo.value: unsupported property type constructor")}if("number"==typeof t)return ht;if(t instanceof e)return rt;if(t instanceof st)return lt;if(t instanceof h)return nt;if(t instanceof r)return ot;if(t instanceof s)return lt;if(t instanceof n)return at;if(t instanceof o)return ut;throw Error("resolveGLSLTypeInfo.value: unsupported property type")}function dt(t,i){const s=i.uniforms["p_"+t];if(void 0===s)throw Error("resolvePropertyUniform.name: unknown uniform");return s}function ft(t,i){for(const s in i){if(!(s in t))return!1;const e=t[s].glslTypeInfo;if(e.glslTypeName!==i[s].glslTypeInfo.glslTypeName)return!1;if(!e.instantiable&&t[s]!==i[s])return!1}return!0}function vt(t){const i={};for(const s in t){const e=t[s];i[s]={value:e,glslTypeInfo:ct(e)}}return i}function pt(t){return"number"==typeof t||t instanceof e?t:t.clone()}function wt(t){const i={};for(const s in t)i[s]=pt(t[s]);return i}function gt(t,i,s){return`\n // Defines\n #define PI 3.14159265359\n #define SRGB_SUPPORTED ${et?"1":"0"}\n \n // Uniforms\n ${t.join("\n")}\n \n // Builtin varyings\n varying vec3 p_position;\n varying vec2 p_uv;\n \n // User varyings\n ${i.join("\n")}\n \n #include <alphahash_pars_fragment>\n \n // sRGB decode helper\n vec4 srgbTexture2D(sampler2D textureSampler, vec2 uv) {\n #if SRGB_SUPPORTED\n return texture2D(textureSampler, uv);\n #else\n vec4 textureValue = texture2D(textureSampler, uv);\n return vec4(pow(textureValue.rgb, vec3(2.2)), textureValue.a);\n #endif\n }\n \n // Source must define vec4 draw() function\n ${s}\n void main() {\n vec4 diffuseColor = draw();\n #ifdef USE_ALPHATEST\n if (diffuseColor.a < 0.50) {\n discard;\n }\n #endif\n #ifdef USE_ALPHAHASH\n if (diffuseColor.a < getAlphaHashThreshold(p_position)) {\n discard;\n }\n #endif\n gl_FragColor = linearToOutputTexel(diffuseColor);\n }\n `}var yt;(t=>{t[t.CLIP=0]="CLIP",t[t.HASH=1]="HASH",t[t.BLEND=2]="BLEND"})(yt||(yt={}));const mt=(()=>{const t=new l(1,1);t.translate(.5,.5,0);const i=new a;return i.index=t.index,i.setAttribute("position",t.attributes.position),i.setAttribute("uv",t.attributes.uv),t.dispose(),i})(),bt=new s,_t=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function xt(t,i,e){if(t instanceof st)t.toGLSLColor(bt),i[e]=bt.x,i[e+1]=bt.y,i[e+2]=bt.z,i[e+3]=bt.w;else if(t instanceof h)i[e]=t.x,i[e+1]=t.y;else if(t instanceof r)i[e]=t.x,i[e+1]=t.y,i[e+2]=t.z;else if(t instanceof s)i[e]=t.x,i[e+1]=t.y,i[e+2]=t.z,i[e+3]=t.w;else if(t instanceof n||t instanceof o){const s=t.elements;for(let t=0;s.length>t;t++)i[e+t]=s[t]}else"number"==typeof t&&(i[e]=t)}function St(t,i){const s=ct(t);if(!s.instantiable)throw Error("buildEmptyInstancedBufferAttribute.value: cannot create instanced attribute for non-instantiable type");return new c(new Float32Array(i*s.bufferSize),s.bufferSize)}function Et(t,i,e){if("number"==typeof t)return i[e];if(t instanceof h)return new h(i[e],i[e+1]);if(t instanceof r)return new r(i[e],i[e+1],i[e+2]);if(t instanceof s)return new s(i[e],i[e+1],i[e+2],i[e+3]);if(t instanceof st)return(new st).setGLSLColor(i[e],i[e+1],i[e+2],i[e+3]);if(t instanceof n){const t=new n;return t.fromArray(i,e),t}if(t instanceof o){const t=new o;return t.fromArray(i,e),t}throw Error("reconstructValue.referenceValue: cannot reconstruct value for type")}class It extends d{constructor(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:4;const r={},n={instanceVisibility:{value:1,glslTypeInfo:ct("number")},instanceTransform:{value:(new o).identity(),glslTypeInfo:ct("Matrix4")}};for(const t in i){const s=i[t];s.glslTypeInfo.instantiable?n[t]=s:r[t]=s}const l=mt.clone(),a=((t,i,s,e)=>{const h={},r=[],n=[],o=[],l=[];for(const t in i){const{value:s,glslTypeInfo:e}=i[t];h["p_"+t]={value:s instanceof st?s.toGLSLColor():s},r.push(`uniform ${e.glslTypeName} p_${t};`)}for(const t in s){const{glslTypeInfo:i}=s[t];n.push(`attribute ${i.glslTypeName} a_${t};`),o.push(`varying ${i.glslTypeName} p_${t};`),l.push(`p_${t} = a_${t};`)}const a=`\n // User attributes\n ${n.join("\n")}\n\n // Uniforms\n ${r.join("\n")}\n\n // Builtin varyings\n varying vec3 p_position;\n varying vec2 p_uv;\n\n // User varyings\n ${o.join("\n")}\n\n void main() {\n if (a_instanceVisibility < 0.5) {\n gl_Position = vec4(2.0, 2.0, 2.0, 1.0);\n return;\n }\n\n ${l.join("\n")}\n\n p_position = position;\n p_uv = uv;\n\n gl_Position = projectionMatrix * a_instanceTransform * vec4(position, 1.0);\n }\n `,c=gt(r,o,t);return new u({uniforms:h,vertexShader:a,fragmentShader:c,transparent:e===yt.BLEND,alphaTest:e===yt.CLIP?.5:0,alphaHash:e===yt.HASH,depthWrite:e!==yt.BLEND,depthTest:!0})})(t,r,n,s);super(l,a),this.source=t,this.transparency=s,this.j=new Map,this.F=new Map,this.C=0,this.frustumCulled=!1,this.matrixAutoUpdate=!1,this.matrixWorldAutoUpdate=!1,this.G=l,this.G.instanceCount=0,this.$=a,this.Y=r,this.X=n,this.q=Math.max(4*Math.ceil(h/4),4);for(const t in this.X){const{value:i}=this.X[t],s=St(i,this.q);this.G.setAttribute("a_"+t,s),this.F.set(t,s)}for(const t in this.Y){const{value:i}=this.Y[t];dt(t,this.$).value=i}this.$.uniformsNeedUpdate=!0}get instanceCount(){return this.G.instanceCount}createInstance(){const t=this.C++,i=this.G.instanceCount;this.Z(i+1),this.j.set(t,i),this.G.instanceCount++;{const t=this.F.get("instanceVisibility"),s=this.F.get("instanceTransform");((t,i,s)=>{t[s]=1;const e=16*s;for(let t=0;16>t;t++)i[e+t]=_t[t]})(t.array,s.array,i),t.needsUpdate=!0,s.needsUpdate=!0}return t}destroyInstance(t){const i=this.J(t);this.j.delete(t);const s=this.G.instanceCount-1;s>i&&(this.K(s,i),this.tt(s,i)),this.G.instanceCount--}setProperties(t,i){const s=this.J(t);for(const t in i){const{value:e,glslTypeInfo:h}=i[t];if(h.instantiable){const i=this.it(t);xt(e,i.array,s*i.itemSize),i.needsUpdate=!0}else dt(t,this.$).value=e,this.$.uniformsNeedUpdate=!0}}setTransform(t,i){const s=this.J(t),e=this.it("instanceTransform"),h=e.array,r=16*s,n=i.elements;for(let t=0;16>t;t++)h[r+t]=n[t];e.needsUpdate=!0}setVisibility(t,i){const s=this.J(t),e=this.it("instanceVisibility");e.array[s]=i?1:0,e.needsUpdate=!0}isPartiallyCompatible(t,i,s){return this.transparency===(arguments.length>2&&void 0!==s?s:yt.BLEND)&&this.source===t&&ft(Object.assign(Object.assign({},this.Y),this.X),i)}arePropertiesPartiallyCompatible(t){return ft(Object.assign(Object.assign({},this.Y),this.X),t)}extractInstanceData(t){return{source:this.source,properties:this.st(t),transparency:this.transparency,transform:this.et(t),visibility:this.ht(t)}}destroy(){this.G.dispose(),this.$.dispose(),this.F.clear(),this.j.clear()}st(t){const i=this.J(t),s={};for(const t in this.Y)s[t]=this.Y[t];for(const t in this.X){const{value:e,glslTypeInfo:h}=this.X[t],r=this.F.get(t);s[t]={value:Et(e,r.array,i*r.itemSize),glslTypeInfo:h}}return s}et(t){const i=this.J(t),s=this.F.get("instanceTransform").array,e=new o;return e.fromArray(s,16*i),e}ht(t){const i=this.J(t);return this.F.get("instanceVisibility").array[i]>=.5}Z(t){if(this.q>=t)return;const i=4*Math.ceil(t/4);for(const[t,s]of this.F){const e=s.itemSize,h=new Float32Array(i*e);h.set(s.array);const r=new c(h,e);this.G.setAttribute("a_"+t,r),this.F.set(t,r)}this.q=i}K(t,i){for(const s of this.F.values()){const e=s.array,h=s.itemSize,r=t*h,n=i*h;for(let t=0;h>t;t++)e[n+t]=e[r+t];s.needsUpdate=!0}}tt(t,i){for(const[s,e]of this.j)if(e===t){this.j.set(s,i);break}}J(t){const i=this.j.get(t);if(void 0===i)throw Error("UIGenericInstancedPlane.resolveIndex.handler: invalid handler");return i}it(t){const i=this.F.get(t);if(void 0===i)throw Error("UIGenericInstancedPlane.resolveAttribute.name: unknown attribute");return i}}const Mt=new l(1,1).translate(.5,.5,0);class Ct extends d{constructor(t,i,s,e,h){const r=((t,i,s,e)=>{const h={p_transform:{value:e}},r=[];for(const t in i){const{value:s,glslTypeInfo:e}=i[t];h["p_"+t]={value:s instanceof st?s.toGLSLColor():s},r.push(`uniform ${e.glslTypeName} p_${t};`)}const n=`\n // Default uniform declarations\n uniform mat4 p_transform;\n\n // Custom uniform declarations\n ${r.join("\n")}\n\n // Default varying declarations\n varying vec3 p_position;\n varying vec2 p_uv;\n\n void main() {\n p_position = position;\n p_uv = uv;\n\n gl_Position = projectionMatrix * p_transform * vec4(position, 1.0);\n }\n `,o=gt(r,[],t);return new u({uniforms:h,vertexShader:n,fragmentShader:o,transparent:s===yt.BLEND,alphaTest:s===yt.CLIP?.5:0,alphaHash:s===yt.HASH,depthWrite:s!==yt.BLEND,depthTest:!0})})(t,i,h,s);super(Mt,r),this.rt=t,this.$=r,this.nt=i,this.ot=h,this.lt=s,this.visible=e,this.frustumCulled=!1,this.matrixAutoUpdate=!1,this.matrixWorldAutoUpdate=!1}get transparency(){return this.ot}setProperties(t){for(const i in t){const s=t[i],h=dt(i,this.$),r=s.value;if(s.value instanceof st)s.value.toGLSLColor(h.value),this.nt[i].value.copy(s.value);else if("number"==typeof r||r instanceof e)h.value=s.value,this.nt[i].value=s.value;else{const t=s.value;h.value.copy(t),this.nt[i].value.copy(t)}}this.$.uniformsNeedUpdate=!0}setTransform(t){dt("transform",this.$).value.copy(t),this.$.uniformsNeedUpdate=!0,this.lt.copy(t)}setVisibility(t){this.visible=t}setTransparency(t){this.ot!==t&&(this.$.transparent=t===yt.BLEND,this.$.alphaTest=t===yt.CLIP?.5:0,this.$.alphaHash=t===yt.HASH,this.$.depthWrite=t!==yt.BLEND,this.$.needsUpdate=!0,this.ot=t)}extractPlaneData(){return{source:this.rt,properties:Object.assign({},this.nt),transform:this.lt.clone(),visibility:this.visible,transparency:this.ot}}isPartiallyCompatible(t,i,s){return this.ot===s&&this.rt===t&&ft(this.nt,i)}arePropertiesPartiallyCompatible(t){return ft(this.nt,t)}destroy(){this.$.dispose()}}function Tt(t){return!("instanceHandler"in t)}function Pt(t){return"instanceHandler"in t}class Ht{constructor(t){this.ut=t,this.C=0,this.ct=new Map}createPlane(t,i,s,e,h){const r=this.C++;return this.dt(r,{source:t,properties:vt(wt(i)),transform:s.clone(),visibility:e,transparency:h}),r}destroyPlane(t){const i=this.ft(t);if(Tt(i))this.ut.remove(i.plane),i.plane.destroy();else{const t=i.plane;1===t.instanceCount?(this.ut.remove(t),t.destroy()):2===t.instanceCount?this.vt(t,i):t.destroyInstance(i.instanceHandler)}this.ct.delete(t)}setProperties(t,i){const s=this.ft(t),e=vt(i);if(Tt(s))return void s.plane.setProperties(e);if(s.plane.arePropertiesPartiallyCompatible(e))return void s.plane.setProperties(s.instanceHandler,e);const h=s.plane.extractInstanceData(s.instanceHandler);for(const t in e)h.properties[t]={value:pt(e[t].value),glslTypeInfo:e[t].glslTypeInfo};this.destroyPlane(t),this.dt(t,h)}setTransform(t,i){const s=this.ft(t);Tt(s)?s.plane.setTransform(i):s.plane.setTransform(s.instanceHandler,i)}setVisibility(t,i){const s=this.ft(t);Tt(s)?s.plane.setVisibility(i):s.plane.setVisibility(s.instanceHandler,i)}setTransparency(t,i){const s=this.ft(t);if(s.plane.transparency===i)return;if(Tt(s))return void s.plane.setTransparency(i);const e=s.plane.extractInstanceData(s.instanceHandler);this.destroyPlane(t),this.dt(t,Object.assign(Object.assign({},e),{transparency:i}))}wt(t,i){const{source:s,properties:e,transform:h,visibility:r,transparency:n}=i.plane.extractPlaneData();this.destroyPlane(t);const o=new It(s,e,n),l=o.createInstance();return o.setProperties(l,e),o.setTransform(l,h),o.setVisibility(l,r),this.ut.add(o),this.ct.set(t,{plane:o,instanceHandler:l}),o}vt(t,i){let s;for(const[e,h]of this.ct)if(Pt(h)&&h!==i&&h.plane===t){s=[e,h];break}if(!s)throw Error("UIGenericPlaneRegistry.demoteInstancedPlaneToSinglePlane.instancedPlane: remaining pair not found");const{source:e,properties:h,transform:r,visibility:n,transparency:o}=t.extractInstanceData(s[1].instanceHandler);this.ut.remove(t),t.destroy();const l=new Ct(e,h,r,n,o);this.ut.add(l),this.ct.set(s[0],{plane:l})}gt(t,i,s,e,h){const r=i.createInstance();i.setProperties(r,s),i.setTransform(r,e),i.setVisibility(r,h),this.ct.set(t,{plane:i,instanceHandler:r})}dt(t,i){const{source:s,properties:e,transparency:h,transform:r,visibility:n}=i,o=this.yt(s,e,h);if(o)return void this.gt(t,o,e,r,n);const l=this.bt(s,e,h);if(l){const i=this.wt(l[0],l[1]);return void this.gt(t,i,e,r,n)}const a=new Ct(s,e,r,n,h);this.ut.add(a),this.ct.set(t,{plane:a})}bt(t,i,s){for(const e of this.ct){const h=e[1];if(Tt(h)&&h.plane.isPartiallyCompatible(t,i,s))return[e[0],h]}}yt(t,i,s){for(const e of this.ct){const h=e[1];if(Pt(h)&&h.plane.isPartiallyCompatible(t,i,s))return h.plane}}ft(t){const i=this.ct.get(t);if(!i)throw Error("UIGenericPlaneRegistry.resolvePlaneDescriptor.handler: descriptor not found");return i}}let At=new i,Ut=0,Rt=!1,Vt=!1,Bt=!1,Dt=!1;class Lt{constructor(t,i){this.ut=new f,this._t=new Ht(this.ut),this.xt=new v(0,t,i,0,-1024,1024)}createPlane(t,i,s,e,h){return this._t.createPlane(t,i,s,e,h)}destroyPlane(t){this._t.destroyPlane(t)}setTransform(t,i){this._t.setTransform(t,i)}setProperties(t,i){this._t.setProperties(t,i)}setVisibility(t,i){this._t.setVisibility(t,i)}setTransparency(t,i){this._t.setTransparency(t,i)}insertCustomObject(t){return this.ut.add(t),this}removeCustomObject(t){return this.ut.remove(t),this}resize(t,i){return this.xt.right=t,this.xt.top=i,this.xt.updateProjectionMatrix(),this}render(t){return At=t.getClearColor(At),Ut=t.getClearAlpha(),Rt=t.autoClear,Vt=t.autoClearColor,Bt=t.autoClearDepth,Dt=t.autoClearStencil,t.autoClear=!1,t.autoClearColor=!1,t.autoClearDepth=!1,t.autoClearStencil=!1,t.setClearColor(0,1),t.clear(!1,!0,!0),t.render(this.ut,this.xt),t.setClearColor(At),t.setClearAlpha(Ut),t.autoClear=Rt,t.autoClearColor=Vt,t.autoClearDepth=Bt,t.autoClearStencil=Dt,this}}class kt{constructor(t,i){let s=arguments.length>1?i:void 0;if(this.constant=arguments.length>0&&void 0!==t?t:0,this.St=s?new Map(s):new Map,s)for(let t=0;s.length>t;t++)Xt()}static plus(t,i){const s=new kt(t.constant+i.constant,Array.from(t.St.entries()));for(const[t,e]of i.St)s.plus(t,e);return s}static minus(t,i){const s=new kt(t.constant-i.constant,Array.from(t.St.entries()));for(const[t,e]of i.St)s.minus(t,e);return s}plus(t,i){var s;return this.St.set(t,(null!==(s=this.St.get(t))&&void 0!==s?s:0)+i),this}minus(t,i){return this.plus(t,-i)}multiply(t){this.constant*=t;for(const[i,s]of this.St)this.St.set(i,s*t);return this}divide(t){if(0===t)throw Error("UIExpression.divide.value: cannot divide by zero");return this.multiply(1/t)}hasTerm(t){return this.St.has(t)}copy(t){this.constant=t.constant,this.St.clear();for(const[i,s]of t.St)this.St.set(i,s);return this}clone(){return new kt(this.constant,Array.from(this.St.entries()))}prepareTerms(){return Array.from(this.St.entries())}}var Ot,Wt;(t=>{t[t.EQUAL=0]="EQUAL",t[t.LESS_THAN=1]="LESS_THAN",t[t.GREATER_THAN=2]="GREATER_THAN"})(Ot||(Ot={}));class Nt{constructor(){this.dirty=!1,this.Et=new z,this.It=!1,this.Mt=new Map,this.Ct=0,this.Tt=new Map,this.Pt=0}createVariable(t,i){var s,e,h;const r=this.Ct++,n=new B;if(i===Z.P0){const e={variable:n,priority:i,value:t};this.Mt.set(r,e),e.constraint=this.Ht(new kt(0,[[r,1]]),new kt(t),Ot.EQUAL,i);try{null===(s=this.Et)||void 0===s||s.addConstraint(e.constraint)}catch(t){this.Et=void 0}}else{this.Mt.set(r,{variable:n,priority:i,value:t});try{null===(e=this.Et)||void 0===e||e.addEditVariable(n,J(i)),null===(h=this.Et)||void 0===h||h.suggestValue(n,t)}catch(t){this.Et=void 0}}return this.It=!0,this.dirty=!0,r}removeVariable(t){var i,s;const e=this.Mt.get(t);if(void 0===e)throw Error("UISolverWrapper.removeVariable.index: variable does not exist");for(const i of this.Tt.values())if(i.lhs.hasTerm(t)||i.rhs.hasTerm(t))throw Error("UISolverWrapper.removeVariable.index: variable is used in constraint");try{e.constraint?null===(i=this.Et)||void 0===i||i.removeConstraint(e.constraint):null===(s=this.Et)||void 0===s||s.removeEditVariable(e.variable)}catch(t){this.Et=void 0}this.Mt.delete(t),this.It=!0,this.dirty=!0}suggestVariableValue(t,i){var s;const e=this.Mt.get(t);if(void 0===e)throw Error("UISolverWrapper.suggestVariableValue.index: variable does not exist");e.value!==i&&(e.value=i,e.constraint?e.constraint=this.At(e.constraint,(new kt).plus(t,1),new kt(e.value),Ot.EQUAL,e.priority):null===(s=this.Et)||void 0===s||s.suggestValue(e.variable,i),this.It=!0,this.dirty=!0)}setVariablePriority(t,i){var s,e;const h=this.Mt.get(t);if(void 0===h)throw Error("UISolverWrapper.setVariablePriority.index: variable does not exist");if(i!==h.priority){if(h.priority=i,h.priority===Z.P0){const i=(new kt).plus(t,1),e=new kt(h.value);h.constraint=this.Ht(i,e,Ot.EQUAL,h.priority);try{null===(s=this.Et)||void 0===s||s.addConstraint(h.constraint)}catch(t){this.Et=void 0}}else{if(h.constraint)try{null===(e=this.Et)||void 0===e||e.removeConstraint(h.constraint)}catch(t){this.Et=void 0}h.constraint=void 0,this.Ut(t,h)}this.It=!0,this.dirty=!0}}readVariableValue(t){var i;const s=this.Mt.get(t);if(void 0===s)throw Error("UISolverWrapper.readVariableValue.index: variable does not exist");return void 0===this.Et&&this.Rt(),this.It&&(null===(i=this.Et)||void 0===i||i.updateVariables(),this.It=!1),s.variable.value()}createConstraint(t,i,s,e,h){var r;const n=this.Pt++,o=this.Ht(t,i,s,e);if(this.Tt.set(n,{constraint:o,lhs:t.clone(),rhs:i.clone(),priority:e,relation:s,enabled:h}),h){try{null===(r=this.Et)||void 0===r||r.addConstraint(o)}catch(t){this.Et=void 0}this.It=!0,this.dirty=!0}return n}removeConstraint(t){var i;const s=this.Tt.get(t);if(void 0===s)throw Error("UISolverWrapper.removeConstraint.index: constraint does not exist");if(s.enabled)try{null===(i=this.Et)||void 0===i||i.removeConstraint(s.constraint)}catch(t){this.Et=void 0}this.Tt.delete(t),this.It=!0,this.dirty=!0}setConstraintLHS(t,i){const s=this.Tt.get(t);if(void 0===s)throw Error("UISolverWrapper.setConstraintLHS.index: constraint does not exist");s.lhs.copy(i),this.Vt(s),this.It=!0,this.dirty=!0}setConstraintRHS(t,i){const s=this.Tt.get(t);if(void 0===s)throw Error("UISolverWrapper.setConstraintRHS.index: constraint does not exist");s.rhs.copy(i),this.Vt(s),this.It=!0,this.dirty=!0}setConstraintRelation(t,i){const s=this.Tt.get(t);if(void 0===s)throw Error("UISolverWrapper.setConstraintRelation.index: constraint does not exist");s.relation!==i&&(s.relation=i,this.Vt(s),this.It=!0,this.dirty=!0)}setConstraintPriority(t,i){const s=this.Tt.get(t);if(void 0===s)throw Error("UISolverWrapper.setConstraintPriority.index: constraint does not exist");s.priority!==i&&(s.priority=i,this.Vt(s),this.It=!0,this.dirty=!0)}setConstraintEnabled(t,i){var s,e;const h=this.Tt.get(t);if(void 0===h)throw Error("UISolverWrapper.setConstraintEnabled.index: constraint does not exist");if(i!==h.enabled){h.enabled=i;try{h.enabled?null===(s=this.Et)||void 0===s||s.addConstraint(h.constraint):null===(e=this.Et)||void 0===e||e.removeConstraint(h.constraint)}catch(t){this.Et=void 0}this.It=!0,this.dirty=!0}}Ut(t,i){var s,e,h,r;const n=[];for(const i of this.Tt.values())if(i.lhs.hasTerm(t)||i.rhs.hasTerm(t)){try{null===(s=this.Et)||void 0===s||s.removeConstraint(i.constraint)}catch(t){this.Et=void 0}n.push(i)}null===(e=this.Et)||void 0===e||e.removeEditVariable(i.variable),null===(h=this.Et)||void 0===h||h.addEditVariable(i.variable,J(i.priority));for(const t of n)t.constraint=this.Ht(t.lhs,t.rhs,t.relation,t.priority);for(const t of n)try{null===(r=this.Et)||void 0===r||r.addConstraint(t.constraint)}catch(t){this.Et=void 0;break}}Vt(t){t.constraint=t.enabled?this.At(t.constraint,t.lhs,t.rhs,t.relation,t.priority):this.Ht(t.lhs,t.rhs,t.relation,t.priority)}At(t,i,s,e,h){var r,n;try{null===(r=this.Et)||void 0===r||r.removeConstraint(t)}catch(t){this.Et=void 0}const o=this.Ht(i,s,e,h);try{null===(n=this.Et)||void 0===n||n.addConstraint(o)}catch(t){this.Et=void 0}return o}Ht(t,i,s,e){return new N(this.Bt(t),(t=>{switch(t){case Ot.EQUAL:return O.Eq;case Ot.LESS_THAN:return O.Le;case Ot.GREATER_THAN:return O.Ge;default:throw Error("convertRelation.relation: invalid relation")}})(s),this.Bt(i),J(e))}Bt(t){return new L(...t.prepareTerms().map(t=>{let[i,s]=t;const e=this.Mt.get(i);if(void 0===e)throw Error("UISolverWrapper.convertExpression.expression: variable does not exist");return[s,e.variable]}),t.constant)}Rt(){if(this.Et)throw Error("UISolverWrapper.rebuildSolver: solver already exists");this.Et=new z;for(const t of this.Mt.values())t.constraint?this.Et.addConstraint(t.constraint):(this.Et.addEditVariable(t.variable,J(t.priority)),this.Et.suggestValue(t.variable,t.value));for(const t of this.Tt.values())t.enabled&&this.Et.addConstraint(t.constraint);this.It=!0,this.dirty=!0}}(t=>{t.ORIENTATION_CHANGED="orientation_changed",t.MODE_CHANGED="mode_changed",t.RENDERING="rendering"})(Wt||(Wt={}));const jt=C.VISIBLE;class zt extends M{constructor(t){var i,s,e,h;super(),this.name="",this.inputWrapperInternal=new K,this.Dt=new Nt;const r=null!==(i=t.width)&&void 0!==i?i:1024,n=null!==(s=t.height)&&void 0!==s?s:1024;this.Lt=new Lt(r,n),this.name=null!==(e=t.name)&&void 0!==e?e:"",this.kt=null!==(h=t.mode)&&void 0!==h?h:jt,this.Ot=r>n?T.HORIZONTAL:T.VERTICAL,this.xVariable=this.Dt.createVariable(0,Z.P0),this.yVariable=this.Dt.createVariable(0,Z.P0),this.wVariable=this.Dt.createVariable(r,Z.P0),this.hVariable=this.Dt.createVariable(n,Z.P0)}get sceneWrapper(){return this.Lt}get solverWrapper(){return this.Dt}get inputWrapper(){return this.inputWrapperInternal}get x(){return this.Dt.readVariableValue(this.xVariable)}get y(){return this.Dt.readVariableValue(this.yVariable)}get width(){return this.Dt.readVariableValue(this.wVariable)}get height(){return this.Dt.readVariableValue(this.hVariable)}get mode(){return this.kt}get orientation(){return this.Ot}set mode(t){t!==this.kt&&(this.kt=t,this.emit(Wt.MODE_CHANGED,this.kt,this))}resizeInternal(t,i){this.Dt.suggestVariableValue(this.wVariable,t),this.Dt.suggestVariableValue(this.hVariable,i),this.Lt.resize(t,i);const s=t>i?T.HORIZONTAL:T.VERTICAL;s!==this.Ot&&(this.Ot=s,this.emit(Wt.ORIENTATION_CHANGED,this.Ot,this))}renderInternal(t,i){H(this.mode)&&(this.emit(Wt.RENDERING,t,i,this),this.Lt.render(t)),this.Dt.dirty=!1,this.inputWrapperInternal.dirty=!1}}function Ft(t){return"object"==typeof t&&null!==t&&"layer"in t&&t.layer instanceof zt}function Gt(t){return"object"==typeof t&&null!==t&&"xVariable"in t&&"number"==typeof t.xVariable&&"yVariable"in t&&"number"==typeof t.yVariable&&"width"in t&&"number"==typeof t.width&&"height"in t&&"number"==typeof t.height}function $t(t){return"object"==typeof t&&null!==t&&"wVariable"in t&&"number"==typeof t.wVariable&&"hVariable"in t&&"number"==typeof t.hVariable&&"width"in t&&"number"==typeof t.width&&"height"in t&&"number"==typeof t.height}const Yt=1e-6;function Xt(){}function qt(t,i,s){if(t instanceof zt)return t;if(Ft(t))return t.layer;if(i instanceof zt)return i;if(Ft(i))return i.layer;throw Error(s+": no valid subjects found")}function Zt(t,i,s){if(Ft(i))return i.layer;if(Ft(s))return s.layer;if(i instanceof zt)return i;if(s instanceof zt)return s;throw Error(t+": no valid subjects found")}class Jt{constructor(t,i){this.layer=t,this.solverWrapper=this.layer.solverWrapper,this.name=null!=i?i:""}}class Kt extends Jt{constructor(t,i){var s,e,h;super(t,null==i?void 0:i.name),this.Wt=()=>{this.solverWrapper.setConstraintEnabled(this.constraint,this.isConstraintEnabled())},this.Nt=null!=(s=null==i?void 0:i.priority)?s:Z.P0,this.jt=null!=(e=null==i?void 0:i.relation)?e:Ot.EQUAL,this.Ot=null!=(h=null==i?void 0:i.orientation)?h:T.ALWAYS,this.layer.on(Wt.ORIENTATION_CHANGED,this.Wt)}get priority(){return this.Nt}get relation(){return this.jt}get orientation(){return this.Ot}set priority(t){t!==this.Nt&&(this.Nt=t,this.solverWrapper.setConstraintPriority(this.constraint,this.Nt))}set relation(t){t!==this.jt&&(this.jt=t,this.solverWrapper.setConstraintRelation(this.constraint,this.jt))}set orientation(t){t!==this.Ot&&(this.Ot=t,this.Wt())}destroy(){this.layer.off(Wt.ORIENTATION_CHANGED,this.Wt),this.solverWrapper.removeConstraint(this.constraint)}isConstraintEnabled(){return this.Ot===T.ALWAYS||this.Ot===this.layer.orientation}}class Qt extends Kt{constructor(t,i){let s=arguments.length>1&&void 0!==i?i:{};var e;super(t.layer,s),this.zt=t,this.Ft=null!==(e=s.height)&&void 0!==e?e:t.height,this.constraint=this.solverWrapper.createConstraint(new kt(0,[[this.zt.hVariable,1]]),new kt(this.Ft),this.relation,this.priority,this.isConstraintEnabled())}get height(){return this.Ft}set height(t){this.Ft!==t&&(this.Ft=t,this.solverWrapper.setConstraintRHS(this.constraint,new kt(t)))}}class ti extends Kt{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r,n;super(qt(t,i,"UIHorizontalDistanceConstraint.constructor"),e),this.Gt=t,this.$t=i,this.Yt=null!==(h=e.anchorA)&&void 0!==h?h:.5,this.Xt=null!==(r=e.anchorB)&&void 0!==r?r:.5,this.qt=null!==(n=e.distance)&&void 0!==n?n:0,this.constraint=this.solverWrapper.createConstraint(this.Zt(),new kt(this.qt),this.relation,this.priority,this.isConstraintEnabled())}get distance(){return this.qt}get anchorA(){return this.Yt}get anchorB(){return this.Xt}set distance(t){this.qt!==t&&(this.qt=t,this.solverWrapper.setConstraintRHS(this.constraint,new kt(this.qt)))}set anchorA(t){this.Yt!==t&&(this.Yt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorB(t){this.Xt!==t&&(this.Xt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}Zt(){let t,i;if($t(this.Gt))t=new kt(0,[[this.Gt.xVariable,1],[this.Gt.wVariable,this.Yt]]);else{if(!Gt(this.Gt))throw Error("UIHorizontalDistanceConstraint.buildLHS.a: invalid element type");t=(new kt).plus(this.Gt.xVariable,1)}if($t(this.$t))i=new kt(0,[[this.$t.xVariable,1],[this.$t.wVariable,this.Xt]]);else{if(!Gt(this.$t))throw Error("UIHorizontalDistanceConstraint.buildLHS.b: invalid element type");i=(new kt).plus(this.$t.xVariable,1)}return kt.minus(i,t)}}class ii extends Kt{constructor(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:{};var r,n,o;const l=null!==(r=h.anchorA)&&void 0!==r?r:.5;super(Zt("UIHorizontalInterpolationConstraint.constructor",t,i),h),this.Gt=t,this.$t=i,this.Jt=s,this.Yt=l,this.Xt=l,this.Kt=null!==(n=h.anchorC)&&void 0!==n?n:.5,this.Qt=null!==(o=h.t)&&void 0!==o?o:.5,this.constraint=this.solverWrapper.createConstraint(this.Zt(),new kt(0),this.relation,this.priority,this.isConstraintEnabled())}get t(){return this.Qt}get anchorA(){return this.Yt}get anchorB(){return this.Xt}get anchorC(){return this.Kt}set t(t){this.Qt!==t&&(this.Qt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorA(t){this.Yt!==t&&(this.Yt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorB(t){this.Xt!==t&&(this.Xt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorC(t){this.Kt!==t&&(this.Kt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}Zt(){let t,i,s;if($t(this.Gt))t=new kt(0,[[this.Gt.xVariable,1],[this.Gt.wVariable,this.Yt]]);else{if(!Gt(this.Gt))throw Error("UIHorizontalInterpolationConstraint.buildLHS.a: invalid element type");t=(new kt).plus(this.Gt.xVariable,1)}if($t(this.$t))i=new kt(0,[[this.$t.xVariable,1],[this.$t.wVariable,this.Xt]]);else{if(!Gt(this.$t))throw Error("UIHorizontalInterpolationConstraint.buildLHS.b: invalid element type");i=(new kt).plus(this.$t.xVariable,1)}if($t(this.Jt))s=new kt(0,[[this.Jt.xVariable,1],[this.Jt.wVariable,this.Kt]]);else{if(!Gt(this.Jt))throw Error("UIHorizontalInterpolationConstraint.buildLHS.c: invalid element type");s=(new kt).plus(this.Jt.xVariable,1)}const e=t.clone().multiply(1-this.Qt),h=i.clone().multiply(this.Qt);return kt.minus(kt.minus(s,e),h)}}class si extends Kt{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h;super(qt(t,i,"UIHorizontalProportionConstraint.constructor"),e),this.Gt=t,this.$t=i,this.ti=null!==(h=e.proportion)&&void 0!==h?h:1,this.constraint=this.solverWrapper.createConstraint(new kt(0),this.ii(),this.relation,this.priority,this.isConstraintEnabled())}get proportion(){return this.ti}set proportion(t){this.ti!==t&&(this.ti=t,this.solverWrapper.setConstraintRHS(this.constraint,this.ii()))}ii(){return kt.minus(new kt(0,[[this.Gt.wVariable,this.ti]]),new kt(0,[[this.$t.wVariable,1]]))}}class ei extends Kt{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r,n;super(qt(t,i,"UIVerticalDistanceConstraint.constructor"),e),this.Gt=t,this.$t=i,this.Yt=null!==(h=e.anchorA)&&void 0!==h?h:.5,this.Xt=null!==(r=e.anchorB)&&void 0!==r?r:.5,this.qt=null!==(n=e.distance)&&void 0!==n?n:0,this.constraint=this.solverWrapper.createConstraint(this.Zt(),new kt(this.qt),this.relation,this.priority,this.isConstraintEnabled())}get distance(){return this.qt}get anchorA(){return this.Yt}get anchorB(){return this.Xt}set distance(t){this.qt!==t&&(this.qt=t,this.solverWrapper.setConstraintRHS(this.constraint,new kt(this.qt)))}set anchorA(t){this.Yt!==t&&(this.Yt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorB(t){this.Xt!==t&&(this.Xt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}Zt(){let t,i;if($t(this.Gt))t=new kt(0,[[this.Gt.yVariable,1],[this.Gt.hVariable,this.Yt]]);else{if(!Gt(this.Gt))throw Error("UIVerticalDistanceConstraint.buildLHS.a: invalid element type");t=(new kt).plus(this.Gt.yVariable,1)}if($t(this.$t))i=new kt(0,[[this.$t.yVariable,1],[this.$t.hVariable,this.Xt]]);else{if(!Gt(this.$t))throw Error("UIVerticalDistanceConstraint.buildLHS.b: invalid element type");i=(new kt).plus(this.$t.yVariable,1)}return kt.minus(i,t)}}class hi extends Kt{constructor(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:{};var r,n,o;const l=null!==(r=h.anchorA)&&void 0!==r?r:.5;super(Zt("UIVerticalInterpolationConstraint.constructor",t,i),h),this.Gt=t,this.$t=i,this.Jt=s,this.Yt=l,this.Xt=l,this.Kt=null!==(n=h.anchorC)&&void 0!==n?n:.5,this.Qt=null!==(o=h.t)&&void 0!==o?o:.5,this.constraint=this.solverWrapper.createConstraint(this.Zt(),new kt(0),this.relation,this.priority,this.isConstraintEnabled())}get t(){return this.Qt}get anchorA(){return this.Yt}get anchorB(){return this.Xt}get anchorC(){return this.Kt}set t(t){this.Qt!==t&&(this.Qt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorA(t){this.Yt!==t&&(this.Yt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorB(t){this.Xt!==t&&(this.Xt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}set anchorC(t){this.Kt!==t&&(this.Kt=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}Zt(){let t,i,s;if($t(this.Gt))t=new kt(0,[[this.Gt.yVariable,1],[this.Gt.hVariable,this.Yt]]);else{if(!Gt(this.Gt))throw Error("UIVerticalInterpolationConstraint.buildLHS.a: invalid element type");t=(new kt).plus(this.Gt.yVariable,1)}if($t(this.$t))i=new kt(0,[[this.$t.yVariable,1],[this.$t.hVariable,this.Xt]]);else{if(!Gt(this.$t))throw Error("UIVerticalInterpolationConstraint.buildLHS.b: invalid element type");i=(new kt).plus(this.$t.yVariable,1)}if($t(this.Jt))s=new kt(0,[[this.Jt.yVariable,1],[this.Jt.hVariable,this.Kt]]);else{if(!Gt(this.Jt))throw Error("UIVerticalInterpolationConstraint.buildLHS.c: invalid element type");s=(new kt).plus(this.Jt.yVariable,1)}const e=t.clone().multiply(1-this.Qt),h=i.clone().multiply(this.Qt);return kt.minus(kt.minus(s,e),h)}}class ri extends Kt{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h;super(qt(t,i,"UIVerticalProportionConstraint.constructor"),e),this.Gt=t,this.$t=i,this.ti=null!==(h=e.proportion)&&void 0!==h?h:1,this.constraint=this.solverWrapper.createConstraint(new kt(0),this.ii(),this.relation,this.priority,this.isConstraintEnabled())}get proportion(){return this.ti}set proportion(t){this.ti!==t&&(this.ti=t,this.solverWrapper.setConstraintRHS(this.constraint,this.ii()))}ii(){return kt.minus(new kt(0,[[this.Gt.hVariable,this.ti]]),new kt(0,[[this.$t.hVariable,1]]))}}class ni extends Kt{constructor(t,i){let s=arguments.length>1&&void 0!==i?i:{};var e;super(t.layer,s),this.zt=t,this.si=null!==(e=s.width)&&void 0!==e?e:t.width,this.constraint=this.solverWrapper.createConstraint(new kt(0,[[this.zt.wVariable,1]]),new kt(this.si),this.relation,this.priority,this.isConstraintEnabled())}get width(){return this.si}set width(t){this.si!==t&&(this.si=t,this.solverWrapper.setConstraintRHS(this.constraint,new kt(t)))}}function oi(t){return void 0===t?{}:Array.isArray(t)?{h:t[0],v:t[1]}:"object"==typeof t&&null!==t&&("h"in t||"v"in t)?t:{h:t,v:t}}class li{static size(t,i){let s=arguments.length>1&&void 0!==i?i:{};const e=oi(s.size),h=oi(s.priority),r=oi(s.relation),n=oi(s.orientation);return{h:new ni(t,{width:e.h,priority:h.h,relation:r.h,orientation:n.h}),v:new Qt(t,{height:e.v,priority:h.v,relation:r.v,orientation:n.v})}}static distance(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};const h=oi(e.anchorA),r=oi(e.anchorB),n=oi(e.distance),o=oi(e.priority),l=oi(e.relation),a=oi(e.orientation);return{h:new ti(t,i,{anchorA:h.h,anchorB:r.h,distance:n.h,priority:o.h,relation:l.h,orientation:a.h}),v:new ei(t,i,{anchorA:h.v,anchorB:r.v,distance:n.v,priority:o.v,relation:l.v,orientation:a.v})}}static proportion(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};const h=oi(e.proportion),r=oi(e.priority),n=oi(e.relation),o=oi(e.orientation);return{h:new si(t,i,{proportion:h.h,priority:r.h,relation:n.h,orientation:o.h}),v:new ri(t,i,{proportion:h.v,priority:r.v,relation:n.v,orientation:o.v})}}static interpolation(t,i,s,e){let h=arguments.length>3&&void 0!==e?e:{};const r=oi(h.anchorA),n=oi(h.anchorB),o=oi(h.anchorC),l=oi(h.t),a=oi(h.priority),u=oi(h.relation),c=oi(h.orientation);return{h:new ii(t,i,s,{anchorA:r.h,anchorB:n.h,anchorC:o.h,t:l.h,priority:a.h,relation:u.h,orientation:c.h}),v:new hi(t,i,s,{anchorA:r.v,anchorB:n.v,anchorC:o.v,t:l.v,priority:a.v,relation:u.v,orientation:c.v})}}}class ai extends Kt{constructor(t,i){let s=arguments.length>1&&void 0!==i?i:{};var e;super(t.layer,s),this.zt=t,this.ei=null!==(e=s.aspect)&&void 0!==e?e:t.width/t.height,this.constraint=this.solverWrapper.createConstraint(this.Zt(),new kt(0),this.relation,this.priority,this.isConstraintEnabled())}get aspect(){return this.ei}set aspect(t){this.ei!==t&&(this.ei=t,this.solverWrapper.setConstraintLHS(this.constraint,this.Zt()))}Zt(){return new kt(0,[[this.zt.wVariable,1],[this.zt.hVariable,-this.ei]])}}const ui=.5;class ci{static build(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r,n,o;let l;return!0===e.keepActiveAspect&&(l=new ai(i,{orientation:e.orientation})),{activeAspectConstraint:l,xConstraint:new ti(t,i,{anchorA:null!==(h=e.anchorH)&&void 0!==h?h:ui,anchorB:null!==(r=e.anchorH)&&void 0!==r?r:ui,orientation:e.orientation}),yConstraint:new ei(t,i,{anchorA:null!==(n=e.anchorV)&&void 0!==n?n:ui,anchorB:null!==(o=e.anchorV)&&void 0!==o?o:ui,orientation:e.orientation}),widthConstraint:new si(t,i,{proportion:1,relation:Ot.GREATER_THAN,orientation:e.orientation}),heightConstraint:new ri(t,i,{proportion:1,priority:Z.P1,orientation:e.orientation})}}}const di=.5;class fi{static build(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r,n,o;let l;return!0===e.keepActiveAspect&&(l=new ai(i,{orientation:e.orientation})),{activeAspectConstraint:l,xConstraint:new ti(t,i,{anchorA:null!==(h=e.anchorH)&&void 0!==h?h:di,anchorB:null!==(r=e.anchorH)&&void 0!==r?r:di,orientation:e.orientation}),yConstraint:new ei(t,i,{anchorA:null!==(n=e.anchorV)&&void 0!==n?n:di,anchorB:null!==(o=e.anchorV)&&void 0!==o?o:di,orientation:e.orientation}),widthConstraint:new si(t,i,{proportion:1,relation:Ot.LESS_THAN,orientation:e.orientation}),heightConstraint:new ri(t,i,{proportion:1,priority:Z.P1,orientation:e.orientation})}}}class vi extends Kt{constructor(t,i,s,e){super(t,arguments.length>3&&void 0!==e?e:{}),this.hi=i,this.ri=s,this.constraint=this.solverWrapper.createConstraint(this.hi,this.ri,this.relation,this.priority,this.isConstraintEnabled())}get lhs(){return this.hi}get rhs(){return this.ri}setLHS(t){this.hi=t,this.solverWrapper.setConstraintLHS(this.constraint,this.hi)}setRHS(t){this.ri=t,this.solverWrapper.setConstraintRHS(this.constraint,this.ri)}}class pi extends M{constructor(t,i){var s,e;const h=null!==(s=null==i?void 0:i.x)&&void 0!==s?s:0,r=null!==(e=null==i?void 0:i.y)&&void 0!==e?e:0;super(),this.layer=t,this.name="",this.solverWrapper=this.layer.solverWrapper,this.xVariable=this.solverWrapper.createVariable(h,Z.P7),this.yVariable=this.solverWrapper.createVariable(r,Z.P7)}get x(){return this.solverWrapper.readVariableValue(this.xVariable)}get y(){return this.solverWrapper.readVariableValue(this.yVariable)}set x(t){this.solverWrapper.suggestVariableValue(this.xVariable,t)}set y(t){this.solverWrapper.suggestVariableValue(this.yVariable,t)}destroy(){this.solverWrapper.removeVariable(this.yVariable),this.solverWrapper.removeVariable(this.xVariable)}}var wi;(t=>{t[t.ROTATION_SCALE=0]="ROTATION_SCALE",t[t.POSITION_ROTATION_SCALE=1]="POSITION_ROTATION_SCALE"})(wi||(wi={}));const gi=.5,yi=wi.ROTATION_SCALE,mi=new r,bi=new p,_i=new r,xi=new o,Si=new r(0,0,1);function Ei(t,i,s,e,h,r,n,o,l,a,u,c,d,f,v,p,w){const g=s-f-v,y=e-p-w,m=o*s*a,b=l*e*u,_=Math.cos(c),x=Math.sin(c),S=m*_-b*x,E=m*x+b*_,I=f*a,M=w*u,C=I*_-M*x,T=I*x+M*_;if(d===wi.POSITION_ROTATION_SCALE)mi.x=t+r-S+C,mi.y=i+n-E+T;else{const h=l*e;mi.x=t+o*s-S+r+C,mi.y=i+h-E+n+T}return mi.z=h,_i.x=g*a,_i.y=y*u,bi.setFromAxisAngle(Si,c),xi.compose(mi,bi,_i),xi}const Ii=new e;var Mi;(t=>{t[t.DIMENSIONS_CHANGED=0]="DIMENSIONS_CHANGED"})(Mi||(Mi={}));class Ci extends M{constructor(t){super(),this.ni=Ii,this.oi=2,this.li=2,this.ai=0,this.ui=0,this.ci=2,this.di=2,this.fi=!1,this.pi=1,this.wi=0,this.gi=0,this.yi=0,this.mi=0,this.bi=!1,this._i=!1,this.xi=!1,void 0!==t&&this.set(t)}get width(){return this.oi/this.pi}get height(){return this.li/this.pi}get trimmedWidth(){return(this.fi?this.di:this.ci)/this.pi}get trimmedHeight(){return(this.fi?this.ci:this.di)/this.pi}get texture(){return this.ni}get rotated(){return this.fi}get scale(){return this.pi}get trim(){const t=this.pi;return{left:this.wi/t,right:this.gi/t,top:this.yi/t,bottom:this.mi/t}}get textureDirty(){return this.bi}get uvTransformDirty(){return this._i}get trimDirty(){return this.xi}setTextureDirtyFalse(){this.bi=!1}setUVTransformDirtyFalse(){this._i=!1}setTrimDirtyFalse(){this.xi=!1}calculateUVTransform(t){let i=arguments.length>0&&void 0!==t?t:new n;var s,e,h,r;const o=null!==(e=null===(s=this.ni.image)||void 0===s?void 0:s.naturalWidth)&&void 0!==e?e:2,l=null!==(r=null===(h=this.ni.image)||void 0===h?void 0:h.naturalHeight)&&void 0!==r?r:2;if(this.fi){const t=this.ci,s=t/l;i.set(0,this.di/o,this.ai/o,-s,0,(l-this.ui-t)/l+s,0,0,1)}else i.set(this.ci/o,0,this.ai/o,0,this.di/l,(l-this.ui-this.di)/l,0,0,1);return i}getResolution(t){return(arguments.length>0&&void 0!==t?t:new h).set(this.width,this.height)}set(t){const i=this.width,s=this.height;t instanceof e?this.Si(t):this.Ei(t),this.width===i&&this.height===s||this.emit(Mi.DIMENSIONS_CHANGED,this.width,this.height,this)}Si(t){var i,s,e,h;const r=null!==(s=null===(i=t.image)||void 0===i?void 0:i.naturalWidth)&&void 0!==s?s:2,n=null!==(h=null===(e=t.image)||void 0===e?void 0:e.naturalHeight)&&void 0!==h?h:2;this.oi=r,this.li=n,this.texture!==t&&(this.ni=t,this.bi=!0),(0!==this.ai||0!==this.ui||this.ci!==r||this.di!==n||1!==this.pi||this.fi)&&(this.ai=0,this.ui=0,this.ci=r,this.di=n,this.fi=!1,this.pi=1,this._i=!0),0===this.wi&&0===this.gi&&0===this.yi&&0===this.mi||(this.wi=0,this.gi=0,this.yi=0,this.mi=0,this.xi=!0)}Ei(t){var i,s;this.oi=t.sourceSize.w,this.li=t.sourceSize.h,this.texture!==t.texture&&(this.ni=t.texture,this.bi=!0);const e=null!==(i=t.scale)&&void 0!==i?i:1,h=null!==(s=t.rotated)&&void 0!==s&&s;0===this.ai&&0===this.ui&&this.ci===t.frame.w&&this.di===t.frame.h&&this.pi===e&&this.fi===h||(this.ai=t.frame.x,this.ui=t.frame.y,this.ci=t.frame.w,this.di=t.frame.h,this.pi=e,this.fi=h,this._i=!0);const r=t.spriteSourceSize,n=r.x,o=r.y,l=this.oi-r.x-r.w,a=this.li-r.y-r.h;this.wi===n&&this.gi===l&&this.yi===o&&this.mi===a||(this.wi=n,this.gi=l,this.yi=o,this.mi=a,this.xi=!0)}}var Ti,Pi="vec4 draw(){vec2 transformedUV=(p_textureTransform*vec3(p_uv,1.0)).xy;return srgbTexture2D(p_texture,transformedUV)*p_color;}";class Hi{constructor(t){var i,s,e,h,r,n,o,l;this.D=!0,this.Ii=null!==(i=null==t?void 0:t.x)&&void 0!==i?i:0,this.Mi=null!==(s=null==t?void 0:t.y)&&void 0!==s?s:0,this.Ci=null!==(e=null==t?void 0:t.anchorX)&&void 0!==e?e:gi,this.Ti=null!==(h=null==t?void 0:t.anchorY)&&void 0!==h?h:gi,this.Pi=null!==(r=null==t?void 0:t.scaleX)&&void 0!==r?r:1,this.Hi=null!==(n=null==t?void 0:t.scaleY)&&void 0!==n?n:1,this.Ai=null!==(o=null==t?void 0:t.rotation)&&void 0!==o?o:0,this.Ui=null!==(l=null==t?void 0:t.anchorMode)&&void 0!==l?l:yi}get x(){return this.Ii}get y(){return this.Mi}get anchorX(){return this.Ci}get anchorY(){return this.Ti}get scaleX(){return this.Pi}get scaleY(){return this.Hi}get angle(){return t.radToDeg(this.Ai)}get anchorMode(){return this.Ui}get rotation(){return this.Ai}get dirty(){return this.D}set x(t){t!==this.Ii&&(this.Ii=t,this.D=!0)}set y(t){t!==this.Mi&&(this.Mi=t,this.D=!0)}set anchorX(t){t!==this.Ci&&(this.Ci=t,this.D=!0)}set anchorY(t){t!==this.Ti&&(this.Ti=t,this.D=!0)}set scaleX(t){t!==this.Pi&&(this.Pi=t,this.D=!0)}set scaleY(t){t!==this.Hi&&(this.Hi=t,this.D=!0)}set angle(i){const s=t.degToRad(i);s!==this.Ai&&(this.Ai=s,this.D=!0)}set rotation(t){t!==this.Ai&&(this.Ai=t,this.D=!0)}set anchorMode(t){t!==this.Ui&&(this.Ui=t,this.D=!0)}setDirtyFalse(){this.D=!1}reset(){0===this.Ii&&0===this.Mi&&this.Ci===gi&&this.Ti===gi&&1===this.Pi&&1===this.Hi&&0===this.Ai||(this.Ii=0,this.Mi=0,this.Ci=gi,this.Ti=gi,this.Pi=1,this.Hi=1,this.Ai=0,this.D=!0)}copy(t){this.Ii===t.Ii&&this.Mi===t.Mi&&this.Ci===t.Ci&&this.Ti===t.Ti&&this.Pi===t.Pi&&this.Hi===t.Hi&&this.Ai===t.Ai&&this.Ui===t.Ui||(this.Ii=t.Ii,this.Mi=t.Mi,this.Ci=t.Ci,this.Ti=t.Ti,this.Pi=t.Pi,this.Hi=t.Hi,this.Ai=t.Ai,this.Ui=t.Ui,this.D=!0)}}class Ai{}class Ui extends Ai{constructor(t,i,s,e){super(),this.x=t,this.y=i,this.width=s,this.height=e}contains(t,i){return!(this.x>t||t>this.x+this.width||this.y>i||i>this.y+this.height)}}(t=>{t.PRESSED="pointerdown",t.MOVED="pointermove",t.RELEASED="pointerup",t.ENTERED="pointerenter",t.LEFT="pointerleave"})(Ti||(Ti={}));const Ri=C.VISIBLE;class Vi extends pi{constructor(t,i){var s,e,h,r;const n=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:64,o=null!==(e=null==i?void 0:i.height)&&void 0!==e?e:32;super(t,i),this.Ri=!1,this.catchPointerDown=(t,i,s)=>this.handleInputEvent(t,i,s,Ti.PRESSED),this.catchPointerMove=(t,i,s)=>this.handleInputEvent(t,i,s,Ti.MOVED),this.catchPointerUp=(t,i,s)=>this.handleInputEvent(t,i,s,Ti.RELEASED),this.interactionArea=null!==(h=null==i?void 0:i.interactionArea)&&void 0!==h?h:new Ui(0,0,1,1),this.modeInternal=null!==(r=null==i?void 0:i.mode)&&void 0!==r?r:Ri,this.inputWrapper=this.layer.inputWrapper,this.wVariable=this.solverWrapper.createVariable(n,Z.P6),this.hVariable=this.solverWrapper.createVariable(o,Z.P6),this.Vi=this.inputWrapper.createInputCatcher(this.catchPointerDown,this.catchPointerMove,this.catchPointerUp,0),this.inputWrapper.setActive(this.Vi,P(this.modeInternal))}get width(){return this.solverWrapper.readVariableValue(this.wVariable)}get height(){return this.solverWrapper.readVariableValue(this.hVariable)}get oppositeX(){return this.x+this.width}get oppositeY(){return this.y+this.height}get centerX(){return this.x+this.width/2}get centerY(){return this.y+this.height/2}get mode(){return this.modeInternal}get zIndex(){return this.inputWrapper.getZIndex(this.Vi)}set width(t){this.solverWrapper.suggestVariableValue(this.wVariable,t)}set height(t){this.solverWrapper.suggestVariableValue(this.hVariable,t)}set oppositeX(t){this.x=t-this.width}set oppositeY(t){this.y=t-this.height}set centerX(t){this.x=t-this.width/2}set centerY(t){this.y=t-this.height/2}set mode(t){if(this.modeInternal!==t){const i=P(t);this.inputWrapper.setActive(this.Vi,i),this.modeInternal=t}}set zIndex(t){this.inputWrapper.setZIndex(this.Vi,t)}destroy(){this.solverWrapper.removeVariable(this.hVariable),this.solverWrapper.removeVariable(this.wVariable),this.inputWrapper.destroyInputCatcher(this.Vi),super.destroy()}handleInputEvent(i,s,e,h){const r=this.interactionArea.contains(t.mapLinear(i,this.x,this.oppositeX,0,1),t.mapLinear(s,this.y,this.oppositeY,0,1));return r&&this.emit(h,i,s,e,this),this.Ri&&!r?this.emit(Ti.LEFT,i,s,e,this):!this.Ri&&r&&this.emit(Ti.ENTERED,i,s,e,this),this.Ri=r,this.modeInternal!==C.INTERACTIVE_TRANSPARENT&&r}}const Bi=yt.BLEND;class Di extends Vi{constructor(t,i,s,e){var h,r;super(t,e),this.Bi=!1,this.Di=!1,this.micro=new Hi(null==e?void 0:e.micro),this.Li=null!==(h=null==e?void 0:e.transparencyMode)&&void 0!==h?h:Bi,this.sceneWrapper=this.layer.sceneWrapper,this.planeHandler=this.sceneWrapper.createPlane(i,s,(new o).identity(),H(null!==(r=null==e?void 0:e.mode)&&void 0!==r?r:this.mode),this.Li),this.layer.on(Wt.RENDERING,this.onWillRender,this)}get transparencyMode(){return this.Li}set transparencyMode(t){this.Li!==t&&(this.Li=t,this.Bi=!0)}set mode(t){this.modeInternal!==t&&(this.Di=H(this.modeInternal)!==H(t),super.mode=t)}destroy(){this.layer.off(Wt.RENDERING,this.onWillRender,this),this.sceneWrapper.destroyPlane(this.planeHandler),super.destroy()}setPlaneTransform(){(this.micro.dirty||this.inputWrapper.dirty||this.solverWrapper.dirty)&&(this.sceneWrapper.setTransform(this.planeHandler,((t,i,s,e,h,r,n,o,l,a,u,c,d)=>{const f=s*this.micro.scaleX,v=e*this.micro.scaleY,p=o*f,w=l*v,g=Math.cos(c),y=Math.sin(c),m=p*g-w*y,b=p*y+w*g;if(d===wi.POSITION_ROTATION_SCALE)mi.x=t+r-m,mi.y=i+n-b;else{const h=l*e;mi.x=t+o*s-m+r,mi.y=i+h-b+n}return mi.z=h,_i.x=f,_i.y=v,bi.setFromAxisAngle(Si,c),xi.compose(mi,bi,_i),xi})(this.x,this.y,this.width,this.height,this.zIndex,this.micro.x,this.micro.y,this.micro.anchorX,this.micro.anchorY,0,0,this.micro.rotation,this.micro.anchorMode)),this.micro.setDirtyFalse())}onWillRender(t,i){this.Bi&&(this.sceneWrapper.setTransparency(this.planeHandler,this.Li),this.Bi=!1),this.Di&&(this.sceneWrapper.setVisibility(this.planeHandler,H(this.modeInternal)),this.Di=!1),this.setPlaneTransform()}}var Li,ki;(t=>{t[t.PLAYED=0]="PLAYED",t[t.PAUSED=1]="PAUSED",t[t.STOPPED=2]="STOPPED"})(Li||(Li={})),(t=>{t[t.NONE=0]="NONE",t[t.LOOP=1]="LOOP",t[t.PING_PONG=2]="PING_PONG"})(ki||(ki={}));const Oi=ki.LOOP;class Wi extends Di{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r,n,o,l;const a=new st(e.color),u=i.map(t=>new Ci(t)),c=u[0];e.width=null!==(h=e.width)&&void 0!==h?h:c.width,e.height=null!==(r=e.height)&&void 0!==r?r:c.height;const d=c.calculateUVTransform();super(t,Pi,{texture:c.texture,textureTransform:d,color:a},e),this.ki=!1,this.Oi=0,this.Wi=!1,this.Ni=0,this.ji=(t,i,s)=>{this.zi[this.Oi]===s&&(this.width=t,this.height=i)},this.Fi=a,this.zi=u,this.Gi=d,this.$i=null!==(n=e.frameRate)&&void 0!==n?n:24,this.Yi=null!==(o=e.timeScale)&&void 0!==o?o:1,this.Xi=null!==(l=e.loopMode)&&void 0!==l?l:Oi,this.qi(),!0===e.playByDefault&&this.play()}get color(){return this.Fi}get duration(){return this.zi.length/this.$i}get frameRate(){return this.$i}get loopMode(){return this.Xi}get sequence(){return this.zi}get timeScale(){return this.Yi}set color(t){this.Fi.set(t)}set frameRate(t){this.$i=t}set loopMode(t){this.Xi=t}set sequence(t){this.stop(),this.Zi();const i=t.length,s=this.zi.length;for(let e=0;Math.min(i,s)>e;e++)this.zi[e].set(t[e]);if(s>i)this.zi.length=i;else if(i>s)for(let e=s;i>e;e++)this.zi.push(new Ci(t[e]));this.qi()}set timeScale(t){this.Yi=t}destroy(){this.Zi(),super.destroy()}play(){this.ki||(this.ki=!0,this.emit(Li.PLAYED))}pause(){this.ki&&(this.ki=!1,this.emit(Li.PAUSED))}stop(){(this.ki||this.Ni>0||this.Oi>0)&&(this.ki=!1,this.Ni=0,this.Oi=0,this.Wi=!0,this.emit(Li.STOPPED))}onWillRender(t,i){if(this.ki&&0!==this.Yi){this.Ni+=i*this.Yi;const t=1/this.$i,s=this.zi.length,e=s-1;if(this.Yi>0)for(;this.Ni>=t;){if(this.Ni-=t,this.Oi+=1,this.Oi>=s)if(this.Xi===ki.LOOP)this.Oi=0;else{if(this.Xi!==ki.PING_PONG){this.Oi=e,this.ki=!1,this.emit(Li.PAUSED);break}this.Oi=e,this.Yi=-this.Yi}this.Wi=!0}else for(;-t>=this.Ni;){if(this.Ni+=t,this.Oi-=1,0>this.Oi)if(this.Xi===ki.LOOP)this.Oi=e;else{if(this.Xi!==ki.PING_PONG){this.Oi=0,this.ki=!1,this.emit(Li.PAUSED);break}this.Oi=0,this.Yi=-this.Yi}this.Wi=!0}}super.onWillRender(t,i)}setPlaneTransform(){let t;this.Fi.dirty&&(null!=t||(t={}),t.color=this.Fi,this.Fi.setDirtyFalse());const i=this.zi[this.Oi];if((i.textureDirty||this.Wi)&&(null!=t||(t={}),t.texture=i.texture,i.setTextureDirtyFalse()),(i.uvTransformDirty||this.Wi)&&(null!=t||(t={}),t.textureTransform=i.calculateUVTransform(this.Gi),i.setUVTransformDirtyFalse()),t&&this.sceneWrapper.setProperties(this.planeHandler,t),this.Wi||this.micro.dirty||i.trimDirty||this.inputWrapper.dirty||this.solverWrapper.dirty){const t=this.micro,s=i.trim;this.sceneWrapper.setTransform(this.planeHandler,Ei(this.x,this.y,this.width,this.height,this.zIndex,t.x,t.y,t.anchorX,t.anchorY,t.scaleX,t.scaleY,t.rotation,t.anchorMode,s.left,s.right,s.top,s.bottom)),this.Wi=!1,this.micro.setDirtyFalse(),i.setTrimDirtyFalse()}}qi(){for(const t of this.zi)t.on(Mi.DIMENSIONS_CHANGED,this.ji)}Zi(){for(const t of this.zi)t.off(Mi.DIMENSIONS_CHANGED,this.ji)}}function Ni(t,i){if("undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,i);const s=document.createElement("canvas");return s.width=t,s.height=i,s}const ji=new st;class zi extends Di{constructor(t,i){var s,e;const h=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:2,r=null!==(e=null==i?void 0:i.height)&&void 0!==e?e:2,o=new st(null==i?void 0:i.color),l=Ni(h,r),a=l.getContext("2d");if(!a)throw Error("UIGraphics.constructor: failed to get 2D context from canvas");const u=new w(l);u.colorSpace=et?g:y,u.minFilter=m,u.magFilter=m,u.needsUpdate=!0,super(t,Pi,{texture:u,textureTransform:new n,color:o},i),this.Ji=l,this.Ki=a,this.Qi=u,this.Fi=o}get color(){return this.Fi}set color(t){this.Fi.set(t)}clear(t){return this.Ki.clearRect(0,0,this.Ji.width,this.Ji.height),void 0!==t&&(this.Ki.fillStyle=ji.set(t).toCSSColor(),this.Ki.fillRect(0,0,this.Ji.width,this.Ji.height)),this.Qi.needsUpdate=!0,this}drawRect(t,i,s,e,h){return this.Ki.fillStyle=ji.set(h).toCSSColor(),this.Ki.fillRect(t,i,s,e),this.Qi.needsUpdate=!0,this}drawCircle(t,i,s,e){return this.Ki.fillStyle=ji.set(e).toCSSColor(),this.Ki.beginPath(),this.Ki.arc(t,i,s,0,2*Math.PI),this.Ki.fill(),this.Qi.needsUpdate=!0,this}drawArc(t,i,s,e,h,r){return this.Ki.fillStyle=ji.set(r).toCSSColor(),this.Ki.beginPath(),this.Ki.arc(t,i,s,e,h),this.Ki.fill(),this.Qi.needsUpdate=!0,this}drawPolyline(t,i,s){let e=arguments.length>2&&void 0!==s?s:1;if(2>t.length)return this;this.Ki.strokeStyle=ji.set(i).toCSSColor(),this.Ki.lineWidth=e,this.Ki.beginPath(),this.Ki.moveTo(t[0][0],t[0][1]);for(let i=1;t.length>i;i++)this.Ki.lineTo(t[i][0],t[i][1]);return this.Ki.stroke(),this.Qi.needsUpdate=!0,this}destroy(){this.Qi.dispose(),super.destroy()}onWillRender(t,i){this.Fi.dirty&&(this.sceneWrapper.setProperties(this.planeHandler,{color:this.Fi}),this.Fi.setDirtyFalse()),super.onWillRender(t,i)}}class Fi extends Di{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r;const n=new st(e.color),o=new Ci(i),l=o.calculateUVTransform();e.width=null!==(h=e.width)&&void 0!==h?h:o.width,e.height=null!==(r=e.height)&&void 0!==r?r:o.height,super(t,Pi,{texture:o.texture,textureTransform:l,color:n},e),this.ji=(t,i)=>{this.width=t,this.height=i},this.texture=o,this.Gi=l,this.Fi=n,this.texture.on(Mi.DIMENSIONS_CHANGED,this.ji)}get color(){return this.Fi}set color(t){this.Fi.set(t)}destroy(){this.texture.off(Mi.DIMENSIONS_CHANGED,this.ji),super.destroy()}setPlaneTransform(){let t;if(this.Fi.dirty&&(null!=t||(t={}),t.color=this.Fi,this.Fi.setDirtyFalse()),this.texture.textureDirty&&(null!=t||(t={}),t.texture=this.texture.texture,this.texture.setTextureDirtyFalse()),this.texture.uvTransformDirty&&(null!=t||(t={}),t.textureTransform=this.texture.calculateUVTransform(this.Gi),this.texture.setUVTransformDirtyFalse()),t&&this.sceneWrapper.setProperties(this.planeHandler,t),this.micro.dirty||this.texture.trimDirty||this.inputWrapper.dirty||this.solverWrapper.dirty){const t=this.micro,i=this.texture.trim;this.sceneWrapper.setTransform(this.planeHandler,Ei(this.x,this.y,this.width,this.height,this.zIndex,t.x,t.y,t.anchorX,t.anchorY,t.scaleX,t.scaleY,t.rotation,t.anchorMode,i.left,i.right,i.top,i.bottom)),this.micro.setDirtyFalse(),this.texture.setTrimDirtyFalse()}}}class Gi{constructor(t){this.B=0,this.P=0,this.Qt=0,this.A=0,this.D=!1,this.set(t)}get left(){return this.B}get right(){return this.P}get top(){return this.Qt}get bottom(){return this.A}get dirty(){return this.D}set left(t){this.B!==t&&(this.B=t,this.D=!0)}set right(t){this.P!==t&&(this.P=t,this.D=!0)}set top(t){this.Qt!==t&&(this.Qt=t,this.D=!0)}set bottom(t){this.A!==t&&(this.A=t,this.D=!0)}setHorizontal(t){this.B===t&&this.P===t||(this.B=t,this.P=t,this.D=!0)}setVertical(t){this.Qt===t&&this.A===t||(this.Qt=t,this.A=t,this.D=!0)}setUnified(t){this.B===t&&this.P===t&&this.Qt===t&&this.A===t||(this.B=t,this.P=t,this.Qt=t,this.A=t,this.D=!0)}set(t){const i=this.B,s=this.P,e=this.Qt,h=this.A;if(void 0===t)this.B=0,this.P=0,this.Qt=0,this.A=0;else if("number"==typeof t)this.B=t,this.P=t,this.Qt=t,this.A=t;else if(Array.isArray(t))if(2===t.length){const i=t[0],s=t[1];this.B=i,this.P=i,this.Qt=s,this.A=s}else{const i=t[1],s=t[2],e=t[3];this.B=t[0],this.P=i,this.Qt=s,this.A=e}else if("left"in t){const i=t.right,s=t.top,e=t.bottom;this.B=t.left,this.P=i,this.Qt=s,this.A=e}else{const i=t.horizontal,s=t.vertical;this.B=i,this.P=i,this.Qt=s,this.A=s}this.B===i&&this.P===s&&this.Qt===e&&this.A===h||(this.D=!0)}setVector4(t){this.B===t.x&&this.P===t.y&&this.Qt===t.z&&this.A===t.w||(this.B=t.x,this.P=t.y,this.Qt=t.z,this.A=t.w,this.D=!0)}toVector4(t){return(arguments.length>0&&void 0!==t?t:new s).set(this.B,this.P,this.Qt,this.A)}reset(){this.setUnified(0)}copy(t){this.B===t.B&&this.P===t.P&&this.Qt===t.Qt&&this.A===t.A||(this.B=t.B,this.P=t.P,this.Qt=t.Qt,this.A=t.A,this.D=!0)}setDirtyFalse(){this.D=!1}}var $i;(t=>{t[t.NORMALIZED=0]="NORMALIZED",t[t.WORLD=1]="WORLD"})($i||($i={}));const Yi=$i.WORLD;class Xi extends Di{constructor(t,i,e){let h=arguments.length>2&&void 0!==e?e:{};var r,n,o,l,a;const u=new st(h.color),c=new Ci(i),d=c.calculateUVTransform();h.width=null!==(r=h.width)&&void 0!==r?r:c.width,h.height=null!==(n=h.height)&&void 0!==n?n:c.height;const f=new Gi(null!==(o=h.sliceBorders)&&void 0!==o?o:.1),v=new Gi(null!==(l=h.sliceRegions)&&void 0!==l?l:.1),p=null!==(a=h.regionMode)&&void 0!==a?a:Yi,w=new s,g=new s;super(t,"vec4 draw(){vec2 localUV=p_uv;float left=p_sliceBorders.x;float right=p_sliceBorders.y;float top=p_sliceBorders.z;float bottom=p_sliceBorders.w;float leftFill=p_sliceRegions.x;float rightFill=p_sliceRegions.y;float topFill=p_sliceRegions.z;float bottomFill=p_sliceRegions.w;float lB=leftFill;float rB=1.0-rightFill;float bB=bottomFill;float tB=1.0-topFill;{float regionL=step(p_uv.x,lB);float regionR=step(rB,p_uv.x);float regionM=1.0-regionL-regionR;float xL=(p_uv.x/lB)*left;float xR=1.0-right+((p_uv.x-rB)/rightFill)*right;float xM=left+((p_uv.x-lB)/(rB-lB))*(1.0-left-right);localUV.x=regionL*xL+regionM*xM+regionR*xR;}{float regionB=step(p_uv.y,bB);float regionT=step(tB,p_uv.y);float regionC=1.0-regionB-regionT;float yB=(p_uv.y/bB)*bottom;float yT=1.0-top+((p_uv.y-tB)/topFill)*top;float yC=bottom+((p_uv.y-bB)/(tB-bB))*(1.0-bottom-top);localUV.y=regionB*yB+regionC*yC+regionT*yT;}vec2 transformedUV=(p_textureTransform*vec3(localUV,1.0)).xy;return srgbTexture2D(p_texture,transformedUV)*p_color;}",{texture:c.texture,textureTransform:d,color:u,sliceBorders:w,sliceRegions:g},h),this.ts=!0,this.ss=new s,this.es=new s,this.hs=!0,this.ji=()=>{this.hs=!0},this.texture=c,this.Gi=d,this.Fi=u,this.rs=f,this.ns=v,this.ls=p,this.ss=w,this.es=g,this.us=this.width,this.cs=this.height,this.texture.on(Mi.DIMENSIONS_CHANGED,this.ji)}get color(){return this.Fi}get regionMode(){return this.ls}get sliceBorders(){return this.rs}get sliceRegions(){return this.ns}set color(t){this.Fi.set(t)}set regionMode(t){this.ls!==t&&(this.ls=t,this.ts=!0)}set sliceBorders(t){this.rs.set(t)}set sliceRegions(t){this.ns.set(t)}destroy(){this.texture.off(Mi.DIMENSIONS_CHANGED,this.ji),super.destroy()}setPlaneTransform(){let t;if((this.hs||this.rs.dirty||this.texture.trimDirty)&&(null!=t||(t={}),t.sliceBorders=this.ds(this.ss),this.rs.setDirtyFalse(),this.hs=!1),(this.ns.dirty||this.ts||this.ls===$i.WORLD&&this.fs())&&(null!=t||(t={}),t.sliceRegions=this.vs(this.es),this.ns.setDirtyFalse(),this.ts=!1,this.ps()),this.Fi.dirty&&(null!=t||(t={}),t.color=this.Fi,this.Fi.setDirtyFalse()),this.texture.textureDirty&&(null!=t||(t={}),t.texture=this.texture.texture,this.texture.setTextureDirtyFalse()),this.texture.uvTransformDirty&&(null!=t||(t={}),t.textureTransform=this.texture.calculateUVTransform(this.Gi),this.texture.setUVTransformDirtyFalse()),t&&this.sceneWrapper.setProperties(this.planeHandler,t),this.micro.dirty||this.texture.trimDirty||this.inputWrapper.dirty||this.solverWrapper.dirty){const t=this.micro,i=this.texture.trim;this.sceneWrapper.setTransform(this.planeHandler,Ei(this.x,this.y,this.width,this.height,this.zIndex,t.x,t.y,t.anchorX,t.anchorY,t.scaleX,t.scaleY,t.rotation,t.anchorMode,i.left,i.right,i.top,i.bottom)),this.micro.setDirtyFalse(),this.texture.setTrimDirtyFalse()}}ds(t){const i=this.texture.width,s=this.texture.height,e=this.texture.trim,h=e.right/i,r=e.top/s,n=e.bottom/s,o=(i-e.left-e.right)/i,l=(s-e.top-e.bottom)/s,a=this.rs.right,u=this.rs.top,c=this.rs.bottom,d=Math.max(0,this.rs.left-e.left/i)/o,f=Math.max(0,a-h)/o,v=Math.max(0,u-r)/l,p=Math.max(0,c-n)/l;return t.set(Math.min(1,d),Math.min(1,f),Math.min(1,v),Math.min(1,p))}vs(t){if(this.ls===$i.NORMALIZED)return t.set(this.ns.left,this.ns.right,this.ns.top,this.ns.bottom);const i=this.width,s=this.height;return t.set(this.ns.left/i,this.ns.right/i,this.ns.top/s,this.ns.bottom/s)}fs(){return this.solverWrapper.dirty&&(this.us!==Math.round(this.width)||this.cs!==Math.round(this.height))}ps(){this.us=Math.round(this.width),this.cs=Math.round(this.height)}}class qi{constructor(t){this.source=t,this.dirtyInternal=!1}get dirty(){return this.dirtyInternal}setDirtyFalse(){this.dirtyInternal=!1}}class Zi extends qi{constructor(t){let i=arguments.length>0&&void 0!==t?t:{x:1,y:0};super("float calculateMask(){float aspect=p_textureResolution.x/p_textureResolution.y;vec2 halfExtents=vec2(aspect,1.0)*0.5;float maxProjection=dot(halfExtents,abs(p_direction));vec2 correctedUV=(p_uv-0.5)*vec2(aspect,1.0);float projection=dot(correctedUV,p_direction);float offset=(projection/maxProjection+1.0)*0.5;return step(offset,p_progress);}"),this.direction=new h,this.ws=new h,this.direction.copy(i).normalize(),this.ws.copy(this.direction)}get dirty(){return this.gs(),this.dirtyInternal||!this.ws.equals(this.direction)}setDirtyFalse(){this.gs(),this.ws.copy(this.direction),super.setDirtyFalse()}enumerateProperties(){return this.gs(),{direction:this.direction}}gs(){const t=this.direction.lengthSq();Math.abs(t)>Yt?Math.abs(t-1)>Yt&&this.direction.divideScalar(t):this.direction.set(1,0)}}var Ji,Ki="vec4 draw(){vec2 transformedUV=(p_textureTransform*vec3(p_uv,1.0)).xy;vec4 diffuseColor=srgbTexture2D(p_texture,transformedUV)*p_color;diffuseColor.a*=calculateMask();return diffuseColor;}";class Qi extends Di{constructor(i,s,e){let h=arguments.length>2&&void 0!==e?e:{};var r,n,o,l;const a=new st(h.color),u=new Ci(s),c=u.calculateUVTransform(),d=u.getResolution();h.width=null!==(r=h.width)&&void 0!==r?r:u.width,h.height=null!==(n=h.height)&&void 0!==n?n:u.height;const f=t.clamp(null!==(o=h.progress)&&void 0!==o?o:1,0,1),v=null!==(l=h.maskFunction)&&void 0!==l?l:new Zi;super(i,v.source+Ki,Object.assign({texture:u.texture,textureTransform:c,textureResolution:d,color:a,progress:f},v.enumerateProperties()),h),this.ys=!1,this.bs=!1,this.ji=(t,i)=>{this.width===t&&this.height===i||(this.width=t,this.height=i,this.bs=!0)},this.texture=u,this.Gi=c,this._s=d,this.Fi=a,this.xs=f,this.Ss=v,this.texture.on(Mi.DIMENSIONS_CHANGED,this.ji)}get color(){return this.Fi}get maskFunction(){return this.Ss}get progress(){return this.xs}set color(t){this.Fi.set(t)}set maskFunction(t){this.Ss!==t&&(this.Ss=t,this.Es())}set progress(i){i=t.clamp(i,0,1),this.xs!==i&&(this.xs=i,this.ys=!0)}setPlaneTransform(){let t;if(this.Fi.dirty&&(null!=t||(t={}),t.color=this.Fi,this.Fi.setDirtyFalse()),this.texture.textureDirty&&(null!=t||(t={}),t.texture=this.texture.texture,this.texture.setTextureDirtyFalse()),this.texture.uvTransformDirty&&(null!=t||(t={}),t.textureTransform=this.texture.calculateUVTransform(this.Gi),this.texture.setUVTransformDirtyFalse()),this.ys&&(null!=t||(t={}),t.progress=this.xs,this.ys=!1),this.bs&&(null!=t||(t={}),t.textureResolution=this.texture.getResolution(this._s),this.bs=!1),this.maskFunction.dirty){null!=t||(t={});const i=this.maskFunction.enumerateProperties();for(const s in i)t[s]=i[s];this.maskFunction.setDirtyFalse()}if(t&&this.sceneWrapper.setProperties(this.planeHandler,t),this.micro.dirty||this.texture.trimDirty||this.inputWrapper.dirty||this.solverWrapper.dirty){const t=this.micro,i=this.texture.trim;this.sceneWrapper.setTransform(this.planeHandler,Ei(this.x,this.y,this.width,this.height,this.zIndex,t.x,t.y,t.anchorX,t.anchorY,t.scaleX,t.scaleY,t.rotation,t.anchorMode,i.left,i.right,i.top,i.bottom)),this.micro.setDirtyFalse(),this.texture.setTrimDirtyFalse()}}Es(){this.sceneWrapper.destroyPlane(this.planeHandler);const t=this.micro,i=this.texture.trim;this.planeHandler=this.sceneWrapper.createPlane(this.Ss.source+Ki,Object.assign({texture:this.texture.texture,textureTransform:this.texture.calculateUVTransform(this.Gi),textureResolution:this.texture.getResolution(this._s),color:this.Fi,progress:this.xs},this.Ss.enumerateProperties()),Ei(this.x,this.y,this.width,this.height,this.zIndex,t.x,t.y,t.anchorX,t.anchorY,t.scaleX,t.scaleY,t.rotation,t.anchorMode,i.left,i.right,i.top,i.bottom),H(this.mode),this.transparencyMode),this.Fi.setDirtyFalse(),this.texture.setTextureDirtyFalse(),this.texture.setUVTransformDirtyFalse(),this.texture.setTrimDirtyFalse(),this.ys=!1,this.bs=!1,this.Ss.setDirtyFalse(),this.micro.setDirtyFalse()}}(t=>{t[t.EVERY_FRAME=1]="EVERY_FRAME",t[t.EVERY_SECOND_FRAME=2]="EVERY_SECOND_FRAME",t[t.ON_PROPERTIES_CHANGE=3]="ON_PROPERTIES_CHANGE",t[t.ON_DIMENSIONS_CHANGE=4]="ON_DIMENSIONS_CHANGE",t[t.MANUAL=5]="MANUAL"})(Ji||(Ji={}));const ts=Ji.ON_PROPERTIES_CHANGE,is=new st(0,0,0,1);class ss extends Di{constructor(i,s){let e=arguments.length>1&&void 0!==s?s:{};var h,r,o,l,a,u,c,d;const v=t.clamp(null!==(h=e.resolutionFactor)&&void 0!==h?h:.5,.1,2),p=null!==(r=e.width)&&void 0!==r?r:64,w=null!==(o=e.height)&&void 0!==o?o:32,g=new b(p*v,w*v,{format:x,minFilter:m,magFilter:m,type:_,depthBuffer:null===(l=e.enableDepthBuffer)||void 0===l||l,stencilBuffer:!1}),y=new st(e.color);super(i,Pi,{texture:g.texture,textureTransform:new n,color:y},e),this.Is=!0,this.Ms=!1,this.Cs=!1,this.Ts=!1,this.Fi=y,this.Ps=new st(null!==(a=e.clearColor)&&void 0!==a?a:is),this.Hs=g,this.As=null!==(u=e.scene)&&void 0!==u?u:new f,this.Us=null!==(c=e.camera)&&void 0!==c?c:new S(60,p/w,.1,100),this.Rs=v,this.Vs=null!==(d=e.updateMode)&&void 0!==d?d:ts,this.Ts=e.updateMode!==Ji.MANUAL}get camera(){return this.Us}get clearColor(){return this.Ps}get color(){return this.Fi}get resolutionFactor(){return this.Rs}get scene(){return this.As}get updateMode(){return this.Vs}set camera(t){this.Us!==t&&(this.Us=t,this.Ts=!0)}set clearColor(t){this.Ps.set(t)}set color(t){this.Fi.set(t)}set resolutionFactor(i){i=t.clamp(i,.1,2),this.Rs!==i&&(this.Rs=i,this.Cs=!0)}set scene(t){this.As!==t&&(this.As=t,this.Ts=!0)}set updateMode(t){this.Vs!==t&&(this.Vs=t,this.Ts=!0)}destroy(){this.Hs.dispose(),super.destroy()}requestUpdate(){this.Ms=!0}onWillRender(t,i){this.Is=!this.Is,(this.Ms||this.Vs===Ji.EVERY_FRAME||this.Vs===Ji.EVERY_SECOND_FRAME&&this.Is||this.Vs===Ji.ON_PROPERTIES_CHANGE&&this.Ts||this.Fi.dirty||this.Ps.dirty||this.Vs===Ji.ON_DIMENSIONS_CHANGE&&(this.Cs||this.solverWrapper.dirty))&&((this.Cs||this.solverWrapper.dirty)&&(this.Hs.setSize(this.width*this.Rs,this.height*this.Rs),this.Cs=!1),this.Fi.dirty&&(this.sceneWrapper.setProperties(this.planeHandler,{color:this.Fi}),this.Fi.setDirtyFalse()),t.setClearColor(this.Ps.getHexRGB(),this.Ps.a),t.setRenderTarget(this.Hs),t.clear(!0,!0,!1),t.render(this.As,this.Us),this.Ts=!1,this.Ms=!1),super.onWillRender(t,i)}}const es="#000000",hs="left",rs="Arial",ns="normal",os="normal",ls=!1,as="transparent",us=!1,cs="#000000";class ds{constructor(t){this.D=!0,this.Fi=null==t?void 0:t.color,this.Bs=null==t?void 0:t.align,this.Ds=null==t?void 0:t.fontFamily,this.Ls=null==t?void 0:t.fontSize,this.ks=null==t?void 0:t.fontStyle,this.Os=null==t?void 0:t.fontWeight,this.Ws=null==t?void 0:t.lineHeight,this.Ns=null==t?void 0:t.enableShadow,this.js=null==t?void 0:t.shadowOffsetX,this.zs=null==t?void 0:t.shadowOffsetY,this.Fs=null==t?void 0:t.shadowBlur,this.Gs=null==t?void 0:t.shadowColor,this.$s=null==t?void 0:t.enableStroke,this.Ys=null==t?void 0:t.strokeColor,this.Xs=null==t?void 0:t.strokeThickness}get color(){return this.Fi}get align(){return this.Bs}get fontFamily(){return this.Ds}get fontSize(){return this.Ls}get fontStyle(){return this.ks}get fontWeight(){return this.Os}get lineHeight(){return this.Ws}get enableShadow(){return this.Ns}get shadowOffsetX(){return this.js}get shadowOffsetY(){return this.zs}get shadowBlur(){return this.Fs}get shadowColor(){return this.Gs}get enableStroke(){return this.$s}get strokeColor(){return this.Ys}get strokeThickness(){return this.Xs}get dirty(){return this.D}set color(t){t!==this.Fi&&(this.Fi=t,this.D=!0)}set align(t){t!==this.Bs&&(this.Bs=t,this.D=!0)}set fontFamily(t){t!==this.Ds&&(this.Ds=t,this.D=!0)}set fontSize(t){t!==this.Ls&&(this.Ls=t,this.D=!0)}set fontStyle(t){t!==this.ks&&(this.ks=t,this.D=!0)}set fontWeight(t){t!==this.Os&&(this.Os=t,this.D=!0)}set lineHeight(t){t!==this.Ws&&(this.Ws=t,this.D=!0)}set enableShadow(t){t!==this.Ns&&(this.Ns=t,this.D=!0)}set shadowOffsetX(t){t!==this.js&&(this.js=t,this.D=!0)}set shadowOffsetY(t){t!==this.zs&&(this.zs=t,this.D=!0)}set shadowBlur(t){t!==this.Fs&&(this.Fs=t,this.D=!0)}set shadowColor(t){t!==this.Gs&&(this.Gs=t,this.D=!0)}set enableStroke(t){t!==this.$s&&(this.$s=t,this.D=!0)}set strokeColor(t){t!==this.Ys&&(this.Ys=t,this.D=!0)}set strokeThickness(t){t!==this.Xs&&(this.Xs=t,this.D=!0)}static resolve(t,i){var s,e,h,r,n,o,l,a,u,c,d,f,v,p,w,g,y,m,b,_,x,S,E,I,M,C,T,P,H,A;const U=null!==(e=null!==(s=t.Ls)&&void 0!==s?s:i.Ls)&&void 0!==e?e:16;return{color:null!==(r=null!==(h=t.Fi)&&void 0!==h?h:i.Fi)&&void 0!==r?r:es,align:null!==(o=null!==(n=t.Bs)&&void 0!==n?n:i.Bs)&&void 0!==o?o:hs,fontFamily:null!==(a=null!==(l=t.Ds)&&void 0!==l?l:i.Ds)&&void 0!==a?a:rs,fontSize:U,fontStyle:null!==(c=null!==(u=t.ks)&&void 0!==u?u:i.ks)&&void 0!==c?c:ns,fontWeight:null!==(f=null!==(d=t.Os)&&void 0!==d?d:i.Os)&&void 0!==f?f:os,lineHeight:null!==(p=null!==(v=t.Ws)&&void 0!==v?v:i.Ws)&&void 0!==p?p:1.2*U,enableShadow:null!==(g=null!==(w=t.Ns)&&void 0!==w?w:i.Ns)&&void 0!==g?g:ls,shadowOffsetX:null!==(m=null!==(y=t.js)&&void 0!==y?y:i.js)&&void 0!==m?m:0,shadowOffsetY:null!==(_=null!==(b=t.zs)&&void 0!==b?b:i.zs)&&void 0!==_?_:0,shadowBlur:null!==(S=null!==(x=t.Fs)&&void 0!==x?x:i.Fs)&&void 0!==S?S:0,shadowColor:null!==(I=null!==(E=t.Gs)&&void 0!==E?E:i.Gs)&&void 0!==I?I:as,enableStroke:null!==(C=null!==(M=t.$s)&&void 0!==M?M:i.$s)&&void 0!==C?C:us,strokeColor:null!==(P=null!==(T=t.Ys)&&void 0!==T?T:i.Ys)&&void 0!==P?P:cs,strokeThickness:null!==(A=null!==(H=t.Xs)&&void 0!==H?H:i.Xs)&&void 0!==A?A:0}}setDirtyFalse(){this.D=!1}setDefaults(){this.Fi===es&&this.Bs===hs&&this.Ds===rs&&16===this.Ls&&this.ks===ns&&this.Os===os&&19.2===this.Ws&&this.Ns===ls&&0===this.js&&0===this.zs&&0===this.Fs&&this.Gs===as&&this.$s===us&&this.Ys===cs&&0===this.Xs||(this.Fi=es,this.Bs=hs,this.Ds=rs,this.Ls=16,this.ks=ns,this.Os=os,this.Ws=19.2,this.Ns=ls,this.js=0,this.zs=0,this.Fs=0,this.Gs=as,this.$s=us,this.Ys=cs,this.Xs=0,this.D=!0)}clear(){void 0===this.Fi&&void 0===this.Bs&&void 0===this.Ds&&void 0===this.Ls&&void 0===this.ks&&void 0===this.Os&&void 0===this.Ws&&void 0===this.Ns&&void 0===this.js&&void 0===this.zs&&void 0===this.Fs&&void 0===this.Gs&&void 0===this.$s&&void 0===this.Ys&&void 0===this.Xs||(this.Fi=void 0,this.Bs=void 0,this.Ds=void 0,this.Ls=void 0,this.ks=void 0,this.Os=void 0,this.Ws=void 0,this.Ns=void 0,this.js=void 0,this.zs=void 0,this.Fs=void 0,this.Gs=void 0,this.$s=void 0,this.Ys=void 0,this.Xs=void 0,this.D=!0)}copy(t){this.Fi===t.Fi&&this.Bs===t.Bs&&this.Ds===t.Ds&&this.Ls===t.Ls&&this.ks===t.ks&&this.Os===t.Os&&this.Ws===t.Ws&&this.Ns===t.Ns&&this.js===t.js&&this.zs===t.zs&&this.Fs===t.Fs&&this.Gs===t.Gs&&this.$s===t.$s&&this.Ys===t.Ys&&this.Xs===t.Xs||(this.Fi=t.Fi,this.Bs=t.Bs,this.Ds=t.Ds,this.Ls=t.Ls,this.ks=t.ks,this.Os=t.Os,this.Ws=t.Ws,this.Ns=t.Ns,this.js=t.js,this.zs=t.zs,this.Fs=t.Fs,this.Gs=t.Gs,this.$s=t.$s,this.Ys=t.Ys,this.Xs=t.Xs,this.D=!0)}calculatePadding(){var t,i,s,e;let h=0;if(void 0!==this.$s&&(h+=null!==(t=this.Xs)&&void 0!==t?t:0),void 0!==this.Ns){const t=null!==(i=this.Fs)&&void 0!==i?i:0,r=null!==(s=this.js)&&void 0!==s?s:0,n=null!==(e=this.zs)&&void 0!==e?e:0,o=2*t;h+=Math.max(Math.abs(r)+o,Math.abs(n)+o)}return Math.ceil(h)}}class fs{constructor(t){this.D=!0,this.qs=t.text,this.style=new ds(t.style)}get text(){return this.qs}get dirty(){return this.D||this.style.dirty}set text(t){t!==this.qs&&(this.qs=t,this.D=!0)}setDirtyFalse(){this.D=!1,this.style.setDirtyFalse()}}var vs;(t=>{t[t.BREAK=0]="BREAK",t[t.SCALE=1]="SCALE"})(vs||(vs={}));const ps=vs.SCALE;function ws(t){var i;return null!==(i=t.match(/\S+|\s|\n/g))&&void 0!==i?i:[]}function gs(t,i,s){if(t.font=`${s.fontStyle} ${s.fontWeight} ${s.fontSize}px "${s.fontFamily}"`,"\n"===i)return{width:1,height:s.lineHeight,baseline:0,lineHeight:s.lineHeight};const e=t.measureText(i);return{width:Math.ceil(e.width),height:Math.ceil(e.actualBoundingBoxAscent+e.actualBoundingBoxDescent),baseline:e.actualBoundingBoxDescent,lineHeight:s.lineHeight}}function ys(t,i){const s=((t,i)=>{const s=[];let e=[],h=0,r=0,n=0,o=0;for(const l of i)"\n"!==l.text?0!==e.length&&h+l.metrics.width>t?(s.push({chunks:e,width:h,height:r,baseline:n,lineHeight:o}),e=[l],h=l.metrics.width,r=l.metrics.height,n=l.metrics.baseline,o=l.metrics.lineHeight):(e.push(l),h+=l.metrics.width,r=Math.max(r,l.metrics.height),n=Math.max(n,l.metrics.baseline),o=Math.max(o,l.metrics.lineHeight)):(e.length>0&&s.push({chunks:e,width:h,height:r,baseline:n,lineHeight:o}),e=[],h=0,r=0,n=0,o=0);return e.length>0&&s.push({chunks:e,width:h,height:r,baseline:n,lineHeight:o}),s})(i,t),e=(t=>{if(0===t.length)return{width:0,height:0};const i=Math.max(...t.map(t=>t.width));let s=0;for(let i=0;t.length>i;i++){const e=t[i];s+=0===i?e.height:e.lineHeight}return{width:i,height:s}})(s);return{lines:s,size:e}}function ms(t,i,s,e,h){h.font=`${e.fontStyle} ${e.fontWeight} ${e.fontSize}px "${e.fontFamily}"`,e.enableShadow&&(h.shadowOffsetX=e.shadowOffsetX,h.shadowOffsetY=e.shadowOffsetY,h.shadowBlur=e.shadowBlur,h.shadowColor=e.shadowColor),e.enableStroke&&(h.strokeStyle=e.strokeColor,h.lineWidth=e.strokeThickness,h.strokeText(s,t,i)),h.fillStyle=e.color,h.fillText(s,t,i)}function bs(t,i,s,e){var h,r;let n=t,o=0;for(const t of s)o=Math.max(t.width,o);for(let t=0;s.length>t;t++){const l=s[t],a=null!==(r=null===(h=l.chunks[0])||void 0===h?void 0:h.style.align)&&void 0!==r?r:hs,u=l.chunks.every(t=>t.style.align===a)?a:hs;let c=0;"center"===u?c=(o-l.width)/2:"right"===u&&(c=o-l.width);let d=i+c;n+=0===t?l.height:l.lineHeight;for(const t of l.chunks)ms(d,n,t.text,t.style,e),d+=t.metrics.width}}class _s extends Di{constructor(t,i,s){let e=arguments.length>2&&void 0!==s?s:{};var h,r;const o=Ni(2,2),l=o.getContext("2d");if(!l)throw Error("UIText.constructor: failed to create canvas context");const a=new w(o);a.colorSpace=et?g:y,a.needsUpdate=!0;const u=new st(e.color);switch(super(t,Pi,{texture:a,textureTransform:new n,color:u}),this.Zs=[],this.Js=!1,this.Ks=!1,this.Qs=!1,this.te=[],this.ie=!1,this.Fi=u,this.se=new Gi(e.padding),this.commonStyle=new ds(e.commonStyle),this.ee=null!==(h=e.maxLineWidth)&&void 0!==h?h:1024,this.he=null!==(r=e.resizeMode)&&void 0!==r?r:ps,this.Ji=o,this.Ki=l,this.Qi=a,this.content=i,this.re=this.width,this.ne=this.height,void 0===e.padding&&this.se.setUnified(this.content.reduce((t,i)=>Math.max(t,i.style.calculatePadding()),this.commonStyle.calculatePadding())),this.he){case vs.SCALE:this.oe();break;case vs.BREAK:this.le()}}get color(){return this.Fi}get content(){return this.Zs}get maxLineWidth(){return this.ee}get padding(){return this.se}get resizeMode(){return this.he}set color(t){this.Fi.set(t)}set content(t){this.Zs!==t&&(this.Zs="string"==typeof t?[new fs({text:t,style:new ds})]:Array.isArray(t)?t.map(t=>new fs("string"==typeof t?{text:t,style:new ds}:{text:t.text,style:new ds(t.style)})):[new fs({text:t.text,style:new ds(t.style)})],this.Js=!0,this.ie=!0)}set maxLineWidth(t){this.ee!==t&&(this.ee=t,this.Ks=!0)}set padding(t){this.se.set(t)}set resizeMode(t){this.he!==t&&(this.he=t,this.Qs=!0)}destroy(){this.Qi.dispose(),super.destroy()}onWillRender(t,i){switch(this.he){case vs.SCALE:this.oe();break;case vs.BREAK:this.le()}super.onWillRender(t,i)}oe(){if(!(this.Fi.dirty||this.Qs||this.Ks||this.se.dirty||this.solverWrapper.dirty&&this.re/this.ne!==Math.round(this.width)/Math.round(this.height)||this.ae()))return;const t=this.ue(),{lines:i,size:s}=ys(t,this.ee),e=s.height+(this.se.top+this.se.bottom),h=s.width+(this.se.left+this.se.right);this.width=h,this.height=e/h*Math.round(this.width),this.width=h/e*Math.round(this.height);const r=this.re!==e||this.ne!==h;r&&(this.Ji.height=e,this.Ji.width=h),bs(this.se.top,this.se.left,i,this.Ki),this.ce(r),this.Qs=!1,this.Ks=!1,this.se.setDirtyFalse(),this.de(),this.fe()}le(){if(!(this.Fi.dirty||this.Qs||this.Ks||this.se.dirty||this.ve()||this.ae()))return;const t=this.ue(),{size:i}=ys(t,this.ee),s=this.se.top+this.se.bottom,e=this.se.left+this.se.right;this.height=i.height+s,this.width=i.width+e;const{lines:h,size:r}=ys(t,Math.round(this.width)-e);this.height=r.height+s,this.width=r.width+e;const n=Math.max(Math.round(this.width),2),o=Math.max(Math.round(this.height),2),l=this.re!==n||this.ne!==o;l&&(this.Ji.width=n,this.Ji.height=o),bs(this.se.top,this.se.left,h,this.Ki),this.ce(l),this.Qs=!1,this.Ks=!1,this.se.setDirtyFalse(),this.de(),this.fe()}ce(t){let i;this.Fi.dirty&&(null!=i||(i={}),i.color=this.Fi,this.Fi.setDirtyFalse()),t&&(this.Qi.dispose(),this.Qi=new w(this.Ji),this.Qi.colorSpace=et?g:y,this.Qi.needsUpdate=!0,null!=i||(i={}),i.texture=this.Qi),i&&this.sceneWrapper.setProperties(this.planeHandler,i)}ue(){return this.ie&&(this.te=((t,i,s)=>{const e=[];for(const h of i){const i=ds.resolve(h.style,s);for(const s of ws(h.text)){const h=gs(t,s,i);e.push({text:s,style:i,metrics:h})}}return e})(this.Ki,this.Zs,this.commonStyle),this.ie=!1),this.te}ve(){return this.solverWrapper.dirty&&(this.re!==Math.round(this.width)||this.ne!==Math.round(this.height))}de(){this.re=Math.round(this.width),this.ne=Math.round(this.height)}ae(){return this.Js||this.content.some(t=>t.dirty)}fe(){this.Js=!1;for(const t of this.content)t.setDirtyFalse()}}class xs{constructor(){this.dirty=!1}}class Ss extends xs{calculateScale(t,i){return 1}}const Es=new Ss;class Is extends zt{constructor(t){var i;const s=null!==(i=null==t?void 0:t.resizePolicy)&&void 0!==i?i:Es,e=s.calculateScale(window.innerWidth,window.innerHeight);super(Object.assign({width:window.innerWidth*e,height:window.innerHeight*e},t)),this.pe=!1,this.we=()=>{const t=this.resizePolicy.calculateScale(window.innerWidth,window.innerHeight);this.resizePolicy.dirty=!1,this.pe=!1,this.resizeInternal(window.innerWidth*t,window.innerHeight*t)},this.ge=t=>{this.ye(t,"onPointerDown",Ti.PRESSED)},this.me=t=>{this.ye(t,"onPointerMove",Ti.MOVED)},this.be=t=>{this.ye(t,"onPointerUp",Ti.RELEASED)},this._e=s,window.addEventListener("resize",this.we),window.addEventListener("pointerdown",this.ge),window.addEventListener("pointermove",this.me),window.addEventListener("pointerup",this.be)}get resizePolicy(){return this._e}set resizePolicy(t){this._e!==t&&(this._e=t,this.pe=!0)}destroy(){window.removeEventListener("resize",this.we),window.removeEventListener("pointerdown",this.ge),window.removeEventListener("pointermove",this.me),window.removeEventListener("pointerup",this.be)}render(t,i){(this.resizePolicy.dirty||this.pe)&&this.we(),super.renderInternal(t,i)}projectWorldPosition(i,s,e){let h=arguments.length>2&&void 0!==e?e:new r;return h.copy(i).project(s),h.x=t.mapLinear(h.x,-1,1,this.x,this.width),h.y=t.mapLinear(h.y,-1,1,this.y,this.height),h}projectLayerPosition(i,s,e,h){let n=arguments.length>2&&void 0!==e?e:-1;return(arguments.length>3&&void 0!==h?h:new r).set(t.mapLinear(i.x,this.x,this.width,-1,1),t.mapLinear(i.y,this.y,this.height,-1,1),n).unproject(s)}buildRay(i,s,e){let h=arguments.length>2&&void 0!==e?e:new E;const n=new r(t.mapLinear(i.x,this.x,this.width,-1,1),t.mapLinear(i.y,this.y,this.height,-1,1),-1).unproject(s),o=new r(t.mapLinear(i.x,this.x,this.width,-1,1),t.mapLinear(i.y,this.y,this.height,-1,1),1).unproject(s).sub(n).normalize();return h.set(n,o)}ye(t,i,s){const e=t.target instanceof HTMLElement?t.target.getBoundingClientRect():null,h=e?t.clientX-e.left:t.clientX,r=e?e.bottom-t.clientY:window.innerHeight-t.clientY,n=this.resizePolicy.calculateScale(window.innerWidth,window.innerHeight),o=h*n,l=r*n;P(this.mode)&&(this.emit(s,o,l,t.pointerId),this.inputWrapperInternal[i](o,l,t.pointerId))}}class Ms extends Ai{constructor(t,i,s){super(),this.centerX=t,this.centerY=i,this.radius=s}contains(t,i){const s=t-this.centerX,e=i-this.centerY;return this.radius*this.radius>=s*s+e*e}}class Cs extends Ai{constructor(t){super(),this.vertices=t}contains(t,i){const s=this.vertices.length;if(3>s)return!1;let e=!1;for(let h=0,r=s-1;s>h;r=h++){const s=this.vertices[h],n=this.vertices[r],o=s.x,l=s.y,a=n.y;l>i!=a>i&&(n.x-o)*(i-l)/(a-l)+o>t&&(e=!e)}return e}}class Ts extends Ai{constructor(t,i,s,e,h){super(),this.x=t,this.y=i,this.width=s,this.height=e,this.radius=h,this.radius=Math.min(h,Math.min(s,e)/2)}contains(t,i){const s=this.x,e=this.x+this.width,h=this.y,r=this.y+this.height;if(s>t||t>e||h>i||i>r)return!1;const n=s+this.radius,o=e-this.radius,l=h+this.radius,a=r-this.radius;if(t>=n&&o>=t)return!0;if(i>=l&&a>=i)return!0;let u,c;u=n>t?n:o,c=l>i?l:a;const d=t-u,f=i-c;return this.radius*this.radius>=d*d+f*f}}class Ps extends qi{constructor(t,i){let s=arguments.length>0&&void 0!==t?t:0,e=arguments.length>1&&void 0!==i&&i;super("float calculateMask(){float aspect=p_textureResolution.x/p_textureResolution.y;vec2 p=(p_uv-0.5)*vec2(aspect,1.0);float angle=atan(p.y,p.x);angle=(angle+PI)/(2.0*PI);float adjusted=angle-p_startAngle;adjusted=p_direction>0.0 ? adjusted :-adjusted;adjusted=fract(adjusted);return step(adjusted,p_progress);}"),this.xe=s,this.Se=e}get startAngle(){return this.xe}get inverseDirection(){return this.Se}set startAngle(t){this.xe!==t&&(this.xe=t,this.dirtyInternal=!0)}set inverseDirection(t){this.Se!==t&&(this.Se=t,this.dirtyInternal=!0)}enumerateProperties(){return{direction:this.Se?-1:1,startAngle:this.xe}}}class Hs extends xs{constructor(t,i){super(),this.Ee=t,this.Ie=i}get rectWidth(){return this.Ee}get rectHeight(){return this.Ie}set rectWidth(t){t!==this.Ee&&(this.Ee=t,this.dirty=!0)}set rectHeight(t){t!==this.Ie&&(this.Ie=t,this.dirty=!0)}calculateScale(t,i){return Math.min(this.Ee/t,this.Ie/i)}}class As extends xs{constructor(t,i){super(),this.Me=t,this.Ce=i}get fixedWidthLandscape(){return this.Me}get fixedHeightPortrait(){return this.Ce}set fixedWidthLandscape(t){t!==this.Me&&(this.Me=t,this.dirty=!0)}set fixedHeightPortrait(t){t!==this.Ce&&(this.Ce=t,this.dirty=!0)}calculateScale(t,i){return t>i?this.Me/t:this.Ce/i}}class Us extends xs{constructor(t,i){super(),this.Te=t,this.Pe=i}get fixedHeightLandscape(){return this.Te}get fixedWidthPortrait(){return this.Pe}set fixedHeightLandscape(t){t!==this.Te&&(this.Te=t,this.dirty=!0)}set fixedWidthPortrait(t){t!==this.Pe&&(this.Pe=t,this.dirty=!0)}calculateScale(t,i){return t>i?this.Te/i:this.Pe/t}}class Rs extends xs{constructor(t,i){super(),this.Ee=t,this.Ie=i}get rectWidth(){return this.Ee}get rectHeight(){return this.Ie}set rectWidth(t){t!==this.Ee&&(this.Ee=t,this.dirty=!0)}set rectHeight(t){t!==this.Ie&&(this.Ie=t,this.dirty=!0)}calculateScale(t,i){return Math.max(this.Ee/t,this.Ie/i)}}class Vs extends xs{constructor(t,i){super(),this.Te=t,this.Ce=i}get fixedHeightLandscape(){return this.Te}get fixedHeightPortrait(){return this.Ce}set fixedHeightLandscape(t){t!==this.Te&&(this.Te=t,this.dirty=!0)}set fixedHeightPortrait(t){t!==this.Ce&&(this.Ce=t,this.dirty=!0)}calculateScale(t,i){return t>i?this.Te/i:this.Ce/i}}class Bs extends xs{constructor(t,i){super(),this.Me=t,this.Pe=i}get fixedWidthLandscape(){return this.Me}get fixedWidthPortrait(){return this.Pe}set fixedWidthLandscape(t){t!==this.Me&&(this.Me=t,this.dirty=!0)}set fixedWidthPortrait(t){t!==this.Pe&&(this.Pe=t,this.dirty=!0)}calculateScale(t,i){return t>i?this.Me/t:this.Pe/t}}export{pi as UIAnchor,Wi as UIAnimatedImage,ki as UIAnimatedImageLoopMode,Ms as UIAreaCircle,Cs as UIAreaPolygon,Ui as UIAreaRectangle,Ts as UIAreaRoundedRectangle,ai as UIAspectConstraint,st as UIColor,li as UIConstraint2DBuilder,ci as UICoverConstraintBuilder,vi as UICustomConstraint,kt as UIExpression,fi as UIFitConstraintBuilder,Is as UIFullscreenLayer,zi as UIGraphics,Qt as UIHeightConstraint,ti as UIHorizontalDistanceConstraint,ii as UIHorizontalInterpolationConstraint,si as UIHorizontalProportionConstraint,Fi as UIImage,Vi as UIInputDummy,Ti as UIInputEvent,Hi as UIMicro,wi as UIMicroAnchorMode,C as UIMode,Xi as UINineSlice,$i as UINineSliceRegionMode,T as UIOrientation,Z as UIPriority,Qi as UIProgress,Ps as UIProgressMaskFunctionCircular,Zi as UIProgressMaskFunctionDirectional,Ot as UIRelation,Hs as UIResizePolicyCover,As as UIResizePolicyCross,Us as UIResizePolicyCrossInverted,Rs as UIResizePolicyFit,Vs as UIResizePolicyFixedHeight,Bs as UIResizePolicyFixedWidth,Ss as UIResizePolicyNone,ss as UIScene,Ji as UISceneUpdateMode,Kt as UISingleParameterConstraint,_s as UIText,vs as UITextResizeMode,yt as UITransparencyMode,ei as UIVerticalDistanceConstraint,hi as UIVerticalInterpolationConstraint,ri as UIVerticalProportionConstraint,ni as UIWidthConstraint};
2
2
  //# sourceMappingURL=index.min.js.map