@nelsonlongxiang/dsh-open-a2a-net 0.5.14 → 0.6.24
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 +243 -121
- package/README_zh.md +144 -84
- package/assets/nexusDist/assets/index-034h1cNc.js +3 -0
- package/assets/nexusDist/assets/index-PG9EieGX.css +1 -0
- package/assets/nexusDist/index.html +26 -0
- package/assets/stageDist/assets/index-Bj7S2pA1.css +1 -0
- package/assets/stageDist/assets/index-C-28k_o5.js +974 -0
- package/assets/stageDist/assets/interiors-CQGBjffT.png +0 -0
- package/assets/stageDist/assets/office-tileset-CHQT-uYL.png +0 -0
- package/assets/stageDist/index.html +13 -0
- package/lib/a2a-client.js +190 -13
- package/lib/canvas-store.js +218 -0
- package/lib/card.js +25 -0
- package/lib/client/A2aControl.js +45 -137
- package/lib/client/locales.js +16 -40
- package/lib/client.js +164 -467
- package/lib/client.js.map +1 -1
- package/lib/group-store.js +6 -0
- package/lib/idempotency-store.js +291 -0
- package/lib/index.js +4217 -259
- package/lib/joined-store.js +11 -0
- package/lib/layout-store.js +155 -0
- package/lib/peer-store.js +98 -13
- package/lib/receipt-ladder.js +35 -0
- package/lib/receipt.js +102 -0
- package/lib/self-suppress.js +62 -0
- package/lib/session-transcript.js +150 -0
- package/lib/skill/SKILL.md +77 -0
- package/lib/skill/references/discovery.md +38 -0
- package/lib/skill/references/membership.md +50 -0
- package/lib/skill/references/pitfalls.md +42 -0
- package/lib/skill/references/routing.md +43 -0
- package/lib/skill-registration.js +52 -0
- package/lib/stage-mount.js +32 -0
- package/lib/task-ledger.js +540 -0
- package/lib/team-store.js +122 -0
- package/lib/teams-bridge.js +18 -0
- package/lib/transport-caps.js +31 -0
- package/lib/types/a2a-client.d.ts +72 -1
- package/lib/types/canvas-store.d.ts +102 -0
- package/lib/types/client/A2aControl.d.ts +18 -28
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/group-store.d.ts +6 -0
- package/lib/types/idempotency-store.d.ts +164 -0
- package/lib/types/index.d.ts +210 -6
- package/lib/types/joined-store.d.ts +9 -0
- package/lib/types/layout-store.d.ts +63 -0
- package/lib/types/peer-store.d.ts +45 -2
- package/lib/types/receipt-ladder.d.ts +25 -0
- package/lib/types/receipt.d.ts +51 -0
- package/lib/types/self-suppress.d.ts +41 -0
- package/lib/types/session-transcript.d.ts +37 -0
- package/lib/types/skill-registration.d.ts +3 -0
- package/lib/types/stage-mount.d.ts +29 -0
- package/lib/types/task-ledger.d.ts +308 -0
- package/lib/types/team-store.d.ts +55 -0
- package/lib/types/teams-bridge.d.ts +112 -0
- package/lib/types/transport-caps.d.ts +29 -0
- package/lib/types/types.d.ts +43 -0
- package/nexus-stage/package-lock.json +2262 -0
- package/nexus-stage/package.json +21 -0
- package/nexus-stage/scripts/__pycache__/mockhost.cpython-312.pyc +0 -0
- package/nexus-stage/scripts/mockhost.py +253 -0
- package/nexus-stage/src/canvas-ops.ts +175 -0
- package/nexus-stage/src/canvas-wire.ts +156 -0
- package/nexus-stage/src/edges.ts +72 -0
- package/nexus-stage/src/fault.ts +56 -0
- package/nexus-stage/src/federation.ts +234 -0
- package/nexus-stage/src/layout-doc.ts +143 -0
- package/nexus-stage/src/layout-wire.ts +158 -0
- package/nexus-stage/src/main.ts +361 -0
- package/nexus-stage/src/planning-menus.ts +352 -0
- package/nexus-stage/src/planning-nodelist.ts +294 -0
- package/nexus-stage/src/planning-types.ts +111 -0
- package/nexus-stage/src/planning-view.ts +1313 -0
- package/nexus-stage/src/planning.css +280 -0
- package/nexus-stage/src/seat.ts +35 -0
- package/nexus-stage/src/stage-name.ts +13 -0
- package/nexus-stage/src/tokens.ts +32 -0
- package/nexus-stage/src/viewport.ts +83 -0
- package/nexus-stage/src/workbench.css +267 -0
- package/nexus-stage/src/workbench.ts +1530 -0
- package/nexus-stage/src/world.ts +509 -0
- package/nexus-stage/tsconfig.json +25 -0
- package/nexus-stage/vite.config.ts +16 -0
- package/package.json +83 -22
|
@@ -0,0 +1,974 @@
|
|
|
1
|
+
var Hb=Object.defineProperty;var Vb=(n,e,t)=>e in n?Hb(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var G=(n,e,t)=>Vb(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();function Vg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var jg={exports:{}},de={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var zo=Symbol.for("react.element"),jb=Symbol.for("react.portal"),$b=Symbol.for("react.fragment"),Xb=Symbol.for("react.strict_mode"),Yb=Symbol.for("react.profiler"),Kb=Symbol.for("react.provider"),qb=Symbol.for("react.context"),Qb=Symbol.for("react.forward_ref"),Zb=Symbol.for("react.suspense"),Jb=Symbol.for("react.memo"),ew=Symbol.for("react.lazy"),x0=Symbol.iterator;function tw(n){return n===null||typeof n!="object"?null:(n=x0&&n[x0]||n["@@iterator"],typeof n=="function"?n:null)}var $g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Xg=Object.assign,Yg={};function hs(n,e,t){this.props=n,this.context=e,this.refs=Yg,this.updater=t||$g}hs.prototype.isReactComponent={};hs.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};hs.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function Kg(){}Kg.prototype=hs.prototype;function ed(n,e,t){this.props=n,this.context=e,this.refs=Yg,this.updater=t||$g}var td=ed.prototype=new Kg;td.constructor=ed;Xg(td,hs.prototype);td.isPureReactComponent=!0;var v0=Array.isArray,qg=Object.prototype.hasOwnProperty,nd={current:null},Qg={key:!0,ref:!0,__self:!0,__source:!0};function Zg(n,e,t){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)qg.call(e,r)&&!Qg.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];i.children=l}if(n&&n.defaultProps)for(r in a=n.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:zo,type:n,key:s,ref:o,props:i,_owner:nd.current}}function nw(n,e){return{$$typeof:zo,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function rd(n){return typeof n=="object"&&n!==null&&n.$$typeof===zo}function rw(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var b0=/\/+/g;function vu(n,e){return typeof n=="object"&&n!==null&&n.key!=null?rw(""+n.key):e.toString(36)}function Na(n,e,t,r,i){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var o=!1;if(n===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(n.$$typeof){case zo:case jb:o=!0}}if(o)return o=n,i=i(o),n=r===""?"."+vu(o,0):r,v0(i)?(t="",n!=null&&(t=n.replace(b0,"$&/")+"/"),Na(i,e,t,"",function(u){return u})):i!=null&&(rd(i)&&(i=nw(i,t+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(b0,"$&/")+"/")+n)),e.push(i)),1;if(o=0,r=r===""?".":r+":",v0(n))for(var a=0;a<n.length;a++){s=n[a];var l=r+vu(s,a);o+=Na(s,e,t,l,i)}else if(l=tw(n),typeof l=="function")for(n=l.call(n),a=0;!(s=n.next()).done;)s=s.value,l=r+vu(s,a++),o+=Na(s,e,t,l,i);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function na(n,e,t){if(n==null)return n;var r=[],i=0;return Na(n,r,"","",function(s){return e.call(t,s,i++)}),r}function iw(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var kt={current:null},za={transition:null},sw={ReactCurrentDispatcher:kt,ReactCurrentBatchConfig:za,ReactCurrentOwner:nd};function Jg(){throw Error("act(...) is not supported in production builds of React.")}de.Children={map:na,forEach:function(n,e,t){na(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return na(n,function(){e++}),e},toArray:function(n){return na(n,function(e){return e})||[]},only:function(n){if(!rd(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};de.Component=hs;de.Fragment=$b;de.Profiler=Yb;de.PureComponent=ed;de.StrictMode=Xb;de.Suspense=Zb;de.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sw;de.act=Jg;de.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var r=Xg({},n.props),i=n.key,s=n.ref,o=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=nd.current),e.key!==void 0&&(i=""+e.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(l in e)qg.call(e,l)&&!Qg.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=t;else if(1<l){a=Array(l);for(var u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:zo,type:n.type,key:i,ref:s,props:r,_owner:o}};de.createContext=function(n){return n={$$typeof:qb,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:Kb,_context:n},n.Consumer=n};de.createElement=Zg;de.createFactory=function(n){var e=Zg.bind(null,n);return e.type=n,e};de.createRef=function(){return{current:null}};de.forwardRef=function(n){return{$$typeof:Qb,render:n}};de.isValidElement=rd;de.lazy=function(n){return{$$typeof:ew,_payload:{_status:-1,_result:n},_init:iw}};de.memo=function(n,e){return{$$typeof:Jb,type:n,compare:e===void 0?null:e}};de.startTransition=function(n){var e=za.transition;za.transition={};try{n()}finally{za.transition=e}};de.unstable_act=Jg;de.useCallback=function(n,e){return kt.current.useCallback(n,e)};de.useContext=function(n){return kt.current.useContext(n)};de.useDebugValue=function(){};de.useDeferredValue=function(n){return kt.current.useDeferredValue(n)};de.useEffect=function(n,e){return kt.current.useEffect(n,e)};de.useId=function(){return kt.current.useId()};de.useImperativeHandle=function(n,e,t){return kt.current.useImperativeHandle(n,e,t)};de.useInsertionEffect=function(n,e){return kt.current.useInsertionEffect(n,e)};de.useLayoutEffect=function(n,e){return kt.current.useLayoutEffect(n,e)};de.useMemo=function(n,e){return kt.current.useMemo(n,e)};de.useReducer=function(n,e,t){return kt.current.useReducer(n,e,t)};de.useRef=function(n){return kt.current.useRef(n)};de.useState=function(n){return kt.current.useState(n)};de.useSyncExternalStore=function(n,e,t){return kt.current.useSyncExternalStore(n,e,t)};de.useTransition=function(){return kt.current.useTransition()};de.version="18.3.1";jg.exports=de;var Yt=jg.exports;const $s=Vg(Yt);var ey={exports:{}},Vt={},ty={exports:{}},ny={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* scheduler.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/(function(n){function e(D,B){var W=D.length;D.push(B);e:for(;0<W;){var J=W-1>>>1,X=D[J];if(0<i(X,B))D[J]=B,D[W]=X,W=J;else break e}}function t(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var B=D[0],W=D.pop();if(W!==B){D[0]=W;e:for(var J=0,X=D.length,ne=X>>>1;J<ne;){var fe=2*(J+1)-1,me=D[fe],le=fe+1,ve=D[le];if(0>i(me,W))le<X&&0>i(ve,me)?(D[J]=ve,D[le]=W,J=le):(D[J]=me,D[fe]=W,J=fe);else if(le<X&&0>i(ve,W))D[J]=ve,D[le]=W,J=le;else break e}}return B}function i(D,B){var W=D.sortIndex-B.sortIndex;return W!==0?W:D.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,h=null,d=3,f=!1,p=!1,g=!1,_=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(D){for(var B=t(u);B!==null;){if(B.callback===null)r(u);else if(B.startTime<=D)r(u),B.sortIndex=B.expirationTime,e(l,B);else break;B=t(u)}}function b(D){if(g=!1,x(D),!p)if(t(l)!==null)p=!0,N(S);else{var B=t(u);B!==null&&$(b,B.startTime-D)}}function S(D,B){p=!1,g&&(g=!1,m(M),M=-1),f=!0;var W=d;try{for(x(B),h=t(l);h!==null&&(!(h.expirationTime>B)||D&&!O());){var J=h.callback;if(typeof J=="function"){h.callback=null,d=h.priorityLevel;var X=J(h.expirationTime<=B);B=n.unstable_now(),typeof X=="function"?h.callback=X:h===t(l)&&r(l),x(B)}else r(l);h=t(l)}if(h!==null)var ne=!0;else{var fe=t(u);fe!==null&&$(b,fe.startTime-B),ne=!1}return ne}finally{h=null,d=W,f=!1}}var T=!1,C=null,M=-1,L=5,R=-1;function O(){return!(n.unstable_now()-R<L)}function U(){if(C!==null){var D=n.unstable_now();R=D;var B=!0;try{B=C(!0,D)}finally{B?j():(T=!1,C=null)}}else T=!1}var j;if(typeof y=="function")j=function(){y(U)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,Ee=K.port2;K.port1.onmessage=U,j=function(){Ee.postMessage(null)}}else j=function(){_(U,0)};function N(D){C=D,T||(T=!0,j())}function $(D,B){M=_(function(){D(n.unstable_now())},B)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(D){D.callback=null},n.unstable_continueExecution=function(){p||f||(p=!0,N(S))},n.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<D?Math.floor(1e3/D):5},n.unstable_getCurrentPriorityLevel=function(){return d},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(D){switch(d){case 1:case 2:case 3:var B=3;break;default:B=d}var W=d;d=B;try{return D()}finally{d=W}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(D,B){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var W=d;d=D;try{return B()}finally{d=W}},n.unstable_scheduleCallback=function(D,B,W){var J=n.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?J+W:J):W=J,D){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=W+X,D={id:c++,callback:B,priorityLevel:D,startTime:W,expirationTime:X,sortIndex:-1},W>J?(D.sortIndex=W,e(u,D),t(l)===null&&D===t(u)&&(g?(m(M),M=-1):g=!0,$(b,W-J))):(D.sortIndex=X,e(l,D),p||f||(p=!0,N(S))),D},n.unstable_shouldYield=O,n.unstable_wrapCallback=function(D){var B=d;return function(){var W=d;d=B;try{return D.apply(this,arguments)}finally{d=W}}}})(ny);ty.exports=ny;var ow=ty.exports;/**
|
|
18
|
+
* @license React
|
|
19
|
+
* react-dom.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var aw=Yt,Ht=ow;function V(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var ry=new Set,yo={};function li(n,e){Ji(n,e),Ji(n+"Capture",e)}function Ji(n,e){for(yo[n]=e,n=0;n<e.length;n++)ry.add(e[n])}var $n=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cc=Object.prototype.hasOwnProperty,lw=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w0={},S0={};function uw(n){return Cc.call(S0,n)?!0:Cc.call(w0,n)?!1:lw.test(n)?S0[n]=!0:(w0[n]=!0,!1)}function cw(n,e,t,r){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function hw(n,e,t,r){if(e===null||typeof e>"u"||cw(n,e,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Pt(n,e,t,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var mt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){mt[n]=new Pt(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];mt[e]=new Pt(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){mt[n]=new Pt(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){mt[n]=new Pt(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){mt[n]=new Pt(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){mt[n]=new Pt(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){mt[n]=new Pt(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){mt[n]=new Pt(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){mt[n]=new Pt(n,5,!1,n.toLowerCase(),null,!1,!1)});var id=/[\-:]([a-z])/g;function sd(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(id,sd);mt[e]=new Pt(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(id,sd);mt[e]=new Pt(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(id,sd);mt[e]=new Pt(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){mt[n]=new Pt(n,1,!1,n.toLowerCase(),null,!1,!1)});mt.xlinkHref=new Pt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){mt[n]=new Pt(n,1,!1,n.toLowerCase(),null,!0,!0)});function od(n,e,t,r){var i=mt.hasOwnProperty(e)?mt[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(hw(e,t,i,r)&&(t=null),r||i===null?uw(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):i.mustUseProperty?n[i.propertyName]=t===null?i.type===3?!1:"":t:(e=i.attributeName,r=i.attributeNamespace,t===null?n.removeAttribute(e):(i=i.type,t=i===3||i===4&&t===!0?"":""+t,r?n.setAttributeNS(r,e,t):n.setAttribute(e,t))))}var Jn=aw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ra=Symbol.for("react.element"),Mi=Symbol.for("react.portal"),Ri=Symbol.for("react.fragment"),ad=Symbol.for("react.strict_mode"),Ec=Symbol.for("react.profiler"),iy=Symbol.for("react.provider"),sy=Symbol.for("react.context"),ld=Symbol.for("react.forward_ref"),Ac=Symbol.for("react.suspense"),kc=Symbol.for("react.suspense_list"),ud=Symbol.for("react.memo"),lr=Symbol.for("react.lazy"),oy=Symbol.for("react.offscreen"),T0=Symbol.iterator;function ks(n){return n===null||typeof n!="object"?null:(n=T0&&n[T0]||n["@@iterator"],typeof n=="function"?n:null)}var Ne=Object.assign,bu;function Xs(n){if(bu===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);bu=e&&e[1]||""}return`
|
|
26
|
+
`+bu+n}var wu=!1;function Su(n,e){if(!n||wu)return"";wu=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var r=u}Reflect.construct(n,[],e)}else{try{e.call()}catch(u){r=u}n.call(e.prototype)}else{try{throw Error()}catch(u){r=u}n()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(`
|
|
27
|
+
`),s=r.stack.split(`
|
|
28
|
+
`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=`
|
|
29
|
+
`+i[o].replace(" at new "," at ");return n.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{wu=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?Xs(n):""}function dw(n){switch(n.tag){case 5:return Xs(n.type);case 16:return Xs("Lazy");case 13:return Xs("Suspense");case 19:return Xs("SuspenseList");case 0:case 2:case 15:return n=Su(n.type,!1),n;case 11:return n=Su(n.type.render,!1),n;case 1:return n=Su(n.type,!0),n;default:return""}}function Pc(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Ri:return"Fragment";case Mi:return"Portal";case Ec:return"Profiler";case ad:return"StrictMode";case Ac:return"Suspense";case kc:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case sy:return(n.displayName||"Context")+".Consumer";case iy:return(n._context.displayName||"Context")+".Provider";case ld:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case ud:return e=n.displayName||null,e!==null?e:Pc(n.type)||"Memo";case lr:e=n._payload,n=n._init;try{return Pc(n(e))}catch{}}return null}function fw(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Pc(e);case 8:return e===ad?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Tr(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ay(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function pw(n){var e=ay(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function ia(n){n._valueTracker||(n._valueTracker=pw(n))}function ly(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=ay(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function rl(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Mc(n,e){var t=e.checked;return Ne({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function C0(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=Tr(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function uy(n,e){e=e.checked,e!=null&&od(n,"checked",e,!1)}function Rc(n,e){uy(n,e);var t=Tr(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?Ic(n,e.type,t):e.hasOwnProperty("defaultValue")&&Ic(n,e.type,Tr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function E0(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function Ic(n,e,t){(e!=="number"||rl(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Ys=Array.isArray;function ji(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i<t.length;i++)e["$"+t[i]]=!0;for(t=0;t<n.length;t++)i=e.hasOwnProperty("$"+n[t].value),n[t].selected!==i&&(n[t].selected=i),i&&r&&(n[t].defaultSelected=!0)}else{for(t=""+Tr(t),e=null,i=0;i<n.length;i++){if(n[i].value===t){n[i].selected=!0,r&&(n[i].defaultSelected=!0);return}e!==null||n[i].disabled||(e=n[i])}e!==null&&(e.selected=!0)}}function Bc(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(V(91));return Ne({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function A0(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(V(92));if(Ys(t)){if(1<t.length)throw Error(V(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:Tr(t)}}function cy(n,e){var t=Tr(e.value),r=Tr(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),r!=null&&(n.defaultValue=""+r)}function k0(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function hy(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Dc(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?hy(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var sa,dy=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,r,i){MSApp.execUnsafeLocalFunction(function(){return n(e,t,r,i)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(sa=sa||document.createElement("div"),sa.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=sa.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function _o(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Js={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},mw=["Webkit","ms","Moz","O"];Object.keys(Js).forEach(function(n){mw.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Js[e]=Js[n]})});function fy(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Js.hasOwnProperty(n)&&Js[n]?(""+e).trim():e+"px"}function py(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=fy(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var gw=Ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Fc(n,e){if(e){if(gw[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(V(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(V(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(V(61))}if(e.style!=null&&typeof e.style!="object")throw Error(V(62))}}function Gc(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Oc=null;function cd(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Lc=null,$i=null,Xi=null;function P0(n){if(n=Vo(n)){if(typeof Lc!="function")throw Error(V(280));var e=n.stateNode;e&&(e=Xl(e),Lc(n.stateNode,n.type,e))}}function my(n){$i?Xi?Xi.push(n):Xi=[n]:$i=n}function gy(){if($i){var n=$i,e=Xi;if(Xi=$i=null,P0(n),e)for(n=0;n<e.length;n++)P0(e[n])}}function yy(n,e){return n(e)}function _y(){}var Tu=!1;function xy(n,e,t){if(Tu)return n(e,t);Tu=!0;try{return yy(n,e,t)}finally{Tu=!1,($i!==null||Xi!==null)&&(_y(),gy())}}function xo(n,e){var t=n.stateNode;if(t===null)return null;var r=Xl(t);if(r===null)return null;t=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(n=n.type,r=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!r;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(V(231,e,typeof t));return t}var Uc=!1;if($n)try{var Ps={};Object.defineProperty(Ps,"passive",{get:function(){Uc=!0}}),window.addEventListener("test",Ps,Ps),window.removeEventListener("test",Ps,Ps)}catch{Uc=!1}function yw(n,e,t,r,i,s,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(t,u)}catch(c){this.onError(c)}}var eo=!1,il=null,sl=!1,Nc=null,_w={onError:function(n){eo=!0,il=n}};function xw(n,e,t,r,i,s,o,a,l){eo=!1,il=null,yw.apply(_w,arguments)}function vw(n,e,t,r,i,s,o,a,l){if(xw.apply(this,arguments),eo){if(eo){var u=il;eo=!1,il=null}else throw Error(V(198));sl||(sl=!0,Nc=u)}}function ui(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function vy(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function M0(n){if(ui(n)!==n)throw Error(V(188))}function bw(n){var e=n.alternate;if(!e){if(e=ui(n),e===null)throw Error(V(188));return e!==n?null:n}for(var t=n,r=e;;){var i=t.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){t=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===t)return M0(i),n;if(s===r)return M0(i),e;s=s.sibling}throw Error(V(188))}if(t.return!==r.return)t=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===t){o=!0,t=i,r=s;break}if(a===r){o=!0,r=i,t=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===t){o=!0,t=s,r=i;break}if(a===r){o=!0,r=s,t=i;break}a=a.sibling}if(!o)throw Error(V(189))}}if(t.alternate!==r)throw Error(V(190))}if(t.tag!==3)throw Error(V(188));return t.stateNode.current===t?n:e}function by(n){return n=bw(n),n!==null?wy(n):null}function wy(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=wy(n);if(e!==null)return e;n=n.sibling}return null}var Sy=Ht.unstable_scheduleCallback,R0=Ht.unstable_cancelCallback,ww=Ht.unstable_shouldYield,Sw=Ht.unstable_requestPaint,je=Ht.unstable_now,Tw=Ht.unstable_getCurrentPriorityLevel,hd=Ht.unstable_ImmediatePriority,Ty=Ht.unstable_UserBlockingPriority,ol=Ht.unstable_NormalPriority,Cw=Ht.unstable_LowPriority,Cy=Ht.unstable_IdlePriority,Hl=null,En=null;function Ew(n){if(En&&typeof En.onCommitFiberRoot=="function")try{En.onCommitFiberRoot(Hl,n,void 0,(n.current.flags&128)===128)}catch{}}var mn=Math.clz32?Math.clz32:Pw,Aw=Math.log,kw=Math.LN2;function Pw(n){return n>>>=0,n===0?32:31-(Aw(n)/kw|0)|0}var oa=64,aa=4194304;function Ks(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function al(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,i=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~i;a!==0?r=Ks(a):(s&=o,s!==0&&(r=Ks(s)))}else o=t&~i,o!==0?r=Ks(o):s!==0&&(r=Ks(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0<e;)t=31-mn(e),i=1<<t,r|=n[t],e&=~i;return r}function Mw(n,e){switch(n){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Rw(n,e){for(var t=n.suspendedLanes,r=n.pingedLanes,i=n.expirationTimes,s=n.pendingLanes;0<s;){var o=31-mn(s),a=1<<o,l=i[o];l===-1?(!(a&t)||a&r)&&(i[o]=Mw(a,e)):l<=e&&(n.expiredLanes|=a),s&=~a}}function zc(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function Ey(){var n=oa;return oa<<=1,!(oa&4194240)&&(oa=64),n}function Cu(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function Wo(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-mn(e),n[e]=t}function Iw(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var r=n.eventTimes;for(n=n.expirationTimes;0<t;){var i=31-mn(t),s=1<<i;e[i]=0,r[i]=-1,n[i]=-1,t&=~s}}function dd(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var r=31-mn(t),i=1<<r;i&e|n[r]&e&&(n[r]|=e),t&=~i}}var we=0;function Ay(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var ky,fd,Py,My,Ry,Wc=!1,la=[],mr=null,gr=null,yr=null,vo=new Map,bo=new Map,cr=[],Bw="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function I0(n,e){switch(n){case"focusin":case"focusout":mr=null;break;case"dragenter":case"dragleave":gr=null;break;case"mouseover":case"mouseout":yr=null;break;case"pointerover":case"pointerout":vo.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":bo.delete(e.pointerId)}}function Ms(n,e,t,r,i,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=Vo(e),e!==null&&fd(e)),n):(n.eventSystemFlags|=r,e=n.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),n)}function Dw(n,e,t,r,i){switch(e){case"focusin":return mr=Ms(mr,n,e,t,r,i),!0;case"dragenter":return gr=Ms(gr,n,e,t,r,i),!0;case"mouseover":return yr=Ms(yr,n,e,t,r,i),!0;case"pointerover":var s=i.pointerId;return vo.set(s,Ms(vo.get(s)||null,n,e,t,r,i)),!0;case"gotpointercapture":return s=i.pointerId,bo.set(s,Ms(bo.get(s)||null,n,e,t,r,i)),!0}return!1}function Iy(n){var e=$r(n.target);if(e!==null){var t=ui(e);if(t!==null){if(e=t.tag,e===13){if(e=vy(t),e!==null){n.blockedOn=e,Ry(n.priority,function(){Py(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Wa(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=Hc(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var r=new t.constructor(t.type,t);Oc=r,t.target.dispatchEvent(r),Oc=null}else return e=Vo(t),e!==null&&fd(e),n.blockedOn=t,!1;e.shift()}return!0}function B0(n,e,t){Wa(n)&&t.delete(e)}function Fw(){Wc=!1,mr!==null&&Wa(mr)&&(mr=null),gr!==null&&Wa(gr)&&(gr=null),yr!==null&&Wa(yr)&&(yr=null),vo.forEach(B0),bo.forEach(B0)}function Rs(n,e){n.blockedOn===e&&(n.blockedOn=null,Wc||(Wc=!0,Ht.unstable_scheduleCallback(Ht.unstable_NormalPriority,Fw)))}function wo(n){function e(i){return Rs(i,n)}if(0<la.length){Rs(la[0],n);for(var t=1;t<la.length;t++){var r=la[t];r.blockedOn===n&&(r.blockedOn=null)}}for(mr!==null&&Rs(mr,n),gr!==null&&Rs(gr,n),yr!==null&&Rs(yr,n),vo.forEach(e),bo.forEach(e),t=0;t<cr.length;t++)r=cr[t],r.blockedOn===n&&(r.blockedOn=null);for(;0<cr.length&&(t=cr[0],t.blockedOn===null);)Iy(t),t.blockedOn===null&&cr.shift()}var Yi=Jn.ReactCurrentBatchConfig,ll=!0;function Gw(n,e,t,r){var i=we,s=Yi.transition;Yi.transition=null;try{we=1,pd(n,e,t,r)}finally{we=i,Yi.transition=s}}function Ow(n,e,t,r){var i=we,s=Yi.transition;Yi.transition=null;try{we=4,pd(n,e,t,r)}finally{we=i,Yi.transition=s}}function pd(n,e,t,r){if(ll){var i=Hc(n,e,t,r);if(i===null)Fu(n,e,r,ul,t),I0(n,r);else if(Dw(i,n,e,t,r))r.stopPropagation();else if(I0(n,r),e&4&&-1<Bw.indexOf(n)){for(;i!==null;){var s=Vo(i);if(s!==null&&ky(s),s=Hc(n,e,t,r),s===null&&Fu(n,e,r,ul,t),s===i)break;i=s}i!==null&&r.stopPropagation()}else Fu(n,e,r,null,t)}}var ul=null;function Hc(n,e,t,r){if(ul=null,n=cd(r),n=$r(n),n!==null)if(e=ui(n),e===null)n=null;else if(t=e.tag,t===13){if(n=vy(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return ul=n,null}function By(n){switch(n){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Tw()){case hd:return 1;case Ty:return 4;case ol:case Cw:return 16;case Cy:return 536870912;default:return 16}default:return 16}}var dr=null,md=null,Ha=null;function Dy(){if(Ha)return Ha;var n,e=md,t=e.length,r,i="value"in dr?dr.value:dr.textContent,s=i.length;for(n=0;n<t&&e[n]===i[n];n++);var o=t-n;for(r=1;r<=o&&e[t-r]===i[s-r];r++);return Ha=i.slice(n,1<r?1-r:void 0)}function Va(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function ua(){return!0}function D0(){return!1}function jt(n){function e(t,r,i,s,o){this._reactName=t,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in n)n.hasOwnProperty(a)&&(t=n[a],this[a]=t?t(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?ua:D0,this.isPropagationStopped=D0,this}return Ne(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=ua)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=ua)},persist:function(){},isPersistent:ua}),e}var ds={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gd=jt(ds),Ho=Ne({},ds,{view:0,detail:0}),Lw=jt(Ho),Eu,Au,Is,Vl=Ne({},Ho,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:yd,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Is&&(Is&&n.type==="mousemove"?(Eu=n.screenX-Is.screenX,Au=n.screenY-Is.screenY):Au=Eu=0,Is=n),Eu)},movementY:function(n){return"movementY"in n?n.movementY:Au}}),F0=jt(Vl),Uw=Ne({},Vl,{dataTransfer:0}),Nw=jt(Uw),zw=Ne({},Ho,{relatedTarget:0}),ku=jt(zw),Ww=Ne({},ds,{animationName:0,elapsedTime:0,pseudoElement:0}),Hw=jt(Ww),Vw=Ne({},ds,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),jw=jt(Vw),$w=Ne({},ds,{data:0}),G0=jt($w),Xw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Yw={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Kw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qw(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=Kw[n])?!!e[n]:!1}function yd(){return qw}var Qw=Ne({},Ho,{key:function(n){if(n.key){var e=Xw[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=Va(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Yw[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:yd,charCode:function(n){return n.type==="keypress"?Va(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Va(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Zw=jt(Qw),Jw=Ne({},Vl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),O0=jt(Jw),eS=Ne({},Ho,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:yd}),tS=jt(eS),nS=Ne({},ds,{propertyName:0,elapsedTime:0,pseudoElement:0}),rS=jt(nS),iS=Ne({},Vl,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),sS=jt(iS),oS=[9,13,27,32],_d=$n&&"CompositionEvent"in window,to=null;$n&&"documentMode"in document&&(to=document.documentMode);var aS=$n&&"TextEvent"in window&&!to,Fy=$n&&(!_d||to&&8<to&&11>=to),L0=" ",U0=!1;function Gy(n,e){switch(n){case"keyup":return oS.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Oy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ii=!1;function lS(n,e){switch(n){case"compositionend":return Oy(e);case"keypress":return e.which!==32?null:(U0=!0,L0);case"textInput":return n=e.data,n===L0&&U0?null:n;default:return null}}function uS(n,e){if(Ii)return n==="compositionend"||!_d&&Gy(n,e)?(n=Dy(),Ha=md=dr=null,Ii=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Fy&&e.locale!=="ko"?null:e.data;default:return null}}var cS={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function N0(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!cS[n.type]:e==="textarea"}function Ly(n,e,t,r){my(r),e=cl(e,"onChange"),0<e.length&&(t=new gd("onChange","change",null,t,r),n.push({event:t,listeners:e}))}var no=null,So=null;function hS(n){Ky(n,0)}function jl(n){var e=Fi(n);if(ly(e))return n}function dS(n,e){if(n==="change")return e}var Uy=!1;if($n){var Pu;if($n){var Mu="oninput"in document;if(!Mu){var z0=document.createElement("div");z0.setAttribute("oninput","return;"),Mu=typeof z0.oninput=="function"}Pu=Mu}else Pu=!1;Uy=Pu&&(!document.documentMode||9<document.documentMode)}function W0(){no&&(no.detachEvent("onpropertychange",Ny),So=no=null)}function Ny(n){if(n.propertyName==="value"&&jl(So)){var e=[];Ly(e,So,n,cd(n)),xy(hS,e)}}function fS(n,e,t){n==="focusin"?(W0(),no=e,So=t,no.attachEvent("onpropertychange",Ny)):n==="focusout"&&W0()}function pS(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return jl(So)}function mS(n,e){if(n==="click")return jl(e)}function gS(n,e){if(n==="input"||n==="change")return jl(e)}function yS(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var yn=typeof Object.is=="function"?Object.is:yS;function To(n,e){if(yn(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(r=0;r<t.length;r++){var i=t[r];if(!Cc.call(e,i)||!yn(n[i],e[i]))return!1}return!0}function H0(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function V0(n,e){var t=H0(n);n=0;for(var r;t;){if(t.nodeType===3){if(r=n+t.textContent.length,n<=e&&r>=e)return{node:t,offset:e-n};n=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=H0(t)}}function zy(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?zy(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function Wy(){for(var n=window,e=rl();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=rl(n.document)}return e}function xd(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function _S(n){var e=Wy(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&zy(t.ownerDocument.documentElement,t)){if(r!==null&&xd(t)){if(e=r.start,n=r.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!n.extend&&s>r&&(i=r,r=s,s=i),i=V0(t,s);var o=V0(t,r);i&&o&&(n.rangeCount!==1||n.anchorNode!==i.node||n.anchorOffset!==i.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),n.removeAllRanges(),s>r?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var xS=$n&&"documentMode"in document&&11>=document.documentMode,Bi=null,Vc=null,ro=null,jc=!1;function j0(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;jc||Bi==null||Bi!==rl(r)||(r=Bi,"selectionStart"in r&&xd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ro&&To(ro,r)||(ro=r,r=cl(Vc,"onSelect"),0<r.length&&(e=new gd("onSelect","select",null,e,t),n.push({event:e,listeners:r}),e.target=Bi)))}function ca(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var Di={animationend:ca("Animation","AnimationEnd"),animationiteration:ca("Animation","AnimationIteration"),animationstart:ca("Animation","AnimationStart"),transitionend:ca("Transition","TransitionEnd")},Ru={},Hy={};$n&&(Hy=document.createElement("div").style,"AnimationEvent"in window||(delete Di.animationend.animation,delete Di.animationiteration.animation,delete Di.animationstart.animation),"TransitionEvent"in window||delete Di.transitionend.transition);function $l(n){if(Ru[n])return Ru[n];if(!Di[n])return n;var e=Di[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in Hy)return Ru[n]=e[t];return n}var Vy=$l("animationend"),jy=$l("animationiteration"),$y=$l("animationstart"),Xy=$l("transitionend"),Yy=new Map,$0="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Er(n,e){Yy.set(n,e),li(e,[n])}for(var Iu=0;Iu<$0.length;Iu++){var Bu=$0[Iu],vS=Bu.toLowerCase(),bS=Bu[0].toUpperCase()+Bu.slice(1);Er(vS,"on"+bS)}Er(Vy,"onAnimationEnd");Er(jy,"onAnimationIteration");Er($y,"onAnimationStart");Er("dblclick","onDoubleClick");Er("focusin","onFocus");Er("focusout","onBlur");Er(Xy,"onTransitionEnd");Ji("onMouseEnter",["mouseout","mouseover"]);Ji("onMouseLeave",["mouseout","mouseover"]);Ji("onPointerEnter",["pointerout","pointerover"]);Ji("onPointerLeave",["pointerout","pointerover"]);li("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));li("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));li("onBeforeInput",["compositionend","keypress","textInput","paste"]);li("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));li("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));li("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),wS=new Set("cancel close invalid load scroll toggle".split(" ").concat(qs));function X0(n,e,t){var r=n.type||"unknown-event";n.currentTarget=t,vw(r,e,void 0,n),n.currentTarget=null}function Ky(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var r=n[t],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,u=a.currentTarget;if(a=a.listener,l!==s&&i.isPropagationStopped())break e;X0(i,a,u),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,u=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;X0(i,a,u),s=l}}}if(sl)throw n=Nc,sl=!1,Nc=null,n}function Re(n,e){var t=e[qc];t===void 0&&(t=e[qc]=new Set);var r=n+"__bubble";t.has(r)||(qy(e,n,2,!1),t.add(r))}function Du(n,e,t){var r=0;e&&(r|=4),qy(t,n,r,e)}var ha="_reactListening"+Math.random().toString(36).slice(2);function Co(n){if(!n[ha]){n[ha]=!0,ry.forEach(function(t){t!=="selectionchange"&&(wS.has(t)||Du(t,!1,n),Du(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[ha]||(e[ha]=!0,Du("selectionchange",!1,e))}}function qy(n,e,t,r){switch(By(e)){case 1:var i=Gw;break;case 4:i=Ow;break;default:i=pd}t=i.bind(null,e,t,n),i=void 0,!Uc||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?n.addEventListener(e,t,{capture:!0,passive:i}):n.addEventListener(e,t,!0):i!==void 0?n.addEventListener(e,t,{passive:i}):n.addEventListener(e,t,!1)}function Fu(n,e,t,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=$r(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}xy(function(){var u=s,c=cd(t),h=[];e:{var d=Yy.get(n);if(d!==void 0){var f=gd,p=n;switch(n){case"keypress":if(Va(t)===0)break e;case"keydown":case"keyup":f=Zw;break;case"focusin":p="focus",f=ku;break;case"focusout":p="blur",f=ku;break;case"beforeblur":case"afterblur":f=ku;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=F0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=Nw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=tS;break;case Vy:case jy:case $y:f=Hw;break;case Xy:f=rS;break;case"scroll":f=Lw;break;case"wheel":f=sS;break;case"copy":case"cut":case"paste":f=jw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=O0}var g=(e&4)!==0,_=!g&&n==="scroll",m=g?d!==null?d+"Capture":null:d;g=[];for(var y=u,x;y!==null;){x=y;var b=x.stateNode;if(x.tag===5&&b!==null&&(x=b,m!==null&&(b=xo(y,m),b!=null&&g.push(Eo(y,b,x)))),_)break;y=y.return}0<g.length&&(d=new f(d,p,null,t,c),h.push({event:d,listeners:g}))}}if(!(e&7)){e:{if(d=n==="mouseover"||n==="pointerover",f=n==="mouseout"||n==="pointerout",d&&t!==Oc&&(p=t.relatedTarget||t.fromElement)&&($r(p)||p[Xn]))break e;if((f||d)&&(d=c.window===c?c:(d=c.ownerDocument)?d.defaultView||d.parentWindow:window,f?(p=t.relatedTarget||t.toElement,f=u,p=p?$r(p):null,p!==null&&(_=ui(p),p!==_||p.tag!==5&&p.tag!==6)&&(p=null)):(f=null,p=u),f!==p)){if(g=F0,b="onMouseLeave",m="onMouseEnter",y="mouse",(n==="pointerout"||n==="pointerover")&&(g=O0,b="onPointerLeave",m="onPointerEnter",y="pointer"),_=f==null?d:Fi(f),x=p==null?d:Fi(p),d=new g(b,y+"leave",f,t,c),d.target=_,d.relatedTarget=x,b=null,$r(c)===u&&(g=new g(m,y+"enter",p,t,c),g.target=x,g.relatedTarget=_,b=g),_=b,f&&p)t:{for(g=f,m=p,y=0,x=g;x;x=gi(x))y++;for(x=0,b=m;b;b=gi(b))x++;for(;0<y-x;)g=gi(g),y--;for(;0<x-y;)m=gi(m),x--;for(;y--;){if(g===m||m!==null&&g===m.alternate)break t;g=gi(g),m=gi(m)}g=null}else g=null;f!==null&&Y0(h,d,f,g,!1),p!==null&&_!==null&&Y0(h,_,p,g,!0)}}e:{if(d=u?Fi(u):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var S=dS;else if(N0(d))if(Uy)S=gS;else{S=pS;var T=fS}else(f=d.nodeName)&&f.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(S=mS);if(S&&(S=S(n,u))){Ly(h,S,t,c);break e}T&&T(n,d,u),n==="focusout"&&(T=d._wrapperState)&&T.controlled&&d.type==="number"&&Ic(d,"number",d.value)}switch(T=u?Fi(u):window,n){case"focusin":(N0(T)||T.contentEditable==="true")&&(Bi=T,Vc=u,ro=null);break;case"focusout":ro=Vc=Bi=null;break;case"mousedown":jc=!0;break;case"contextmenu":case"mouseup":case"dragend":jc=!1,j0(h,t,c);break;case"selectionchange":if(xS)break;case"keydown":case"keyup":j0(h,t,c)}var C;if(_d)e:{switch(n){case"compositionstart":var M="onCompositionStart";break e;case"compositionend":M="onCompositionEnd";break e;case"compositionupdate":M="onCompositionUpdate";break e}M=void 0}else Ii?Gy(n,t)&&(M="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(M="onCompositionStart");M&&(Fy&&t.locale!=="ko"&&(Ii||M!=="onCompositionStart"?M==="onCompositionEnd"&&Ii&&(C=Dy()):(dr=c,md="value"in dr?dr.value:dr.textContent,Ii=!0)),T=cl(u,M),0<T.length&&(M=new G0(M,n,null,t,c),h.push({event:M,listeners:T}),C?M.data=C:(C=Oy(t),C!==null&&(M.data=C)))),(C=aS?lS(n,t):uS(n,t))&&(u=cl(u,"onBeforeInput"),0<u.length&&(c=new G0("onBeforeInput","beforeinput",null,t,c),h.push({event:c,listeners:u}),c.data=C))}Ky(h,e)})}function Eo(n,e,t){return{instance:n,listener:e,currentTarget:t}}function cl(n,e){for(var t=e+"Capture",r=[];n!==null;){var i=n,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=xo(n,t),s!=null&&r.unshift(Eo(n,s,i)),s=xo(n,e),s!=null&&r.push(Eo(n,s,i))),n=n.return}return r}function gi(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function Y0(n,e,t,r,i){for(var s=e._reactName,o=[];t!==null&&t!==r;){var a=t,l=a.alternate,u=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&u!==null&&(a=u,i?(l=xo(t,s),l!=null&&o.unshift(Eo(t,l,a))):i||(l=xo(t,s),l!=null&&o.push(Eo(t,l,a)))),t=t.return}o.length!==0&&n.push({event:e,listeners:o})}var SS=/\r\n?/g,TS=/\u0000|\uFFFD/g;function K0(n){return(typeof n=="string"?n:""+n).replace(SS,`
|
|
30
|
+
`).replace(TS,"")}function da(n,e,t){if(e=K0(e),K0(n)!==e&&t)throw Error(V(425))}function hl(){}var $c=null,Xc=null;function Yc(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Kc=typeof setTimeout=="function"?setTimeout:void 0,CS=typeof clearTimeout=="function"?clearTimeout:void 0,q0=typeof Promise=="function"?Promise:void 0,ES=typeof queueMicrotask=="function"?queueMicrotask:typeof q0<"u"?function(n){return q0.resolve(null).then(n).catch(AS)}:Kc;function AS(n){setTimeout(function(){throw n})}function Gu(n,e){var t=e,r=0;do{var i=t.nextSibling;if(n.removeChild(t),i&&i.nodeType===8)if(t=i.data,t==="/$"){if(r===0){n.removeChild(i),wo(e);return}r--}else t!=="$"&&t!=="$?"&&t!=="$!"||r++;t=i}while(t);wo(e)}function _r(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function Q0(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var fs=Math.random().toString(36).slice(2),Cn="__reactFiber$"+fs,Ao="__reactProps$"+fs,Xn="__reactContainer$"+fs,qc="__reactEvents$"+fs,kS="__reactListeners$"+fs,PS="__reactHandles$"+fs;function $r(n){var e=n[Cn];if(e)return e;for(var t=n.parentNode;t;){if(e=t[Xn]||t[Cn]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=Q0(n);n!==null;){if(t=n[Cn])return t;n=Q0(n)}return e}n=t,t=n.parentNode}return null}function Vo(n){return n=n[Cn]||n[Xn],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Fi(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(V(33))}function Xl(n){return n[Ao]||null}var Qc=[],Gi=-1;function Ar(n){return{current:n}}function Ie(n){0>Gi||(n.current=Qc[Gi],Qc[Gi]=null,Gi--)}function Pe(n,e){Gi++,Qc[Gi]=n.current,n.current=e}var Cr={},Tt=Ar(Cr),Bt=Ar(!1),Jr=Cr;function es(n,e){var t=n.type.contextTypes;if(!t)return Cr;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=e[s];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=i),i}function Dt(n){return n=n.childContextTypes,n!=null}function dl(){Ie(Bt),Ie(Tt)}function Z0(n,e,t){if(Tt.current!==Cr)throw Error(V(168));Pe(Tt,e),Pe(Bt,t)}function Qy(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(V(108,fw(n)||"Unknown",i));return Ne({},t,r)}function fl(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Cr,Jr=Tt.current,Pe(Tt,n),Pe(Bt,Bt.current),!0}function J0(n,e,t){var r=n.stateNode;if(!r)throw Error(V(169));t?(n=Qy(n,e,Jr),r.__reactInternalMemoizedMergedChildContext=n,Ie(Bt),Ie(Tt),Pe(Tt,n)):Ie(Bt),Pe(Bt,t)}var Ln=null,Yl=!1,Ou=!1;function Zy(n){Ln===null?Ln=[n]:Ln.push(n)}function MS(n){Yl=!0,Zy(n)}function kr(){if(!Ou&&Ln!==null){Ou=!0;var n=0,e=we;try{var t=Ln;for(we=1;n<t.length;n++){var r=t[n];do r=r(!0);while(r!==null)}Ln=null,Yl=!1}catch(i){throw Ln!==null&&(Ln=Ln.slice(n+1)),Sy(hd,kr),i}finally{we=e,Ou=!1}}return null}var Oi=[],Li=0,pl=null,ml=0,Kt=[],qt=0,ei=null,zn=1,Wn="";function Lr(n,e){Oi[Li++]=ml,Oi[Li++]=pl,pl=n,ml=e}function Jy(n,e,t){Kt[qt++]=zn,Kt[qt++]=Wn,Kt[qt++]=ei,ei=n;var r=zn;n=Wn;var i=32-mn(r)-1;r&=~(1<<i),t+=1;var s=32-mn(e)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,zn=1<<32-mn(e)+i|t<<i|r,Wn=s+n}else zn=1<<s|t<<i|r,Wn=n}function vd(n){n.return!==null&&(Lr(n,1),Jy(n,1,0))}function bd(n){for(;n===pl;)pl=Oi[--Li],Oi[Li]=null,ml=Oi[--Li],Oi[Li]=null;for(;n===ei;)ei=Kt[--qt],Kt[qt]=null,Wn=Kt[--qt],Kt[qt]=null,zn=Kt[--qt],Kt[qt]=null}var Wt=null,zt=null,De=!1,dn=null;function e_(n,e){var t=Qt(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function ep(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,Wt=n,zt=_r(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,Wt=n,zt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=ei!==null?{id:zn,overflow:Wn}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=Qt(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,Wt=n,zt=null,!0):!1;default:return!1}}function Zc(n){return(n.mode&1)!==0&&(n.flags&128)===0}function Jc(n){if(De){var e=zt;if(e){var t=e;if(!ep(n,e)){if(Zc(n))throw Error(V(418));e=_r(t.nextSibling);var r=Wt;e&&ep(n,e)?e_(r,t):(n.flags=n.flags&-4097|2,De=!1,Wt=n)}}else{if(Zc(n))throw Error(V(418));n.flags=n.flags&-4097|2,De=!1,Wt=n}}}function tp(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Wt=n}function fa(n){if(n!==Wt)return!1;if(!De)return tp(n),De=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!Yc(n.type,n.memoizedProps)),e&&(e=zt)){if(Zc(n))throw t_(),Error(V(418));for(;e;)e_(n,e),e=_r(e.nextSibling)}if(tp(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(V(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){zt=_r(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}zt=null}}else zt=Wt?_r(n.stateNode.nextSibling):null;return!0}function t_(){for(var n=zt;n;)n=_r(n.nextSibling)}function ts(){zt=Wt=null,De=!1}function wd(n){dn===null?dn=[n]:dn.push(n)}var RS=Jn.ReactCurrentBatchConfig;function Bs(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(V(309));var r=t.stateNode}if(!r)throw Error(V(147,n));var i=r,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=i.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof n!="string")throw Error(V(284));if(!t._owner)throw Error(V(290,n))}return n}function pa(n,e){throw n=Object.prototype.toString.call(e),Error(V(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function np(n){var e=n._init;return e(n._payload)}function n_(n){function e(m,y){if(n){var x=m.deletions;x===null?(m.deletions=[y],m.flags|=16):x.push(y)}}function t(m,y){if(!n)return null;for(;y!==null;)e(m,y),y=y.sibling;return null}function r(m,y){for(m=new Map;y!==null;)y.key!==null?m.set(y.key,y):m.set(y.index,y),y=y.sibling;return m}function i(m,y){return m=wr(m,y),m.index=0,m.sibling=null,m}function s(m,y,x){return m.index=x,n?(x=m.alternate,x!==null?(x=x.index,x<y?(m.flags|=2,y):x):(m.flags|=2,y)):(m.flags|=1048576,y)}function o(m){return n&&m.alternate===null&&(m.flags|=2),m}function a(m,y,x,b){return y===null||y.tag!==6?(y=Vu(x,m.mode,b),y.return=m,y):(y=i(y,x),y.return=m,y)}function l(m,y,x,b){var S=x.type;return S===Ri?c(m,y,x.props.children,b,x.key):y!==null&&(y.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===lr&&np(S)===y.type)?(b=i(y,x.props),b.ref=Bs(m,y,x),b.return=m,b):(b=Qa(x.type,x.key,x.props,null,m.mode,b),b.ref=Bs(m,y,x),b.return=m,b)}function u(m,y,x,b){return y===null||y.tag!==4||y.stateNode.containerInfo!==x.containerInfo||y.stateNode.implementation!==x.implementation?(y=ju(x,m.mode,b),y.return=m,y):(y=i(y,x.children||[]),y.return=m,y)}function c(m,y,x,b,S){return y===null||y.tag!==7?(y=Zr(x,m.mode,b,S),y.return=m,y):(y=i(y,x),y.return=m,y)}function h(m,y,x){if(typeof y=="string"&&y!==""||typeof y=="number")return y=Vu(""+y,m.mode,x),y.return=m,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case ra:return x=Qa(y.type,y.key,y.props,null,m.mode,x),x.ref=Bs(m,null,y),x.return=m,x;case Mi:return y=ju(y,m.mode,x),y.return=m,y;case lr:var b=y._init;return h(m,b(y._payload),x)}if(Ys(y)||ks(y))return y=Zr(y,m.mode,x,null),y.return=m,y;pa(m,y)}return null}function d(m,y,x,b){var S=y!==null?y.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return S!==null?null:a(m,y,""+x,b);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case ra:return x.key===S?l(m,y,x,b):null;case Mi:return x.key===S?u(m,y,x,b):null;case lr:return S=x._init,d(m,y,S(x._payload),b)}if(Ys(x)||ks(x))return S!==null?null:c(m,y,x,b,null);pa(m,x)}return null}function f(m,y,x,b,S){if(typeof b=="string"&&b!==""||typeof b=="number")return m=m.get(x)||null,a(y,m,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case ra:return m=m.get(b.key===null?x:b.key)||null,l(y,m,b,S);case Mi:return m=m.get(b.key===null?x:b.key)||null,u(y,m,b,S);case lr:var T=b._init;return f(m,y,x,T(b._payload),S)}if(Ys(b)||ks(b))return m=m.get(x)||null,c(y,m,b,S,null);pa(y,b)}return null}function p(m,y,x,b){for(var S=null,T=null,C=y,M=y=0,L=null;C!==null&&M<x.length;M++){C.index>M?(L=C,C=null):L=C.sibling;var R=d(m,C,x[M],b);if(R===null){C===null&&(C=L);break}n&&C&&R.alternate===null&&e(m,C),y=s(R,y,M),T===null?S=R:T.sibling=R,T=R,C=L}if(M===x.length)return t(m,C),De&&Lr(m,M),S;if(C===null){for(;M<x.length;M++)C=h(m,x[M],b),C!==null&&(y=s(C,y,M),T===null?S=C:T.sibling=C,T=C);return De&&Lr(m,M),S}for(C=r(m,C);M<x.length;M++)L=f(C,m,M,x[M],b),L!==null&&(n&&L.alternate!==null&&C.delete(L.key===null?M:L.key),y=s(L,y,M),T===null?S=L:T.sibling=L,T=L);return n&&C.forEach(function(O){return e(m,O)}),De&&Lr(m,M),S}function g(m,y,x,b){var S=ks(x);if(typeof S!="function")throw Error(V(150));if(x=S.call(x),x==null)throw Error(V(151));for(var T=S=null,C=y,M=y=0,L=null,R=x.next();C!==null&&!R.done;M++,R=x.next()){C.index>M?(L=C,C=null):L=C.sibling;var O=d(m,C,R.value,b);if(O===null){C===null&&(C=L);break}n&&C&&O.alternate===null&&e(m,C),y=s(O,y,M),T===null?S=O:T.sibling=O,T=O,C=L}if(R.done)return t(m,C),De&&Lr(m,M),S;if(C===null){for(;!R.done;M++,R=x.next())R=h(m,R.value,b),R!==null&&(y=s(R,y,M),T===null?S=R:T.sibling=R,T=R);return De&&Lr(m,M),S}for(C=r(m,C);!R.done;M++,R=x.next())R=f(C,m,M,R.value,b),R!==null&&(n&&R.alternate!==null&&C.delete(R.key===null?M:R.key),y=s(R,y,M),T===null?S=R:T.sibling=R,T=R);return n&&C.forEach(function(U){return e(m,U)}),De&&Lr(m,M),S}function _(m,y,x,b){if(typeof x=="object"&&x!==null&&x.type===Ri&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case ra:e:{for(var S=x.key,T=y;T!==null;){if(T.key===S){if(S=x.type,S===Ri){if(T.tag===7){t(m,T.sibling),y=i(T,x.props.children),y.return=m,m=y;break e}}else if(T.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===lr&&np(S)===T.type){t(m,T.sibling),y=i(T,x.props),y.ref=Bs(m,T,x),y.return=m,m=y;break e}t(m,T);break}else e(m,T);T=T.sibling}x.type===Ri?(y=Zr(x.props.children,m.mode,b,x.key),y.return=m,m=y):(b=Qa(x.type,x.key,x.props,null,m.mode,b),b.ref=Bs(m,y,x),b.return=m,m=b)}return o(m);case Mi:e:{for(T=x.key;y!==null;){if(y.key===T)if(y.tag===4&&y.stateNode.containerInfo===x.containerInfo&&y.stateNode.implementation===x.implementation){t(m,y.sibling),y=i(y,x.children||[]),y.return=m,m=y;break e}else{t(m,y);break}else e(m,y);y=y.sibling}y=ju(x,m.mode,b),y.return=m,m=y}return o(m);case lr:return T=x._init,_(m,y,T(x._payload),b)}if(Ys(x))return p(m,y,x,b);if(ks(x))return g(m,y,x,b);pa(m,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,y!==null&&y.tag===6?(t(m,y.sibling),y=i(y,x),y.return=m,m=y):(t(m,y),y=Vu(x,m.mode,b),y.return=m,m=y),o(m)):t(m,y)}return _}var ns=n_(!0),r_=n_(!1),gl=Ar(null),yl=null,Ui=null,Sd=null;function Td(){Sd=Ui=yl=null}function Cd(n){var e=gl.current;Ie(gl),n._currentValue=e}function eh(n,e,t){for(;n!==null;){var r=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),n===t)break;n=n.return}}function Ki(n,e){yl=n,Sd=Ui=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(It=!0),n.firstContext=null)}function nn(n){var e=n._currentValue;if(Sd!==n)if(n={context:n,memoizedValue:e,next:null},Ui===null){if(yl===null)throw Error(V(308));Ui=n,yl.dependencies={lanes:0,firstContext:n}}else Ui=Ui.next=n;return e}var Xr=null;function Ed(n){Xr===null?Xr=[n]:Xr.push(n)}function i_(n,e,t,r){var i=e.interleaved;return i===null?(t.next=t,Ed(e)):(t.next=i.next,i.next=t),e.interleaved=t,Yn(n,r)}function Yn(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var ur=!1;function Ad(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function s_(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Hn(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function xr(n,e,t){var r=n.updateQueue;if(r===null)return null;if(r=r.shared,ge&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Yn(n,t)}return i=r.interleaved,i===null?(e.next=e,Ed(r)):(e.next=i.next,i.next=e),r.interleaved=e,Yn(n,t)}function ja(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,dd(n,t)}}function rp(n,e){var t=n.updateQueue,r=n.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var i=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?i=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?i=s=e:s=s.next=e}else i=s=e;t={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function _l(n,e,t,r){var i=n.updateQueue;ur=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var c=n.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(s!==null){var h=i.baseState;o=0,c=u=l=null,a=s;do{var d=a.lane,f=a.eventTime;if((r&d)===d){c!==null&&(c=c.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=n,g=a;switch(d=e,f=t,g.tag){case 1:if(p=g.payload,typeof p=="function"){h=p.call(f,h,d);break e}h=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=g.payload,d=typeof p=="function"?p.call(f,h,d):p,d==null)break e;h=Ne({},h,d);break e;case 2:ur=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,d=i.effects,d===null?i.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=f,l=h):c=c.next=f,o|=d;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;d=a,a=d.next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}while(!0);if(c===null&&(l=h),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);ni|=o,n.lanes=o,n.memoizedState=h}}function ip(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var r=n[e],i=r.callback;if(i!==null){if(r.callback=null,r=t,typeof i!="function")throw Error(V(191,i));i.call(r)}}}var jo={},An=Ar(jo),ko=Ar(jo),Po=Ar(jo);function Yr(n){if(n===jo)throw Error(V(174));return n}function kd(n,e){switch(Pe(Po,e),Pe(ko,n),Pe(An,jo),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Dc(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=Dc(e,n)}Ie(An),Pe(An,e)}function rs(){Ie(An),Ie(ko),Ie(Po)}function o_(n){Yr(Po.current);var e=Yr(An.current),t=Dc(e,n.type);e!==t&&(Pe(ko,n),Pe(An,t))}function Pd(n){ko.current===n&&(Ie(An),Ie(ko))}var Oe=Ar(0);function xl(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Lu=[];function Md(){for(var n=0;n<Lu.length;n++)Lu[n]._workInProgressVersionPrimary=null;Lu.length=0}var $a=Jn.ReactCurrentDispatcher,Uu=Jn.ReactCurrentBatchConfig,ti=0,Le=null,Je=null,ot=null,vl=!1,io=!1,Mo=0,IS=0;function _t(){throw Error(V(321))}function Rd(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!yn(n[t],e[t]))return!1;return!0}function Id(n,e,t,r,i,s){if(ti=s,Le=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,$a.current=n===null||n.memoizedState===null?GS:OS,n=t(r,i),io){s=0;do{if(io=!1,Mo=0,25<=s)throw Error(V(301));s+=1,ot=Je=null,e.updateQueue=null,$a.current=LS,n=t(r,i)}while(io)}if($a.current=bl,e=Je!==null&&Je.next!==null,ti=0,ot=Je=Le=null,vl=!1,e)throw Error(V(300));return n}function Bd(){var n=Mo!==0;return Mo=0,n}function Tn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ot===null?Le.memoizedState=ot=n:ot=ot.next=n,ot}function rn(){if(Je===null){var n=Le.alternate;n=n!==null?n.memoizedState:null}else n=Je.next;var e=ot===null?Le.memoizedState:ot.next;if(e!==null)ot=e,Je=n;else{if(n===null)throw Error(V(310));Je=n,n={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},ot===null?Le.memoizedState=ot=n:ot=ot.next=n}return ot}function Ro(n,e){return typeof e=="function"?e(n):e}function Nu(n){var e=rn(),t=e.queue;if(t===null)throw Error(V(311));t.lastRenderedReducer=n;var r=Je,i=r.baseQueue,s=t.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,t.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,l=null,u=s;do{var c=u.lane;if((ti&c)===c)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:n(r,u.action);else{var h={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=h,o=r):l=l.next=h,Le.lanes|=c,ni|=c}u=u.next}while(u!==null&&u!==s);l===null?o=r:l.next=a,yn(r,e.memoizedState)||(It=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=l,t.lastRenderedState=r}if(n=t.interleaved,n!==null){i=n;do s=i.lane,Le.lanes|=s,ni|=s,i=i.next;while(i!==n)}else i===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function zu(n){var e=rn(),t=e.queue;if(t===null)throw Error(V(311));t.lastRenderedReducer=n;var r=t.dispatch,i=t.pending,s=e.memoizedState;if(i!==null){t.pending=null;var o=i=i.next;do s=n(s,o.action),o=o.next;while(o!==i);yn(s,e.memoizedState)||(It=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,r]}function a_(){}function l_(n,e){var t=Le,r=rn(),i=e(),s=!yn(r.memoizedState,i);if(s&&(r.memoizedState=i,It=!0),r=r.queue,Dd(h_.bind(null,t,r,n),[n]),r.getSnapshot!==e||s||ot!==null&&ot.memoizedState.tag&1){if(t.flags|=2048,Io(9,c_.bind(null,t,r,i,e),void 0,null),lt===null)throw Error(V(349));ti&30||u_(t,e,i)}return i}function u_(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=Le.updateQueue,e===null?(e={lastEffect:null,stores:null},Le.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function c_(n,e,t,r){e.value=t,e.getSnapshot=r,d_(e)&&f_(n)}function h_(n,e,t){return t(function(){d_(e)&&f_(n)})}function d_(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!yn(n,t)}catch{return!0}}function f_(n){var e=Yn(n,1);e!==null&&gn(e,n,1,-1)}function sp(n){var e=Tn();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:n},e.queue=n,n=n.dispatch=FS.bind(null,Le,n),[e.memoizedState,n]}function Io(n,e,t,r){return n={tag:n,create:e,destroy:t,deps:r,next:null},e=Le.updateQueue,e===null?(e={lastEffect:null,stores:null},Le.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(r=t.next,t.next=n,n.next=r,e.lastEffect=n)),n}function p_(){return rn().memoizedState}function Xa(n,e,t,r){var i=Tn();Le.flags|=n,i.memoizedState=Io(1|e,t,void 0,r===void 0?null:r)}function Kl(n,e,t,r){var i=rn();r=r===void 0?null:r;var s=void 0;if(Je!==null){var o=Je.memoizedState;if(s=o.destroy,r!==null&&Rd(r,o.deps)){i.memoizedState=Io(e,t,s,r);return}}Le.flags|=n,i.memoizedState=Io(1|e,t,s,r)}function op(n,e){return Xa(8390656,8,n,e)}function Dd(n,e){return Kl(2048,8,n,e)}function m_(n,e){return Kl(4,2,n,e)}function g_(n,e){return Kl(4,4,n,e)}function y_(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function __(n,e,t){return t=t!=null?t.concat([n]):null,Kl(4,4,y_.bind(null,e,n),t)}function Fd(){}function x_(n,e){var t=rn();e=e===void 0?null:e;var r=t.memoizedState;return r!==null&&e!==null&&Rd(e,r[1])?r[0]:(t.memoizedState=[n,e],n)}function v_(n,e){var t=rn();e=e===void 0?null:e;var r=t.memoizedState;return r!==null&&e!==null&&Rd(e,r[1])?r[0]:(n=n(),t.memoizedState=[n,e],n)}function b_(n,e,t){return ti&21?(yn(t,e)||(t=Ey(),Le.lanes|=t,ni|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,It=!0),n.memoizedState=t)}function BS(n,e){var t=we;we=t!==0&&4>t?t:4,n(!0);var r=Uu.transition;Uu.transition={};try{n(!1),e()}finally{we=t,Uu.transition=r}}function w_(){return rn().memoizedState}function DS(n,e,t){var r=br(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},S_(n))T_(e,t);else if(t=i_(n,e,t,r),t!==null){var i=At();gn(t,n,r,i),C_(t,e,r)}}function FS(n,e,t){var r=br(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(S_(n))T_(e,i);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(i.hasEagerState=!0,i.eagerState=a,yn(a,o)){var l=e.interleaved;l===null?(i.next=i,Ed(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=i_(n,e,i,r),t!==null&&(i=At(),gn(t,n,r,i),C_(t,e,r))}}function S_(n){var e=n.alternate;return n===Le||e!==null&&e===Le}function T_(n,e){io=vl=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function C_(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,dd(n,t)}}var bl={readContext:nn,useCallback:_t,useContext:_t,useEffect:_t,useImperativeHandle:_t,useInsertionEffect:_t,useLayoutEffect:_t,useMemo:_t,useReducer:_t,useRef:_t,useState:_t,useDebugValue:_t,useDeferredValue:_t,useTransition:_t,useMutableSource:_t,useSyncExternalStore:_t,useId:_t,unstable_isNewReconciler:!1},GS={readContext:nn,useCallback:function(n,e){return Tn().memoizedState=[n,e===void 0?null:e],n},useContext:nn,useEffect:op,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Xa(4194308,4,y_.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Xa(4194308,4,n,e)},useInsertionEffect:function(n,e){return Xa(4,2,n,e)},useMemo:function(n,e){var t=Tn();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=Tn();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=DS.bind(null,Le,n),[r.memoizedState,n]},useRef:function(n){var e=Tn();return n={current:n},e.memoizedState=n},useState:sp,useDebugValue:Fd,useDeferredValue:function(n){return Tn().memoizedState=n},useTransition:function(){var n=sp(!1),e=n[0];return n=BS.bind(null,n[1]),Tn().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Le,i=Tn();if(De){if(t===void 0)throw Error(V(407));t=t()}else{if(t=e(),lt===null)throw Error(V(349));ti&30||u_(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,op(h_.bind(null,r,s,n),[n]),r.flags|=2048,Io(9,c_.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=Tn(),e=lt.identifierPrefix;if(De){var t=Wn,r=zn;t=(r&~(1<<32-mn(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Mo++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=IS++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},OS={readContext:nn,useCallback:x_,useContext:nn,useEffect:Dd,useImperativeHandle:__,useInsertionEffect:m_,useLayoutEffect:g_,useMemo:v_,useReducer:Nu,useRef:p_,useState:function(){return Nu(Ro)},useDebugValue:Fd,useDeferredValue:function(n){var e=rn();return b_(e,Je.memoizedState,n)},useTransition:function(){var n=Nu(Ro)[0],e=rn().memoizedState;return[n,e]},useMutableSource:a_,useSyncExternalStore:l_,useId:w_,unstable_isNewReconciler:!1},LS={readContext:nn,useCallback:x_,useContext:nn,useEffect:Dd,useImperativeHandle:__,useInsertionEffect:m_,useLayoutEffect:g_,useMemo:v_,useReducer:zu,useRef:p_,useState:function(){return zu(Ro)},useDebugValue:Fd,useDeferredValue:function(n){var e=rn();return Je===null?e.memoizedState=n:b_(e,Je.memoizedState,n)},useTransition:function(){var n=zu(Ro)[0],e=rn().memoizedState;return[n,e]},useMutableSource:a_,useSyncExternalStore:l_,useId:w_,unstable_isNewReconciler:!1};function cn(n,e){if(n&&n.defaultProps){e=Ne({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function th(n,e,t,r){e=n.memoizedState,t=t(r,e),t=t==null?e:Ne({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var ql={isMounted:function(n){return(n=n._reactInternals)?ui(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var r=At(),i=br(n),s=Hn(r,i);s.payload=e,t!=null&&(s.callback=t),e=xr(n,s,i),e!==null&&(gn(e,n,i,r),ja(e,n,i))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var r=At(),i=br(n),s=Hn(r,i);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=xr(n,s,i),e!==null&&(gn(e,n,i,r),ja(e,n,i))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=At(),r=br(n),i=Hn(t,r);i.tag=2,e!=null&&(i.callback=e),e=xr(n,i,r),e!==null&&(gn(e,n,r,t),ja(e,n,r))}};function ap(n,e,t,r,i,s,o){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(r,s,o):e.prototype&&e.prototype.isPureReactComponent?!To(t,r)||!To(i,s):!0}function E_(n,e,t){var r=!1,i=Cr,s=e.contextType;return typeof s=="object"&&s!==null?s=nn(s):(i=Dt(e)?Jr:Tt.current,r=e.contextTypes,s=(r=r!=null)?es(n,i):Cr),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=ql,n.stateNode=e,e._reactInternals=n,r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=i,n.__reactInternalMemoizedMaskedChildContext=s),e}function lp(n,e,t,r){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,r),e.state!==n&&ql.enqueueReplaceState(e,e.state,null)}function nh(n,e,t,r){var i=n.stateNode;i.props=t,i.state=n.memoizedState,i.refs={},Ad(n);var s=e.contextType;typeof s=="object"&&s!==null?i.context=nn(s):(s=Dt(e)?Jr:Tt.current,i.context=es(n,s)),i.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(th(n,e,s,t),i.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&ql.enqueueReplaceState(i,i.state,null),_l(n,t,i,r),i.state=n.memoizedState),typeof i.componentDidMount=="function"&&(n.flags|=4194308)}function is(n,e){try{var t="",r=e;do t+=dw(r),r=r.return;while(r);var i=t}catch(s){i=`
|
|
31
|
+
Error generating stack: `+s.message+`
|
|
32
|
+
`+s.stack}return{value:n,source:e,stack:i,digest:null}}function Wu(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function rh(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var US=typeof WeakMap=="function"?WeakMap:Map;function A_(n,e,t){t=Hn(-1,t),t.tag=3,t.payload={element:null};var r=e.value;return t.callback=function(){Sl||(Sl=!0,fh=r),rh(n,e)},t}function k_(n,e,t){t=Hn(-1,t),t.tag=3;var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;t.payload=function(){return r(i)},t.callback=function(){rh(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){rh(n,e),typeof r!="function"&&(vr===null?vr=new Set([this]):vr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function up(n,e,t){var r=n.pingCache;if(r===null){r=n.pingCache=new US;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(t)||(i.add(t),n=JS.bind(null,n,e,t),e.then(n,n))}function cp(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function hp(n,e,t,r,i){return n.mode&1?(n.flags|=65536,n.lanes=i,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Hn(-1,1),e.tag=2,xr(t,e,1))),t.lanes|=1),n)}var NS=Jn.ReactCurrentOwner,It=!1;function Ct(n,e,t,r){e.child=n===null?r_(e,null,t,r):ns(e,n.child,t,r)}function dp(n,e,t,r,i){t=t.render;var s=e.ref;return Ki(e,i),r=Id(n,e,t,r,s,i),t=Bd(),n!==null&&!It?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,Kn(n,e,i)):(De&&t&&vd(e),e.flags|=1,Ct(n,e,r,i),e.child)}function fp(n,e,t,r,i){if(n===null){var s=t.type;return typeof s=="function"&&!Hd(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,P_(n,e,s,r,i)):(n=Qa(t.type,null,r,e,e.mode,i),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&i)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:To,t(o,r)&&n.ref===e.ref)return Kn(n,e,i)}return e.flags|=1,n=wr(s,r),n.ref=e.ref,n.return=e,e.child=n}function P_(n,e,t,r,i){if(n!==null){var s=n.memoizedProps;if(To(s,r)&&n.ref===e.ref)if(It=!1,e.pendingProps=r=s,(n.lanes&i)!==0)n.flags&131072&&(It=!0);else return e.lanes=n.lanes,Kn(n,e,i)}return ih(n,e,t,r,i)}function M_(n,e,t){var r=e.pendingProps,i=r.children,s=n!==null?n.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Pe(zi,Nt),Nt|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,Pe(zi,Nt),Nt|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:t,Pe(zi,Nt),Nt|=r}else s!==null?(r=s.baseLanes|t,e.memoizedState=null):r=t,Pe(zi,Nt),Nt|=r;return Ct(n,e,i,t),e.child}function R_(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function ih(n,e,t,r,i){var s=Dt(t)?Jr:Tt.current;return s=es(e,s),Ki(e,i),t=Id(n,e,t,r,s,i),r=Bd(),n!==null&&!It?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,Kn(n,e,i)):(De&&r&&vd(e),e.flags|=1,Ct(n,e,t,i),e.child)}function pp(n,e,t,r,i){if(Dt(t)){var s=!0;fl(e)}else s=!1;if(Ki(e,i),e.stateNode===null)Ya(n,e),E_(e,t,r),nh(e,t,r,i),r=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,u=t.contextType;typeof u=="object"&&u!==null?u=nn(u):(u=Dt(t)?Jr:Tt.current,u=es(e,u));var c=t.getDerivedStateFromProps,h=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==u)&&lp(e,o,r,u),ur=!1;var d=e.memoizedState;o.state=d,_l(e,r,o,i),l=e.memoizedState,a!==r||d!==l||Bt.current||ur?(typeof c=="function"&&(th(e,t,c,r),l=e.memoizedState),(a=ur||ap(e,t,a,r,d,l,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,s_(n,e),a=e.memoizedProps,u=e.type===e.elementType?a:cn(e.type,a),o.props=u,h=e.pendingProps,d=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=nn(l):(l=Dt(t)?Jr:Tt.current,l=es(e,l));var f=t.getDerivedStateFromProps;(c=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||d!==l)&&lp(e,o,r,l),ur=!1,d=e.memoizedState,o.state=d,_l(e,r,o,i);var p=e.memoizedState;a!==h||d!==p||Bt.current||ur?(typeof f=="function"&&(th(e,t,f,r),p=e.memoizedState),(u=ur||ap(e,t,u,r,d,p,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=l,r=u):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=1024),r=!1)}return sh(n,e,t,r,s,i)}function sh(n,e,t,r,i,s){R_(n,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&J0(e,t,!1),Kn(n,e,s);r=e.stateNode,NS.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,n!==null&&o?(e.child=ns(e,n.child,null,s),e.child=ns(e,null,a,s)):Ct(n,e,a,s),e.memoizedState=r.state,i&&J0(e,t,!0),e.child}function I_(n){var e=n.stateNode;e.pendingContext?Z0(n,e.pendingContext,e.pendingContext!==e.context):e.context&&Z0(n,e.context,!1),kd(n,e.containerInfo)}function mp(n,e,t,r,i){return ts(),wd(i),e.flags|=256,Ct(n,e,t,r),e.child}var oh={dehydrated:null,treeContext:null,retryLane:0};function ah(n){return{baseLanes:n,cachePool:null,transitions:null}}function B_(n,e,t){var r=e.pendingProps,i=Oe.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(i|=1),Pe(Oe,i&1),n===null)return Jc(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,n=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Jl(o,r,0,null),n=Zr(n,r,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=ah(t),e.memoizedState=oh,n):Gd(e,o));if(i=n.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return zS(n,e,o,r,a,i,t);if(s){s=r.fallback,o=e.mode,i=n.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=wr(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=wr(a,s):(s=Zr(s,o,t,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=n.child.memoizedState,o=o===null?ah(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=oh,r}return s=n.child,n=s.sibling,r=wr(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=t),r.return=e,r.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=r,e.memoizedState=null,r}function Gd(n,e){return e=Jl({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function ma(n,e,t,r){return r!==null&&wd(r),ns(e,n.child,null,t),n=Gd(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function zS(n,e,t,r,i,s,o){if(t)return e.flags&256?(e.flags&=-257,r=Wu(Error(V(422))),ma(n,e,o,r)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=Jl({mode:"visible",children:r.children},i,0,null),s=Zr(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&ns(e,n.child,null,o),e.child.memoizedState=ah(o),e.memoizedState=oh,s);if(!(e.mode&1))return ma(n,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(V(419)),r=Wu(s,r,void 0),ma(n,e,o,r)}if(a=(o&n.childLanes)!==0,It||a){if(r=lt,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Yn(n,i),gn(r,n,i,-1))}return Wd(),r=Wu(Error(V(421))),ma(n,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=n.child,e=e2.bind(null,n),i._reactRetry=e,null):(n=s.treeContext,zt=_r(i.nextSibling),Wt=e,De=!0,dn=null,n!==null&&(Kt[qt++]=zn,Kt[qt++]=Wn,Kt[qt++]=ei,zn=n.id,Wn=n.overflow,ei=e),e=Gd(e,r.children),e.flags|=4096,e)}function gp(n,e,t){n.lanes|=e;var r=n.alternate;r!==null&&(r.lanes|=e),eh(n.return,e,t)}function Hu(n,e,t,r,i){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:t,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=t,s.tailMode=i)}function D_(n,e,t){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(Ct(n,e,r.children,t),r=Oe.current,r&2)r=r&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&gp(n,t,e);else if(n.tag===19)gp(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}r&=1}if(Pe(Oe,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(t=e.child,i=null;t!==null;)n=t.alternate,n!==null&&xl(n)===null&&(i=t),t=t.sibling;t=i,t===null?(i=e.child,e.child=null):(i=t.sibling,t.sibling=null),Hu(e,!1,i,t,s);break;case"backwards":for(t=null,i=e.child,e.child=null;i!==null;){if(n=i.alternate,n!==null&&xl(n)===null){e.child=i;break}n=i.sibling,i.sibling=t,t=i,i=n}Hu(e,!0,t,null,s);break;case"together":Hu(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Ya(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function Kn(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),ni|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(V(153));if(e.child!==null){for(n=e.child,t=wr(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=wr(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function WS(n,e,t){switch(e.tag){case 3:I_(e),ts();break;case 5:o_(e);break;case 1:Dt(e.type)&&fl(e);break;case 4:kd(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;Pe(gl,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Pe(Oe,Oe.current&1),e.flags|=128,null):t&e.child.childLanes?B_(n,e,t):(Pe(Oe,Oe.current&1),n=Kn(n,e,t),n!==null?n.sibling:null);Pe(Oe,Oe.current&1);break;case 19:if(r=(t&e.childLanes)!==0,n.flags&128){if(r)return D_(n,e,t);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Pe(Oe,Oe.current),r)break;return null;case 22:case 23:return e.lanes=0,M_(n,e,t)}return Kn(n,e,t)}var F_,lh,G_,O_;F_=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};lh=function(){};G_=function(n,e,t,r){var i=n.memoizedProps;if(i!==r){n=e.stateNode,Yr(An.current);var s=null;switch(t){case"input":i=Mc(n,i),r=Mc(n,r),s=[];break;case"select":i=Ne({},i,{value:void 0}),r=Ne({},r,{value:void 0}),s=[];break;case"textarea":i=Bc(n,i),r=Bc(n,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(n.onclick=hl)}Fc(t,r);var o;t=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var a=i[u];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(yo.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(a=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(u,t)),t=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(yo.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Re("scroll",n),s||a===l||(s=[])):(s=s||[]).push(u,l))}t&&(s=s||[]).push("style",t);var u=s;(e.updateQueue=u)&&(e.flags|=4)}};O_=function(n,e,t,r){t!==r&&(e.flags|=4)};function Ds(n,e){if(!De)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:r.sibling=null}}function xt(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,r=0;if(e)for(var i=n.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=n,i=i.sibling;else for(i=n.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=n,i=i.sibling;return n.subtreeFlags|=r,n.childLanes=t,e}function HS(n,e,t){var r=e.pendingProps;switch(bd(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xt(e),null;case 1:return Dt(e.type)&&dl(),xt(e),null;case 3:return r=e.stateNode,rs(),Ie(Bt),Ie(Tt),Md(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(n===null||n.child===null)&&(fa(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,dn!==null&&(gh(dn),dn=null))),lh(n,e),xt(e),null;case 5:Pd(e);var i=Yr(Po.current);if(t=e.type,n!==null&&e.stateNode!=null)G_(n,e,t,r,i),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(V(166));return xt(e),null}if(n=Yr(An.current),fa(e)){r=e.stateNode,t=e.type;var s=e.memoizedProps;switch(r[Cn]=e,r[Ao]=s,n=(e.mode&1)!==0,t){case"dialog":Re("cancel",r),Re("close",r);break;case"iframe":case"object":case"embed":Re("load",r);break;case"video":case"audio":for(i=0;i<qs.length;i++)Re(qs[i],r);break;case"source":Re("error",r);break;case"img":case"image":case"link":Re("error",r),Re("load",r);break;case"details":Re("toggle",r);break;case"input":C0(r,s),Re("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Re("invalid",r);break;case"textarea":A0(r,s),Re("invalid",r)}Fc(t,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&da(r.textContent,a,n),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&da(r.textContent,a,n),i=["children",""+a]):yo.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&Re("scroll",r)}switch(t){case"input":ia(r),E0(r,s,!0);break;case"textarea":ia(r),k0(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=hl)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=hy(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=o.createElement(t,{is:r.is}):(n=o.createElement(t),t==="select"&&(o=n,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):n=o.createElementNS(n,t),n[Cn]=e,n[Ao]=r,F_(n,e,!1,!1),e.stateNode=n;e:{switch(o=Gc(t,r),t){case"dialog":Re("cancel",n),Re("close",n),i=r;break;case"iframe":case"object":case"embed":Re("load",n),i=r;break;case"video":case"audio":for(i=0;i<qs.length;i++)Re(qs[i],n);i=r;break;case"source":Re("error",n),i=r;break;case"img":case"image":case"link":Re("error",n),Re("load",n),i=r;break;case"details":Re("toggle",n),i=r;break;case"input":C0(n,r),i=Mc(n,r),Re("invalid",n);break;case"option":i=r;break;case"select":n._wrapperState={wasMultiple:!!r.multiple},i=Ne({},r,{value:void 0}),Re("invalid",n);break;case"textarea":A0(n,r),i=Bc(n,r),Re("invalid",n);break;default:i=r}Fc(t,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?py(n,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&dy(n,l)):s==="children"?typeof l=="string"?(t!=="textarea"||l!=="")&&_o(n,l):typeof l=="number"&&_o(n,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(yo.hasOwnProperty(s)?l!=null&&s==="onScroll"&&Re("scroll",n):l!=null&&od(n,s,l,o))}switch(t){case"input":ia(n),E0(n,r,!1);break;case"textarea":ia(n),k0(n);break;case"option":r.value!=null&&n.setAttribute("value",""+Tr(r.value));break;case"select":n.multiple=!!r.multiple,s=r.value,s!=null?ji(n,!!r.multiple,s,!1):r.defaultValue!=null&&ji(n,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(n.onclick=hl)}switch(t){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return xt(e),null;case 6:if(n&&e.stateNode!=null)O_(n,e,n.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(V(166));if(t=Yr(Po.current),Yr(An.current),fa(e)){if(r=e.stateNode,t=e.memoizedProps,r[Cn]=e,(s=r.nodeValue!==t)&&(n=Wt,n!==null))switch(n.tag){case 3:da(r.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&da(r.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else r=(t.nodeType===9?t:t.ownerDocument).createTextNode(r),r[Cn]=e,e.stateNode=r}return xt(e),null;case 13:if(Ie(Oe),r=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(De&&zt!==null&&e.mode&1&&!(e.flags&128))t_(),ts(),e.flags|=98560,s=!1;else if(s=fa(e),r!==null&&r.dehydrated!==null){if(n===null){if(!s)throw Error(V(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(V(317));s[Cn]=e}else ts(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;xt(e),s=!1}else dn!==null&&(gh(dn),dn=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(r=r!==null,r!==(n!==null&&n.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(n===null||Oe.current&1?tt===0&&(tt=3):Wd())),e.updateQueue!==null&&(e.flags|=4),xt(e),null);case 4:return rs(),lh(n,e),n===null&&Co(e.stateNode.containerInfo),xt(e),null;case 10:return Cd(e.type._context),xt(e),null;case 17:return Dt(e.type)&&dl(),xt(e),null;case 19:if(Ie(Oe),s=e.memoizedState,s===null)return xt(e),null;if(r=(e.flags&128)!==0,o=s.rendering,o===null)if(r)Ds(s,!1);else{if(tt!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(o=xl(n),o!==null){for(e.flags|=128,Ds(s,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=t,t=e.child;t!==null;)s=t,n=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,n=o.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return Pe(Oe,Oe.current&1|2),e.child}n=n.sibling}s.tail!==null&&je()>ss&&(e.flags|=128,r=!0,Ds(s,!1),e.lanes=4194304)}else{if(!r)if(n=xl(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Ds(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!De)return xt(e),null}else 2*je()-s.renderingStartTime>ss&&t!==1073741824&&(e.flags|=128,r=!0,Ds(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=je(),e.sibling=null,t=Oe.current,Pe(Oe,r?t&1|2:t&1),e):(xt(e),null);case 22:case 23:return zd(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Nt&1073741824&&(xt(e),e.subtreeFlags&6&&(e.flags|=8192)):xt(e),null;case 24:return null;case 25:return null}throw Error(V(156,e.tag))}function VS(n,e){switch(bd(e),e.tag){case 1:return Dt(e.type)&&dl(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return rs(),Ie(Bt),Ie(Tt),Md(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return Pd(e),null;case 13:if(Ie(Oe),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(V(340));ts()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return Ie(Oe),null;case 4:return rs(),null;case 10:return Cd(e.type._context),null;case 22:case 23:return zd(),null;case 24:return null;default:return null}}var ga=!1,wt=!1,jS=typeof WeakSet=="function"?WeakSet:Set,q=null;function Ni(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){ze(n,e,r)}else t.current=null}function uh(n,e,t){try{t()}catch(r){ze(n,e,r)}}var yp=!1;function $S(n,e){if($c=ll,n=Wy(),xd(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,u=0,c=0,h=n,d=null;t:for(;;){for(var f;h!==t||i!==0&&h.nodeType!==3||(a=o+i),h!==s||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)d=h,h=f;for(;;){if(h===n)break t;if(d===t&&++u===i&&(a=o),d===s&&++c===r&&(l=o),(f=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=f}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(Xc={focusedElem:n,selectionRange:t},ll=!1,q=e;q!==null;)if(e=q,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,q=n;else for(;q!==null;){e=q;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var g=p.memoizedProps,_=p.memoizedState,m=e.stateNode,y=m.getSnapshotBeforeUpdate(e.elementType===e.type?g:cn(e.type,g),_);m.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var x=e.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(V(163))}}catch(b){ze(e,e.return,b)}if(n=e.sibling,n!==null){n.return=e.return,q=n;break}q=e.return}return p=yp,yp=!1,p}function so(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var s=i.destroy;i.destroy=void 0,s!==void 0&&uh(e,t,s)}i=i.next}while(i!==r)}}function Ql(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function ch(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function L_(n){var e=n.alternate;e!==null&&(n.alternate=null,L_(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Cn],delete e[Ao],delete e[qc],delete e[kS],delete e[PS])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function U_(n){return n.tag===5||n.tag===3||n.tag===4}function _p(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||U_(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function hh(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=hl));else if(r!==4&&(n=n.child,n!==null))for(hh(n,e,t),n=n.sibling;n!==null;)hh(n,e,t),n=n.sibling}function dh(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(dh(n,e,t),n=n.sibling;n!==null;)dh(n,e,t),n=n.sibling}var dt=null,hn=!1;function ir(n,e,t){for(t=t.child;t!==null;)N_(n,e,t),t=t.sibling}function N_(n,e,t){if(En&&typeof En.onCommitFiberUnmount=="function")try{En.onCommitFiberUnmount(Hl,t)}catch{}switch(t.tag){case 5:wt||Ni(t,e);case 6:var r=dt,i=hn;dt=null,ir(n,e,t),dt=r,hn=i,dt!==null&&(hn?(n=dt,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):dt.removeChild(t.stateNode));break;case 18:dt!==null&&(hn?(n=dt,t=t.stateNode,n.nodeType===8?Gu(n.parentNode,t):n.nodeType===1&&Gu(n,t),wo(n)):Gu(dt,t.stateNode));break;case 4:r=dt,i=hn,dt=t.stateNode.containerInfo,hn=!0,ir(n,e,t),dt=r,hn=i;break;case 0:case 11:case 14:case 15:if(!wt&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&uh(t,e,o),i=i.next}while(i!==r)}ir(n,e,t);break;case 1:if(!wt&&(Ni(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){ze(t,e,a)}ir(n,e,t);break;case 21:ir(n,e,t);break;case 22:t.mode&1?(wt=(r=wt)||t.memoizedState!==null,ir(n,e,t),wt=r):ir(n,e,t);break;default:ir(n,e,t)}}function xp(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new jS),e.forEach(function(r){var i=t2.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function an(n,e){var t=e.deletions;if(t!==null)for(var r=0;r<t.length;r++){var i=t[r];try{var s=n,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:dt=a.stateNode,hn=!1;break e;case 3:dt=a.stateNode.containerInfo,hn=!0;break e;case 4:dt=a.stateNode.containerInfo,hn=!0;break e}a=a.return}if(dt===null)throw Error(V(160));N_(s,o,i),dt=null,hn=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(u){ze(i,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)z_(e,n),e=e.sibling}function z_(n,e){var t=n.alternate,r=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(an(e,n),bn(n),r&4){try{so(3,n,n.return),Ql(3,n)}catch(g){ze(n,n.return,g)}try{so(5,n,n.return)}catch(g){ze(n,n.return,g)}}break;case 1:an(e,n),bn(n),r&512&&t!==null&&Ni(t,t.return);break;case 5:if(an(e,n),bn(n),r&512&&t!==null&&Ni(t,t.return),n.flags&32){var i=n.stateNode;try{_o(i,"")}catch(g){ze(n,n.return,g)}}if(r&4&&(i=n.stateNode,i!=null)){var s=n.memoizedProps,o=t!==null?t.memoizedProps:s,a=n.type,l=n.updateQueue;if(n.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&uy(i,s),Gc(a,o);var u=Gc(a,s);for(o=0;o<l.length;o+=2){var c=l[o],h=l[o+1];c==="style"?py(i,h):c==="dangerouslySetInnerHTML"?dy(i,h):c==="children"?_o(i,h):od(i,c,h,u)}switch(a){case"input":Rc(i,s);break;case"textarea":cy(i,s);break;case"select":var d=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var f=s.value;f!=null?ji(i,!!s.multiple,f,!1):d!==!!s.multiple&&(s.defaultValue!=null?ji(i,!!s.multiple,s.defaultValue,!0):ji(i,!!s.multiple,s.multiple?[]:"",!1))}i[Ao]=s}catch(g){ze(n,n.return,g)}}break;case 6:if(an(e,n),bn(n),r&4){if(n.stateNode===null)throw Error(V(162));i=n.stateNode,s=n.memoizedProps;try{i.nodeValue=s}catch(g){ze(n,n.return,g)}}break;case 3:if(an(e,n),bn(n),r&4&&t!==null&&t.memoizedState.isDehydrated)try{wo(e.containerInfo)}catch(g){ze(n,n.return,g)}break;case 4:an(e,n),bn(n);break;case 13:an(e,n),bn(n),i=n.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Ud=je())),r&4&&xp(n);break;case 22:if(c=t!==null&&t.memoizedState!==null,n.mode&1?(wt=(u=wt)||c,an(e,n),wt=u):an(e,n),bn(n),r&8192){if(u=n.memoizedState!==null,(n.stateNode.isHidden=u)&&!c&&n.mode&1)for(q=n,c=n.child;c!==null;){for(h=q=c;q!==null;){switch(d=q,f=d.child,d.tag){case 0:case 11:case 14:case 15:so(4,d,d.return);break;case 1:Ni(d,d.return);var p=d.stateNode;if(typeof p.componentWillUnmount=="function"){r=d,t=d.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(g){ze(r,t,g)}}break;case 5:Ni(d,d.return);break;case 22:if(d.memoizedState!==null){bp(h);continue}}f!==null?(f.return=d,q=f):bp(h)}c=c.sibling}e:for(c=null,h=n;;){if(h.tag===5){if(c===null){c=h;try{i=h.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=h.stateNode,l=h.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=fy("display",o))}catch(g){ze(n,n.return,g)}}}else if(h.tag===6){if(c===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(g){ze(n,n.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===n)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===n)break e;for(;h.sibling===null;){if(h.return===null||h.return===n)break e;c===h&&(c=null),h=h.return}c===h&&(c=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:an(e,n),bn(n),r&4&&xp(n);break;case 21:break;default:an(e,n),bn(n)}}function bn(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(U_(t)){var r=t;break e}t=t.return}throw Error(V(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(_o(i,""),r.flags&=-33);var s=_p(n);dh(n,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=_p(n);hh(n,a,o);break;default:throw Error(V(161))}}catch(l){ze(n,n.return,l)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function XS(n,e,t){q=n,W_(n)}function W_(n,e,t){for(var r=(n.mode&1)!==0;q!==null;){var i=q,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||ga;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||wt;a=ga;var u=wt;if(ga=o,(wt=l)&&!u)for(q=i;q!==null;)o=q,l=o.child,o.tag===22&&o.memoizedState!==null?wp(i):l!==null?(l.return=o,q=l):wp(i);for(;s!==null;)q=s,W_(s),s=s.sibling;q=i,ga=a,wt=u}vp(n)}else i.subtreeFlags&8772&&s!==null?(s.return=i,q=s):vp(n)}}function vp(n){for(;q!==null;){var e=q;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:wt||Ql(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!wt)if(t===null)r.componentDidMount();else{var i=e.elementType===e.type?t.memoizedProps:cn(e.type,t.memoizedProps);r.componentDidUpdate(i,t.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&ip(e,s,r);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}ip(e,o,t)}break;case 5:var a=e.stateNode;if(t===null&&e.flags&4){t=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&t.focus();break;case"img":l.src&&(t.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var h=c.dehydrated;h!==null&&wo(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(V(163))}wt||e.flags&512&&ch(e)}catch(d){ze(e,e.return,d)}}if(e===n){q=null;break}if(t=e.sibling,t!==null){t.return=e.return,q=t;break}q=e.return}}function bp(n){for(;q!==null;){var e=q;if(e===n){q=null;break}var t=e.sibling;if(t!==null){t.return=e.return,q=t;break}q=e.return}}function wp(n){for(;q!==null;){var e=q;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{Ql(4,e)}catch(l){ze(e,t,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){ze(e,i,l)}}var s=e.return;try{ch(e)}catch(l){ze(e,s,l)}break;case 5:var o=e.return;try{ch(e)}catch(l){ze(e,o,l)}}}catch(l){ze(e,e.return,l)}if(e===n){q=null;break}var a=e.sibling;if(a!==null){a.return=e.return,q=a;break}q=e.return}}var YS=Math.ceil,wl=Jn.ReactCurrentDispatcher,Od=Jn.ReactCurrentOwner,en=Jn.ReactCurrentBatchConfig,ge=0,lt=null,Ye=null,pt=0,Nt=0,zi=Ar(0),tt=0,Bo=null,ni=0,Zl=0,Ld=0,oo=null,Rt=null,Ud=0,ss=1/0,Gn=null,Sl=!1,fh=null,vr=null,ya=!1,fr=null,Tl=0,ao=0,ph=null,Ka=-1,qa=0;function At(){return ge&6?je():Ka!==-1?Ka:Ka=je()}function br(n){return n.mode&1?ge&2&&pt!==0?pt&-pt:RS.transition!==null?(qa===0&&(qa=Ey()),qa):(n=we,n!==0||(n=window.event,n=n===void 0?16:By(n.type)),n):1}function gn(n,e,t,r){if(50<ao)throw ao=0,ph=null,Error(V(185));Wo(n,t,r),(!(ge&2)||n!==lt)&&(n===lt&&(!(ge&2)&&(Zl|=t),tt===4&&hr(n,pt)),Ft(n,r),t===1&&ge===0&&!(e.mode&1)&&(ss=je()+500,Yl&&kr()))}function Ft(n,e){var t=n.callbackNode;Rw(n,e);var r=al(n,n===lt?pt:0);if(r===0)t!==null&&R0(t),n.callbackNode=null,n.callbackPriority=0;else if(e=r&-r,n.callbackPriority!==e){if(t!=null&&R0(t),e===1)n.tag===0?MS(Sp.bind(null,n)):Zy(Sp.bind(null,n)),ES(function(){!(ge&6)&&kr()}),t=null;else{switch(Ay(r)){case 1:t=hd;break;case 4:t=Ty;break;case 16:t=ol;break;case 536870912:t=Cy;break;default:t=ol}t=q_(t,H_.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function H_(n,e){if(Ka=-1,qa=0,ge&6)throw Error(V(327));var t=n.callbackNode;if(qi()&&n.callbackNode!==t)return null;var r=al(n,n===lt?pt:0);if(r===0)return null;if(r&30||r&n.expiredLanes||e)e=Cl(n,r);else{e=r;var i=ge;ge|=2;var s=j_();(lt!==n||pt!==e)&&(Gn=null,ss=je()+500,Qr(n,e));do try{QS();break}catch(a){V_(n,a)}while(!0);Td(),wl.current=s,ge=i,Ye!==null?e=0:(lt=null,pt=0,e=tt)}if(e!==0){if(e===2&&(i=zc(n),i!==0&&(r=i,e=mh(n,i))),e===1)throw t=Bo,Qr(n,0),hr(n,r),Ft(n,je()),t;if(e===6)hr(n,r);else{if(i=n.current.alternate,!(r&30)&&!KS(i)&&(e=Cl(n,r),e===2&&(s=zc(n),s!==0&&(r=s,e=mh(n,s))),e===1))throw t=Bo,Qr(n,0),hr(n,r),Ft(n,je()),t;switch(n.finishedWork=i,n.finishedLanes=r,e){case 0:case 1:throw Error(V(345));case 2:Ur(n,Rt,Gn);break;case 3:if(hr(n,r),(r&130023424)===r&&(e=Ud+500-je(),10<e)){if(al(n,0)!==0)break;if(i=n.suspendedLanes,(i&r)!==r){At(),n.pingedLanes|=n.suspendedLanes&i;break}n.timeoutHandle=Kc(Ur.bind(null,n,Rt,Gn),e);break}Ur(n,Rt,Gn);break;case 4:if(hr(n,r),(r&4194240)===r)break;for(e=n.eventTimes,i=-1;0<r;){var o=31-mn(r);s=1<<o,o=e[o],o>i&&(i=o),r&=~s}if(r=i,r=je()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*YS(r/1960))-r,10<r){n.timeoutHandle=Kc(Ur.bind(null,n,Rt,Gn),r);break}Ur(n,Rt,Gn);break;case 5:Ur(n,Rt,Gn);break;default:throw Error(V(329))}}}return Ft(n,je()),n.callbackNode===t?H_.bind(null,n):null}function mh(n,e){var t=oo;return n.current.memoizedState.isDehydrated&&(Qr(n,e).flags|=256),n=Cl(n,e),n!==2&&(e=Rt,Rt=t,e!==null&&gh(e)),n}function gh(n){Rt===null?Rt=n:Rt.push.apply(Rt,n)}function KS(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var r=0;r<t.length;r++){var i=t[r],s=i.getSnapshot;i=i.value;try{if(!yn(s(),i))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function hr(n,e){for(e&=~Ld,e&=~Zl,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-mn(e),r=1<<t;n[t]=-1,e&=~r}}function Sp(n){if(ge&6)throw Error(V(327));qi();var e=al(n,0);if(!(e&1))return Ft(n,je()),null;var t=Cl(n,e);if(n.tag!==0&&t===2){var r=zc(n);r!==0&&(e=r,t=mh(n,r))}if(t===1)throw t=Bo,Qr(n,0),hr(n,e),Ft(n,je()),t;if(t===6)throw Error(V(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,Ur(n,Rt,Gn),Ft(n,je()),null}function Nd(n,e){var t=ge;ge|=1;try{return n(e)}finally{ge=t,ge===0&&(ss=je()+500,Yl&&kr())}}function ri(n){fr!==null&&fr.tag===0&&!(ge&6)&&qi();var e=ge;ge|=1;var t=en.transition,r=we;try{if(en.transition=null,we=1,n)return n()}finally{we=r,en.transition=t,ge=e,!(ge&6)&&kr()}}function zd(){Nt=zi.current,Ie(zi)}function Qr(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,CS(t)),Ye!==null)for(t=Ye.return;t!==null;){var r=t;switch(bd(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&dl();break;case 3:rs(),Ie(Bt),Ie(Tt),Md();break;case 5:Pd(r);break;case 4:rs();break;case 13:Ie(Oe);break;case 19:Ie(Oe);break;case 10:Cd(r.type._context);break;case 22:case 23:zd()}t=t.return}if(lt=n,Ye=n=wr(n.current,null),pt=Nt=e,tt=0,Bo=null,Ld=Zl=ni=0,Rt=oo=null,Xr!==null){for(e=0;e<Xr.length;e++)if(t=Xr[e],r=t.interleaved,r!==null){t.interleaved=null;var i=r.next,s=t.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}t.pending=r}Xr=null}return n}function V_(n,e){do{var t=Ye;try{if(Td(),$a.current=bl,vl){for(var r=Le.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}vl=!1}if(ti=0,ot=Je=Le=null,io=!1,Mo=0,Od.current=null,t===null||t.return===null){tt=1,Bo=e,Ye=null;break}e:{var s=n,o=t.return,a=t,l=e;if(e=pt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,c=a,h=c.tag;if(!(c.mode&1)&&(h===0||h===11||h===15)){var d=c.alternate;d?(c.updateQueue=d.updateQueue,c.memoizedState=d.memoizedState,c.lanes=d.lanes):(c.updateQueue=null,c.memoizedState=null)}var f=cp(o);if(f!==null){f.flags&=-257,hp(f,o,a,s,e),f.mode&1&&up(s,u,e),e=f,l=u;var p=e.updateQueue;if(p===null){var g=new Set;g.add(l),e.updateQueue=g}else p.add(l);break e}else{if(!(e&1)){up(s,u,e),Wd();break e}l=Error(V(426))}}else if(De&&a.mode&1){var _=cp(o);if(_!==null){!(_.flags&65536)&&(_.flags|=256),hp(_,o,a,s,e),wd(is(l,a));break e}}s=l=is(l,a),tt!==4&&(tt=2),oo===null?oo=[s]:oo.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var m=A_(s,l,e);rp(s,m);break e;case 1:a=l;var y=s.type,x=s.stateNode;if(!(s.flags&128)&&(typeof y.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(vr===null||!vr.has(x)))){s.flags|=65536,e&=-e,s.lanes|=e;var b=k_(s,a,e);rp(s,b);break e}}s=s.return}while(s!==null)}X_(t)}catch(S){e=S,Ye===t&&t!==null&&(Ye=t=t.return);continue}break}while(!0)}function j_(){var n=wl.current;return wl.current=bl,n===null?bl:n}function Wd(){(tt===0||tt===3||tt===2)&&(tt=4),lt===null||!(ni&268435455)&&!(Zl&268435455)||hr(lt,pt)}function Cl(n,e){var t=ge;ge|=2;var r=j_();(lt!==n||pt!==e)&&(Gn=null,Qr(n,e));do try{qS();break}catch(i){V_(n,i)}while(!0);if(Td(),ge=t,wl.current=r,Ye!==null)throw Error(V(261));return lt=null,pt=0,tt}function qS(){for(;Ye!==null;)$_(Ye)}function QS(){for(;Ye!==null&&!ww();)$_(Ye)}function $_(n){var e=K_(n.alternate,n,Nt);n.memoizedProps=n.pendingProps,e===null?X_(n):Ye=e,Od.current=null}function X_(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=VS(t,e),t!==null){t.flags&=32767,Ye=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{tt=6,Ye=null;return}}else if(t=HS(t,e,Nt),t!==null){Ye=t;return}if(e=e.sibling,e!==null){Ye=e;return}Ye=e=n}while(e!==null);tt===0&&(tt=5)}function Ur(n,e,t){var r=we,i=en.transition;try{en.transition=null,we=1,ZS(n,e,t,r)}finally{en.transition=i,we=r}return null}function ZS(n,e,t,r){do qi();while(fr!==null);if(ge&6)throw Error(V(327));t=n.finishedWork;var i=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(V(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(Iw(n,s),n===lt&&(Ye=lt=null,pt=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||ya||(ya=!0,q_(ol,function(){return qi(),null})),s=(t.flags&15990)!==0,t.subtreeFlags&15990||s){s=en.transition,en.transition=null;var o=we;we=1;var a=ge;ge|=4,Od.current=null,$S(n,t),z_(t,n),_S(Xc),ll=!!$c,Xc=$c=null,n.current=t,XS(t),Sw(),ge=a,we=o,en.transition=s}else n.current=t;if(ya&&(ya=!1,fr=n,Tl=i),s=n.pendingLanes,s===0&&(vr=null),Ew(t.stateNode),Ft(n,je()),e!==null)for(r=n.onRecoverableError,t=0;t<e.length;t++)i=e[t],r(i.value,{componentStack:i.stack,digest:i.digest});if(Sl)throw Sl=!1,n=fh,fh=null,n;return Tl&1&&n.tag!==0&&qi(),s=n.pendingLanes,s&1?n===ph?ao++:(ao=0,ph=n):ao=0,kr(),null}function qi(){if(fr!==null){var n=Ay(Tl),e=en.transition,t=we;try{if(en.transition=null,we=16>n?16:n,fr===null)var r=!1;else{if(n=fr,fr=null,Tl=0,ge&6)throw Error(V(331));var i=ge;for(ge|=4,q=n.current;q!==null;){var s=q,o=s.child;if(q.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(q=u;q!==null;){var c=q;switch(c.tag){case 0:case 11:case 15:so(8,c,s)}var h=c.child;if(h!==null)h.return=c,q=h;else for(;q!==null;){c=q;var d=c.sibling,f=c.return;if(L_(c),c===u){q=null;break}if(d!==null){d.return=f,q=d;break}q=f}}}var p=s.alternate;if(p!==null){var g=p.child;if(g!==null){p.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}q=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,q=o;else e:for(;q!==null;){if(s=q,s.flags&2048)switch(s.tag){case 0:case 11:case 15:so(9,s,s.return)}var m=s.sibling;if(m!==null){m.return=s.return,q=m;break e}q=s.return}}var y=n.current;for(q=y;q!==null;){o=q;var x=o.child;if(o.subtreeFlags&2064&&x!==null)x.return=o,q=x;else e:for(o=y;q!==null;){if(a=q,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Ql(9,a)}}catch(S){ze(a,a.return,S)}if(a===o){q=null;break e}var b=a.sibling;if(b!==null){b.return=a.return,q=b;break e}q=a.return}}if(ge=i,kr(),En&&typeof En.onPostCommitFiberRoot=="function")try{En.onPostCommitFiberRoot(Hl,n)}catch{}r=!0}return r}finally{we=t,en.transition=e}}return!1}function Tp(n,e,t){e=is(t,e),e=A_(n,e,1),n=xr(n,e,1),e=At(),n!==null&&(Wo(n,1,e),Ft(n,e))}function ze(n,e,t){if(n.tag===3)Tp(n,n,t);else for(;e!==null;){if(e.tag===3){Tp(e,n,t);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(vr===null||!vr.has(r))){n=is(t,n),n=k_(e,n,1),e=xr(e,n,1),n=At(),e!==null&&(Wo(e,1,n),Ft(e,n));break}}e=e.return}}function JS(n,e,t){var r=n.pingCache;r!==null&&r.delete(e),e=At(),n.pingedLanes|=n.suspendedLanes&t,lt===n&&(pt&t)===t&&(tt===4||tt===3&&(pt&130023424)===pt&&500>je()-Ud?Qr(n,0):Ld|=t),Ft(n,e)}function Y_(n,e){e===0&&(n.mode&1?(e=aa,aa<<=1,!(aa&130023424)&&(aa=4194304)):e=1);var t=At();n=Yn(n,e),n!==null&&(Wo(n,e,t),Ft(n,t))}function e2(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),Y_(n,t)}function t2(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(V(314))}r!==null&&r.delete(e),Y_(n,t)}var K_;K_=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Bt.current)It=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return It=!1,WS(n,e,t);It=!!(n.flags&131072)}else It=!1,De&&e.flags&1048576&&Jy(e,ml,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Ya(n,e),n=e.pendingProps;var i=es(e,Tt.current);Ki(e,t),i=Id(null,e,r,n,i,t);var s=Bd();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Dt(r)?(s=!0,fl(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ad(e),i.updater=ql,e.stateNode=i,i._reactInternals=e,nh(e,r,n,t),e=sh(null,e,r,!0,s,t)):(e.tag=0,De&&s&&vd(e),Ct(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(Ya(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=r2(r),n=cn(r,n),i){case 0:e=ih(null,e,r,n,t);break e;case 1:e=pp(null,e,r,n,t);break e;case 11:e=dp(null,e,r,n,t);break e;case 14:e=fp(null,e,r,cn(r.type,n),t);break e}throw Error(V(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:cn(r,i),ih(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:cn(r,i),pp(n,e,r,i,t);case 3:e:{if(I_(e),n===null)throw Error(V(387));r=e.pendingProps,s=e.memoizedState,i=s.element,s_(n,e),_l(e,r,null,t);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=is(Error(V(423)),e),e=mp(n,e,r,t,i);break e}else if(r!==i){i=is(Error(V(424)),e),e=mp(n,e,r,t,i);break e}else for(zt=_r(e.stateNode.containerInfo.firstChild),Wt=e,De=!0,dn=null,t=r_(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(ts(),r===i){e=Kn(n,e,t);break e}Ct(n,e,r,t)}e=e.child}return e;case 5:return o_(e),n===null&&Jc(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,Yc(r,i)?o=null:s!==null&&Yc(r,s)&&(e.flags|=32),R_(n,e),Ct(n,e,o,t),e.child;case 6:return n===null&&Jc(e),null;case 13:return B_(n,e,t);case 4:return kd(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=ns(e,null,r,t):Ct(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:cn(r,i),dp(n,e,r,i,t);case 7:return Ct(n,e,e.pendingProps,t),e.child;case 8:return Ct(n,e,e.pendingProps.children,t),e.child;case 12:return Ct(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,Pe(gl,r._currentValue),r._currentValue=o,s!==null)if(yn(s.value,o)){if(s.children===i.children&&!Bt.current){e=Kn(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Hn(-1,t&-t),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),eh(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(V(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),eh(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Ct(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Ki(e,t),i=nn(i),r=r(i),e.flags|=1,Ct(n,e,r,t),e.child;case 14:return r=e.type,i=cn(r,e.pendingProps),i=cn(r.type,i),fp(n,e,r,i,t);case 15:return P_(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:cn(r,i),Ya(n,e),e.tag=1,Dt(r)?(n=!0,fl(e)):n=!1,Ki(e,t),E_(e,r,i),nh(e,r,i,t),sh(null,e,r,!0,n,t);case 19:return D_(n,e,t);case 22:return M_(n,e,t)}throw Error(V(156,e.tag))};function q_(n,e){return Sy(n,e)}function n2(n,e,t,r){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qt(n,e,t,r){return new n2(n,e,t,r)}function Hd(n){return n=n.prototype,!(!n||!n.isReactComponent)}function r2(n){if(typeof n=="function")return Hd(n)?1:0;if(n!=null){if(n=n.$$typeof,n===ld)return 11;if(n===ud)return 14}return 2}function wr(n,e){var t=n.alternate;return t===null?(t=Qt(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function Qa(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")Hd(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Ri:return Zr(t.children,i,s,e);case ad:o=8,i|=8;break;case Ec:return n=Qt(12,t,e,i|2),n.elementType=Ec,n.lanes=s,n;case Ac:return n=Qt(13,t,e,i),n.elementType=Ac,n.lanes=s,n;case kc:return n=Qt(19,t,e,i),n.elementType=kc,n.lanes=s,n;case oy:return Jl(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case iy:o=10;break e;case sy:o=9;break e;case ld:o=11;break e;case ud:o=14;break e;case lr:o=16,r=null;break e}throw Error(V(130,n==null?n:typeof n,""))}return e=Qt(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function Zr(n,e,t,r){return n=Qt(7,n,r,e),n.lanes=t,n}function Jl(n,e,t,r){return n=Qt(22,n,r,e),n.elementType=oy,n.lanes=t,n.stateNode={isHidden:!1},n}function Vu(n,e,t){return n=Qt(6,n,null,e),n.lanes=t,n}function ju(n,e,t){return e=Qt(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function i2(n,e,t,r,i){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Cu(0),this.expirationTimes=Cu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cu(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Vd(n,e,t,r,i,s,o,a,l){return n=new i2(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Qt(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ad(s),n}function s2(n,e,t){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Mi,key:r==null?null:""+r,children:n,containerInfo:e,implementation:t}}function Q_(n){if(!n)return Cr;n=n._reactInternals;e:{if(ui(n)!==n||n.tag!==1)throw Error(V(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Dt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(V(171))}if(n.tag===1){var t=n.type;if(Dt(t))return Qy(n,t,e)}return e}function Z_(n,e,t,r,i,s,o,a,l){return n=Vd(t,r,!0,n,i,s,o,a,l),n.context=Q_(null),t=n.current,r=At(),i=br(t),s=Hn(r,i),s.callback=e??null,xr(t,s,i),n.current.lanes=i,Wo(n,i,r),Ft(n,r),n}function eu(n,e,t,r){var i=e.current,s=At(),o=br(i);return t=Q_(t),e.context===null?e.context=t:e.pendingContext=t,e=Hn(s,o),e.payload={element:n},r=r===void 0?null:r,r!==null&&(e.callback=r),n=xr(i,e,o),n!==null&&(gn(n,i,o,s),ja(n,i,o)),o}function El(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function Cp(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function jd(n,e){Cp(n,e),(n=n.alternate)&&Cp(n,e)}function o2(){return null}var J_=typeof reportError=="function"?reportError:function(n){console.error(n)};function $d(n){this._internalRoot=n}tu.prototype.render=$d.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(V(409));eu(n,e,null,null)};tu.prototype.unmount=$d.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;ri(function(){eu(null,n,null,null)}),e[Xn]=null}};function tu(n){this._internalRoot=n}tu.prototype.unstable_scheduleHydration=function(n){if(n){var e=My();n={blockedOn:null,target:n,priority:e};for(var t=0;t<cr.length&&e!==0&&e<cr[t].priority;t++);cr.splice(t,0,n),t===0&&Iy(n)}};function Xd(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function nu(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Ep(){}function a2(n,e,t,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=El(o);s.call(u)}}var o=Z_(e,r,n,0,null,!1,!1,"",Ep);return n._reactRootContainer=o,n[Xn]=o.current,Co(n.nodeType===8?n.parentNode:n),ri(),o}for(;i=n.lastChild;)n.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var u=El(l);a.call(u)}}var l=Vd(n,0,!1,null,null,!1,!1,"",Ep);return n._reactRootContainer=l,n[Xn]=l.current,Co(n.nodeType===8?n.parentNode:n),ri(function(){eu(e,l,t,r)}),l}function ru(n,e,t,r,i){var s=t._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=El(o);a.call(l)}}eu(e,o,n,i)}else o=a2(t,e,n,i,r);return El(o)}ky=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=Ks(e.pendingLanes);t!==0&&(dd(e,t|1),Ft(e,je()),!(ge&6)&&(ss=je()+500,kr()))}break;case 13:ri(function(){var r=Yn(n,1);if(r!==null){var i=At();gn(r,n,1,i)}}),jd(n,1)}};fd=function(n){if(n.tag===13){var e=Yn(n,134217728);if(e!==null){var t=At();gn(e,n,134217728,t)}jd(n,134217728)}};Py=function(n){if(n.tag===13){var e=br(n),t=Yn(n,e);if(t!==null){var r=At();gn(t,n,e,r)}jd(n,e)}};My=function(){return we};Ry=function(n,e){var t=we;try{return we=n,e()}finally{we=t}};Lc=function(n,e,t){switch(e){case"input":if(Rc(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var r=t[e];if(r!==n&&r.form===n.form){var i=Xl(r);if(!i)throw Error(V(90));ly(r),Rc(r,i)}}}break;case"textarea":cy(n,t);break;case"select":e=t.value,e!=null&&ji(n,!!t.multiple,e,!1)}};yy=Nd;_y=ri;var l2={usingClientEntryPoint:!1,Events:[Vo,Fi,Xl,my,gy,Nd]},Fs={findFiberByHostInstance:$r,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},u2={bundleType:Fs.bundleType,version:Fs.version,rendererPackageName:Fs.rendererPackageName,rendererConfig:Fs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Jn.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=by(n),n===null?null:n.stateNode},findFiberByHostInstance:Fs.findFiberByHostInstance||o2,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_a.isDisabled&&_a.supportsFiber)try{Hl=_a.inject(u2),En=_a}catch{}}Vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=l2;Vt.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Xd(e))throw Error(V(200));return s2(n,e,null,t)};Vt.createRoot=function(n,e){if(!Xd(n))throw Error(V(299));var t=!1,r="",i=J_;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=Vd(n,1,!1,null,null,t,!1,r,i),n[Xn]=e.current,Co(n.nodeType===8?n.parentNode:n),new $d(e)};Vt.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(V(188)):(n=Object.keys(n).join(","),Error(V(268,n)));return n=by(e),n=n===null?null:n.stateNode,n};Vt.flushSync=function(n){return ri(n)};Vt.hydrate=function(n,e,t){if(!nu(e))throw Error(V(200));return ru(null,n,e,!0,t)};Vt.hydrateRoot=function(n,e,t){if(!Xd(n))throw Error(V(405));var r=t!=null&&t.hydratedSources||null,i=!1,s="",o=J_;if(t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=Z_(e,null,n,1,t??null,i,!1,s,o),n[Xn]=e.current,Co(n),r)for(n=0;n<r.length;n++)t=r[n],i=t._getVersion,i=i(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,i]:e.mutableSourceEagerHydrationData.push(t,i);return new tu(e)};Vt.render=function(n,e,t){if(!nu(e))throw Error(V(200));return ru(null,n,e,!1,t)};Vt.unmountComponentAtNode=function(n){if(!nu(n))throw Error(V(40));return n._reactRootContainer?(ri(function(){ru(null,null,n,!1,function(){n._reactRootContainer=null,n[Xn]=null})}),!0):!1};Vt.unstable_batchedUpdates=Nd;Vt.unstable_renderSubtreeIntoContainer=function(n,e,t,r){if(!nu(t))throw Error(V(200));if(n==null||n._reactInternals===void 0)throw Error(V(38));return ru(n,e,t,!1,r)};Vt.version="18.3.1-next-f1338f8080-20240426";function ex(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ex)}catch(n){console.error(n)}}ex(),ey.exports=Vt;var c2=ey.exports,tx,Ap=c2;tx=Ap.createRoot,Ap.hydrateRoot;var nx={exports:{}},iu={};/**
|
|
33
|
+
* @license React
|
|
34
|
+
* react-jsx-runtime.production.min.js
|
|
35
|
+
*
|
|
36
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
37
|
+
*
|
|
38
|
+
* This source code is licensed under the MIT license found in the
|
|
39
|
+
* LICENSE file in the root directory of this source tree.
|
|
40
|
+
*/var h2=Yt,d2=Symbol.for("react.element"),f2=Symbol.for("react.fragment"),p2=Object.prototype.hasOwnProperty,m2=h2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,g2={key:!0,ref:!0,__self:!0,__source:!0};function rx(n,e,t){var r,i={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)p2.call(e,r)&&!g2.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:d2,type:n,key:s,ref:o,props:i,_owner:m2.current}}iu.Fragment=f2;iu.jsx=rx;iu.jsxs=rx;nx.exports=iu;var y2=nx.exports;const _2="modulepreload",x2=function(n,e){return new URL(n,e).href},kp={},lo=function(e,t,r){let i=Promise.resolve();if(t&&t.length>0){const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(t.map(u=>{if(u=x2(u,r),u in kp)return;kp[u]=!0;const c=u.endsWith(".css"),h=c?'[rel="stylesheet"]':"";if(!!r)for(let p=o.length-1;p>=0;p--){const g=o[p];if(g.href===u&&(!c||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${h}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":_2,c||(f.as="script"),f.crossOrigin="",f.href=u,l&&f.setAttribute("nonce",l),document.head.appendChild(f),c)return new Promise((p,g)=>{f.addEventListener("load",p),f.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};var k=(n=>(n.Application="application",n.WebGLPipes="webgl-pipes",n.WebGLPipesAdaptor="webgl-pipes-adaptor",n.WebGLSystem="webgl-system",n.WebGPUPipes="webgpu-pipes",n.WebGPUPipesAdaptor="webgpu-pipes-adaptor",n.WebGPUSystem="webgpu-system",n.CanvasSystem="canvas-system",n.CanvasPipesAdaptor="canvas-pipes-adaptor",n.CanvasPipes="canvas-pipes",n.Asset="asset",n.LoadParser="load-parser",n.ResolveParser="resolve-parser",n.CacheParser="cache-parser",n.DetectionParser="detection-parser",n.MaskEffect="mask-effect",n.BlendMode="blend-mode",n.TextureSource="texture-source",n.TextureUploaderWebGL="texture-uploader-webgl",n.TextureUploaderWebGPU="texture-uploader-webgpu",n.Environment="environment",n.ShapeBuilder="shape-builder",n.Batcher="batcher",n))(k||{});const yh=n=>{if(typeof n=="function"||typeof n=="object"&&n.extension){if(!n.extension)throw new Error("Extension class must have an extension object");n={...typeof n.extension!="object"?{type:n.extension}:n.extension,ref:n}}if(typeof n=="object")n={...n};else throw new Error("Invalid extension type");return typeof n.type=="string"&&(n.type=[n.type]),n},xa=(n,e)=>yh(n).priority??e,ae={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...n){return n.map(yh).forEach(e=>{e.type.forEach(t=>{var r,i;return(i=(r=this._removeHandlers)[t])==null?void 0:i.call(r,e)})}),this},add(...n){return n.map(yh).forEach(e=>{e.type.forEach(t=>{var s,o;const r=this._addHandlers,i=this._queue;r[t]?(o=r[t])==null||o.call(r,e):(i[t]=i[t]||[],(s=i[t])==null||s.push(e))})}),this},handle(n,e,t){var o;const r=this._addHandlers,i=this._removeHandlers;if(r[n]||i[n])throw new Error(`Extension type ${n} already has a handler`);r[n]=e,i[n]=t;const s=this._queue;return s[n]&&((o=s[n])==null||o.forEach(a=>e(a)),delete s[n]),this},handleByMap(n,e){return this.handle(n,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByNamedList(n,e,t=-1){return this.handle(n,r=>{e.findIndex(s=>s.name===r.name)>=0||(e.push({name:r.name,value:r.ref}),e.sort((s,o)=>xa(o.value,t)-xa(s.value,t)))},r=>{const i=e.findIndex(s=>s.name===r.name);i!==-1&&e.splice(i,1)})},handleByList(n,e,t=-1){return this.handle(n,r=>{e.includes(r.ref)||(e.push(r.ref),e.sort((i,s)=>xa(s,t)-xa(i,t)))},r=>{const i=e.indexOf(r.ref);i!==-1&&e.splice(i,1)})},mixin(n,...e){for(const t of e)Object.defineProperties(n.prototype,Object.getOwnPropertyDescriptors(t))}},v2={extension:{type:k.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await lo(()=>Promise.resolve().then(()=>X8),void 0,import.meta.url)}},b2={extension:{type:k.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await lo(()=>Promise.resolve().then(()=>Y8),void 0,import.meta.url)}};class ft{constructor(e,t,r){this._x=t||0,this._y=r||0,this._observer=e}clone(e){return new ft(e??this._observer,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}var ix={exports:{}};(function(n){var e=Object.prototype.hasOwnProperty,t="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(t=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function s(l,u,c,h,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new i(c,h||l,d),p=t?t+u:u;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],f]:l._events[p].push(f):(l._events[p]=f,l._eventsCount++),l}function o(l,u){--l._eventsCount===0?l._events=new r:delete l._events[u]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)e.call(c,h)&&u.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},a.prototype.listeners=function(u){var c=t?t+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,f=h.length,p=new Array(f);d<f;d++)p[d]=h[d].fn;return p},a.prototype.listenerCount=function(u){var c=t?t+u:u,h=this._events[c];return h?h.fn?1:h.length:0},a.prototype.emit=function(u,c,h,d,f,p){var g=t?t+u:u;if(!this._events[g])return!1;var _=this._events[g],m=arguments.length,y,x;if(_.fn){switch(_.once&&this.removeListener(u,_.fn,void 0,!0),m){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,c),!0;case 3:return _.fn.call(_.context,c,h),!0;case 4:return _.fn.call(_.context,c,h,d),!0;case 5:return _.fn.call(_.context,c,h,d,f),!0;case 6:return _.fn.call(_.context,c,h,d,f,p),!0}for(x=1,y=new Array(m-1);x<m;x++)y[x-1]=arguments[x];_.fn.apply(_.context,y)}else{var b=_.length,S;for(x=0;x<b;x++)switch(_[x].once&&this.removeListener(u,_[x].fn,void 0,!0),m){case 1:_[x].fn.call(_[x].context);break;case 2:_[x].fn.call(_[x].context,c);break;case 3:_[x].fn.call(_[x].context,c,h);break;case 4:_[x].fn.call(_[x].context,c,h,d);break;default:if(!y)for(S=1,y=new Array(m-1);S<m;S++)y[S-1]=arguments[S];_[x].fn.apply(_[x].context,y)}}return!0},a.prototype.on=function(u,c,h){return s(this,u,c,h,!1)},a.prototype.once=function(u,c,h){return s(this,u,c,h,!0)},a.prototype.removeListener=function(u,c,h,d){var f=t?t+u:u;if(!this._events[f])return this;if(!c)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===c&&(!d||p.once)&&(!h||p.context===h)&&o(this,f);else{for(var g=0,_=[],m=p.length;g<m;g++)(p[g].fn!==c||d&&!p[g].once||h&&p[g].context!==h)&&_.push(p[g]);_.length?this._events[f]=_.length===1?_[0]:_:o(this,f)}return this},a.prototype.removeAllListeners=function(u){var c;return u?(c=t?t+u:u,this._events[c]&&o(this,c)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,n.exports=a})(ix);var w2=ix.exports;const Ot=Vg(w2),S2=Math.PI*2,T2=180/Math.PI,C2=Math.PI/180;class Me{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new Me(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return $u.x=0,$u.y=0,$u}}const $u=new Me;class Z{constructor(e=1,t=0,r=0,i=1,s=0,o=0){this.array=null,this.a=e,this.b=t,this.c=r,this.d=i,this.tx=s,this.ty=o}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,r,i,s,o){return this.a=e,this.b=t,this.c=r,this.d=i,this.tx=s,this.ty=o,this}toArray(e,t){this.array||(this.array=new Float32Array(9));const r=t||this.array;return e?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(e,t){t=t||new Me;const r=e.x,i=e.y;return t.x=this.a*r+this.c*i+this.tx,t.y=this.b*r+this.d*i+this.ty,t}applyInverse(e,t){t=t||new Me;const r=this.a,i=this.b,s=this.c,o=this.d,a=this.tx,l=this.ty,u=1/(r*o+s*-i),c=e.x,h=e.y;return t.x=o*u*c+-s*u*h+(l*s-a*o)*u,t.y=r*u*h+-i*u*c+(-l*r+a*i)*u,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){const t=Math.cos(e),r=Math.sin(e),i=this.a,s=this.c,o=this.tx;return this.a=i*t-this.b*r,this.b=i*r+this.b*t,this.c=s*t-this.d*r,this.d=s*r+this.d*t,this.tx=o*t-this.ty*r,this.ty=o*r+this.ty*t,this}append(e){const t=this.a,r=this.b,i=this.c,s=this.d;return this.a=e.a*t+e.b*i,this.b=e.a*r+e.b*s,this.c=e.c*t+e.d*i,this.d=e.c*r+e.d*s,this.tx=e.tx*t+e.ty*i+this.tx,this.ty=e.tx*r+e.ty*s+this.ty,this}appendFrom(e,t){const r=e.a,i=e.b,s=e.c,o=e.d,a=e.tx,l=e.ty,u=t.a,c=t.b,h=t.c,d=t.d;return this.a=r*u+i*h,this.b=r*c+i*d,this.c=s*u+o*h,this.d=s*c+o*d,this.tx=a*u+l*h+t.tx,this.ty=a*c+l*d+t.ty,this}setTransform(e,t,r,i,s,o,a,l,u){return this.a=Math.cos(a+u)*s,this.b=Math.sin(a+u)*s,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=e-(r*this.a+i*this.c),this.ty=t-(r*this.b+i*this.d),this}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const r=this.a,i=this.c;this.a=r*e.a+this.b*e.c,this.b=r*e.b+this.b*e.d,this.c=i*e.a+this.d*e.c,this.d=i*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){const t=this.a,r=this.b,i=this.c,s=this.d,o=e.pivot,a=-Math.atan2(-i,s),l=Math.atan2(r,t),u=Math.abs(a+l);return u<1e-5||Math.abs(S2-u)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(t*t+r*r),e.scale.y=Math.sqrt(i*i+s*s),e.position.x=this.tx+(o.x*t+o.y*i),e.position.y=this.ty+(o.x*r+o.y*s),e}invert(){const e=this.a,t=this.b,r=this.c,i=this.d,s=this.tx,o=e*i-t*r;return this.a=i/o,this.b=-t/o,this.c=-r/o,this.d=e/o,this.tx=(r*this.ty-i*s)/o,this.ty=-(e*this.ty-t*s)/o,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const e=new Z;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return A2.identity()}static get shared(){return E2.identity()}}const E2=new Z,A2=new Z,Nr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],zr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Wr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Hr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],_h=[],sx=[],va=Math.sign;function k2(){for(let n=0;n<16;n++){const e=[];_h.push(e);for(let t=0;t<16;t++){const r=va(Nr[n]*Nr[t]+Wr[n]*zr[t]),i=va(zr[n]*Nr[t]+Hr[n]*zr[t]),s=va(Nr[n]*Wr[t]+Wr[n]*Hr[t]),o=va(zr[n]*Wr[t]+Hr[n]*Hr[t]);for(let a=0;a<16;a++)if(Nr[a]===r&&zr[a]===i&&Wr[a]===s&&Hr[a]===o){e.push(a);break}}}for(let n=0;n<16;n++){const e=new Z;e.set(Nr[n],zr[n],Wr[n],Hr[n],0,0),sx.push(e)}}k2();const he={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:n=>Nr[n],uY:n=>zr[n],vX:n=>Wr[n],vY:n=>Hr[n],inv:n=>n&8?n&15:-n&7,add:(n,e)=>_h[n][e],sub:(n,e)=>_h[n][he.inv(e)],rotate180:n=>n^4,isVertical:n=>(n&3)===2,byDirection:(n,e)=>Math.abs(n)*2<=Math.abs(e)?e>=0?he.S:he.N:Math.abs(e)*2<=Math.abs(n)?n>0?he.E:he.W:e>0?n>0?he.SE:he.SW:n>0?he.NE:he.NW,matrixAppendRotationInv:(n,e,t=0,r=0,i=0,s=0)=>{const o=sx[he.inv(e)],a=o.a,l=o.b,u=o.c,c=o.d,h=t-Math.min(0,a*i,u*s,a*i+u*s),d=r-Math.min(0,l*i,c*s,l*i+c*s),f=n.a,p=n.b,g=n.c,_=n.d;n.a=a*f+l*g,n.b=a*p+l*_,n.c=u*f+c*g,n.d=u*p+c*_,n.tx=h*f+d*g+n.tx,n.ty=h*p+d*_+n.ty},transformRectCoords:(n,e,t,r)=>{const{x:i,y:s,width:o,height:a}=n,{x:l,y:u,width:c,height:h}=e;return t===he.E?(r.set(i+l,s+u,o,a),r):t===he.S?r.set(c-s-a+l,i+u,a,o):t===he.W?r.set(c-i-o+l,h-s-a+u,o,a):t===he.N?r.set(s+l,h-i-o+u,a,o):r.set(i+l,s+u,o,a)}},ba=[new Me,new Me,new Me,new Me];class xe{constructor(e=0,t=0,r=0,i=0){this.type="rectangle",this.x=Number(e),this.y=Number(t),this.width=Number(r),this.height=Number(i)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new xe(0,0,0,0)}clone(){return new xe(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}strokeContains(e,t,r,i=.5){const{width:s,height:o}=this;if(s<=0||o<=0)return!1;const a=this.x,l=this.y,u=r*(1-i),c=r-u,h=a-u,d=a+s+u,f=l-u,p=l+o+u,g=a+c,_=a+s-c,m=l+c,y=l+o-c;return e>=h&&e<=d&&t>=f&&t<=p&&!(e>g&&e<_&&t>m&&t<y)}intersects(e,t){if(!t){const M=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=M)return!1;const R=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>R}const r=this.left,i=this.right,s=this.top,o=this.bottom;if(i<=r||o<=s)return!1;const a=ba[0].set(e.left,e.top),l=ba[1].set(e.left,e.bottom),u=ba[2].set(e.right,e.top),c=ba[3].set(e.right,e.bottom);if(u.x<=a.x||l.y<=a.y)return!1;const h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(a,a),t.apply(l,l),t.apply(u,u),t.apply(c,c),Math.max(a.x,l.x,u.x,c.x)<=r||Math.min(a.x,l.x,u.x,c.x)>=i||Math.max(a.y,l.y,u.y,c.y)<=s||Math.min(a.y,l.y,u.y,c.y)>=o))return!1;const d=h*(l.y-a.y),f=h*(a.x-l.x),p=d*r+f*s,g=d*i+f*s,_=d*r+f*o,m=d*i+f*o;if(Math.max(p,g,_,m)<=d*a.x+f*a.y||Math.min(p,g,_,m)>=d*c.x+f*c.y)return!1;const y=h*(a.y-u.y),x=h*(u.x-a.x),b=y*r+x*s,S=y*i+x*s,T=y*r+x*o,C=y*i+x*o;return!(Math.max(b,S,T,C)<=y*a.x+x*a.y||Math.min(b,S,T,C)>=y*c.x+x*c.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){const t=Math.max(this.x,e.x),r=Math.min(this.x+this.width,e.x+e.width),i=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(r-t,0),this.y=i,this.height=Math.max(s-i,0),this}ceil(e=1,t=.001){const r=Math.ceil((this.x+this.width-t)*e)/e,i=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=r-this.x,this.height=i-this.y,this}scale(e,t=e){return this.x*=e,this.y*=t,this.width*=e,this.height*=t,this}enlarge(e){const t=Math.min(this.x,e.x),r=Math.max(this.x+this.width,e.x+e.width),i=Math.min(this.y,e.y),s=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=r-t,this.y=i,this.height=s-i,this}getBounds(e){return e||(e=new xe),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;const t=e.x,r=e.y,i=e.x+e.width,s=e.y+e.height;return t>=this.x&&t<this.x+this.width&&r>=this.y&&r<this.y+this.height&&i>=this.x&&i<=this.x+this.width&&s>=this.y&&s<=this.y+this.height}set(e,t,r,i){return this.x=e,this.y=t,this.width=r,this.height=i,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const Xu={default:-1};function be(n="default"){return Xu[n]===void 0&&(Xu[n]=-1),++Xu[n]}const Pp=new Set,Ge="8.0.0",P2="8.3.4",Wi={quiet:!1,noColor:!1},ie=(n,e,t=3)=>{if(Wi.quiet||Pp.has(e))return;let r=new Error().stack;const i=`${e}
|
|
41
|
+
Deprecated since v${n}`,s=typeof console.groupCollapsed=="function"&&!Wi.noColor;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",i):(r=r.split(`
|
|
42
|
+
`).splice(t).join(`
|
|
43
|
+
`),s?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",i),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",i),console.warn(r))),Pp.add(e)};Object.defineProperties(ie,{quiet:{get:()=>Wi.quiet,set:n=>{Wi.quiet=n},enumerable:!0,configurable:!1},noColor:{get:()=>Wi.noColor,set:n=>{Wi.noColor=n},enumerable:!0,configurable:!1}});const ox=()=>{};function os(n){return n+=n===0?1:0,--n,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n+1}function Mp(n){return!(n&n-1)&&!!n}function ax(n){const e={};for(const t in n)n[t]!==void 0&&(e[t]=n[t]);return e}const Rp=Object.create(null);function M2(n){const e=Rp[n];return e===void 0&&(Rp[n]=be("resource")),e}const lx=class ux extends Ot{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...ux.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){ie(Ge,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){const e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=M2(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};lx.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let ii=lx;const cx=class hx extends Ot{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=be("textureSource"),this._resourceType="textureSource",this._resourceId=be("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this._ownsStyle=!1,this.antialias=!1,this.transient=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...hx.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.viewDimension=e.viewDimension??e.dimensions,this.arrayLayerCount=e.arrayLayerCount,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.transient=e.transient??!1,this.alphaMode=e.alphaMode,this.style=new ii(ax(e)),this._ownsStyle=!0,this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){var t,r;this.style!==e&&(this._ownsStyle=!1,(t=this._style)==null||t.off("change",this._onStyleChange,this),this._style=e,(r=this._style)==null||r.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(e){this._style.maxAnisotropy=e}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._ownsStyle&&this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){var e,t;this._resourceId=be("resource"),this.emit("change",this),this.emit("unload",this);for(const r in this._gpuData)(t=(e=this._gpuData[r])==null?void 0:e.destroy)==null||t.call(e);this._gpuData=Object.create(null)}get resourceWidth(){const{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){const{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,t,r){r||(r=this._resolution),e||(e=this.width),t||(t=this.height);const i=Math.round(e*r),s=Math.round(t*r);return this.width=i/r,this.height=s/r,this._resolution=r,this.pixelWidth===i&&this.pixelHeight===s?!1:(this._refreshPOT(),this.pixelWidth=i,this.pixelHeight=s,this.emit("resize",this),this._resourceId=be("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Mp(this.pixelWidth)&&Mp(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};cx.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let $e=cx;class Yd extends $e{constructor(e){const t=e.resource||new Float32Array(e.width*e.height*4);let r=e.format;r||(t instanceof Float32Array?r="rgba32float":t instanceof Int32Array||t instanceof Uint32Array?r="rgba32uint":t instanceof Int16Array||t instanceof Uint16Array?r="rgba16uint":(t instanceof Int8Array,r="bgra8unorm")),super({...e,resource:t,format:r}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}}Yd.extension=k.TextureSource;const Ip=new Z;class dx{constructor(e,t){this.mapCoord=new Z,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._updateID=0,this.clampOffset=0,typeof t>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=t,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){var t;this._texture!==e&&((t=this._texture)==null||t.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this)),this.update()}destroy(){var e;(e=this._texture)==null||e.removeListener("update",this.update,this),this._texture=null}multiplyUvs(e,t){t===void 0&&(t=e);const r=this.mapCoord;for(let i=0;i<e.length;i+=2){const s=e[i],o=e[i+1];t[i]=s*r.a+o*r.c+r.tx,t[i+1]=s*r.b+o*r.d+r.ty}return t}update(){const e=this._texture;this._updateID++;const t=e.uvs;this.mapCoord.set(t.x1-t.x0,t.y1-t.y0,t.x3-t.x0,t.y3-t.y0,t.x0,t.y0);const r=e.orig,i=e.trim;i&&(Ip.set(r.width/i.width,0,0,r.height/i.height,-i.x/i.width,-i.y/i.height),this.mapCoord.append(Ip));const s=e.source,o=this.uClampFrame,a=this.clampMargin/s._resolution,l=this.clampOffset/s._resolution;return o[0]=(e.frame.x+a+l)/s.width,o[1]=(e.frame.y+a+l)/s.height,o[2]=(e.frame.x+e.frame.width-a+l)/s.width,o[3]=(e.frame.y+e.frame.height-a+l)/s.height,this.uClampOffset[0]=this.clampOffset/s.pixelWidth,this.uClampOffset[1]=this.clampOffset/s.pixelHeight,this.isSimple=e.frame.width===s.width&&e.frame.height===s.height&&e.rotate===0,!0}}class Q extends Ot{constructor({source:e,label:t,frame:r,orig:i,trim:s,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:u}={}){if(super(),this.uid=be("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new xe,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=(e==null?void 0:e.source)??new $e,this.noFrame=!r,r)this.frame.copyFrom(r);else{const{width:c,height:h}=this._source;this.frame.width=c,this.frame.height=h}this.orig=i||this.frame,this.trim=s,this.rotate=l??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=u||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new dx(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:e,frame:t}=this,{width:r,height:i}=this._source,s=t.x/r,o=t.y/i,a=t.width/r,l=t.height/i;let u=this.rotate;if(u){const c=a/2,h=l/2,d=s+c,f=o+h;u=he.add(u,he.NW),e.x0=d+c*he.uX(u),e.y0=f+h*he.uY(u),u=he.add(u,2),e.x1=d+c*he.uX(u),e.y1=f+h*he.uY(u),u=he.add(u,2),e.x2=d+c*he.uX(u),e.y2=f+h*he.uY(u),u=he.add(u,2),e.x3=d+c*he.uX(u),e.y3=f+h*he.uY(u)}else e.x0=s,e.y0=o,e.x1=s+a,e.y1=o,e.x2=s+a,e.y2=o+l,e.x3=s,e.y3=o+l}destroy(e=!1){this._source&&(this._source.off("resize",this.update,this),e&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return ie(Ge,"Texture.baseTexture is now Texture.source"),this._source}}Q.EMPTY=new Q({label:"EMPTY",source:new $e({label:"EMPTY"})});Q.EMPTY.destroy=ox;Q.WHITE=new Q({source:new Yd({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});Q.WHITE.destroy=ox;function fx(n,e,t){const{width:r,height:i}=t.orig,s=t.trim;if(s){const o=s.width,a=s.height;n.minX=s.x-e._x*r,n.maxX=n.minX+o,n.minY=s.y-e._y*i,n.maxY=n.minY+a}else n.minX=-e._x*r,n.maxX=n.minX+r,n.minY=-e._y*i,n.maxY=n.minY+i}const Bp=new Z;class gt{constructor(e=1/0,t=1/0,r=-1/0,i=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Bp,this.minX=e,this.minY=t,this.maxX=r,this.maxY=i}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new xe);const e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Bp,this}set(e,t,r,i){this.minX=e,this.minY=t,this.maxX=r,this.maxY=i}addFrame(e,t,r,i,s){s||(s=this.matrix);const o=s.a,a=s.b,l=s.c,u=s.d,c=s.tx,h=s.ty;let d=this.minX,f=this.minY,p=this.maxX,g=this.maxY,_=o*e+l*t+c,m=a*e+u*t+h;_<d&&(d=_),m<f&&(f=m),_>p&&(p=_),m>g&&(g=m),_=o*r+l*t+c,m=a*r+u*t+h,_<d&&(d=_),m<f&&(f=m),_>p&&(p=_),m>g&&(g=m),_=o*e+l*i+c,m=a*e+u*i+h,_<d&&(d=_),m<f&&(f=m),_>p&&(p=_),m>g&&(g=m),_=o*r+l*i+c,m=a*r+u*i+h,_<d&&(d=_),m<f&&(f=m),_>p&&(p=_),m>g&&(g=m),this.minX=d,this.minY=f,this.maxX=p,this.maxY=g}addRect(e,t){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,t)}addBounds(e,t){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,t)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){const t=this.minX,r=this.minY,i=this.maxX,s=this.maxY,{a:o,b:a,c:l,d:u,tx:c,ty:h}=e;let d=o*t+l*r+c,f=a*t+u*r+h;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=o*i+l*r+c,f=a*i+u*r+h,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=o*t+l*s+c,f=a*t+u*s+h,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=o*i+l*s+c,f=a*i+u*s+h,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,t,r,i){return this.minX<e&&(this.minX=e),this.maxX>t&&(this.maxX=t),this.minY<r&&(this.minY=r),this.maxY>i&&(this.maxY=i),this}pad(e,t=e){return this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new gt(this.minX,this.minY,this.maxX,this.maxY)}scale(e,t=e){return this.minX*=e,this.minY*=t,this.maxX*=e,this.maxY*=t,this}get x(){return this.minX}set x(e){const t=this.maxX-this.minX;this.minX=e,this.maxX=e+t}get y(){return this.minY}set y(e){const t=this.maxY-this.minY;this.minY=e,this.maxY=e+t}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(e,t,r,i){let s=this.minX,o=this.minY,a=this.maxX,l=this.maxY;i||(i=this.matrix);const u=i.a,c=i.b,h=i.c,d=i.d,f=i.tx,p=i.ty;for(let g=t;g<r;g+=2){const _=e[g],m=e[g+1],y=u*_+h*m+f,x=c*_+d*m+p;s=y<s?y:s,o=x<o?x:o,a=y>a?y:a,l=x>l?x:l}this.minX=s,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(e,t){return this.minX<=e&&this.minY<=t&&this.maxX>=e&&this.maxY>=t}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}var R2={grad:.9,turn:360,rad:360/(2*Math.PI)},Dn=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},at=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*n)/t+0},Zt=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),n>t?t:n>e?n:e},px=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},Dp=function(n){return{r:Zt(n.r,0,255),g:Zt(n.g,0,255),b:Zt(n.b,0,255),a:Zt(n.a)}},Yu=function(n){return{r:at(n.r),g:at(n.g),b:at(n.b),a:at(n.a,3)}},I2=/^#([0-9a-f]{3,8})$/i,wa=function(n){var e=n.toString(16);return e.length<2?"0"+e:e},mx=function(n){var e=n.r,t=n.g,r=n.b,i=n.a,s=Math.max(e,t,r),o=s-Math.min(e,t,r),a=o?s===e?(t-r)/o:s===t?2+(r-e)/o:4+(e-t)/o:0;return{h:60*(a<0?a+6:a),s:s?o/s*100:0,v:s/255*100,a:i}},gx=function(n){var e=n.h,t=n.s,r=n.v,i=n.a;e=e/360*6,t/=100,r/=100;var s=Math.floor(e),o=r*(1-t),a=r*(1-(e-s)*t),l=r*(1-(1-e+s)*t),u=s%6;return{r:255*[r,a,o,o,l,r][u],g:255*[l,r,r,a,o,o][u],b:255*[o,o,l,r,r,a][u],a:i}},Fp=function(n){return{h:px(n.h),s:Zt(n.s,0,100),l:Zt(n.l,0,100),a:Zt(n.a)}},Gp=function(n){return{h:at(n.h),s:at(n.s),l:at(n.l),a:at(n.a,3)}},Op=function(n){return gx((t=(e=n).s,{h:e.h,s:(t*=((r=e.l)<50?r:100-r)/100)>0?2*t/(r+t)*100:0,v:r+t,a:e.a}));var e,t,r},uo=function(n){return{h:(e=mx(n)).h,s:(i=(200-(t=e.s))*(r=e.v)/100)>0&&i<200?t*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,t,r,i},B2=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,D2=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,F2=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,G2=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xh={string:[[function(n){var e=I2.exec(n);return e?(n=e[1]).length<=4?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?at(parseInt(n[3]+n[3],16)/255,2):1}:n.length===6||n.length===8?{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16),a:n.length===8?at(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var e=F2.exec(n)||G2.exec(n);return e?e[2]!==e[4]||e[4]!==e[6]?null:Dp({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(n){var e=B2.exec(n)||D2.exec(n);if(!e)return null;var t,r,i=Fp({h:(t=e[1],r=e[2],r===void 0&&(r="deg"),Number(t)*(R2[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Op(i)},"hsl"]],object:[[function(n){var e=n.r,t=n.g,r=n.b,i=n.a,s=i===void 0?1:i;return Dn(e)&&Dn(t)&&Dn(r)?Dp({r:Number(e),g:Number(t),b:Number(r),a:Number(s)}):null},"rgb"],[function(n){var e=n.h,t=n.s,r=n.l,i=n.a,s=i===void 0?1:i;if(!Dn(e)||!Dn(t)||!Dn(r))return null;var o=Fp({h:Number(e),s:Number(t),l:Number(r),a:Number(s)});return Op(o)},"hsl"],[function(n){var e=n.h,t=n.s,r=n.v,i=n.a,s=i===void 0?1:i;if(!Dn(e)||!Dn(t)||!Dn(r))return null;var o=function(a){return{h:px(a.h),s:Zt(a.s,0,100),v:Zt(a.v,0,100),a:Zt(a.a)}}({h:Number(e),s:Number(t),v:Number(r),a:Number(s)});return gx(o)},"hsv"]]},Lp=function(n,e){for(var t=0;t<e.length;t++){var r=e[t][0](n);if(r)return[r,e[t][1]]}return[null,void 0]},O2=function(n){return typeof n=="string"?Lp(n.trim(),xh.string):typeof n=="object"&&n!==null?Lp(n,xh.object):[null,void 0]},Ku=function(n,e){var t=uo(n);return{h:t.h,s:Zt(t.s+100*e,0,100),l:t.l,a:t.a}},qu=function(n){return(299*n.r+587*n.g+114*n.b)/1e3/255},Up=function(n,e){var t=uo(n);return{h:t.h,s:t.s,l:Zt(t.l+100*e,0,100),a:t.a}},vh=function(){function n(e){this.parsed=O2(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return n.prototype.isValid=function(){return this.parsed!==null},n.prototype.brightness=function(){return at(qu(this.rgba),2)},n.prototype.isDark=function(){return qu(this.rgba)<.5},n.prototype.isLight=function(){return qu(this.rgba)>=.5},n.prototype.toHex=function(){return e=Yu(this.rgba),t=e.r,r=e.g,i=e.b,o=(s=e.a)<1?wa(at(255*s)):"","#"+wa(t)+wa(r)+wa(i)+o;var e,t,r,i,s,o},n.prototype.toRgb=function(){return Yu(this.rgba)},n.prototype.toRgbString=function(){return e=Yu(this.rgba),t=e.r,r=e.g,i=e.b,(s=e.a)<1?"rgba("+t+", "+r+", "+i+", "+s+")":"rgb("+t+", "+r+", "+i+")";var e,t,r,i,s},n.prototype.toHsl=function(){return Gp(uo(this.rgba))},n.prototype.toHslString=function(){return e=Gp(uo(this.rgba)),t=e.h,r=e.s,i=e.l,(s=e.a)<1?"hsla("+t+", "+r+"%, "+i+"%, "+s+")":"hsl("+t+", "+r+"%, "+i+"%)";var e,t,r,i,s},n.prototype.toHsv=function(){return e=mx(this.rgba),{h:at(e.h),s:at(e.s),v:at(e.v),a:at(e.a,3)};var e},n.prototype.invert=function(){return wn({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},n.prototype.saturate=function(e){return e===void 0&&(e=.1),wn(Ku(this.rgba,e))},n.prototype.desaturate=function(e){return e===void 0&&(e=.1),wn(Ku(this.rgba,-e))},n.prototype.grayscale=function(){return wn(Ku(this.rgba,-1))},n.prototype.lighten=function(e){return e===void 0&&(e=.1),wn(Up(this.rgba,e))},n.prototype.darken=function(e){return e===void 0&&(e=.1),wn(Up(this.rgba,-e))},n.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},n.prototype.alpha=function(e){return typeof e=="number"?wn({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):at(this.rgba.a,3);var t},n.prototype.hue=function(e){var t=uo(this.rgba);return typeof e=="number"?wn({h:e,s:t.s,l:t.l,a:t.a}):at(t.h)},n.prototype.isEqual=function(e){return this.toHex()===wn(e).toHex()},n}(),wn=function(n){return n instanceof vh?n:new vh(n)},Np=[],L2=function(n){n.forEach(function(e){Np.indexOf(e)<0&&(e(vh,xh),Np.push(e))})};function U2(n,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var i in t)r[t[i]]=i;var s={};n.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,u=r[this.toHex()];if(u)return u;if(o!=null&&o.closest){var c=this.toRgb(),h=1/0,d="black";if(!s.length)for(var f in t)s[f]=new n(t[f]).toRgb();for(var p in t){var g=(a=c,l=s[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));g<h&&(h=g,d=p)}return d}},e.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":t[a];return l?new n(l).toRgb():null},"name"])}L2([U2]);const as=class Qs{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(e){if(e instanceof Qs)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,t){const r=typeof e;if(r!==typeof t)return!1;if(r==="number"||r==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((s,o)=>s===t[o]);if(e!==null&&t!==null){const s=Object.keys(e),o=Object.keys(t);return s.length!==o.length?!1:s.every(a=>e[a]===t[a])}return e===t}toRgba(){const[e,t,r,i]=this._components;return{r:e,g:t,b:r,a:i}}toRgb(){const[e,t,r]=this._components;return{r:e,g:t,b:r}}toRgbaString(){const[e,t,r]=this.toUint8RgbArray();return`rgba(${e},${t},${r},${this.alpha})`}toUint8RgbArray(e){const[t,r,i]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(t*255),e[1]=Math.round(r*255),e[2]=Math.round(i*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);const[t,r,i,s]=this._components;return e[0]=t,e[1]=r,e[2]=i,e[3]=s,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);const[t,r,i]=this._components;return e[0]=t,e[1]=r,e[2]=i,e}toNumber(){return this._int}toBgrNumber(){const[e,t,r]=this.toUint8RgbArray();return(r<<16)+(t<<8)+e}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[t,r,i,s]=Qs._temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=r,this._components[2]*=i,this._components[3]*=s,this._refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let r=this._int>>16&255,i=this._int>>8&255,s=this._int&255;return t&&(r=r*e+.5|0,i=i*e+.5|0,s=s*e+.5|0),(e*255<<24)+(r<<16)+(i<<8)+s}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(e){return this._components[3]=this._clamp(e),this._value=null,this}_normalize(e){let t,r,i,s;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const o=e;t=(o>>16&255)/255,r=(o>>8&255)/255,i=(o&255)/255,s=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[t,r,i,s=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[t,r,i,s=255]=e,t/=255,r/=255,i/=255,s/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const a=Qs.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=wn(e);o.isValid()&&({r:t,g:r,b:i,a:s}=o.rgba,t/=255,r/=255,i/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=r,this._components[2]=i,this._components[3]=s,this._refreshInt();else throw new Error(`Unable to convert color ${e}`)}_refreshInt(){this._clamp(this._components);const[e,t,r]=this._components;this._int=(e*255<<16)+(t*255<<8)+(r*255|0)}_clamp(e,t=0,r=1){return typeof e=="number"?Math.min(Math.max(e,t),r):(e.forEach((i,s)=>{e[s]=Math.min(Math.max(i,t),r)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof Qs||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}};as.shared=new as;as._temp=new as;as.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ce=as;const N2={cullArea:null,cullable:!1,cullableChildren:!0};let Qu=0;const zp=500;function se(...n){Qu!==zp&&(Qu++,Qu===zp?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...n))}const ps={_registeredResources:new Set,register(n){this._registeredResources.add(n)},unregister(n){this._registeredResources.delete(n)},release(){this._registeredResources.forEach(n=>n.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(n){return this._registeredResources.has(n)},reset(){this._registeredResources.clear()}};class z2{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t<e;t++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){var r;let t;return this._index>0?t=this._pool[--this._index]:(t=new this._classType,this._count++),(r=t.init)==null||r.call(t,e),t}return(e){var t;(t=e.reset)==null||t.call(e),this._pool[this._index++]=e}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let e=0;e<this._index;e++)this._pool[e].destroy();this._pool.length=0,this._count=0,this._index=0}}class W2{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new z2(e)),this._poolsByClass.get(e)}stats(){const e={};return this._poolsByClass.forEach(t=>{const r=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[r]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}clear(){this._poolsByClass.forEach(e=>e.clear()),this._poolsByClass.clear()}}const ut=new W2;ps.register(ut);const H2={get isCachedAsTexture(){var n;return!!((n=this.renderGroup)!=null&&n.isCachedAsTexture)},cacheAsTexture(n){typeof n=="boolean"&&n===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(n===!0?{}:n))},updateCacheTexture(){var n;(n=this.renderGroup)==null||n.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(n){ie("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(n)}};function yx(n,e,t){const r=n.length;let i;if(e>=r||t===0)return;t=e+t>r?r-e:t;const s=r-t;for(i=e;i<s;++i)n[i]=n[i+t];n.length=s}const V2={allowChildren:!0,removeChildren(n=0,e){var s;const t=e??this.children.length,r=t-n,i=[];if(r>0&&r<=t){for(let a=t-1;a>=n;a--){const l=this.children[a];l&&(i.push(l),l.parent=null)}yx(this.children,n,t);const o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(i);for(let a=0;a<i.length;++a){const l=i[a];(s=l.parentRenderLayer)==null||s.detach(l),this.emit("childRemoved",l,this,a),i[a].emit("removed",this)}return i.length>0&&this._didViewChangeTick++,i}else if(r===0&&this.children.length===0)return i;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(n){const e=this.getChildAt(n);return this.removeChild(e)},getChildAt(n){if(n<0||n>=this.children.length)throw new Error(`getChildAt: Index (${n}) does not exist.`);return this.children[n]},setChildIndex(n,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(n),this.addChildAt(n,e)},getChildIndex(n){const e=this.children.indexOf(n);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(n,e){this.allowChildren||ie(Ge,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:t}=this;if(e<0||e>t.length)throw new Error(`${n}addChildAt: The index ${e} supplied is out of bounds ${t.length}`);const r=n.parent===this;if(n.parent){const s=n.parent.children.indexOf(n);if(r){if(s===e)return n;n.parent.children.splice(s,1)}else n.removeFromParent()}e===t.length?t.push(n):t.splice(e,0,n);const i=this.renderGroup||this.parentRenderGroup;return this.sortableChildren&&(this.sortDirty=!0),r?(i&&(i.structureDidChange=!0),n):(n.parent=this,n.didChange=!0,n._updateFlags=15,i&&i.addChild(n),this.emit("childAdded",n,this,e),n.emit("added",this),n)},swapChildren(n,e){if(n===e)return;const t=this.getChildIndex(n),r=this.getChildIndex(e);this.children[t]=e,this.children[r]=n;const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var n;(n=this.parent)==null||n.removeChild(this)},reparentChild(...n){return n.length===1?this.reparentChildAt(n[0],this.children.length):(n.forEach(e=>this.reparentChildAt(e,this.children.length)),n[0])},reparentChildAt(n,e){if(n.parent===this)return this.setChildIndex(n,e),n;const t=n.worldTransform.clone();n.removeFromParent(),this.addChildAt(n,e);const r=this.worldTransform.clone();return r.invert(),t.prepend(r),n.setFromMatrix(t),n},replaceChild(n,e){n.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(n)),e.setFromMatrix(n.localTransform),e.updateLocalTransform(),this.removeChild(n)}},j2={collectRenderables(n,e,t){this.parentRenderLayer&&this.parentRenderLayer!==t||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(n,e,t):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,n):this.collectRenderablesWithEffects(n,e,t))},collectRenderablesSimple(n,e,t){const r=this.children,i=r.length;for(let s=0;s<i;s++)r[s].collectRenderables(n,e,t)},collectRenderablesWithEffects(n,e,t){const{renderPipes:r}=e;for(let i=0;i<this.effects.length;i++){const s=this.effects[i];r[s.pipe].push(s,this,n)}this.collectRenderablesSimple(n,e,t);for(let i=this.effects.length-1;i>=0;i--){const s=this.effects[i];r[s.pipe].pop(s,this,n)}}};class Al{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}class $2{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let t=0;t<this._tests.length;t++){const r=this._tests[t];if(r.test(e))return ut.get(r.maskClass,e)}return e}returnMaskEffect(e){ut.return(e)}}const bh=new $2;ae.handleByList(k.MaskEffect,bh._effectClasses);const X2={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_filterEffect:null,effects:[],_markStructureAsChanged(){const n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0)},addEffect(n){this.effects.indexOf(n)===-1&&(this.effects.push(n),this.effects.sort((t,r)=>t.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(n){const e=this.effects.indexOf(n);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(n){const e=this._maskEffect;(e==null?void 0:e.mask)!==n&&(e&&(this.removeEffect(e),bh.returnMaskEffect(e),this._maskEffect=null),n!=null&&(this._maskEffect=bh.getMaskEffect(n),this.addEffect(this._maskEffect)))},get mask(){var n;return(n=this._maskEffect)==null?void 0:n.mask},setMask(n){this._maskOptions={...this._maskOptions,...n},n.mask&&(this.mask=n.mask),this._markStructureAsChanged()},set filters(n){var s;!Array.isArray(n)&&n&&(n=[n]);const e=this._filterEffect||(this._filterEffect=new Al);n=n;const t=(n==null?void 0:n.length)>0,r=((s=e.filters)==null?void 0:s.length)>0,i=t!==r;n=Array.isArray(n)?n.slice(0):n,e.filters=Object.freeze(n),i&&(t?this.addEffect(e):(this.removeEffect(e),e.filters=n??null))},get filters(){var n;return(n=this._filterEffect)==null?void 0:n.filters},set filterArea(n){this._filterEffect||(this._filterEffect=new Al),this._filterEffect.filterArea=n},get filterArea(){var n;return(n=this._filterEffect)==null?void 0:n.filterArea}},Y2={label:null,get name(){return ie(Ge,"Container.name property has been removed, use Container.label instead"),this.label},set name(n){ie(Ge,"Container.name property has been removed, use Container.label instead"),this.label=n},getChildByName(n,e=!1){return this.getChildByLabel(n,e)},getChildByLabel(n,e=!1){const t=this.children;for(let r=0;r<t.length;r++){const i=t[r];if(i.label===n||n instanceof RegExp&&n.test(i.label))return i}if(e)for(let r=0;r<t.length;r++){const s=t[r].getChildByLabel(n,!0);if(s)return s}return null},getChildrenByLabel(n,e=!1,t=[]){const r=this.children;for(let i=0;i<r.length;i++){const s=r[i];(s.label===n||n instanceof RegExp&&n.test(s.label))&&t.push(s)}if(e)for(let i=0;i<r.length;i++)r[i].getChildrenByLabel(n,!0,t);return t}},Et=ut.getPool(Z),Vn=ut.getPool(gt),K2=new Z,q2={getFastGlobalBounds(n,e){e||(e=new gt),e.clear(),this._getGlobalBoundsRecursive(!!n,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);const t=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(t.worldTransform),e},_getGlobalBoundsRecursive(n,e,t){let r=e;if(n&&this.parentRenderLayer&&this.parentRenderLayer!==t||this.localDisplayStatus!==7||!this.measurable)return;const i=!!this.effects.length;if((this.renderGroup||i)&&(r=Vn.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const o=this.bounds;r.addFrame(o.minX,o.minY,o.maxX,o.maxY,this.groupTransform)}const s=this.children;for(let o=0;o<s.length;o++)s[o]._getGlobalBoundsRecursive(n,r,t)}if(i){let s=!1;const o=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(s||(s=!0,r.applyMatrix(o.worldTransform)),this.effects[a].addBounds(r,!0));s&&r.applyMatrix(o.worldTransform.copyTo(K2).invert()),e.addBounds(r),Vn.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),Vn.return(r))}};function Kd(n,e,t){t.clear();let r,i;return n.parent?e?r=n.parent.worldTransform:(i=Et.get().identity(),r=qd(n,i)):r=Z.IDENTITY,_x(n,t,r,e),i&&Et.return(i),t.isValid||t.set(0,0,0,0),t}function _x(n,e,t,r){var a,l;if(!n.visible||!n.measurable)return;let i;r?i=n.worldTransform:(n.updateLocalTransform(),i=Et.get(),i.appendFrom(n.localTransform,t));const s=e,o=!!n.effects.length;if(o&&(e=Vn.get().clear()),n.boundsArea)e.addRect(n.boundsArea,i);else{const u=n.bounds;u&&!u.isEmpty()&&(e.matrix=i,e.addBounds(u));for(let c=0;c<n.children.length;c++)_x(n.children[c],e,i,r)}if(o){for(let u=0;u<n.effects.length;u++)(l=(a=n.effects[u]).addBounds)==null||l.call(a,e);s.addBounds(e,Z.IDENTITY),Vn.return(e)}r||Et.return(i)}function qd(n,e){const t=n.parent;return t&&(qd(t,e),t.updateLocalTransform(),e.append(t.localTransform)),e}function Qi(n,e){if(n===16777215||!e)return e;if(e===16777215||!n)return n;const t=n>>16&255,r=n>>8&255,i=n&255,s=e>>16&255,o=e>>8&255,a=e&255,l=t*s/255|0,u=r*o/255|0,c=i*a/255|0;return(l<<16)+(u<<8)+c}const Wp=16777215;function kl(n,e){return n===Wp?e:e===Wp?n:Qi(n,e)}function Zi(n){return((n&255)<<16)+(n&65280)+(n>>16&255)}const Q2={getGlobalAlpha(n){if(n)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,t=this.parent;for(;t;)e*=t.alpha,t=t.parent;return e},getGlobalTransform(n=new Z,e){if(e)return n.copyFrom(this.worldTransform);this.updateLocalTransform();const t=qd(this,Et.get().identity());return n.appendFrom(this.localTransform,t),Et.return(t),n},getGlobalTint(n){if(n)return this.renderGroup?Zi(this.renderGroup.worldColor):this.parentRenderGroup?Zi(kl(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,t=this.parent;for(;t;)e=kl(e,t.localColor),t=t.parent;return Zi(e)}};function Qd(n,e,t){return e.clear(),t||(t=Z.IDENTITY),xx(n,e,t,n,!0),e.isValid||e.set(0,0,0,0),e}function xx(n,e,t,r,i){var l,u;let s;if(i)s=Et.get(),s=t.copyTo(s);else{if(!n.visible||!n.measurable)return;n.updateLocalTransform();const c=n.localTransform;s=Et.get(),s.appendFrom(c,t)}const o=e,a=!!n.effects.length;if(a&&(e=Vn.get().clear()),n.boundsArea)e.addRect(n.boundsArea,s);else{n.renderPipeId&&(e.matrix=s,e.addBounds(n.bounds));const c=n.children;for(let h=0;h<c.length;h++)xx(c[h],e,s,r,!1)}if(a){for(let c=0;c<n.effects.length;c++)(u=(l=n.effects[c]).addLocalBounds)==null||u.call(l,e,r);o.addBounds(e,Z.IDENTITY),Vn.return(e)}Et.return(s)}function vx(n,e){const t=n.children;for(let r=0;r<t.length;r++){const i=t[r],s=i.uid,o=(i._didViewChangeTick&65535)<<16|i._didContainerChangeTick&65535,a=e.index;(e.data[a]!==s||e.data[a+1]!==o)&&(e.data[e.index]=s,e.data[e.index+1]=o,e.didChange=!0),e.index=a+2,i.children.length&&vx(i,e)}return e.didChange}const Z2=new Z,J2={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(n,e){const t=Math.sign(this.scale.x)||1;e!==0?this.scale.x=n/e*t:this.scale.x=t},_setHeight(n,e){const t=Math.sign(this.scale.y)||1;e!==0?this.scale.y=n/e*t:this.scale.y=t},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new gt});const n=this._localBoundsCacheData;return n.index=1,n.didChange=!1,n.data[0]!==this._didViewChangeTick&&(n.didChange=!0,n.data[0]=this._didViewChangeTick),vx(this,n),n.didChange&&Qd(this,n.localBounds,Z2),n.localBounds},getBounds(n,e){return Kd(this,n,e||new gt)}},eT={_onRender:null,set onRender(n){const e=this.renderGroup||this.parentRenderGroup;if(!n){this._onRender&&(e==null||e.removeOnRender(this)),this._onRender=null;return}this._onRender||e==null||e.addOnRender(this),this._onRender=n},get onRender(){return this._onRender}},tT={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(n){this._zIndex!==n&&(this._zIndex=n,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(nT))}};function nT(n,e){return n._zIndex-e._zIndex}const rT={getGlobalPosition(n=new Me,e=!1){return this.parent?this.parent.toGlobal(this._position,n,e):(n.x=this._position.x,n.y=this._position.y),n},toGlobal(n,e,t=!1){const r=this.getGlobalTransform(Et.get(),t);return e=r.apply(n,e),Et.return(r),e},toLocal(n,e,t,r){e&&(n=e.toGlobal(n,t,r));const i=this.getGlobalTransform(Et.get(),r);return t=i.applyInverse(n,t),Et.return(i),t}};class Zd{constructor(){this.uid=be("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}let iT=0;class sT{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this.textureStyle=new ii(this.textureOptions)}createTexture(e,t,r,i){const s=new $e({...this.textureOptions,width:e,height:t,resolution:1,antialias:r,autoGarbageCollect:!1,autoGenerateMipmaps:i});return new Q({source:s,label:`texturePool_${iT++}`})}getOptimalTexture(e,t,r=1,i,s=!1){let o=Math.ceil(e*r-1e-6),a=Math.ceil(t*r-1e-6);o=os(o),a=os(a);const l=i?1:0,u=s?1:0,c=(o<<17)+(a<<2)+(u<<1)+l;this._texturePool[c]||(this._texturePool[c]=[]);let h=this._texturePool[c].pop();return h||(h=this.createTexture(o,a,i,s)),h.source._resolution=r,h.source.width=o/r,h.source.height=a/r,h.source.pixelWidth=o,h.source.pixelHeight=a,h.frame.x=0,h.frame.y=0,h.frame.width=e,h.frame.height=t,h.updateUvs(),this._poolKeyHash[h.uid]=c,h}getSameSizeTexture(e,t=!1){const r=e.source;return this.getOptimalTexture(e.width,e.height,r._resolution,t)}returnTexture(e,t=!1){const r=this._poolKeyHash[e.uid];t&&(e.source.style=this.textureStyle),this._texturePool[r].push(e)}clear(e){if(e=e!==!1,e)for(const t in this._texturePool){const r=this._texturePool[t];if(r)for(let i=0;i<r.length;i++)r[i].destroy(!0)}this._texturePool={}}}const vt=new sT;ps.register(vt);class wh{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new Z,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Zd,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;const t=e.children;for(let r=0;r<t.length;r++){const i=t[r];i._updateFlags=15,this.addChild(i)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(vt.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const e=this._parentCacheAsTextureRenderGroup;e&&!e.textureNeedsUpdate&&e.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const e in this.childrenToUpdate){const t=this.childrenToUpdate[e];t.list.fill(null),t.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){const t=this.renderGroupChildren.indexOf(e);t>-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);const t=e.children;for(let r=0;r<t.length;r++)this.addChild(t[r])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}const t=e.children;for(let r=0;r<t.length;r++)this.removeChild(t[r])}removeChildren(e){for(let t=0;t<e.length;t++)this.removeChild(e[t])}onChildUpdate(e){let t=this.childrenToUpdate[e.relativeRenderGroupDepth];t||(t=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),t.list[t.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.indexOf(e)===-1&&this._onRenderContainers.push(e)}removeOnRender(e){const t=this._onRenderContainers.indexOf(e);t!==-1&&this._onRenderContainers.splice(t,1)}runOnRender(e){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender(e)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(e=[]){const t=this.root.children;for(let r=0;r<t.length;r++)this._getChildren(t[r],e);return e}_getChildren(e,t=[]){if(t.push(e),e.renderGroup)return t;const r=e.children;for(let i=0;i<r.length;i++)this._getChildren(r[i],t);return t}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return this._matrixDirty&1?(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new Z),this._inverseWorldTransform.copyFrom(this.worldTransform).invert()):this._inverseWorldTransform}get textureOffsetInverseTransform(){return this._matrixDirty&2?(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new Z),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y)):this._textureOffsetInverseTransform}get inverseParentTextureTransform(){if(!(this._matrixDirty&4))return this._inverseParentTextureTransform;this._matrixDirty&=-5;const e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new Z),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function oT(n,e,t={}){for(const r in e)!t[r]&&e[r]!==void 0&&(n[r]=e[r])}const Zu=new ft(null),Sa=new ft(null),Ju=new ft(null,1,1),Ta=new ft(null),Pl=1,Jd=2,co=4;class Ue extends Ot{constructor(e={}){var t,r;super(),this.uid=be("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new Z,this.relativeGroupTransform=new Z,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new ft(this,0,0),this._scale=Ju,this._pivot=Sa,this._origin=Ta,this._skew=Zu,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],oT(this,e,{children:!0,parent:!0,effects:!0}),(t=e.children)==null||t.forEach(i=>this.addChild(i)),(r=e.parent)==null||r.addChild(this)}static mixin(e){ie("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),ae.mixin(Ue,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||ie(Ge,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let i=0;i<e.length;i++)this.addChild(e[i]);return e[0]}const t=e[0],r=this.renderGroup||this.parentRenderGroup;return t.parent===this?(this.children.splice(this.children.indexOf(t),1),this.children.push(t),r&&(r.structureDidChange=!0),t):(t.parent&&t.parent.removeChild(t),this.children.push(t),this.sortableChildren&&(this.sortDirty=!0),t.parent=this,t.didChange=!0,t._updateFlags=15,r&&r.addChild(t),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this),this._didViewChangeTick++,t._zIndex!==0&&t.depthOfChildModified(),t)}removeChild(...e){if(e.length>1){for(let i=0;i<e.length;i++)this.removeChild(e[i]);return e[0]}const t=e[0],r=this.children.indexOf(t);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(t):this.parentRenderGroup&&this.parentRenderGroup.removeChild(t),t.parentRenderLayer&&t.parentRenderLayer.detach(t),t.parent=null,this.emit("childRemoved",t,this,r),t.emit("removed",this)),t}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),this.renderGroup=ut.get(wh,this),this.groupTransform=Z.IDENTITY,e==null||e.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const e=this.parentRenderGroup;e==null||e.removeChild(this),ut.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e==null||e.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new Z),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*T2}set angle(e){this.rotation=e*C2}get pivot(){return this._pivot===Sa&&(this._pivot=new ft(this,0,0)),this._pivot}set pivot(e){this._pivot===Sa&&(this._pivot=new ft(this,0,0),this._origin!==Ta&&se("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===Zu&&(this._skew=new ft(this,0,0)),this._skew}set skew(e){this._skew===Zu&&(this._skew=new ft(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Ju&&(this._scale=new ft(this,1,1)),this._scale}set scale(e){this._scale===Ju&&(this._scale=new ft(this,0,0)),typeof e=="string"&&(e=parseFloat(e)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get origin(){return this._origin===Ta&&(this._origin=new ft(this,0,0)),this._origin}set origin(e){this._origin===Ta&&(this._origin=new ft(this,0,0),this._pivot!==Sa&&se("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._origin.set(e):this._origin.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){const t=this.getLocalBounds().width;this._setWidth(e,t)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){const t=this.getLocalBounds().height;this._setHeight(e,t)}getSize(e){e||(e={});const t=this.getLocalBounds();return e.width=Math.abs(this.scale.x*t.width),e.height=Math.abs(this.scale.y*t.height),e}setSize(e,t){const r=this.getLocalBounds();typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,r.width),t!==void 0&&this._setHeight(t,r.height)}_updateSkew(){const e=this._rotation,t=this._skew;this._cx=Math.cos(e+t._y),this._sx=Math.sin(e+t._y),this._cy=-Math.sin(e-t._x),this._sy=Math.cos(e-t._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX:this.scale.x,typeof e.scaleY=="number"?e.scaleY:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this.origin.set(typeof e.originX=="number"?e.originX:this.origin.x,typeof e.originY=="number"?e.originY:this.origin.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){const e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;const t=this.localTransform,r=this._scale,i=this._pivot,s=this._origin,o=this._position,a=r._x,l=r._y,u=i._x,c=i._y,h=-s._x,d=-s._y;t.a=this._cx*a,t.b=this._sx*a,t.c=this._cy*l,t.d=this._sy*l,t.tx=o._x-(u*t.a+c*t.c)+(h*t.a+d*t.c)-h,t.ty=o._y-(u*t.b+c*t.d)+(h*t.b+d*t.d)-d}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=Pl,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){const r=Ce.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Pl,this._onUpdate())}get tint(){return Zi(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Jd,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){const t=e?2:0;(this.localDisplayStatus&2)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=co,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",e))}get culled(){return!(this.localDisplayStatus&4)}set culled(e){const t=e?0:4;(this.localDisplayStatus&4)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=co,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){const t=e?1:0;(this.localDisplayStatus&1)!==t&&(this._updateFlags|=co,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){var i;if(this.destroyed)return;this.destroyed=!0;let t;if(this.children.length&&(t=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof e=="boolean"?e:e==null?void 0:e.children)&&t)for(let s=0;s<t.length;++s)t[s].destroy(e);(i=this.renderGroup)==null||i.destroy(),this.renderGroup=null}}ae.mixin(Ue,V2,q2,rT,eT,J2,X2,Y2,tT,N2,H2,Q2,j2);class ef extends Ue{constructor(e){super(e),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new gt(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=e.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){const t=this.bounds,{x:r,y:i}=e;return r>=t.minX&&r<=t.maxX&&i>=t.minY&&i<=t.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}unload(){var e;this.emit("unload",this);for(const t in this._gpuData)(e=this._gpuData[t])==null||e.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(e){this.unload(),super.destroy(e),this._bounds=null}collectRenderablesSimple(e,t,r){const{renderPipes:i}=t;i.blendMode.pushBlendMode(this,this.groupBlendMode,e);const o=i[this.renderPipeId];o!=null&&o.addRenderable&&o.addRenderable(this,e),this.didViewUpdate=!1;const a=this.children,l=a.length;for(let u=0;u<l;u++)a[u].collectRenderables(e,t,r);i.blendMode.popBlendMode(e)}}class qn extends ef{constructor(e=Q.EMPTY){e instanceof Q&&(e={texture:e});const{texture:t=Q.EMPTY,anchor:r,roundPixels:i,width:s,height:o,...a}=e;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new ft({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:t.defaultAnchor&&(this.anchor=t.defaultAnchor),this.texture=t,this.allowChildren=!1,this.roundPixels=i??!1,s!==void 0&&(this.width=s),o!==void 0&&(this.height=o)}static from(e,t=!1){return e instanceof Q?new qn(e):new qn(Q.from(e,t))}set texture(e){e||(e=Q.EMPTY);const t=this._texture;t!==e&&(t&&t.dynamic&&t.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return fx(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return ie("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const e=this._anchor,t=this._texture,r=this._bounds,{width:i,height:s}=t.orig;r.minX=-e._x*i,r.maxX=r.minX+i,r.minY=-e._y*s,r.maxY=r.minY+s}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e==null?void 0:e.texture){const r=typeof e=="boolean"?e:e==null?void 0:e.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),t!==void 0&&this._setHeight(t,this._texture.orig.height)}}const aT=new gt;function bx(n,e,t){const r=aT;n.measurable=!0,Kd(n,t,r),e.addBoundsMask(r),n.measurable=!1}function wx(n,e,t){const r=Vn.get();n.measurable=!0;const i=Et.get().identity(),s=Sx(n,t,i);Qd(n,r,s),n.measurable=!1,e.addBoundsMask(r),Et.return(i),Vn.return(r)}function Sx(n,e,t){return n?(n!==e&&(Sx(n.parent,e,t),n.updateLocalTransform(),t.append(n.localTransform)),t):(se("Mask bounds, renderable is not inside the root container"),t)}class Tx{constructor(e){this.priority=0,this.inverse=!1,this.channel="red",this.pipe="alphaMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof qn),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(e,t){this.inverse||bx(this.mask,e,t)}addLocalBounds(e,t){wx(this.mask,e,t)}containsPoint(e,t){const r=this.mask;return t(r,e)}destroy(){this.reset()}static test(e){return e instanceof qn}}Tx.extension=k.MaskEffect;class Cx{constructor(e){this.priority=0,this.pipe="colorMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}}Cx.extension=k.MaskEffect;class Ex{constructor(e){this.priority=0,this.pipe="stencilMask",e!=null&&e.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(e,t){bx(this.mask,e,t)}addLocalBounds(e,t){wx(this.mask,e,t)}containsPoint(e,t){const r=this.mask;return t(r,e)}destroy(){this.reset()}static test(e){return e instanceof Ue}}Ex.extension=k.MaskEffect;const lT={createCanvas:(n,e)=>{const t=document.createElement("canvas");return t.width=n,t.height=e,t},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(n,e)=>fetch(n,e),parseXML:n=>new DOMParser().parseFromString(n,"text/xml")};let Hp=lT;const pe={get(){return Hp},set(n){Hp=n}};class tn extends $e{constructor(e){e.resource||(e.resource=pe.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(e=this.width,t=this.height,r=this._resolution){const i=super.resize(e,t,r);return i&&this.resizeCanvas(),i}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}tn.extension=k.TextureSource;class Ml extends $e{constructor(e){super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}}Ml.extension=k.TextureSource;var si=(n=>(n[n.INTERACTION=50]="INTERACTION",n[n.HIGH=25]="HIGH",n[n.NORMAL=0]="NORMAL",n[n.LOW=-25]="LOW",n[n.UTILITY=-50]="UTILITY",n))(si||{});class ec{constructor(e,t=null,r=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=t,this.priority=r,this._once=i}match(e,t=null){return this._fn===e&&this._context===t}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));const t=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const t=this.next;return this.next=e?null:t,this.previous=null,t}}const Ax=class Ut{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new ec(null,null,1/0),this.deltaMS=1/Ut.targetFPMS,this.elapsedMS=1/Ut.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,r=si.NORMAL){return this._addListener(new ec(e,t,r))}addOnce(e,t,r=si.NORMAL){return this._addListener(new ec(e,t,r,!0))}_addListener(e){let t=this._head.next,r=this._head;if(!t)e.connect(r);else{for(;t;){if(e.priority>t.priority){e.connect(r);break}r=t,t=t.next}e.previous||e.connect(r)}return this._startIfPossible(),this}remove(e,t){let r=this._head.next;for(;r;)r.match(e,t)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){const s=e-this._lastFrame|0;if(s<this._minElapsedMS)return;this._lastFrame=e-s%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*Ut.targetFPMS;const r=this._head;let i=r.next;for(;i;)i=i.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const t=Math.min(Math.max(0,e)/1e3,Ut.targetFPMS);this._maxElapsedMS=1/t,this._minElapsedMS&&e>this.maxFPS&&(this.maxFPS=e)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){e===0?this._minElapsedMS=0:(e<this.minFPS&&(this.minFPS=e),this._minElapsedMS=1/(e/1e3))}static get shared(){if(!Ut._shared){const e=Ut._shared=new Ut;e.autoStart=!0,e._protected=!0}return Ut._shared}static get system(){if(!Ut._system){const e=Ut._system=new Ut;e.autoStart=!0,e._protected=!0}return Ut._system}};Ax.targetFPMS=.06;let St=Ax,tc;async function uT(){return tc??(tc=(async()=>{var o;const e=pe.get().createCanvas(1,1).getContext("webgl");if(!e)return"premultiply-alpha-on-upload";const t=await new Promise(a=>{const l=document.createElement("video");l.onloadeddata=()=>a(l),l.onerror=()=>a(null),l.autoplay=!1,l.crossOrigin="anonymous",l.preload="auto",l.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",l.load()});if(!t)return"premultiply-alpha-on-upload";const r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);const i=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);const s=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,s),e.deleteFramebuffer(i),e.deleteTexture(r),(o=e.getExtension("WEBGL_lose_context"))==null||o.loseContext(),s[0]<=s[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),tc}const su=class kx extends $e{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...kx.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),this._onLoadedMetadata=this._onLoadedMetadata.bind(this),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const e=St.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const e=this.resource,t=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(t.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.isValid||e.addEventListener("loadedmetadata",this._onLoadedMetadata),this.alphaMode=await uT(),this._load=new Promise((r,i)=>{this.isValid?r(this):(this._resolve=r,this._reject=i,t.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${t.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){const e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onLoadedMetadata(){this.isValid&&this._mediaReady()}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlayThrough),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&this.isValid&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("loadedmetadata",this._onLoadedMetadata),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(St.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(St.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(St.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};su.extension=k.TextureSource;su.defaultOptions={...$e.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};su.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let cT=su;const Ei=(n,e,t=!1)=>(Array.isArray(n)||(n=[n]),e?n.map(r=>typeof r=="string"||t?e(r):r):n);class hT{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){const t=this._cache.get(e);return t||se(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){const r=Ei(e);let i;for(let l=0;l<this.parsers.length;l++){const u=this.parsers[l];if(u.test(t)){i=u.getCacheableAssets(r,t);break}}const s=new Map(Object.entries(i||{}));i||r.forEach(l=>{s.set(l,t)});const o=[...s.keys()],a={cacheKeys:o,keys:r};r.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{const u=i?i[l]:t;this._cache.has(l)&&this._cache.get(l)!==u&&se("[Cache] already has key:",l),this._cache.set(l,s.get(l))})}remove(e){if(!this._cacheMap.has(e)){se(`[Assets] Asset id ${e} was not found in the Cache`);return}const t=this._cacheMap.get(e);t.cacheKeys.forEach(i=>{this._cache.delete(i)}),t.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const Ai=new hT,Sh=[];ae.handleByList(k.TextureSource,Sh);function Px(n={}){const e=n&&n.resource,t=e?n.resource:n,r=e?n:{resource:n};for(let i=0;i<Sh.length;i++){const s=Sh[i];if(s.test(t))return new s(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function dT(n={},e=!1){const t=n&&n.resource,r=t?n.resource:n,i=t?n:{resource:n};if(!e&&Ai.has(r))return Ai.get(r);const s=new Q({source:Px(i)});return s.on("destroy",()=>{Ai.has(r)&&Ai.remove(r)}),e||Ai.set(r,s),s}function fT(n,e=!1){return typeof n=="string"?Ai.get(n):n instanceof $e?new Q({source:n}):dT(n,e)}Q.from=fT;$e.from=Px;ae.add(Tx,Cx,Ex,cT,Ml,tn,Yd);var Mx=(n=>(n[n.Low=0]="Low",n[n.Normal=1]="Normal",n[n.High=2]="High",n))(Mx||{});function ln(n){if(typeof n!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(n)}`)}function Gs(n){return n.split("?")[0].split("#")[0]}function pT(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mT(n,e,t){return n.replace(new RegExp(pT(e),"g"),t)}function gT(n,e){let t="",r=0,i=-1,s=0,o=-1;for(let a=0;a<=n.length;++a){if(a<n.length)o=n.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||s===1))if(i!==a-1&&s===2){if(t.length<2||r!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){const l=t.lastIndexOf("/");if(l!==t.length-1){l===-1?(t="",r=0):(t=t.slice(0,l),r=t.length-1-t.lastIndexOf("/")),i=a,s=0;continue}}else if(t.length===2||t.length===1){t="",r=0,i=a,s=0;continue}}}else t.length>0?t+=`/${n.slice(i+1,a)}`:t=n.slice(i+1,a),r=a-i-1;i=a,s=0}else o===46&&s!==-1?++s:s=-1}return t}const Do={toPosix(n){return mT(n,"\\","/")},isUrl(n){return/^https?:/.test(this.toPosix(n))},isDataUrl(n){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(n)},isBlobUrl(n){return n.startsWith("blob:")},hasProtocol(n){return/^[^/:]+:/.test(this.toPosix(n))},getProtocol(n){ln(n),n=this.toPosix(n);const e=/^file:\/\/\//.exec(n);if(e)return e[0];const t=/^[^/:]+:\/{0,2}/.exec(n);return t?t[0]:""},toAbsolute(n,e,t){if(ln(n),this.isDataUrl(n)||this.isBlobUrl(n))return n;const r=Gs(this.toPosix(e??pe.get().getBaseUrl())),i=Gs(this.toPosix(t??this.rootname(r)));return n=this.toPosix(n),n.startsWith("/")?Do.join(i,n.slice(1)):this.isAbsolute(n)?n:this.join(r,n)},normalize(n){if(ln(n),n.length===0)return".";if(this.isDataUrl(n)||this.isBlobUrl(n))return n;n=this.toPosix(n);let e="";const t=n.startsWith("/");this.hasProtocol(n)&&(e=this.rootname(n),n=n.slice(e.length));const r=n.endsWith("/");return n=gT(n),n.length>0&&r&&(n+="/"),t?`/${n}`:e+n},isAbsolute(n){return ln(n),n=this.toPosix(n),this.hasProtocol(n)?!0:n.startsWith("/")},join(...n){if(n.length===0)return".";let e;for(let t=0;t<n.length;++t){const r=n[t];if(ln(r),r.length>0)if(e===void 0)e=r;else{const i=n[t-1]??"";this.joinExtensions.includes(this.extname(i).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(n){if(ln(n),n.length===0)return".";n=this.toPosix(n);let e=n.charCodeAt(0);const t=e===47;let r=-1,i=!0;const s=this.getProtocol(n),o=n;n=n.slice(s.length);for(let a=n.length-1;a>=1;--a)if(e=n.charCodeAt(a),e===47){if(!i){r=a;break}}else i=!1;return r===-1?t?"/":this.isUrl(o)?s+n:s:t&&r===1?"//":s+n.slice(0,r)},rootname(n){ln(n),n=this.toPosix(n);let e="";if(n.startsWith("/")?e="/":e=this.getProtocol(n),this.isUrl(n)){const t=n.indexOf("/",e.length);t!==-1?e=n.slice(0,t):e=n,e.endsWith("/")||(e+="/")}return e},basename(n,e){ln(n),e&&ln(e),n=Gs(this.toPosix(n));let t=0,r=-1,i=!0,s;if(e!==void 0&&e.length>0&&e.length<=n.length){if(e.length===n.length&&e===n)return"";let o=e.length-1,a=-1;for(s=n.length-1;s>=0;--s){const l=n.charCodeAt(s);if(l===47){if(!i){t=s+1;break}}else a===-1&&(i=!1,a=s+1),o>=0&&(l===e.charCodeAt(o)?--o===-1&&(r=s):(o=-1,r=a))}return t===r?r=a:r===-1&&(r=n.length),n.slice(t,r)}for(s=n.length-1;s>=0;--s)if(n.charCodeAt(s)===47){if(!i){t=s+1;break}}else r===-1&&(i=!1,r=s+1);return r===-1?"":n.slice(t,r)},extname(n){ln(n),n=Gs(this.toPosix(n));let e=-1,t=0,r=-1,i=!0,s=0;for(let o=n.length-1;o>=0;--o){const a=n.charCodeAt(o);if(a===47){if(!i){t=o+1;break}continue}r===-1&&(i=!1,r=o+1),a===46?e===-1?e=o:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||r===-1||s===0||s===1&&e===r-1&&e===t+1?"":n.slice(e,r)},parse(n){ln(n);const e={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return e;n=Gs(this.toPosix(n));let t=n.charCodeAt(0);const r=this.isAbsolute(n);let i;e.root=this.rootname(n),r||this.hasProtocol(n)?i=1:i=0;let s=-1,o=0,a=-1,l=!0,u=n.length-1,c=0;for(;u>=i;--u){if(t=n.charCodeAt(u),t===47){if(!l){o=u+1;break}continue}a===-1&&(l=!1,a=u+1),t===46?s===-1?s=u:c!==1&&(c=1):s!==-1&&(c=-1)}return s===-1||a===-1||c===0||c===1&&s===a-1&&s===o+1?a!==-1&&(o===0&&r?e.base=e.name=n.slice(1,a):e.base=e.name=n.slice(o,a)):(o===0&&r?(e.name=n.slice(1,s),e.base=n.slice(1,a)):(e.name=n.slice(o,s),e.base=n.slice(o,a)),e.ext=n.slice(s,a)),e.dir=this.dirname(n),e},sep:"/",delimiter:":",joinExtensions:[".html"]};function Rx(n,e,t,r,i){const s=e[t];for(let o=0;o<s.length;o++){const a=s[o];t<e.length-1?Rx(n.replace(r[t],a),e,t+1,r,i):i.push(n.replace(r[t],a))}}function yT(n){const e=/\{(.*?)\}/g,t=n.match(e),r=[];if(t){const i=[];t.forEach(s=>{const o=s.substring(1,s.length-1).split(",");i.push(o)}),Rx(n,i,0,t,r)}else r.push(n);return r}const Vp=n=>!Array.isArray(n);class Ix{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{const t=e;this._defaultSearchParams=Object.keys(t).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(t[r])}`).join("&")}}getAlias(e){const{alias:t,src:r}=e;return Ei(t||r,s=>typeof s=="string"?s:Array.isArray(s)?s.map(o=>(o==null?void 0:o.src)??o):s!=null&&s.src?s.src:s,!0)}removeAlias(e,t){this._assetMap[e]&&(t&&t!==this._resolverHash[e]||(delete this._resolverHash[e],delete this._assetMap[e]))}addManifest(e){this._manifest&&se("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(t=>{this.addBundle(t.name,t.assets)})}addBundle(e,t){const r=[];let i=t;Array.isArray(t)||(i=Object.entries(t).map(([s,o])=>typeof o=="string"||Array.isArray(o)?{alias:s,src:o}:{alias:s,...o})),i.forEach(s=>{const o=s.src,a=s.alias;let l;if(typeof a=="string"){const u=this._createBundleAssetId(e,a);r.push(u),l=[a,u]}else{const u=a.map(c=>this._createBundleAssetId(e,c));r.push(...u),l=[...a,...u]}this.add({...s,alias:l,src:o})}),this._bundles[e]=r}add(e){const t=[];Array.isArray(e)?t.push(...e):t.push(e);let r;r=s=>{this.hasKey(s)&&se(`[Resolver] already has key: ${s} overwriting`)},Ei(t).forEach(s=>{const{src:o}=s;let{data:a,format:l,loadParser:u,parser:c}=s;const h=Ei(o).map(g=>typeof g=="string"?yT(g):Array.isArray(g)?g:[g]),d=this.getAlias(s);Array.isArray(d)?d.forEach(r):r(d);const f=[],p=g=>{const _=this._parsers.find(m=>m.test(g));return{src:g,..._==null?void 0:_.parse(g)}};h.forEach(g=>{g.forEach(_=>{let m={};if(typeof _!="object"?m=p(_):(a=_.data??a,l=_.format??l,(_.loadParser||_.parser)&&(u=_.loadParser??u,c=_.parser??c),m={...p(_.src),..._}),!d)throw new Error(`[Resolver] alias is undefined for this asset: ${m.src}`);m=this._buildResolvedAsset(m,{aliases:d,data:a,format:l,loadParser:u,parser:c,progressSize:s.progressSize}),f.push(m)})}),d.forEach(g=>{this._assetMap[g]=f})})}resolveBundle(e){const t=Vp(e);e=Ei(e);const r={};return e.forEach(i=>{const s=this._bundles[i];if(s){const o=this.resolve(s),a={};for(const l in o){const u=o[l];a[this._extractAssetIdFromBundle(i,l)]=u}r[i]=a}}),t?r[e[0]]:r}resolveUrl(e){const t=this.resolve(e);if(typeof e!="string"){const r={};for(const i in t)r[i]=t[i].src;return r}return t.src}resolve(e){const t=Vp(e);e=Ei(e);const r={};return e.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let s=this._assetMap[i];const o=this._getPreferredOrder(s);o==null||o.priority.forEach(a=>{o.params[a].forEach(l=>{const u=s.filter(c=>c[a]?c[a]===l:!1);u.length&&(s=u)})}),this._resolverHash[i]=s[0]}else this._resolverHash[i]=this._buildResolvedAsset({alias:[i],src:i},{});r[i]=this._resolverHash[i]}),t?r[e[0]]:r}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){const r=e[t],i=this._preferredOrder.find(s=>s.params.format.includes(r.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}_buildResolvedAsset(e,t){const{aliases:r,data:i,loadParser:s,parser:o,format:a,progressSize:l}=t;return(this._basePath||this._rootPath)&&(e.src=Do.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=r??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...i||{},...e.data},e.loadParser=s??e.loadParser,e.parser=o??e.parser,e.format=a??e.format??_T(e.src),l!==void 0&&(e.progressSize=l),e}}Ix.RETINA_PREFIX=/@([0-9\.]+)x/;function _T(n){return n.split(".").pop().split("?").shift().split("#").shift()}const jp=(n,e)=>{const t=e.split("?")[1];return t&&(n+=`?${t}`),n},Bx=class Zs{constructor(e,t){this.linkedSheets=[];let r=e;(e==null?void 0:e.source)instanceof $e&&(r={texture:e,data:t});const{texture:i,data:s,cachePrefix:o=""}=r;this.cachePrefix=o,this._texture=i instanceof Q?i:null,this.textureSource=i.source,this.textures={},this.animations={},this.data=s;const a=parseFloat(s.meta.scale);a?(this.resolution=a,i.source.resolution=this.resolution):this.resolution=i.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=Zs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(e,t=!1){let r=e;const i=t?1/0:Zs.BATCH_SIZE;for(;r-e<i&&r<this._frameKeys.length;){const s=this._frameKeys[r],o=this._frames[s],a=o.frame;if(a){let l=null,u=null;const c=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,h=new xe(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);o.rotated?l=new xe(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):l=new xe(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(u=new xe(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[s]=new Q({source:this.textureSource,frame:l,orig:h,trim:u,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}r++}}_processAnimations(){const e=this.data.animations||{};for(const t in e){this.animations[t]=[];for(let r=0;r<e[t].length;r++){const i=e[t][r];this.animations[t].push(this.textures[i])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Zs.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Zs.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){var t;for(const r in this.textures)this.textures[r].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&((t=this._texture)==null||t.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};Bx.BATCH_SIZE=1e3;let $p=Bx;const xT=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Dx(n,e,t){const r={};if(n.forEach(i=>{r[i]=e}),Object.keys(e.textures).forEach(i=>{r[`${e.cachePrefix}${i}`]=e.textures[i]}),!t){const i=Do.dirname(n[0]);e.linkedSheets.forEach((s,o)=>{const a=Dx([`${i}/${e.data.meta.related_multi_packs[o]}`],s,!0);Object.assign(r,a)})}return r}const vT={extension:k.Asset,cache:{test:n=>n instanceof $p,getCacheableAssets:(n,e)=>Dx(n,e,!1)},resolver:{extension:{type:k.ResolveParser,name:"resolveSpritesheet"},test:n=>{const t=n.split("?")[0].split("."),r=t.pop(),i=t.pop();return r==="json"&&xT.includes(i)},parse:n=>{var t;const e=n.split(".");return{resolution:parseFloat(((t=Ix.RETINA_PREFIX.exec(n))==null?void 0:t[1])??"1"),format:e[e.length-2],src:n}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:k.LoadParser,priority:Mx.Normal,name:"spritesheetLoader"},async testParse(n,e){return Do.extname(e.src).toLowerCase()===".json"&&!!n.frames},async parse(n,e,t){var h,d;const{texture:r,imageFilename:i,textureOptions:s,cachePrefix:o}=(e==null?void 0:e.data)??{};let a=Do.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof Q)l=r;else{const f=jp(a+(i??n.meta.image),e.src);l=(await t.load([{src:f,data:s}]))[f]}const u=new $p({texture:l.source,data:n,cachePrefix:o});await u.parse();const c=(h=n==null?void 0:n.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(c)){const f=[];for(const g of c){if(typeof g!="string")continue;let _=a+g;(d=e.data)!=null&&d.ignoreMultiPack||(_=jp(_,e.src),f.push(t.load({src:_,data:{textureOptions:s,ignoreMultiPack:!0}})))}const p=await Promise.all(f);u.linkedSheets=p,p.forEach(g=>{g.linkedSheets=[u].concat(u.linkedSheets.filter(_=>_!==g))})}return u},async unload(n,e,t){await t.unload(n.textureSource._sourceOrigin),n.destroy(!1)}}};ae.add(vT);class Fx{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),r=this._canvas.width,i=this._canvas.height,s=t.width/r*this._renderer.resolution,o=t.height/i*this._renderer.resolution,a=t.left,l=t.top,u=`translate(${a}px, ${l}px) scale(${s}, ${o})`;u!==this._lastTransform&&(this._domElement.style.transform=u,this._lastTransform=u)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const r=this.canvas.width,i=this.canvas.height,s=t.contentRect.width/r*this._renderer.resolution,o=t.contentRect.height/i*this._renderer.resolution;(this._lastScaleX!==s||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=s,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||St.shared.add(this.updateTranslation,this,si.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&St.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class $o{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=$o.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Me,this.page=new Me,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,r,i,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var nc=/iPhone/i,Xp=/iPod/i,Yp=/iPad/i,Kp=/\biOS-universal(?:.+)Mac\b/i,rc=/\bAndroid(?:.+)Mobile\b/i,qp=/Android/i,yi=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ca=/Silk/i,Fn=/Windows Phone/i,Qp=/\bWindows(?:.+)ARM\b/i,Zp=/BlackBerry/i,Jp=/BB10/i,em=/Opera Mini/i,tm=/\b(CriOS|Chrome)(?:.+)Mobile/i,nm=/Mobile(?:.+)Firefox\b/i,rm=function(n){return typeof n<"u"&&n.platform==="MacIntel"&&typeof n.maxTouchPoints=="number"&&n.maxTouchPoints>1&&typeof MSStream>"u"};function bT(n){return function(e){return e.test(n)}}function im(n){var e={userAgent:"",platform:"",maxTouchPoints:0};!n&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof n=="string"?e.userAgent=n:n&&n.userAgent&&(e={userAgent:n.userAgent,platform:n.platform,maxTouchPoints:n.maxTouchPoints||0});var t=e.userAgent,r=t.split("[FBAN");typeof r[1]<"u"&&(t=r[0]),r=t.split("Twitter"),typeof r[1]<"u"&&(t=r[0]);var i=bT(t),s={apple:{phone:i(nc)&&!i(Fn),ipod:i(Xp),tablet:!i(nc)&&(i(Yp)||rm(e))&&!i(Fn),universal:i(Kp),device:(i(nc)||i(Xp)||i(Yp)||i(Kp)||rm(e))&&!i(Fn)},amazon:{phone:i(yi),tablet:!i(yi)&&i(Ca),device:i(yi)||i(Ca)},android:{phone:!i(Fn)&&i(yi)||!i(Fn)&&i(rc),tablet:!i(Fn)&&!i(yi)&&!i(rc)&&(i(Ca)||i(qp)),device:!i(Fn)&&(i(yi)||i(Ca)||i(rc)||i(qp))||i(/\bokhttp\b/i)},windows:{phone:i(Fn),tablet:i(Qp),device:i(Fn)||i(Qp)},other:{blackberry:i(Zp),blackberry10:i(Jp),opera:i(em),firefox:i(nm),chrome:i(tm),device:i(Zp)||i(Jp)||i(em)||i(nm)||i(tm)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const wT=im.default??im,ST=wT(globalThis.navigator),TT=9,sm=100,CT=0,ET=0,om=2,am=1,AT=-1e3,kT=-1e3,PT=2,tf=class Gx{constructor(e,t=ST){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${am}px`,e.style.height=`${am}px`,e.style.position="absolute",e.style.top=`${AT}px`,e.style.left=`${kT}px`,e.style.zIndex=PT.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${CT}px`,this._div.style.left=`${ET}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=om.toString(),this._canvasObserver=new Fx({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){var e,t;if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const r of this._children)(e=r._accessibleDiv)!=null&&e.parentNode&&(r._accessibleDiv.parentNode.removeChild(r._accessibleDiv),r._accessibleDiv=null),r._accessibleActive=!1;for(const r in this._pools)this._pools[r].forEach(s=>{s.parentNode&&s.parentNode.removeChild(s)}),delete this._pools[r];(t=this._div)!=null&&t.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let r=0;r<t.length;r++)this._updateAccessibleObjects(t[r])}init(e){const r={accessibilityOptions:{...Gx.defaultOptions,...(e==null?void 0:e.accessibilityOptions)||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const r of this._children)r._renderId===this._renderId&&t.add(this._children.indexOf(r))}for(let r=this._children.length-1;r>=0;r--){const i=this._children[r];t.has(r)||(i._accessibleDiv&&i._accessibleDiv.parentNode&&(i._accessibleDiv.parentNode.removeChild(i._accessibleDiv),this._getPool(i.accessibleType).push(i._accessibleDiv),i._accessibleDiv=null),i._accessibleActive=!1,yx(this._children,r,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let r=0;r<this._children.length;r++){const i=this._children[r];if(!i._accessibleActive||!i._accessibleDiv)continue;const s=i._accessibleDiv,o=i.hitArea||i.getBounds().rectangle;if(i.hitArea){const a=i.worldTransform;s.style.left=`${a.tx+o.x*a.a}px`,s.style.top=`${a.ty+o.y*a.d}px`,s.style.width=`${o.width*a.a}px`,s.style.height=`${o.height*a.d}px`}else this._capHitArea(o),s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.style.width=`${o.width}px`,s.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:r}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>r&&(e.height=r-e.y)}_addChild(e){let r=this._getPool(e.accessibleType).pop();r?(r.innerHTML="",r.removeAttribute("title"),r.removeAttribute("aria-label"),r.tabIndex=0):(e.accessibleType==="button"?r=document.createElement("button"):(r=document.createElement(e.accessibleType),r.style.cssText=`
|
|
44
|
+
color: transparent;
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
padding: 0;
|
|
47
|
+
margin: 0;
|
|
48
|
+
border: 0;
|
|
49
|
+
outline: 0;
|
|
50
|
+
background: transparent;
|
|
51
|
+
box-sizing: border-box;
|
|
52
|
+
user-select: none;
|
|
53
|
+
-webkit-user-select: none;
|
|
54
|
+
-moz-user-select: none;
|
|
55
|
+
-ms-user-select: none;
|
|
56
|
+
`,e.accessibleText&&(r.innerText=e.accessibleText)),r.style.width=`${sm}px`,r.style.height=`${sm}px`,r.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",r.style.position="absolute",r.style.zIndex=om.toString(),r.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?r.setAttribute("aria-live","off"):r.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?r.setAttribute("aria-relevant","additions"):r.setAttribute("aria-relevant","text"),r.addEventListener("click",this._onClick.bind(this)),r.addEventListener("focus",this._onFocus.bind(this)),r.addEventListener("focusout",this._onFocusOut.bind(this))),r.style.pointerEvents=e.accessiblePointerEvents,r.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?r.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(r.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&r.setAttribute("aria-label",e.accessibleHint),e.interactive?r.tabIndex=e.tabIndex:r.tabIndex=0,this.debug&&this._updateDebugHTML(r),e._accessibleActive=!0,e._accessibleDiv=r,r.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv)}_dispatchEvent(e,t){const{container:r}=e.target,i=this._renderer.events.rootBoundary,s=Object.assign(new $o(i),{target:r});i.rootTarget=this._renderer.lastObjectRendered,t.forEach(o=>i.dispatchEvent(s,o))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode!==TT||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){var e;this._deactivate(),this._destroyTouchHook(),(e=this._canvasObserver)==null||e.destroy(),this._canvasObserver=null,this._div=null,this._pools=null,this._children=null,this._renderer=null,this._hookDiv=null,globalThis.removeEventListener("keydown",this._boundOnKeyDown),this._boundOnKeyDown=null,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._boundOnMouseMove=null}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}_getPool(e){return this._pools[e]||(this._pools[e]=[]),this._pools[e]}};tf.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"accessibility"};tf.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};let MT=tf;const RT={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1},ic=Object.create(null),lm=Object.create(null);function ls(n,e){let t=lm[n];return t===void 0&&(ic[e]===void 0&&(ic[e]=1),lm[n]=t=ic[e]++),t}let _i;function Ox(){return(!_i||_i!=null&&_i.isContextLost())&&(_i=pe.get().createCanvas().getContext("webgl",{})),_i}let Ea;function IT(){if(!Ea){Ea="mediump";const n=Ox();n&&n.getShaderPrecisionFormat&&(Ea=n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision?"highp":"mediump")}return Ea}function BT(n,e,t){return e?n:t?(n=n.replace("out vec4 finalColor;",""),`
|
|
57
|
+
|
|
58
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
59
|
+
#define in varying
|
|
60
|
+
#define finalColor gl_FragColor
|
|
61
|
+
#define texture texture2D
|
|
62
|
+
#endif
|
|
63
|
+
${n}
|
|
64
|
+
`):`
|
|
65
|
+
|
|
66
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
67
|
+
#define in attribute
|
|
68
|
+
#define out varying
|
|
69
|
+
#endif
|
|
70
|
+
${n}
|
|
71
|
+
`}function DT(n,e,t){const r=t?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(n.substring(0,9)!=="precision"){let i=t?e.requestedFragmentPrecision:e.requestedVertexPrecision;return i==="highp"&&r!=="highp"&&(i="mediump"),`precision ${i} float;
|
|
72
|
+
${n}`}else if(r!=="highp"&&n.substring(0,15)==="precision highp")return n.replace("precision highp","precision mediump");return n}function FT(n,e){return e?`#version 300 es
|
|
73
|
+
${n}`:n}const GT={},OT={};function LT(n,{name:e="pixi-program"},t=!0){e=e.replace(/\s+/g,"-"),e+=t?"-fragment":"-vertex";const r=t?GT:OT;return r[e]?(r[e]++,e+=`-${r[e]}`):r[e]=1,n.indexOf("#define SHADER_NAME")!==-1?n:`${`#define SHADER_NAME ${e}`}
|
|
74
|
+
${n}`}function UT(n,e){return e?n.replace("#version 300 es",""):n}const sc={stripVersion:UT,ensurePrecision:DT,addProgramDefines:BT,setProgramName:LT,insertVersion:FT},Os=Object.create(null),Lx=class Th{constructor(e){e={...Th.defaultOptions,...e};const t=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:t,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:IT()},setProgramName:{name:e.name},addProgramDefines:t,insertVersion:t};let i=e.fragment,s=e.vertex;Object.keys(sc).forEach(o=>{const a=r[o];i=sc[o](i,a,!0),s=sc[o](s,a,!1)}),this.fragment=i,this.vertex=s,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=ls(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,Os[this._cacheKey]=null}static from(e){const t=`${e.vertex}:${e.fragment}`;return Os[t]||(Os[t]=new Th(e),Os[t]._cacheKey=t),Os[t]}};Lx.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let ms=Lx;const um={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function Qn(n){return um[n]??um.float32}const NT={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},cm=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function hm(n,e){let t;for(;(t=cm.exec(n))!==null;){const r=NT[t[3]]??"float32";e[t[2]]={location:parseInt(t[1],10),format:r,stride:Qn(r).stride,offset:0,instance:!1,start:0}}cm.lastIndex=0}function zT(n){return n.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function WT({source:n,entryPoint:e}){const t={},r=zT(n),i=r.indexOf(`fn ${e}(`);if(i===-1)return t;const s=r.indexOf("->",i);if(s===-1)return t;const o=r.substring(i,s);if(hm(o,t),Object.keys(t).length===0){const a=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(a){const l=a[1],u=new RegExp(`struct\\s+${l}\\s*\\{([^}]+)\\}`,"s"),c=r.match(u);c&&hm(c[1],t)}}return t}function oc(n){var h,d;const e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,t=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,i=/var(<[^>]+>)? (\w+)/,s=/:\s*([\w<>]+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,u=(h=n.match(e))==null?void 0:h.map(f=>{const p=f.match(i),g=(p==null?void 0:p[1])??"";let _;return g==="<uniform>"?_="uniform":g.startsWith("<storage")&&(_="storage"),{group:parseInt(f.match(t)[1],10),binding:parseInt(f.match(r)[1],10),name:p[2],accessMode:_,type:f.match(s)[1]}});if(!u)return{groups:[],structs:[]};const c=((d=n.match(o))==null?void 0:d.map(f=>{const p=f.match(l)[1],g=f.match(a).reduce((_,m)=>{const[y,x]=m.split(":");return _[y.trim()]=x.trim(),_},{});return g?{name:p,members:g}:null}).filter(({name:f})=>u.some(p=>p.type===f||p.type.includes(`<${f}>`))))??[];return{groups:u,structs:c}}var Ze=(n=>(n[n.VERTEX=1]="VERTEX",n[n.FRAGMENT=2]="FRAGMENT",n[n.COMPUTE=4]="COMPUTE",n))(Ze||{});function HT({groups:n}){const e=[];for(let t=0;t<n.length;t++){const r=n[t];e[r.group]||(e[r.group]=[]),r.accessMode==="uniform"?e[r.group].push({binding:r.binding,visibility:Ze.VERTEX|Ze.FRAGMENT,buffer:{type:"uniform"}}):r.accessMode==="storage"?e[r.group].push({binding:r.binding,visibility:Ze.VERTEX|Ze.FRAGMENT,buffer:{type:"read-only-storage"}}):r.type==="sampler"?e[r.group].push({binding:r.binding,visibility:Ze.VERTEX|Ze.FRAGMENT,sampler:{type:"filtering"}}):r.type==="sampler_comparison"?e[r.group].push({binding:r.binding,visibility:Ze.VERTEX|Ze.FRAGMENT,sampler:{type:"comparison"}}):r.type==="texture_2d"||r.type.startsWith("texture_2d<")?e[r.group].push({binding:r.binding,visibility:Ze.VERTEX|Ze.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):r.type==="texture_depth_2d"?e[r.group].push({binding:r.binding,visibility:Ze.VERTEX|Ze.FRAGMENT,texture:{sampleType:"depth",viewDimension:"2d",multisampled:!1}}):r.type==="texture_depth_2d_array"?e[r.group].push({binding:r.binding,visibility:Ze.VERTEX|Ze.FRAGMENT,texture:{sampleType:"depth",viewDimension:"2d-array",multisampled:!1}}):r.type==="texture_2d_array"||r.type.startsWith("texture_2d_array<")?e[r.group].push({binding:r.binding,visibility:Ze.VERTEX|Ze.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(r.type==="texture_cube"||r.type.startsWith("texture_cube<"))&&e[r.group].push({binding:r.binding,visibility:Ze.VERTEX|Ze.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let t=0;t<e.length;t++)e[t]||(e[t]=[]);return e}function VT({groups:n}){const e=[];for(let t=0;t<n.length;t++){const r=n[t];e[r.group]||(e[r.group]={}),e[r.group][r.name]=r.binding}return e}function jT(n,e){const t=new Set,r=new Set,i=[...n.structs,...e.structs].filter(o=>t.has(o.name)?!1:(t.add(o.name),!0)),s=[...n.groups,...e.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:i,groups:s}}const Ls=Object.create(null);class ci{constructor(e){var a,l;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:t,vertex:r,layout:i,gpuLayout:s,name:o}=e;if(this.name=o,this.fragment=t,this.vertex=r,t.source===r.source){const u=oc(t.source);this.structsAndGroups=u}else{const u=oc(r.source),c=oc(t.source);this.structsAndGroups=jT(u,c)}this.layout=i??VT(this.structsAndGroups),this.gpuLayout=s??HT(this.structsAndGroups),this.autoAssignGlobalUniforms=((a=this.layout[0])==null?void 0:a.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((l=this.layout[1])==null?void 0:l.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:e,fragment:t}=this,r=e.source+t.source+e.entryPoint+t.entryPoint;this._layoutKey=ls(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=WT(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Ls[this._cacheKey]=null}static from(e){const t=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return Ls[t]||(Ls[t]=new ci(e),Ls[t]._cacheKey=t),Ls[t]}}const Ux=["f32","i32","u32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>","vec2<u32>","vec3<u32>","vec4<u32>"],$T=Ux.reduce((n,e)=>(n[e]=!0,n),{});function XT(n,e){switch(n){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const Nx=class zx extends Ot{constructor(e,t){super(),this._touched=0,this.uid=be("uniform"),this._resourceType="uniformGroup",this._resourceId=be("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,t={...zx.defaultOptions,...t},this.uniformStructures=e;const r={};for(const i in e){const s=e[i];if(s.name=i,s.size=s.size??1,!$T[s.type]){const o=s.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,l]=o;throw new Error(`Uniform type ${s.type} is not supported. Use type: '${a}', size: ${l} instead.`)}throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${Ux.join(", ")}`)}s.value??(s.value=XT(s.type,s.size)),r[i]=s.value}this.uniforms=r,this._dirtyId=1,this.ubo=t.ubo,this.isStatic=t.isStatic,this._signature=ls(Object.keys(r).map(i=>`${i}-${e[i].type}`).join("-"),"uniform-group")}get buffer(){return this._buffer}set buffer(e){var t;this._buffer!==e&&((t=this._buffer)==null||t.off("change",this.onBufferChange,this),this._buffer=e,e==null||e.on("change",this.onBufferChange,this))}get _gcLastUsed(){var e;return((e=this._buffer)==null?void 0:e._gcLastUsed)??-1}set _gcLastUsed(e){this._buffer&&(this._buffer._gcLastUsed=e)}onBufferChange(){this._resourceId=be("resource"),this.emit("change",this)}update(){this._dirtyId++}};Nx.defaultOptions={ubo:!1,isStatic:!1};let xn=Nx;class Sr{constructor(e){this.resources=Object.create(null),this._dirty=!0;let t=0;for(const r in e){const i=e[r];this.setResource(i,t++)}}get _key(){if(this._dirty){this._dirty=!1;const e=[];let t=0;for(const r in this.resources)e[t++]=this.resources[r]?this.resources[r]._resourceId:-1;this._keyValue=e.join("|")}return this._keyValue}setResource(e,t){var i,s;const r=this.resources[t];e!==r&&(r&&((i=r.off)==null||i.call(r,"change",this.onResourceChange,this)),(s=e.on)==null||s.call(e,"change",this.onResourceChange,this),this.resources[t]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e,t){const r=this.resources;for(const i in r){const s=r[i];s&&(s._gcLastUsed=e,s._touched=t)}}destroy(){var t;const e=this.resources;for(const r in e){const i=e[r];(t=i==null?void 0:i.off)==null||t.call(i,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(e){if(this._dirty=!0,e.destroyed){const t=this.resources;for(const r in t)t[r]===e&&(t[r]=null);se(`[BindGroup] a '${e._resourceType}' was destroyed while still bound to a shader. Remove it from the shader before destroying it.`)}}}var _n=(n=>(n[n.WEBGL=1]="WEBGL",n[n.WEBGPU=2]="WEBGPU",n[n.CANVAS=4]="CANVAS",n[n.BOTH=3]="BOTH",n))(_n||{});class Fo{constructor(e){this.data={...e};const t=Object.keys(e).sort().map(r=>`${r}:${e[r]}`).join("|");this.id=ls(t,"shader-overrides")}static from(e){return e instanceof Fo?e:new Fo(e)}}class er extends Ot{constructor(e){super(),this.uid=be("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:t,glProgram:r,groups:i,resources:s,compatibleRenderers:o,groupMap:a,overrides:l}=e;this._overrides=l?Fo.from(l):null,this.gpuProgram=t,this.glProgram=r,o===void 0&&(o=0,t&&(o|=_n.WEBGPU),r&&(o|=_n.WEBGL)),this.compatibleRenderers=o;const u={};if(a)for(const c in a)for(const h in a[c]){const d=a[c][h];u[d]={group:c,binding:h,name:d}}if(!s&&!i&&(s={}),s&&i)throw new Error("[Shader] Cannot have both resources and groups");if(!t&&i&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(t&&i&&!a){const c=t.structsAndGroups.groups;a={},c.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,u[h.name]=h})}else if(s){i={},a||(a={}),t&&t.structsAndGroups.groups.forEach(d=>{a[d.group]=a[d.group]||{},a[d.group][d.binding]=d.name,u[d.name]=d});let c=0;for(const h in s)u[h]||(t&&!r&&se(`[Shader] the resource '${h}' matches no binding in the WGSL source — is the name correct?`),i[99]||(i[99]=new Sr,this._ownedBindGroups.push(i[99])),u[h]={group:99,binding:c,name:h},a[99]=a[99]||{},a[99][c]=h,c++);for(const h in s){const d=h;let f=s[h];!f.source&&!f._resourceType&&(f=new xn(f));const p=u[d];p&&(i[p.group]||(i[p.group]=new Sr,this._ownedBindGroups.push(i[p.group])),i[p.group].setResource(f,p.binding))}}this.groups=i,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(i,u)}addResource(e,t,r){var i,s;(i=this._uniformBindMap)[t]||(i[t]={}),(s=this._uniformBindMap[t])[r]||(s[r]=e),this.groups[t]||(this.groups[t]=new Sr,this._ownedBindGroups.push(this.groups[t]))}_buildResourceAccessor(e,t){const r={};for(const i in t){const s=t[i];Object.defineProperty(r,s.name,{get(){return e[s.group].getResource(s.binding)},set(o){e[s.group].setResource(o,s.binding)}})}return r}destroy(e=!1){var t,r;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),e&&((t=this.gpuProgram)==null||t.destroy(),(r=this.glProgram)==null||r.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(i=>{i.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null,this._overrides=null)}static from(e){const{gpu:t,gl:r,...i}=e;let s,o;return t&&(s=ci.from(t)),r&&(o=ms.from(r)),new er({gpuProgram:s,glProgram:o,...i})}}const YT={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},Wx={BLEND:0,OFFSET:1,CULLING:2,DEPTH_TEST:3,WINDING:4,DEPTH_MASK:5},{BLEND:ac,OFFSET:lc,CULLING:uc,DEPTH_TEST:cc,WINDING:hc,DEPTH_MASK:dc}=Wx,Ch=class Hx{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<ac)}set blend(e){!!(this.data&1<<ac)!==e&&(this.data^=1<<ac)}get offsets(){return!!(this.data&1<<lc)}set offsets(e){!!(this.data&1<<lc)!==e&&(this.data^=1<<lc)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<uc)}set culling(e){!!(this.data&1<<uc)!==e&&(this.data^=1<<uc)}get depthTest(){return!!(this.data&1<<cc)}set depthTest(e){!!(this.data&1<<cc)!==e&&(this.data^=1<<cc)}get depthMask(){return!!(this.data&1<<dc)}set depthMask(e){!!(this.data&1<<dc)!==e&&(this.data^=1<<dc)}get clockwiseFrontFace(){return!!(this.data&1<<hc)}set clockwiseFrontFace(e){!!(this.data&1<<hc)!==e&&(this.data^=1<<hc)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=YT[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const e=new Hx;return e.depthTest=!1,e.depthMask=!1,e.blend=!0,e}};Ch.default2d=Ch.for2d();let tr=Ch;const Vx=class Eh extends er{constructor(e){e={...Eh.defaultOptions,...e},super(e),this.enabled=!0,this._state=tr.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1),e.blendRequired&&this.addResource("uBackTexture",0,3)}apply(e,t,r,i){e.applyFilter(this,t,r,i)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){const{gpu:t,gl:r,...i}=e;let s,o;return t&&(s=ci.from(t)),r&&(o=ms.from(r)),new Eh({gpuProgram:s,glProgram:o,...i})}};Vx.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let jx=Vx;const Ah=[];ae.handleByNamedList(k.Environment,Ah);async function KT(n){if(!n)for(let e=0;e<Ah.length;e++){const t=Ah[e];if(t.value.test()){await t.value.load();return}}}let Us;function $x(){if(typeof Us=="boolean")return Us;try{Us=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Us=!1}return Us}const Go=new Set;let kh=!1;function dm(n,e,t=2){const r=e&&e.length,i=r?e[0]*t:n.length;Go.size&&Go.clear();let s=Xx(n,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,u=0;if(r&&(s=eC(n,e,s,t)),n.length>80*t){a=n[0],l=n[1];let c=a,h=l;for(let d=t;d<i;d+=t){const f=n[d],p=n[d+1];f<a&&(a=f),p<l&&(l=p),f>c&&(c=f),p>h&&(h=p)}u=Math.max(c-a,h-l),u=u!==0?32767/u:0}return Ph(s,o,a,l,u),o}function Xx(n,e,t,r,i){let s=null;if(i===fC(n,e,t,r)>0)for(let o=e;o<t;o+=r)s=mm(o/r|0,n[o],n[o+1],s);else for(let o=t-r;o>=e;o-=r)s=mm(o/r|0,n[o],n[o+1],s);return s&&Oo(s,s.next)&&(Uo(s),s=s.next),s}function oi(n,e=n){const t=e===n;let r=n,i;do i=!1,r!==r.next&&(Go.size===0||!Go.has(r))&&(Oo(r,r.next)||Ke(r.prev,r,r.next)===0)?((t||r===e)&&(e=r.prev),kh=!0,Uo(r),r=r.prev,i=!0):(t||r!==e)&&(r=r.next,i=!t);while(i||r!==e);return e}function Ph(n,e,t,r,i){i&&aC(n,t,r,i);let s=n,o=!1;for(;n.prev!==n.next;){const a=n.prev,l=n.next;if(Ke(a,n,l)<0&&(i?QT(n,t,r,i):qT(n))){e.push(a.i,n.i,l.i),Uo(n),n=l,s=l;continue}if(n=l,n===s){if(kh=!1,n=oi(n),kh){s=n;continue}if(!o){n=ZT(n,e),s=n,o=!0;continue}JT(n,e,t,r,i);break}}}function qT(n){const e=n.prev,t=n,r=n.next,i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,u=r.y,c=Math.min(i,s,o),h=Math.min(a,l,u),d=Math.max(i,s,o),f=Math.max(a,l,u);let p=r.next;for(;p!==e;){if(p.x>=c&&p.x<=d&&p.y>=h&&p.y<=f&&!(i===p.x&&a===p.y)&&Il(i,a,s,l,o,u,p.x,p.y)&&Ke(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function QT(n,e,t,r){const i=n.prev,s=n,o=n.next,a=i.x,l=s.x,u=o.x,c=i.y,h=s.y,d=o.y,f=Math.min(a,l,u),p=Math.min(c,h,d),g=Math.max(a,l,u),_=Math.max(c,h,d),m=Bh(f,p,e,t,r),y=Bh(g,_,e,t,r);let x=n.prevZ;for(;x&&x.z>=m;){if(x.x>=f&&x.x<=g&&x.y>=p&&x.y<=_&&x!==o&&!(a===x.x&&c===x.y)&&Il(a,c,l,h,u,d,x.x,x.y)&&Ke(x.prev,x,x.next)>=0)return!1;x=x.prevZ}let b=n.nextZ;for(;b&&b.z<=y;){if(b.x>=f&&b.x<=g&&b.y>=p&&b.y<=_&&b!==o&&!(a===b.x&&c===b.y)&&Il(a,c,l,h,u,d,b.x,b.y)&&Ke(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function ZT(n,e){let t=n,r=!1;do{const i=t.prev,s=t.next.next;qx(i,t,t.next,s,!1)&&Lo(i,s)&&Lo(s,i)&&(e.push(i.i,t.i,s.i),Uo(t),Uo(t.next),t=n=s,r=!0),t=t.next}while(t!==n);return r?oi(t):t}function JT(n,e,t,r,i){let s=n;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&cC(s,o)){let a=Qx(s,o);s=oi(s,s.next),a=oi(a,a.next),Ph(s,e,t,r,i),Ph(a,e,t,r,i);return}o=o.next}s=s.next}while(s!==n)}let Mh=!1;function eC(n,e,t,r){const i=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*r,l=s<o-1?e[s+1]*r:n.length,u=Xx(n,a,l,r,!1);u===u.next&&Go.add(u),i.push(uC(u))}i.sort(tC),rC(n.length/r,e.length),Kx(t,t),Mh=!0;for(let s=0;s<i.length;s++)t=nC(i[s],t);return Mh=!1,oi(t)}function tC(n,e){return n.x-e.x||n.y-e.y||(n.next.y-n.y)/(n.next.x-n.x)-(e.next.y-e.y)/(e.next.x-e.x)}function nC(n,e){const t=sC(n,e);if(!t)return e;const r=Qx(t,n),i=r.next;return Kx(t,i.next),oi(r,r.next),oi(t,t.next)}const Yx=16;let We=new Float64Array(0),Rl=0;const Rh=[],Ih=[];function rC(n,e){const t=Math.ceil((n+2*e)/Yx)+e+2;We.length<t*4&&(We=new Float64Array(t*4)),Rl=0}function Kx(n,e){let t=n;do{const r=Rl++;Rh[r]=t;let i=1/0,s=1/0,o=-1/0,a=-1/0,l=0;do{const c=t.next;t.z=r,t.x<i&&(i=t.x),t.x>o&&(o=t.x),t.y<s&&(s=t.y),t.y>a&&(a=t.y),c.x<i&&(i=c.x),c.x>o&&(o=c.x),c.y<s&&(s=c.y),c.y>a&&(a=c.y),t=c}while(++l<Yx&&t!==e);Ih[r]=t;const u=r*4;We[u]=i,We[u+1]=s,We[u+2]=o,We[u+3]=a}while(t!==e)}function iC(n,e){const t=n.z*4;e.x<We[t]&&(We[t]=e.x),e.y<We[t+1]&&(We[t+1]=e.y),e.x>We[t+2]&&(We[t+2]=e.x),e.y>We[t+3]&&(We[t+3]=e.y)}function fm(n){let e=Ih[n];for(;e.prev.next!==e;)e=e.next;return Ih[n]=e,e}function pm(n){let e=Rh[n];for(;e.prev.next!==e;)e=e.next;return Rh[n]=e,e}function sC(n,e){let t=e;const r=n.x,i=n.y;let s=-1/0,o;if(Oo(n,t))return t;for(let d=0,f=0;d<Rl;d++,f+=4){if(i<We[f+1]||i>We[f+3]||We[f]>r||We[f+2]<=s)continue;const p=fm(d);t=pm(d);do{if(t.prev.next===t){if(Oo(n,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=r&&g>s&&(s=g,o=t.x<t.next.x?t:t.next,g===r))return o}}t=t.next}while(t!==p)}if(!o)return null;const a=o.x,l=o.y,u=Math.min(i,l),c=Math.max(i,l);let h=1/0;for(let d=0,f=0;d<Rl;d++,f+=4){if(We[f+2]<a||We[f]>r||We[f+3]<u||We[f+1]>c)continue;const p=fm(d);t=pm(d);do{if(t.prev.next===t&&r>=t.x&&t.x>=a&&r!==t.x&&Il(i<l?r:s,i,a,l,i<l?s:r,i,t.x,t.y)){const g=Math.abs(i-t.y)/(r-t.x);(Lo(t,n)||t.y===i&&t.next.y===i&&t.next.x>r)&&(g<h||g===h&&(t.x>o.x||t.x===o.x&&oC(o,t)))&&(o=t,h=g)}t=t.next}while(t!==p)}return o}function oC(n,e){return Ke(n.prev,n,e.prev)<0&&Ke(e.next,n,n.next)<0}const Xt=[];let Ns=[],Dr=new Uint32Array(0),zs=new Uint32Array(0);const Ws=new Uint32Array(256);function aC(n,e,t,r){let i=n,s=0;do i.z=Bh(i.x,i.y,e,t,r),Xt[s++]=i,i=i.next;while(i!==n);lC(s);let o=null;for(let a=0;a<s;a++){const l=Xt[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function lC(n){if(n<=32){for(let e=1;e<n;e++){const t=Xt[e],r=t.z;let i=e-1;for(;i>=0&&Xt[i].z>r;)Xt[i+1]=Xt[i],i--;Xt[i+1]=t}return}Dr.length<n&&(Dr=new Uint32Array(n),zs=new Uint32Array(n),Ns=new Array(n));for(let e=0;e<n;e++)Dr[e]=Xt[e].z;Aa(n,Xt,Dr,Ns,zs,0),Aa(n,Ns,zs,Xt,Dr,8),Aa(n,Xt,Dr,Ns,zs,16),Aa(n,Ns,zs,Xt,Dr,24)}function Aa(n,e,t,r,i,s){Ws.fill(0);for(let a=0;a<n;a++)Ws[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){const l=Ws[a];Ws[a]=o,o+=l}for(let a=0;a<n;a++){const l=t[a],u=Ws[l>>>s&255]++;r[u]=e[a],i[u]=l}}function Bh(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function uC(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function Il(n,e,t,r,i,s,o,a){return(i-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function cC(n,e){const t=Oo(n,e)&&Ke(n.prev,n,n.next)>0&&Ke(e.prev,e,e.next)>0;return n.next.i!==e.i&&(t||Lo(n,e)&&Lo(e,n)&&(Ke(n.prev,n,e.prev)!==0||Ke(n,e.prev,e)!==0))&&!hC(n,e)&&(t||dC(n,e))}function Ke(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Oo(n,e){return n.x===e.x&&n.y===e.y}function qx(n,e,t,r,i=!0){const s=Ke(n,e,t),o=Ke(n,e,r),a=Ke(t,r,n),l=Ke(t,r,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:i?!!(s===0&&ka(n,t,e)||o===0&&ka(n,r,e)||a===0&&ka(t,n,r)||l===0&&ka(t,e,r)):!1}function ka(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function hC(n,e){const t=Math.min(n.x,e.x),r=Math.max(n.x,e.x),i=Math.min(n.y,e.y),s=Math.max(n.y,e.y);let o=n;do{const a=o.next;if(o.x>r&&a.x>r||o.x<t&&a.x<t||o.y>s&&a.y>s||o.y<i&&a.y<i){o=a;continue}if(o.i!==n.i&&a.i!==n.i&&o.i!==e.i&&a.i!==e.i&&qx(o,a,n,e))return!0;o=a}while(o!==n);return!1}function Lo(n,e){return Ke(n.prev,n,n.next)<0?Ke(n,e,n.next)>=0&&Ke(n,n.prev,e)>=0:Ke(n,e,n.prev)<0||Ke(n,n.next,e)<0}function dC(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do{const o=t.next;t.y>s!=o.y>s&&i<(o.x-t.x)*(s-t.y)/(o.y-t.y)+t.x&&(r=!r),t=o}while(t!==n);return r}function Qx(n,e){const t=Dh(n.i,n.x,n.y),r=Dh(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function mm(n,e,t,r){const i=Dh(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Uo(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ),Mh&&iC(n.prev,n.next)}function Dh(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function fC(n,e,t,r){let i=0;for(let s=e,o=t-r;s<t;s+=r)i+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return i}const pC=dm.default||dm;var et=(n=>(n[n.NONE=0]="NONE",n[n.COLOR=16384]="COLOR",n[n.STENCIL=1024]="STENCIL",n[n.DEPTH=256]="DEPTH",n[n.COLOR_DEPTH=16640]="COLOR_DEPTH",n[n.COLOR_STENCIL=17408]="COLOR_STENCIL",n[n.DEPTH_STENCIL=1280]="DEPTH_STENCIL",n[n.ALL=17664]="ALL",n))(et||{});class Zx{constructor(e){this.items=[],this._name=e}emit(e,t,r,i,s,o,a,l){const{name:u,items:c}=this;for(let h=0,d=c.length;h<d;h++)c[h][u](e,t,r,i,s,o,a,l);return this}add(e){return e[this._name]&&(this.remove(e),this.items.push(e)),this}remove(e){const t=this.items.indexOf(e);return t!==-1&&this.items.splice(t,1),this}contains(e){return this.items.indexOf(e)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}const mC=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],Jx=class e1 extends Ot{constructor(e){super(),this.tick=0,this.uid=be("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;const t=[...mC,...this.config.runners??[]];this._addRunners(...t),this._unsafeEvalCheck()}async init(e={}){const t=e.skipExtensionImports===!0?!0:e.manageImports===!1;await KT(t),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const r in this._systemsHash)e={...this._systemsHash[r].constructor.defaultOptions,...e};e={...e1.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(e);this._initOptions=e}render(e,t){this.tick++;let r=e;if(r instanceof Ue&&(r={container:r},t&&(ie(Ge,"passing a second argument is deprecated, please use render options instead"),r.target=t.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){const i=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=i?r.clearColor:Ce.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.visible&&(r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r))}resize(e,t,r){const i=this.view.resolution;this.view.resize(e,t,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==i&&this.runners.resolutionChange.emit(r)}clear(e={}){const t=this;e.target||(e.target=t.renderTarget.renderTarget),e.clearColor||(e.clearColor=this.background.colorRgba),e.clear??(e.clear=et.ALL);const{clear:r,clearColor:i,target:s,mipLevel:o,layer:a}=e;Ce.shared.setValue(i??this.background.colorRgba),t.renderTarget.clear(s,r,Ce.shared.toArray(),o??0,a??0)}get resolution(){return this.view.resolution}set resolution(e){this.view.resolution=e,this.runners.resolutionChange.emit(e)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...e){e.forEach(t=>{this.runners[t]=new Zx(t)})}_addSystems(e){let t;for(t in e){const r=e[t];this._addSystem(r.value,r.name)}}_addSystem(e,t){const r=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=r,this._systemsHash[t]=r;for(const i in this.runners)this.runners[i].add(r);return this}_addPipes(e,t){const r=t.reduce((i,s)=>(i[s.name]=s.value,i),{});e.forEach(i=>{const s=i.value,o=i.name,a=r[o];this.renderPipes[o]=new s(this,a?new a:null),this.runners.destroy.add(this.renderPipes[o])})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),(e===!0||typeof e=="object"&&e.releaseGlobalResources)&&ps.release(),Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!$x())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};Jx.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let gs=Jx,Pa;function gC(n){return Pa!==void 0||(Pa=(()=>{var t;const e={stencil:!0,failIfMajorPerformanceCaveat:n??gs.defaultOptions.failIfMajorPerformanceCaveat};try{if(!pe.get().getWebGLRenderingContext())return!1;let i=pe.get().createCanvas().getContext("webgl",e);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),Pa}let Ma;async function yC(n={}){return Ma!==void 0||(Ma=await(async()=>{const e=pe.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(n)).requestDevice(),!0}catch{return!1}})()),Ma}const gm=["webgl","webgpu","canvas"];async function _C(n){let e=[];n.preference?Array.isArray(n.preference)?e=n.preference.slice():(e.push(n.preference),gm.forEach(s=>{s!==n.preference&&e.push(s)})):e=gm.slice();let t,r={};for(let s=0;s<e.length;s++){const o=e[s];if(o==="webgpu"&&await yC()){const{WebGPURenderer:a}=await lo(async()=>{const{WebGPURenderer:l}=await Promise.resolve().then(()=>mP);return{WebGPURenderer:l}},void 0,import.meta.url);t=a,r={...n,...n.webgpu};break}else if(o==="webgl"&&gC(n.failIfMajorPerformanceCaveat??gs.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:a}=await lo(async()=>{const{WebGLRenderer:l}=await Promise.resolve().then(()=>V3);return{WebGLRenderer:l}},void 0,import.meta.url);t=a,r={...n,...n.webgl};break}else if(o==="canvas"){const{CanvasRenderer:a}=await lo(async()=>{const{CanvasRenderer:l}=await Promise.resolve().then(()=>Vk);return{CanvasRenderer:l}},void 0,import.meta.url);t=a,r={...n,...n.canvasOptions};break}}if(delete r.webgpu,delete r.webgl,delete r.canvasOptions,!t)throw new Error("No available renderer for the current environment");const i=new t;return await i.init(r),i}const Bl="8.20.1";class t1{static init(){var e;(e=globalThis.__PIXI_APP_INIT__)==null||e.call(globalThis,this,Bl)}static destroy(){}}t1.extension=k.Application;class n1{constructor(e){this._renderer=e}init(){var e;(e=globalThis.__PIXI_RENDERER_INIT__)==null||e.call(globalThis,this._renderer,Bl)}destroy(){this._renderer=null}}n1.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"initHook",priority:-10};class r1{static init(e){Object.defineProperty(this,"resizeTo",{configurable:!0,set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let t,r;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,r=globalThis.innerHeight;else{const{clientWidth:i,clientHeight:s}=this._resizeTo;t=i,r=s}this.renderer.resize(t,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}r1.extension=k.Application;class i1{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{configurable:!0,set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,si.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?St.shared:new St,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}i1.extension=k.Application;ae.add(r1);ae.add(i1);const s1=class Fh{constructor(...e){this.stage=new Ue,e[0]!==void 0&&ie(Ge,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.stage||(this.stage=new Ue),this.renderer=await _C(e),Fh._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return ie(Ge,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){var e;return(e=this.renderer.renderPipes.dom)==null?void 0:e._domElement}destroy(e=!1,t=!1){const r=Fh._plugins.slice(0);r.reverse(),r.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};s1._plugins=[];let o1=s1;ae.handleByList(k.Application,o1._plugins);ae.add(t1);const fc={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},xC=/([astvzqmhlc])([^astvzqmhlc]*)/gi,vC=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function bC(n){const e=[];return n.replace(xC,(t,r,i)=>{let s=r.toLowerCase(),o=r;const a=wC(i);for(s==="m"&&a.length>2&&(e.push([o,...a.splice(0,2)]),s="l",o=o==="m"?"l":"L");;){if(a.length===fc[s])return e.push([o,...a]),"";if(a.length<fc[s])throw new Error("malformed path data");e.push([o,...a.splice(0,fc[s])])}}),e}function wC(n){const e=n.match(vC);return e?e.map(Number):[]}function SC(n,e){const t=bC(n),r=[];let i=null,s=0,o=0;for(let a=0;a<t.length;a++){const l=t[a],u=l[0],c=l;switch(u){case"M":s=c[1],o=c[2],e.moveTo(s,o);break;case"m":s+=c[1],o+=c[2],e.moveTo(s,o);break;case"H":s=c[1],e.lineTo(s,o);break;case"h":s+=c[1],e.lineTo(s,o);break;case"V":o=c[1],e.lineTo(s,o);break;case"v":o+=c[1],e.lineTo(s,o);break;case"L":s=c[1],o=c[2],e.lineTo(s,o);break;case"l":s+=c[1],o+=c[2],e.lineTo(s,o);break;case"C":s=c[5],o=c[6],e.bezierCurveTo(c[1],c[2],c[3],c[4],s,o);break;case"c":e.bezierCurveTo(s+c[1],o+c[2],s+c[3],o+c[4],s+c[5],o+c[6]),s+=c[5],o+=c[6];break;case"S":s=c[3],o=c[4],e.bezierCurveToShort(c[1],c[2],s,o);break;case"s":e.bezierCurveToShort(s+c[1],o+c[2],s+c[3],o+c[4]),s+=c[3],o+=c[4];break;case"Q":s=c[3],o=c[4],e.quadraticCurveTo(c[1],c[2],s,o);break;case"q":e.quadraticCurveTo(s+c[1],o+c[2],s+c[3],o+c[4]),s+=c[3],o+=c[4];break;case"T":s=c[1],o=c[2],e.quadraticCurveToShort(s,o);break;case"t":s+=c[1],o+=c[2],e.quadraticCurveToShort(s,o);break;case"A":s=c[6],o=c[7],e.arcToSvg(c[1],c[2],c[3],c[4],c[5],s,o);break;case"a":s+=c[6],o+=c[7],e.arcToSvg(c[1],c[2],c[3],c[4],c[5],s,o);break;case"Z":case"z":e.closePath(),r.length>0&&(i=r.pop(),i?(s=i.startX,o=i.startY):(s=0,o=0)),i=null;break;default:se(`Unknown SVG path command: ${u}`)}u!=="Z"&&u!=="z"&&i===null&&(i={startX:s,startY:o},r.push(i))}return e}class nf{constructor(e=0,t=0,r=0){this.type="circle",this.x=e,this.y=t,this.radius=r}clone(){return new nf(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;const r=this.radius*this.radius;let i=this.x-e,s=this.y-t;return i*=i,s*=s,i+s<=r}strokeContains(e,t,r,i=.5){if(this.radius===0)return!1;const s=this.x-e,o=this.y-t,a=this.radius,l=(1-i)*r,u=Math.sqrt(s*s+o*o);return u<=a+l&&u>a-(r-l)}getBounds(e){return e||(e=new xe),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class rf{constructor(e=0,t=0,r=0,i=0){this.type="ellipse",this.x=e,this.y=t,this.halfWidth=r,this.halfHeight=i}clone(){return new rf(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,t){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(e-this.x)/this.halfWidth,i=(t-this.y)/this.halfHeight;return r*=r,i*=i,r+i<=1}strokeContains(e,t,r,i=.5){const{halfWidth:s,halfHeight:o}=this;if(s<=0||o<=0)return!1;const a=r*(1-i),l=r-a,u=s-l,c=o-l,h=s+a,d=o+a,f=e-this.x,p=t-this.y,g=f*f/(u*u)+p*p/(c*c),_=f*f/(h*h)+p*p/(d*d);return g>1&&_<=1}getBounds(e){return e||(e=new xe),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function a1(n){const e=n.length;if(e<6)return 1;let t=0;for(let r=0,i=n[e-2],s=n[e-1];r<e;r+=2){const o=n[r],a=n[r+1];t+=(o-i)*(a+s),i=o,s=a}return t<0?-1:1}function TC(n,e,t,r,i,s){const o=n-t,a=e-r,l=i-t,u=s-r,c=o*l+a*u,h=l*l+u*u;let d=-1;h!==0&&(d=c/h);let f,p;d<0?(f=t,p=r):d>1?(f=i,p=s):(f=t+d*l,p=r+d*u);const g=n-f,_=e-p;return g*g+_*_}let CC,EC;class ho{constructor(...e){this.type="polygon";let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){const r=[];for(let i=0,s=t.length;i<s;i++)r.push(t[i].x,t[i].y);t=r}this.points=t,this.closePath=!0}isClockwise(){let e=0;const t=this.points,r=t.length;for(let i=0;i<r;i+=2){const s=t[i],o=t[i+1],a=t[(i+2)%r],l=t[(i+3)%r];e+=(a-s)*(l+o)}return e<0}containsPolygon(e){const t=this.getBounds(CC),r=e.getBounds(EC);if(!t.containsRect(r))return!1;const i=e.points;for(let s=0;s<i.length;s+=2){const o=i[s],a=i[s+1];if(!this.contains(o,a))return!1}return!0}clone(){const e=this.points.slice(),t=new ho(e);return t.closePath=this.closePath,t}contains(e,t){let r=!1;const i=this.points.length/2;for(let s=0,o=i-1;s<i;o=s++){const a=this.points[s*2],l=this.points[s*2+1],u=this.points[o*2],c=this.points[o*2+1];l>t!=c>t&&e<(u-a)*((t-l)/(c-l))+a&&(r=!r)}return r}strokeContains(e,t,r,i=.5){const{points:s}=this,o=i===.5?i:(i-.5)*a1(s)+.5,a=r*o,l=r-a,u=a*a,c=l*l,h=s.length-(this.closePath?0:2);for(let d=0;d<h;d+=2){const f=s[d],p=s[d+1],g=s[(d+2)%s.length],_=s[(d+3)%s.length],m=TC(e,t,f,p,g,_),y=Math.sign((g-f)*(t-p)-(_-p)*(e-f));if(m<=(y<0?u:c))return!0}return!1}getBounds(e){e||(e=new xe);const t=this.points;let r=1/0,i=-1/0,s=1/0,o=-1/0;for(let a=0,l=t.length;a<l;a+=2){const u=t[a],c=t[a+1];r=u<r?u:r,i=u>i?u:i,s=c<s?c:s,o=c>o?c:o}return e.x=r,e.width=i-r,e.y=s,e.height=o-s,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,t)=>`${e}, ${t}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return ie("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return ie("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const Ra=(n,e,t,r,i,s,o)=>{const a=n-t,l=e-r,u=Math.sqrt(a*a+l*l);return u>=i-s&&u<=i+o};class sf{constructor(e=0,t=0,r=0,i=0,s=20){this.type="roundedRectangle",this.x=e,this.y=t,this.width=r,this.height=i,this.radius=s}getBounds(e){return e||(e=new xe),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new sf(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){const r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+r&&t<=this.y+this.height-r||e>=this.x+r&&e<=this.x+this.width-r)return!0;let i=e-(this.x+r),s=t-(this.y+r);const o=r*r;if(i*i+s*s<=o||(i=e-(this.x+this.width-r),i*i+s*s<=o)||(s=t-(this.y+this.height-r),i*i+s*s<=o)||(i=e-(this.x+r),i*i+s*s<=o))return!0}return!1}strokeContains(e,t,r,i=.5){const{x:s,y:o,width:a,height:l,radius:u}=this,c=r*(1-i),h=r-c,d=s+u,f=o+u,p=a-u*2,g=l-u*2,_=s+a,m=o+l;return(e>=s-c&&e<=s+h||e>=_-h&&e<=_+c)&&t>=f&&t<=f+g||(t>=o-c&&t<=o+h||t>=m-h&&t<=m+c)&&e>=d&&e<=d+p?!0:e<d&&t<f&&Ra(e,t,d,f,u,h,c)||e>_-u&&t<f&&Ra(e,t,_-u,f,u,h,c)||e>_-u&&t>m-u&&Ra(e,t,_-u,m-u,u,h,c)||e<d&&t>m-u&&Ra(e,t,d,m-u,u,h,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const l1={};function of(n,e,t){let r=2166136261;for(let i=0;i<e;i++)r^=n[i].uid,r=Math.imul(r,16777619),r>>>=0;return l1[r]||AC(n,e,r,t)}function AC(n,e,t,r){const i={};let s=0;for(let a=0;a<r;a++){const l=a<e?n[a]:Q.EMPTY.source;i[s++]=l.source,i[s++]=l.style}const o=new Sr(i);return l1[t]=o,o}class Hi{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}function Gh(n,e,t,r){if(t??(t=0),r??(r=Math.min(n.byteLength-t,e.byteLength)),!(t&7)&&!(r&7)){const i=r/8;new Float64Array(e,0,i).set(new Float64Array(n,t,i))}else if(!(t&3)&&!(r&3)){const i=r/4;new Float32Array(e,0,i).set(new Float32Array(n,t,i))}else new Uint8Array(e).set(new Uint8Array(n,t,r))}const kC={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var Ve=(n=>(n[n.DISABLED=0]="DISABLED",n[n.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",n[n.MASK_ACTIVE=2]="MASK_ACTIVE",n[n.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",n[n.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",n[n.NONE=5]="NONE",n))(Ve||{});function ym(n,e){return e.alphaMode==="no-premultiply-alpha"&&kC[n]||n}const PC=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
75
|
+
`);function MC(n){let e="";for(let t=0;t<n;++t)t>0&&(e+=`
|
|
76
|
+
else `),t<n-1&&(e+=`if(test == ${t}.0){}`);return e}function u1(n,e){if(n===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const t=e.createShader(e.FRAGMENT_SHADER);try{for(;;){const r=PC.replace(/%forloop%/gi,MC(n));if(e.shaderSource(t,r),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))n=n/2|0;else break}}finally{e.deleteShader(t)}return n}let xi=null;function RC(){var e;if(xi)return xi;const n=Ox();return xi=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),xi=u1(xi,n),(e=n.getExtension("WEBGL_lose_context"))==null||e.loseContext(),xi}class IC{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e<this.count;e++){const t=this.textures[e];this.textures[e]=null,this.ids[t.uid]=null}this.count=0}}class BC{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new IC,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}}const fo=[];let Dl=0;ps.register({clear:()=>{if(fo.length>0)for(const n of fo)n&&n.destroy();fo.length=0,Dl=0}});function _m(){return Dl>0?fo[--Dl]:new BC}function xm(n){n.elements=null,fo[Dl++]=n}let Hs=0;const c1=class h1{constructor(e){this.uid=be("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...h1.defaultOptions,...e},e.maxTextures||(ie("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=RC());const{maxTextures:t,attributesInitialSize:r,indicesInitialSize:i}=e;this.attributeBuffer=new Hi(r*4),this.indexBuffer=new Uint16Array(i),this.maxTextures=t}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)xm(this.batches[e]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(e){this._elements[this.elementSize++]=e,e._indexStart=this.indexSize,e._attributeStart=this.attributeSize,e._batcher=this,this.indexSize+=e.indexSize,this.attributeSize+=e.attributeSize*this.vertexSize}checkAndUpdateTexture(e,t){const r=e._batch.textures.ids[t._source.uid];return!r&&r!==0?!1:(e._textureId=r,e.texture=t,!0)}updateElement(e){this.dirty=!0;const t=this.attributeBuffer;e.packAsQuad?this.packQuadAttributes(e,t.float32View,t.uint32View,e._attributeStart,e._textureId):this.packAttributes(e,t.float32View,t.uint32View,e._attributeStart,e._textureId)}break(e){const t=this._elements;if(!t[this.elementStart])return;let r=_m(),i=r.textures;i.clear();const s=t[this.elementStart];let o=ym(s.blendMode,s.texture._source),a=s.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const l=this.attributeBuffer.float32View,u=this.attributeBuffer.uint32View,c=this.indexBuffer;let h=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=[];const g=this.maxTextures;for(let _=this.elementStart;_<this.elementSize;++_){const m=t[_];t[_]=null;const x=m.texture._source,b=ym(m.blendMode,x),S=o!==b||a!==m.topology;if(x._batchTick===Hs&&!S){m._textureId=x._textureBindLocation,h+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,u,m._attributeStart,m._textureId),this.packQuadIndex(c,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,u,m._attributeStart,m._textureId),this.packIndex(m,c,m._indexStart,m._attributeStart/this.vertexSize)),m._batch=r,p.push(m);continue}x._batchTick=Hs,(i.count>=g||S)&&(this._finishBatch(r,d,h-d,i,o,a,e,f,p),f="renderBatch",d=h,o=b,a=m.topology,r=_m(),i=r.textures,i.clear(),p=[],++Hs),m._textureId=x._textureBindLocation=i.count,i.ids[x.uid]=i.count,i.textures[i.count++]=x,m._batch=r,p.push(m),h+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,u,m._attributeStart,m._textureId),this.packQuadIndex(c,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,u,m._attributeStart,m._textureId),this.packIndex(m,c,m._indexStart,m._attributeStart/this.vertexSize))}i.count>0&&(this._finishBatch(r,d,h-d,i,o,a,e,f,p),d=h,++Hs),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=h}_finishBatch(e,t,r,i,s,o,a,l,u){e.gpuBindGroup=null,e.bindGroup=null,e.action=l,e.batcher=this,e.textures=i,e.blendMode=s,e.topology=o,e.start=t,e.size=r,e.elements=u,++Hs,this.batches[this.batchIndex++]=e,a.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){const t=Math.max(e,this.attributeBuffer.size*2),r=new Hi(t);Gh(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(e){const t=this.indexBuffer;let r=Math.max(e,t.length*1.5);r+=r%2;const i=r>65535?new Uint32Array(r):new Uint16Array(r);if(i.BYTES_PER_ELEMENT!==t.BYTES_PER_ELEMENT)for(let s=0;s<t.length;s++)i[s]=t[s];else Gh(t.buffer,i.buffer);this.indexBuffer=i}packQuadIndex(e,t,r){e[t]=r+0,e[t+1]=r+1,e[t+2]=r+2,e[t+3]=r+0,e[t+4]=r+2,e[t+5]=r+3}packIndex(e,t,r,i){const s=e.indices,o=e.indexSize,a=e.indexOffset,l=e.attributeOffset;for(let u=0;u<o;u++)t[r++]=i+s[u+a]-l}destroy(e={}){var t;if(this.batches!==null){for(let r=0;r<this.batchIndex;r++)xm(this.batches[r]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,e.shader&&((t=this.shader)==null||t.destroy(),this.shader=null);for(let r=0;r<this._elements.length;r++)this._elements[r]&&(this._elements[r]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};c1.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let DC=c1;var Te=(n=>(n[n.MAP_READ=1]="MAP_READ",n[n.MAP_WRITE=2]="MAP_WRITE",n[n.COPY_SRC=4]="COPY_SRC",n[n.COPY_DST=8]="COPY_DST",n[n.INDEX=16]="INDEX",n[n.VERTEX=32]="VERTEX",n[n.UNIFORM=64]="UNIFORM",n[n.STORAGE=128]="STORAGE",n[n.INDIRECT=256]="INDIRECT",n[n.QUERY_RESOLVE=512]="QUERY_RESOLVE",n[n.STATIC=1024]="STATIC",n))(Te||{});class Pn extends Ot{constructor(e){let{data:t,size:r}=e;const{usage:i,label:s,shrinkToFit:o}=e;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=be("buffer"),this._resourceType="buffer",this._resourceId=be("resource"),this._touched=0,this._updateID=1,this._updateOffset=0,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,t instanceof Array&&(t=new Float32Array(t)),this._data=t,r??(r=t==null?void 0:t.byteLength);const a=!!t;this.descriptor={size:r,usage:i,mappedAtCreation:a,label:s},this.shrinkToFit=o??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&Te.STATIC)}set static(e){e?this.descriptor.usage|=Te.STATIC:this.descriptor.usage&=~Te.STATIC}setDataWithSize(e,t,r){if(this._updateID++,this._updateSize=t*e.BYTES_PER_ELEMENT,this._updateOffset=0,this._data===e){r&&this.emit("update",this);return}const i=this._data;if(this._data=e,this._dataInt32=null,!i||i.length!==e.length){!this.shrinkToFit&&i&&e.byteLength<i.byteLength?r&&this.emit("update",this):(this.descriptor.size=e.byteLength,this._resourceId=be("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(e,t){this._updateSize=e??this._updateSize,this._updateOffset=t||0,this._updateID++,this.emit("update",this)}unload(){var e;this.emit("unload",this);for(const t in this._gpuData)(e=this._gpuData[t])==null||e.destroy();this._gpuData=Object.create(null),this.destroyed||(this._resourceId=be("resource"),this.emit("change",this))}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function d1(n,e){if(!(n instanceof Pn)){let t=e?Te.INDEX:Te.VERTEX;n instanceof Array&&(e?(n=new Uint32Array(n),t=Te.INDEX|Te.COPY_DST):(n=new Float32Array(n),t=Te.VERTEX|Te.COPY_DST)),n=new Pn({data:n,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:t})}return n}function FC(n,e,t){const r=n.getAttribute(e);if(!r)return t.minX=0,t.minY=0,t.maxX=0,t.maxY=0,t;const i=r.buffer.data;let s=1/0,o=1/0,a=-1/0,l=-1/0;const u=i.BYTES_PER_ELEMENT,c=(r.offset||0)/u,h=(r.stride||2*4)/u;for(let d=c;d<i.length;d+=h){const f=i[d],p=i[d+1];f>a&&(a=f),p>l&&(l=p),f<s&&(s=f),p<o&&(o=p)}return t.minX=s,t.minY=o,t.maxX=a,t.maxY=l,t}function GC(n){return(n instanceof Pn||Array.isArray(n)||n.BYTES_PER_ELEMENT)&&(n={buffer:n}),n.buffer=d1(n.buffer,!1),n}class ou extends Ot{constructor(e={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=be("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new gt,this._boundsDirty=!0,this._vertexCount=0,this._vertexCountDirty=!0;const{attributes:t,indexBuffer:r,topology:i}=e;if(this.buffers=[],this.attributes={},t)for(const s in t)this.addAttribute(s,t[s]);this.instanceCount=e.instanceCount??1,r&&this.addIndex(r),this.topology=i||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this._vertexCountDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}get vertexCount(){if(!this._vertexCountDirty)return this._vertexCount;this._vertexCountDirty=!1;const e=this.attributes;for(const t in e){const r=e[t];if(r.instance)continue;const i=r.buffer;return this._vertexCount=i.data.length/(r.stride/4||r.size),this._vertexCount}return this._vertexCount=0,0}getSize(){return ie("8.20.0","Geometry.getSize is deprecated, please use Geometry.vertexCount instead."),this.vertexCount}addAttribute(e,t){const r=GC(t);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[e]=r,this._vertexCountDirty=!0}addIndex(e){this.indexBuffer=d1(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,FC(this,"aPosition",this._bounds)):this._bounds}unload(){var e;this.emit("unload",this);for(const t in this._gpuData)(e=this._gpuData[t])==null||e.destroy();this._gpuData=Object.create(null)}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(t=>t.destroy()),this.unload(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const OC=new Float32Array(1),LC=new Uint32Array(1);class UC extends ou{constructor(){const t=new Pn({data:OC,label:"attribute-batch-buffer",usage:Te.VERTEX|Te.COPY_DST,shrinkToFit:!1}),r=new Pn({data:LC,label:"index-batch-buffer",usage:Te.INDEX|Te.COPY_DST,shrinkToFit:!1}),i=6*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:i,offset:0},aUV:{buffer:t,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:t,format:"unorm8x4",stride:i,offset:4*4},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:i,offset:5*4}},indexBuffer:r})}}function vm(n,e,t){if(n)for(const r in n){const i=r.toLocaleLowerCase(),s=e[i];if(s){let o=n[r];r==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),t&&s.push(`//----${t}----//`),s.push(o)}else se(`${r} placement hook does not exist in shader`)}}const NC=/\{\{(.*?)\}\}/g;function bm(n){var r;const e={};return(((r=n.match(NC))==null?void 0:r.map(i=>i.replace(/[{()}]/g,"")))??[]).forEach(i=>{e[i]=[]}),e}function wm(n,e){let t;const r=/@in\s+([^;]+);/g;for(;(t=r.exec(n))!==null;)e.push(t[1])}function Sm(n,e,t=!1){const r=[];wm(e,r),n.forEach(a=>{a.header&&wm(a.header,r)});const i=r;t&&i.sort();const s=i.map((a,l)=>` @location(${l}) ${a},`).join(`
|
|
77
|
+
`);let o=e.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
|
|
78
|
+
${s}
|
|
79
|
+
`),o}function Tm(n,e){let t;const r=/@out\s+([^;]+);/g;for(;(t=r.exec(n))!==null;)e.push(t[1])}function zC(n){const t=/\b(\w+)\s*:/g.exec(n);return t?t[1]:""}function WC(n){const e=/@.*?\s+/g;return n.replace(e,"")}function HC(n,e){const t=[];Tm(e,t),n.forEach(l=>{l.header&&Tm(l.header,t)});let r=0;const i=t.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
|
|
80
|
+
`),s=t.sort().map(l=>` var ${WC(l)};`).join(`
|
|
81
|
+
`),o=`return VSOutput(
|
|
82
|
+
${t.sort().map(l=>` ${zC(l)}`).join(`,
|
|
83
|
+
`)});`;let a=e.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
|
|
84
|
+
${i}
|
|
85
|
+
`),a=a.replace("{{start}}",`
|
|
86
|
+
${s}
|
|
87
|
+
`),a=a.replace("{{return}}",`
|
|
88
|
+
${o}
|
|
89
|
+
`),a}function Cm(n,e){let t=n;for(const r in e){const i=e[r];i.join(`
|
|
90
|
+
`).length?t=t.replace(`{{${r}}}`,`//-----${r} START-----//
|
|
91
|
+
${i.join(`
|
|
92
|
+
`)}
|
|
93
|
+
//----${r} FINISH----//`):t=t.replace(`{{${r}}}`,"")}return t}const pr=Object.create(null),pc=new Map;let VC=0;function jC({template:n,bits:e}){const t=f1(n,e);if(pr[t])return pr[t];const{vertex:r,fragment:i}=XC(n,e);return pr[t]=p1(r,i,e),pr[t]}function $C({template:n,bits:e}){const t=f1(n,e);return pr[t]||(pr[t]=p1(n.vertex,n.fragment,e)),pr[t]}function XC(n,e){const t=e.map(o=>o.vertex).filter(o=>!!o),r=e.map(o=>o.fragment).filter(o=>!!o);let i=Sm(t,n.vertex,!0);i=HC(t,i);const s=Sm(r,n.fragment,!0);return{vertex:i,fragment:s}}function f1(n,e){return e.map(t=>(pc.has(t)||pc.set(t,VC++),pc.get(t))).sort((t,r)=>t-r).join("-")+n.vertex+n.fragment}function p1(n,e,t){const r=bm(n),i=bm(e);return t.forEach(s=>{vm(s.vertex,r,s.name),vm(s.fragment,i,s.name)}),{vertex:Cm(n,r),fragment:Cm(e,i)}}const YC=`
|
|
94
|
+
@in aPosition: vec2<f32>;
|
|
95
|
+
@in aUV: vec2<f32>;
|
|
96
|
+
|
|
97
|
+
@out @builtin(position) vPosition: vec4<f32>;
|
|
98
|
+
@out vUV : vec2<f32>;
|
|
99
|
+
@out vColor : vec4<f32>;
|
|
100
|
+
|
|
101
|
+
{{header}}
|
|
102
|
+
|
|
103
|
+
struct VSOutput {
|
|
104
|
+
{{struct}}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
@vertex
|
|
108
|
+
fn main( {{in}} ) -> VSOutput {
|
|
109
|
+
|
|
110
|
+
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
|
|
111
|
+
var modelMatrix = mat3x3<f32>(
|
|
112
|
+
1.0, 0.0, 0.0,
|
|
113
|
+
0.0, 1.0, 0.0,
|
|
114
|
+
0.0, 0.0, 1.0
|
|
115
|
+
);
|
|
116
|
+
var position = aPosition;
|
|
117
|
+
var uv = aUV;
|
|
118
|
+
|
|
119
|
+
{{start}}
|
|
120
|
+
|
|
121
|
+
vColor = vec4<f32>(1., 1., 1., 1.);
|
|
122
|
+
|
|
123
|
+
{{main}}
|
|
124
|
+
|
|
125
|
+
vUV = uv;
|
|
126
|
+
|
|
127
|
+
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
128
|
+
|
|
129
|
+
vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
|
|
130
|
+
|
|
131
|
+
vColor *= globalUniforms.uWorldColorAlpha;
|
|
132
|
+
|
|
133
|
+
{{end}}
|
|
134
|
+
|
|
135
|
+
{{return}}
|
|
136
|
+
};
|
|
137
|
+
`,KC=`
|
|
138
|
+
@in vUV : vec2<f32>;
|
|
139
|
+
@in vColor : vec4<f32>;
|
|
140
|
+
|
|
141
|
+
{{header}}
|
|
142
|
+
|
|
143
|
+
@fragment
|
|
144
|
+
fn main(
|
|
145
|
+
{{in}}
|
|
146
|
+
) -> @location(0) vec4<f32> {
|
|
147
|
+
|
|
148
|
+
{{start}}
|
|
149
|
+
|
|
150
|
+
var outColor:vec4<f32>;
|
|
151
|
+
|
|
152
|
+
{{main}}
|
|
153
|
+
|
|
154
|
+
var finalColor:vec4<f32> = outColor * vColor;
|
|
155
|
+
|
|
156
|
+
{{end}}
|
|
157
|
+
|
|
158
|
+
return finalColor;
|
|
159
|
+
};
|
|
160
|
+
`,qC=`
|
|
161
|
+
in vec2 aPosition;
|
|
162
|
+
in vec2 aUV;
|
|
163
|
+
|
|
164
|
+
out vec4 vColor;
|
|
165
|
+
out vec2 vUV;
|
|
166
|
+
|
|
167
|
+
{{header}}
|
|
168
|
+
|
|
169
|
+
void main(void){
|
|
170
|
+
|
|
171
|
+
mat3 worldTransformMatrix = uWorldTransformMatrix;
|
|
172
|
+
mat3 modelMatrix = mat3(
|
|
173
|
+
1.0, 0.0, 0.0,
|
|
174
|
+
0.0, 1.0, 0.0,
|
|
175
|
+
0.0, 0.0, 1.0
|
|
176
|
+
);
|
|
177
|
+
vec2 position = aPosition;
|
|
178
|
+
vec2 uv = aUV;
|
|
179
|
+
|
|
180
|
+
{{start}}
|
|
181
|
+
|
|
182
|
+
vColor = vec4(1.);
|
|
183
|
+
|
|
184
|
+
{{main}}
|
|
185
|
+
|
|
186
|
+
vUV = uv;
|
|
187
|
+
|
|
188
|
+
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
189
|
+
|
|
190
|
+
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
191
|
+
|
|
192
|
+
vColor *= uWorldColorAlpha;
|
|
193
|
+
|
|
194
|
+
{{end}}
|
|
195
|
+
}
|
|
196
|
+
`,QC=`
|
|
197
|
+
|
|
198
|
+
in vec4 vColor;
|
|
199
|
+
in vec2 vUV;
|
|
200
|
+
|
|
201
|
+
out vec4 finalColor;
|
|
202
|
+
|
|
203
|
+
{{header}}
|
|
204
|
+
|
|
205
|
+
void main(void) {
|
|
206
|
+
|
|
207
|
+
{{start}}
|
|
208
|
+
|
|
209
|
+
vec4 outColor;
|
|
210
|
+
|
|
211
|
+
{{main}}
|
|
212
|
+
|
|
213
|
+
finalColor = outColor * vColor;
|
|
214
|
+
|
|
215
|
+
{{end}}
|
|
216
|
+
}
|
|
217
|
+
`,ZC={name:"global-uniforms-bit",vertex:{header:`
|
|
218
|
+
struct GlobalUniforms {
|
|
219
|
+
uProjectionMatrix:mat3x3<f32>,
|
|
220
|
+
uWorldTransformMatrix:mat3x3<f32>,
|
|
221
|
+
uWorldColorAlpha: vec4<f32>,
|
|
222
|
+
uResolution: vec2<f32>,
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
226
|
+
`}},JC={name:"global-uniforms-bit",vertex:{header:`
|
|
227
|
+
uniform mat3 uProjectionMatrix;
|
|
228
|
+
uniform mat3 uWorldTransformMatrix;
|
|
229
|
+
uniform vec4 uWorldColorAlpha;
|
|
230
|
+
uniform vec2 uResolution;
|
|
231
|
+
`}};function af({bits:n,name:e}){const t=jC({template:{fragment:KC,vertex:YC},bits:[ZC,...n]});return ci.from({name:e,vertex:{source:t.vertex,entryPoint:"main"},fragment:{source:t.fragment,entryPoint:"main"}})}function lf({bits:n,name:e}){return new ms({name:e,...$C({template:{vertex:qC,fragment:QC},bits:[JC,...n]})})}const m1={name:"color-bit",vertex:{header:`
|
|
232
|
+
@in aColor: vec4<f32>;
|
|
233
|
+
`,main:`
|
|
234
|
+
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
235
|
+
`}},g1={name:"color-bit",vertex:{header:`
|
|
236
|
+
in vec4 aColor;
|
|
237
|
+
`,main:`
|
|
238
|
+
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
239
|
+
`}},mc={};function eE(n){const e=[];if(n===1)e.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let t=0;for(let r=0;r<n;r++)e.push(`@group(1) @binding(${t++}) var textureSource${r+1}: texture_2d<f32>;`),e.push(`@group(1) @binding(${t++}) var textureSampler${r+1}: sampler;`)}return e.join(`
|
|
240
|
+
`)}function tE(n){const e=[];if(n===1)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let t=0;t<n;t++)t===n-1?e.push(" default:{"):e.push(` case ${t}:{`),e.push(` outColor = textureSampleGrad(textureSource${t+1}, textureSampler${t+1}, vUV, uvDx, uvDy);`),e.push(" break;}");e.push("}")}return e.join(`
|
|
241
|
+
`)}function y1(n){return mc[n]||(mc[n]={name:"texture-batch-bit",vertex:{header:`
|
|
242
|
+
@in aTextureIdAndRound: vec2<u32>;
|
|
243
|
+
@out @interpolate(flat) vTextureId : u32;
|
|
244
|
+
`,main:`
|
|
245
|
+
vTextureId = aTextureIdAndRound.y;
|
|
246
|
+
`,end:`
|
|
247
|
+
if(aTextureIdAndRound.x == 1)
|
|
248
|
+
{
|
|
249
|
+
vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
250
|
+
}
|
|
251
|
+
`},fragment:{header:`
|
|
252
|
+
@in @interpolate(flat) vTextureId: u32;
|
|
253
|
+
|
|
254
|
+
${eE(n)}
|
|
255
|
+
`,main:`
|
|
256
|
+
var uvDx = dpdx(vUV);
|
|
257
|
+
var uvDy = dpdy(vUV);
|
|
258
|
+
|
|
259
|
+
${tE(n)}
|
|
260
|
+
`}}),mc[n]}const gc={};function nE(n){const e=[];for(let t=0;t<n;t++)t>0&&e.push("else"),t<n-1&&e.push(`if(vTextureId < ${t}.5)`),e.push("{"),e.push(` outColor = texture(uTextures[${t}], vUV);`),e.push("}");return e.join(`
|
|
261
|
+
`)}function _1(n){return gc[n]||(gc[n]={name:"texture-batch-bit",vertex:{header:`
|
|
262
|
+
in vec2 aTextureIdAndRound;
|
|
263
|
+
out float vTextureId;
|
|
264
|
+
|
|
265
|
+
`,main:`
|
|
266
|
+
vTextureId = aTextureIdAndRound.y;
|
|
267
|
+
`,end:`
|
|
268
|
+
if(aTextureIdAndRound.x == 1.)
|
|
269
|
+
{
|
|
270
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
271
|
+
}
|
|
272
|
+
`},fragment:{header:`
|
|
273
|
+
in float vTextureId;
|
|
274
|
+
|
|
275
|
+
uniform sampler2D uTextures[${n}];
|
|
276
|
+
|
|
277
|
+
`,main:`
|
|
278
|
+
|
|
279
|
+
${nE(n)}
|
|
280
|
+
`}}),gc[n]}const uf={name:"round-pixels-bit",vertex:{header:`
|
|
281
|
+
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
282
|
+
{
|
|
283
|
+
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
284
|
+
}
|
|
285
|
+
`}},cf={name:"round-pixels-bit",vertex:{header:`
|
|
286
|
+
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
287
|
+
{
|
|
288
|
+
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
289
|
+
}
|
|
290
|
+
`}},Em={};function x1(n){let e=Em[n];if(e)return e;const t=new Int32Array(n);for(let r=0;r<n;r++)t[r]=r;return e=Em[n]=new xn({uTextures:{value:t,type:"i32",size:n}},{isStatic:!0}),e}class Am extends er{constructor(e){const t=lf({name:"batch",bits:[g1,_1(e),cf]}),r=af({name:"batch",bits:[m1,y1(e),uf]});super({glProgram:t,gpuProgram:r,resources:{batchSamplers:x1(e)}}),this.maxTextures=e}}let Vs=null;const v1=class b1 extends DC{constructor(e){super(e),this.geometry=new UC,this.name=b1.extension.name,this.vertexSize=6,Vs??(Vs=new Am(e.maxTextures)),this.shader=Vs}packAttributes(e,t,r,i,s){const o=s<<16|e.roundPixels&65535,a=e.transform,l=a.a,u=a.b,c=a.c,h=a.d,d=a.tx,f=a.ty,{positions:p,uvs:g}=e,_=e.color,m=e.attributeOffset,y=m+e.attributeSize;for(let x=m;x<y;x++){const b=x*2,S=p[b],T=p[b+1];t[i++]=l*S+c*T+d,t[i++]=h*T+u*S+f,t[i++]=g[b],t[i++]=g[b+1],r[i++]=_,r[i++]=o}}packQuadAttributes(e,t,r,i,s){const o=e.texture,a=e.transform,l=a.a,u=a.b,c=a.c,h=a.d,d=a.tx,f=a.ty,p=e.bounds,g=p.maxX,_=p.minX,m=p.maxY,y=p.minY,x=o.uvs,b=e.color,S=s<<16|e.roundPixels&65535;t[i+0]=l*_+c*y+d,t[i+1]=h*y+u*_+f,t[i+2]=x.x0,t[i+3]=x.y0,r[i+4]=b,r[i+5]=S,t[i+6]=l*g+c*y+d,t[i+7]=h*y+u*g+f,t[i+8]=x.x1,t[i+9]=x.y1,r[i+10]=b,r[i+11]=S,t[i+12]=l*g+c*m+d,t[i+13]=h*m+u*g+f,t[i+14]=x.x2,t[i+15]=x.y2,r[i+16]=b,r[i+17]=S,t[i+18]=l*_+c*m+d,t[i+19]=h*m+u*_+f,t[i+20]=x.x3,t[i+21]=x.y3,r[i+22]=b,r[i+23]=S}_updateMaxTextures(e){this.shader.maxTextures!==e&&(Vs=new Am(e),this.shader=Vs)}destroy(){this.shader=null,super.destroy()}};v1.extension={type:[k.Batcher],name:"default"};let hf=v1;class Rn{constructor(e){this.items=Object.create(null);const{renderer:t,type:r,onUnload:i,priority:s,name:o}=e;this._renderer=t,t.gc.addResourceHash(this,"items",r,s??0),this._onUnload=i,this.name=o}add(e){return this.items[e.uid]?!1:(this.items[e.uid]=e,e.once("unload",this.remove,this),e._gcLastUsed=this._renderer.gc.now,!0)}remove(e,...t){var i;if(!this.items[e.uid])return;const r=e._gpuData[this._renderer.uid];r&&((i=this._onUnload)==null||i.call(this,e,...t),r.destroy(),e._gpuData[this._renderer.uid]=null,this.items[e.uid]=null)}removeAll(...e){Object.values(this.items).forEach(t=>t&&this.remove(t,...e))}destroy(...e){this.removeAll(...e),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}function rE(n,e,t,r,i,s,o,a=null){let l=0;t*=e,i*=s;const u=a.a,c=a.b,h=a.c,d=a.d,f=a.tx,p=a.ty;for(;l<o;){const g=n[t],_=n[t+1];r[i]=u*g+h*_+f,r[i+1]=c*g+d*_+p,i+=s,t+=e,l++}}function iE(n,e,t,r){let i=0;for(e*=t;i<r;)n[e]=0,n[e+1]=0,e+=t,i++}function w1(n,e,t,r,i){const s=e.a,o=e.b,a=e.c,l=e.d,u=e.tx,c=e.ty;t||(t=0),r||(r=2),i||(i=n.length/r-t);let h=t*r;for(let d=0;d<i;d++){const f=n[h],p=n[h+1];n[h]=s*f+a*p+u,n[h+1]=o*f+l*p+c,h+=r}}const sE=new Z;class df{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const e=this.baseColor,t=e>>16|e&65280|(e&255)<<16,r=this.renderable;return r?Qi(t,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):t+(this.alpha*255<<24)}get transform(){var e;return((e=this.renderable)==null?void 0:e.groupTransform)||sE}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}const No={extension:{type:k.ShapeBuilder,name:"circle"},build(n,e){let t,r,i,s,o,a;if(n.type==="circle"){const b=n;if(o=a=b.radius,o<=0)return!1;t=b.x,r=b.y,i=s=0}else if(n.type==="ellipse"){const b=n;if(o=b.halfWidth,a=b.halfHeight,o<=0||a<=0)return!1;t=b.x,r=b.y,i=s=0}else{const b=n,S=b.width/2,T=b.height/2;t=b.x+S,r=b.y+T,o=a=Math.max(0,Math.min(b.radius,Math.min(S,T))),i=S-o,s=T-a}if(i<0||s<0)return!1;const l=Math.ceil(2.3*Math.sqrt(o+a)),u=l*8+(i?4:0)+(s?4:0);if(u===0)return!1;if(l===0)return e[0]=e[6]=t+i,e[1]=e[3]=r+s,e[2]=e[4]=t-i,e[5]=e[7]=r-s,!0;let c=0,h=l*4+(i?2:0)+2,d=h,f=u,p=i+o,g=s,_=t+p,m=t-p,y=r+g;if(e[c++]=_,e[c++]=y,e[--h]=y,e[--h]=m,s){const b=r-g;e[d++]=m,e[d++]=b,e[--f]=b,e[--f]=_}for(let b=1;b<l;b++){const S=Math.PI/2*(b/l),T=i+Math.cos(S)*o,C=s+Math.sin(S)*a,M=t+T,L=t-T,R=r+C,O=r-C;e[c++]=M,e[c++]=R,e[--h]=R,e[--h]=L,e[d++]=L,e[d++]=O,e[--f]=O,e[--f]=M}p=i,g=s+a,_=t+p,m=t-p,y=r+g;const x=r-g;return e[c++]=_,e[c++]=y,e[--f]=x,e[--f]=_,i&&(e[c++]=m,e[c++]=y,e[--f]=x,e[--f]=m),!0},triangulate(n,e,t,r,i,s){if(n.length===0)return;let o=0,a=0;for(let c=0;c<n.length;c+=2)o+=n[c],a+=n[c+1];o/=n.length/2,a/=n.length/2;let l=r;e[l*t]=o,e[l*t+1]=a;const u=l++;for(let c=0;c<n.length;c+=2)e[l*t]=n[c],e[l*t+1]=n[c+1],c>0&&(i[s++]=l,i[s++]=u,i[s++]=l-1),l++;i[s++]=u+1,i[s++]=u,i[s++]=l-1}},oE={...No,extension:{...No.extension,name:"ellipse"}},aE={...No,extension:{...No.extension,name:"roundedRectangle"}},S1=1e-4,km=1e-4;function Pm(n,e,t,r,i,s,o,a){const l=n-t*i,u=e-r*i,c=n+t*s,h=e+r*s;let d,f;o?(d=r,f=-t):(d=-r,f=t);const p=l+d,g=u+f,_=c+d,m=h+f;return a.push(p,g),a.push(_,m),2}function Fr(n,e,t,r,i,s,o,a){const l=t-n,u=r-e;let c=Math.atan2(l,u),h=Math.atan2(i-n,s-e);a&&c<h?c+=Math.PI*2:!a&&c>h&&(h+=Math.PI*2);let d=c;const f=h-c,p=Math.abs(f),g=Math.sqrt(l*l+u*u),_=(15*p*Math.sqrt(g)/Math.PI>>0)+1,m=f/_;if(d+=m,a){o.push(n,e),o.push(t,r);for(let y=1,x=d;y<_;y++,x+=m)o.push(n,e),o.push(n+Math.sin(x)*g,e+Math.cos(x)*g);o.push(n,e),o.push(i,s)}else{o.push(t,r),o.push(n,e);for(let y=1,x=d;y<_;y++,x+=m)o.push(n+Math.sin(x)*g,e+Math.cos(x)*g),o.push(n,e);o.push(i,s),o.push(n,e)}return _*2}function ff(n,e,t,r,i,s){const o=S1;if(n.length===0)return;const a=e;let l=a.alignment;if(e.alignment!==.5){let B=a1(n);l=(l-.5)*B+.5}const u=new Me(n[0],n[1]),c=new Me(n[n.length-2],n[n.length-1]),h=r,d=Math.abs(u.x-c.x)<o&&Math.abs(u.y-c.y)<o;if(h){n=n.slice(),d&&(n.pop(),n.pop(),c.set(n[n.length-2],n[n.length-1]));const B=(u.x+c.x)*.5,W=(c.y+u.y)*.5;n.unshift(B,W),n.push(B,W)}const f=i,p=n.length/2;let g=n.length;const _=f.length/2,m=a.width/2,y=m*m,x=a.miterLimit*a.miterLimit;let b=n[0],S=n[1],T=n[2],C=n[3],M=0,L=0,R=-(S-C),O=b-T,U=0,j=0,K=Math.sqrt(R*R+O*O);R/=K,O/=K,R*=m,O*=m;const Ee=l,N=(1-Ee)*2,$=Ee*2;h||(a.cap==="round"?g+=Fr(b-R*(N-$)*.5,S-O*(N-$)*.5,b-R*N,S-O*N,b+R*$,S+O*$,f,!0)+2:a.cap==="square"&&(g+=Pm(b,S,R,O,N,$,!0,f))),f.push(b-R*N,S-O*N),f.push(b+R*$,S+O*$);for(let B=1;B<p-1;++B){b=n[(B-1)*2],S=n[(B-1)*2+1],T=n[B*2],C=n[B*2+1],M=n[(B+1)*2],L=n[(B+1)*2+1],R=-(S-C),O=b-T,K=Math.sqrt(R*R+O*O),R/=K,O/=K,R*=m,O*=m,U=-(C-L),j=T-M,K=Math.sqrt(U*U+j*j),U/=K,j/=K,U*=m,j*=m;const W=T-b,J=S-C,X=T-M,ne=L-C,fe=W*X+J*ne,me=J*X-ne*W,le=me<0;if(Math.abs(me)<.001*Math.abs(fe)){f.push(T-R*N,C-O*N),f.push(T+R*$,C+O*$),fe>=0&&(a.join==="round"?g+=Fr(T,C,T-R*N,C-O*N,T-U*N,C-j*N,f,!1)+4:g+=2,f.push(T-U*$,C-j*$),f.push(T+U*N,C+j*N));continue}const ve=(-R+b)*(-O+C)-(-R+T)*(-O+S),rt=(-U+M)*(-j+C)-(-U+T)*(-j+L),ue=(W*rt-X*ve)/me,ct=(ne*ve-J*rt)/me,Mt=(ue-T)*(ue-T)+(ct-C)*(ct-C),ke=T+(ue-T)*N,qe=C+(ct-C)*N,Se=T-(ue-T)*$,it=C-(ct-C)*$,vn=Math.min(W*W+J*J,X*X+ne*ne),He=le?N:$,$t=vn+He*He*y;Mt<=$t?a.join==="bevel"||Mt/y>x?(le?(f.push(ke,qe),f.push(T+R*$,C+O*$),f.push(ke,qe),f.push(T+U*$,C+j*$)):(f.push(T-R*N,C-O*N),f.push(Se,it),f.push(T-U*N,C-j*N),f.push(Se,it)),g+=2):a.join==="round"?le?(f.push(ke,qe),f.push(T+R*$,C+O*$),g+=Fr(T,C,T+R*$,C+O*$,T+U*$,C+j*$,f,!0)+4,f.push(ke,qe),f.push(T+U*$,C+j*$)):(f.push(T-R*N,C-O*N),f.push(Se,it),g+=Fr(T,C,T-R*N,C-O*N,T-U*N,C-j*N,f,!1)+4,f.push(T-U*N,C-j*N),f.push(Se,it)):(f.push(ke,qe),f.push(Se,it)):(f.push(T-R*N,C-O*N),f.push(T+R*$,C+O*$),a.join==="round"?le?g+=Fr(T,C,T+R*$,C+O*$,T+U*$,C+j*$,f,!0)+2:g+=Fr(T,C,T-R*N,C-O*N,T-U*N,C-j*N,f,!1)+2:a.join==="miter"&&Mt/y<=x&&(le?(f.push(Se,it),f.push(Se,it)):(f.push(ke,qe),f.push(ke,qe)),g+=2),f.push(T-U*N,C-j*N),f.push(T+U*$,C+j*$),g+=2)}b=n[(p-2)*2],S=n[(p-2)*2+1],T=n[(p-1)*2],C=n[(p-1)*2+1],R=-(S-C),O=b-T,K=Math.sqrt(R*R+O*O),R/=K,O/=K,R*=m,O*=m,f.push(T-R*N,C-O*N),f.push(T+R*$,C+O*$),h||(a.cap==="round"?g+=Fr(T-R*(N-$)*.5,C-O*(N-$)*.5,T-R*N,C-O*N,T+R*$,C+O*$,f,!1)+2:a.cap==="square"&&(g+=Pm(T,C,R,O,N,$,!1,f)));const D=km*km;for(let B=_;B<g+_-2;++B)b=f[B*2],S=f[B*2+1],T=f[(B+1)*2],C=f[(B+1)*2+1],M=f[(B+2)*2],L=f[(B+2)*2+1],!(Math.abs(b*(C-L)+T*(L-S)+M*(S-C))<D)&&s.push(B,B+1,B+2)}function lE(n,e,t,r){const i=S1;if(n.length===0)return;const s=n[0],o=n[1],a=n[n.length-2],l=n[n.length-1],u=e||Math.abs(s-a)<i&&Math.abs(o-l)<i,c=t,h=n.length/2,d=c.length/2;for(let f=0;f<h;f++)c.push(n[f*2]),c.push(n[f*2+1]);for(let f=0;f<h-1;f++)r.push(d+f,d+f+1);u&&r.push(d+h-1,d)}function T1(n,e,t,r,i,s,o){const a=pC(n,e,2);if(!a)return;for(let u=0;u<a.length;u+=3)s[o++]=a[u]+i,s[o++]=a[u+1]+i,s[o++]=a[u+2]+i;let l=i*r;for(let u=0;u<n.length;u+=2)t[l]=n[u],t[l+1]=n[u+1],l+=r}const uE=[],cE={extension:{type:k.ShapeBuilder,name:"polygon"},build(n,e){for(let t=0;t<n.points.length;t++)e[t]=n.points[t];return!0},triangulate(n,e,t,r,i,s){T1(n,uE,e,t,r,i,s)}},hE={extension:{type:k.ShapeBuilder,name:"rectangle"},build(n,e){const t=n,r=t.x,i=t.y,s=t.width,o=t.height;return s>0&&o>0?(e[0]=r,e[1]=i,e[2]=r+s,e[3]=i,e[4]=r+s,e[5]=i+o,e[6]=r,e[7]=i+o,!0):!1},triangulate(n,e,t,r,i,s){let o=0;r*=t,e[r+o]=n[0],e[r+o+1]=n[1],o+=t,e[r+o]=n[2],e[r+o+1]=n[3],o+=t,e[r+o]=n[6],e[r+o+1]=n[7],o+=t,e[r+o]=n[4],e[r+o+1]=n[5],o+=t;const a=r/t;i[s++]=a,i[s++]=a+1,i[s++]=a+2,i[s++]=a+1,i[s++]=a+3,i[s++]=a+2}},dE={extension:{type:k.ShapeBuilder,name:"triangle"},build(n,e){return e[0]=n.x,e[1]=n.y,e[2]=n.x2,e[3]=n.y2,e[4]=n.x3,e[5]=n.y3,!0},triangulate(n,e,t,r,i,s){let o=0;r*=t,e[r+o]=n[0],e[r+o+1]=n[1],o+=t,e[r+o]=n[2],e[r+o+1]=n[3],o+=t,e[r+o]=n[4],e[r+o+1]=n[5];const a=r/t;i[s++]=a,i[s++]=a+1,i[s++]=a+2}},Mm=[{offset:0,color:"white"},{offset:1,color:"black"}],pf=class Oh{constructor(...e){this.uid=be("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let t=fE(e);t={...t.type==="radial"?Oh.defaultRadialOptions:Oh.defaultLinearOptions,...ax(t)},this._textureSize=t.textureSize,this._wrapMode=t.wrapMode,t.type==="radial"?(this.center=t.center,this.outerCenter=t.outerCenter??this.center,this.innerRadius=t.innerRadius,this.outerRadius=t.outerRadius,this.scale=t.scale,this.rotation=t.rotation):(this.start=t.start,this.end=t.end),this.textureSpace=t.textureSpace,this.type=t.type,t.colorStops.forEach(i=>{this.addColorStop(i.offset,i.color)})}addColorStop(e,t){return this.colorStops.push({offset:e,color:Ce.shared.setValue(t).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:t}=this.start,{x:r,y:i}=this.end,s=r-e,o=i-t;const a=s<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(s<0){const _=e;e=r,r=_,s*=-1}if(o<0){const _=t;t=i,i=_,o*=-1}}const l=this.colorStops.length?this.colorStops:Mm,u=this._textureSize,{canvas:c,context:h}=Im(u,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);Rm(d,l),h.fillStyle=d,h.fillRect(0,0,u,1),this.texture=new Q({source:new Ml({resource:c,addressMode:this._wrapMode})});const f=Math.sqrt(s*s+o*o),p=Math.atan2(o,s),g=new Z;g.scale(f/u,1),g.rotate(p),g.translate(e,t),this.textureSpace==="local"&&g.scale(u,u),this.transform=g}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const e=this.colorStops.length?this.colorStops:Mm,t=this._textureSize,{canvas:r,context:i}=Im(t,t),{x:s,y:o}=this.center,{x:a,y:l}=this.outerCenter,u=this.innerRadius,c=this.outerRadius,h=a-c,d=l-c,f=t/(c*2),p=(s-h)*f,g=(o-d)*f,_=i.createRadialGradient(p,g,u*f,(a-h)*f,(l-d)*f,c*f);Rm(_,e),i.fillStyle=e[e.length-1].color,i.fillRect(0,0,t,t),i.fillStyle=_,i.translate(p,g),i.rotate(this.rotation),i.scale(1,this.scale),i.translate(-p,-g),i.fillRect(0,0,t,t),this.texture=new Q({source:new Ml({resource:r,addressMode:this._wrapMode})});const m=new Z;this.textureSpace==="local"?m.scale(2*c,2*c):m.scale(1/f,1/f),m.translate(h,d),this.transform=m}destroy(){var e;(e=this.texture)==null||e.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};pf.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};pf.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,rotation:0,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let Mn=pf;function Rm(n,e){for(let t=0;t<e.length;t++){const r=e[t];n.addColorStop(r.offset,r.color)}}function Im(n,e){const t=pe.get().createCanvas(n,e),r=t.getContext("2d");return{canvas:t,context:r}}function fE(n){let e=n[0]??{};return(typeof e=="number"||n[1])&&(ie("8.5.2","use options object instead"),e={type:"linear",start:{x:n[0],y:n[1]},end:{x:n[2],y:n[3]},textureSpace:n[4],textureSize:n[5]??Mn.defaultLinearOptions.textureSize}),e}const pE=new Z,mE=new xe,gE=new Z;function C1(n,e,t,r){const i=e.matrix?n.copyFrom(e.matrix).invert():n.identity();if(e.textureSpace==="local"){const o=t.getBounds(mE);e.width&&o.pad(e.width);const{x:a,y:l}=o,u=1/o.width,c=1/o.height,h=-a*u,d=-l*c,f=i.a,p=i.b,g=i.c,_=i.d;i.a*=u,i.b*=u,i.c*=c,i.d*=c,i.tx=h*f+d*g+i.tx,i.ty=h*p+d*_+i.ty}else if(e.texture.rotate){const{uvs:o,orig:a}=e.texture;i.scale(1/a.width,1/a.height),i.prepend(gE.set(o.x1-o.x0,o.y1-o.y0,o.x3-o.x0,o.y3-o.y0,o.x0,o.y0))}else i.translate(e.texture.frame.x,e.texture.frame.y),i.scale(1/e.texture.source.width,1/e.texture.source.height);const s=e.texture.source.style;return!(e.fill instanceof Mn)&&s.addressMode==="clamp-to-edge"&&(s.addressMode="repeat",s.update()),r&&i.append(pE.copyFrom(r).invert()),i}const ys={};ae.handleByMap(k.ShapeBuilder,ys);ae.add(hE,cE,dE,No,oE,aE);const yE=new xe,_E=new Z;function xE(n,e){const{geometryData:t,batches:r}=e;r.length=0,t.indices.length=0,t.vertices.length=0,t.uvs.length=0;for(let i=0;i<n.instructions.length;i++){const s=n.instructions[i];if(s.action==="texture")vE(s.data,r,t);else if(s.action==="fill"||s.action==="stroke"){const o=s.action==="stroke",a=s.data.path.shapePath,l=s.data.style,u=s.data.hole;o&&u&&Bm(u.shapePath,l,!0,r,t),u&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=u.shapePath.shapePrimitives),Bm(a,l,o,r,t)}}}function vE(n,e,t){const r=[],i=ys.rectangle,s=yE;s.x=n.dx,s.y=n.dy,s.width=n.dw,s.height=n.dh;const o=n.transform;if(!i.build(s,r))return;const{vertices:a,uvs:l,indices:u}=t,c=u.length,h=a.length/2;o&&w1(r,o),i.triangulate(r,a,2,h,u,c);const d=n.image,f=d.uvs;l.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);const p=ut.get(df);p.indexOffset=c,p.indexSize=u.length-c,p.attributeOffset=h,p.attributeSize=a.length/2-h,p.baseColor=n.style,p.alpha=n.alpha,p.texture=d,p.geometryData=t,e.push(p)}function Bm(n,e,t,r,i){const{vertices:s,uvs:o,indices:a}=i;n.shapePrimitives.forEach(({shape:l,transform:u,holes:c})=>{const h=[],d=ys[l.type];if(!d.build(l,h))return;const f=a.length,p=s.length/2;let g="triangle-list";if(u&&w1(h,u),t){const x=l.closePath??!0,b=e;b.pixelLine?(lE(h,x,s,a),g="line-list"):ff(h,b,!1,x,s,a)}else if(c){const x=[],b=h.slice();bE(c).forEach(T=>{x.push(b.length/2),b.push(...T)}),T1(b,x,s,2,p,a,f)}else d.triangulate(h,s,2,p,a,f);const _=o.length/2,m=e.texture;if(m!==Q.WHITE){const x=C1(_E,e,l,u);rE(s,2,p,o,_,2,s.length/2-p,x)}else iE(o,_,2,s.length/2-p);const y=ut.get(df);y.indexOffset=f,y.indexSize=a.length-f,y.attributeOffset=p,y.attributeSize=s.length/2-p,y.baseColor=e.color,y.alpha=e.alpha,y.texture=m,y.geometryData=i,y.topology=g,r.push(y)})}function bE(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t].shape,i=[];ys[r.type].build(r,i)&&e.push(i)}return e}class wE{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(e=>{ut.return(e)}),this.graphicsData&&ut.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class SE{constructor(){this.instructions=new Zd}init(e){const t=e.maxTextures;this.batcher?this.batcher._updateMaxTextures(t):this.batcher=new hf({maxTextures:t}),this.instructions.reset()}get geometry(){return ie(P2,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const mf=class Lh{constructor(e){this._renderer=e,this._managedContexts=new Rn({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Lh.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Lh.defaultOptions.bezierSmoothness}getContextRenderData(e){return e._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const t=!!e._gpuData[this._renderer.uid],r=e._gpuData[this._renderer.uid]||this._initContext(e);if(e.dirty||!t){t&&r.reset(),xE(e,r);const i=e.batchMode;e.customShader||i==="no-batch"?r.isBatchable=!1:i==="auto"?r.isBatchable=r.geometryData.vertices.length<400:r.isBatchable=!0,e.dirty=!1}return r}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const t=ut.get(SE,{maxTextures:this._renderer.limits.maxBatchableTextures}),r=e._gpuData[this._renderer.uid],{batches:i,geometryData:s}=r;r.graphicsData=t;const o=s.vertices.length,a=s.indices.length;for(let h=0;h<i.length;h++)i[h].applyTransform=!1;const l=t.batcher;l.ensureAttributeBuffer(o),l.ensureIndexBuffer(a),l.begin();for(let h=0;h<i.length;h++){const d=i[h];l.add(d)}l.finish(t.instructions);const u=l.geometry;u.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),u.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);const c=l.batches;for(let h=0;h<c.length;h++){const d=c[h];d.bindGroup=of(d.textures.textures,d.textures.count,this._renderer.limits.maxBatchableTextures)}return t}_initContext(e){const t=new wE;return t.context=e,e._gpuData[this._renderer.uid]=t,this._managedContexts.add(e),t}destroy(){this._managedContexts.destroy(),this._renderer=null}};mf.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"graphicsContext"};mf.defaultOptions={bezierSmoothness:.5};let gf=mf;const TE=8,Ia=11920929e-14,CE=1;function E1(n,e,t,r,i,s,o,a,l,u){const h=Math.min(.99,Math.max(0,u??gf.defaultOptions.bezierSmoothness));let d=(CE-h)/1;return d*=d,EE(e,t,r,i,s,o,a,l,n,d),n}function EE(n,e,t,r,i,s,o,a,l,u){Uh(n,e,t,r,i,s,o,a,l,u,0),l.push(o,a)}function Uh(n,e,t,r,i,s,o,a,l,u,c){if(c>TE)return;const h=(n+t)/2,d=(e+r)/2,f=(t+i)/2,p=(r+s)/2,g=(i+o)/2,_=(s+a)/2,m=(h+f)/2,y=(d+p)/2,x=(f+g)/2,b=(p+_)/2,S=(m+x)/2,T=(y+b)/2;if(c>0){let C=o-n,M=a-e;const L=Math.abs((t-o)*M-(r-a)*C),R=Math.abs((i-o)*M-(s-a)*C);if(L>Ia&&R>Ia){if((L+R)*(L+R)<=u*(C*C+M*M)){l.push(S,T);return}}else if(L>Ia){if(L*L<=u*(C*C+M*M)){l.push(S,T);return}}else if(R>Ia){if(R*R<=u*(C*C+M*M)){l.push(S,T);return}}else if(C=S-(n+o)/2,M=T-(e+a)/2,C*C+M*M<=u){l.push(S,T);return}}Uh(n,e,h,d,m,y,S,T,l,u,c+1),Uh(S,T,x,b,g,_,o,a,l,u,c+1)}const AE=8,kE=11920929e-14,PE=1;function ME(n,e,t,r,i,s,o,a){const u=Math.min(.99,Math.max(0,a??gf.defaultOptions.bezierSmoothness));let c=(PE-u)/1;return c*=c,RE(e,t,r,i,s,o,n,c),n}function RE(n,e,t,r,i,s,o,a){Nh(o,n,e,t,r,i,s,a,0),o.push(i,s)}function Nh(n,e,t,r,i,s,o,a,l){if(l>AE)return;const u=(e+r)/2,c=(t+i)/2,h=(r+s)/2,d=(i+o)/2,f=(u+h)/2,p=(c+d)/2;let g=s-e,_=o-t;const m=Math.abs((r-s)*_-(i-o)*g);if(m>kE){if(m*m<=a*(g*g+_*_)){n.push(f,p);return}}else if(g=f-(e+s)/2,_=p-(t+o)/2,g*g+_*_<=a){n.push(f,p);return}Nh(n,e,t,u,c,f,p,a,l+1),Nh(n,f,p,h,d,s,o,a,l+1)}function A1(n,e,t,r,i,s,o,a){let l=Math.abs(i-s);(!o&&i>s||o&&s>i)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI)))),a=Math.max(a,3);let u=l/a,c=i;u*=o?-1:1;for(let h=0;h<a+1;h++){const d=Math.cos(c),f=Math.sin(c),p=e+d*r,g=t+f*r;n.push(p,g),c+=u}}function IE(n,e,t,r,i,s){const o=n[n.length-2],l=n[n.length-1]-t,u=o-e,c=i-t,h=r-e,d=Math.abs(l*h-u*c);if(d<1e-8||s===0){(n[n.length-2]!==e||n[n.length-1]!==t)&&n.push(e,t);return}const f=l*l+u*u,p=c*c+h*h,g=l*c+u*h,_=s*Math.sqrt(f)/d,m=s*Math.sqrt(p)/d,y=_*g/f,x=m*g/p,b=_*h+m*u,S=_*c+m*l,T=u*(m+y),C=l*(m+y),M=h*(_+x),L=c*(_+x),R=Math.atan2(C-S,T-b),O=Math.atan2(L-S,M-b);A1(n,b+e,S+t,s,R,O,u*c>h*l)}const po=Math.PI*2,yc={centerX:0,centerY:0,ang1:0,ang2:0},_c=({x:n,y:e},t,r,i,s,o,a,l)=>{n*=t,e*=r;const u=i*n-s*e,c=s*n+i*e;return l.x=u+o,l.y=c+a,l};function BE(n,e){const t=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=e===1.5707963267948966?.551915024494:t,i=Math.cos(n),s=Math.sin(n),o=Math.cos(n+e),a=Math.sin(n+e);return[{x:i-s*r,y:s+i*r},{x:o+a*r,y:a-o*r},{x:o,y:a}]}const Dm=(n,e,t,r)=>{const i=n*r-e*t<0?-1:1;let s=n*t+e*r;return s>1&&(s=1),s<-1&&(s=-1),i*Math.acos(s)},DE=(n,e,t,r,i,s,o,a,l,u,c,h,d)=>{const f=Math.pow(i,2),p=Math.pow(s,2),g=Math.pow(c,2),_=Math.pow(h,2);let m=f*p-f*_-p*g;m<0&&(m=0),m/=f*_+p*g,m=Math.sqrt(m)*(o===a?-1:1);const y=m*i/s*h,x=m*-s/i*c,b=u*y-l*x+(n+t)/2,S=l*y+u*x+(e+r)/2,T=(c-y)/i,C=(h-x)/s,M=(-c-y)/i,L=(-h-x)/s,R=Dm(1,0,T,C);let O=Dm(T,C,M,L);a===0&&O>0&&(O-=po),a===1&&O<0&&(O+=po),d.centerX=b,d.centerY=S,d.ang1=R,d.ang2=O};function FE(n,e,t,r,i,s,o,a=0,l=0,u=0){if(s===0||o===0)return;const c=Math.sin(a*po/360),h=Math.cos(a*po/360),d=h*(e-r)/2+c*(t-i)/2,f=-c*(e-r)/2+h*(t-i)/2;if(d===0&&f===0)return;s=Math.abs(s),o=Math.abs(o);const p=Math.pow(d,2)/Math.pow(s,2)+Math.pow(f,2)/Math.pow(o,2);p>1&&(s*=Math.sqrt(p),o*=Math.sqrt(p)),DE(e,t,r,i,s,o,l,u,c,h,d,f,yc);let{ang1:g,ang2:_}=yc;const{centerX:m,centerY:y}=yc;let x=Math.abs(_)/(po/4);Math.abs(1-x)<1e-7&&(x=1);const b=Math.max(Math.ceil(x),1);_/=b;let S=n[n.length-2],T=n[n.length-1];const C={x:0,y:0};for(let M=0;M<b;M++){const L=BE(g,_),{x:R,y:O}=_c(L[0],s,o,h,c,m,y,C),{x:U,y:j}=_c(L[1],s,o,h,c,m,y,C),{x:K,y:Ee}=_c(L[2],s,o,h,c,m,y,C);E1(n,S,T,R,O,U,j,K,Ee),S=K,T=Ee,g+=_}}function GE(n,e,t){const r=(o,a)=>{const l=a.x-o.x,u=a.y-o.y,c=Math.sqrt(l*l+u*u),h=l/c,d=u/c;return{len:c,nx:h,ny:d}},i=(o,a)=>{o===0?n.moveTo(a.x,a.y):n.lineTo(a.x,a.y)};let s=e[e.length-1];for(let o=0;o<e.length;o++){const a=e[o%e.length],l=a.radius??t;if(l<=0){i(o,a),s=a;continue}const u=e[(o+1)%e.length],c=r(a,s),h=r(a,u);if(c.len<1e-4||h.len<1e-4){i(o,a),s=a;continue}let d=Math.asin(c.nx*h.ny-c.ny*h.nx),f=1,p=!1;c.nx*h.nx-c.ny*-h.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);const g=d/2;let _,m=Math.abs(Math.cos(g)*l/Math.sin(g));m>Math.min(c.len/2,h.len/2)?(m=Math.min(c.len/2,h.len/2),_=Math.abs(m*Math.sin(g)/Math.cos(g))):_=l;const y=a.x+h.nx*m+-h.ny*_*f,x=a.y+h.ny*m+h.nx*_*f,b=Math.atan2(c.ny,c.nx)+Math.PI/2*f,S=Math.atan2(h.ny,h.nx)-Math.PI/2*f;o===0&&n.moveTo(y+Math.cos(b)*_,x+Math.sin(b)*_),n.arc(y,x,_,b,S,p),s=a}}function OE(n,e,t,r){const i=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),s=(a,l,u)=>({x:a.x+(l.x-a.x)*u,y:a.y+(l.y-a.y)*u}),o=e.length;for(let a=0;a<o;a++){const l=e[(a+1)%o],u=l.radius??t;if(u<=0){a===0?n.moveTo(l.x,l.y):n.lineTo(l.x,l.y);continue}const c=e[a],h=e[(a+2)%o],d=i(c,l);let f;if(d<1e-4)f=l;else{const _=Math.min(d/2,u);f=s(l,c,_/d)}const p=i(h,l);let g;if(p<1e-4)g=l;else{const _=Math.min(p/2,u);g=s(l,h,_/p)}a===0?n.moveTo(f.x,f.y):n.lineTo(f.x,f.y),n.quadraticCurveTo(l.x,l.y,g.x,g.y,r)}}const LE=new xe;class UE{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new gt,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();const r=this._currentPoly.points,i=r[r.length-2],s=r[r.length-1];return(i!==e||s!==t)&&r.push(e,t),this}arc(e,t,r,i,s,o){this._ensurePoly(!1);const a=this._currentPoly.points;return A1(a,e,t,r,i,s,o),this}arcTo(e,t,r,i,s){this._ensurePoly();const o=this._currentPoly.points;return IE(o,e,t,r,i,s),this}arcToSvg(e,t,r,i,s,o,a){const l=this._currentPoly.points;return FE(l,this._currentPoly.lastX,this._currentPoly.lastY,o,a,e,t,r,i,s),this}bezierCurveTo(e,t,r,i,s,o,a){this._ensurePoly();const l=this._currentPoly;return E1(this._currentPoly.points,l.lastX,l.lastY,e,t,r,i,s,o,a),this}quadraticCurveTo(e,t,r,i,s){this._ensurePoly();const o=this._currentPoly;return ME(this._currentPoly.points,o.lastX,o.lastY,e,t,r,i,s),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));const r=this.shapePrimitives,i=r.length;for(let s=0;s<e.instructions.length;s++){const o=e.instructions[s];this[o.action](...o.data)}if(e.checkForHoles&&r.length-i>1){let s=null;for(let o=i;o<r.length;o++){const a=r[o];if(a.shape.type==="polygon"){const l=a.shape,u=s==null?void 0:s.shape;u&&u.containsPolygon(l)?(s.holes||(s.holes=[]),s.holes.push(a),r.copyWithin(o,o+1),r.length--,o--):s=a}}}return this}finish(e=!1){this.endPoly(e)}rect(e,t,r,i,s){return this.drawShape(new xe(e,t,r,i),s),this}circle(e,t,r,i){return this.drawShape(new nf(e,t,r),i),this}poly(e,t,r){const i=new ho(e);return i.closePath=t,this.drawShape(i,r),this}regularPoly(e,t,r,i,s=0,o){i=Math.max(i|0,3);const a=-1*Math.PI/2+s,l=Math.PI*2/i,u=[];for(let c=0;c<i;c++){const h=a-c*l;u.push(e+r*Math.cos(h),t+r*Math.sin(h))}return this.poly(u,!0,o),this}roundPoly(e,t,r,i,s,o=0,a){if(i=Math.max(i|0,3),s<=0)return this.regularPoly(e,t,r,i,o);const l=r*Math.sin(Math.PI/i)-.001;s=Math.min(s,l);const u=-1*Math.PI/2+o,c=Math.PI*2/i,h=(i-2)*Math.PI/i/2;for(let d=0;d<i;d++){const f=d*c+u,p=e+r*Math.cos(f),g=t+r*Math.sin(f),_=f+Math.PI+h,m=f-Math.PI-h,y=p+s*Math.cos(_),x=g+s*Math.sin(_),b=p+s*Math.cos(m),S=g+s*Math.sin(m);d===0?this.moveTo(y,x):this.lineTo(y,x),this.quadraticCurveTo(p,g,b,S,a)}return this.closePath()}roundShape(e,t,r=!1,i){return e.length<3?this:(r?OE(this,e,t,i):GE(this,e,t),this.closePath())}filletRect(e,t,r,i,s){if(s===0)return this.rect(e,t,r,i);const o=Math.min(r,i)/2,a=Math.min(o,Math.max(-o,s)),l=e+r,u=t+i,c=a<0?-a:0,h=Math.abs(a);return this.moveTo(e,t+h).arcTo(e+c,t+c,e+h,t,h).lineTo(l-h,t).arcTo(l-c,t+c,l,t+h,h).lineTo(l,u-h).arcTo(l-c,u-c,e+r-h,u,h).lineTo(e+h,u).arcTo(e+c,u-c,e,u-h,h).closePath()}chamferRect(e,t,r,i,s,o){if(s<=0)return this.rect(e,t,r,i);const a=Math.min(s,Math.min(r,i)/2),l=e+r,u=t+i,c=[e+a,t,l-a,t,l,t+a,l,u-a,l-a,u,e+a,u,e,u-a,e,t+a];for(let h=c.length-1;h>=2;h-=2)c[h]===c[h-2]&&c[h-1]===c[h-3]&&c.splice(h-1,2);return this.poly(c,!0,o)}ellipse(e,t,r,i,s){return this.drawShape(new rf(e,t,r,i),s),this}roundRect(e,t,r,i,s,o){return this.drawShape(new sf(e,t,r,i,s),o),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let r=this._currentPoly;return r&&this.endPoly(),r=new ho,r.points.push(e,t),this._currentPoly=r,this}endPoly(e=!1){const t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new ho,e)){const t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let r=t.shape.x,i=t.shape.y;if(t.transform&&!t.transform.isIdentity()){const s=t.transform,o=r;r=s.a*r+s.c*i+s.tx,i=s.b*o+s.d*i+s.ty}this._currentPoly.points.push(r,i)}else this._currentPoly.points.push(0,0)}}buildPath(){const e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let t=0;t<e.instructions.length;t++){const r=e.instructions[t];this[r.action](...r.data)}this.finish()}get bounds(){const e=this._bounds;e.clear();const t=this.shapePrimitives;for(let r=0;r<t.length;r++){const i=t[r],s=i.shape.getBounds(LE);i.transform?e.addRect(s,i.transform):e.addRect(s)}return e}}class jn{constructor(e,t=!1){this.instructions=[],this.uid=be("graphicsPath"),this._dirty=!0,this.checkForHoles=t,typeof e=="string"?SC(e,this):this.instructions=(e==null?void 0:e.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new UE(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,t){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,t]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,t,r,i,s){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(Me.shared);let l=0,u=0;if(!o||o.action!=="bezierCurveTo")l=a.x,u=a.y;else{l=o.data[2],u=o.data[3];const c=a.x,h=a.y;l=c+(c-l),u=h+(h-u)}return this.instructions.push({action:"bezierCurveTo",data:[l,u,e,t,r,i,s]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,t,r){const i=this.instructions[this.instructions.length-1],s=this.getLastPoint(Me.shared);let o=0,a=0;if(!i||i.action!=="quadraticCurveTo")o=s.x,a=s.y;else{o=i.data[0],a=i.data[1];const l=s.x,u=s.y;o=l+(l-o),a=u+(u-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,e,t,r]}),this._dirty=!0,this}rect(e,t,r,i,s){return this.instructions.push({action:"rect",data:[e,t,r,i,s]}),this._dirty=!0,this}circle(e,t,r,i){return this.instructions.push({action:"circle",data:[e,t,r,i]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,t,r,i,s,o,a){s||(s=i/2);const l=-1*Math.PI/2+o,u=r*2,c=Math.PI*2/u,h=[];for(let d=0;d<u;d++){const f=d%2?s:i,p=d*c+l;h.push(e+f*Math.cos(p),t+f*Math.sin(p))}return this.poly(h,!0,a),this}clone(e=!1){const t=new jn;if(t.checkForHoles=this.checkForHoles,!e)t.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){const i=this.instructions[r];t.instructions.push({action:i.action,data:i.data.slice()})}return t}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;const t=e.a,r=e.b,i=e.c,s=e.d,o=e.tx,a=e.ty;let l=0,u=0,c=0,h=0,d=0,f=0,p=0,g=0;for(let _=0;_<this.instructions.length;_++){const m=this.instructions[_],y=m.data;switch(m.action){case"moveTo":case"lineTo":l=y[0],u=y[1],y[0]=t*l+i*u+o,y[1]=r*l+s*u+a;break;case"bezierCurveTo":c=y[0],h=y[1],d=y[2],f=y[3],l=y[4],u=y[5],y[0]=t*c+i*h+o,y[1]=r*c+s*h+a,y[2]=t*d+i*f+o,y[3]=r*d+s*f+a,y[4]=t*l+i*u+o,y[5]=r*l+s*u+a;break;case"quadraticCurveTo":c=y[0],h=y[1],l=y[2],u=y[3],y[0]=t*c+i*h+o,y[1]=r*c+s*h+a,y[2]=t*l+i*u+o,y[3]=r*l+s*u+a;break;case"arcToSvg":l=y[5],u=y[6],p=y[0],g=y[1],y[0]=t*p+i*g,y[1]=r*p+s*g,y[5]=t*l+i*u+o,y[6]=r*l+s*u+a;break;case"circle":y[4]=vi(y[3],e);break;case"rect":y[4]=vi(y[4],e);break;case"ellipse":y[8]=vi(y[8],e);break;case"roundRect":y[5]=vi(y[5],e);break;case"addPath":y[0].transform(e);break;case"poly":y[2]=vi(y[2],e);break;case"regularPoly":case"chamferRect":y[5]=vi(y[5],e);break;case"closePath":break;default:se("unknown transform action",m.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let t=this.instructions.length-1,r=this.instructions[t];if(!r)return e.x=0,e.y=0,e;for(;r.action==="closePath";){if(t--,t<0)return e.x=0,e.y=0,e;r=this.instructions[t]}switch(r.action){case"moveTo":case"lineTo":e.x=r.data[0],e.y=r.data[1];break;case"quadraticCurveTo":e.x=r.data[2],e.y=r.data[3];break;case"bezierCurveTo":e.x=r.data[4],e.y=r.data[5];break;case"arc":case"arcToSvg":e.x=r.data[5],e.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(e);break}return e}}function vi(n,e){return n?n.prepend(e):e.clone()}function st(n,e,t){const r=n.getAttribute(e);return r?Number(r):t}function NE(n,e){const t=n.querySelectorAll("defs");for(let r=0;r<t.length;r++){const i=t[r];for(let s=0;s<i.children.length;s++){const o=i.children[s];switch(o.nodeName.toLowerCase()){case"lineargradient":e.defs[o.id]=zE(o);break;case"radialgradient":e.defs[o.id]=WE(o);break}}}}function fn(n,e,t){const r=n.getAttribute(e);if(r!=null&&r.trim().endsWith("%")){const i=Number(r.trim().slice(0,-1));return Number.isNaN(i)?t:i/100}return st(n,e,t)}function k1(n){return(n.getAttribute("gradientUnits")||"objectBoundingBox")==="objectBoundingBox"?"local":"global"}function P1(n){const e=[];for(let t=0;t<n.children.length;t++){const r=n.children[t],i=fn(r,"offset",0),s=Ce.shared.setValue(r.getAttribute("stop-color")).toNumber();e.push({offset:i,color:s})}return e}function zE(n){const e=fn(n,"x1",0),t=fn(n,"y1",0),r=fn(n,"x2",1),i=fn(n,"y2",0);return new Mn({type:"linear",start:{x:e,y:t},end:{x:r,y:i},textureSpace:k1(n),colorStops:P1(n)})}function WE(n){const e=fn(n,"cx",.5),t=fn(n,"cy",.5),r=fn(n,"r",.5),i=fn(n,"fx",e),s=fn(n,"fy",t),o=fn(n,"fr",0);return new Mn({type:"radial",center:{x:i,y:s},innerRadius:o,outerCenter:{x:e,y:t},outerRadius:r,textureSpace:k1(n),colorStops:P1(n)})}function Fm(n){const e=n.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const Gm={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};function M1(n,e){const t=n.getAttribute("style"),r={},i={},s={strokeStyle:r,fillStyle:i,useFill:!1,useStroke:!1};for(const o in Gm){const a=n.getAttribute(o);a&&Om(e,s,o,a.trim())}if(t){const o=t.split(";");for(let a=0;a<o.length;a++){const l=o[a].trim(),[u,c]=l.split(":");Gm[u]&&Om(e,s,u,c.trim())}}return{strokeStyle:s.useStroke?r:null,fillStyle:s.useFill?i:null,useFill:s.useFill,useStroke:s.useStroke}}function Om(n,e,t,r){switch(t){case"stroke":if(r!=="none"){if(r.startsWith("url(")){const i=Fm(r);e.strokeStyle.fill=n.defs[i]}else e.strokeStyle.color=Ce.shared.setValue(r).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){const i=Fm(r);e.fillStyle.fill=n.defs[i]}else e.fillStyle.color=Ce.shared.setValue(r).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(r);break;case"stroke-opacity":e.strokeStyle.alpha=Number(r);break;case"opacity":e.fillStyle.alpha=Number(r),e.strokeStyle.alpha=Number(r);break}}function HE(n){if(n.length<=2)return!0;const e=n.map(a=>a.area).sort((a,l)=>l-a),[t,r]=e,i=e[e.length-1],s=t/r,o=r/i;return!(s>3&&o<2)}function VE(n){return n.split(/(?=[Mm])/).filter(r=>r.trim().length>0)}function jE(n){const e=n.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!e||e.length<4)return 0;const t=e.map(Number),r=[],i=[];for(let c=0;c<t.length;c+=2)c+1<t.length&&(r.push(t[c]),i.push(t[c+1]));if(r.length===0||i.length===0)return 0;const s=Math.min(...r),o=Math.max(...r),a=Math.min(...i),l=Math.max(...i);return(o-s)*(l-a)}function Lm(n,e){const t=new jn(n,!1);for(const r of t.instructions)e.instructions.push(r)}function $E(n,e){if(typeof n=="string"){const o=document.createElement("div");o.innerHTML=n.trim(),n=o.querySelector("svg")}const t={context:e,defs:{},path:new jn};NE(n,t);const r=n.children,{fillStyle:i,strokeStyle:s}=M1(n,t);for(let o=0;o<r.length;o++){const a=r[o];a.nodeName.toLowerCase()!=="defs"&&R1(a,t,i,s)}return e}function R1(n,e,t,r){const i=n.children,{fillStyle:s,strokeStyle:o}=M1(n,e);s&&t?t={...t,...s}:s&&(t=s),o&&r?r={...r,...o}:o&&(r=o);const a=!t&&!r;a&&(t={color:0});let l,u,c,h,d,f,p,g,_,m,y,x,b,S,T,C,M;switch(n.nodeName.toLowerCase()){case"path":{S=n.getAttribute("d");const L=n.getAttribute("fill-rule"),R=VE(S),O=L==="evenodd",U=R.length>1;if(O&&U){const K=R.map(N=>({path:N,area:jE(N)}));if(K.sort((N,$)=>$.area-N.area),R.length>3||!HE(K))for(let N=0;N<K.length;N++){const $=K[N],D=N===0;e.context.beginPath();const B=new jn(void 0,!0);Lm($.path,B),e.context.path(B),D?(t&&e.context.fill(t),r&&e.context.stroke(r)):e.context.cut()}else for(let N=0;N<K.length;N++){const $=K[N],D=N%2===1;e.context.beginPath();const B=new jn(void 0,!0);Lm($.path,B),e.context.path(B),D?e.context.cut():(t&&e.context.fill(t),r&&e.context.stroke(r))}}else{const K=L?L==="evenodd":!0;T=new jn(S,K),e.context.path(T),t&&e.context.fill(t),r&&e.context.stroke(r)}break}case"circle":p=st(n,"cx",0),g=st(n,"cy",0),_=st(n,"r",0),e.context.ellipse(p,g,_,_),t&&e.context.fill(t),r&&e.context.stroke(r);break;case"rect":l=st(n,"x",0),u=st(n,"y",0),C=st(n,"width",0),M=st(n,"height",0),m=st(n,"rx",0),y=st(n,"ry",0),m||y?e.context.roundRect(l,u,C,M,m||y):e.context.rect(l,u,C,M),t&&e.context.fill(t),r&&e.context.stroke(r);break;case"ellipse":p=st(n,"cx",0),g=st(n,"cy",0),m=st(n,"rx",0),y=st(n,"ry",0),e.context.beginPath(),e.context.ellipse(p,g,m,y),t&&e.context.fill(t),r&&e.context.stroke(r);break;case"line":c=st(n,"x1",0),h=st(n,"y1",0),d=st(n,"x2",0),f=st(n,"y2",0),e.context.beginPath(),e.context.moveTo(c,h),e.context.lineTo(d,f),r&&e.context.stroke(r);break;case"polygon":b=n.getAttribute("points"),x=b.match(/-?\d+/g).map(L=>parseInt(L,10)),e.context.poly(x,!0),t&&e.context.fill(t),r&&e.context.stroke(r);break;case"polyline":b=n.getAttribute("points"),x=b.match(/-?\d+/g).map(L=>parseInt(L,10)),e.context.poly(x,!1),r&&e.context.stroke(r);break;case"g":case"svg":break;default:{se(`[SVG parser] <${n.nodeName}> elements unsupported`);break}}a&&(t=null);for(let L=0;L<i.length;L++)R1(i[L],e,t,r)}function XE(n){return n.texture!==void 0}const Um={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class Xo{constructor(e,t){this.uid=be("fillPattern"),this._tick=0,this.transform=new Z;const r=XE(e)?e:{texture:e,repetition:t};this.texture=r.texture,this.textureSpace=r.textureSpace??"global";const i=r.repetition;i&&(this.texture.source.style.addressModeU=Um[i].addressModeU,this.texture.source.style.addressModeV=Um[i].addressModeV)}setTransform(e){if(e){if(this.transform.equals(e))return;this.transform.copyFrom(e)}else{if(this.transform.isIdentity())return;this.transform.identity()}this._tick++}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture=e,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}function YE(n){return Ce.isColorLike(n)}function Nm(n){return n instanceof Xo}function zm(n){return n instanceof Mn}function KE(n){return n instanceof Q}function qE(n,e,t){const r=Ce.shared.setValue(e??0);return n.color=r.toNumber(),n.alpha=r.alpha===1?t.alpha:r.alpha,n.texture=Q.WHITE,{...t,...n}}function QE(n,e,t){return n.texture=e,{...t,...n}}function Wm(n,e,t){return n.fill=e,n.color=16777215,n.texture=e.texture,n.matrix=e.transform,n.textureSpace=e.textureSpace,{...t,...n}}function Hm(n,e,t){return e.buildGradient(),n.fill=e,n.color=16777215,n.texture=e.texture,n.matrix=e.transform,n.textureSpace=e.textureSpace,{...t,...n}}function ZE(n,e){const t={...e,...n},r=Ce.shared.setValue(t.color);return t.alpha*=r.alpha,t.color=r.toNumber(),t}function Kr(n,e){if(n==null)return null;const t={},r=n;return YE(n)?qE(t,n,e):KE(n)?QE(t,n,e):Nm(n)?Wm(t,n,e):zm(n)?Hm(t,n,e):r.fill&&Nm(r.fill)?Wm(r,r.fill,e):r.fill&&zm(r.fill)?Hm(r,r.fill,e):ZE(r,e)}function Fl(n,e){const{width:t,alignment:r,miterLimit:i,cap:s,join:o,pixelLine:a,...l}=e,u=Kr(n,l);return u?{width:t,alignment:r,miterLimit:i,cap:s,join:o,pixelLine:a,...u}:null}function JE(n,e){let t=1;const r=n.shapePath.shapePrimitives;for(let i=0;i<r.length;i++){const s=r[i].shape;if(s.type!=="polygon")continue;const o=s.points,a=o.length;if(a<6)continue;const l=s.closePath;for(let u=0;u<a;u+=2){if(!l&&(u===0||u===a-2))continue;const c=(u-2+a)%a,h=(u+2)%a,d=o[c],f=o[c+1],p=o[u],g=o[u+1],_=o[h],m=o[h+1],y=d-p,x=f-g,b=_-p,S=m-g,T=y*y+x*x,C=b*b+S*S;if(T<1e-12||C<1e-12)continue;let R=(y*b+x*S)/Math.sqrt(T*C);R<-1?R=-1:R>1&&(R=1);const O=Math.sqrt((1-R)*.5);if(O<1e-6)continue;const U=Math.min(1/O,e);U>t&&(t=U)}}return t}const eA=new Me,Vm=new Z,yf=class Sn extends Ot{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=be("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new jn,this._transform=new Z,this._fillStyle={...Sn.defaultFillStyle},this._strokeStyle={...Sn.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new gt,this._boundsDirty=!0}clone(){const e=new Sn;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=Kr(e,Sn.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Fl(e,Sn.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=Kr(e,Sn.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=Kr(e,Sn.defaultStrokeStyle),this}texture(e,t,r,i,s,o){return this.instructions.push({action:"texture",data:{image:e,dx:r||0,dy:i||0,dw:s||e.frame.width,dh:o||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:t||t===0?Ce.shared.setValue(t).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new jn,this}fill(e,t){let r;const i=this.instructions[this.instructions.length-1];return this._tick===0&&(i==null?void 0:i.action)==="stroke"?r=i.data.path:r=this._activePath.clone(),r?(e!=null&&(t!==void 0&&typeof e=="number"&&(ie(Ge,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:t}),this._fillStyle=Kr(e,Sn.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:e,y:t}=this._activePath.getLastPoint(Me.shared);this._activePath.clear(),this._activePath.moveTo(e,t)}stroke(e){let t;const r=this.instructions[this.instructions.length-1];return this._tick===0&&(r==null?void 0:r.action)==="fill"?t=r.data.path:t=this._activePath.clone(),t?(e!=null&&(this._strokeStyle=Fl(e,Sn.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:t}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){const t=this.instructions[this.instructions.length-1-e],r=this._activePath.clone();if(t&&(t.action==="stroke"||t.action==="fill"))if(t.data.hole)t.data.hole.addPath(r);else{t.data.hole=r;break}}return this._initNextPathLocation(),this}arc(e,t,r,i,s,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*e+a.c*t+a.tx,a.b*e+a.d*t+a.ty,r,i,s,o),this}arcTo(e,t,r,i,s){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*e+o.c*t+o.tx,o.b*e+o.d*t+o.ty,o.a*r+o.c*i+o.tx,o.b*r+o.d*i+o.ty,s),this}arcToSvg(e,t,r,i,s,o,a){this._tick++;const l=this._transform;return this._activePath.arcToSvg(e,t,r,i,s,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(e,t,r,i,s,o,a){this._tick++;const l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*t+l.tx,l.b*e+l.d*t+l.ty,l.a*r+l.c*i+l.tx,l.b*r+l.d*i+l.ty,l.a*s+l.c*o+l.tx,l.b*s+l.d*o+l.ty,a),this}closePath(){var e;return this._tick++,(e=this._activePath)==null||e.closePath(),this}ellipse(e,t,r,i){return this._tick++,this._activePath.ellipse(e,t,r,i,this._transform.clone()),this}circle(e,t,r){return this._tick++,this._activePath.circle(e,t,r,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,t){this._tick++;const r=this._transform;return this._activePath.lineTo(r.a*e+r.c*t+r.tx,r.b*e+r.d*t+r.ty),this}moveTo(e,t){this._tick++;const r=this._transform,i=this._activePath.instructions,s=r.a*e+r.c*t+r.tx,o=r.b*e+r.d*t+r.ty;return i.length===1&&i[0].action==="moveTo"?(i[0].data[0]=s,i[0].data[1]=o,this):(this._activePath.moveTo(s,o),this)}quadraticCurveTo(e,t,r,i,s){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*e+o.c*t+o.tx,o.b*e+o.d*t+o.ty,o.a*r+o.c*i+o.tx,o.b*r+o.d*i+o.ty,s),this}rect(e,t,r,i){return this._tick++,this._activePath.rect(e,t,r,i,this._transform.clone()),this}roundRect(e,t,r,i,s){return this._tick++,this._activePath.roundRect(e,t,r,i,s,this._transform.clone()),this}poly(e,t){return this._tick++,this._activePath.poly(e,t,this._transform.clone()),this}regularPoly(e,t,r,i,s=0,o){return this._tick++,this._activePath.regularPoly(e,t,r,i,s,o),this}roundPoly(e,t,r,i,s,o){return this._tick++,this._activePath.roundPoly(e,t,r,i,s,o),this}roundShape(e,t,r,i){return this._tick++,this._activePath.roundShape(e,t,r,i),this}filletRect(e,t,r,i,s){return this._tick++,this._activePath.filletRect(e,t,r,i,s),this}chamferRect(e,t,r,i,s,o){return this._tick++,this._activePath.chamferRect(e,t,r,i,s,o),this}star(e,t,r,i,s=0,o=0){return this._tick++,this._activePath.star(e,t,r,i,s,o,this._transform.clone()),this}svg(e){return this._tick++,$E(e,this),this}restore(){const e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(e){return this._transform.rotate(e),this}scale(e,t=e){return this._transform.scale(e,t),this}setTransform(e,t,r,i,s,o){return e instanceof Z?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,t,r,i,s,o),this)}transform(e,t,r,i,s,o){return e instanceof Z?(this._transform.append(e),this):(Vm.set(e,t,r,i,s,o),this._transform.append(Vm),this)}translate(e,t=e){return this._transform.translate(e,t),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;const e=this._bounds;e.clear();for(let t=0;t<this.instructions.length;t++){const r=this.instructions[t],i=r.action;if(i==="fill"){const s=r.data;e.addBounds(s.path.bounds)}else if(i==="texture"){const s=r.data;e.addFrame(s.dx,s.dy,s.dx+s.dw,s.dy+s.dh,s.transform)}if(i==="stroke"){const s=r.data,o=s.style.alignment;let a=s.style.width*(1-o);s.style.join==="miter"&&(a*=JE(s.path,s.style.miterLimit));const l=s.path.bounds;e.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return e.isValid||e.set(0,0,0,0),e}containsPoint(e){var i;if(!this.bounds.containsPoint(e.x,e.y))return!1;const t=this.instructions;let r=!1;for(let s=0;s<t.length;s++){const o=t[s],a=o.data,l=a.path;if(!o.action||!l)continue;const u=a.style,c=l.shapePath.shapePrimitives;for(let h=0;h<c.length;h++){const d=c[h].shape;if(!u||!d)continue;const f=c[h].transform,p=f?f.applyInverse(e,eA):e;if(o.action==="fill")r=d.contains(p.x,p.y);else{const _=u;r=d.strokeContains(p.x,p.y,_.width,_.alignment)}const g=a.hole;if(g){const _=(i=g.shapePath)==null?void 0:i.shapePrimitives;if(_)for(let m=0;m<_.length;m++)_[m].shape.contains(p.x,p.y)&&(r=!1)}if(r)return!0}}return r}unload(){var e;this.emit("unload",this);for(const t in this._gpuData)(e=this._gpuData[t])==null||e.destroy();this._gpuData=Object.create(null)}destroy(e=!1){if(this.destroyed)return;if(this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners(),typeof e=="boolean"?e:e==null?void 0:e.texture){const r=typeof e=="boolean"?e:e==null?void 0:e.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(r)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(r))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};yf.defaultFillStyle={color:16777215,alpha:1,texture:Q.WHITE,matrix:null,fill:null,textureSpace:"local"};yf.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:Q.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let pn=yf;class I1{constructor(e){this._attachedDomElements=[],this._renderer=e,this._renderer.runners.postrender.add(this),this._renderer.runners.init.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}init(){this._canvasObserver=new Fx({domElement:this._domElement,renderer:this._renderer})}addRenderable(e,t){this._attachedDomElements.includes(e)||this._attachedDomElements.push(e)}updateRenderable(e){}validateRenderable(e){return!0}postrender(){const e=this._attachedDomElements;if(e.length===0){this._domElement.remove();return}this._canvasObserver.ensureAttached();for(let t=0;t<e.length;t++){const r=e[t],i=r.element;if(!r.parent||r.globalDisplayStatus<7)i==null||i.remove(),e.splice(t,1),t--;else{this._domElement.contains(i)||(i.style.position="absolute",i.style.pointerEvents="auto",this._domElement.appendChild(i));const s=r.worldTransform,o=r._anchor,a=r.width*o.x,l=r.height*o.y;i.style.transformOrigin=`${a}px ${l}px`,i.style.transform=`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.tx-a}, ${s.ty-l})`,i.style.opacity=r.groupAlpha.toString()}}}destroy(){var e;this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++)(e=this._attachedDomElements[t].element)==null||e.remove();this._attachedDomElements.length=0,this._domElement.remove(),this._canvasObserver.destroy(),this._renderer=null}}I1.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"dom"};class tA{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(St.system.add(this._tickerUpdate,this,si.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(St.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}):new MouseEvent("mousemove",{clientX:e.clientX,clientY:e.clientY}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}destroy(){this.removeTickerListener(),this.events=null,this.domElement=null,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}}const Un=new tA;class Gl extends $o{constructor(){super(...arguments),this.client=new Me,this.movement=new Me,this.offset=new Me,this.global=new Me,this.screen=new Me}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,r){return e.worldTransform.applyInverse(r||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,r,i,s,o,a,l,u,c,h,d,f,p,g){throw new Error("Method not implemented.")}}class un extends Gl{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1,this.persistentDeviceId=0}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class us extends Gl{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}us.DOM_DELTA_PIXEL=0;us.DOM_DELTA_LINE=1;us.DOM_DELTA_PAGE=2;const nA=2048,rA=new Me,js=new Me;class iA{constructor(e){this.dispatch=new Ot,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((r,i)=>r.priority-i.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let r=0,i=t.length;r<i;r++)t[r].fn(e);else se(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){Un.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,rA.set(e,t),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(e,t){if(!e.target)return;const r=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let i=0,s=r.length-1;i<s;i++)if(e.currentTarget=r[i],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let i=r.length-2;i>=0;i--)if(e.currentTarget=r[i],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,r=this._allInteractiveElements){if(r.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const i=Array.isArray(t)?t:[t];for(let s=r.length-1;s>=0;s--)i.forEach(o=>{e.currentTarget=r[s],this.notifyTarget(e,o)})}propagationPath(e){const t=[e];for(let r=0;r<nA&&e!==this.rootTarget&&e.parent;r++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,r,i,s,o=!1){let a=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(Un.pauseUpdate=!1),e.interactiveChildren&&e.children){const c=e.children;for(let h=c.length-1;h>=0;h--){const d=c[h],f=this.hitTestMoveRecursive(d,this._isInteractive(t)?t:d.eventMode,r,i,s,o||s(e,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=e.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const l=this._isInteractive(t),u=e.isInteractive();return u&&u&&this._allInteractiveElements.push(e),o||this._hitElements.length>0?null:a?this._hitElements:l&&!s(e,r)&&i(e,r)?u?[e]:[]:null}hitTestRecursive(e,t,r,i,s){if(this._interactivePrune(e)||s(e,r))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(Un.pauseUpdate=!1),e.interactiveChildren&&e.children){const l=e.children,u=r;for(let c=l.length-1;c>=0;c--){const h=l[c],d=this.hitTestRecursive(h,this._isInteractive(t)?t:h.eventMode,u,i,s);if(d){if(d.length>0&&!d[d.length-1].parent)continue;const f=e.isInteractive();return(d.length>0||f)&&d.push(e),d}}}const o=this._isInteractive(t),a=e.isInteractive();return o&&i(e,r)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,js),!e.hitArea.contains(js.x,js.y)))return!0;if(e.effects&&e.effects.length)for(let r=0;r<e.effects.length;r++){const i=e.effects[r];if(i.containsPoint&&!i.containsPoint(t,this.hitTestFn))return!0}return!1}hitTestFn(e,t){return e.hitArea?!0:e!=null&&e.containsPoint?(e.worldTransform.applyInverse(t,js),e.containsPoint(js)):!1}notifyTarget(e,t){var s,o;if(!e.currentTarget.isInteractive())return;t??(t=e.type);const r=`on${t}`;(o=(s=e.currentTarget)[r])==null||o.call(s,e);const i=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this._notifyListeners(e,i),e.eventPhase===e.AT_TARGET&&this._notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof un)){se("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.createPointerEvent(e);if(this.dispatchEvent(t,"pointerdown"),t.pointerType==="touch")this.dispatchEvent(t,"touchstart");else if(t.pointerType==="mouse"||t.pointerType==="pen"){const i=t.button===2;this.dispatchEvent(t,i?"rightdown":"mousedown")}const r=this.trackingData(e.pointerId);r.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){var l,u;if(!(e instanceof un)){se("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;const r=t.pointerType==="mouse"||t.pointerType==="pen",i=this.trackingData(e.pointerId),s=this.findMountedTarget(i.overTargets);if(((l=i.overTargets)==null?void 0:l.length)>0&&s!==t.target){const c=e.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(e,c,s);if(this.dispatchEvent(h,"pointerout"),r&&this.dispatchEvent(h,"mouseout"),!t.composedPath().includes(s)){const d=this.createPointerEvent(e,"pointerleave",s);for(d.eventPhase=d.AT_TARGET;d.target&&!t.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),r&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(h)}if(s!==t.target){const c=e.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(t,c);this.dispatchEvent(h,"pointerover"),r&&this.dispatchEvent(h,"mouseover");let d=s==null?void 0:s.parent;for(;d&&d!==this.rootTarget.parent&&d!==t.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const p=this.clonePointerEvent(t,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==s&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),r&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(h)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&o.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&o.push("globaltouchmove")),r&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(u=t.target)==null?void 0:u.cursor),o.length>0&&this.all(t,o),this._allInteractiveElements.length=0,this._hitElements.length=0,i.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var o;if(!(e instanceof un)){se("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),r=this.createPointerEvent(e),i=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),i&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=(o=r.target)==null?void 0:o.cursor);const s=this.clonePointerEvent(r,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),i&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;t.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(s)}mapPointerOut(e){if(!(e instanceof un)){se("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const r=e.pointerType==="mouse"||e.pointerType==="pen",i=this.findMountedTarget(t.overTargets),s=this.createPointerEvent(e,"pointerout",i);this.dispatchEvent(s),r&&this.dispatchEvent(s,"mouseout");const o=this.createPointerEvent(e,"pointerleave",i);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),r&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;t.overTargets=null,this.freeEvent(s),this.freeEvent(o)}this.cursor=null}mapPointerUp(e){if(!(e instanceof un)){se("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),r=this.createPointerEvent(e);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){const a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}const i=this.trackingData(e.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[e.button]);let o=s;if(s&&!r.composedPath().includes(s)){let a=s;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){const l=r.button===2;this.notifyTarget(r,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete i.pressTargetsByButton[e.button],o=a}if(o){const a=this.clonePointerEvent(r,"click");a.target=o,a.path=null,i.clicksByButton[e.button]||(i.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});const l=i.clicksByButton[e.button];if(l.target===a.target&&t-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=t,a.detail=l.clickCount,a.pointerType==="mouse"){const u=a.button===2;this.dispatchEvent(a,u?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(e){if(!(e instanceof un)){se("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),r=this.findMountedTarget(t.pressTargetsByButton[e.button]),i=this.createPointerEvent(e);if(r){let s=r;for(;s;)i.currentTarget=s,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch"?this.notifyTarget(i,"touchendoutside"):(i.pointerType==="mouse"||i.pointerType==="pen")&&this.notifyTarget(i,i.button===2?"rightupoutside":"mouseupoutside"),s=s.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(i)}mapWheel(e){if(!(e instanceof us)){se("EventBoundary cannot map a non-wheel event as a wheel event");return}const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let r=1;r<e.length&&e[r].parent===t;r++)t=e[r];return t}createPointerEvent(e,t,r){const i=this.allocateEvent(un);return this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.nativeEvent=e.nativeEvent,i.originalEvent=e,i.target=r??this.hitTest(i.global.x,i.global.y)??this._hitElements[0],typeof t=="string"&&(i.type=t),i}createWheelEvent(e){const t=this.allocateEvent(us);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){const r=this.allocateEvent(un);return r.nativeEvent=e.nativeEvent,r.originalEvent=e.originalEvent,this.copyPointerData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.target=e.target,r.path=e.composedPath().slice(),r.type=t??r.type,r}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof un&&t instanceof un&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,t.persistentDeviceId=e.persistentDeviceId)}copyMouseData(e,t){e instanceof Gl&&t instanceof Gl&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);const t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.defaultPrevented=!1,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}_notifyListeners(e,t){const r=e.currentTarget._events[t];if(r)if("fn"in r)r.once&&e.currentTarget.removeListener(t,r.fn,void 0,!0),r.fn.call(r.context,e);else for(let i=0,s=r.length;i<s&&!e.propagationImmediatelyStopped;i++)r[i].once&&e.currentTarget.removeListener(t,r[i].fn,void 0,!0),r[i].fn.call(r[i].context,e)}}const sA=1,oA={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},_f=class zh{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new iA(null),Un.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new un(null),this._rootWheelEvent=new us(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...zh.defaultEventFeatures},{set:(t,r,i)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=i),t[r]=i,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){const{canvas:t,resolution:r}=this.renderer;this.setTargetElement(t),this.resolution=r,zh._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){Un.destroy(),this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||(e="default");let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this._currentCursor===e)return;this._currentCursor=e;const r=this.cursorStyles[e];if(r)switch(typeof r){case"string":t&&(this.domElement.style.cursor=r);break;case"function":r(e);break;case"object":t&&Object.assign(this.domElement.style,r);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let r=0,i=t.length;r<i;r++){const s=t[r],o=this._bootstrapEvent(this._rootPointerEvent,s);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Un.pointerMoved();const t=this._normalizeToPointerData(e);for(let r=0,i=t.length;r<i;r++){const s=this._bootstrapEvent(this._rootPointerEvent,t[r]);this.rootBoundary.mapEvent(s)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const r=t!==this.domElement?"outside":"",i=this._normalizeToPointerData(e);for(let s=0,o=i.length;s<o;s++){const a=this._bootstrapEvent(this._rootPointerEvent,i[s]);a.type+=r,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);for(let r=0,i=t.length;r<i;r++){const s=this._bootstrapEvent(this._rootPointerEvent,t[r]);this.rootBoundary.mapEvent(s)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;const t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this._removeEvents(),this.domElement=e,Un.domElement=e,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Un.addTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Un.removeTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(e,t,r){const i=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},s=1/this.resolution;e.x=(t-i.left)*(this.domElement.width/i.width)*s,e.y=(r-i.top)*(this.domElement.height/i.height)*s}_normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let r=0,i=e.changedTouches.length;r<i;r++){const s=e.changedTouches[r];typeof s.button>"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=e.type,s.altKey??(s.altKey=e.altKey),s.ctrlKey??(s.ctrlKey=e.ctrlKey),s.metaKey??(s.metaKey=e.metaKey),s.shiftKey??(s.shiftKey=e.shiftKey),t.push(s)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const r=e;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=sA),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,t.push(r)}else t.push(e);return t}normalizeWheelEvent(e){const t=this._rootWheelEvent;return this._transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}_bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this._transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=oA[e.type]||e.type),e}_transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};_f.extension={name:"events",type:[k.WebGLSystem,k.CanvasSystem,k.WebGPUSystem],priority:-1};_f.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let B1=_f;const aA={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(n){this.eventMode=n?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??B1.defaultEventMode},set eventMode(n){this._internalEventMode=n},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(n,e,t){const r=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,i=typeof t=="object"?t.signal:void 0,s=typeof t=="object"?t.once===!0:!1,o=typeof e=="function"?void 0:e;n=r?`${n}capture`:n;const a=typeof e=="function"?e:e.handleEvent,l=this;i&&i.addEventListener("abort",()=>{l.off(n,a,o)}),s?l.once(n,a,o):l.on(n,a,o)},removeEventListener(n,e,t){const r=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,i=typeof e=="function"?void 0:e;n=r?`${n}capture`:n,e=typeof e=="function"?e:e.handleEvent,this.off(n,e,i)},dispatchEvent(n){if(!(n instanceof $o))throw new Error("Container cannot propagate events outside of the Federated Events API");return n.defaultPrevented=!1,n.path=null,n.target=this,n.manager.dispatchEvent(n),!n.defaultPrevented}};let bi;function jm(n){const e=pe.get().createCanvas(6,1),t=e.getContext("2d");return t.fillStyle=n,t.fillRect(0,0,6,1),e}function D1(){if(bi!==void 0)return bi;try{const n=jm("#ff00ff"),e=jm("#ffff00"),r=pe.get().createCanvas(6,1).getContext("2d");r.globalCompositeOperation="multiply",r.drawImage(n,0,0),r.drawImage(e,2,0);const i=r.getImageData(2,0,1,1);if(!i)bi=!1;else{const s=i.data;bi=s[0]===255&&s[1]===0&&s[2]===0}}catch{bi=!1}return bi}const ce={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:D1(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:n=>{const e=n.source,t=e==null?void 0:e.resource;if(!t)return null;const r=e.alphaMode==="premultiplied-alpha",i=e.resourceWidth??e.pixelWidth,s=e.resourceHeight??e.pixelHeight,o=i!==e.pixelWidth||s!==e.pixelHeight;if(r){if((t instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)&&!o)return t;const a=ce._unpremultipliedCache.get(e);if((a==null?void 0:a.resourceId)===e._resourceId)return a.canvas}if(t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Uint32Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof ArrayBuffer){const a=ce._canvasSourceCache.get(e);if((a==null?void 0:a.resourceId)===e._resourceId)return a.canvas;const l=pe.get().createCanvas(e.pixelWidth,e.pixelHeight),u=l.getContext("2d"),c=u.createImageData(e.pixelWidth,e.pixelHeight),h=c.data,d=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(e.format==="bgra8unorm")for(let f=0;f<h.length&&f+3<d.length;f+=4)h[f]=d[f+2],h[f+1]=d[f+1],h[f+2]=d[f],h[f+3]=d[f+3];else h.set(d.subarray(0,h.length));return u.putImageData(c,0,0),ce._canvasSourceCache.set(e,{canvas:l,resourceId:e._resourceId}),l}if(r){const a=pe.get().createCanvas(e.pixelWidth,e.pixelHeight),l=a.getContext("2d",{willReadFrequently:!0});a.width=e.pixelWidth,a.height=e.pixelHeight,l.drawImage(t,0,0);const u=l.getImageData(0,0,a.width,a.height),c=u.data;for(let h=0;h<c.length;h+=4){const d=c[h+3];if(d>0){const f=255/d;c[h]=Math.min(255,c[h]*f+.5),c[h+1]=Math.min(255,c[h+1]*f+.5),c[h+2]=Math.min(255,c[h+2]*f+.5)}}return l.putImageData(u,0,0),ce._unpremultipliedCache.set(e,{canvas:a,resourceId:e._resourceId}),a}if(o){const a=ce._canvasSourceCache.get(e);if((a==null?void 0:a.resourceId)===e._resourceId)return a.canvas;const l=pe.get().createCanvas(e.pixelWidth,e.pixelHeight),u=l.getContext("2d");return l.width=e.pixelWidth,l.height=e.pixelHeight,u.drawImage(t,0,0),ce._canvasSourceCache.set(e,{canvas:l,resourceId:e._resourceId}),l}return t},getTintedCanvas:(n,e)=>{const t=n.texture,r=Ce.shared.setValue(e).toHex(),i=t.tintCache||(t.tintCache={}),s=i[r],o=t.source._resourceId;if((s==null?void 0:s.tintId)===o)return s;const a=s&&"getContext"in s?s:pe.get().createCanvas();return ce.tintMethod(t,e,a),a.tintId=o,i[r]=a,i[r]},getTintedPattern:(n,e)=>{const t=Ce.shared.setValue(e).toHex(),r=n.patternCache||(n.patternCache={}),i=n.source._resourceId;let s=r[t];return(s==null?void 0:s.tintId)===i||(ce.canvas||(ce.canvas=pe.get().createCanvas()),ce.tintMethod(n,e,ce.canvas),s=ce.canvas.getContext("2d").createPattern(ce.canvas,"repeat"),s.tintId=i,r[t]=s),s},applyPatternTransform:(n,e,t=!0)=>{if(!e)return;const r=n;if(!r.setTransform)return;const i=globalThis.DOMMatrix;if(!i)return;const s=new i([e.a,e.b,e.c,e.d,e.tx,e.ty]);r.setTransform(t?s.inverse():s)},tintWithMultiply:(n,e,t)=>{const r=t.getContext("2d"),i=n.frame.clone(),s=n.source._resolution??n.source.resolution??1,o=n.rotate;i.x*=s,i.y*=s,i.width*=s,i.height*=s;const a=he.isVertical(o),l=a?i.height:i.width,u=a?i.width:i.height;t.width=Math.ceil(l),t.height=Math.ceil(u),r.save(),r.fillStyle=Ce.shared.setValue(e).toHex(),r.fillRect(0,0,l,u),r.globalCompositeOperation="multiply";const c=ce.getCanvasSource(n);if(!c){r.restore();return}o&&ce._applyInverseRotation(r,o,i.width,i.height),r.drawImage(c,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.globalCompositeOperation="destination-atop",r.drawImage(c,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore()},tintWithOverlay:(n,e,t)=>{const r=t.getContext("2d"),i=n.frame.clone(),s=n.source._resolution??n.source.resolution??1,o=n.rotate;i.x*=s,i.y*=s,i.width*=s,i.height*=s;const a=he.isVertical(o),l=a?i.height:i.width,u=a?i.width:i.height;t.width=Math.ceil(l),t.height=Math.ceil(u),r.save(),r.globalCompositeOperation="copy",r.fillStyle=Ce.shared.setValue(e).toHex(),r.fillRect(0,0,l,u),r.globalCompositeOperation="destination-atop";const c=ce.getCanvasSource(n);if(!c){r.restore();return}o&&ce._applyInverseRotation(r,o,i.width,i.height),r.drawImage(c,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore()},tintWithPerPixel:(n,e,t)=>{const r=t.getContext("2d"),i=n.frame.clone(),s=n.source._resolution??n.source.resolution??1,o=n.rotate;i.x*=s,i.y*=s,i.width*=s,i.height*=s;const a=he.isVertical(o),l=a?i.height:i.width,u=a?i.width:i.height;t.width=Math.ceil(l),t.height=Math.ceil(u),r.save(),r.globalCompositeOperation="copy";const c=ce.getCanvasSource(n);if(!c){r.restore();return}o&&ce._applyInverseRotation(r,o,i.width,i.height),r.drawImage(c,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore();const h=e>>16&255,d=e>>8&255,f=e&255,p=r.getImageData(0,0,l,u),g=p.data;for(let _=0;_<g.length;_+=4)g[_]=g[_]*h/255,g[_+1]=g[_+1]*d/255,g[_+2]=g[_+2]*f/255;r.putImageData(p,0,0)},_applyInverseRotation:(n,e,t,r)=>{const i=he.inv(e),s=he.uX(i),o=he.uY(i),a=he.vX(i),l=he.vY(i),u=-Math.min(0,s*t,a*r,s*t+a*r),c=-Math.min(0,o*t,l*r,o*t+l*r);n.transform(s,o,a,l,u,c)}};ce.tintMethod=ce.canUseMultiply?ce.tintWithMultiply:ce.tintWithPerPixel;class lA{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){const r=pe.get().createCanvas();r.width=e,r.height=t;const i=r.getContext("2d");return{canvas:r,context:i}}getOptimalCanvasAndContext(e,t,r=1){e=Math.ceil(e*r-1e-6),t=Math.ceil(t*r-1e-6),e=os(e),t=os(t);const i=(e<<17)+(t<<1);this._canvasPool[i]||(this._canvasPool[i]=[]);let s=this._canvasPool[i].pop();return s||(s=this._createCanvasAndContext(e,t)),s}returnCanvasAndContext(e){const t=e.canvas,{width:r,height:i}=t,s=(r<<17)+(i<<1);e.context.resetTransform(),e.context.clearRect(0,0,r,i),this._canvasPool[s].push(e)}clear(){this._canvasPool={}}}const cs=new lA;ps.register(cs);const $m=new Z;function F1(n,e){e.clear();const t=e.matrix;for(let r=0;r<n.length;r++){const i=n[r];if(i.globalDisplayStatus<7)continue;const s=i.renderGroup??i.parentRenderGroup;s!=null&&s.isCachedAsTexture?e.matrix=$m.copyFrom(s.textureOffsetInverseTransform).append(i.worldTransform):s!=null&&s._parentCacheAsTextureRenderGroup?e.matrix=$m.copyFrom(s._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(i.groupTransform):e.matrix=i.worldTransform,e.addBounds(i.bounds)}return e.matrix=t,e}const uA=new gt;function G1(n,e,t,r,i=!1){const s=uA;s.minX=0,s.minY=0,s.maxX=n.width/r|0,s.maxY=n.height/r|0;const o=vt.getOptimalTexture(s.width,s.height,r,!1,i);return o.source.uploadMethodId="image",o.source.resource=n,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=e/r,o.frame.height=t/r,o.source.emit("update",o.source),o.updateUvs(),o}function Xm(n){return typeof n.getCanvasFilterString=="function"}class cA{constructor(){this.skip=!1,this.useClip=!1,this.filters=null,this.container=null,this.bounds=new gt,this.cssFilterString=""}}class O1{constructor(e){this._filterStack=[],this._filterStackIndex=0,this._savedStates=[],this._alphaMultiplier=1,this._warnedFilterTypes=new Set,this.renderer=e}push(e){const t=this._pushFilterFrame(),r=e.filterEffect.filters;if(t.skip=!1,t.useClip=!1,t.filters=r,t.container=e.container,t.cssFilterString="",r.every(l=>!l.enabled)){t.skip=!0;return}const i=[],s=1;for(const l of r){if(!l.enabled)continue;if(!Xm(l)){this._warnUnsupportedFilter(l);continue}const u=l.getCanvasFilterString();if(u===null){this._warnUnsupportedFilter(l);continue}u&&i.push(u)}if(i.length===0&&s===1){t.skip=!0;return}t.cssFilterString=i.join(" "),this._calculateFilterArea(e,t.bounds),t.useClip=!!e.filterEffect.filterArea;const o=this.renderer.canvasContext.activeContext,a=o.filter||"none";if(this._savedStates.push({filter:a,alphaMultiplier:this._alphaMultiplier}),t.useClip&&Number.isFinite(t.bounds.width)&&Number.isFinite(t.bounds.height)&&t.bounds.width>0&&t.bounds.height>0){const l=this.renderer.canvasContext.activeResolution||1;o.save(),o.setTransform(1,0,0,1,0,0),o.beginPath(),o.rect(t.bounds.x*l,t.bounds.y*l,t.bounds.width*l,t.bounds.height*l),o.clip()}else t.useClip=!1;t.cssFilterString&&(o.filter=a!=="none"?`${a} ${t.cssFilterString}`:t.cssFilterString)}pop(){const e=this._popFilterFrame();if(e.skip)return;const t=this._savedStates.pop();if(!t)return;const r=this.renderer.canvasContext.activeContext;e.useClip?r.restore():r.filter=t.filter,this._alphaMultiplier=t.alphaMultiplier}generateFilteredTexture({texture:e,filters:t}){if(!(t!=null&&t.length)||t.every(m=>!m.enabled))return e;const r=[],i=1;for(const m of t){if(!m.enabled)continue;if(!Xm(m)){this._warnUnsupportedFilter(m);continue}const y=m.getCanvasFilterString();if(y===null){this._warnUnsupportedFilter(m);continue}y&&r.push(y)}if(r.length===0&&i===1)return e;const s=ce.getCanvasSource(e);if(!s)return e;const o=e.frame,a=e.source._resolution??e.source.resolution??1,l=o.width,u=o.height,c=cs.getOptimalCanvasAndContext(l,u,a),{canvas:h,context:d}=c;d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,h.width,h.height),r.length&&(d.filter=r.join(" "));const f=o.x*a,p=o.y*a,g=l*a,_=u*a;return d.drawImage(s,f,p,g,_,0,0,g,_),d.filter="none",d.globalAlpha=1,G1(h,l,u,a)}_calculateFilterArea(e,t){if(e.renderables?F1(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){const r=e.container.renderGroup||e.container.parentRenderGroup,i=r==null?void 0:r.cacheToLocalTransform;i&&t.applyMatrix(i)}}_warnUnsupportedFilter(e){var r;const t=((r=e==null?void 0:e.constructor)==null?void 0:r.name)||"Filter";this._warnedFilterTypes.has(t)||(this._warnedFilterTypes.add(t),console.warn(`CanvasRenderer: filter "${t}" is not supported in Canvas2D and will be skipped.`))}get alphaMultiplier(){return this._alphaMultiplier}_pushFilterFrame(){let e=this._filterStack[this._filterStackIndex];return e||(e=this._filterStack[this._filterStackIndex]=new cA),this._filterStackIndex++,e}_popFilterFrame(){return this._filterStackIndex<=0?this._filterStack[0]:(this._filterStackIndex--,this._filterStack[this._filterStackIndex])}destroy(){this._filterStack=null,this._savedStates=null,this._warnedFilterTypes=null,this._alphaMultiplier=1}}O1.extension={type:[k.CanvasSystem],name:"filter"};var hA=`in vec2 aPosition;
|
|
291
|
+
out vec2 vTextureCoord;
|
|
292
|
+
|
|
293
|
+
uniform vec4 uInputSize;
|
|
294
|
+
uniform vec4 uOutputFrame;
|
|
295
|
+
uniform vec4 uOutputTexture;
|
|
296
|
+
|
|
297
|
+
vec4 filterVertexPosition( void )
|
|
298
|
+
{
|
|
299
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
300
|
+
|
|
301
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
302
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
303
|
+
|
|
304
|
+
return vec4(position, 0.0, 1.0);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
vec2 filterTextureCoord( void )
|
|
308
|
+
{
|
|
309
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
void main(void)
|
|
313
|
+
{
|
|
314
|
+
gl_Position = filterVertexPosition();
|
|
315
|
+
vTextureCoord = filterTextureCoord();
|
|
316
|
+
}
|
|
317
|
+
`,dA=`in vec2 vTextureCoord;
|
|
318
|
+
out vec4 finalColor;
|
|
319
|
+
uniform sampler2D uTexture;
|
|
320
|
+
void main() {
|
|
321
|
+
finalColor = texture(uTexture, vTextureCoord);
|
|
322
|
+
}
|
|
323
|
+
`,Ym=`struct GlobalFilterUniforms {
|
|
324
|
+
uInputSize: vec4<f32>,
|
|
325
|
+
uInputPixel: vec4<f32>,
|
|
326
|
+
uInputClamp: vec4<f32>,
|
|
327
|
+
uOutputFrame: vec4<f32>,
|
|
328
|
+
uGlobalFrame: vec4<f32>,
|
|
329
|
+
uOutputTexture: vec4<f32>,
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
@group(0) @binding(0) var <uniform> gfu: GlobalFilterUniforms;
|
|
333
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
334
|
+
@group(0) @binding(2) var uSampler: sampler;
|
|
335
|
+
|
|
336
|
+
struct VSOutput {
|
|
337
|
+
@builtin(position) position: vec4<f32>,
|
|
338
|
+
@location(0) uv: vec2<f32>
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
fn filterVertexPosition(aPosition: vec2<f32>) -> vec4<f32>
|
|
342
|
+
{
|
|
343
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
344
|
+
|
|
345
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
346
|
+
position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
347
|
+
|
|
348
|
+
return vec4(position, 0.0, 1.0);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
fn filterTextureCoord(aPosition: vec2<f32>) -> vec2<f32>
|
|
352
|
+
{
|
|
353
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
@vertex
|
|
357
|
+
fn mainVertex(
|
|
358
|
+
@location(0) aPosition: vec2<f32>,
|
|
359
|
+
) -> VSOutput {
|
|
360
|
+
return VSOutput(
|
|
361
|
+
filterVertexPosition(aPosition),
|
|
362
|
+
filterTextureCoord(aPosition)
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
@fragment
|
|
367
|
+
fn mainFragment(
|
|
368
|
+
@location(0) uv: vec2<f32>,
|
|
369
|
+
) -> @location(0) vec4<f32> {
|
|
370
|
+
return textureSample(uTexture, uSampler, uv);
|
|
371
|
+
}
|
|
372
|
+
`;class fA extends jx{constructor(){const e=ci.from({vertex:{source:Ym,entryPoint:"mainVertex"},fragment:{source:Ym,entryPoint:"mainFragment"},name:"passthrough-filter"}),t=ms.from({vertex:hA,fragment:dA,name:"passthrough-filter"});super({gpuProgram:e,glProgram:t})}}class L1{constructor(e){this._renderer=e}push(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}L1.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"filter"};const pA=new ou({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])});class mA{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new gt,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0},this.firstEnabledIndex=-1,this.lastEnabledIndex=-1}}class U1{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new xn({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Sr({}),this.renderer=e}get activeBackTexture(){var e;return(e=this._activeFilterData)==null?void 0:e.backTexture}push(e){const t=this.renderer,r=e.filterEffect.filters,i=this._pushFilterData();i.skip=!1,i.filters=r,i.container=e.container,i.outputRenderSurface=t.renderTarget.renderSurface;const s=t.renderTarget.renderTarget.colorTexture.source,o=s.resolution,a=s.antialias;if(r.every(f=>!f.enabled)){i.skip=!0;return}const l=i.bounds;if(this._calculateFilterArea(e,l),this._calculateFilterBounds(i,t.renderTarget.rootViewPort,a,o,1),i.skip)return;const u=this._getPreviousFilterData(),c=this._findFilterResolution(o);let h=0,d=0;u&&(h=u.bounds.minX,d=u.bounds.minY),this._calculateGlobalFrame(i,h,d,c,s.width,s.height),this._setupFilterTextures(i,l,t,u)}generateFilteredTexture({texture:e,filters:t}){const r=this._pushFilterData();this._activeFilterData=r,r.skip=!1,r.filters=t;const i=e.source,s=i.resolution,o=i.antialias;if(t.every(f=>!f.enabled))return r.skip=!0,e;const a=r.bounds;if(a.addRect(e.frame),this._calculateFilterBounds(r,a.rectangle,o,s,0),r.skip)return e;const l=s;this._calculateGlobalFrame(r,0,0,l,i.width,i.height),r.outputRenderSurface=vt.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=Q.EMPTY,r.inputTexture=e,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,!0);const d=r.outputRenderSurface;return d.source.alphaMode="premultiplied-alpha",d}pop(){const e=this.renderer,t=this._popFilterData();t.skip||(e.globalUniforms.pop(),e.renderTarget.finishRenderPass(),this._activeFilterData=t,this._applyFiltersToTexture(t,!1),t.blendRequired&&vt.returnTexture(t.backTexture),vt.returnTexture(t.inputTexture))}getBackTexture(e,t,r){const i=e.colorTexture.source._resolution,s=vt.getOptimalTexture(t.width,t.height,i,!1);let o=t.minX,a=t.minY;r&&(o-=r.minX,a-=r.minY),o=Math.floor(o*i),a=Math.floor(a*i);const l=Math.ceil(t.width*i),u=Math.ceil(t.height*i);return this.renderer.renderTarget.copyToTexture(e,s,{x:o,y:a},{width:l,height:u},{x:0,y:0}),s}applyFilter(e,t,r,i){const s=this.renderer,o=this._activeFilterData,l=o.outputRenderSurface===r,u=s.renderTarget.rootRenderTarget.colorTexture.source._resolution,c=this._findFilterResolution(u);let h=0,d=0;if(l){const p=this._findPreviousFilterOffset();h=p.x,d=p.y}this._updateFilterUniforms(t,r,o,h,d,c,l,i);const f=e.enabled?e:this._getPassthroughFilter();this._setupBindGroupsAndRender(f,t,s)}calculateSpriteMatrix(e,t){const r=this._activeFilterData,i=e.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),s=t.worldTransform.copyTo(Z.shared),o=t.renderGroup||t.parentRenderGroup;return o&&o.cacheToLocalTransform&&s.prepend(o.cacheToLocalTransform),s.invert(),i.prepend(s),i.scale(1/t.texture.orig.width,1/t.texture.orig.height),i.translate(t.anchor.x,t.anchor.y),i}destroy(){var e;(e=this._passthroughFilter)==null||e.destroy(!0),this._passthroughFilter=null}_getPassthroughFilter(){return this._passthroughFilter??(this._passthroughFilter=new fA),this._passthroughFilter}_setupBindGroupsAndRender(e,t,r){if(r.renderPipes.uniformBatch){const i=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(i,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:pA,shader:e,state:e._state,topology:"triangle-list"}),r.type===_n.WEBGL&&r.renderTarget.finishRenderPass()}_setupFilterTextures(e,t,r,i){if(e.backTexture=Q.EMPTY,e.inputTexture=vt.getOptimalTexture(t.width,t.height,e.resolution,e.antialias),e.blendRequired){r.renderTarget.finishRenderPass();const s=r.renderTarget.getRenderTarget(e.outputRenderSurface);e.backTexture=this.getBackTexture(s,t,i==null?void 0:i.bounds)}r.renderTarget.bind({target:e.inputTexture,clear:!0}),r.globalUniforms.push({offset:t})}_calculateGlobalFrame(e,t,r,i,s,o){const a=e.globalFrame;a.x=t*i,a.y=r*i,a.width=s*i,a.height=o*i}_updateFilterUniforms(e,t,r,i,s,o,a,l){const u=this._filterGlobalUniforms.uniforms,c=u.uOutputFrame,h=u.uInputSize,d=u.uInputPixel,f=u.uInputClamp,p=u.uGlobalFrame,g=u.uOutputTexture;a?(c[0]=r.bounds.minX-i,c[1]=r.bounds.minY-s):(c[0]=0,c[1]=0),c[2]=e.frame.width,c[3]=e.frame.height,h[0]=e.source.width,h[1]=e.source.height,h[2]=1/h[0],h[3]=1/h[1],d[0]=e.source.pixelWidth,d[1]=e.source.pixelHeight,d[2]=1/d[0],d[3]=1/d[1],f[0]=.5*d[2],f[1]=.5*d[3],f[2]=e.frame.width*h[2]-.5*d[2],f[3]=e.frame.height*h[3]-.5*d[3];const _=this.renderer.renderTarget.rootRenderTarget.colorTexture;p[0]=i*o,p[1]=s*o,p[2]=_.source.width*o,p[3]=_.source.height*o,t instanceof Q&&(t.source.resource=null);const m=this.renderer.renderTarget.getRenderTarget(t);this.renderer.renderTarget.bind({target:t,clear:!!l}),t instanceof Q?(g[0]=t.frame.width,g[1]=t.frame.height):(g[0]=m.width,g[1]=m.height),g[2]=m.isRoot?-1:1,this._filterGlobalUniforms.update()}_findFilterResolution(e){let t=this._filterStackIndex-1;for(;t>0&&this._filterStack[t].skip;)--t;return t>0&&this._filterStack[t].inputTexture?this._filterStack[t].inputTexture.source._resolution:e}_findPreviousFilterOffset(){let e=0,t=0,r=this._filterStackIndex;for(;r>0;){r--;const i=this._filterStack[r];if(!i.skip){e=i.bounds.minX,t=i.bounds.minY;break}}return{x:e,y:t}}_calculateFilterArea(e,t){if(e.renderables?F1(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){const i=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;i&&t.applyMatrix(i)}}_applyFiltersToTexture(e,t){const r=e.inputTexture,i=e.bounds,s=e.filters,o=e.firstEnabledIndex,a=e.lastEnabledIndex;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(e.backTexture.source,3),o===a)s[o].apply(this,r,e.outputRenderSurface,t);else{let l=e.inputTexture;const u=vt.getOptimalTexture(i.width,i.height,l.source._resolution,!1);let c=u;for(let h=o;h<a;h++){const d=s[h];if(!d.enabled)continue;d.apply(this,l,c,!0);const f=l;l=c,c=f}s[a].apply(this,l,e.outputRenderSurface,t),vt.returnTexture(u)}}_calculateFilterBounds(e,t,r,i,s){var m;const o=this.renderer,a=e.bounds,l=e.filters;let u=1/0,c=0,h=!0,d=!1,f=!1,p=!0,g=-1,_=-1;for(let y=0;y<l.length;y++){const x=l[y];if(!x.enabled)continue;if(g===-1&&(g=y),_=y,u=Math.min(u,x.resolution==="inherit"?i:x.resolution),c+=x.padding,x.antialias==="off"?h=!1:x.antialias==="inherit"&&h&&(h=r),x.clipToViewport||(p=!1),!!!(x.compatibleRenderers&o.type)){f=!1;break}if(x.blendRequired&&!(((m=o.backBuffer)==null?void 0:m.useBackBuffer)??!0)){se("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),f=!1;break}f=!0,d||(d=x.blendRequired)}if(!f){e.skip=!0;return}if(p&&a.fitBounds(0,t.width/i,0,t.height/i),a.scale(u).ceil().scale(1/u).pad((c|0)*s),!a.isPositive){e.skip=!0;return}e.antialias=h,e.resolution=u,e.blendRequired=d,e.firstEnabledIndex=g,e.lastEnabledIndex=_}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let e,t=this._filterStackIndex-1;for(;t>0&&(t--,e=this._filterStack[t],!!e.skip););return e}_pushFilterData(){let e=this._filterStack[this._filterStackIndex];return e||(e=this._filterStack[this._filterStackIndex]=new mA),this._filterStackIndex++,e}}U1.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"filter"};var gA=`in vec2 vMaskCoord;
|
|
373
|
+
in vec2 vTextureCoord;
|
|
374
|
+
|
|
375
|
+
uniform sampler2D uTexture;
|
|
376
|
+
uniform sampler2D uMaskTexture;
|
|
377
|
+
|
|
378
|
+
uniform float uAlpha;
|
|
379
|
+
uniform vec4 uMaskClamp;
|
|
380
|
+
uniform float uInverse;
|
|
381
|
+
uniform float uChannel;
|
|
382
|
+
|
|
383
|
+
out vec4 finalColor;
|
|
384
|
+
|
|
385
|
+
void main(void)
|
|
386
|
+
{
|
|
387
|
+
float clip = step(3.5,
|
|
388
|
+
step(uMaskClamp.x, vMaskCoord.x) +
|
|
389
|
+
step(uMaskClamp.y, vMaskCoord.y) +
|
|
390
|
+
step(vMaskCoord.x, uMaskClamp.z) +
|
|
391
|
+
step(vMaskCoord.y, uMaskClamp.w));
|
|
392
|
+
|
|
393
|
+
// TODO look into why this is needed
|
|
394
|
+
float npmAlpha = uAlpha;
|
|
395
|
+
vec4 original = texture(uTexture, vTextureCoord);
|
|
396
|
+
vec4 masky = texture(uMaskTexture, vMaskCoord);
|
|
397
|
+
|
|
398
|
+
float a;
|
|
399
|
+
if (uChannel == 1.0) {
|
|
400
|
+
a = masky.a * npmAlpha * clip;
|
|
401
|
+
} else {
|
|
402
|
+
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
|
403
|
+
a = alphaMul * masky.r * npmAlpha * clip;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (uInverse == 1.0) {
|
|
407
|
+
a = 1.0 - a;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
finalColor = original * a;
|
|
411
|
+
}
|
|
412
|
+
`,yA=`in vec2 aPosition;
|
|
413
|
+
|
|
414
|
+
out vec2 vTextureCoord;
|
|
415
|
+
out vec2 vMaskCoord;
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
uniform vec4 uInputSize;
|
|
419
|
+
uniform vec4 uOutputFrame;
|
|
420
|
+
uniform vec4 uOutputTexture;
|
|
421
|
+
uniform mat3 uFilterMatrix;
|
|
422
|
+
|
|
423
|
+
vec4 filterVertexPosition( vec2 aPosition )
|
|
424
|
+
{
|
|
425
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
426
|
+
|
|
427
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
428
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
429
|
+
|
|
430
|
+
return vec4(position, 0.0, 1.0);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
vec2 filterTextureCoord( vec2 aPosition )
|
|
434
|
+
{
|
|
435
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
vec2 getFilterCoord( vec2 aPosition )
|
|
439
|
+
{
|
|
440
|
+
return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
void main(void)
|
|
444
|
+
{
|
|
445
|
+
gl_Position = filterVertexPosition(aPosition);
|
|
446
|
+
vTextureCoord = filterTextureCoord(aPosition);
|
|
447
|
+
vMaskCoord = getFilterCoord(aPosition);
|
|
448
|
+
}
|
|
449
|
+
`,Km=`struct GlobalFilterUniforms {
|
|
450
|
+
uInputSize:vec4<f32>,
|
|
451
|
+
uInputPixel:vec4<f32>,
|
|
452
|
+
uInputClamp:vec4<f32>,
|
|
453
|
+
uOutputFrame:vec4<f32>,
|
|
454
|
+
uGlobalFrame:vec4<f32>,
|
|
455
|
+
uOutputTexture:vec4<f32>,
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
struct MaskUniforms {
|
|
459
|
+
uFilterMatrix:mat3x3<f32>,
|
|
460
|
+
uMaskClamp:vec4<f32>,
|
|
461
|
+
uAlpha:f32,
|
|
462
|
+
uInverse:f32,
|
|
463
|
+
uChannel:f32,
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
467
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
468
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
469
|
+
|
|
470
|
+
@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;
|
|
471
|
+
@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;
|
|
472
|
+
|
|
473
|
+
struct VSOutput {
|
|
474
|
+
@builtin(position) position: vec4<f32>,
|
|
475
|
+
@location(0) uv : vec2<f32>,
|
|
476
|
+
@location(1) filterUv : vec2<f32>,
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
480
|
+
{
|
|
481
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
482
|
+
|
|
483
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
484
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
485
|
+
|
|
486
|
+
return vec4(position, 0.0, 1.0);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
490
|
+
{
|
|
491
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
495
|
+
{
|
|
496
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
|
|
500
|
+
{
|
|
501
|
+
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
fn getSize() -> vec2<f32>
|
|
505
|
+
{
|
|
506
|
+
return gfu.uGlobalFrame.zw;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
@vertex
|
|
510
|
+
fn mainVertex(
|
|
511
|
+
@location(0) aPosition : vec2<f32>,
|
|
512
|
+
) -> VSOutput {
|
|
513
|
+
return VSOutput(
|
|
514
|
+
filterVertexPosition(aPosition),
|
|
515
|
+
filterTextureCoord(aPosition),
|
|
516
|
+
getFilterCoord(aPosition)
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
@fragment
|
|
521
|
+
fn mainFragment(
|
|
522
|
+
@location(0) uv: vec2<f32>,
|
|
523
|
+
@location(1) filterUv: vec2<f32>,
|
|
524
|
+
@builtin(position) position: vec4<f32>
|
|
525
|
+
) -> @location(0) vec4<f32> {
|
|
526
|
+
|
|
527
|
+
var maskClamp = filterUniforms.uMaskClamp;
|
|
528
|
+
var uAlpha = filterUniforms.uAlpha;
|
|
529
|
+
|
|
530
|
+
var clip = step(3.5,
|
|
531
|
+
step(maskClamp.x, filterUv.x) +
|
|
532
|
+
step(maskClamp.y, filterUv.y) +
|
|
533
|
+
step(filterUv.x, maskClamp.z) +
|
|
534
|
+
step(filterUv.y, maskClamp.w));
|
|
535
|
+
|
|
536
|
+
var mask = textureSample(uMaskTexture, uSampler, filterUv);
|
|
537
|
+
var source = textureSample(uTexture, uSampler, uv);
|
|
538
|
+
|
|
539
|
+
var a: f32;
|
|
540
|
+
if (filterUniforms.uChannel == 1.0) {
|
|
541
|
+
a = mask.a * uAlpha * clip;
|
|
542
|
+
} else {
|
|
543
|
+
var alphaMul = 1.0 - uAlpha * (1.0 - mask.a);
|
|
544
|
+
a = alphaMul * mask.r * uAlpha * clip;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
if (filterUniforms.uInverse == 1.0) {
|
|
548
|
+
a = 1.0 - a;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
return source * a;
|
|
552
|
+
}
|
|
553
|
+
`;class _A extends jx{constructor(e){const{sprite:t,...r}=e,i=new dx(t.texture),s=new xn({uFilterMatrix:{value:new Z,type:"mat3x3<f32>"},uMaskClamp:{value:i.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:e.inverse?1:0,type:"f32"},uChannel:{value:e.channel==="alpha"?1:0,type:"f32"}}),o=ci.from({vertex:{source:Km,entryPoint:"mainVertex"},fragment:{source:Km,entryPoint:"mainFragment"}}),a=ms.from({vertex:yA,fragment:gA,name:"mask-filter"});super({...r,gpuProgram:o,glProgram:a,clipToViewport:!1,resources:{filterUniforms:s,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=i}setSprite(e){this.sprite=e;const t=this._getSafeTexture();this._textureMatrix.texture=t,this.resources.uMaskTexture=t.source}set inverse(e){this.resources.filterUniforms.uniforms.uInverse=e?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}set channel(e){this.resources.filterUniforms.uniforms.uChannel=e==="alpha"?1:0}get channel(){return this.resources.filterUniforms.uniforms.uChannel===1?"alpha":"red"}apply(e,t,r,i){const s=this._getSafeTexture();this._textureMatrix.texture=s,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=s.source,e.applyFilter(this,t,r,i)}_getSafeTexture(){const e=this.sprite.texture;return e.destroyed||!e.source||e.source.destroyed?(se("[MaskFilter] The mask texture was destroyed while the mask is still in use. Remove the mask before destroying its texture."),Q.EMPTY):e}destroy(e=!1){this._textureMatrix.destroy(),super.destroy(e)}}class xA{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class vA{constructor(){this.instructions=new Zd}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const xf=class Wh{constructor(e){this._renderer=e,this._managedContexts=new Rn({renderer:e,type:"resource",name:"graphicsContext"})}init(e){Wh.defaultOptions.bezierSmoothness=(e==null?void 0:e.bezierSmoothness)??Wh.defaultOptions.bezierSmoothness}getContextRenderData(e){return this.getGpuContext(e).graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const t=e._gpuData,r=!!t[this._renderer.uid],i=t[this._renderer.uid]||this._initContext(e);return(e.dirty||!r)&&(r&&i.reset(),i.isBatchable=!1,e.dirty=!1),i}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const t=new vA,r=this.getGpuContext(e);return r.graphicsData=t,t.init(),t}_initContext(e){const t=new xA;return t.context=e,e._gpuData[this._renderer.uid]=t,this._managedContexts.add(e),t}destroy(){this._managedContexts.destroy(),this._renderer=null}};xf.extension={type:[k.CanvasSystem],name:"graphicsContext"};xf.defaultOptions={bezierSmoothness:.5};let bA=xf;class N1{constructor(e,t){this.state=tr.for2d(),this.renderer=e,this._adaptor=t,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Rn({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){return!1}addRenderable(e,t){this._managedGraphics.add(e),this.renderer.renderPipes.batch.break(t),t.add(e)}updateRenderable(e){}execute(e){e.isRenderable&&this._adaptor.execute(this,e)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}N1.extension={type:[k.CanvasPipes],name:"graphics"};function z1(n,e,t){const r=(n>>24&255)/255;e[t++]=(n&255)/255*r,e[t++]=(n>>8&255)/255*r,e[t++]=(n>>16&255)/255*r,e[t++]=r}class wA{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(e=>{ut.return(e)}),this.batches.length=0}}class W1{constructor(e,t){this.state=tr.for2d(),this.renderer=e,this._adaptor=t,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Rn({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){const t=e.context,r=!!e._gpuData,s=this.renderer.graphicsContext.updateGpuContext(t);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(e,t){const i=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),i.isBatchable?this._addToBatcher(e,t):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){const r=this._getGpuDataForRenderable(e).batches;for(let i=0;i<r.length;i++){const s=r[i];s._batcher.updateElement(s)}}execute(e){if(!e.isRenderable)return;const t=this.renderer,r=e.context;if(!t.graphicsContext.getGpuContext(r).batches.length)return;const s=r.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;const o=s.resources.localUniforms.uniforms;o.uTransformMatrix=e.groupTransform,o.uRound=t._roundPixels|e._roundPixels,z1(e.groupColorAlpha,o.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){const t=this._getGpuDataForRenderable(e),i=this.renderer.graphicsContext.updateGpuContext(e.context);t.destroy(),i.isBatchable&&this._updateBatchesForRenderable(e,t)}_addToBatcher(e,t){const r=this.renderer.renderPipes.batch,i=this._getGpuDataForRenderable(e).batches;for(let s=0;s<i.length;s++){const o=i[s];r.addToBatch(o,t)}}_getGpuDataForRenderable(e){return e._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(e)}_initGpuDataForRenderable(e){const t=new wA;return e._gpuData[this.renderer.uid]=t,this._managedGraphics.add(e),t}_updateBatchesForRenderable(e,t){const r=e.context,s=this.renderer.graphicsContext.getGpuContext(r),o=this.renderer._roundPixels|e._roundPixels;t.batches=s.batches.map(a=>{const l=ut.get(df);return a.copyTo(l),l.renderable=e,l.roundPixels=o,l})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}W1.extension={type:[k.WebGLPipes,k.WebGPUPipes],name:"graphics"};ae.add(N1);ae.add(W1);ae.add(bA);ae.add(gf);class Be extends ef{constructor(e){e instanceof pn&&(e={context:e});const{context:t,roundPixels:r,...i}=e||{};super({label:"Graphics",...i}),this.renderPipeId="graphics",t?this.context=t:(this.context=this._ownedContext=new pn,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=r??!1}set context(e){e!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=e,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(e){return this._context.containsPoint(e)}destroy(e){var t,r;this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||(e==null?void 0:e.context)===!0)&&this._context.destroy(e),(t=this._context)==null||t.off("update",this.onViewUpdate,this),(r=this._context)==null||r.off("unload",this.unload,this),this._ownedContext=null,this._context=null,super.destroy(e)}_onTouch(e){this._gcLastUsed=e,this._context._gcLastUsed=e}_callContextMethod(e,t){return this.context[e](...t),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new Be(this._context.clone()):(this._ownedContext=null,new Be(this._context))}lineStyle(e,t,r){ie(Ge,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const i={};return e&&(i.width=e),t&&(i.color=t),r&&(i.alpha=r),this.context.strokeStyle=i,this}beginFill(e,t){ie(Ge,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const r={};return e!==void 0&&(r.color=e),t!==void 0&&(r.alpha=t),this.context.fillStyle=r,this}endFill(){ie(Ge,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const e=this.context.strokeStyle;return(e.width!==pn.defaultStrokeStyle.width||e.color!==pn.defaultStrokeStyle.color||e.alpha!==pn.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return ie(Ge,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return ie(Ge,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return ie(Ge,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return ie(Ge,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return ie(Ge,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return ie(Ge,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}class Ol extends qn{constructor(...e){let t=e[0];Array.isArray(e[0])&&(t={textures:e[0],autoUpdate:e[1]});const{animationSpeed:r=1,autoPlay:i=!1,autoUpdate:s=!0,loop:o=!0,onComplete:a=null,onFrameChange:l=null,onLoop:u=null,textures:c,updateAnchor:h=!1,...d}=t,[f]=c;super({...d,texture:f instanceof Q?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=s,this._isConnectedToTicker=!1,this.animationSpeed=r,this.loop=o,this.updateAnchor=h,this.onComplete=a,this.onFrameChange=l,this.onLoop=u,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,i&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(St.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(St.shared.add(this.update,this,si.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(e){this.stop(),this.currentFrame=e}gotoAndPlay(e){this.currentFrame=e,this.play()}update(e){if(!this._playing)return;const t=e.deltaTime,r=this.animationSpeed*t,i=this.currentFrame;if(this._durations!==null){let s=this._currentTime%1*this._durations[this.currentFrame];for(s+=r/60*1e3;s<0;)this._currentTime--,s+=this._durations[this.currentFrame];const o=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);s>=this._durations[this.currentFrame];)s-=this._durations[this.currentFrame]*o,this._currentTime+=o;this._currentTime+=s/this._durations[this.currentFrame]}else this._currentTime+=r;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()):i!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<i||this.animationSpeed<0&&this.currentFrame>i)&&this.onLoop(),this._updateTexture())}_updateTexture(){const e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this.texture=this._textures[e],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(e=!1){if(typeof e=="boolean"?e:e==null?void 0:e.texture){const r=typeof e=="boolean"?e:e==null?void 0:e.textureSource;this._textures.forEach(i=>{this.texture!==i&&i.destroy(r)})}this._textures=[],this._durations=null,this.stop(),super.destroy(e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(e){const t=[];for(let r=0;r<e.length;++r)t.push(Q.from(e[r]));return new Ol(t)}static fromImages(e){const t=[];for(let r=0;r<e.length;++r)t.push(Q.from(e[r]));return new Ol(t)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(e){if(e[0]instanceof Q)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(let t=0;t<e.length;t++)this._textures.push(e[t].texture),this._durations.push(e[t].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e}set currentFrame(e){if(e<0||e>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${e}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(St.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(St.shared.add(this.update,this),this._isConnectedToTicker=!0))}}const Za={name:"local-uniform-bit",vertex:{header:`
|
|
554
|
+
|
|
555
|
+
struct LocalUniforms {
|
|
556
|
+
uTransformMatrix:mat3x3<f32>,
|
|
557
|
+
uColor:vec4<f32>,
|
|
558
|
+
uRound:f32,
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
@group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
562
|
+
`,main:`
|
|
563
|
+
vColor *= localUniforms.uColor;
|
|
564
|
+
modelMatrix *= localUniforms.uTransformMatrix;
|
|
565
|
+
`,end:`
|
|
566
|
+
if(localUniforms.uRound == 1)
|
|
567
|
+
{
|
|
568
|
+
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
569
|
+
}
|
|
570
|
+
`}},SA={...Za,vertex:{...Za.vertex,header:Za.vertex.header.replace("group(1)","group(2)")}},H1={name:"local-uniform-bit",vertex:{header:`
|
|
571
|
+
|
|
572
|
+
uniform mat3 uTransformMatrix;
|
|
573
|
+
uniform vec4 uColor;
|
|
574
|
+
uniform float uRound;
|
|
575
|
+
`,main:`
|
|
576
|
+
vColor *= uColor;
|
|
577
|
+
modelMatrix = uTransformMatrix;
|
|
578
|
+
`,end:`
|
|
579
|
+
if(uRound == 1.)
|
|
580
|
+
{
|
|
581
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
582
|
+
}
|
|
583
|
+
`}};class TA extends ef{constructor(e,t){const{text:r,resolution:i,style:s,anchor:o,width:a,height:l,roundPixels:u,...c}=e;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=r??"",this.style=s,this.resolution=i??null,this.allowChildren=!1,this._anchor=new ft({_onUpdate:()=>{this.onViewUpdate()}}),o&&(this.anchor=o),this.roundPixels=u??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){var t;e||(e={}),(t=this._style)==null||t.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this.bounds.width),t!==void 0&&this._setHeight(t,this.bounds.height)}containsPoint(e){const t=this.bounds.width,r=this.bounds.height,i=-t*this.anchor.x;let s=0;return e.x>=i&&e.x<=i+t&&(s=-r*this.anchor.y,e.y>=s&&e.y<=s+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(e=!1){var t;(t=this._style)==null||t.off("update",this.onViewUpdate,this),super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e!=null&&e.style)&&this._style.destroy(e),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}function CA(n,e){let t=n[0]??{};return(typeof t=="string"||n[1])&&(ie(Ge,`use new ${e}({ text: "hi!", style }) instead`),t={text:t,style:n[1]}),t}let Gr=null,Nn=null;function EA(n,e){Gr||(Gr=pe.get().createCanvas(256,128),Nn=Gr.getContext("2d",{willReadFrequently:!0}),Nn.globalCompositeOperation="copy",Nn.globalAlpha=1),(Gr.width<n||Gr.height<e)&&(Gr.width=os(n),Gr.height=os(e))}function qm(n,e,t){for(let r=0,i=4*t*e;r<e;++r,i+=4)if(n[i+3]!==0)return!1;return!0}function Qm(n,e,t,r,i){const s=4*e;for(let o=r,a=r*s+4*t;o<=i;++o,a+=s)if(n[a+3]!==0)return!1;return!0}function AA(...n){let e=n[0];e.canvas||(e={canvas:n[0],resolution:n[1]});const{canvas:t}=e,r=Math.min(e.resolution??1,1),i=e.width??t.width,s=e.height??t.height;let o=e.output;if(EA(i,s),!Nn)throw new TypeError("Failed to get canvas 2D context");Nn.drawImage(t,0,0,i,s,0,0,i*r,s*r);const l=Nn.getImageData(0,0,i,s).data;let u=0,c=0,h=i-1,d=s-1;for(;c<s&&qm(l,i,c);)++c;if(c===s)return xe.EMPTY;for(;qm(l,i,d);)--d;for(;Qm(l,i,u,c,d);)++u;for(;Qm(l,i,h,c,d);)--h;return++h,++d,Nn.globalCompositeOperation="source-over",Nn.strokeRect(u,c,h-u,d-c),Nn.globalCompositeOperation="copy",o??(o=new xe),o.set(u/r,c/r,(h-u)/r,(d-c)/r),o}/**
|
|
584
|
+
* tiny-lru
|
|
585
|
+
*
|
|
586
|
+
* @copyright 2026 Jason Mulligan <jason.mulligan@avoidwork.com>
|
|
587
|
+
* @license BSD-3-Clause
|
|
588
|
+
* @version 11.4.7
|
|
589
|
+
*/class kA{constructor(e=0,t=0,r=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=r,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const t=this.items[e];delete this.items[e],this.size--,t.prev!==null&&(t.prev.next=t.next),t.next!==null&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){const t=new Array(e.length);for(let r=0;r<e.length;r++){const i=e[r];t[r]=[i,this.get(i)]}return t}evict(e=!1){if(e||this.size>0){const t=this.first;delete this.items[t.key],--this.size===0?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){const t=this.items[e];if(t!==void 0){if(this.ttl>0&&t.expiry<=Date.now()){this.delete(e);return}return this.moveToEnd(t),t.value}}has(e){return e in this.items}moveToEnd(e){this.last!==e&&(e.prev!==null&&(e.prev.next=e.next),e.next!==null&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),e.prev=this.last,e.next=null,this.last!==null&&(this.last.next=e),this.last=e,this.first===null&&(this.first=e))}keys(){const e=new Array(this.size);let t=this.first,r=0;for(;t!==null;)e[r++]=t.key,t=t.next;return e}setWithEvicted(e,t,r=this.resetTtl){let i=null;if(this.has(e))this.set(e,t,!0,r);else{this.max>0&&this.size===this.max&&(i={...this.first},this.evict(!0));let s=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};++this.size===1?this.first=s:this.last.next=s,this.last=s}return i}set(e,t,r=!1,i=this.resetTtl){let s=this.items[e];return r||s!==void 0?(s.value=t,r===!1&&i&&(s.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(s)):(this.max>0&&this.size===this.max&&this.evict(!0),s=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},++this.size===1?this.first=s:this.last.next=s,this.last=s),this}values(e=this.keys()){const t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=this.get(e[r]);return t}}function PA(n=1e3,e=0,t=!1){if(isNaN(n)||n<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if(typeof t!="boolean")throw new TypeError("Invalid resetTtl value");return new kA(n,e,t)}function V1(n){return!!n.tagStyles&&Object.keys(n.tagStyles).length>0}function j1(n){return n.includes("<")}function MA(n,e){return n.clone().assign(e)}function RA(n,e){const t=[],r=e.tagStyles;if(!V1(e)||!j1(n))return t.push({text:n,style:e}),t;const i=[e],s=[];let o="",a=0;for(;a<n.length;){const l=n[a];if(l==="<"){const u=n.indexOf(">",a);if(u===-1){o+=l,a++;continue}const c=n.indexOf("<",a+1);if(c!==-1&&c<u){o+=l,a++;continue}const h=n.slice(a+1,u);if(h.startsWith("/")){const d=h.slice(1).trim();if(s.length>0&&s[s.length-1]===d){o.length>0&&(t.push({text:o,style:i[i.length-1]}),o=""),i.pop(),s.pop(),a=u+1;continue}else{o+=n.slice(a,u+1),a=u+1;continue}}else{const d=h.trim();if(r[d]){o.length>0&&(t.push({text:o,style:i[i.length-1]}),o="");const f=i[i.length-1],p=MA(f,r[d]);i.push(p),s.push(d),a=u+1;continue}else{o+=n.slice(a,u+1),a=u+1;continue}}}else o+=l,a++}return o.length>0&&t.push({text:o,style:i[i.length-1]}),t}const IA=[10,13],BA=new Set(IA),DA=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],FA=new Set(DA),GA=[9,32];new Set(GA);const OA=[45,8208,8211,8212,173],LA=new Set(OA),UA=/(\r\n|\r|\n)/,NA=/(?:\r\n|\r|\n)/;function Ll(n){return typeof n!="string"?!1:BA.has(n.charCodeAt(0))}function Jt(n,e){return typeof n!="string"?!1:FA.has(n.charCodeAt(0))}function zA(n){return typeof n!="string"?!1:LA.has(n.charCodeAt(0))}function $1(n){return n==="normal"||n==="pre-line"}function X1(n){return n==="normal"}function On(n){if(typeof n!="string")return"";let e=n.length-1;for(;e>=0&&Jt(n[e]);)e--;return e<n.length-1?n.slice(0,e+1):n}function Y1(n){const e=[],t=[];if(typeof n!="string")return e;for(let r=0;r<n.length;r++){const i=n[r],s=n[r+1];if(Jt(i)||Ll(i)){t.length>0&&(e.push(t.join("")),t.length=0),i==="\r"&&s===`
|
|
590
|
+
`?(e.push(`\r
|
|
591
|
+
`),r++):e.push(i);continue}t.push(i),zA(i)&&s&&!Jt(s)&&!Ll(s)&&(e.push(t.join("")),t.length=0)}return t.length>0&&e.push(t.join("")),e}function K1(n,e,t,r){const i=t(n),s=[];for(let o=0;o<i.length;o++){let a=i[o],l=a,u=1;for(;i[o+u];){const c=i[o+u];if(!r(l,c,n,o,e))a+=c,l=c,u++;else break}o+=u-1,s.push(a)}return s}const WA=/\r\n|\r|\n/g;function HA(n,e,t,r,i,s,o,a,l){var K,Ee;const u=RA(n,e);if(X1(e.whiteSpace))for(let N=0;N<u.length;N++){const $=u[N];u[N]={text:$.text.replace(WA," "),style:$.style}}const h=[];let d=[];for(const N of u){const $=N.text.split(UA);for(let D=0;D<$.length;D++){const B=$[D];B===`\r
|
|
592
|
+
`||B==="\r"||B===`
|
|
593
|
+
`?(h.push(d),d=[]):B.length>0&&d.push({text:B,style:N.style})}}(d.length>0||h.length===0)&&h.push(d);const f=t?VA(h,e,r,s,a,l):h,p=[],g=[],_=[],m=[],y=[];let x=0;const b=e._fontString,S=o(b);S.fontSize===0&&(S.fontSize=e.fontSize,S.ascent=e.fontSize);let T="",C=!!e.dropShadow,M=((K=e._stroke)==null?void 0:K.width)||0;for(const N of f){let $=0,D=S.ascent,B=S.descent,W="";for(const X of N){const ne=X.style._fontString,fe=o(ne);ne!==T&&(r.font=ne,T=ne);const me=i(X.text,X.style.letterSpacing,r);$+=me,D=Math.max(D,fe.ascent),B=Math.max(B,fe.descent),W+=X.text;const le=((Ee=X.style._stroke)==null?void 0:Ee.width)||0;le>M&&(M=le),!C&&X.style.dropShadow&&(C=!0)}N.length===0&&(D=S.ascent,B=S.descent),p.push($),g.push(D),_.push(B),y.push(W);const J=e.lineHeight||D+B;m.push(J+e.leading),x=Math.max(x,$)}const L=M,R=x+L+(e.dropShadow?e.dropShadow.distance:0);let O=0;for(let N=0;N<m.length;N++)O+=m[N];O=Math.max(O,m[0]+L);const U=O+(e.dropShadow?e.dropShadow.distance:0),j=e.lineHeight||S.fontSize;return{width:R,height:U,lines:y,lineWidths:p,lineHeight:j+e.leading,maxLineWidth:x,fontProperties:S,runsByLine:f,lineAscents:g,lineDescents:_,lineHeights:m,hasDropShadow:C}}function VA(n,e,t,r,i,s){var _;const{letterSpacing:o,whiteSpace:a,wordWrapWidth:l,breakWords:u}=e,c=$1(a),h=l+o,d={};let f="";const p=(m,y)=>{const x=`${m}|${y.styleKey}`;let b=d[x];if(b===void 0){const S=y._fontString;S!==f&&(t.font=S,f=S),b=r(m,y.letterSpacing,t)+y.letterSpacing,d[x]=b}return b},g=[];for(const m of n){const y=jA(m),x=g.length,b=U=>{let j=0,K=U;do{const{token:Ee,style:N}=y[K];j+=p(Ee,N),K++}while(K<y.length&&y[K].continuesFromPrevious);return j},S=U=>{const j=[];let K=U;do j.push({token:y[K].token,style:y[K].style}),K++;while(K<y.length&&y[K].continuesFromPrevious);return j};let T=[],C=0,M=!c,L=null;const R=()=>{L&&L.text.length>0&&T.push(L),L=null},O=()=>{if(R(),T.length>0){const U=T[T.length-1];U.text=On(U.text),U.text.length===0&&T.pop()}g.push(T),T=[],C=0,M=!1};for(let U=0;U<y.length;U++){const{token:j,style:K,continuesFromPrevious:Ee}=y[U],N=p(j,K);if(c){const B=Jt(j),W=(L==null?void 0:L.text[L.text.length-1])??((_=T[T.length-1])==null?void 0:_.text.slice(-1))??"",J=W?Jt(W):!1;if(B&&J)continue}const $=!Ee,D=$?b(U):N;if(D>h&&$)if(C>0&&O(),u){const B=S(U);for(let W=0;W<B.length;W++){const J=B[W].token,X=B[W].style,ne=K1(J,u,s,i);for(const fe of ne){const me=p(fe,X);me+C>h&&O(),!L||L.style!==X?(R(),L={text:fe,style:X}):L.text+=fe,C+=me}}U+=B.length-1}else{const B=S(U);R(),g.push(B.map(W=>({text:W.token,style:W.style}))),M=!1,U+=B.length-1}else if(D+C>h&&$){if(Jt(j)){M=!1;continue}O(),L={text:j,style:K},C=N}else if(Ee&&!u)!L||L.style!==K?(R(),L={text:j,style:K}):L.text+=j,C+=N;else{const B=Jt(j);if(C===0&&B&&!M)continue;!L||L.style!==K?(R(),L={text:j,style:K}):L.text+=j,C+=N}}if(R(),T.length>0){const U=T[T.length-1];U.text=On(U.text),U.text.length===0&&T.pop()}(T.length>0||g.length===x)&&g.push(T)}return g}function jA(n){const e=[];let t=!1;for(const r of n){const i=Y1(r.text);let s=!0;for(const o of i){const a=Jt(o)||Ll(o),l=s&&t&&!a;e.push({token:o,style:r.style,continuesFromPrevious:l}),t=!a,s=!1}}return e}const $A={willReadFrequently:!0};function Zm(n,e,t,r,i){let s=t[n];return typeof s!="number"&&(s=i(n,e,r)+e,t[n]=s),s}function XA(n,e,t,r,i,s,o){const a=t.getContext("2d",$A);a.font=e._fontString;let l=0,u="";const c=[],h=Object.create(null),{letterSpacing:d,whiteSpace:f}=e,p=$1(f),g=X1(f);let _=!p;const m=e.wordWrapWidth+d,y=Y1(n);for(let b=0;b<y.length;b++){let S=y[b];if(Ll(S)){if(!g){c.push(On(u)),_=!p,u="",l=0;continue}S=" "}if(p){const C=Jt(S),M=Jt(u[u.length-1]);if(C&&M)continue}const T=Zm(S,d,h,a,r);if(T>m)if(u!==""&&(c.push(On(u)),u="",l=0),i(S,e.breakWords)){const C=K1(S,e.breakWords,o,s);for(const M of C){const L=Zm(M,d,h,a,r);L+l>m&&(c.push(On(u)),_=!1,u="",l=0),u+=M,l+=L}}else u.length>0&&(c.push(On(u)),u="",l=0),c.push(On(S)),_=!1,u="",l=0;else T+l>m&&(_=!1,c.push(On(u)),u="",l=0),(u.length>0||!Jt(S)||_)&&(u+=S,l+=T)}const x=On(u);return x.length>0&&c.push(x),c.join(`
|
|
594
|
+
`)}const Jm={willReadFrequently:!0},nr=class re{static get experimentalLetterSpacingSupported(){let e=re._experimentalLetterSpacingSupported;if(e===void 0){const t=pe.get().getCanvasRenderingContext2D().prototype;e=re._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,r,i,s,o,a,l,u,c){this.text=e,this.style=t,this.width=r,this.height=i,this.lines=s,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=u,c&&(this.runsByLine=c.runsByLine,this.lineAscents=c.lineAscents,this.lineDescents=c.lineDescents,this.lineHeights=c.lineHeights,this.hasDropShadow=c.hasDropShadow)}static measureText(e=" ",t,r=re._canvas,i=t.wordWrap){var b;const s=`${e}-${t.styleKey}-wordWrap-${i}`;if(re._measurementCache.has(s))return re._measurementCache.get(s);if(V1(t)&&j1(e)){const S=HA(e,t,i,re._context,re._measureText,re._measureTextAdvance,re.measureFont,re.canBreakChars,re.wordWrapSplit),T=new re(e,t,S.width,S.height,S.lines,S.lineWidths,S.lineHeight,S.maxLineWidth,S.fontProperties,{runsByLine:S.runsByLine,lineAscents:S.lineAscents,lineDescents:S.lineDescents,lineHeights:S.lineHeights,hasDropShadow:S.hasDropShadow});return re._measurementCache.set(s,T),T}const a=t._fontString,l=re.measureFont(a);l.fontSize===0&&(l.fontSize=t.fontSize,l.ascent=t.fontSize,l.descent=0);const u=re._context;u.font=a;const h=(i?re._wordWrap(e,t,r):e).split(NA),d=new Array(h.length);let f=0;for(let S=0;S<h.length;S++){const T=re._measureText(h[S],t.letterSpacing,u);d[S]=T,f=Math.max(f,T)}const p=((b=t._stroke)==null?void 0:b.width)??0,g=t.lineHeight||l.fontSize,_=re._adjustWidthForStyle(f,t),m=Math.max(g,l.fontSize+p)+(h.length-1)*(g+t.leading),y=re._adjustHeightForStyle(m,t),x=new re(e,t,_,y,h,d,g+t.leading,f,l);return re._measurementCache.set(s,x),x}static _adjustWidthForStyle(e,t){var s;const r=((s=t._stroke)==null?void 0:s.width)||0;let i=e+r;return t.dropShadow&&(i+=t.dropShadow.distance),i}static _adjustHeightForStyle(e,t){let r=e;return t.dropShadow&&(r+=t.dropShadow.distance),r}static _measureText(e,t,r){const{metricWidth:i,metrics:s,letterSpacingVal:o}=re._measureTextCore(e,t,r),a=-(s.actualBoundingBoxLeft??0);let u=(s.actualBoundingBoxRight??0)-a;return s.width>0&&(u+=o),Math.max(i,u)}static _measureTextAdvance(e,t,r){return re._measureTextCore(e,t,r).metricWidth}static _measureTextCore(e,t,r){let i=!1;re.experimentalLetterSpacingSupported&&(re.experimentalLetterSpacing?(r.letterSpacing=`${t}px`,r.textLetterSpacing=`${t}px`,i=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));const s=r.measureText(e);let o=s.width,a=0;return o>0&&(i?a=-t:a=(re.graphemeSegmenter(e).length-1)*t,o+=a),{metricWidth:o,metrics:s,letterSpacingVal:a}}static _wordWrap(e,t,r=re._canvas){return XA(e,t,r,re._measureTextAdvance,re.canBreakWords,re.canBreakChars,re.wordWrapSplit)}static isBreakingSpace(e,t){return Jt(e)}static canBreakWords(e,t){return t}static canBreakChars(e,t,r,i,s){return!0}static wordWrapSplit(e){return re.graphemeSegmenter(e)}static measureFont(e){if(re._fonts[e])return re._fonts[e];const t=re._context;t.font=e;const r=t.measureText(re.METRICS_STRING+re.BASELINE_SYMBOL),i=r.actualBoundingBoxAscent??0,s=r.actualBoundingBoxDescent??0,o={ascent:i,descent:s,fontSize:i+s};return re._fonts[e]=o,o}static clearMetrics(e=""){e?delete re._fonts[e]:re._fonts={}}static get _canvas(){if(!re.__canvas){let e;try{const t=new OffscreenCanvas(0,0),r=t.getContext("2d",Jm);if(r!=null&&r.measureText)return re.__canvas=t,t;e=pe.get().createCanvas()}catch{e=pe.get().createCanvas()}e.width=e.height=10,re.__canvas=e}return re.__canvas}static get _context(){return re.__context||(re.__context=re._canvas.getContext("2d",Jm)),re.__context}};nr.METRICS_STRING="|ÉqÅ";nr.BASELINE_SYMBOL="M";nr.BASELINE_MULTIPLIER=1.4;nr.HEIGHT_MULTIPLIER=2;nr.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const n=new Intl.Segmenter;return e=>{const t=n.segment(e),r=[];let i=0;for(const s of t)r[i++]=s.segment;return r}}return n=>[...n]})();nr.experimentalLetterSpacing=!1;nr._fonts={};nr._measurementCache=PA(1e3);let ar=nr;const YA=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function Hh(n){const e=typeof n.fontSize=="number"?`${n.fontSize}px`:n.fontSize;let t=n.fontFamily;Array.isArray(n.fontFamily)||(t=n.fontFamily.split(","));for(let r=t.length-1;r>=0;r--){let i=t[r].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&!YA.includes(i)&&(i=`"${i}"`),t[r]=i}return`${n.fontStyle} ${n.fontVariant} ${n.fontWeight} ${e} ${t.join(",")}`}const eg=1e5;function Ba(n,e,t,r=0,i=0,s=0){if(n.texture===Q.WHITE&&!n.fill)return Ce.shared.setValue(n.color).setAlpha(n.alpha??1).toHexa();if(n.fill){if(n.fill instanceof Xo){const o=n.fill,a=e.createPattern(o.texture.source.resource,"repeat");return ce.applyPatternTransform(a,o.transform,!1),a}else if(n.fill instanceof Mn){const o=n.fill,a=o.type==="linear",l=o.textureSpace==="local";let u=1,c=1;l&&t&&(u=t.width+r,c=t.height+r);let h,d=!1;if(a){const{start:f,end:p}=o;h=e.createLinearGradient(f.x*u+i,f.y*c+s,p.x*u+i,p.y*c+s),d=Math.abs(p.x-f.x)<Math.abs((p.y-f.y)*.1)}else{const{center:f,innerRadius:p,outerCenter:g,outerRadius:_}=o;h=e.createRadialGradient(f.x*u+i,f.y*c+s,p*u,g.x*u+i,g.y*c+s,_*u)}if(d&&l&&t){const f=t.lineHeight/c;for(let p=0;p<t.lines.length;p++){const g=(p*t.lineHeight+r/2)/c;o.colorStops.forEach(_=>{let m=g+_.offset*f;m=Math.max(0,Math.min(1,m)),h.addColorStop(Math.floor(m*eg)/eg,Ce.shared.setValue(_.color).toHex())})}}else o.colorStops.forEach(f=>{h.addColorStop(f.offset,Ce.shared.setValue(f.color).toHex())});return h}}else{const o=e.createPattern(n.texture.source.resource,"repeat"),a=n.matrix.copyTo(Z.shared);return a.scale(n.texture.source.pixelWidth,n.texture.source.pixelHeight),o.setTransform(a),o}return se("FillStyle not recognised",n),"red"}const tg=new xe;function wi(n){let e=0;for(let t=0;t<n.length;t++)n.charCodeAt(t)===32&&e++;return e}class KA{getCanvasAndContext(e){const{text:t,style:r,resolution:i=1}=e,s=r._getFinalPadding(),o=ar.measureText(t||" ",r),a=Math.ceil(Math.ceil(Math.max(1,o.width)+s*2)*i),l=Math.ceil(Math.ceil(Math.max(1,o.height)+s*2)*i),u=cs.getOptimalCanvasAndContext(a,l);this._renderTextToCanvas(r,s,i,u,o);const c=r.trim?AA({canvas:u.canvas,width:a,height:l,resolution:1,output:tg}):tg.set(0,0,a,l);return{canvasAndContext:u,frame:c}}returnCanvasAndContext(e){cs.returnCanvasAndContext(e)}_renderTextToCanvas(e,t,r,i,s){var S,T,C;if(s.runsByLine&&s.runsByLine.length>0){this._renderTaggedTextToCanvas(s,e,t,r,i);return}const{canvas:o,context:a}=i,l=Hh(e),u=s.lines,c=s.lineHeight,h=s.lineWidths,d=s.maxLineWidth,f=s.fontProperties,p=o.height;if(a.resetTransform(),a.scale(r,r),a.textBaseline=e.textBaseline,(S=e._stroke)!=null&&S.width){const M=e._stroke;a.lineWidth=M.width,a.miterLimit=M.miterLimit,a.lineJoin=M.join,a.lineCap=M.cap}a.font=l;let g,_;const m=e.dropShadow?2:1,x=(((T=e._stroke)==null?void 0:T.width)??0)/2;let b=(c-f.fontSize)/2;c-f.fontSize<0&&(b=0);for(let M=0;M<m;++M){const L=e.dropShadow&&M===0,R=L?Math.ceil(Math.max(1,p)+t*2):0,O=R*r;if(L)this._setupDropShadow(a,e,r,O);else{const U=e._gradientBounds,j=e._gradientOffset;if(U){const K={width:U.width,height:U.height,lineHeight:U.height,lines:s.lines};this._setFillAndStrokeStyles(a,e,K,t,x,(j==null?void 0:j.x)??0,(j==null?void 0:j.y)??0)}else j?this._setFillAndStrokeStyles(a,e,s,t,x,j.x,j.y):this._setFillAndStrokeStyles(a,e,s,t,x);a.shadowColor="rgba(0,0,0,0)"}for(let U=0;U<u.length;U++){g=x,_=x+U*c+f.ascent+b,g+=this._getAlignmentOffset(h[U],d,e.align);let j=0;if(e.align==="justify"&&e.wordWrap&&U<u.length-1){const K=wi(u[U]);K>0&&(j=(d-h[U])/K)}(C=e._stroke)!=null&&C.width&&this._drawLetterSpacing(u[U],e,i,g+t,_+t-R,!0,j),e._fill!==void 0&&this._drawLetterSpacing(u[U],e,i,g+t,_+t-R,!1,j)}}}_renderTaggedTextToCanvas(e,t,r,i,s){var x,b,S;const{canvas:o,context:a}=s,{runsByLine:l,lineWidths:u,maxLineWidth:c,lineAscents:h,lineHeights:d,hasDropShadow:f}=e,p=o.height;a.resetTransform(),a.scale(i,i),a.textBaseline=t.textBaseline;const g=f?2:1;let _=((x=t._stroke)==null?void 0:x.width)??0;for(const T of l)for(const C of T){const M=((b=C.style._stroke)==null?void 0:b.width)??0;M>_&&(_=M)}const m=_/2,y=[];for(let T=0;T<l.length;T++){const C=l[T],M=[];for(const L of C){const R=Hh(L.style);a.font=R,M.push({width:ar._measureText(L.text,L.style.letterSpacing,a),font:R})}y.push(M)}for(let T=0;T<g;++T){const C=f&&T===0,M=C?Math.ceil(Math.max(1,p)+r*2):0,L=M*i;C||(a.shadowColor="rgba(0,0,0,0)");let R=m;for(let O=0;O<l.length;O++){const U=l[O],j=u[O],K=h[O],Ee=d[O],N=y[O];let $=m;$+=this._getAlignmentOffset(j,c,t.align);let D=0;if(t.align==="justify"&&t.wordWrap&&O<l.length-1){let J=0;for(const X of U)J+=wi(X.text);J>0&&(D=(c-j)/J)}const B=R+K;let W=$+r;for(let J=0;J<U.length;J++){const X=U[J],{width:ne,font:fe}=N[J];if(a.font=fe,a.textBaseline=X.style.textBaseline,(S=X.style._stroke)!=null&&S.width){const le=X.style._stroke;if(a.lineWidth=le.width,a.miterLimit=le.miterLimit,a.lineJoin=le.join,a.lineCap=le.cap,C)if(X.style.dropShadow)this._setupDropShadow(a,X.style,i,L);else{const ve=wi(X.text);W+=ne+ve*D;continue}else{const ve=ar.measureFont(fe),rt=X.style.lineHeight||ve.fontSize,ue={width:ne,height:rt,lineHeight:rt,lines:[X.text]};a.strokeStyle=Ba(le,a,ue,r*2,W-r,R)}this._drawLetterSpacing(X.text,X.style,s,W,B+r-M,!0,D)}const me=wi(X.text);W+=ne+me*D}W=$+r;for(let J=0;J<U.length;J++){const X=U[J],{width:ne,font:fe}=N[J];if(a.font=fe,a.textBaseline=X.style.textBaseline,X.style._fill!==void 0){if(C)if(X.style.dropShadow)this._setupDropShadow(a,X.style,i,L);else{const le=wi(X.text);W+=ne+le*D;continue}else{const le=ar.measureFont(fe),ve=X.style.lineHeight||le.fontSize,rt={width:ne,height:ve,lineHeight:ve,lines:[X.text]};a.fillStyle=Ba(X.style._fill,a,rt,r*2,W-r,R)}this._drawLetterSpacing(X.text,X.style,s,W,B+r-M,!1,D)}const me=wi(X.text);W+=ne+me*D}R+=Ee}}}_setFillAndStrokeStyles(e,t,r,i,s,o=0,a=0){var l;if(e.fillStyle=t._fill?Ba(t._fill,e,r,i*2,o,a):null,(l=t._stroke)!=null&&l.width){const u=s+i*2;e.strokeStyle=Ba(t._stroke,e,r,u,o,a)}}_setupDropShadow(e,t,r,i){e.fillStyle="black",e.strokeStyle="black";const s=t.dropShadow,o=s.color,a=s.alpha;e.shadowColor=Ce.shared.setValue(o).setAlpha(a).toRgbaString();const l=s.blur*r,u=s.distance*r;e.shadowBlur=l,e.shadowOffsetX=Math.cos(s.angle)*u,e.shadowOffsetY=Math.sin(s.angle)*u+i}_getAlignmentOffset(e,t,r){return r==="right"?t-e:r==="center"?(t-e)/2:0}_drawLetterSpacing(e,t,r,i,s,o=!1,a=0){const{context:l}=r,u=t.letterSpacing;let c=!1;if(ar.experimentalLetterSpacingSupported&&(ar.experimentalLetterSpacing?(l.letterSpacing=`${u}px`,l.textLetterSpacing=`${u}px`,c=!0):(l.letterSpacing="0px",l.textLetterSpacing="0px")),(u===0||c)&&a===0){o?l.strokeText(e,i,s):l.fillText(e,i,s);return}if(a!==0&&(u===0||c)){const g=e.split(" ");let _=i;const m=l.measureText(" ").width;for(let y=0;y<g.length;y++)o?l.strokeText(g[y],_,s):l.fillText(g[y],_,s),_+=l.measureText(g[y]).width+m+a;return}let h=i;const d=ar.graphemeSegmenter(e);let f=l.measureText(e).width,p=0;for(let g=0;g<d.length;++g){const _=d[g];o?l.strokeText(_,h,s):l.fillText(_,h,s);let m="";for(let y=g+1;y<d.length;++y)m+=d[y];p=l.measureText(m).width,h+=f-p+u,_===" "&&(h+=a),f=p}}}const Vi=new KA,vf=class Vr extends Ot{constructor(e={}){super(),this.uid=be("textStyle"),this._tick=0,this._cachedFontString=null,qA(e),e instanceof Vr&&(e=e._toObject());const i={...Vr.defaultTextStyle,...e};for(const s in i){const o=s;this[o]=i[s]}this._tagStyles=e.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.update())}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords!==e&&(this._breakWords=e,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(e!==null&&typeof e=="object"?this._dropShadow=this._createProxy({...Vr.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...Vr.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.update())}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize!==e&&(typeof e=="string"?this._fontSize=parseInt(e,10):this._fontSize=e,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle!==e&&(this._fontStyle=e.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant!==e&&(this._fontVariant=e,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.update())}get leading(){return this._leading}set leading(e){this._leading!==e&&(this._leading=e,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.update())}get padding(){return this._padding}set padding(e){this._padding!==e&&(this._padding=e,this.update())}get filters(){return this._filters}set filters(e){this._filters!==e&&(this._filters=Object.freeze(e),this.update())}get trim(){return this._trim}set trim(e){this._trim!==e&&(this._trim=e,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline!==e&&(this._textBaseline=e,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap!==e&&(this._wordWrap=e,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.update())}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...pn.defaultFillStyle,...e},()=>{this._fill=Kr({...this._originalFill},pn.defaultFillStyle)})),this._fill=Kr(e===0?"black":e,pn.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...pn.defaultStrokeStyle,...e},()=>{this._stroke=Fl({...this._originalStroke},pn.defaultStrokeStyle)})),this._stroke=Fl(e,pn.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(e){this._tagStyles!==e&&(this._tagStyles=e??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){const e=Vr.defaultTextStyle;for(const t in e)this[t]=e[t]}assign(e){for(const t in e){const r=t;this[r]=e[t]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return this._cachedFontString===null&&(this._cachedFontString=Hh(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new Vr(this._toObject())}_getFinalPadding(){let e=0;if(this._filters)for(let t=0;t<this._filters.length;t++)e+=this._filters[t].padding;return Math.max(this._padding,e)}destroy(e=!1){var r,i,s,o;if(this.removeAllListeners(),typeof e=="boolean"?e:e==null?void 0:e.texture){const a=typeof e=="boolean"?e:e==null?void 0:e.textureSource;(r=this._fill)!=null&&r.texture&&this._fill.texture.destroy(a),(i=this._originalFill)!=null&&i.texture&&this._originalFill.texture.destroy(a),(s=this._stroke)!=null&&s.texture&&this._stroke.texture.destroy(a),(o=this._originalStroke)!=null&&o.texture&&this._originalStroke.texture.destroy(a)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(e,t){return new Proxy(e,{set:(r,i,s)=>(r[i]===s||(r[i]=s,t==null||t(i,s),this.update()),!0)})}_isFillStyle(e){return(e??null)!==null&&!(Ce.isColorLike(e)||e instanceof Mn||e instanceof Xo)}};vf.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};vf.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Ul=vf;function qA(n){const e=n;if(typeof e.dropShadow=="boolean"&&e.dropShadow){const t=Ul.defaultDropShadow;n.dropShadow={alpha:e.dropShadowAlpha??t.alpha,angle:e.dropShadowAngle??t.angle,blur:e.dropShadowBlur??t.blur,color:e.dropShadowColor??t.color,distance:e.dropShadowDistance??t.distance}}if(e.strokeThickness!==void 0){ie(Ge,"strokeThickness is now a part of stroke");const t=e.stroke;let r={};if(Ce.isColorLike(t))r.color=t;else if(t instanceof Mn||t instanceof Xo)r.fill=t;else if(Object.hasOwnProperty.call(t,"color")||Object.hasOwnProperty.call(t,"fill"))r=t;else throw new Error("Invalid stroke value.");n.stroke={...r,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){if(ie(Ge,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(e.fill)||e.fill.length===0)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");e.fill.length!==e.fillGradientStops.length&&se("The number of fill colors must match the number of fill gradient stops.");const t=new Mn({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),r=e.fillGradientStops.slice(),i=e.fill.map(s=>Ce.shared.setValue(s).toNumber());r.forEach((s,o)=>{t.addColorStop(s,i[o])}),n.fill={fill:t}}}function QA(n,e){const{texture:t,bounds:r}=n,i=e._style._getFinalPadding();fx(r,e._anchor,t);const s=e._anchor._x*i*2,o=e._anchor._y*i*2;r.minX-=i-s,r.minY-=i-o,r.maxX-=i-s,r.maxY-=i-o}class bf{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){this.reset()}}class ZA extends bf{}class q1{constructor(e){this._renderer=e,e.runners.resolutionChange.add(this),this._managedTexts=new Rn({renderer:e,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(const e in this._managedTexts.items){const t=this._managedTexts.items[e];t!=null&&t._autoResolution&&t.onViewUpdate()}}validateRenderable(e){const t=this._getGpuText(e),r=e.styleKey;return t.currentKey!==r?!0:e._didTextUpdate}addRenderable(e,t){const r=this._getGpuText(e);if(e._didTextUpdate){const i=e._autoResolution?this._renderer.resolution:e.resolution;(r.currentKey!==e.styleKey||e._resolution!==i)&&this._updateGpuText(e),e._didTextUpdate=!1,QA(r,e)}this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuText(e);t._batcher.updateElement(t)}_updateGpuText(e){const t=this._getGpuText(e);t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,t.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e.styleKey}_getGpuText(e){return e._gpuData[this._renderer.uid]||this.initGpuText(e)}initGpuText(e){const t=new ZA;return t.currentKey="--",t.renderable=e,t.transform=e.groupTransform,t.bounds={minX:0,maxX:1,minY:0,maxY:0},t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._gpuData[this._renderer.uid]=t,this._managedTexts.add(e),t}onTextUnload(e){const t=e._gpuData[this._renderer.uid];if(!t)return;const{canvasText:r}=this._renderer;r.getReferenceCount(t.currentKey)>0?r.decreaseReferenceCount(t.currentKey):t.texture&&r.returnTexture(t.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}q1.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"text"};class Q1{constructor(e,t){this._activeTextures={},this._renderer=e,this._retainCanvasContext=t}getTexture(e,t,r,i){typeof e=="string"&&(ie("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:r,resolution:t}),e.style instanceof Ul||(e.style=new Ul(e.style)),e.textureStyle instanceof ii||(e.textureStyle=new ii(e.textureStyle)),typeof e.text!="string"&&(e.text=e.text.toString());const{text:s,style:o,textureStyle:a,autoGenerateMipmaps:l}=e,u=e.resolution??this._renderer.resolution,{frame:c,canvasAndContext:h}=Vi.getCanvasAndContext({text:s,style:o,resolution:u}),d=G1(h.canvas,c.width,c.height,u,l);if(a&&(d.source.style=a),o.trim&&(c.pad(o.padding),d.frame.copyFrom(c),d.frame.scale(1/u),d.updateUvs()),o.filters){const f=this._applyFilters(d,o.filters);return this.returnTexture(d),Vi.returnCanvasAndContext(h),f}return this._renderer.texture.initSource(d._source),this._retainCanvasContext||Vi.returnCanvasAndContext(h),d}returnTexture(e){const t=e.source,r=t.resource;if(this._retainCanvasContext&&(r!=null&&r.getContext)){const i=r.getContext("2d");i&&Vi.returnCanvasAndContext({canvas:r,context:i})}t.resource=null,t.uploadMethodId="unknown",t.alphaMode="no-premultiply-alpha",vt.returnTexture(e,!0)}renderTextToCanvas(){ie("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;const t=e.styleKey;if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;const r=this.getTexture({text:e.text,style:e.style,resolution:e._resolution,textureStyle:e.textureStyle,autoGenerateMipmaps:e.autoGenerateMipmaps});return this._activeTextures[t]={texture:r,usageCount:1},r}decreaseReferenceCount(e){const t=this._activeTextures[e];t&&(t.usageCount--,t.usageCount===0&&(this.returnTexture(t.texture),this._activeTextures[e]=null))}getReferenceCount(e){var t;return((t=this._activeTextures[e])==null?void 0:t.usageCount)??0}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}_applyFilters(e,t){const r=this._renderer.renderTarget.renderTarget,i=this._renderer.filter.generateFilteredTexture({texture:e,filters:t});return this._renderer.renderTarget.bind({target:r,clear:!1}),i}destroy(){this._renderer=null;for(const e in this._activeTextures)this._activeTextures[e]&&this.returnTexture(this._activeTextures[e].texture);this._activeTextures=null}}class Z1 extends Q1{constructor(e){super(e,!0)}}Z1.extension={type:[k.CanvasSystem],name:"canvasText"};class J1 extends Q1{constructor(e){super(e,!1)}}J1.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"canvasText"};ae.add(Z1);ae.add(J1);ae.add(q1);class JA extends TA{constructor(...e){const t=CA(e,"Text");super(t,Ul),this.renderPipeId="text",t.textureStyle&&(this.textureStyle=t.textureStyle instanceof ii?t.textureStyle:new ii(t.textureStyle)),this.autoGenerateMipmaps=t.autoGenerateMipmaps??$e.defaultOptions.autoGenerateMipmaps}updateBounds(){const e=this._bounds,t=this._anchor;let r=0,i=0;if(this._style.trim){const{frame:s,canvasAndContext:o}=Vi.getCanvasAndContext({text:this.text,style:this._style,resolution:1});Vi.returnCanvasAndContext(o),r=s.width,i=s.height}else{const s=ar.measureText(this._text,this._style);r=s.width,i=s.height}e.minX=-t._x*r,e.maxX=e.minX+r,e.minY=-t._y*i,e.maxY=e.minY+i}}function ek(){const{userAgent:n}=pe.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(n)}const wf=class jr{static _getPatternRepeat(e,t){const r=e&&e!=="clamp-to-edge",i=t&&t!=="clamp-to-edge";return r&&i?"repeat":r?"repeat-x":i?"repeat-y":"no-repeat"}start(e,t,r){}execute(e,t){var a,l,u,c;const r=t.elements;if(!r||!r.length)return;const i=e.renderer,s=i.canvasContext,o=s.activeContext;for(let h=0;h<r.length;h++){const d=r[h];if(!d.packAsQuad)continue;const f=d,p=f.texture,g=p?ce.getCanvasSource(p):null;if(!g)continue;const _=p.source.style,m=s.smoothProperty,y=_.scaleMode!=="nearest";o[m]!==y&&(o[m]=y),s.setBlendMode(t.blendMode);const x=((a=i.globalUniforms.globalUniformData)==null?void 0:a.worldColor)??4294967295,b=f.color,S=(x>>>24&255)/255,T=(b>>>24&255)/255,C=((l=i.filter)==null?void 0:l.alphaMultiplier)??1,M=S*T*C;if(M<=0)continue;o.globalAlpha=M;const L=x&16777215,R=b&16777215,O=Zi(Qi(R,L)),U=p.frame,j=_.addressModeU??_.addressMode,K=_.addressModeV??_.addressMode,Ee=jr._getPatternRepeat(j,K),N=p.source._resolution??p.source.resolution??1,$=(c=(u=f.renderable)==null?void 0:u.renderGroup)==null?void 0:c.isCachedAsTexture,D=U.x*N,B=U.y*N,W=U.width*N,J=U.height*N,X=f.bounds,ne=i.renderTarget.renderTarget.isRoot,fe=X.minX,me=X.minY,le=X.maxX-X.minX,ve=X.maxY-X.minY,rt=p.rotate,ue=p.uvs,ct=Math.min(ue.x0,ue.x1,ue.x2,ue.x3,ue.y0,ue.y1,ue.y2,ue.y3),Mt=Math.max(ue.x0,ue.x1,ue.x2,ue.x3,ue.y0,ue.y1,ue.y2,ue.y3),ke=Ee!=="no-repeat"&&(ct<0||Mt>1),Se=rt&&!(!ke&&(O!==16777215||rt));Se?(jr._tempPatternMatrix.copyFrom(f.transform),he.matrixAppendRotationInv(jr._tempPatternMatrix,rt,fe,me,le,ve),s.setContextTransform(jr._tempPatternMatrix,f.roundPixels===1,void 0,$&&ne)):s.setContextTransform(f.transform,f.roundPixels===1,void 0,$&&ne);const it=le,vn=ve;let He=Se?0:fe,$t=Se?0:me;if(!Se&&f.roundPixels===1&&(He|=0,$t|=0),ke){let Mr=g;const Lt=O!==16777215&&!rt,sn=U.width<=p.source.width&&U.height<=p.source.height;Lt&&sn&&(Mr=ce.getTintedCanvas({texture:p},O));const _s=o.createPattern(Mr,Ee);if(!_s)continue;const di=it,rr=vn;if(di===0||rr===0)continue;const xs=1/di,fi=1/rr,Yo=(ue.x1-ue.x0)*xs,Ko=(ue.y1-ue.y0)*xs,vs=(ue.x3-ue.x0)*fi,bs=(ue.y3-ue.y0)*fi,ws=ue.x0-Yo*He-vs*$t,qo=ue.y0-Ko*He-bs*$t,Ss=p.source.pixelWidth,pi=p.source.pixelHeight;jr._tempPatternMatrix.set(Yo*Ss,Ko*pi,vs*Ss,bs*pi,ws*Ss,qo*pi),ce.applyPatternTransform(_s,jr._tempPatternMatrix),o.fillStyle=_s,o.fillRect(He,$t,it,vn)}else{const Lt=O!==16777215||rt?ce.getTintedCanvas({texture:p},O):g,sn=Lt!==g;o.drawImage(Lt,sn?0:D,sn?0:B,sn?Lt.width:W,sn?Lt.height:J,He,$t,it,vn)}}}};wf._tempPatternMatrix=new Z;wf.extension={type:[k.CanvasPipesAdaptor],name:"batch"};let tk=wf;class ev{constructor(){this._tempState=tr.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,t,r){const i=e.renderer,s=this._didUploadHash[r.uid];i.shader.bind(r,s),s||(this._didUploadHash[r.uid]=!0),i.shader.updateUniformGroup(i.globalUniforms.uniformGroup),i.geometry.bind(t,r.glProgram)}execute(e,t){const r=e.renderer;this._tempState.blendMode=t.blendMode,r.state.set(this._tempState);const i=t.textures.textures;for(let s=0;s<t.textures.count;s++)r.texture.bind(i[s],s);r.geometry.draw(t.topology,t.size,t.start)}}ev.extension={type:[k.WebGLPipesAdaptor],name:"batch"};const Da=tr.for2d();class tv{start(e,t,r){const i=e.renderer,s=i.encoder,o=r.gpuProgram;this._shader=r,this._geometry=t,s.setGeometry(t,o),Da.blendMode="normal",i.pipeline.getPipeline(t,o,Da,void 0,r._overrides);const a=i.globalUniforms.bindGroup;s.resetBindGroup(1),s.setBindGroup(0,a,o)}execute(e,t){const r=this._shader.gpuProgram,i=e.renderer,s=i.encoder;if(!t.bindGroup){const l=t.textures;t.bindGroup=of(l.textures,l.count,i.limits.maxBatchableTextures)}Da.blendMode=t.blendMode;const o=i.bindGroup.getBindGroup(t.bindGroup,r,1),a=i.pipeline.getPipeline(this._geometry,r,Da,t.topology,this._shader._overrides);t.bindGroup._touch(i.gc.now,i.tick),s.setPipeline(a),s.renderPassEncoder.setBindGroup(1,o),s.renderPassEncoder.drawIndexed(t.size,1,t.start)}}tv.extension={type:[k.WebGPUPipesAdaptor],name:"batch"};const Sf=class nv{constructor(e,t){var r,i;this.state=tr.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=t,(i=(r=this._adaptor).init)==null||i.call(r,this)}static getBatcher(e,t){return new this._availableBatchers[e]({maxTextures:t})}buildStart(e){let t=this._batchersByInstructionSet[e.uid];t||(t=this._batchersByInstructionSet[e.uid]=Object.create(null),t.default||(t.default=new hf({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=t,this._activeBatch=this._activeBatches.default;for(const r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(e,t){if(this._activeBatch.name!==e.batcherName){this._activeBatch.break(t);let r=this._activeBatches[e.batcherName];r||(r=this._activeBatches[e.batcherName]=nv.getBatcher(e.batcherName,this.renderer.limits.maxBatchableTextures),r.begin()),this._activeBatch=r}this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);const t=this._activeBatches;for(const r in t){const i=t[r],s=i.geometry;s.indexBuffer.setDataWithSize(i.indexBuffer,i.indexSize,!0),s.buffers[0].setDataWithSize(i.attributeBuffer.float32View,i.attributeSize,!1)}}upload(e){const t=this._batchersByInstructionSet[e.uid];for(const r in t){const i=t[r],s=i.geometry;i.dirty&&(i.dirty=!1,s.buffers[0].update(i.attributeSize*4))}}execute(e){if(e.action==="startBatch"){const t=e.batcher,r=t.geometry,i=t.shader;this._adaptor.start(this,r,i)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(const e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}};Sf.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"batch"};Sf._availableBatchers=Object.create(null);let Tf=Sf;ae.handleByMap(k.Batcher,Tf._availableBatchers);ae.add(hf);const nk={name:"texture-bit",vertex:{header:`
|
|
595
|
+
|
|
596
|
+
struct TextureUniforms {
|
|
597
|
+
uTextureMatrix:mat3x3<f32>,
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
@group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;
|
|
601
|
+
`,main:`
|
|
602
|
+
uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
603
|
+
`},fragment:{header:`
|
|
604
|
+
@group(2) @binding(0) var uTexture: texture_2d<f32>;
|
|
605
|
+
@group(2) @binding(1) var uSampler: sampler;
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
`,main:`
|
|
609
|
+
outColor = textureSample(uTexture, uSampler, vUV);
|
|
610
|
+
`}},rk={name:"texture-bit",vertex:{header:`
|
|
611
|
+
uniform mat3 uTextureMatrix;
|
|
612
|
+
`,main:`
|
|
613
|
+
uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
614
|
+
`},fragment:{header:`
|
|
615
|
+
uniform sampler2D uTexture;
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
`,main:`
|
|
619
|
+
outColor = texture(uTexture, vUV);
|
|
620
|
+
`}},ik=new gt;class sk extends Al{constructor(){super(),this._placeholderSprite=new qn(Q.EMPTY),this.filters=[new _A({sprite:this._placeholderSprite,inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].setSprite(e)}get inverse(){return this.filters[0].inverse}set inverse(e){this.filters[0].inverse=e}get channel(){return this.filters[0].channel}set channel(e){this.filters[0].channel=e}reset(){this._placeholderSprite.texture=Q.EMPTY,this.sprite=this._placeholderSprite}}class Cf{constructor(e){this._activeMaskStage=[],this._usedEffects=[],this._renderer=e,e.runners.postrender.add(this)}push(e,t,r){const i=this._renderer;if(i.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1,maskedContainer:t}),e.inverse=t._maskOptions.inverse,e.channel=t._maskOptions.channel??"red",e.renderMaskToTexture){const s=e.mask;s.includeInBuild=!0,s.collectRenderables(r,i,null),s.includeInBuild=!1}i.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){const t=this._renderer,r=e.mask.renderMaskToTexture;if(e.action==="pushMaskBegin"){const i=ut.get(sk);if(i.inverse=e.inverse,i.channel=e.mask.channel,r){e.mask.mask.measurable=!0;const s=Kd(e.mask.mask,!0,ik);e.mask.mask.measurable=!1,s.ceil();const o=t.renderTarget.renderTarget.colorTexture.source,a=vt.getOptimalTexture(s.width,s.height,o._resolution,o.antialias);t.renderTarget.push({target:a,clear:!0}),t.globalUniforms.push({offset:s,worldColor:4294967295});const l=i.sprite;l.texture=a,l.worldTransform.tx=s.minX,l.worldTransform.ty=s.minY,this._activeMaskStage.push({filterEffect:i,maskedContainer:e.maskedContainer,filterTexture:a})}else i.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:i,maskedContainer:e.maskedContainer})}else if(e.action==="pushMaskEnd"){const i=this._activeMaskStage[this._activeMaskStage.length-1];r&&(t.type===_n.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:i.maskedContainer,filterEffect:i.filterEffect,canBundle:!1})}else if(e.action==="popMaskEnd"){t.filter.pop();const i=this._activeMaskStage.pop();r&&vt.returnTexture(i.filterTexture),this._usedEffects.push(i.filterEffect)}}postrender(){const e=this._usedEffects;for(let t=0;t<e.length;t++)ut.return(e[t]);e.length=0}destroy(){this.postrender(),this._renderer.runners.postrender.remove(this),this._renderer=null,this._activeMaskStage=null,this._usedEffects=null}}Cf.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"alphaMask"};class rv{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,r){this._renderer.renderPipes.batch.break(r);const i=this._colorStack;i[this._colorStackIndex]=i[this._colorStackIndex-1]&e.mask;const s=this._colorStack[this._colorStackIndex];s!==this._currentColor&&(this._currentColor=s,r.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1})),this._colorStackIndex++}pop(e,t,r){this._renderer.renderPipes.batch.break(r);const i=this._colorStack;this._colorStackIndex--;const s=i[this._colorStackIndex-1];s!==this._currentColor&&(this._currentColor=s,r.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1}))}execute(e){}destroy(){this._renderer=null,this._colorStack=null}}rv.extension={type:[k.CanvasPipes],name:"colorMask"};class iv{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,r){this._renderer.renderPipes.batch.break(r);const s=this._colorStack;s[this._colorStackIndex]=s[this._colorStackIndex-1]&e.mask;const o=this._colorStack[this._colorStackIndex];o!==this._currentColor&&(this._currentColor=o,r.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1})),this._colorStackIndex++}pop(e,t,r){this._renderer.renderPipes.batch.break(r);const s=this._colorStack;this._colorStackIndex--;const o=s[this._colorStackIndex-1];o!==this._currentColor&&(this._currentColor=o,r.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._renderer=null,this._colorStack=null}}iv.extension={type:[k.WebGLPipes,k.WebGPUPipes],name:"colorMask"};function ok(n,e,t,r,i,s){s=Math.max(0,Math.min(s,Math.min(r,i)/2)),n.moveTo(e+s,t),n.lineTo(e+r-s,t),n.quadraticCurveTo(e+r,t,e+r,t+s),n.lineTo(e+r,t+i-s),n.quadraticCurveTo(e+r,t+i,e+r-s,t+i),n.lineTo(e+s,t+i),n.quadraticCurveTo(e,t+i,e,t+i-s),n.lineTo(e,t+s),n.quadraticCurveTo(e,t,e+s,t)}function sv(n,e){switch(e.type){case"rectangle":{const t=e;n.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;ok(n,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;n.moveTo(t.x+t.radius,t.y),n.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;n.ellipse?(n.moveTo(t.x+t.halfWidth,t.y),n.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2)):(n.save(),n.translate(t.x,t.y),n.scale(t.halfWidth,t.halfHeight),n.moveTo(1,0),n.arc(0,0,1,0,Math.PI*2),n.restore());break}case"triangle":{const t=e;n.moveTo(t.x,t.y),n.lineTo(t.x2,t.y2),n.lineTo(t.x3,t.y3),n.closePath();break}case"polygon":default:{const t=e,r=t.points;if(!(r!=null&&r.length))break;n.moveTo(r[0],r[1]);for(let i=2;i<r.length;i+=2)n.lineTo(r[i],r[i+1]);t.closePath&&n.closePath();break}}}function ak(n,e,t){const r=[],i=[],s=[],o=ys[e.type];if(!(o!=null&&o.build(e,r)))return!1;const a=e.closePath??!0;ff(r,t,!1,a,i,s);for(let l=0;l<s.length;l+=3){const u=s[l]*2,c=s[l+1]*2,h=s[l+2]*2;n.moveTo(i[u],i[u+1]),n.lineTo(i[c],i[c+1]),n.lineTo(i[h],i[h+1]),n.closePath()}return!0}function lk(n,e){if(!(e!=null&&e.length))return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!(r!=null&&r.shape))continue;const i=r.transform,s=i&&!i.isIdentity();s&&(n.save(),n.transform(i.a,i.b,i.c,i.d,i.tx,i.ty)),sv(n,r.shape),s&&n.restore()}return!0}class ov{constructor(e){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=e}push(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){var c,h,d;if(e.action!=="pushMaskBegin"&&e.action!=="popMaskEnd")return;const t=this._renderer,r=t.canvasContext,i=r==null?void 0:r.activeContext;if(!i)return;if(e.action==="popMaskEnd"){this._canvasMaskStack.pop()&&i.restore();return}e.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const s=e.mask.mask;if(!(s instanceof Be)){this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),this._canvasMaskStack.push(!1);return}const o=s,a=(c=o.context)==null?void 0:c.instructions;if(!(a!=null&&a.length)){this._canvasMaskStack.push(!1);return}i.save(),r.setContextTransform(o.groupTransform,(t._roundPixels|o._roundPixels)===1),i.beginPath();let l=!1,u=!1;for(let f=0;f<a.length;f++){const p=a[f],g=p.action;if(g!=="fill"&&g!=="stroke")continue;const _=p.data,m=(h=_==null?void 0:_.path)==null?void 0:h.shapePath;if(!((d=m==null?void 0:m.shapePrimitives)!=null&&d.length))continue;const y=g==="stroke",x=m.shapePrimitives;for(let b=0;b<x.length;b++){const S=x[b];if(!(S!=null&&S.shape))continue;const T=S.transform,C=T&&!T.isIdentity();C&&(i.save(),i.transform(T.a,T.b,T.c,T.d,T.tx,T.ty)),y&&_.style?l=ak(i,S.shape,_.style)||l:(sv(i,S.shape),u=lk(i,S.holes)||u,l=!0),C&&i.restore()}}if(!l){i.restore(),this._canvasMaskStack.push(!1);return}u?i.clip("evenodd"):i.clip(),this._canvasMaskStack.push(!0)}destroy(){this._renderer=null,this._warnedMaskTypes=null,this._canvasMaskStack=null}_warnOnce(e,t){this._warnedMaskTypes.has(e)||(this._warnedMaskTypes.add(e),se(t))}}ov.extension={type:[k.CanvasPipes],name:"stencilMask"};class av{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,r){var i;const s=e,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const a=s.mask;a.includeInBuild=!0,this._maskHash.has(s)||this._maskHash.set(s,{instructionsStart:0,instructionsLength:0});const l=this._maskHash.get(s);l.instructionsStart=r.instructionSize,a.collectRenderables(r,o,null),a.includeInBuild=!1,o.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const u=r.instructionSize-l.instructionsStart-1;l.instructionsLength=u;const c=o.renderTarget.renderTarget.uid;(i=this._maskStackHash)[c]??(i[c]=0)}pop(e,t,r){const i=e,s=this._renderer;s.renderPipes.batch.break(r),s.renderPipes.blendMode.setBlendMode(i.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:t._maskOptions.inverse,canBundle:!1});const o=this._maskHash.get(e);for(let a=0;a<o.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[o.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(e){var t;const r=this._renderer,i=r,s=r.renderTarget.renderTarget.uid;let o=(t=this._maskStackHash)[s]??(t[s]=0);e.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(Ve.RENDERING_MASK_ADD,o),o++,i.colorMask.setMask(0)):e.action==="pushMaskEnd"?(e.inverse?i.stencil.setStencilMode(Ve.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Ve.MASK_ACTIVE,o),i.colorMask.setMask(15)):e.action==="popMaskBegin"?(i.colorMask.setMask(0),o!==0?i.stencil.setStencilMode(Ve.RENDERING_MASK_REMOVE,o):(i.renderTarget.clear(null,et.STENCIL),i.stencil.setStencilMode(Ve.DISABLED,o)),o--):e.action==="popMaskEnd"&&(e.inverse?i.stencil.setStencilMode(Ve.INVERSE_MASK_ACTIVE,o):i.stencil.setStencilMode(Ve.MASK_ACTIVE,o),i.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}av.extension={type:[k.WebGLPipes,k.WebGPUPipes],name:"stencilMask"};const Ae="source-over";function uk(){const n=D1(),e=Object.create(null);return e.inherit=Ae,e.none=Ae,e.normal="source-over",e.add="lighter",e.multiply=n?"multiply":Ae,e.screen=n?"screen":Ae,e.overlay=n?"overlay":Ae,e.darken=n?"darken":Ae,e.lighten=n?"lighten":Ae,e["color-dodge"]=n?"color-dodge":Ae,e["color-burn"]=n?"color-burn":Ae,e["hard-light"]=n?"hard-light":Ae,e["soft-light"]=n?"soft-light":Ae,e.difference=n?"difference":Ae,e.exclusion=n?"exclusion":Ae,e.saturation=n?"saturation":Ae,e.color=n?"color":Ae,e.luminosity=n?"luminosity":Ae,e["linear-burn"]=n?"color-burn":Ae,e["linear-dodge"]=n?"color-dodge":Ae,e["linear-light"]=n?"hard-light":Ae,e["pin-light"]=n?"hard-light":Ae,e["vivid-light"]=n?"hard-light":Ae,e["hard-mix"]=Ae,e.negation=n?"difference":Ae,e["normal-npm"]=e.normal,e["add-npm"]=e.add,e["screen-npm"]=e.screen,e.erase="destination-out",e.subtract=Ae,e.divide=Ae,e.min=Ae,e.max=Ae,e}const ck=new Z;class lv{constructor(e){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=uk(),this._activeBlendMode="normal",this._projTransform=null,this._outerBlend=!1,this._warnedBlendModes=new Set,this._renderer=e}resolutionChange(e){this.activeResolution=e}init(){const e=this._renderer.background.alpha<1;if(this.rootContext=this._renderer.canvas.getContext("2d",{alpha:e}),this.activeContext=this.rootContext,this.activeResolution=this._renderer.resolution,!this.rootContext.imageSmoothingEnabled){const t=this.rootContext;t.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":t.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":t.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":t.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(e,t,r,i){var u;const s=i?Z.IDENTITY:((u=this._renderer.globalUniforms.globalUniformData)==null?void 0:u.worldTransformMatrix)||Z.IDENTITY;let o=ck;o.copyFrom(s),o.append(e);const a=this._projTransform,l=this.activeResolution;if(r=r||l,a){const c=Z.shared;c.copyFrom(o),c.prepend(a),o=c}t?this.activeContext.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*l|0,o.ty*l|0):this.activeContext.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*l,o.ty*l)}clear(e,t){const r=this.activeContext,i=this._renderer;if(r.clearRect(0,0,i.width,i.height),e){const s=Ce.shared.setValue(e);r.globalAlpha=t??s.alpha,r.fillStyle=s.toHex(),r.fillRect(0,0,i.width,i.height),r.globalAlpha=1}}setBlendMode(e){if(this._activeBlendMode===e)return;this._activeBlendMode=e,this._outerBlend=!1;const t=this.blendModes[e];if(!t){this._warnedBlendModes.has(e)||(console.warn(`CanvasRenderer: blend mode "${e}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(e)),this.activeContext.globalCompositeOperation="source-over";return}this.activeContext.globalCompositeOperation=t}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}lv.extension={type:[k.CanvasSystem],name:"canvasContext"};class uv{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}uv.extension={type:[k.CanvasSystem],name:"limits"};class Ef{constructor(e){this._renderer=e}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}}Ef.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"customRender"};function Vh(n,e){const t=n.instructionSet,r=t.instructions;for(let i=0;i<t.instructionSize;i++){const s=r[i];e[s.renderPipeId].execute(s)}}class Af{constructor(e){this._renderer=e}addRenderGroup(e,t){e.isCachedAsTexture?this._addRenderableCacheAsTexture(e,t):this._addRenderableDirect(e,t)}execute(e){e.isRenderable&&(e.isCachedAsTexture?this._executeCacheAsTexture(e):this._executeDirect(e))}destroy(){this._renderer=null}_addRenderableDirect(e,t){this._renderer.renderPipes.batch.break(t),e._batchableRenderGroup&&(ut.return(e._batchableRenderGroup),e._batchableRenderGroup=null),t.add(e)}_addRenderableCacheAsTexture(e,t){const r=e._batchableRenderGroup??(e._batchableRenderGroup=ut.get(bf));r.renderable=e.root,r.transform=e.root.relativeGroupTransform,r.texture=e.texture,r.bounds=e._textureBounds,t.add(e),this._renderer.renderPipes.blendMode.pushBlendMode(e,e.root.groupBlendMode,t),this._renderer.renderPipes.batch.addToBatch(r,t),this._renderer.renderPipes.blendMode.popBlendMode(t)}_executeCacheAsTexture(e){if(e.textureNeedsUpdate){e.textureNeedsUpdate=!1;const t=new Z().translate(-e._textureBounds.x,-e._textureBounds.y);this._renderer.renderTarget.push({target:e.texture,clear:!0,frame:e.texture.frame}),this._renderer.globalUniforms.push({worldTransformMatrix:t,worldColor:4294967295,offset:{x:0,y:0}}),Vh(e,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}e._batchableRenderGroup._batcher.updateElement(e._batchableRenderGroup),e._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(e){this._renderer.globalUniforms.push({worldTransformMatrix:e.inverseParentTextureTransform,worldColor:e.worldColorAlpha}),Vh(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}}Af.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"renderGroup"};const hk="#808080",Fa=new Z,dk=new Z,fk=new Z,xc=new Z,pk=new Z;function mk(n,e,t){n.beginPath();for(let r=0;r<t.length;r+=3){const i=t[r]*2,s=t[r+1]*2,o=t[r+2]*2;n.moveTo(e[i],e[i+1]),n.lineTo(e[s],e[s+1]),n.lineTo(e[o],e[o+1]),n.closePath()}n.fill()}function gk(n){return`#${(n&16777215).toString(16).padStart(6,"0")}`}function yk(n,e,t,r,i,s){s=Math.max(0,Math.min(s,Math.min(r,i)/2)),n.moveTo(e+s,t),n.lineTo(e+r-s,t),n.quadraticCurveTo(e+r,t,e+r,t+s),n.lineTo(e+r,t+i-s),n.quadraticCurveTo(e+r,t+i,e+r-s,t+i),n.lineTo(e+s,t+i),n.quadraticCurveTo(e,t+i,e,t+i-s),n.lineTo(e,t+s),n.quadraticCurveTo(e,t,e+s,t)}function Ja(n,e){switch(e.type){case"rectangle":{const t=e;n.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;yk(n,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;n.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;n.ellipse?n.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2):(n.save(),n.translate(t.x,t.y),n.scale(t.halfWidth,t.halfHeight),n.arc(0,0,1,0,Math.PI*2),n.restore());break}case"triangle":{const t=e;n.moveTo(t.x,t.y),n.lineTo(t.x2,t.y2),n.lineTo(t.x3,t.y3),n.closePath();break}case"polygon":default:{const t=e,r=t.points;if(!(r!=null&&r.length))break;n.moveTo(r[0],r[1]);for(let i=2;i<r.length;i+=2)n.lineTo(r[i],r[i+1]);t.closePath&&n.closePath();break}}}function _k(n,e){if(!(e!=null&&e.length))return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!(r!=null&&r.shape))continue;const i=r.transform,s=i&&!i.isIdentity();s&&(n.save(),n.transform(i.a,i.b,i.c,i.d,i.tx,i.ty)),Ja(n,r.shape),s&&n.restore()}return!0}function xk(n,e,t,r){const i=n.fill;if(i instanceof Mn){i.buildGradient();const o=i.texture;if(o){const a=ce.getTintedPattern(o,e),l=t?xc.copyFrom(t).scale(o.source.pixelWidth,o.source.pixelHeight):xc.copyFrom(i.transform);return r&&!n.textureSpace&&l.append(r),ce.applyPatternTransform(a,l),a}}if(i instanceof Xo){const o=ce.getTintedPattern(i.texture,e);return ce.applyPatternTransform(o,i.transform,!1),o}const s=n.texture;if(s&&s!==Q.WHITE){if(!s.source.resource)return hk;const o=ce.getTintedPattern(s,e);let a=n.matrix;if(t){const{resolution:l}=s.source;if(a=xc.copyFrom(t),s.rotate){const{uvs:u,orig:c}=s;a.prepend(pk.set(u.x1-u.x0,u.y1-u.y0,u.x3-u.x0,u.y3-u.y0,u.x0,u.y0).invert()).scale(c.width*l,c.height*l)}else a.scale(s.source.pixelWidth,s.source.pixelHeight).translate(-s.frame.x*l,-s.frame.y*l)}return ce.applyPatternTransform(o,a),o}return gk(e)}class cv{constructor(){this.shader=null}contextChange(e){}execute(e,t){var y,x,b,S,T,C,M;const r=e.renderer,i=r.canvasContext,s=i.activeContext,o=t.groupTransform,a=((y=r.globalUniforms.globalUniformData)==null?void 0:y.worldColor)??4294967295,l=t.groupColorAlpha,u=(a>>>24&255)/255,c=(l>>>24&255)/255,h=((x=r.filter)==null?void 0:x.alphaMultiplier)??1,d=u*c*h;if(d<=0)return;const f=a&16777215,p=l&16777215,g=Zi(Qi(p,f)),_=r._roundPixels|t._roundPixels;s.save(),i.setContextTransform(o,_===1),i.setBlendMode(t.groupBlendMode);const m=t.context.instructions;for(let L=0;L<m.length;L++){const R=m[L];if(R.action==="texture"){const D=R.data,B=D.image,W=B?ce.getCanvasSource(B):null;if(!W)continue;const J=D.alpha*d;if(J<=0)continue;const X=Qi(D.style,g);s.globalAlpha=J;let ne=W;X!==16777215&&(ne=ce.getTintedCanvas({texture:B},X));const fe=B.frame,me=B.source._resolution??B.source.resolution??1;let le=fe.x*me,ve=fe.y*me;const rt=fe.width*me,ue=fe.height*me;ne!==W&&(le=0,ve=0);const ct=D.transform,Mt=ct&&!ct.isIdentity(),ke=B.rotate;Mt||ke?(Fa.copyFrom(o),Mt&&Fa.append(ct),ke&&he.matrixAppendRotationInv(Fa,ke,D.dx,D.dy,D.dw,D.dh),i.setContextTransform(Fa,_===1)):i.setContextTransform(o,_===1),s.drawImage(ne,le,ve,ne===W?rt:ne.width,ne===W?ue:ne.height,ke?0:D.dx,ke?0:D.dy,D.dw,D.dh),(Mt||ke)&&i.setContextTransform(o,_===1);continue}const O=R.data,U=(b=O==null?void 0:O.path)==null?void 0:b.shapePath;if(!((S=U==null?void 0:U.shapePrimitives)!=null&&S.length))continue;const j=O.style,K=Qi(j.color,g),Ee=j.alpha*d;if(Ee<=0)continue;const N=R.action==="stroke";if(s.globalAlpha=Ee,N){const D=j;s.lineWidth=D.width,s.lineCap=D.cap,s.lineJoin=D.join,s.miterLimit=D.miterLimit}const $=U.shapePrimitives;if(!N&&((M=(C=(T=O.hole)==null?void 0:T.shapePath)==null?void 0:C.shapePrimitives)!=null&&M.length)){const D=$[$.length-1];D.holes=O.hole.shapePath.shapePrimitives}for(let D=0;D<$.length;D++){const B=$[D];if(!(B!=null&&B.shape))continue;const W=B.transform,J=W&&!W.isIdentity(),X=j.texture&&j.texture!==Q.WHITE,ne=j.textureSpace==="global"?W:null,fe=X?C1(dk,j,B.shape,ne):null,me=J?fk.copyFrom(o).append(W):o,le=xk(j,K,fe,me);if(J&&(s.save(),s.transform(W.a,W.b,W.c,W.d,W.tx,W.ty)),N){const ve=j;if(ve.alignment!==.5&&!ve.pixelLine){const ue=[],ct=[],Mt=[],ke=ys[B.shape.type];if(ke!=null&&ke.build(B.shape,ue)){const qe=B.shape.closePath??!0;ff(ue,ve,!1,qe,ct,Mt),s.fillStyle=le,mk(s,ct,Mt)}else s.strokeStyle=le,s.beginPath(),Ja(s,B.shape),s.stroke()}else s.strokeStyle=le,s.beginPath(),Ja(s,B.shape),s.stroke()}else s.fillStyle=le,s.beginPath(),Ja(s,B.shape),_k(s,B.holes)?s.fill("evenodd"):s.fill();J&&s.restore()}}s.restore()}destroy(){this.shader=null}}cv.extension={type:[k.CanvasPipesAdaptor],name:"graphics"};class kf{constructor(e){this._renderer=e}addRenderable(e,t){const r=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){const t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}_updateBatchableSprite(e,t){t.bounds=e.visualBounds,t.texture=e._texture}_getGpuSprite(e){return e._gpuData[this._renderer.uid]||this._initGPUSprite(e)}_initGPUSprite(e){const t=new bf;return t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.bounds=e.visualBounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._gpuData[this._renderer.uid]=t,t}destroy(){this._renderer=null}}kf.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"sprite"};const mo={};ae.handle(k.BlendMode,n=>{if(!n.name)throw new Error("BlendMode extension must have a name property");mo[n.name]=n.ref},n=>{delete mo[n.name]});class Pf{constructor(e){this._blendModeStack=[],this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}pushBlendMode(e,t,r){this._blendModeStack.push(t),this.setBlendMode(e,t,r)}popBlendMode(e){this._blendModeStack.pop();const t=this._blendModeStack[this._activeBlendMode.length-1]??"normal";this.setBlendMode(null,t,e)}setBlendMode(e,t,r){var s;const i=e instanceof wh;if(this._activeBlendMode===t){this._isAdvanced&&e&&!i&&((s=this._renderableList)==null||s.push(e));return}this._isAdvanced&&this._endAdvancedBlendMode(r),this._activeBlendMode=t,e&&(this._isAdvanced=!!mo[t],this._isAdvanced&&this._beginAdvancedBlendMode(e,r))}_beginAdvancedBlendMode(e,t){this._renderer.renderPipes.batch.break(t);const r=this._activeBlendMode;if(!mo[r]){se(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}const i=this._ensureFilterEffect(r),s=e instanceof wh,o={renderPipeId:"filter",action:"pushFilter",filterEffect:i,renderables:s?null:[e],container:s?e.root:null,canBundle:!1};this._renderableList=o.renderables,t.add(o)}_ensureFilterEffect(e){let t=this._filterHash[e];return t||(t=this._filterHash[e]=new Al,t.filters=[new mo[e]]),t}_endAdvancedBlendMode(e){this._isAdvanced=!1,this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(const e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}}Pf.extension={type:[k.WebGLPipes,k.WebGPUPipes,k.CanvasPipes],name:"blendMode"};function jh(n,e){e||(e=0);for(let t=e;t<n.length&&n[t];t++)n[t]=null}const vk=new Ue,ng=co|Pl|Jd;function hv(n,e=!1){bk(n);const t=n.childrenToUpdate,r=n.updateTick++;for(const i in t){const s=Number(i),o=t[i],a=o.list,l=o.index;for(let u=0;u<l;u++){const c=a[u];c.parentRenderGroup===n&&c.relativeRenderGroupDepth===s&&dv(c,r,0)}jh(a,l),o.index=0}if(e)for(let i=0;i<n.renderGroupChildren.length;i++)hv(n.renderGroupChildren[i],e)}function bk(n){const e=n.root;let t;if(n.renderGroupParent){const r=n.renderGroupParent;n.worldTransform.appendFrom(e.relativeGroupTransform,r.worldTransform),n.worldColor=kl(e.groupColor,r.worldColor),t=e.groupAlpha*r.worldAlpha}else n.worldTransform.copyFrom(e.localTransform),n.worldColor=e.localColor,t=e.localAlpha;t=t<0?0:t>1?1:t,n.worldAlpha=t,n.worldColorAlpha=n.worldColor+((t*255|0)<<24)}function dv(n,e,t){if(e===n.updateTick)return;n.updateTick=e,n.didChange=!1;const r=n.localTransform;n.updateLocalTransform();const i=n.parent;if(i&&!i.renderGroup?(t|=n._updateFlags,n.relativeGroupTransform.appendFrom(r,i.relativeGroupTransform),t&ng&&rg(n,i,t)):(t=n._updateFlags,n.relativeGroupTransform.copyFrom(r),t&ng&&rg(n,vk,t)),!n.renderGroup){const s=n.children,o=s.length;for(let u=0;u<o;u++)dv(s[u],e,t);const a=n.parentRenderGroup,l=n;l.renderPipeId&&!a.structureDidChange&&a.updateRenderable(l)}}function rg(n,e,t){if(t&Pl){n.groupColor=kl(n.localColor,e.groupColor);let r=n.localAlpha*e.groupAlpha;r=r<0?0:r>1?1:r,n.groupAlpha=r,n.groupColorAlpha=n.groupColor+((r*255|0)<<24)}t&Jd&&(n.groupBlendMode=n.localBlendMode==="inherit"?e.groupBlendMode:n.localBlendMode),t&co&&(n.globalDisplayStatus=n.localDisplayStatus&e.globalDisplayStatus),n._updateFlags=0}function wk(n,e){const{list:t}=n.childrenRenderablesToUpdate;let r=!1;for(let i=0;i<n.childrenRenderablesToUpdate.index;i++){const s=t[i];if(r=e[s.renderPipeId].validateRenderable(s),r)break}return n.structureDidChange=r,r}const Sk=new Z;class fv{constructor(e){this._renderer=e}render({container:e,transform:t}){const r=e.parent,i=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;const s=this._renderer,o=Sk;t&&(o.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));const a=s.renderPipes;this._updateCachedRenderGroups(e.renderGroup,null),this._updateRenderGroups(e.renderGroup),s.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),Vh(e.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(o),e.parent=r,e.renderGroup.renderGroupParent=i}destroy(){this._renderer=null}_updateCachedRenderGroups(e,t){if(e._parentCacheAsTextureRenderGroup=t,e.isCachedAsTexture){if(!e.textureNeedsUpdate)return;t=e}for(let r=e.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(e.renderGroupChildren[r],t);if(e.invalidateMatrices(),e.isCachedAsTexture){if(e.textureNeedsUpdate){const r=e.root.getLocalBounds(),i=this._renderer,s=e.textureOptions.resolution||i.view.resolution,o=e.textureOptions.antialias??i.view.antialias,a=e.textureOptions.scaleMode??"linear",l=e.texture;r.ceil(),e.texture&&vt.returnTexture(e.texture,!0);const u=vt.getOptimalTexture(r.width,r.height,s,o);u._source.style=new ii({scaleMode:a}),e.texture=u,e._textureBounds||(e._textureBounds=new gt),e._textureBounds.copyFrom(r),l!==e.texture&&e.renderGroupParent&&(e.renderGroupParent.structureDidChange=!0)}}else e.texture&&(vt.returnTexture(e.texture,!0),e.texture=null)}_updateRenderGroups(e){const t=this._renderer,r=t.renderPipes;if(e.runOnRender(t),e.instructionSet.renderPipes=r,e.structureDidChange?jh(e.childrenRenderablesToUpdate.list,0):wk(e,r),hv(e),e.structureDidChange?(e.structureDidChange=!1,this._buildInstructions(e,t)):this._updateRenderables(e),e.childrenRenderablesToUpdate.index=0,t.renderPipes.batch.upload(e.instructionSet),!(e.isCachedAsTexture&&!e.textureNeedsUpdate))for(let i=0;i<e.renderGroupChildren.length;i++)this._updateRenderGroups(e.renderGroupChildren[i])}_updateRenderables(e){const{list:t,index:r}=e.childrenRenderablesToUpdate;for(let i=0;i<r;i++){const s=t[i];s.didViewUpdate&&e.updateRenderable(s)}jh(t,r)}_buildInstructions(e,t){const r=e.root,i=e.instructionSet;i.reset();const s=t.renderPipes?t:t.batch.renderer,o=s.renderPipes;o.batch.buildStart(i),o.blendMode.buildStart(),o.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(i,s,null),o.batch.buildEnd(i),o.blendMode.buildEnd(i)}}fv.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"renderGroup"};const Mf=class pv{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Ce(0),this.color=this._backgroundColor,this.alpha=1}init(e){e={...pv.defaultOptions,...e},this.clearBeforeRender=e.clearBeforeRender,this.color=e.background||e.backgroundColor||this._backgroundColor,this.alpha=e.backgroundAlpha,this._backgroundColor.setAlpha(e.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){Ce.shared.setValue(e).alpha<1&&this._backgroundColor.alpha===1&&se("Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."),this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Mf.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"background",priority:0};Mf.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let Tk=Mf;const vc={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Rf=class mv{constructor(e){this._renderer=e}_normalizeOptions(e,t={}){return e instanceof Ue||e instanceof Q?{target:e,...t}:{...t,...e}}async image(e){const t=pe.get().createImage();return t.src=await this.base64(e),t}async base64(e){e=this._normalizeOptions(e,mv.defaultImageOptions);const{format:t,quality:r}=e,i=this.canvas(e);if(i.toBlob!==void 0)return new Promise((s,o)=>{i.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>s(l.result),l.onerror=o,l.readAsDataURL(a)},vc[t],r)});if(i.toDataURL!==void 0)return i.toDataURL(vc[t],r);if(i.convertToBlob!==void 0){const s=await i.convertToBlob({type:vc[t],quality:r});return new Promise((o,a)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(s)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){e=this._normalizeOptions(e);const t=e.target,r=this._renderer;if(t instanceof Q)return r.texture.generateCanvas(t);const i=r.textureGenerator.generateTexture(e),s=r.texture.generateCanvas(i);return i.destroy(!0),s}pixels(e){e=this._normalizeOptions(e);const t=e.target,r=this._renderer,i=t instanceof Q?t:r.textureGenerator.generateTexture(e),s=r.texture.getPixels(i);return t instanceof Ue&&i.destroy(!0),s}texture(e){return e=this._normalizeOptions(e),e.target instanceof Q?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);const t=this.canvas(e),r=document.createElement("a");r.download=e.filename??"image.png",r.href=t.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(e){const t=e.width??200;e=this._normalizeOptions(e);const r=this.canvas(e),i=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);const s=["font-size: 1px;",`padding: ${t}px 300px;`,`background: url(${i}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}destroy(){this._renderer=null}};Rf.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"extract"};Rf.defaultImageOptions={format:"png",quality:1};let Ck=Rf;class If extends Q{static create(e){const{dynamic:t,textureOptions:r,...i}=e;return new If({...r,source:new $e(i),dynamic:t??!1})}resize(e,t,r){return this.source.resize(e,t,r),this}}const Ek=new xe,Ak=new gt,kk=[0,0,0,0];class gv{constructor(e){this._renderer=e}generateTexture(e){var c;e instanceof Ue&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});const t=e.resolution||this._renderer.resolution,r=e.antialias||this._renderer.view.antialias,i=e.target;let s=e.clearColor;s?s=Array.isArray(s)&&s.length===4?s:Ce.shared.setValue(s).toArray():s=kk;const o=((c=e.frame)==null?void 0:c.copyTo(Ek))||Qd(i,Ak).rectangle,a=e.defaultAnchor&&{defaultAnchor:e.defaultAnchor};o.width=Math.max(o.width,1/t)|0,o.height=Math.max(o.height,1/t)|0;const l=If.create({...e.textureSourceOptions,width:o.width,height:o.height,resolution:t,antialias:r,textureOptions:a}),u=Z.shared.translate(-o.x,-o.y);return this._renderer.render({container:i,transform:u,target:l,clearColor:s}),l.source.updateMipmaps(),l}destroy(){this._renderer=null}}gv.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"textureGenerator"};function Pk(n){let e=!1;for(const r in n)if(n[r]==null){e=!0;break}if(!e)return n;const t=Object.create(null);for(const r in n){const i=n[r];i&&(t[r]=i)}return t}function Mk(n){let e=0;for(let t=0;t<n.length;t++)n[t]==null?e++:n[t-e]=n[t];return n.length-=e,n}const Bf=class yv{constructor(e){this._managedResources=[],this._managedResourceHashes=[],this._managedCollections=[],this._ready=!1,this._renderer=e}init(e){e={...yv.defaultOptions,...e},this.maxUnusedTime=e.gcMaxUnusedTime,this._frequency=e.gcFrequency,this.enabled=e.gcActive,this.now=performance.now()}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?(this._handler=this._renderer.scheduler.repeat(()=>{this._ready=!0},this._frequency,!1),this._collectionsHandler=this._renderer.scheduler.repeat(()=>{for(const t of this._managedCollections){const{context:r,collection:i,type:s}=t;s==="hash"?r[i]=Pk(r[i]):r[i]=Mk(r[i])}},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._collectionsHandler),this._handler=0,this._collectionsHandler=0))}prerender({container:e}){this.now=performance.now(),e.renderGroup.gcTick=this._renderer.tick++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}postrender(){!this._ready||!this.enabled||(this.run(),this._ready=!1)}_updateInstructionGCTick(e,t){e.instructionSet.gcTick=t,e.gcTick=t;for(const r of e.renderGroupChildren)this._updateInstructionGCTick(r,t)}addCollection(e,t,r){this._managedCollections.push({context:e,collection:t,type:r})}addResource(e,t){var i,s;if(e._gcLastUsed!==-1){e._gcLastUsed=this.now,(i=e._onTouch)==null||i.call(e,this.now);return}const r=this._managedResources.length;e._gcData={index:r,type:t},e._gcLastUsed=this.now,(s=e._onTouch)==null||s.call(e,this.now),e.once("unload",this.removeResource,this),this._managedResources.push(e)}removeResource(e){const t=e._gcData;if(!t)return;const r=t.index,i=this._managedResources.length-1;if(r!==i){const s=this._managedResources[i];this._managedResources[r]=s,s._gcData.index=r}this._managedResources.length--,e._gcData=null,e._gcLastUsed=-1}addResourceHash(e,t,r,i=0){this._managedResourceHashes.push({context:e,hash:t,type:r,priority:i}),this._managedResourceHashes.sort((s,o)=>s.priority-o.priority)}run(){const e=performance.now(),t=this._managedResourceHashes;for(const i of t)this.runOnHash(i,e);let r=0;for(let i=0;i<this._managedResources.length;i++){const s=this._managedResources[i];r=this.runOnResource(s,e,r)}this._managedResources.length=r}updateRenderableGCTick(e,t){var s,o;const r=e.renderGroup??e.parentRenderGroup,i=((s=r==null?void 0:r.instructionSet)==null?void 0:s.gcTick)??-1;((r==null?void 0:r.gcTick)??0)===i&&(e._gcLastUsed=t,(o=e._onTouch)==null||o.call(e,t))}runOnResource(e,t,r){const i=e._gcData;return i.type==="renderable"&&this.updateRenderableGCTick(e,t),t-e._gcLastUsed<this.maxUnusedTime||!e.autoGarbageCollect?(this._managedResources[r]=e,i.index=r,r++):(e.unload(),e._gcData=null,e._gcLastUsed=-1,e.off("unload",this.removeResource,this)),r}_createHashClone(e,t){const r=Object.create(null);for(const i in e){if(i===t)break;e[i]!==null&&(r[i]=e[i])}return r}runOnHash(e,t){var u;const{context:r,hash:i,type:s}=e,o=r[i];let a=null,l=0;for(const c in o){const h=o[c];if(h===null){l++,l===1e4&&!a&&(a=this._createHashClone(o,c));continue}if(h._gcLastUsed===-1){h._gcLastUsed=t,(u=h._onTouch)==null||u.call(h,t),a&&(a[c]=h);continue}if(s==="renderable"&&this.updateRenderableGCTick(h,t),!(t-h._gcLastUsed<this.maxUnusedTime)&&h.autoGarbageCollect){if(s==="renderable"){const f=h,p=f.renderGroup??f.parentRenderGroup;p&&(p.structureDidChange=!0)}h.unload(),h._gcData=null,h._gcLastUsed=-1,a||(l+1!==1e4?(o[c]=null,l++):a=this._createHashClone(o,c))}else a&&(a[c]=h)}a&&(r[i]=a)}destroy(){this.enabled=!1,this._managedResources.forEach(e=>{e.off("unload",this.removeResource,this)}),this._managedResources.length=0,this._managedResourceHashes.length=0,this._managedCollections.length=0,this._renderer=null}};Bf.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"gc",priority:0};Bf.defaultOptions={gcActive:!0,gcMaxUnusedTime:6e4,gcFrequency:3e4};let Rk=Bf;class _v{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e<this._activeUniforms.length;e++)this._uniformsPool.push(this._activeUniforms[e]);for(let e=0;e<this._activeBindGroups.length;e++)this._bindGroupPool.push(this._activeBindGroups[e]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(e){this.reset(),this.push(e)}bind({size:e,projectionMatrix:t,worldTransformMatrix:r,worldColor:i,offset:s}){const o=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{worldTransformMatrix:new Z,worldColor:4294967295,offset:new Me},l={projectionMatrix:t||this._renderer.renderTarget.projectionMatrix,resolution:e||o.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:i||a.worldColor,offset:s||a.offset,bindGroup:null},u=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(u);const c=u.uniforms;c.uProjectionMatrix=l.projectionMatrix,c.uResolution=l.resolution,c.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),c.uWorldTransformMatrix.tx-=l.offset.x,c.uWorldTransformMatrix.ty-=l.offset.y,z1(l.worldColor,c.uWorldColorAlpha,0),u.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(u,!1):(h=this._bindGroupPool.pop()||new Sr,this._activeBindGroups.push(h),h.setResource(u,0)),l.bindGroup=h,this._currentGlobalUniformData=l}push(e){this.bind(e),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===_n.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new xn({uProjectionMatrix:{value:new Z,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new Z,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null,this._globalUniformDataStack.length=0,this._uniformsPool.length=0,this._activeUniforms.length=0,this._bindGroupPool.length=0,this._activeBindGroups.length=0,this._currentGlobalUniformData=null}}_v.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"globalUniforms"};let Ik=1;class xv{constructor(){this._tasks=[],this._offset=0}init(){St.system.add(this._update,this)}repeat(e,t,r=!0){const i=Ik++;let s=0;return r&&(this._offset+=1e3,s=this._offset),this._tasks.push({func:e,duration:t,start:performance.now(),offset:s,last:performance.now(),repeat:!0,id:i}),i}cancel(e){for(let t=0;t<this._tasks.length;t++)if(this._tasks[t].id===e){this._tasks.splice(t,1);return}}_update(){const e=performance.now();for(let t=0;t<this._tasks.length;t++){const r=this._tasks[t];if(e-r.offset-r.last>=r.duration){const i=e-r.start;r.func(i),r.last=e}}}destroy(){St.system.remove(this._update,this),this._tasks.length=0}}xv.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"scheduler",priority:0};let ig=!1;function Bk(n){if(!ig){if(pe.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const e=[`%c %c %c %c %c PixiJS %c v${Bl} (${n}) http://www.pixijs.com/
|
|
621
|
+
|
|
622
|
+
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...e)}else globalThis.console&&globalThis.console.log(`PixiJS ${Bl} - ${n} - http://www.pixijs.com/`);ig=!0}}class Df{constructor(e){this._renderer=e}init(e){if(e.hello){let t=this._renderer.name;this._renderer.type===_n.WEBGL&&(t+=` ${this._renderer.context.webGLVersion}`),Bk(t)}}}Df.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"hello",priority:-2};Df.defaultOptions={hello:!1};const Ff=class vv{constructor(e){this._renderer=e}init(e){e={...vv.defaultOptions,...e},this.maxUnusedTime=e.renderableGCMaxUnusedTime}get enabled(){return ie("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled}set enabled(e){ie("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled=e}addManagedHash(e,t){ie("8.15.0","RenderableGCSystem.addManagedHash is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(e,t,"hash")}addManagedArray(e,t){ie("8.15.0","RenderableGCSystem.addManagedArray is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(e,t,"array")}addRenderable(e){ie("8.15.0","RenderableGCSystem.addRenderable is deprecated, please use the GCSystem instead."),this._renderer.gc.addResource(e,"renderable")}run(){ie("8.15.0","RenderableGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};Ff.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"renderableGC",priority:0};Ff.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let Dk=Ff;const Gf=class el{get count(){return this._renderer.tick}get checkCount(){return this._checkCount}set checkCount(e){ie("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._checkCount=e}get maxIdle(){return this._renderer.gc.maxUnusedTime/1e3*60}set maxIdle(e){ie("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.maxUnusedTime=e/60*1e3}get checkCountMax(){return Math.floor(this._renderer.gc._frequency/1e3)}set checkCountMax(e){ie("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead.")}get active(){return this._renderer.gc.enabled}set active(e){ie("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.enabled=e}constructor(e){this._renderer=e,this._checkCount=0}init(e){e.textureGCActive!==el.defaultOptions.textureGCActive&&(this.active=e.textureGCActive),e.textureGCMaxIdle!==el.defaultOptions.textureGCMaxIdle&&(this.maxIdle=e.textureGCMaxIdle),e.textureGCCheckCountMax!==el.defaultOptions.textureGCCheckCountMax&&(this.checkCountMax=e.textureGCCheckCountMax)}run(){ie("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};Gf.extension={type:[k.WebGLSystem,k.WebGPUSystem],name:"textureGC"};Gf.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};let Fk=Gf;const bv=class wv{constructor(e={}){this.uid=be("renderTarget"),this.colorAttachments=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,this._depth=!1,this._stencil=!1,this._colorTextures=null;const t="colorAttachments"in e?e:this._normalizeOptions(e);if(this.isRoot=t.isRoot??!1,this.label=t.label,this.colorAttachments=t.colorAttachments,this.depthStencilAttachment=t.depthStencilAttachment,this.depthStencilAttachment){const r=this.depthStencilAttachment.texture.format;this._depth||(this._depth=r.includes("depth")),this._stencil||(this._stencil=r.includes("stencil"))}if(this.colorAttachments.length===0&&!this.depthStencilAttachment)throw new Error("[RenderTarget] no color textures or depth textures were provided. Provide a depthStencilTexture or set depth/stencil to true when using colorTextures: 0.");if(this.colorAttachments.length>0){const r=this.colorTexture;this.resize(r.width,r.height,r._resolution)}this.sizeSource&&this.sizeSource.on("resize",this.onSourceResize,this)}_normalizeOptions(e){const t={...wv.defaultOptions,...e},r=[];let i;if(typeof t.colorTextures=="number"){if(t.colorTextures>0){this._managedColorTextures=!0;for(let o=0;o<t.colorTextures;o++)r.push({texture:new $e({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}),loadOp:"clear",storeOp:"store"})}}else t.colorTextures.forEach(o=>{r.push({texture:o.source,loadOp:"clear",storeOp:"store"})});const s=t.depthStencilTexture===!0;if(this._depth=!!(t.depth||s),this._stencil=!!(t.stencil||s),t.depthStencilTexture instanceof Q||t.depthStencilTexture instanceof $e){if(t.isRoot)throw new Error("[RenderTarget] cannot attach a depth-stencil texture to the screen — the canvas owns its own depth/stencil buffers. Render to a texture target instead.");i={texture:t.depthStencilTexture.source}}else(s&&!t.isRoot||(t.stencil||t.depth)&&r.length===0)&&(i=this._createDepthStencilTexture(t.width,t.height,t.resolution));return{colorAttachments:r,depthStencilAttachment:i,isRoot:t.isRoot,label:t.label}}get size(){const e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}get width(){return this.sizeSource.width}get height(){return this.sizeSource.height}get pixelWidth(){return this.sizeSource.pixelWidth}get pixelHeight(){return this.sizeSource.pixelHeight}get resolution(){return this.sizeSource._resolution}get colorTextures(){return this._colorTextures||(this._colorTextures=this.colorAttachments.map(e=>e.texture)),this._colorTextures}get depthStencilTexture(){var e;return((e=this.depthStencilAttachment)==null?void 0:e.texture)??null}get depth(){return this._depth}get stencil(){return this._stencil}get colorTexture(){var e;return(e=this.colorAttachments[0])==null?void 0:e.texture}get sizeSource(){var e,t;return((e=this.colorAttachments[0])==null?void 0:e.texture)??((t=this.depthStencilAttachment)==null?void 0:t.texture)}onSourceResize(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this._createDepthStencilTexture(this.sizeSource.width,this.sizeSource.height,this.sizeSource._resolution),this._depth=!0,this._stencil=!0}resize(e,t,r=this.resolution,i=!1){if(this.dirtyId++,this.colorAttachments.forEach((s,o)=>{i&&o===0||s.texture.resize(e,t,r)}),this.depthStencilAttachment){if(i&&this.colorAttachments.length===0)return;this.depthStencilAttachment.texture.resize(e,t,r)}}destroy(){!this.colorAttachments&&!this.depthStencilAttachment||(this.sizeSource.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorAttachments.forEach(e=>{e.texture.destroy()}),this.depthStencilAttachment&&(this.depthStencilAttachment.texture.destroy(),delete this.depthStencilAttachment),this.colorAttachments=null,this._colorTextures=null)}_createDepthStencilTexture(e,t,r){return this.depthStencilAttachment??(this.depthStencilAttachment={texture:new $e({width:e,height:t,resolution:r,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1})}),this.depthStencilAttachment}};bv.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let tl=bv;const ki=new Map;ps.register(ki);function Sv(n,e){if(!ki.has(n)){const t=new Q({source:new tn({resource:n,...e})}),r=()=>{ki.get(n)===t&&ki.delete(n)};t.once("destroy",r),t.source.once("destroy",r),ki.set(n,t)}return ki.get(n)}const Of=class Tv{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}init(e){e={...Tv.defaultOptions,...e},e.view&&(ie(Ge,"ViewSystem.view has been renamed to ViewSystem.canvas"),e.canvas=e.view),this.screen=new xe(0,0,e.width,e.height),this.canvas=e.canvas||pe.get().createCanvas(),this.antialias=!!e.antialias,this.texture=Sv(this.canvas,e),this.renderTarget=new tl({colorTextures:[this.texture],depth:!!e.depth,isRoot:!0}),this.texture.source.transparent=e.backgroundAlpha<1,this.resolution=e.resolution}resize(e,t,r){this.texture.source.resize(e,t,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){(typeof e=="boolean"?e:!!(e!=null&&e.removeView))&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.texture.destroy()}};Of.extension={type:[k.WebGLSystem,k.WebGPUSystem,k.CanvasSystem],name:"view",priority:0};Of.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let Gk=Of;const Lf=[Tk,_v,Df,Gk,fv,Rk,Fk,gv,Ck,n1,Dk,xv],Cv=[Pf,Tf,kf,Af,Cf,av,iv,Ef];function Ok(n,e,t,r,i,s){const o=s?1:-1;return n.identity(),n.a=1/r*2,n.d=o*(1/i*2),n.tx=-1-e*n.a,n.ty=-o-t*n.d,n}function Lk(n){if(n.colorAttachments.length===0)return!1;const e=n.colorTexture.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}class Uf{constructor(e){this.rootViewPort=new xe,this.viewport=new xe,this.onRenderTargetChange=new Zx("onRenderTargetChange"),this.projectionMatrix=new Z,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._bindState={target:null,frame:void 0,mipLevel:0,layer:0,flipY:!1},this._bindFrame=new xe,this._renderer=e,e.gc.addCollection(this,"_gpuRenderTargetHash","hash")}get renderSurface(){return this._bindState.target}get mipLevel(){return this._bindState.mipLevel}get layer(){return this._bindState.layer}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart(e){var t,r;this._renderTargetStack.length=0,this.push(e),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=Lk(this.rootRenderTarget),(r=(t=this.adaptor).prerender)==null||r.call(t,this.rootRenderTarget)}postrender(){var e,t;(t=(e=this.adaptor).postrender)==null||t.call(e,this.rootRenderTarget)}bind(e,t=!0,r,i,s=0,o=0,a){var x,b;let l;"target"in e?l=e:(ie("8.20.0","RenderTargetSystem.bind: positional arguments are deprecated, please use an options object instead: bind({ target, clear, clearColor, frame, mipLevel, layer, flipY })"),l={target:e,clear:t,clearColor:r,frame:i,mipLevel:s,layer:o,flipY:a});const u=l.target;t=l.clear??!0,r=l.clearColor,s=(l.mipLevel??0)|0,o=(l.layer??0)|0,a=l.flipY,i=l.frame;const c=this.getRenderTarget(u),h=this.renderTarget!==c;this.renderTarget=c;const d=this.getGpuRenderTarget(c);(c.pixelWidth!==d.width||c.pixelHeight!==d.height)&&(this.adaptor.resizeGpuRenderTarget(c),d.width=c.pixelWidth,d.height=c.pixelHeight);const f=((x=c.colorAttachments[0])==null?void 0:x.texture)||((b=c.depthStencilAttachment)==null?void 0:b.texture),p=this.viewport,g=f.arrayLayerCount||1;if(o<0||o>=g)throw new Error(`[RenderTargetSystem] layer ${o} is out of bounds (arrayLayerCount=${g}).`);const _=this._bindState;_.target=u,_.frame=i?this._bindFrame.copyFrom(i):void 0,_.mipLevel=s,_.layer=o,_.flipY=a;const m=Math.max(f.pixelWidth>>s,1),y=Math.max(f.pixelHeight>>s,1);if(!i&&u instanceof Q&&(i=u.frame),i){const S=f._resolution,T=1<<Math.max(s,0),C=i.x*S+.5|0,M=i.y*S+.5|0,L=i.width*S+.5|0,R=i.height*S+.5|0;let O=Math.floor(C/T),U=Math.floor(M/T),j=Math.ceil(L/T),K=Math.ceil(R/T);O<0&&(j+=O,O=0),U<0&&(K+=U,U=0),O=Math.min(O,m-1),U=Math.min(U,y-1),j=Math.min(j,m-O),K=Math.min(K,y-U),j=Math.max(j,1),K=Math.max(K,1),p.x=O,p.y=U,p.width=j,p.height=K}else p.x=0,p.y=0,p.width=m,p.height=y;return c.flipY=a,Ok(this.projectionMatrix,0,0,p.width/f.resolution,p.height/f.resolution,!c.isRoot!=!!c.flipY),this.adaptor.startRenderPass(c,t,r,p,s,o),h&&this.onRenderTargetChange.emit(c),c}getBindState(e){if(!this.renderTarget)throw new Error("[RenderTargetSystem] getBindState is only valid while a render surface is bound");const t=this._bindState;return e??(e={}),e.target=t.target,e.clear=et.NONE,e.clearColor=void 0,t.frame?e.frame?e.frame.copyFrom(t.frame):e.frame=t.frame.clone():e.frame=void 0,e.mipLevel=t.mipLevel,e.layer=t.layer,e.flipY=!!t.flipY,e}get frontFaceInverted(){const e=this.renderTarget;if(!e)return!1;const t=this._renderer.type===_n.WEBGL&&!e.isRoot;return!!e.flipY!==t}clear(e,t=et.ALL,r,i=this.mipLevel,s=this.layer){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,r,this.viewport,i,s))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=et.ALL,r,i,s=0,o=0,a){let l;"target"in e?l=e:(ie("8.20.0","RenderTargetSystem.push: positional arguments are deprecated, please use an options object instead: push({ target, clear, clearColor, frame, mipLevel, layer, flipY })"),l={target:e,clear:t,clearColor:r,frame:i,mipLevel:s,layer:o,flipY:a});const u=this.bind(l);return this._renderTargetStack.push({target:l.target,clear:!1,clearColor:void 0,frame:l.frame?l.frame.clone():void 0,mipLevel:l.mipLevel,layer:l.layer,flipY:l.flipY}),u}pop(){this._renderTargetStack.pop();const e=this._renderTargetStack[this._renderTargetStack.length-1];if(!e)throw new Error("[RenderTargetSystem] pop: no previous binding to restore (unbalanced pop)");return this.bind(e)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,r,i,s){const o=this.getRenderTarget(e);r.x<0&&(i.width+=r.x,s.x-=r.x,r.x=0),r.y<0&&(i.height+=r.y,s.y-=r.y,r.y=0);const{pixelWidth:a,pixelHeight:l}=o;return i.width=Math.min(i.width,a-r.x),i.height=Math.min(i.height,l-r.y),this.adaptor.copyToTexture(o,t,r,i,s)}copyDepthTexture(e,t,r,i,s={x:0,y:0}){const o=this.getRenderTarget(e);if(!o.depthStencilAttachment){se("[RenderTargetSystem] copyDepthTexture: the source render target has no depth attachment to copy from");return}const a=t.source;if(!a.format.includes("depth")&&!a.format.includes("stencil")){se(`[RenderTargetSystem] copyDepthTexture: the destination texture must have a depth/stencil format (got '${a.format}')`);return}let l=r.x,u=r.y,c=s.x,h=s.y,d=i.width,f=i.height;l<0&&(d+=l,c-=l,l=0),u<0&&(f+=u,h-=u,u=0),d=Math.min(d,o.pixelWidth-l),f=Math.min(f,o.pixelHeight-u),d=Math.min(d,a.pixelWidth-c),f=Math.min(f,a.pixelHeight-h),!(d<=0||f<=0)&&this.adaptor.copyDepthTexture(o,t,{x:l,y:u},{width:d,height:f},{x:c,y:h})}ensureDepthStencil(){if(!this.renderTarget.stencil){if(this.renderTarget.depthStencilTexture){se(`[RenderTargetSystem] a stencil mask is being used, but the render target's depthStencilTexture format '${this.renderTarget.depthStencilTexture.format}' has no stencil aspect, so masking cannot work here. Use a 'depth24plus-stencil8' texture instead.`);return}this.renderTarget._depth=!0,this.renderTarget._stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport,0,this.layer)}}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,t)=>{e!==t&&this._releaseRenderTarget(t,e)}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;if(tn.test(e)&&(e=Sv(e).source),e instanceof tl)t=e;else if(e instanceof $e){const r=e.format;t=r.includes("depth")||r.includes("stencil")?new tl({colorTextures:0,depthStencilTexture:e}):new tl({colorTextures:[e]}),e.source instanceof tn&&(t.isRoot=!0),e.once("destroy",this._onRenderSurfaceDestroy,this)}return this._renderSurfaceToRenderTargetHash.set(e,t),t}_onRenderSurfaceDestroy(e){const t=this._renderSurfaceToRenderTargetHash.get(e);t&&this._releaseRenderTarget(e,t)}_releaseRenderTarget(e,t){t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e),e.off("destroy",this._onRenderSurfaceDestroy,this);const r=this._gpuRenderTargetHash[t.uid];r&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(r))}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this._bindState.target=null}}class Uk{init(e,t){this._renderer=e,this._renderTargetSystem=t}initGpuRenderTarget(e){const t=e.colorTexture,{canvas:r,context:i}=this._ensureCanvas(t);return{canvas:r,context:i,width:r.width,height:r.height}}resizeGpuRenderTarget(e){const t=e.colorTexture,{canvas:r}=this._ensureCanvas(t);r.width=e.pixelWidth,r.height=e.pixelHeight}startRenderPass(e,t,r,i){const s=this._renderTargetSystem.getGpuRenderTarget(e);this._renderer.canvasContext.activeContext=s.context,this._renderer.canvasContext.activeResolution=e.resolution,t&&this.clear(e,t,r,i)}clear(e,t,r,i){const o=this._renderTargetSystem.getGpuRenderTarget(e).context,a=i||{x:0,y:0,width:e.pixelWidth,height:e.pixelHeight};if(o.setTransform(1,0,0,1,0,0),o.clearRect(a.x,a.y,a.width,a.height),r){const l=Ce.shared.setValue(r);l.alpha>0&&(o.globalAlpha=l.alpha,o.fillStyle=l.toHex(),o.fillRect(a.x,a.y,a.width,a.height),o.globalAlpha=1)}}finishRenderPass(){}copyToTexture(e,t,r,i,s){const a=this._renderTargetSystem.getGpuRenderTarget(e).canvas,l=t.source,{context:u}=this._ensureCanvas(l),c=(s==null?void 0:s.x)??0,h=(s==null?void 0:s.y)??0;return u.drawImage(a,r.x,r.y,i.width,i.height,c,h,i.width,i.height),l.update(),t}copyDepthTexture(e,t,r,i,s){se("[CanvasRenderTargetAdaptor] copyDepthTexture is not supported in the canvas renderer")}destroyGpuRenderTarget(e){}_ensureCanvas(e){let t=e.resource;(!t||!tn.test(t))&&(t=pe.get().createCanvas(e.pixelWidth,e.pixelHeight),e.resource=t),(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(t.width=e.pixelWidth,t.height=e.pixelHeight);const r=t.getContext("2d");return{canvas:t,context:r}}}class Ev extends Uf{constructor(e){super(e),this.adaptor=new Uk,this.adaptor.init(e,this)}}Ev.extension={type:[k.CanvasSystem],name:"renderTarget"};class Av{constructor(e){}init(){}initSource(e){}generateCanvas(e){const t=pe.get().createCanvas(),r=t.getContext("2d"),i=ce.getCanvasSource(e);if(!i)return t;const s=e.frame,o=e.source._resolution??e.source.resolution??1,a=s.x*o,l=s.y*o,u=s.width*o,c=s.height*o;return t.width=Math.ceil(u),t.height=Math.ceil(c),r.drawImage(i,a,l,u,c,0,0,u,c),t}getPixels(e){const t=this.generateCanvas(e);return{pixels:t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,t.width,t.height).data,width:t.width,height:t.height}}destroy(){}}Av.extension={type:[k.CanvasSystem],name:"texture"};const Nk=[...Lf,lv,uv,Av,Ev],zk=[Pf,Tf,kf,Af,Cf,ov,rv,Ef],Wk=[tk,cv],kv=[],Pv=[],Mv=[];ae.handleByNamedList(k.CanvasSystem,kv);ae.handleByNamedList(k.CanvasPipes,Pv);ae.handleByNamedList(k.CanvasPipesAdaptor,Mv);ae.add(...Nk,...zk,...Wk);class Hk extends gs{constructor(){const e={name:"canvas",type:_n.CANVAS,systems:kv,renderPipes:Pv,renderPipeAdaptors:Mv};super(e)}}const Vk=Object.freeze(Object.defineProperty({__proto__:null,CanvasRenderer:Hk},Symbol.toStringTag,{value:"Module"}));var nl=(n=>(n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",n))(nl||{});class jk{constructor(e,t){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=t}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}class Rv{constructor(e){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._managedBuffers=new Rn({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this.createGLBuffer(e)}bind(e){const{_gl:t}=this,r=this.getGlBuffer(e);t.bindBuffer(r.type,r.buffer)}bindBufferBase(e,t){const{_gl:r}=this;this._boundBufferBases[t]!==e&&(this._boundBufferBases[t]=e,e._lastBindBaseLocation=t,r.bindBufferBase(r.UNIFORM_BUFFER,t,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let t=this.getLastBindBaseLocation(e);if(t>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,t;let r=0,i=this._nextBindBaseIndex;for(;r<2;){i>=this._maxBindings&&(i=this._minBaseLocation,r++);const s=this._boundBufferBases[i];if(s&&s._lastBindCallId===this._bindCallId){i++;continue}break}return t=i,this._nextBindBaseIndex=i+1,r>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[t]=null,t)}getLastBindBaseLocation(e){const t=e._lastBindBaseLocation;return this._boundBufferBases[t]===e?t:-1}bindBufferRange(e,t,r,i){const{_gl:s}=this;r||(r=0),t||(t=0),this._boundBufferBases[t]=null,s.bindBufferRange(s.UNIFORM_BUFFER,t||0,e.buffer,r*256,i||256)}updateBuffer(e){const{_gl:t}=this,r=this.getGlBuffer(e);if(e._updateID===r.updateID)return r;r.updateID=e._updateID,t.bindBuffer(r.type,r.buffer);const i=e.data,s=e.descriptor.usage&Te.STATIC?t.STATIC_DRAW:t.DYNAMIC_DRAW;return i?r.byteLength>=i.byteLength?t.bufferSubData(r.type,e._updateOffset,i,e._updateOffset/i.BYTES_PER_ELEMENT,(e._updateSize||i.byteLength)/i.BYTES_PER_ELEMENT):(r.byteLength=i.byteLength,t.bufferData(r.type,i,s)):(r.byteLength=e.descriptor.size,t.bufferData(r.type,r.byteLength,s)),r}destroyAll(e=!1){this._managedBuffers.removeAll(e)}onBufferUnload(e,t=!1){const r=e._gpuData[this._renderer.uid];r&&(t||this._gl.deleteBuffer(r.buffer))}createGLBuffer(e){const{_gl:t}=this;let r=nl.ARRAY_BUFFER;e.descriptor.usage&Te.INDEX?r=nl.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&Te.UNIFORM&&(r=nl.UNIFORM_BUFFER);const i=new jk(t.createBuffer(),r);return e._gpuData[this._renderer.uid]=i,this._managedBuffers.add(e),i}resetState(){this._boundBufferBases=Object.create(null)}}Rv.extension={type:[k.WebGLSystem],name:"buffer"};const Nf=class Iv{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...Iv.defaultOptions,...e};let t=this.multiView=e.multiView;if(e.context&&t&&(se("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),t=!1),t?this.canvas=pe.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const r=this._renderer.background.alpha<1,i=e.premultipliedAlpha??!0,s=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:r,premultipliedAlpha:i,antialias:s,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&se("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:t}=this;(t.width<e.width||t.height<e.height)&&(t.width=Math.max(e.width,e.width),t.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof pe.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);const t=this._renderer.view.canvas;t.addEventListener("webglcontextlost",this.handleContextLost,!1),t.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,t){let r;const i=this.canvas;if(e===2&&(r=i.getContext("webgl2",t)),!r&&(r=i.getContext("webgl",t),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){const{gl:e}=this,t={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...t,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...t,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};const r=e.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{var t;this.gl.isContextLost()&&((t=this.extensions.loseContext)==null||t.restoreContext())},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){var t;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),(t=this.extensions.loseContext)==null||t.loseContext()}forceContextLoss(){var e;(e=this.extensions.loseContext)==null||e.loseContext(),this._contextLossForced=!0}validateContext(e){const t=e.getContextAttributes();t&&!t.stencil&&se("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=this.supports,i=this.webGLVersion===2,s=this.extensions;r.uint32Indices=i||!!s.uint32ElementIndex,r.uniformBufferObject=i,r.vertexArrayObject=i||!!s.vertexArrayObject,r.srgbTextures=i||!!s.srgb,r.nonPowOf2wrapping=i,r.nonPowOf2mipmaps=i,r.msaa=i,r.uint32Indices||se("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};Nf.extension={type:[k.WebGLSystem],name:"context"};Nf.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let $k=Nf;function $h(n,e){for(const t in n.attributes){const r=n.attributes[t],i=e[t];i?(r.format??(r.format=i.format),r.offset??(r.offset=i.offset),r.instance??(r.instance=i.instance)):se(`Attribute ${t} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}Xk(n)}function Xk(n){const{buffers:e,attributes:t}=n,r={},i={};for(const s in e){const o=e[s];r[o.uid]=0,i[o.uid]=0}for(const s in t){const o=t[s];r[o.buffer.uid]+=Qn(o.format).stride}for(const s in t){const o=t[s];o.stride??(o.stride=r[o.buffer.uid]),o.start??(o.start=i[o.buffer.uid]),i[o.buffer.uid]+=Qn(o.format).stride}}var Xh=(n=>(n[n.RGBA=6408]="RGBA",n[n.RGB=6407]="RGB",n[n.RG=33319]="RG",n[n.RED=6403]="RED",n[n.RGBA_INTEGER=36249]="RGBA_INTEGER",n[n.RGB_INTEGER=36248]="RGB_INTEGER",n[n.RG_INTEGER=33320]="RG_INTEGER",n[n.RED_INTEGER=36244]="RED_INTEGER",n[n.ALPHA=6406]="ALPHA",n[n.LUMINANCE=6409]="LUMINANCE",n[n.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",n[n.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",n[n.DEPTH_STENCIL=34041]="DEPTH_STENCIL",n))(Xh||{}),zf=(n=>(n[n.TEXTURE_2D=3553]="TEXTURE_2D",n[n.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",n[n.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",n[n.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",n[n.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",n[n.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",n[n.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",n[n.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",n[n.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",n))(zf||{}),ye=(n=>(n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",n[n.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",n[n.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",n[n.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",n[n.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",n[n.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",n[n.BYTE=5120]="BYTE",n[n.SHORT=5122]="SHORT",n[n.INT=5124]="INT",n[n.FLOAT=5126]="FLOAT",n[n.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",n[n.HALF_FLOAT=36193]="HALF_FLOAT",n))(ye||{});const sg={uint8x2:ye.UNSIGNED_BYTE,uint8x4:ye.UNSIGNED_BYTE,sint8x2:ye.BYTE,sint8x4:ye.BYTE,unorm8x2:ye.UNSIGNED_BYTE,unorm8x4:ye.UNSIGNED_BYTE,snorm8x2:ye.BYTE,snorm8x4:ye.BYTE,uint16x2:ye.UNSIGNED_SHORT,uint16x4:ye.UNSIGNED_SHORT,sint16x2:ye.SHORT,sint16x4:ye.SHORT,unorm16x2:ye.UNSIGNED_SHORT,unorm16x4:ye.UNSIGNED_SHORT,snorm16x2:ye.SHORT,snorm16x4:ye.SHORT,float16x2:ye.HALF_FLOAT,float16x4:ye.HALF_FLOAT,float32:ye.FLOAT,float32x2:ye.FLOAT,float32x3:ye.FLOAT,float32x4:ye.FLOAT,uint32:ye.UNSIGNED_INT,uint32x2:ye.UNSIGNED_INT,uint32x3:ye.UNSIGNED_INT,uint32x4:ye.UNSIGNED_INT,sint32:ye.INT,sint32x2:ye.INT,sint32x3:ye.INT,sint32x4:ye.INT};function Yk(n){return sg[n]??sg.float32}const Kk={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class qk{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}}class Bv{constructor(e){this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new Rn({renderer:e,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");this.destroyAll(!0);const t=this._renderer.context.extensions.vertexArrayObject;t&&(e.createVertexArray=()=>t.createVertexArrayOES(),e.bindVertexArray=i=>t.bindVertexArrayOES(i),e.deleteVertexArray=i=>t.deleteVertexArrayOES(i));const r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(e.drawArraysInstanced=(i,s,o,a)=>{r.drawArraysInstancedANGLE(i,s,o,a)},e.drawElementsInstanced=(i,s,o,a,l)=>{r.drawElementsInstancedANGLE(i,s,o,a,l)},e.vertexAttribDivisor=(i,s)=>r.vertexAttribDivisorANGLE(i,s)),this._activeGeometry=null,this._activeVao=null}bind(e,t){const r=this.gl;this._activeGeometry=e;const i=this.getVao(e,t);this._activeVao!==i&&(this._activeVao=i,r.bindVertexArray(i)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const e=this._activeGeometry,t=this._renderer.buffer;for(let r=0;r<e.buffers.length;r++){const i=e.buffers[r];t.updateBuffer(i)}e._gcLastUsed=this._renderer.gc.now}checkCompatibility(e,t){const r=e.attributes,i=t._attributeData;for(const s in i)if(!r[s])throw new Error(`shader and geometry incompatible, geometry missing the "${s}" attribute`)}getSignature(e,t){const r=e.attributes,i=t._attributeData,s=["g",e.uid];for(const o in r)i[o]&&s.push(o,i[o].location);return s.join("-")}getVao(e,t){var r;return((r=e._gpuData[this._renderer.uid])==null?void 0:r.vaoCache[t._key])||this.initGeometryVao(e,t)}initGeometryVao(e,t,r=!0){const i=this._renderer.gl,s=this._renderer.buffer;this._renderer.shader._getProgramData(t),this.checkCompatibility(e,t);const o=this.getSignature(e,t);let a=e._gpuData[this._renderer.uid];a||(a=new qk,e._gpuData[this._renderer.uid]=a,this._managedGeometries.add(e));const l=a.vaoCache;let u=l[o];if(u)return l[t._key]=u,u;$h(e,t._attributeData);const c=e.buffers;u=i.createVertexArray(),i.bindVertexArray(u);for(let h=0;h<c.length;h++){const d=c[h];s.bind(d)}return this.activateVao(e,t),l[t._key]=u,l[o]=u,i.bindVertexArray(null),u}onGeometryUnload(e,t=!1){const r=e._gpuData[this._renderer.uid];if(!r)return;const i=r.vaoCache;if(!t)for(const s in i)this._activeVao!==i[s]&&this.resetState(),this.gl.deleteVertexArray(i[s])}destroyAll(e=!1){this._managedGeometries.removeAll(e)}activateVao(e,t){var a;const r=this._renderer.gl,i=this._renderer.buffer,s=e.attributes;e.indexBuffer&&i.bind(e.indexBuffer);let o=null;for(const l in s){const u=s[l],c=u.buffer,h=i.getGlBuffer(c),d=t._attributeData[l];if(d){o!==h&&(i.bind(c),o=h);const f=d.location;r.enableVertexAttribArray(f);const p=Qn(u.format),g=Yk(u.format);if(((a=d.format)==null?void 0:a.substring(1,4))==="int"?r.vertexAttribIPointer(f,p.size,g,u.stride,u.offset):r.vertexAttribPointer(f,p.size,g,p.normalised,u.stride,u.offset),u.instance)if(this.hasInstance){const _=u.divisor??1;r.vertexAttribDivisor(f,_)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,t,r,i){const{gl:s}=this._renderer,o=this._activeGeometry,a=Kk[e||o.topology];if(i??(i=o.instanceCount),o.indexBuffer){const l=o.indexBuffer.data.BYTES_PER_ELEMENT,u=l===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;i!==1?s.drawElementsInstanced(a,t||o.indexBuffer.data.length,u,(r||0)*l,i):s.drawElements(a,t||o.indexBuffer.data.length,u,(r||0)*l)}else i!==1?s.drawArraysInstanced(a,r||0,t||o.vertexCount,i):s.drawArrays(a,r||0,t||o.vertexCount);return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._managedGeometries.destroy(),this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}Bv.extension={type:[k.WebGLSystem],name:"geometry"};const Qk=new ou({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Wf=class Dv{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){const{useBackBuffer:t,antialias:r}={...Dv.defaultOptions,...e};this.useBackBuffer=t,this._antialias=r,this._renderer.context.supports.msaa||(se("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=tr.for2d();const i=new ms({vertex:`
|
|
623
|
+
attribute vec2 aPosition;
|
|
624
|
+
out vec2 vUv;
|
|
625
|
+
|
|
626
|
+
void main() {
|
|
627
|
+
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
628
|
+
|
|
629
|
+
vUv = (aPosition + 1.0) / 2.0;
|
|
630
|
+
|
|
631
|
+
// flip dem UVs
|
|
632
|
+
vUv.y = 1.0 - vUv.y;
|
|
633
|
+
}`,fragment:`
|
|
634
|
+
in vec2 vUv;
|
|
635
|
+
out vec4 finalColor;
|
|
636
|
+
|
|
637
|
+
uniform sampler2D uTexture;
|
|
638
|
+
|
|
639
|
+
void main() {
|
|
640
|
+
finalColor = texture(uTexture, vUv);
|
|
641
|
+
}`,name:"big-triangle"});this._bigTriangleShader=new er({glProgram:i,resources:{uTexture:Q.WHITE.source}})}renderStart(e){const t=this._renderer.renderTarget.getRenderTarget(e.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!t.isRoot,this._useBackBufferThisRender){const r=this._renderer.renderTarget.getRenderTarget(e.target);this._targetTexture=r.colorTexture,e.target=this._getBackBufferTexture(r.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){const e=this._renderer;e.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(e.renderTarget.bind({target:this._targetTexture,clear:!1}),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,e.encoder.draw({geometry:Qk,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(e){return this._backBufferTexture=this._backBufferTexture||new Q({source:new $e({width:e.width,height:e.height,resolution:e._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(e.width,e.height,e._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};Wf.extension={type:[k.WebGLSystem],name:"backBuffer",priority:1};Wf.defaultOptions={useBackBuffer:!1};let Zk=Wf;class Fv{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.gl.colorMask(!!(e&8),!!(e&4),!!(e&2),!!(e&1)))}}Fv.extension={type:[k.WebGLSystem],name:"colorMask"};class Gv{constructor(e){this.commandFinished=Promise.resolve(),this._renderer=e}setGeometry(e,t){this._renderer.geometry.bind(e,t.glProgram)}finishRenderPass(){}draw(e){const t=this._renderer,{geometry:r,shader:i,state:s,skipSync:o,topology:a,size:l,start:u,instanceCount:c}=e;t.shader.bind(i,o),t.geometry.bind(r,t.shader._activeProgram),s&&t.state.set(s),t.geometry.draw(a,l,u,c??r.instanceCount)}destroy(){this._renderer=null}}Gv.extension={type:[k.WebGLSystem],name:"encoder"};class Ov{constructor(e){this._renderer=e}contextChange(){const e=this._renderer.gl;this.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxBatchableTextures=u1(this.maxTextures,e);const t=this._renderer.context.webGLVersion===2;this.maxUniformBindings=t?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0}destroy(){}}Ov.extension={type:[k.WebGLSystem],name:"limits"};class Jk{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this._attachedMipLevel=0,this._attachedLayer=0,this.msaaRenderBuffer=[]}}const Pr=[];Pr[Ve.NONE]=void 0;Pr[Ve.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Pr[Ve.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Pr[Ve.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Pr[Ve.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Pr[Ve.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}};class Lv{constructor(e){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Ve.NONE},this._renderTargetStencilState=Object.create(null),e.renderTarget.onRenderTargetChange.add(this)}contextChange(e){this._gl=e,this._comparisonFuncMapping={always:e.ALWAYS,never:e.NEVER,equal:e.EQUAL,"not-equal":e.NOTEQUAL,less:e.LESS,"less-equal":e.LEQUAL,greater:e.GREATER,"greater-equal":e.GEQUAL},this._stencilOpsMapping={keep:e.KEEP,zero:e.ZERO,replace:e.REPLACE,invert:e.INVERT,"increment-clamp":e.INCR,"decrement-clamp":e.DECR,"increment-wrap":e.INCR_WRAP,"decrement-wrap":e.DECR_WRAP},this.resetState()}onRenderTargetChange(e){if(this._activeRenderTarget===e)return;this._activeRenderTarget=e;let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Ve.DISABLED,stencilReference:0}),this.setStencilMode(t.stencilMode,t.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Ve.NONE,this._stencilCache.stencilReference=0}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid],i=this._gl,s=Pr[e],o=this._stencilCache;if(r.stencilMode=e,r.stencilReference=t,e===Ve.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,i.disable(i.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,i.enable(i.STENCIL_TEST)),(e!==o.stencilMode||o.stencilReference!==t)&&(o.stencilMode=e,o.stencilReference=t,i.stencilFunc(this._comparisonFuncMapping[s.stencilBack.compare],t,255),i.stencilOp(i.KEEP,i.KEEP,this._stencilOpsMapping[s.stencilBack.passOp]))}}Lv.extension={type:[k.WebGLSystem],name:"stencil"};class Hf{constructor(e){this._syncFunctionHash=Object.create(null),this._adaptor=e,this._systemCheck()}_systemCheck(){if(!$x())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(e){const t=this.getUniformGroupData(e);e.buffer||(e.buffer=new Pn({data:new Float32Array(t.layout.size/4),usage:Te.UNIFORM|Te.COPY_DST}))}getUniformGroupData(e){return this._syncFunctionHash[e._signature]||this._initUniformGroup(e)}_initUniformGroup(e){const t=e._signature;let r=this._syncFunctionHash[t];if(!r){const i=Object.keys(e.uniformStructures).map(a=>e.uniformStructures[a]),s=this._adaptor.createUboElements(i),o=this._generateUboSync(s.uboElements);r=this._syncFunctionHash[t]={layout:s,syncFunction:o}}return this._syncFunctionHash[t]}_generateUboSync(e){return this._adaptor.generateUboSync(e)}syncUniformGroup(e,t,r){const i=this.getUniformGroupData(e);e.buffer||(e.buffer=new Pn({data:new Float32Array(i.layout.size/4),usage:Te.UNIFORM|Te.COPY_DST}));let s=null;return t||(t=e.buffer.data,s=e.buffer.dataInt32),r||(r=0),i.syncFunction(e.uniforms,t,s,r),!0}updateUniformGroup(e){if(e.isStatic&&!e._dirtyId)return!1;e._dirtyId=0;const t=this.syncUniformGroup(e);return e.buffer.update(),t}destroy(){this._syncFunctionHash=null}}const Vf={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,u32:4,"vec2<u32>":8,"vec3<u32>":12,"vec4<u32>":16,"mat2x2<f32>":16*2,"mat3x3<f32>":16*3,"mat4x4<f32>":16*4};function e3(n){const e=n.map(s=>({data:s,offset:0,size:0})),t=16;let r=0,i=0;for(let s=0;s<e.length;s++){const o=e[s];if(r=Vf[o.data.type],!r)throw new Error(`Unknown type ${o.data.type}`);o.data.size>1&&(r=Math.max(r,t)*o.data.size);const a=r===12?16:r;o.size=r;const l=i%t;l>0&&t-l<a?i+=(t-l)%16:i+=(r-l%r)%r,o.offset=i,i+=r}return i=Math.ceil(i/16)*16,{uboElements:e,size:i}}const kn=[{type:"mat3x3<f32>",test:n=>n.value.a!==void 0,ubo:`
|
|
642
|
+
var matrix = uv[name].toArray(true);
|
|
643
|
+
data[offset] = matrix[0];
|
|
644
|
+
data[offset + 1] = matrix[1];
|
|
645
|
+
data[offset + 2] = matrix[2];
|
|
646
|
+
data[offset + 4] = matrix[3];
|
|
647
|
+
data[offset + 5] = matrix[4];
|
|
648
|
+
data[offset + 6] = matrix[5];
|
|
649
|
+
data[offset + 8] = matrix[6];
|
|
650
|
+
data[offset + 9] = matrix[7];
|
|
651
|
+
data[offset + 10] = matrix[8];
|
|
652
|
+
`,uniform:`
|
|
653
|
+
gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));
|
|
654
|
+
`},{type:"vec4<f32>",test:n=>n.type==="vec4<f32>"&&n.size===1&&n.value.width!==void 0,ubo:`
|
|
655
|
+
v = uv[name];
|
|
656
|
+
data[offset] = v.x;
|
|
657
|
+
data[offset + 1] = v.y;
|
|
658
|
+
data[offset + 2] = v.width;
|
|
659
|
+
data[offset + 3] = v.height;
|
|
660
|
+
`,uniform:`
|
|
661
|
+
cv = ud[name].value;
|
|
662
|
+
v = uv[name];
|
|
663
|
+
if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {
|
|
664
|
+
cv[0] = v.x;
|
|
665
|
+
cv[1] = v.y;
|
|
666
|
+
cv[2] = v.width;
|
|
667
|
+
cv[3] = v.height;
|
|
668
|
+
gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);
|
|
669
|
+
}
|
|
670
|
+
`},{type:"vec2<f32>",test:n=>n.type==="vec2<f32>"&&n.size===1&&n.value.x!==void 0,ubo:`
|
|
671
|
+
v = uv[name];
|
|
672
|
+
data[offset] = v.x;
|
|
673
|
+
data[offset + 1] = v.y;
|
|
674
|
+
`,uniform:`
|
|
675
|
+
cv = ud[name].value;
|
|
676
|
+
v = uv[name];
|
|
677
|
+
if (cv[0] !== v.x || cv[1] !== v.y) {
|
|
678
|
+
cv[0] = v.x;
|
|
679
|
+
cv[1] = v.y;
|
|
680
|
+
gl.uniform2f(ud[name].location, v.x, v.y);
|
|
681
|
+
}
|
|
682
|
+
`},{type:"vec4<f32>",test:n=>n.type==="vec4<f32>"&&n.size===1&&n.value.red!==void 0,ubo:`
|
|
683
|
+
v = uv[name];
|
|
684
|
+
data[offset] = v.red;
|
|
685
|
+
data[offset + 1] = v.green;
|
|
686
|
+
data[offset + 2] = v.blue;
|
|
687
|
+
data[offset + 3] = v.alpha;
|
|
688
|
+
`,uniform:`
|
|
689
|
+
cv = ud[name].value;
|
|
690
|
+
v = uv[name];
|
|
691
|
+
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {
|
|
692
|
+
cv[0] = v.red;
|
|
693
|
+
cv[1] = v.green;
|
|
694
|
+
cv[2] = v.blue;
|
|
695
|
+
cv[3] = v.alpha;
|
|
696
|
+
gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);
|
|
697
|
+
}
|
|
698
|
+
`},{type:"vec3<f32>",test:n=>n.type==="vec3<f32>"&&n.size===1&&n.value.red!==void 0,ubo:`
|
|
699
|
+
v = uv[name];
|
|
700
|
+
data[offset] = v.red;
|
|
701
|
+
data[offset + 1] = v.green;
|
|
702
|
+
data[offset + 2] = v.blue;
|
|
703
|
+
`,uniform:`
|
|
704
|
+
cv = ud[name].value;
|
|
705
|
+
v = uv[name];
|
|
706
|
+
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {
|
|
707
|
+
cv[0] = v.red;
|
|
708
|
+
cv[1] = v.green;
|
|
709
|
+
cv[2] = v.blue;
|
|
710
|
+
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
|
|
711
|
+
}
|
|
712
|
+
`}];function Uv(n,e,t){const r=[`
|
|
713
|
+
var v = null;
|
|
714
|
+
var v2 = null;
|
|
715
|
+
var t = 0;
|
|
716
|
+
var index = 0;
|
|
717
|
+
var name = null;
|
|
718
|
+
var arrayOffset = null;
|
|
719
|
+
`];let i=0;for(let o=0;o<n.length;o++){const a=n[o],l=a.data.name;let u=!1,c=0;for(let h=0;h<kn.length;h++)if(kn[h].test(a.data)){c=a.offset/4,r.push(`name = "${l}";`,`offset += ${c-i};`,kn[h].ubo),u=!0;break}if(!u)if(a.data.size>1)c=a.offset/4,r.push(t(a,c-i));else{const h=e[a.data.type];c=a.offset/4,r.push(`
|
|
720
|
+
v = uv.${l};
|
|
721
|
+
offset += ${c-i};
|
|
722
|
+
${h};
|
|
723
|
+
`)}i=c}const s=r.join(`
|
|
724
|
+
`);return new Function("uv","data","dataInt32","offset",s)}function Si(n,e){return`
|
|
725
|
+
for (let i = 0; i < ${n*e}; i++) {
|
|
726
|
+
data[offset + (((i / ${n})|0) * 4) + (i % ${n})] = v[i];
|
|
727
|
+
}
|
|
728
|
+
`}const Nv={f32:`
|
|
729
|
+
data[offset] = v;`,i32:`
|
|
730
|
+
dataInt32[offset] = v;`,u32:`
|
|
731
|
+
dataInt32[offset] = v;`,"vec2<f32>":`
|
|
732
|
+
data[offset] = v[0];
|
|
733
|
+
data[offset + 1] = v[1];`,"vec3<f32>":`
|
|
734
|
+
data[offset] = v[0];
|
|
735
|
+
data[offset + 1] = v[1];
|
|
736
|
+
data[offset + 2] = v[2];`,"vec4<f32>":`
|
|
737
|
+
data[offset] = v[0];
|
|
738
|
+
data[offset + 1] = v[1];
|
|
739
|
+
data[offset + 2] = v[2];
|
|
740
|
+
data[offset + 3] = v[3];`,"vec2<i32>":`
|
|
741
|
+
dataInt32[offset] = v[0];
|
|
742
|
+
dataInt32[offset + 1] = v[1];`,"vec3<i32>":`
|
|
743
|
+
dataInt32[offset] = v[0];
|
|
744
|
+
dataInt32[offset + 1] = v[1];
|
|
745
|
+
dataInt32[offset + 2] = v[2];`,"vec4<i32>":`
|
|
746
|
+
dataInt32[offset] = v[0];
|
|
747
|
+
dataInt32[offset + 1] = v[1];
|
|
748
|
+
dataInt32[offset + 2] = v[2];
|
|
749
|
+
dataInt32[offset + 3] = v[3];`,"vec2<u32>":`
|
|
750
|
+
dataInt32[offset] = v[0];
|
|
751
|
+
dataInt32[offset + 1] = v[1];`,"vec3<u32>":`
|
|
752
|
+
dataInt32[offset] = v[0];
|
|
753
|
+
dataInt32[offset + 1] = v[1];
|
|
754
|
+
dataInt32[offset + 2] = v[2];`,"vec4<u32>":`
|
|
755
|
+
dataInt32[offset] = v[0];
|
|
756
|
+
dataInt32[offset + 1] = v[1];
|
|
757
|
+
dataInt32[offset + 2] = v[2];
|
|
758
|
+
dataInt32[offset + 3] = v[3];`,"mat2x2<f32>":`
|
|
759
|
+
data[offset] = v[0];
|
|
760
|
+
data[offset + 1] = v[1];
|
|
761
|
+
data[offset + 4] = v[2];
|
|
762
|
+
data[offset + 5] = v[3];`,"mat3x3<f32>":`
|
|
763
|
+
data[offset] = v[0];
|
|
764
|
+
data[offset + 1] = v[1];
|
|
765
|
+
data[offset + 2] = v[2];
|
|
766
|
+
data[offset + 4] = v[3];
|
|
767
|
+
data[offset + 5] = v[4];
|
|
768
|
+
data[offset + 6] = v[5];
|
|
769
|
+
data[offset + 8] = v[6];
|
|
770
|
+
data[offset + 9] = v[7];
|
|
771
|
+
data[offset + 10] = v[8];`,"mat4x4<f32>":`
|
|
772
|
+
for (let i = 0; i < 16; i++) {
|
|
773
|
+
data[offset + i] = v[i];
|
|
774
|
+
}`,"mat3x2<f32>":Si(3,2),"mat4x2<f32>":Si(4,2),"mat2x3<f32>":Si(2,3),"mat4x3<f32>":Si(4,3),"mat2x4<f32>":Si(2,4),"mat3x4<f32>":Si(3,4)},t3={...Nv,"mat2x2<f32>":`
|
|
775
|
+
data[offset] = v[0];
|
|
776
|
+
data[offset + 1] = v[1];
|
|
777
|
+
data[offset + 2] = v[2];
|
|
778
|
+
data[offset + 3] = v[3];
|
|
779
|
+
`};function n3(n,e){const t=Math.max(Vf[n.data.type]/16,1),r=n.data.value.length/n.data.size,i=(4-r%4)%4,s=n.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
780
|
+
v = uv.${n.data.name};
|
|
781
|
+
offset += ${e};
|
|
782
|
+
|
|
783
|
+
arrayOffset = offset;
|
|
784
|
+
|
|
785
|
+
t = 0;
|
|
786
|
+
|
|
787
|
+
for(var i=0; i < ${n.data.size*t}; i++)
|
|
788
|
+
{
|
|
789
|
+
for(var j = 0; j < ${r}; j++)
|
|
790
|
+
{
|
|
791
|
+
${s}[arrayOffset++] = v[t++];
|
|
792
|
+
}
|
|
793
|
+
${i!==0?`arrayOffset += ${i};`:""}
|
|
794
|
+
}
|
|
795
|
+
`}function r3(n){return Uv(n,Nv,n3)}class jf extends Hf{constructor(){super({createUboElements:e3,generateUboSync:r3})}}jf.extension={type:[k.WebGLSystem],name:"ubo"};class i3{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new xe,this._boundFramebuffer=void 0}init(e,t){this._renderer=e,this._renderTargetSystem=t,e.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new xe,this._boundFramebuffer=void 0;const e=this._renderer.gl;this._drawBuffersCache=[];for(let t=1;t<=16;t++)this._drawBuffersCache[t]=Array.from({length:t},(r,i)=>e.COLOR_ATTACHMENT0+i)}copyToTexture(e,t,r,i,s){const o=this._renderTargetSystem,a=this._renderer,l=o.getGpuRenderTarget(e),u=a.gl;return this.finishRenderPass(e),u.bindFramebuffer(u.FRAMEBUFFER,l.resolveTargetFramebuffer),this._boundFramebuffer=l.resolveTargetFramebuffer,a.texture.bind(t,0),u.copyTexSubImage2D(u.TEXTURE_2D,0,s.x,s.y,r.x,r.y,i.width,i.height),t}copyDepthTexture(e,t,r,i,s){const o=this._renderTargetSystem,a=this._renderer.gl;this.finishRenderPass(e);const l=o.getRenderTarget(t),u=o.getGpuRenderTarget(e),c=o.getGpuRenderTarget(l);a.bindFramebuffer(a.READ_FRAMEBUFFER,u.framebuffer),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,c.framebuffer),this._boundFramebuffer=void 0,a.blitFramebuffer(r.x,r.y,r.x+i.width,r.y+i.height,s.x,s.y,s.x+i.width,s.y+i.height,a.DEPTH_BUFFER_BIT,a.NEAREST)}startRenderPass(e,t=!0,r,i,s=0,o=0){const l=this._renderTargetSystem.getGpuRenderTarget(e);if(o!==0&&this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to array layers requires WebGL2.");if(s>0){if(l.msaa)throw new Error("[RenderTargetSystem] Rendering to mip levels is not supported with MSAA render targets.");if(this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to mip levels requires WebGL2.")}e.colorAttachments.forEach(d=>{this._renderer.texture.unbind(d.texture)});const u=this._renderer.gl;this.bindFramebuffer(l.framebuffer),!e.isRoot&&e.colorAttachments.length>0&&(l._attachedMipLevel!==s||l._attachedLayer!==o)&&(e.colorAttachments.forEach((d,f)=>{const p=d.texture,g=this._renderer.texture.getGlSource(p);if(g.target===u.TEXTURE_2D){if(o!==0)throw new Error("[RenderTargetSystem] layer must be 0 when rendering to 2D textures in WebGL.");u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0+f,u.TEXTURE_2D,g.texture,s)}else if(g.target===u.TEXTURE_2D_ARRAY){if(this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to 2D array textures requires WebGL2.");u.framebufferTextureLayer(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0+f,g.texture,s,o)}else if(g.target===u.TEXTURE_CUBE_MAP){if(o<0||o>5)throw new Error("[RenderTargetSystem] Cube map layer must be between 0 and 5.");u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0+f,u.TEXTURE_CUBE_MAP_POSITIVE_X+o,g.texture,s)}else throw new Error("[RenderTargetSystem] Unsupported texture target for render-to-layer in WebGL.")}),l._attachedMipLevel=s,l._attachedLayer=o),l.framebuffer&&(e.depthStencilAttachment?this._attachDepthStencilTexture(e,s,o):!l.depthStencilRenderBuffer&&(e.stencil||e.depth)&&this._initStencil(l)),e.colorAttachments.length>1&&this._setDrawBuffers(e,u);let c=i.y;e.isRoot&&(c=e.pixelHeight-i.height-i.y);const h=this._viewPortCache;(h.x!==i.x||h.y!==c||h.width!==i.width||h.height!==i.height)&&(h.x=i.x,h.y=c,h.width=i.width,h.height=i.height,u.viewport(i.x,c,i.width,i.height)),this.clear(e,t,r)}finishRenderPass(e){const r=this._renderTargetSystem.getGpuRenderTarget(e);if(!r.msaa||e.colorAttachments.length===0)return;const i=this._renderer.gl;i.bindFramebuffer(i.FRAMEBUFFER,r.resolveTargetFramebuffer),i.bindFramebuffer(i.READ_FRAMEBUFFER,r.framebuffer),i.blitFramebuffer(0,0,r.width,r.height,0,0,r.width,r.height,i.COLOR_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,r.framebuffer),this._boundFramebuffer=r.framebuffer}initGpuRenderTarget(e){const r=this._renderer.gl,i=new Jk;i._attachedMipLevel=0,i._attachedLayer=0;const s=e.colorTexture;return s instanceof tn?(this._renderer.context.ensureCanvasSize(s.resource),i.framebuffer=null,i):(i.width=e.pixelWidth,i.height=e.pixelHeight,e.colorAttachments.length===0?this._initDepth(e,i):this._initColor(e,i),e.depthStencilAttachment&&this._attachDepthStencilTexture(e,0,0),r.bindFramebuffer(r.FRAMEBUFFER,null),this._boundFramebuffer=null,i)}destroyGpuRenderTarget(e){const t=this._renderer.gl;e.framebuffer&&(t.deleteFramebuffer(e.framebuffer),e.framebuffer=null),e.resolveTargetFramebuffer&&(t.deleteFramebuffer(e.resolveTargetFramebuffer),e.resolveTargetFramebuffer=null),e.depthStencilRenderBuffer&&(t.deleteRenderbuffer(e.depthStencilRenderBuffer),e.depthStencilRenderBuffer=null),e.msaaRenderBuffer.forEach(r=>{t.deleteRenderbuffer(r)}),e.msaaRenderBuffer=null}clear(e,t,r,i,s=0,o=0){if(!t)return;if(o!==0)throw new Error("[RenderTargetSystem] Clearing array layers is not supported in WebGL renderer.");const a=this._renderTargetSystem;if(typeof t=="boolean"&&(t=t?et.ALL:et.NONE),e.colorAttachments.length===0&&(t&=~et.COLOR,!t))return;const l=this._renderer.gl,u=!!(t&et.DEPTH)&&!this._renderer.state.depthMaskEnabled;if(t&et.COLOR){r??(r=a.defaultClearColor);const c=this._clearColorCache,h=r;(c[0]!==h[0]||c[1]!==h[1]||c[2]!==h[2]||c[3]!==h[3])&&(c[0]=h[0],c[1]=h[1],c[2]=h[2],c[3]=h[3],l.clearColor(h[0],h[1],h[2],h[3]))}u&&l.depthMask(!0),l.clear(t),u&&l.depthMask(!1)}resizeGpuRenderTarget(e){if(e.isRoot)return;const t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.pixelWidth,t.height=e.pixelHeight,e.colorAttachments.length>0&&this._resizeColor(e,t),t.depthStencilRenderBuffer&&this._resizeStencil(t),this._boundFramebuffer=void 0}_initColor(e,t){const r=this._renderer,i=r.gl,s=i.createFramebuffer();if(t.resolveTargetFramebuffer=s,i.bindFramebuffer(i.FRAMEBUFFER,s),e.colorAttachments.forEach((a,l)=>{const u=a.texture;u.antialias&&(r.context.supports.msaa?t.msaa=!0:se("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(u,0);const c=r.texture.getGlSource(u),h=c.texture;if(c.target===i.TEXTURE_2D)i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,i.TEXTURE_2D,h,0);else if(c.target===i.TEXTURE_2D_ARRAY){if(r.context.webGLVersion<2)throw new Error("[RenderTargetSystem] TEXTURE_2D_ARRAY requires WebGL2.");i.framebufferTextureLayer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,h,0,0)}else if(c.target===i.TEXTURE_CUBE_MAP)i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,i.TEXTURE_CUBE_MAP_POSITIVE_X,h,0);else throw new Error("[RenderTargetSystem] Unsupported texture target for framebuffer attachment.")}),t.msaa){const a=i.createFramebuffer();t.framebuffer=a,i.bindFramebuffer(i.FRAMEBUFFER,a),e.colorAttachments.forEach((l,u)=>{const c=i.createRenderbuffer();t.msaaRenderBuffer[u]=c})}else t.framebuffer=s;this._resizeColor(e,t)}_initDepth(e,t){const r=this._renderer;if(r.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Depth-only render targets require WebGL2.");const i=r.gl,s=i.createFramebuffer();t.resolveTargetFramebuffer=s,t.framebuffer=s,i.bindFramebuffer(i.FRAMEBUFFER,s),i.drawBuffers([i.NONE]),i.readBuffer(i.NONE)}_resizeColor(e,t){const r=e.colorAttachments[0].texture;if(t._attachedMipLevel=0,t._attachedLayer=0,e.colorAttachments.forEach((i,s)=>{s!==0&&i.texture.resize(r.width,r.height,r._resolution)}),t.msaa){const i=this._renderer,s=i.gl,o=t.framebuffer;s.bindFramebuffer(s.FRAMEBUFFER,o),e.colorAttachments.forEach((a,l)=>{const u=a.texture;i.texture.bindSource(u,0);const h=i.texture.getGlSource(u).internalFormat,d=t.msaaRenderBuffer[l];s.bindRenderbuffer(s.RENDERBUFFER,d),s.renderbufferStorageMultisample(s.RENDERBUFFER,4,h,u.pixelWidth,u.pixelHeight),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+l,s.RENDERBUFFER,d)})}}_attachDepthStencilTexture(e,t,r){const i=this._renderer,s=i.gl,o=e.depthStencilAttachment.texture,a=i.texture.getGlSource(o),l=a.texture,u=o.format;let c;u==="depth24plus-stencil8"||u==="depth32float-stencil8"?c=s.DEPTH_STENCIL_ATTACHMENT:u==="stencil8"?c=s.STENCIL_ATTACHMENT:c=s.DEPTH_ATTACHMENT,a.target===s.TEXTURE_2D?s.framebufferTexture2D(s.FRAMEBUFFER,c,s.TEXTURE_2D,l,t):a.target===s.TEXTURE_2D_ARRAY?s.framebufferTextureLayer(s.FRAMEBUFFER,c,l,t,r):a.target===s.TEXTURE_CUBE_MAP&&s.framebufferTexture2D(s.FRAMEBUFFER,c,s.TEXTURE_CUBE_MAP_POSITIVE_X+r,l,t)}_initStencil(e){if(e.framebuffer===null)return;const t=this._renderer.gl,r=t.createRenderbuffer();e.depthStencilRenderBuffer=r,t.bindRenderbuffer(t.RENDERBUFFER,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r),this._resizeStencil(e)}_resizeStencil(e){const t=this._renderer.gl;t.bindRenderbuffer(t.RENDERBUFFER,e.depthStencilRenderBuffer),e.msaa?t.renderbufferStorageMultisample(t.RENDERBUFFER,4,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,this._renderer.context.webGLVersion===2?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL,e.width,e.height)}prerender(e){if(e.colorAttachments.length===0)return;const t=e.colorAttachments[0].texture.resource;this._renderer.context.multiView&&tn.test(t)&&this._renderer.context.ensureCanvasSize(t)}postrender(e){if(!this._renderer.context.multiView||e.colorAttachments.length===0)return;const t=e.colorAttachments[0].texture;if(tn.test(t.resource)){const r=this._renderer.context.canvas,i=t;i.context2D.drawImage(r,0,i.pixelHeight-r.height)}}_setDrawBuffers(e,t){const r=e.colorAttachments.length,i=this._drawBuffersCache[r];if(this._renderer.context.webGLVersion===1){const s=this._renderer.context.extensions.drawBuffers;s?s.drawBuffersWEBGL(i):se("[RenderTexture] This WebGL1 context does not support rendering to multiple targets")}else t.drawBuffers(i)}resetState(){this._boundFramebuffer=void 0,this._viewPortCache=new xe,this._clearColorCache=[0,0,0,0]}bindFramebuffer(e){this._boundFramebuffer!==e&&(this._boundFramebuffer=e,this._renderer.gl.bindFramebuffer(this._renderer.gl.FRAMEBUFFER,e))}}class zv extends Uf{constructor(e){super(e),this.adaptor=new i3,this.adaptor.init(e,this)}resetState(){this.adaptor.resetState()}}zv.extension={type:[k.WebGLSystem],name:"renderTarget"};class au extends Ot{constructor({buffer:e,offset:t,size:r}){super(),this.uid=be("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=be("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=t|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}get _gcLastUsed(){var e;return((e=this.buffer)==null?void 0:e._gcLastUsed)??-1}set _gcLastUsed(e){this.buffer&&(this.buffer._gcLastUsed=e)}onBufferChange(){this._resourceId=be("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null,this.removeAllListeners()}}class Wv extends Ot{constructor(e,t){super(),this._resourceType="textureView",this._resourceId=be("resource"),this._touched=0,this.source=e,this.viewDescriptor=t,this._onChange=this._onChange.bind(this),this._onDestroy=this._onDestroy.bind(this),this.source.on("change",this._onChange),this.source.on("destroy",this._onDestroy)}_onChange(){this.emit("change",this)}_onDestroy(){this.destroy()}get destroyed(){return this.source.destroyed}destroy(){this.source&&(this.source.off("change",this._onChange),this.source.off("destroy",this._onDestroy)),this.emit("destroy",this),this.removeAllListeners()}}function s3(n,e){const t=[],r=[`
|
|
796
|
+
var g = s.groups;
|
|
797
|
+
var sS = r.shader;
|
|
798
|
+
var p = s.glProgram;
|
|
799
|
+
var ugS = r.uniformGroup;
|
|
800
|
+
var resources;
|
|
801
|
+
`];let i=!1,s=0;const o=e._getProgramData(n.glProgram);for(const l in n.groups){const u=n.groups[l];t.push(`
|
|
802
|
+
resources = g[${l}].resources;
|
|
803
|
+
`);for(const c in u.resources){const h=u.resources[c];if(h instanceof xn)if(h.ubo){const d=n._uniformBindMap[l][Number(c)];t.push(`
|
|
804
|
+
sS.bindUniformBlock(
|
|
805
|
+
resources[${c}],
|
|
806
|
+
'${d}',
|
|
807
|
+
${n.glProgram._uniformBlockData[d].index}
|
|
808
|
+
);
|
|
809
|
+
`)}else t.push(`
|
|
810
|
+
ugS.updateUniformGroup(resources[${c}], p, sD);
|
|
811
|
+
`);else if(h instanceof au){const d=n._uniformBindMap[l][Number(c)];t.push(`
|
|
812
|
+
sS.bindUniformBlock(
|
|
813
|
+
resources[${c}],
|
|
814
|
+
'${d}',
|
|
815
|
+
${n.glProgram._uniformBlockData[d].index}
|
|
816
|
+
);
|
|
817
|
+
`)}else if(h instanceof $e||h instanceof Wv){const d=n._uniformBindMap[l][c],f=o.uniformData[d];f&&(i||(i=!0,r.push(`
|
|
818
|
+
var tS = r.texture;
|
|
819
|
+
`)),e._gl.uniform1i(f.location,s),t.push(`
|
|
820
|
+
tS.bind(resources[${c}], ${s});
|
|
821
|
+
`),s++)}}}const a=[...r,...t].join(`
|
|
822
|
+
`);return new Function("r","s","sD",a)}class o3{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}function og(n,e,t){const r=n.createShader(e);return n.shaderSource(r,t),n.compileShader(r),r}function bc(n){const e=new Array(n);for(let t=0;t<e.length;t++)e[t]=!1;return e}function Hv(n,e){switch(n){case"float":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return bc(2*e);case"bvec3":return bc(3*e);case"bvec4":return bc(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}let Ga=null;const ag={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_2D_SHADOW:"sampler2DShadow",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_CUBE_SHADOW:"samplerCubeShadow",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray",SAMPLER_2D_ARRAY_SHADOW:"sampler2DArrayShadow"},a3={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"};function Vv(n,e){if(!Ga){const t=Object.keys(ag);Ga={};for(let r=0;r<t.length;++r){const i=t[r];Ga[n[i]]=ag[i]}}return Ga[e]}function l3(n,e){const t=Vv(n,e);return a3[t]||"float32"}function u3(n,e,t=!1){const r={},i=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES);for(let o=0;o<i;o++){const a=e.getActiveAttrib(n,o);if(a.name.startsWith("gl_"))continue;const l=l3(e,a.type);r[a.name]={location:0,format:l,stride:Qn(l).stride,offset:0,instance:!1,start:0}}const s=Object.keys(r);if(t){s.sort((o,a)=>o>a?1:-1);for(let o=0;o<s.length;o++)r[s[o]].location=o,e.bindAttribLocation(n,o,s[o]);e.linkProgram(n)}else for(let o=0;o<s.length;o++)r[s[o]].location=e.getAttribLocation(n,s[o]);return r}function c3(n,e){if(!e.ACTIVE_UNIFORM_BLOCKS)return{};const t={},r=e.getProgramParameter(n,e.ACTIVE_UNIFORM_BLOCKS);for(let i=0;i<r;i++){const s=e.getActiveUniformBlockName(n,i),o=e.getUniformBlockIndex(n,s),a=e.getActiveUniformBlockParameter(n,i,e.UNIFORM_BLOCK_DATA_SIZE);t[s]={name:s,index:o,size:a}}return t}function h3(n,e){const t={},r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let i=0;i<r;i++){const s=e.getActiveUniform(n,i),o=s.name.replace(/\[.*?\]$/,""),a=!!s.name.match(/\[.*?\]$/),l=Vv(e,s.type);t[o]={name:o,index:i,type:l,size:s.size,isArray:a,value:Hv(l,s.size)}}return t}function lg(n,e){const t=n.getShaderSource(e);if(t===null){console.error("PixiJS Error: Could not retrieve shader source (WebGL context may be lost).");return}const r=t.split(`
|
|
823
|
+
`).map((c,h)=>`${h}: ${c}`),i=n.getShaderInfoLog(e)??"",s=i.split(`
|
|
824
|
+
`),o={},a=s.map(c=>parseFloat(c.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(c=>c&&!o[c]?(o[c]=!0,!0):!1),l=[""];a.forEach(c=>{r[c-1]=`%c${r[c-1]}%c`,l.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const u=r.join(`
|
|
825
|
+
`);l[0]=u,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...l),console.groupEnd()}function d3(n,e,t,r){n.getProgramParameter(e,n.LINK_STATUS)||(n.getShaderParameter(t,n.COMPILE_STATUS)||lg(n,t),n.getShaderParameter(r,n.COMPILE_STATUS)||lg(n,r),console.error("PixiJS Error: Could not initialize shader."),n.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",n.getProgramInfoLog(e)))}function f3(n,e){const t=og(n,n.VERTEX_SHADER,e.vertex),r=og(n,n.FRAGMENT_SHADER,e.fragment),i=n.createProgram();n.attachShader(i,t),n.attachShader(i,r);const s=e.transformFeedbackVaryings;s&&(typeof n.transformFeedbackVaryings!="function"?se("TransformFeedback is not supported but TransformFeedbackVaryings are given."):n.transformFeedbackVaryings(i,s.names,s.bufferMode==="separate"?n.SEPARATE_ATTRIBS:n.INTERLEAVED_ATTRIBS)),n.linkProgram(i),n.getProgramParameter(i,n.LINK_STATUS)||d3(n,i,t,r),e._attributeData=u3(i,n,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)),e._uniformData=h3(i,n),e._uniformBlockData=c3(i,n),n.deleteShader(t),n.deleteShader(r);const o={};for(const l in e._uniformData){const u=e._uniformData[l];o[l]={location:n.getUniformLocation(i,l),value:Hv(u.type,u.size)}}return new o3(i,o)}const Oa={textureCount:0,blockIndex:0};class $f{constructor(e){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=e}contextChange(e){this._gl=e,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null}bind(e,t){if(this._setProgram(e.glProgram),t)return;Oa.textureCount=0,Oa.blockIndex=0;let r=this._shaderSyncFunctions[e.glProgram._key];r||(r=this._shaderSyncFunctions[e.glProgram._key]=this._generateShaderSync(e,this)),this._renderer.buffer.nextBindBase(!!e.glProgram.transformFeedbackVaryings),r(this._renderer,e,Oa)}updateUniformGroup(e){this._renderer.uniformGroup.updateUniformGroup(e,this._activeProgram,Oa)}bindUniformBlock(e,t,r=0){const i=this._renderer.buffer,s=this._getProgramData(this._activeProgram),o=e._bufferResource;o||this._renderer.ubo.updateUniformGroup(e);const a=e.buffer,l=i.updateBuffer(a),u=i.freeLocationForBufferBase(l);if(o){const{offset:h,size:d}=e;h===0&&d===a.data.byteLength?i.bindBufferBase(l,u):i.bindBufferRange(l,u,h)}else i.getLastBindBaseLocation(l)!==u&&i.bindBufferBase(l,u);const c=this._activeProgram._uniformBlockData[t].index;s.uniformBlockBindings[r]!==u&&(s.uniformBlockBindings[r]=u,this._renderer.gl.uniformBlockBinding(s.program,c,u))}_setProgram(e){if(this._activeProgram===e)return;this._activeProgram=e;const t=this._getProgramData(e);this._gl.useProgram(t.program)}_getProgramData(e){return this._programDataHash[e._key]||this._createProgramData(e)}_createProgramData(e){const t=e._key;return this._programDataHash[t]=f3(this._gl,e),this._programDataHash[t]}destroy(){for(const e of Object.keys(this._programDataHash))this._programDataHash[e].destroy();this._programDataHash=null,this._shaderSyncFunctions=null,this._activeProgram=null,this._renderer=null,this._gl=null}_generateShaderSync(e,t){return s3(e,t)}resetState(){this._activeProgram=null}}$f.extension={type:[k.WebGLSystem],name:"shader"};const p3={f32:`if (cv !== v) {
|
|
826
|
+
cu.value = v;
|
|
827
|
+
gl.uniform1f(location, v);
|
|
828
|
+
}`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
829
|
+
cv[0] = v[0];
|
|
830
|
+
cv[1] = v[1];
|
|
831
|
+
gl.uniform2f(location, v[0], v[1]);
|
|
832
|
+
}`,"vec3<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
833
|
+
cv[0] = v[0];
|
|
834
|
+
cv[1] = v[1];
|
|
835
|
+
cv[2] = v[2];
|
|
836
|
+
gl.uniform3f(location, v[0], v[1], v[2]);
|
|
837
|
+
}`,"vec4<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
838
|
+
cv[0] = v[0];
|
|
839
|
+
cv[1] = v[1];
|
|
840
|
+
cv[2] = v[2];
|
|
841
|
+
cv[3] = v[3];
|
|
842
|
+
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
|
843
|
+
}`,i32:`if (cv !== v) {
|
|
844
|
+
cu.value = v;
|
|
845
|
+
gl.uniform1i(location, v);
|
|
846
|
+
}`,"vec2<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
847
|
+
cv[0] = v[0];
|
|
848
|
+
cv[1] = v[1];
|
|
849
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
850
|
+
}`,"vec3<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
851
|
+
cv[0] = v[0];
|
|
852
|
+
cv[1] = v[1];
|
|
853
|
+
cv[2] = v[2];
|
|
854
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
855
|
+
}`,"vec4<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
856
|
+
cv[0] = v[0];
|
|
857
|
+
cv[1] = v[1];
|
|
858
|
+
cv[2] = v[2];
|
|
859
|
+
cv[3] = v[3];
|
|
860
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
861
|
+
}`,u32:`if (cv !== v) {
|
|
862
|
+
cu.value = v;
|
|
863
|
+
gl.uniform1ui(location, v);
|
|
864
|
+
}`,"vec2<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
865
|
+
cv[0] = v[0];
|
|
866
|
+
cv[1] = v[1];
|
|
867
|
+
gl.uniform2ui(location, v[0], v[1]);
|
|
868
|
+
}`,"vec3<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
869
|
+
cv[0] = v[0];
|
|
870
|
+
cv[1] = v[1];
|
|
871
|
+
cv[2] = v[2];
|
|
872
|
+
gl.uniform3ui(location, v[0], v[1], v[2]);
|
|
873
|
+
}`,"vec4<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
874
|
+
cv[0] = v[0];
|
|
875
|
+
cv[1] = v[1];
|
|
876
|
+
cv[2] = v[2];
|
|
877
|
+
cv[3] = v[3];
|
|
878
|
+
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
|
879
|
+
}`,bool:`if (cv !== v) {
|
|
880
|
+
cu.value = v;
|
|
881
|
+
gl.uniform1i(location, v);
|
|
882
|
+
}`,"vec2<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
883
|
+
cv[0] = v[0];
|
|
884
|
+
cv[1] = v[1];
|
|
885
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
886
|
+
}`,"vec3<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
887
|
+
cv[0] = v[0];
|
|
888
|
+
cv[1] = v[1];
|
|
889
|
+
cv[2] = v[2];
|
|
890
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
891
|
+
}`,"vec4<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
892
|
+
cv[0] = v[0];
|
|
893
|
+
cv[1] = v[1];
|
|
894
|
+
cv[2] = v[2];
|
|
895
|
+
cv[3] = v[3];
|
|
896
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
897
|
+
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},m3={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"};function g3(n,e){const t=[`
|
|
898
|
+
var v = null;
|
|
899
|
+
var cv = null;
|
|
900
|
+
var cu = null;
|
|
901
|
+
var t = 0;
|
|
902
|
+
var gl = renderer.gl;
|
|
903
|
+
var name = null;
|
|
904
|
+
`];for(const r in n.uniforms){if(!e[r]){n.uniforms[r]instanceof xn?n.uniforms[r].ubo?t.push(`
|
|
905
|
+
renderer.shader.bindUniformBlock(uv.${r}, "${r}");
|
|
906
|
+
`):t.push(`
|
|
907
|
+
renderer.shader.updateUniformGroup(uv.${r});
|
|
908
|
+
`):n.uniforms[r]instanceof au&&t.push(`
|
|
909
|
+
renderer.shader.bindBufferResource(uv.${r}, "${r}");
|
|
910
|
+
`);continue}const i=n.uniformStructures[r];let s=!1;for(let o=0;o<kn.length;o++){const a=kn[o];if(i.type===a.type&&a.test(i)){t.push(`name = "${r}";`,kn[o].uniform),s=!0;break}}if(!s){const a=(i.size===1?p3:m3)[i.type].replace("location",`ud["${r}"].location`);t.push(`
|
|
911
|
+
cu = ud["${r}"];
|
|
912
|
+
cv = cu.value;
|
|
913
|
+
v = uv["${r}"];
|
|
914
|
+
${a};`)}}return new Function("ud","uv","renderer","syncData",t.join(`
|
|
915
|
+
`))}class Xf{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,t,r){const i=this._renderer.shader._getProgramData(t);(!e.isStatic||e._dirtyId!==i.uniformDirtyGroups[e.uid])&&(i.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,t)(i.uniformData,e.uniforms,this._renderer,r))}_getUniformSyncFunction(e,t){var r;return((r=this._uniformGroupSyncHash[e._signature])==null?void 0:r[t._key])||this._createUniformSyncFunction(e,t)}_createUniformSyncFunction(e,t){const r=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),i=this._getSignature(e,t._uniformData,"u");return this._cache[i]||(this._cache[i]=this._generateUniformsSync(e,t._uniformData)),r[t._key]=this._cache[i],r[t._key]}_generateUniformsSync(e,t){return g3(e,t)}_getSignature(e,t,r){const i=e.uniforms,s=[`${r}-`];for(const o in i)s.push(o),t[o]&&s.push(t[o].type);return s.join("-")}destroy(){this._renderer=null,this._cache=null}}Xf.extension={type:[k.WebGLSystem],name:"uniformGroup"};function y3(n){const e={};if(e.normal=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e.add=[n.ONE,n.ONE],e.multiply=[n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA],e.screen=[n.ONE,n.ONE_MINUS_SRC_COLOR,n.ONE,n.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[n.SRC_ALPHA,n.ONE,n.ONE,n.ONE],e["screen-npm"]=[n.SRC_ALPHA,n.ONE_MINUS_SRC_COLOR,n.ONE,n.ONE_MINUS_SRC_ALPHA],e.erase=[n.ZERO,n.ONE_MINUS_SRC_ALPHA],!(n instanceof pe.get().getWebGLRenderingContext()))e.min=[n.ONE,n.ONE,n.ONE,n.ONE,n.MIN,n.MIN],e.max=[n.ONE,n.ONE,n.ONE,n.ONE,n.MAX,n.MAX];else{const r=n.getExtension("EXT_blend_minmax");r&&(e.min=[n.ONE,n.ONE,n.ONE,n.ONE,r.MIN_EXT,r.MIN_EXT],e.max=[n.ONE,n.ONE,n.ONE,n.ONE,r.MAX_EXT,r.MAX_EXT])}return e}const{BLEND:_3,OFFSET:x3,CULLING:v3,DEPTH_TEST:b3,WINDING:w3,DEPTH_MASK:ug}=Wx,jv=class Yh{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[_3]=this.setBlend,this.map[x3]=this.setOffset,this.map[v3]=this.setCullFace,this.map[b3]=this.setDepthTest,this.map[w3]=this.setFrontFace,this.map[ug]=this.setDepthMask,this.checks=[],this.defaultState=tr.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot!=!!e.flipY,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=y3(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let t=this.stateId^e.data,r=0;for(;t;)t&1&&this.map[r].call(this,!!(e.data&1<<r)),t>>=1,r++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e||(e=this.defaultState);for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(Yh._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(Yh._checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}get depthMaskEnabled(){return!!(this.stateId&1<<ug)}setCullFace(e){this._cullFace=e,this.gl[e?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(e){this._frontFace=e,this._frontFaceDirty=!1;const t=this._invertFrontFace?!e:e;this._glFrontFace!==t&&(this._glFrontFace=t,this.gl.frontFace(this.gl[t?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;const t=this.blendModesMap[e],r=this.gl;t.length===2?r.blendFunc(t[0],t[1]):r.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,r.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(e,t){const r=this.checks.indexOf(e);t&&r===-1?this.checks.push(e):!t&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static _checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};jv.extension={type:[k.WebGLSystem],name:"state"};let S3=jv;class T3{constructor(e){this.target=zf.TEXTURE_2D,this._layerInitMask=0,this.texture=e,this.width=-1,this.height=-1,this.type=ye.UNSIGNED_BYTE,this.internalFormat=Xh.RGBA,this.format=Xh.RGBA,this.samplerType=0}destroy(){}}const C3={id:"buffer",upload(n,e,t,r,i,s=!1){const o=i||e.target;!s&&e.width===n.width&&e.height===n.height?t.texSubImage2D(o,0,0,0,n.width,n.height,e.format,e.type,n.resource):t.texImage2D(o,0,e.internalFormat,n.width,n.height,0,e.format,e.type,n.resource),e.width=n.width,e.height=n.height}},E3={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},A3={id:"compressed",upload(n,e,t,r,i,s){const o=i??e.target;t.pixelStorei(t.UNPACK_ALIGNMENT,4);let a=n.pixelWidth,l=n.pixelHeight;const u=!!E3[n.format];for(let c=0;c<n.resource.length;c++){const h=n.resource[c];u?t.compressedTexImage2D(o,c,e.internalFormat,a,l,0,h):t.texImage2D(o,c,e.internalFormat,a,l,0,e.format,e.type,h),a=Math.max(a>>1,1),l=Math.max(l>>1,1)}}},cg=["right","left","top","bottom","front","back"];function k3(n){return{id:"cube",upload(e,t,r,i){const s=e.faces;for(let o=0;o<cg.length;o++){const a=cg[o],l=s[a];if(!l.resource)continue;(n[l.uploadMethodId]||n.image).upload(l,t,r,i,zf.TEXTURE_CUBE_MAP_POSITIVE_X+o,(t._layerInitMask&1<<o)===0),t._layerInitMask|=1<<o}t.width=e.pixelWidth,t.height=e.pixelHeight}}}const $v={id:"image",upload(n,e,t,r,i,s=!1){const o=i||e.target,a=n.pixelWidth,l=n.pixelHeight,u=n.resourceWidth,c=n.resourceHeight,h=r===2,d=s||e.width!==a||e.height!==l,f=u>=a&&c>=l,p=n.resource;(h?P3:M3)(t,o,e,a,l,u,c,p,d,f),e.width=a,e.height=l}};function P3(n,e,t,r,i,s,o,a,l,u){if(!u){l&&n.texImage2D(e,0,t.internalFormat,r,i,0,t.format,t.type,null),n.texSubImage2D(e,0,0,0,s,o,t.format,t.type,a);return}if(!l){n.texSubImage2D(e,0,0,0,t.format,t.type,a);return}n.texImage2D(e,0,t.internalFormat,r,i,0,t.format,t.type,a)}function M3(n,e,t,r,i,s,o,a,l,u){if(!u){l&&n.texImage2D(e,0,t.internalFormat,r,i,0,t.format,t.type,null),n.texSubImage2D(e,0,0,0,t.format,t.type,a);return}if(!l){n.texSubImage2D(e,0,0,0,t.format,t.type,a);return}n.texImage2D(e,0,t.internalFormat,t.format,t.type,a)}const R3=ek(),I3={id:"video",upload(n,e,t,r,i,s=R3){if(!n.isValid){const o=i??e.target;t.texImage2D(o,0,e.internalFormat,1,1,0,e.format,e.type,null);return}$v.upload(n,e,t,r,i,s)}},hg={linear:9729,nearest:9728},B3={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},wc={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},D3={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function dg(n,e,t,r,i,s,o,a){const l=s;if(!a||n.addressModeU!=="repeat"||n.addressModeV!=="repeat"||n.addressModeW!=="repeat"){const u=wc[o?"clamp-to-edge":n.addressModeU],c=wc[o?"clamp-to-edge":n.addressModeV],h=wc[o?"clamp-to-edge":n.addressModeW];e[i](l,e.TEXTURE_WRAP_S,u),e[i](l,e.TEXTURE_WRAP_T,c),e.TEXTURE_WRAP_R&&e[i](l,e.TEXTURE_WRAP_R,h)}if((!a||n.magFilter!=="linear")&&e[i](l,e.TEXTURE_MAG_FILTER,hg[n.magFilter]),t){if(!a||n.mipmapFilter!=="linear"){const u=B3[n.minFilter][n.mipmapFilter];e[i](l,e.TEXTURE_MIN_FILTER,u)}}else e[i](l,e.TEXTURE_MIN_FILTER,hg[n.minFilter]);if(r&&n.maxAnisotropy>1){const u=Math.min(n.maxAnisotropy,e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[i](l,r.TEXTURE_MAX_ANISOTROPY_EXT,u)}n.compare?(e[i](l,e.TEXTURE_COMPARE_FUNC,D3[n.compare]),e[i](l,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE)):a||e[i](l,e.TEXTURE_COMPARE_MODE,e.NONE)}function F3(n){return{r8unorm:n.RED,r8snorm:n.RED,r8uint:n.RED,r8sint:n.RED,r16uint:n.RED,r16sint:n.RED,r16float:n.RED,rg8unorm:n.RG,rg8snorm:n.RG,rg8uint:n.RG,rg8sint:n.RG,r32uint:n.RED,r32sint:n.RED,r32float:n.RED,rg16uint:n.RG,rg16sint:n.RG,rg16float:n.RG,rgba8unorm:n.RGBA,"rgba8unorm-srgb":n.RGBA,rgba8snorm:n.RGBA,rgba8uint:n.RGBA,rgba8sint:n.RGBA,bgra8unorm:n.RGBA,"bgra8unorm-srgb":n.RGBA,rgb9e5ufloat:n.RGB,rgb10a2unorm:n.RGBA,rg11b10ufloat:n.RGB,rg32uint:n.RG,rg32sint:n.RG,rg32float:n.RG,rgba16uint:n.RGBA,rgba16sint:n.RGBA,rgba16float:n.RGBA,rgba32uint:n.RGBA,rgba32sint:n.RGBA,rgba32float:n.RGBA,stencil8:n.STENCIL_INDEX8,depth16unorm:n.DEPTH_COMPONENT,depth24plus:n.DEPTH_COMPONENT,"depth24plus-stencil8":n.DEPTH_STENCIL,depth32float:n.DEPTH_COMPONENT,"depth32float-stencil8":n.DEPTH_STENCIL}}function G3(n,e){let t={},r=n.RGBA;return n instanceof pe.get().getWebGLRenderingContext()?e.srgb&&(t={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(t={"rgba8unorm-srgb":n.SRGB8_ALPHA8,"bgra8unorm-srgb":n.SRGB8_ALPHA8},r=n.RGBA8),{r8unorm:n.R8,r8snorm:n.R8_SNORM,r8uint:n.R8UI,r8sint:n.R8I,r16uint:n.R16UI,r16sint:n.R16I,r16float:n.R16F,rg8unorm:n.RG8,rg8snorm:n.RG8_SNORM,rg8uint:n.RG8UI,rg8sint:n.RG8I,r32uint:n.R32UI,r32sint:n.R32I,r32float:n.R32F,rg16uint:n.RG16UI,rg16sint:n.RG16I,rg16float:n.RG16F,rgba8unorm:n.RGBA,...t,rgba8snorm:n.RGBA8_SNORM,rgba8uint:n.RGBA8UI,rgba8sint:n.RGBA8I,bgra8unorm:r,rgb9e5ufloat:n.RGB9_E5,rgb10a2unorm:n.RGB10_A2,rg11b10ufloat:n.R11F_G11F_B10F,rg32uint:n.RG32UI,rg32sint:n.RG32I,rg32float:n.RG32F,rgba16uint:n.RGBA16UI,rgba16sint:n.RGBA16I,rgba16float:n.RGBA16F,rgba32uint:n.RGBA32UI,rgba32sint:n.RGBA32I,rgba32float:n.RGBA32F,stencil8:n.STENCIL_INDEX8,depth16unorm:n.DEPTH_COMPONENT16,depth24plus:n.DEPTH_COMPONENT24,"depth24plus-stencil8":n.DEPTH24_STENCIL8,depth32float:n.DEPTH_COMPONENT32F,"depth32float-stencil8":n.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}function O3(n){return{r8unorm:n.UNSIGNED_BYTE,r8snorm:n.BYTE,r8uint:n.UNSIGNED_BYTE,r8sint:n.BYTE,r16uint:n.UNSIGNED_SHORT,r16sint:n.SHORT,r16float:n.HALF_FLOAT,rg8unorm:n.UNSIGNED_BYTE,rg8snorm:n.BYTE,rg8uint:n.UNSIGNED_BYTE,rg8sint:n.BYTE,r32uint:n.UNSIGNED_INT,r32sint:n.INT,r32float:n.FLOAT,rg16uint:n.UNSIGNED_SHORT,rg16sint:n.SHORT,rg16float:n.HALF_FLOAT,rgba8unorm:n.UNSIGNED_BYTE,"rgba8unorm-srgb":n.UNSIGNED_BYTE,rgba8snorm:n.BYTE,rgba8uint:n.UNSIGNED_BYTE,rgba8sint:n.BYTE,bgra8unorm:n.UNSIGNED_BYTE,"bgra8unorm-srgb":n.UNSIGNED_BYTE,rgb9e5ufloat:n.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:n.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:n.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:n.UNSIGNED_INT,rg32sint:n.INT,rg32float:n.FLOAT,rgba16uint:n.UNSIGNED_SHORT,rgba16sint:n.SHORT,rgba16float:n.HALF_FLOAT,rgba32uint:n.UNSIGNED_INT,rgba32sint:n.INT,rgba32float:n.FLOAT,stencil8:n.UNSIGNED_BYTE,depth16unorm:n.UNSIGNED_SHORT,depth24plus:n.UNSIGNED_INT,"depth24plus-stencil8":n.UNSIGNED_INT_24_8,depth32float:n.FLOAT,"depth32float-stencil8":n.FLOAT_32_UNSIGNED_INT_24_8_REV}}function L3(n){return{"2d":n.TEXTURE_2D,cube:n.TEXTURE_CUBE_MAP,"1d":null,"3d":(n==null?void 0:n.TEXTURE_3D)||null,"2d-array":(n==null?void 0:n.TEXTURE_2D_ARRAY)||null,"cube-array":(n==null?void 0:n.TEXTURE_CUBE_MAP_ARRAY)||null}}const U3=4,Yf=class Xv{constructor(e){this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=e,this._managedTextures=new Rn({renderer:e,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"glTexture"});const t={image:$v,buffer:C3,video:I3,compressed:A3,...Xv.uploadExtensions};this._uploads={...t,cube:k3(t)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=G3(e,this._renderer.context.extensions),this._mapFormatToType=O3(e),this._mapFormatToFormat=F3(e),this._mapViewDimensionToGlTarget=L3(e)),this._managedTextures.removeAll(!0),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let t=0;t<16;t++)this.bind(Q.EMPTY,t)}initSource(e){this.bind(e)}bind(e,t=0){const r=e.source;e?(this.bindSource(r,t),this._useSeparateSamplers&&this._bindSampler(r.style,t)):(this.bindSource(null,t),this._useSeparateSamplers&&this._bindSampler(null,t))}bindSource(e,t=0){const r=this._gl;if(e._gcLastUsed=this._renderer.gc.now,this._boundTextures[t]!==e){this._boundTextures[t]=e,this._activateLocation(t),e||(e=Q.EMPTY.source);const i=this.getGlSource(e);r.bindTexture(i.target,i.texture)}}_bindSampler(e,t=0){const r=this._gl;if(!e){this._boundSamplers[t]=null,r.bindSampler(t,null);return}const i=this._getGlSampler(e);this._boundSamplers[t]!==i&&(this._boundSamplers[t]=i,r.bindSampler(t,i))}unbind(e){const t=e.source,r=this._boundTextures,i=this._gl;for(let s=0;s<r.length;s++)if(r[s]===t){this._activateLocation(s);const o=this.getGlSource(t);i.bindTexture(o.target,null),r[s]=null}}_activateLocation(e){this._activeTextureLocation!==e&&(this._activeTextureLocation=e,this._gl.activeTexture(this._gl.TEXTURE0+e))}_initSource(e){const t=this._gl,r=new T3(t.createTexture());if(r.type=this._mapFormatToType[e.format],r.internalFormat=this._mapFormatToInternalFormat[e.format],r.format=this._mapFormatToFormat[e.format],r.target=this._mapViewDimensionToGlTarget[e.viewDimension],r.target===null)throw new Error(`Unsupported view dimension: ${e.viewDimension} with this webgl version: ${this._renderer.context.webGLVersion}`);if(e.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||e.isPowerOfTwo)){const s=Math.max(e.width,e.height);e.mipLevelCount=Math.floor(Math.log2(s))+1}return e._gpuData[this._renderer.uid]=r,this._managedTextures.add(e)&&(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceUpdate,this),e.on("styleChange",this.onStyleChange,this),e.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(e),this.updateStyle(e,!1),r}onStyleChange(e){this.updateStyle(e,!1)}updateStyle(e,t){const r=this._gl,i=this.getGlSource(e);r.bindTexture(i.target,i.texture),this._boundTextures[this._activeTextureLocation]=e,dg(e.style,r,e.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.target,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,t)}onSourceUnload(e,t=!1){const r=e._gpuData[this._renderer.uid];r&&(t||(this.unbind(e),this._gl.deleteTexture(r.texture)),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this))}onSourceUpdate(e){const t=this._gl,r=this.getGlSource(e);t.bindTexture(r.target,r.texture),this._boundTextures[this._activeTextureLocation]=e;const i=e.alphaMode==="premultiply-alpha-on-upload";if(this._premultiplyAlpha!==i&&(this._premultiplyAlpha=i,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i)),this._uploads[e.uploadMethodId])this._uploads[e.uploadMethodId].upload(e,r,t,this._renderer.context.webGLVersion);else if(r.target===t.TEXTURE_2D)this._initEmptyTexture2D(r,e);else if(r.target===t.TEXTURE_2D_ARRAY)this._initEmptyTexture2DArray(r,e);else if(r.target===t.TEXTURE_CUBE_MAP)this._initEmptyTextureCube(r,e);else throw new Error("[GlTextureSystem] Unsupported texture target for empty allocation.");this._applyMipRange(r,e),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,t=!0){t&&this.bindSource(e,0);const r=this.getGlSource(e);this._gl.generateMipmap(r.target)}_initEmptyTexture2D(e,t){const r=this._gl;r.texImage2D(r.TEXTURE_2D,0,e.internalFormat,t.pixelWidth,t.pixelHeight,0,e.format,e.type,null);let i=Math.max(t.pixelWidth>>1,1),s=Math.max(t.pixelHeight>>1,1);for(let o=1;o<t.mipLevelCount;o++)r.texImage2D(r.TEXTURE_2D,o,e.internalFormat,i,s,0,e.format,e.type,null),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}_initEmptyTexture2DArray(e,t){if(this._renderer.context.webGLVersion!==2)throw new Error("[GlTextureSystem] TEXTURE_2D_ARRAY requires WebGL2.");const r=this._gl,i=Math.max(t.arrayLayerCount|0,1);r.texImage3D(r.TEXTURE_2D_ARRAY,0,e.internalFormat,t.pixelWidth,t.pixelHeight,i,0,e.format,e.type,null);let s=Math.max(t.pixelWidth>>1,1),o=Math.max(t.pixelHeight>>1,1);for(let a=1;a<t.mipLevelCount;a++)r.texImage3D(r.TEXTURE_2D_ARRAY,a,e.internalFormat,s,o,i,0,e.format,e.type,null),s=Math.max(s>>1,1),o=Math.max(o>>1,1)}_initEmptyTextureCube(e,t){const r=this._gl,i=6;for(let a=0;a<i;a++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,e.internalFormat,t.pixelWidth,t.pixelHeight,0,e.format,e.type,null);let s=Math.max(t.pixelWidth>>1,1),o=Math.max(t.pixelHeight>>1,1);for(let a=1;a<t.mipLevelCount;a++){for(let l=0;l<i;l++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+l,a,e.internalFormat,s,o,0,e.format,e.type,null);s=Math.max(s>>1,1),o=Math.max(o>>1,1)}}_applyMipRange(e,t){if(this._renderer.context.webGLVersion!==2||t.mipLevelCount<=1)return;const r=this._gl,i=Math.max((t.mipLevelCount|0)-1,0);r.texParameteri(e.target,r.TEXTURE_BASE_LEVEL,0),r.texParameteri(e.target,r.TEXTURE_MAX_LEVEL,i)}_initSampler(e){const t=this._gl,r=this._gl.createSampler();return this._glSamplers[e._resourceId]=r,dg(e,t,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this._initSource(e)}generateCanvas(e){const{pixels:t,width:r,height:i}=this.getPixels(e),s=pe.get().createCanvas();s.width=r,s.height=i;const o=s.getContext("2d");if(o){const a=o.createImageData(r,i);a.data.set(t),o.putImageData(a,0,0)}return s}getPixels(e){const t=e.source.resolution,r=e.frame,i=Math.max(Math.round(r.width*t),1),s=Math.max(Math.round(r.height*t),1),o=new Uint8Array(U3*i*s),a=this._renderer,l=a.renderTarget.getRenderTarget(e),u=a.renderTarget.getGpuRenderTarget(l),c=a.gl;return a.renderTarget.adaptor.bindFramebuffer(u.resolveTargetFramebuffer),c.readPixels(Math.round(r.x*t),Math.round(r.y*t),i,s,c.RGBA,c.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:i,height:s}}destroy(){this._managedTextures.destroy(),this._glSamplers=null,this._boundTextures=null,this._boundSamplers=null,this._mapFormatToInternalFormat=null,this._mapFormatToType=null,this._mapFormatToFormat=null,this._uploads=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(Q.EMPTY.source),this._boundSamplers=Object.create(null);const e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Yf.extension={type:[k.WebGLSystem],name:"texture"};Yf.uploadExtensions=Object.create(null);let Yv=Yf;ae.handleByMap(k.TextureUploaderWebGL,Yv.uploadExtensions);class Kv{contextChange(e){const t=new xn({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new Z,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),r=e.limits.maxBatchableTextures,i=lf({name:"graphics",bits:[g1,_1(r),H1,cf]});this.shader=new er({glProgram:i,resources:{localUniforms:t,batchSamplers:x1(r)}})}execute(e,t){const r=t.context,i=r.customShader||this.shader,s=e.renderer,o=s.graphicsContext,{batcher:a,instructions:l}=o.getContextRenderData(r);i.groups[0]=s.globalUniforms.bindGroup,s.state.set(e.state),s.shader.bind(i),s.geometry.bind(a.geometry,i.glProgram);const u=l.instructions;for(let c=0;c<l.instructionSize;c++){const h=u[c];if(h.size){for(let d=0;d<h.textures.count;d++)s.texture.bind(h.textures.textures[d],d);s.geometry.draw(h.topology,h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}Kv.extension={type:[k.WebGLPipesAdaptor],name:"graphics"};class qv{init(){const e=lf({name:"mesh",bits:[H1,rk,cf]});this._shader=new er({glProgram:e,resources:{uTexture:Q.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new Z}}}})}execute(e,t){const r=e.renderer;let i=t._shader;if(i){if(!i.glProgram){se("Mesh shader has no glProgram",t.shader);return}}else{i=this._shader;const s=t.texture,o=s.source;i.resources.uTexture=o,i.resources.uSampler=o.style,i.resources.textureUniforms.uniforms.uTextureMatrix=s.textureMatrix.mapCoord}i.groups[100]=r.globalUniforms.bindGroup,i.groups[101]=e.localUniformsBindGroup,r.encoder.draw({geometry:t._geometry,shader:i,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}}qv.extension={type:[k.WebGLPipesAdaptor],name:"mesh"};const N3=[...Lf,jf,Zk,$k,Ov,Rv,Yv,zv,Bv,Xf,$f,Gv,S3,Lv,Fv],z3=[...Cv],W3=[ev,qv,Kv],Qv=[],Zv=[],Jv=[];ae.handleByNamedList(k.WebGLSystem,Qv);ae.handleByNamedList(k.WebGLPipes,Zv);ae.handleByNamedList(k.WebGLPipesAdaptor,Jv);ae.add(...N3,...z3,...W3);class H3 extends gs{constructor(){const e={name:"webgl",type:_n.WEBGL,systems:Qv,renderPipes:Zv,renderPipeAdaptors:Jv};super(e)}}const V3=Object.freeze(Object.defineProperty({__proto__:null,WebGLRenderer:H3},Symbol.toStringTag,{value:"Module"}));class eb{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){const i=`${e._key}:${t._layoutKey<<4|r}`;return this._hash[i]||this._createBindGroup(i,e,t,r)}_createBindGroup(e,t,r,i){const s=this._gpu.device,o=r.layout[i],a=[],l=this._renderer;for(const h in o){const d=t.resources[h]??t.resources[o[h]];if(!d||d.destroyed)throw new Error(`[BindGroup] the resource bound as '${h}' was destroyed while a shader still uses it. Remove it from the shader before destroying it.`);let f;if(d._resourceType==="uniformGroup"){const p=d;l.ubo.updateUniformGroup(p);const g=p.buffer;f={buffer:l.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(d._resourceType==="buffer"){const p=d;f={buffer:l.buffer.getGPUBuffer(p),offset:0,size:p.descriptor.size}}else if(d._resourceType==="bufferResource"){const p=d;f={buffer:l.buffer.getGPUBuffer(p.buffer),offset:p.offset,size:p.size??p.buffer.descriptor.size}}else if(d._resourceType==="textureSampler"){const p=d;f=l.texture.getGpuSampler(p)}else if(d._resourceType==="textureSource"){const p=d;f=l.texture.getTextureView(p)}else if(d._resourceType==="textureView"){const p=d;f=l.texture.getTextureView(p.source,p.viewDescriptor)}a.push({binding:o[h],resource:f})}const u=l.shader.getProgramData(r).bindGroups[i],c=s.createBindGroup({layout:u,entries:a});return this._hash[e]=c,c}destroy(){this._hash=null,this._renderer=null}}eb.extension={type:[k.WebGPUSystem],name:"bindGroup"};class j3{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class tb{constructor(e){this._renderer=e,this._managedBuffers=new Rn({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){var t;return e._gcLastUsed=this._renderer.gc.now,((t=e._gpuData[this._renderer.uid])==null?void 0:t.gpuBuffer)||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,e._updateOffset,r.buffer,r.byteOffset+e._updateOffset,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this)}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e.data&&(Gh(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new j3(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}tb.extension={type:[k.WebGPUSystem],name:"buffer"};class $3{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r<e.length;r++)this.data[t/4+r]=e[r];return t}destroy(){this.data=null}}class nb{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}}nb.extension={type:[k.WebGPUSystem],name:"colorMask"};class Kf{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then(t=>{this.gpu=t,this.extensions={transientAttachment:typeof GPUTextureUsage.TRANSIENT_ATTACHMENT=="number"},this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await pe.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter});if(!t)throw new Error("WebGPU not supported. No GPU adapter was returned by navigator.gpu.requestAdapter().");const r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2","indirect-first-instance"].filter(s=>t.features.has(s)),i=await t.requestDevice({requiredFeatures:r,requiredLimits:{maxSampledTexturesPerShaderStage:t.limits.maxSampledTexturesPerShaderStage,maxSamplersPerShaderStage:t.limits.maxSamplersPerShaderStage}});return{adapter:t,device:i}}destroy(){this.gpu=null,this.extensions=null,this._renderer=null}}Kf.extension={type:[k.WebGPUSystem],name:"device"};Kf.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class rb{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e;for(let t=0;t<16;t++)this._boundBindGroup[t]={bindGroup:null,program:null,key:null}}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this._passEncoder=this.commandEncoder.beginRenderPass(e.descriptor),this.renderPassEncoder=this._passEncoder}endRenderPass(){this._passEncoder&&this._passEncoder.end(),this.renderPassEncoder=null,this._passEncoder=null}beginBundle(){if(this._passEncoder!==this.renderPassEncoder)throw new Error("Cannot begin a new render bundle while one is already being recorded.");this._clearCache();const e=this._renderer.pipeline.getBundleDescriptor();this.renderPassEncoder=this._gpu.device.createRenderBundleEncoder(e)}endBundle(){const e=this.renderPassEncoder;if(!e||!("finish"in e))throw new Error("endBundle called without an active render bundle.");const t=e.finish();return this.renderPassEncoder=this._passEncoder,this._clearCache(),t}executeBundle(e){this._clearCache(),this._passEncoder.executeBundles([e])}setViewport(e){this._passEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setStencilReference(e){this._passEncoder.setStencilReference(e)}setPipelineFromGeometryProgramAndState(e,t,r,i,s){const o=this._renderer.pipeline.getPipeline(e,t,r,i,s);this.setPipeline(o)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){const t=this._boundBindGroup[e];t.bindGroup=null,t.program=null,t.key=null}setBindGroup(e,t,r){const i=this._boundBindGroup[e];if(i.bindGroup===t&&i.program===r&&i.key===t._key)return;i.bindGroup=t,i.program=r,i.key=t._key,t._touch(this._renderer.gc.now,this._renderer.tick);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const i in r)this._setVertexBuffer(parseInt(i,10),e.attributes[r[i]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){const r=e.gpuProgram;for(const i in e.groups){if(!r.layout[i])continue;const s=e.groups[i];t||this._syncBindGroup(s),this.setBindGroup(i,s,r)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r&&r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:i,topology:s,size:o,start:a,baseVertex:l,instanceCount:u,skipSync:c,firstInstance:h}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,i,s,r._overrides),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(o||t.indexBuffer.data.length,u??t.instanceCount,a||0,l||0,h||0):this.renderPassEncoder.draw(o||t.vertexCount,u??t.instanceCount,a||0,h||0)}drawIndirect(e){const{geometry:t,shader:r,state:i,topology:s,skipSync:o,indirectBuffer:a,indirectOffset:l}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,i,s,r._overrides),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,o),t.indexBuffer?this.renderPassEncoder.drawIndexedIndirect(a,l):this.renderPassEncoder.drawIndirect(a,l)}finishRenderPass(){this._passEncoder&&(this._passEncoder.end(),this.renderPassEncoder=null,this._passEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}_clearCache(){for(let e=0;e<16;e++){const t=this._boundBindGroup[e];t.bindGroup=null,t.program=null,t.key=null,this._boundVertexBuffer[e]=null}this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null,this.renderPassEncoder=null,this._passEncoder=null}contextChange(e){this._gpu=e}}rb.extension={type:[k.WebGPUSystem],name:"encoder",priority:1};class ib{constructor(e){this.supportsOverrideConstants=!1,this._renderer=e}contextChange(){const e=this._renderer.device.gpu.device;this.maxTextures=Math.min(e.limits.maxSampledTexturesPerShaderStage,e.limits.maxSamplersPerShaderStage),this.maxBatchableTextures=this.maxTextures,this._detectOverrideConstantsSupport(e)}_detectOverrideConstantsSupport(e){e.pushErrorScope("validation");const t=e.createShaderModule({code:`override TEST_VALUE: f32 = 0.0;
|
|
916
|
+
@compute @workgroup_size(1) fn main() {}`});e.createComputePipeline({layout:"auto",compute:{module:t,entryPoint:"main",constants:{TEST_VALUE:1}}}),e.popErrorScope().then(r=>{this.supportsOverrideConstants=!r})}destroy(){}}ib.extension={type:[k.WebGPUSystem],name:"limits"};class sb{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Ve.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const i=this._renderer;i.pipeline.setStencilMode(e),i.encoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}sb.extension={type:[k.WebGPUSystem],name:"stencil"};const go={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function X3(n){const e=n.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r<e.length;r++){const i=e[r];let s=go[i.data.type].size;const o=go[i.data.type].align;if(!go[i.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${i.data.type}`);i.data.size>1&&(s=Math.max(s,o)*i.data.size),t=Math.ceil(t/o)*o,i.size=s,i.offset=t,t+=s}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function Y3(n,e){const{size:t,align:r}=go[n.data.type],i=(r-t)/4,s=n.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
917
|
+
v = uv.${n.data.name};
|
|
918
|
+
${e!==0?`offset += ${e};`:""}
|
|
919
|
+
|
|
920
|
+
arrayOffset = offset;
|
|
921
|
+
|
|
922
|
+
t = 0;
|
|
923
|
+
|
|
924
|
+
for(var i=0; i < ${n.data.size*(t/4)}; i++)
|
|
925
|
+
{
|
|
926
|
+
for(var j = 0; j < ${t/4}; j++)
|
|
927
|
+
{
|
|
928
|
+
${s}[arrayOffset++] = v[t++];
|
|
929
|
+
}
|
|
930
|
+
${i!==0?`arrayOffset += ${i};`:""}
|
|
931
|
+
}
|
|
932
|
+
`}function K3(n){return Uv(n,t3,Y3)}class qf extends Hf{constructor(){super({createUboElements:X3,generateUboSync:K3})}}qf.extension={type:[k.WebGPUSystem],name:"ubo"};const sr=128;class ob{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._batchBuffer=new $3({minUniformOffsetAlignment:sr});const t=256/sr;for(let r=0;r<t;r++){let i=Te.UNIFORM|Te.COPY_DST;r===0&&(i|=Te.COPY_SRC),this._buffers.push(new Pn({data:this._batchBuffer.data,usage:i}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){this._bindGroupHash=Object.create(null),this._batchBuffer.clear()}getUniformBindGroup(e,t){if(!t&&this._bindGroupHash[e.uid])return this._bindGroupHash[e.uid];this._renderer.ubo.ensureUniformGroup(e);const r=e.buffer.data,i=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(e,this._batchBuffer.data,i/4),this._bindGroupHash[e.uid]=this._getBindGroup(i/sr),this._bindGroupHash[e.uid]}getUboResource(e){this._renderer.ubo.updateUniformGroup(e);const t=e.buffer.data,r=this._batchBuffer.addGroup(t);return this._getBufferResource(r/sr)}getArrayBindGroup(e){const t=this._batchBuffer.addGroup(e);return this._getBindGroup(t/sr)}getArrayBufferResource(e){const r=this._batchBuffer.addGroup(e)/sr;return this._getBufferResource(r)}_getBufferResource(e){if(!this._bufferResources[e]){const t=this._buffers[e%2];this._bufferResources[e]=new au({buffer:t,offset:(e/2|0)*256,size:sr})}return this._bufferResources[e]}_getBindGroup(e){if(!this._bindGroups[e]){const t=new Sr({0:this._getBufferResource(e)});this._bindGroups[e]=t}return this._bindGroups[e]}_uploadBindGroups(){const e=this._renderer.buffer,t=this._buffers[0];t.update(this._batchBuffer.byteIndex),e.updateBuffer(t);const r=this._renderer.gpu.device.createCommandEncoder();for(let i=1;i<this._buffers.length;i++){const s=this._buffers[i];r.copyBufferToBuffer(e.getGPUBuffer(t),sr,e.getGPUBuffer(s),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){var e;for(let t=0;t<this._bindGroups.length;t++)(e=this._bindGroups[t])==null||e.destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._renderer=null}}ob.extension={type:[k.WebGPUPipes],name:"uniformBatch"};const fg={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4},q3=new Fo({}),Q3={"depth24plus-stencil8":{depth:!0,stencil:!0,index:1},depth24plus:{depth:!0,stencil:!1,index:2},depth32float:{depth:!0,stencil:!1,index:3},"depth32float-stencil8":{depth:!0,stencil:!0,index:4},depth16unorm:{depth:!0,stencil:!1,index:5},stencil8:{depth:!1,stencil:!0,index:6}},pg={depth:!1,stencil:!1,index:0};function mg(n,e){for(const[t,r]of Object.entries(e)){const i=new RegExp(`override\\s+${t}\\s*:\\s*(\\w+)\\s*(?:=[^;]*)?;`);n=n.replace(i,(s,o)=>{let a;return o==="u32"?a=`${Math.trunc(r)}u`:o==="i32"?a=`${Math.trunc(r)}`:a=Number.isInteger(r)?`${r}.0`:`${r}`,`const ${t}: ${o} = ${a};`})}return n}function gg(n,e,t,r,i,s){return n*35184372088832+e*536870912+s*16384+(t<<8)+(r<<3)+i}const yg=Object.create(null);let Z3=0;function _g(n){let e=yg[n];return e===void 0&&(e=yg[n]=Z3++),e}function J3(n,e,t,r,i,s,o,a){return a<<20|s<<16|i<<13|t<<9|n<<6|o<<5|r<<1|e}class ab{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=new Map,this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._colorTargetCount=1,this._colorFormat="bgra8unorm",this._colorFormatId=_g("bgra8unorm"),this._depthStencilFormat="depth24plus-stencil8",this._depthStencilFormatData=pg,this._depthReadOnly=!1,this._invertFrontFace=!1,this._renderer=e}contextChange(e){this._gpu=e,this.setStencilMode(Ve.DISABLED),this._updatePipeHash()}setMultisampleCount(e){this._multisampleCount!==e&&(this._multisampleCount=e,this._updatePipeHash())}setRenderTarget(e){var r,i,s;const t=(r=e.colorAttachments[0])==null?void 0:r.texture;this._multisampleCount=t!=null&&t.source.antialias?4:1,this._colorTargetCount=e.colorAttachments.length,this._colorFormat=(t==null?void 0:t.format)??"bgra8unorm",this._colorFormatId=_g(this._colorFormat),this._depthStencilFormat=(i=e.depthStencilAttachment)==null?void 0:i.texture.format,this._depthStencilFormatData=Q3[this._depthStencilFormat]||pg,this._depthReadOnly=((s=e.depthStencilAttachment)==null?void 0:s.depthReadOnly)??!1,this._invertFrontFace=!!e.flipY,this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=Pr[e],this._updatePipeHash())}getBundleDescriptor(){const e=[];for(let r=0;r<this._colorTargetCount;r++)e.push(this._colorFormat);const t={colorFormats:e,sampleCount:this._multisampleCount};return(this._depthStencilFormatData.depth||this._depthStencilFormatData.stencil)&&(t.depthStencilFormat=this._depthStencilFormat),t}setPipeline(e,t,r,i){const s=this.getPipeline(e,t,r);i.setPipeline(s)}getPipelineKey(e,t,r,i,s){return e._layoutKey||($h(e,t.attributeData),this._generateBufferKey(e)),gg(e._layoutKey,t._layoutKey,r.data,r._blendModeId,fg[i],s.id)}getPipeline(e,t,r,i,s){e._layoutKey||($h(e,t.attributeData),this._generateBufferKey(e)),i||(i=e.topology),s||(s=q3);const o=gg(e._layoutKey,t._layoutKey,r.data,r._blendModeId,fg[i],s.id);let a=this._pipeCache.get(o);return a||(a=this._createPipeline(e,t,r,i,s),this._pipeCache.set(o,a)),a}_createPipeline(e,t,r,i,s){const o=this._gpu.device,a=this._createVertexBufferLayouts(e,t),l=this._renderer.state.getColorTargets(r,this._colorTargetCount,this._colorFormat),u=this._stencilMode===Ve.RENDERING_MASK_ADD?0:this._colorMask;for(let m=0;m<l.length;m++)l[m].writeMask=u;const c=this._renderer.shader.getProgramData(t).pipeline,h=Object.keys(s.data).length>0;let d=t.vertex.source,f=t.fragment.source,p;h&&(this._renderer.limits.supportsOverrideConstants?p=s.data:(d=mg(d,s.data),f=mg(f,s.data)));const g={vertex:{module:this._getModule(d),entryPoint:t.vertex.entryPoint,constants:p,buffers:a},fragment:{module:this._getModule(f),entryPoint:t.fragment.entryPoint,targets:l,constants:p},primitive:{topology:i,cullMode:r.culling?"back":"none",frontFace:r.clockwiseFrontFace!==this._invertFrontFace?"cw":"ccw"},layout:c,multisample:{count:this._multisampleCount},label:t.name?`PIXI Pipeline (${t.name})`:"PIXI Pipeline"};if(this._depthStencilFormatData.depth||this._depthStencilFormatData.stencil){const m=this._depthStencilFormatData;g.depthStencil={...this._stencilState,format:this._depthStencilFormat,depthWriteEnabled:m.depth?r.depthMask&&!this._depthReadOnly:!1,depthCompare:m.depth&&r.depthTest?"less":"always"}}return o.createRenderPipeline(g)}_getModule(e){return this._moduleCache[e]||this._createModule(e)}_createModule(e){const t=this._gpu.device;return this._moduleCache[e]=t.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){const t=[];let r=0;const i=Object.keys(e.attributes).sort();for(let o=0;o<i.length;o++){const a=e.attributes[i[o]];t[r++]=a.offset,t[r++]=a.format,t[r++]=a.stride,t[r++]=a.instance}const s=t.join("|");return e._layoutKey=ls(s,"geometry"),e._layoutKey}_generateAttributeLocationsKey(e){const t=[];let r=0;const i=Object.keys(e.attributeData).sort();for(let o=0;o<i.length;o++){const a=e.attributeData[i[o]];t[r++]=a.location}const s=t.join("|");return e._attributeLocationsKey=ls(s,"programAttributes"),e._attributeLocationsKey}getBufferNamesToBind(e,t){const r=e._layoutKey<<16|t._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];const i=this._createVertexBufferLayouts(e,t),s=Object.create(null),o=t.attributeData;for(let a=0;a<i.length;a++){const u=Object.values(i[a].attributes)[0].shaderLocation;for(const c in o)if(o[c].location===u){s[a]=c;break}}return this._bindingNamesCache[r]=s,s}_createVertexBufferLayouts(e,t){t._attributeLocationsKey||this._generateAttributeLocationsKey(t);const r=e._layoutKey<<16|t._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];const i=[];return e.buffers.forEach(s=>{const o={arrayStride:0,stepMode:"vertex",attributes:[]},a=o.attributes;for(const l in t.attributeData){const u=e.attributes[l];(u.divisor??1)!==1&&se(`Attribute ${l} has an invalid divisor value of '${u.divisor}'. WebGPU only supports a divisor value of 1`),u.buffer===s&&(o.arrayStride=u.stride,o.stepMode=u.instance?"instance":"vertex",a.push({shaderLocation:t.attributeData[l].location,offset:u.offset,format:u.format}))}a.length&&i.push(o)}),this._bufferLayoutsCache[r]=i,i}_updatePipeHash(){var e;const t=J3(this._stencilMode,this._multisampleCount===1?0:1,this._colorMask,this._colorTargetCount,this._depthStencilFormatData.index,this._colorFormatId,this._depthReadOnly?1:0,this._invertFrontFace?1:0);this._pipeCache=(e=this._pipeStateCaches)[t]??(e[t]=new Map)}destroy(){this._bufferLayoutsCache=null,this._pipeCache=null,this._gpu=null,this._renderer=null,this._bindingNamesCache=null,this._pipeStateCaches=null,this._moduleCache=null}}ab.extension={type:[k.WebGPUSystem],name:"pipeline"};class eP{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}const tP={bgra8unorm:!0,rgba8unorm:!0,rgba16float:!0};function nP(n){if(tP[n])return n;const e=navigator.gpu.getPreferredCanvasFormat();return se(`[WebGPU] CanvasSource format '${n}' is not a valid GPUCanvasContext format. Falling back to '${e}'. Allowed formats are: bgra8unorm, rgba8unorm, rgba16float.`),e}class rP{constructor(){this._activePass=null}init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,r,i,s){const o=this._renderer;this.finishRenderPass();const a=this._getGpuColorTexture(e),l=o.texture.getGpuSource(t.source);return o.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:l,origin:s},i),t}copyDepthTexture(e,t,r,i,s){const o=this._renderer;this.finishRenderPass();const a=e.depthStencilAttachment.texture,l=o.texture.getGpuSource(a),u=o.texture.getGpuSource(t.source),c=o.encoder.commandEncoder===null,h=c?o.gpu.device.createCommandEncoder():o.encoder.commandEncoder;h.copyTextureToTexture({texture:l,origin:r},{texture:u,origin:s},{width:i.width,height:i.height}),c&&o.gpu.device.queue.submit([h.finish()])}startRenderPass(e,t=!0,r,i,s=0,o=0){var p,g;const l=this._renderTargetSystem.getGpuRenderTarget(e);if(o!==0&&((p=l.msaaTextures)!=null&&p.length))throw new Error("[RenderTargetSystem] Rendering to array layers is not supported with MSAA render targets.");if(s>0&&((g=l.msaaTextures)!=null&&g.length))throw new Error("[RenderTargetSystem] Rendering to mip levels is not supported with MSAA render targets.");let u=t;typeof u=="boolean"&&(u=u?et.ALL:et.NONE),(e.stencil||e.depth)&&!e.depthStencilAttachment&&e.ensureDepthStencilTexture();const c=!!e.depthStencilAttachment,h=this._activePass;if(h!==null&&h.renderTarget===e&&h.mipLevel===s&&h.layer===o&&h.depthStencil===c&&this._renderer.encoder.renderPassEncoder!==null&&u===et.NONE){this._renderer.encoder.setViewport(i);return}const f=this.getDescriptor(e,t,r,s,o);l.descriptor=f,this._renderer.pipeline.setRenderTarget(e),this._renderer.encoder.beginRenderPass(l),this._renderer.encoder.setViewport(i),this._activePass={renderTarget:e,mipLevel:s,layer:o,depthStencil:c}}finishRenderPass(){this._renderer.encoder.endRenderPass(),this._activePass=null}_getGpuColorTexture(e){if(e.colorAttachments.length===0)throw new Error("[GpuRenderTargetAdaptor] cannot get gpu color texture from a depth-only render target");const t=e.colorAttachments[0].texture;return t instanceof tn&&t._gpuContext?t._gpuContext.getCurrentTexture():this._renderer.texture.getGpuSource(t)}getDescriptor(e,t,r,i=0,s=0){var h;typeof t=="boolean"&&(t=t?et.ALL:et.NONE);const o=this._renderTargetSystem,a=o.getGpuRenderTarget(e),l=e.colorAttachments.map((d,f)=>{const p=d.texture,g=p instanceof tn?p._gpuContext:null;let _,m;if(g){if(s!==0)throw new Error("[RenderTargetSystem] Rendering to array layers is not supported for canvas targets.");_=g.getCurrentTexture().createView(d.viewDescriptor)}else _=this._renderer.texture.getTextureRenderTargetView(d.texture,i,s,d.viewDescriptor);let y=!1;a.msaaTextures[f]&&(m=_,_=this._renderer.texture.getTextureView(a.msaaTextures[f]),y=a.msaaTextures[f].transient);let x=d.loadOp;t!==void 0&&(x=t&et.COLOR?"clear":"load"),r??(r=o.defaultClearColor);const b=d.storeOp??"store",S={view:_,resolveTarget:m,storeOp:y?"discard":b,loadOp:x};x==="clear"&&(r??(r=d.clearValue??o.defaultClearColor),S.clearValue=r);for(const T in d)T!=="texture"&&T!=="viewDescriptor"&&T!=="clearValue"&&T!=="loadOp"&&T!=="storeOp"&&(S[T]=d[T]);return S});let u;if(e.depthStencilAttachment){a.msaa&&(e.depthStencilAttachment.texture.sampleCount=4),e.depthStencilAttachment.texture.transient=!!((h=a.msaaTextures[0])!=null&&h.transient);const d=e.depthStencilAttachment,f=d.texture.format.includes("stencil"),p=d.texture.format.includes("depth"),g=d.texture.transient?"discard":"store";u={view:this._renderer.texture.getTextureRenderTargetView(d.texture,i,s,d.viewDescriptor)};const _=d.depthReadOnly??!1,m=d.stencilReadOnly??_;f&&!m?(u.stencilLoadOp=t&et.STENCIL?"clear":d.stencilLoadOp??"load",u.stencilStoreOp=d.stencilStoreOp??g,u.stencilLoadOp==="clear"&&(u.stencilClearValue=d.stencilClearValue??0)):f&&m&&(u.stencilReadOnly=!0),p&&!_?(u.depthLoadOp=t&et.DEPTH?"clear":d.depthLoadOp??"load",u.depthStoreOp=d.depthStoreOp??g,u.depthLoadOp==="clear"&&(u.depthClearValue=d.depthClearValue??1)):p&&_&&(u.depthReadOnly=!0);for(const y in d)y!=="texture"&&y!=="viewDescriptor"&&y!=="stencilLoadOp"&&y!=="stencilStoreOp"&&y!=="stencilClearValue"&&y!=="stencilReadOnly"&&y!=="depthLoadOp"&&y!=="depthStoreOp"&&y!=="depthClearValue"&&y!=="depthReadOnly"&&(u[y]=d[y])}return{colorAttachments:l,depthStencilAttachment:u,label:e.label}}clear(e,t=!0,r,i,s=0,o=0){if(!t)return;const{gpu:a,encoder:l}=this._renderer,u=a.device;if(l.commandEncoder===null){const h=u.createCommandEncoder(),d=this.getDescriptor(e,t,r,s,o),f=h.beginRenderPass(d);f.setViewport(i.x,i.y,i.width,i.height,0,1),f.end();const p=h.finish();u.queue.submit([p])}else this.startRenderPass(e,t,r,i,s,o)}initGpuRenderTarget(e){var r;e.isRoot=!0;const t=new eP;return e.colorAttachments.forEach((i,s)=>{const o=i.texture;if(o instanceof tn){if(!o._gpuContext){const a=o.resource.getContext("webgpu"),l=o.transparent?"premultiplied":"opaque",u=nP(o.format);try{a.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:u,alphaMode:l,...u==="rgba16float"?{toneMapping:{mode:"extended"}}:{}})}catch(c){console.error(c)}o._gpuContext=a}t.contexts[s]=o._gpuContext}if(t.msaa=o.source.antialias,o.antialias){const a=new $e({width:0,height:0,sampleCount:4,transient:o.transient,arrayLayerCount:o.arrayLayerCount,format:o.format});t.msaaTextures[s]=a}}),t.msaa&&(t.msaaSamples=4,e.depthStencilAttachment&&(e.depthStencilAttachment.texture.sampleCount=4,e.depthStencilAttachment.texture.transient=!!((r=t.msaaTextures[0])!=null&&r.transient))),t}destroyGpuRenderTarget(e){e.contexts.forEach(t=>{t.unconfigure()}),e.msaaTextures.forEach(t=>{t.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilAttachment&&t.msaa&&(e.depthStencilAttachment.texture.sampleCount=4)}resizeGpuRenderTarget(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorAttachments.forEach((r,i)=>{const s=r.texture,o=t.msaaTextures[i];o==null||o.resize(s.width,s.height,s._resolution)})}}class lb extends Uf{constructor(e){super(e),this.adaptor=new rP,this.adaptor.init(e,this)}}lb.extension={type:[k.WebGPUSystem],name:"renderTarget"};class ub{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){const t=this._gpu.device,r=e.gpuLayout.map(s=>t.createBindGroupLayout({entries:s})),i={bindGroupLayouts:r};return this._gpuProgramData[e._layoutKey]={bindGroups:r,pipeline:t.createPipelineLayout(i)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}ub.extension={type:[k.WebGPUSystem],name:"shader"};const Gt={};Gt.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Gt.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Gt.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Gt.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Gt.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Gt.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Gt["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Gt["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Gt["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Gt.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Gt.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Gt.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}};class cb{constructor(){this.defaultState=new tr,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e,t,r){const i=e.blend?Gt[e.blendMode]||Gt.normal:void 0,s=[];for(let o=0;o<t;o++)s[o]={format:r,writeMask:0,blend:i};return s}destroy(){this.gpu=null}}cb.extension={type:[k.WebGPUSystem],name:"state"};const iP={type:"image",upload(n,e,t,r=0){const i=n.resource,s=(n.pixelWidth|0)*(n.pixelHeight|0),o=i.byteLength/s;t.device.queue.writeTexture({texture:e,origin:{x:0,y:0,z:r}},i,{offset:0,rowsPerImage:n.pixelHeight,bytesPerRow:n.pixelWidth*o},{width:n.pixelWidth,height:n.pixelHeight,depthOrArrayLayers:1})}},hb={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},sP={blockBytes:4,blockWidth:1,blockHeight:1},oP={type:"compressed",upload(n,e,t,r=0){let i=n.pixelWidth,s=n.pixelHeight;const o=hb[n.format]||sP;for(let a=0;a<n.resource.length;a++){const l=n.resource[a],u=Math.ceil(i/o.blockWidth)*o.blockBytes;t.device.queue.writeTexture({texture:e,mipLevel:a,origin:{x:0,y:0,z:r}},l,{offset:0,bytesPerRow:u},{width:Math.ceil(i/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}},xg=["right","left","top","bottom","front","back"];function aP(n){return{type:"cube",upload(e,t,r){const i=e.faces;for(let s=0;s<xg.length;s++){const o=xg[s],a=i[o];(n[a.uploadMethodId]||n.image).upload(a,t,r,s)}}}}const db={type:"image",upload(n,e,t,r=0){const i=n.resource;if(!i)return;if(globalThis.HTMLImageElement&&i instanceof HTMLImageElement){const l=pe.get().createCanvas(i.width,i.height);l.getContext("2d").drawImage(i,0,0,i.width,i.height),n.resource=l,se("ImageSource: Image element passed, converting to canvas and replacing resource.")}const s=Math.min(e.width,n.resourceWidth||n.pixelWidth),o=Math.min(e.height,n.resourceHeight||n.pixelHeight),a=n.alphaMode==="premultiply-alpha-on-upload";t.device.queue.copyExternalImageToTexture({source:i},{texture:e,origin:{x:0,y:0,z:r},premultipliedAlpha:a},{width:s,height:o})}},lP={type:"video",upload(n,e,t,r){db.upload(n,e,t,r)}};class uP{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
933
|
+
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
934
|
+
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
935
|
+
|
|
936
|
+
struct VertexOutput {
|
|
937
|
+
@builtin(position) position : vec4<f32>,
|
|
938
|
+
@location(0) texCoord : vec2<f32>,
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
@vertex
|
|
942
|
+
fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
|
|
943
|
+
var output : VertexOutput;
|
|
944
|
+
output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
|
|
945
|
+
output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
|
|
946
|
+
return output;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
@group(0) @binding(0) var imgSampler : sampler;
|
|
950
|
+
@group(0) @binding(1) var img : texture_2d<f32>;
|
|
951
|
+
|
|
952
|
+
@fragment
|
|
953
|
+
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
954
|
+
return textureSample(img, imgSampler, texCoord);
|
|
955
|
+
}
|
|
956
|
+
`})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){const t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=e;const i=e.depthOrArrayLayers||1,s=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!s){const l={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:i},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};r=this.device.createTexture(l)}const o=this.device.createCommandEncoder({}),a=t.getBindGroupLayout(0);for(let l=0;l<i;++l){let u=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),c=s?1:0;for(let h=1;h<e.mipLevelCount;++h){const d=r.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),f=o.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),p=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:u}]});f.setPipeline(t),f.setBindGroup(0,p),f.draw(3,1,0,0),f.end(),u=d}}if(!s){const l={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:i};for(let u=1;u<e.mipLevelCount;++u)o.copyTextureToTexture({texture:r,mipLevel:u-1},{texture:e,mipLevel:u},l),l.width=Math.ceil(l.width/2),l.height=Math.ceil(l.height/2)}return this.device.queue.submit([o.finish()]),s||r.destroy(),e}}class cP{constructor(e){this.textureView=null,this.textureViews=Object.create(null),this.gpuTexture=e}destroy(){this.gpuTexture.destroy(),this.textureView=null,this.textureViews=null,this.gpuTexture=null}}function vg(n){return`${n.format||""}.${n.dimension||""}.${n.aspect||""}.${n.baseMipLevel||0}.${n.mipLevelCount||""}.${n.baseArrayLayer||0}.${n.arrayLayerCount||""}`}const Qf=class fb{constructor(e){this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._renderer=e,e.gc.addCollection(this,"_bindGroupHash","hash"),this._managedTextures=new Rn({renderer:e,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"gpuTextureSource"});const t={image:db,buffer:iP,video:lP,compressed:oP,...fb.uploadExtensions};this._uploads={...t,cube:aP(t)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gpu=e}initSource(e){var t;return((t=e._gpuData[this._renderer.uid])==null?void 0:t.gpuTexture)||this._initSource(e)}_initSource(e){if(e.autoGenerateMipmaps){const u=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(u))+1}let t;e.sampleCount>1?(t=GPUTextureUsage.RENDER_ATTACHMENT,e.transient&&this._renderer.device.extensions.transientAttachment&&(t|=GPUTextureUsage.TRANSIENT_ATTACHMENT)):(t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,e.uploadMethodId!=="compressed"&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC));const r=hb[e.format]||{blockWidth:1,blockHeight:1},i=Math.ceil(e.pixelWidth/r.blockWidth)*r.blockWidth,s=Math.ceil(e.pixelHeight/r.blockHeight)*r.blockHeight,o={label:e.label,size:{width:i,height:s,depthOrArrayLayers:e.arrayLayerCount},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},a=this._gpu.device.createTexture(o);return e._gpuData[this._renderer.uid]=new cP(a),this._managedTextures.add(e)&&(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,this),e.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(e),a}onSourceUpdate(e){const t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new uP(this._gpu.device));const t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceUnload(e){e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this)}onSourceResize(e){e._gcLastUsed=this._renderer.gc.now;const t=e._gpuData[this._renderer.uid],r=t==null?void 0:t.gpuTexture;r?(r.width!==e.pixelWidth||r.height!==e.pixelHeight)&&(t.destroy(),this._bindGroupHash[e.uid]=null,e._gpuData[this._renderer.uid]=null,this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){var t;return e._gcLastUsed=this._renderer.gc.now,((t=e._gpuData[this._renderer.uid])==null?void 0:t.gpuTexture)||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]||this._createTextureBindGroup(e)}_createTextureBindGroup(e){const t=e.source;return this._bindGroupHash[e.uid]=new Sr({0:t,1:t.style,2:new xn({uTextureMatrix:{type:"mat3x3<f32>",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e,t){var r;const i=e.source;i._gcLastUsed=this._renderer.gc.now;let s=i._gpuData[this._renderer.uid];s||(this.initSource(i),s=i._gpuData[this._renderer.uid]);const o=t?vg(t):0;return(r=s.textureViews)[o]||(r[o]=s.gpuTexture.createView({dimension:i.viewDimension,...t})),s.textureViews[o]}getTextureRenderTargetView(e,t=0,r=0,i){var s;const o=e.source;o._gcLastUsed=this._renderer.gc.now;let a=o._gpuData[this._renderer.uid];a||(this.initSource(o),a=o._gpuData[this._renderer.uid]);let l=r*(o.mipLevelCount||1)+t+1;return i&&(l=`${l}.${vg(i)}`),(s=a.textureViews)[l]||(s[l]=a.gpuTexture.createView({dimension:"2d",baseMipLevel:t,mipLevelCount:1,baseArrayLayer:r,arrayLayerCount:1,...i})),a.textureViews[l]}generateCanvas(e){const t=this._renderer,r=t.gpu.device.createCommandEncoder(),i=pe.get().createCanvas();i.width=e.source.pixelWidth,i.height=e.source.pixelHeight;const s=i.getContext("webgpu");return s.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:pe.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:s.getCurrentTexture()},{width:i.width,height:i.height}),t.gpu.device.queue.submit([r.finish()]),i}getPixels(e){const t=this.generateCanvas(e),r=cs.getOptimalCanvasAndContext(t.width,t.height),i=r.context;i.drawImage(t,0,0);const{width:s,height:o}=t,a=i.getImageData(0,0,s,o),l=new Uint8ClampedArray(a.data.buffer);return cs.returnCanvasAndContext(r),{pixels:l,width:s,height:o}}destroy(){this._managedTextures.destroy();for(const e of Object.keys(this._bindGroupHash)){const t=Number(e),r=this._bindGroupHash[t];r==null||r.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}};Qf.extension={type:[k.WebGPUSystem],name:"texture"};Qf.uploadExtensions=Object.create(null);let pb=Qf;ae.handleByMap(k.TextureUploaderWebGPU,pb.uploadExtensions);class mb{constructor(){this._maxTextures=0}contextChange(e){const t=new xn({uTransformMatrix:{value:new Z,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}});this._maxTextures=e.limits.maxBatchableTextures;const r=af({name:"graphics",bits:[m1,y1(this._maxTextures),SA,uf]});this.shader=new er({gpuProgram:r,resources:{localUniforms:t}})}execute(e,t){const r=t.context,i=r.customShader||this.shader,s=e.renderer,o=s.graphicsContext,{batcher:a,instructions:l}=o.getContextRenderData(r),u=s.encoder;u.setGeometry(a.geometry,i.gpuProgram);const c=s.globalUniforms.bindGroup;u.setBindGroup(0,c,i.gpuProgram);const h=s.renderPipes.uniformBatch.getUniformBindGroup(i.resources.localUniforms,!0);u.setBindGroup(2,h,i.gpuProgram);const d=l.instructions;let f=null;for(let p=0;p<l.instructionSize;p++){const g=d[p];if(g.topology!==f&&(f=g.topology,u.setPipelineFromGeometryProgramAndState(a.geometry,i.gpuProgram,e.state,g.topology,i._overrides)),i.groups[1]=g.bindGroup,!g.gpuBindGroup){const _=g.textures;g.bindGroup=of(_.textures,_.count,this._maxTextures),g.gpuBindGroup=s.bindGroup.getBindGroup(g.bindGroup,i.gpuProgram,1)}u.setBindGroup(1,g.bindGroup,i.gpuProgram),u.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}mb.extension={type:[k.WebGPUPipesAdaptor],name:"graphics"};class gb{init(){const e=af({name:"mesh",bits:[Za,nk,uf]});this._shader=new er({gpuProgram:e,resources:{uTexture:Q.EMPTY._source,uSampler:Q.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new Z}}}})}execute(e,t){const r=e.renderer;let i=t._shader;if(!i)i=this._shader,i.groups[2]=r.texture.getTextureBindGroup(t.texture);else if(!i.gpuProgram){se("Mesh shader has no gpuProgram",t.shader);return}const s=i.gpuProgram;if(s.autoAssignGlobalUniforms&&(i.groups[0]=r.globalUniforms.bindGroup),s.autoAssignLocalUniforms){const o=e.localUniforms;i.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(o,!0)}r.encoder.draw({geometry:t._geometry,shader:i,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}}gb.extension={type:[k.WebGPUPipesAdaptor],name:"mesh"};const hP=[...Lf,qf,rb,Kf,ib,tb,pb,lb,ub,cb,ab,nb,sb,eb],dP=[...Cv,ob],fP=[tv,gb,mb],yb=[],_b=[],xb=[];ae.handleByNamedList(k.WebGPUSystem,yb);ae.handleByNamedList(k.WebGPUPipes,_b);ae.handleByNamedList(k.WebGPUPipesAdaptor,xb);ae.add(...hP,...dP,...fP);class pP extends gs{constructor(){const e={name:"webgpu",type:_n.WEBGPU,systems:yb,renderPipes:_b,renderPipeAdaptors:xb};super(e)}}const mP=Object.freeze(Object.defineProperty({__proto__:null,WebGPURenderer:pP},Symbol.toStringTag,{value:"Module"}));function bg(n,e=null){const t=n*6;if(t>65535?e||(e=new Uint32Array(t)):e||(e=new Uint16Array(t)),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let r=0,i=0;r<t;r+=6,i+=4)e[r+0]=i+0,e[r+1]=i+1,e[r+2]=i+2,e[r+3]=i+0,e[r+4]=i+2,e[r+5]=i+3;return e}function gP(n){return{dynamicUpdate:wg(n,!0),staticUpdate:wg(n,!1)}}function wg(n,e){const t=[];t.push(`
|
|
957
|
+
|
|
958
|
+
var index = 0;
|
|
959
|
+
|
|
960
|
+
for (let i = 0; i < ps.length; ++i)
|
|
961
|
+
{
|
|
962
|
+
const p = ps[i];
|
|
963
|
+
|
|
964
|
+
`);let r=0;for(const s in n){const o=n[s];if(e!==o.dynamic)continue;t.push(`offset = index + ${r}`),t.push(o.code);const a=Qn(o.format);r+=a.stride/4}t.push(`
|
|
965
|
+
index += stride * 4;
|
|
966
|
+
}
|
|
967
|
+
`),t.unshift(`
|
|
968
|
+
var stride = ${r};
|
|
969
|
+
`);const i=t.join(`
|
|
970
|
+
`);return new Function("ps","f32v","u32v",i)}class yP{constructor(e){this._size=0,this._generateParticleUpdateCache={};const t=this._size=e.size??1e3,r=e.properties;let i=0,s=0;for(const c in r){const h=r[c],d=Qn(h.format);h.dynamic?s+=d.stride:i+=d.stride}this._dynamicStride=s/4,this._staticStride=i/4,this.staticAttributeBuffer=new Hi(t*4*i),this.dynamicAttributeBuffer=new Hi(t*4*s),this.indexBuffer=bg(t);const o=new ou;let a=0,l=0;this._staticBuffer=new Pn({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:Te.VERTEX|Te.COPY_DST}),this._dynamicBuffer=new Pn({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:Te.VERTEX|Te.COPY_DST});for(const c in r){const h=r[c],d=Qn(h.format);h.dynamic?(o.addAttribute(h.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:h.format}),a+=d.size):(o.addAttribute(h.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:l*4,format:h.format}),l+=d.size)}o.addIndex(this.indexBuffer);const u=this.getParticleUpdate(r);this._dynamicUpload=u.dynamicUpdate,this._staticUpload=u.staticUpdate,this.geometry=o}getParticleUpdate(e){const t=_P(e);return this._generateParticleUpdateCache[t]?this._generateParticleUpdateCache[t]:(this._generateParticleUpdateCache[t]=this.generateParticleUpdate(e),this._generateParticleUpdateCache[t])}generateParticleUpdate(e){return gP(e)}update(e,t){e.length>this._size&&(t=!0,this._size=Math.max(e.length,this._size*1.5|0),this.staticAttributeBuffer=new Hi(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Hi(this._size*this._dynamicStride*4*4),this.indexBuffer=bg(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));const r=this.dynamicAttributeBuffer;if(this._dynamicUpload(e,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,e.length*this._dynamicStride*4,!0),t){const i=this.staticAttributeBuffer;this._staticUpload(e,i.float32View,i.uint32View),this._staticBuffer.setDataWithSize(i.float32View,e.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}function _P(n){const e=[];for(const t in n){const r=n[t];e.push(t,r.code,r.dynamic?"d":"s")}return e.join("_")}ae.add(v2,b2);const xP={aVertex:(n,e,t,r,i)=>{let s=0,o=0,a=0,l=0;for(let u=0;u<n.length;++u){const c=n[u],h=c.texture,d=c.scaleX,f=c.scaleY,p=c.anchorX,g=c.anchorY,_=h.trim,m=h.orig;_?(o=_.x-p*m.width,s=o+_.width,l=_.y-g*m.height,a=l+_.height):(s=m.width*(1-p),o=m.width*-p,a=m.height*(1-g),l=m.height*-g),e[r]=o*d,e[r+1]=l*f,e[r+i]=s*d,e[r+i+1]=l*f,e[r+i*2]=s*d,e[r+i*2+1]=a*f,e[r+i*3]=o*d,e[r+i*3+1]=a*f,r+=i*4}},aPosition:(n,e,t,r,i)=>{for(let s=0;s<n.length;++s){const o=n[s],a=o.x,l=o.y;e[r]=a,e[r+1]=l,e[r+i]=a,e[r+i+1]=l,e[r+i*2]=a,e[r+i*2+1]=l,e[r+i*3]=a,e[r+i*3+1]=l,r+=i*4}},aRotation:(n,e,t,r,i)=>{for(let s=0;s<n.length;++s){const o=n[s].rotation;e[r]=o,e[r+i]=o,e[r+i*2]=o,e[r+i*3]=o,r+=i*4}},aUV:(n,e,t,r,i)=>{for(let s=0;s<n.length;++s){const o=n[s].texture.uvs;e[r]=o.x0,e[r+1]=o.y0,e[r+i]=o.x1,e[r+i+1]=o.y1,e[r+i*2]=o.x2,e[r+i*2+1]=o.y2,e[r+i*3]=o.x3,e[r+i*3+1]=o.y3,r+=i*4}},aColor:(n,e,t,r,i)=>{for(let s=0;s<n.length;++s){const o=n[s].color;t[r]=o,t[r+i]=o,t[r+i*2]=o,t[r+i*3]=o,r+=i*4}}};function vP(n){const e=Object.values(n),t=e.filter(i=>i.dynamic),r=e.filter(i=>!i.dynamic);return{dynamicUpdate:Sg(t),staticUpdate:Sg(r)}}function Sg(n){let e=0;const t=[];for(let r=0;r<n.length;r++){const i=n[r],s=Qn(i.format).stride/4;e+=s,t.push({stride:s,updateFunction:i.updateFunction||xP[i.attributeName]})}return(r,i,s)=>{let o=0;for(let a=0;a<t.length;a++){const l=t[a];l.updateFunction(r,i,s,o,e),o+=l.stride}}}function bP(){return wP}function wP(n,e,t){const r=n.gl,i=n.shader,s=i._getProgramData(e.glProgram);for(const o in e.groups){const a=e.groups[o];for(const l in a.resources){const u=a.resources[l];if(u instanceof xn)u.ubo?i.bindUniformBlock(u,e._uniformBindMap[o][l],t.blockIndex++):i.updateUniformGroup(u);else if(u instanceof au)i.bindUniformBlock(u,e._uniformBindMap[o][l],t.blockIndex++);else if(u instanceof $e||u instanceof Wv){n.texture.bind(u,t.textureCount);const c=e._uniformBindMap[o][l],h=s.uniformData[c];h&&(h.value!==t.textureCount&&r.uniform1i(h.location,t.textureCount),t.textureCount++)}}}}const SP=[(n,e,t,r,i)=>{const s=r[n].toArray(!0);e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+4]=s[3],e[t+5]=s[4],e[t+6]=s[5],e[t+8]=s[6],e[t+9]=s[7],e[t+10]=s[8]},(n,e,t,r,i)=>{i=r[n],e[t]=i.x,e[t+1]=i.y,e[t+2]=i.width,e[t+3]=i.height},(n,e,t,r,i)=>{i=r[n],e[t]=i.x,e[t+1]=i.y},(n,e,t,r,i)=>{i=r[n],e[t]=i.red,e[t+1]=i.green,e[t+2]=i.blue,e[t+3]=i.alpha},(n,e,t,r,i)=>{i=r[n],e[t]=i.red,e[t+1]=i.green,e[t+2]=i.blue}],TP={f32:(n,e,t,r,i)=>{e[t]=i},i32:(n,e,t,r,i)=>{e[t]=i},"vec2<f32>":(n,e,t,r,i)=>{e[t]=i[0],e[t+1]=i[1]},"vec3<f32>":(n,e,t,r,i)=>{e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2]},"vec4<f32>":(n,e,t,r,i)=>{e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3]},"mat2x2<f32>":(n,e,t,r,i)=>{e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3]},"mat3x3<f32>":(n,e,t,r,i)=>{e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+4]=i[3],e[t+5]=i[4],e[t+6]=i[5],e[t+8]=i[6],e[t+9]=i[7],e[t+10]=i[8]},"mat4x4<f32>":(n,e,t,r,i)=>{for(let s=0;s<16;s++)e[t+s]=i[s]},"mat3x2<f32>":(n,e,t,r,i)=>{for(let s=0;s<6;s++)e[t+(s/3|0)*4+s%3]=i[s]},"mat4x2<f32>":(n,e,t,r,i)=>{for(let s=0;s<8;s++)e[t+(s/4|0)*4+s%4]=i[s]},"mat2x3<f32>":(n,e,t,r,i)=>{for(let s=0;s<6;s++)e[t+(s/2|0)*4+s%2]=i[s]},"mat4x3<f32>":(n,e,t,r,i)=>{for(let s=0;s<12;s++)e[t+(s/4|0)*4+s%4]=i[s]},"mat2x4<f32>":(n,e,t,r,i)=>{for(let s=0;s<8;s++)e[t+(s/2|0)*4+s%2]=i[s]},"mat3x4<f32>":(n,e,t,r,i)=>{for(let s=0;s<12;s++)e[t+(s/3|0)*4+s%3]=i[s]}},CP={f32:(n,e,t,r,i)=>{e[t]=i},i32:(n,e,t,r,i)=>{e[t]=i},"vec2<f32>":(n,e,t,r,i)=>{e[t]=i[0],e[t+1]=i[1]},"vec3<f32>":(n,e,t,r,i)=>{e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2]},"vec4<f32>":(n,e,t,r,i)=>{e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3]},"mat2x2<f32>":(n,e,t,r,i)=>{e[t]=i[0],e[t+1]=i[1],e[t+4]=i[2],e[t+5]=i[3]},"mat3x3<f32>":(n,e,t,r,i)=>{e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+4]=i[3],e[t+5]=i[4],e[t+6]=i[5],e[t+8]=i[6],e[t+9]=i[7],e[t+10]=i[8]},"mat4x4<f32>":(n,e,t,r,i)=>{for(let s=0;s<16;s++)e[t+s]=i[s]},"mat3x2<f32>":(n,e,t,r,i)=>{for(let s=0;s<6;s++)e[t+(s/3|0)*4+s%3]=i[s]},"mat4x2<f32>":(n,e,t,r,i)=>{for(let s=0;s<8;s++)e[t+(s/4|0)*4+s%4]=i[s]},"mat2x3<f32>":(n,e,t,r,i)=>{for(let s=0;s<6;s++)e[t+(s/2|0)*4+s%2]=i[s]},"mat4x3<f32>":(n,e,t,r,i)=>{for(let s=0;s<12;s++)e[t+(s/4|0)*4+s%4]=i[s]},"mat2x4<f32>":(n,e,t,r,i)=>{for(let s=0;s<8;s++)e[t+(s/2|0)*4+s%2]=i[s]},"mat3x4<f32>":(n,e,t,r,i)=>{for(let s=0;s<12;s++)e[t+(s/3|0)*4+s%3]=i[s]}};function EP(n){return vb(n,CP,e=>{const t=Math.max(Vf[e.data.type]/16,1),r=e.data.value.length/e.data.size,i=(4-r%4)%4;return(s,o,a,l,u)=>{let c=0;for(let h=0;h<e.data.size*t;h++){for(let d=0;d<r;d++)o[a++]=u[c++];a+=i}}})}function AP(n){return vb(n,TP,e=>{const{size:t,align:r}=go[e.data.type],i=(t-r)/4;return(s,o,a,l,u)=>{let c=0;for(let h=0;h<e.data.size*(t/4);h++){for(let d=0;d<t/4;d++)o[a++]=u[c++];a+=i}}})}function vb(n,e,t){const r={};for(const i in n){const s=n[i],o=s.data;let a=!1;r[o.name]={offset:s.offset/4,func:null};for(let l=0;l<kn.length;l++){const u=kn[l];if(o.type===u.type&&u.test(o)){r[o.name].func=SP[l],a=!0;break}}a||(o.size===1?r[o.name].func=e[o.type]:r[o.name].func=t(s))}return(i,s,o,a)=>{for(const l in r)r[l].func(l,s,a+r[l].offset,i,i[l])}}const kP={f32(n,e,t,r,i,s,o){t!==r&&(e.value=r,o.uniform1f(i[n].location,r))},"vec2<f32>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1])&&(t[0]=r[0],t[1]=r[1],o.uniform2f(i[n].location,r[0],r[1]))},"vec3<f32>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2])&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],o.uniform3f(i[n].location,r[0],r[1],r[2]))},"vec4<f32>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3])&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],o.uniform4f(i[n].location,r[0],r[1],r[2],r[3]))},i32(n,e,t,r,i,s,o){t!==r&&(e.value=r,o.uniform1i(i[n].location,r))},"vec2<i32>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1])&&(t[0]=r[0],t[1]=r[1],o.uniform2i(i[n].location,r[0],r[1]))},"vec3<i32>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2])&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],o.uniform3i(i[n].location,r[0],r[1],r[2]))},"vec4<i32>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3])&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],o.uniform4i(i[n].location,r[0],r[1],r[2],r[3]))},u32(n,e,t,r,i,s,o){t!==r&&(e.value=r,o.uniform1ui(i[n].location,r))},"vec2<u32>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1])&&(t[0]=r[0],t[1]=r[1],o.uniform2ui(i[n].location,r[0],r[1]))},"vec3<u32>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2])&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],o.uniform3ui(i[n].location,r[0],r[1],r[2]))},"vec4<u32>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3])&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],o.uniform4ui(i[n].location,r[0],r[1],r[2],r[3]))},bool(n,e,t,r,i,s,o){t!==r&&(e.value=r,o.uniform1i(i[n].location,r))},"vec2<bool>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1])&&(t[0]=r[0],t[1]=r[1],o.uniform2i(i[n].location,r[0],r[1]))},"vec3<bool>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2])&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],o.uniform3i(i[n].location,r[0],r[1],r[2]))},"vec4<bool>"(n,e,t,r,i,s,o){(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3])&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],o.uniform4i(i[n].location,r[0],r[1],r[2],r[3]))},"mat2x2<f32>"(n,e,t,r,i,s,o){o.uniformMatrix2fv(i[n].location,!1,r)},"mat3x3<f32>"(n,e,t,r,i,s,o){o.uniformMatrix3fv(i[n].location,!1,r)},"mat4x4<f32>"(n,e,t,r,i,s,o){o.uniformMatrix4fv(i[n].location,!1,r)}},PP={f32(n,e,t,r,i,s,o){o.uniform1fv(i[n].location,r)},"vec2<f32>"(n,e,t,r,i,s,o){o.uniform2fv(i[n].location,r)},"vec3<f32>"(n,e,t,r,i,s,o){o.uniform3fv(i[n].location,r)},"vec4<f32>"(n,e,t,r,i,s,o){o.uniform4fv(i[n].location,r)},"mat2x2<f32>"(n,e,t,r,i,s,o){o.uniformMatrix2fv(i[n].location,!1,r)},"mat3x3<f32>"(n,e,t,r,i,s,o){o.uniformMatrix3fv(i[n].location,!1,r)},"mat4x4<f32>"(n,e,t,r,i,s,o){o.uniformMatrix4fv(i[n].location,!1,r)},i32(n,e,t,r,i,s,o){o.uniform1iv(i[n].location,r)},"vec2<i32>"(n,e,t,r,i,s,o){o.uniform2iv(i[n].location,r)},"vec3<i32>"(n,e,t,r,i,s,o){o.uniform3iv(i[n].location,r)},"vec4<i32>"(n,e,t,r,i,s,o){o.uniform4iv(i[n].location,r)},u32(n,e,t,r,i,s,o){o.uniform1iv(i[n].location,r)},"vec2<u32>"(n,e,t,r,i,s,o){o.uniform2iv(i[n].location,r)},"vec3<u32>"(n,e,t,r,i,s,o){o.uniform3iv(i[n].location,r)},"vec4<u32>"(n,e,t,r,i,s,o){o.uniform4iv(i[n].location,r)},bool(n,e,t,r,i,s,o){o.uniform1iv(i[n].location,r)},"vec2<bool>"(n,e,t,r,i,s,o){o.uniform2iv(i[n].location,r)},"vec3<bool>"(n,e,t,r,i,s,o){o.uniform3iv(i[n].location,r)},"vec4<bool>"(n,e,t,r,i,s,o){o.uniform4iv(i[n].location,r)}},MP=[(n,e,t,r,i,s,o)=>{o.uniformMatrix3fv(i[n].location,!1,s[n].toArray(!0))},(n,e,t,r,i,s,o)=>{t=i[n].value,r=s[n],(t[0]!==r.x||t[1]!==r.y||t[2]!==r.width||t[3]!==r.height)&&(t[0]=r.x,t[1]=r.y,t[2]=r.width,t[3]=r.height,o.uniform4f(i[n].location,r.x,r.y,r.width,r.height))},(n,e,t,r,i,s,o)=>{t=i[n].value,r=s[n],(t[0]!==r.x||t[1]!==r.y)&&(t[0]=r.x,t[1]=r.y,o.uniform2f(i[n].location,r.x,r.y))},(n,e,t,r,i,s,o)=>{t=i[n].value,r=s[n],(t[0]!==r.red||t[1]!==r.green||t[2]!==r.blue||t[3]!==r.alpha)&&(t[0]=r.red,t[1]=r.green,t[2]=r.blue,t[3]=r.alpha,o.uniform4f(i[n].location,r.red,r.green,r.blue,r.alpha))},(n,e,t,r,i,s,o)=>{t=i[n].value,r=s[n],(t[0]!==r.red||t[1]!==r.green||t[2]!==r.blue)&&(t[0]=r.red,t[1]=r.green,t[2]=r.blue,o.uniform3f(i[n].location,r.red,r.green,r.blue))}];function RP(n,e){const t={};for(const r in n.uniformStructures){if(!e[r])continue;const i=n.uniformStructures[r];let s=!1;for(let o=0;o<kn.length;o++){const a=kn[o];if(i.type===a.type&&a.test(i)){t[r]=MP[o],s=!0;break}}if(!s){const o=i.size===1?kP:PP;t[r]=o[i.type]}}return(r,i,s)=>{const o=s.gl;for(const a in t){const l=i[a],u=r[a],c=r[a].value;t[a](a,u,c,l,r,i,o)}}}function IP(){Object.assign(gs.prototype,{_unsafeEvalCheck(){}}),Object.assign(Hf.prototype,{_systemCheck(){}}),Object.assign(Xf.prototype,{_generateUniformsSync:RP}),Object.assign(jf.prototype,{_generateUboSync:EP}),Object.assign(qf.prototype,{_generateUboSync:AP}),Object.assign($f.prototype,{_generateShaderSync:bP}),Object.assign(yP.prototype,{generateParticleUpdate:vP})}IP();const Tg=n=>{let e;const t=new Set,r=(u,c)=>{const h=typeof u=="function"?u(e):u;if(!Object.is(h,e)){const d=e;e=c??(typeof h!="object"||h===null)?h:Object.assign({},e,h),t.forEach(f=>f(e,d))}},i=()=>e,a={setState:r,getState:i,getInitialState:()=>l,subscribe:u=>(t.add(u),()=>t.delete(u))},l=e=n(r,i,a);return a},BP=n=>n?Tg(n):Tg,DP=n=>n;function FP(n,e=DP){const t=$s.useSyncExternalStore(n.subscribe,$s.useCallback(()=>e(n.getState()),[n,e]),$s.useCallback(()=>e(n.getInitialState()),[n,e]));return $s.useDebugValue(t),t}const Cg=n=>{const e=BP(n),t=r=>FP(e,r);return Object.assign(t,e),t},GP=n=>n?Cg(n):Cg,Xe=GP(n=>({agents:[],selectedId:null,officeTheme:"office",fullscreenAgentId:null,ideOpen:!1,select:e=>n({selectedId:e}),applyFeed:e=>n({agents:e}),requestCommandCenterTab:()=>{}})),OP=2147483648,LP=1073741824,UP=536870912,La=536870911,NP=["floor","walls","furniture-below","furniture-above"],zP="collision",WP="spawn-points",HP="zones",Wl=class Wl{constructor(e,t){G(this,"width");G(this,"height");G(this,"tileSize");G(this,"walkabilityGrid",[]);G(this,"spawnPoints",new Map);G(this,"zones",new Map);G(this,"characterContainer");G(this,"rootContainer");this.mapData=e,this.tilesetTextures=t,this.width=e.width,this.height=e.height,this.tileSize=e.tilewidth,this.rootContainer=new Ue,this.characterContainer=new Ue,this.characterContainer.sortableChildren=!0,this.parseCollisionLayer(),this.parseSpawnPoints(),this.markWalkableSpawnPoints(),this.parseZones(),this.buildTileLayers()}getContainer(){return this.rootContainer}getCharacterContainer(){return this.characterContainer}isWalkable(e,t){return e<0||t<0||e>=this.width||t>=this.height?!1:this.walkabilityGrid[t][e]}tileToPixel(e,t){return{x:e*this.tileSize,y:t*this.tileSize}}pixelToTile(e,t){return{x:Math.floor(e/this.tileSize),y:Math.floor(t/this.tileSize)}}getSpawnPoint(e){return this.spawnPoints.get(e)}getAllSpawnPoints(){return this.spawnPoints}getZone(e){return this.zones.get(e)}getAllZones(){return this.zones}gidAt(e,t,r){const i=this.findLayer(e,"tilelayer");return!(i!=null&&i.data)||t<0||r<0||t>=this.width||r>=this.height?0:(i.data[r*this.width+t]??0)&La}textureForGid(e){const t=e&La;if(t===0)return;const r=this.resolveTileset(t);if(!r)return;const{tileset:i,texture:s}=r,o=i.columns??16,a=i.tilewidth??this.tileSize,l=i.tileheight??this.tileSize,u=t-i.firstgid,c=new xe(u%o*a,Math.floor(u/o)*l,a,l);return new Q({source:s.source,frame:c})}parseCollisionLayer(){const e=this.findLayer(zP,"tilelayer");if(this.walkabilityGrid=Array.from({length:this.height},()=>Array(this.width).fill(!0)),!!(e!=null&&e.data))for(let t=0;t<this.height;t++)for(let r=0;r<this.width;r++)e.data[t*this.width+r]&La&&(this.walkabilityGrid[t][r]=!1)}parseSpawnPoints(){const e=this.findLayer(WP,"objectgroup");if(e!=null&&e.objects)for(const t of e.objects)this.spawnPoints.set(t.name,{x:Math.floor(t.x/this.tileSize),y:Math.floor(t.y/this.tileSize)})}markWalkableSpawnPoints(){for(const[e,t]of this.spawnPoints)Wl.WALKABLE_SPAWN_PREFIXES.some(r=>e.startsWith(r))&&t.y>=0&&t.y<this.height&&t.x>=0&&t.x<this.width&&(this.walkabilityGrid[t.y][t.x]=!0)}parseZones(){const e=this.findLayer(HP,"objectgroup");if(e!=null&&e.objects)for(const t of e.objects)this.zones.set(t.name,{x:Math.floor(t.x/this.tileSize),y:Math.floor(t.y/this.tileSize),width:Math.floor((t.width??0)/this.tileSize),height:Math.floor((t.height??0)/this.tileSize)})}resolveTileset(e){for(let t=this.mapData.tilesets.length-1;t>=0;t--)if(e>=this.mapData.tilesets[t].firstgid)return{tileset:this.mapData.tilesets[t],texture:this.tilesetTextures[t]}}buildTileLayers(){if(this.mapData.tilesets.length!==0){for(const e of NP){const t=this.findLayer(e,"tilelayer"),r=new Ue;if(r.label=e,t!=null&&t.data)for(let i=0;i<this.height;i++)for(let s=0;s<this.width;s++){const o=t.data[i*this.width+s];if(o===0)continue;const a=(o&OP)!==0,l=(o&LP)!==0,u=(o&UP)!==0,c=o&La,h=this.resolveTileset(c);if(!h)continue;const{tileset:d,texture:f}=h,p=d.columns??16,g=d.tilewidth??this.tileSize,_=d.tileheight??this.tileSize,m=c-d.firstgid,y=m%p*g,x=Math.floor(m/p)*_,b=new xe(y,x,g,_),S=new qn(new Q({source:f.source,frame:b}));a||l||u?(S.anchor.set(.5,.5),S.x=s*this.tileSize+this.tileSize/2,S.y=i*this.tileSize+this.tileSize/2,u?a&&!l?S.rotation=Math.PI/2:!a&&l?S.rotation=-Math.PI/2:a&&l?(S.rotation=Math.PI/2,S.scale.y=-1):(S.rotation=Math.PI/2,S.scale.x=-1):(a&&(S.scale.x=-1),l&&(S.scale.y=-1))):(S.x=s*this.tileSize,S.y=i*this.tileSize),r.addChild(S)}this.rootContainer.addChild(r)}this.rootContainer.addChild(this.characterContainer)}}findLayer(e,t){return this.mapData.layers.find(r=>r.name===e&&r.type===t)}};G(Wl,"WALKABLE_SPAWN_PREFIXES",["desk-","pc-","warroom-","entrance"]);let Kh=Wl;const Sc=.08;class VP{constructor(e){G(this,"container");G(this,"currentX",0);G(this,"currentY",0);G(this,"currentZoom",1);G(this,"targetX",0);G(this,"targetY",0);G(this,"targetZoom",1);G(this,"viewWidth",960);G(this,"viewHeight",800);G(this,"mapWidth",640);G(this,"mapHeight",480);G(this,"manualOverride",!1);G(this,"nudgeOffsetX",0);G(this,"nudgeOffsetY",0);G(this,"nudgeElapsed",0);G(this,"nudgeDuration",0);G(this,"nudgeStrength",.4);this.container=e}setMapSize(e,t){this.mapWidth=e,this.mapHeight=t}setViewSize(e,t){this.viewWidth=e,this.viewHeight=t,this.manualOverride||this.fitToScreen()}getMinZoom(){return this.viewWidth===0||this.viewHeight===0?1:Math.min(this.viewWidth/this.mapWidth,this.viewHeight/this.mapHeight)}fitToScreen(){this.manualOverride=!1,this.targetX=this.mapWidth/2,this.targetY=this.mapHeight/2,this.targetZoom=this.getMinZoom()}focusOn(e,t,r){this.manualOverride=!0,this.targetX=e,this.targetY=t,this.targetZoom=Math.max(this.getMinZoom(),Math.min(4,r??this.currentZoom))}nudgeToward(e,t,r=1200){this.manualOverride||(this.nudgeOffsetX=(e-this.targetX)*this.nudgeStrength,this.nudgeOffsetY=(t-this.targetY)*this.nudgeStrength,this.nudgeElapsed=0,this.nudgeDuration=r/1e3)}update(e){if(this.currentX+=(this.targetX-this.currentX)*Sc,this.currentY+=(this.targetY-this.currentY)*Sc,this.currentZoom+=(this.targetZoom-this.currentZoom)*Sc,this.nudgeDuration>0){this.nudgeElapsed+=e;const i=Math.min(this.nudgeElapsed/this.nudgeDuration,1),s=1-i;this.currentX+=this.nudgeOffsetX*s,this.currentY+=this.nudgeOffsetY*s,i>=1&&(this.nudgeDuration=0,this.nudgeOffsetX=0,this.nudgeOffsetY=0)}this.container.scale.set(this.currentZoom),this.container.x=this.viewWidth/2-this.currentX*this.currentZoom,this.container.y=this.viewHeight/2-this.currentY*this.currentZoom;const t=this.mapWidth*this.currentZoom,r=this.mapHeight*this.currentZoom;t<=this.viewWidth?this.container.x=(this.viewWidth-t)/2:this.container.x=Math.min(0,Math.max(this.viewWidth-t,this.container.x)),r<=this.viewHeight?this.container.y=(this.viewHeight-r)/2:this.container.y=Math.min(0,Math.max(this.viewHeight-r,this.container.y))}}const jP={down:0,up:1,right:2,left:2},$P={walk:[0,1,2,1],type:[0,1,2,1],read:[0,1,2,1],idle:[0]},XP=1.08;class YP{constructor(e){G(this,"container");G(this,"sprite");G(this,"frames");G(this,"currentDirection","down");G(this,"currentAnim","idle");G(this,"frameSpeed",.15);G(this,"frameW");G(this,"frameH");G(this,"cropMask",null);this.frames=e,this.container=new Ue;const t=this.getFrames("down","idle");this.sprite=new Ol(t),this.sprite.anchor.set(.5,1),this.sprite.animationSpeed=this.frameSpeed,this.sprite.play(),this.frameW=this.sprite.texture.frame.width||this.sprite.width||16,this.frameH=this.sprite.texture.frame.height||this.sprite.height||32,this.container.addChild(this.sprite),this.container.scale.set(XP)}setSeatedCrop(e){if(e<=0){this.cropMask&&(this.sprite.mask=null,this.cropMask.visible=!1);return}this.cropMask||(this.cropMask=new Be,this.container.addChild(this.cropMask));const t=this.frameW,r=this.frameH;this.cropMask.clear(),this.cropMask.rect(-t/2-2,-r-2,t+4,r-e+2).fill(16777215),this.cropMask.visible=!0,this.sprite.mask=this.cropMask}getFrames(e,t){const r=jP[e];return $P[t].map(i=>this.frames[r][i])}setAnimation(e,t){e===this.currentAnim&&t===this.currentDirection||(this.currentAnim=e,this.currentDirection=t,this.sprite.textures=this.getFrames(t,e),this.sprite.scale.x=t==="left"?-1:1,this.sprite.animationSpeed=e==="walk"?.15:e==="idle"?.08:.06,this.sprite.play())}setPosition(e,t){this.container.x=e,this.container.y=t}setAlpha(e){this.container.alpha=e}destroy(){this.container.destroy({children:!0})}}const KP=[{x:0,y:-1},{x:0,y:1},{x:-1,y:0},{x:1,y:0}];function qP(n,e,t){if(e.x===t.x&&e.y===t.y)return[];if(!n.isWalkable(t.x,t.y))return null;const r=a=>`${a.x},${a.y}`,i=new Set,s=new Map,o=[e];for(i.add(r(e));o.length>0;){const a=o.shift();for(const l of KP){const u={x:a.x+l.x,y:a.y+l.y},c=r(u);if(!(i.has(c)||!n.isWalkable(u.x,u.y))){if(i.add(c),s.set(c,a),u.x===t.x&&u.y===t.y)return QP(s,e,t);o.push(u)}}}return null}function QP(n,e,t){const r=[];let i=t;const s=o=>`${o.x},${o.y}`;for(;!(i.x===e.x&&i.y===e.y);)r.unshift(i),i=n.get(s(i));return r}const bt={cream:{50:16776693,200:16050631},ink:{900:1708832},accent:{coral:14248546,coralLight:15979469,mint:6072698,mintLight:13821914,sky:5218223,skyLight:13624809,lemon:14461756,lemonLight:15983804,lilac:9732819,lilacLight:14736114,peach:14258536,peachLight:15981258}},ZP={Read:"<",Edit:">",Write:">",Bash:"$",Grep:"?",Glob:"?",WebFetch:"@",WebSearch:"@",TodoWrite:"=",MCP:"*"},JP="*";function eM(n){return ZP[n]??JP}const qh=6,Eg=3,tM=5,nM=150,Ag=bt.cream[50],kg=bt.ink[900],rM="#3d2e4a",iM=12,Pi=.5,Pg=-38,sM=.15,oM=.3,aM=1.2,lM=.45,uM=nM/Pi-qh*2,Mg=160;class cM{constructor(){G(this,"container");G(this,"inner");G(this,"bg");G(this,"tail");G(this,"label");G(this,"state","hidden");G(this,"fadeElapsed",0);G(this,"lingerElapsed",0);G(this,"bgW",0);G(this,"bgH",0);G(this,"isThinking",!1);G(this,"dotsElapsed",0);G(this,"dotsPhase",0);G(this,"extraLift",0);G(this,"zoom",1);G(this,"boundsW",0);G(this,"boundsH",0);this.container=new Ue,this.container.zIndex=1e5,this.container.eventMode="none",this.container.alpha=0,this.container.visible=!1,this.inner=new Ue,this.inner.scale.set(Pi),this.container.addChild(this.inner),this.tail=new Be,this.bg=new Be,this.label=new JA({text:"",style:{fontSize:iM,fontWeight:"bold",fill:rM,fontFamily:"monospace",align:"left",wordWrap:!0,wordWrapWidth:uM,breakWords:!0}}),this.label.x=qh,this.label.y=Eg,this.inner.addChild(this.tail,this.bg,this.label)}show(e,t){if(this.isThinking=!e.trim(),this.isThinking)this.dotsElapsed=0,this.dotsPhase=0,this.label.text=".";else{const r=t?`${eM(t)} ${e}`:e;this.label.text=r.length>Mg?r.slice(0,Mg-1).trimEnd()+"…":r}this.redraw(),this.reveal()}reveal(){this.state==="hidden"||this.state==="fading-out"?(this.state="fading-in",this.fadeElapsed=0,this.container.visible=!0):(this.state="visible",this.container.alpha=1),this.lingerElapsed=0}startLinger(){this.state!=="hidden"&&(this.state="lingering",this.lingerElapsed=0)}setZoom(e){!(e>0)||e===this.zoom||(this.zoom=e,this.container.scale.set(this.compensation()))}compensation(){return 1/Math.min(this.zoom,1)}setBounds(e,t){this.boundsW=e,this.boundsH=t}setPosition(e,t){const r=this.compensation(),i=this.bgW*Pi*r,s=this.bgH*Pi*r;let o=e-i/2,a=t+Pg-s-this.extraLift;this.boundsW>0&&(o=Math.min(Math.max(o,1),Math.max(1,this.boundsW-i-1)),a=Math.min(Math.max(a,1),Math.max(1,this.boundsH-s-1))),this.container.x=Math.round(o),this.container.y=Math.round(a)}setLift(e){this.extraLift=e}getLayout(e,t){if(this.state==="hidden")return null;const r=this.compensation(),i=this.bgW*Pi*r,s=this.bgH*Pi*r;let o=e-i/2,a=t+Pg-s;return this.boundsW>0&&(o=Math.min(Math.max(o,1),Math.max(1,this.boundsW-i-1)),a=Math.min(Math.max(a,1),Math.max(1,this.boundsH-s-1))),{x:o,y:a,w:i,h:s}}hide(){this.state="hidden",this.isThinking=!1,this.container.alpha=0,this.container.visible=!1}isHidden(){return this.state==="hidden"}update(e){if(this.isThinking&&(this.state==="visible"||this.state==="fading-in")){this.dotsElapsed+=e;const t=Math.floor(this.dotsElapsed/lM)%3;t!==this.dotsPhase&&(this.dotsPhase=t,this.label.text=[".","..","..."][this.dotsPhase],this.redraw())}switch(this.state){case"fading-in":{this.fadeElapsed+=e;const t=Math.min(this.fadeElapsed/sM,1);this.container.alpha=t,t>=1&&(this.state="visible");break}case"lingering":{this.lingerElapsed+=e,this.lingerElapsed>=aM&&(this.state="fading-out",this.fadeElapsed=0);break}case"fading-out":{this.fadeElapsed+=e;const t=Math.min(this.fadeElapsed/oM,1);this.container.alpha=1-t,t>=1&&this.hide();break}}}destroy(){this.container.destroy({children:!0})}redraw(){this.bgW=this.label.width+qh*2,this.bgH=this.label.height+Eg*2,this.bg.clear(),this.bg.roundRect(0,0,this.bgW,this.bgH,tM),this.bg.fill({color:Ag}),this.bg.stroke({color:kg,width:1}),this.tail.clear();const e=this.bgW*.32,t=(r,i,s)=>{this.tail.circle(r,i,s).fill({color:Ag}).stroke({color:kg,width:1})};t(e,this.bgH+4,3),t(e-5,this.bgH+9,2)}}function hM(n,e,t){const r=Math.min(Math.max(t,0),1);return n+(e-n)*r}function bb(n,e,t){n.rect(e,t-4,5,4).fill(15920610),n.rect(e,t-2,5,1).fill(15253837),n.rect(e+5,t-3,1,2).fill(14275268),n.rect(e,t-4,5,1).fill(16777215)}const dM=48,Rg=5,fM=12,pM=5,Ig=4,mM=8,gM=2,yM=30,_M=30;class xM{constructor(e){G(this,"agentId");G(this,"sprite");G(this,"state","idle");G(this,"mapRenderer");G(this,"deskTile");G(this,"seatDirection");G(this,"px");G(this,"py");G(this,"path",[]);G(this,"pendingWork",null);G(this,"pendingSit",!1);G(this,"sitting",!1);G(this,"wandering",!1);G(this,"idleTimer",0);G(this,"idleWanderDelay",1+Math.random()*3);G(this,"idleLoop",!1);G(this,"idleLoopPhase","linger");G(this,"idleLoopTimer",0);G(this,"direction","down");G(this,"arrivalCallback",null);G(this,"isVisible",!1);G(this,"fadeDirection",null);G(this,"fadeDuration",0);G(this,"fadeElapsed",0);G(this,"hideTimer",null);G(this,"thoughtBubble");G(this,"workGlow");G(this,"workGlowElapsed",0);G(this,"glowOn",!1);G(this,"overlay");G(this,"statusGlyph","none");G(this,"glyphElapsed",0);G(this,"onClick");G(this,"fx");G(this,"fxDirty",!1);G(this,"cheerT",-1);G(this,"confetti",[]);G(this,"carryingCup",!1);G(this,"deskCup");G(this,"deskCupOn",!1);G(this,"cupSpot",null);G(this,"waterT",-1);G(this,"waterDur",0);G(this,"onWaterDone",null);G(this,"smokeT",-1);G(this,"smokeDur",0);G(this,"onSmokeDone",null);G(this,"targetAlpha",1);G(this,"steamT",0);this.agentId=e.agentId,this.mapRenderer=e.mapRenderer,this.sprite=new YP(e.frames),this.deskTile=e.seatTile,this.seatDirection=e.seatDirection??"down",this.onClick=e.onClick;const t=e.spawnTile??this.deskTile,r=this.mapRenderer.tileToPixel(t.x,t.y);this.px=r.x+this.mapRenderer.tileSize/2,this.py=r.y+this.mapRenderer.tileSize,this.sprite.setPosition(this.px,this.py),this.thoughtBubble=new cM,this.thoughtBubble.setBounds(this.mapRenderer.width*this.mapRenderer.tileSize,this.mapRenderer.height*this.mapRenderer.tileSize),this.workGlow=new Be,this.workGlow.circle(0,0,14),this.workGlow.fill({color:e.glowColor,alpha:1}),this.workGlow.alpha=0,this.workGlow.eventMode="none",this.overlay=new Be,this.overlay.eventMode="none",this.fx=new Be,this.fx.eventMode="none",this.deskCup=new Be,this.deskCup.eventMode="none",this.deskCup.visible=!1}getAnimation(){return this.state}getDeskTile(){return this.deskTile}getPixelPosition(){return{x:this.px,y:this.py}}getTilePosition(){return this.mapRenderer.pixelToTile(this.px,this.py-1)}moveTo(e){const t=qP(this.mapRenderer,this.getTilePosition(),e);t&&t.length>0&&(this.sitting=!1,this.sprite.setSeatedCrop(0),this.path=t,this.state="walk",this.sprite.setAnimation("walk",this.direction))}walkToAndThen(e,t){if(this.idleLoop=!1,this.arrivalCallback=t,this.moveTo(e),this.state!=="walk"){this.arrivalCallback=null;const r=this.getTilePosition();r.x===e.x&&r.y===e.y&&t()}}sitAtDesk(e){this.idleLoop=!1,this.walkToDeskAndSit(e)}walkToDeskAndSit(e){this.glowOn=e,this.wandering=!1;const t=this.getTilePosition();t.x===this.deskTile.x&&t.y===this.deskTile.y?this.applySit():(this.pendingSit=!0,this.pendingWork=null,this.arrivalCallback=null,this.moveTo(this.deskTile))}applySit(){this.applySitPose(this.seatDirection)}applySitPose(e){this.state="idle",this.pendingWork=null,this.pendingSit=!1,this.path=[],this.sitting=!0,this.direction=e,this.sprite.setAnimation("idle",e);let t=0,r=0;switch(e){case"down":r=fM;break;case"up":r=pM;break;case"left":t=-Rg,r=Ig;break;case"right":t=Rg,r=Ig;break}this.sprite.setPosition(this.px+t,this.py+r),this.sprite.setSeatedCrop(e==="down"?mM:gM)}sitInPlace(e){this.idleLoop=!1,this.wandering=!1,this.glowOn=!1,this.arrivalCallback=null,this.applySitPose(e)}isSitting(){return this.sitting}faceDirection(e){this.direction=e,!this.sitting&&this.state!=="walk"&&this.sprite.setAnimation("idle",e)}setIdle(){this.idleLoop=!1,this.state="idle",this.pendingWork=null,this.pendingSit=!1,this.sitting=!1,this.wandering=!1,this.path=[],this.glowOn=!1,this.sprite.setSeatedCrop(0),this.sprite.setAnimation("idle",this.direction),this.sprite.setPosition(this.px,this.py)}startWandering(){this.idleLoop&&this.wandering||(this.idleLoop=!0,this.idleLoopPhase="linger",this.idleLoopTimer=0,this.beginWander())}beginWander(){this.wandering||(this.glowOn=!1,this.sitting=!1,this.pendingSit=!1,this.pendingWork=null,this.wandering=!0,this.idleTimer=0,this.idleWanderDelay=.5+Math.random()*2,this.sprite.setSeatedCrop(0),this.state!=="walk"&&(this.state="idle",this.sprite.setAnimation("idle",this.direction),this.sprite.setPosition(this.px,this.py)))}walkToTile(e){this.idleLoop=!1,this.pendingWork=null,this.pendingSit=!1,this.sitting=!1,this.wandering=!1,this.arrivalCallback=null,this.moveTo(e)}repositionTo(e,t){this.deskTile={x:e,y:t};const r=this.mapRenderer.tileToPixel(e,t);this.px=r.x+this.mapRenderer.tileSize/2,this.py=r.y+this.mapRenderer.tileSize,this.sprite.setPosition(this.px,this.py)}showThought(e,t){this.thoughtBubble.show(e,t)}hideThought(){this.thoughtBubble.startLinger()}getThoughtLayout(){return this.thoughtBubble.getLayout(this.px,this.py)}setThoughtLift(e){this.thoughtBubble.setLift(e)}setBubbleZoom(e){this.thoughtBubble.setZoom(e)}setStatusGlyph(e){e!==this.statusGlyph&&(this.statusGlyph=e,this.glyphElapsed=0,e==="none"&&this.overlay.clear())}cheer(){if(this.sitting)return;this.path=[],this.state==="walk"&&(this.state="idle",this.sprite.setAnimation("idle",this.direction)),this.cheerT=0,this.confetti=[];const e=[16767293,16739179,7064439,5084927,16164607];for(let t=0;t<14;t++)this.confetti.push({x:(Math.random()-.5)*8,y:-22-Math.random()*6,vx:(Math.random()-.5)*46,vy:-30-Math.random()*40,c:e[t%e.length]})}isCheering(){return this.cheerT>=0}setCupSpot(e){this.cupSpot=e,e&&(this.deskCup.position.set(e.x,e.y),this.deskCup.zIndex=e.y)}setCarryingCup(e){this.carryingCup=e}setCupOnDesk(e){this.cupSpot&&(this.deskCupOn=e,this.deskCup.visible=e,e?this.drawCup(this.deskCup,0,0):this.deskCup.clear())}hasCupOnDesk(){return this.deskCupOn}isCarryingCup(){return this.carryingCup}startWatering(e,t){this.waterT=0,this.waterDur=e,this.onWaterDone=t??null}isWatering(){return this.waterT>=0}stopWatering(){this.waterT=-1,this.onWaterDone=null}startSmoking(e,t){this.smokeT=0,this.smokeDur=e,this.onSmokeDone=t??null}isSmoking(){return this.smokeT>=0}stopSmoking(){this.smokeT=-1,this.onSmokeDone=null}setBaseAlpha(e){this.targetAlpha=e}enableClick(){this.sprite.container.eventMode="static",this.sprite.container.cursor="pointer",this.sprite.container.on("pointertap",e=>{var t;e.stopPropagation(),(t=this.onClick)==null||t.call(this,this.agentId)})}show(e){this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null),this.isVisible=!0,this.sprite.setAlpha(0),e.addChild(this.workGlow),e.addChild(this.sprite.container),this.sprite.container.addChild(this.overlay),this.sprite.container.addChild(this.fx),e.addChild(this.deskCup),e.addChild(this.thoughtBubble.container),this.enableClick(),this.fadeDirection="in",this.fadeDuration=.5,this.fadeElapsed=0}hide(e=0){this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null);const t=()=>{this.hideTimer=null,this.fadeDirection="out",this.fadeDuration=.6,this.fadeElapsed=0};e>0?this.hideTimer=setTimeout(t,e):t()}update(e){var i,s,o,a;if(this.fadeDirection){this.fadeElapsed+=e;const l=Math.min(this.fadeElapsed/this.fadeDuration,1),u=(this.fadeDirection==="in"?l:1-l)*this.targetAlpha;if(this.sprite.setAlpha(u),l>=1){const c=this.fadeDirection==="out";this.fadeDirection=null,c&&(this.isVisible=!1,(i=this.sprite.container.parent)==null||i.removeChild(this.sprite.container),this.thoughtBubble.hide(),(s=this.thoughtBubble.container.parent)==null||s.removeChild(this.thoughtBubble.container),(o=this.workGlow.parent)==null||o.removeChild(this.workGlow),(a=this.deskCup.parent)==null||a.removeChild(this.deskCup))}}else if(this.isVisible){const l=this.sprite.container.alpha;Math.abs(l-this.targetAlpha)>.01&&this.sprite.setAlpha(hM(l,this.targetAlpha,Math.min(1,e/.2)))}if(this.thoughtBubble.update(e),!this.isVisible)return;const t=this.cheerT>=0||this.waterT>=0||this.smokeT>=0;this.state==="walk"?this.updateWalk(e):this.wandering&&!t&&this.updateWander(e),this.idleLoop&&!t&&this.updateIdleLoop(e),this.sprite.container.zIndex=this.py,this.thoughtBubble.setPosition(this.px,this.py);const r=this.mapRenderer.tileSize;if(this.workGlow.x=this.px,this.workGlow.y=this.py-r/2,this.workGlow.zIndex=this.py-1,this.glowOn){this.workGlowElapsed+=e;const l=(Math.sin(this.workGlowElapsed*Math.PI/.6)+1)/2;this.workGlow.alpha=(.18+.27*l)*this.sprite.container.alpha,this.workGlow.scale.set(.95+.15*l)}else this.workGlow.alpha=0,this.workGlowElapsed=0;this.updateStatusGlyph(e),this.updateFx(e)}isSittingAtDesk(){if(!this.sitting)return!1;const e=this.getTilePosition();return e.x===this.deskTile.x&&e.y===this.deskTile.y}carryOffset(){switch(this.direction){case"left":return{x:-7,y:-9};case"right":return{x:7,y:-9};case"up":return{x:-5,y:-10};default:return{x:5,y:-9}}}handOffset(){switch(this.direction){case"left":return{x:-6,y:-9};case"right":return{x:6,y:-9};case"up":return{x:0,y:-13};default:return{x:0,y:-6}}}drawCup(e,t,r){bb(e,t,r)}updateFx(e){if(this.steamT+=e,this.deskCupOn&&this.cupSpot){this.deskCup.clear(),this.drawCup(this.deskCup,0,0);for(let r=0;r<2;r++){const i=(this.steamT*.7+r*.5)%1;this.deskCup.rect(1+r*2,-5-Math.round(i*5),1,1).fill({color:16777215,alpha:.5*(1-i)})}}if(!(this.cheerT>=0||this.waterT>=0||this.smokeT>=0||this.carryingCup)){this.fxDirty&&(this.fx.clear(),this.fxDirty=!1);return}if(this.fx.clear(),this.fxDirty=!0,this.cheerT>=0){this.cheerT+=e;const r=this.cheerT;if(r>=1.6)this.cheerT=-1,this.sprite.setPosition(this.px,this.py);else{const i=1-r/1.6,s=Math.abs(Math.sin(r*Math.PI*2.2))*5*i;this.sprite.setPosition(this.px,this.py-s);for(const o of this.confetti){o.x+=o.vx*e,o.y+=o.vy*e,o.vy+=110*e;const a=Math.max(0,Math.min(1,(1.45-r)/.5));this.fx.rect(Math.round(o.x),Math.round(o.y),2,2).fill({color:o.c,alpha:a})}}}if(this.carryingCup){const r=this.carryOffset();this.drawCup(this.fx,r.x,r.y);const i=this.steamT*.9%1;this.fx.rect(r.x+2,r.y-5-Math.round(i*4),1,1).fill({color:16777215,alpha:.5*(1-i)})}if(this.smokeT>=0)if(this.smokeT+=e,this.smokeT>=this.smokeDur){this.smokeT=-1;const r=this.onSmokeDone;this.onSmokeDone=null,r==null||r()}else{const r=this.handOffset(),i=this.direction==="left"?-1:this.direction==="right"?1:0,s=r.x+(i>=0?4:-4);this.fx.rect(Math.min(r.x,s),r.y-1,4,1).fill(7031347),this.fx.rect(r.x+(i>=0?1:-2),r.y-1,1,1).fill(14262346);const o=.5+.5*Math.sin(this.smokeT*5);this.fx.rect(s,r.y-1,1,1).fill({color:16742972,alpha:.55+.45*o});for(let a=0;a<3;a++){const l=(this.smokeT*.45+a/3)%1,u=s+Math.sin((this.smokeT+a*2)*1.7)*2+l*2*(i||1),c=r.y-3-l*12;this.fx.circle(u,c,1+l*1.5).fill({color:13617876,alpha:.45*(1-l)})}}if(this.waterT>=0)if(this.waterT+=e,this.waterT>=this.waterDur){this.waterT=-1;const r=this.onWaterDone;this.onWaterDone=null,r==null||r()}else{const r=this.handOffset(),i=this.direction==="left"?-1:this.direction==="right"?1:0,s=this.direction==="up"?-1:this.direction==="down"?1:0;this.fx.rect(r.x-2,r.y-2,5,3).fill(10135472),this.fx.rect(r.x+(i>=0?3:-4),r.y-2,2,1).fill(10135472);for(let o=0;o<4;o++){const a=(this.waterT*1.3+o/4)%1,l=4+a*7,u=i!==0?l*i:(o-1.5)*1.5,c=s!==0?l*s:0,h=a*a*9;this.fx.rect(Math.round(r.x+u),Math.round(r.y+c+h-2),1,2).fill({color:6010856,alpha:1-a*.45})}}}updateStatusGlyph(e){if(this.statusGlyph==="none")return;this.glyphElapsed+=e;const t=this.overlay;t.clear();const r=-34;if(this.statusGlyph==="blocked")Math.floor(this.glyphElapsed/.4)%2===0&&(t.rect(-1,r,2,5).fill(16739179),t.rect(-1,r+6,2,2).fill(16739179));else if(this.statusGlyph==="success"){const s=2+(Math.sin(this.glyphElapsed*18)+1)/2*2;t.rect(-.5,r-s,1,s*2).fill(16767293),t.rect(-s,r-.5,s*2,1).fill(16767293),this.glyphElapsed>.9&&this.setStatusGlyph("none")}else if(this.statusGlyph==="compacting"){const s=2+(Math.sin(this.glyphElapsed*6)+1)/2*3;t.rect(-s,r-s,s*2,s*2).fill(10190558)}else if(this.statusGlyph==="looping"){const i=Math.floor(this.glyphElapsed*8)%4,s=[[-3,r-3],[3,r-3],[3,r+3],[-3,r+3]];for(let o=0;o<4;o++){const[a,l]=s[o];t.rect(a-1,l-1,2,2).fill(o===i?16752451:7035e3)}}}updateWalk(e){if(this.path.length===0){if(this.pendingSit?this.applySit():this.pendingWork?(this.state=this.pendingWork,this.pendingWork=null,this.sprite.setAnimation(this.state,this.seatDirection)):this.wandering?(this.state="idle",this.idleTimer=0,this.idleWanderDelay=1+Math.random()*3,this.sprite.setAnimation("idle",this.direction)):this.setIdle(),this.arrivalCallback){const c=this.arrivalCallback;this.arrivalCallback=null,c()}return}const t=this.path[0],r=this.mapRenderer.tileSize,i=t.x*r+r/2,s=t.y*r+r,o=i-this.px,a=s-this.py,l=Math.sqrt(o*o+a*a);if(l<1){this.px=i,this.py=s,this.path.shift();return}const u=Math.min(dM*e,l);this.px+=o/l*u,this.py+=a/l*u,this.direction=Math.abs(o)>Math.abs(a)?o>0?"right":"left":a>0?"down":"up",this.sprite.setAnimation("walk",this.direction),this.sprite.setPosition(this.px,this.py)}updateIdleLoop(e){switch(this.idleLoopPhase){case"linger":this.idleLoopTimer+=e,this.idleLoopTimer>=yM&&(this.idleLoopPhase="toDesk",this.idleLoopTimer=0,this.walkToDeskAndSit(!1));break;case"toDesk":this.idleLoopTimer+=e,this.sitting?(this.idleLoopPhase="resting",this.idleLoopTimer=0):this.idleLoopTimer>=20&&(this.idleLoopPhase="linger",this.idleLoopTimer=0,this.beginWander());break;case"resting":this.idleLoopTimer+=e,this.idleLoopTimer>=_M&&(this.idleLoopPhase="linger",this.idleLoopTimer=0,this.beginWander());break}}updateWander(e){if(this.idleTimer+=e,this.idleTimer<this.idleWanderDelay)return;this.idleTimer=0,this.idleWanderDelay=1+Math.random()*3;const t=this.getTilePosition(),r=6;for(let i=0;i<14;i++){const s=t.x+Math.floor(Math.random()*r*2)-r,o=t.y+Math.floor(Math.random()*r*2)-r;if((s!==t.x||o!==t.y)&&this.mapRenderer.isWalkable(s,o)){const a=this.wandering;this.moveTo({x:s,y:o}),this.wandering=a;return}}}destroy(){var e;this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null),this.thoughtBubble.destroy(),this.sprite.destroy(),this.workGlow.destroy(),this.overlay.destroy(),this.fx.destroy(),(e=this.deskCup.parent)==null||e.removeChild(this.deskCup),this.deskCup.destroy()}}const vM=[[367,0,0],[368,1,0],[383,0,1],[384,1,1]],or={x:3,y:5,h:12};class bM{constructor(e,t,r){G(this,"container",new Ue);G(this,"anim",new Be);G(this,"on",!1);G(this,"t",0);const i=e.tileSize,s=(r==null?void 0:r.onGids)??vM;for(const[o,a,l]of s){const u=e.textureForGid(o);if(!u)continue;const c=new qn(u);c.x=a*i,c.y=l*i,this.container.addChild(c)}this.anim.eventMode="none",this.container.addChild(this.anim),this.container.x=t.x*i,this.container.y=t.y*i,this.container.zIndex=(t.y+2)*i-1,this.container.visible=!1,this.container.eventMode="none"}setOn(e){e!==this.on&&(this.on=e,this.container.visible=e,e||(this.anim.clear(),this.t=0))}update(e){if(!this.on)return;this.t+=e;const t=this.anim;t.clear();for(let r=0;r<2;r++){const i=(this.t*3.2+r*(or.h/2))%or.h,s=or.y+or.h-1-i,o=6+(r*7+Math.floor(this.t/1.7))%9;t.rect(or.x+2,Math.round(s),o,1).fill({color:13625087,alpha:.55})}Math.floor(this.t/.53)%2===0&&t.rect(or.x+2,or.y+or.h-2,2,2).fill({color:16777215,alpha:.9})}destroy(){this.container.destroy({children:!0})}}const wM={request:bt.accent.sky,query:bt.accent.lilac,propose:bt.accent.lemon,inform:bt.cream[200],agree:bt.accent.mint,done:bt.accent.mint,refuse:bt.accent.coral},Bg=bt.ink[900],SM=bt.accent.coral,Dg=22,TM=230,CM=.8,EM=2,AM=.14,Fg=.22,kM=.34;function PM(n){return n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2}class MM{constructor(e,t,r,i){G(this,"container");G(this,"body");G(this,"burst");G(this,"sx");G(this,"sy");G(this,"ex");G(this,"ey");G(this,"duration");G(this,"elapsed",0);G(this,"bursting",!1);G(this,"burstElapsed",0);G(this,"finished",!1);this.sx=e.x,this.sy=e.y-Dg,this.ex=t.x,this.ey=t.y-Dg;const s=Math.hypot(this.ex-this.sx,this.ey-this.sy);this.duration=Math.min(EM,Math.max(CM,s/TM));const o=i?SM:wM[r]??bt.cream[200];this.container=new Ue,this.container.zIndex=1e6,this.container.eventMode="none",this.container.alpha=0,this.body=new Be;const a=14,l=10;this.body.rect(-a/2,-l/2,a,l).fill({color:o}).stroke({color:Bg,width:1}),this.body.moveTo(-a/2,-l/2).lineTo(0,l/2-3).lineTo(a/2,-l/2).stroke({color:Bg,width:1}),this.container.addChild(this.body),this.burst=new Be,this.burst.visible=!1,this.container.addChild(this.burst),this.setPos(this.sx,this.sy)}setPos(e,t){this.container.x=Math.round(e),this.container.y=Math.round(t)}update(e){if(this.finished)return!0;if(!this.bursting){this.elapsed+=e;const i=Math.min(this.elapsed/this.duration,1),s=PM(i),o=this.sx+(this.ex-this.sx)*s,a=-38*Math.sin(Math.PI*s),l=this.sy+(this.ey-this.sy)*s+a;this.setPos(o,l);const u=Math.min(this.elapsed/AM,1),c=i>1-Fg/this.duration?Math.max(0,(1-i)/(Fg/this.duration)):1;return this.container.alpha=Math.min(u,c),this.body.rotation=Math.sin(this.elapsed*6)*.12,i>=1&&(this.bursting=!0,this.body.visible=!1,this.burst.visible=!0,this.container.alpha=1,this.setPos(this.ex,this.ey)),!1}this.burstElapsed+=e;const t=Math.min(this.burstElapsed/kM,1),r=3+t*12;return this.burst.clear(),this.burst.circle(0,0,r).stroke({color:bt.accent.lemon,width:2,alpha:1-t}),this.container.alpha=1-t,t>=1?(this.finished=!0,!0):!1}destroy(){this.container.destroy({children:!0})}}const RM=18,IM=28,Nl=18,zl=32,BM=[38,34,46],te=4,ee=13;let ai=RM,lu=IM;const Ti=n=>n<0?0:n>255?255:Math.round(n);function nt(n,e=1.22,t=.68){return[[Ti(n[0]*e),Ti(n[1]*e),Ti(n[2]*e)],[n[0],n[1],n[2]],[Ti(n[0]*t),Ti(n[1]*t),Ti(n[2]*t)]]}function E(n,e,t,r,i=255){if(e<0||e>=ai||t<0||t>=lu)return;const s=(t*ai+e)*4;n[s]=r[0],n[s+1]=r[1],n[s+2]=r[2],n[s+3]=i}function Zn(n,e,t){return e<0||e>=ai||t<0||t>=lu?0:n[(t*ai+e)*4+3]}function Zf(n,e,t){const r=(t*ai+e)*4;return[n[r],n[r+1],n[r+2]]}function Jf(n,e){return n[0]===e[0]&&n[1]===e[1]&&n[2]===e[2]}function _e(n,e,t,r,i,s){for(let o=t;o<=i;o++)for(let a=e;a<=r;a++)E(n,a,o,s)}const hi={light:{hi:[255,221,189],base:[247,201,170],sh:[212,158,126],line:[168,112,82]},tan:{hi:[232,182,136],base:[214,162,116],sh:[176,126,86],line:[138,92,60]},brown:{hi:[180,130,94],base:[158,112,78],sh:[124,86,58],line:[90,60,40]},dark:{hi:[142,98,70],base:[120,80,56],sh:[94,62,42],line:[64,42,28]}};function DM(n,e){const t=hi[e];for(let r=4;r<=16;r++)for(let i=te;i<=ee;i++)(i===te||i===ee)&&(r===4||r===5||r===16)||(i===5||i===12)&&r===4||E(n,i,r,t.base);for(let r=6;r<12;r++)E(n,5,r,t.hi);E(n,6,5,t.hi),E(n,7,5,t.hi);for(let r=6;r<15;r++)E(n,12,r,t.sh);for(const r of[7,8,9,10,11])E(n,r,16,t.sh);for(const r of[te-1,ee+1])E(n,r,9,t.base),E(n,r,10,t.base),E(n,r,11,t.sh);_e(n,7,17,10,18,t.sh),_e(n,7,17,9,17,t.base)}function FM(n,e,t,r,i,s=!1){const o=hi[e],a=[250,248,244],l=[46,38,42];for(const[h,d,f]of[[5,6,6],[10,11,10]])E(n,h,9,a),E(n,d,9,a),E(n,f,9,l);if(s){const h=[54,40,48],d=[252,250,248];for(const f of[5,6,10,11])E(n,f,8,h);E(n,4,8,h),E(n,12,8,h),E(n,5,9,d),E(n,10,9,d)}if(t==="flat")for(const h of[5,6,10,11])E(n,h,7,o.line);else if(t==="angry")E(n,5,8,o.line),E(n,6,7,o.line),E(n,10,7,o.line),E(n,11,8,o.line);else if(t==="raised")for(const h of[5,6,10,11])E(n,h,6,o.line);else if(t==="soft"){for(const h of[5,11])E(n,h,7,o.line);for(const h of[6,10])E(n,h,7,o.sh)}E(n,8,11,o.sh),E(n,8,12,o.sh),E(n,7,12,o.sh);const u=[158,86,80],c={neutral:[[7,14],[8,14],[9,14],[10,14]],smile:[[7,14],[8,14],[9,14],[10,14],[6,13],[11,13]],frown:[[7,15],[8,15],[9,15],[10,15],[6,14],[11,14]],grin:[[7,14],[8,14],[9,14],[10,14],[7,13],[8,13],[9,13],[10,13],[6,13],[11,13]]};for(const[h,d]of c[r])E(n,h,d,u);if(i)for(const h of[5,12])E(n,h,12,[235,150,140],140)}const GM=(n,e,t,r)=>{const[i,s,o]=nt(e),a=r.part??"L",l=r.recede??0;_e(n,te,2,ee,4,s);for(let c=te-1;c<=ee+1;c++)E(n,c,3,s);_e(n,te-1,4,ee+1,5,s);for(let c=6;c<9;c++)E(n,te-1,c,s),E(n,te,c,s),E(n,ee,c,s),E(n,ee+1,c,s);for(let c=te;c<=ee;c++)E(n,c,5,s);if(l){for(let c=3;c<6;c++)for(let h=6;h<12;h++)Jf(Zf(n,h,c),s)&&E(n,h,c,t);E(n,8,5,s)}const u=a==="L"?6:11;for(let c=2;c<6;c++)E(n,u,c,o);for(let c=te;c<u;c++)Zn(n,c,3)&&E(n,c,3,i);for(let c=te;c<=ee;c++)Zn(n,c,2)&&E(n,c,2,i)},OM=(n,e)=>{const[t,r]=nt(e);_e(n,te,2,ee,4,r);for(let i=te-1;i<=ee+1;i++)E(n,i,3,r);_e(n,te-1,4,ee+1,5,r);for(let i=te;i<=ee;i++)E(n,i,5,r);for(let i=6;i<=12;i++)E(n,i,6,r);E(n,9,7,r),E(n,10,7,r),E(n,11,7,r);for(let i=6;i<9;i++)E(n,te-1,i,r),E(n,te,i,r),E(n,ee,i,r),E(n,ee+1,i,r);for(let i=te;i<=ee;i++)Zn(n,i,2)&&E(n,i,2,t);for(const i of[7,8,9])E(n,i,6,t)},LM=(n,e,t,r)=>{const[i,s,o]=nt(e),a=r.length??17,l=r.vol??1;_e(n,te-1,2,ee+1,5,s);for(let u=te-1;u<=ee+1;u++)E(n,u,3,s);for(let u=te;u<=ee;u++)E(n,u,5,s);for(let u=6;u<12;u++)E(n,u,6,s);E(n,8,6,t),E(n,9,6,t);for(let u=6;u<=a;u++){for(let c=0;c<l;c++)E(n,te-1-c,u,s),E(n,ee+1+c,u,s);E(n,te,u,s),E(n,ee,u,s)}for(let u=te-1;u<te+1;u++)E(n,u,a+1,s);for(let u=ee;u<ee+2;u++)E(n,u,a+1,s);for(let u=2;u<6;u++)Zn(n,ee,u)&&E(n,ee,u,o);for(let u=te;u<9;u++)Zn(n,u,2)&&E(n,u,2,i)},UM=(n,e,t)=>{const[r,i]=nt(e);_e(n,te,3,ee,5,i);for(let s=te-1;s<=ee+1;s++)E(n,s,4,i);for(let s=te;s<=ee;s++)E(n,s,5,i);for(let s=6;s<12;s++)E(n,s,6,i);E(n,8,6,t),E(n,9,6,t);for(let s=6;s<9;s++)E(n,te,s,i),E(n,ee,s,i);_e(n,7,1,10,2,i);for(let s=te;s<=ee;s++)Zn(n,s,3)&&E(n,s,3,r)},NM=(n,e,t)=>{const[r,i]=nt(e),s=[[4,3],[5,2],[6,3],[7,2],[8,3],[9,2],[10,3],[11,2],[12,3],[13,3],[3,4],[4,4],[13,4],[14,4],[3,5],[4,5],[13,5],[14,5],[3,6],[13,6],[4,6],[12,6],[3,7],[13,7],[4,7]];_e(n,te,3,ee,5,i);for(let o=te-1;o<=ee+1;o++)E(n,o,4,i);for(const[o,a]of s)E(n,o,a,i);for(let o=6;o<12;o++)E(n,o,6,i);E(n,8,6,t),E(n,9,6,t);for(const[o,a]of[[5,2],[7,2],[9,2],[11,2]])E(n,o,a,r)},zM=(n,e,t,r)=>{const[i,s]=nt(e),o=r.length??8;_e(n,te-1,2,ee+1,5,s);const a=[[3,2],[5,1],[7,2],[9,1],[11,2],[13,1],[14,2],[4,2],[12,2]];for(const[l,u]of a)E(n,l,u,s);for(let l=te;l<=ee;l++)E(n,l,5,s);for(let l=6;l<12;l++)E(n,l,6,s);E(n,8,6,t),E(n,9,6,t);for(let l=6;l<=o;l++)E(n,te-1,l,s),E(n,te,l,s),E(n,ee,l,s),E(n,ee+1,l,s);for(const[l,u]of a)E(n,l,u,i)},WM=(n,e,t)=>{const[,r,i]=nt(e);for(let s=4;s<10;s++)E(n,te-1,s,r),E(n,te,s,r),E(n,ee,s,r),E(n,ee+1,s,r);for(let s=te;s<=ee;s++)E(n,s,4,r);for(let s=te+1;s<ee;s++)E(n,s,5,r);for(let s=5;s<9;s++)for(let o=6;o<12;o++)Jf(Zf(n,o,s),r)&&E(n,o,s,t);for(let s=te;s<=ee;s++)Zn(n,s,4)&&E(n,s,4,i)},HM=(n,e,t)=>{const[r,i]=nt(e);_e(n,te,3,ee,5,i);for(let o=te-1;o<=ee+1;o++)E(n,o,4,i);for(let o=te;o<=ee;o++)E(n,o,5,i);const s=[[5,2],[7,1],[9,2],[11,1],[6,2],[8,2],[10,2],[12,2]];for(const[o,a]of s)E(n,o,a,i);for(let o=6;o<12;o++)E(n,o,6,i);E(n,8,6,t),E(n,9,6,t);for(let o=6;o<8;o++)E(n,te,o,i),E(n,ee,o,i);for(const[o,a]of s)E(n,o,a,r)},VM=(n,e,t,r)=>{const[i,s,o]=nt(t,1.1,.82);for(let c=6;c<=11;c++)E(n,c,2,s);for(let c=5;c<=12;c++)E(n,c,3,s);for(let c=te;c<=ee;c++)E(n,c,4,s);for(const c of[7,8,9])E(n,c,2,i);E(n,6,3,i),E(n,7,3,i),E(n,5,3,o),E(n,12,3,o),E(n,ee,4,o);const[,a,l]=nt(e),u=r.recede?8:6;for(let c=u;c<=10;c++)E(n,te-1,c,a),E(n,te,c,a),E(n,ee,c,a),E(n,ee+1,c,a);for(let c=u;c<=10;c++)E(n,te-1,c,l),E(n,ee+1,c,l)},jM={styleShort:GM,styleFloppy:OM,styleFrame:LM,styleBun:UM,styleCurly:NM,styleMessy:zM,styleRecede:WM,styleSpiky:HM,styleBald:VM};function $M(n,e,t){const[,r,i]=nt(t);if(e==="mustache"){for(const s of[6,7,8,9,10])E(n,s,13,r);E(n,6,12,r),E(n,10,12,r)}else if(e==="mustacheSm")for(const s of[7,8,9])E(n,s,13,r);else if(e==="stubble")for(const[s,o]of[[5,14],[6,15],[7,15],[8,15],[9,15],[10,15],[11,14],[12,13],[4,13],[5,15],[10,15]])E(n,s,o,i,150);else if(e==="goatee"){for(const s of[8,9])E(n,s,15,r);E(n,8,14,r),E(n,9,14,r);for(const s of[7,8,9,10])E(n,s,13,r)}}function XM(n){const e=[60,54,62],t=[236,240,246];for(const r of[5,6])E(n,r,8,e),E(n,r,10,e);E(n,4,9,e),E(n,7,9,e),E(n,4,8,e),E(n,7,8,e);for(const r of[10,11])E(n,r,8,e),E(n,r,10,e);E(n,9,9,e),E(n,12,9,e),E(n,9,8,e),E(n,12,8,e),E(n,8,8,e),E(n,3,9,e),E(n,13,9,e),E(n,4,8,t),E(n,9,8,t)}const Gg=[44,40,48];function YM(n,e,t){const[,r,i]=nt(e);for(const[a,l]of[[5,7],[10,12]]){_e(n,a,25,l,30,r);for(let u=25;u<=30;u++)E(n,l,u,i)}const s=t!==1,o=t!==2;_e(n,5,s?31:30,7,s?31:30,Gg),_e(n,10,o?31:30,12,o?31:30,Gg)}function KM(n,e,t){const[r,i,s]=nt(e.c1);if(e.heavy){_e(n,3,18,14,18,i),_e(n,2,19,15,19,i),_e(n,2,20,15,24,i);for(let a=20;a<=24;a++)E(n,2,a,s),E(n,15,a,s),E(n,14,a,s)}else{_e(n,4,18,13,18,i),_e(n,3,19,14,19,i),_e(n,4,20,13,24,i);for(let a=20;a<=24;a++)E(n,3,a,s),E(n,14,a,s),E(n,13,a,s)}if(t){_e(n,6,18,11,18,s);for(let a=19;a<=24;a++)E(n,8,a,s);return}const o=hi[e.skin];if(e.cloth==="suit"){const a=[238,238,236];for(const[l,u]of[[8,18],[9,18],[7,19],[8,19],[9,19],[10,19],[8,20],[9,20]])E(n,l,u,a);for(const[l,u]of[[6,19],[7,20],[11,19],[10,20]])E(n,l,u,s);if(e.tie){for(let l=19;l<=24;l++)E(n,8,l,e.tie),E(n,9,l,e.tie);E(n,8,19,nt(e.tie)[0])}}else if(e.cloth==="dressshirt"){for(const[a,l]of[[6,18],[7,18],[10,18],[11,18],[7,19],[10,19]])E(n,a,l,s);if(e.tie)for(let a=18;a<=24;a++)E(n,8,a,e.tie),E(n,9,a,e.tie);else for(let a=20;a<=24;a+=2)E(n,8,a,s)}else if(e.cloth==="polo"){for(const[a,l]of[[6,18],[7,18],[10,18],[11,18]])E(n,a,l,r);E(n,8,19,s),E(n,8,21,s)}else if(e.cloth==="blouse"){for(const[a,l]of[[7,18],[8,18],[9,18],[10,18],[8,19],[9,19]])E(n,a,l,o.sh);for(let a=5;a<13;a++)Jf(Zf(n,a,19),i)&&E(n,a,19,r)}else if(e.cloth==="cardigan"){const a=e.c2?nt(e.c2)[1]:[235,233,226];for(let l=18;l<=24;l++)E(n,8,l,a),E(n,9,l,a);for(const[l,u]of[[6,18],[7,18],[10,18],[11,18]])E(n,l,u,s)}else if(e.cloth==="sweater")for(const[a,l]of[[6,18],[7,18],[8,18],[9,18],[10,18],[11,18]])E(n,a,l,s)}function qM(n,e){var l,u;const t=hi[e.skin];if(e.hair==="styleBald"){QM(n,e);return}const[r,i,s]=nt(e.hairc),o=[[2,6,11],[3,5,12],[4,4,13],[5,4,13],[6,4,13],[7,4,13],[8,4,13],[9,4,13],[10,4,13],[11,4,13],[12,4,13],[13,5,12],[14,6,11]];for(const[c,h,d]of o)_e(n,h,c,d,c,i);const a=e.hair==="styleFrame"?((l=e.hairargs)==null?void 0:l.length)??17:e.hair==="styleMessy"?((u=e.hairargs)==null?void 0:u.length)??9:0;for(let c=11;c<=a;c++)E(n,te-1,c,i),E(n,te,c,i),E(n,ee,c,i),E(n,ee+1,c,i);for(let c=4;c<=12;c++)E(n,4,c,s),E(n,13,c,s);for(const[c,h]of[[5,3],[12,3],[5,13],[12,13],[6,14],[11,14]])E(n,c,h,s);for(const[c,h]of[[7,2],[8,2],[9,2],[10,2],[7,3],[8,3],[9,3]])E(n,c,h,r);for(let c=4;c<=11;c++)E(n,9,c,r);for(let c=4;c<=12;c++)E(n,8,c,s);_e(n,7,14,10,14,s),_e(n,7,15,10,17,t.sh),_e(n,7,15,9,15,t.base)}function QM(n,e){const t=hi[e.skin],[r,i,s]=nt(t.base,1.1,.82),o=[[2,6,11],[3,5,12],[4,4,13],[5,4,13],[6,4,13],[7,4,13],[8,4,13],[9,4,13],[10,4,13],[11,4,13],[12,4,13],[13,5,12],[14,6,11]];for(const[u,c,h]of o)_e(n,c,u,h,u,i);for(let u=4;u<=12;u++)E(n,4,u,s),E(n,13,u,s);for(const[u,c]of[[7,2],[8,2],[9,2],[8,3],[9,4],[9,5]])E(n,u,c,r);const[,a,l]=nt(e.hairc);for(let u=4;u<=13;u++)E(n,u,11,a),E(n,u,12,a);for(const u of[4,13])E(n,u,11,l),E(n,u,12,l);_e(n,7,14,10,14,t.sh),_e(n,7,15,10,17,t.sh),_e(n,7,15,9,15,t.base)}function ZM(n,e,t,r){KM(n,e,r),YM(n,n8(e),t)}function JM(n){const e=[];for(let t=0;t<lu;t++)for(let r=0;r<ai;r++)if(Zn(n,r,t)===0){for(const[i,s]of[[1,0],[-1,0],[0,1],[0,-1]])if(Zn(n,r+i,t+s)===255){e.push([r,t]);break}}for(const[t,r]of e)E(n,t,r,BM)}function e8(n,e){const t=hi[e];for(let r=11;r<=15;r++)E(n,te-1,r,t.base),E(n,ee+1,r,t.base);E(n,te-1,15,t.sh),E(n,ee+1,15,t.sh);for(const r of[5,6,11,12])E(n,r,16,t.base);_e(n,6,17,11,18,t.base);for(const r of[6,7,8,9,10,11])E(n,r,18,t.sh);E(n,7,17,t.sh),E(n,10,17,t.sh)}const Og={michael:{skin:"light",hairc:[58,42,28],hair:"styleShort",hairargs:{part:"L"},cloth:"suit",c1:[58,63,74],tie:[170,58,58],brow:"flat",mouth:"smile"},jim:{skin:"light",hairc:[92,60,34],hair:"styleFloppy",cloth:"dressshirt",c1:[172,196,224],tie:[120,130,150],brow:"flat",mouth:"smile"},pam:{skin:"light",hairc:[120,76,42],hair:"styleFrame",hairargs:{length:18,vol:2},cloth:"cardigan",c1:[236,174,192],c2:[244,242,238],brow:"soft",mouth:"smile",blush:!0,lashes:!0},dwight:{skin:"light",hairc:[64,48,28],hair:"styleShort",hairargs:{part:"L",recede:1},cloth:"dressshirt",c1:[184,155,62],tie:[120,82,46],glasses:!0,brow:"angry",mouth:"neutral"},kevin:{skin:"light",hairc:[58,44,30],hair:"styleBald",cloth:"polo",c1:[110,140,180],c2:[90,120,160],brow:"flat",mouth:"neutral",heavy:!0},angela:{skin:"light",hairc:[186,154,90],hair:"styleBun",cloth:"cardigan",c1:[150,146,170],c2:[235,233,226],brow:"angry",mouth:"frown",lashes:!0},oscar:{skin:"tan",hairc:[28,22,18],hair:"styleShort",hairargs:{part:"L"},cloth:"sweater",c1:[122,60,74],brow:"flat",mouth:"smile"},stanley:{skin:"dark",hairc:[60,54,48],hair:"styleRecede",cloth:"dressshirt",c1:[150,120,86],tie:[120,78,52],glasses:!0,facial:"mustache",brow:"flat",mouth:"neutral",heavy:!0},phyllis:{skin:"light",hairc:[196,162,110],hair:"styleCurly",cloth:"blouse",c1:[202,160,192],glasses:!0,brow:"soft",mouth:"smile",lashes:!0,heavy:!0},andy:{skin:"light",hairc:[74,51,32],hair:"styleShort",hairargs:{part:"R"},cloth:"polo",c1:[176,65,58],c2:[150,50,46],brow:"raised",mouth:"smile"},kelly:{skin:"tan",hairc:[24,18,22],hair:"styleFrame",hairargs:{length:20,vol:1},cloth:"blouse",c1:[212,90,158],brow:"soft",mouth:"smile",blush:!0,lashes:!0},ryan:{skin:"light",hairc:[42,32,24],hair:"styleSpiky",cloth:"suit",c1:[58,58,68],tie:[40,40,50],brow:"flat",mouth:"neutral"},toby:{skin:"light",hairc:[106,90,66],hair:"styleShort",hairargs:{part:"L",recede:1},cloth:"dressshirt",c1:[150,150,120],facial:"mustacheSm",brow:"soft",mouth:"frown"},creed:{skin:"light",hairc:[170,166,156],hair:"styleBald",cloth:"dressshirt",c1:[126,130,96],facial:"stubble",brow:"flat",mouth:"neutral"},meredith:{skin:"light",hairc:[154,82,46],hair:"styleMessy",hairargs:{length:15},cloth:"blouse",c1:[176,86,74],brow:"raised",mouth:"smile",lashes:!0}};function t8(n,e){const t=hi[e.skin].base;DM(n,e.skin),e.heavy&&e8(n,e.skin),FM(n,e.skin,e.brow??"flat",e.mouth??"neutral",e.blush??!1,e.lashes??!1),e.facial&&$M(n,e.facial,e.hairc),jM[e.hair](n,e.hairc,t,e.hairargs??{}),e.glasses&&XM(n)}function n8(n){return n.pants?n.pants:n.cloth==="suit"?nt(n.c1)[2]:[54,56,70]}function Ci(n,e,t){ai=Nl,lu=zl;const r=new Uint8ClampedArray(Nl*zl*4);return ZM(r,n,e,t),t?qM(r,n):t8(r,n),JM(r),r}const Lg=new Map;function r8(n){let e=Lg.get(n);if(!e){const t=Og[n]??Og.jim;e={front:[Ci(t,0,!1),Ci(t,1,!1),Ci(t,2,!1)],back:[Ci(t,0,!0),Ci(t,1,!0),Ci(t,2,!0)]},Lg.set(n,e)}return e}const i8=[{name:"michael",displayName:"Michael",shirt:"#5a6b8c",blurb:"World's best boss"},{name:"jim",displayName:"Jim",shirt:"#6fa8dc",blurb:"Salesman, prankster"},{name:"pam",displayName:"Pam",shirt:"#9caf88",blurb:"Receptionist, artist"},{name:"dwight",displayName:"Dwight",shirt:"#b89b3e",blurb:"Assistant (to the) RM"},{name:"kevin",displayName:"Kevin",shirt:"#4a7ab5",blurb:"Accounting"},{name:"angela",displayName:"Angela",shirt:"#8a86a6",blurb:"Head of accounting"},{name:"oscar",displayName:"Oscar",shirt:"#7a4b6b",blurb:"Accountant"},{name:"stanley",displayName:"Stanley",shirt:"#8c5a4b",blurb:"Sales, crossword"},{name:"phyllis",displayName:"Phyllis",shirt:"#b08bbf",blurb:"Sales"},{name:"andy",displayName:"Andy",shirt:"#6fae6f",blurb:"Cornell, a cappella"},{name:"kelly",displayName:"Kelly",shirt:"#d16ba5",blurb:"Customer service"},{name:"ryan",displayName:"Ryan",shirt:"#3a3a44",blurb:"The temp"},{name:"toby",displayName:"Toby",shirt:"#9a8c5a",blurb:"Human resources"},{name:"creed",displayName:"Creed",shirt:"#6b7a4b",blurb:"Quality assurance"},{name:"meredith",displayName:"Meredith",shirt:"#b5544a",blurb:"Supplier relations"}],s8=Object.fromEntries(i8.map(n=>[n.name,n])),Qh="jim";function o8(n){return parseInt(n.replace("#",""),16)}const Ug=new Map;function a8(n){const e=document.createElement("canvas");e.width=Nl,e.height=zl;const t=e.getContext("2d"),r=t.createImageData(Nl,zl);r.data.set(n),t.putImageData(r,0,0);const i=Q.from(e);return i.source.scaleMode="nearest",i}async function l8(n){const e=Ug.get(n);if(e)return e;const{front:t,back:r}=r8(n),i=a=>{const[l,u,c]=a.map(a8);return[l,u,c,l,l,l,l]},s=i(t),o=[s,i(r),s];return Ug.set(n,o),o}const Zh=(n,e)=>n[(e%n.length+n.length)%n.length],u8=["is this… decaf?? who did this","we're out of beans again","World’s Best Boss mug","first cup of the day. and the fifth.","the coffee here is basically a hug","who took my mug?"],c8=["the machine ate my dollar","B4… please be the pretzels","it’s stuck. classic.","shaking it. gently. respectfully.","one (1) emotional-support snack","A1 again. living dangerously."],h8=["is it Pretzel Day?","who finished the chips??","just a little treat","these are everyone’s? cool cool cool","second breakfast"],d8=["big day. lots of meetings.","just five more minutes","did you see the standup notes?","pretending to read my notes","I needed this break, honestly","do NOT tell Michael I’m in here"],f8={coffee:u8,vending:c8,snack:h8,table:d8},p8={michael:["I DECLARE… BANKRUPTCY!","that's what she said","I'm not superstitious. just a little stitious.","no meetings before coffee. that’s the rule."],dwight:["FALSE.","identity theft is not a joke","that mug is regulation","this fridge needs a beet drawer","Schrute Farms has better coffee"],jim:["...that's what she said","bears. beets. Battlestar Galactica.","I moved Dwight’s stapler again","just here for the gossip"],pam:["Dunder Mifflin, this is Pam","sketching the vending machine","the watercolor of the break room"],kevin:["the chili is NOT ready","why waste time say lot word","me want snack","cookie? cookie."],angela:["this break room is filthy","party planning committee, 3pm","I’m judging the fridge"],oscar:["actually, it’s “espresso”","well, actually…","the budget for snacks is concerning"],stanley:["is it Pretzel Day?","did I stutter?","crossword and coffee. leave me be.","I'll retire before this brews"],phyllis:["Bob is picking me up at five","knitting and a nice cup of tea"],andy:["Cornell, ever heard of it?","rit-dit-dit, coffee break!","Big Tuna, grab a chair"],kelly:["did you HEAR what happened??","so. much. to tell you.","I am the GOSSIP queen"],ryan:["I’m kind of a big deal","the temp needs caffeine","starting a coffee startup, actually"],toby:["I should write that up…","HR-wise this break is fine","no one ever sits with me"],creed:["which one of you is the new guy?","I’ve eaten worse out of that fridge","mung beans. under my desk."],meredith:["is it 5 o’clock yet?","someone spike the coffee?"]};function m8(n,e,t){const r=p8[n];return r&&t%5<3?Zh(r,Math.floor(t/5)):Zh(f8[e],t)}const g8=[["world’s best boss.","you are. I had the mug made.","and I cherish it."],["would an idiot do this?","...if yes, I don’t.","that’s my boy."],["feared or loved? both.","that’s beautiful.","I know."],["I edited your wiki page again.","I know. thank you."],["question. how many bears?","one.","that’s too many."],["fact: bears eat beets.","bears. beets. Galactica.","what is happening."],["I grew up on a beet farm.","shocking.","...not shocking at all."],["what’s Schrute Farms smell like?","victory. and beets."],["did you just throw your phone?","didn’t like what it said.","cool."],["is a hot dog a sandwich?","it is.","I know, right?"],["three-hole-punch Jim returns.","never gets old."],["why few word when lot word?","...genuinely profound.","I know."],["I am not a bad person.","...","not a great person either.","there it is."],["I love my cats more than people.","including us?","especially you."],["cats are better than dogs.","dogs are better.","...sorry."],["do you love me?","I love… being here.","that’s a yes."],["I’m kind of a big deal.","you are?","in my mind. yes."],["did you miss me?","no.","a little?","...there it is."],["did you just roll your eyes?","I did.","why?","muscle memory."],["I’ve watched that clock since 4.","weren’t you working?","watching the clock."],["what do we sell again?","paper.","sure, yeah."],["how old are you?","yeah.","that’s not an answer.","sure it is."],["that’s not how math works.","I know.","then why?","faster."],["I’m not an alcoholic.","you went to a meeting.","for the food."],["I went to Cornell.","nobody cares.","I went to Cornell.","still nobody cares."],["I have a lot of feelings.","I can tell.","is that bad?","for us? yes."],["why are you the way you are?","...","honestly."],["your cat died.","I know.","I’m sorry.","...thank you."],["stop looking at me.","you stop looking at me."],["sign this.","what is it?","doesn’t matter.","...fine."],["you can’t say that.","I just did.","gonna stop me?","...no."],["that’s a fire lane.","fire hasn’t happened yet."],["I wrapped your stapler in Jello.","I’ll eat around it.","fair."],["zombie attack plan?","especially that.","of course."],["just seeing if you’d answer.","I hate you.","I know."],["a little stitious, not super.","that’s not a word.","it is now."],["funniest person in the office?","and other times?","other times I know it."],["that’s what she said.","...every time.","come on."],["I started the fire.","no you didn’t.","in our hearts, I did."],["is today a day ending in Y?","yes.","then no."],["Bob Vance.","Phyllis Vance.","Vance Refrigeration."],["you look beautiful today.","...I know."],["I’m better than you in every way.","probably.","definitely.","sure."],["I’m a nice guy.","you’re okay.","nicest thing you’ve said."],["are you okay?","I’ve been worse.","when?","can’t narrow it down."],["there’s a spider on your desk.","where?","...you ate it.","protein."],["soul mates can be bosses.","you’re my boss.","exactly."],["standup ran 40 minutes.","could’ve been an email."],["is the build green yet?","...don’t look."],["who reply-all’d everyone?","we don’t talk about it."]],y8=[["taking way longer than I expected.","that’s what she said."],["it’s too big, can’t fit it in my mouth.","that’s what she said."],["you really need to slow down.","that’s what she said."],["gonna need a bigger one.","that’s what she said."],["help, I can’t get it to go in.","that’s what she said."],["it’s not that hard if you just push.","that’s what she said."],["I can’t do this all night.","that’s what she said."],["I need it now, I can’t wait.","that’s what she said."],["so hot in here, I’m sweating.","that’s what she said."],["it keeps slipping out of my hands.","that’s what she said."],["why not just stick it in already?","that’s what she said.","*looks at camera*"],["I just need a few more inches.","that’s what she said.","for the shelf!","still counts."],["make it louder, I can barely feel it.","that’s what she said."],["can we get this over with quickly?","that’s what she said.","I meant the meeting.","sure."],["I just need you to hold it steady.","that’s what she said."],["can’t believe I did that all morning.","that’s what she said."],["my hands are cramping.","that’s what she said.","from typing!","that’s what she said."],["hours in and barely halfway done.","that’s what she said."],["surprisingly heavy for its size.","that’s what she said."],["be more precise. less sloppy.","that’s what she said.","I meant the spreadsheet.","I know."],["how long was it?","that’s what she said.","*the whole room goes quiet*","I’m sorry, I can’t help it."],["too tight, cutting off my circulation.","that’s what she said.","*mouths thank you*"],["I don’t think it’ll fit.","that’s what she said.","*stands up and applauds*"],["stop, you’re doing it wrong.","that’s what she said.","never been prouder."],["this just keeps getting harder.","that’s what she said.","he’s ready."],["not wide enough, I need more room.","that’s what she said."],["I can hold it a really long time.","that’s what she said.","my breath!","still."],["why is it taking so long?","that’s what she said.","I hate you.","then why set me up?"],["I can’t do it with people watching.","that’s what she said.","the presentation!","sure."],["it’s deeper than it looks.","that’s what she said.","the pothole, Michael!","doesn’t matter."],["so much longer than last time.","that’s what she said.","the report, Michael.","right, right."],["oh my god, it went on FOREVER.","that’s what she said.","the Twilight movie!","classic."],["can’t believe how thick this is.","that’s what she said.","the folder. *stares*"],["I fit all THAT in one day?","that’s what she said.","that’s actually what I said!","meta."],["I went at it hard this morning.","that’s what she said.","at the gym!","irrelevant."],["someone help me finish this off.","that’s what she said.","the leftover cake!","still works."],["get in, do my thing, get out.","that’s what she said.","*doesn’t look up from crossword*"],["can’t believe it took this long.","that’s what she said.","the raise. eight years.","that one’s on me."],["do it slower, it’ll hurt less.","that’s what she said.","for the quarterly review.","sure, Oscar."],["didn’t realize how big it’d be.","that’s what she said.","the calzone, it’s enormous!","I love this office."],["*to no one* that’s what she said.","nobody said anything.","just thinking about earlier."],["*on the phone* that’s what she said.","who was that?","my mother. about a sandwich."],["too hot in here! that’s what she said.","you said both parts.","I contain multitudes."],["*at the TV* that’s what she said.","you’re alone, Michael.","she doesn’t know that."],["you need to be more professional.","that’s what she said.","I am she.","...that’s what she said."],["stop. just stop. every time—","that’s what she said.","*leaves the room*","*whispers* that’s what she said."],["as you can see, it’s going up.","that’s what she said.","*everyone groans*","set that one up myself."],["I declared bankruptcy once. felt good.","what does that have to do with—","that’s what she said.","it doesn’t.","I know."],["you didn’t say it.","I know.","why not?","I’m growing.","...that’s what she said.","there it is."],["impressive you held back today.","thank you.","I counted zero times.","that’s what she said.","still counts."]],_8=[...g8,...y8],x8={michael:["that’s what she said.","...there it is."],dwight:["identity theft is not a joke.","nobody touched your stapler, Dwight."],kevin:["why few word when lot word?","...just use the words, Kevin."],kelly:["okay don’t freak out, but—","I’m already freaking out."],oscar:["well, actually—","...here we go."],angela:["this table is filthy.","it’s a break room, Angela."],creed:["which one are you again?","...we sit next to each other."],stanley:["is it Pretzel Day?","no, Stanley.","...did I stutter?"],andy:["I went to Cornell.","nobody cares.","...I went to Cornell."],jim:["question.","yes.","nothing. just checking."]};function v8(n,e){const t=x8[n];return t&&e%4===0?t:Zh(_8,e)}const b8=""+new URL("office-tileset-CHQT-uYL.png",import.meta.url).href,w8="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAIACAYAAABtmrL7AAAAAXNSR0IArs4c6QAADmFJREFUeJzt3c2PHGedB/Bf2x2P7RBAWUI2K0GQ4oNfolXyB5BEEV57j7snJEBIcIhIQFGQwj/BASGUSDmtEBxX4oitQVbs3Ts+rF+EyMGJFhSSzSpvtscZezi0n4mnPD3V1V0vPfP7fC6VaXfVU1Vd+T6/rup6ahQteer40YiIOHnqVERE/PwXvyyvb7TVxhAuXr46ioh49ZWXIyJi9ezZ8vqwK1ZR9n9E7Or9vQuMYgk//3ntG3oFgOGM215gtef/46UrbTfRq6dPHNuIyXaNYmtPu9Rm3e9PnzjW6P17RdPtLu/fa1QAkFjrFcBe6fmLsh2lEijfAWEvUAFAYgIAEhMAkJgAgMQEACTW+lWAWS3bddW9ctWiaLp/l+3z6EvW7S5UAJDYYBVAsXruzKDtn3z+9KDtd2XW/Vq2f+jPoW9Nt3uvHicqAEhMAEBiAgASEwCQmACAxAQAJCYAIDEBAIkJAEhMAEBiAgASEwCQmACAxAQAJCYAIDEBAIkJAEhMAEBiAgASEwCQmACAxAQAJCYAIDEBAIkJAEhMAEBiAgASEwCQmACAxAQAJCYAIDEBAIkJAEhMAEBiAgASEwCQmACAxAQAJCYAIDEBAIkJAEhMAEBiAgASEwCQmACAxAQAJCYAIDEBAIkJAEhs1NaCnjp+tPznRkTEHy9d2fH9T5841lbTrWiwvqOIiIuXry7U3j37q20bXS2YiDb/n7nXosfTvFQAkNh46BXI6oUXX4qIiDdef02Pvbu0+nm98OJLo4iIH/34J20udmYqAEhssAqg7jv3XvfEkSMRA+6H6jmYbJ/Hsmz/6tkzg7RbqAAgMecABnLy1OmhV4ElMPRxoAKAxAQAJCYAILHWzwFcvHx1FJOzrDP9InDZlbPFZbva+gVfOfs79HdAhuUqADCY1iuAV195OSIifv6LX26pBHar0vOX7Vo9e7aV5b715z9HRMTPftrNPRFNK69luzdj2XS1f8ovQoeiAoDEurgbMIVlvxuw6d2NiS3F/nI3INC71s4BDJVgu1Xb+2vRiiLb52d/TagAIDEBAIkJAEhMAEBiAgASEwCQmACAxAQAJCYAIDEBAIkJAEhMAEBiAgASEwCQmACAxFobD6DvEYGWeESeXcn+aKbt/WVEIKB345JkLSZQ16MAtzImWxmN9Y3XX9vVoxZP02AU2z25/U0NuL8GHZNRBQCJdfZ04AajrM71/kU9ceTITO3udWW/Zt8PfVuW5zCoACCxziqAZeeZfKACgNQEACQmACCxtAGwevbM4M9mh6GlDQAg8VWAtZvXI5boeuzQ7IecVACQWOIK4NOIiFg91+55gJPPT35f0NUvIYda37Y13f693v5QVACQ2HivPOe8qWefe2boVYDBqQAgMQEAiQkASEwAQGICABITAJCYAIDEBAAkJgAgMQEAiQkASEwAQGICABITAJCYAIDEBAAkJgAgsfFTx49GRETbIwO9/+61Tt8PbVqWMfr6pgKAxNKOCQj3MiowkI4AgMQEACQmACAxAQCJCQBITABAYmmfDty1ptd5l+W68FCyb/9QVACQmAqgI6vnzuz47yefP73Q+/eauu1v217fn7NSAUBiAgASEwCQmACAxAQAJCYAIDEBAIkJAEhMAEBiAgASEwCQmACAxAQAJCYAIDEBAImlDYDzb16I829eGHo1YFBpAwDocESgpiOuDDVCy24bGWa3rS/LTQUAiXVRAYw6WGZn2h6LrvTQX3n08Ubzzfr+ttf37Jk/jCIiVs9OlnvyVLcVRmnn2PETERFx5fKljU4brHHs+IlBtv+FF1+KiIg3Xn+t0/bqqAAgsdYqgIuXr7a1qF48+9wzQ6/CUjh1+lsREfHIP36j13afOn601/amuXL5UkRE/Mvpfx16VQahAoDEBAAkJgAgMQEAiQkASEwAQGICABITAJCYAIDEBAAkJgAgMQEAiQkASEwAQGICABITAJCYAIDEBAAkJgAgMQEAiQkASEwAQGICABITAJCYAIDEOns68LI7/+aFCE8I2twP5KQCgMTSVgDXrr0dcc/TfHeLttf3e9//bqvLm9du+xz2ChUAJJa2AvjNr39b/nPU8qK7ft59q+t7z34YStv7nwZUAJBY2grg4uWrEfc8p778Pa++n3e/6PoObbev/16hAoDEBAAkJgAgMQEAiQkASEwAQGICABJL+zuArj194lin74c2qAAgMRVAR1bPndnx36t3vzV9P7RBBQCJCQBITABAYgIAEhMAkJgAgMQEACQmACAxAQCJCQBITABAYgIAEhMAkJgAgMQEACQmACAxAQCJCQBITABAYp7N3pLydODvff+7ERHx+ONfj4iIZ597Zsv7zr95ISIiLpz/ry2vP/PsN3d8/7Vrb0dExG9+/dsIT9elJSoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJjTqDzVtm9PHDsRERFHjj25ZdqX26O1yvRWr+1/evOBiIi4vlamB3pt/6sHJ9v96KEy7Xf7r98+GBERN+5sndZZX1/f9vXxeNxo/ocOTqZfPDSZPvyFmWaPz25t3/4DB2Zrv8z/lw8n+/v/125HRMQnG5MHdR9emW05TV1fW787nbR34+7U04EhsXFEbAzR8FtXLkVExOl///YQzcf+jZWIiLi17+NB2n/w4GcREfH+Rw8O0v7fbk62/58fHmb7D++/GRERH6x/udF8paf/5NPrERHxhQcPzzX/e3d74G880mj2zZ7+4w8+iYiIh2YtHSrzP3x3+y9+ODkOvvZIs+1oqlQW//fR1kpPBQCJdfOFA5hJ1z3/tPbeeW9SQakAIDEVACRUKgEVACSmAoCEnAMABABkJgAgMQEAiQkASEwAQGICABLzOwCWQvXuvrq/q/Mtqnp3X93f1fl2KxUAJKYCYClUe/a6v+ter1OtHKo9e93fda/XWZbKQQUAiQkASEwAQGICABITAJCYAIDEBAAk5ncAkJAxAQEVAGRkTEBABQBDKj1xX08IKu0VKgBITAXAoNq6n3/e8QTauitv3vEEimolUO2p51W3PBUAJDb673P/sRE93p9cTcDf/c/BiIg48OhKL+3fendty99H/2Hr8+ZntejINGX+P33wdsQc3wGriT7v/Hc2/ilijv1f3Y/zzv9vT96MmOP4W3RknjJ/Of6q2j4eq/ur2Df6y7avt31OQAUA3Gfc98gk1e9CffX8RWmvJPK8PXd1vmmvT1PeN2/PXZ2v6dnk8r6/jubruauf27TXpynv+/iD9xu1X/1OXff6NJ+/b2sF0NXxWD3upunqasC0cwEqAEhssKsAnyfwlwZpfzPpP7w10/vrevhpZ53bUtfDVxO+7Z6kroev9nBt96R1Pfy0s+6zWrSimaa6nGmVwKIV3TTV5VSPExUAJDZYBbB5Fve9YdrfTODtTwJvmve7fVuVwLzf7dvqQeb9bt9WDzrvd/tZ5+uq568uf1ol8NhGNz1/Me14cDcg4JeA0yzagy9aCSzaEyxaCSzaEy5aCcz7Xb6Y95xA11cB6nR9FaBKBQCJqQAq2j6L37QS6Os74DR9fQeeZtGev2rRqwN7nQoAElMB3NXV9fuirhLo+r7wukqgq+v3RV0l0HUPrRLYngoAEktfAXTd81dVK4E/vTf5LXxfI8JUK4E7G932/FXVSuChJ/vtke+7L3+g36EsCxUAJCYAIDEBAImlPwfQ9V18VdV2ur6Lr6raThkPoOurAEW1nTIeQF9n5+9vZ5i7UZeFCgASS18BFF1XAnXL7boSqFtu1/fz1y236+v0rv9vTwUAiakAKtquBJoup+1KoOly2q4Emi6n7UpAz78zFQAkZkzAKWMCLloJLFpBLFoJLFpBLFoJLFpBLFoJzDvfUOdAir7PAakAIDFjAtaMCdi0Emj7KkLTSqDtHqRpJdB2D9q0Emja89eN2tvVOZDy+jujnUft7eockFGBgRj3fZa0+ky3vn6BVm2vqbpKoOtfEtb1DF3/krCuZ+z6c6yrBBY9jqdVAouatp+qpo3au6hpx0mhAoDENs8BzPoc86ZmXV41geftqavqlrfouP/V12c173gA057xNv/TgRcb97/6+qzmHQ9g2vE099OFKw/n7foqQJ2urwJUqQAgsdHv//NXG9v9Q1sVQDEtof+6dngUEXHlk+3bu7N2Z6729q1sn21leQ8dGEVExKH9k78P75tM12/f3nG54/37J9Px/i2vr6/fbjT/jTuTHmH0wOT9t0eTvw+v7Hxh5vra+t3p1nYOr+xvNv/NA5P1uHs34L6VByfTg/t3mDvizs3bd6dbP5d9B/c1mv+xlc8iIuIroxsREfHoocnvMdZvre84//jAeMu0KPPNOv+7Nybb/7cbk+3/348m612Om1m3p051f31+PE+2e1Smo5sREXFo83Oc7fOsUz1eblSOGxUAJHZfvLTd81eXW60EHluZfDf5wXd+2Em7wHQqAEjsvqsARVtXA6rLqVYC1e9yQH9UAJDYuKuev5j2+4Iy/azmrC3QHRUAJNb7VYCqB5wDgMGoACAxAQCJCQBITABAYgIAEhMAkJgAgMQEACQmACAxAQCJCQBITABAYgIAEhMAkJgAgMTuuxm/7RGB6pZrRCAYjgoAEhvXjdrb9qjA1deNCgzDUQFAYpvd77RKYFF1T3Gte5Yb0B0VACTW+1UAYHmoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAX+DsVnwvKX4RkOQAAAABJRU5ErkJggg==",S8=""+new URL("interiors-CQGBjffT.png",import.meta.url).href,T8='{"compressionlevel":-1,"height":22,"infinite":false,"layers":[{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,1698,1699,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,1714,1715,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"height":22,"id":1,"name":"floor","opacity":1,"type":"tilelayer","visible":true,"width":34,"x":0,"y":0},{"data":[514,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,517,530,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,533,530,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,533,530,0,0,0,0,0,0,611,611,0,0,0,0,0,0,0,0,0,611,0,0,0,0,0,0,611,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,643,643,0,0,0,0,0,0,0,0,0,643,0,0,0,0,0,0,643,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,643,0,0,0,0,0,0,643,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,643,643,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,643,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,643,643,0,0,0,0,0,0,0,0,0,643,0,0,0,0,0,0,643,0,0,0,0,0,0,0,533,530,522,522,522,522,0,522,522,522,522,522,522,522,0,522,522,522,522,522,0,0,0,0,0,0,643,0,0,0,0,0,0,0,533,530,554,554,554,554,0,554,554,554,554,554,554,554,0,554,554,554,554,554,0,0,0,0,0,0,522,0,522,522,522,522,522,522,533,530,570,570,570,570,0,570,570,570,570,570,570,570,0,570,570,570,570,570,0,0,0,0,0,0,554,0,554,554,554,554,554,554,533,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,570,0,570,570,570,570,570,570,533,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,611,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,643,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,643,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,643,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,643,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,643,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,643,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,643,0,0,0,0,0,0,0,0,533,578,579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,0,579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,581],"height":22,"id":2,"name":"walls","opacity":1,"type":"tilelayer","visible":true,"width":34,"x":0,"y":0},{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,266,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,281,282,0,0,0,0,0,0,0,468,0,0,0,0,257,257,257,257,0,0,468,0,0,0,0,0,0,0,0,0,0,0,0,0,297,298,0,0,0,0,289,0,0,0,0,0,0,1610612898,1610612914,2684354789,2684354789,1610612914,1610612930,260,0,0,0,0,0,0,0,0,0,2,3,4,2,3,4,0,0,0,0,2,3,4,0,0,0,0,0,1610612897,1610612913,1610612965,1610612965,1610612913,1610612929,276,0,0,0,0,0,0,0,0,0,0,289,0,0,289,0,0,0,0,0,18,289,20,0,0,0,0,0,0,274,274,274,274,0,0,0,0,2,3,4,2,3,4,0,0,305,0,0,305,0,0,0,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,289,0,0,289,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,305,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1029,1026,1027,0,0,2,3,4,0,2,3,4,0,2,3,4,0,2,3,4,0,2,3,4,0,2,3,4,0,0,0,0,0,0,1041,1042,1043,0,0,0,289,0,0,0,289,0,0,0,289,0,0,0,289,0,0,0,289,0,0,0,289,0,0,0,0,0,0,0,1044,0,1061,0,0,0,305,0,0,0,305,0,0,0,305,0,0,0,305,0,0,0,305,0,0,0,305,0,0,0,0,305,305,0,1073,1074,1075,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,305,305,0,0,0,297,0,0,2,3,4,0,2,3,4,0,2,3,4,0,2,3,4,0,2,3,4,0,2,3,4,0,0,0,0,0,269,191,192,0,0,0,0,289,0,0,0,289,0,0,0,289,0,0,0,289,0,0,0,289,0,0,0,289,0,0,0,38,40,39,285,207,208,2248,0,0,0,305,0,0,0,305,0,0,0,305,0,0,0,305,0,0,0,305,0,0,0,305,0,0,0,54,56,55,301,223,224,2264,0,0,470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,297,0,0,0,0,0,471,0,0,0,0,0,0,0,472,2280,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"height":22,"id":3,"name":"furniture-below","opacity":1,"type":"tilelayer","visible":true,"width":34,"x":0,"y":0},{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,354,327,328,0,0,0,0,0,0,327,328,0,0,327,328,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,370,343,344,0,0,452,0,0,0,343,344,0,0,343,344,0,452,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,365,366,0,365,366,0,0,0,0,0,0,0,0,0,0,0,0,451,0,0,0,0,395,0,0,0,0,0,0,0,0,0,0,0,381,382,0,381,382,0,0,0,0,431,432,349,0,0,0,0,0,467,258,258,258,258,411,0,0,0,0,365,366,0,365,366,0,18,19,20,18,19,20,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,381,382,0,381,382,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,19,20,18,19,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,365,366,0,0,365,366,0,0,365,366,0,0,365,366,0,0,365,366,0,0,365,366,0,0,0,0,0,0,0,0,0,0,0,0,381,382,0,0,381,382,0,0,381,382,0,0,381,382,0,0,381,382,0,0,381,382,0,0,0,0,0,0,0,0,0,0,0,18,19,20,0,18,19,20,0,18,19,20,0,18,19,20,0,18,19,20,0,18,19,20,0,0,0,0,0,0,0,1610613812,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1650,1650,0,0,0,281,0,0,0,365,366,0,0,365,366,0,0,365,366,0,0,365,366,0,0,365,366,0,0,365,366,0,0,0,0,0,0,0,0,0,0,0,0,381,382,0,0,381,382,0,0,381,382,0,0,381,382,0,0,381,382,0,0,381,382,0,0,313,0,0,0,0,0,0,0,0,18,19,20,0,18,19,20,0,18,19,20,0,18,19,20,0,18,19,20,0,18,19,20,0,0,329,330,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,281,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"height":22,"id":4,"name":"furniture-above","opacity":1,"type":"tilelayer","visible":true,"width":34,"x":0,"y":0},{"data":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,0,1,1,0,1,0,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,0,1,0,0,1,1,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"height":22,"id":5,"name":"collision","opacity":1,"type":"tilelayer","visible":true,"width":34,"x":0,"y":0},{"draworder":"topdown","id":6,"name":"spawn-points","objects":[{"id":0,"name":"desk-ceo","type":"","x":48,"y":64,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"pc-1","type":"","x":32,"y":208,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"pc-2","type":"","x":96,"y":208,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"pc-3","type":"","x":160,"y":208,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"pc-4","type":"","x":224,"y":208,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"pc-5","type":"","x":288,"y":208,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"pc-6","type":"","x":352,"y":208,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"desk-team-lead","type":"","x":32,"y":288,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"desk-backend-engineer","type":"","x":96,"y":288,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"desk-product-manager","type":"","x":160,"y":288,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"desk-data-engineer","type":"","x":224,"y":288,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"desk-project-manager","type":"","x":288,"y":288,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"desk-market-researcher","type":"","x":352,"y":288,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"desk-agent-organizer","type":"","x":320,"y":112,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"warroom-seat","type":"","x":368,"y":112,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"desk-chief-architect","type":"","x":432,"y":80,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"desk-ui-ux-expert","type":"","x":480,"y":80,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"entrance","type":"","x":256,"y":320,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"cafe-seat-1","type":"","x":432,"y":224,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"cafe-seat-2","type":"","x":432,"y":256,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"cafe-seat-3","type":"","x":448,"y":224,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"cafe-seat-4","type":"","x":448,"y":256,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"cafe-stand-coffee","type":"","x":416,"y":320,"width":0,"height":0,"rotation":0,"visible":true,"point":true},{"id":0,"name":"cafe-stand-vending","type":"","x":464,"y":208,"width":0,"height":0,"rotation":0,"visible":true,"point":true}],"opacity":1,"type":"objectgroup","visible":true,"x":0,"y":0},{"draworder":"topdown","id":7,"name":"zones","objects":[{"id":0,"name":"boardroom","type":"","x":144,"y":48,"width":144,"height":80,"rotation":0,"visible":true},{"id":0,"name":"cafeteria","type":"","x":384,"y":192,"width":128,"height":128,"rotation":0,"visible":true}],"opacity":1,"type":"objectgroup","visible":true,"x":0,"y":0}],"nextlayerid":8,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.12.0","tileheight":16,"tilesets":[{"columns":16,"firstgid":1,"image":"../tilesets/office-tileset.png","imageheight":512,"imagewidth":256,"margin":0,"name":"office-tileset","spacing":0,"tilecount":512,"tileheight":16,"tilewidth":16},{"firstgid":513,"source":"A5 Office Floors & Walls.tsx"},{"firstgid":1025,"source":"interiors.tsx"}],"tilewidth":16,"type":"map","version":"1.10","width":34}',C8='{"compressionlevel":-1,"infinite":false,"orientation":"orthogonal","renderorder":"right-down","width":36,"height":24,"tilewidth":16,"tileheight":16,"nextlayerid":99,"nextobjectid":20,"version":"1.10","tiledversion":"1.10.2","type":"map","tilesets":[{"firstgid":1,"columns":16,"image":"../tilesets/office-tileset.png","imageheight":512,"imagewidth":256,"margin":0,"name":"office-tileset","spacing":0,"tilecount":512,"tileheight":16,"tilewidth":16},{"firstgid":513,"source":"A5 Office Floors & Walls.tsx"},{"firstgid":1025,"source":"interiors.tsx"}],"layers":[{"id":1,"name":"floor","type":"tilelayer","data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,783,784,0,0,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,799,800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,783,784,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"width":36,"height":24,"x":0,"y":0,"opacity":1,"visible":true},{"id":2,"name":"walls","type":"tilelayer","data":[570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,570,570,570,570,0,0,570,570,570,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,570,570,0,0,570,570,570,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,0,0,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570],"width":36,"height":24,"x":0,"y":0,"opacity":1,"visible":true},{"id":3,"name":"furniture-below","type":"tilelayer","data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,289,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,0,0,2,3,4,0,0,2,3,4,0,0,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,289,0,0,0,0,289,0,0,0,0,289,0,0,0,0,289,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,305,0,0,0,0,305,0,0,0,0,305,0,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,0,0,2,3,4,0,0,2,3,4,0,0,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,289,0,0,0,0,289,0,0,0,0,289,0,0,0,0,289,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,305,0,0,0,0,305,0,0,0,0,305,0,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"width":36,"height":24,"x":0,"y":0,"opacity":1,"visible":true},{"id":4,"name":"furniture-above","type":"tilelayer","data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,365,366,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,381,382,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,19,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,365,366,0,0,0,365,366,0,0,0,365,366,0,0,0,365,366,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,381,382,0,0,0,381,382,0,0,0,381,382,0,0,0,381,382,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,19,20,0,0,18,19,20,0,0,18,19,20,0,0,18,19,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,365,366,0,0,0,365,366,0,0,0,365,366,0,0,0,365,366,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,381,382,0,0,0,381,382,0,0,0,381,382,0,0,0,381,382,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,19,20,0,0,18,19,20,0,0,18,19,20,0,0,18,19,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"width":36,"height":24,"x":0,"y":0,"opacity":1,"visible":true},{"id":5,"name":"collision","type":"tilelayer","data":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"width":36,"height":24,"x":0,"y":0,"opacity":1,"visible":true},{"id":6,"name":"spawn-points","type":"objectgroup","objects":[{"id":1,"name":"desk-ceo","point":true,"x":496,"y":80,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":2,"name":"pc-1","point":true,"x":80,"y":208,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":3,"name":"pc-2","point":true,"x":160,"y":208,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":4,"name":"pc-3","point":true,"x":240,"y":208,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":5,"name":"pc-4","point":true,"x":320,"y":208,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":6,"name":"pc-5","point":true,"x":80,"y":304,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":7,"name":"pc-6","point":true,"x":160,"y":304,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":8,"name":"pc-7","point":true,"x":240,"y":304,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":9,"name":"pc-8","point":true,"x":320,"y":304,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":10,"name":"cafe-seat-1","point":true,"x":464,"y":224,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":11,"name":"cafe-seat-2","point":true,"x":464,"y":256,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":12,"name":"cafe-seat-3","point":true,"x":512,"y":224,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":13,"name":"cafe-seat-4","point":true,"x":512,"y":256,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":14,"name":"cafe-stand-coffee","point":true,"x":480,"y":320,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":15,"name":"cafe-stand-vending","point":true,"x":528,"y":192,"width":0,"height":0,"rotation":0,"type":"","visible":true},{"id":16,"name":"entrance","point":true,"x":272,"y":352,"width":0,"height":0,"rotation":0,"type":"","visible":true}],"draworder":"topdown","opacity":1,"visible":true,"x":0,"y":0},{"id":7,"name":"zones","type":"objectgroup","objects":[{"id":17,"name":"boardroom","x":32,"y":32,"width":128,"height":80,"rotation":0,"type":"","visible":true},{"id":18,"name":"cafeteria","x":448,"y":160,"width":112,"height":192,"rotation":0,"type":"","visible":true},{"id":19,"name":"holding","x":16,"y":288,"width":64,"height":64,"rotation":0,"type":"","visible":true}],"draworder":"topdown","opacity":1,"visible":true,"x":0,"y":0}]}',qr={id:"office",mapRaw:T8,tilesets:[{url:b8,embedded:!0},{url:w8,firstgid:513,image:"a5",imagewidth:256,imageheight:512,tilewidth:16,tileheight:16,columns:16,tilecount:512},{url:S8,firstgid:1025,image:"interiors",imagewidth:256,imageheight:1424,tilewidth:16,tileheight:16,columns:16,tilecount:1424}],primarySeatNames:["desk-ceo","pc-1","pc-2","pc-3","pc-4","pc-5","pc-6","desk-chief-architect","desk-product-manager","desk-team-lead","desk-backend-engineer","desk-ui-ux-expert","desk-data-engineer","desk-project-manager","desk-market-researcher","desk-agent-organizer"],cafeSeatNames:["cafe-seat-1","cafe-seat-2","cafe-seat-3","cafe-seat-4"],cafeStands:[["cafe-stand-coffee","coffee"],["cafe-stand-vending","vending"]],coffee:{trayTile:{x:29,y:15},trayStand:{x:29,y:16},machineStand:{x:26,y:20},sinkTile:{x:28,y:18},sinkStand:{x:28,y:20},maxCups:4},anchors:{calendar:{x:4,y:1},boards:{x:6,y:10},clock:{x:1,y:1}},errandSpots:[{kind:"water",stand:{x:2,y:20},facing:"left",fx:{x:1,y:20},duration:4.5},{kind:"water",stand:{x:22,y:20},facing:"right",fx:{x:23,y:20},duration:4.5},{kind:"water",stand:{x:30,y:20},facing:"right",fx:{x:31,y:20},duration:4.5},{kind:"water",stand:{x:6,y:4},facing:"up",fx:{x:6,y:3},duration:4.5,godOnly:!0},{kind:"smoke",stand:{x:2,y:3},facing:"up",fx:{x:2,y:1},duration:18,godOnly:!0},{kind:"water",stand:{x:17,y:4},facing:"up",fx:{x:17,y:3},duration:4.5},{kind:"window",stand:{x:10,y:3},facing:"up",fx:{x:10,y:1},duration:5},{kind:"window",stand:{x:15,y:3},facing:"up",fx:{x:14,y:1},duration:5},{kind:"dispenser",stand:{x:16,y:3},facing:"down",fx:{x:16,y:4},duration:3.5},{kind:"dispenser",stand:{x:32,y:4},facing:"up",fx:{x:32,y:3},duration:3.5},{kind:"fridge",stand:{x:29,y:20},facing:"up",fx:{x:29,y:19},duration:3.2},{kind:"shelf",stand:{x:30,y:20},facing:"up",fx:{x:30,y:18},duration:4},{kind:"bin",stand:{x:18,y:20},facing:"left",fx:{x:17,y:20},duration:2.6},{kind:"bin",stand:{x:31,y:16},facing:"right",fx:{x:32,y:16},duration:2.6}],monitor:{offTopLeftGid:365,onGids:[[367,0,0],[368,1,0],[383,0,1],[384,1,1]]},palette:{background:bt.ink[900],noteColors:{todo:15916938,doing:10406896,blocked:15770531,done:11067568}},cast:{byName:s8,getFrames:n=>l8(n),defaultCharacter:Qh}},E8={id:"brooklyn99",mapRaw:C8,tilesets:qr.tilesets,primarySeatNames:["desk-ceo","pc-1","pc-2","pc-3","pc-4","pc-5","pc-6","pc-7","pc-8"],cafeSeatNames:["cafe-seat-1","cafe-seat-2","cafe-seat-3","cafe-seat-4"],cafeStands:[["cafe-stand-coffee","coffee"],["cafe-stand-vending","vending"]],coffee:{trayTile:{x:33,y:18},trayStand:{x:33,y:19},machineStand:{x:30,y:21},sinkTile:{x:31,y:18},sinkStand:{x:31,y:19},maxCups:4},anchors:{calendar:{x:4,y:1},boards:{x:14,y:1},clock:{x:1,y:1}},errandSpots:[{kind:"water",stand:{x:2,y:13},facing:"left",fx:{x:1,y:13},duration:4.5},{kind:"water",stand:{x:24,y:15},facing:"right",fx:{x:25,y:15},duration:4.5},{kind:"water",stand:{x:13,y:15},facing:"down",fx:{x:13,y:16},duration:4.5},{kind:"water",stand:{x:28,y:6},facing:"up",fx:{x:28,y:5},duration:4.5,godOnly:!0},{kind:"smoke",stand:{x:34,y:2},facing:"up",fx:{x:34,y:0},duration:18,godOnly:!0},{kind:"window",stand:{x:14,y:1},facing:"up",fx:{x:14,y:0},duration:5},{kind:"window",stand:{x:22,y:1},facing:"up",fx:{x:22,y:0},duration:5},{kind:"dispenser",stand:{x:8,y:15},facing:"down",fx:{x:8,y:16},duration:3.5},{kind:"dispenser",stand:{x:17,y:20},facing:"down",fx:{x:17,y:21},duration:3.5},{kind:"fridge",stand:{x:29,y:21},facing:"up",fx:{x:29,y:20},duration:3.2},{kind:"shelf",stand:{x:34,y:18},facing:"up",fx:{x:34,y:17},duration:4},{kind:"bin",stand:{x:19,y:20},facing:"left",fx:{x:18,y:20},duration:2.6},{kind:"bin",stand:{x:34,y:15},facing:"up",fx:{x:34,y:14},duration:2.6}],monitor:qr.monitor,palette:qr.palette,cast:qr.cast},A8={office:qr,brooklyn99:E8};function k8(n){return A8[n]??qr}function P8(n){const e=JSON.parse(n.mapRaw);return{...e,tilesets:n.tilesets.map((t,r)=>{if(t.embedded)return e.tilesets[r];const{url:i,embedded:s,...o}=t;return o})}}function M8(n){return n.tilesets.map(e=>e.url)}function R8(n){try{const e=JSON.parse(n.mapRaw);return typeof e.width=="number"&&e.width>0&&typeof e.height=="number"&&e.height>0&&Array.isArray(e.layers)&&Array.isArray(e.tilesets)}catch{return!1}}async function I8(n){const e=k8(n);return R8(e)?e:(console.warn(`[themeLoader] theme '${n}' is not renderable — falling back to 'office'`),qr)}const B8=3,D8=1500;function F8(n,e){const t=e.maxRebuilds??B8,r=e.delayMs??D8,i=e.schedule??((u,c)=>setTimeout(u,c)),s=e.log??(u=>console.warn(u));let o=0,a=!0;const l=u=>{var c;if(u.preventDefault(),!!a){if(o>=t){s(`[OfficeFloor] WebGL context lost again after ${t} rebuilds — too many live contexts on this floor; giving up until restart`),(c=e.onGiveUp)==null||c.call(e),a=!1;return}o+=1,s(`[OfficeFloor] WebGL context lost (Chromium evicted the oldest context) — rebuilding the scene, attempt ${o}/${t}`),i(()=>{a&&e.onRebuild()},r)}};return n.addEventListener("webglcontextlost",l,!1),()=>{a=!1,n.removeEventListener("webglcontextlost",l,!1)}}const G8=6e4,O8={water:["watering the plants 🌿","giving the plants a drink","they grow so fast"],window:["letting some air in 🍃","a bit of fresh air","nice breeze today"],dispenser:["getting some water 💧","hydration break","staying sharp"],fridge:["anything good in the fridge?","who took my yogurt?","just looking…"],shelf:["checking out the shelf 📚","anything new in here?","so much good stuff"],bin:["out with the scrap paper 🗑️","desk cleanup day","tidying up a little"],smoke:["the floor runs itself 🚬","boss break.","thinking big thoughts 🚬","I DECLARE… a break"]},Ng=["already shipped {done} tasks, Michael. raise? 🥺","{done} tasks done this week, boss!","great vision as always, boss!","I was JUST about to do exactly that!","love the tie today, Michael","working hard, boss! 💪","best boss ever. genuinely."],zg=["has he ever actually written code?","another 'quick sync' that took an hour…","'world's best boss' — he bought that mug himself","he pinned MY task as his idea","the cigar smell, honestly…","he watered the plant. ONE plant. his own.","did you hear him? 'I DECLARE… a break'"],Ua=["done! ✔","nailed it","that's a wrap","ship it 🚀","another one done","crushed it","in the books"];function L8(n){return new Promise((e,t)=>{const r=new Image;r.onload=()=>{const i=Q.from(r);i.source.scaleMode="nearest",e(i)},r.onerror=()=>t(new Error("failed to load "+n.slice(0,40))),r.src=n})}function Or(n,e=""){const t=(n.action||"").trim();return t||U8(n.lastPrompt)||e}function U8(n,e=6,t=42){if(!n)return"";const r=n.trim().split(/\s+/);let i=r.slice(0,e).join(" ");const s=r.length>e;return i.length>t?i=i.slice(0,t).trimEnd():s&&(i+="…"),i}function N8(){const n=Yt.useRef(null),e=Yt.useRef(null),t=Yt.useRef(0),[r,i]=Yt.useState(0),s=Xe(d=>d.officeTheme),o=Xe(d=>d.fullscreenAgentId),a=Xe(d=>d.ideOpen),[l,u]=Yt.useState(()=>document.hidden);Yt.useEffect(()=>{const d=()=>u(document.hidden);return document.addEventListener("visibilitychange",d),()=>document.removeEventListener("visibilitychange",d)},[]);const c=!!o||a||l,h=Yt.useRef(c);return Yt.useEffect(()=>{var f;h.current=c;const d=(f=e.current)==null?void 0:f.ticker;d&&(c?d.stop():d.start())},[c]),Yt.useEffect(()=>{const d=n.current;if(!d)return;for(;d.firstChild;)d.removeChild(d.firstChild);const f=++t.current,p=new o1;e.current=p;const g=new Map,_=new Set,m=[],y=16;return(async()=>{const b=await I8(s);if(await p.init({background:b.palette.background,antialias:!1,roundPixels:!0,resolution:Math.max(window.devicePixelRatio||1,2),autoDensity:!0,width:d.clientWidth||800,height:d.clientHeight||600}),t.current!==f){Tc(p);return}for(;d.firstChild;)d.removeChild(d.firstChild);d.appendChild(p.canvas),p.__glRecovery=F8(p.canvas,{onRebuild:()=>{t.current===f&&i(v=>v+1)},onGiveUp:()=>{if(t.current!==f)return;const v=document.createElement("div");v.style.cssText="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:24px;color:#ffd0b5;font-family:monospace;font-size:13px;text-align:center;white-space:pre-wrap;",v.textContent=`The office floor lost its GPU context.
|
|
971
|
+
|
|
972
|
+
Too many terminals are using the GPU at once.
|
|
973
|
+
Close a few agent terminals, or restart the app, to bring it back.`,d.appendChild(v)}});const S=await Promise.all(M8(b).map(L8));if(t.current!==f){Tc(p);return}const T=new Ue;p.stage.addChild(T);const C=new Kh(P8(b),S);T.addChild(C.getContainer());const M=C.getCharacterContainer(),L=C.getContainer().children.reduce((v,w)=>{var A;return v+(((A=w.children)==null?void 0:A.length)??0)},0);console.log(`[OfficeFloor] map ${C.width}x${C.height}, ${L} tile sprites rendered`);const R=new VP(T);R.setMapSize(C.width*C.tileSize,C.height*C.tileSize),R.setViewSize(p.screen.width,p.screen.height),R.fitToScreen();const O=C.tileSize,U=new Be;U.eventMode="static",U.cursor="pointer",U.position.set(b.anchors.calendar.x*O+8,b.anchors.calendar.y*O+5),U.zIndex=3*O,U.on("pointertap",v=>{v.stopPropagation();const w=Xe.getState(),A=w.agents.find(P=>P.isGod);A&&w.select(A.id),w.requestCommandCenterTab("triggers")}),U.rect(7,-2,2,2).fill(4864850),U.rect(0,0,16,20).fill(4864850),U.rect(1,1,14,18).fill(15919832),U.rect(1,1,14,4).fill(13193039),U.rect(4,0,1,2).fill(14209988),U.rect(11,0,1,2).fill(14209988);for(let v=0;v<3;v++)for(let w=0;w<5;w++)U.rect(2+w*3,7+v*4,2,2).fill(12102544);U.rect(8,11,2,2).fill(13193039),M.addChild(U);const j=[],K=new Set,Ee=v=>{if(!v)return;const w=`${v.x},${v.y}`;K.has(w)||(K.add(w),j.push({x:v.x,y:v.y}))};for(const v of b.primarySeatNames)Ee(C.getSpawnPoint(v));(v=>{const w=C.getZone(v);if(w)for(let A=w.y;A<w.y+w.height;A++)for(let P=w.x;P<w.x+w.width;P++)C.isWalkable(P,A)&&Ee({x:P,y:A})})("boardroom");const $=C.getSpawnPoint("entrance")??{x:Math.floor(C.width/2),y:C.height-2},D=[],B=new Set;for(let v=0;v<=6&&D.length<16;v++)for(let w=-v;w<=v;w++)for(let A=-v;A<=v;A++){if(Math.max(Math.abs(A),Math.abs(w))!==v)continue;const P=$.x+A,z=$.y+w,H=`${P},${z}`;B.has(H)||C.isWalkable(P,z)&&(B.add(H),D.push({x:P,y:z}))}D.length===0&&D.push($);const W=0,J=v=>{if(v.isGod)return _.add(W),W;for(let w=1;w<j.length;w++)if(!_.has(w))return _.add(w),w;return null},X=v=>C.isWalkable(v.x,v.y-1)?C.isWalkable(v.x,v.y+1)?C.isWalkable(v.x-1,v.y)?C.isWalkable(v.x+1,v.y)?"up":"right":"left":"down":"up",ne=[],fe=v=>C.isWalkable(v.x+1,v.y)?C.isWalkable(v.x-1,v.y)?C.isWalkable(v.x,v.y-1)?"down":"up":"left":"right";for(const v of b.cafeSeatNames){const w=C.getSpawnPoint(v);w&&ne.push({tile:w,facing:X(w),spot:"table",seated:!0,partner:-1})}for(let v=0;v<ne.length;v++)for(let w=v+1;w<ne.length;w++){const A=ne[v].tile,P=ne[w].tile;A.x===P.x&&Math.abs(A.y-P.y)===2&&(ne[v].partner=w,ne[w].partner=v)}for(const[v,w]of b.cafeStands){const A=C.getSpawnPoint(v);A&&ne.push({tile:A,facing:fe(A),spot:w,seated:!1,partner:-1})}const me=new Array(ne.length).fill(null),le=v=>Xe.getState().agents.find(w=>w.id===v),ve=b.coffee.trayTile,rt=b.coffee.trayStand,ue=b.coffee.machineStand,ct=b.coffee.sinkTile,Mt=b.coffee.sinkStand,ke=b.coffee.maxCups;let qe=ke;const Se=C.tileSize,it=new Be;it.eventMode="none",it.position.set(ve.x*Se,ve.y*Se),it.zIndex=(ve.y+1)*Se,M.addChild(it);const vn=()=>{it.clear();const v=[[2,10],[9,10],[2,15],[9,15]];for(let w=0;w<qe&&w<v.length;w++)bb(it,v[w][0],v[w][1])};vn();const He=new Be;He.eventMode="none",He.position.set(ct.x*Se,ct.y*Se),He.zIndex=(ct.y+1)*Se,M.addChild(He);let $t=0;const Mr=v=>{if(He.clear(),He.rect(2,6,12,8).fill(12174025),He.rect(3,7,10,6).fill(8885149),He.rect(7,9,2,2).fill(6121327),He.rect(7,2,2,4).fill(7042688),He.rect(6,2,4,1).fill(7042688),$t>0){He.rect(7,6,2,4).fill({color:10475248,alpha:.9});for(let w=0;w<3;w++){const A=(v*1.2+w/3)%1;He.circle(4+w*4,7-A*4,1).fill({color:16777215,alpha:.7*(1-A)})}}};Mr(0);const Lt=new Be;Lt.eventMode="none",Lt.position.set(26*Se,17*Se),Lt.zIndex=19*Se,M.addChild(Lt);let sn=0;const _s=v=>{if(Lt.clear(),!(sn<=0))for(let w=0;w<2;w++){const A=(v*.9+w*.5)%1;Lt.rect(6+w*3,2-Math.round(A*5),1,1).fill({color:16777215,alpha:.6*(1-A)})}},di=v=>{v.run=void 0;const w=v.character;w.isCarryingCup()?(v.cupCarryHome=!0,w.hideThought(),w.sitAtDesk(!1)):(w.hideThought(),w.startWandering())},rr=(v,w)=>{v.run={phase:w,timer:0};const A=v.character,P=w==="toMachine"?ue:w==="toSink"?Mt:rt;A.walkToAndThen(P,()=>{if(!(!v.run||v.run.phase!==w))if(A.faceDirection("up"),w==="toTray"){if(qe<=0){A.showThought("no clean mugs left…"),v.run={phase:"placing",timer:-1};return}qe--,vn(),A.setCarryingCup(!0),v.run={phase:"taking",timer:0}}else w==="toMachine"?(A.showThought("brewing a fresh one ☕"),sn=2.6,v.run={phase:"brewing",timer:0}):w==="toSink"?(A.showThought("washing the mug"),$t=2.4,v.run={phase:"washing",timer:0}):(A.setCarryingCup(!1),qe=Math.min(ke,qe+1),vn(),v.run={phase:"placing",timer:0})})},xs=v=>{v.run&&(v.run=void 0,v.character.isCarryingCup()&&(v.cupCarryHome=!0))};let fi=0;const Yo=v=>{fi+=v,$t>0&&($t-=v,Mr(fi)),sn>0&&(sn-=v,_s(fi));for(const[,w]of g){const A=w.run;if(A)switch(A.timer+=v,w.character,A.phase){case"toTray":case"toMachine":case"toSink":case"toTrayBack":A.timer>20&&di(w);break;case"taking":A.timer>=.8&&rr(w,"toMachine");break;case"brewing":A.timer>=2.6&&di(w);break;case"washing":A.timer>=2.4&&rr(w,"toTrayBack");break;case"placing":A.timer>=.6&&di(w);break}}},Ko=(v,w)=>{const A=Xe.getState().agents.find(H=>H.isGod),P=A?g.get(A.id):void 0;if(!P)return 1/0;const z=P.character.getPixelPosition();return Math.hypot(z.x-v,z.y-w)},vs=(v,w,A)=>{var I;const P=ne[A],z=((I=le(v))==null?void 0:I.character)??Qh,H=Math.floor(Math.random()*1e6),F=w.character.getPixelPosition();if(Ko(F.x,F.y)>96&&Math.random()<.35){w.character.showThought(zg[Math.floor(Math.random()*zg.length)]);return}w.character.showThought(m8(z,P.spot,H))},bs=(v,w,A)=>{var Y;const P=ne[A];if(P.partner<0||!w.brk)return!1;const z=me[P.partner];if(!z)return!1;const H=g.get(z);if(!(H!=null&&H.brk)||H.brk.phase!=="lingering"||w.brk.chat||w.brk.chattingWith||H.brk.chat||H.brk.chattingWith)return!1;const F=((Y=le(v))==null?void 0:Y.character)??Qh,I=v8(F,Math.floor(Math.random()*1e6));return w.brk.chat={lines:I,partnerId:z,idx:0,beat:0},H.brk.chattingWith=v,!0},ws=v=>{if(v.brk){if(v.brk.chat){const w=g.get(v.brk.chat.partnerId);w!=null&&w.brk&&(w.brk.chattingWith=void 0)}if(v.brk.chattingWith){const w=g.get(v.brk.chattingWith);w!=null&&w.brk&&(w.brk.chat=void 0)}me[v.brk.spotIdx]=null,v.brk=void 0}},qo=(v,w)=>{var H;const A=((H=w.brk)==null?void 0:H.phase)==="lingering";ws(w),w.character.hideThought();const P=le(v);if(P!=null&&P.isGod){w.character.sitAtDesk(!0);return}const z=w.character;if(!A){z.isCarryingCup()?(w.cupCarryHome=!0,z.sitAtDesk(!1)):z.startWandering();return}z.isCarryingCup()?Math.random()<.6?rr(w,"toMachine"):rr(w,"toSink"):!z.hasCupOnDesk()&&Math.random()<.75?rr(w,"toTray"):z.startWandering()},Ss=(v,w)=>{const A=[],P=[];for(let Y=0;Y<ne.length;Y++){if(me[Y])continue;A.push(Y);const oe=ne[Y].partner;oe>=0&&me[oe]&&P.push(Y)}if(A.length===0)return;const z=P.length&&Math.random()<.55?P:A,H=z[Math.floor(Math.random()*z.length)],F=ne[H];me[H]=v,w.brk={spotIdx:H,phase:"walking",timer:0,quipTimer:0};const I=w.character;I.hasCupOnDesk()&&(I.setCupOnDesk(!1),I.setCarryingCup(!0)),I.walkToAndThen(F.tile,()=>{!w.brk||w.brk.spotIdx!==H||(F.seated?I.sitInPlace(F.facing):(I.setIdle(),I.faceDirection(F.facing)),w.brk.phase="lingering",w.brk.timer=8+Math.random()*8,w.brk.quipTimer=4+Math.random()*4,bs(v,w,H)||vs(v,w,H))})},pi=(v,w)=>v.isGod||w.brk||w.err||w.run||w.cupCarryHome||v.status!=="idle"&&v.status!=="success"?!1:!w.character.isSitting();let uu=5;const Sb=v=>{for(const[z,H]of g){const F=H.brk;if(F){if(F.phase==="walking"){F.timer+=v,F.timer>20&&qo(z,H);continue}if(F.chat){if(F.chat.beat-=v,F.chat.beat<=0)if(F.chat.idx<F.chat.lines.length){const I=F.chat.idx%2===0?H:g.get(F.chat.partnerId);I==null||I.character.showThought(F.chat.lines[F.chat.idx]),F.chat.idx++,F.chat.beat=2.4,F.timer=Math.max(F.timer,3.5);const Y=g.get(F.chat.partnerId);Y!=null&&Y.brk&&(Y.brk.timer=Math.max(Y.brk.timer,3.5))}else{const I=g.get(F.chat.partnerId);I!=null&&I.brk&&(I.brk.chattingWith=void 0),F.chat=void 0}}else F.chattingWith||(F.quipTimer-=v,F.quipTimer<=0?(F.quipTimer=4+Math.random()*4,vs(z,H,F.spotIdx)):Math.random()<.004&&bs(z,H,F.spotIdx));F.timer-=v,F.timer<=0&&qo(z,H)}}if(uu-=v,uu>0||(uu=6+Math.random()*6,me.filter(Boolean).length>=4)||Math.random()>=.7)return;const w=[];for(const z of Xe.getState().agents){const H=g.get(z.id);H&&pi(z,H)&&w.push([z,H])}if(w.length===0)return;const[A,P]=w[Math.floor(Math.random()*w.length)];Ss(A.id,P)},Ts=b.errandSpots,cu=new Array(Ts.length).fill(null),hu=new Map,Tb=v=>{let w=hu.get(v);if(!w){const A=Ts[v];w=new Be,w.eventMode="none",w.position.set(A.fx.x*Se,A.fx.y*Se),w.zIndex=(A.fx.y+1)*Se,M.addChild(w),hu.set(v,w)}return w},Cb=(v,w,A)=>{if(w.clear(),v==="window"||v==="smoke")for(let P=0;P<3;P++){const z=(A*.7+P/3)%1;w.rect(2+P*9-z*5,26+z*16,7,1).fill({color:14217719,alpha:.55*(1-z)})}else if(v==="dispenser"){const P=A*1.6%1;w.rect(7,18+P*6,1,3).fill({color:10475248,alpha:.9*(1-P)});const z=A*.9%1;w.circle(8,12-z*6,1).fill({color:16777215,alpha:.6*(1-z)})}else if(v==="fridge"){const P=.16+.05*Math.sin(A*5);w.poly([3,12,13,12,16,30,0,30]).fill({color:16773816,alpha:P})}else if(v==="shelf"){const P=A*.5%1;w.rect(2+P*24,4+Math.floor(A*.5)%3*9,2,2).fill({color:16775112,alpha:.8*Math.sin(P*Math.PI)})}else if(v==="bin"){const P=A*1%1;if(P<.45){const z=P/.45,H=18,I=H+(8-H)*z,Y=2-Math.sin(z*Math.PI)*9;w.rect(Math.round(I),Math.round(Y),2,2).fill({color:16118246,alpha:.95})}}},Cs=v=>{var w;v.err&&(cu[v.err.idx]=null,(w=hu.get(v.err.idx))==null||w.clear(),v.err=void 0,v.character.stopWatering(),v.character.stopSmoking())};let du=18;const Eb=v=>{for(const[,I]of g){const Y=I.err;if(!Y)continue;Y.timer+=v;const oe=Ts[Y.idx];if(Y.phase==="walking"){Y.timer>20&&(Cs(I),I.character.startWandering());continue}Cb(oe.kind,Tb(Y.idx),Y.timer),oe.kind!=="water"&&oe.kind!=="smoke"&&Y.timer>=oe.duration&&(Cs(I),I.character.hideThought(),I.character.startWandering())}if(du-=v,du>0||(du=14+Math.random()*18,Math.random()>=.65))return;const w=Ts.map((I,Y)=>Y).filter(I=>!cu[I]);if(w.length===0)return;const A=w[Math.floor(Math.random()*w.length)],P=Ts[A];let z,H;if(P.godOnly){const I=Xe.getState().agents.find(oe=>oe.isGod),Y=I?g.get(I.id):void 0;if(!I||!Y||Y.err||Y.brk||I.status!=="idle"&&I.status!=="success"||Math.random()>=.5)return;z=I,H=Y}else{const I=[];for(const Y of Xe.getState().agents){const oe=g.get(Y.id);oe&&pi(Y,oe)&&I.push([Y,oe])}if(I.length===0)return;[z,H]=I[Math.floor(Math.random()*I.length)]}const F=H.character;cu[A]=z.id,H.err={phase:"walking",timer:0,idx:A},F.walkToAndThen(P.stand,()=>{if(!H.err||H.err.idx!==A)return;H.err.phase="doing",H.err.timer=0,F.faceDirection(P.facing);const I=O8[P.kind];F.showThought(I[Math.floor(Math.random()*I.length)]);const Y=()=>{const oe=!!z.isGod;Cs(H),F.hideThought(),oe?F.sitAtDesk(!0):F.startWandering()};P.kind==="water"?F.startWatering(P.duration,Y):P.kind==="smoke"&&F.startSmoking(P.duration,Y)})},r0=new Map;let i0=new Map,fu=999,pu=1.5;const Ab=v=>{var H,F;if(fu+=v,fu>30&&(fu=0,window.cth.hiveTasks().then(I=>{const Y=I&&typeof I=="object"&&Array.isArray(I.tasks)?I.tasks:[],oe=new Map;for(const Fe of Y)(Fe==null?void 0:Fe.status)==="done"&&typeof Fe.assignee=="string"&&Fe.assignee&&oe.set(Fe.assignee,(oe.get(Fe.assignee)??0)+1);i0=oe}).catch(()=>{})),pu-=v,pu>0)return;pu=1.5;const w=Xe.getState().agents.find(I=>I.isGod),A=w?g.get(w.id):void 0;if(!A)return;const P=A.character.getPixelPosition(),z=Date.now();for(const[I,Y]of g){if(I===w.id)continue;const oe=le(I);if(!oe||oe.status!=="idle"&&oe.status!=="success"||(H=Y.brk)!=null&&H.chat||(F=Y.brk)!=null&&F.chattingWith)continue;const Fe=Y.character.getPixelPosition();if(Math.hypot(Fe.x-P.x,Fe.y-P.y)>44||z-(r0.get(I)??0)<25e3||Math.random()>=.6)continue;r0.set(I,z);const ht=i0.get(I)??0,_0=ht>0?Ng:Ng.slice(2),Wb=_0[Math.floor(Math.random()*_0.length)].replace("{done}",String(ht));Y.character.showThought(Wb),Y.character.hideThought()}},kb=v=>{for(const[w,A]of g){if(A.cupCarryHome&&A.character.isSittingAtDesk()){A.cupCarryHome=!1,A.character.setCarryingCup(!1),A.character.setCupOnDesk(!0);const P=le(w);P&&!P.isGod&&(P.status==="idle"||P.status==="success")&&A.character.startWandering()}A.screen&&(A.screen.setOn(A.character.isSittingAtDesk()),A.screen.update(v))}},mu=b.anchors.boards,Pb=15,In=b.palette.noteColors,Bn=C.tileSize,Qe=new Be;Qe.eventMode="static",Qe.cursor="pointer",Qe.position.set(mu.x*Bn+Pb,mu.y*Bn),Qe.zIndex=(mu.y+1)*Bn,Qe.on("pointertap",v=>{v.stopPropagation();const w=Xe.getState(),A=w.agents.find(P=>P.isGod);A&&w.select(A.id),w.requestCommandCenterTab("tasks")}),M.addChild(Qe);const Qo=new Map,Mb=()=>{var v;for(const w of Qo.values())(v=w.parent)==null||v.removeChild(w),w.destroy();Qo.clear()},s0=(v,w,A)=>{Qe.rect(v,-8,30,22).fill(7231033),Qe.rect(v+1,-7,28,3).fill(w),Qe.rect(v+1,-4,28,17).fill(13217923);const P=Math.min(A.length,12);for(let z=0;z<P;z++){const H=v+3+z%4*7,F=-2+Math.floor(z/4)*5;Qe.rect(H,F,5,4).fill(In[A[z]]??15920604),Qe.rect(H+2,F,1,1).fill(4864850)}A.length>12&&(Qe.rect(v+22,8,5,4).fill(15261896),Qe.rect(v+23,7,5,4).fill(15920604))},o0=v=>{Qe.clear(),Mb();const w=v.filter(H=>H.status==="blocked").map(()=>"blocked"),A=v.filter(H=>H.status==="todo").map(()=>"todo");let P=0;for(const H of v){if(H.status==="done"){P++;continue}if(H.status!=="doing")continue;const F=H.assignee?g.get(H.assignee):void 0;if(!F){A.push("doing");continue}const I=F.character.getDeskTile();let Y=Qo.get(H.assignee);Y||(Y=new Be,Y.eventMode="none",Y.position.set((I.x-1)*Bn+3,(I.y-1)*Bn+8),Y.zIndex=I.y*Bn-1,M.addChild(Y),Qo.set(H.assignee,Y));const oe=Y.__count??0;Y.__count=oe+1,Y.rect(oe*7,-(oe%2),5,4).fill(In.doing),Y.rect(oe*7+2,-(oe%2),1,1).fill(4864850)}s0(0,In.blocked,w),s0(34,In.todo,A),Qe.rect(68,6,14,4).fill(11570526),Qe.rect(68,10,14,4).fill(9072461),Qe.rect(69,14,2,2).fill(7231033),Qe.rect(79,14,2,2).fill(7231033);const z=Math.min(P,6);for(let H=0;H<z;H++)Qe.rect(71+H%2,4-H*2,8,2).fill({color:In.done,alpha:1}).stroke({color:7245678,width:.5})};o0([]);const Rr=new Be;Rr.eventMode="static",Rr.cursor="pointer",Rr.position.set(b.anchors.clock.x*Se,b.anchors.clock.y*Se),Rr.hitArea={contains:(v,w)=>v>=0&&v<=16&&w>=0&&w<=32},Rr.zIndex=3*Se,Rr.on("pointertap",v=>{v.stopPropagation(),window.close()}),M.addChild(Rr);const yt=new Be;yt.eventMode="static",yt.cursor="pointer",yt.position.set(14*Bn+25,10*Bn),yt.zIndex=11*Bn,yt.on("pointertap",v=>{v.stopPropagation();const w=Xe.getState(),A=w.agents.find(P=>P.isGod);A&&w.select(A.id),w.requestCommandCenterTab("human")}),M.addChild(yt);let Es=0,gu=0;const yu=v=>{if(yt.clear(),yt.rect(0,-8,30,22).fill(5982827),yt.rect(1,-7,28,3).fill(13481192),yt.rect(1,-4,28,17).fill(13217923),Es===0)yt.rect(13,-1,4,2).fill({color:9074015,alpha:.8}),yt.rect(15,1,2,4).fill({color:9074015,alpha:.8}),yt.rect(15,7,2,2).fill({color:9074015,alpha:.8});else{const w=Math.min(Es,8);for(let P=0;P<w;P++){const z=3+P%4*7,H=-2+Math.floor(P/4)*6;yt.rect(z,H,5,4).fill(13481192),yt.rect(z+2,H,1,1).fill(4864850)}const A=.35+.3*Math.sin(v*4);yt.rect(-2,-10,34,26).stroke({color:13481192,width:2,alpha:A})}};yu(0);const a0={x:8,y:11},l0={x:9,y:11},Rb={x:12,y:11};let on=new Map;const As=[],Ir=new Set,Br=new Map,mi=()=>o0([...on.values()]),Zo=(v,w)=>{var P;on.set(v.taskId,v.after),mi(),Ir.delete(v.actorId);const A=Br.get(v.actorId);if(A&&((P=A.parent)==null||P.removeChild(A),A.destroy(),Br.delete(v.actorId)),w){w.character.hideThought();const z=le(v.actorId);z&&xu(z,w,!0)}},u0=(v,w)=>{if(Br.has(v))return;const A=new Be;A.eventMode="none",A.rect(0,0,5,4).fill(w),A.rect(2,0,1,1).fill(4864850),M.addChild(A),Br.set(v,A)},Ib=v=>{const w=g.get(v.actorId);if(!w){Zo(v,void 0);return}Ir.add(v.actorId);const A=w.character;v.kind==="archive"&&(u0(v.actorId,v.carryColor),on.set(v.taskId,{status:"__carried__"}),mi()),A.showThought(v.thought),A.walkToAndThen(v.stand,()=>{A.faceDirection("up"),v.kind==="take"&&u0(v.actorId,v.carryColor),setTimeout(()=>{if(v.kind==="take"){const P=g.get(v.actorId);if(!P){Zo(v,void 0);return}on.set(v.taskId,{...v.after,status:"__carried__"}),mi(),P.character.walkToAndThen(P.character.getDeskTile(),()=>Zo(v,P))}else Zo(v,g.get(v.actorId))},900)})};let _u=0;const Bb=v=>{var w;for(const[A,P]of Br){const z=g.get(A);if(!z)continue;const H=z.character.getPixelPosition();P.position.set(H.x+5,H.y-10),P.zIndex=H.y+1}for(let A=As.length-1;A>=0;A--)if(!Ir.has(As[A].actorId)){const P=As.splice(A,1)[0];Ib(P)}if(gu+=v,Es>0&&yu(gu),_u+=v,_u>30&&Ir.size>0){_u=0;for(const A of[...Ir]){Ir.delete(A);const P=Br.get(A);P&&((w=P.parent)==null||w.removeChild(P),P.destroy(),Br.delete(A))}on=new Map(ea.map(A=>[A.id,{status:A.status,assignee:A.assignee}])),mi()}},Jo=(v,w)=>{if(!w&&v&&g.has(v))return v;const A=Xe.getState().agents.find(P=>P.isGod);return A&&g.has(A.id)?A.id:void 0};let ea=[],c0=!0;const h0=async()=>{try{const v=await window.cth.hiveTasks(),w=v&&Array.isArray(v.tasks)?v.tasks:[],A=w.map((F,I)=>({id:typeof(F==null?void 0:F.id)=="string"&&F.id?F.id:`idx-${I}`,status:String((F==null?void 0:F.status)??"todo"),assignee:typeof(F==null?void 0:F.assignee)=="string"&&F.assignee?F.assignee:void 0})),P=w.filter(F=>String(F==null?void 0:F.status)==="blocked"&&Array.isArray(F==null?void 0:F.humanQA)&&F.humanQA.some(I=>I&&typeof I.q=="string"&&!I.a)).length;if(P!==Es&&(Es=P,yu(gu)),c0){c0=!1,on=new Map(A.map(F=>[F.id,{status:F.status,assignee:F.assignee}])),mi(),ea=A;return}const z=new Map(ea.map(F=>[F.id,F]));let H=!1;for(const F of A){const I=z.get(F.id),Y=I==null?void 0:I.status;if(Y===F.status&&(I==null?void 0:I.assignee)===F.assignee)continue;const oe={status:F.status,assignee:F.assignee};let Fe=null;if(!I&&(F.status==="todo"||F.status==="blocked")){const ht=Jo(void 0,!0);ht&&(Fe={kind:"pin",taskId:F.id,actorId:ht,after:oe,carryColor:In[F.status],stand:F.status==="blocked"?a0:l0,thought:"pinning a new task 📌"})}else if(Y!=="doing"&&F.status==="doing"){const ht=Jo(F.assignee,!1);ht&&ht===F.assignee&&(Fe={kind:"take",taskId:F.id,actorId:ht,after:oe,carryColor:In.doing,stand:l0,thought:"grabbing my task"})}else if(F.status==="done"&&Y!=="done"){const ht=Jo((I==null?void 0:I.assignee)??F.assignee,!1);ht&&(Fe={kind:"archive",taskId:F.id,actorId:ht,after:oe,carryColor:In.done,stand:Rb,thought:"filing it as done ✔"})}else if(F.status==="blocked"&&Y!=="blocked"){const ht=Jo((I==null?void 0:I.assignee)??F.assignee,!1);ht&&(Fe={kind:"pin",taskId:F.id,actorId:ht,after:oe,carryColor:In.blocked,stand:a0,thought:"this one is stuck 😤"})}Fe&&!Ir.has(Fe.actorId)&&!As.some(ht=>ht.actorId===Fe.actorId)?(!on.has(F.id)&&Fe.kind!=="pin"&&on.set(F.id,{status:Y??"todo",assignee:I==null?void 0:I.assignee}),As.push(Fe)):(on.set(F.id,oe),H=!0)}for(const F of[...on.keys()])A.some(I=>I.id===F)||(on.delete(F),H=!0);H&&mi(),ea=A}catch{}};h0();const Db=setInterval(()=>{h0()},5e3);p.__taskBoardPoll=Db;const Fb=async v=>{const w=b.cast.byName[v.character]?v.character:b.cast.defaultCharacter,A=b.cast.byName[w],P=J(v),z=(P!=null?j[P]:void 0)??C.getSpawnPoint("entrance")??{x:2,y:2},H=D[(P??0)%D.length],F=await b.cast.getFrames(w);if(t.current!==f)return;if(!Xe.getState().agents.some(oe=>oe.id===v.id)){P!=null&&_.delete(P);return}const I=new xM({agentId:v.id,mapRenderer:C,frames:F,seatTile:z,seatDirection:X(z),spawnTile:$,glowColor:bt.accent[v.accent]??o8(A.shirt),onClick:oe=>Xe.getState().select(oe)});I.show(M);const Y={character:I,seatIndex:P,waitTile:H,charName:w};if(C.gidAt("furniture-above",z.x,z.y-2)===b.monitor.offTopLeftGid){const oe={x:z.x,y:z.y-2};Y.screen=new bM(C,oe,b.monitor),M.addChild(Y.screen.container);const Fe=C.tileSize;I.setCupSpot({x:oe.x*Fe+18,y:oe.y*Fe+23})}g.set(v.id,Y),xu(v,Y,!0)},Gb=v=>{var A;const w=g.get(v);w&&(ws(w),Cs(w),xs(w),(w.character.isCarryingCup()||w.character.hasCupOnDesk())&&(qe>=ke&&console.warn("[office] mug reclaim over cap — cup accounting drifted"),qe=Math.min(ke,qe+1),vn()),w.seatIndex!=null&&_.delete(w.seatIndex),(A=w.screen)==null||A.destroy(),w.character.hide(0),setTimeout(()=>w.character.destroy(),700),g.delete(v))},xu=(v,w,A=!1)=>{if(!(A||w.prevStatus!==v.status||w.prevAction!==v.action||w.prevCarrying!==v.carrying||w.prevPrompt!==v.lastPrompt))return;const z=w.prevStatus==="working"||w.prevStatus==="thinking"||w.prevStatus==="compacting",H=v.status==="working"||v.status==="thinking"||v.status==="compacting";H&&!z&&(w.busySince=Date.now());const F=!A&&!v.isGod&&z&&(v.status==="idle"||v.status==="success")&&w.busySince!==void 0&&Date.now()-w.busySince>=G8;H||(w.busySince=void 0),w.prevStatus=v.status,w.prevAction=v.action,w.prevCarrying=v.carrying,w.prevPrompt=v.lastPrompt;const I=w.character;if(I.setBaseAlpha(v.status==="ghost"?.5:1),w.brk){if(v.status==="idle"||v.status==="success"){I.setStatusGlyph(v.status==="success"?"success":"none");return}ws(w)}if(w.err){if(v.status==="idle"||v.status==="success"){I.setStatusGlyph(v.status==="success"?"success":"none");return}Cs(w)}if(w.run){if(v.status==="idle"||v.status==="success"){I.setStatusGlyph(v.status==="success"?"success":"none");return}xs(w)}switch(v.status){case"working":case"thinking":I.setStatusGlyph("none"),I.sitAtDesk(!0),I.showThought(Or(v),v.carrying);break;case"waiting":I.setStatusGlyph("none"),I.sitAtDesk(!1),I.showThought(Or(v,"waiting"),v.carrying);break;case"blocked":I.setStatusGlyph("blocked"),I.showThought(Or(v,"needs you")),I.walkToTile(w.waitTile);break;case"compacting":I.setStatusGlyph("compacting"),I.sitAtDesk(!0),I.showThought(Or(v,"compacting context"));break;case"looping":I.setStatusGlyph("looping"),I.sitAtDesk(!1),I.showThought(Or(v,"looping — breaker armed"));break;case"success":if(I.setStatusGlyph("success"),v.isGod){I.hideThought(),I.sitAtDesk(!0);break}I.startWandering(),F?(I.cheer(),I.showThought(Ua[Math.floor(Math.random()*Ua.length)])):I.hideThought();break;case"ghost":I.setStatusGlyph("none"),I.hideThought(),I.setIdle();break;case"idle":default:I.setStatusGlyph("none"),v.isGod?(I.sitAtDesk(!0),I.showThought(Or(v,"running the floor"))):F?(I.startWandering(),I.cheer(),I.showThought(Ua[Math.floor(Math.random()*Ua.length)])):(I.startWandering(),I.showThought(Or(v,"idle")));break}},d0=()=>{const{agents:v}=Xe.getState(),w=new Set(v.map(A=>A.id));for(const A of Array.from(g.keys()))w.has(A)||Gb(A);for(const A of v){const P=g.get(A.id);P?xu(A,P):Fb(A)}};d0();let f0=Xe.getState().selectedId;const Ob=Xe.subscribe((v,w)=>{if(v.agents!==w.agents&&d0(),v.selectedId!==f0){f0=v.selectedId;const A=v.selectedId?g.get(v.selectedId):void 0;if(A){const P=A.character.getPixelPosition();R.nudgeToward(P.x,P.y)}}});p.__unsub=Ob;const ta=C.tileSize,Lb={x:$.x*ta+ta/2,y:$.y*ta+ta},p0=v=>{if(v==="human")return Lb;const w=g.get(v);return w?w.character.getPixelPosition():null},m0=(v,w,A,P)=>{if(m.length>=y||w===v)return;const z=p0(v),H=p0(w);if(!z||!H)return;const F=new MM(z,H,A,P);M.addChild(F.container),m.push(F)},Ub=window.cth.onHiveMessage?window.cth.onHiveMessage(v=>{for(const w of v.targets)m0(v.from,w,v.act,v.needsHuman)}):()=>{},g0=v=>{const w=v.detail;w&&m0(w.from,w.to,w.act,!1)};window.addEventListener("cth:demo-handoff",g0),p.__offMessage=()=>{Ub(),window.removeEventListener("cth:demo-handoff",g0)};const Nb=()=>{const v=[];for(const P of g.values()){const z=P.character.getThoughtLayout();z&&v.push({rt:P,...z})}if(v.length<2){for(const P of v)P.rt.character.setThoughtLift(0);return}v.sort((P,z)=>z.y+z.h-(P.y+P.h)||P.x-z.x);const w=[],A=2;for(const P of v){let z=P.y,H=!0,F=0;for(;H&&F++<12;){H=!1;for(const I of w){const Y=P.x<I.x+I.w+A&&P.x+P.w+A>I.x,oe=z<I.y+I.h+A&&z+P.h+A>I.y;Y&&oe&&(z=I.y-P.h-A,H=!0)}}w.push({x:P.x,y:z,w:P.w,h:P.h}),P.rt.character.setThoughtLift(P.y-z)}},zb=v=>{const w=v.deltaMS/1e3;R.update(w);const A=T.scale.x;for(const P of g.values())P.character.setBubbleZoom(A),P.character.update(w);Sb(w),Yo(w),Eb(w),Ab(w),kb(w),Bb(w),Nb();for(let P=m.length-1;P>=0;P--)m[P].update(w)&&(m[P].destroy(),m.splice(P,1))};p.ticker.add(zb),h.current&&p.ticker.stop();const y0=new ResizeObserver(v=>{var w;for(const A of v){const{width:P,height:z}=A.contentRect;P===0||z===0||((w=p.renderer)==null||w.resize(P,z),R.setViewSize(P,z))}});y0.observe(d),p.__resize=y0})().catch(b=>{if(t.current!==f)return;console.error("[OfficeFloor] init failed:",b);const S=document.createElement("div");S.style.cssText="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:24px;color:#ffd0b5;font-family:monospace;font-size:13px;text-align:center;white-space:pre-wrap;",S.textContent=`OfficeFloor failed to start:
|
|
974
|
+
`+((b==null?void 0:b.stack)||(b==null?void 0:b.message)||String(b)),d.appendChild(S)}),()=>{var S,T,C,M,L;t.current++;const b=e.current;if(b){(S=b.__glRecovery)==null||S.call(b),(C=(T=b.__resize)==null?void 0:T.disconnect)==null||C.call(T);try{(M=b.__unsub)==null||M.call(b)}catch{}try{(L=b.__offMessage)==null||L.call(b)}catch{}try{clearInterval(b.__taskBoardPoll)}catch{}Tc(b)}for(e.current=null;d.firstChild;)d.removeChild(d.firstChild)}},[s,r]),y2.jsx("div",{ref:n,style:{width:"100%",height:"100%",boxShadow:"var(--cth-panel-border)",overflow:"hidden",imageRendering:"pixelated",background:z8(bt.ink[900])}})}function z8(n){return"#"+n.toString(16).padStart(6,"0")}function Tc(n){var e;try{(e=n.ticker)==null||e.stop()}catch{}try{n.destroy(!0,{children:!0})}catch{}}const Wg=["michael","dwight","jim","pam","stanley","kevin","angela","oscar","phyllis","meredith","creed","ryan"],Hg=["coral","mint","sky","lemon","lilac","peach"];let wb=new Map;function W8(n){if(n.live===!1)return"idle";var e=wb.get(n.team);return e!==void 0&&Date.now()-e<9e4?"working":"idle"}async function e0(n){const e=await fetch(n,{cache:"no-store"});if(!e.ok)throw new Error(String(e.status));return e.json()}async function H8(){const n=await e0("/__dsh_a2a/state");if(!n||n.nodes!==!0||!Array.isArray(n.sessions))return;const e=Array.isArray(n.activity)?n.activity:[],t=new Map;for(const l of e)t.set(l.team,l.ts);wb=t;const r=n.sessions.filter(l=>l.joined===!0),i=[],s=new Set,o=n.canvas&&Array.isArray(n.canvas.teams)?n.canvas.teams:[];for(const l of o)for(const u of l.members){const c=r.find(h=>h.id===u.id);c&&!s.has(c.id)&&(i.push(c),s.add(c.id))}for(const l of r)s.has(l.id)||i.push(l);const a=i.map((l,u)=>({id:l.id,name:l.name||l.label,character:Wg[u%Wg.length],accent:Hg[u%Hg.length],description:l.team,project:"",status:W8(l),action:l.live===!1?"cold - waiting to be woken":"on the floor",progress:0,isGod:!1}));Xe.getState().applyFeed(a)}const Jh=new Set;window.cth={onHiveMessage:function(n){return Jh.add(n),function(){Jh.delete(n)}},hiveTasks:async function(){try{const n=await e0("/__dsh_a2a/state");return{tasks:(Array.isArray(n&&n.tasks)?n.tasks:[]).map(function(t){return{id:t.taskId,status:t.status==="pending"?"open":"done",assignee:t.team}})}}catch{return null}}};function V8(n,e){if(n.length!==e.length)for(let t=n.length;t<e.length;t++){const r=e[t],i=r.ok?r.dir==="out"?"propose":"query":"refuse",s=Xe.getState().agents.find(function(a){return a.description===r.team}),o=s?s.id:"human";for(const a of Jh)a({from:"human",targets:[o],act:i,needsHuman:!1})}}async function j8(){let n=[];for(;;){try{const e=await e0("/__dsh_a2a/state"),t=Array.isArray(e.activity)?e.activity:[];V8(n,t),n=t,await H8()}catch{}await new Promise(function(e){setTimeout(e,5e3)})}}const t0=document.createElement("div");t0.setAttribute("style",["position:fixed","z-index:20","left:14px","top:12px","font-size:13px","letter-spacing:.06em","color:#f4e9c7","background:rgba(26,19,32,.82)","border:1px solid rgba(244,233,199,.25)","border-radius:6px","padding:6px 10px","pointer-events:none"].join(";"));t0.textContent="dsh-a2a-munder-difflin · A2A Floor";document.body.appendChild(t0);const n0=document.createElement("div");n0.setAttribute("style",["position:fixed","z-index:20","right:14px","bottom:12px","font-size:11px","line-height:1.7","color:#c9cede","background:rgba(26,19,32,.72)","border-radius:6px","padding:8px 10px","pointer-events:none"].join(";"));n0.innerHTML=["<b>A2A 办公层</b> - 每个加入的会话是一位员工","拖拽空白处平移 · 滚轮缩放 · 点击头像聚焦","信封颜色:<span style=color:#34d399>外发</span> / <span style=color:#a78bfa>来件</span> / <span style=color:#f87171>失败</span>"].join("<br>");document.body.appendChild(n0);const $8=document.getElementById("root");tx($8).render($s.createElement(N8));j8();ae.add(MT);ae.mixin(Ue,RT);ae.add(I1);ae.add(B1);ae.mixin(Ue,aA);ae.add(U1,O1);ae.add(L1);const X8=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Y8=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));
|