route-graphics 0.0.31 → 0.0.32

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/README.md CHANGED
@@ -1055,12 +1055,45 @@ src: hero-sprite
1055
1055
  # Run all tests
1056
1056
  bun run test
1057
1057
  ```
1058
+
1059
+ ### Playground (Rettangoli Sites)
1060
+
1061
+ The playground is managed as its own local Sites project in `playground/`.
1062
+
1063
+ ```bash
1064
+ # Install playground deps
1065
+ cd playground
1066
+ bun install
1067
+
1068
+ # Start watch/dev server (default port 3001)
1069
+ bun run watch
1070
+
1071
+ # Build static output
1072
+ bun run build
1073
+ ```
1074
+
1075
+ Notes:
1076
+
1077
+ - Sites config is YAML-only: `playground/sites.config.yaml`
1078
+ - Playground scripts live in `playground/package.json`
1079
+ - Template source of truth: `playground/data/templates.yaml`
1080
+ - Runtime template catalog: `playground/static/public/playground/templates.yaml`
1081
+
1058
1082
  ### Code Quality
1059
1083
 
1060
1084
  ```bash
1061
- # Build visual tests
1085
+ # Build VT pages
1062
1086
  bun run vt:generate
1063
1087
 
1088
+ # Capture screenshots with Docker
1089
+ bun run vt:screenshot
1090
+
1091
+ # Generate visual diff report
1092
+ bun run vt:report
1093
+
1094
+ # Accept expected diffs
1095
+ bun run vt:accept
1096
+
1064
1097
 
1065
1098
  # Fix linting issues
1066
1099
  bun run lint:fix
@@ -1146,5 +1179,3 @@ Join us on [Discord](https://discord.gg/8J9dyZSu9C) to ask questions, report bug
1146
1179
  ## License
1147
1180
 
1148
1181
  This project is licensed under the [MIT License](LICENSE).
1149
-
1150
-
@@ -1141,7 +1141,7 @@ ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=Be(t
1141
1141
  };
1142
1142
 
1143
1143
  })();
1144
- `,Uo=null,pl=class{constructor(){Uo||(Uo=URL.createObjectURL(new Blob([dk],{type:"application/javascript"}))),this.worker=new Worker(Uo)}};pl.revokeObjectURL=function(){Uo&&(URL.revokeObjectURL(Uo),Uo=null)};var C1=0,Cg,Rg=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Go;e.addEventListener("message",i=>{e.terminate(),Go.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Cg===void 0&&(Cg=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Cg&&(this._createdWorkers++,t=new pl().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[C1]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:C1++,id:i})}},Mg=new Rg;ri();var fk=[".jpeg",".jpg",".png",".webp",".avif"],pk=["image/jpeg","image/png","image/webp","image/avif"];async function mk(r,t){let e=await X.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var vu={name:"loadTextures",extension:{type:T.LoadParser,priority:fe.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return lr(r,pk)||hr(r,fk)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Mg.isImageBitmapSupported()?i=await Mg.loadImageBitmap(r,t):i=await mk(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new He({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Io(r),...t.data});return Fo(s,e,r)},unload(r){r.destroy(!0)}};M();$f();zf();var R1=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],gk=R1.map(r=>`video/${r.substring(1)}`);function xk(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=_k(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function yk(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function _k(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var M1={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=lr(r,gk),e=hr(r,R1);return t||e},async load(r,t,e){let i={...js.defaultOptions,resolution:t.data?.resolution||Io(r),alphaMode:t.data?.alphaMode||await Yh(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let h=o[l];h!==void 0&&s.setAttribute(l,h)}),i.muted===!0&&(s.muted=!0),xk(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=js.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let h=async()=>{let c=new js({...i,resource:s});s.removeEventListener("canplay",h),t.data.preload&&await yk(s),l(Fo(c,e,r))};s.addEventListener("canplay",h),s.appendChild(n)})},unload(r){r.destroy(!0)}};M();zs();M();zs();var Tu={extension:{type:T.ResolveParser,name:"resolveTexture"},test:vu.test,parse:r=>({resolution:parseFloat(qe.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var B1={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>qe.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Tu.parse};zs();Gn();Wh();var Su=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new qe,this.loader=new bu,this.cache=vt,this._backgroundLoader=new yu(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=ts(t),s=Be(t).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,l=0,h=()=>{e?.(++a/l)},c=n.map(u=>{let d=s[u];return l+=Object.keys(d).length,this._mapLoadToResolve(d,h).then(f=>{o[u]=f})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return vt.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=vt.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(h=>{o[h]=a}),vt.set(l,a)}),o}async unload(t){this._initialized||await this.init();let e=Be(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Be(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{vt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},Tr=new Su;k.handleByList(T.LoadParser,Tr.loader.parsers).handleByList(T.ResolveParser,Tr.resolver.parsers).handleByList(T.CacheParser,Tr.cache.parsers).handleByList(T.DetectionParser,Tr.detections);k.add(g1,_1,x1,S1,b1,v1,T1,E1,w1,A1,P1,vu,M1,m1,p1,Tu,B1);var I1={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};k.handle(T.Asset,r=>{let t=r.ref;Object.entries(I1).filter(([e])=>!!t[e]).forEach(([e,i])=>k.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(I1).filter(e=>!!t[e]).forEach(e=>k.remove(t[e]))});bt();Mn();Ws();Ln();var ml=class r extends kt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:h=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof R?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=l,this.onLoop=h,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ne.shared.add(this.update,this,Mr.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(R.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(R.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof R)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ne.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Eh();Ht();Vh();var Eu=class extends Si{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:h,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new ye({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=h??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function F1(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&($(J,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}aa();hs();var Sr=class extends Eu{constructor(...t){let e=F1(t,"Text");super(e,Mt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=qt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ri();oe();bt();Yf();xr();cm();Ln();aa();hs();Df();Te();var bk=zi(uc(),1);k.add(HS,WS);var vk=new(window.AudioContext||window.webkitAudioContext),Bg={},Tk=async(r,t)=>{if(!Bg[r]&&t.byteLength!==0)try{let e=await vk.decodeAudioData(t);Bg[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},Sk=r=>Bg[r],Oo={load:Tk,getAsset:Sk};var he=({type:r,add:t,update:e,delete:i,parse:s})=>({type:r,add:t,update:e,delete:i,parse:s});var Ig=({type:r})=>({type:r});var Fg=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var k1={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},kg={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var ds={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var Ge={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var cr=(r,t)=>{let e={fill:t?.fill??Ge.fill,fontFamily:t?.fontFamily??Ge.fontFamily,fontSize:t?.fontSize??Ge.fontSize,align:t?.align??Ge.align,lineHeight:t?.lineHeight??Ge.lineHeight,wordWrap:t?.wordWrap??Ge.wordWrap,breakWords:t?.breakWords??Ge.breakWords,strokeColor:t?.strokeColor??Ge.strokeColor,strokeWidth:t?.strokeWidth??Ge.strokeWidth,wordWrapWidth:t?.wordWrapWidth??Ge.wordWrapWidth};r.style=e};var G1=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=new Sr({label:e.id});l.zIndex=a,l.text=e.content,cr(l,e.textStyle),l.alpha=e.alpha,l.x=e.x,l.y=e.y;let h=e?.hover,c=e?.click,u=e?.rightClick,d={isHovering:!1,isPressed:!1,isRightPressed:!1},f=({isHovering:m,isPressed:p,isRightPressed:b})=>{b&&u?.textStyle?cr(l,u.textStyle):p&&c?.textStyle?cr(l,c.textStyle):m&&h?.textStyle?cr(l,h.textStyle):cr(l,e.textStyle)};if(h){let{cursor:m,soundSrc:p,actionPayload:b}=h;l.eventMode="static";let y=()=>{d.isHovering=!0,b&&s&&s("hover",{_event:{id:l.label},...b}),m&&(l.cursor=m),p&&r.audioStage.add({id:`hover-${Date.now()}`,url:p,loop:!1}),f(d)},_=()=>{d.isHovering=!1,l.cursor="auto",f(d)};l.on("pointerover",y),l.on("pointerout",_)}if(c){let{soundSrc:m,soundVolume:p,actionPayload:b}=c;l.eventMode="static";let y=()=>{d.isPressed=!0,f(d)},_=()=>{d.isPressed=!1,f(d),b&&s&&s("click",{_event:{id:l.label},...b}),m&&r.audioStage.add({id:`click-${Date.now()}`,url:m,loop:!1,volume:(p??1e3)/1e3})},v=()=>{d.isPressed=!1,f(d)};l.on("pointerdown",y),l.on("pointerup",_),l.on("pointerupoutside",v)}if(u){let{soundSrc:m,actionPayload:p}=u;l.eventMode="static";let b=()=>{d.isRightPressed=!0,f(d)},y=()=>{d.isRightPressed=!1,f(d),p&&s&&s("rightclick",{_event:{id:l.label},...p}),m&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:m,loop:!1})},_=()=>{d.isRightPressed=!1,f(d)};l.on("rightdown",b),l.on("rightup",y),l.on("rightupoutside",_)}t.addChild(l);let g=i?.filter(m=>m.targetId===e.id)||[];for(let m of g){let p=n.getVersion();n.track(p),o.dispatch({type:"START",payload:{id:m.id,element:l,properties:m.properties,targetState:{x:e.x,y:e.y,alpha:e.alpha},onComplete:()=>{n.complete(p)}}})}};var U1=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let h=t.children.find(m=>m.label===e.id);if(!h)return;h.zIndex=l;let{x:c,y:u,alpha:d}=i,f=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.text=i.content,cr(h,i.textStyle),h.x=c,h.y=u,h.alpha=d,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let m=i?.hover,p=i?.click,b=i?.rightClick,y={isHovering:!1,isPressed:!1,isRightPressed:!1},_=({isHovering:v,isPressed:E,isRightPressed:A})=>{A&&b?.textStyle?cr(h,b.textStyle):E&&p?.textStyle?cr(h,p.textStyle):v&&m?.textStyle?cr(h,m.textStyle):cr(h,i.textStyle)};if(m){let{cursor:v,soundSrc:E,actionPayload:A}=m;h.eventMode="static";let S=()=>{y.isHovering=!0,A&&s&&s("hover",{_event:{id:h.label},...A}),v&&(h.cursor=v),E&&r.audioStage.add({id:`hover-${Date.now()}`,url:E,loop:!1}),_(y)},w=()=>{y.isHovering=!1,h.cursor="auto",_(y)};h.on("pointerover",S),h.on("pointerout",w)}if(p){let{soundSrc:v,soundVolume:E,actionPayload:A}=p;h.eventMode="static";let S=()=>{y.isPressed=!0,_(y)},w=()=>{y.isPressed=!1,_(y),A&&s&&s("click",{_event:{id:h.label},...A}),v&&r.audioStage.add({id:`click-${Date.now()}`,url:v,loop:!1,volume:(E??1e3)/1e3})},P=()=>{y.isPressed=!1,_(y)};h.on("pointerdown",S),h.on("pointerup",w),h.on("pointerupoutside",P)}if(b){let{soundSrc:v,actionPayload:E}=b;h.eventMode="static";let A=()=>{y.isRightPressed=!0,_(y)},S=()=>{y.isRightPressed=!1,_(y),E&&s&&s("rightclick",{_event:{id:h.label},...E}),v&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:v,loop:!1})},w=()=>{y.isRightPressed=!1,_(y)};h.on("rightdown",A),h.on("rightup",S),h.on("rightupoutside",w)}}},g=o?.filter(m=>m.targetId===e.id)||[];if(g.length>0)for(let m of g){let p=a.getVersion();a.track(p),n.dispatch({type:"START",payload:{id:m.id,element:h,properties:m.properties,targetState:{x:c,y:u,alpha:d},onComplete:()=>{a.complete(p),f()}}})}else f()};var O1=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;let n=e?.filter(a=>a.targetId===t.id)||[];if(n.length===0){o.destroy();return}for(let a of n){let l=s.getVersion();s.track(l),i.dispatch({type:"START",payload:{id:a.id,element:o,properties:a.properties,targetState:null,onComplete:()=>{s.complete(l),o&&!o.destroyed&&o.destroy()}}})}};var L1=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,l=t-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var Ee=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(ds).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(ds).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===ds.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=L1({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var D1=({state:r})=>{let t={...Ge,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),r.width&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let e=String(r.content??""),{width:i,height:s}=qt.measureText(e,new Mt(t)),o=Math.round(i),n=Math.round(s);return{...Ee({...r,width:o,height:n}),content:e,textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}}};var Ek=he({type:"text",add:G1,update:U1,delete:O1,parse:D1});var N1=({app:r,parent:t,element:e,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a})=>{let{id:l,x:h,y:c,width:u,height:d,fill:f,border:g,alpha:m}=e,p=new le;p.label=l,p.zIndex=n,(()=>{p.clear(),p.rect(0,0,Math.round(u),Math.round(d)).fill(f),p.x=Math.round(h),p.y=Math.round(c),p.alpha=m,g&&p.stroke({color:g.color,alpha:g.alpha,width:Math.round(g.width)})})();let y=e?.hover,_=e?.click,v=e?.rightClick,E=e?.scroll,A=e?.drag;if(y){let{cursor:w,soundSrc:P,actionPayload:C}=y;p.eventMode="static";let B=()=>{C&&o&&o("hover",{_event:{id:p.label},...C}),w&&(p.cursor=w),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},I=()=>{p.cursor="auto"};p.on("pointerover",B),p.on("pointerout",I)}if(_){let{soundSrc:w,soundVolume:P,actionPayload:C}=_;p.eventMode="static";let B=()=>{C&&o&&o("click",{_event:{id:p.label},...C}),w&&r.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1,volume:(P??1e3)/1e3})};p.on("pointerup",B)}if(v){let{soundSrc:w,actionPayload:P}=v;p.eventMode="static";let C=()=>{P&&o&&o("rightclick",{_event:{id:p.label},...P}),w&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:w,loop:!1})};p.on("rightclick",C)}if(E){p.eventMode="static";let w=P=>{if(P.deltaY<0&&E.up){let{actionPayload:C}=E.up;C&&o&&o("scrollup",{_event:{id:p.label},...C})}else if(P.deltaY>0&&E.down){let{actionPayload:C}=E.down;C&&o&&o("scrolldown",{_event:{id:p.label},...C})}};p.on("wheel",w)}if(A){let{start:w,end:P,move:C}=A;p.eventMode="static";let B=()=>{p._isDragging=!0,w&&o&&o("drag-start",{_event:{id:p.label},...typeof w?.actionPayload=="object"?w.actionPayload:{}})},I=()=>{p._isDragging=!1,P&&o&&o("drag-end",{_event:{id:p.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},L=N=>{C&&o&&p._isDragging&&o("drag-move",{_event:{id:p.label,x:N.global.x,y:N.global.y},...typeof C?.actionPayload=="object"?C.actionPayload:{}})};p.on("pointerdown",B),p.on("pointerup",I),p.on("globalpointermove",L),p.on("pointerupoutside",I)}t.addChild(p);let S=i?.filter(w=>w.targetId===l)||[];for(let w of S){let P=a.getVersion();a.track(P),s.dispatch({type:"START",payload:{id:w.id,element:p,properties:w.properties,targetState:{x:h,y:c,alpha:m},onComplete:()=>{a.complete(P)}}})}};var H1=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=a;let{x:c,y:u,width:d,height:f,fill:g,border:m,alpha:p}=i,b=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.clear(),h.rect(0,0,Math.round(d),Math.round(f)).fill(g),h.x=Math.round(c),h.y=Math.round(u),h.alpha=p,m&&h.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightclick"),h.removeAllListeners("wheel"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let _=i?.hover,v=i?.click,E=i?.rightClick,A=i?.scroll,S=i?.drag;if(_){let{cursor:w,soundSrc:P,actionPayload:C}=_;h.eventMode="static";let B=()=>{C&&n&&n("hover",{_event:{id:h.label},...C}),w&&(h.cursor=w),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},I=()=>{h.cursor="auto"};h.on("pointerover",B),h.on("pointerout",I)}if(v){let{soundSrc:w,soundVolume:P,actionPayload:C}=v;h.eventMode="static";let B=()=>{C&&n&&n("click",{_event:{id:h.label},...C}),w&&r.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1,volume:(P??1e3)/1e3})};h.on("pointerup",B)}if(E){let{soundSrc:w,actionPayload:P}=E;h.eventMode="static";let C=()=>{P&&n&&n("rightclick",{_event:{id:h.label},...P}),w&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:w,loop:!1})};h.on("rightclick",C)}if(A){h.eventMode="static";let w=P=>{if(P.deltaY<0&&A.up){let{actionPayload:C}=A.up;C&&n&&n("scrollup",{_event:{id:h.label},...C})}else if(P.deltaY>0&&A.down){let{actionPayload:C}=A.down;C&&n&&n("scrolldown",{_event:{id:h.label},...C})}};h.on("wheel",w)}if(S){let{start:w,end:P,move:C}=S;h.eventMode="static";let B=()=>{h._isDragging=!0,w&&n&&n("drag-start",{_event:{id:h.label},...typeof w?.actionPayload=="object"?w.actionPayload:{}})},I=()=>{h._isDragging=!1,P&&n&&n("drag-end",{_event:{id:h.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},L=N=>{C&&n&&h._isDragging&&n("drag-move",{_event:{id:h.label,x:N.global.x,y:N.global.y},...typeof C?.actionPayload=="object"?C.actionPayload:{}})};h.on("pointerdown",B),h.on("pointerup",I),h.on("globalpointermove",L),h.on("pointerupoutside",I)}}},y=s?.filter(_=>_.targetId===e.id)||[];if(y.length>0)for(let _ of y){let v=l.getVersion();l.track(v),o.dispatch({type:"START",payload:{id:_.id,element:h,properties:_.properties,targetState:{x:c,y:u,alpha:p},onComplete:()=>{l.complete(v),b()}}})}else b()};var V1=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;let n=e?.filter(a=>a.targetId===t.id)||[];if(n.length===0){o.destroy();return}for(let a of n){let l=s.getVersion();s.track(l),i.dispatch({type:"START",payload:{id:a.id,element:o,properties:a.properties,targetState:null,onComplete:()=>{s.complete(l),o&&!o.destroyed&&o.destroy()}}})}};var W1=({state:r})=>{let t=Ee(r),e=t;return r.border&&(e={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:r.border?.width??0}}),{...e,fill:r.fill??"white",rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scroll&&{scroll:r.scroll}}};var wk=he({type:"rect",add:N1,update:H1,delete:V1,parse:W1});var z1=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,src:f,alpha:g}=e,m=f?R.from(f):R.EMPTY,p=new kt(m);p.label=l,p.zIndex=a,p.x=Math.round(h),p.y=Math.round(c),p.width=Math.round(u),p.height=Math.round(d),p.alpha=g;let b=e?.hover,y=e?.click,_=e?.rightClick,v={isHovering:!1,isPressed:!1,isRightPressed:!1},E=({isHovering:S,isPressed:w,isRightPressed:P})=>{if(P&&_?.src){let C=R.from(_.src);p.texture=C}else if(w&&y?.src){let C=R.from(y.src);p.texture=C}else if(S&&b?.src){let C=R.from(b.src);p.texture=C}else p.texture=m};if(b){let{cursor:S,soundSrc:w,actionPayload:P}=b;p.eventMode="static";let C=()=>{v.isHovering=!0,P&&s&&s("hover",{_event:{id:p.label},...P}),S&&(p.cursor=S),w&&r.audioStage.add({id:`hover-${Date.now()}`,url:w,loop:!1}),E(v)},B=()=>{v.isHovering=!1,p.cursor="auto",E(v)};p.on("pointerover",C),p.on("pointerout",B)}if(y){let{soundSrc:S,soundVolume:w,actionPayload:P}=y;p.eventMode="static";let C=()=>{v.isPressed=!0,E(v)},B=()=>{v.isPressed=!1,E(v),P&&s&&s("click",{_event:{id:p.label},...P}),S&&r.audioStage.add({id:`click-${Date.now()}`,url:S,loop:!1,volume:(w??1e3)/1e3})},I=()=>{v.isPressed=!1,E(v)};p.on("pointerdown",C),p.on("pointerup",B),p.on("pointerupoutside",I)}if(_){let{soundSrc:S,actionPayload:w}=_;p.eventMode="static";let P=()=>{v.isRightPressed=!0,E(v)},C=()=>{v.isRightPressed=!1,E(v),w&&s&&s("rightclick",{_event:{id:p.label},...w}),S&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:S,loop:!1})},B=()=>{v.isRightPressed=!1,E(v)};p.on("rightdown",P),p.on("rightup",C),p.on("rightupoutside",B)}t.addChild(p);let A=i?.filter(S=>S.targetId===l)||[];for(let S of A){let w=n.getVersion();n.track(w),o.dispatch({type:"START",payload:{id:S.id,element:p,properties:S.properties,targetState:{x:h,y:c,width:u,height:d,alpha:g},onComplete:()=>{n.complete(w)}}})}};var $1=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=l;let{id:c,x:u,y:d,width:f,height:g,src:m,alpha:p}=i,b=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){let _=m?R.from(m):R.EMPTY;h.texture=_,h.x=Math.round(u),h.y=Math.round(d),h.width=Math.round(f),h.height=Math.round(g),h.alpha=p,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let v=i?.hover,E=i?.click,A=i?.rightClick,S={isHovering:!1,isPressed:!1,isRightPressed:!1},w=({isHovering:P,isPressed:C,isRightPressed:B})=>{if(B&&A?.src){let I=R.from(A.src);h.texture=I}else if(C&&E?.src){let I=R.from(E.src);h.texture=I}else if(P&&v?.src){let I=R.from(v.src);h.texture=I}else h.texture=_};if(v){let{cursor:P,soundSrc:C,actionPayload:B}=v;h.eventMode="static";let I=()=>{S.isHovering=!0,B&&a&&a("hover",{_event:{id:h.label},...B}),P&&(h.cursor=P),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1}),w(S)},L=()=>{S.isHovering=!1,h.cursor="auto",w(S)};h.on("pointerover",I),h.on("pointerout",L)}if(E){let{soundSrc:P,soundVolume:C,actionPayload:B}=E;h.eventMode="static";let I=()=>{S.isPressed=!0,w(S)},L=()=>{S.isPressed=!1,w(S),B&&a&&a("click",{_event:{id:h.label},...B}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:(C??1e3)/1e3})},N=()=>{S.isPressed=!1,w(S)};h.on("pointerdown",I),h.on("pointerup",L),h.on("pointerupoutside",N)}if(A){let{soundSrc:P,actionPayload:C}=A;h.eventMode="static";let B=()=>{S.isRightPressed=!0,w(S)},I=()=>{S.isRightPressed=!1,w(S),C&&a&&a("rightclick",{_event:{id:h.label},...C}),P&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:P,loop:!1})},L=()=>{S.isRightPressed=!1,w(S)};h.on("rightdown",B),h.on("rightup",I),h.on("rightupoutside",L)}}},y=s?.filter(_=>_.targetId===e.id)||[];if(y.length>0)for(let _ of y){let v=n.getVersion();n.track(v),o.dispatch({type:"START",payload:{id:_.id,element:h,properties:_.properties,targetState:{x:u,y:d,width:f,height:g,alpha:p},onComplete:()=>{n.complete(v),b()}}})}else b()};var X1=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===t.id);if(!o)return;let n=e?.filter(a=>a.targetId===t.id)||[];if(n.length===0){o.destroy();return}for(let a of n){let l=s.getVersion();s.track(l),i.dispatch({type:"START",payload:{id:a.id,element:o,properties:a.properties,targetState:null,onComplete:()=>{s.complete(l),o&&!o.destroyed&&o.destroy()}}})}};var j1=({state:r})=>({...Ee(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var Ak=he({type:"sprite",add:z1,update:$1,delete:X1,parse:j1});var Y1=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,src:f,volume:g,loop:m,alpha:p}=e,b=R.from(f),y=b.source.resource;y.pause(),y.currentTime=0,y.loop=m??!1,y.volume=g/1e3,y.muted=!1,y.play();let _=new kt(b);_.label=l,_.zIndex=a,_.x=Math.round(h),_.y=Math.round(c),_.width=Math.round(u),_.height=Math.round(d),_.alpha=p??1,t.addChild(_);let v=i?.filter(E=>E.targetId===l)||[];for(let E of v){let A=n.getVersion();n.track(A),o.dispatch({type:"START",payload:{id:E.id,element:_,properties:E.properties,targetState:{x:h,y:c,width:u,height:d,alpha:p??1},onComplete:()=>{n.complete(A)}}})}};var q1=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,completionTracker:a,zIndex:l})=>{let h=t.children.find(b=>b.label===e.id);if(!h)return;h.zIndex=l;let{x:c,y:u,width:d,height:f,alpha:g}=i,m=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){if(h.x=Math.round(c),h.y=Math.round(u),h.width=Math.round(d),h.height=Math.round(f),h.alpha=g??1,e.src!==i.src){let b=h.texture.source.resource;b&&b.pause();let y=R.from(i.src);h.texture=y;let _=y.source.resource;_.muted=!1,_.pause(),_.currentTime=0,_.play()}h.texture.source.resource.volume=i.volume/1e3,h.texture.source.resource.loop=i.loop??!1}},p=s?.filter(b=>b.targetId===e.id)||[];if(p.length>0)for(let b of p){let y=a.getVersion();a.track(y),o.dispatch({type:"START",payload:{id:b.id,element:h,properties:b.properties,targetState:{x:c,y:u,width:d,height:f,alpha:g??1},onComplete:()=>{a.complete(y),m()}}})}else m()};var K1=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(l=>l.label===e.id);if(!n)return;let a=i?.filter(l=>l.targetId===e.id)||[];if(a.length===0){let l=n.texture.source.resource;l&&l.pause(),t.removeChild(n),n.destroy();return}for(let l of a){let h=o.getVersion();o.track(h),s.dispatch({type:"START",payload:{id:l.id,element:n,properties:l.properties,targetState:null,onComplete:()=>{if(o.complete(h),n&&!n.destroyed){let c=n.texture.source.resource;c&&c.pause(),t.removeChild(n),n.destroy()}}}})}};var Z1=({state:r})=>({...Ee(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var Pk=he({type:"video",add:Y1,update:q1,delete:K1,parse:Z1});var Q1=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,eventHandler:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,alpha:f,thumbSrc:g,barSrc:m,direction:p,min:b,max:y,step:_,initialValue:v,originX:E,originY:A,hover:S,change:w}=e,P=new yt;P.label=l,P.zIndex=a,P.x=h,P.y=c,P.alpha=f,P.sortableChildren=!0,P.eventMode="static";let C=0,B=m?R.from(m):R.EMPTY,I=new kt(B);I.label=`${l}-bar`,I.eventMode="static";let L=g?R.from(g):R.EMPTY,N=new kt(L);N.label=`${l}-thumb`,N.eventMode="static";let ut=v??b,H=y-b,K=pt=>{let lt=(pt-b)/H;p==="horizontal"?(N.x=lt*(I.width-N.width),N.y=(I.height-N.height)/2):(N.x=(I.width-N.width)/2,N.y=lt*(I.height-N.height))};(()=>{I.width=u,I.height=d;let pt=p==="horizontal"?d-C*2:u-C*2,lt=g?R.from(g):R.EMPTY,_t=lt.width,Ft=lt.height,Qt=pt/_t,Jt=pt/Ft,Le=Math.min(Qt,Jt);N.width=_t*Le,N.height=Ft*Le,K(ut)})();let U=L,z=B,rt=!1,nt=pt=>{let lt;if(p==="horizontal"){let Ft=pt.x-N.width/2;lt=Math.max(0,Math.min(1,Ft/(I.width-N.width)))}else{let Ft=pt.y-N.height/2;lt=Math.max(0,Math.min(1,Ft/(I.height-N.height)))}let _t=b+lt*H;return _>0&&(_t=Math.round((_t-b)/_)*_+b,_t=Math.max(b,Math.min(y,_t))),_t},Tt=pt=>{let lt=P.toLocal(pt.global),_t=nt(lt);_t!==ut&&(ut=_t,K(ut),w?.actionPayload&&n&&n("change",{_event:{id:l,value:ut},...w.actionPayload}))},Ut=pt=>{rt=!0,Tt(pt)},Nt=pt=>{rt&&Tt(pt)},Zt=()=>{rt&&(rt=!1)};if(P.on("pointerdown",Ut),P.on("globalpointermove",Nt),P.on("pointerup",Zt),P.on("pointerupoutside",Zt),S){let{cursor:pt,soundSrc:lt,thumbSrc:_t,barSrc:Ft}=S,Qt=()=>{pt&&(I.cursor=pt,N.cursor=pt),lt&&r.audioStage.add({id:`hover-${Date.now()}`,url:lt,loop:!1}),_t&&(N.texture=R.from(_t)),Ft&&(I.texture=R.from(Ft))},Jt=()=>{rt||(I.cursor="auto",N.cursor="auto",N.texture=U,I.texture=z)};P.on("pointerover",Qt),P.on("pointerout",Jt),P.on("pointerupoutside",Jt)}P.addChild(I),P.addChild(N),t.addChild(P);let Pe=i?.filter(pt=>pt.targetId===l)||[];for(let pt of Pe){let lt=o.getVersion();o.track(lt),s.dispatch({type:"START",payload:{id:pt.id,element:P,properties:pt.properties,targetState:{x:h,y:c,alpha:f},onComplete:()=>{o.complete(lt)}}})}};var J1=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(m=>m.label===e.id);if(!h)return;h.zIndex=l;let c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.label=i.id,h.pivot.set(i.originX,i.originY);let m=h.getChildByLabel(`${i.id}-bar`),p=h.getChildByLabel(`${i.id}-thumb`),b=JSON.stringify(e.hover)!==JSON.stringify(i.hover)||JSON.stringify(e.change)!==JSON.stringify(i.change)||e.min!==i.min||e.max!==i.max||e.step!==i.step||e.direction!==i.direction;if(m&&p){m.width=i.width,m.height=i.height;let y=0,_=i.direction==="horizontal"?i.height-y*2:i.width-y*2,v=i.thumbSrc?R.from(i.thumbSrc):R.EMPTY,E=v.width||16,A=v.height||16,S=_/E,w=_/A,P=Math.min(S,w);if(p.width=E*P,p.height=A*P,e.barSrc!==i.barSrc){let I=i.barSrc?R.from(i.barSrc):R.EMPTY;m.texture=I}if(e.thumbSrc!==i.thumbSrc){let I=i.thumbSrc?R.from(i.thumbSrc):R.EMPTY;p.texture=I}let C=i.max-i.min,B=(i.initialValue-i.min)/C;i.direction==="horizontal"?(p.x=B*(m.width-p.width),p.y=(m.height-p.height)/2):(p.x=(m.width-p.width)/2,p.y=B*(m.height-p.height))}if(b&&(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove")),b){let{hover:y,change:_,min:v,max:E,step:A,direction:S,initialValue:w}=i,P=w??v,C=E-v;h.eventMode="static";let B=z=>{let rt=(z-v)/C;S==="horizontal"?(p.x=rt*(m.width-p.width),p.y=(m.height-p.height)/2):(p.x=(m.width-p.width)/2,p.y=rt*(m.height-p.height))},I=z=>{let rt;if(S==="horizontal"){let Tt=z.x-p.width/2;rt=Math.max(0,Math.min(1,Tt/(m.width-p.width)))}else{let Tt=z.y-p.height/2;rt=Math.max(0,Math.min(1,Tt/(m.height-p.height)))}let nt=v+rt*C;return A>0&&(nt=Math.round((nt-v)/A)*A+v,nt=Math.max(v,Math.min(E,nt))),nt},L=p.texture,N=m.texture,ut=!1,H=z=>{let rt=h.toLocal(z.global),nt=I(rt);nt!==P&&(P=nt,B(P),_?.actionPayload&&a&&a("change",{_event:{id:i.id,value:P},..._.actionPayload}))},K=z=>{ut=!0,H(z)},W=z=>{ut&&H(z)},U=()=>{ut&&(ut=!1)};if(h.on("pointerdown",K),h.on("globalpointermove",W),h.on("pointerup",U),h.on("pointerupoutside",U),y){let{cursor:z,soundSrc:rt,thumbSrc:nt,barSrc:Tt}=y,Ut=()=>{z&&(h.cursor=z,p.cursor=z),rt&&r.audioStage.add({id:`hover-${Date.now()}`,url:rt,loop:!1}),nt&&(p.texture=R.from(nt)),Tt&&(m.texture=R.from(Tt))},Nt=()=>{ut||(h.cursor="auto",p.cursor="auto",p.texture=L,m.texture=N)};h.on("pointerover",Ut),h.on("pointerout",Nt),h.on("pointerupoutside",Nt)}}}},{x:u,y:d,alpha:f}=i,g=s?.filter(m=>m.targetId===e.id)||[];if(g.length>0)for(let m of g){let p=n.getVersion();n.track(p),o.dispatch({type:"START",payload:{id:m.id,element:h,properties:m.properties,targetState:{x:u,y:d,alpha:f},onComplete:()=>{n.complete(p),c()}}})}else c()};var tP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=i?.filter(l=>l.targetId===e.id)||[];if(a.length===0){n.destroy({children:!0});return}for(let l of a){let h=o.getVersion();o.track(h),s.dispatch({type:"START",payload:{id:l.id,element:n,properties:l.properties,targetState:null,onComplete:()=>{o.complete(h),n&&!n.destroyed&&n.destroy({children:!0})}}})}};var eP=({state:r})=>{let t=Ee(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue??0,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var Ck=he({type:"slider",add:Q1,update:J1,delete:tP,parse:eP});var gl=({container:r,element:t})=>{let e=0,i=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),i=Math.max(n.height+n.y,i)});let s=t.scroll&&t.height&&i>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new yt({label:`${r.label}-content`});[...r.children].forEach(f=>{n.addChild(f)}),r.addChild(n);let l=new le({label:`${r.label}-clip`}).rect(0,0,t.width||e,t.height||i).fill({color:16711680,alpha:0});r.addChild(l),n.mask=l,r.eventMode="static",r.hitArea=new et(0,0,t.width||e,t.height||i);let h=0,c=0,u=-(i-(t.height||i)),d=-(e-(t.width||e));r.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let g=h-f.deltaY;g>0?h=0:g<u?h=u:h=g,n.y=h}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let g=f.deltaX!==0?f.deltaX:f.deltaY,m=c-g;m>0?c=0:m<d?c=d:c=m,n.x=c}})}},Gg=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel")};var rP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,zIndex:a,completionTracker:l})=>{let{id:h,x:c,y:u,children:d,scroll:f,alpha:g}=e,m=new yt;if(m.label=h,m.zIndex=a,m.x=Math.round(c),m.y=Math.round(u),m.alpha=g,t.addChild(m),d&&d.length>0)for(let v of d){let E=n.find(A=>A.type===v.type);if(!E)throw new Error(`No plugin found for child element type: ${v.type}`);E.add({app:r,parent:m,element:v,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,completionTracker:l})}f&&gl({container:m,element:e});let p=e?.hover,b=e?.click,y=e?.rightClick;if(p){let{cursor:v,soundSrc:E,actionPayload:A}=p;m.eventMode="static";let S=()=>{A&&s&&s("hover",{_event:{id:m.label},...A}),v&&(m.cursor=v),E&&r.audioStage.add({id:`hover-${Date.now()}`,url:E,loop:!1})},w=()=>{m.cursor="auto"};m.on("pointerover",S),m.on("pointerout",w)}if(b){let{soundSrc:v,soundVolume:E,actionPayload:A}=b;m.eventMode="static";let S=()=>{A&&s&&s("click",{_event:{id:m.label},...A}),v&&r.audioStage.add({id:`click-${Date.now()}`,url:v,loop:!1,volume:(E??1e3)/1e3})};m.on("pointerup",S)}if(y){let{soundSrc:v,actionPayload:E}=y;m.eventMode="static";let A=()=>{E&&s&&s("rightclick",{_event:{id:m.label},...E}),v&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:v,loop:!1})};m.on("rightclick",A)}let _=i?.filter(v=>v.targetId===h)||[];for(let v of _){let E=l.getVersion();l.track(E),o.dispatch({type:"START",payload:{id:v.id,element:m,properties:v.properties,targetState:{x:c,y:u,alpha:g},onComplete:()=>{l.complete(E)}}})}};var xl=r=>{let t=new Set;if(r.id&&t.add(r.id),r.children&&Array.isArray(r.children))for(let e of r.children)for(let i of xl(e))t.add(i);return t};var iP=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let h of r)i.add(h.id),s.set(h.id,h);for(let h of t)i.add(h.id),o.set(h.id,h);for(let h of i){let c=s.get(h),u=o.get(h);if(!c&&u)n.push(u);else if(c&&!u)a.push(c);else{let d=xl(u),f=e.find(g=>d.has(g.targetId));(JSON.stringify(c)!==JSON.stringify(u)||f)&&l.push({prev:c,next:u})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var yl=({app:r,parent:t,prevComputedTree:e,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l})=>{t.sortableChildren=!0;let{toAddElement:h,toDeleteElement:c,toUpdateElement:u}=iP(e,i,s);for(let d of t.children){let f=i.findIndex(g=>g.id===d.label);f!==-1&&(d.zIndex=f)}for(let d of c){let f=l.find(g=>g.type===d.type);if(!f)throw new Error(`No plugin found for element type: ${d.type}`);f.delete({app:r,parent:t,element:d,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l})}for(let d of h){let f=l.find(m=>m.type===d.type);if(!f)throw new Error(`No plugin found for element type: ${d.type}`);let g=i.findIndex(m=>m.id===d.id);f.add({app:r,parent:t,element:d,animations:s,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,zIndex:g})}for(let{prev:d,next:f}of u){let g=l.find(p=>p.type===f.type);if(!g)throw new Error(`No plugin found for element type: ${f.type}`);let m=i.findIndex(p=>p.id===f.id);g.update({app:r,parent:t,prevElement:d,nextElement:f,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,zIndex:m})}};var sP=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,zIndex:l,completionTracker:h})=>{let c=t.children.find(p=>p.label===e.id);if(!c)return;c.zIndex=l;let{x:u,y:d,alpha:f}=i,g=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){c.x=Math.round(u),c.y=Math.round(d),c.label=i.id,c.alpha=f,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightclick");let _=i?.hover,v=i?.click,E=i?.rightClick;if(_){let{cursor:A,soundSrc:S,actionPayload:w}=_;c.eventMode="static";let P=()=>{w&&s&&s("hover",{_event:{id:c.label},...w}),A&&(c.cursor=A),S&&r.audioStage.add({id:`hover-${Date.now()}`,url:S,loop:!1})},C=()=>{c.cursor="auto"};c.on("pointerover",P),c.on("pointerout",C)}if(v){let{soundSrc:A,soundVolume:S,actionPayload:w}=v;c.eventMode="static";let P=()=>{w&&s&&s("click",{_event:{id:c.label},...w}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:(S??1e3)/1e3})};c.on("pointerup",P)}if(E){let{soundSrc:A,actionPayload:S}=E;c.eventMode="static";let w=()=>{S&&s&&s("rightclick",{_event:{id:c.label},...S}),A&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:A,loop:!1})};c.on("rightclick",w)}e.scroll!==i.scroll?i.scroll?gl({container:c,element:i}):Gg({container:c}):i.scroll&&(Gg({container:c}),gl({container:c,element:i}))}let p=JSON.stringify(e.children)!==JSON.stringify(i.children),b=xl({children:i.children}),y=o?.some(_=>b.has(_.targetId));(p||y)&&yl({app:r,parent:i.scroll?c.children.find(_=>_.label===`${i.id}-content`):c,nextComputedTree:i.children,prevComputedTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:h})},m=o?.filter(p=>p.targetId===e.id)||[];if(m.length>0)for(let p of m){let b=h.getVersion();h.track(b),n.dispatch({type:"START",payload:{id:p.id,element:c,properties:p.properties,targetState:{x:u,y:d,alpha:f},onComplete:()=>{h.complete(b),g()}}})}else g()};var oP=({app:r,parent:t,element:e,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=t.getChildByLabel(e.id);if(!a)return;let l=s?.filter(c=>c.targetId===e.id)||[],h=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0,texture:!0,baseTexture:!0}))};if(l.length===0){h();return}for(let c of l){let u=n.getVersion();n.track(u),i.dispatch({type:"START",payload:{id:c.id,element:a,properties:c.properties,targetState:null,onComplete:()=>{n.complete(u),h()}}})}};var nP=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,h=0,c=0,u=0,d=0,f=0,g=0,m=0,p=0;for(let _=0;_<o.length;_++){let v=_<o.length-1?s:0,E=o[_];_>0?e==="horizontal"?(E.x=h,E.y=f):e==="vertical"&&(E.x=g,E.y=c):(e==="horizontal"||e==="vertical")&&(E.x=0,E.y=0);let A=t.find(S=>S.type===E.type);if(A){let S=(E.scaleX??1)*(r.scaleX??1),w=(E.scaleY??1)*(r.scaleY??1);E=A.parse({state:{...E,scaleX:S,scaleY:w},parserPlugins:t})}e==="horizontal"?(r.width&&E.width+m>r.width&&!i?(h=0,m=0,f+=u+s,u=E.height,E.x=0,E.y=f):u=Math.max(u,E.height),h+=E.width+v,m=E.x+E.width,a=Math.max(h,a),l=Math.max(E.height+E.y,l)):e==="vertical"?(r.height&&E.height+p>r.height&&!i?(c=0,p=0,g+=d+s,d=E.width,E.x=g,E.y=0):d=Math.max(d,E.width),c+=E.height+v,p=E.y+E.height,a=Math.max(E.width+E.x,a),l=Math.max(c,l)):(a=Math.max(E.width+E.x,a),l=Math.max(E.height+E.y,l)),n.push(E)}let y={...Ee({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:e,gap:s,scroll:i,rotation:r.rotation??0};return r.rightClick&&(y.rightClick=r.rightClick),y};var Rk=he({type:"container",add:rP,update:sP,delete:oP,parse:nP});function Lo(r,t){let e=r.text.substring(0,t),s=qt.measureText(e,r.style).width;return r.x+s}var Mk=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s=setTimeout(()=>{e()},r),o=()=>{clearTimeout(s),i(t.reason)};t?.addEventListener("abort",o,{once:!0})}),Do=Mk;var aP=async({parent:r,element:t,completionTracker:e,zIndex:i})=>{let s=e.getVersion();e.track(s);let o=t.speed??50,n=t.revealEffect??"typewriter",a=t?.indicator?.offset??12,l=n==="none",h=l?0:Math.max(1,Math.floor(1e3/o)),c=l?0:Math.max(1,Math.floor(4e3/o)),u=new yt;u.label=t.id,u.zIndex=i;let d=new kt(R.EMPTY);if(t?.indicator?.revealing?.src){let f=t.indicator.revealing.src?R.from(t.indicator.revealing.src):R.EMPTY;d=new kt(f),d.width=t.indicator.revealing.width??f.width,d.height=t.indicator.revealing.height??f.height}u.addChild(d),t.x!==void 0&&(u.x=Math.round(t.x)),t.y!==void 0&&(u.y=Math.round(t.y)),t.alpha!==void 0&&(u.alpha=t.alpha),r.addChild(u);for(let f=0;f<t.content.length;f++){let g=t.content[f];d.x=a,d.y=g.y+(g.lineMaxHeight-d.height);for(let m=0;m<g.lineParts.length;m++){let p=g.lineParts[m],b=new Mt(p.textStyle),y=new Sr({text:"",style:b,x:Math.round(p.x),y:Math.round(p.y)}),_=null;if(p.furigana){let A=new Mt(p.furigana.textStyle);_=new Sr({text:"",style:A,x:Math.round(p.furigana.x),y:Math.round(p.furigana.y)}),u.addChild(_)}u.addChild(y);let v=p.text,E=p.furigana?.text||"";if(l)y.text=v,d.x=Lo(y,v.length-1)+a,_&&(_.text=E);else{let A=E.length;for(let S=0;S<v.length;S++){y.text=v.substring(0,S+1),d.x=Lo(y,S)+a;let w=Math.round((S+1)/v.length*A);_&&(_.text=E.substring(0,w)),S<v.length-1&&await Do(h)}}}f<t.content.length-1&&await Do(c)}if(t?.indicator?.complete?.src){let f=t.indicator.complete.src?R.from(t.indicator.complete.src):R.EMPTY;d.texture=f,d.width=t.indicator.complete.width??f.width,d.height=t.indicator.complete.height??f.height}e.complete(s)};var lP=async r=>{let{parent:t,nextElement:e,completionTracker:i,zIndex:s}=r,o=i.getVersion();i.track(o);let n=e.speed??50,a=e.revealEffect??"typewriter",l=e?.indicator?.offset??12,h=a==="none",c=h?0:Math.max(1,Math.floor(1e3/n)),u=h?0:Math.max(1,Math.floor(4e3/n)),d=t.children.find(f=>f.label===e.id);if(d){d.zIndex=s,d.removeChildren();let f=new kt(R.EMPTY);if(e?.indicator?.revealing?.src){let g=e.indicator.revealing.src?R.from(e.indicator.revealing.src):R.EMPTY;f=new kt(g),f.width=e.indicator.revealing.width??g.width,f.height=e.indicator.revealing.height??g.height}d.addChild(f),e.x!==void 0&&(d.x=e.x),e.y!==void 0&&(d.y=e.y),e.alpha!==void 0&&(d.alpha=e.alpha);for(let g=0;g<e.content.length;g++){let m=e.content[g];f.x=l,f.y=m.y+(m.lineMaxHeight-f.height);for(let p=0;p<m.lineParts.length;p++){let b=m.lineParts[p],y=new Mt(b.textStyle),_=new Sr({text:"",style:y,x:b.x,y:b.y}),v=null;if(b.furigana){let S=new Mt(b.furigana.textStyle);v=new Sr({text:"",style:S,x:b.furigana.x,y:b.furigana.y}),d.addChild(v)}d.addChild(_);let E=b.text,A=b.furigana?.text||"";if(h)_.text=E,f.x=Lo(_,E.length-1)+l,v&&(v.text=A);else{let S=A.length;for(let w=0;w<E.length;w++){_.text=E.substring(0,w+1),f.x=Lo(_,w)+l;let P=Math.round((w+1)/E.length*S);v&&(v.text=A.substring(0,P)),w<E.length-1&&await Do(c)}}}g<e.content.length-1&&await Do(u)}if(e?.indicator?.complete?.src){let g=e.indicator.complete.src?R.from(e.indicator.complete.src):R.EMPTY;f.texture=g,f.width=e.indicator.complete.width??g.width,f.height=e.indicator.complete.height??g.height}i.complete(o)}};var hP=({parent:r,element:t})=>{let e=r.getChildByLabel(t.id);e&&!e.destroyed&&e.destroy({children:!0})};var Bk=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,l=[...r],h=new WeakSet;for(;l.length>0;){let u=l[0];if(!u.text||u.text.length===0){l.shift();continue}let d=Math.round(t-s),f={...u.textStyle,wordWrapWidth:d},g=qt.measureText(u.text,new Mt(f));if(g.lineWidths[0]>d&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let m=g.lines[0];g.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let p=qt.measureText(m,new Mt({...u.textStyle,wordWrap:!1,breakWords:!1})),b={text:m,textStyle:f,height:p.height,x:s,y:o};if(u.furigana&&!h.has(u)){h.add(u);let _=qt.measureText(u.furigana.text,new Mt(u.furigana.textStyle)),v=-_.height+o+2,E={text:u.furigana.text,textStyle:u.furigana.textStyle,x:Math.round(s+(g.lineWidths[0]-_.width)/2),y:v};b.furigana=E}i.push(b),n=Math.max(n,p.height),s+=Math.round(g.lineWidths[0]),a=Math.max(a,s);let y=g.lines.slice(1).join(" ");y&&y.length>0?u.text=y:l.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let g=f.height;f.height&&delete f.height;let m=f.y+(d-g),p=f.furigana;return p&&(p.y=p.y-f.y+m),{...f,...p&&{furigana:p},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},cP=({state:r})=>{let t={...Ge,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(c.furigana){let g={...t,...c.furigana.textStyle||{}};g.lineHeight=Math.round(g.lineHeight*g.fontSize),r.width&&(g.wordWrapWidth=r.width,g.wordWrap=!0),d={text:String(c.furigana.text),textStyle:g}}return{text:String(c.text).replace(/ +$/,g=>"\xA0".repeat(g.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=Bk(e,i),a=r.width||o,h=Ee({...r,width:a,height:n});if(h.alpha=r.alpha??1,r.indicator){let c=r.indicator;h.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...h,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var Ik=he({type:"text-revealing",add:aP,update:lP,delete:hP,parse:cP});var wu=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},Au=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var uP=async({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,zIndex:n})=>{let{id:a,x:l,y:h,width:c,height:u,spritesheetSrc:d,spritesheetData:f,animation:g,alpha:m}=e,p=f,b=Object.keys(p.frames),y=new Ei(R.from(d),p);await y.parse();let _=g.frames.map(A=>y.textures[b[A]]),v=new ml(_);v.label=a,v.zIndex=n,v.animationSpeed=g.animationSpeed??.5,v.loop=g.loop??!0,r.debug?wu(v,a,r.debug):v.play(),v.x=Math.round(l),v.y=Math.round(h),v.width=Math.round(c),v.height=Math.round(u),v.alpha=m,t.addChild(v);let E=i?.filter(A=>A.targetId===a)||[];for(let A of E){let S=o.getVersion();o.track(S),s.dispatch({type:"START",payload:{id:A.id,element:v,properties:A.properties,targetState:{x:l,y:h,width:c,height:u,alpha:m},onComplete:()=>{o.complete(S)}}})}};var dP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(p=>p.label===e.id);if(!l)return;l.zIndex=a;let h=async()=>{if(JSON.stringify(e)!==JSON.stringify(i)&&(l.x=Math.round(i.x),l.y=Math.round(i.y),l.width=Math.round(i.width),l.height=Math.round(i.height),l.alpha=i.alpha,JSON.stringify(e.animation)!==JSON.stringify(i.animation))){l.animationSpeed=i.animation.animationSpeed??.5,l.loop=i.animation.loop??!0;let p=i.spritesheetData,b=Object.keys(p.frames),y=new Ei(R.from(i.spritesheetSrc),p);await y.parse();let _=i.animation.frames.map(v=>y.textures[b[v]]);l.textures=_,r.debug?e.id!==i.id&&(Au(l),wu(l,i.id,r.debug)):l.play()}},{x:c,y:u,width:d,height:f,alpha:g}=i,m=s?.filter(p=>p.targetId===e.id)||[];if(m.length>0)for(let p of m){let b=n.getVersion();n.track(b),o.dispatch({type:"START",payload:{id:p.id,element:l,properties:p.properties,targetState:{x:c,y:u,width:d,height:f,alpha:g},onComplete:async()=>{n.complete(b),await h()}}})}else await h()};var fP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;let a=()=>{r.debug&&Au(n),n&&!n.destroyed&&(n.stop(),n.destroy())},l=i?.filter(h=>h.targetId===e.id)||[];if(l.length===0){a();return}for(let h of l){let c=o.getVersion();o.track(c),s.dispatch({type:"START",payload:{id:h.id,element:n,properties:h.properties,targetState:null,onComplete:()=>{o.complete(c),a()}}})}};var pP=({state:r})=>({...Ee(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var Fk=he({type:"animated-sprite",add:uP,update:dP,delete:fP,parse:pP});var kk=Ig({type:"tween"});var Pu=new Set,Ug=()=>{for(let r of Pu)clearTimeout(r);Pu.clear()},mP=({app:r,element:t})=>{let e={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};if(t.delay&&t.delay>0){let i=setTimeout(()=>{Pu.delete(i),r.audioStage.add(e)},t.delay);Pu.add(i)}else r.audioStage.add(e)};var gP=({app:r,prevElement:t,nextElement:e})=>{if(t.src!==e.src||t.volume!==e.volume){let i=r.audioStage.getById(t.id);i&&(i.url=e.src,i.volume=(e.volume??800)/1e3)}};var xP=({app:r,element:t})=>{r.audioStage.remove(t.id)};var Gk=Fg({type:"sound",add:mP,update:gP,delete:xP});var _l=class extends kt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Og(r){let t=new le;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Lg(r){let t=new le;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Dg(r){let t=new le;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function bl(r,t,e){return r+(t-r)*e}function Ru(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function yP(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,l=t&255,h=Math.round(bl(i,n,e)),c=Math.round(bl(s,a,e)),u=Math.round(bl(o,l,e));return h<<16|c<<8|u}var Cu=class r{constructor(t,e,i=!1){this.value=i?Ru(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},Er=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=Cu.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?yP(e.value,e.next.value,i):bl(e.value,e.next.value,i)}};var Mu=class{static type="alpha";constructor(t){this.list=new Er(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},Bu=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var Iu=class{static type="scale";constructor(t){this.list=new Er(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},Fu=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var Uk=Math.PI/180,ku=class{static type="speed";constructor(t){this.list=new Er(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Gu=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Uu=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*Uk}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var iht=Math.PI/180,Ou=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},Lu=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Ui=Math.PI/180,Du=class{static type="rotation";constructor(t){this.minStart=t.minStart*Ui,this.maxStart=t.maxStart*Ui,this.minSpeed=t.minSpeed*Ui,this.maxSpeed=t.maxSpeed*Ui,this.accel=(t.accel??0)*Ui}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},Nu=class{static type="rotationStatic";constructor(t){this.min=t.min*Ui,this.max=t.max*Ui}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},Hu=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*Ui}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var Vu=class{static type="color";constructor(t){this.list=new Er(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},Wu=class{static type="colorStatic";constructor(t){this.color=Ru(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var zu=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},$u=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},Ng=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},Hg=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},Ok={rect:zu,rectangle:zu,torus:$u,circle:$u,point:Ng,line:Hg};var Xu=class{static type="spawnShape";constructor(t){let e=Ok[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},ju=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var _P=new Map,bP=new Map;function Vg(r,t){_P.set(r,t)}function we(r){bP.set(r.type,r)}function vP(r,t){let e=_P.get(r);return e?e(t):null}function TP(r){return bP.get(r)}Vg("circle",Dg);Vg("snowflake",Og);Vg("raindrop",Lg);we(Mu);we(Bu);we(Iu);we(Fu);we(ku);we(Gu);we(Uu);we(Ou);we(Lu);we(Du);we(Nu);we(Hu);we(Vu);we(Wu);we(Xu);we(ju);var Yu=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var vl=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new Yu(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=TP(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new _l(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function Lk(r,t){let e=new le,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var Tl=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,zIndex:n})=>{let a=new yt;a.label=e.id,a.zIndex=n,t.addChild(a);let l=e.width,h=e.height;a.x=e.x??0,a.y=e.y??0;let c={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},u;if(typeof e.texture=="object"&&e.texture.shape)u=Lk(r,e.texture);else{let m=e.texture??"circle";if(u=vP(m,r),!u)try{u=R.from(m)}catch{console.warn(`Failed to load particle texture: ${m}`);return}}c.texture=u;let d=new vl(a,c);if(a.emitter=d,c.recycleOnBounds){let m=Math.min(e.count??100,c.maxParticles);d.spawn(m);let p=d._activeFirst;for(;p;)p.y=d.random()*h,p.age=d.random()*p.maxLife*.8,p=p.next}let f=m=>{if(d.destroyed){r.ticker.remove(f);return}d.update(m.deltaTime/60)};if(a.tickerCallback=f,r?.debug){let m=p=>{if(d.destroyed){window.removeEventListener("snapShotKeyFrame",m);return}p?.detail?.deltaMS&&d.update(Number(p.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",m),a.customTickerHandler=m}else r.ticker.add(f);e.alpha!==void 0&&(a.alpha=e.alpha);let g=i?.filter(m=>m.targetId===e.id)||[];for(let m of g){let p=o.getVersion();o.track(p),s.dispatch({type:"START",payload:{id:m.id,element:a,properties:m.properties,targetState:{x:e.x??0,y:e.y??0,alpha:e.alpha},onComplete:()=>{o.complete(p)}}})}};var qu=({app:r,parent:t,element:e,animationBus:i,animations:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))},l=s?.filter(h=>h.targetId===e.id)||[];if(l.length===0){a();return}for(let h of l){let c=o.getVersion();o.track(c),i.dispatch({type:"START",payload:{id:h.id,element:n,properties:h.properties,targetState:null,onComplete:()=>{o.complete(c),a()}}})}};var SP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(c=>c.label===e.id);if(!l){Tl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});return}l.zIndex=a,Dk(e,i)?(qu({app:r,parent:t,element:e,animations:s,animationBus:o,completionTracker:n}),Tl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})):(i.alpha!==void 0&&(l.alpha=i.alpha),i.x!==void 0&&(l.x=i.x),i.y!==void 0&&(l.y=i.y))};function Dk(r,t){return r.count!==t.count||JSON.stringify(r.texture)!==JSON.stringify(t.texture)||JSON.stringify(r.behaviors)!==JSON.stringify(t.behaviors)||JSON.stringify(r.emitter)!==JSON.stringify(t.emitter)||r.width!==t.width||r.height!==t.height}function EP(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(ds).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(ds).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function wP(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function AP(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function PP(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function CP(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function RP(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var MP=({state:r})=>{EP(r),wP(r),AP(r),PP(r),CP(r),RP(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var Nk=he({type:"particles",add:Tl,update:SP,delete:qu,parse:MP});var BP=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)e.add(l.id),i.set(l.id,l);for(let l of t)e.add(l.id),s.set(l.id,l);for(let l of e){let h=i.get(l),c=s.get(l);!h&&c?o.push(c):h&&!c?n.push(h):(h.src!==c.src||h.volume!==c.volume||h.loop!==c.loop||h.delay!==c.delay)&&a.push({prev:h,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Wg=({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i})=>{Ug();let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=BP(t,e);for(let a of o){let l=i.find(h=>h.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(h=>h.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let h=i.find(c=>c.type===l.type);if(!h)throw new Error(`No audio plugin found for type: ${l.type}`);h.update({app:r,prevElement:a,nextElement:l})}};var Ke=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ke||{}),zg=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(zg||{}),Ku=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Ku||{}),Q=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(Q||{}),No=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(No||{}),G=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(G||{}),hi=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(hi||{}),st=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(st||{}),D=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(D||{}),ur=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(ur||{}),Sl=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Sl||{}),wr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(wr||{}),Ze=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(Ze||{}),Oi=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Oi||{}),Zu=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Zu||{}),Ue=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ue||{}),re=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(re||{});var Pt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Pt||{}),$e=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))($e||{});var $g={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var Y={ADAPTER:$g,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Cf();var Hk=Ti.default??Ti,Ar=Hk(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var _s=zi(FP(),1),IU=zi(uc(),1);var wx=zi(qR(),1);var KR={};function ct(r,t,e=3){if(KR[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1144
+ `,Uo=null,pl=class{constructor(){Uo||(Uo=URL.createObjectURL(new Blob([dk],{type:"application/javascript"}))),this.worker=new Worker(Uo)}};pl.revokeObjectURL=function(){Uo&&(URL.revokeObjectURL(Uo),Uo=null)};var C1=0,Cg,Rg=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Go;e.addEventListener("message",i=>{e.terminate(),Go.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Cg===void 0&&(Cg=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Cg&&(this._createdWorkers++,t=new pl().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[C1]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:C1++,id:i})}},Mg=new Rg;ri();var fk=[".jpeg",".jpg",".png",".webp",".avif"],pk=["image/jpeg","image/png","image/webp","image/avif"];async function mk(r,t){let e=await X.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var vu={name:"loadTextures",extension:{type:T.LoadParser,priority:fe.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return lr(r,pk)||hr(r,fk)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Mg.isImageBitmapSupported()?i=await Mg.loadImageBitmap(r,t):i=await mk(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new He({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Io(r),...t.data});return Fo(s,e,r)},unload(r){r.destroy(!0)}};M();$f();zf();var R1=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],gk=R1.map(r=>`video/${r.substring(1)}`);function xk(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=_k(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function yk(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function _k(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var M1={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=lr(r,gk),e=hr(r,R1);return t||e},async load(r,t,e){let i={...js.defaultOptions,resolution:t.data?.resolution||Io(r),alphaMode:t.data?.alphaMode||await Yh(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let h=o[l];h!==void 0&&s.setAttribute(l,h)}),i.muted===!0&&(s.muted=!0),xk(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=js.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let h=async()=>{let c=new js({...i,resource:s});s.removeEventListener("canplay",h),t.data.preload&&await yk(s),l(Fo(c,e,r))};s.addEventListener("canplay",h),s.appendChild(n)})},unload(r){r.destroy(!0)}};M();zs();M();zs();var Tu={extension:{type:T.ResolveParser,name:"resolveTexture"},test:vu.test,parse:r=>({resolution:parseFloat(qe.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var B1={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>qe.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Tu.parse};zs();Gn();Wh();var Su=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new qe,this.loader=new bu,this.cache=vt,this._backgroundLoader=new yu(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=ts(t),s=Be(t).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,l=0,h=()=>{e?.(++a/l)},c=n.map(u=>{let d=s[u];return l+=Object.keys(d).length,this._mapLoadToResolve(d,h).then(f=>{o[u]=f})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return vt.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=vt.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(h=>{o[h]=a}),vt.set(l,a)}),o}async unload(t){this._initialized||await this.init();let e=Be(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Be(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{vt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},Tr=new Su;k.handleByList(T.LoadParser,Tr.loader.parsers).handleByList(T.ResolveParser,Tr.resolver.parsers).handleByList(T.CacheParser,Tr.cache.parsers).handleByList(T.DetectionParser,Tr.detections);k.add(g1,_1,x1,S1,b1,v1,T1,E1,w1,A1,P1,vu,M1,m1,p1,Tu,B1);var I1={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};k.handle(T.Asset,r=>{let t=r.ref;Object.entries(I1).filter(([e])=>!!t[e]).forEach(([e,i])=>k.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(I1).filter(e=>!!t[e]).forEach(e=>k.remove(t[e]))});bt();Mn();Ws();Ln();var ml=class r extends kt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:h=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof R?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=l,this.onLoop=h,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ne.shared.add(this.update,this,Mr.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(R.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(R.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof R)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ne.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Eh();Ht();Vh();var Eu=class extends Si{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:h,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new ye({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=h??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function F1(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&($(J,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}aa();hs();var Sr=class extends Eu{constructor(...t){let e=F1(t,"Text");super(e,Mt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=qt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ri();oe();bt();Yf();xr();cm();Ln();aa();hs();Df();Te();var bk=zi(uc(),1);k.add(HS,WS);var vk=new(window.AudioContext||window.webkitAudioContext),Bg={},Tk=async(r,t)=>{if(!Bg[r]&&t.byteLength!==0)try{let e=await vk.decodeAudioData(t);Bg[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},Sk=r=>Bg[r],Oo={load:Tk,getAsset:Sk};var he=({type:r,add:t,update:e,delete:i,parse:s})=>({type:r,add:t,update:e,delete:i,parse:s});var Ig=({type:r})=>({type:r});var Fg=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var k1={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},kg={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var ds={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var Ge={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var cr=(r,t)=>{let e={fill:t?.fill??Ge.fill,fontFamily:t?.fontFamily??Ge.fontFamily,fontSize:t?.fontSize??Ge.fontSize,align:t?.align??Ge.align,lineHeight:t?.lineHeight??Ge.lineHeight,wordWrap:t?.wordWrap??Ge.wordWrap,breakWords:t?.breakWords??Ge.breakWords,strokeColor:t?.strokeColor??Ge.strokeColor,strokeWidth:t?.strokeWidth??Ge.strokeWidth,wordWrapWidth:t?.wordWrapWidth??Ge.wordWrapWidth};r.style=e};var G1=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=new Sr({label:e.id});l.zIndex=a,l.text=e.content,cr(l,e.textStyle),l.alpha=e.alpha,l.x=e.x,l.y=e.y;let h=e?.hover,c=e?.click,u=e?.rightClick,d={isHovering:!1,isPressed:!1,isRightPressed:!1},f=({isHovering:m,isPressed:p,isRightPressed:b})=>{b&&u?.textStyle?cr(l,u.textStyle):p&&c?.textStyle?cr(l,c.textStyle):m&&h?.textStyle?cr(l,h.textStyle):cr(l,e.textStyle)};if(h){let{cursor:m,soundSrc:p,actionPayload:b}=h;l.eventMode="static";let y=()=>{d.isHovering=!0,b&&s&&s("hover",{_event:{id:l.label},...b}),m&&(l.cursor=m),p&&r.audioStage.add({id:`hover-${Date.now()}`,url:p,loop:!1}),f(d)},_=()=>{d.isHovering=!1,l.cursor="auto",f(d)};l.on("pointerover",y),l.on("pointerout",_)}if(c){let{soundSrc:m,soundVolume:p,actionPayload:b}=c;l.eventMode="static";let y=()=>{d.isPressed=!0,f(d)},_=()=>{d.isPressed=!1,f(d),b&&s&&s("click",{_event:{id:l.label},...b}),m&&r.audioStage.add({id:`click-${Date.now()}`,url:m,loop:!1,volume:(p??1e3)/1e3})},v=()=>{d.isPressed=!1,f(d)};l.on("pointerdown",y),l.on("pointerup",_),l.on("pointerupoutside",v)}if(u){let{soundSrc:m,actionPayload:p}=u;l.eventMode="static";let b=()=>{d.isRightPressed=!0,f(d)},y=()=>{d.isRightPressed=!1,f(d),p&&s&&s("rightclick",{_event:{id:l.label},...p}),m&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:m,loop:!1})},_=()=>{d.isRightPressed=!1,f(d)};l.on("rightdown",b),l.on("rightup",y),l.on("rightupoutside",_)}t.addChild(l);let g=i?.filter(m=>m.targetId===e.id)||[];for(let m of g){let p=n.getVersion();n.track(p),o.dispatch({type:"START",payload:{id:m.id,element:l,properties:m.properties,targetState:{x:e.x,y:e.y,alpha:e.alpha},onComplete:()=>{n.complete(p)}}})}};var U1=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let h=t.children.find(m=>m.label===e.id);if(!h)return;h.zIndex=l;let{x:c,y:u,alpha:d}=i,f=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.text=i.content,cr(h,i.textStyle),h.x=c,h.y=u,h.alpha=d,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let m=i?.hover,p=i?.click,b=i?.rightClick,y={isHovering:!1,isPressed:!1,isRightPressed:!1},_=({isHovering:v,isPressed:E,isRightPressed:A})=>{A&&b?.textStyle?cr(h,b.textStyle):E&&p?.textStyle?cr(h,p.textStyle):v&&m?.textStyle?cr(h,m.textStyle):cr(h,i.textStyle)};if(m){let{cursor:v,soundSrc:E,actionPayload:A}=m;h.eventMode="static";let S=()=>{y.isHovering=!0,A&&s&&s("hover",{_event:{id:h.label},...A}),v&&(h.cursor=v),E&&r.audioStage.add({id:`hover-${Date.now()}`,url:E,loop:!1}),_(y)},w=()=>{y.isHovering=!1,h.cursor="auto",_(y)};h.on("pointerover",S),h.on("pointerout",w)}if(p){let{soundSrc:v,soundVolume:E,actionPayload:A}=p;h.eventMode="static";let S=()=>{y.isPressed=!0,_(y)},w=()=>{y.isPressed=!1,_(y),A&&s&&s("click",{_event:{id:h.label},...A}),v&&r.audioStage.add({id:`click-${Date.now()}`,url:v,loop:!1,volume:(E??1e3)/1e3})},P=()=>{y.isPressed=!1,_(y)};h.on("pointerdown",S),h.on("pointerup",w),h.on("pointerupoutside",P)}if(b){let{soundSrc:v,actionPayload:E}=b;h.eventMode="static";let A=()=>{y.isRightPressed=!0,_(y)},S=()=>{y.isRightPressed=!1,_(y),E&&s&&s("rightclick",{_event:{id:h.label},...E}),v&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:v,loop:!1})},w=()=>{y.isRightPressed=!1,_(y)};h.on("rightdown",A),h.on("rightup",S),h.on("rightupoutside",w)}}},g=o?.filter(m=>m.targetId===e.id)||[];if(g.length>0)for(let m of g){let p=a.getVersion();a.track(p),n.dispatch({type:"START",payload:{id:m.id,element:h,properties:m.properties,targetState:{x:c,y:u,alpha:d},onComplete:()=>{a.complete(p),f()}}})}else f()};var O1=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;let n=e?.filter(a=>a.targetId===t.id)||[];if(n.length===0){o.destroy();return}for(let a of n){let l=s.getVersion();s.track(l),i.dispatch({type:"START",payload:{id:a.id,element:o,properties:a.properties,targetState:null,onComplete:()=>{s.complete(l),o&&!o.destroyed&&o.destroy()}}})}};var L1=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,l=t-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var Ee=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(ds).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(ds).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===ds.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=L1({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var D1=({state:r})=>{let t={...Ge,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),r.width&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let e=String(r.content??""),{width:i,height:s}=qt.measureText(e,new Mt(t)),o=Math.round(i),n=Math.round(s);return{...Ee({...r,width:o,height:n}),content:e,textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}}};var Ek=he({type:"text",add:G1,update:U1,delete:O1,parse:D1});var N1=({app:r,parent:t,element:e,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a})=>{let{id:l,x:h,y:c,width:u,height:d,fill:f,border:g,alpha:m}=e,p=new le;p.label=l,p.zIndex=n,(()=>{p.clear(),p.rect(0,0,Math.round(u),Math.round(d)).fill(f),p.x=Math.round(h),p.y=Math.round(c),p.alpha=m,g&&p.stroke({color:g.color,alpha:g.alpha,width:Math.round(g.width)})})();let y=e?.hover,_=e?.click,v=e?.rightClick,E=e?.scroll,A=e?.drag;if(y){let{cursor:w,soundSrc:P,actionPayload:C}=y;p.eventMode="static";let B=()=>{C&&o&&o("hover",{_event:{id:p.label},...C}),w&&(p.cursor=w),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},I=()=>{p.cursor="auto"};p.on("pointerover",B),p.on("pointerout",I)}if(_){let{soundSrc:w,soundVolume:P,actionPayload:C}=_;p.eventMode="static";let B=()=>{C&&o&&o("click",{_event:{id:p.label},...C}),w&&r.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1,volume:(P??1e3)/1e3})};p.on("pointerup",B)}if(v){let{soundSrc:w,actionPayload:P}=v;p.eventMode="static";let C=()=>{P&&o&&o("rightclick",{_event:{id:p.label},...P}),w&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:w,loop:!1})};p.on("rightclick",C)}if(E){p.eventMode="static";let w=P=>{if(P.deltaY<0&&E.up){let{actionPayload:C}=E.up;C&&o&&o("scrollup",{_event:{id:p.label},...C})}else if(P.deltaY>0&&E.down){let{actionPayload:C}=E.down;C&&o&&o("scrolldown",{_event:{id:p.label},...C})}};p.on("wheel",w)}if(A){let{start:w,end:P,move:C}=A;p.eventMode="static";let B=()=>{p._isDragging=!0,w&&o&&o("drag-start",{_event:{id:p.label},...typeof w?.actionPayload=="object"?w.actionPayload:{}})},I=()=>{p._isDragging=!1,P&&o&&o("drag-end",{_event:{id:p.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},L=N=>{C&&o&&p._isDragging&&o("drag-move",{_event:{id:p.label,x:N.global.x,y:N.global.y},...typeof C?.actionPayload=="object"?C.actionPayload:{}})};p.on("pointerdown",B),p.on("pointerup",I),p.on("globalpointermove",L),p.on("pointerupoutside",I)}t.addChild(p);let S=i?.filter(w=>w.targetId===l)||[];for(let w of S){let P=a.getVersion();a.track(P),s.dispatch({type:"START",payload:{id:w.id,element:p,properties:w.properties,targetState:{x:h,y:c,alpha:m},onComplete:()=>{a.complete(P)}}})}};var H1=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=a;let{x:c,y:u,width:d,height:f,fill:g,border:m,alpha:p}=i,b=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.clear(),h.rect(0,0,Math.round(d),Math.round(f)).fill(g),h.x=Math.round(c),h.y=Math.round(u),h.alpha=p,m&&h.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightclick"),h.removeAllListeners("wheel"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let _=i?.hover,v=i?.click,E=i?.rightClick,A=i?.scroll,S=i?.drag;if(_){let{cursor:w,soundSrc:P,actionPayload:C}=_;h.eventMode="static";let B=()=>{C&&n&&n("hover",{_event:{id:h.label},...C}),w&&(h.cursor=w),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},I=()=>{h.cursor="auto"};h.on("pointerover",B),h.on("pointerout",I)}if(v){let{soundSrc:w,soundVolume:P,actionPayload:C}=v;h.eventMode="static";let B=()=>{C&&n&&n("click",{_event:{id:h.label},...C}),w&&r.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1,volume:(P??1e3)/1e3})};h.on("pointerup",B)}if(E){let{soundSrc:w,actionPayload:P}=E;h.eventMode="static";let C=()=>{P&&n&&n("rightclick",{_event:{id:h.label},...P}),w&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:w,loop:!1})};h.on("rightclick",C)}if(A){h.eventMode="static";let w=P=>{if(P.deltaY<0&&A.up){let{actionPayload:C}=A.up;C&&n&&n("scrollup",{_event:{id:h.label},...C})}else if(P.deltaY>0&&A.down){let{actionPayload:C}=A.down;C&&n&&n("scrolldown",{_event:{id:h.label},...C})}};h.on("wheel",w)}if(S){let{start:w,end:P,move:C}=S;h.eventMode="static";let B=()=>{h._isDragging=!0,w&&n&&n("drag-start",{_event:{id:h.label},...typeof w?.actionPayload=="object"?w.actionPayload:{}})},I=()=>{h._isDragging=!1,P&&n&&n("drag-end",{_event:{id:h.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},L=N=>{C&&n&&h._isDragging&&n("drag-move",{_event:{id:h.label,x:N.global.x,y:N.global.y},...typeof C?.actionPayload=="object"?C.actionPayload:{}})};h.on("pointerdown",B),h.on("pointerup",I),h.on("globalpointermove",L),h.on("pointerupoutside",I)}}},y=s?.filter(_=>_.targetId===e.id)||[];if(y.length>0)for(let _ of y){let v=l.getVersion();l.track(v),o.dispatch({type:"START",payload:{id:_.id,element:h,properties:_.properties,targetState:{x:c,y:u,alpha:p},onComplete:()=>{l.complete(v),b()}}})}else b()};var V1=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;let n=e?.filter(a=>a.targetId===t.id)||[];if(n.length===0){o.destroy();return}for(let a of n){let l=s.getVersion();s.track(l),i.dispatch({type:"START",payload:{id:a.id,element:o,properties:a.properties,targetState:null,onComplete:()=>{s.complete(l),o&&!o.destroyed&&o.destroy()}}})}};var W1=({state:r})=>{let t=Ee(r),e=t;return r.border&&(e={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:r.border?.width??0}}),{...e,fill:r.fill??"white",rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scroll&&{scroll:r.scroll}}};var wk=he({type:"rect",add:N1,update:H1,delete:V1,parse:W1});var z1=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,src:f,alpha:g}=e,m=f?R.from(f):R.EMPTY,p=new kt(m);p.label=l,p.zIndex=a,p.x=Math.round(h),p.y=Math.round(c),p.width=Math.round(u),p.height=Math.round(d),p.alpha=g;let b=e?.hover,y=e?.click,_=e?.rightClick,v={isHovering:!1,isPressed:!1,isRightPressed:!1},E=({isHovering:S,isPressed:w,isRightPressed:P})=>{if(P&&_?.src){let C=R.from(_.src);p.texture=C}else if(w&&y?.src){let C=R.from(y.src);p.texture=C}else if(S&&b?.src){let C=R.from(b.src);p.texture=C}else p.texture=m};if(b){let{cursor:S,soundSrc:w,actionPayload:P}=b;p.eventMode="static";let C=()=>{v.isHovering=!0,P&&s&&s("hover",{_event:{id:p.label},...P}),S&&(p.cursor=S),w&&r.audioStage.add({id:`hover-${Date.now()}`,url:w,loop:!1}),E(v)},B=()=>{v.isHovering=!1,p.cursor="auto",E(v)};p.on("pointerover",C),p.on("pointerout",B)}if(y){let{soundSrc:S,soundVolume:w,actionPayload:P}=y;p.eventMode="static";let C=()=>{v.isPressed=!0,E(v)},B=()=>{v.isPressed=!1,E(v),P&&s&&s("click",{_event:{id:p.label},...P}),S&&r.audioStage.add({id:`click-${Date.now()}`,url:S,loop:!1,volume:(w??1e3)/1e3})},I=()=>{v.isPressed=!1,E(v)};p.on("pointerdown",C),p.on("pointerup",B),p.on("pointerupoutside",I)}if(_){let{soundSrc:S,actionPayload:w}=_;p.eventMode="static";let P=()=>{v.isRightPressed=!0,E(v)},C=()=>{v.isRightPressed=!1,E(v),w&&s&&s("rightclick",{_event:{id:p.label},...w}),S&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:S,loop:!1})},B=()=>{v.isRightPressed=!1,E(v)};p.on("rightdown",P),p.on("rightup",C),p.on("rightupoutside",B)}t.addChild(p);let A=i?.filter(S=>S.targetId===l)||[];for(let S of A){let w=n.getVersion();n.track(w),o.dispatch({type:"START",payload:{id:S.id,element:p,properties:S.properties,targetState:{x:h,y:c,width:u,height:d,alpha:g},onComplete:()=>{n.complete(w)}}})}};var $1=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=l;let{id:c,x:u,y:d,width:f,height:g,src:m,alpha:p}=i,b=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){let _=m?R.from(m):R.EMPTY;h.texture=_,h.x=Math.round(u),h.y=Math.round(d),h.width=Math.round(f),h.height=Math.round(g),h.alpha=p,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let v=i?.hover,E=i?.click,A=i?.rightClick,S={isHovering:!1,isPressed:!1,isRightPressed:!1},w=({isHovering:P,isPressed:C,isRightPressed:B})=>{if(B&&A?.src){let I=R.from(A.src);h.texture=I}else if(C&&E?.src){let I=R.from(E.src);h.texture=I}else if(P&&v?.src){let I=R.from(v.src);h.texture=I}else h.texture=_};if(v){let{cursor:P,soundSrc:C,actionPayload:B}=v;h.eventMode="static";let I=()=>{S.isHovering=!0,B&&a&&a("hover",{_event:{id:h.label},...B}),P&&(h.cursor=P),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1}),w(S)},L=()=>{S.isHovering=!1,h.cursor="auto",w(S)};h.on("pointerover",I),h.on("pointerout",L)}if(E){let{soundSrc:P,soundVolume:C,actionPayload:B}=E;h.eventMode="static";let I=()=>{S.isPressed=!0,w(S)},L=()=>{S.isPressed=!1,w(S),B&&a&&a("click",{_event:{id:h.label},...B}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:(C??1e3)/1e3})},N=()=>{S.isPressed=!1,w(S)};h.on("pointerdown",I),h.on("pointerup",L),h.on("pointerupoutside",N)}if(A){let{soundSrc:P,actionPayload:C}=A;h.eventMode="static";let B=()=>{S.isRightPressed=!0,w(S)},I=()=>{S.isRightPressed=!1,w(S),C&&a&&a("rightclick",{_event:{id:h.label},...C}),P&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:P,loop:!1})},L=()=>{S.isRightPressed=!1,w(S)};h.on("rightdown",B),h.on("rightup",I),h.on("rightupoutside",L)}}},y=s?.filter(_=>_.targetId===e.id)||[];if(y.length>0)for(let _ of y){let v=n.getVersion();n.track(v),o.dispatch({type:"START",payload:{id:_.id,element:h,properties:_.properties,targetState:{x:u,y:d,width:f,height:g,alpha:p},onComplete:()=>{n.complete(v),b()}}})}else b()};var X1=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===t.id);if(!o)return;let n=e?.filter(a=>a.targetId===t.id)||[];if(n.length===0){o.destroy();return}for(let a of n){let l=s.getVersion();s.track(l),i.dispatch({type:"START",payload:{id:a.id,element:o,properties:a.properties,targetState:null,onComplete:()=>{s.complete(l),o&&!o.destroyed&&o.destroy()}}})}};var j1=({state:r})=>({...Ee(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var Ak=he({type:"sprite",add:z1,update:$1,delete:X1,parse:j1});var Y1=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,src:f,volume:g,loop:m,alpha:p}=e,b=R.from(f),y=b.source.resource;y.pause(),y.currentTime=0,y.loop=m??!1,y.volume=g/1e3,y.muted=!1,y.play();let _=new kt(b);_.label=l,_.zIndex=a,_.x=Math.round(h),_.y=Math.round(c),_.width=Math.round(u),_.height=Math.round(d),_.alpha=p??1,t.addChild(_);let v=i?.filter(E=>E.targetId===l)||[];for(let E of v){let A=n.getVersion();n.track(A),o.dispatch({type:"START",payload:{id:E.id,element:_,properties:E.properties,targetState:{x:h,y:c,width:u,height:d,alpha:p??1},onComplete:()=>{n.complete(A)}}})}};var q1=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,completionTracker:a,zIndex:l})=>{let h=t.children.find(b=>b.label===e.id);if(!h)return;h.zIndex=l;let{x:c,y:u,width:d,height:f,alpha:g}=i,m=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){if(h.x=Math.round(c),h.y=Math.round(u),h.width=Math.round(d),h.height=Math.round(f),h.alpha=g??1,e.src!==i.src){let b=h.texture.source.resource;b&&b.pause();let y=R.from(i.src);h.texture=y;let _=y.source.resource;_.muted=!1,_.pause(),_.currentTime=0,_.play()}h.texture.source.resource.volume=i.volume/1e3,h.texture.source.resource.loop=i.loop??!1}},p=s?.filter(b=>b.targetId===e.id)||[];if(p.length>0)for(let b of p){let y=a.getVersion();a.track(y),o.dispatch({type:"START",payload:{id:b.id,element:h,properties:b.properties,targetState:{x:c,y:u,width:d,height:f,alpha:g??1},onComplete:()=>{a.complete(y),m()}}})}else m()};var K1=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(l=>l.label===e.id);if(!n)return;let a=i?.filter(l=>l.targetId===e.id)||[];if(a.length===0){let l=n.texture.source.resource;l&&l.pause(),t.removeChild(n),n.destroy();return}for(let l of a){let h=o.getVersion();o.track(h),s.dispatch({type:"START",payload:{id:l.id,element:n,properties:l.properties,targetState:null,onComplete:()=>{if(o.complete(h),n&&!n.destroyed){let c=n.texture.source.resource;c&&c.pause(),t.removeChild(n),n.destroy()}}}})}};var Z1=({state:r})=>({...Ee(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var Pk=he({type:"video",add:Y1,update:q1,delete:K1,parse:Z1});var Q1=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,eventHandler:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,alpha:f,thumbSrc:g,barSrc:m,direction:p,min:b,max:y,step:_,initialValue:v,originX:E,originY:A,hover:S,change:w}=e,P=new yt;P.label=l,P.zIndex=a,P.x=h,P.y=c,P.alpha=f,P.sortableChildren=!0,P.eventMode="static";let C=0,B=m?R.from(m):R.EMPTY,I=new kt(B);I.label=`${l}-bar`,I.eventMode="static";let L=g?R.from(g):R.EMPTY,N=new kt(L);N.label=`${l}-thumb`,N.eventMode="static";let ut=v??b,H=y-b,K=pt=>{let lt=(pt-b)/H;p==="horizontal"?(N.x=lt*(I.width-N.width),N.y=(I.height-N.height)/2):(N.x=(I.width-N.width)/2,N.y=lt*(I.height-N.height))};(()=>{I.width=u,I.height=d;let pt=p==="horizontal"?d-C*2:u-C*2,lt=g?R.from(g):R.EMPTY,_t=lt.width,Ft=lt.height,Qt=pt/_t,Jt=pt/Ft,Le=Math.min(Qt,Jt);N.width=_t*Le,N.height=Ft*Le,K(ut)})();let U=L,z=B,rt=!1,nt=pt=>{let lt;if(p==="horizontal"){let Ft=pt.x-N.width/2;lt=Math.max(0,Math.min(1,Ft/(I.width-N.width)))}else{let Ft=pt.y-N.height/2;lt=Math.max(0,Math.min(1,Ft/(I.height-N.height)))}let _t=b+lt*H;return _>0&&(_t=Math.round((_t-b)/_)*_+b,_t=Math.max(b,Math.min(y,_t))),_t},Tt=pt=>{let lt=P.toLocal(pt.global),_t=nt(lt);_t!==ut&&(ut=_t,K(ut),w?.actionPayload&&n&&n("change",{_event:{id:l,value:ut},...w.actionPayload}))},Ut=pt=>{rt=!0,Tt(pt)},Nt=pt=>{rt&&Tt(pt)},Zt=()=>{rt&&(rt=!1)};if(P.on("pointerdown",Ut),P.on("globalpointermove",Nt),P.on("pointerup",Zt),P.on("pointerupoutside",Zt),S){let{cursor:pt,soundSrc:lt,thumbSrc:_t,barSrc:Ft}=S,Qt=()=>{pt&&(I.cursor=pt,N.cursor=pt),lt&&r.audioStage.add({id:`hover-${Date.now()}`,url:lt,loop:!1}),_t&&(N.texture=R.from(_t)),Ft&&(I.texture=R.from(Ft))},Jt=()=>{rt||(I.cursor="auto",N.cursor="auto",N.texture=U,I.texture=z)};P.on("pointerover",Qt),P.on("pointerout",Jt),P.on("pointerupoutside",Jt)}P.addChild(I),P.addChild(N),t.addChild(P);let Pe=i?.filter(pt=>pt.targetId===l)||[];for(let pt of Pe){let lt=o.getVersion();o.track(lt),s.dispatch({type:"START",payload:{id:pt.id,element:P,properties:pt.properties,targetState:{x:h,y:c,alpha:f},onComplete:()=>{o.complete(lt)}}})}};var J1=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(m=>m.label===e.id);if(!h)return;h.zIndex=l;let c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.label=i.id,h.pivot.set(i.originX,i.originY);let m=h.getChildByLabel(`${i.id}-bar`),p=h.getChildByLabel(`${i.id}-thumb`),b=JSON.stringify(e.hover)!==JSON.stringify(i.hover)||JSON.stringify(e.change)!==JSON.stringify(i.change)||e.min!==i.min||e.max!==i.max||e.step!==i.step||e.direction!==i.direction;if(m&&p){m.width=i.width,m.height=i.height;let y=0,_=i.direction==="horizontal"?i.height-y*2:i.width-y*2,v=i.thumbSrc?R.from(i.thumbSrc):R.EMPTY,E=v.width||16,A=v.height||16,S=_/E,w=_/A,P=Math.min(S,w);if(p.width=E*P,p.height=A*P,e.barSrc!==i.barSrc){let I=i.barSrc?R.from(i.barSrc):R.EMPTY;m.texture=I}if(e.thumbSrc!==i.thumbSrc){let I=i.thumbSrc?R.from(i.thumbSrc):R.EMPTY;p.texture=I}let C=i.max-i.min,B=(i.initialValue-i.min)/C;i.direction==="horizontal"?(p.x=B*(m.width-p.width),p.y=(m.height-p.height)/2):(p.x=(m.width-p.width)/2,p.y=B*(m.height-p.height))}if(b&&(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove")),b){let{hover:y,change:_,min:v,max:E,step:A,direction:S,initialValue:w}=i,P=w??v,C=E-v;h.eventMode="static";let B=z=>{let rt=(z-v)/C;S==="horizontal"?(p.x=rt*(m.width-p.width),p.y=(m.height-p.height)/2):(p.x=(m.width-p.width)/2,p.y=rt*(m.height-p.height))},I=z=>{let rt;if(S==="horizontal"){let Tt=z.x-p.width/2;rt=Math.max(0,Math.min(1,Tt/(m.width-p.width)))}else{let Tt=z.y-p.height/2;rt=Math.max(0,Math.min(1,Tt/(m.height-p.height)))}let nt=v+rt*C;return A>0&&(nt=Math.round((nt-v)/A)*A+v,nt=Math.max(v,Math.min(E,nt))),nt},L=p.texture,N=m.texture,ut=!1,H=z=>{let rt=h.toLocal(z.global),nt=I(rt);nt!==P&&(P=nt,B(P),_?.actionPayload&&a&&a("change",{_event:{id:i.id,value:P},..._.actionPayload}))},K=z=>{ut=!0,H(z)},W=z=>{ut&&H(z)},U=()=>{ut&&(ut=!1)};if(h.on("pointerdown",K),h.on("globalpointermove",W),h.on("pointerup",U),h.on("pointerupoutside",U),y){let{cursor:z,soundSrc:rt,thumbSrc:nt,barSrc:Tt}=y,Ut=()=>{z&&(h.cursor=z,p.cursor=z),rt&&r.audioStage.add({id:`hover-${Date.now()}`,url:rt,loop:!1}),nt&&(p.texture=R.from(nt)),Tt&&(m.texture=R.from(Tt))},Nt=()=>{ut||(h.cursor="auto",p.cursor="auto",p.texture=L,m.texture=N)};h.on("pointerover",Ut),h.on("pointerout",Nt),h.on("pointerupoutside",Nt)}}}},{x:u,y:d,alpha:f}=i,g=s?.filter(m=>m.targetId===e.id)||[];if(g.length>0)for(let m of g){let p=n.getVersion();n.track(p),o.dispatch({type:"START",payload:{id:m.id,element:h,properties:m.properties,targetState:{x:u,y:d,alpha:f},onComplete:()=>{n.complete(p),c()}}})}else c()};var tP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=i?.filter(l=>l.targetId===e.id)||[];if(a.length===0){n.destroy({children:!0});return}for(let l of a){let h=o.getVersion();o.track(h),s.dispatch({type:"START",payload:{id:l.id,element:n,properties:l.properties,targetState:null,onComplete:()=>{o.complete(h),n&&!n.destroyed&&n.destroy({children:!0})}}})}};var eP=({state:r})=>{let t=Ee(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue??0,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var Ck=he({type:"slider",add:Q1,update:J1,delete:tP,parse:eP});var gl=({container:r,element:t})=>{let e=0,i=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),i=Math.max(n.height+n.y,i)});let s=t.scroll&&t.height&&i>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new yt({label:`${r.label}-content`});[...r.children].forEach(f=>{n.addChild(f)}),r.addChild(n);let l=new le({label:`${r.label}-clip`}).rect(0,0,t.width||e,t.height||i).fill({color:16711680,alpha:0});r.addChild(l),n.mask=l,r.eventMode="static",r.hitArea=new et(0,0,t.width||e,t.height||i);let h=0,c=0,u=-(i-(t.height||i)),d=-(e-(t.width||e));r.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let g=h-f.deltaY;g>0?h=0:g<u?h=u:h=g,n.y=h}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let g=f.deltaX!==0?f.deltaX:f.deltaY,m=c-g;m>0?c=0:m<d?c=d:c=m,n.x=c}})}},Gg=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel")};var rP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,zIndex:a,completionTracker:l})=>{let{id:h,x:c,y:u,children:d,scroll:f,alpha:g}=e,m=new yt;if(m.label=h,m.zIndex=a,m.x=Math.round(c),m.y=Math.round(u),m.alpha=g,t.addChild(m),d&&d.length>0)for(let v of d){let E=n.find(A=>A.type===v.type);if(!E)throw new Error(`No plugin found for child element type: ${v.type}`);E.add({app:r,parent:m,element:v,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,completionTracker:l})}f&&gl({container:m,element:e});let p=e?.hover,b=e?.click,y=e?.rightClick;if(p){let{cursor:v,soundSrc:E,actionPayload:A}=p;m.eventMode="static";let S=()=>{A&&s&&s("hover",{_event:{id:m.label},...A}),v&&(m.cursor=v),E&&r.audioStage.add({id:`hover-${Date.now()}`,url:E,loop:!1})},w=()=>{m.cursor="auto"};m.on("pointerover",S),m.on("pointerout",w)}if(b){let{soundSrc:v,soundVolume:E,actionPayload:A}=b;m.eventMode="static";let S=()=>{A&&s&&s("click",{_event:{id:m.label},...A}),v&&r.audioStage.add({id:`click-${Date.now()}`,url:v,loop:!1,volume:(E??1e3)/1e3})};m.on("pointerup",S)}if(y){let{soundSrc:v,actionPayload:E}=y;m.eventMode="static";let A=()=>{E&&s&&s("rightclick",{_event:{id:m.label},...E}),v&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:v,loop:!1})};m.on("rightclick",A)}let _=i?.filter(v=>v.targetId===h)||[];for(let v of _){let E=l.getVersion();l.track(E),o.dispatch({type:"START",payload:{id:v.id,element:m,properties:v.properties,targetState:{x:c,y:u,alpha:g},onComplete:()=>{l.complete(E)}}})}};var xl=r=>{let t=new Set;if(r.id&&t.add(r.id),r.children&&Array.isArray(r.children))for(let e of r.children)for(let i of xl(e))t.add(i);return t};var iP=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let h of r)i.add(h.id),s.set(h.id,h);for(let h of t)i.add(h.id),o.set(h.id,h);for(let h of i){let c=s.get(h),u=o.get(h);if(!c&&u)n.push(u);else if(c&&!u)a.push(c);else{let d=xl(u),f=e.find(g=>d.has(g.targetId));(JSON.stringify(c)!==JSON.stringify(u)||f)&&l.push({prev:c,next:u})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var yl=({app:r,parent:t,prevComputedTree:e,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l})=>{t.sortableChildren=!0;let{toAddElement:h,toDeleteElement:c,toUpdateElement:u}=iP(e,i,s);for(let d of t.children){let f=i.findIndex(g=>g.id===d.label);f!==-1&&(d.zIndex=f)}for(let d of c){let f=l.find(g=>g.type===d.type);if(!f)throw new Error(`No plugin found for element type: ${d.type}`);f.delete({app:r,parent:t,element:d,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l})}for(let d of h){let f=l.find(m=>m.type===d.type);if(!f)throw new Error(`No plugin found for element type: ${d.type}`);let g=i.findIndex(m=>m.id===d.id);f.add({app:r,parent:t,element:d,animations:s,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,zIndex:g})}for(let{prev:d,next:f}of u){let g=l.find(p=>p.type===f.type);if(!g)throw new Error(`No plugin found for element type: ${f.type}`);let m=i.findIndex(p=>p.id===f.id);g.update({app:r,parent:t,prevElement:d,nextElement:f,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,zIndex:m})}};var sP=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,zIndex:l,completionTracker:h})=>{let c=t.children.find(p=>p.label===e.id);if(!c)return;c.zIndex=l;let{x:u,y:d,alpha:f}=i,g=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){c.x=Math.round(u),c.y=Math.round(d),c.label=i.id,c.alpha=f,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightclick");let _=i?.hover,v=i?.click,E=i?.rightClick;if(_){let{cursor:A,soundSrc:S,actionPayload:w}=_;c.eventMode="static";let P=()=>{w&&s&&s("hover",{_event:{id:c.label},...w}),A&&(c.cursor=A),S&&r.audioStage.add({id:`hover-${Date.now()}`,url:S,loop:!1})},C=()=>{c.cursor="auto"};c.on("pointerover",P),c.on("pointerout",C)}if(v){let{soundSrc:A,soundVolume:S,actionPayload:w}=v;c.eventMode="static";let P=()=>{w&&s&&s("click",{_event:{id:c.label},...w}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:(S??1e3)/1e3})};c.on("pointerup",P)}if(E){let{soundSrc:A,actionPayload:S}=E;c.eventMode="static";let w=()=>{S&&s&&s("rightclick",{_event:{id:c.label},...S}),A&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:A,loop:!1})};c.on("rightclick",w)}e.scroll!==i.scroll?i.scroll?gl({container:c,element:i}):Gg({container:c}):i.scroll&&(Gg({container:c}),gl({container:c,element:i}))}let p=JSON.stringify(e.children)!==JSON.stringify(i.children),b=xl({children:i.children}),y=o?.some(_=>b.has(_.targetId));(p||y)&&yl({app:r,parent:i.scroll?c.children.find(_=>_.label===`${i.id}-content`):c,nextComputedTree:i.children,prevComputedTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:h})},m=o?.filter(p=>p.targetId===e.id)||[];if(m.length>0)for(let p of m){let b=h.getVersion();h.track(b),n.dispatch({type:"START",payload:{id:p.id,element:c,properties:p.properties,targetState:{x:u,y:d,alpha:f},onComplete:()=>{h.complete(b),g()}}})}else g()};var oP=({app:r,parent:t,element:e,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=t.getChildByLabel(e.id);if(!a)return;let l=s?.filter(c=>c.targetId===e.id)||[],h=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0,texture:!0,baseTexture:!0}))};if(l.length===0){h();return}for(let c of l){let u=n.getVersion();n.track(u),i.dispatch({type:"START",payload:{id:c.id,element:a,properties:c.properties,targetState:null,onComplete:()=>{n.complete(u),h()}}})}};var nP=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,h=0,c=0,u=0,d=0,f=0,g=0,m=0,p=0;for(let _=0;_<o.length;_++){let v=_<o.length-1?s:0,E=o[_];_>0?e==="horizontal"?(E.x=h,E.y=f):e==="vertical"&&(E.x=g,E.y=c):(e==="horizontal"||e==="vertical")&&(E.x=0,E.y=0);let A=t.find(S=>S.type===E.type);if(A){let S=(E.scaleX??1)*(r.scaleX??1),w=(E.scaleY??1)*(r.scaleY??1);E=A.parse({state:{...E,scaleX:S,scaleY:w},parserPlugins:t})}e==="horizontal"?(r.width&&E.width+m>r.width&&!i?(h=0,m=0,f+=u+s,u=E.height,E.x=0,E.y=f):u=Math.max(u,E.height),h+=E.width+v,m=E.x+E.width,a=Math.max(h,a),l=Math.max(E.height+E.y,l)):e==="vertical"?(r.height&&E.height+p>r.height&&!i?(c=0,p=0,g+=d+s,d=E.width,E.x=g,E.y=0):d=Math.max(d,E.width),c+=E.height+v,p=E.y+E.height,a=Math.max(E.width+E.x,a),l=Math.max(c,l)):(a=Math.max(E.width+E.x,a),l=Math.max(E.height+E.y,l)),n.push(E)}let y={...Ee({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:e,gap:s,scroll:i,rotation:r.rotation??0};return r.rightClick&&(y.rightClick=r.rightClick),y};var Rk=he({type:"container",add:rP,update:sP,delete:oP,parse:nP});function Lo(r,t){let e=r.text.substring(0,t),s=qt.measureText(e,r.style).width;return r.x+s}var Mk=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s=setTimeout(()=>{e()},r),o=()=>{clearTimeout(s),i(t.reason)};t?.addEventListener("abort",o,{once:!0})}),Do=Mk;var aP=async({parent:r,element:t,completionTracker:e,zIndex:i})=>{let s=e.getVersion();e.track(s);let o=t.speed??50,n=t.revealEffect??"typewriter",a=t?.indicator?.offset??12,l=n==="none",h=l?0:Math.max(1,Math.floor(1e3/o)),c=l?0:Math.max(1,Math.floor(4e3/o)),u=new yt;u.label=t.id,u.zIndex=i;let d=new kt(R.EMPTY);if(t?.indicator?.revealing?.src){let f=t.indicator.revealing.src?R.from(t.indicator.revealing.src):R.EMPTY;d=new kt(f),d.width=t.indicator.revealing.width??f.width,d.height=t.indicator.revealing.height??f.height}u.addChild(d),t.x!==void 0&&(u.x=Math.round(t.x)),t.y!==void 0&&(u.y=Math.round(t.y)),t.alpha!==void 0&&(u.alpha=t.alpha),r.addChild(u);for(let f=0;f<t.content.length;f++){let g=t.content[f];d.x=a,d.y=g.y+(g.lineMaxHeight-d.height);for(let m=0;m<g.lineParts.length;m++){let p=g.lineParts[m],b=new Mt(p.textStyle),y=new Sr({text:"",style:b,x:Math.round(p.x),y:Math.round(p.y)}),_=null;if(p.furigana){let A=new Mt(p.furigana.textStyle);_=new Sr({text:"",style:A,x:Math.round(p.furigana.x),y:Math.round(p.furigana.y)}),u.addChild(_)}u.addChild(y);let v=p.text,E=p.furigana?.text||"";if(l)y.text=v,d.x=Lo(y,v.length-1)+a,_&&(_.text=E);else{let A=E.length;for(let S=0;S<v.length;S++){y.text=v.substring(0,S+1),d.x=Lo(y,S)+a;let w=Math.round((S+1)/v.length*A);_&&(_.text=E.substring(0,w)),S<v.length-1&&await Do(h)}}}f<t.content.length-1&&await Do(c)}if(t?.indicator?.complete?.src){let f=t.indicator.complete.src?R.from(t.indicator.complete.src):R.EMPTY;d.texture=f,d.width=t.indicator.complete.width??f.width,d.height=t.indicator.complete.height??f.height}e.complete(s)};var lP=async r=>{let{parent:t,nextElement:e,completionTracker:i,zIndex:s}=r,o=i.getVersion();i.track(o);let n=e.speed??50,a=e.revealEffect??"typewriter",l=e?.indicator?.offset??12,h=a==="none",c=h?0:Math.max(1,Math.floor(1e3/n)),u=h?0:Math.max(1,Math.floor(4e3/n)),d=t.children.find(f=>f.label===e.id);if(d){d.zIndex=s,d.removeChildren();let f=new kt(R.EMPTY);if(e?.indicator?.revealing?.src){let g=e.indicator.revealing.src?R.from(e.indicator.revealing.src):R.EMPTY;f=new kt(g),f.width=e.indicator.revealing.width??g.width,f.height=e.indicator.revealing.height??g.height}d.addChild(f),e.x!==void 0&&(d.x=e.x),e.y!==void 0&&(d.y=e.y),e.alpha!==void 0&&(d.alpha=e.alpha);for(let g=0;g<e.content.length;g++){let m=e.content[g];f.x=l,f.y=m.y+(m.lineMaxHeight-f.height);for(let p=0;p<m.lineParts.length;p++){let b=m.lineParts[p],y=new Mt(b.textStyle),_=new Sr({text:"",style:y,x:b.x,y:b.y}),v=null;if(b.furigana){let S=new Mt(b.furigana.textStyle);v=new Sr({text:"",style:S,x:b.furigana.x,y:b.furigana.y}),d.addChild(v)}d.addChild(_);let E=b.text,A=b.furigana?.text||"";if(h)_.text=E,f.x=Lo(_,E.length-1)+l,v&&(v.text=A);else{let S=A.length;for(let w=0;w<E.length;w++){_.text=E.substring(0,w+1),f.x=Lo(_,w)+l;let P=Math.round((w+1)/E.length*S);v&&(v.text=A.substring(0,P)),w<E.length-1&&await Do(c)}}}g<e.content.length-1&&await Do(u)}if(e?.indicator?.complete?.src){let g=e.indicator.complete.src?R.from(e.indicator.complete.src):R.EMPTY;f.texture=g,f.width=e.indicator.complete.width??g.width,f.height=e.indicator.complete.height??g.height}i.complete(o)}};var hP=({parent:r,element:t})=>{let e=r.getChildByLabel(t.id);e&&!e.destroyed&&e.destroy({children:!0})};var Bk=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,l=[...r],h=new WeakSet;for(;l.length>0;){let u=l[0];if(!u.text||u.text.length===0){l.shift();continue}let d=Math.round(t-s),f={...u.textStyle,wordWrapWidth:d},g=qt.measureText(u.text,new Mt(f));if(g.lineWidths[0]>d&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let m=g.lines[0];g.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let p=qt.measureText(m,new Mt({...u.textStyle,wordWrap:!1,breakWords:!1})),b={text:m,textStyle:f,height:p.height,x:s,y:o};if(u.furigana&&!h.has(u)){h.add(u);let _=qt.measureText(u.furigana.text,new Mt(u.furigana.textStyle)),v=-_.height+o+2,E={text:u.furigana.text,textStyle:u.furigana.textStyle,x:Math.round(s+(g.lineWidths[0]-_.width)/2),y:v};b.furigana=E}i.push(b),n=Math.max(n,p.height),s+=Math.round(g.lineWidths[0]),a=Math.max(a,s);let y=g.lines.slice(1).join(" ");y&&y.length>0?u.text=y:l.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let g=f.height;f.height&&delete f.height;let m=f.y+(d-g),p=f.furigana;return p&&(p.y=p.y-f.y+m),{...f,...p&&{furigana:p},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},cP=({state:r})=>{let t={...Ge,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(c.furigana){let g={...t,...c.furigana.textStyle||{}};g.lineHeight=Math.round(g.lineHeight*g.fontSize),r.width&&(g.wordWrapWidth=r.width,g.wordWrap=!0),d={text:String(c.furigana.text),textStyle:g}}return{text:String(c.text).replace(/ +$/,g=>"\xA0".repeat(g.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=Bk(e,i),a=r.width||o,h=Ee({...r,width:a,height:n});if(h.alpha=r.alpha??1,r.indicator){let c=r.indicator;h.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...h,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var Ik=he({type:"text-revealing",add:aP,update:lP,delete:hP,parse:cP});var wu=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},Au=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var uP=async({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,zIndex:n})=>{let{id:a,x:l,y:h,width:c,height:u,spritesheetSrc:d,spritesheetData:f,animation:g,alpha:m}=e,p=f,b=Object.keys(p.frames),y=new Ei(R.from(d),p);await y.parse();let _=g.frames.map(A=>y.textures[b[A]]),v=new ml(_);v.label=a,v.zIndex=n,v.animationSpeed=g.animationSpeed??.5,v.loop=g.loop??!0,r.debug?wu(v,a,r.debug):v.play(),v.x=Math.round(l),v.y=Math.round(h),c!==void 0&&(v.width=Math.round(c)),u!==void 0&&(v.height=Math.round(u)),v.alpha=m,t.addChild(v);let E=i?.filter(A=>A.targetId===a)||[];for(let A of E){let S=o.getVersion();o.track(S),s.dispatch({type:"START",payload:{id:A.id,element:v,properties:A.properties,targetState:{x:l,y:h,width:c,height:u,alpha:m},onComplete:()=>{o.complete(S)}}})}};var dP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(p=>p.label===e.id);if(!l)return;l.zIndex=a;let h=async()=>{if(JSON.stringify(e)!==JSON.stringify(i)&&(l.x=Math.round(i.x),l.y=Math.round(i.y),l.width=Math.round(i.width),l.height=Math.round(i.height),l.alpha=i.alpha,JSON.stringify(e.animation)!==JSON.stringify(i.animation))){l.animationSpeed=i.animation.animationSpeed??.5,l.loop=i.animation.loop??!0;let p=i.spritesheetData,b=Object.keys(p.frames),y=new Ei(R.from(i.spritesheetSrc),p);await y.parse();let _=i.animation.frames.map(v=>y.textures[b[v]]);l.textures=_,r.debug?e.id!==i.id&&(Au(l),wu(l,i.id,r.debug)):l.play()}},{x:c,y:u,width:d,height:f,alpha:g}=i,m=s?.filter(p=>p.targetId===e.id)||[];if(m.length>0)for(let p of m){let b=n.getVersion();n.track(b),o.dispatch({type:"START",payload:{id:p.id,element:l,properties:p.properties,targetState:{x:c,y:u,width:d,height:f,alpha:g},onComplete:async()=>{n.complete(b),await h()}}})}else await h()};var fP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;let a=()=>{r.debug&&Au(n),n&&!n.destroyed&&(n.stop(),n.destroy())},l=i?.filter(h=>h.targetId===e.id)||[];if(l.length===0){a();return}for(let h of l){let c=o.getVersion();o.track(c),s.dispatch({type:"START",payload:{id:h.id,element:n,properties:h.properties,targetState:null,onComplete:()=>{o.complete(c),a()}}})}};var pP=({state:r})=>({...Ee(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var Fk=he({type:"animated-sprite",add:uP,update:dP,delete:fP,parse:pP});var kk=Ig({type:"tween"});var Pu=new Set,Ug=()=>{for(let r of Pu)clearTimeout(r);Pu.clear()},mP=({app:r,element:t})=>{let e={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};if(t.delay&&t.delay>0){let i=setTimeout(()=>{Pu.delete(i),r.audioStage.add(e)},t.delay);Pu.add(i)}else r.audioStage.add(e)};var gP=({app:r,prevElement:t,nextElement:e})=>{if(t.src!==e.src||t.volume!==e.volume){let i=r.audioStage.getById(t.id);i&&(i.url=e.src,i.volume=(e.volume??800)/1e3)}};var xP=({app:r,element:t})=>{r.audioStage.remove(t.id)};var Gk=Fg({type:"sound",add:mP,update:gP,delete:xP});var _l=class extends kt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Og(r){let t=new le;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Lg(r){let t=new le;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Dg(r){let t=new le;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function bl(r,t,e){return r+(t-r)*e}function Ru(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function yP(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,l=t&255,h=Math.round(bl(i,n,e)),c=Math.round(bl(s,a,e)),u=Math.round(bl(o,l,e));return h<<16|c<<8|u}var Cu=class r{constructor(t,e,i=!1){this.value=i?Ru(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},Er=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=Cu.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?yP(e.value,e.next.value,i):bl(e.value,e.next.value,i)}};var Mu=class{static type="alpha";constructor(t){this.list=new Er(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},Bu=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var Iu=class{static type="scale";constructor(t){this.list=new Er(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},Fu=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var Uk=Math.PI/180,ku=class{static type="speed";constructor(t){this.list=new Er(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Gu=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Uu=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*Uk}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var iht=Math.PI/180,Ou=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},Lu=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Ui=Math.PI/180,Du=class{static type="rotation";constructor(t){this.minStart=t.minStart*Ui,this.maxStart=t.maxStart*Ui,this.minSpeed=t.minSpeed*Ui,this.maxSpeed=t.maxSpeed*Ui,this.accel=(t.accel??0)*Ui}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},Nu=class{static type="rotationStatic";constructor(t){this.min=t.min*Ui,this.max=t.max*Ui}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},Hu=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*Ui}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var Vu=class{static type="color";constructor(t){this.list=new Er(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},Wu=class{static type="colorStatic";constructor(t){this.color=Ru(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var zu=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},$u=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},Ng=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},Hg=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},Ok={rect:zu,rectangle:zu,torus:$u,circle:$u,point:Ng,line:Hg};var Xu=class{static type="spawnShape";constructor(t){let e=Ok[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},ju=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var _P=new Map,bP=new Map;function Vg(r,t){_P.set(r,t)}function we(r){bP.set(r.type,r)}function vP(r,t){let e=_P.get(r);return e?e(t):null}function TP(r){return bP.get(r)}Vg("circle",Dg);Vg("snowflake",Og);Vg("raindrop",Lg);we(Mu);we(Bu);we(Iu);we(Fu);we(ku);we(Gu);we(Uu);we(Ou);we(Lu);we(Du);we(Nu);we(Hu);we(Vu);we(Wu);we(Xu);we(ju);var Yu=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var vl=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new Yu(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=TP(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new _l(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function Lk(r,t){let e=new le,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var Tl=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,zIndex:n})=>{let a=new yt;a.label=e.id,a.zIndex=n,t.addChild(a);let l=e.width,h=e.height;a.x=e.x??0,a.y=e.y??0;let c={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},u;if(typeof e.texture=="object"&&e.texture.shape)u=Lk(r,e.texture);else{let m=e.texture??"circle";if(u=vP(m,r),!u)try{u=R.from(m)}catch{console.warn(`Failed to load particle texture: ${m}`);return}}c.texture=u;let d=new vl(a,c);if(a.emitter=d,c.recycleOnBounds){let m=Math.min(e.count??100,c.maxParticles);d.spawn(m);let p=d._activeFirst;for(;p;)p.y=d.random()*h,p.age=d.random()*p.maxLife*.8,p=p.next}let f=m=>{if(d.destroyed){r.ticker.remove(f);return}d.update(m.deltaTime/60)};if(a.tickerCallback=f,r?.debug){let m=p=>{if(d.destroyed){window.removeEventListener("snapShotKeyFrame",m);return}p?.detail?.deltaMS&&d.update(Number(p.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",m),a.customTickerHandler=m}else r.ticker.add(f);e.alpha!==void 0&&(a.alpha=e.alpha);let g=i?.filter(m=>m.targetId===e.id)||[];for(let m of g){let p=o.getVersion();o.track(p),s.dispatch({type:"START",payload:{id:m.id,element:a,properties:m.properties,targetState:{x:e.x??0,y:e.y??0,alpha:e.alpha},onComplete:()=>{o.complete(p)}}})}};var qu=({app:r,parent:t,element:e,animationBus:i,animations:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))},l=s?.filter(h=>h.targetId===e.id)||[];if(l.length===0){a();return}for(let h of l){let c=o.getVersion();o.track(c),i.dispatch({type:"START",payload:{id:h.id,element:n,properties:h.properties,targetState:null,onComplete:()=>{o.complete(c),a()}}})}};var SP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(c=>c.label===e.id);if(!l){Tl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});return}l.zIndex=a,Dk(e,i)?(qu({app:r,parent:t,element:e,animations:s,animationBus:o,completionTracker:n}),Tl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})):(i.alpha!==void 0&&(l.alpha=i.alpha),i.x!==void 0&&(l.x=i.x),i.y!==void 0&&(l.y=i.y))};function Dk(r,t){return r.count!==t.count||JSON.stringify(r.texture)!==JSON.stringify(t.texture)||JSON.stringify(r.behaviors)!==JSON.stringify(t.behaviors)||JSON.stringify(r.emitter)!==JSON.stringify(t.emitter)||r.width!==t.width||r.height!==t.height}function EP(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(ds).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(ds).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function wP(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function AP(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function PP(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function CP(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function RP(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var MP=({state:r})=>{EP(r),wP(r),AP(r),PP(r),CP(r),RP(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var Nk=he({type:"particles",add:Tl,update:SP,delete:qu,parse:MP});var BP=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)e.add(l.id),i.set(l.id,l);for(let l of t)e.add(l.id),s.set(l.id,l);for(let l of e){let h=i.get(l),c=s.get(l);!h&&c?o.push(c):h&&!c?n.push(h):(h.src!==c.src||h.volume!==c.volume||h.loop!==c.loop||h.delay!==c.delay)&&a.push({prev:h,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Wg=({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i})=>{Ug();let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=BP(t,e);for(let a of o){let l=i.find(h=>h.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(h=>h.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let h=i.find(c=>c.type===l.type);if(!h)throw new Error(`No audio plugin found for type: ${l.type}`);h.update({app:r,prevElement:a,nextElement:l})}};var Ke=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ke||{}),zg=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(zg||{}),Ku=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Ku||{}),Q=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(Q||{}),No=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(No||{}),G=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(G||{}),hi=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(hi||{}),st=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(st||{}),D=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(D||{}),ur=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(ur||{}),Sl=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Sl||{}),wr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(wr||{}),Ze=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(Ze||{}),Oi=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Oi||{}),Zu=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Zu||{}),Ue=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ue||{}),re=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(re||{});var Pt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Pt||{}),$e=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))($e||{});var $g={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var Y={ADAPTER:$g,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Cf();var Hk=Ti.default??Ti,Ar=Hk(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var _s=zi(FP(),1),IU=zi(uc(),1);var wx=zi(qR(),1);var KR={};function ct(r,t,e=3){if(KR[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1145
1145
  Deprecated since v${r}`):(i=i.split(`
1146
1146
  `).splice(e).join(`
1147
1147
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "route-graphics",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "A 2D graphics rendering interface that takes JSON input and renders pixels using PixiJS",
5
5
  "main": "dist/RouteGraphics.js",
6
6
  "type": "module",
@@ -28,11 +28,13 @@
28
28
  "scripts": {
29
29
  "lint": "bunx prettier --check src",
30
30
  "lint:fix": "bunx prettier --check --write src",
31
- "build": "bun run esbuild.js",
32
- "vt:generate": "bun run esbuild.js && rtgl vt generate --skip-screenshots",
33
- "vt:docker": "bun run esbuild.js && docker run --rm --user $(id -u):$(id -g) -e RTGL_VT_DEBUG=true -v \"$PWD:/app\" -w /app han4wluc/rtgl:playwright-v1.57.0-rtgl-v0.0.38 rtgl vt generate --wait-event vt:ready --concurrency 8",
34
- "vt:report": "bun run vt:docker && rtgl vt report",
35
- "vt:accept": "rtgl vt accept",
31
+ "build": "bunx esbuild ./src/index.js --bundle --minify --format=esm --outfile=./dist/RouteGraphics.js && bunx esbuild ./src/index.js --bundle --sourcemap --format=esm --outfile=./vt/static/RouteGraphics.js",
32
+ "vt:docker:pull": "docker pull han4wluc/rtgl:playwright-v1.57.0-rtgl-v1.0.0-rc11",
33
+ "vt:generate": "bun run build && docker run --rm --user $(id -u):$(id -g) -e RTGL_VT_DEBUG=true -v \"$PWD:/workspace\" han4wluc/rtgl:playwright-v1.57.0-rtgl-v1.0.0-rc11 rtgl vt generate --wait-event vt:ready",
34
+ "vt:screenshot": "bun run build && docker run --rm --user $(id -u):$(id -g) -e RTGL_VT_DEBUG=true -v \"$PWD:/workspace\" han4wluc/rtgl:playwright-v1.57.0-rtgl-v1.0.0-rc11 rtgl vt screenshot --wait-event vt:ready --concurrency 8",
35
+ "vt:docker": "bun run vt:screenshot",
36
+ "vt:report": "bun run vt:screenshot && docker run --rm --user $(id -u):$(id -g) -e RTGL_VT_DEBUG=true -v \"$PWD:/workspace\" han4wluc/rtgl:playwright-v1.57.0-rtgl-v1.0.0-rc11 rtgl vt report",
37
+ "vt:accept": "docker run --rm --user $(id -u):$(id -g) -e RTGL_VT_DEBUG=true -v \"$PWD:/workspace\" han4wluc/rtgl:playwright-v1.57.0-rtgl-v1.0.0-rc11 rtgl vt accept",
36
38
  "test": "vitest run",
37
39
  "test:coverage": "vitest run --coverage",
38
40
  "test:watch": "vitest",