modern-canvas 0.4.35 → 0.4.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +4 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5661,6 +5661,10 @@ class GradientTexture extends Texture2D {
|
|
|
5661
5661
|
return this.regExp.test(value);
|
|
5662
5662
|
}
|
|
5663
5663
|
constructor(value, width, height) {
|
|
5664
|
+
if (width === Infinity)
|
|
5665
|
+
width = 0;
|
|
5666
|
+
if (height === Infinity)
|
|
5667
|
+
height = 0;
|
|
5664
5668
|
super(
|
|
5665
5669
|
LinearGradient.from(value).parse(width, height)
|
|
5666
5670
|
);
|
package/dist/index.js
CHANGED
|
@@ -110,7 +110,7 @@ uniform sampler2D sampler;
|
|
|
110
110
|
uniform vec4 tint;
|
|
111
111
|
void main(void) {
|
|
112
112
|
gl_FragColor = texture2D(sampler, vUv) * tint;
|
|
113
|
-
}`,uniforms:{sampler:0,projectionMatrix:new Float32Array([1,0,0,0,1,0,0,0,1]),modelViewMatrix:new Float32Array([1,0,0,0,1,0,0,0,1]),tint:new Float32Array([1,1,1,1])}})}}u(JA,"_instance");class ue extends Ir{static get instance(){return this._instance??(this._instance=new this)}static draw(A,e=JA.instance,t){this.instance.draw(A,e,t)}constructor(){super({vertexAttributes:{position:new lt({buffer:new qt({data:new Float32Array([-1,-1,1,-1,1,1,-1,1]),dynamic:!1}),size:2,normalized:!1,type:"float"}),uv:new lt({buffer:new qt({data:new Float32Array([0,0,1,0,1,1,0,1]),dynamic:!1}),size:2,normalized:!1,type:"float"})},indexBuffer:new HA({data:new Uint16Array([0,1,2,0,2,3]),dynamic:!1})})}}u(ue,"_instance");class bc extends Ir{constructor(){const e=new qt({data:new Float32Array,dynamic:!0}),t=new qt({data:new Float32Array,dynamic:!0});super({vertexAttributes:{position:new lt({buffer:e,size:2,normalized:!1,type:"float"}),uv:new lt({buffer:t,size:2,normalized:!1,type:"float"})},indexBuffer:new HA({data:new Uint16Array,dynamic:!0})});u(this,"positionBuffer");u(this,"uvBuffer");this.positionBuffer=e,this.uvBuffer=t}}var xc=Object.defineProperty,KA=(r,A,e,t)=>{for(var i=void 0,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(A,e,i)||i);return i&&xc(A,e,i),i};class ve extends zt{constructor(e){super();u(this,"_isPowerOfTwo",!1);u(this,"_needsUpload",!1);this.source=e,this._updateSize()}static get EMPTY(){return new this({width:1,height:1,pixels:null})}static get WHITE(){return new this({width:1,height:1,pixels:new Uint8Array([255,255,255,255])})}static get BLACK(){return new this({width:1,height:1,pixels:new Uint8Array([0,0,0,255])})}static get RED(){return new this({width:1,height:1,pixels:new Uint8Array([255,0,0,255])})}static get GREEN(){return new this({width:1,height:1,pixels:new Uint8Array([0,255,0,255])})}static get BLUE(){return new this({width:1,height:1,pixels:new Uint8Array([0,0,255,255])})}get valid(){return!!(this.width&&this.height)}get realWidth(){return Math.round(this.width*this.pixelRatio)}get realHeight(){return Math.round(this.height*this.pixelRatio)}_glTextureOptions(e,t){let i=this.wrapMode;return e.version===1&&!this._isPowerOfTwo&&(i="clamp_to_edge"),{value:this.source,target:"texture_2d",location:0,filterMode:this.filterMode,wrapMode:i,...t}}_glTexture(e,t){return e.getRelated(this,()=>e.texture.create(this._glTextureOptions(e,t)))}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"width":case"height":this._updatePOT();break;case"source":this._updateSize();break;case"filterMode":case"wrapMode":case"pixelRatio":this.requestUpload();break}}_updatePOT(){this._isPowerOfTwo=ys(this.realWidth)&&ys(this.realHeight),this.requestUpload()}_updateSize(){const e=this.source;"pixels"in e?(this.width=e.width/this.pixelRatio,this.height=e.height/this.pixelRatio):(this.width=Number(e.naturalWidth||e.videoWidth||e.width||0)/this.pixelRatio,this.height=Number(e.naturalHeight||e.videoHeight||e.height||0)/this.pixelRatio),this.requestUpload()}requestUpload(){this._needsUpload=!0}upload(e,t){return this._needsUpload&&this.valid?(this._needsUpload=!1,e.texture.update(this._glTexture(e,t),this._glTextureOptions(e,t)),!0):!1}activate(e,t=0){return this.valid?(e.texture.bind({target:"texture_2d",value:this._glTexture(e,{location:t}),location:t}),this.upload(e,{location:t}),!0):!1}inactivate(e){e.texture.unbind(this._glTexture(e))}free(){co&&this.source instanceof ImageBitmap&&this.source.close()}}KA([pe()],ve.prototype,"source"),KA([b({default:0})],ve.prototype,"width"),KA([b({default:0})],ve.prototype,"height"),KA([b({default:"linear"})],ve.prototype,"filterMode"),KA([b({default:"clamp_to_edge"})],ve.prototype,"wrapMode"),KA([b({default:1})],ve.prototype,"pixelRatio");class Br extends zt{constructor(e){super();u(this,"frames");let t;if(Array.isArray(e))t=e;else if(e instanceof ve)t=[{texture:e,duration:0}];else throw new TypeError("Failed new AnimatedTexture");this.frames=t,this.updateDuration()}updateDuration(){return this.duration=this.frames.reduce((e,t)=>t.duration+e,0),this}free(){this.frames.forEach(e=>{e.texture.free()})}}var Sc=Object.defineProperty,Mc=(r,A,e,t)=>{for(var i=void 0,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(A,e,i)||i);return i&&Sc(A,e,i),i};class YA extends ve{constructor(A=document.createElement("canvas")){super(A)}_updateProperty(A,e,t,i){switch(A){case"width":this.source.width=Math.max(1,Math.ceil(e*this.pixelRatio));break;case"height":this.source.height=Math.max(1,Math.ceil(e*this.pixelRatio));break}super._updateProperty(A,e,t,i)}}Mc([b({default:2})],YA.prototype,"pixelRatio");class ua extends ve{constructor(A){const e=new Vt(A);super({width:1,height:1,pixels:new Uint8Array([e.r8,e.g8,e.b8,e.a8])})}}class Er extends ve{static test(A){return this.regExp.test(A)}constructor(A,e,t){super(fr.from(A).parse(e,t))}}u(Er,"regExp",/(linear-gradient)/);function Rc(r){return{autoLoad:!!((r==null?void 0:r.autoLoad)??!0),useBitmap:!!((r==null?void 0:r.useBitmap)??!0)&&ws,crossorigin:(r==null?void 0:r.crossorigin)??null}}class Pc extends ve{constructor(e,t){const i=Rc(t);super(e);u(this,"bitmap");u(this,"useBitmap");u(this,"preserveBitmap",!1);u(this,"_loadSource");u(this,"_loadBitmap");const s=e.src,n=s.includes(".svg")||s.startsWith("data:image/svg+xml");this.useBitmap=i.useBitmap&&!n,i.autoLoad&&this.load()}async load(){return this._loadSource||(this._loadSource=new Promise(e=>{this._loadSource=void 0;const t=this.source,i=()=>{t.onload=null,t.onerror=null},s=()=>{i(),this.requestUpload(),this.useBitmap?this.genBitmap().finally(()=>e(this)):e(this)},n=o=>{i(),console.warn(`Failed to load ImageTexture, src: ${t.src}`,o),this.emit("error",o),e(this)};t.complete&&t.src?s():(t.onload=s,t.onerror=n)})),this._loadSource}genBitmap(){if(this._loadBitmap)return this._loadBitmap;if(this.bitmap||!ws)return Promise.resolve(this);const e=this.source,t=!e.crossOrigin||e.crossOrigin==="anonymous";return this._loadBitmap=fetch(e.src,{mode:t?"cors":"no-cors"}).then(i=>i.blob()).then(i=>createImageBitmap(i,0,0,e.width,e.height,{premultiplyAlpha:"premultiply"})).then(i=>(this.bitmap=i,this.requestUpload(),this._loadBitmap=void 0,this)).catch(i=>(console.warn("Failed to genBitmap",i),this)),this._loadBitmap}_glTextureOptions(e){return{...super._glTextureOptions(e),value:this.bitmap??this.source}}upload(e){if(this.useBitmap){if(!this.bitmap)return this.genBitmap(),!1}else{const i=this.source;if(yi&&i instanceof HTMLImageElement&&(!i.complete||i.naturalWidth===0))return!1}const t=super.upload(e);return this.preserveBitmap&&this.bitmap&&(this.bitmap.close(),this.bitmap=void 0),t}}class Ks extends ve{constructor(A,e=1,t=1){const i={width:e,height:t,pixels:null};A&&(ArrayBuffer.isView(A)?i.pixels=new Uint8Array(A.buffer):i.pixels=new Uint8Array(A)),super(i)}_updateProperty(A,e,t,i){switch(A){case"width":this.source.width=Math.round(this.width*this.pixelRatio);break;case"height":this.source.height=Math.round(this.height*this.pixelRatio);break;case"pixelRatio":this.source.width=Math.round(this.width*this.pixelRatio),this.source.height=Math.round(this.height*this.pixelRatio);break}super._updateProperty(A,e,t,i)}}var Uc=Object.defineProperty,fa=(r,A,e,t)=>{for(var i=void 0,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(A,e,i)||i);return i&&Uc(A,e,i),i};function kc(r){return{autoLoad:!!((r==null?void 0:r.autoLoad)??!0),autoPlay:!!((r==null?void 0:r.autoPlay)??!1),fps:Number((r==null?void 0:r.fps)??0),crossorigin:(r==null?void 0:r.crossorigin)??null,loop:!!((r==null?void 0:r.loop)??!1),muted:!!((r==null?void 0:r.muted)??!1),playsinline:!!((r==null?void 0:r.playsinline)??!0)}}const Ys=(FA=class extends ve{constructor(e,t){const i=kc(t);if(!Bo(e)){typeof e=="string"&&(e=[e]);const s=e[0].src||e[0],n=document.createElement("video");i.autoLoad&&n.setAttribute("preload","auto"),i.playsinline&&(n.setAttribute("webkit-playsinline",""),n.setAttribute("playsinline","")),i.muted&&(n.setAttribute("muted",""),n.muted=!0),i.loop&&n.setAttribute("loop",""),i.autoPlay&&n.setAttribute("autoplay",""),mo(n,s,i.crossorigin);for(let o=0;o<e.length;++o){let{src:a,mime:l}=e[o];if(a=a||e[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const c=a.split("?").shift().toLowerCase(),f=c.slice(c.lastIndexOf(".")+1);l=l||FA.mimeTypes.get(f)||`video/${f}`}const h=document.createElement("source");h.src=a,l&&(h.type=l),n.appendChild(h)}e=n}super(e);u(this,"_spf",0);u(this,"_autoPlay",!1);u(this,"_sourceLoad");u(this,"_nextTime",0);u(this,"_connected",!1);u(this,"_requestId");u(this,"_resolve");u(this,"_reject");u(this,"_onPlayStart",()=>{this.valid||this._onCanPlay(),this._setupAutoUpdate()});u(this,"_onPlayStop",()=>{this._setupAutoUpdate()});u(this,"_onCanPlay",()=>{const e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);const t=this.valid;this._nextTime=0,this._updateSize(),this.requestUpload(),this._nextTime=0,!t&&this._resolve&&(this._resolve(this),this._sourceLoad=void 0,this._resolve=void 0,this._reject=void 0),this.isPlaying?this._onPlayStart():this._autoPlay&&e.play()});u(this,"_onError",e=>{this.source.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=void 0,this._resolve=void 0)});u(this,"_onSeeked",()=>{this.autoUpdate&&!this.isPlaying&&(this._nextTime=0,this.requestUpload(),this._nextTime=0)});u(this,"_videoFrameRequestCallback",()=>{this.requestUpload(),this._requestId=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)});u(this,"requestUpload",()=>{const e=Math.floor(xe.elapsed*this.source.playbackRate);this._nextTime-=e,(!this._spf||this._nextTime<=0)&&(super.requestUpload(),this._nextTime=this._spf||0)});this.fps=i.fps,this._autoPlay=i.autoPlay,i.autoPlay&&this.load(),this._setupAutoUpdate()}get isReady(){return this.source.readyState>2}get isPlaying(){return!this.source.paused&&!this.source.ended&&this.isReady}get duration(){return this.source.duration}get seeking(){return this.source.seeking}get currentTime(){return this.source.currentTime}set currentTime(e){this.source.currentTime=e}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"fps":this._spf=t?Math.floor(1e3/t):0,this._setupAutoUpdate();break;case"autoUpdate":this._setupAutoUpdate();break}}_setupAutoUpdate(){this.autoUpdate&&this.isPlaying?!this.fps&&this.source.requestVideoFrameCallback?(this._connected&&(xe.off(this.requestUpload),this._connected=!1,this._nextTime=0),this._requestId===void 0&&(this._requestId=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._requestId!==void 0&&(this.source.cancelVideoFrameCallback(this._requestId),this._requestId=void 0),this._connected||(xe.on(this.requestUpload),this._connected=!0,this._nextTime=0)):(this._requestId!==void 0&&(this.source.cancelVideoFrameCallback(this._requestId),this._requestId=void 0),this._connected&&(xe.off(this.requestUpload),this._connected=!1,this._nextTime=0))}async load(){if(!this._sourceLoad){const e=this.source;(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this.isReady?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._sourceLoad=new Promise((t,i)=>{this.valid?(this._sourceLoad=void 0,t(this)):(this._resolve=t,this._reject=i,e.load())})}return this._sourceLoad}free(){this._setupAutoUpdate();const e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load())}},u(FA,"mimeTypes",new Map(Object.entries({ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"}))),FA);fa([pe({default:!0})],Ys.prototype,"autoUpdate"),fa([pe({default:0})],Ys.prototype,"fps");let da=Ys;class zs extends Ks{}var Nc=Object.defineProperty,Fc=Object.getOwnPropertyDescriptor,vA=(r,A,e,t)=>{for(var i=t>1?void 0:t?Fc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Nc(A,e,i),i};const Ia={};function Tc(r){let A=Ia[r]??0;return A++,Ia[r]=A,A}g.Node=class extends Yt{constructor(e,t=[]){super();u(this,"_readyed",!1);u(this,"_tree");u(this,"_parent");u(this,"_children",[]);u(this,"_meta",new Map);this._onTreeEnter=this._onTreeEnter.bind(this),this._onTreeExit=this._onTreeExit.bind(this),this._onParented=this._onParented.bind(this),this._onUnparented=this._onUnparented.bind(this),this._onReady=this._onReady.bind(this),this._onProcess=this._onProcess.bind(this),this.setProperties({name:`${this.tag}:${Tc(this.tag)}`,...e}).append(t),this.on("treeEnter",this._onTreeEnter).on("treeExit",this._onTreeExit).on("parented",this._onParented).on("unparented",this._onUnparented).on("ready",this._onReady).on("process",this._onProcess)}setProperties(e){if(e){const{meta:t,...i}=e;if(t)for(const s in t)this.setMeta(s,t[s]);super.setProperties(i)}return this}getName(){return this.name}setName(e){return this.name=e,this}get tree(){return this.getTree()}set tree(e){this.setTree(e)}getTree(){return this._tree}getViewport(){var e;return(e=this._tree)==null?void 0:e.getCurrentViewport()}getWindow(){var e;return(e=this._tree)==null?void 0:e.root}isInsideTree(){return!!this._tree}setTree(e){const t=this._tree;if(!(e!=null&&e.is(t))){t&&this.emit("treeExit",t),this._tree=e,e&&this.emit("treeEnter",e);for(let i=this._children.length,s=0;s<i;s++){const n=this._children[s];!e&&this.emit("childExitingTree",n),n.setTree(e),e&&this.emit("childEnteredTree",n)}e&&(this.emit("treePostEnter",e),this._readyed||(this._readyed=!0,this.emit("ready")))}return this}get parent(){return this._parent}set parent(e){this.setParent(e)}hasParent(){return!!this._parent}getParent(){return this._parent}setParent(e){var t;if(!((t=this._parent)!=null&&t.is(e))){const i=this._parent;i&&this.emit("unparented",i),this._parent=e,e&&this.emit("parented",e),this.setTree(e==null?void 0:e._tree)}return this}get siblingIndex(){return this.getIndex()}set siblingIndex(e){var t;(t=this._parent)==null||t.moveChild(this,e)}get previousSibling(){var e;return(e=this._parent)==null?void 0:e.getChildren()[this.getIndex()-1]}get nextSibling(){var e;return(e=this._parent)==null?void 0:e.getChildren()[this.getIndex()+1]}get firstSibling(){var e;return(e=this._parent)==null?void 0:e.getChildren()[0]}get lastSibling(){var t;const e=(t=this._parent)==null?void 0:t.getChildren();return e?e[e.length-1]:void 0}hasMeta(e){return this._meta.has(e)}getMeta(e,t){return this._meta.get(e)??t}setMeta(e,t){this._meta.set(e,t)}deleteMeta(e){this._meta.delete(e)}clearMeta(){this._meta.clear()}canProcess(){var e;if(!this._tree)return!1;switch(this.processMode){case"inherit":return((e=this._parent)==null?void 0:e.canProcess())??!0;case"pausable":return!this._tree.processPaused;case"when_paused":return this._tree.processPaused;case"always":return!0;case"disabled":default:return!1}}canRender(){var e;if(!this._tree)return!1;switch(this.renderMode){case"inherit":return((e=this._parent)==null?void 0:e.canRender())??!0;case"always":return!0;case"disabled":default:return!1}}_update(e){super._update(e)}_updateProperty(e,t,i,s){super._updateProperty(e,t,i,s)}_onTreeEnter(e){this._treeEnter(e),this.emit("treeEntered",e)}_onTreeExit(e){this.emit("treeExiting",e),this._treeExit(e),this.emit("treeExited",e)}_onParented(e){this._parented(e)}_onUnparented(e){this._unparented(e)}_onReady(){this._ready()}_onProcess(e=0){const t=this._tree,i=this.canRender(),s=this.canProcess(),n=[],o=[];for(let l=this._children.length,h=0;h<l;h++){const c=this._children[h];switch(c.processSortMode){case"default":o.push(c);break;case"parent_before":n.push(c);break}}n.forEach(l=>{l.emit("process",e)}),s&&(t==null||t.emit("nodeProcessing",this),this.emit("processing",e),this._process(e));let a;if(i){const l=t.renderStack.push(this);a=t.renderStack.currentCall,t.renderStack.currentCall=l}if(this.mask instanceof g.Node)this.getNode("__$mask")||(this.mask.processMode="disabled",this.appendChild(this.mask,"front"));else{const l=this.getNode("__$mask");l&&this.removeChild(l)}o.forEach(l=>{l.emit("process",e)}),i&&(t.renderStack.currentCall=a),s&&(this.emit("processed",e),t==null||t.emit("nodeProcessed",this))}render(e,t){const i=this.mask;i&&(e.flush(),e.mask.push(this,i)),this._render(e),t==null||t(),i&&(e.flush(),e.mask.pop(this))}input(e,t){for(let i=this._children.length-1;i>=0;i--)this._children[i].input(e,t);this._input(e,t)}getChildren(e=!1){switch(e){case!0:return this._children;case!1:return this._children.filter(t=>t.internalMode==="default");default:return this._children.filter(t=>t.internalMode===e)}}getIndex(e=!1){var t;return((t=this._parent)==null?void 0:t.getChildren(e).indexOf(this))??0}getNode(e){return this._children.find(t=>t.name===e)}removeNode(e){var t;(t=this.getNode(e))==null||t.remove()}addSibling(e){return this.is(e)||!this.hasParent()||e.hasParent()?this:(e.internalMode=this.internalMode,this._parent.moveChild(e,this.getIndex(!0)+1),this)}prepend(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(i=>{this.moveChild(i,0)})}append(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(i=>{this.appendChild(i)})}before(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(i=>{var s;(s=this._parent)==null||s.moveChild(i,this.getIndex(!0))})}after(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(i=>{var s;(s=this._parent)==null||s.moveChild(i,this.getIndex(!0)+1)})}insertBefore(e,t){return!t.hasParent()||!this.is(t.parent)||this.moveChild(e,t.getIndex(!0)),e}appendChild(e,t=e.internalMode){if(this.is(e)||e.hasParent())return e;switch(t){case"default":case"front":{const i=t==="default"?"back":"front",s=this._children.findIndex(n=>n.internalMode===i);s>-1?this._children.splice(s,0,e):this._children.push(e);break}case"back":this._children.push(e);break}return e.internalMode=t,e.setParent(this),this.emit("appendChild",e),e}moveChild(e,t,i=e.internalMode){if(this.is(e)||e.hasParent()&&!this.is(e.parent))return this;e.internalMode=i;const s=this._children.indexOf(e);let n=this._children.findIndex(l=>{switch(i){case"default":return l.internalMode!=="front";case"back":return l.internalMode==="back";case"front":default:return!0}});n=n>-1?n:Math.max(0,this._children.length-1);let o=this._children.slice(n).findIndex(l=>{switch(i){case"front":return l.internalMode!=="front";case"default":return l.internalMode==="back";case"back":default:return!1}});o=o>-1?n+o:Math.max(0,this._children.length);const a=St(n,t>-1?t:o,o);return a!==s&&(s>-1&&this._children.splice(s,1),e.setParent(this),a>-1&&a<this._children.length?this._children.splice(a,0,e):this._children.push(e),s>-1?this.emit("moveChild",e,a,s):this.emit("appendChild",e)),this}removeChild(e){const t=e.getIndex(!0);return this.is(e.parent)&&t>-1&&(this._children.splice(t,1),e.setParent(void 0),this.emit("removeChild",e,t)),e}removeChildren(){this.getChildren().forEach(e=>this.removeChild(e))}remove(){var e;(e=this._parent)==null||e.removeChild(this)}forEachChild(e){return this.getChildren().forEach(e),this}forEachDescendant(e){return this.getChildren().forEach(t=>{e(t),t.forEachDescendant(e)}),this}_ready(){}_treeEnter(e){}_treeExit(e){}_parented(e){}_unparented(e){}_process(e){}_input(e,t){}_render(e){}clone(){return new this.constructor(this.toJSON().props,this.getChildren(!0))}toJSON(){return{tag:this.tag,props:{name:this.name,...super.toJSON()},meta:Object.fromEntries(this._meta.entries()),children:this.getChildren().map(e=>e.toJSON())}}static parse(e){if(Array.isArray(e))return e.map(a=>this.parse(a));const{tag:t,props:i,children:s}=e,n=lr.get(t)??g.Node,o=new n(i);return s==null||s.forEach(a=>o.appendChild(this.parse(a))),o}},vA([pe()],g.Node.prototype,"name",2),vA([b()],g.Node.prototype,"mask",2),vA([b({default:"inherit"})],g.Node.prototype,"processMode",2),vA([b({default:"default"})],g.Node.prototype,"processSortMode",2),vA([b({default:"inherit"})],g.Node.prototype,"renderMode",2),vA([b({default:"default"})],g.Node.prototype,"internalMode",2),g.Node=vA([ne("Node")],g.Node);var Lc=Object.defineProperty,Gc=Object.getOwnPropertyDescriptor,_i=(r,A,e,t)=>{for(var i=t>1?void 0:t?Gc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Lc(A,e,i),i};g.TimelineNode=class extends g.Node{constructor(e,t=[]){super();u(this,"computedDuration",0);u(this,"_currentTime",0);u(this,"_startTime",0);this.setProperties(e).append(t)}get timeline(){var e;return(e=this._tree)==null?void 0:e.timeline}get timelineCurrentTime(){var e;return((e=this.timeline)==null?void 0:e.currentTime)??0}get parentStartTime(){var e;return((e=this._parent)==null?void 0:e.startTime)??0}get currentTime(){return St(0,this._currentTime,this.computedDuration)}get startTime(){return this._startTime}set startTime(e){this.delay=e-this.parentStartTime,this._updateCurrentTime(!0)}get endTime(){return this._startTime+this.computedDuration}get currentTimeProgress(){return this.computedDuration?St(0,this._currentTime/this.computedDuration,1):0}isInsideTimeRange(){const e=this._currentTime;return this.computedDuration?e>=0&&e<=this.computedDuration:e>=0}_updateCurrentTime(e=!1){if(e||!this.paused){const t=this._parent;this._startTime=this.delay+this.parentStartTime,this.computedDuration=t!=null&&t.computedDuration?Math.min(this._startTime+this.duration,t.endTime)-this._startTime:this.duration,this._currentTime=this.timelineCurrentTime-this._startTime,this.emit("updateCurrentTime",this._currentTime),this.insideTimeRange=this.isInsideTimeRange()}}_process(e){super._process(e),this._updateCurrentTime()}},_i([b({default:0})],g.TimelineNode.prototype,"delay",2),_i([b({default:0})],g.TimelineNode.prototype,"duration",2),_i([b({default:!1})],g.TimelineNode.prototype,"paused",2),_i([pe()],g.TimelineNode.prototype,"insideTimeRange",2),g.TimelineNode=_i([ne("TimelineNode")],g.TimelineNode);var Oc=Object.defineProperty,Hc=Object.getOwnPropertyDescriptor,Di=(r,A,e,t)=>{for(var i=t>1?void 0:t?Hc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Oc(A,e,i),i};g.Viewport=class extends g.Node{constructor(e=!1){super();u(this,"_projection",new Ko);u(this,"_framebufferIndex",0);u(this,"_framebuffers",[{texture:new zs,needsUpload:!1},{texture:new zs,needsUpload:!1}]);this.flipY=e,this._projection.flipY(e)}get valid(){return!!(this.width&&this.height)}get framebuffer(){return this._framebuffers[this._framebufferIndex]}get texture(){return this.framebuffer.texture}_glFramebufferOptions(e){const{width:t,height:i}=this,{pixelRatio:s}=e;return this._framebuffers.forEach(n=>{const o=n.texture;o.width=t,o.height=i,o.pixelRatio=s,o.upload(e)}),{width:t,height:i,colorTextures:[this.texture._glTexture(e)]}}_glFramebuffer(e){return e.getRelated(this.framebuffer,()=>e.framebuffer.create(this._glFramebufferOptions(e)))}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"x":case"y":this.requestUpload(),this._projection.translate(this.x,this.y),this.emit("updateRect");break;case"width":case"height":this.requestUpload(),this._projection.resize(this.width,this.height),this.emit("updateRect");break}}requestUpload(){this._framebuffers.forEach(e=>e.needsUpload=!0)}resize(e,t){this.width=e,this.height=t}upload(e){const t=this.framebuffer;return t.needsUpload&&this.valid?(t.needsUpload=!1,e.framebuffer.update(this._glFramebuffer(e),this._glFramebufferOptions(e)),!0):!1}activate(e){var t;return this.valid?(e.flush(),(t=this._tree)==null||t.setCurrentViewport(this),this.upload(e),e.framebuffer.bind(this._glFramebuffer(e)),!0):!1}redraw(e,t){if(this.valid){e.flush();const i=this.framebuffer.texture;return this._framebufferIndex=(this._framebufferIndex+1)%this._framebuffers.length,this.activate(e),e.clear(),i.activate(e,0),t(),!0}return!1}activateWithCopy(e,t){this.resize(t.width,t.height),this.activate(e)&&(e.clear(),t.texture.activate(e,0),ue.draw(e,JA.instance,{sampler:0}))}render(e,t){var s,n;const i=(s=this._tree)==null?void 0:s.getCurrentViewport();this.activate(e),e.clear(),super.render(e,t),e.flush(),i?i.activate(e):(e.framebuffer.bind(null),(n=this._tree)==null||n.setCurrentViewport(void 0))}getRect(){return new Os(this.x,this.y,this.width,this.height)}toProjectionArray(e=!1){return this._projection.toArray(e)}},Di([b({default:0})],g.Viewport.prototype,"x",2),Di([b({default:0})],g.Viewport.prototype,"y",2),Di([b({default:0})],g.Viewport.prototype,"width",2),Di([b({default:0})],g.Viewport.prototype,"height",2),g.Viewport=Di([ne("Viewport")],g.Viewport);var Jc=Object.defineProperty,Kc=Object.getOwnPropertyDescriptor,bi=(r,A,e,t)=>{for(var i=t>1?void 0:t?Kc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Jc(A,e,i),i};g.Effect=class extends g.TimelineNode{constructor(e,t=[]){super();u(this,"viewport1",new g.Viewport);u(this,"viewport2",new g.Viewport);u(this,"_renderId",0);u(this,"_renderViewport");u(this,"_previousSibling");u(this,"_nextSibling");this._onProcessing=this._onProcessing.bind(this),this._onNodeProcessed=this._onNodeProcessed.bind(this),this.setProperties(e).append(t)}get _effectMode(){return this.effectMode??"parent"}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"glsl":{const n=new pr(t);!this.effectMode&&n.has.transition&&(this.effectMode="transition"),this.material=n;break}case"glslSrc":{t?Lt.text.load(t).then(n=>this.glsl=n):this.glsl="";break}}}_treeEnter(e){e.on("processing",this._onProcessing),e.on("nodeProcessed",this._onNodeProcessed),this.viewport1.setTree(e),this.viewport2.setTree(e)}_treeExit(e){e.off("processing",this._onProcessing),e.off("nodeProcessed",this._onNodeProcessed),this.viewport1.setTree(void 0),this.viewport2.setTree(void 0)}_onProcessing(){if(this.canProcess())switch(this._updateCurrentTime(),this._effectMode){case"transition":this._previousSibling=this.previousSibling,this._nextSibling=this.nextSibling;break;default:this._previousSibling=void 0,this._nextSibling=void 0;break}}_onNodeProcessed(e){var i;if(!this.canProcess()||!this.isInsideTimeRange())return;const t=(i=this._tree)==null?void 0:i.renderStack;if(t)switch(this._effectMode){case"transition":e.is(this._previousSibling)?(this._previousSibling=void 0,t.push(this)):e.is(this._nextSibling)&&(this._nextSibling=void 0,t.push(this));break}}_processParent(){var o,a;const e=(o=this._tree)==null?void 0:o.renderStack;if(!e)return;const t=(a=e.currentCall)==null?void 0:a.parentCall;if(!t)return;const i=t.calls;let s,n;i.forEach((l,h)=>{var c;(l.renderable.is(this._parent)||(c=l.renderable.parent)!=null&&c.is(this._parent))&&(s=s??h,n=h)}),!(s===void 0||n===void 0)&&(i.splice(n+1,0,e.createCall(this)),i.splice(s,0,e.createCall(this)))}_processChildren(){var e;this._children.length&&(super.emit("process"),(e=this._tree)==null||e.renderStack.push(this))}_onProcess(e=0){if(this.canProcess())switch(this._renderId=0,this._effectMode){case"before":super._onProcess(e);break;case"parent":this._processParent();break;case"children":this._processChildren();break}}_renderBefore(e){var i;const t=(i=this._tree)==null?void 0:i.getCurrentViewport();t&&this.apply(e,t,{redraw:!0})}_renderTransition(e){var t;if(this._renderId%2===0)this._renderViewport=(t=this._tree)==null?void 0:t.getCurrentViewport(),this._renderViewport&&(this.viewport1.activateWithCopy(e,this._renderViewport),this.viewport2.resize(this._renderViewport.width,this._renderViewport.height)),this.viewport2.activate(e),e.clear();else{const i=this._renderViewport;this._renderViewport=void 0,i&&(i.activate(e),e.clear(),this.viewport1.texture.activate(e,0),this.viewport2.texture.activate(e,1),this.apply(e,i,{from:this.viewport1,to:this.viewport2}),e.texture.unbind(0),e.texture.unbind(1))}}_renderParentOrChildren(e){var t;if(this._renderId%2===0)this._renderViewport=(t=this._tree)==null?void 0:t.getCurrentViewport(),this._renderViewport&&this.viewport1.resize(this._renderViewport.width,this._renderViewport.height),this.viewport1.activate(e),e.clear();else{const i=this._renderViewport;this._renderViewport=void 0,i&&(this.viewport1.activate(e),this.apply(e,this.viewport1,{redraw:!0,target:this._effectMode==="parent"?this._parent??void 0:void 0,targetArea:this._parseTargetArea()}),i.activate(e),this.viewport1.texture.activate(e,0),ue.draw(e))}}_parseTargetArea(){if(this._effectMode==="parent"&&this._parent&&"getRect"in this._parent){const e=this._parent.getRect();if(e)return[e.left/this.viewport1.width,e.top/this.viewport1.height,e.width/this.viewport1.width,e.height/this.viewport1.height]}}_render(e){switch(this._effectMode){case"before":this._renderBefore(e);break;case"transition":this._renderTransition(e);break;case"parent":case"children":default:this._renderParentOrChildren(e);break}this._renderId++}apply(e,t,i){this.material&&(i!=null&&i.redraw?t.redraw(e,()=>{ue.draw(e,this.material,{from:0,to:1,progress:this.currentTimeProgress,ratio:t.width/t.height})}):ue.draw(e,this.material,{from:0,to:1,progress:this.currentTimeProgress,ratio:i!=null&&i.from?i.from.width/i.from.height:0}))}},bi([pe()],g.Effect.prototype,"material",2),bi([b()],g.Effect.prototype,"effectMode",2),bi([b({default:""})],g.Effect.prototype,"glsl",2),bi([b({default:""})],g.Effect.prototype,"glslSrc",2),g.Effect=bi([ne("Effect")],g.Effect);var pa=Object.defineProperty,Yc=Object.getOwnPropertyDescriptor,zc=(r,A,e)=>A in r?pa(r,A,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[A]=e,Xt=(r,A,e,t)=>{for(var i=t>1?void 0:t?Yc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&pa(A,e,i),i},Wc=(r,A,e)=>zc(r,A+"",e);g.ColorAdjustEffect=class extends g.Effect{constructor(A,e=[]){super(),this.setProperties(A).append(e)}apply(A,e){e.redraw(A,()=>{ue.draw(A,g.ColorAdjustEffect.material,{sampler:0,saturation:this.saturation,contrast:this.contrast,brightness:this.brightness,red:this.red,green:this.green,blue:this.blue,alpha:this.alpha,gamma:Math.max(this.gamma??1,1e-4)})})}},Wc(g.ColorAdjustEffect,"material",new Ee({vert:`precision mediump float;
|
|
113
|
+
}`,uniforms:{sampler:0,projectionMatrix:new Float32Array([1,0,0,0,1,0,0,0,1]),modelViewMatrix:new Float32Array([1,0,0,0,1,0,0,0,1]),tint:new Float32Array([1,1,1,1])}})}}u(JA,"_instance");class ue extends Ir{static get instance(){return this._instance??(this._instance=new this)}static draw(A,e=JA.instance,t){this.instance.draw(A,e,t)}constructor(){super({vertexAttributes:{position:new lt({buffer:new qt({data:new Float32Array([-1,-1,1,-1,1,1,-1,1]),dynamic:!1}),size:2,normalized:!1,type:"float"}),uv:new lt({buffer:new qt({data:new Float32Array([0,0,1,0,1,1,0,1]),dynamic:!1}),size:2,normalized:!1,type:"float"})},indexBuffer:new HA({data:new Uint16Array([0,1,2,0,2,3]),dynamic:!1})})}}u(ue,"_instance");class bc extends Ir{constructor(){const e=new qt({data:new Float32Array,dynamic:!0}),t=new qt({data:new Float32Array,dynamic:!0});super({vertexAttributes:{position:new lt({buffer:e,size:2,normalized:!1,type:"float"}),uv:new lt({buffer:t,size:2,normalized:!1,type:"float"})},indexBuffer:new HA({data:new Uint16Array,dynamic:!0})});u(this,"positionBuffer");u(this,"uvBuffer");this.positionBuffer=e,this.uvBuffer=t}}var xc=Object.defineProperty,KA=(r,A,e,t)=>{for(var i=void 0,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(A,e,i)||i);return i&&xc(A,e,i),i};class ve extends zt{constructor(e){super();u(this,"_isPowerOfTwo",!1);u(this,"_needsUpload",!1);this.source=e,this._updateSize()}static get EMPTY(){return new this({width:1,height:1,pixels:null})}static get WHITE(){return new this({width:1,height:1,pixels:new Uint8Array([255,255,255,255])})}static get BLACK(){return new this({width:1,height:1,pixels:new Uint8Array([0,0,0,255])})}static get RED(){return new this({width:1,height:1,pixels:new Uint8Array([255,0,0,255])})}static get GREEN(){return new this({width:1,height:1,pixels:new Uint8Array([0,255,0,255])})}static get BLUE(){return new this({width:1,height:1,pixels:new Uint8Array([0,0,255,255])})}get valid(){return!!(this.width&&this.height)}get realWidth(){return Math.round(this.width*this.pixelRatio)}get realHeight(){return Math.round(this.height*this.pixelRatio)}_glTextureOptions(e,t){let i=this.wrapMode;return e.version===1&&!this._isPowerOfTwo&&(i="clamp_to_edge"),{value:this.source,target:"texture_2d",location:0,filterMode:this.filterMode,wrapMode:i,...t}}_glTexture(e,t){return e.getRelated(this,()=>e.texture.create(this._glTextureOptions(e,t)))}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"width":case"height":this._updatePOT();break;case"source":this._updateSize();break;case"filterMode":case"wrapMode":case"pixelRatio":this.requestUpload();break}}_updatePOT(){this._isPowerOfTwo=ys(this.realWidth)&&ys(this.realHeight),this.requestUpload()}_updateSize(){const e=this.source;"pixels"in e?(this.width=e.width/this.pixelRatio,this.height=e.height/this.pixelRatio):(this.width=Number(e.naturalWidth||e.videoWidth||e.width||0)/this.pixelRatio,this.height=Number(e.naturalHeight||e.videoHeight||e.height||0)/this.pixelRatio),this.requestUpload()}requestUpload(){this._needsUpload=!0}upload(e,t){return this._needsUpload&&this.valid?(this._needsUpload=!1,e.texture.update(this._glTexture(e,t),this._glTextureOptions(e,t)),!0):!1}activate(e,t=0){return this.valid?(e.texture.bind({target:"texture_2d",value:this._glTexture(e,{location:t}),location:t}),this.upload(e,{location:t}),!0):!1}inactivate(e){e.texture.unbind(this._glTexture(e))}free(){co&&this.source instanceof ImageBitmap&&this.source.close()}}KA([pe()],ve.prototype,"source"),KA([b({default:0})],ve.prototype,"width"),KA([b({default:0})],ve.prototype,"height"),KA([b({default:"linear"})],ve.prototype,"filterMode"),KA([b({default:"clamp_to_edge"})],ve.prototype,"wrapMode"),KA([b({default:1})],ve.prototype,"pixelRatio");class Br extends zt{constructor(e){super();u(this,"frames");let t;if(Array.isArray(e))t=e;else if(e instanceof ve)t=[{texture:e,duration:0}];else throw new TypeError("Failed new AnimatedTexture");this.frames=t,this.updateDuration()}updateDuration(){return this.duration=this.frames.reduce((e,t)=>t.duration+e,0),this}free(){this.frames.forEach(e=>{e.texture.free()})}}var Sc=Object.defineProperty,Mc=(r,A,e,t)=>{for(var i=void 0,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(A,e,i)||i);return i&&Sc(A,e,i),i};class YA extends ve{constructor(A=document.createElement("canvas")){super(A)}_updateProperty(A,e,t,i){switch(A){case"width":this.source.width=Math.max(1,Math.ceil(e*this.pixelRatio));break;case"height":this.source.height=Math.max(1,Math.ceil(e*this.pixelRatio));break}super._updateProperty(A,e,t,i)}}Mc([b({default:2})],YA.prototype,"pixelRatio");class ua extends ve{constructor(A){const e=new Vt(A);super({width:1,height:1,pixels:new Uint8Array([e.r8,e.g8,e.b8,e.a8])})}}class Er extends ve{static test(A){return this.regExp.test(A)}constructor(A,e,t){e===1/0&&(e=0),t===1/0&&(t=0),super(fr.from(A).parse(e,t))}}u(Er,"regExp",/(linear-gradient)/);function Rc(r){return{autoLoad:!!((r==null?void 0:r.autoLoad)??!0),useBitmap:!!((r==null?void 0:r.useBitmap)??!0)&&ws,crossorigin:(r==null?void 0:r.crossorigin)??null}}class Pc extends ve{constructor(e,t){const i=Rc(t);super(e);u(this,"bitmap");u(this,"useBitmap");u(this,"preserveBitmap",!1);u(this,"_loadSource");u(this,"_loadBitmap");const s=e.src,n=s.includes(".svg")||s.startsWith("data:image/svg+xml");this.useBitmap=i.useBitmap&&!n,i.autoLoad&&this.load()}async load(){return this._loadSource||(this._loadSource=new Promise(e=>{this._loadSource=void 0;const t=this.source,i=()=>{t.onload=null,t.onerror=null},s=()=>{i(),this.requestUpload(),this.useBitmap?this.genBitmap().finally(()=>e(this)):e(this)},n=o=>{i(),console.warn(`Failed to load ImageTexture, src: ${t.src}`,o),this.emit("error",o),e(this)};t.complete&&t.src?s():(t.onload=s,t.onerror=n)})),this._loadSource}genBitmap(){if(this._loadBitmap)return this._loadBitmap;if(this.bitmap||!ws)return Promise.resolve(this);const e=this.source,t=!e.crossOrigin||e.crossOrigin==="anonymous";return this._loadBitmap=fetch(e.src,{mode:t?"cors":"no-cors"}).then(i=>i.blob()).then(i=>createImageBitmap(i,0,0,e.width,e.height,{premultiplyAlpha:"premultiply"})).then(i=>(this.bitmap=i,this.requestUpload(),this._loadBitmap=void 0,this)).catch(i=>(console.warn("Failed to genBitmap",i),this)),this._loadBitmap}_glTextureOptions(e){return{...super._glTextureOptions(e),value:this.bitmap??this.source}}upload(e){if(this.useBitmap){if(!this.bitmap)return this.genBitmap(),!1}else{const i=this.source;if(yi&&i instanceof HTMLImageElement&&(!i.complete||i.naturalWidth===0))return!1}const t=super.upload(e);return this.preserveBitmap&&this.bitmap&&(this.bitmap.close(),this.bitmap=void 0),t}}class Ks extends ve{constructor(A,e=1,t=1){const i={width:e,height:t,pixels:null};A&&(ArrayBuffer.isView(A)?i.pixels=new Uint8Array(A.buffer):i.pixels=new Uint8Array(A)),super(i)}_updateProperty(A,e,t,i){switch(A){case"width":this.source.width=Math.round(this.width*this.pixelRatio);break;case"height":this.source.height=Math.round(this.height*this.pixelRatio);break;case"pixelRatio":this.source.width=Math.round(this.width*this.pixelRatio),this.source.height=Math.round(this.height*this.pixelRatio);break}super._updateProperty(A,e,t,i)}}var Uc=Object.defineProperty,fa=(r,A,e,t)=>{for(var i=void 0,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=n(A,e,i)||i);return i&&Uc(A,e,i),i};function kc(r){return{autoLoad:!!((r==null?void 0:r.autoLoad)??!0),autoPlay:!!((r==null?void 0:r.autoPlay)??!1),fps:Number((r==null?void 0:r.fps)??0),crossorigin:(r==null?void 0:r.crossorigin)??null,loop:!!((r==null?void 0:r.loop)??!1),muted:!!((r==null?void 0:r.muted)??!1),playsinline:!!((r==null?void 0:r.playsinline)??!0)}}const Ys=(FA=class extends ve{constructor(e,t){const i=kc(t);if(!Bo(e)){typeof e=="string"&&(e=[e]);const s=e[0].src||e[0],n=document.createElement("video");i.autoLoad&&n.setAttribute("preload","auto"),i.playsinline&&(n.setAttribute("webkit-playsinline",""),n.setAttribute("playsinline","")),i.muted&&(n.setAttribute("muted",""),n.muted=!0),i.loop&&n.setAttribute("loop",""),i.autoPlay&&n.setAttribute("autoplay",""),mo(n,s,i.crossorigin);for(let o=0;o<e.length;++o){let{src:a,mime:l}=e[o];if(a=a||e[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const c=a.split("?").shift().toLowerCase(),f=c.slice(c.lastIndexOf(".")+1);l=l||FA.mimeTypes.get(f)||`video/${f}`}const h=document.createElement("source");h.src=a,l&&(h.type=l),n.appendChild(h)}e=n}super(e);u(this,"_spf",0);u(this,"_autoPlay",!1);u(this,"_sourceLoad");u(this,"_nextTime",0);u(this,"_connected",!1);u(this,"_requestId");u(this,"_resolve");u(this,"_reject");u(this,"_onPlayStart",()=>{this.valid||this._onCanPlay(),this._setupAutoUpdate()});u(this,"_onPlayStop",()=>{this._setupAutoUpdate()});u(this,"_onCanPlay",()=>{const e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);const t=this.valid;this._nextTime=0,this._updateSize(),this.requestUpload(),this._nextTime=0,!t&&this._resolve&&(this._resolve(this),this._sourceLoad=void 0,this._resolve=void 0,this._reject=void 0),this.isPlaying?this._onPlayStart():this._autoPlay&&e.play()});u(this,"_onError",e=>{this.source.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=void 0,this._resolve=void 0)});u(this,"_onSeeked",()=>{this.autoUpdate&&!this.isPlaying&&(this._nextTime=0,this.requestUpload(),this._nextTime=0)});u(this,"_videoFrameRequestCallback",()=>{this.requestUpload(),this._requestId=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)});u(this,"requestUpload",()=>{const e=Math.floor(xe.elapsed*this.source.playbackRate);this._nextTime-=e,(!this._spf||this._nextTime<=0)&&(super.requestUpload(),this._nextTime=this._spf||0)});this.fps=i.fps,this._autoPlay=i.autoPlay,i.autoPlay&&this.load(),this._setupAutoUpdate()}get isReady(){return this.source.readyState>2}get isPlaying(){return!this.source.paused&&!this.source.ended&&this.isReady}get duration(){return this.source.duration}get seeking(){return this.source.seeking}get currentTime(){return this.source.currentTime}set currentTime(e){this.source.currentTime=e}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"fps":this._spf=t?Math.floor(1e3/t):0,this._setupAutoUpdate();break;case"autoUpdate":this._setupAutoUpdate();break}}_setupAutoUpdate(){this.autoUpdate&&this.isPlaying?!this.fps&&this.source.requestVideoFrameCallback?(this._connected&&(xe.off(this.requestUpload),this._connected=!1,this._nextTime=0),this._requestId===void 0&&(this._requestId=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._requestId!==void 0&&(this.source.cancelVideoFrameCallback(this._requestId),this._requestId=void 0),this._connected||(xe.on(this.requestUpload),this._connected=!0,this._nextTime=0)):(this._requestId!==void 0&&(this.source.cancelVideoFrameCallback(this._requestId),this._requestId=void 0),this._connected&&(xe.off(this.requestUpload),this._connected=!1,this._nextTime=0))}async load(){if(!this._sourceLoad){const e=this.source;(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this.isReady?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._sourceLoad=new Promise((t,i)=>{this.valid?(this._sourceLoad=void 0,t(this)):(this._resolve=t,this._reject=i,e.load())})}return this._sourceLoad}free(){this._setupAutoUpdate();const e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load())}},u(FA,"mimeTypes",new Map(Object.entries({ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"}))),FA);fa([pe({default:!0})],Ys.prototype,"autoUpdate"),fa([pe({default:0})],Ys.prototype,"fps");let da=Ys;class zs extends Ks{}var Nc=Object.defineProperty,Fc=Object.getOwnPropertyDescriptor,vA=(r,A,e,t)=>{for(var i=t>1?void 0:t?Fc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Nc(A,e,i),i};const Ia={};function Tc(r){let A=Ia[r]??0;return A++,Ia[r]=A,A}g.Node=class extends Yt{constructor(e,t=[]){super();u(this,"_readyed",!1);u(this,"_tree");u(this,"_parent");u(this,"_children",[]);u(this,"_meta",new Map);this._onTreeEnter=this._onTreeEnter.bind(this),this._onTreeExit=this._onTreeExit.bind(this),this._onParented=this._onParented.bind(this),this._onUnparented=this._onUnparented.bind(this),this._onReady=this._onReady.bind(this),this._onProcess=this._onProcess.bind(this),this.setProperties({name:`${this.tag}:${Tc(this.tag)}`,...e}).append(t),this.on("treeEnter",this._onTreeEnter).on("treeExit",this._onTreeExit).on("parented",this._onParented).on("unparented",this._onUnparented).on("ready",this._onReady).on("process",this._onProcess)}setProperties(e){if(e){const{meta:t,...i}=e;if(t)for(const s in t)this.setMeta(s,t[s]);super.setProperties(i)}return this}getName(){return this.name}setName(e){return this.name=e,this}get tree(){return this.getTree()}set tree(e){this.setTree(e)}getTree(){return this._tree}getViewport(){var e;return(e=this._tree)==null?void 0:e.getCurrentViewport()}getWindow(){var e;return(e=this._tree)==null?void 0:e.root}isInsideTree(){return!!this._tree}setTree(e){const t=this._tree;if(!(e!=null&&e.is(t))){t&&this.emit("treeExit",t),this._tree=e,e&&this.emit("treeEnter",e);for(let i=this._children.length,s=0;s<i;s++){const n=this._children[s];!e&&this.emit("childExitingTree",n),n.setTree(e),e&&this.emit("childEnteredTree",n)}e&&(this.emit("treePostEnter",e),this._readyed||(this._readyed=!0,this.emit("ready")))}return this}get parent(){return this._parent}set parent(e){this.setParent(e)}hasParent(){return!!this._parent}getParent(){return this._parent}setParent(e){var t;if(!((t=this._parent)!=null&&t.is(e))){const i=this._parent;i&&this.emit("unparented",i),this._parent=e,e&&this.emit("parented",e),this.setTree(e==null?void 0:e._tree)}return this}get siblingIndex(){return this.getIndex()}set siblingIndex(e){var t;(t=this._parent)==null||t.moveChild(this,e)}get previousSibling(){var e;return(e=this._parent)==null?void 0:e.getChildren()[this.getIndex()-1]}get nextSibling(){var e;return(e=this._parent)==null?void 0:e.getChildren()[this.getIndex()+1]}get firstSibling(){var e;return(e=this._parent)==null?void 0:e.getChildren()[0]}get lastSibling(){var t;const e=(t=this._parent)==null?void 0:t.getChildren();return e?e[e.length-1]:void 0}hasMeta(e){return this._meta.has(e)}getMeta(e,t){return this._meta.get(e)??t}setMeta(e,t){this._meta.set(e,t)}deleteMeta(e){this._meta.delete(e)}clearMeta(){this._meta.clear()}canProcess(){var e;if(!this._tree)return!1;switch(this.processMode){case"inherit":return((e=this._parent)==null?void 0:e.canProcess())??!0;case"pausable":return!this._tree.processPaused;case"when_paused":return this._tree.processPaused;case"always":return!0;case"disabled":default:return!1}}canRender(){var e;if(!this._tree)return!1;switch(this.renderMode){case"inherit":return((e=this._parent)==null?void 0:e.canRender())??!0;case"always":return!0;case"disabled":default:return!1}}_update(e){super._update(e)}_updateProperty(e,t,i,s){super._updateProperty(e,t,i,s)}_onTreeEnter(e){this._treeEnter(e),this.emit("treeEntered",e)}_onTreeExit(e){this.emit("treeExiting",e),this._treeExit(e),this.emit("treeExited",e)}_onParented(e){this._parented(e)}_onUnparented(e){this._unparented(e)}_onReady(){this._ready()}_onProcess(e=0){const t=this._tree,i=this.canRender(),s=this.canProcess(),n=[],o=[];for(let l=this._children.length,h=0;h<l;h++){const c=this._children[h];switch(c.processSortMode){case"default":o.push(c);break;case"parent_before":n.push(c);break}}n.forEach(l=>{l.emit("process",e)}),s&&(t==null||t.emit("nodeProcessing",this),this.emit("processing",e),this._process(e));let a;if(i){const l=t.renderStack.push(this);a=t.renderStack.currentCall,t.renderStack.currentCall=l}if(this.mask instanceof g.Node)this.getNode("__$mask")||(this.mask.processMode="disabled",this.appendChild(this.mask,"front"));else{const l=this.getNode("__$mask");l&&this.removeChild(l)}o.forEach(l=>{l.emit("process",e)}),i&&(t.renderStack.currentCall=a),s&&(this.emit("processed",e),t==null||t.emit("nodeProcessed",this))}render(e,t){const i=this.mask;i&&(e.flush(),e.mask.push(this,i)),this._render(e),t==null||t(),i&&(e.flush(),e.mask.pop(this))}input(e,t){for(let i=this._children.length-1;i>=0;i--)this._children[i].input(e,t);this._input(e,t)}getChildren(e=!1){switch(e){case!0:return this._children;case!1:return this._children.filter(t=>t.internalMode==="default");default:return this._children.filter(t=>t.internalMode===e)}}getIndex(e=!1){var t;return((t=this._parent)==null?void 0:t.getChildren(e).indexOf(this))??0}getNode(e){return this._children.find(t=>t.name===e)}removeNode(e){var t;(t=this.getNode(e))==null||t.remove()}addSibling(e){return this.is(e)||!this.hasParent()||e.hasParent()?this:(e.internalMode=this.internalMode,this._parent.moveChild(e,this.getIndex(!0)+1),this)}prepend(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(i=>{this.moveChild(i,0)})}append(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(i=>{this.appendChild(i)})}before(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(i=>{var s;(s=this._parent)==null||s.moveChild(i,this.getIndex(!0))})}after(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(i=>{var s;(s=this._parent)==null||s.moveChild(i,this.getIndex(!0)+1)})}insertBefore(e,t){return!t.hasParent()||!this.is(t.parent)||this.moveChild(e,t.getIndex(!0)),e}appendChild(e,t=e.internalMode){if(this.is(e)||e.hasParent())return e;switch(t){case"default":case"front":{const i=t==="default"?"back":"front",s=this._children.findIndex(n=>n.internalMode===i);s>-1?this._children.splice(s,0,e):this._children.push(e);break}case"back":this._children.push(e);break}return e.internalMode=t,e.setParent(this),this.emit("appendChild",e),e}moveChild(e,t,i=e.internalMode){if(this.is(e)||e.hasParent()&&!this.is(e.parent))return this;e.internalMode=i;const s=this._children.indexOf(e);let n=this._children.findIndex(l=>{switch(i){case"default":return l.internalMode!=="front";case"back":return l.internalMode==="back";case"front":default:return!0}});n=n>-1?n:Math.max(0,this._children.length-1);let o=this._children.slice(n).findIndex(l=>{switch(i){case"front":return l.internalMode!=="front";case"default":return l.internalMode==="back";case"back":default:return!1}});o=o>-1?n+o:Math.max(0,this._children.length);const a=St(n,t>-1?t:o,o);return a!==s&&(s>-1&&this._children.splice(s,1),e.setParent(this),a>-1&&a<this._children.length?this._children.splice(a,0,e):this._children.push(e),s>-1?this.emit("moveChild",e,a,s):this.emit("appendChild",e)),this}removeChild(e){const t=e.getIndex(!0);return this.is(e.parent)&&t>-1&&(this._children.splice(t,1),e.setParent(void 0),this.emit("removeChild",e,t)),e}removeChildren(){this.getChildren().forEach(e=>this.removeChild(e))}remove(){var e;(e=this._parent)==null||e.removeChild(this)}forEachChild(e){return this.getChildren().forEach(e),this}forEachDescendant(e){return this.getChildren().forEach(t=>{e(t),t.forEachDescendant(e)}),this}_ready(){}_treeEnter(e){}_treeExit(e){}_parented(e){}_unparented(e){}_process(e){}_input(e,t){}_render(e){}clone(){return new this.constructor(this.toJSON().props,this.getChildren(!0))}toJSON(){return{tag:this.tag,props:{name:this.name,...super.toJSON()},meta:Object.fromEntries(this._meta.entries()),children:this.getChildren().map(e=>e.toJSON())}}static parse(e){if(Array.isArray(e))return e.map(a=>this.parse(a));const{tag:t,props:i,children:s}=e,n=lr.get(t)??g.Node,o=new n(i);return s==null||s.forEach(a=>o.appendChild(this.parse(a))),o}},vA([pe()],g.Node.prototype,"name",2),vA([b()],g.Node.prototype,"mask",2),vA([b({default:"inherit"})],g.Node.prototype,"processMode",2),vA([b({default:"default"})],g.Node.prototype,"processSortMode",2),vA([b({default:"inherit"})],g.Node.prototype,"renderMode",2),vA([b({default:"default"})],g.Node.prototype,"internalMode",2),g.Node=vA([ne("Node")],g.Node);var Lc=Object.defineProperty,Gc=Object.getOwnPropertyDescriptor,_i=(r,A,e,t)=>{for(var i=t>1?void 0:t?Gc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Lc(A,e,i),i};g.TimelineNode=class extends g.Node{constructor(e,t=[]){super();u(this,"computedDuration",0);u(this,"_currentTime",0);u(this,"_startTime",0);this.setProperties(e).append(t)}get timeline(){var e;return(e=this._tree)==null?void 0:e.timeline}get timelineCurrentTime(){var e;return((e=this.timeline)==null?void 0:e.currentTime)??0}get parentStartTime(){var e;return((e=this._parent)==null?void 0:e.startTime)??0}get currentTime(){return St(0,this._currentTime,this.computedDuration)}get startTime(){return this._startTime}set startTime(e){this.delay=e-this.parentStartTime,this._updateCurrentTime(!0)}get endTime(){return this._startTime+this.computedDuration}get currentTimeProgress(){return this.computedDuration?St(0,this._currentTime/this.computedDuration,1):0}isInsideTimeRange(){const e=this._currentTime;return this.computedDuration?e>=0&&e<=this.computedDuration:e>=0}_updateCurrentTime(e=!1){if(e||!this.paused){const t=this._parent;this._startTime=this.delay+this.parentStartTime,this.computedDuration=t!=null&&t.computedDuration?Math.min(this._startTime+this.duration,t.endTime)-this._startTime:this.duration,this._currentTime=this.timelineCurrentTime-this._startTime,this.emit("updateCurrentTime",this._currentTime),this.insideTimeRange=this.isInsideTimeRange()}}_process(e){super._process(e),this._updateCurrentTime()}},_i([b({default:0})],g.TimelineNode.prototype,"delay",2),_i([b({default:0})],g.TimelineNode.prototype,"duration",2),_i([b({default:!1})],g.TimelineNode.prototype,"paused",2),_i([pe()],g.TimelineNode.prototype,"insideTimeRange",2),g.TimelineNode=_i([ne("TimelineNode")],g.TimelineNode);var Oc=Object.defineProperty,Hc=Object.getOwnPropertyDescriptor,Di=(r,A,e,t)=>{for(var i=t>1?void 0:t?Hc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Oc(A,e,i),i};g.Viewport=class extends g.Node{constructor(e=!1){super();u(this,"_projection",new Ko);u(this,"_framebufferIndex",0);u(this,"_framebuffers",[{texture:new zs,needsUpload:!1},{texture:new zs,needsUpload:!1}]);this.flipY=e,this._projection.flipY(e)}get valid(){return!!(this.width&&this.height)}get framebuffer(){return this._framebuffers[this._framebufferIndex]}get texture(){return this.framebuffer.texture}_glFramebufferOptions(e){const{width:t,height:i}=this,{pixelRatio:s}=e;return this._framebuffers.forEach(n=>{const o=n.texture;o.width=t,o.height=i,o.pixelRatio=s,o.upload(e)}),{width:t,height:i,colorTextures:[this.texture._glTexture(e)]}}_glFramebuffer(e){return e.getRelated(this.framebuffer,()=>e.framebuffer.create(this._glFramebufferOptions(e)))}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"x":case"y":this.requestUpload(),this._projection.translate(this.x,this.y),this.emit("updateRect");break;case"width":case"height":this.requestUpload(),this._projection.resize(this.width,this.height),this.emit("updateRect");break}}requestUpload(){this._framebuffers.forEach(e=>e.needsUpload=!0)}resize(e,t){this.width=e,this.height=t}upload(e){const t=this.framebuffer;return t.needsUpload&&this.valid?(t.needsUpload=!1,e.framebuffer.update(this._glFramebuffer(e),this._glFramebufferOptions(e)),!0):!1}activate(e){var t;return this.valid?(e.flush(),(t=this._tree)==null||t.setCurrentViewport(this),this.upload(e),e.framebuffer.bind(this._glFramebuffer(e)),!0):!1}redraw(e,t){if(this.valid){e.flush();const i=this.framebuffer.texture;return this._framebufferIndex=(this._framebufferIndex+1)%this._framebuffers.length,this.activate(e),e.clear(),i.activate(e,0),t(),!0}return!1}activateWithCopy(e,t){this.resize(t.width,t.height),this.activate(e)&&(e.clear(),t.texture.activate(e,0),ue.draw(e,JA.instance,{sampler:0}))}render(e,t){var s,n;const i=(s=this._tree)==null?void 0:s.getCurrentViewport();this.activate(e),e.clear(),super.render(e,t),e.flush(),i?i.activate(e):(e.framebuffer.bind(null),(n=this._tree)==null||n.setCurrentViewport(void 0))}getRect(){return new Os(this.x,this.y,this.width,this.height)}toProjectionArray(e=!1){return this._projection.toArray(e)}},Di([b({default:0})],g.Viewport.prototype,"x",2),Di([b({default:0})],g.Viewport.prototype,"y",2),Di([b({default:0})],g.Viewport.prototype,"width",2),Di([b({default:0})],g.Viewport.prototype,"height",2),g.Viewport=Di([ne("Viewport")],g.Viewport);var Jc=Object.defineProperty,Kc=Object.getOwnPropertyDescriptor,bi=(r,A,e,t)=>{for(var i=t>1?void 0:t?Kc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&Jc(A,e,i),i};g.Effect=class extends g.TimelineNode{constructor(e,t=[]){super();u(this,"viewport1",new g.Viewport);u(this,"viewport2",new g.Viewport);u(this,"_renderId",0);u(this,"_renderViewport");u(this,"_previousSibling");u(this,"_nextSibling");this._onProcessing=this._onProcessing.bind(this),this._onNodeProcessed=this._onNodeProcessed.bind(this),this.setProperties(e).append(t)}get _effectMode(){return this.effectMode??"parent"}_updateProperty(e,t,i,s){switch(super._updateProperty(e,t,i,s),e){case"glsl":{const n=new pr(t);!this.effectMode&&n.has.transition&&(this.effectMode="transition"),this.material=n;break}case"glslSrc":{t?Lt.text.load(t).then(n=>this.glsl=n):this.glsl="";break}}}_treeEnter(e){e.on("processing",this._onProcessing),e.on("nodeProcessed",this._onNodeProcessed),this.viewport1.setTree(e),this.viewport2.setTree(e)}_treeExit(e){e.off("processing",this._onProcessing),e.off("nodeProcessed",this._onNodeProcessed),this.viewport1.setTree(void 0),this.viewport2.setTree(void 0)}_onProcessing(){if(this.canProcess())switch(this._updateCurrentTime(),this._effectMode){case"transition":this._previousSibling=this.previousSibling,this._nextSibling=this.nextSibling;break;default:this._previousSibling=void 0,this._nextSibling=void 0;break}}_onNodeProcessed(e){var i;if(!this.canProcess()||!this.isInsideTimeRange())return;const t=(i=this._tree)==null?void 0:i.renderStack;if(t)switch(this._effectMode){case"transition":e.is(this._previousSibling)?(this._previousSibling=void 0,t.push(this)):e.is(this._nextSibling)&&(this._nextSibling=void 0,t.push(this));break}}_processParent(){var o,a;const e=(o=this._tree)==null?void 0:o.renderStack;if(!e)return;const t=(a=e.currentCall)==null?void 0:a.parentCall;if(!t)return;const i=t.calls;let s,n;i.forEach((l,h)=>{var c;(l.renderable.is(this._parent)||(c=l.renderable.parent)!=null&&c.is(this._parent))&&(s=s??h,n=h)}),!(s===void 0||n===void 0)&&(i.splice(n+1,0,e.createCall(this)),i.splice(s,0,e.createCall(this)))}_processChildren(){var e;this._children.length&&(super.emit("process"),(e=this._tree)==null||e.renderStack.push(this))}_onProcess(e=0){if(this.canProcess())switch(this._renderId=0,this._effectMode){case"before":super._onProcess(e);break;case"parent":this._processParent();break;case"children":this._processChildren();break}}_renderBefore(e){var i;const t=(i=this._tree)==null?void 0:i.getCurrentViewport();t&&this.apply(e,t,{redraw:!0})}_renderTransition(e){var t;if(this._renderId%2===0)this._renderViewport=(t=this._tree)==null?void 0:t.getCurrentViewport(),this._renderViewport&&(this.viewport1.activateWithCopy(e,this._renderViewport),this.viewport2.resize(this._renderViewport.width,this._renderViewport.height)),this.viewport2.activate(e),e.clear();else{const i=this._renderViewport;this._renderViewport=void 0,i&&(i.activate(e),e.clear(),this.viewport1.texture.activate(e,0),this.viewport2.texture.activate(e,1),this.apply(e,i,{from:this.viewport1,to:this.viewport2}),e.texture.unbind(0),e.texture.unbind(1))}}_renderParentOrChildren(e){var t;if(this._renderId%2===0)this._renderViewport=(t=this._tree)==null?void 0:t.getCurrentViewport(),this._renderViewport&&this.viewport1.resize(this._renderViewport.width,this._renderViewport.height),this.viewport1.activate(e),e.clear();else{const i=this._renderViewport;this._renderViewport=void 0,i&&(this.viewport1.activate(e),this.apply(e,this.viewport1,{redraw:!0,target:this._effectMode==="parent"?this._parent??void 0:void 0,targetArea:this._parseTargetArea()}),i.activate(e),this.viewport1.texture.activate(e,0),ue.draw(e))}}_parseTargetArea(){if(this._effectMode==="parent"&&this._parent&&"getRect"in this._parent){const e=this._parent.getRect();if(e)return[e.left/this.viewport1.width,e.top/this.viewport1.height,e.width/this.viewport1.width,e.height/this.viewport1.height]}}_render(e){switch(this._effectMode){case"before":this._renderBefore(e);break;case"transition":this._renderTransition(e);break;case"parent":case"children":default:this._renderParentOrChildren(e);break}this._renderId++}apply(e,t,i){this.material&&(i!=null&&i.redraw?t.redraw(e,()=>{ue.draw(e,this.material,{from:0,to:1,progress:this.currentTimeProgress,ratio:t.width/t.height})}):ue.draw(e,this.material,{from:0,to:1,progress:this.currentTimeProgress,ratio:i!=null&&i.from?i.from.width/i.from.height:0}))}},bi([pe()],g.Effect.prototype,"material",2),bi([b()],g.Effect.prototype,"effectMode",2),bi([b({default:""})],g.Effect.prototype,"glsl",2),bi([b({default:""})],g.Effect.prototype,"glslSrc",2),g.Effect=bi([ne("Effect")],g.Effect);var pa=Object.defineProperty,Yc=Object.getOwnPropertyDescriptor,zc=(r,A,e)=>A in r?pa(r,A,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[A]=e,Xt=(r,A,e,t)=>{for(var i=t>1?void 0:t?Yc(A,e):A,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(t?n(A,e,i):n(i))||i);return t&&i&&pa(A,e,i),i},Wc=(r,A,e)=>zc(r,A+"",e);g.ColorAdjustEffect=class extends g.Effect{constructor(A,e=[]){super(),this.setProperties(A).append(e)}apply(A,e){e.redraw(A,()=>{ue.draw(A,g.ColorAdjustEffect.material,{sampler:0,saturation:this.saturation,contrast:this.contrast,brightness:this.brightness,red:this.red,green:this.green,blue:this.blue,alpha:this.alpha,gamma:Math.max(this.gamma??1,1e-4)})})}},Wc(g.ColorAdjustEffect,"material",new Ee({vert:`precision mediump float;
|
|
114
114
|
attribute vec2 position;
|
|
115
115
|
attribute vec2 uv;
|
|
116
116
|
varying vec2 vUv;
|
package/dist/index.mjs
CHANGED
|
@@ -5655,6 +5655,10 @@ class GradientTexture extends Texture2D {
|
|
|
5655
5655
|
return this.regExp.test(value);
|
|
5656
5656
|
}
|
|
5657
5657
|
constructor(value, width, height) {
|
|
5658
|
+
if (width === Infinity)
|
|
5659
|
+
width = 0;
|
|
5660
|
+
if (height === Infinity)
|
|
5661
|
+
height = 0;
|
|
5658
5662
|
super(
|
|
5659
5663
|
LinearGradient.from(value).parse(width, height)
|
|
5660
5664
|
);
|