UNPKG

@omnimedia/omnitool

Version:

open source video processing tools

3 lines (2 loc) 39.3 kB
import{D as y,E as ce,H as fe,J as pe,N as me,d as S,e as b,f as ie,g as re,h as se,i as ne,j as he,k as a,l as oe,m as w,o as m,p as O,q as ae,r as g,t as x,u as le,v as de,w as L,y as ue,z as k}from"./chunk-ERLCDDYH.js";var G=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}};var U=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let t=0;t<this._tests.length;t++){let r=this._tests[t];if(r.test(e))return g.get(r.maskClass,e)}return e}returnMaskEffect(e){g.return(e)}},B=new U;b.handleByList(S.MaskEffect,B._effectClasses);var c=g.getPool(a),_=g.getPool(x);function _e(i,e,t){t.clear();let r,s;return i.parent?e?r=i.parent.worldTransform:(s=c.get().identity(),r=v(i,s)):r=a.IDENTITY,ge(i,t,r,e),s&&c.return(s),t.isValid||t.set(0,0,0,0),t}function ge(i,e,t,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=c.get(),s.appendFrom(i.localTransform,t));let n=e,h=!!i.effects.length;if(h&&(e=_.get().clear()),i.boundsArea)e.addRect(i.boundsArea,s);else{let o=i.bounds;o&&!o.isEmpty()&&(e.matrix=s,e.addBounds(o));for(let l=0;l<i.children.length;l++)ge(i.children[l],e,s,r)}if(h){for(let o=0;o<i.effects.length;o++)i.effects[o].addBounds?.(e);n.addBounds(e,a.IDENTITY),_.return(e)}r||c.return(s)}function v(i,e){let t=i.parent;return t&&(v(t,e),t.updateLocalTransform(),e.append(t.localTransform)),e}var xe=16777215;function N(i,e){return i===xe?e:e===xe?i:le(i,e)}function M(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var ye={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,t=this.parent;for(;t;)e*=t.alpha,t=t.parent;return e},getGlobalTransform(i=new a,e){if(e)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let t=v(this,c.get().identity());return i.appendFrom(this.localTransform,t),c.return(t),i},getGlobalTint(i){if(i)return this.renderGroup?M(this.renderGroup.worldColor):this.parentRenderGroup?M(N(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,t=this.parent;for(;t;)e=N(e,t.localColor),t=t.parent;return M(e)}};var ze=0,V=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this.textureStyle=new ue(this.textureOptions)}createTexture(e,t,r,s){let n=new k({...this.textureOptions,width:e,height:t,resolution:1,antialias:r,autoGarbageCollect:!1,autoGenerateMipmaps:s});return new y({source:n,label:`texturePool_${ze++}`})}getOptimalTexture(e,t,r=1,s,n=!1){let h=Math.ceil(e*r-1e-6),o=Math.ceil(t*r-1e-6);h=L(h),o=L(o);let l=s?1:0,p=n?1:0,C=(h<<17)+(o<<2)+(p<<1)+l;this._texturePool[C]||(this._texturePool[C]=[]);let d=this._texturePool[C].pop();return d||(d=this.createTexture(h,o,s,n)),d.source._resolution=r,d.source.width=h/r,d.source.height=o/r,d.source.pixelWidth=h,d.source.pixelHeight=o,d.frame.x=0,d.frame.y=0,d.frame.width=e,d.frame.height=t,d.updateUvs(),this._poolKeyHash[d.uid]=C,d}getSameSizeTexture(e,t=!1){let r=e.source;return this.getOptimalTexture(e.width,e.height,r._resolution,t)}returnTexture(e,t=!1){let r=this._poolKeyHash[e.uid];t&&(e.source.style=this.textureStyle),this._texturePool[r].push(e)}clear(e){if(e=e!==!1,e)for(let t in this._texturePool){let r=this._texturePool[t];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}},z=new V;ae.register(z);var A=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new a,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new de,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;let t=e.children;for(let r=0;r<t.length;r++){let s=t[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(z.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;let e=this._parentCacheAsTextureRenderGroup;e&&!e.textureNeedsUpdate&&e.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(let e in this.childrenToUpdate){let t=this.childrenToUpdate[e];t.list.fill(null),t.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){let t=this.renderGroupChildren.indexOf(e);t>-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);let t=e.children;for(let r=0;r<t.length;r++)this.addChild(t[r])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}let t=e.children;for(let r=0;r<t.length;r++)this.removeChild(t[r])}removeChildren(e){for(let t=0;t<e.length;t++)this.removeChild(e[t])}onChildUpdate(e){let t=this.childrenToUpdate[e.relativeRenderGroupDepth];t||(t=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),t.list[t.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender(e)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(e=[]){let t=this.root.children;for(let r=0;r<t.length;r++)this._getChildren(t[r],e);return e}_getChildren(e,t=[]){if(t.push(e),e.renderGroup)return t;let r=e.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],t);return t}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new a),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new a),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new a),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}};var Ce={cullArea:null,cullable:!1,cullableChildren:!0};var u=class i{constructor(e,t,r){this._x=t||0,this._y=r||0,this._observer=e}clone(e){return new i(e??this._observer,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}};var we={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){m("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}};function Te(i,e,t){let r=i.length,s;if(e>=r||t===0)return;t=e+t>r?r-e:t;let n=r-t;for(s=e;s<n;++s)i[s]=i[s+t];i.length=n}var be={allowChildren:!0,removeChildren(i=0,e){let t=e??this.children.length,r=t-i,s=[];if(r>0&&r<=t){for(let h=t-1;h>=i;h--){let o=this.children[h];o&&(s.push(o),o.parent=null)}Te(this.children,i,t);let n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(s);for(let h=0;h<s.length;++h){let o=s[h];o.parentRenderLayer?.detach(o),this.emit("childRemoved",o,this,h),s[h].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let e=this.getChildAt(i);return this.removeChild(e)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,e)},getChildIndex(i){let e=this.children.indexOf(i);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(i,e){this.allowChildren||m(w,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:t}=this;if(e<0||e>t.length)throw new Error(`${i}addChildAt: The index ${e} supplied is out of bounds ${t.length}`);let r=i.parent===this;if(i.parent){let n=i.parent.children.indexOf(i);if(r){if(n===e)return i;i.parent.children.splice(n,1)}else i.removeFromParent()}e===t.length?t.push(i):t.splice(e,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let s=this.renderGroup||this.parentRenderGroup;return s&&s.addChild(i),this.sortableChildren&&(this.sortDirty=!0),r||(this.emit("childAdded",i,this,e),i.emit("added",this)),i},swapChildren(i,e){if(i===e)return;let t=this.getChildIndex(i),r=this.getChildIndex(e);this.children[t]=e,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(e=>this.reparentChildAt(e,this.children.length)),i[0])},reparentChildAt(i,e){if(i.parent===this)return this.setChildIndex(i,e),i;let t=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,e);let r=this.worldTransform.clone();return r.invert(),t.prepend(r),i.setFromMatrix(t),i},replaceChild(i,e){i.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(i)),e.setFromMatrix(i.localTransform),e.updateLocalTransform(),this.removeChild(i)}};var Ge={collectRenderables(i,e,t){this.parentRenderLayer&&this.parentRenderLayer!==t||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,e,t):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,e,t))},collectRenderablesSimple(i,e,t){let r=this.children,s=r.length;for(let n=0;n<s;n++)r[n].collectRenderables(i,e,t)},collectRenderablesWithEffects(i,e,t){let{renderPipes:r}=e;for(let s=0;s<this.effects.length;s++){let n=this.effects[s];r[n.pipe].push(n,this,i)}this.collectRenderablesSimple(i,e,t);for(let s=this.effects.length-1;s>=0;s--){let n=this.effects[s];r[n.pipe].pop(n,this,i)}}};var Me={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((t,r)=>t.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(i){let e=this.effects.indexOf(i);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(i){let e=this._maskEffect;e?.mask!==i&&(e&&(this.removeEffect(e),B.returnMaskEffect(e),this._maskEffect=null),i!=null&&(this._maskEffect=B.getMaskEffect(i),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let e=this._filterEffect||(this._filterEffect=new G);i=i;let t=i?.length>0,r=e.filters?.length>0,s=t!==r;i=Array.isArray(i)?i.slice(0):i,e.filters=Object.freeze(i),s&&(t?this.addEffect(e):(this.removeEffect(e),e.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new G),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}};var Re={label:null,get name(){return m(w,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){m(w,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,e=!1){return this.getChildByLabel(i,e)},getChildByLabel(i,e=!1){let t=this.children;for(let r=0;r<t.length;r++){let s=t[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(e)for(let r=0;r<t.length;r++){let n=t[r].getChildByLabel(i,!0);if(n)return n}return null},getChildrenByLabel(i,e=!1,t=[]){let r=this.children;for(let s=0;s<r.length;s++){let n=r[s];(n.label===i||i instanceof RegExp&&i.test(n.label))&&t.push(n)}if(e)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,!0,t);return t}};var He=new a,Se={getFastGlobalBounds(i,e){e||(e=new x),e.clear(),this._getGlobalBoundsRecursive(!!i,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);let t=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(t.worldTransform),e},_getGlobalBoundsRecursive(i,e,t){let r=e;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==t||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=_.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let h=this.bounds;r.addFrame(h.minX,h.minY,h.maxX,h.maxY,this.groupTransform)}let n=this.children;for(let h=0;h<n.length;h++)n[h]._getGlobalBoundsRecursive(i,r,t)}if(s){let n=!1,h=this.renderGroup||this.parentRenderGroup;for(let o=0;o<this.effects.length;o++)this.effects[o].addBounds&&(n||(n=!0,r.applyMatrix(h.worldTransform)),this.effects[o].addBounds(r,!0));n&&r.applyMatrix(h.worldTransform.copyTo(He).invert()),e.addBounds(r),_.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),_.return(r))}};function ke(i,e,t){return e.clear(),t||(t=a.IDENTITY),Be(i,e,t,i,!0),e.isValid||e.set(0,0,0,0),e}function Be(i,e,t,r,s){let n;if(s)n=c.get(),n=t.copyTo(n);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let l=i.localTransform;n=c.get(),n.appendFrom(l,t)}let h=e,o=!!i.effects.length;if(o&&(e=_.get().clear()),i.boundsArea)e.addRect(i.boundsArea,n);else{i.renderPipeId&&(e.matrix=n,e.addBounds(i.bounds));let l=i.children;for(let p=0;p<l.length;p++)Be(l[p],e,n,r,!1)}if(o){for(let l=0;l<i.effects.length;l++)i.effects[l].addLocalBounds?.(e,r);h.addBounds(e,a.IDENTITY),_.return(e)}c.return(n)}function H(i,e){let t=i.children;for(let r=0;r<t.length;r++){let s=t[r],n=s.uid,h=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,o=e.index;(e.data[o]!==n||e.data[o+1]!==h)&&(e.data[e.index]=n,e.data[e.index+1]=h,e.didChange=!0),e.index=o+2,s.children.length&&H(s,e)}return e.didChange}var We=new a,ve={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,e){let t=Math.sign(this.scale.x)||1;e!==0?this.scale.x=i/e*t:this.scale.x=t},_setHeight(i,e){let t=Math.sign(this.scale.y)||1;e!==0?this.scale.y=i/e*t:this.scale.y=t},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new x});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),H(this,i),i.didChange&&ke(this,i.localBounds,We),i.localBounds},getBounds(i,e){return _e(this,i,e||new x)}};var Ae={_onRender:null,set onRender(i){let e=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}};var Fe={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(Ye))}};function Ye(i,e){return i._zIndex-e._zIndex}var Pe={getGlobalPosition(i=new he,e=!1){return this.parent?this.parent.toGlobal(this._position,i,e):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,e,t=!1){let r=this.getGlobalTransform(c.get(),t);return e=r.apply(i,e),c.return(r),e},toLocal(i,e,t,r){e&&(i=e.toGlobal(i,t,r));let s=this.getGlobalTransform(c.get(),r);return t=s.applyInverse(i,t),c.return(s),t}};function Ie(i,e,t={}){for(let r in e)!t[r]&&e[r]!==void 0&&(i[r]=e[r])}var W=new u(null),F=new u(null),Y=new u(null,1,1),P=new u(null),Ee=1,Xe=2,X=4;var R=class i extends ie{constructor(e={}){super(),this.uid=oe("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new a,this.relativeGroupTransform=new a,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new u(this,0,0),this._scale=Y,this._pivot=F,this._origin=P,this._skew=W,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],Ie(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(t=>this.addChild(t)),e.parent?.addChild(this)}static mixin(e){m("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),b.mixin(i,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||m(w,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let s=0;s<e.length;s++)this.addChild(e[s]);return e[0]}let t=e[0],r=this.renderGroup||this.parentRenderGroup;return t.parent===this?(this.children.splice(this.children.indexOf(t),1),this.children.push(t),r&&(r.structureDidChange=!0),t):(t.parent&&t.parent.removeChild(t),this.children.push(t),this.sortableChildren&&(this.sortDirty=!0),t.parent=this,t.didChange=!0,t._updateFlags=15,r&&r.addChild(t),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this),this._didViewChangeTick++,t._zIndex!==0&&t.depthOfChildModified(),t)}removeChild(...e){if(e.length>1){for(let s=0;s<e.length;s++)this.removeChild(e[s]);return e[0]}let t=e[0],r=this.children.indexOf(t);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(t):this.parentRenderGroup&&this.parentRenderGroup.removeChild(t),t.parentRenderLayer&&t.parentRenderLayer.detach(t),t.parent=null,this.emit("childRemoved",t,this,r),t.emit("removed",this)),t}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=g.get(A,this),this.groupTransform=a.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),g.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new a),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*se}set angle(e){this.rotation=e*ne}get pivot(){return this._pivot===F&&(this._pivot=new u(this,0,0)),this._pivot}set pivot(e){this._pivot===F&&(this._pivot=new u(this,0,0),this._origin!==P&&O("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===W&&(this._skew=new u(this,0,0)),this._skew}set skew(e){this._skew===W&&(this._skew=new u(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Y&&(this._scale=new u(this,1,1)),this._scale}set scale(e){this._scale===Y&&(this._scale=new u(this,0,0)),typeof e=="string"&&(e=parseFloat(e)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get origin(){return this._origin===P&&(this._origin=new u(this,0,0)),this._origin}set origin(e){this._origin===P&&(this._origin=new u(this,0,0),this._pivot!==F&&O("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._origin.set(e):this._origin.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let t=this.getLocalBounds().width;this._setWidth(e,t)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let t=this.getLocalBounds().height;this._setHeight(e,t)}getSize(e){e||(e={});let t=this.getLocalBounds();return e.width=Math.abs(this.scale.x*t.width),e.height=Math.abs(this.scale.y*t.height),e}setSize(e,t){let r=this.getLocalBounds();typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,r.width),t!==void 0&&this._setHeight(t,r.height)}_updateSkew(){let e=this._rotation,t=this._skew;this._cx=Math.cos(e+t._y),this._sx=Math.sin(e+t._y),this._cy=-Math.sin(e-t._x),this._sy=Math.cos(e-t._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this.origin.set(typeof e.originX=="number"?e.originX:this.origin.x,typeof e.originY=="number"?e.originY:this.origin.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;let t=this.localTransform,r=this._scale,s=this._pivot,n=this._origin,h=this._position,o=r._x,l=r._y,p=s._x,C=s._y,d=-n._x,D=-n._y;t.a=this._cx*o,t.b=this._sx*o,t.c=this._cy*l,t.d=this._sy*l,t.tx=h._x-(p*t.a+C*t.c)+(d*t.a+D*t.c)-d,t.ty=h._y-(p*t.b+C*t.d)+(d*t.b+D*t.d)-D}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=Ee,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let r=re.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Ee,this._onUpdate())}get tint(){return M(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Xe,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let t=e?2:0;(this.localDisplayStatus&2)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=X,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",e))}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let t=e?0:4;(this.localDisplayStatus&4)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=X,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let t=e?1:0;(this.localDisplayStatus&1)!==t&&(this._updateFlags|=X,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0;let t;if(this.children.length&&(t=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof e=="boolean"?e:e?.children)&&t)for(let s=0;s<t.length;++s)t[s].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}};b.mixin(R,be,Se,Pe,Ae,ve,Me,Re,Fe,Ce,we,ye,Ge);function De(i,e,t){let{width:r,height:s}=t.orig,n=t.trim;if(n){let h=n.width,o=n.height;i.minX=n.x-e._x*r,i.maxX=i.minX+h,i.minY=n.y-e._y*s,i.maxY=i.minY+o}else i.minX=-e._x*r,i.maxX=i.minX+r,i.minY=-e._y*s,i.maxY=i.minY+s}var I=class extends R{constructor(e){super(e),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new x(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=e.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){let t=this.bounds,{x:r,y:s}=e;return r>=t.minX&&r<=t.maxX&&s>=t.minY&&s<=t.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}unload(){this.emit("unload",this);for(let e in this._gpuData)this._gpuData[e]?.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(e){this.unload(),super.destroy(e),this._bounds=null}collectRenderablesSimple(e,t,r){let{renderPipes:s}=t;s.blendMode.pushBlendMode(this,this.groupBlendMode,e);let h=s[this.renderPipeId];h?.addRenderable&&h.addRenderable(this,e),this.didViewUpdate=!1;let o=this.children,l=o.length;for(let p=0;p<l;p++)o[p].collectRenderables(e,t,r);s.blendMode.popBlendMode(e)}};var Oe=class i extends I{constructor(e=y.EMPTY){e instanceof y&&(e={texture:e});let{texture:t=y.EMPTY,anchor:r,roundPixels:s,width:n,height:h,...o}=e;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new u({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:t.defaultAnchor&&(this.anchor=t.defaultAnchor),this.texture=t,this.allowChildren=!1,this.roundPixels=s??!1,n!==void 0&&(this.width=n),h!==void 0&&(this.height=h)}static from(e,t=!1){return e instanceof y?new i(e):new i(y.from(e,t))}set texture(e){e||(e=y.EMPTY);let t=this._texture;t!==e&&(t&&t.dynamic&&t.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return De(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return m("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let e=this._anchor,t=this._texture,r=this._bounds,{width:s,height:n}=t.orig;r.minX=-e._x*s,r.maxX=r.minX+s,r.minY=-e._y*n,r.maxY=r.minY+n}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e?.texture){let r=typeof e=="boolean"?e:e?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),t!==void 0&&this._setHeight(t,this._texture.orig.height)}};var q=class extends k{constructor(e){e.resource||(e.resource=ce.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(e=this.width,t=this.height,r=this._resolution){let s=super.resize(e,t,r);return s&&this.resizeCanvas(),s}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};q.extension=S.TextureSource;var qe={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},$=0,j=1,K=2,Q=3,J=4,Z=5,ee=class Le{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<$)}set blend(e){!!(this.data&1<<$)!==e&&(this.data^=1<<$)}get offsets(){return!!(this.data&1<<j)}set offsets(e){!!(this.data&1<<j)!==e&&(this.data^=1<<j)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<K)}set culling(e){!!(this.data&1<<K)!==e&&(this.data^=1<<K)}get depthTest(){return!!(this.data&1<<Q)}set depthTest(e){!!(this.data&1<<Q)!==e&&(this.data^=1<<Q)}get depthMask(){return!!(this.data&1<<Z)}set depthMask(e){!!(this.data&1<<Z)!==e&&(this.data^=1<<Z)}get clockwiseFrontFace(){return!!(this.data&1<<J)}set clockwiseFrontFace(e){!!(this.data&1<<J)!==e&&(this.data^=1<<J)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=qe[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let e=new Le;return e.depthTest=!1,e.blend=!0,e}};ee.default2d=ee.for2d();var Ue=ee;var E=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(E||{});var T=class{constructor(e,t=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=t,this.priority=r,this._once=s}match(e,t=null){return this._fn===e&&this._context===t}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));let t=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let t=this.next;return this.next=e?null:t,this.previous=null,t}};var Ne=class f{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new T(null,null,1/0),this.deltaMS=1/f.targetFPMS,this.elapsedMS=1/f.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,r=E.NORMAL){return this._addListener(new T(e,t,r))}addOnce(e,t,r=E.NORMAL){return this._addListener(new T(e,t,r,!0))}_addListener(e){let t=this._head.next,r=this._head;if(!t)e.connect(r);else{for(;t;){if(e.priority>t.priority){e.connect(r);break}r=t,t=t.next}e.previous||e.connect(r)}return this._startIfPossible(),this}remove(e,t){let r=this._head.next;for(;r;)r.match(e,t)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){let n=e-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=e-n%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*f.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){let t=Math.min(Math.max(0,e)/1e3,f.targetFPMS);this._maxElapsedMS=1/t,this._minElapsedMS&&e>this.maxFPS&&(this.maxFPS=e)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){e===0?this._minElapsedMS=0:(e<this.minFPS&&(this.minFPS=e),this._minElapsedMS=1/(e/1e3))}static get shared(){if(!f._shared){let e=f._shared=new f;e.autoStart=!0,e._protected=!0}return f._shared}static get system(){if(!f._system){let e=f._system=new f;e.autoStart=!0,e._protected=!0}return f._system}};Ne.targetFPMS=.06;var Xi=Ne;var Ve=class te extends me{constructor(e){e={...te.defaultOptions,...e},super(e),this.enabled=!0,this._state=Ue.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1),e.blendRequired&&this.addResource("uBackTexture",0,3)}apply(e,t,r,s){e.applyFilter(this,t,r,s)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:t,gl:r,...s}=e,n,h;return t&&(n=pe.from(t)),r&&(h=fe.from(r)),new te({gpuProgram:n,glProgram:h,...s})}};Ve.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};var Ji=Ve;export{u as a,Te as b,G as c,c as d,_ as e,_e as f,N as g,M as h,ke as i,z as j,A as k,Ee as l,Xe as m,X as n,R as o,E as p,Xi as q,I as r,De as s,Oe as t,q as u,Ue as v,Ji as w}; //# sourceMappingURL=chunk-TT2DOKKC.js.map