@archilogic/floor-plan-sdk 3.2.0 → 4.4.0
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 +19 -14
- package/dist/fpe.api.json +2827 -0
- package/dist/fpe.d.ts +1476 -0
- package/dist/fpe.es.js +861 -0
- package/dist/fpe.mjs +847 -0
- package/dist/fpe.umd.js +847 -0
- package/dist/style.css +1 -0
- package/package.json +23 -8
- package/fpe.css +0 -8
- package/fpe.d.ts +0 -832
- package/fpe.esm.js +0 -254
- package/fpe.js +0 -254
package/dist/fpe.es.js
ADDED
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
Archilogic Floor Plan Engine SDK v5.0.0-beta.8 webgl build nightly-230216-140848-1ac08e
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2023 Archilogic AG. All rights reserved.
|
|
5
|
+
|
|
6
|
+
License: According to your license agreement with Archilogic AG
|
|
7
|
+
*/var cf=Object.defineProperty,pf=Object.defineProperties,df=Object.getOwnPropertyDescriptors,Xo=Object.getOwnPropertySymbols,vf=Object.prototype.hasOwnProperty,mf=Object.prototype.propertyIsEnumerable,Go=(t,e,r)=>e in t?cf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yf=(t,e)=>{for(var r in e||(e={}))vf.call(e,r)&&Go(t,r,e[r]);if(Xo)for(var r of Xo(e))mf.call(e,r)&&Go(t,r,e[r]);return t},gf=(t,e)=>pf(t,df(e));const Pn=3.28084,bn=(t,e=1/64)=>{const r=1/e;return Math.round(t*r)/r};function Ho(t){return Math.sign(t)*Math.floor(Math.abs(t))}function _f(t){const e=t*Pn,r=Math.abs(e),i=bn(r%1*12);return{feet:Ho(r),inches:Ho(i),fraction:bn(i%1),isNegative:Math.sign(t)<0}}function xf(t){return t*Pn*Pn}const dr="\xA0",vr={meters:"m",feet:"\u2032",inches:"\u2033",squareMeters:"m\xB2",squareFeet:"ft\xB2",fraction:"/"};function zo(t,e=1/2,r=1/64){return!(t%e)||e<=r?[t/e,1/e]:zo(t,e/2)}const Tn=(t=0,e="metric",r=3)=>{if(e==="imperial"){const{feet:n,inches:s,fraction:o,isNegative:a}=_f(t);let l="";if(o>0){const[h,u]=zo(bn(o));l=`${dr}${h}/${u}`}return`${a?"-":""}${n}${vr.feet}${dr}${s}${l}${vr.inches}`}const i=Math.pow(10,r);return`${Math.round(t*i)/i}${dr}${vr.meters}`},Wo=(t=0,e="metric",r=0,i=!0)=>{let n="",s="";const o=Math.pow(10,r);if(e==="imperial"){const a=xf(t);n=`${Math.round(a*o)/o}`,s=`${dr}${vr.squareFeet}`}else n=`${Math.round(t*o)/o}`,s=`${dr}${vr.squareMeters}`;return i&&(n+=s),n};function wf(t){return t.replace(/([A-Z])/g,e=>` ${e}`).replace(/^./,e=>e.toUpperCase()).trim()}function Pf(t){return t.slice(0,1)==="#"&&(t=t.slice(1)),t}function $o(t){const e=Pf(t);return e.length===3?`#${e.split("").map(r=>r+r).join("")}`:t}function In(t){return t>=0&&t<=255}function bf({r:t,g:e,b:r}){return In(t)&&In(e)&&In(r)}function Tf(t){const e=$o(t),r={r:parseInt(e.substring(1,3),16),g:parseInt(e.substring(3,5),16),b:parseInt(e.substring(5,7),16)};if(bf(r))return r;throw"invalid hex color input"}function If(t){return $o(t).match(/^#[a-f0-9]{6}$/i)!==null}function qr(t){return JSON.parse(JSON.stringify(t))}function Yo(...t){let e={};for(const r of t)if(r instanceof Array)e instanceof Array||(e=[]),e=[...e,...r];else if(r instanceof Object)for(const i of Object.entries(r)){const n=i[0];let s=i[1];s instanceof Object&&n in e&&(s=Yo(e[n],s)),e=gf(yf({},e),{[n]:s})}return e}function Vo(){return typeof window<"u"&&typeof navigator<"u"&&typeof document<"u"}function Cf(){return Vo()&&navigator.platform.toUpperCase().indexOf("MAC")>=0}function Af(){return!Vo()||window.self===window.top?!1:!!(window.location.ancestorOrigins&&window.location.ancestorOrigins[0]||document.referrer)}Af(),Cf();var jt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ef(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function jo(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function i(){if(this instanceof i){var n=[null];n.push.apply(n,arguments);var s=Function.bind.apply(e,n);return new s}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}var Zo={},Jr={},Qr={},Sf={},Nf=Object.freeze({__proto__:null,default:Sf}),Cn=jo(Nf);Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.default=Mf;var Of=Lf(Cn);function Lf(t){return t&&t.__esModule?t:{default:t}}function Mf(){return Of.default.randomBytes(16)}var je={};Object.defineProperty(je,"__esModule",{value:!0}),je.default=void 0;for(var qo=[],Kr=0;Kr<256;++Kr)qo[Kr]=(Kr+256).toString(16).substr(1);function Ff(t,e){var r=e||0,i=qo;return[i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]]].join("")}var Rf=Ff;je.default=Rf,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.default=void 0;var kf=Jo(Qr),Uf=Jo(je);function Jo(t){return t&&t.__esModule?t:{default:t}}var Qo,An,En=0,Sn=0;function Bf(t,e,r){var i=e&&r||0,n=e||[];t=t||{};var s=t.node||Qo,o=t.clockseq!==void 0?t.clockseq:An;if(s==null||o==null){var a=t.random||(t.rng||kf.default)();s==null&&(s=Qo=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),o==null&&(o=An=(a[6]<<8|a[7])&16383)}var l=t.msecs!==void 0?t.msecs:new Date().getTime(),h=t.nsecs!==void 0?t.nsecs:Sn+1,u=l-En+(h-Sn)/1e4;if(u<0&&t.clockseq===void 0&&(o=o+1&16383),(u<0||l>En)&&t.nsecs===void 0&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");En=l,Sn=h,An=o,l+=122192928e5;var f=((l&268435455)*1e4+h)%4294967296;n[i++]=f>>>24&255,n[i++]=f>>>16&255,n[i++]=f>>>8&255,n[i++]=f&255;var c=l/4294967296*1e4&268435455;n[i++]=c>>>8&255,n[i++]=c&255,n[i++]=c>>>24&15|16,n[i++]=c>>>16&255,n[i++]=o>>>8|128,n[i++]=o&255;for(var d=0;d<6;++d)n[i+d]=s[d];return e||(0,Uf.default)(n)}var Df=Bf;Jr.default=Df;var ti={},pe={};Object.defineProperty(pe,"__esModule",{value:!0}),pe.default=Wf,pe.URL=pe.DNS=void 0;var Xf=Gf(je);function Gf(t){return t&&t.__esModule?t:{default:t}}function Hf(t){var e=[];return t.replace(/[a-fA-F0-9]{2}/g,function(r){e.push(parseInt(r,16))}),e}function zf(t){t=unescape(encodeURIComponent(t));for(var e=new Array(t.length),r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}const Ko="6ba7b810-9dad-11d1-80b4-00c04fd430c8";pe.DNS=Ko;const ta="6ba7b811-9dad-11d1-80b4-00c04fd430c8";pe.URL=ta;function Wf(t,e,r){var i=function(n,s,o,a){var l=o&&a||0;if(typeof n=="string"&&(n=zf(n)),typeof s=="string"&&(s=Hf(s)),!Array.isArray(n))throw TypeError("value must be an array of bytes");if(!Array.isArray(s)||s.length!==16)throw TypeError("namespace must be uuid string or an Array of 16 byte values");var h=r(s.concat(n));if(h[6]=h[6]&15|e,h[8]=h[8]&63|128,o)for(var u=0;u<16;++u)o[l+u]=h[u];return o||(0,Xf.default)(h)};try{i.name=t}catch{}return i.DNS=Ko,i.URL=ta,i}var ei={};Object.defineProperty(ei,"__esModule",{value:!0}),ei.default=void 0;var $f=Yf(Cn);function Yf(t){return t&&t.__esModule?t:{default:t}}function Vf(t){return Array.isArray(t)?t=Buffer.from(t):typeof t=="string"&&(t=Buffer.from(t,"utf8")),$f.default.createHash("md5").update(t).digest()}var jf=Vf;ei.default=jf,Object.defineProperty(ti,"__esModule",{value:!0}),ti.default=void 0;var Zf=ea(pe),qf=ea(ei);function ea(t){return t&&t.__esModule?t:{default:t}}const Jf=(0,Zf.default)("v3",48,qf.default);var Qf=Jf;ti.default=Qf;var ri={};Object.defineProperty(ri,"__esModule",{value:!0}),ri.default=void 0;var Kf=ra(Qr),tc=ra(je);function ra(t){return t&&t.__esModule?t:{default:t}}function ec(t,e,r){var i=e&&r||0;typeof t=="string"&&(e=t==="binary"?new Array(16):null,t=null),t=t||{};var n=t.random||(t.rng||Kf.default)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e)for(var s=0;s<16;++s)e[i+s]=n[s];return e||(0,tc.default)(n)}var rc=ec;ri.default=rc;var ii={},ni={};Object.defineProperty(ni,"__esModule",{value:!0}),ni.default=void 0;var ic=nc(Cn);function nc(t){return t&&t.__esModule?t:{default:t}}function sc(t){return Array.isArray(t)?t=Buffer.from(t):typeof t=="string"&&(t=Buffer.from(t,"utf8")),ic.default.createHash("sha1").update(t).digest()}var oc=sc;ni.default=oc,Object.defineProperty(ii,"__esModule",{value:!0}),ii.default=void 0;var ac=ia(pe),lc=ia(ni);function ia(t){return t&&t.__esModule?t:{default:t}}const hc=(0,ac.default)("v5",80,lc.default);var uc=hc;ii.default=uc,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"v1",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(t,"v3",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"v5",{enumerable:!0,get:function(){return n.default}});var e=s(Jr),r=s(ti),i=s(ri),n=s(ii);function s(o){return o&&o.__esModule?o:{default:o}}}(Zo);var si=Ef(Zo);si.v1,si.v3;const Ne=si.v4;si.v5;/*!
|
|
8
|
+
* @pixi/constants - v6.5.7
|
|
9
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
10
|
+
*
|
|
11
|
+
* @pixi/constants is licensed under the MIT License.
|
|
12
|
+
* http://www.opensource.org/licenses/mit-license
|
|
13
|
+
*/var Zt;(function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"})(Zt||(Zt={}));var Ze;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"})(Ze||(Ze={}));var oi;(function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"})(oi||(oi={}));var A;(function(t){t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR"})(A||(A={}));var qt;(function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(qt||(qt={}));var F;(function(t){t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(F||(F={}));var Oe;(function(t){t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(Oe||(Oe={}));var H;(function(t){t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT"})(H||(H={}));var ai;(function(t){t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT"})(ai||(ai={}));var xt;(function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"})(xt||(xt={}));var mr;(function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(mr||(mr={}));var Le;(function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL"})(Le||(Le={}));var de;(function(t){t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",t[t.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(de||(de={}));var ve;(function(t){t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT"})(ve||(ve={}));var Nn;(function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"})(Nn||(Nn={}));var Dt;(function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"})(Dt||(Dt={}));var ot;(function(t){t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE",t[t.COLOR=4]="COLOR"})(ot||(ot={}));var na;(function(t){t[t.RED=1]="RED",t[t.GREEN=2]="GREEN",t[t.BLUE=4]="BLUE",t[t.ALPHA=8]="ALPHA"})(na||(na={}));var nt;(function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"})(nt||(nt={}));var Xt;(function(t){t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(Xt||(Xt={}));/*!
|
|
14
|
+
* @pixi/settings - v6.5.7
|
|
15
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
16
|
+
*
|
|
17
|
+
* @pixi/settings is licensed under the MIT License.
|
|
18
|
+
* http://www.opensource.org/licenses/mit-license
|
|
19
|
+
*//*!
|
|
20
|
+
* @pixi/constants - v6.5.7
|
|
21
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
22
|
+
*
|
|
23
|
+
* @pixi/constants is licensed under the MIT License.
|
|
24
|
+
* http://www.opensource.org/licenses/mit-license
|
|
25
|
+
*/var sa;(function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"})(sa||(sa={}));var oa;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"})(oa||(oa={}));var aa;(function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"})(aa||(aa={}));var la;(function(t){t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR"})(la||(la={}));var ha;(function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(ha||(ha={}));var ua;(function(t){t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(ua||(ua={}));var fa;(function(t){t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(fa||(fa={}));var ca;(function(t){t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT"})(ca||(ca={}));var pa;(function(t){t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT"})(pa||(pa={}));var On;(function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"})(On||(On={}));var Ln;(function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(Ln||(Ln={}));var Mn;(function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL"})(Mn||(Mn={}));var da;(function(t){t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",t[t.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(da||(da={}));var va;(function(t){t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT"})(va||(va={}));var Fn;(function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"})(Fn||(Fn={}));var yr;(function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"})(yr||(yr={}));var ma;(function(t){t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE",t[t.COLOR=4]="COLOR"})(ma||(ma={}));var ya;(function(t){t[t.RED=1]="RED",t[t.GREEN=2]="GREEN",t[t.BLUE=4]="BLUE",t[t.ALPHA=8]="ALPHA"})(ya||(ya={}));var Rn;(function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"})(Rn||(Rn={}));var ga;(function(t){t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(ga||(ga={}));var fc={createCanvas:function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,r},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var t;return(t=document.baseURI)!==null&&t!==void 0?t:window.location.href},fetch:function(t,e){return fetch(t,e)}},kn=/iPhone/i,_a=/iPod/i,xa=/iPad/i,wa=/\biOS-universal(?:.+)Mac\b/i,Un=/\bAndroid(?:.+)Mobile\b/i,Pa=/Android/i,qe=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,li=/Silk/i,Jt=/Windows Phone/i,ba=/\bWindows(?:.+)ARM\b/i,Ta=/BlackBerry/i,Ia=/BB10/i,Ca=/Opera Mini/i,Aa=/\b(CriOS|Chrome)(?:.+)Mobile/i,Ea=/Mobile(?:.+)Firefox\b/i,Sa=function(t){return typeof t<"u"&&t.platform==="MacIntel"&&typeof t.maxTouchPoints=="number"&&t.maxTouchPoints>1&&typeof MSStream>"u"};function cc(t){return function(e){return e.test(t)}}function pc(t){var e={userAgent:"",platform:"",maxTouchPoints:0};!t&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof t=="string"?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0});var r=e.userAgent,i=r.split("[FBAN");typeof i[1]<"u"&&(r=i[0]),i=r.split("Twitter"),typeof i[1]<"u"&&(r=i[0]);var n=cc(r),s={apple:{phone:n(kn)&&!n(Jt),ipod:n(_a),tablet:!n(kn)&&(n(xa)||Sa(e))&&!n(Jt),universal:n(wa),device:(n(kn)||n(_a)||n(xa)||n(wa)||Sa(e))&&!n(Jt)},amazon:{phone:n(qe),tablet:!n(qe)&&n(li),device:n(qe)||n(li)},android:{phone:!n(Jt)&&n(qe)||!n(Jt)&&n(Un),tablet:!n(Jt)&&!n(qe)&&!n(Un)&&(n(li)||n(Pa)),device:!n(Jt)&&(n(qe)||n(li)||n(Un)||n(Pa))||n(/\bokhttp\b/i)},windows:{phone:n(Jt),tablet:n(ba),device:n(Jt)||n(ba)},other:{blackberry:n(Ta),blackberry10:n(Ia),opera:n(Ca),firefox:n(Ea),chrome:n(Aa),device:n(Ta)||n(Ia)||n(Ca)||n(Ea)||n(Aa)},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}var Me=pc(globalThis.navigator);function dc(){return!Me.apple.device}function vc(t){var e=!0;if(Me.tablet||Me.phone){if(Me.apple.device){var r=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(r){var i=parseInt(r[1],10);i<11&&(e=!1)}}if(Me.android.device){var r=navigator.userAgent.match(/Android\s([0-9.]*)/);if(r){var i=parseInt(r[1],10);i<7&&(e=!1)}}}return e?t:4}var R={ADAPTER:fc,MIPMAP_TEXTURES:Mn.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:Rn.NONE,SPRITE_MAX_TEXTURES:vc(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:Fn.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:Ln.CLAMP,SCALE_MODE:On.LINEAR,PRECISION_VERTEX:yr.HIGH,PRECISION_FRAGMENT:Me.apple.device?yr.HIGH:yr.MEDIUM,CAN_UPLOAD_SAME_BUFFER:dc(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};/*!
|
|
26
|
+
* @pixi/extensions - v6.5.7
|
|
27
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
28
|
+
*
|
|
29
|
+
* @pixi/extensions is licensed under the MIT License.
|
|
30
|
+
* http://www.opensource.org/licenses/mit-license
|
|
31
|
+
*//*! *****************************************************************************
|
|
32
|
+
Copyright (c) Microsoft Corporation.
|
|
33
|
+
|
|
34
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
35
|
+
purpose with or without fee is hereby granted.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
38
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
39
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
40
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
41
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
42
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
43
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
44
|
+
***************************************************************************** */var gr=function(){return gr=Object.assign||function(e){for(var r=arguments,i,n=1,s=arguments.length;n<s;n++){i=r[n];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},gr.apply(this,arguments)},dt;(function(t){t.Application="application",t.RendererPlugin="renderer-webgl-plugin",t.CanvasRendererPlugin="renderer-canvas-plugin",t.Loader="loader",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser"})(dt||(dt={}));var Na=function(t){if(typeof t=="function"||typeof t=="object"&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");var e=typeof t.extension!="object"?{type:t.extension}:t.extension;t=gr(gr({},e),{ref:t})}if(typeof t=="object")t=gr({},t);else throw new Error("Invalid extension type");return typeof t.type=="string"&&(t.type=[t.type]),t},Gt={_addHandlers:null,_removeHandlers:null,_queue:{},remove:function(){for(var t=arguments,e=this,r=[],i=0;i<arguments.length;i++)r[i]=t[i];return r.map(Na).forEach(function(n){n.type.forEach(function(s){var o,a;return(a=(o=e._removeHandlers)[s])===null||a===void 0?void 0:a.call(o,n)})}),this},add:function(){for(var t=arguments,e=this,r=[],i=0;i<arguments.length;i++)r[i]=t[i];return r.map(Na).forEach(function(n){n.type.forEach(function(s){var o=e._addHandlers,a=e._queue;o[s]?o[s](n):(a[s]=a[s]||[],a[s].push(n))})}),this},handle:function(t,e,r){var i=this._addHandlers=this._addHandlers||{},n=this._removeHandlers=this._removeHandlers||{};if(i[t]||n[t])throw new Error("Extension type "+t+" already has a handler");i[t]=e,n[t]=r;var s=this._queue;return s[t]&&(s[t].forEach(function(o){return e(o)}),delete s[t]),this},handleByMap:function(t,e){return this.handle(t,function(r){e[r.name]=r.ref},function(r){delete e[r.name]})},handleByList:function(t,e){return this.handle(t,function(r){var i,n;e.push(r.ref),t===dt.Loader&&((n=(i=r.ref).add)===null||n===void 0||n.call(i))},function(r){var i=e.indexOf(r.ref);i!==-1&&e.splice(i,1)})}};/*!
|
|
45
|
+
* @pixi/ticker - v6.5.7
|
|
46
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
47
|
+
*
|
|
48
|
+
* @pixi/ticker is licensed under the MIT License.
|
|
49
|
+
* http://www.opensource.org/licenses/mit-license
|
|
50
|
+
*/R.TARGET_FPMS=.06;var me;(function(t){t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY"})(me||(me={}));var Bn=function(){function t(e,r,i,n){r===void 0&&(r=null),i===void 0&&(i=0),n===void 0&&(n=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=r,this.priority=i,this.once=n}return t.prototype.match=function(e,r){return r===void 0&&(r=null),this.fn===e&&this.context===r},t.prototype.emit=function(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));var r=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),r},t.prototype.connect=function(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this},t.prototype.destroy=function(e){e===void 0&&(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);var r=this.next;return this.next=e?null:r,this.previous=null,r},t}(),vt=function(){function t(){var e=this;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 Bn(null,null,1/0),this.deltaMS=1/R.TARGET_FPMS,this.elapsedMS=1/R.TARGET_FPMS,this._tick=function(r){e._requestId=null,e.started&&(e.update(r),e.started&&e._requestId===null&&e._head.next&&(e._requestId=requestAnimationFrame(e._tick)))}}return t.prototype._requestIfNeeded=function(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},t.prototype._cancelIfNeeded=function(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)},t.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},t.prototype.add=function(e,r,i){return i===void 0&&(i=me.NORMAL),this._addListener(new Bn(e,r,i))},t.prototype.addOnce=function(e,r,i){return i===void 0&&(i=me.NORMAL),this._addListener(new Bn(e,r,i,!0))},t.prototype._addListener=function(e){var r=this._head.next,i=this._head;if(!r)e.connect(i);else{for(;r;){if(e.priority>r.priority){e.connect(i);break}i=r,r=r.next}e.previous||e.connect(i)}return this._startIfPossible(),this},t.prototype.remove=function(e,r){for(var i=this._head.next;i;)i.match(e,r)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(t.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,r=this._head;r=r.next;)e++;return e},enumerable:!1,configurable:!0}),t.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},t.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},t.prototype.destroy=function(){if(!this._protected){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}},t.prototype.update=function(e){e===void 0&&(e=performance.now());var r;if(e>this.lastTime){if(r=this.elapsedMS=e-this.lastTime,r>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){var i=e-this._lastFrame|0;if(i<this._minElapsedMS)return;this._lastFrame=e-i%this._minElapsedMS}this.deltaMS=r,this.deltaTime=this.deltaMS*R.TARGET_FPMS;for(var n=this._head,s=n.next;s;)s=s.emit(this.deltaTime);n.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e},Object.defineProperty(t.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(e){var r=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,r)/1e3,R.TARGET_FPMS);this._maxElapsedMS=1/i},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(e){if(e===0)this._minElapsedMS=0;else{var r=Math.max(this.minFPS,e);this._minElapsedMS=1/(r/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"shared",{get:function(){if(!t._shared){var e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared},enumerable:!1,configurable:!0}),Object.defineProperty(t,"system",{get:function(){if(!t._system){var e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system},enumerable:!1,configurable:!0}),t}();(function(){function t(){}return t.init=function(e){var r=this;e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set:function(i){this._ticker&&this._ticker.remove(this.render,this),this._ticker=i,i&&i.add(this.render,this,me.LOW)},get:function(){return this._ticker}}),this.stop=function(){r._ticker.stop()},this.start=function(){r._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?vt.shared:new vt,e.autoStart&&this.start()},t.destroy=function(){if(this._ticker){var e=this._ticker;this.ticker=null,e.destroy()}},t.extension=dt.Application,t})();var ye={},mc={get exports(){return ye},set exports(t){ye=t}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function n(l,h,u){this.fn=l,this.context=h,this.once=u||!1}function s(l,h,u,f,c){if(typeof u!="function")throw new TypeError("The listener must be a function");var d=new n(u,f||l,c),v=r?r+h:h;return l._events[v]?l._events[v].fn?l._events[v]=[l._events[v],d]:l._events[v].push(d):(l._events[v]=d,l._eventsCount++),l}function o(l,h){--l._eventsCount===0?l._events=new i:delete l._events[h]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var h=[],u,f;if(this._eventsCount===0)return h;for(f in u=this._events)e.call(u,f)&&h.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(u)):h},a.prototype.listeners=function(h){var u=r?r+h:h,f=this._events[u];if(!f)return[];if(f.fn)return[f.fn];for(var c=0,d=f.length,v=new Array(d);c<d;c++)v[c]=f[c].fn;return v},a.prototype.listenerCount=function(h){var u=r?r+h:h,f=this._events[u];return f?f.fn?1:f.length:0},a.prototype.emit=function(h,u,f,c,d,v){var y=r?r+h:h;if(!this._events[y])return!1;var m=this._events[y],g=arguments.length,x,_;if(m.fn){switch(m.once&&this.removeListener(h,m.fn,void 0,!0),g){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,u),!0;case 3:return m.fn.call(m.context,u,f),!0;case 4:return m.fn.call(m.context,u,f,c),!0;case 5:return m.fn.call(m.context,u,f,c,d),!0;case 6:return m.fn.call(m.context,u,f,c,d,v),!0}for(_=1,x=new Array(g-1);_<g;_++)x[_-1]=arguments[_];m.fn.apply(m.context,x)}else{var P=m.length,w;for(_=0;_<P;_++)switch(m[_].once&&this.removeListener(h,m[_].fn,void 0,!0),g){case 1:m[_].fn.call(m[_].context);break;case 2:m[_].fn.call(m[_].context,u);break;case 3:m[_].fn.call(m[_].context,u,f);break;case 4:m[_].fn.call(m[_].context,u,f,c);break;default:if(!x)for(w=1,x=new Array(g-1);w<g;w++)x[w-1]=arguments[w];m[_].fn.apply(m[_].context,x)}}return!0},a.prototype.on=function(h,u,f){return s(this,h,u,f,!1)},a.prototype.once=function(h,u,f){return s(this,h,u,f,!0)},a.prototype.removeListener=function(h,u,f,c){var d=r?r+h:h;if(!this._events[d])return this;if(!u)return o(this,d),this;var v=this._events[d];if(v.fn)v.fn===u&&(!c||v.once)&&(!f||v.context===f)&&o(this,d);else{for(var y=0,m=[],g=v.length;y<g;y++)(v[y].fn!==u||c&&!v[y].once||f&&v[y].context!==f)&&m.push(v[y]);m.length?this._events[d]=m.length===1?m[0]:m:o(this,d)}return this},a.prototype.removeAllListeners=function(h){var u;return h?(u=r?r+h:h,this._events[u]&&o(this,u)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a})(mc);var _r={},yc={get exports(){return _r},set exports(t){_r=t}};yc.exports=hi,_r.default=hi;function hi(t,e,r){r=r||2;var i=e&&e.length,n=i?e[0]*r:t.length,s=Oa(t,0,n,r,!0),o=[];if(!s||s.next===s.prev)return o;var a,l,h,u,f,c,d;if(i&&(s=Pc(t,e,s,r)),t.length>80*r){a=h=t[0],l=u=t[1];for(var v=r;v<n;v+=r)f=t[v],c=t[v+1],f<a&&(a=f),c<l&&(l=c),f>h&&(h=f),c>u&&(u=c);d=Math.max(h-a,u-l),d=d!==0?32767/d:0}return xr(s,o,r,a,l,d,0),o}function Oa(t,e,r,i,n){var s,o;if(n===Gn(t,e,r,i)>0)for(s=e;s<r;s+=i)o=Fa(s,t[s],t[s+1],o);else for(s=r-i;s>=e;s-=i)o=Fa(s,t[s],t[s+1],o);return o&&ui(o,o.next)&&(Pr(o),o=o.next),o}function Fe(t,e){if(!t)return t;e||(e=t);var r=t,i;do if(i=!1,!r.steiner&&(ui(r,r.next)||K(r.prev,r,r.next)===0)){if(Pr(r),r=e=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function xr(t,e,r,i,n,s,o){if(t){!o&&s&&Ac(t,i,n,s);for(var a=t,l,h;t.prev!==t.next;){if(l=t.prev,h=t.next,s?_c(t,i,n,s):gc(t)){e.push(l.i/r|0),e.push(t.i/r|0),e.push(h.i/r|0),Pr(t),t=h.next,a=h.next;continue}if(t=h,t===a){o?o===1?(t=xc(Fe(t),e,r),xr(t,e,r,i,n,s,2)):o===2&&wc(t,e,r,i,n,s):xr(Fe(t),e,r,i,n,s,1);break}}}}function gc(t){var e=t.prev,r=t,i=t.next;if(K(e,r,i)>=0)return!1;for(var n=e.x,s=r.x,o=i.x,a=e.y,l=r.y,h=i.y,u=n<s?n<o?n:o:s<o?s:o,f=a<l?a<h?a:h:l<h?l:h,c=n>s?n>o?n:o:s>o?s:o,d=a>l?a>h?a:h:l>h?l:h,v=i.next;v!==e;){if(v.x>=u&&v.x<=c&&v.y>=f&&v.y<=d&&Je(n,a,s,l,o,h,v.x,v.y)&&K(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function _c(t,e,r,i){var n=t.prev,s=t,o=t.next;if(K(n,s,o)>=0)return!1;for(var a=n.x,l=s.x,h=o.x,u=n.y,f=s.y,c=o.y,d=a<l?a<h?a:h:l<h?l:h,v=u<f?u<c?u:c:f<c?f:c,y=a>l?a>h?a:h:l>h?l:h,m=u>f?u>c?u:c:f>c?f:c,g=Dn(d,v,e,r,i),x=Dn(y,m,e,r,i),_=t.prevZ,P=t.nextZ;_&&_.z>=g&&P&&P.z<=x;){if(_.x>=d&&_.x<=y&&_.y>=v&&_.y<=m&&_!==n&&_!==o&&Je(a,u,l,f,h,c,_.x,_.y)&&K(_.prev,_,_.next)>=0||(_=_.prevZ,P.x>=d&&P.x<=y&&P.y>=v&&P.y<=m&&P!==n&&P!==o&&Je(a,u,l,f,h,c,P.x,P.y)&&K(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;_&&_.z>=g;){if(_.x>=d&&_.x<=y&&_.y>=v&&_.y<=m&&_!==n&&_!==o&&Je(a,u,l,f,h,c,_.x,_.y)&&K(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;P&&P.z<=x;){if(P.x>=d&&P.x<=y&&P.y>=v&&P.y<=m&&P!==n&&P!==o&&Je(a,u,l,f,h,c,P.x,P.y)&&K(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function xc(t,e,r){var i=t;do{var n=i.prev,s=i.next.next;!ui(n,s)&&La(n,i,i.next,s)&&wr(n,s)&&wr(s,n)&&(e.push(n.i/r|0),e.push(i.i/r|0),e.push(s.i/r|0),Pr(i),Pr(i.next),i=t=s),i=i.next}while(i!==t);return Fe(i)}function wc(t,e,r,i,n,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Nc(o,a)){var l=Ma(o,a);o=Fe(o,o.next),l=Fe(l,l.next),xr(o,e,r,i,n,s,0),xr(l,e,r,i,n,s,0);return}a=a.next}o=o.next}while(o!==t)}function Pc(t,e,r,i){var n=[],s,o,a,l,h;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:t.length,h=Oa(t,a,l,i,!1),h===h.next&&(h.steiner=!0),n.push(Sc(h));for(n.sort(bc),s=0;s<n.length;s++)r=Tc(n[s],r);return r}function bc(t,e){return t.x-e.x}function Tc(t,e){var r=Ic(t,e);if(!r)return e;var i=Ma(r,t);return Fe(i,i.next),Fe(r,r.next)}function Ic(t,e){var r=e,i=t.x,n=t.y,s=-1/0,o;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){var a=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s&&(s=a,o=r.x<r.next.x?r:r.next,a===i))return o}r=r.next}while(r!==e);if(!o)return null;var l=o,h=o.x,u=o.y,f=1/0,c;r=o;do i>=r.x&&r.x>=h&&i!==r.x&&Je(n<u?i:s,n,h,u,n<u?s:i,n,r.x,r.y)&&(c=Math.abs(n-r.y)/(i-r.x),wr(r,t)&&(c<f||c===f&&(r.x>o.x||r.x===o.x&&Cc(o,r)))&&(o=r,f=c)),r=r.next;while(r!==l);return o}function Cc(t,e){return K(t.prev,t,e.prev)<0&&K(e.next,t,t.next)<0}function Ac(t,e,r,i){var n=t;do n.z===0&&(n.z=Dn(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,Ec(n)}function Ec(t){var e,r,i,n,s,o,a,l,h=1;do{for(r=t,t=null,s=null,o=0;r;){for(o++,i=r,a=0,e=0;e<h&&(a++,i=i.nextZ,!!i);e++);for(l=h;a>0||l>0&&i;)a!==0&&(l===0||!i||r.z<=i.z)?(n=r,r=r.nextZ,a--):(n=i,i=i.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=i}s.nextZ=null,h*=2}while(o>1);return t}function Dn(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Sc(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function Je(t,e,r,i,n,s,o,a){return(n-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(i-a)>=(r-o)*(e-a)&&(r-o)*(s-a)>=(n-o)*(i-a)}function Nc(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Oc(t,e)&&(wr(t,e)&&wr(e,t)&&Lc(t,e)&&(K(t.prev,t,e.prev)||K(t,e.prev,e))||ui(t,e)&&K(t.prev,t,t.next)>0&&K(e.prev,e,e.next)>0)}function K(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ui(t,e){return t.x===e.x&&t.y===e.y}function La(t,e,r,i){var n=ci(K(t,e,r)),s=ci(K(t,e,i)),o=ci(K(r,i,t)),a=ci(K(r,i,e));return!!(n!==s&&o!==a||n===0&&fi(t,r,e)||s===0&&fi(t,i,e)||o===0&&fi(r,t,i)||a===0&&fi(r,e,i))}function fi(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ci(t){return t>0?1:t<0?-1:0}function Oc(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&La(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function wr(t,e){return K(t.prev,t,t.next)<0?K(t,e,t.next)>=0&&K(t,t.prev,e)>=0:K(t,e,t.prev)<0||K(t,t.next,e)<0}function Lc(t,e){var r=t,i=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}function Ma(t,e){var r=new Xn(t.i,t.x,t.y),i=new Xn(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function Fa(t,e,r,i){var n=new Xn(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Pr(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Xn(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}hi.deviation=function(t,e,r,i){var n=e&&e.length,s=n?e[0]*r:t.length,o=Math.abs(Gn(t,0,s,r));if(n)for(var a=0,l=e.length;a<l;a++){var h=e[a]*r,u=a<l-1?e[a+1]*r:t.length;o-=Math.abs(Gn(t,h,u,r))}var f=0;for(a=0;a<i.length;a+=3){var c=i[a]*r,d=i[a+1]*r,v=i[a+2]*r;f+=Math.abs((t[c]-t[v])*(t[d+1]-t[c+1])-(t[c]-t[d])*(t[v+1]-t[c+1]))}return o===0&&f===0?0:Math.abs((f-o)/o)};function Gn(t,e,r,i){for(var n=0,s=e,o=r-i;s<r;s+=i)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}hi.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},i=0,n=0;n<t.length;n++){for(var s=0;s<t[n].length;s++)for(var o=0;o<e;o++)r.vertices.push(t[n][s][o]);n>0&&(i+=t[n-1].length,r.holes.push(i))}return r};/*! https://mths.be/punycode v1.4.1 by @mathias */var Hn=2147483647,br=36,Ra=1,zn=26,Mc=38,Fc=700,Rc=72,kc=128,Uc="-",Bc=/[^\x20-\x7E]/,Dc=/[\x2E\u3002\uFF0E\uFF61]/g,Xc={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Wn=br-Ra,Qe=Math.floor,$n=String.fromCharCode;function ka(t){throw new RangeError(Xc[t])}function Gc(t,e){for(var r=t.length,i=[];r--;)i[r]=e(t[r]);return i}function Hc(t,e){var r=t.split("@"),i="";r.length>1&&(i=r[0]+"@",t=r[1]),t=t.replace(Dc,".");var n=t.split("."),s=Gc(n,e).join(".");return i+s}function zc(t){for(var e=[],r=0,i=t.length,n,s;r<i;)n=t.charCodeAt(r++),n>=55296&&n<=56319&&r<i?(s=t.charCodeAt(r++),(s&64512)==56320?e.push(((n&1023)<<10)+(s&1023)+65536):(e.push(n),r--)):e.push(n);return e}function Ua(t,e){return t+22+75*(t<26)-((e!=0)<<5)}function Wc(t,e,r){var i=0;for(t=r?Qe(t/Fc):t>>1,t+=Qe(t/e);t>Wn*zn>>1;i+=br)t=Qe(t/Wn);return Qe(i+(Wn+1)*t/(t+Mc))}function $c(t){var e,r,i,n,s,o,a,l,h,u,f,c=[],d,v,y,m;for(t=zc(t),d=t.length,e=kc,r=0,s=Rc,o=0;o<d;++o)f=t[o],f<128&&c.push($n(f));for(i=n=c.length,n&&c.push(Uc);i<d;){for(a=Hn,o=0;o<d;++o)f=t[o],f>=e&&f<a&&(a=f);for(v=i+1,a-e>Qe((Hn-r)/v)&&ka("overflow"),r+=(a-e)*v,e=a,o=0;o<d;++o)if(f=t[o],f<e&&++r>Hn&&ka("overflow"),f==e){for(l=r,h=br;u=h<=s?Ra:h>=s+zn?zn:h-s,!(l<u);h+=br)m=l-u,y=br-u,c.push($n(Ua(u+m%y,0))),l=Qe(m/y);c.push($n(Ua(l,0))),s=Wc(r,v,i==n),r=0,++i}++r,++e}return c.join("")}function Yc(t){return Hc(t,function(e){return Bc.test(e)?"xn--"+$c(e):e})}function pi(t){return t===null}function Vc(t){return t==null}function Yn(t){return typeof t=="string"}function Ba(t){return typeof t=="object"&&t!==null}function jc(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Da=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function Tr(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}}function Zc(t,e,r,i){return e=e||"&",r=r||"=",t===null&&(t=void 0),typeof t=="object"?Xa(qc(t),function(n){var s=encodeURIComponent(Tr(n))+r;return Da(t[n])?Xa(t[n],function(o){return s+encodeURIComponent(Tr(o))}).join(e):s+encodeURIComponent(Tr(t[n]))}).join(e):i?encodeURIComponent(Tr(i))+r+encodeURIComponent(Tr(t)):""}function Xa(t,e){if(t.map)return t.map(e);for(var r=[],i=0;i<t.length;i++)r.push(e(t[i],i));return r}var qc=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e};function Ga(t,e,r,i){e=e||"&",r=r||"=";var n={};if(typeof t!="string"||t.length===0)return n;var s=/\+/g;t=t.split(e);var o=1e3;i&&typeof i.maxKeys=="number"&&(o=i.maxKeys);var a=t.length;o>0&&a>o&&(a=o);for(var l=0;l<a;++l){var h=t[l].replace(s,"%20"),u=h.indexOf(r),f,c,d,v;u>=0?(f=h.substr(0,u),c=h.substr(u+1)):(f=h,c=""),d=decodeURIComponent(f),v=decodeURIComponent(c),jc(n,d)?Da(n[d])?n[d].push(v):n[d]=[n[d],v]:n[d]=v}return n}function Qt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Jc=/^([a-z0-9.+-]+:)/i,Qc=/:[0-9]*$/,Kc=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,tp=["<",">",'"',"`"," ","\r",`
|
|
51
|
+
`," "],ep=["{","}","|","\\","^","`"].concat(tp),Vn=["'"].concat(ep),Ha=["%","/","?",";","#"].concat(Vn),za=["/","?","#"],rp=255,Wa=/^[+a-z0-9A-Z_-]{0,63}$/,ip=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,np={javascript:!0,"javascript:":!0},jn={javascript:!0,"javascript:":!0},Ke={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Zn(t,e,r){if(t&&Ba(t)&&t instanceof Qt)return t;var i=new Qt;return i.parse(t,e,r),i}Qt.prototype.parse=function(t,e,r){return $a(this,t,e,r)};function $a(t,e,r,i){if(!Yn(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),s=n!==-1&&n<e.indexOf("#")?"?":"#",o=e.split(s),a=/\\/g;o[0]=o[0].replace(a,"/"),e=o.join(s);var l=e;if(l=l.trim(),!i&&e.split("#").length===1){var h=Kc.exec(l);if(h)return t.path=l,t.href=l,t.pathname=h[1],h[2]?(t.search=h[2],r?t.query=Ga(t.search.substr(1)):t.query=t.search.substr(1)):r&&(t.search="",t.query={}),t}var u=Jc.exec(l);if(u){u=u[0];var f=u.toLowerCase();t.protocol=f,l=l.substr(u.length)}if(i||u||l.match(/^\/\/[^@\/]+@[^@\/]+/)){var c=l.substr(0,2)==="//";c&&!(u&&jn[u])&&(l=l.substr(2),t.slashes=!0)}var d,v,y,m;if(!jn[u]&&(c||u&&!Ke[u])){var g=-1;for(d=0;d<za.length;d++)v=l.indexOf(za[d]),v!==-1&&(g===-1||v<g)&&(g=v);var x,_;for(g===-1?_=l.lastIndexOf("@"):_=l.lastIndexOf("@",g),_!==-1&&(x=l.slice(0,_),l=l.slice(_+1),t.auth=decodeURIComponent(x)),g=-1,d=0;d<Ha.length;d++)v=l.indexOf(Ha[d]),v!==-1&&(g===-1||v<g)&&(g=v);g===-1&&(g=l.length),t.host=l.slice(0,g),l=l.slice(g),Ya(t),t.hostname=t.hostname||"";var P=t.hostname[0]==="["&&t.hostname[t.hostname.length-1]==="]";if(!P){var w=t.hostname.split(/\./);for(d=0,y=w.length;d<y;d++){var b=w[d];if(b&&!b.match(Wa)){for(var T="",E=0,I=b.length;E<I;E++)b.charCodeAt(E)>127?T+="x":T+=b[E];if(!T.match(Wa)){var C=w.slice(0,d),O=w.slice(d+1),L=b.match(ip);L&&(C.push(L[1]),O.unshift(L[2])),O.length&&(l="/"+O.join(".")+l),t.hostname=C.join(".");break}}}}t.hostname.length>rp?t.hostname="":t.hostname=t.hostname.toLowerCase(),P||(t.hostname=Yc(t.hostname)),m=t.port?":"+t.port:"";var M=t.hostname||"";t.host=M+m,t.href+=t.host,P&&(t.hostname=t.hostname.substr(1,t.hostname.length-2),l[0]!=="/"&&(l="/"+l))}if(!np[f])for(d=0,y=Vn.length;d<y;d++){var U=Vn[d];if(l.indexOf(U)!==-1){var S=encodeURIComponent(U);S===U&&(S=escape(U)),l=l.split(U).join(S)}}var k=l.indexOf("#");k!==-1&&(t.hash=l.substr(k),l=l.slice(0,k));var D=l.indexOf("?");if(D!==-1?(t.search=l.substr(D),t.query=l.substr(D+1),r&&(t.query=Ga(t.query)),l=l.slice(0,D)):r&&(t.search="",t.query={}),l&&(t.pathname=l),Ke[f]&&t.hostname&&!t.pathname&&(t.pathname="/"),t.pathname||t.search){m=t.pathname||"";var gt=t.search||"";t.path=m+gt}return t.href=qn(t),t}function sp(t){return Yn(t)&&(t=$a({},t)),qn(t)}function qn(t){var e=t.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var r=t.protocol||"",i=t.pathname||"",n=t.hash||"",s=!1,o="";t.host?s=e+t.host:t.hostname&&(s=e+(t.hostname.indexOf(":")===-1?t.hostname:"["+this.hostname+"]"),t.port&&(s+=":"+t.port)),t.query&&Ba(t.query)&&Object.keys(t.query).length&&(o=Zc(t.query));var a=t.search||o&&"?"+o||"";return r&&r.substr(-1)!==":"&&(r+=":"),t.slashes||(!r||Ke[r])&&s!==!1?(s="//"+(s||""),i&&i.charAt(0)!=="/"&&(i="/"+i)):s||(s=""),n&&n.charAt(0)!=="#"&&(n="#"+n),a&&a.charAt(0)!=="?"&&(a="?"+a),i=i.replace(/[?#]/g,function(l){return encodeURIComponent(l)}),a=a.replace("#","%23"),r+s+i+a+n}Qt.prototype.format=function(){return qn(this)};function op(t,e){return Zn(t,!1,!0).resolve(e)}Qt.prototype.resolve=function(t){return this.resolveObject(Zn(t,!1,!0)).format()},Qt.prototype.resolveObject=function(t){if(Yn(t)){var e=new Qt;e.parse(t,!1,!0),t=e}for(var r=new Qt,i=Object.keys(this),n=0;n<i.length;n++){var s=i[n];r[s]=this[s]}if(r.hash=t.hash,t.href==="")return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var o=Object.keys(t),a=0;a<o.length;a++){var l=o[a];l!=="protocol"&&(r[l]=t[l])}return Ke[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}var h;if(t.protocol&&t.protocol!==r.protocol){if(!Ke[t.protocol]){for(var u=Object.keys(t),f=0;f<u.length;f++){var c=u[f];r[c]=t[c]}return r.href=r.format(),r}if(r.protocol=t.protocol,!t.host&&!jn[t.protocol]){for(h=(t.pathname||"").split("/");h.length&&!(t.host=h.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),h[0]!==""&&h.unshift(""),h.length<2&&h.unshift(""),r.pathname=h.join("/")}else r.pathname=t.pathname;if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var d=r.pathname||"",v=r.search||"";r.path=d+v}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var y=r.pathname&&r.pathname.charAt(0)==="/",m=t.host||t.pathname&&t.pathname.charAt(0)==="/",g=m||y||r.host&&t.pathname,x=g,_=r.pathname&&r.pathname.split("/")||[],P=r.protocol&&!Ke[r.protocol];h=t.pathname&&t.pathname.split("/")||[],P&&(r.hostname="",r.port=null,r.host&&(_[0]===""?_[0]=r.host:_.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(h[0]===""?h[0]=t.host:h.unshift(t.host)),t.host=null),g=g&&(h[0]===""||_[0]===""));var w;if(m)r.host=t.host||t.host===""?t.host:r.host,r.hostname=t.hostname||t.hostname===""?t.hostname:r.hostname,r.search=t.search,r.query=t.query,_=h;else if(h.length)_||(_=[]),_.pop(),_=_.concat(h),r.search=t.search,r.query=t.query;else if(!Vc(t.search))return P&&(r.hostname=r.host=_.shift(),w=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1,w&&(r.auth=w.shift(),r.host=r.hostname=w.shift())),r.search=t.search,r.query=t.query,(!pi(r.pathname)||!pi(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var b=_.slice(-1)[0],T=(r.host||t.host||_.length>1)&&(b==="."||b==="..")||b==="",E=0,I=_.length;I>=0;I--)b=_[I],b==="."?_.splice(I,1):b===".."?(_.splice(I,1),E++):E&&(_.splice(I,1),E--);if(!g&&!x)for(;E--;E)_.unshift("..");g&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")&&_.unshift(""),T&&_.join("/").substr(-1)!=="/"&&_.push("");var C=_[0]===""||_[0]&&_[0].charAt(0)==="/";return P&&(r.hostname=r.host=C?"":_.length?_.shift():"",w=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1,w&&(r.auth=w.shift(),r.host=r.hostname=w.shift())),g=g||r.host&&_.length,g&&!C&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),(!pi(r.pathname)||!pi(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},Qt.prototype.parseHost=function(){return Ya(this)};function Ya(t){var e=t.host,r=Qc.exec(e);r&&(r=r[0],r!==":"&&(t.port=r.substr(1)),e=e.substr(0,e.length-r.length)),e&&(t.hostname=e)}/*!
|
|
52
|
+
* @pixi/utils - v6.5.7
|
|
53
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
54
|
+
*
|
|
55
|
+
* @pixi/utils is licensed under the MIT License.
|
|
56
|
+
* http://www.opensource.org/licenses/mit-license
|
|
57
|
+
*/var ap={parse:Zn,format:sp,resolve:op};R.RETINA_PREFIX=/@([0-9\.]+)x/,R.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Jn=!1,Va="6.5.7";function lp(){Jn=!0}function ja(t){var e;if(!Jn){if(R.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var r=[`
|
|
58
|
+
%c %c %c PixiJS `+Va+" - \u2730 "+t+` \u2730 %c %c http://www.pixijs.com/ %c %c \u2665%c\u2665%c\u2665
|
|
59
|
+
|
|
60
|
+
`,"background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=globalThis.console).log.apply(e,r)}else globalThis.console&&globalThis.console.log("PixiJS "+Va+" - "+t+" - http://www.pixijs.com/");Jn=!0}}var Qn;function hp(){return typeof Qn>"u"&&(Qn=function(){var e={stencil:!0,failIfMajorPerformanceCaveat:R.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!R.ADAPTER.getWebGLRenderingContext())return!1;var r=R.ADAPTER.createCanvas(),i=r.getContext("webgl",e)||r.getContext("experimental-webgl",e),n=!!(i&&i.getContextAttributes().stencil);if(i){var s=i.getExtension("WEBGL_lose_context");s&&s.loseContext()}return i=null,n}catch{return!1}}()),Qn}var up="#f0f8ff",fp="#faebd7",cp="#00ffff",pp="#7fffd4",dp="#f0ffff",vp="#f5f5dc",mp="#ffe4c4",yp="#000000",gp="#ffebcd",_p="#0000ff",xp="#8a2be2",wp="#a52a2a",Pp="#deb887",bp="#5f9ea0",Tp="#7fff00",Ip="#d2691e",Cp="#ff7f50",Ap="#6495ed",Ep="#fff8dc",Sp="#dc143c",Np="#00ffff",Op="#00008b",Lp="#008b8b",Mp="#b8860b",Fp="#a9a9a9",Rp="#006400",kp="#a9a9a9",Up="#bdb76b",Bp="#8b008b",Dp="#556b2f",Xp="#ff8c00",Gp="#9932cc",Hp="#8b0000",zp="#e9967a",Wp="#8fbc8f",$p="#483d8b",Yp="#2f4f4f",Vp="#2f4f4f",jp="#00ced1",Zp="#9400d3",qp="#ff1493",Jp="#00bfff",Qp="#696969",Kp="#696969",td="#1e90ff",ed="#b22222",rd="#fffaf0",id="#228b22",nd="#ff00ff",sd="#dcdcdc",od="#f8f8ff",ad="#daa520",ld="#ffd700",hd="#808080",ud="#008000",fd="#adff2f",cd="#808080",pd="#f0fff0",dd="#ff69b4",vd="#cd5c5c",md="#4b0082",yd="#fffff0",gd="#f0e68c",_d="#fff0f5",xd="#e6e6fa",wd="#7cfc00",Pd="#fffacd",bd="#add8e6",Td="#f08080",Id="#e0ffff",Cd="#fafad2",Ad="#d3d3d3",Ed="#90ee90",Sd="#d3d3d3",Nd="#ffb6c1",Od="#ffa07a",Ld="#20b2aa",Md="#87cefa",Fd="#778899",Rd="#778899",kd="#b0c4de",Ud="#ffffe0",Bd="#00ff00",Dd="#32cd32",Xd="#faf0e6",Gd="#ff00ff",Hd="#800000",zd="#66cdaa",Wd="#0000cd",$d="#ba55d3",Yd="#9370db",Vd="#3cb371",jd="#7b68ee",Zd="#00fa9a",qd="#48d1cc",Jd="#c71585",Qd="#191970",Kd="#f5fffa",tv="#ffe4e1",ev="#ffe4b5",rv="#ffdead",iv="#000080",nv="#fdf5e6",sv="#808000",ov="#6b8e23",av="#ffa500",lv="#ff4500",hv="#da70d6",uv="#eee8aa",fv="#98fb98",cv="#afeeee",pv="#db7093",dv="#ffefd5",vv="#ffdab9",mv="#cd853f",yv="#ffc0cb",gv="#dda0dd",_v="#b0e0e6",xv="#800080",wv="#663399",Pv="#ff0000",bv="#bc8f8f",Tv="#4169e1",Iv="#8b4513",Cv="#fa8072",Av="#f4a460",Ev="#2e8b57",Sv="#fff5ee",Nv="#a0522d",Ov="#c0c0c0",Lv="#87ceeb",Mv="#6a5acd",Fv="#708090",Rv="#708090",kv="#fffafa",Uv="#00ff7f",Bv="#4682b4",Dv="#d2b48c",Xv="#008080",Gv="#d8bfd8",Hv="#ff6347",zv="#40e0d0",Wv="#ee82ee",$v="#f5deb3",Yv="#ffffff",Vv="#f5f5f5",jv="#ffff00",Zv="#9acd32",qv={aliceblue:up,antiquewhite:fp,aqua:cp,aquamarine:pp,azure:dp,beige:vp,bisque:mp,black:yp,blanchedalmond:gp,blue:_p,blueviolet:xp,brown:wp,burlywood:Pp,cadetblue:bp,chartreuse:Tp,chocolate:Ip,coral:Cp,cornflowerblue:Ap,cornsilk:Ep,crimson:Sp,cyan:Np,darkblue:Op,darkcyan:Lp,darkgoldenrod:Mp,darkgray:Fp,darkgreen:Rp,darkgrey:kp,darkkhaki:Up,darkmagenta:Bp,darkolivegreen:Dp,darkorange:Xp,darkorchid:Gp,darkred:Hp,darksalmon:zp,darkseagreen:Wp,darkslateblue:$p,darkslategray:Yp,darkslategrey:Vp,darkturquoise:jp,darkviolet:Zp,deeppink:qp,deepskyblue:Jp,dimgray:Qp,dimgrey:Kp,dodgerblue:td,firebrick:ed,floralwhite:rd,forestgreen:id,fuchsia:nd,gainsboro:sd,ghostwhite:od,goldenrod:ad,gold:ld,gray:hd,green:ud,greenyellow:fd,grey:cd,honeydew:pd,hotpink:dd,indianred:vd,indigo:md,ivory:yd,khaki:gd,lavenderblush:_d,lavender:xd,lawngreen:wd,lemonchiffon:Pd,lightblue:bd,lightcoral:Td,lightcyan:Id,lightgoldenrodyellow:Cd,lightgray:Ad,lightgreen:Ed,lightgrey:Sd,lightpink:Nd,lightsalmon:Od,lightseagreen:Ld,lightskyblue:Md,lightslategray:Fd,lightslategrey:Rd,lightsteelblue:kd,lightyellow:Ud,lime:Bd,limegreen:Dd,linen:Xd,magenta:Gd,maroon:Hd,mediumaquamarine:zd,mediumblue:Wd,mediumorchid:$d,mediumpurple:Yd,mediumseagreen:Vd,mediumslateblue:jd,mediumspringgreen:Zd,mediumturquoise:qd,mediumvioletred:Jd,midnightblue:Qd,mintcream:Kd,mistyrose:tv,moccasin:ev,navajowhite:rv,navy:iv,oldlace:nv,olive:sv,olivedrab:ov,orange:av,orangered:lv,orchid:hv,palegoldenrod:uv,palegreen:fv,paleturquoise:cv,palevioletred:pv,papayawhip:dv,peachpuff:vv,peru:mv,pink:yv,plum:gv,powderblue:_v,purple:xv,rebeccapurple:wv,red:Pv,rosybrown:bv,royalblue:Tv,saddlebrown:Iv,salmon:Cv,sandybrown:Av,seagreen:Ev,seashell:Sv,sienna:Nv,silver:Ov,skyblue:Lv,slateblue:Mv,slategray:Fv,slategrey:Rv,snow:kv,springgreen:Uv,steelblue:Bv,tan:Dv,teal:Xv,thistle:Gv,tomato:Hv,turquoise:zv,violet:Wv,wheat:$v,white:Yv,whitesmoke:Vv,yellow:jv,yellowgreen:Zv};function tr(t,e){return e===void 0&&(e=[]),e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(t&255)/255,e}function di(t){var e=t.toString(16);return e="000000".substring(0,6-e.length)+e,"#"+e}function er(t){return typeof t=="string"&&(t=qv[t.toLowerCase()]||t,t[0]==="#"&&(t=t.slice(1))),parseInt(t,16)}function vi(t){return(t[0]*255<<16)+(t[1]*255<<8)+(t[2]*255|0)}function Jv(){for(var t=[],e=[],r=0;r<32;r++)t[r]=r,e[r]=r;t[A.NORMAL_NPM]=A.NORMAL,t[A.ADD_NPM]=A.ADD,t[A.SCREEN_NPM]=A.SCREEN,e[A.NORMAL]=A.NORMAL_NPM,e[A.ADD]=A.ADD_NPM,e[A.SCREEN]=A.SCREEN_NPM;var i=[];return i.push(e),i.push(t),i}var Qv=Jv();function Za(t,e){if(e===1)return(e*255<<24)+t;if(e===0)return 0;var r=t>>16&255,i=t>>8&255,n=t&255;return r=r*e+.5|0,i=i*e+.5|0,n=n*e+.5|0,(e*255<<24)+(r<<16)+(i<<8)+n}function qa(t){if(t.BYTES_PER_ELEMENT===4)return t instanceof Float32Array?"Float32Array":t instanceof Uint32Array?"Uint32Array":"Int32Array";if(t.BYTES_PER_ELEMENT===2){if(t instanceof Uint16Array)return"Uint16Array"}else if(t.BYTES_PER_ELEMENT===1&&t instanceof Uint8Array)return"Uint8Array";return null}function mi(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function Ja(t){return!(t&t-1)&&!!t}function Qa(t){var e=(t>65535?1:0)<<4;t>>>=e;var r=(t>255?1:0)<<3;return t>>>=r,e|=r,r=(t>15?1:0)<<2,t>>>=r,e|=r,r=(t>3?1:0)<<1,t>>>=r,e|=r,e|t>>1}function yi(t,e,r){var i=t.length,n;if(!(e>=i||r===0)){r=e+r>i?i-e:r;var s=i-r;for(n=e;n<s;++n)t[n]=t[n+r];t.length=s}}function rr(t){return t===0?0:t<0?-1:1}var Kv=0;function Ir(){return++Kv}var Ka={};function Kt(t,e,r){if(r===void 0&&(r=3),!Ka[e]){var i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",e+`
|
|
61
|
+
Deprecated since v`+t):(i=i.split(`
|
|
62
|
+
`).splice(r).join(`
|
|
63
|
+
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",e+`
|
|
64
|
+
Deprecated since v`+t),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",e+`
|
|
65
|
+
Deprecated since v`+t),console.warn(i))),Ka[e]=!0}}var tl={},Mt=Object.create(null),te=Object.create(null);function el(){var t;for(t in Mt)delete Mt[t];for(t in te)delete te[t]}var rl=function(){function t(e,r,i){this.canvas=R.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=i||R.RESOLUTION,this.resize(e,r)}return t.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},t.prototype.resize=function(e,r){this.canvas.width=Math.round(e*this.resolution),this.canvas.height=Math.round(r*this.resolution)},t.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(t.prototype,"width",{get:function(){return this.canvas.width},set:function(e){this.canvas.width=Math.round(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.canvas.height},set:function(e){this.canvas.height=Math.round(e)},enumerable:!1,configurable:!0}),t}();function tm(t){var e=t.width,r=t.height,i=t.getContext("2d",{willReadFrequently:!0}),n=i.getImageData(0,0,e,r),s=n.data,o=s.length,a={top:null,left:null,right:null,bottom:null},l=null,h,u,f;for(h=0;h<o;h+=4)s[h+3]!==0&&(u=h/4%e,f=~~(h/4/e),a.top===null&&(a.top=f),(a.left===null||u<a.left)&&(a.left=u),(a.right===null||a.right<u)&&(a.right=u+1),(a.bottom===null||a.bottom<f)&&(a.bottom=f));return a.top!==null&&(e=a.right-a.left,r=a.bottom-a.top+1,l=i.getImageData(a.left,a.top,e,r)),{height:r,width:e,data:l}}var gi;function em(t,e){if(e===void 0&&(e=globalThis.location),t.indexOf("data:")===0)return"";e=e||globalThis.location,gi||(gi=document.createElement("a")),gi.href=t;var r=ap.parse(gi.href),i=!r.port&&e.port===""||r.port===e.port;return r.hostname!==e.hostname||!i||r.protocol!==e.protocol?"anonymous":""}function il(t,e){var r=R.RETINA_PREFIX.exec(t);return r?parseFloat(r[1]):e!==void 0?e:1}/*!
|
|
66
|
+
* @pixi/math - v6.5.7
|
|
67
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
68
|
+
*
|
|
69
|
+
* @pixi/math is licensed under the MIT License.
|
|
70
|
+
* http://www.opensource.org/licenses/mit-license
|
|
71
|
+
*/var _i=Math.PI*2,rm=180/Math.PI,im=Math.PI/180,V;(function(t){t[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC"})(V||(V={}));var X=function(){function t(e,r){e===void 0&&(e=0),r===void 0&&(r=0),this.x=0,this.y=0,this.x=e,this.y=r}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(e){return this.set(e.x,e.y),this},t.prototype.copyTo=function(e){return e.set(this.x,this.y),e},t.prototype.equals=function(e){return e.x===this.x&&e.y===this.y},t.prototype.set=function(e,r){return e===void 0&&(e=0),r===void 0&&(r=e),this.x=e,this.y=r,this},t.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},t}(),xi=[new X,new X,new X,new X],G=function(){function t(e,r,i,n){e===void 0&&(e=0),r===void 0&&(r=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=Number(e),this.y=Number(r),this.width=Number(i),this.height=Number(n),this.type=V.RECT}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t,"EMPTY",{get:function(){return new t(0,0,0,0)},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this},t.prototype.copyTo=function(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},t.prototype.contains=function(e,r){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height},t.prototype.intersects=function(e,r){if(!r){var i=this.x<e.x?e.x:this.x,n=this.right>e.right?e.right:this.right;if(n<=i)return!1;var s=this.y<e.y?e.y:this.y,o=this.bottom>e.bottom?e.bottom:this.bottom;return o>s}var a=this.left,l=this.right,h=this.top,u=this.bottom;if(l<=a||u<=h)return!1;var f=xi[0].set(e.left,e.top),c=xi[1].set(e.left,e.bottom),d=xi[2].set(e.right,e.top),v=xi[3].set(e.right,e.bottom);if(d.x<=f.x||c.y<=f.y)return!1;var y=Math.sign(r.a*r.d-r.b*r.c);if(y===0||(r.apply(f,f),r.apply(c,c),r.apply(d,d),r.apply(v,v),Math.max(f.x,c.x,d.x,v.x)<=a||Math.min(f.x,c.x,d.x,v.x)>=l||Math.max(f.y,c.y,d.y,v.y)<=h||Math.min(f.y,c.y,d.y,v.y)>=u))return!1;var m=y*(c.y-f.y),g=y*(f.x-c.x),x=m*a+g*h,_=m*l+g*h,P=m*a+g*u,w=m*l+g*u;if(Math.max(x,_,P,w)<=m*f.x+g*f.y||Math.min(x,_,P,w)>=m*v.x+g*v.y)return!1;var b=y*(f.y-d.y),T=y*(d.x-f.x),E=b*a+T*h,I=b*l+T*h,C=b*a+T*u,O=b*l+T*u;return!(Math.max(E,I,C,O)<=b*f.x+T*f.y||Math.min(E,I,C,O)>=b*v.x+T*v.y)},t.prototype.pad=function(e,r){return e===void 0&&(e=0),r===void 0&&(r=e),this.x-=e,this.y-=r,this.width+=e*2,this.height+=r*2,this},t.prototype.fit=function(e){var r=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return this.x=r,this.width=Math.max(i-r,0),this.y=n,this.height=Math.max(s-n,0),this},t.prototype.ceil=function(e,r){e===void 0&&(e=1),r===void 0&&(r=.001);var i=Math.ceil((this.x+this.width-r)*e)/e,n=Math.ceil((this.y+this.height-r)*e)/e;return this.x=Math.floor((this.x+r)*e)/e,this.y=Math.floor((this.y+r)*e)/e,this.width=i-this.x,this.height=n-this.y,this},t.prototype.enlarge=function(e){var r=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),s=Math.max(this.y+this.height,e.y+e.height);return this.x=r,this.width=i-r,this.y=n,this.height=s-n,this},t.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},t}(),nm=function(){function t(e,r,i){e===void 0&&(e=0),r===void 0&&(r=0),i===void 0&&(i=0),this.x=e,this.y=r,this.radius=i,this.type=V.CIRC}return t.prototype.clone=function(){return new t(this.x,this.y,this.radius)},t.prototype.contains=function(e,r){if(this.radius<=0)return!1;var i=this.radius*this.radius,n=this.x-e,s=this.y-r;return n*=n,s*=s,n+s<=i},t.prototype.getBounds=function(){return new G(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)},t.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},t}(),sm=function(){function t(e,r,i,n){e===void 0&&(e=0),r===void 0&&(r=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=e,this.y=r,this.width=i,this.height=n,this.type=V.ELIP}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.contains=function(e,r){if(this.width<=0||this.height<=0)return!1;var i=(e-this.x)/this.width,n=(r-this.y)/this.height;return i*=i,n*=n,i+n<=1},t.prototype.getBounds=function(){return new G(this.x-this.width,this.y-this.height,this.width,this.height)},t.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},t}(),Kn=function(){function t(){for(var e=arguments,r=[],i=0;i<arguments.length;i++)r[i]=e[i];var n=Array.isArray(r[0])?r[0]:r;if(typeof n[0]!="number"){for(var s=[],o=0,a=n.length;o<a;o++)s.push(n[o].x,n[o].y);n=s}this.points=n,this.type=V.POLY,this.closeStroke=!0}return t.prototype.clone=function(){var e=this.points.slice(),r=new t(e);return r.closeStroke=this.closeStroke,r},t.prototype.contains=function(e,r){for(var i=!1,n=this.points.length/2,s=0,o=n-1;s<n;o=s++){var a=this.points[s*2],l=this.points[s*2+1],h=this.points[o*2],u=this.points[o*2+1],f=l>r!=u>r&&e<(h-a)*((r-l)/(u-l))+a;f&&(i=!i)}return i},t.prototype.toString=function(){return"[@pixi/math:Polygon"+("closeStroke="+this.closeStroke)+("points="+this.points.reduce(function(e,r){return e+", "+r},"")+"]")},t}(),om=function(){function t(e,r,i,n,s){e===void 0&&(e=0),r===void 0&&(r=0),i===void 0&&(i=0),n===void 0&&(n=0),s===void 0&&(s=20),this.x=e,this.y=r,this.width=i,this.height=n,this.radius=s,this.type=V.RREC}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height,this.radius)},t.prototype.contains=function(e,r){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&r>=this.y&&r<=this.y+this.height){var i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(r>=this.y+i&&r<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;var n=e-(this.x+i),s=r-(this.y+i),o=i*i;if(n*n+s*s<=o||(n=e-(this.x+this.width-i),n*n+s*s<=o)||(s=r-(this.y+this.height-i),n*n+s*s<=o)||(n=e-(this.x+i),n*n+s*s<=o))return!0}return!1},t.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+("width="+this.width+" height="+this.height+" radius="+this.radius+"]")},t}(),Cr=function(){function t(e,r,i,n){i===void 0&&(i=0),n===void 0&&(n=0),this._x=i,this._y=n,this.cb=e,this.scope=r}return t.prototype.clone=function(e,r){return e===void 0&&(e=this.cb),r===void 0&&(r=this.scope),new t(e,r,this._x,this._y)},t.prototype.set=function(e,r){return e===void 0&&(e=0),r===void 0&&(r=e),(this._x!==e||this._y!==r)&&(this._x=e,this._y=r,this.cb.call(this.scope)),this},t.prototype.copyFrom=function(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(e){return e.set(this._x,this._y),e},t.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},t.prototype.toString=function(){return"[@pixi/math:ObservablePoint x="+0+" y="+0+" scope="+this.scope+"]"},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),t}(),at=function(){function t(e,r,i,n,s,o){e===void 0&&(e=1),r===void 0&&(r=0),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=0),o===void 0&&(o=0),this.array=null,this.a=e,this.b=r,this.c=i,this.d=n,this.tx=s,this.ty=o}return t.prototype.fromArray=function(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]},t.prototype.set=function(e,r,i,n,s,o){return this.a=e,this.b=r,this.c=i,this.d=n,this.tx=s,this.ty=o,this},t.prototype.toArray=function(e,r){this.array||(this.array=new Float32Array(9));var i=r||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},t.prototype.apply=function(e,r){r=r||new X;var i=e.x,n=e.y;return r.x=this.a*i+this.c*n+this.tx,r.y=this.b*i+this.d*n+this.ty,r},t.prototype.applyInverse=function(e,r){r=r||new X;var i=1/(this.a*this.d+this.c*-this.b),n=e.x,s=e.y;return r.x=this.d*i*n+-this.c*i*s+(this.ty*this.c-this.tx*this.d)*i,r.y=this.a*i*s+-this.b*i*n+(-this.ty*this.a+this.tx*this.b)*i,r},t.prototype.translate=function(e,r){return this.tx+=e,this.ty+=r,this},t.prototype.scale=function(e,r){return this.a*=e,this.d*=r,this.c*=e,this.b*=r,this.tx*=e,this.ty*=r,this},t.prototype.rotate=function(e){var r=Math.cos(e),i=Math.sin(e),n=this.a,s=this.c,o=this.tx;return this.a=n*r-this.b*i,this.b=n*i+this.b*r,this.c=s*r-this.d*i,this.d=s*i+this.d*r,this.tx=o*r-this.ty*i,this.ty=o*i+this.ty*r,this},t.prototype.append=function(e){var r=this.a,i=this.b,n=this.c,s=this.d;return this.a=e.a*r+e.b*n,this.b=e.a*i+e.b*s,this.c=e.c*r+e.d*n,this.d=e.c*i+e.d*s,this.tx=e.tx*r+e.ty*n+this.tx,this.ty=e.tx*i+e.ty*s+this.ty,this},t.prototype.setTransform=function(e,r,i,n,s,o,a,l,h){return this.a=Math.cos(a+h)*s,this.b=Math.sin(a+h)*s,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=e-(i*this.a+n*this.c),this.ty=r-(i*this.b+n*this.d),this},t.prototype.prepend=function(e){var r=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){var i=this.a,n=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=r*e.a+this.ty*e.c+e.tx,this.ty=r*e.b+this.ty*e.d+e.ty,this},t.prototype.decompose=function(e){var r=this.a,i=this.b,n=this.c,s=this.d,o=e.pivot,a=-Math.atan2(-n,s),l=Math.atan2(i,r),h=Math.abs(a+l);return h<1e-5||Math.abs(_i-h)<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(r*r+i*i),e.scale.y=Math.sqrt(n*n+s*s),e.position.x=this.tx+(o.x*r+o.y*n),e.position.y=this.ty+(o.x*i+o.y*s),e},t.prototype.invert=function(){var e=this.a,r=this.b,i=this.c,n=this.d,s=this.tx,o=e*n-r*i;return this.a=n/o,this.b=-r/o,this.c=-i/o,this.d=e/o,this.tx=(i*this.ty-n*s)/o,this.ty=-(e*this.ty-r*s)/o,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var e=new t;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},t.prototype.copyTo=function(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},t.prototype.copyFrom=function(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},t.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!1,configurable:!0}),t}(),Re=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ke=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ue=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Be=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ts=[],nl=[],wi=Math.sign;function am(){for(var t=0;t<16;t++){var e=[];ts.push(e);for(var r=0;r<16;r++)for(var i=wi(Re[t]*Re[r]+Ue[t]*ke[r]),n=wi(ke[t]*Re[r]+Be[t]*ke[r]),s=wi(Re[t]*Ue[r]+Ue[t]*Be[r]),o=wi(ke[t]*Ue[r]+Be[t]*Be[r]),a=0;a<16;a++)if(Re[a]===i&&ke[a]===n&&Ue[a]===s&&Be[a]===o){e.push(a);break}}for(var t=0;t<16;t++){var l=new at;l.set(Re[t],ke[t],Ue[t],Be[t],0,0),nl.push(l)}}am();var q={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:function(t){return Re[t]},uY:function(t){return ke[t]},vX:function(t){return Ue[t]},vY:function(t){return Be[t]},inv:function(t){return t&8?t&15:-t&7},add:function(t,e){return ts[t][e]},sub:function(t,e){return ts[t][q.inv(e)]},rotate180:function(t){return t^4},isVertical:function(t){return(t&3)===2},byDirection:function(t,e){return Math.abs(t)*2<=Math.abs(e)?e>=0?q.S:q.N:Math.abs(e)*2<=Math.abs(t)?t>0?q.E:q.W:e>0?t>0?q.SE:q.SW:t>0?q.NE:q.NW},matrixAppendRotationInv:function(t,e,r,i){r===void 0&&(r=0),i===void 0&&(i=0);var n=nl[q.inv(e)];n.tx=r,n.ty=i,t.append(n)}},lm=function(){function t(){this.worldTransform=new at,this.localTransform=new at,this.position=new Cr(this.onChange,this,0,0),this.scale=new Cr(this.onChange,this,1,1),this.pivot=new Cr(this.onChange,this,0,0),this.skew=new Cr(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.toString=function(){return"[@pixi/math:Transform "+("position=("+this.position.x+", "+this.position.y+") ")+("rotation="+this.rotation+" ")+("scale=("+this.scale.x+", "+this.scale.y+") ")+("skew=("+this.skew.x+", "+this.skew.y+") ")+"]"},t.prototype.updateLocalTransform=function(){var e=this.localTransform;this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(e){var r=this.localTransform;if(this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==e._worldID){var i=e.worldTransform,n=this.worldTransform;n.a=r.a*i.a+r.b*i.c,n.b=r.a*i.b+r.b*i.d,n.c=r.c*i.a+r.d*i.c,n.d=r.c*i.b+r.d*i.d,n.tx=r.tx*i.a+r.ty*i.c+i.tx,n.ty=r.tx*i.b+r.ty*i.d+i.ty,this._parentID=e._worldID,this._worldID++}},t.prototype.setFromMatrix=function(e){e.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,this.updateSkew())},enumerable:!1,configurable:!0}),t.IDENTITY=new t,t}();/*!
|
|
72
|
+
* @pixi/display - v6.5.7
|
|
73
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
74
|
+
*
|
|
75
|
+
* @pixi/display is licensed under the MIT License.
|
|
76
|
+
* http://www.opensource.org/licenses/mit-license
|
|
77
|
+
*/R.SORTABLE_CHILDREN=!1;var Pi=function(){function t(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return t.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},t.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},t.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?G.EMPTY:(e=e||new G(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},t.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},t.prototype.addPointMatrix=function(e,r){var i=e.a,n=e.b,s=e.c,o=e.d,a=e.tx,l=e.ty,h=i*r.x+s*r.y+a,u=n*r.x+o*r.y+l;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)},t.prototype.addQuad=function(e){var r=this.minX,i=this.minY,n=this.maxX,s=this.maxY,o=e[0],a=e[1];r=o<r?o:r,i=a<i?a:i,n=o>n?o:n,s=a>s?a:s,o=e[2],a=e[3],r=o<r?o:r,i=a<i?a:i,n=o>n?o:n,s=a>s?a:s,o=e[4],a=e[5],r=o<r?o:r,i=a<i?a:i,n=o>n?o:n,s=a>s?a:s,o=e[6],a=e[7],r=o<r?o:r,i=a<i?a:i,n=o>n?o:n,s=a>s?a:s,this.minX=r,this.minY=i,this.maxX=n,this.maxY=s},t.prototype.addFrame=function(e,r,i,n,s){this.addFrameMatrix(e.worldTransform,r,i,n,s)},t.prototype.addFrameMatrix=function(e,r,i,n,s){var o=e.a,a=e.b,l=e.c,h=e.d,u=e.tx,f=e.ty,c=this.minX,d=this.minY,v=this.maxX,y=this.maxY,m=o*r+l*i+u,g=a*r+h*i+f;c=m<c?m:c,d=g<d?g:d,v=m>v?m:v,y=g>y?g:y,m=o*n+l*i+u,g=a*n+h*i+f,c=m<c?m:c,d=g<d?g:d,v=m>v?m:v,y=g>y?g:y,m=o*r+l*s+u,g=a*r+h*s+f,c=m<c?m:c,d=g<d?g:d,v=m>v?m:v,y=g>y?g:y,m=o*n+l*s+u,g=a*n+h*s+f,c=m<c?m:c,d=g<d?g:d,v=m>v?m:v,y=g>y?g:y,this.minX=c,this.minY=d,this.maxX=v,this.maxY=y},t.prototype.addVertexData=function(e,r,i){for(var n=this.minX,s=this.minY,o=this.maxX,a=this.maxY,l=r;l<i;l+=2){var h=e[l],u=e[l+1];n=h<n?h:n,s=u<s?u:s,o=h>o?h:o,a=u>a?u:a}this.minX=n,this.minY=s,this.maxX=o,this.maxY=a},t.prototype.addVertices=function(e,r,i,n){this.addVerticesMatrix(e.worldTransform,r,i,n)},t.prototype.addVerticesMatrix=function(e,r,i,n,s,o){s===void 0&&(s=0),o===void 0&&(o=s);for(var a=e.a,l=e.b,h=e.c,u=e.d,f=e.tx,c=e.ty,d=this.minX,v=this.minY,y=this.maxX,m=this.maxY,g=i;g<n;g+=2){var x=r[g],_=r[g+1],P=a*x+h*_+f,w=u*_+l*x+c;d=Math.min(d,P-s),y=Math.max(y,P+s),v=Math.min(v,w-o),m=Math.max(m,w+o)}this.minX=d,this.minY=v,this.maxX=y,this.maxY=m},t.prototype.addBounds=function(e){var r=this.minX,i=this.minY,n=this.maxX,s=this.maxY;this.minX=e.minX<r?e.minX:r,this.minY=e.minY<i?e.minY:i,this.maxX=e.maxX>n?e.maxX:n,this.maxY=e.maxY>s?e.maxY:s},t.prototype.addBoundsMask=function(e,r){var i=e.minX>r.minX?e.minX:r.minX,n=e.minY>r.minY?e.minY:r.minY,s=e.maxX<r.maxX?e.maxX:r.maxX,o=e.maxY<r.maxY?e.maxY:r.maxY;if(i<=s&&n<=o){var a=this.minX,l=this.minY,h=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=n<l?n:l,this.maxX=s>h?s:h,this.maxY=o>u?o:u}},t.prototype.addBoundsMatrix=function(e,r){this.addFrameMatrix(r,e.minX,e.minY,e.maxX,e.maxY)},t.prototype.addBoundsArea=function(e,r){var i=e.minX>r.x?e.minX:r.x,n=e.minY>r.y?e.minY:r.y,s=e.maxX<r.x+r.width?e.maxX:r.x+r.width,o=e.maxY<r.y+r.height?e.maxY:r.y+r.height;if(i<=s&&n<=o){var a=this.minX,l=this.minY,h=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=n<l?n:l,this.maxX=s>h?s:h,this.maxY=o>u?o:u}},t.prototype.pad=function(e,r){e===void 0&&(e=0),r===void 0&&(r=e),this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=r,this.maxY+=r)},t.prototype.addFramePad=function(e,r,i,n,s,o){e-=s,r-=o,i+=s,n+=o,this.minX=this.minX<e?this.minX:e,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<r?this.minY:r,this.maxY=this.maxY>n?this.maxY:n},t}();/*! *****************************************************************************
|
|
78
|
+
Copyright (c) Microsoft Corporation.
|
|
79
|
+
|
|
80
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
81
|
+
purpose with or without fee is hereby granted.
|
|
82
|
+
|
|
83
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
84
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
85
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
86
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
87
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
88
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
89
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
90
|
+
***************************************************************************** */var es=function(t,e){return es=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},es(t,e)};function rs(t,e){es(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var ee=function(t){rs(e,t);function e(){var r=t.call(this)||this;return r.tempDisplayObjectParent=null,r.transform=new lm,r.alpha=1,r.visible=!0,r.renderable=!0,r.cullable=!1,r.cullArea=null,r.parent=null,r.worldAlpha=1,r._lastSortedIndex=0,r._zIndex=0,r.filterArea=null,r.filters=null,r._enabledFilters=null,r._bounds=new Pi,r._localBounds=null,r._boundsID=0,r._boundsRect=null,r._localBoundsRect=null,r._mask=null,r._maskRefCount=0,r._destroyed=!1,r.isSprite=!1,r.isMask=!1,r}return e.mixin=function(r){for(var i=Object.keys(r),n=0;n<i.length;++n){var s=i[n];Object.defineProperty(e.prototype,s,Object.getOwnPropertyDescriptor(r,s))}},Object.defineProperty(e.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!1,configurable:!0}),e.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},e.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},e.prototype.getBounds=function(r,i){return r||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),i||(this._boundsRect||(this._boundsRect=new G),i=this._boundsRect),this._bounds.getRectangle(i)},e.prototype.getLocalBounds=function(r){r||(this._localBoundsRect||(this._localBoundsRect=new G),r=this._localBoundsRect),this._localBounds||(this._localBounds=new Pi);var i=this.transform,n=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var s=this._bounds,o=this._boundsID;this._bounds=this._localBounds;var a=this.getBounds(!1,r);return this.parent=n,this.transform=i,this._bounds=s,this._bounds.updateID+=this._boundsID-o,a},e.prototype.toGlobal=function(r,i,n){return n===void 0&&(n=!1),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(r,i)},e.prototype.toLocal=function(r,i,n,s){return i&&(r=i.toGlobal(r,n,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(r,n)},e.prototype.setParent=function(r){if(!r||!r.addChild)throw new Error("setParent: Argument must be a Container");return r.addChild(this),r},e.prototype.setTransform=function(r,i,n,s,o,a,l,h,u){return r===void 0&&(r=0),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=1),o===void 0&&(o=0),a===void 0&&(a=0),l===void 0&&(l=0),h===void 0&&(h=0),u===void 0&&(u=0),this.position.x=r,this.position.y=i,this.scale.x=n||1,this.scale.y=s||1,this.rotation=o,this.skew.x=a,this.skew.y=l,this.pivot.x=h,this.pivot.y=u,this},e.prototype.destroy=function(r){this.parent&&this.parent.removeChild(this),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()},Object.defineProperty(e.prototype,"_tempDisplayObjectParent",{get:function(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new sl),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),e.prototype.enableTempParent=function(){var r=this.parent;return this.parent=this._tempDisplayObjectParent,r},e.prototype.disableTempParent=function(r){this.parent=r},Object.defineProperty(e.prototype,"x",{get:function(){return this.position.x},set:function(r){this.transform.position.x=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.position.y},set:function(r){this.transform.position.y=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.transform.position},set:function(r){this.transform.position.copyFrom(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(r){this.transform.scale.copyFrom(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(r){this.transform.pivot.copyFrom(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skew",{get:function(){return this.transform.skew},set:function(r){this.transform.skew.copyFrom(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(r){this.transform.rotation=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.transform.rotation*rm},set:function(r){this.transform.rotation=r*im},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zIndex",{get:function(){return this._zIndex},set:function(r){this._zIndex=r,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldVisible",{get:function(){var r=this;do{if(!r.visible)return!1;r=r.parent}while(r);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mask",{get:function(){return this._mask},set:function(r){if(this._mask!==r){if(this._mask){var i=this._mask.isMaskData?this._mask.maskObject:this._mask;i&&(i._maskRefCount--,i._maskRefCount===0&&(i.renderable=!0,i.isMask=!1))}if(this._mask=r,this._mask){var i=this._mask.isMaskData?this._mask.maskObject:this._mask;i&&(i._maskRefCount===0&&(i.renderable=!1,i.isMask=!0),i._maskRefCount++)}}},enumerable:!1,configurable:!0}),e}(ye),sl=function(t){rs(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.sortDirty=null,r}return e}(ee);ee.prototype.displayObjectUpdateTransform=ee.prototype.updateTransform;/*!
|
|
91
|
+
* @pixi/constants - v6.5.7
|
|
92
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
93
|
+
*
|
|
94
|
+
* @pixi/constants is licensed under the MIT License.
|
|
95
|
+
* http://www.opensource.org/licenses/mit-license
|
|
96
|
+
*/var ol;(function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"})(ol||(ol={}));var al;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"})(al||(al={}));var ll;(function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"})(ll||(ll={}));var hl;(function(t){t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR"})(hl||(hl={}));var ul;(function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(ul||(ul={}));var fl;(function(t){t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(fl||(fl={}));var cl;(function(t){t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(cl||(cl={}));var pl;(function(t){t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT"})(pl||(pl={}));var dl;(function(t){t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT"})(dl||(dl={}));var vl;(function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"})(vl||(vl={}));var ml;(function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(ml||(ml={}));var yl;(function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL"})(yl||(yl={}));var gl;(function(t){t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",t[t.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(gl||(gl={}));var _l;(function(t){t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT"})(_l||(_l={}));var xl;(function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"})(xl||(xl={}));var wl;(function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"})(wl||(wl={}));var is;(function(t){t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE",t[t.COLOR=4]="COLOR"})(is||(is={}));var Pl;(function(t){t[t.RED=1]="RED",t[t.GREEN=2]="GREEN",t[t.BLUE=4]="BLUE",t[t.ALPHA=8]="ALPHA"})(Pl||(Pl={}));var bl;(function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"})(bl||(bl={}));var Tl;(function(t){t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(Tl||(Tl={}));function hm(t,e){return t.zIndex===e.zIndex?t._lastSortedIndex-e._lastSortedIndex:t.zIndex-e.zIndex}var mt=function(t){rs(e,t);function e(){var r=t.call(this)||this;return r.children=[],r.sortableChildren=R.SORTABLE_CHILDREN,r.sortDirty=!1,r}return e.prototype.onChildrenChange=function(r){},e.prototype.addChild=function(){for(var r=arguments,i=[],n=0;n<arguments.length;n++)i[n]=r[n];if(i.length>1)for(var s=0;s<i.length;s++)this.addChild(i[s]);else{var o=i[0];o.parent&&o.parent.removeChild(o),o.parent=this,this.sortDirty=!0,o.transform._parentID=-1,this.children.push(o),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",o,this,this.children.length-1),o.emit("added",this)}return i[0]},e.prototype.addChildAt=function(r,i){if(i<0||i>this.children.length)throw new Error(r+"addChildAt: The index "+i+" supplied is out of bounds "+this.children.length);return r.parent&&r.parent.removeChild(r),r.parent=this,this.sortDirty=!0,r.transform._parentID=-1,this.children.splice(i,0,r),this._boundsID++,this.onChildrenChange(i),r.emit("added",this),this.emit("childAdded",r,this,i),r},e.prototype.swapChildren=function(r,i){if(r!==i){var n=this.getChildIndex(r),s=this.getChildIndex(i);this.children[n]=i,this.children[s]=r,this.onChildrenChange(n<s?n:s)}},e.prototype.getChildIndex=function(r){var i=this.children.indexOf(r);if(i===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return i},e.prototype.setChildIndex=function(r,i){if(i<0||i>=this.children.length)throw new Error("The index "+i+" supplied is out of bounds "+this.children.length);var n=this.getChildIndex(r);yi(this.children,n,1),this.children.splice(i,0,r),this.onChildrenChange(i)},e.prototype.getChildAt=function(r){if(r<0||r>=this.children.length)throw new Error("getChildAt: Index ("+r+") does not exist.");return this.children[r]},e.prototype.removeChild=function(){for(var r=arguments,i=[],n=0;n<arguments.length;n++)i[n]=r[n];if(i.length>1)for(var s=0;s<i.length;s++)this.removeChild(i[s]);else{var o=i[0],a=this.children.indexOf(o);if(a===-1)return null;o.parent=null,o.transform._parentID=-1,yi(this.children,a,1),this._boundsID++,this.onChildrenChange(a),o.emit("removed",this),this.emit("childRemoved",o,this,a)}return i[0]},e.prototype.removeChildAt=function(r){var i=this.getChildAt(r);return i.parent=null,i.transform._parentID=-1,yi(this.children,r,1),this._boundsID++,this.onChildrenChange(r),i.emit("removed",this),this.emit("childRemoved",i,this,r),i},e.prototype.removeChildren=function(r,i){r===void 0&&(r=0),i===void 0&&(i=this.children.length);var n=r,s=i,o=s-n,a;if(o>0&&o<=s){a=this.children.splice(n,o);for(var l=0;l<a.length;++l)a[l].parent=null,a[l].transform&&(a[l].transform._parentID=-1);this._boundsID++,this.onChildrenChange(r);for(var l=0;l<a.length;++l)a[l].emit("removed",this),this.emit("childRemoved",a[l],this,l);return a}else if(o===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},e.prototype.sortChildren=function(){for(var r=!1,i=0,n=this.children.length;i<n;++i){var s=this.children[i];s._lastSortedIndex=i,!r&&s.zIndex!==0&&(r=!0)}r&&this.children.length>1&&this.children.sort(hm),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var r=0,i=this.children.length;r<i;++r){var n=this.children[r];n.visible&&n.updateTransform()}},e.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var r=0;r<this.children.length;r++){var i=this.children[r];if(!(!i.visible||!i.renderable))if(i.calculateBounds(),i._mask){var n=i._mask.isMaskData?i._mask.maskObject:i._mask;n?(n.calculateBounds(),this._bounds.addBoundsMask(i._bounds,n._bounds)):this._bounds.addBounds(i._bounds)}else i.filterArea?this._bounds.addBoundsArea(i._bounds,i.filterArea):this._bounds.addBounds(i._bounds)}this._bounds.updateID=this._boundsID},e.prototype.getLocalBounds=function(r,i){i===void 0&&(i=!1);var n=t.prototype.getLocalBounds.call(this,r);if(!i)for(var s=0,o=this.children.length;s<o;++s){var a=this.children[s];a.visible&&a.updateTransform()}return n},e.prototype._calculateBounds=function(){},e.prototype._renderWithCulling=function(r){var i=r.renderTexture.sourceFrame;if(i.width>0&&i.height>0){var n,s;if(this.cullArea?(n=this.cullArea,s=this.worldTransform):this._render!==e.prototype._render&&(n=this.getBounds(!0)),n&&i.intersects(n,s))this._render(r);else if(this.cullArea)return;for(var o=0,a=this.children.length;o<a;++o){var l=this.children[o],h=l.cullable;l.cullable=h||!this.cullArea,l.render(r),l.cullable=h}}},e.prototype.render=function(r){if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(r);else if(this.cullable)this._renderWithCulling(r);else{this._render(r);for(var i=0,n=this.children.length;i<n;++i)this.children[i].render(r)}},e.prototype.renderAdvanced=function(r){var i=this.filters,n=this._mask;if(i){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var s=0;s<i.length;s++)i[s].enabled&&this._enabledFilters.push(i[s])}var o=i&&this._enabledFilters&&this._enabledFilters.length||n&&(!n.isMaskData||n.enabled&&(n.autoDetect||n.type!==is.NONE));if(o&&r.batch.flush(),i&&this._enabledFilters&&this._enabledFilters.length&&r.filter.push(this,this._enabledFilters),n&&r.mask.push(this,this._mask),this.cullable)this._renderWithCulling(r);else{this._render(r);for(var s=0,a=this.children.length;s<a;++s)this.children[s].render(r)}o&&r.batch.flush(),n&&r.mask.pop(this),i&&this._enabledFilters&&this._enabledFilters.length&&r.filter.pop()},e.prototype._render=function(r){},e.prototype.destroy=function(r){t.prototype.destroy.call(this),this.sortDirty=!1;var i=typeof r=="boolean"?r:r&&r.children,n=this.removeChildren(0,this.children.length);if(i)for(var s=0;s<n.length;++s)n[s].destroy(r)},Object.defineProperty(e.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(r){var i=this.getLocalBounds().width;i!==0?this.scale.x=r/i:this.scale.x=1,this._width=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(r){var i=this.getLocalBounds().height;i!==0?this.scale.y=r/i:this.scale.y=1,this._height=r},enumerable:!1,configurable:!0}),e}(ee);mt.prototype.containerUpdateTransform=mt.prototype.updateTransform;/*!
|
|
97
|
+
* @pixi/runner - v6.5.7
|
|
98
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
99
|
+
*
|
|
100
|
+
* @pixi/runner is licensed under the MIT License.
|
|
101
|
+
* http://www.opensource.org/licenses/mit-license
|
|
102
|
+
*/var ut=function(){function t(e){this.items=[],this._name=e,this._aliasCount=0}return t.prototype.emit=function(e,r,i,n,s,o,a,l){if(arguments.length>8)throw new Error("max arguments reached");var h=this,u=h.name,f=h.items;this._aliasCount++;for(var c=0,d=f.length;c<d;c++)f[c][u](e,r,i,n,s,o,a,l);return f===this.items&&this._aliasCount--,this},t.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this},t.prototype.remove=function(e){var r=this.items.indexOf(e);return r!==-1&&(this.ensureNonAliasedItems(),this.items.splice(r,1)),this},t.prototype.contains=function(e){return this.items.indexOf(e)!==-1},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return this.items.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t}();Object.defineProperties(ut.prototype,{dispatch:{value:ut.prototype.emit},run:{value:ut.prototype.emit}});/*!
|
|
103
|
+
* @pixi/core - v6.5.7
|
|
104
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
105
|
+
*
|
|
106
|
+
* @pixi/core is licensed under the MIT License.
|
|
107
|
+
* http://www.opensource.org/licenses/mit-license
|
|
108
|
+
*/R.PREFER_ENV=Me.any?Zt.WEBGL:Zt.WEBGL2,R.STRICT_TEXTURE_CACHE=!1;var ns=[];function Il(t,e){if(!t)return null;var r="";if(typeof t=="string"){var i=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);i&&(r=i[1].toLowerCase())}for(var n=ns.length-1;n>=0;--n){var s=ns[n];if(s.test&&s.test(t,r))return new s(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}/*! *****************************************************************************
|
|
109
|
+
Copyright (c) Microsoft Corporation.
|
|
110
|
+
|
|
111
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
112
|
+
purpose with or without fee is hereby granted.
|
|
113
|
+
|
|
114
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
115
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
116
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
117
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
118
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
119
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
120
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
121
|
+
***************************************************************************** */var ss=function(t,e){return ss=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},ss(t,e)};function j(t,e){ss(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var os=function(){return os=Object.assign||function(e){for(var r=arguments,i,n=1,s=arguments.length;n<s;n++){i=r[n];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},os.apply(this,arguments)};function um(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}var Ar=function(){function t(e,r){e===void 0&&(e=0),r===void 0&&(r=0),this._width=e,this._height=r,this.destroyed=!1,this.internal=!1,this.onResize=new ut("setRealSize"),this.onUpdate=new ut("update"),this.onError=new ut("onError")}return t.prototype.bind=function(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},t.prototype.unbind=function(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)},t.prototype.resize=function(e,r){(e!==this._width||r!==this._height)&&(this._width=e,this._height=r,this.onResize.emit(e,r))},Object.defineProperty(t.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),t.prototype.update=function(){this.destroyed||this.onUpdate.emit()},t.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),t.prototype.style=function(e,r,i){return!1},t.prototype.dispose=function(){},t.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)},t.test=function(e,r){return!1},t}(),as=function(t){j(e,t);function e(r,i){var n=this,s=i||{},o=s.width,a=s.height;if(!o||!a)throw new Error("BufferResource width or height invalid");return n=t.call(this,o,a)||this,n.data=r,n}return e.prototype.upload=function(r,i,n){var s=r.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===de.UNPACK);var o=i.realWidth,a=i.realHeight;return n.width===o&&n.height===a?s.texSubImage2D(i.target,0,0,0,o,a,i.format,n.type,this.data):(n.width=o,n.height=a,s.texImage2D(i.target,0,n.internalFormat,o,a,0,i.format,n.type,this.data)),!0},e.prototype.dispose=function(){this.data=null},e.test=function(r){return r instanceof Float32Array||r instanceof Uint8Array||r instanceof Uint32Array},e}(Ar),fm={scaleMode:xt.NEAREST,format:F.RGBA,alphaMode:de.NPM},Z=function(t){j(e,t);function e(r,i){r===void 0&&(r=null),i===void 0&&(i=null);var n=t.call(this)||this;i=i||{};var s=i.alphaMode,o=i.mipmap,a=i.anisotropicLevel,l=i.scaleMode,h=i.width,u=i.height,f=i.wrapMode,c=i.format,d=i.type,v=i.target,y=i.resolution,m=i.resourceOptions;return r&&!(r instanceof Ar)&&(r=Il(r,m),r.internal=!0),n.resolution=y||R.RESOLUTION,n.width=Math.round((h||0)*n.resolution)/n.resolution,n.height=Math.round((u||0)*n.resolution)/n.resolution,n._mipmap=o!==void 0?o:R.MIPMAP_TEXTURES,n.anisotropicLevel=a!==void 0?a:R.ANISOTROPIC_LEVEL,n._wrapMode=f||R.WRAP_MODE,n._scaleMode=l!==void 0?l:R.SCALE_MODE,n.format=c||F.RGBA,n.type=d||H.UNSIGNED_BYTE,n.target=v||Oe.TEXTURE_2D,n.alphaMode=s!==void 0?s:de.UNPACK,n.uid=Ir(),n.touched=0,n.isPowerOfTwo=!1,n._refreshPOT(),n._glTextures={},n.dirtyId=0,n.dirtyStyleId=0,n.cacheId=null,n.valid=h>0&&u>0,n.textureCacheIds=[],n.destroyed=!1,n.resource=null,n._batchEnabled=0,n._batchLocation=0,n.parentTextureArray=null,n.setResource(r),n}return Object.defineProperty(e.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mipmap",{get:function(){return this._mipmap},set:function(r){this._mipmap!==r&&(this._mipmap=r,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(r){this._scaleMode!==r&&(this._scaleMode=r,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(r){this._wrapMode!==r&&(this._wrapMode=r,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),e.prototype.setStyle=function(r,i){var n;return r!==void 0&&r!==this.scaleMode&&(this.scaleMode=r,n=!0),i!==void 0&&i!==this.mipmap&&(this.mipmap=i,n=!0),n&&this.dirtyStyleId++,this},e.prototype.setSize=function(r,i,n){return n=n||this.resolution,this.setRealSize(r*n,i*n,n)},e.prototype.setRealSize=function(r,i,n){return this.resolution=n||this.resolution,this.width=Math.round(r)/this.resolution,this.height=Math.round(i)/this.resolution,this._refreshPOT(),this.update(),this},e.prototype._refreshPOT=function(){this.isPowerOfTwo=Ja(this.realWidth)&&Ja(this.realHeight)},e.prototype.setResolution=function(r){var i=this.resolution;return i===r?this:(this.resolution=r,this.valid&&(this.width=Math.round(this.width*i)/r,this.height=Math.round(this.height*i)/r,this.emit("update",this)),this._refreshPOT(),this)},e.prototype.setResource=function(r){if(this.resource===r)return this;if(this.resource)throw new Error("Resource can be set only once");return r.bind(this),this.resource=r,this},e.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},e.prototype.onError=function(r){this.emit("error",this,r)},e.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete te[this.cacheId],delete Mt[this.cacheId],this.cacheId=null),this.dispose(),e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},e.prototype.dispose=function(){this.emit("dispose",this)},e.prototype.castToBaseTexture=function(){return this},e.from=function(r,i,n){n===void 0&&(n=R.STRICT_TEXTURE_CACHE);var s=typeof r=="string",o=null;if(s)o=r;else{if(!r._pixiId){var a=i&&i.pixiIdPrefix||"pixiid";r._pixiId=a+"_"+Ir()}o=r._pixiId}var l=te[o];if(s&&n&&!l)throw new Error('The cacheId "'+o+'" does not exist in BaseTextureCache.');return l||(l=new e(r,i),l.cacheId=o,e.addToCache(l,o)),l},e.fromBuffer=function(r,i,n,s){r=r||new Float32Array(i*n*4);var o=new as(r,{width:i,height:n}),a=r instanceof Float32Array?H.FLOAT:H.UNSIGNED_BYTE;return new e(o,Object.assign({},fm,s||{width:i,height:n,type:a}))},e.addToCache=function(r,i){i&&(r.textureCacheIds.indexOf(i)===-1&&r.textureCacheIds.push(i),te[i]&&console.warn("BaseTexture added to the cache with an id ["+i+"] that already had an entry"),te[i]=r)},e.removeFromCache=function(r){if(typeof r=="string"){var i=te[r];if(i){var n=i.textureCacheIds.indexOf(r);return n>-1&&i.textureCacheIds.splice(n,1),delete te[r],i}}else if(r&&r.textureCacheIds){for(var s=0;s<r.textureCacheIds.length;++s)delete te[r.textureCacheIds[s]];return r.textureCacheIds.length=0,r}return null},e._globalBatch=0,e}(ye),Cl=function(t){j(e,t);function e(r,i){var n=this,s=i||{},o=s.width,a=s.height;n=t.call(this,o,a)||this,n.items=[],n.itemDirtyIds=[];for(var l=0;l<r;l++){var h=new Z;n.items.push(h),n.itemDirtyIds.push(-2)}return n.length=r,n._load=null,n.baseTexture=null,n}return e.prototype.initFromArray=function(r,i){for(var n=0;n<this.length;n++)r[n]&&(r[n].castToBaseTexture?this.addBaseTextureAt(r[n].castToBaseTexture(),n):r[n]instanceof Ar?this.addResourceAt(r[n],n):this.addResourceAt(Il(r[n],i),n))},e.prototype.dispose=function(){for(var r=0,i=this.length;r<i;r++)this.items[r].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},e.prototype.addResourceAt=function(r,i){if(!this.items[i])throw new Error("Index "+i+" is out of bounds");return r.valid&&!this.valid&&this.resize(r.width,r.height),this.items[i].setResource(r),this},e.prototype.bind=function(r){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");t.prototype.bind.call(this,r);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=r,this.items[i].on("update",r.update,r)},e.prototype.unbind=function(r){t.prototype.unbind.call(this,r);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=null,this.items[i].off("update",r.update,r)},e.prototype.load=function(){var r=this;if(this._load)return this._load;var i=this.items.map(function(s){return s.resource}).filter(function(s){return s}),n=i.map(function(s){return s.load()});return this._load=Promise.all(n).then(function(){var s=r.items[0],o=s.realWidth,a=s.realHeight;return r.resize(o,a),Promise.resolve(r)}),this._load},e}(Ar),cm=function(t){j(e,t);function e(r,i){var n=this,s=i||{},o=s.width,a=s.height,l,h;return Array.isArray(r)?(l=r,h=r.length):h=r,n=t.call(this,h,{width:o,height:a})||this,l&&n.initFromArray(l,i),n}return e.prototype.addBaseTextureAt=function(r,i){if(r.resource)this.addResourceAt(r.resource,i);else throw new Error("ArrayResource does not support RenderTexture");return this},e.prototype.bind=function(r){t.prototype.bind.call(this,r),r.target=Oe.TEXTURE_2D_ARRAY},e.prototype.upload=function(r,i,n){var s=this,o=s.length,a=s.itemDirtyIds,l=s.items,h=r.gl;n.dirtyId<0&&h.texImage3D(h.TEXTURE_2D_ARRAY,0,n.internalFormat,this._width,this._height,o,0,i.format,n.type,null);for(var u=0;u<o;u++){var f=l[u];a[u]<f.dirtyId&&(a[u]=f.dirtyId,f.valid&&h.texSubImage3D(h.TEXTURE_2D_ARRAY,0,0,0,u,f.resource.width,f.resource.height,1,i.format,n.type,f.resource.source))}return!0},e}(Cl),ge=function(t){j(e,t);function e(r){var i=this,n=r,s=n.naturalWidth||n.videoWidth||n.width,o=n.naturalHeight||n.videoHeight||n.height;return i=t.call(this,s,o)||this,i.source=r,i.noSubImage=!1,i}return e.crossOrigin=function(r,i,n){n===void 0&&i.indexOf("data:")!==0?r.crossOrigin=em(i):n!==!1&&(r.crossOrigin=typeof n=="string"?n:"anonymous")},e.prototype.upload=function(r,i,n,s){var o=r.gl,a=i.realWidth,l=i.realHeight;if(s=s||this.source,s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===de.UNPACK),!this.noSubImage&&i.target===o.TEXTURE_2D&&n.width===a&&n.height===l?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i.format,n.type,s):(n.width=a,n.height=l,o.texImage2D(i.target,0,n.internalFormat,i.format,n.type,s)),!0},e.prototype.update=function(){if(!this.destroyed){var r=this.source,i=r.naturalWidth||r.videoWidth||r.width,n=r.naturalHeight||r.videoHeight||r.height;this.resize(i,n),t.prototype.update.call(this)}},e.prototype.dispose=function(){this.source=null},e}(Ar),Al=function(t){j(e,t);function e(r){return t.call(this,r)||this}return e.test=function(r){var i=globalThis.OffscreenCanvas;return i&&r instanceof i?!0:globalThis.HTMLCanvasElement&&r instanceof HTMLCanvasElement},e}(ge),pm=function(t){j(e,t);function e(r,i){var n=this,s=i||{},o=s.width,a=s.height,l=s.autoLoad,h=s.linkBaseTexture;if(r&&r.length!==e.SIDES)throw new Error("Invalid length. Got "+r.length+", expected 6");n=t.call(this,6,{width:o,height:a})||this;for(var u=0;u<e.SIDES;u++)n.items[u].target=Oe.TEXTURE_CUBE_MAP_POSITIVE_X+u;return n.linkBaseTexture=h!==!1,r&&n.initFromArray(r,i),l!==!1&&n.load(),n}return e.prototype.bind=function(r){t.prototype.bind.call(this,r),r.target=Oe.TEXTURE_CUBE_MAP},e.prototype.addBaseTextureAt=function(r,i,n){if(!this.items[i])throw new Error("Index "+i+" is out of bounds");if(!this.linkBaseTexture||r.parentTextureArray||Object.keys(r._glTextures).length>0)if(r.resource)this.addResourceAt(r.resource,i);else throw new Error("CubeResource does not support copying of renderTexture.");else r.target=Oe.TEXTURE_CUBE_MAP_POSITIVE_X+i,r.parentTextureArray=this.baseTexture,this.items[i]=r;return r.valid&&!this.valid&&this.resize(r.realWidth,r.realHeight),this.items[i]=r,this},e.prototype.upload=function(r,i,n){for(var s=this.itemDirtyIds,o=0;o<e.SIDES;o++){var a=this.items[o];(s[o]<a.dirtyId||n.dirtyId<i.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(r,a,n),s[o]=a.dirtyId):s[o]<-1&&(r.gl.texImage2D(a.target,0,n.internalFormat,i.realWidth,i.realHeight,0,i.format,n.type,null),s[o]=-1))}return!0},e.test=function(r){return Array.isArray(r)&&r.length===e.SIDES},e.SIDES=6,e}(Cl),El=function(t){j(e,t);function e(r,i){var n=this;if(i=i||{},!(r instanceof HTMLImageElement)){var s=new Image;ge.crossOrigin(s,r,i.crossorigin),s.src=r,r=s}return n=t.call(this,r)||this,!r.complete&&n._width&&n._height&&(n._width=0,n._height=0),n.url=r.src,n._process=null,n.preserveBitmap=!1,n.createBitmap=(i.createBitmap!==void 0?i.createBitmap:R.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,n.alphaMode=typeof i.alphaMode=="number"?i.alphaMode:null,n.bitmap=null,n._load=null,i.autoLoad!==!1&&n.load(),n}return e.prototype.load=function(r){var i=this;return this._load?this._load:(r!==void 0&&(this.createBitmap=r),this._load=new Promise(function(n,s){var o=i.source;i.url=o.src;var a=function(){i.destroyed||(o.onload=null,o.onerror=null,i.resize(o.width,o.height),i._load=null,i.createBitmap?n(i.process()):n(i))};o.complete&&o.src?a():(o.onload=a,o.onerror=function(l){s(l),i.onError.emit(l)})}),this._load)},e.prototype.process=function(){var r=this,i=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);var n=globalThis.createImageBitmap,s=!i.crossOrigin||i.crossOrigin==="anonymous";return this._process=fetch(i.src,{mode:s?"cors":"no-cors"}).then(function(o){return o.blob()}).then(function(o){return n(o,0,0,i.width,i.height,{premultiplyAlpha:r.alphaMode===null||r.alphaMode===de.UNPACK?"premultiply":"none"})}).then(function(o){return r.destroyed?Promise.reject():(r.bitmap=o,r.update(),r._process=null,Promise.resolve(r))}),this._process},e.prototype.upload=function(r,i,n){if(typeof this.alphaMode=="number"&&(i.alphaMode=this.alphaMode),!this.createBitmap)return t.prototype.upload.call(this,r,i,n);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(t.prototype.upload.call(this,r,i,n,this.bitmap),!this.preserveBitmap){var s=!0,o=i._glTextures;for(var a in o){var l=o[a];if(l!==n&&l.dirtyId!==i.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},e.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,t.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},e.test=function(r){return typeof r=="string"||r instanceof HTMLImageElement},e}(ge),dm=function(t){j(e,t);function e(r,i){var n=this;return i=i||{},n=t.call(this,R.ADAPTER.createCanvas())||this,n._width=0,n._height=0,n.svg=r,n.scale=i.scale||1,n._overrideWidth=i.width,n._overrideHeight=i.height,n._resolve=null,n._crossorigin=i.crossorigin,n._load=null,i.autoLoad!==!1&&n.load(),n}return e.prototype.load=function(){var r=this;return this._load?this._load:(this._load=new Promise(function(i){if(r._resolve=function(){r.resize(r.source.width,r.source.height),i(r)},e.SVG_XML.test(r.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");r.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(r.svg)))}r._loadSvg()}),this._load)},e.prototype._loadSvg=function(){var r=this,i=new Image;ge.crossOrigin(i,this.svg,this._crossorigin),i.src=this.svg,i.onerror=function(n){r._resolve&&(i.onerror=null,r.onError.emit(n))},i.onload=function(){if(r._resolve){var n=i.width,s=i.height;if(!n||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var o=n*r.scale,a=s*r.scale;(r._overrideWidth||r._overrideHeight)&&(o=r._overrideWidth||r._overrideHeight/s*n,a=r._overrideHeight||r._overrideWidth/n*s),o=Math.round(o),a=Math.round(a);var l=r.source;l.width=o,l.height=a,l._pixiId="canvas_"+Ir(),l.getContext("2d").drawImage(i,0,0,n,s,0,0,o,a),r._resolve(),r._resolve=null}}},e.getSize=function(r){var i=e.SVG_SIZE.exec(r),n={};return i&&(n[i[1]]=Math.round(parseFloat(i[3])),n[i[5]]=Math.round(parseFloat(i[7]))),n},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},e.test=function(r,i){return i==="svg"||typeof r=="string"&&r.startsWith("data:image/svg+xml")||typeof r=="string"&&e.SVG_XML.test(r)},e.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,e.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(ge),vm=function(t){j(e,t);function e(r,i){var n=this;if(i=i||{},!(r instanceof HTMLVideoElement)){var s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),typeof r=="string"&&(r=[r]);var o=r[0].src||r[0];ge.crossOrigin(s,o,i.crossorigin);for(var a=0;a<r.length;++a){var l=document.createElement("source"),h=r[a],u=h.src,f=h.mime;u=u||r[a];var c=u.split("?").shift().toLowerCase(),d=c.slice(c.lastIndexOf(".")+1);f=f||e.MIME_TYPES[d]||"video/"+d,l.src=u,l.type=f,s.appendChild(l)}r=s}return n=t.call(this,r)||this,n.noSubImage=!0,n._autoUpdate=!0,n._isConnectedToTicker=!1,n._updateFPS=i.updateFPS||0,n._msToNextUpdate=0,n.autoPlay=i.autoPlay!==!1,n._load=null,n._resolve=null,n._onCanPlay=n._onCanPlay.bind(n),n._onError=n._onError.bind(n),i.autoLoad!==!1&&n.load(),n}return e.prototype.update=function(r){if(!this.destroyed){var i=vt.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-i),(!this._updateFPS||this._msToNextUpdate<=0)&&(t.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}},e.prototype.load=function(){var r=this;if(this._load)return this._load;var i=this.source;return(i.readyState===i.HAVE_ENOUGH_DATA||i.readyState===i.HAVE_FUTURE_DATA)&&i.width&&i.height&&(i.complete=!0),i.addEventListener("play",this._onPlayStart.bind(this)),i.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(i.addEventListener("canplay",this._onCanPlay),i.addEventListener("canplaythrough",this._onCanPlay),i.addEventListener("error",this._onError,!0)),this._load=new Promise(function(n){r.valid?n(r):(r._resolve=n,i.load())}),this._load},e.prototype._onError=function(r){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(r)},e.prototype._isSourcePlaying=function(){var r=this.source;return!r.paused&&!r.ended&&this._isSourceReady()},e.prototype._isSourceReady=function(){var r=this.source;return r.readyState>2},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(vt.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(vt.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var r=this.source;r.removeEventListener("canplay",this._onCanPlay),r.removeEventListener("canplaythrough",this._onCanPlay);var i=this.valid;this.resize(r.videoWidth,r.videoHeight),!i&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&r.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&(vt.shared.remove(this.update,this),this._isConnectedToTicker=!1);var r=this.source;r&&(r.removeEventListener("error",this._onError,!0),r.pause(),r.src="",r.load()),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(r){r!==this._autoUpdate&&(this._autoUpdate=r,!this._autoUpdate&&this._isConnectedToTicker?(vt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(vt.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(r){r!==this._updateFPS&&(this._updateFPS=r)},enumerable:!1,configurable:!0}),e.test=function(r,i){return globalThis.HTMLVideoElement&&r instanceof HTMLVideoElement||e.TYPES.indexOf(i)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(ge),mm=function(t){j(e,t);function e(r){return t.call(this,r)||this}return e.test=function(r){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&r instanceof ImageBitmap},e}(ge);ns.push(El,mm,Al,vm,dm,as,pm,cm);var ym=function(t){j(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.upload=function(r,i,n){var s=r.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===de.UNPACK);var o=i.realWidth,a=i.realHeight;return n.width===o&&n.height===a?s.texSubImage2D(i.target,0,0,0,o,a,i.format,n.type,this.data):(n.width=o,n.height=a,s.texImage2D(i.target,0,n.internalFormat,o,a,0,i.format,n.type,this.data)),!0},e}(as),ls=function(){function t(e,r){this.width=Math.round(e||100),this.height=Math.round(r||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new ut("disposeFramebuffer"),this.multisample=nt.NONE}return Object.defineProperty(t.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),t.prototype.addColorTexture=function(e,r){return e===void 0&&(e=0),this.colorTextures[e]=r||new Z(null,{scaleMode:xt.NEAREST,resolution:1,mipmap:Le.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},t.prototype.addDepthTexture=function(e){return this.depthTexture=e||new Z(new ym(null,{width:this.width,height:this.height}),{scaleMode:xt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Le.OFF,format:F.DEPTH_COMPONENT,type:H.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},t.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},t.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},t.prototype.resize=function(e,r){if(e=Math.round(e),r=Math.round(r),!(e===this.width&&r===this.height)){this.width=e,this.height=r,this.dirtyId++,this.dirtySize++;for(var i=0;i<this.colorTextures.length;i++){var n=this.colorTextures[i],s=n.resolution;n.setSize(e/s,r/s)}if(this.depthTexture){var s=this.depthTexture.resolution;this.depthTexture.setSize(e/s,r/s)}}},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},t}(),bi=function(t){j(e,t);function e(r){r===void 0&&(r={});var i=this;if(typeof r=="number"){var n=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3];r={width:n,height:s,scaleMode:o,resolution:a}}return r.width=r.width||100,r.height=r.height||100,r.multisample=r.multisample!==void 0?r.multisample:nt.NONE,i=t.call(this,null,r)||this,i.mipmap=Le.OFF,i.valid=!0,i.clearColor=[0,0,0,0],i.framebuffer=new ls(i.realWidth,i.realHeight).addColorTexture(0,i),i.framebuffer.multisample=r.multisample,i.maskStack=[],i.filterStack=[{}],i}return e.prototype.resize=function(r,i){this.framebuffer.resize(r*this.resolution,i*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)},e.prototype.dispose=function(){this.framebuffer.dispose(),t.prototype.dispose.call(this)},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},e}(Z),Sl=function(){function t(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}return t.prototype.set=function(e,r,i){var n=r.width,s=r.height;if(i){var o=e.width/2/n,a=e.height/2/s,l=e.x/n+o,h=e.y/s+a;i=q.add(i,q.NW),this.x0=l+o*q.uX(i),this.y0=h+a*q.uY(i),i=q.add(i,2),this.x1=l+o*q.uX(i),this.y1=h+a*q.uY(i),i=q.add(i,2),this.x2=l+o*q.uX(i),this.y2=h+a*q.uY(i),i=q.add(i,2),this.x3=l+o*q.uX(i),this.y3=h+a*q.uY(i)}else this.x0=e.x/n,this.y0=e.y/s,this.x1=(e.x+e.width)/n,this.y1=e.y/s,this.x2=(e.x+e.width)/n,this.y2=(e.y+e.height)/s,this.x3=e.x/n,this.y3=(e.y+e.height)/s;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3},t.prototype.toString=function(){return"[@pixi/core:TextureUvs "+("x0="+this.x0+" y0="+this.y0+" ")+("x1="+this.x1+" y1="+this.y1+" x2="+this.x2+" ")+("y2="+this.y2+" x3="+this.x3+" y3="+this.y3)+"]"},t}(),Nl=new Sl;function Ti(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}var lt=function(t){j(e,t);function e(r,i,n,s,o,a){var l=t.call(this)||this;if(l.noFrame=!1,i||(l.noFrame=!0,i=new G(0,0,1,1)),r instanceof e&&(r=r.baseTexture),l.baseTexture=r,l._frame=i,l.trim=s,l.valid=!1,l._uvs=Nl,l.uvMatrix=null,l.orig=n||i,l._rotate=Number(o||0),o===!0)l._rotate=2;else if(l._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return l.defaultAnchor=a?new X(a.x,a.y):new X(0,0),l._updateID=0,l.textureCacheIds=[],r.valid?l.noFrame?r.valid&&l.onBaseTextureUpdated(r):l.frame=i:r.once("loaded",l.onBaseTextureUpdated,l),l.noFrame&&r.on("update",l.onBaseTextureUpdated,l),l}return e.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},e.prototype.onBaseTextureUpdated=function(r){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=r.width,this._frame.height=r.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)},e.prototype.destroy=function(r){if(this.baseTexture){if(r){var i=this.baseTexture.resource;i&&i.url&&Mt[i.url]&&e.removeFromCache(i.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,e.removeFromCache(this),this.textureCacheIds=null},e.prototype.clone=function(){var r=this._frame.clone(),i=this._frame===this.orig?r:this.orig.clone(),n=new e(this.baseTexture,!this.noFrame&&r,i,this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor);return this.noFrame&&(n._frame=r),n},e.prototype.updateUvs=function(){this._uvs===Nl&&(this._uvs=new Sl),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},e.from=function(r,i,n){i===void 0&&(i={}),n===void 0&&(n=R.STRICT_TEXTURE_CACHE);var s=typeof r=="string",o=null;if(s)o=r;else if(r instanceof Z){if(!r.cacheId){var a=i&&i.pixiIdPrefix||"pixiid";r.cacheId=a+"-"+Ir(),Z.addToCache(r,r.cacheId)}o=r.cacheId}else{if(!r._pixiId){var a=i&&i.pixiIdPrefix||"pixiid";r._pixiId=a+"_"+Ir()}o=r._pixiId}var l=Mt[o];if(s&&n&&!l)throw new Error('The cacheId "'+o+'" does not exist in TextureCache.');return!l&&!(r instanceof Z)?(i.resolution||(i.resolution=il(r)),l=new e(new Z(r,i)),l.baseTexture.cacheId=o,Z.addToCache(l.baseTexture,o),e.addToCache(l,o)):!l&&r instanceof Z&&(l=new e(r),e.addToCache(l,o)),l},e.fromURL=function(r,i){var n=Object.assign({autoLoad:!1},i?.resourceOptions),s=e.from(r,Object.assign({resourceOptions:n},i),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(function(){return Promise.resolve(s)})},e.fromBuffer=function(r,i,n,s){return new e(Z.fromBuffer(r,i,n,s))},e.fromLoader=function(r,i,n,s){var o=new Z(r,Object.assign({scaleMode:R.SCALE_MODE,resolution:il(i)},s)),a=o.resource;a instanceof El&&(a.url=i);var l=new e(o);return n||(n=i),Z.addToCache(l.baseTexture,n),e.addToCache(l,n),n!==i&&(Z.addToCache(l.baseTexture,i),e.addToCache(l,i)),l.baseTexture.valid?Promise.resolve(l):new Promise(function(h){l.baseTexture.once("loaded",function(){return h(l)})})},e.addToCache=function(r,i){i&&(r.textureCacheIds.indexOf(i)===-1&&r.textureCacheIds.push(i),Mt[i]&&console.warn("Texture added to the cache with an id ["+i+"] that already had an entry"),Mt[i]=r)},e.removeFromCache=function(r){if(typeof r=="string"){var i=Mt[r];if(i){var n=i.textureCacheIds.indexOf(r);return n>-1&&i.textureCacheIds.splice(n,1),delete Mt[r],i}}else if(r&&r.textureCacheIds){for(var s=0;s<r.textureCacheIds.length;++s)Mt[r.textureCacheIds[s]]===r&&delete Mt[r.textureCacheIds[s]];return r.textureCacheIds.length=0,r}return null},Object.defineProperty(e.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frame",{get:function(){return this._frame},set:function(r){this._frame=r,this.noFrame=!1;var i=r.x,n=r.y,s=r.width,o=r.height,a=i+s>this.baseTexture.width,l=n+o>this.baseTexture.height;if(a||l){var h=a&&l?"and":"or",u="X: "+i+" + "+s+" = "+(i+s)+" > "+this.baseTexture.width,f="Y: "+n+" + "+o+" = "+(n+o)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(u+" "+h+" "+f))}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=r),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(r){this._rotate=r,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(e,"EMPTY",{get:function(){return e._EMPTY||(e._EMPTY=new e(new Z),Ti(e._EMPTY),Ti(e._EMPTY.baseTexture)),e._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"WHITE",{get:function(){if(!e._WHITE){var r=R.ADAPTER.createCanvas(16,16),i=r.getContext("2d");r.width=16,r.height=16,i.fillStyle="white",i.fillRect(0,0,16,16),e._WHITE=new e(Z.from(r)),Ti(e._WHITE),Ti(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(ye),Ht=function(t){j(e,t);function e(r,i){var n=t.call(this,r,i)||this;return n.valid=!0,n.filterFrame=null,n.filterPoolKey=null,n.updateUvs(),n}return Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(r){this.framebuffer.multisample=r},enumerable:!1,configurable:!0}),e.prototype.resize=function(r,i,n){n===void 0&&(n=!0);var s=this.baseTexture.resolution,o=Math.round(r*s)/s,a=Math.round(i*s)/s;this.valid=o>0&&a>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=a,n&&this.baseTexture.resize(o,a),this.updateUvs()},e.prototype.setResolution=function(r){var i=this.baseTexture;i.resolution!==r&&(i.setResolution(r),this.resize(i.width,i.height,!1))},e.create=function(r){for(var i=arguments,n=[],s=1;s<arguments.length;s++)n[s-1]=i[s];return typeof r=="number"&&(Kt("6.0.0","Arguments (width, height, scaleMode, resolution) have been deprecated."),r={width:r,height:n[0],scaleMode:n[1],resolution:n[2]}),new e(new bi(r))},e}(lt),gm=function(){function t(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return t.prototype.createTexture=function(e,r,i){i===void 0&&(i=nt.NONE);var n=new bi(Object.assign({width:e,height:r,resolution:1,multisample:i},this.textureOptions));return new Ht(n)},t.prototype.getOptimalTexture=function(e,r,i,n){i===void 0&&(i=1),n===void 0&&(n=nt.NONE);var s;e=Math.ceil(e*i-1e-6),r=Math.ceil(r*i-1e-6),!this.enableFullScreen||e!==this._pixelsWidth||r!==this._pixelsHeight?(e=mi(e),r=mi(r),s=((e&65535)<<16|r&65535)>>>0,n>1&&(s+=n*4294967296)):s=n>1?-n:-1,this.texturePool[s]||(this.texturePool[s]=[]);var o=this.texturePool[s].pop();return o||(o=this.createTexture(e,r,n)),o.filterPoolKey=s,o.setResolution(i),o},t.prototype.getFilterTexture=function(e,r,i){var n=this.getOptimalTexture(e.width,e.height,r||e.resolution,i||nt.NONE);return n.filterFrame=e.filterFrame,n},t.prototype.returnTexture=function(e){var r=e.filterPoolKey;e.filterFrame=null,this.texturePool[r].push(e)},t.prototype.returnFilterTexture=function(e){this.returnTexture(e)},t.prototype.clear=function(e){if(e=e!==!1,e)for(var r in this.texturePool){var i=this.texturePool[r];if(i)for(var n=0;n<i.length;n++)i[n].destroy(!0)}this.texturePool={}},t.prototype.setScreenSize=function(e){if(!(e.width===this._pixelsWidth&&e.height===this._pixelsHeight)){this.enableFullScreen=e.width>0&&e.height>0;for(var r in this.texturePool)if(Number(r)<0){var i=this.texturePool[r];if(i)for(var n=0;n<i.length;n++)i[n].destroy(!0);this.texturePool[r]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}},t.SCREEN_KEY=-1,t}(),Ol=function(){function t(e,r,i,n,s,o,a){r===void 0&&(r=0),i===void 0&&(i=!1),n===void 0&&(n=H.FLOAT),this.buffer=e,this.size=r,this.normalized=i,this.type=n,this.stride=s,this.start=o,this.instance=a}return t.prototype.destroy=function(){this.buffer=null},t.from=function(e,r,i,n,s){return new t(e,r,i,n,s)},t}(),_m=0,bt=function(){function t(e,r,i){r===void 0&&(r=!0),i===void 0&&(i=!1),this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=r,this.id=_m++,this.disposeRunner=new ut("disposeBuffer")}return t.prototype.update=function(e){e instanceof Array&&(e=new Float32Array(e)),this.data=e||this.data,this._updateID++},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroy=function(){this.dispose(),this.data=null},Object.defineProperty(t.prototype,"index",{get:function(){return this.type===Xt.ELEMENT_ARRAY_BUFFER},set:function(e){this.type=e?Xt.ELEMENT_ARRAY_BUFFER:Xt.ARRAY_BUFFER},enumerable:!1,configurable:!0}),t.from=function(e){return e instanceof Array&&(e=new Float32Array(e)),new t(e)},t}(),xm={Float32Array,Uint32Array,Int32Array,Uint8Array};function wm(t,e){for(var r=0,i=0,n={},s=0;s<t.length;s++)i+=e[s],r+=t[s].length;for(var o=new ArrayBuffer(r*4),a=null,l=0,s=0;s<t.length;s++){var h=e[s],u=t[s],f=qa(u);n[f]||(n[f]=new xm[f](o)),a=n[f];for(var c=0;c<u.length;c++){var d=(c/h|0)*i+l,v=c%h;a[d+v]=u[c]}l+=h}return new Float32Array(o)}var Ll={5126:4,5123:2,5121:1},Pm=0,bm={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},hs=function(){function t(e,r){e===void 0&&(e=[]),r===void 0&&(r={}),this.buffers=e,this.indexBuffer=null,this.attributes=r,this.glVertexArrayObjects={},this.id=Pm++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ut("disposeGeometry"),this.refCount=0}return t.prototype.addAttribute=function(e,r,i,n,s,o,a,l){if(i===void 0&&(i=0),n===void 0&&(n=!1),l===void 0&&(l=!1),!r)throw new Error("You must pass a buffer when creating an attribute");r instanceof bt||(r instanceof Array&&(r=new Float32Array(r)),r=new bt(r));var h=e.split("|");if(h.length>1){for(var u=0;u<h.length;u++)this.addAttribute(h[u],r,i,n,s);return this}var f=this.buffers.indexOf(r);return f===-1&&(this.buffers.push(r),f=this.buffers.length-1),this.attributes[e]=new Ol(f,i,n,s,o,a,l),this.instanced=this.instanced||l,this},t.prototype.getAttribute=function(e){return this.attributes[e]},t.prototype.getBuffer=function(e){return this.buffers[this.getAttribute(e).buffer]},t.prototype.addIndex=function(e){return e instanceof bt||(e instanceof Array&&(e=new Uint16Array(e)),e=new bt(e)),e.type=Xt.ELEMENT_ARRAY_BUFFER,this.indexBuffer=e,this.buffers.indexOf(e)===-1&&this.buffers.push(e),this},t.prototype.getIndex=function(){return this.indexBuffer},t.prototype.interleave=function(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;var e=[],r=[],i=new bt,n;for(n in this.attributes){var s=this.attributes[n],o=this.buffers[s.buffer];e.push(o.data),r.push(s.size*Ll[s.type]/4),s.buffer=0}for(i.data=wm(e,r),n=0;n<this.buffers.length;n++)this.buffers[n]!==this.indexBuffer&&this.buffers[n].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},t.prototype.getSize=function(){for(var e in this.attributes){var r=this.attributes[e],i=this.buffers[r.buffer];return i.data.length/(r.stride/4||r.size)}return 0},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},t.prototype.clone=function(){for(var e=new t,r=0;r<this.buffers.length;r++)e.buffers[r]=new bt(this.buffers[r].data.slice(0));for(var r in this.attributes){var i=this.attributes[r];e.attributes[r]=new Ol(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=Xt.ELEMENT_ARRAY_BUFFER),e},t.merge=function(e){for(var r=new t,i=[],n=[],s=[],o,a=0;a<e.length;a++){o=e[a];for(var l=0;l<o.buffers.length;l++)n[l]=n[l]||0,n[l]+=o.buffers[l].data.length,s[l]=0}for(var a=0;a<o.buffers.length;a++)i[a]=new bm[qa(o.buffers[a].data)](n[a]),r.buffers[a]=new bt(i[a]);for(var a=0;a<e.length;a++){o=e[a];for(var l=0;l<o.buffers.length;l++)i[l].set(o.buffers[l].data,s[l]),s[l]+=o.buffers[l].data.length}if(r.attributes=o.attributes,o.indexBuffer){r.indexBuffer=r.buffers[o.buffers.indexOf(o.indexBuffer)],r.indexBuffer.type=Xt.ELEMENT_ARRAY_BUFFER;for(var h=0,u=0,f=0,c=0,a=0;a<o.buffers.length;a++)if(o.buffers[a]!==o.indexBuffer){c=a;break}for(var a in o.attributes){var d=o.attributes[a];(d.buffer|0)===c&&(u+=d.size*Ll[d.type]/4)}for(var a=0;a<e.length;a++){for(var v=e[a].indexBuffer.data,l=0;l<v.length;l++)r.indexBuffer.data[l+f]+=h;h+=e[a].buffers[c].data.length/u,f+=v.length}}return r},t}(),Tm=function(t){j(e,t);function e(){var r=t.call(this)||this;return r.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),r}return e}(hs),Im=function(t){j(e,t);function e(){var r=t.call(this)||this;return r.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),r.uvs=new Float32Array([0,0,1,0,1,1,0,1]),r.vertexBuffer=new bt(r.vertices),r.uvBuffer=new bt(r.uvs),r.addAttribute("aVertexPosition",r.vertexBuffer).addAttribute("aTextureCoord",r.uvBuffer).addIndex([0,1,2,0,2,3]),r}return e.prototype.map=function(r,i){var n=0,s=0;return this.uvs[0]=n,this.uvs[1]=s,this.uvs[2]=n+i.width/r.width,this.uvs[3]=s,this.uvs[4]=n+i.width/r.width,this.uvs[5]=s+i.height/r.height,this.uvs[6]=n,this.uvs[7]=s+i.height/r.height,n=i.x,s=i.y,this.vertices[0]=n,this.vertices[1]=s,this.vertices[2]=n+i.width,this.vertices[3]=s,this.vertices[4]=n+i.width,this.vertices[5]=s+i.height,this.vertices[6]=n,this.vertices[7]=s+i.height,this.invalidate(),this},e.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},e}(hs),Cm=0,De=function(){function t(e,r,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Cm++,this.static=!!r,this.ubo=!!i,e instanceof bt?(this.buffer=e,this.buffer.type=Xt.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new bt(new Float32Array(1)),this.buffer.type=Xt.UNIFORM_BUFFER,this.autoManage=!0))}return t.prototype.update=function(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()},t.prototype.add=function(e,r,i){if(!this.ubo)this.uniforms[e]=new t(r,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")},t.from=function(e,r,i){return new t(e,r,i)},t.uboFrom=function(e,r){return new t(e,r??!0,!0)},t}(),Am=function(){function t(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=nt.NONE,this.sourceFrame=new G,this.destinationFrame=new G,this.bindingSourceFrame=new G,this.bindingDestinationFrame=new G,this.filters=[],this.transform=null}return t.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},t}(),Ii=[new X,new X,new X,new X],us=new at,Em=function(){function t(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new gm,this.texturePool.setScreenSize(e.view),this.statePool=[],this.quad=new Tm,this.quadUv=new Im,this.tempRect=new G,this.activeState={},this.globalUniforms=new De({outputFrame:new G,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}return t.prototype.push=function(e,r){for(var i,n,s=this.renderer,o=this.defaultFilterStack,a=this.statePool.pop()||new Am,l=this.renderer.renderTexture,h=r[0].resolution,u=r[0].multisample,f=r[0].padding,c=r[0].autoFit,d=(i=r[0].legacy)!==null&&i!==void 0?i:!0,v=1;v<r.length;v++){var y=r[v];h=Math.min(h,y.resolution),u=Math.min(u,y.multisample),f=this.useMaxPadding?Math.max(f,y.padding):f+y.padding,c=c&&y.autoFit,d=d||((n=y.legacy)!==null&&n!==void 0?n:!0)}o.length===1&&(this.defaultFilterStack[0].renderTexture=l.current),o.push(a),a.resolution=h,a.multisample=u,a.legacy=d,a.target=e,a.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),a.sourceFrame.pad(f);var m=this.tempRect.copyFrom(l.sourceFrame);s.projection.transform&&this.transformAABB(us.copyFrom(s.projection.transform).invert(),m),c?(a.sourceFrame.fit(m),(a.sourceFrame.width<=0||a.sourceFrame.height<=0)&&(a.sourceFrame.width=0,a.sourceFrame.height=0)):a.sourceFrame.intersects(m)||(a.sourceFrame.width=0,a.sourceFrame.height=0),this.roundFrame(a.sourceFrame,l.current?l.current.resolution:s.resolution,l.sourceFrame,l.destinationFrame,s.projection.transform),a.renderTexture=this.getOptimalFilterTexture(a.sourceFrame.width,a.sourceFrame.height,h,u),a.filters=r,a.destinationFrame.width=a.renderTexture.width,a.destinationFrame.height=a.renderTexture.height;var g=this.tempRect;g.x=0,g.y=0,g.width=a.sourceFrame.width,g.height=a.sourceFrame.height,a.renderTexture.filterFrame=a.sourceFrame,a.bindingSourceFrame.copyFrom(l.sourceFrame),a.bindingDestinationFrame.copyFrom(l.destinationFrame),a.transform=s.projection.transform,s.projection.transform=null,l.bind(a.renderTexture,a.sourceFrame,g),s.framebuffer.clear(0,0,0,0)},t.prototype.pop=function(){var e=this.defaultFilterStack,r=e.pop(),i=r.filters;this.activeState=r;var n=this.globalUniforms.uniforms;n.outputFrame=r.sourceFrame,n.resolution=r.resolution;var s=n.inputSize,o=n.inputPixel,a=n.inputClamp;if(s[0]=r.destinationFrame.width,s[1]=r.destinationFrame.height,s[2]=1/s[0],s[3]=1/s[1],o[0]=Math.round(s[0]*r.resolution),o[1]=Math.round(s[1]*r.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=r.sourceFrame.width*s[2]-.5*o[2],a[3]=r.sourceFrame.height*s[3]-.5*o[3],r.legacy){var l=n.filterArea;l[0]=r.destinationFrame.width,l[1]=r.destinationFrame.height,l[2]=r.sourceFrame.x,l[3]=r.sourceFrame.y,n.filterClamp=n.inputClamp}this.globalUniforms.update();var h=e[e.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,r.renderTexture,h.renderTexture,ve.BLEND,r),this.returnFilterTexture(r.renderTexture);else{var u=r.renderTexture,f=this.getOptimalFilterTexture(u.width,u.height,r.resolution);f.filterFrame=u.filterFrame;var c=0;for(c=0;c<i.length-1;++c){c===1&&r.multisample>1&&(f=this.getOptimalFilterTexture(u.width,u.height,r.resolution),f.filterFrame=u.filterFrame),i[c].apply(this,u,f,ve.CLEAR,r);var d=u;u=f,f=d}i[c].apply(this,u,h.renderTexture,ve.BLEND,r),c>1&&r.multisample>1&&this.returnFilterTexture(r.renderTexture),this.returnFilterTexture(u),this.returnFilterTexture(f)}r.clear(),this.statePool.push(r)},t.prototype.bindAndClear=function(e,r){r===void 0&&(r=ve.CLEAR);var i=this.renderer,n=i.renderTexture,s=i.state;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e&&e.filterFrame){var o=this.tempRect;o.x=0,o.y=0,o.width=e.filterFrame.width,o.height=e.filterFrame.height,n.bind(e,e.filterFrame,o)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?n.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var a=s.stateId&1||this.forceClear;(r===ve.CLEAR||r===ve.BLIT&&a)&&this.renderer.framebuffer.clear(0,0,0,0)},t.prototype.applyFilter=function(e,r,i,n){var s=this.renderer;s.state.set(e.state),this.bindAndClear(i,n),e.uniforms.uSampler=r,e.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(r._frame,r.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(qt.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(qt.TRIANGLE_STRIP))},t.prototype.calculateSpriteMatrix=function(e,r){var i=this.activeState,n=i.sourceFrame,s=i.destinationFrame,o=r._texture.orig,a=e.set(s.width,0,0,s.height,n.x,n.y),l=r.worldTransform.copyTo(at.TEMP_MATRIX);return l.invert(),a.prepend(l),a.scale(1/o.width,1/o.height),a.translate(r.anchor.x,r.anchor.y),a},t.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},t.prototype.getOptimalFilterTexture=function(e,r,i,n){return i===void 0&&(i=1),n===void 0&&(n=nt.NONE),this.texturePool.getOptimalTexture(e,r,i,n)},t.prototype.getFilterTexture=function(e,r,i){if(typeof e=="number"){var n=e;e=r,r=n}e=e||this.activeState.renderTexture;var s=this.texturePool.getOptimalTexture(e.width,e.height,r||e.resolution,i||nt.NONE);return s.filterFrame=e.filterFrame,s},t.prototype.returnFilterTexture=function(e){this.texturePool.returnTexture(e)},t.prototype.emptyPool=function(){this.texturePool.clear(!0)},t.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},t.prototype.transformAABB=function(e,r){var i=Ii[0],n=Ii[1],s=Ii[2],o=Ii[3];i.set(r.left,r.top),n.set(r.left,r.bottom),s.set(r.right,r.top),o.set(r.right,r.bottom),e.apply(i,i),e.apply(n,n),e.apply(s,s),e.apply(o,o);var a=Math.min(i.x,n.x,s.x,o.x),l=Math.min(i.y,n.y,s.y,o.y),h=Math.max(i.x,n.x,s.x,o.x),u=Math.max(i.y,n.y,s.y,o.y);r.x=a,r.y=l,r.width=h-a,r.height=u-l},t.prototype.roundFrame=function(e,r,i,n,s){if(!(e.width<=0||e.height<=0||i.width<=0||i.height<=0)){if(s){var o=s.a,a=s.b,l=s.c,h=s.d;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(h)>1e-4))return}s=s?us.copyFrom(s):us.identity(),s.translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.height).translate(n.x,n.y),this.transformAABB(s,e),e.ceil(r),this.transformAABB(s.invert(),e)}},t}(),Ml=function(){function t(e){this.renderer=e}return t.prototype.flush=function(){},t.prototype.destroy=function(){this.renderer=null},t.prototype.start=function(){},t.prototype.stop=function(){this.flush()},t.prototype.render=function(e){},t}(),Sm=function(){function t(e){this.renderer=e,this.emptyRenderer=new Ml(e),this.currentRenderer=this.emptyRenderer}return t.prototype.setObjectRenderer=function(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())},t.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},t.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},t.prototype.copyBoundTextures=function(e,r){for(var i=this.renderer.texture.boundTextures,n=r-1;n>=0;--n)e[n]=i[n]||null,e[n]&&(e[n]._batchLocation=n)},t.prototype.boundArray=function(e,r,i,n){for(var s=e.elements,o=e.ids,a=e.count,l=0,h=0;h<a;h++){var u=s[h],f=u._batchLocation;if(f>=0&&f<n&&r[f]===u){o[h]=f;continue}for(;l<n;){var c=r[l];if(c&&c._batchEnabled===i&&c._batchLocation===l){l++;continue}o[h]=l,u._batchLocation=l,r[l]=u;break}}},t.prototype.destroy=function(){this.renderer=null},t}(),Fl=0,Nm=function(){function t(e){this.renderer=e,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),e.view.addEventListener("webglcontextlost",this.handleContextLost,!1),e.view.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}return Object.defineProperty(t.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),t.prototype.contextChange=function(e){this.gl=e,this.renderer.gl=e,this.renderer.CONTEXT_UID=Fl++,e.isContextLost()&&e.getExtension("WEBGL_lose_context")&&e.getExtension("WEBGL_lose_context").restoreContext()},t.prototype.initFromContext=function(e){this.gl=e,this.validateContext(e),this.renderer.gl=e,this.renderer.CONTEXT_UID=Fl++,this.renderer.runners.contextChange.emit(e)},t.prototype.initFromOptions=function(e){var r=this.createContext(this.renderer.view,e);this.initFromContext(r)},t.prototype.createContext=function(e,r){var i;if(R.PREFER_ENV>=Zt.WEBGL2&&(i=e.getContext("webgl2",r)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl},t.prototype.getExtensions=function(){var e=this.gl,r={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")};this.webGLVersion===1?Object.assign(this.extensions,r,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),loseContext:e.getExtension("WEBGL_lose_context"),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")}):this.webGLVersion===2&&Object.assign(this.extensions,r,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},t.prototype.handleContextLost=function(e){e.preventDefault()},t.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},t.prototype.destroy=function(){var e=this.renderer.view;this.renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},t.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},t.prototype.validateContext=function(e){var r=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),r&&!r.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var n=i||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=n,n||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},t}(),Om=function(){function t(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=nt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return t}(),Lm=new G,Mm=function(){function t(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new ls(10,10),this.msaaSamples=null}return t.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new G,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),this.renderer.context.webGLVersion===1){var r=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;R.PREFER_ENV===Zt.WEBGL_LEGACY&&(r=null,i=null),r?e.drawBuffers=function(n){return r.drawBuffersWEBGL(n)}:(this.hasMRT=!1,e.drawBuffers=function(){}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},t.prototype.bind=function(e,r,i){i===void 0&&(i=0);var n=this.gl;if(e){var s=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,n.bindFramebuffer(n.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==i&&(e.dirtyId++,e.dirtyFormat++,s.mipLevel=i),s.dirtyId!==e.dirtyId&&(s.dirtyId=e.dirtyId,s.dirtyFormat!==e.dirtyFormat?(s.dirtyFormat=e.dirtyFormat,s.dirtySize=e.dirtySize,this.updateFramebuffer(e,i)):s.dirtySize!==e.dirtySize&&(s.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var o=0;o<e.colorTextures.length;o++){var a=e.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),r){var l=r.width>>i,h=r.height>>i,u=l/r.width;this.setViewport(r.x*u,r.y*u,l,h)}else{var l=e.width>>i,h=e.height>>i;this.setViewport(0,0,l,h)}}else this.current&&(this.current=null,n.bindFramebuffer(n.FRAMEBUFFER,null)),r?this.setViewport(r.x,r.y,r.width,r.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},t.prototype.setViewport=function(e,r,i,n){var s=this.viewport;e=Math.round(e),r=Math.round(r),i=Math.round(i),n=Math.round(n),(s.width!==i||s.height!==n||s.x!==e||s.y!==r)&&(s.x=e,s.y=r,s.width=i,s.height=n,this.gl.viewport(e,r,i,n))},Object.defineProperty(t.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),t.prototype.clear=function(e,r,i,n,s){s===void 0&&(s=oi.COLOR|oi.DEPTH);var o=this.gl;o.clearColor(e,r,i,n),o.clear(s)},t.prototype.initFramebuffer=function(e){var r=this.gl,i=new Om(r.createFramebuffer());return i.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(e),e.disposeRunner.add(this),i},t.prototype.resizeFramebuffer=function(e){var r=this.gl,i=e.glFramebuffers[this.CONTEXT_UID];i.msaaBuffer&&(r.bindRenderbuffer(r.RENDERBUFFER,i.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.RGBA8,e.width,e.height)),i.stencil&&(r.bindRenderbuffer(r.RENDERBUFFER,i.stencil),i.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.DEPTH24_STENCIL8,e.width,e.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,e.width,e.height));var n=e.colorTextures,s=n.length;r.drawBuffers||(s=Math.min(s,1));for(var o=0;o<s;o++){var a=n[o],l=a.parentTextureArray||a;this.renderer.texture.bind(l,0)}e.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(e.depthTexture,0)},t.prototype.updateFramebuffer=function(e,r){var i=this.gl,n=e.glFramebuffers[this.CONTEXT_UID],s=e.colorTextures,o=s.length;i.drawBuffers||(o=Math.min(o,1)),n.multisample>1&&this.canMultisampleFramebuffer(e)?(n.msaaBuffer=n.msaaBuffer||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,n.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,n.multisample,i.RGBA8,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,n.msaaBuffer)):n.msaaBuffer&&(i.deleteRenderbuffer(n.msaaBuffer),n.msaaBuffer=null,n.blitFramebuffer&&(n.blitFramebuffer.dispose(),n.blitFramebuffer=null));for(var a=[],l=0;l<o;l++){var h=s[l],u=h.parentTextureArray||h;this.renderer.texture.bind(u,0),!(l===0&&n.msaaBuffer)&&(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,h.target,u._glTextures[this.CONTEXT_UID].texture,r),a.push(i.COLOR_ATTACHMENT0+l))}if(a.length>1&&i.drawBuffers(a),e.depthTexture){var f=this.writeDepthTexture;if(f){var c=e.depthTexture;this.renderer.texture.bind(c,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,c._glTextures[this.CONTEXT_UID].texture,r)}}(e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)?(n.stencil=n.stencil||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,n.stencil),n.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,n.multisample,i.DEPTH24_STENCIL8,e.width,e.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,n.stencil)):n.stencil&&(i.deleteRenderbuffer(n.stencil),n.stencil=null)},t.prototype.canMultisampleFramebuffer=function(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture},t.prototype.detectSamples=function(e){var r=this.msaaSamples,i=nt.NONE;if(e<=1||r===null)return i;for(var n=0;n<r.length;n++)if(r[n]<=e){i=r[n];break}return i===1&&(i=nt.NONE),i},t.prototype.blit=function(e,r,i){var n=this,s=n.current,o=n.renderer,a=n.gl,l=n.CONTEXT_UID;if(o.context.webGLVersion===2&&s){var h=s.glFramebuffers[l];if(h){if(!e){if(!h.msaaBuffer)return;var u=s.colorTextures[0];if(!u)return;h.blitFramebuffer||(h.blitFramebuffer=new ls(s.width,s.height),h.blitFramebuffer.addColorTexture(0,u)),e=h.blitFramebuffer,e.colorTextures[0]!==u&&(e.colorTextures[0]=u,e.dirtyId++,e.dirtyFormat++),(e.width!==s.width||e.height!==s.height)&&(e.width=s.width,e.height=s.height,e.dirtyId++,e.dirtySize++)}r||(r=Lm,r.width=s.width,r.height=s.height),i||(i=r);var f=r.width===i.width&&r.height===i.height;this.bind(e),a.bindFramebuffer(a.READ_FRAMEBUFFER,h.framebuffer),a.blitFramebuffer(r.left,r.top,r.right,r.bottom,i.left,i.top,i.right,i.bottom,a.COLOR_BUFFER_BIT,f?a.NEAREST:a.LINEAR)}}},t.prototype.disposeFramebuffer=function(e,r){var i=e.glFramebuffers[this.CONTEXT_UID],n=this.gl;if(i){delete e.glFramebuffers[this.CONTEXT_UID];var s=this.managedFramebuffers.indexOf(e);s>=0&&this.managedFramebuffers.splice(s,1),e.disposeRunner.remove(this),r||(n.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&n.deleteRenderbuffer(i.msaaBuffer),i.stencil&&n.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&i.blitFramebuffer.dispose()}},t.prototype.disposeAll=function(e){var r=this.managedFramebuffers;this.managedFramebuffers=[];for(var i=0;i<r.length;i++)this.disposeFramebuffer(r[i],e)},t.prototype.forceStencil=function(){var e=this.current;if(e){var r=e.glFramebuffers[this.CONTEXT_UID];if(!(!r||r.stencil)){e.stencil=!0;var i=e.width,n=e.height,s=this.gl,o=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,o),r.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,r.multisample,s.DEPTH24_STENCIL8,i,n):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,i,n),r.stencil=o,s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,o)}}},t.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new G},t.prototype.destroy=function(){this.renderer=null},t}(),fs={5126:4,5123:2,5121:1},Fm=function(){function t(e){this.renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}return t.prototype.contextChange=function(){this.disposeAll(!0);var e=this.gl=this.renderer.gl,r=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,r.webGLVersion!==2){var i=this.renderer.context.extensions.vertexArrayObject;R.PREFER_ENV===Zt.WEBGL_LEGACY&&(i=null),i?(e.createVertexArray=function(){return i.createVertexArrayOES()},e.bindVertexArray=function(s){return i.bindVertexArrayOES(s)},e.deleteVertexArray=function(s){return i.deleteVertexArrayOES(s)}):(this.hasVao=!1,e.createVertexArray=function(){return null},e.bindVertexArray=function(){return null},e.deleteVertexArray=function(){return null})}if(r.webGLVersion!==2){var n=e.getExtension("ANGLE_instanced_arrays");n?(e.vertexAttribDivisor=function(s,o){return n.vertexAttribDivisorANGLE(s,o)},e.drawElementsInstanced=function(s,o,a,l,h){return n.drawElementsInstancedANGLE(s,o,a,l,h)},e.drawArraysInstanced=function(s,o,a,l){return n.drawArraysInstancedANGLE(s,o,a,l)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=r.webGLVersion===2||!!r.extensions.uint32ElementIndex},t.prototype.bind=function(e,r){r=r||this.renderer.shader.shader;var i=this.gl,n=e.glVertexArrayObjects[this.CONTEXT_UID],s=!1;n||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=n={},s=!0);var o=n[r.program.id]||this.initGeometryVao(e,r,s);this._activeGeometry=e,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):this.activateVao(e,r.program)),this.updateBuffers()},t.prototype.reset=function(){this.unbind()},t.prototype.updateBuffers=function(){for(var e=this._activeGeometry,r=this.renderer.buffer,i=0;i<e.buffers.length;i++){var n=e.buffers[i];r.update(n)}},t.prototype.checkCompatibility=function(e,r){var i=e.attributes,n=r.attributeData;for(var s in n)if(!i[s])throw new Error('shader and geometry incompatible, geometry missing the "'+s+'" attribute')},t.prototype.getSignature=function(e,r){var i=e.attributes,n=r.attributeData,s=["g",e.id];for(var o in i)n[o]&&s.push(o,n[o].location);return s.join("-")},t.prototype.initGeometryVao=function(e,r,i){i===void 0&&(i=!0);var n=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,a=r.program;a.glPrograms[s]||this.renderer.shader.generateProgram(r),this.checkCompatibility(e,a);var l=this.getSignature(e,a),h=e.glVertexArrayObjects[this.CONTEXT_UID],u=h[l];if(u)return h[a.id]=u,u;var f=e.buffers,c=e.attributes,d={},v={};for(var y in f)d[y]=0,v[y]=0;for(var y in c)!c[y].size&&a.attributeData[y]?c[y].size=a.attributeData[y].size:c[y].size||console.warn("PIXI Geometry attribute '"+y+"' size cannot be determined (likely the bound shader does not have the attribute)"),d[c[y].buffer]+=c[y].size*fs[c[y].type];for(var y in c){var m=c[y],g=m.size;m.stride===void 0&&(d[m.buffer]===g*fs[m.type]?m.stride=0:m.stride=d[m.buffer]),m.start===void 0&&(m.start=v[m.buffer],v[m.buffer]+=g*fs[m.type])}u=n.createVertexArray(),n.bindVertexArray(u);for(var x=0;x<f.length;x++){var _=f[x];o.bind(_),i&&_._glBuffers[s].refCount++}return this.activateVao(e,a),this._activeVao=u,h[a.id]=u,h[l]=u,u},t.prototype.disposeGeometry=function(e,r){var i;if(this.managedGeometries[e.id]){delete this.managedGeometries[e.id];var n=e.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=e.buffers,a=(i=this.renderer)===null||i===void 0?void 0:i.buffer;if(e.disposeRunner.remove(this),!!n){if(a)for(var l=0;l<o.length;l++){var h=o[l]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!r&&a.dispose(o[l],r))}if(!r){for(var u in n)if(u[0]==="g"){var f=n[u];this._activeVao===f&&this.unbind(),s.deleteVertexArray(f)}}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}},t.prototype.disposeAll=function(e){for(var r=Object.keys(this.managedGeometries),i=0;i<r.length;i++)this.disposeGeometry(this.managedGeometries[r[i]],e)},t.prototype.activateVao=function(e,r){var i=this.gl,n=this.CONTEXT_UID,s=this.renderer.buffer,o=e.buffers,a=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);var l=null;for(var h in a){var u=a[h],f=o[u.buffer],c=f._glBuffers[n];if(r.attributeData[h]){l!==c&&(s.bind(f),l=c);var d=r.attributeData[h].location;if(i.enableVertexAttribArray(d),i.vertexAttribPointer(d,u.size,u.type||i.FLOAT,u.normalized,u.stride,u.start),u.instance)if(this.hasInstance)i.vertexAttribDivisor(d,1);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}},t.prototype.draw=function(e,r,i,n){var s=this.gl,o=this._activeGeometry;if(o.indexBuffer){var a=o.indexBuffer.data.BYTES_PER_ELEMENT,l=a===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?s.drawElementsInstanced(e,r||o.indexBuffer.data.length,l,(i||0)*a,n||1):s.drawElements(e,r||o.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?s.drawArraysInstanced(e,i,r||o.getSize(),n||1):s.drawArrays(e,i,r||o.getSize());return this},t.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},t.prototype.destroy=function(){this.renderer=null},t}(),Rm=function(){function t(e){e===void 0&&(e=null),this.type=ot.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=R.FILTER_MULTISAMPLE,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}return Object.defineProperty(t.prototype,"filter",{get:function(){return this._filters?this._filters[0]:null},set:function(e){e?this._filters?this._filters[0]=e:this._filters=[e]:this._filters=null},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=ot.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null},t.prototype.copyCountersOrReset=function(e){e?(this._stencilCounter=e._stencilCounter,this._scissorCounter=e._scissorCounter,this._scissorRect=e._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},t}();function Rl(t,e,r){var i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),i}function kl(t,e){var r=t.getShaderSource(e).split(`
|
|
122
|
+
`).map(function(h,u){return u+": "+h}),i=t.getShaderInfoLog(e),n=i.split(`
|
|
123
|
+
`),s={},o=n.map(function(h){return parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))}).filter(function(h){return h&&!s[h]?(s[h]=!0,!0):!1}),a=[""];o.forEach(function(h){r[h-1]="%c"+r[h-1]+"%c",a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});var l=r.join(`
|
|
124
|
+
`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn.apply(console,a),console.groupEnd()}function km(t,e,r,i){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||kl(t,r),t.getShaderParameter(i,t.COMPILE_STATUS)||kl(t,i),console.error("PixiJS Error: Could not initialize shader."),t.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}function cs(t){for(var e=new Array(t),r=0;r<e.length;r++)e[r]=!1;return e}function Ul(t,e){switch(t){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 cs(2*e);case"bvec3":return cs(3*e);case"bvec4":return cs(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}var Bl={},Er=Bl;function Um(){if(Er===Bl||Er&&Er.isContextLost()){var t=R.ADAPTER.createCanvas(),e=void 0;R.PREFER_ENV>=Zt.WEBGL2&&(e=t.getContext("webgl2",{})),e||(e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),Er=e}return Er}var Ci;function Bm(){if(!Ci){Ci=Dt.MEDIUM;var t=Um();if(t&&t.getShaderPrecisionFormat){var e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);Ci=e.precision?Dt.HIGH:Dt.MEDIUM}}return Ci}function Dl(t,e,r){if(t.substring(0,9)!=="precision"){var i=e;return e===Dt.HIGH&&r!==Dt.HIGH&&(i=Dt.MEDIUM),"precision "+i+` float;
|
|
125
|
+
`+t}else if(r!==Dt.HIGH&&t.substring(0,15)==="precision highp")return t.replace("precision highp","precision mediump");return t}var Dm={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Xl(t){return Dm[t]}var Ai=null,Gl={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_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Hl(t,e){if(!Ai){var r=Object.keys(Gl);Ai={};for(var i=0;i<r.length;++i){var n=r[i];Ai[t[n]]=Gl[n]}}return Ai[e]}var ir=[{test:function(t){return t.type==="float"&&t.size===1&&!t.isArray},code:function(t){return`
|
|
126
|
+
if(uv["`+t+'"] !== ud["'+t+`"].value)
|
|
127
|
+
{
|
|
128
|
+
ud["`+t+'"].value = uv["'+t+`"]
|
|
129
|
+
gl.uniform1f(ud["`+t+'"].location, uv["'+t+`"])
|
|
130
|
+
}
|
|
131
|
+
`}},{test:function(t,e){return(t.type==="sampler2D"||t.type==="samplerCube"||t.type==="sampler2DArray")&&t.size===1&&!t.isArray&&(e==null||e.castToBaseTexture!==void 0)},code:function(t){return`t = syncData.textureCount++;
|
|
132
|
+
|
|
133
|
+
renderer.texture.bind(uv["`+t+`"], t);
|
|
134
|
+
|
|
135
|
+
if(ud["`+t+`"].value !== t)
|
|
136
|
+
{
|
|
137
|
+
ud["`+t+`"].value = t;
|
|
138
|
+
gl.uniform1i(ud["`+t+`"].location, t);
|
|
139
|
+
; // eslint-disable-line max-len
|
|
140
|
+
}`}},{test:function(t,e){return t.type==="mat3"&&t.size===1&&!t.isArray&&e.a!==void 0},code:function(t){return`
|
|
141
|
+
gl.uniformMatrix3fv(ud["`+t+'"].location, false, uv["'+t+`"].toArray(true));
|
|
142
|
+
`},codeUbo:function(t){return`
|
|
143
|
+
var `+t+"_matrix = uv."+t+`.toArray(true);
|
|
144
|
+
|
|
145
|
+
data[offset] = `+t+`_matrix[0];
|
|
146
|
+
data[offset+1] = `+t+`_matrix[1];
|
|
147
|
+
data[offset+2] = `+t+`_matrix[2];
|
|
148
|
+
|
|
149
|
+
data[offset + 4] = `+t+`_matrix[3];
|
|
150
|
+
data[offset + 5] = `+t+`_matrix[4];
|
|
151
|
+
data[offset + 6] = `+t+`_matrix[5];
|
|
152
|
+
|
|
153
|
+
data[offset + 8] = `+t+`_matrix[6];
|
|
154
|
+
data[offset + 9] = `+t+`_matrix[7];
|
|
155
|
+
data[offset + 10] = `+t+`_matrix[8];
|
|
156
|
+
`}},{test:function(t,e){return t.type==="vec2"&&t.size===1&&!t.isArray&&e.x!==void 0},code:function(t){return`
|
|
157
|
+
cv = ud["`+t+`"].value;
|
|
158
|
+
v = uv["`+t+`"];
|
|
159
|
+
|
|
160
|
+
if(cv[0] !== v.x || cv[1] !== v.y)
|
|
161
|
+
{
|
|
162
|
+
cv[0] = v.x;
|
|
163
|
+
cv[1] = v.y;
|
|
164
|
+
gl.uniform2f(ud["`+t+`"].location, v.x, v.y);
|
|
165
|
+
}`},codeUbo:function(t){return`
|
|
166
|
+
v = uv.`+t+`;
|
|
167
|
+
|
|
168
|
+
data[offset] = v.x;
|
|
169
|
+
data[offset+1] = v.y;
|
|
170
|
+
`}},{test:function(t){return t.type==="vec2"&&t.size===1&&!t.isArray},code:function(t){return`
|
|
171
|
+
cv = ud["`+t+`"].value;
|
|
172
|
+
v = uv["`+t+`"];
|
|
173
|
+
|
|
174
|
+
if(cv[0] !== v[0] || cv[1] !== v[1])
|
|
175
|
+
{
|
|
176
|
+
cv[0] = v[0];
|
|
177
|
+
cv[1] = v[1];
|
|
178
|
+
gl.uniform2f(ud["`+t+`"].location, v[0], v[1]);
|
|
179
|
+
}
|
|
180
|
+
`}},{test:function(t,e){return t.type==="vec4"&&t.size===1&&!t.isArray&&e.width!==void 0},code:function(t){return`
|
|
181
|
+
cv = ud["`+t+`"].value;
|
|
182
|
+
v = uv["`+t+`"];
|
|
183
|
+
|
|
184
|
+
if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
|
|
185
|
+
{
|
|
186
|
+
cv[0] = v.x;
|
|
187
|
+
cv[1] = v.y;
|
|
188
|
+
cv[2] = v.width;
|
|
189
|
+
cv[3] = v.height;
|
|
190
|
+
gl.uniform4f(ud["`+t+`"].location, v.x, v.y, v.width, v.height)
|
|
191
|
+
}`},codeUbo:function(t){return`
|
|
192
|
+
v = uv.`+t+`;
|
|
193
|
+
|
|
194
|
+
data[offset] = v.x;
|
|
195
|
+
data[offset+1] = v.y;
|
|
196
|
+
data[offset+2] = v.width;
|
|
197
|
+
data[offset+3] = v.height;
|
|
198
|
+
`}},{test:function(t){return t.type==="vec4"&&t.size===1&&!t.isArray},code:function(t){return`
|
|
199
|
+
cv = ud["`+t+`"].value;
|
|
200
|
+
v = uv["`+t+`"];
|
|
201
|
+
|
|
202
|
+
if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
203
|
+
{
|
|
204
|
+
cv[0] = v[0];
|
|
205
|
+
cv[1] = v[1];
|
|
206
|
+
cv[2] = v[2];
|
|
207
|
+
cv[3] = v[3];
|
|
208
|
+
|
|
209
|
+
gl.uniform4f(ud["`+t+`"].location, v[0], v[1], v[2], v[3])
|
|
210
|
+
}`}}],Xm={float:`
|
|
211
|
+
if (cv !== v)
|
|
212
|
+
{
|
|
213
|
+
cu.value = v;
|
|
214
|
+
gl.uniform1f(location, v);
|
|
215
|
+
}`,vec2:`
|
|
216
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
217
|
+
{
|
|
218
|
+
cv[0] = v[0];
|
|
219
|
+
cv[1] = v[1];
|
|
220
|
+
|
|
221
|
+
gl.uniform2f(location, v[0], v[1])
|
|
222
|
+
}`,vec3:`
|
|
223
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
224
|
+
{
|
|
225
|
+
cv[0] = v[0];
|
|
226
|
+
cv[1] = v[1];
|
|
227
|
+
cv[2] = v[2];
|
|
228
|
+
|
|
229
|
+
gl.uniform3f(location, v[0], v[1], v[2])
|
|
230
|
+
}`,vec4:`
|
|
231
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
232
|
+
{
|
|
233
|
+
cv[0] = v[0];
|
|
234
|
+
cv[1] = v[1];
|
|
235
|
+
cv[2] = v[2];
|
|
236
|
+
cv[3] = v[3];
|
|
237
|
+
|
|
238
|
+
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
|
239
|
+
}`,int:`
|
|
240
|
+
if (cv !== v)
|
|
241
|
+
{
|
|
242
|
+
cu.value = v;
|
|
243
|
+
|
|
244
|
+
gl.uniform1i(location, v);
|
|
245
|
+
}`,ivec2:`
|
|
246
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
247
|
+
{
|
|
248
|
+
cv[0] = v[0];
|
|
249
|
+
cv[1] = v[1];
|
|
250
|
+
|
|
251
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
252
|
+
}`,ivec3:`
|
|
253
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
254
|
+
{
|
|
255
|
+
cv[0] = v[0];
|
|
256
|
+
cv[1] = v[1];
|
|
257
|
+
cv[2] = v[2];
|
|
258
|
+
|
|
259
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
260
|
+
}`,ivec4:`
|
|
261
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
262
|
+
{
|
|
263
|
+
cv[0] = v[0];
|
|
264
|
+
cv[1] = v[1];
|
|
265
|
+
cv[2] = v[2];
|
|
266
|
+
cv[3] = v[3];
|
|
267
|
+
|
|
268
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
269
|
+
}`,uint:`
|
|
270
|
+
if (cv !== v)
|
|
271
|
+
{
|
|
272
|
+
cu.value = v;
|
|
273
|
+
|
|
274
|
+
gl.uniform1ui(location, v);
|
|
275
|
+
}`,uvec2:`
|
|
276
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
277
|
+
{
|
|
278
|
+
cv[0] = v[0];
|
|
279
|
+
cv[1] = v[1];
|
|
280
|
+
|
|
281
|
+
gl.uniform2ui(location, v[0], v[1]);
|
|
282
|
+
}`,uvec3:`
|
|
283
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
284
|
+
{
|
|
285
|
+
cv[0] = v[0];
|
|
286
|
+
cv[1] = v[1];
|
|
287
|
+
cv[2] = v[2];
|
|
288
|
+
|
|
289
|
+
gl.uniform3ui(location, v[0], v[1], v[2]);
|
|
290
|
+
}`,uvec4:`
|
|
291
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
292
|
+
{
|
|
293
|
+
cv[0] = v[0];
|
|
294
|
+
cv[1] = v[1];
|
|
295
|
+
cv[2] = v[2];
|
|
296
|
+
cv[3] = v[3];
|
|
297
|
+
|
|
298
|
+
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
|
299
|
+
}`,bool:`
|
|
300
|
+
if (cv !== v)
|
|
301
|
+
{
|
|
302
|
+
cu.value = v;
|
|
303
|
+
gl.uniform1i(location, v);
|
|
304
|
+
}`,bvec2:`
|
|
305
|
+
if (cv[0] != v[0] || cv[1] != v[1])
|
|
306
|
+
{
|
|
307
|
+
cv[0] = v[0];
|
|
308
|
+
cv[1] = v[1];
|
|
309
|
+
|
|
310
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
311
|
+
}`,bvec3:`
|
|
312
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
313
|
+
{
|
|
314
|
+
cv[0] = v[0];
|
|
315
|
+
cv[1] = v[1];
|
|
316
|
+
cv[2] = v[2];
|
|
317
|
+
|
|
318
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
319
|
+
}`,bvec4:`
|
|
320
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
321
|
+
{
|
|
322
|
+
cv[0] = v[0];
|
|
323
|
+
cv[1] = v[1];
|
|
324
|
+
cv[2] = v[2];
|
|
325
|
+
cv[3] = v[3];
|
|
326
|
+
|
|
327
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
328
|
+
}`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:`
|
|
329
|
+
if (cv !== v)
|
|
330
|
+
{
|
|
331
|
+
cu.value = v;
|
|
332
|
+
|
|
333
|
+
gl.uniform1i(location, v);
|
|
334
|
+
}`,samplerCube:`
|
|
335
|
+
if (cv !== v)
|
|
336
|
+
{
|
|
337
|
+
cu.value = v;
|
|
338
|
+
|
|
339
|
+
gl.uniform1i(location, v);
|
|
340
|
+
}`,sampler2DArray:`
|
|
341
|
+
if (cv !== v)
|
|
342
|
+
{
|
|
343
|
+
cu.value = v;
|
|
344
|
+
|
|
345
|
+
gl.uniform1i(location, v);
|
|
346
|
+
}`},Gm={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Hm(t,e){var r,i=[`
|
|
347
|
+
var v = null;
|
|
348
|
+
var cv = null;
|
|
349
|
+
var cu = null;
|
|
350
|
+
var t = 0;
|
|
351
|
+
var gl = renderer.gl;
|
|
352
|
+
`];for(var n in t.uniforms){var s=e[n];if(!s){!((r=t.uniforms[n])===null||r===void 0)&&r.group&&(t.uniforms[n].ubo?i.push(`
|
|
353
|
+
renderer.shader.syncUniformBufferGroup(uv.`+n+", '"+n+`');
|
|
354
|
+
`):i.push(`
|
|
355
|
+
renderer.shader.syncUniformGroup(uv.`+n+`, syncData);
|
|
356
|
+
`));continue}for(var o=t.uniforms[n],a=!1,l=0;l<ir.length;l++)if(ir[l].test(s,o)){i.push(ir[l].code(n,o)),a=!0;break}if(!a){var h=s.size===1&&!s.isArray?Xm:Gm,u=h[s.type].replace("location",'ud["'+n+'"].location');i.push(`
|
|
357
|
+
cu = ud["`+n+`"];
|
|
358
|
+
cv = cu.value;
|
|
359
|
+
v = uv["`+n+`"];
|
|
360
|
+
`+u+";")}}return new Function("ud","uv","renderer","syncData",i.join(`
|
|
361
|
+
`))}var zm=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
362
|
+
`);function Wm(t){for(var e="",r=0;r<t;++r)r>0&&(e+=`
|
|
363
|
+
else `),r<t-1&&(e+="if(test == "+r+".0){}");return e}function $m(t,e){if(t===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var r=e.createShader(e.FRAGMENT_SHADER);;){var i=zm.replace(/%forloop%/gi,Wm(t));if(e.shaderSource(r,i),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))t=t/2|0;else break}return t}var Sr;function Ym(){if(typeof Sr=="boolean")return Sr;try{var t=new Function("param1","param2","param3","return param1[param2] === param3;");Sr=t({a:"b"},"a","b")===!0}catch{Sr=!1}return Sr}var Vm=`varying vec2 vTextureCoord;
|
|
364
|
+
|
|
365
|
+
uniform sampler2D uSampler;
|
|
366
|
+
|
|
367
|
+
void main(void){
|
|
368
|
+
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
|
369
|
+
}`,jm=`attribute vec2 aVertexPosition;
|
|
370
|
+
attribute vec2 aTextureCoord;
|
|
371
|
+
|
|
372
|
+
uniform mat3 projectionMatrix;
|
|
373
|
+
|
|
374
|
+
varying vec2 vTextureCoord;
|
|
375
|
+
|
|
376
|
+
void main(void){
|
|
377
|
+
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
378
|
+
vTextureCoord = aTextureCoord;
|
|
379
|
+
}
|
|
380
|
+
`,Zm=0,Ei={},ps=function(){function t(e,r,i){i===void 0&&(i="pixi-shader"),this.id=Zm++,this.vertexSrc=e||t.defaultVertexSrc,this.fragmentSrc=r||t.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),Ei[i]?(Ei[i]++,i+="-"+Ei[i]):Ei[i]=1,this.vertexSrc="#define SHADER_NAME "+i+`
|
|
381
|
+
`+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+i+`
|
|
382
|
+
`+this.fragmentSrc,this.vertexSrc=Dl(this.vertexSrc,R.PRECISION_VERTEX,Dt.HIGH),this.fragmentSrc=Dl(this.fragmentSrc,R.PRECISION_FRAGMENT,Bm())),this.glPrograms={},this.syncUniforms=null}return Object.defineProperty(t,"defaultVertexSrc",{get:function(){return jm},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentSrc",{get:function(){return Vm},enumerable:!1,configurable:!0}),t.from=function(e,r,i){var n=e+r,s=tl[n];return s||(tl[n]=s=new t(e,r,i)),s},t}(),ds=function(){function t(e,r){this.uniformBindCount=0,this.program=e,r?r instanceof De?this.uniformGroup=r:this.uniformGroup=new De(r):this.uniformGroup=new De({}),this.disposeRunner=new ut("disposeShader")}return t.prototype.checkUniformExists=function(e,r){if(r.uniforms[e])return!0;for(var i in r.uniforms){var n=r.uniforms[i];if(n.group&&this.checkUniformExists(e,n))return!0}return!1},t.prototype.destroy=function(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()},Object.defineProperty(t.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),t.from=function(e,r,i){var n=ps.from(e,r);return new t(n,i)},t}(),vs=0,ms=1,ys=2,gs=3,_s=4,xs=5,Si=function(){function t(){this.data=0,this.blendMode=A.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}return Object.defineProperty(t.prototype,"blend",{get:function(){return!!(this.data&1<<vs)},set:function(e){!!(this.data&1<<vs)!==e&&(this.data^=1<<vs)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offsets",{get:function(){return!!(this.data&1<<ms)},set:function(e){!!(this.data&1<<ms)!==e&&(this.data^=1<<ms)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"culling",{get:function(){return!!(this.data&1<<ys)},set:function(e){!!(this.data&1<<ys)!==e&&(this.data^=1<<ys)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthTest",{get:function(){return!!(this.data&1<<gs)},set:function(e){!!(this.data&1<<gs)!==e&&(this.data^=1<<gs)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthMask",{get:function(){return!!(this.data&1<<xs)},set:function(e){!!(this.data&1<<xs)!==e&&(this.data^=1<<xs)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwiseFrontFace",{get:function(){return!!(this.data&1<<_s)},set:function(e){!!(this.data&1<<_s)!==e&&(this.data^=1<<_s)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendMode",{get:function(){return this._blendMode},set:function(e){this.blend=e!==A.NONE,this._blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(e){this.offsets=!!e,this._polygonOffset=e},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return"[@pixi/core:State "+("blendMode="+this.blendMode+" ")+("clockwiseFrontFace="+this.clockwiseFrontFace+" ")+("culling="+this.culling+" ")+("depthMask="+this.depthMask+" ")+("polygonOffset="+this.polygonOffset)+"]"},t.for2d=function(){var e=new t;return e.depthTest=!1,e.blend=!0,e},t}(),qm=`varying vec2 vTextureCoord;
|
|
383
|
+
|
|
384
|
+
uniform sampler2D uSampler;
|
|
385
|
+
|
|
386
|
+
void main(void){
|
|
387
|
+
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
|
388
|
+
}
|
|
389
|
+
`,Jm=`attribute vec2 aVertexPosition;
|
|
390
|
+
|
|
391
|
+
uniform mat3 projectionMatrix;
|
|
392
|
+
|
|
393
|
+
varying vec2 vTextureCoord;
|
|
394
|
+
|
|
395
|
+
uniform vec4 inputSize;
|
|
396
|
+
uniform vec4 outputFrame;
|
|
397
|
+
|
|
398
|
+
vec4 filterVertexPosition( void )
|
|
399
|
+
{
|
|
400
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
401
|
+
|
|
402
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
vec2 filterTextureCoord( void )
|
|
406
|
+
{
|
|
407
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
void main(void)
|
|
411
|
+
{
|
|
412
|
+
gl_Position = filterVertexPosition();
|
|
413
|
+
vTextureCoord = filterTextureCoord();
|
|
414
|
+
}
|
|
415
|
+
`,zl=function(t){j(e,t);function e(r,i,n){var s=this,o=ps.from(r||e.defaultVertexSrc,i||e.defaultFragmentSrc);return s=t.call(this,o,n)||this,s.padding=0,s.resolution=R.FILTER_RESOLUTION,s.multisample=R.FILTER_MULTISAMPLE,s.enabled=!0,s.autoFit=!0,s.state=new Si,s}return e.prototype.apply=function(r,i,n,s,o){r.applyFilter(this,i,n,s)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(r){this.state.blendMode=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(r){this._resolution=r},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultVertexSrc",{get:function(){return Jm},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultFragmentSrc",{get:function(){return qm},enumerable:!1,configurable:!0}),e}(ds),Qm=`attribute vec2 aVertexPosition;
|
|
416
|
+
attribute vec2 aTextureCoord;
|
|
417
|
+
|
|
418
|
+
uniform mat3 projectionMatrix;
|
|
419
|
+
uniform mat3 otherMatrix;
|
|
420
|
+
|
|
421
|
+
varying vec2 vMaskCoord;
|
|
422
|
+
varying vec2 vTextureCoord;
|
|
423
|
+
|
|
424
|
+
void main(void)
|
|
425
|
+
{
|
|
426
|
+
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
427
|
+
|
|
428
|
+
vTextureCoord = aTextureCoord;
|
|
429
|
+
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
430
|
+
}
|
|
431
|
+
`,Km=`varying vec2 vMaskCoord;
|
|
432
|
+
varying vec2 vTextureCoord;
|
|
433
|
+
|
|
434
|
+
uniform sampler2D uSampler;
|
|
435
|
+
uniform sampler2D mask;
|
|
436
|
+
uniform float alpha;
|
|
437
|
+
uniform float npmAlpha;
|
|
438
|
+
uniform vec4 maskClamp;
|
|
439
|
+
|
|
440
|
+
void main(void)
|
|
441
|
+
{
|
|
442
|
+
float clip = step(3.5,
|
|
443
|
+
step(maskClamp.x, vMaskCoord.x) +
|
|
444
|
+
step(maskClamp.y, vMaskCoord.y) +
|
|
445
|
+
step(vMaskCoord.x, maskClamp.z) +
|
|
446
|
+
step(vMaskCoord.y, maskClamp.w));
|
|
447
|
+
|
|
448
|
+
vec4 original = texture2D(uSampler, vTextureCoord);
|
|
449
|
+
vec4 masky = texture2D(mask, vMaskCoord);
|
|
450
|
+
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
|
451
|
+
|
|
452
|
+
original *= (alphaMul * masky.r * alpha * clip);
|
|
453
|
+
|
|
454
|
+
gl_FragColor = original;
|
|
455
|
+
}
|
|
456
|
+
`,Wl=new at,t0=function(){function t(e,r){this._texture=e,this.mapCoord=new at,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof r>"u"?.5:r,this.isSimple=!1}return Object.defineProperty(t.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture=e,this._textureID=-1},enumerable:!1,configurable:!0}),t.prototype.multiplyUvs=function(e,r){r===void 0&&(r=e);for(var i=this.mapCoord,n=0;n<e.length;n+=2){var s=e[n],o=e[n+1];r[n]=s*i.a+o*i.c+i.tx,r[n+1]=s*i.b+o*i.d+i.ty}return r},t.prototype.update=function(e){var r=this._texture;if(!r||!r.valid||!e&&this._textureID===r._updateID)return!1;this._textureID=r._updateID,this._updateID++;var i=r._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);var n=r.orig,s=r.trim;s&&(Wl.set(n.width/s.width,0,0,n.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Wl));var o=r.baseTexture,a=this.uClampFrame,l=this.clampMargin/o.resolution,h=this.clampOffset;return a[0]=(r._frame.x+l+h)/o.width,a[1]=(r._frame.y+l+h)/o.height,a[2]=(r._frame.x+r._frame.width-l+h)/o.width,a[3]=(r._frame.y+r._frame.height-l+h)/o.height,this.uClampOffset[0]=h/o.realWidth,this.uClampOffset[1]=h/o.realHeight,this.isSimple=r._frame.width===o.width&&r._frame.height===o.height&&r.rotate===0,!0},t}(),e0=function(t){j(e,t);function e(r,i,n){var s=this,o=null;return typeof r!="string"&&i===void 0&&n===void 0&&(o=r,r=void 0,i=void 0,n=void 0),s=t.call(this,r||Qm,i||Km,n)||this,s.maskSprite=o,s.maskMatrix=new at,s}return Object.defineProperty(e.prototype,"maskSprite",{get:function(){return this._maskSprite},set:function(r){this._maskSprite=r,this._maskSprite&&(this._maskSprite.renderable=!1)},enumerable:!1,configurable:!0}),e.prototype.apply=function(r,i,n,s){var o=this._maskSprite,a=o._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new t0(a,0)),a.uvMatrix.update(),this.uniforms.npmAlpha=a.baseTexture.alphaMode?0:1,this.uniforms.mask=a,this.uniforms.otherMatrix=r.calculateSpriteMatrix(this.maskMatrix,o).prepend(a.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=a.uvMatrix.uClampFrame,r.applyFilter(this,i,n,s))},e}(zl),r0=function(){function t(e){this.renderer=e,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}return t.prototype.setMaskStack=function(e){this.maskStack=e,this.renderer.scissor.setMaskStack(e),this.renderer.stencil.setMaskStack(e)},t.prototype.push=function(e,r){var i=r;if(!i.isMaskData){var n=this.maskDataPool.pop()||new Rm;n.pooled=!0,n.maskObject=r,i=n}var s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=e,i.type!==ot.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case ot.SCISSOR:this.renderer.scissor.push(i);break;case ot.STENCIL:this.renderer.stencil.push(i);break;case ot.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case ot.COLOR:this.pushColorMask(i);break}i.type===ot.SPRITE&&this.maskStack.push(i)},t.prototype.pop=function(e){var r=this.maskStack.pop();if(!(!r||r._target!==e)){if(r.enabled)switch(r.type){case ot.SCISSOR:this.renderer.scissor.pop(r);break;case ot.STENCIL:this.renderer.stencil.pop(r.maskObject);break;case ot.SPRITE:this.popSpriteMask(r);break;case ot.COLOR:this.popColorMask(r);break}if(r.reset(),r.pooled&&this.maskDataPool.push(r),this.maskStack.length!==0){var i=this.maskStack[this.maskStack.length-1];i.type===ot.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}},t.prototype.detect=function(e){var r=e.maskObject;r?r.isSprite?e.type=ot.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=ot.SCISSOR:e.type=ot.STENCIL:e.type=ot.COLOR},t.prototype.pushSpriteMask=function(e){var r,i,n=e.maskObject,s=e._target,o=e._filters;o||(o=this.alphaMaskPool[this.alphaMaskIndex],o||(o=this.alphaMaskPool[this.alphaMaskIndex]=[new e0]));var a=this.renderer,l=a.renderTexture,h,u;if(l.current){var f=l.current;h=e.resolution||f.resolution,u=(r=e.multisample)!==null&&r!==void 0?r:f.multisample}else h=e.resolution||a.resolution,u=(i=e.multisample)!==null&&i!==void 0?i:a.multisample;o[0].resolution=h,o[0].multisample=u,o[0].maskSprite=n;var c=s.filterArea;s.filterArea=n.getBounds(!0),a.filter.push(s,o),s.filterArea=c,e._filters||this.alphaMaskIndex++},t.prototype.popSpriteMask=function(e){this.renderer.filter.pop(),e._filters?e._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)},t.prototype.pushColorMask=function(e){var r=e._colorMask,i=e._colorMask=r&e.colorMask;i!==r&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)},t.prototype.popColorMask=function(e){var r=e._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==r&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)},t.prototype.destroy=function(){this.renderer=null},t}(),$l=function(){function t(e){this.renderer=e,this.maskStack=[],this.glConst=0}return t.prototype.getStackLength=function(){return this.maskStack.length},t.prototype.setMaskStack=function(e){var r=this.renderer.gl,i=this.getStackLength();this.maskStack=e;var n=this.getStackLength();n!==i&&(n===0?r.disable(this.glConst):(r.enable(this.glConst),this._useCurrent()))},t.prototype._useCurrent=function(){},t.prototype.destroy=function(){this.renderer=null,this.maskStack=null},t}(),Yl=new at,Vl=[],i0=function(t){j(e,t);function e(r){var i=t.call(this,r)||this;return i.glConst=R.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,i}return e.prototype.getStackLength=function(){var r=this.maskStack[this.maskStack.length-1];return r?r._scissorCounter:0},e.prototype.calcScissorRect=function(r){var i;if(!r._scissorRectLocal){var n=r._scissorRect,s=r.maskObject,o=this.renderer,a=o.renderTexture,l=s.getBounds(!0,(i=Vl.pop())!==null&&i!==void 0?i:new G);this.roundFrameToPixels(l,a.current?a.current.resolution:o.resolution,a.sourceFrame,a.destinationFrame,o.projection.transform),n&&l.fit(n),r._scissorRectLocal=l}},e.isMatrixRotated=function(r){if(!r)return!1;var i=r.a,n=r.b,s=r.c,o=r.d;return(Math.abs(n)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(i)>1e-4||Math.abs(o)>1e-4)},e.prototype.testScissor=function(r){var i=r.maskObject;if(!i.isFastRect||!i.isFastRect()||e.isMatrixRotated(i.worldTransform)||e.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(r);var n=r._scissorRectLocal;return n.width>0&&n.height>0},e.prototype.roundFrameToPixels=function(r,i,n,s,o){e.isMatrixRotated(o)||(o=o?Yl.copyFrom(o):Yl.identity(),o.translate(-n.x,-n.y).scale(s.width/n.width,s.height/n.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,r),r.fit(s),r.x=Math.round(r.x*i),r.y=Math.round(r.y*i),r.width=Math.round(r.width*i),r.height=Math.round(r.height*i))},e.prototype.push=function(r){r._scissorRectLocal||this.calcScissorRect(r);var i=this.renderer.gl;r._scissorRect||i.enable(i.SCISSOR_TEST),r._scissorCounter++,r._scissorRect=r._scissorRectLocal,this._useCurrent()},e.prototype.pop=function(r){var i=this.renderer.gl;r&&Vl.push(r._scissorRectLocal),this.getStackLength()>0?this._useCurrent():i.disable(i.SCISSOR_TEST)},e.prototype._useCurrent=function(){var r=this.maskStack[this.maskStack.length-1]._scissorRect,i;this.renderer.renderTexture.current?i=r.y:i=this.renderer.height-r.height-r.y,this.renderer.gl.scissor(r.x,i,r.width,r.height)},e}($l),n0=function(t){j(e,t);function e(r){var i=t.call(this,r)||this;return i.glConst=R.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,i}return e.prototype.getStackLength=function(){var r=this.maskStack[this.maskStack.length-1];return r?r._stencilCounter:0},e.prototype.push=function(r){var i=r.maskObject,n=this.renderer.gl,s=r._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),n.clearStencil(0),n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST)),r._stencilCounter++;var o=r._colorMask;o!==0&&(r._colorMask=0,n.colorMask(!1,!1,!1,!1)),n.stencilFunc(n.EQUAL,s,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.INCR),i.renderable=!0,i.render(this.renderer),this.renderer.batch.flush(),i.renderable=!1,o!==0&&(r._colorMask=o,n.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()},e.prototype.pop=function(r){var i=this.renderer.gl;if(this.getStackLength()===0)i.disable(i.STENCIL_TEST);else{var n=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=n?n._colorMask:15;s!==0&&(n._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilOp(i.KEEP,i.KEEP,i.DECR),r.renderable=!0,r.render(this.renderer),this.renderer.batch.flush(),r.renderable=!1,s!==0&&(n._colorMask=s,i.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}},e.prototype._useCurrent=function(){var r=this.renderer.gl;r.stencilFunc(r.EQUAL,this.getStackLength(),4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP)},e}($l),s0=function(){function t(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new at,this.transform=null}return t.prototype.update=function(e,r,i,n){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=r||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,n),this.transform&&this.projectionMatrix.append(this.transform);var s=this.renderer;s.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,s.globalUniforms.update(),s.shader.shader&&s.shader.syncUniformGroup(s.shader.shader.uniforms.globals)},t.prototype.calculateProjection=function(e,r,i,n){var s=this.projectionMatrix,o=n?-1:1;s.identity(),s.a=1/r.width*2,s.d=o*(1/r.height*2),s.tx=-1-r.x*s.a,s.ty=-o-r.y*s.d},t.prototype.setTransform=function(e){},t.prototype.destroy=function(){this.renderer=null},t}(),Xe=new G,Nr=new G,o0=function(){function t(e){this.renderer=e,this.clearColor=e._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new G,this.destinationFrame=new G,this.viewportFrame=new G}return t.prototype.bind=function(e,r,i){e===void 0&&(e=null);var n=this.renderer;this.current=e;var s,o,a;e?(s=e.baseTexture,a=s.resolution,r||(Xe.width=e.frame.width,Xe.height=e.frame.height,r=Xe),i||(Nr.x=e.frame.x,Nr.y=e.frame.y,Nr.width=r.width,Nr.height=r.height,i=Nr),o=s.framebuffer):(a=n.resolution,r||(Xe.width=n.screen.width,Xe.height=n.screen.height,r=Xe),i||(i=Xe,i.width=r.width,i.height=r.height));var l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,e||(l.y=n.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(o,l),this.renderer.projection.update(i,r,a,!o),e?this.renderer.mask.setMaskStack(s.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(r),this.destinationFrame.copyFrom(i)},t.prototype.clear=function(e,r){this.current?e=e||this.current.baseTexture.clearColor:e=e||this.clearColor;var i=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer.screen,s=i.width!==n.width||i.height!==n.height;if(s){var o=this.viewportFrame,a=o.x,l=o.y,h=o.width,u=o.height;a=Math.round(a),l=Math.round(l),h=Math.round(h),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(a,l,h,u)}this.renderer.framebuffer.clear(e[0],e[1],e[2],e[3],r),s&&this.renderer.scissor.pop()},t.prototype.resize=function(){this.bind(null)},t.prototype.reset=function(){this.bind(null)},t.prototype.destroy=function(){this.renderer=null},t}();function a0(t,e,r,i,n){r.buffer.update(n)}var l0={float:`
|
|
457
|
+
data[offset] = v;
|
|
458
|
+
`,vec2:`
|
|
459
|
+
data[offset] = v[0];
|
|
460
|
+
data[offset+1] = v[1];
|
|
461
|
+
`,vec3:`
|
|
462
|
+
data[offset] = v[0];
|
|
463
|
+
data[offset+1] = v[1];
|
|
464
|
+
data[offset+2] = v[2];
|
|
465
|
+
|
|
466
|
+
`,vec4:`
|
|
467
|
+
data[offset] = v[0];
|
|
468
|
+
data[offset+1] = v[1];
|
|
469
|
+
data[offset+2] = v[2];
|
|
470
|
+
data[offset+3] = v[3];
|
|
471
|
+
`,mat2:`
|
|
472
|
+
data[offset] = v[0];
|
|
473
|
+
data[offset+1] = v[1];
|
|
474
|
+
|
|
475
|
+
data[offset+4] = v[2];
|
|
476
|
+
data[offset+5] = v[3];
|
|
477
|
+
`,mat3:`
|
|
478
|
+
data[offset] = v[0];
|
|
479
|
+
data[offset+1] = v[1];
|
|
480
|
+
data[offset+2] = v[2];
|
|
481
|
+
|
|
482
|
+
data[offset + 4] = v[3];
|
|
483
|
+
data[offset + 5] = v[4];
|
|
484
|
+
data[offset + 6] = v[5];
|
|
485
|
+
|
|
486
|
+
data[offset + 8] = v[6];
|
|
487
|
+
data[offset + 9] = v[7];
|
|
488
|
+
data[offset + 10] = v[8];
|
|
489
|
+
`,mat4:`
|
|
490
|
+
for(var i = 0; i < 16; i++)
|
|
491
|
+
{
|
|
492
|
+
data[offset + i] = v[i];
|
|
493
|
+
}
|
|
494
|
+
`},jl={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function h0(t){for(var e=t.map(function(l){return{data:l,offset:0,dataLen:0,dirty:0}}),r=0,i=0,n=0,s=0;s<e.length;s++){var o=e[s];if(r=jl[o.data.type],o.data.size>1&&(r=Math.max(r,16)*o.data.size),o.dataLen=r,i%r!==0&&i<16){var a=i%r%16;i+=a,n+=a}i+r>16?(n=Math.ceil(n/16)*16,o.offset=n,n+=r,i=r):(o.offset=n,i+=r,n+=r)}return n=Math.ceil(n/16)*16,{uboElements:e,size:n}}function u0(t,e){var r=[];for(var i in t)e[i]&&r.push(e[i]);return r.sort(function(n,s){return n.index-s.index}),r}function f0(t,e){if(!t.autoManage)return{size:0,syncFunc:a0};for(var r=u0(t.uniforms,e),i=h0(r),n=i.uboElements,s=i.size,o=[`
|
|
495
|
+
var v = null;
|
|
496
|
+
var v2 = null;
|
|
497
|
+
var cv = null;
|
|
498
|
+
var t = 0;
|
|
499
|
+
var gl = renderer.gl
|
|
500
|
+
var index = 0;
|
|
501
|
+
var data = buffer.data;
|
|
502
|
+
`],a=0;a<n.length;a++){for(var l=n[a],h=t.uniforms[l.data.name],u=l.data.name,f=!1,c=0;c<ir.length;c++){var d=ir[c];if(d.codeUbo&&d.test(l.data,h)){o.push("offset = "+l.offset/4+";",ir[c].codeUbo(l.data.name,h)),f=!0;break}}if(!f)if(l.data.size>1){var v=Xl(l.data.type),y=Math.max(jl[l.data.type]/16,1),m=v/y,g=(4-m%4)%4;o.push(`
|
|
503
|
+
cv = ud.`+u+`.value;
|
|
504
|
+
v = uv.`+u+`;
|
|
505
|
+
offset = `+l.offset/4+`;
|
|
506
|
+
|
|
507
|
+
t = 0;
|
|
508
|
+
|
|
509
|
+
for(var i=0; i < `+l.data.size*y+`; i++)
|
|
510
|
+
{
|
|
511
|
+
for(var j = 0; j < `+m+`; j++)
|
|
512
|
+
{
|
|
513
|
+
data[offset++] = v[t++];
|
|
514
|
+
}
|
|
515
|
+
offset += `+g+`;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
`)}else{var x=l0[l.data.type];o.push(`
|
|
519
|
+
cv = ud.`+u+`.value;
|
|
520
|
+
v = uv.`+u+`;
|
|
521
|
+
offset = `+l.offset/4+`;
|
|
522
|
+
`+x+`;
|
|
523
|
+
`)}}return o.push(`
|
|
524
|
+
renderer.buffer.update(buffer);
|
|
525
|
+
`),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
|
|
526
|
+
`))}}var c0=function(){function t(e,r){this.program=e,this.uniformData=r,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return t.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},t}();function p0(t,e){for(var r={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var s=e.getActiveAttrib(t,n);if(s.name.indexOf("gl_")!==0){var o=Hl(e,s.type),a={type:o,name:s.name,size:Xl(o),location:e.getAttribLocation(t,s.name)};r[s.name]=a}}return r}function d0(t,e){for(var r={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),n=0;n<i;n++){var s=e.getActiveUniform(t,n),o=s.name.replace(/\[.*?\]$/,""),a=!!s.name.match(/\[.*?\]$/),l=Hl(e,s.type);r[o]={name:o,index:n,type:l,size:s.size,isArray:a,value:Ul(l,s.size)}}return r}function v0(t,e){var r=Rl(t,t.VERTEX_SHADER,e.vertexSrc),i=Rl(t,t.FRAGMENT_SHADER,e.fragmentSrc),n=t.createProgram();if(t.attachShader(n,r),t.attachShader(n,i),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||km(t,n,r,i),e.attributeData=p0(n,t),e.uniformData=d0(n,t),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){var s=Object.keys(e.attributeData);s.sort(function(u,f){return u>f?1:-1});for(var o=0;o<s.length;o++)e.attributeData[s[o]].location=o,t.bindAttribLocation(n,o,s[o]);t.linkProgram(n)}t.deleteShader(r),t.deleteShader(i);var a={};for(var o in e.uniformData){var l=e.uniformData[o];a[o]={location:t.getUniformLocation(n,o),value:Ul(l.type,l.size)}}var h=new c0(n,a);return h}var m0=0,Ni={textureCount:0,uboCount:0},Zl=function(){function t(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=m0++}return t.prototype.systemCheck=function(){if(!Ym())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},t.prototype.contextChange=function(e){this.gl=e,this.reset()},t.prototype.bind=function(e,r){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;var i=e.program,n=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(n.program)),r||(Ni.textureCount=0,Ni.uboCount=0,this.syncUniformGroup(e.uniformGroup,Ni)),n},t.prototype.setUniforms=function(e){var r=this.shader.program,i=r.glPrograms[this.renderer.CONTEXT_UID];r.syncUniforms(i.uniformData,e,this.renderer)},t.prototype.syncUniformGroup=function(e,r){var i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,r))},t.prototype.syncUniforms=function(e,r,i){var n=e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e);n(r.uniformData,e.uniforms,this.renderer,i)},t.prototype.createSyncGroups=function(e){var r=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[r]||(this.cache[r]=Hm(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[r],e.syncUniforms[this.shader.program.id]},t.prototype.syncUniformBufferGroup=function(e,r){var i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;var n=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,r);e.buffer.update(),n(i.uniformData,e.uniforms,this.renderer,Ni,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[r])},t.prototype.createSyncBufferGroup=function(e,r,i){var n=this.renderer.gl;this.renderer.buffer.bind(e.buffer);var s=this.gl.getUniformBlockIndex(r.program,i);r.uniformBufferBindings[i]=this.shader.uniformBindCount,n.uniformBlockBinding(r.program,s,this.shader.uniformBindCount),this.shader.uniformBindCount++;var o=this.getSignature(e,this.shader.program.uniformData,"ubo"),a=this._uboCache[o];if(a||(a=this._uboCache[o]=f0(e,this.shader.program.uniformData)),e.autoManage){var l=new Float32Array(a.size/4);e.buffer.update(l)}return r.uniformGroups[e.id]=a.syncFunc,r.uniformGroups[e.id]},t.prototype.getSignature=function(e,r,i){var n=e.uniforms,s=[i+"-"];for(var o in n)s.push(o),r[o]&&s.push(r[o].type);return s.join("-")},t.prototype.getGlProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},t.prototype.generateProgram=function(e){var r=this.gl,i=e.program,n=v0(r,i);return i.glPrograms[this.renderer.CONTEXT_UID]=n,n},t.prototype.reset=function(){this.program=null,this.shader=null},t.prototype.disposeShader=function(e){this.shader===e&&(this.shader=null)},t.prototype.destroy=function(){this.renderer=null,this.destroyed=!0},t}();function y0(t,e){return e===void 0&&(e=[]),e[A.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.ADD]=[t.ONE,t.ONE],e[A.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.NONE]=[0,0],e[A.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.ADD_NPM]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e[A.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[A.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[A.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[A.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[A.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[A.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[A.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[A.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[A.XOR]=[t.ONE_MINUS_DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[A.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}var g0=0,_0=1,x0=2,w0=3,P0=4,b0=5,T0=function(){function t(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=A.NONE,this._blendEq=!1,this.map=[],this.map[g0]=this.setBlend,this.map[_0]=this.setOffset,this.map[x0]=this.setCullFace,this.map[w0]=this.setDepthTest,this.map[P0]=this.setFrontFace,this.map[b0]=this.setDepthMask,this.checks=[],this.defaultState=new Si,this.defaultState.blend=!0}return t.prototype.contextChange=function(e){this.gl=e,this.blendModes=y0(e),this.set(this.defaultState),this.reset()},t.prototype.set=function(e){if(e=e||this.defaultState,this.stateId!==e.data){for(var r=this.stateId^e.data,i=0;r;)r&1&&this.map[i].call(this,!!(e.data&1<<i)),r=r>>1,i++;this.stateId=e.data}for(var i=0;i<this.checks.length;i++)this.checks[i](this,e)},t.prototype.forceState=function(e){e=e||this.defaultState;for(var r=0;r<this.map.length;r++)this.map[r].call(this,!!(e.data&1<<r));for(var r=0;r<this.checks.length;r++)this.checks[r](this,e);this.stateId=e.data},t.prototype.setBlend=function(e){this.updateCheck(t.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)},t.prototype.setOffset=function(e){this.updateCheck(t.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},t.prototype.setDepthTest=function(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)},t.prototype.setDepthMask=function(e){this.gl.depthMask(e)},t.prototype.setCullFace=function(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)},t.prototype.setFrontFace=function(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])},t.prototype.setBlendMode=function(e){if(e!==this.blendMode){this.blendMode=e;var r=this.blendModes[e],i=this.gl;r.length===2?i.blendFunc(r[0],r[1]):i.blendFuncSeparate(r[0],r[1],r[2],r[3]),r.length===6?(this._blendEq=!0,i.blendEquationSeparate(r[4],r[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}},t.prototype.setPolygonOffset=function(e,r){this.gl.polygonOffset(e,r)},t.prototype.reset=function(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)},t.prototype.updateCheck=function(e,r){var i=this.checks.indexOf(e);r&&i===-1?this.checks.push(e):!r&&i!==-1&&this.checks.splice(i,1)},t.checkBlendMode=function(e,r){e.setBlendMode(r.blendMode)},t.checkPolygonOffset=function(e,r){e.setPolygonOffset(1,r.polygonOffset)},t.prototype.destroy=function(){this.gl=null},t}(),I0=function(){function t(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=R.GC_MAX_IDLE,this.checkCountMax=R.GC_MAX_CHECK_COUNT,this.mode=R.GC_MODE}return t.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==Nn.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},t.prototype.run=function(){for(var e=this.renderer.texture,r=e.managedTextures,i=!1,n=0;n<r.length;n++){var s=r[n];!s.framebuffer&&this.count-s.touched>this.maxIdle&&(e.destroyTexture(s,!0),r[n]=null,i=!0)}if(i){for(var o=0,n=0;n<r.length;n++)r[n]!==null&&(r[o++]=r[n]);r.length=o}},t.prototype.unload=function(e){var r=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&r.destroyTexture(i);for(var n=e.children.length-1;n>=0;n--)this.unload(e.children[n])},t.prototype.destroy=function(){this.renderer=null},t}();function C0(t){var e,r,i,n,s,o,a,l,h,u,f,c,d,v,y,m,g,x,_,P,w,b,T;return"WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?T=(e={},e[H.UNSIGNED_BYTE]=(r={},r[F.RGBA]=t.RGBA8,r[F.RGB]=t.RGB8,r[F.RG]=t.RG8,r[F.RED]=t.R8,r[F.RGBA_INTEGER]=t.RGBA8UI,r[F.RGB_INTEGER]=t.RGB8UI,r[F.RG_INTEGER]=t.RG8UI,r[F.RED_INTEGER]=t.R8UI,r[F.ALPHA]=t.ALPHA,r[F.LUMINANCE]=t.LUMINANCE,r[F.LUMINANCE_ALPHA]=t.LUMINANCE_ALPHA,r),e[H.BYTE]=(i={},i[F.RGBA]=t.RGBA8_SNORM,i[F.RGB]=t.RGB8_SNORM,i[F.RG]=t.RG8_SNORM,i[F.RED]=t.R8_SNORM,i[F.RGBA_INTEGER]=t.RGBA8I,i[F.RGB_INTEGER]=t.RGB8I,i[F.RG_INTEGER]=t.RG8I,i[F.RED_INTEGER]=t.R8I,i),e[H.UNSIGNED_SHORT]=(n={},n[F.RGBA_INTEGER]=t.RGBA16UI,n[F.RGB_INTEGER]=t.RGB16UI,n[F.RG_INTEGER]=t.RG16UI,n[F.RED_INTEGER]=t.R16UI,n[F.DEPTH_COMPONENT]=t.DEPTH_COMPONENT16,n),e[H.SHORT]=(s={},s[F.RGBA_INTEGER]=t.RGBA16I,s[F.RGB_INTEGER]=t.RGB16I,s[F.RG_INTEGER]=t.RG16I,s[F.RED_INTEGER]=t.R16I,s),e[H.UNSIGNED_INT]=(o={},o[F.RGBA_INTEGER]=t.RGBA32UI,o[F.RGB_INTEGER]=t.RGB32UI,o[F.RG_INTEGER]=t.RG32UI,o[F.RED_INTEGER]=t.R32UI,o[F.DEPTH_COMPONENT]=t.DEPTH_COMPONENT24,o),e[H.INT]=(a={},a[F.RGBA_INTEGER]=t.RGBA32I,a[F.RGB_INTEGER]=t.RGB32I,a[F.RG_INTEGER]=t.RG32I,a[F.RED_INTEGER]=t.R32I,a),e[H.FLOAT]=(l={},l[F.RGBA]=t.RGBA32F,l[F.RGB]=t.RGB32F,l[F.RG]=t.RG32F,l[F.RED]=t.R32F,l[F.DEPTH_COMPONENT]=t.DEPTH_COMPONENT32F,l),e[H.HALF_FLOAT]=(h={},h[F.RGBA]=t.RGBA16F,h[F.RGB]=t.RGB16F,h[F.RG]=t.RG16F,h[F.RED]=t.R16F,h),e[H.UNSIGNED_SHORT_5_6_5]=(u={},u[F.RGB]=t.RGB565,u),e[H.UNSIGNED_SHORT_4_4_4_4]=(f={},f[F.RGBA]=t.RGBA4,f),e[H.UNSIGNED_SHORT_5_5_5_1]=(c={},c[F.RGBA]=t.RGB5_A1,c),e[H.UNSIGNED_INT_2_10_10_10_REV]=(d={},d[F.RGBA]=t.RGB10_A2,d[F.RGBA_INTEGER]=t.RGB10_A2UI,d),e[H.UNSIGNED_INT_10F_11F_11F_REV]=(v={},v[F.RGB]=t.R11F_G11F_B10F,v),e[H.UNSIGNED_INT_5_9_9_9_REV]=(y={},y[F.RGB]=t.RGB9_E5,y),e[H.UNSIGNED_INT_24_8]=(m={},m[F.DEPTH_STENCIL]=t.DEPTH24_STENCIL8,m),e[H.FLOAT_32_UNSIGNED_INT_24_8_REV]=(g={},g[F.DEPTH_STENCIL]=t.DEPTH32F_STENCIL8,g),e):T=(x={},x[H.UNSIGNED_BYTE]=(_={},_[F.RGBA]=t.RGBA,_[F.RGB]=t.RGB,_[F.ALPHA]=t.ALPHA,_[F.LUMINANCE]=t.LUMINANCE,_[F.LUMINANCE_ALPHA]=t.LUMINANCE_ALPHA,_),x[H.UNSIGNED_SHORT_5_6_5]=(P={},P[F.RGB]=t.RGB,P),x[H.UNSIGNED_SHORT_4_4_4_4]=(w={},w[F.RGBA]=t.RGBA,w),x[H.UNSIGNED_SHORT_5_5_5_1]=(b={},b[F.RGBA]=t.RGBA,b),x),T}var ws=function(){function t(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=H.UNSIGNED_BYTE,this.internalFormat=F.RGBA,this.samplerType=0}return t}(),A0=function(){function t(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Z,this.hasIntegerTextures=!1}return t.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=C0(e);var r=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=r;for(var i=0;i<r;i++)this.boundTextures[i]=null;this.emptyTextures={};var n=new ws(e.createTexture());e.bindTexture(e.TEXTURE_2D,n.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=n,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new ws(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(var i=0;i<6;i++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(var i=0;i<this.boundTextures.length;i++)this.bind(null,i)},t.prototype.bind=function(e,r){r===void 0&&(r=0);var i=this.gl;if(e=e?.castToBaseTexture(),e&&e.valid&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;var n=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[r]!==e&&(this.currentLocation!==r&&(this.currentLocation=r,i.activeTexture(i.TEXTURE0+r)),i.bindTexture(e.target,n.texture)),n.dirtyId!==e.dirtyId?(this.currentLocation!==r&&(this.currentLocation=r,i.activeTexture(i.TEXTURE0+r)),this.updateTexture(e)):n.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[r]=e}else this.currentLocation!==r&&(this.currentLocation=r,i.activeTexture(i.TEXTURE0+r)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[r]=null},t.prototype.reset=function(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(var e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture},t.prototype.unbind=function(e){var r=this,i=r.gl,n=r.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var s=0;s<n.length;s++)n[s]===this.unknownTexture&&this.bind(null,s)}for(var s=0;s<n.length;s++)n[s]===e&&(this.currentLocation!==s&&(i.activeTexture(i.TEXTURE0+s),this.currentLocation=s),i.bindTexture(e.target,this.emptyTextures[e.target].texture),n[s]=null)},t.prototype.ensureSamplerType=function(e){var r=this,i=r.boundTextures,n=r.hasIntegerTextures,s=r.CONTEXT_UID;if(n)for(var o=e-1;o>=0;--o){var a=i[o];if(a){var l=a._glTextures[s];l.samplerType!==ai.FLOAT&&this.renderer.texture.unbind(a)}}},t.prototype.initTexture=function(e){var r=new ws(this.gl.createTexture());return r.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=r,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),r},t.prototype.initTextureType=function(e,r){var i,n;r.internalFormat=(n=(i=this.internalFormats[e.type])===null||i===void 0?void 0:i[e.format])!==null&&n!==void 0?n:e.format,this.webGLVersion===2&&e.type===H.HALF_FLOAT?r.type=this.gl.HALF_FLOAT:r.type=e.type},t.prototype.updateTexture=function(e){var r=e._glTextures[this.CONTEXT_UID];if(r){var i=this.renderer;if(this.initTextureType(e,r),e.resource&&e.resource.upload(i,e,r))r.samplerType!==ai.FLOAT&&(this.hasIntegerTextures=!0);else{var n=e.realWidth,s=e.realHeight,o=i.gl;(r.width!==n||r.height!==s||r.dirtyId<0)&&(r.width=n,r.height=s,o.texImage2D(e.target,0,r.internalFormat,n,s,0,e.format,r.type,null))}e.dirtyStyleId!==r.dirtyStyleId&&this.updateTextureStyle(e),r.dirtyId=e.dirtyId}},t.prototype.destroyTexture=function(e,r){var i=this.gl;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!r)){var n=this.managedTextures.indexOf(e);n!==-1&&yi(this.managedTextures,n,1)}},t.prototype.updateTextureStyle=function(e){var r=e._glTextures[this.CONTEXT_UID];r&&((e.mipmap===Le.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?r.mipmap=!1:r.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?r.wrapMode=mr.CLAMP:r.wrapMode=e.wrapMode,e.resource&&e.resource.style(this.renderer,e,r)||this.setStyle(e,r),r.dirtyStyleId=e.dirtyStyleId)},t.prototype.setStyle=function(e,r){var i=this.gl;if(r.mipmap&&e.mipmap!==Le.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,r.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,r.wrapMode),r.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===xt.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===xt.LINEAR){var s=Math.min(e.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,s)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===xt.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===xt.LINEAR?i.LINEAR:i.NEAREST)},t.prototype.destroy=function(){this.renderer=null},t}(),Ps=new at,ql=function(t){j(e,t);function e(r,i){r===void 0&&(r=Ze.UNKNOWN);var n=t.call(this)||this;return i=Object.assign({},R.RENDER_OPTIONS,i),n.options=i,n.type=r,n.screen=new G(0,0,i.width,i.height),n.view=i.view||R.ADAPTER.createCanvas(),n.resolution=i.resolution||R.RESOLUTION,n.useContextAlpha=i.useContextAlpha,n.autoDensity=!!i.autoDensity,n.preserveDrawingBuffer=i.preserveDrawingBuffer,n.clearBeforeRender=i.clearBeforeRender,n._backgroundColor=0,n._backgroundColorRgba=[0,0,0,1],n._backgroundColorString="#000000",n.backgroundColor=i.backgroundColor||n._backgroundColor,n.backgroundAlpha=i.backgroundAlpha,i.transparent!==void 0&&(Kt("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),n.useContextAlpha=i.transparent,n.backgroundAlpha=i.transparent?0:1),n._lastObjectRendered=null,n.plugins={},n}return e.prototype.initPlugins=function(r){for(var i in r)this.plugins[i]=new r[i](this)},Object.defineProperty(e.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),e.prototype.resize=function(r,i){this.view.width=Math.round(r*this.resolution),this.view.height=Math.round(i*this.resolution);var n=this.view.width/this.resolution,s=this.view.height/this.resolution;this.screen.width=n,this.screen.height=s,this.autoDensity&&(this.view.style.width=n+"px",this.view.style.height=s+"px"),this.emit("resize",n,s)},e.prototype.generateTexture=function(r,i,n,s){i===void 0&&(i={}),typeof i=="number"&&(Kt("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),i={scaleMode:i,resolution:n,region:s});var o=i.region,a=um(i,["region"]);s=o||r.getLocalBounds(null,!0),s.width===0&&(s.width=1),s.height===0&&(s.height=1);var l=Ht.create(os({width:s.width,height:s.height},a));return Ps.tx=-s.x,Ps.ty=-s.y,this.render(r,{renderTexture:l,clear:!1,transform:Ps,skipUpdateTransform:!!r.parent}),l},e.prototype.destroy=function(r){for(var i in this.plugins)this.plugins[i].destroy(),this.plugins[i]=null;r&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var n=this;n.plugins=null,n.type=Ze.UNKNOWN,n.view=null,n.screen=null,n._tempDisplayObjectParent=null,n.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(r){this._backgroundColor=r,this._backgroundColorString=di(r),tr(r,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(r){this._backgroundColorRgba[3]=r},enumerable:!1,configurable:!0}),e}(ye),E0=function(){function t(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}return t}(),S0=function(){function t(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}return t.prototype.destroy=function(){this.renderer=null},t.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},t.prototype.bind=function(e){var r=this,i=r.gl,n=r.CONTEXT_UID,s=e._glBuffers[n]||this.createGLBuffer(e);i.bindBuffer(e.type,s.buffer)},t.prototype.bindBufferBase=function(e,r){var i=this,n=i.gl,s=i.CONTEXT_UID;if(this.boundBufferBases[r]!==e){var o=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[r]=e,n.bindBufferBase(n.UNIFORM_BUFFER,r,o.buffer)}},t.prototype.bindBufferRange=function(e,r,i){var n=this,s=n.gl,o=n.CONTEXT_UID;i=i||0;var a=e._glBuffers[o]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,r||0,a.buffer,i*256,256)},t.prototype.update=function(e){var r=this,i=r.gl,n=r.CONTEXT_UID,s=e._glBuffers[n];if(e._updateID!==s.updateID)if(s.updateID=e._updateID,i.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)i.bufferSubData(e.type,0,e.data);else{var o=e.static?i.STATIC_DRAW:i.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,i.bufferData(e.type,e.data,o)}},t.prototype.dispose=function(e,r){if(this.managedBuffers[e.id]){delete this.managedBuffers[e.id];var i=e._glBuffers[this.CONTEXT_UID],n=this.gl;e.disposeRunner.remove(this),i&&(r||n.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}},t.prototype.disposeAll=function(e){for(var r=Object.keys(this.managedBuffers),i=0;i<r.length;i++)this.dispose(this.managedBuffers[r[i]],e)},t.prototype.createGLBuffer=function(e){var r=this,i=r.CONTEXT_UID,n=r.gl;return e._glBuffers[i]=new E0(n.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[i]},t}(),nr=function(t){j(e,t);function e(r){var i=t.call(this,Ze.WEBGL,r)||this;return r=i.options,i.gl=null,i.CONTEXT_UID=0,i.runners={destroy:new ut("destroy"),contextChange:new ut("contextChange"),reset:new ut("reset"),update:new ut("update"),postrender:new ut("postrender"),prerender:new ut("prerender"),resize:new ut("resize")},i.runners.contextChange.add(i),i.globalUniforms=new De({projectionMatrix:new at},!0),i.addSystem(r0,"mask").addSystem(Nm,"context").addSystem(T0,"state").addSystem(Zl,"shader").addSystem(A0,"texture").addSystem(S0,"buffer").addSystem(Fm,"geometry").addSystem(Mm,"framebuffer").addSystem(i0,"scissor").addSystem(n0,"stencil").addSystem(s0,"projection").addSystem(I0,"textureGC").addSystem(Em,"filter").addSystem(o0,"renderTexture").addSystem(Sm,"batch"),i.initPlugins(e.__plugins),i.multisample=void 0,r.context?i.context.initFromContext(r.context):i.context.initFromOptions({alpha:!!i.useContextAlpha,antialias:r.antialias,premultipliedAlpha:i.useContextAlpha&&i.useContextAlpha!=="notMultiplied",stencil:!0,preserveDrawingBuffer:r.preserveDrawingBuffer,powerPreference:i.options.powerPreference}),i.renderingToScreen=!0,ja(i.context.webGLVersion===2?"WebGL 2":"WebGL 1"),i.resize(i.options.width,i.options.height),i}return e.create=function(r){if(hp())return new e(r);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},e.prototype.contextChange=function(){var r=this.gl,i;if(this.context.webGLVersion===1){var n=r.getParameter(r.FRAMEBUFFER_BINDING);r.bindFramebuffer(r.FRAMEBUFFER,null),i=r.getParameter(r.SAMPLES),r.bindFramebuffer(r.FRAMEBUFFER,n)}else{var n=r.getParameter(r.DRAW_FRAMEBUFFER_BINDING);r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),i=r.getParameter(r.SAMPLES),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,n)}i>=nt.HIGH?this.multisample=nt.HIGH:i>=nt.MEDIUM?this.multisample=nt.MEDIUM:i>=nt.LOW?this.multisample=nt.LOW:this.multisample=nt.NONE},e.prototype.addSystem=function(r,i){var n=new r(this);if(this[i])throw new Error('Whoops! The name "'+i+'" is already in use');this[i]=n;for(var s in this.runners)this.runners[s].add(n);return this},e.prototype.render=function(r,i){var n,s,o,a;if(i&&(i instanceof Ht?(Kt("6.0.0","Renderer#render arguments changed, use options instead."),n=i,s=arguments[2],o=arguments[3],a=arguments[4]):(n=i.renderTexture,s=i.clear,o=i.transform,a=i.skipUpdateTransform)),this.renderingToScreen=!n,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=o,!this.context.isLost){if(n||(this._lastObjectRendered=r),!a){var l=r.enableTempParent();r.updateTransform(),r.disableTempParent(l)}this.renderTexture.bind(n),this.batch.currentRenderer.start(),(s!==void 0?s:this.clearBeforeRender)&&this.renderTexture.clear(),r.render(this),this.batch.currentRenderer.flush(),n&&n.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},e.prototype.generateTexture=function(r,i,n,s){i===void 0&&(i={});var o=t.prototype.generateTexture.call(this,r,i,n,s);return this.framebuffer.blit(),o},e.prototype.resize=function(r,i){t.prototype.resize.call(this,r,i),this.runners.resize.emit(this.screen.height,this.screen.width)},e.prototype.reset=function(){return this.runners.reset.emit(),this},e.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},e.prototype.destroy=function(r){this.runners.destroy.emit();for(var i in this.runners)this.runners[i].destroy();t.prototype.destroy.call(this,r),this.gl=null},Object.defineProperty(e.prototype,"extract",{get:function(){return Kt("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),e.registerPlugin=function(r,i){Kt("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),Gt.add({name:r,type:dt.RendererPlugin,ref:i})},e.__plugins={},e}(ql);Gt.handleByMap(dt.RendererPlugin,nr.__plugins);function N0(t){return nr.create(t)}var O0=`attribute vec2 aVertexPosition;
|
|
527
|
+
|
|
528
|
+
uniform mat3 projectionMatrix;
|
|
529
|
+
|
|
530
|
+
varying vec2 vTextureCoord;
|
|
531
|
+
|
|
532
|
+
uniform vec4 inputSize;
|
|
533
|
+
uniform vec4 outputFrame;
|
|
534
|
+
|
|
535
|
+
vec4 filterVertexPosition( void )
|
|
536
|
+
{
|
|
537
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
538
|
+
|
|
539
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
vec2 filterTextureCoord( void )
|
|
543
|
+
{
|
|
544
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
void main(void)
|
|
548
|
+
{
|
|
549
|
+
gl_Position = filterVertexPosition();
|
|
550
|
+
vTextureCoord = filterTextureCoord();
|
|
551
|
+
}
|
|
552
|
+
`,L0=O0,bs=function(){function t(){this.texArray=null,this.blend=0,this.type=qt.TRIANGLES,this.start=0,this.size=0,this.data=null}return t}(),Ts=function(){function t(){this.elements=[],this.ids=[],this.count=0}return t.prototype.clear=function(){for(var e=0;e<this.count;e++)this.elements[e]=null;this.count=0},t}(),M0=function(){function t(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)}return Object.defineProperty(t.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),t.prototype.view=function(e){return this[e+"View"]},t.prototype.destroy=function(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null},t.sizeOf=function(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")}},t}(),F0=function(t){j(e,t);function e(r){var i=t.call(this,r)||this;return i.shaderGenerator=null,i.geometryClass=null,i.vertexSize=null,i.state=Si.for2d(),i.size=R.SPRITE_BATCH_SIZE*4,i._vertexCount=0,i._indexCount=0,i._bufferedElements=[],i._bufferedTextures=[],i._bufferSize=0,i._shader=null,i._packedGeometries=[],i._packedGeometryPoolSize=2,i._flushId=0,i._aBuffers={},i._iBuffers={},i.MAX_TEXTURES=1,i.renderer.on("prerender",i.onPrerender,i),r.runners.contextChange.add(i),i._dcIndex=0,i._aIndex=0,i._iIndex=0,i._attributeBuffer=null,i._indexBuffer=null,i._tempBoundTextures=[],i}return e.prototype.contextChange=function(){var r=this.renderer.gl;R.PREFER_ENV===Zt.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),R.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=$m(this.MAX_TEXTURES,r)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var i=0;i<this._packedGeometryPoolSize;i++)this._packedGeometries[i]=new this.geometryClass;this.initFlushBuffers()},e.prototype.initFlushBuffers=function(){for(var r=e._drawCallPool,i=e._textureArrayPool,n=this.size/4,s=Math.floor(n/this.MAX_TEXTURES)+1;r.length<n;)r.push(new bs);for(;i.length<s;)i.push(new Ts);for(var o=0;o<this.MAX_TEXTURES;o++)this._tempBoundTextures[o]=null},e.prototype.onPrerender=function(){this._flushId=0},e.prototype.render=function(r){r._texture.valid&&(this._vertexCount+r.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=r.vertexData.length/2,this._indexCount+=r.indices.length,this._bufferedTextures[this._bufferSize]=r._texture.baseTexture,this._bufferedElements[this._bufferSize++]=r)},e.prototype.buildTexturesAndDrawCalls=function(){var r=this,i=r._bufferedTextures,n=r.MAX_TEXTURES,s=e._textureArrayPool,o=this.renderer.batch,a=this._tempBoundTextures,l=this.renderer.textureGC.count,h=++Z._globalBatch,u=0,f=s[0],c=0;o.copyBoundTextures(a,n);for(var d=0;d<this._bufferSize;++d){var v=i[d];i[d]=null,v._batchEnabled!==h&&(f.count>=n&&(o.boundArray(f,a,h,n),this.buildDrawCalls(f,c,d),c=d,f=s[++u],++h),v._batchEnabled=h,v.touched=l,f.elements[f.count++]=v)}f.count>0&&(o.boundArray(f,a,h,n),this.buildDrawCalls(f,c,this._bufferSize),++u,++h);for(var d=0;d<a.length;d++)a[d]=null;Z._globalBatch=h},e.prototype.buildDrawCalls=function(r,i,n){var s=this,o=s._bufferedElements,a=s._attributeBuffer,l=s._indexBuffer,h=s.vertexSize,u=e._drawCallPool,f=this._dcIndex,c=this._aIndex,d=this._iIndex,v=u[f];v.start=this._iIndex,v.texArray=r;for(var y=i;y<n;++y){var m=o[y],g=m._texture.baseTexture,x=Qv[g.alphaMode?1:0][m.blendMode];o[y]=null,i<y&&v.blend!==x&&(v.size=d-v.start,i=y,v=u[++f],v.texArray=r,v.start=d),this.packInterleavedGeometry(m,a,l,c,d),c+=m.vertexData.length/2*h,d+=m.indices.length,v.blend=x}i<n&&(v.size=d-v.start,++f),this._dcIndex=f,this._aIndex=c,this._iIndex=d},e.prototype.bindAndClearTexArray=function(r){for(var i=this.renderer.texture,n=0;n<r.count;n++)i.bind(r.elements[n],r.ids[n]),r.elements[n]=null;r.count=0},e.prototype.updateGeometry=function(){var r=this,i=r._packedGeometries,n=r._attributeBuffer,s=r._indexBuffer;R.CAN_UPLOAD_SAME_BUFFER?(i[this._flushId]._buffer.update(n.rawBinaryData),i[this._flushId]._indexBuffer.update(s),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,i[this._flushId]=new this.geometryClass),i[this._flushId]._buffer.update(n.rawBinaryData),i[this._flushId]._indexBuffer.update(s),this.renderer.geometry.bind(i[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},e.prototype.drawBatches=function(){for(var r=this._dcIndex,i=this.renderer,n=i.gl,s=i.state,o=e._drawCallPool,a=null,l=0;l<r;l++){var h=o[l],u=h.texArray,f=h.type,c=h.size,d=h.start,v=h.blend;a!==u&&(a=u,this.bindAndClearTexArray(u)),this.state.blendMode=v,s.set(this.state),n.drawElements(f,c,n.UNSIGNED_SHORT,d*2)}},e.prototype.flush=function(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)},e.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES),this.renderer.shader.bind(this._shader),R.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},e.prototype.stop=function(){this.flush()},e.prototype.destroy=function(){for(var r=0;r<this._packedGeometryPoolSize;r++)this._packedGeometries[r]&&this._packedGeometries[r].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),t.prototype.destroy.call(this)},e.prototype.getAttributeBuffer=function(r){var i=mi(Math.ceil(r/8)),n=Qa(i),s=i*8;this._aBuffers.length<=n&&(this._iBuffers.length=n+1);var o=this._aBuffers[s];return o||(this._aBuffers[s]=o=new M0(s*this.vertexSize*4)),o},e.prototype.getIndexBuffer=function(r){var i=mi(Math.ceil(r/12)),n=Qa(i),s=i*12;this._iBuffers.length<=n&&(this._iBuffers.length=n+1);var o=this._iBuffers[n];return o||(this._iBuffers[n]=o=new Uint16Array(s)),o},e.prototype.packInterleavedGeometry=function(r,i,n,s,o){for(var a=i.uint32View,l=i.float32View,h=s/this.vertexSize,u=r.uvs,f=r.indices,c=r.vertexData,d=r._texture.baseTexture._batchLocation,v=Math.min(r.worldAlpha,1),y=v<1&&r._texture.baseTexture.alphaMode?Za(r._tintRGB,v):r._tintRGB+(v*255<<24),m=0;m<c.length;m+=2)l[s++]=c[m],l[s++]=c[m+1],l[s++]=u[m],l[s++]=u[m+1],a[s++]=y,l[s++]=d;for(var m=0;m<f.length;m++)n[o++]=h+f[m]},e._drawCallPool=[],e._textureArrayPool=[],e}(Ml),R0=function(){function t(e,r){if(this.vertexSrc=e,this.fragTemplate=r,this.programCache={},this.defaultGroupCache={},r.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(r.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}return t.prototype.generateShader=function(e){if(!this.programCache[e]){for(var r=new Int32Array(e),i=0;i<e;i++)r[i]=i;this.defaultGroupCache[e]=De.from({uSamplers:r},!0);var n=this.fragTemplate;n=n.replace(/%count%/gi,""+e),n=n.replace(/%forloop%/gi,this.generateSampleSrc(e)),this.programCache[e]=new ps(this.vertexSrc,n)}var s={tint:new Float32Array([1,1,1,1]),translationMatrix:new at,default:this.defaultGroupCache[e]};return new ds(this.programCache[e],s)},t.prototype.generateSampleSrc=function(e){var r="";r+=`
|
|
553
|
+
`,r+=`
|
|
554
|
+
`;for(var i=0;i<e;i++)i>0&&(r+=`
|
|
555
|
+
else `),i<e-1&&(r+="if(vTextureId < "+i+".5)"),r+=`
|
|
556
|
+
{`,r+=`
|
|
557
|
+
color = texture2D(uSamplers[`+i+"], vTextureCoord);",r+=`
|
|
558
|
+
}`;return r+=`
|
|
559
|
+
`,r+=`
|
|
560
|
+
`,r},t}(),Jl=function(t){j(e,t);function e(r){r===void 0&&(r=!1);var i=t.call(this)||this;return i._buffer=new bt(null,r,!1),i._indexBuffer=new bt(null,r,!0),i.addAttribute("aVertexPosition",i._buffer,2,!1,H.FLOAT).addAttribute("aTextureCoord",i._buffer,2,!1,H.FLOAT).addAttribute("aColor",i._buffer,4,!0,H.UNSIGNED_BYTE).addAttribute("aTextureId",i._buffer,1,!0,H.FLOAT).addIndex(i._indexBuffer),i}return e}(hs),Ql=`precision highp float;
|
|
561
|
+
attribute vec2 aVertexPosition;
|
|
562
|
+
attribute vec2 aTextureCoord;
|
|
563
|
+
attribute vec4 aColor;
|
|
564
|
+
attribute float aTextureId;
|
|
565
|
+
|
|
566
|
+
uniform mat3 projectionMatrix;
|
|
567
|
+
uniform mat3 translationMatrix;
|
|
568
|
+
uniform vec4 tint;
|
|
569
|
+
|
|
570
|
+
varying vec2 vTextureCoord;
|
|
571
|
+
varying vec4 vColor;
|
|
572
|
+
varying float vTextureId;
|
|
573
|
+
|
|
574
|
+
void main(void){
|
|
575
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
576
|
+
|
|
577
|
+
vTextureCoord = aTextureCoord;
|
|
578
|
+
vTextureId = aTextureId;
|
|
579
|
+
vColor = aColor * tint;
|
|
580
|
+
}
|
|
581
|
+
`,Kl=`varying vec2 vTextureCoord;
|
|
582
|
+
varying vec4 vColor;
|
|
583
|
+
varying float vTextureId;
|
|
584
|
+
uniform sampler2D uSamplers[%count%];
|
|
585
|
+
|
|
586
|
+
void main(void){
|
|
587
|
+
vec4 color;
|
|
588
|
+
%forloop%
|
|
589
|
+
gl_FragColor = color * vColor;
|
|
590
|
+
}
|
|
591
|
+
`,k0=function(){function t(){}return t.create=function(e){var r=Object.assign({vertex:Ql,fragment:Kl,geometryClass:Jl,vertexSize:6},e),i=r.vertex,n=r.fragment,s=r.vertexSize,o=r.geometryClass;return function(a){j(l,a);function l(h){var u=a.call(this,h)||this;return u.shaderGenerator=new R0(i,n),u.geometryClass=o,u.vertexSize=s,u}return l}(F0)},Object.defineProperty(t,"defaultVertexSrc",{get:function(){return Ql},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentTemplate",{get:function(){return Kl},enumerable:!1,configurable:!0}),t}(),th=k0.create();Object.assign(th,{extension:{name:"batch",type:dt.RendererPlugin}});/*!
|
|
592
|
+
* @pixi/canvas-display - v6.5.7
|
|
593
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
594
|
+
*
|
|
595
|
+
* @pixi/canvas-display is licensed under the MIT License.
|
|
596
|
+
* http://www.opensource.org/licenses/mit-license
|
|
597
|
+
*/mt.prototype._renderCanvas=function(e){},mt.prototype.renderCanvas=function(e){if(!(!this.visible||this.worldAlpha<=0||!this.renderable)){this._mask&&e.maskManager.pushMask(this._mask),this._renderCanvas(e);for(var r=0,i=this.children.length;r<i;++r)this.children[r].renderCanvas(e);this._mask&&e.maskManager.popMask(e)}},ee.prototype.renderCanvas=function(e){};/*!
|
|
598
|
+
* @pixi/sprite - v6.5.7
|
|
599
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
600
|
+
*
|
|
601
|
+
* @pixi/sprite is licensed under the MIT License.
|
|
602
|
+
* http://www.opensource.org/licenses/mit-license
|
|
603
|
+
*//*! *****************************************************************************
|
|
604
|
+
Copyright (c) Microsoft Corporation.
|
|
605
|
+
|
|
606
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
607
|
+
purpose with or without fee is hereby granted.
|
|
608
|
+
|
|
609
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
610
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
611
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
612
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
613
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
614
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
615
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
616
|
+
***************************************************************************** */var Is=function(t,e){return Is=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Is(t,e)};function U0(t,e){Is(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Or=new X,B0=new Uint16Array([0,1,2,0,2,3]),zt=function(t){U0(e,t);function e(r){var i=t.call(this)||this;return i._anchor=new Cr(i._onAnchorUpdate,i,r?r.defaultAnchor.x:0,r?r.defaultAnchor.y:0),i._texture=null,i._width=0,i._height=0,i._tint=null,i._tintRGB=null,i.tint=16777215,i.blendMode=A.NORMAL,i._cachedTint=16777215,i.uvs=null,i.texture=r||lt.EMPTY,i.vertexData=new Float32Array(8),i.vertexTrimmedData=null,i._transformID=-1,i._textureID=-1,i._transformTrimmedID=-1,i._textureTrimmedID=-1,i.indices=B0,i.pluginName="batch",i.isSprite=!0,i._roundPixels=R.ROUND_PIXELS,i}return e.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=rr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=rr(this.scale.y)*this._height/this._texture.orig.height)},e.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},e.prototype.calculateVertices=function(){var r=this._texture;if(!(this._transformID===this.transform._worldID&&this._textureID===r._updateID)){this._textureID!==r._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=r._updateID;var i=this.transform.worldTransform,n=i.a,s=i.b,o=i.c,a=i.d,l=i.tx,h=i.ty,u=this.vertexData,f=r.trim,c=r.orig,d=this._anchor,v=0,y=0,m=0,g=0;if(f?(y=f.x-d._x*c.width,v=y+f.width,g=f.y-d._y*c.height,m=g+f.height):(y=-d._x*c.width,v=y+c.width,g=-d._y*c.height,m=g+c.height),u[0]=n*y+o*g+l,u[1]=a*g+s*y+h,u[2]=n*v+o*g+l,u[3]=a*g+s*v+h,u[4]=n*v+o*m+l,u[5]=a*m+s*v+h,u[6]=n*y+o*m+l,u[7]=a*m+s*y+h,this._roundPixels)for(var x=R.RESOLUTION,_=0;_<u.length;++_)u[_]=Math.round((u[_]*x|0)/x)}},e.prototype.calculateTrimmedVertices=function(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var r=this._texture,i=this.vertexTrimmedData,n=r.orig,s=this._anchor,o=this.transform.worldTransform,a=o.a,l=o.b,h=o.c,u=o.d,f=o.tx,c=o.ty,d=-s._x*n.width,v=d+n.width,y=-s._y*n.height,m=y+n.height;i[0]=a*d+h*y+f,i[1]=u*y+l*d+c,i[2]=a*v+h*y+f,i[3]=u*y+l*v+c,i[4]=a*v+h*m+f,i[5]=u*m+l*v+c,i[6]=a*d+h*m+f,i[7]=u*m+l*d+c},e.prototype._render=function(r){this.calculateVertices(),r.batch.setObjectRenderer(r.plugins[this.pluginName]),r.plugins[this.pluginName].render(this)},e.prototype._calculateBounds=function(){var r=this._texture.trim,i=this._texture.orig;!r||r.width===i.width&&r.height===i.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},e.prototype.getLocalBounds=function(r){return this.children.length===0?(this._localBounds||(this._localBounds=new Pi),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),r||(this._localBoundsRect||(this._localBoundsRect=new G),r=this._localBoundsRect),this._localBounds.getRectangle(r)):t.prototype.getLocalBounds.call(this,r)},e.prototype.containsPoint=function(r){this.worldTransform.applyInverse(r,Or);var i=this._texture.orig.width,n=this._texture.orig.height,s=-i*this.anchor.x,o=0;return Or.x>=s&&Or.x<s+i&&(o=-n*this.anchor.y,Or.y>=o&&Or.y<o+n)},e.prototype.destroy=function(r){t.prototype.destroy.call(this,r),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null;var i=typeof r=="boolean"?r:r&&r.texture;if(i){var n=typeof r=="boolean"?r:r&&r.baseTexture;this._texture.destroy(!!n)}this._texture=null},e.from=function(r,i){var n=r instanceof lt?r:lt.from(r,i);return new e(n)},Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(r){this._roundPixels!==r&&(this._transformID=-1),this._roundPixels=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(r){var i=rr(this.scale.x)||1;this.scale.x=i*r/this._texture.orig.width,this._width=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(r){var i=rr(this.scale.y)||1;this.scale.y=i*r/this._texture.orig.height,this._height=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchor",{get:function(){return this._anchor},set:function(r){this._anchor.copyFrom(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(r){this._tint=r,this._tintRGB=(r>>16)+(r&65280)+((r&255)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture},set:function(r){this._texture!==r&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=r||lt.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,r&&(r.baseTexture.valid?this._onTextureUpdate():r.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),e}(mt);/*!
|
|
617
|
+
* @pixi/graphics - v6.5.7
|
|
618
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
619
|
+
*
|
|
620
|
+
* @pixi/graphics is licensed under the MIT License.
|
|
621
|
+
* http://www.opensource.org/licenses/mit-license
|
|
622
|
+
*/var _e;(function(t){t.MITER="miter",t.BEVEL="bevel",t.ROUND="round"})(_e||(_e={}));var xe;(function(t){t.BUTT="butt",t.ROUND="round",t.SQUARE="square"})(xe||(xe={}));var Lr={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(e===void 0&&(e=20),!this.adaptive||!t||isNaN(t))return e;var r=Math.ceil(t/this.maxLength);return r<this.minSegments?r=this.minSegments:r>this.maxSegments&&(r=this.maxSegments),r}},eh=function(){function t(){this.color=16777215,this.alpha=1,this.texture=lt.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=lt.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}();/*! *****************************************************************************
|
|
623
|
+
Copyright (c) Microsoft Corporation.
|
|
624
|
+
|
|
625
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
626
|
+
purpose with or without fee is hereby granted.
|
|
627
|
+
|
|
628
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
629
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
630
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
631
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
632
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
633
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
634
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
635
|
+
***************************************************************************** */var Cs=function(t,e){return Cs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Cs(t,e)};function As(t,e){Cs(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function rh(t,e){var r,i;e===void 0&&(e=!1);var n=t.length;if(!(n<6)){for(var s=0,o=0,a=t[n-2],l=t[n-1];o<n;o+=2){var h=t[o],u=t[o+1];s+=(h-a)*(u+l),a=h,l=u}if(!e&&s>0||e&&s<=0)for(var f=n/2,o=f+f%2;o<n;o+=2){var c=n-o-2,d=n-o-1,v=o,y=o+1;r=[t[v],t[c]],t[c]=r[0],t[v]=r[1],i=[t[y],t[d]],t[d]=i[0],t[y]=i[1]}}}var ih={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var r=t.points,i=t.holes,n=e.points,s=e.indices;if(r.length>=6){rh(r,!1);for(var o=[],a=0;a<i.length;a++){var l=i[a];rh(l.points,!0),o.push(r.length/2),r=r.concat(l.points)}var h=_r(r,o,2);if(!h)return;for(var u=n.length/2,a=0;a<h.length;a+=3)s.push(h[a]+u),s.push(h[a+1]+u),s.push(h[a+2]+u);for(var a=0;a<r.length;a++)n.push(r[a])}}},Oi={build:function(t){var e=t.points,r,i,n,s,o,a;if(t.type===V.CIRC){var l=t.shape;r=l.x,i=l.y,o=a=l.radius,n=s=0}else if(t.type===V.ELIP){var h=t.shape;r=h.x,i=h.y,o=h.width,a=h.height,n=s=0}else{var u=t.shape,f=u.width/2,c=u.height/2;r=u.x+f,i=u.y+c,o=a=Math.max(0,Math.min(u.radius,Math.min(f,c))),n=f-o,s=c-a}if(!(o>=0&&a>=0&&n>=0&&s>=0)){e.length=0;return}var d=Math.ceil(2.3*Math.sqrt(o+a)),v=d*8+(n?4:0)+(s?4:0);if(e.length=v,v!==0){if(d===0){e.length=8,e[0]=e[6]=r+n,e[1]=e[3]=i+s,e[2]=e[4]=r-n,e[5]=e[7]=i-s;return}var y=0,m=d*4+(n?2:0)+2,g=m,x=v;{var _=n+o,P=s,w=r+_,b=r-_,T=i+P;if(e[y++]=w,e[y++]=T,e[--m]=T,e[--m]=b,s){var E=i-P;e[g++]=b,e[g++]=E,e[--x]=E,e[--x]=w}}for(var I=1;I<d;I++){var C=Math.PI/2*(I/d),_=n+Math.cos(C)*o,P=s+Math.sin(C)*a,w=r+_,b=r-_,T=i+P,E=i-P;e[y++]=w,e[y++]=T,e[--m]=T,e[--m]=b,e[g++]=b,e[g++]=E,e[--x]=E,e[--x]=w}{var _=n,P=s+a,w=r+_,b=r-_,T=i+P,E=i-P;e[y++]=w,e[y++]=T,e[--x]=E,e[--x]=w,n&&(e[y++]=b,e[y++]=T,e[--x]=E,e[--x]=b)}}},triangulate:function(t,e){var r=t.points,i=e.points,n=e.indices;if(r.length!==0){var s=i.length/2,o=s,a,l;if(t.type!==V.RREC){var h=t.shape;a=h.x,l=h.y}else{var u=t.shape;a=u.x+u.width/2,l=u.y+u.height/2}var f=t.matrix;i.push(t.matrix?f.a*a+f.c*l+f.tx:a,t.matrix?f.b*a+f.d*l+f.ty:l),s++,i.push(r[0],r[1]);for(var c=2;c<r.length;c+=2)i.push(r[c],r[c+1]),n.push(s++,o,s);n.push(o+1,o,s)}}},D0={build:function(t){var e=t.shape,r=e.x,i=e.y,n=e.width,s=e.height,o=t.points;o.length=0,o.push(r,i,r+n,i,r+n,i+s,r,i+s)},triangulate:function(t,e){var r=t.points,i=e.points,n=i.length/2;i.push(r[0],r[1],r[2],r[3],r[6],r[7],r[4],r[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function sr(t,e,r){var i=e-t;return t+i*r}function Li(t,e,r,i,n,s,o){o===void 0&&(o=[]);for(var a=20,l=o,h=0,u=0,f=0,c=0,d=0,v=0,y=0,m=0;y<=a;++y)m=y/a,h=sr(t,r,m),u=sr(e,i,m),f=sr(r,n,m),c=sr(i,s,m),d=sr(h,f,m),v=sr(u,c,m),!(y===0&&l[l.length-2]===d&&l[l.length-1]===v)&&l.push(d,v);return l}var X0={build:function(t){if(wt.nextRoundedRectBehavior){Oi.build(t);return}var e=t.shape,r=t.points,i=e.x,n=e.y,s=e.width,o=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,o)/2));r.length=0,a?(Li(i,n+a,i,n,i+a,n,r),Li(i+s-a,n,i+s,n,i+s,n+a,r),Li(i+s,n+o-a,i+s,n+o,i+s-a,n+o,r),Li(i+a,n+o,i,n+o,i,n+o-a,r)):r.push(i,n,i+s,n,i+s,n+o,i,n+o)},triangulate:function(t,e){if(wt.nextRoundedRectBehavior){Oi.triangulate(t,e);return}for(var r=t.points,i=e.points,n=e.indices,s=i.length/2,o=_r(r,null,2),a=0,l=o.length;a<l;a+=3)n.push(o[a]+s),n.push(o[a+1]+s),n.push(o[a+2]+s);for(var a=0,l=r.length;a<l;a++)i.push(r[a],r[++a])}};function nh(t,e,r,i,n,s,o,a){var l=t-r*n,h=e-i*n,u=t+r*s,f=e+i*s,c,d;o?(c=i,d=-r):(c=-i,d=r);var v=l+c,y=h+d,m=u+c,g=f+d;return a.push(v,y),a.push(m,g),2}function or(t,e,r,i,n,s,o,a){var l=r-t,h=i-e,u=Math.atan2(l,h),f=Math.atan2(n-t,s-e);a&&u<f?u+=Math.PI*2:!a&&u>f&&(f+=Math.PI*2);var c=u,d=f-u,v=Math.abs(d),y=Math.sqrt(l*l+h*h),m=(15*v*Math.sqrt(y)/Math.PI>>0)+1,g=d/m;if(c+=g,a){o.push(t,e),o.push(r,i);for(var x=1,_=c;x<m;x++,_+=g)o.push(t,e),o.push(t+Math.sin(_)*y,e+Math.cos(_)*y);o.push(t,e),o.push(n,s)}else{o.push(r,i),o.push(t,e);for(var x=1,_=c;x<m;x++,_+=g)o.push(t+Math.sin(_)*y,e+Math.cos(_)*y),o.push(t,e);o.push(n,s),o.push(t,e)}return m*2}function G0(t,e){var r=t.shape,i=t.points||r.points.slice(),n=e.closePointEps;if(i.length!==0){var s=t.lineStyle,o=new X(i[0],i[1]),a=new X(i[i.length-2],i[i.length-1]),l=r.type!==V.POLY||r.closeStroke,h=Math.abs(o.x-a.x)<n&&Math.abs(o.y-a.y)<n;if(l){i=i.slice(),h&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));var u=(o.x+a.x)*.5,f=(a.y+o.y)*.5;i.unshift(u,f),i.push(u,f)}var c=e.points,d=i.length/2,v=i.length,y=c.length/2,m=s.width/2,g=m*m,x=s.miterLimit*s.miterLimit,_=i[0],P=i[1],w=i[2],b=i[3],T=0,E=0,I=-(P-b),C=_-w,O=0,L=0,M=Math.sqrt(I*I+C*C);I/=M,C/=M,I*=m,C*=m;var U=s.alignment,S=(1-U)*2,k=U*2;l||(s.cap===xe.ROUND?v+=or(_-I*(S-k)*.5,P-C*(S-k)*.5,_-I*S,P-C*S,_+I*k,P+C*k,c,!0)+2:s.cap===xe.SQUARE&&(v+=nh(_,P,I,C,S,k,!0,c))),c.push(_-I*S,P-C*S),c.push(_+I*k,P+C*k);for(var D=1;D<d-1;++D){_=i[(D-1)*2],P=i[(D-1)*2+1],w=i[D*2],b=i[D*2+1],T=i[(D+1)*2],E=i[(D+1)*2+1],I=-(P-b),C=_-w,M=Math.sqrt(I*I+C*C),I/=M,C/=M,I*=m,C*=m,O=-(b-E),L=w-T,M=Math.sqrt(O*O+L*L),O/=M,L/=M,O*=m,L*=m;var gt=w-_,Ae=P-b,Yt=w-T,Vt=E-b,Nt=Ae*Yt-Vt*gt,Ot=Nt<0;if(Math.abs(Nt)<.1){c.push(w-I*S,b-C*S),c.push(w+I*k,b+C*k);continue}var Ee=(-I+_)*(-C+b)-(-I+w)*(-C+P),Se=(-O+T)*(-L+b)-(-O+w)*(-L+E),fe=(gt*Se-Yt*Ee)/Nt,ce=(Vt*Ee-Ae*Se)/Nt,Bt=(fe-w)*(fe-w)+(ce-b)*(ce-b),_t=w+(fe-w)*S,et=b+(ce-b)*S,rt=w-(fe-w)*k,ht=b-(ce-b)*k,Lt=Math.min(gt*gt+Ae*Ae,Yt*Yt+Vt*Vt),jr=Ot?S:k,Pt=Lt+jr*jr*g,Zr=Bt<=Pt;Zr?s.join===_e.BEVEL||Bt/g>x?(Ot?(c.push(_t,et),c.push(w+I*k,b+C*k),c.push(_t,et),c.push(w+O*k,b+L*k)):(c.push(w-I*S,b-C*S),c.push(rt,ht),c.push(w-O*S,b-L*S),c.push(rt,ht)),v+=2):s.join===_e.ROUND?Ot?(c.push(_t,et),c.push(w+I*k,b+C*k),v+=or(w,b,w+I*k,b+C*k,w+O*k,b+L*k,c,!0)+4,c.push(_t,et),c.push(w+O*k,b+L*k)):(c.push(w-I*S,b-C*S),c.push(rt,ht),v+=or(w,b,w-I*S,b-C*S,w-O*S,b-L*S,c,!1)+4,c.push(w-O*S,b-L*S),c.push(rt,ht)):(c.push(_t,et),c.push(rt,ht)):(c.push(w-I*S,b-C*S),c.push(w+I*k,b+C*k),s.join===_e.ROUND?Ot?v+=or(w,b,w+I*k,b+C*k,w+O*k,b+L*k,c,!0)+2:v+=or(w,b,w-I*S,b-C*S,w-O*S,b-L*S,c,!1)+2:s.join===_e.MITER&&Bt/g<=x&&(Ot?(c.push(rt,ht),c.push(rt,ht)):(c.push(_t,et),c.push(_t,et)),v+=2),c.push(w-O*S,b-L*S),c.push(w+O*k,b+L*k),v+=2)}_=i[(d-2)*2],P=i[(d-2)*2+1],w=i[(d-1)*2],b=i[(d-1)*2+1],I=-(P-b),C=_-w,M=Math.sqrt(I*I+C*C),I/=M,C/=M,I*=m,C*=m,c.push(w-I*S,b-C*S),c.push(w+I*k,b+C*k),l||(s.cap===xe.ROUND?v+=or(w-I*(S-k)*.5,b-C*(S-k)*.5,w-I*S,b-C*S,w+I*k,b+C*k,c,!1)+2:s.cap===xe.SQUARE&&(v+=nh(w,b,I,C,S,k,!1,c)));for(var uf=e.indices,ff=Lr.epsilon*Lr.epsilon,D=y;D<v+y-2;++D)_=c[D*2],P=c[D*2+1],w=c[(D+1)*2],b=c[(D+1)*2+1],T=c[(D+2)*2],E=c[(D+2)*2+1],!(Math.abs(_*(b-E)+w*(E-P)+T*(P-b))<ff)&&uf.push(D,D+1,D+2)}}function H0(t,e){var r=0,i=t.shape,n=t.points||i.points,s=i.type!==V.POLY||i.closeStroke;if(n.length!==0){var o=e.points,a=e.indices,l=n.length/2,h=o.length/2,u=h;for(o.push(n[0],n[1]),r=1;r<l;r++)o.push(n[r*2],n[r*2+1]),a.push(u,u+1),u++;s&&a.push(u,h)}}function sh(t,e){t.lineStyle.native?H0(t,e):G0(t,e)}var oh=function(){function t(){}return t.curveTo=function(e,r,i,n,s,o){var a=o[o.length-2],l=o[o.length-1],h=l-r,u=a-e,f=n-r,c=i-e,d=Math.abs(h*c-u*f);if(d<1e-8||s===0)return(o[o.length-2]!==e||o[o.length-1]!==r)&&o.push(e,r),null;var v=h*h+u*u,y=f*f+c*c,m=h*f+u*c,g=s*Math.sqrt(v)/d,x=s*Math.sqrt(y)/d,_=g*m/v,P=x*m/y,w=g*c+x*u,b=g*f+x*h,T=u*(x+_),E=h*(x+_),I=c*(g+P),C=f*(g+P),O=Math.atan2(E-b,T-w),L=Math.atan2(C-b,I-w);return{cx:w+e,cy:b+r,radius:s,startAngle:O,endAngle:L,anticlockwise:u*f>c*h}},t.arc=function(e,r,i,n,s,o,a,l,h){for(var u=a-o,f=Lr._segmentsCount(Math.abs(u)*s,Math.ceil(Math.abs(u)/_i)*40),c=u/(f*2),d=c*2,v=Math.cos(c),y=Math.sin(c),m=f-1,g=m%1/m,x=0;x<=m;++x){var _=x+g*x,P=c+o+d*_,w=Math.cos(P),b=-Math.sin(P);h.push((v*w+y*b)*s+i,(v*-b+y*w)*s+n)}},t}(),z0=function(){function t(){}return t.curveLength=function(e,r,i,n,s,o,a,l){for(var h=10,u=0,f=0,c=0,d=0,v=0,y=0,m=0,g=0,x=0,_=0,P=0,w=e,b=r,T=1;T<=h;++T)f=T/h,c=f*f,d=c*f,v=1-f,y=v*v,m=y*v,g=m*e+3*y*f*i+3*v*c*s+d*a,x=m*r+3*y*f*n+3*v*c*o+d*l,_=w-g,P=b-x,w=g,b=x,u+=Math.sqrt(_*_+P*P);return u},t.curveTo=function(e,r,i,n,s,o,a){var l=a[a.length-2],h=a[a.length-1];a.length-=2;var u=Lr._segmentsCount(t.curveLength(l,h,e,r,i,n,s,o)),f=0,c=0,d=0,v=0,y=0;a.push(l,h);for(var m=1,g=0;m<=u;++m)g=m/u,f=1-g,c=f*f,d=c*f,v=g*g,y=v*g,a.push(d*l+3*c*g*e+3*f*v*i+y*s,d*h+3*c*g*r+3*f*v*n+y*o)},t}(),W0=function(){function t(){}return t.curveLength=function(e,r,i,n,s,o){var a=e-2*i+s,l=r-2*n+o,h=2*i-2*e,u=2*n-2*r,f=4*(a*a+l*l),c=4*(a*h+l*u),d=h*h+u*u,v=2*Math.sqrt(f+c+d),y=Math.sqrt(f),m=2*f*y,g=2*Math.sqrt(d),x=c/y;return(m*v+y*c*(v-g)+(4*d*f-c*c)*Math.log((2*y+x+v)/(x+g)))/(4*m)},t.curveTo=function(e,r,i,n,s){for(var o=s[s.length-2],a=s[s.length-1],l=Lr._segmentsCount(t.curveLength(o,a,e,r,i,n)),h=0,u=0,f=1;f<=l;++f){var c=f/l;h=o+(e-o)*c,u=a+(r-a)*c,s.push(h+(e+(i-e)*c-h)*c,u+(r+(n-r)*c-u)*c)}},t}(),$0=function(){function t(){this.reset()}return t.prototype.begin=function(e,r,i){this.reset(),this.style=e,this.start=r,this.attribStart=i},t.prototype.end=function(e,r){this.attribSize=r-this.attribStart,this.size=e-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),Ge,Es=(Ge={},Ge[V.POLY]=ih,Ge[V.CIRC]=Oi,Ge[V.ELIP]=Oi,Ge[V.RECT]=D0,Ge[V.RREC]=X0,Ge),ah=[],Mi=[],lh=function(){function t(e,r,i,n){r===void 0&&(r=null),i===void 0&&(i=null),n===void 0&&(n=null),this.points=[],this.holes=[],this.shape=e,this.lineStyle=i,this.fillStyle=r,this.matrix=n,this.type=e.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),ar=new X,Y0=function(t){As(e,t);function e(){var r=t.call(this)||this;return r.closePointEps=1e-4,r.boundsPadding=0,r.uvsFloat32=null,r.indicesUint16=null,r.batchable=!1,r.points=[],r.colors=[],r.uvs=[],r.indices=[],r.textureIds=[],r.graphicsData=[],r.drawCalls=[],r.batchDirty=-1,r.batches=[],r.dirty=0,r.cacheDirty=-1,r.clearDirty=0,r.shapeIndex=0,r._bounds=new Pi,r.boundsDirty=-1,r}return Object.defineProperty(e.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),e.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var r=0;r<this.drawCalls.length;r++)this.drawCalls[r].texArray.clear(),Mi.push(this.drawCalls[r]);this.drawCalls.length=0;for(var r=0;r<this.batches.length;r++){var i=this.batches[r];i.reset(),ah.push(i)}this.batches.length=0},e.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},e.prototype.drawShape=function(r,i,n,s){i===void 0&&(i=null),n===void 0&&(n=null),s===void 0&&(s=null);var o=new lh(r,i,n,s);return this.graphicsData.push(o),this.dirty++,this},e.prototype.drawHole=function(r,i){if(i===void 0&&(i=null),!this.graphicsData.length)return null;var n=new lh(r,null,null,i),s=this.graphicsData[this.graphicsData.length-1];return n.lineStyle=s.lineStyle,s.holes.push(n),this.dirty++,this},e.prototype.destroy=function(){t.prototype.destroy.call(this);for(var r=0;r<this.graphicsData.length;++r)this.graphicsData[r].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},e.prototype.containsPoint=function(r){for(var i=this.graphicsData,n=0;n<i.length;++n){var s=i[n];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(r,ar):ar.copyFrom(r),s.shape.contains(ar.x,ar.y))){var o=!1;if(s.holes)for(var a=0;a<s.holes.length;a++){var l=s.holes[a];if(l.shape.contains(ar.x,ar.y)){o=!0;break}}if(!o)return!0}}return!1},e.prototype.updateBatches=function(){if(!this.graphicsData.length){this.batchable=!0;return}if(this.validateBatching()){this.cacheDirty=this.dirty;var r=this.uvs,i=this.graphicsData,n=null,s=null;this.batches.length>0&&(n=this.batches[this.batches.length-1],s=n.style);for(var o=this.shapeIndex;o<i.length;o++){this.shapeIndex++;var a=i[o],l=a.fillStyle,h=a.lineStyle,u=Es[a.type];u.build(a),a.matrix&&this.transformPoints(a.points,a.matrix),(l.visible||h.visible)&&this.processHoles(a.holes);for(var f=0;f<2;f++){var c=f===0?l:h;if(c.visible){var d=c.texture.baseTexture,v=this.indices.length,y=this.points.length/2;d.wrapMode=mr.REPEAT,f===0?this.processFill(a):this.processLine(a);var m=this.points.length/2-y;m!==0&&(n&&!this._compareStyles(s,c)&&(n.end(v,y),n=null),n||(n=ah.pop()||new $0,n.begin(c,v,y),this.batches.push(n),s=c),this.addUvs(this.points,r,c.texture,y,m,c.matrix))}}}var g=this.indices.length,x=this.points.length/2;if(n&&n.end(g,x),this.batches.length===0){this.batchable=!0;return}var _=x>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&_===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=_?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}},e.prototype._compareStyles=function(r,i){return!(!r||!i||r.texture.baseTexture!==i.texture.baseTexture||r.color+r.alpha!==i.color+i.alpha||!!r.native!=!!i.native)},e.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var r=0,i=this.graphicsData.length;r<i;r++){var n=this.graphicsData[r],s=n.fillStyle,o=n.lineStyle;if(s&&!s.texture.baseTexture.valid||o&&!o.texture.baseTexture.valid)return!1}return!0},e.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var r=this.batches,i=0,n=r.length;i<n;i++)for(var s=r[i],o=0;o<s.size;o++){var a=s.start+o;this.indicesUint16[a]=this.indicesUint16[a]-s.attribStart}},e.prototype.isBatchable=function(){if(this.points.length>65535*2)return!1;for(var r=this.batches,i=0;i<r.length;i++)if(r[i].style.native)return!1;return this.points.length<e.BATCHABLE_SIZE*2},e.prototype.buildDrawCalls=function(){for(var r=++Z._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),Mi.push(this.drawCalls[i]);this.drawCalls.length=0;var n=this.colors,s=this.textureIds,o=Mi.pop();o||(o=new bs,o.texArray=new Ts),o.texArray.count=0,o.start=0,o.size=0,o.type=qt.TRIANGLES;var a=0,l=null,h=0,u=!1,f=qt.TRIANGLES,c=0;this.drawCalls.push(o);for(var i=0;i<this.batches.length;i++){var d=this.batches[i],v=8,y=d.style,m=y.texture.baseTexture;u!==!!y.native&&(u=!!y.native,f=u?qt.LINES:qt.TRIANGLES,l=null,a=v,r++),l!==m&&(l=m,m._batchEnabled!==r&&(a===v&&(r++,a=0,o.size>0&&(o=Mi.pop(),o||(o=new bs,o.texArray=new Ts),this.drawCalls.push(o)),o.start=c,o.size=0,o.texArray.count=0,o.type=f),m.touched=1,m._batchEnabled=r,m._batchLocation=a,m.wrapMode=mr.REPEAT,o.texArray.elements[o.texArray.count++]=m,a++)),o.size+=d.size,c+=d.size,h=m._batchLocation,this.addColors(n,y.color,y.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,h,d.attribSize,d.attribStart)}Z._globalBatch=r,this.packAttributes()},e.prototype.packAttributes=function(){for(var r=this.points,i=this.uvs,n=this.colors,s=this.textureIds,o=new ArrayBuffer(r.length*3*4),a=new Float32Array(o),l=new Uint32Array(o),h=0,u=0;u<r.length/2;u++)a[h++]=r[u*2],a[h++]=r[u*2+1],a[h++]=i[u*2],a[h++]=i[u*2+1],l[h++]=n[u],a[h++]=s[u];this._buffer.update(o),this._indexBuffer.update(this.indicesUint16)},e.prototype.processFill=function(r){if(r.holes.length)ih.triangulate(r,this);else{var i=Es[r.type];i.triangulate(r,this)}},e.prototype.processLine=function(r){sh(r,this);for(var i=0;i<r.holes.length;i++)sh(r.holes[i],this)},e.prototype.processHoles=function(r){for(var i=0;i<r.length;i++){var n=r[i],s=Es[n.type];s.build(n),n.matrix&&this.transformPoints(n.points,n.matrix)}},e.prototype.calculateBounds=function(){var r=this._bounds;r.clear(),r.addVertexData(this.points,0,this.points.length),r.pad(this.boundsPadding,this.boundsPadding)},e.prototype.transformPoints=function(r,i){for(var n=0;n<r.length/2;n++){var s=r[n*2],o=r[n*2+1];r[n*2]=i.a*s+i.c*o+i.tx,r[n*2+1]=i.b*s+i.d*o+i.ty}},e.prototype.addColors=function(r,i,n,s,o){o===void 0&&(o=0);var a=(i>>16)+(i&65280)+((i&255)<<16),l=Za(a,n);r.length=Math.max(r.length,o+s);for(var h=0;h<s;h++)r[o+h]=l},e.prototype.addTextureIds=function(r,i,n,s){s===void 0&&(s=0),r.length=Math.max(r.length,s+n);for(var o=0;o<n;o++)r[s+o]=i},e.prototype.addUvs=function(r,i,n,s,o,a){a===void 0&&(a=null);for(var l=0,h=i.length,u=n.frame;l<o;){var f=r[(s+l)*2],c=r[(s+l)*2+1];if(a){var d=a.a*f+a.c*c+a.tx;c=a.b*f+a.d*c+a.ty,f=d}l++,i.push(f/u.width,c/u.height)}var v=n.baseTexture;(u.width<v.width||u.height<v.height)&&this.adjustUvs(i,n,h,o)},e.prototype.adjustUvs=function(r,i,n,s){for(var o=i.baseTexture,a=1e-6,l=n+s*2,h=i.frame,u=h.width/o.width,f=h.height/o.height,c=h.x/h.width,d=h.y/h.height,v=Math.floor(r[n]+a),y=Math.floor(r[n+1]+a),m=n+2;m<l;m+=2)v=Math.min(v,Math.floor(r[m]+a)),y=Math.min(y,Math.floor(r[m+1]+a));c-=v,d-=y;for(var m=n;m<l;m+=2)r[m]=(r[m]+c)*u,r[m+1]=(r[m+1]+d)*f},e.BATCHABLE_SIZE=100,e}(Jl),V0=function(t){As(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.width=0,r.alignment=.5,r.native=!1,r.cap=xe.BUTT,r.join=_e.MITER,r.miterLimit=10,r}return e.prototype.clone=function(){var r=new e;return r.color=this.color,r.alpha=this.alpha,r.texture=this.texture,r.matrix=this.matrix,r.visible=this.visible,r.width=this.width,r.alignment=this.alignment,r.native=this.native,r.cap=this.cap,r.join=this.join,r.miterLimit=this.miterLimit,r},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(eh),j0=new Float32Array(3),Ss={},wt=function(t){As(e,t);function e(r){r===void 0&&(r=null);var i=t.call(this)||this;return i.shader=null,i.pluginName="batch",i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i._fillStyle=new eh,i._lineStyle=new V0,i._matrix=null,i._holeMode=!1,i.state=Si.for2d(),i._geometry=r||new Y0,i._geometry.refCount++,i._transformID=-1,i.tint=16777215,i.blendMode=A.NORMAL,i}return Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return this.finishPoly(),new e(this._geometry)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(r){this.state.blendMode=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(r){this._tint=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),e.prototype.lineStyle=function(r,i,n,s,o){return r===void 0&&(r=null),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=.5),o===void 0&&(o=!1),typeof r=="number"&&(r={width:r,color:i,alpha:n,alignment:s,native:o}),this.lineTextureStyle(r)},e.prototype.lineTextureStyle=function(r){r=Object.assign({width:0,texture:lt.WHITE,color:r&&r.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:xe.BUTT,join:_e.MITER,miterLimit:10},r),this.currentPath&&this.startPoly();var i=r.width>0&&r.alpha>0;return i?(r.matrix&&(r.matrix=r.matrix.clone(),r.matrix.invert()),Object.assign(this._lineStyle,{visible:i},r)):this._lineStyle.reset(),this},e.prototype.startPoly=function(){if(this.currentPath){var r=this.currentPath.points,i=this.currentPath.points.length;i>2&&(this.drawShape(this.currentPath),this.currentPath=new Kn,this.currentPath.closeStroke=!1,this.currentPath.points.push(r[i-2],r[i-1]))}else this.currentPath=new Kn,this.currentPath.closeStroke=!1},e.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},e.prototype.moveTo=function(r,i){return this.startPoly(),this.currentPath.points[0]=r,this.currentPath.points[1]=i,this},e.prototype.lineTo=function(r,i){this.currentPath||this.moveTo(0,0);var n=this.currentPath.points,s=n[n.length-2],o=n[n.length-1];return(s!==r||o!==i)&&n.push(r,i),this},e.prototype._initCurve=function(r,i){r===void 0&&(r=0),i===void 0&&(i=0),this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[r,i]):this.moveTo(r,i)},e.prototype.quadraticCurveTo=function(r,i,n,s){this._initCurve();var o=this.currentPath.points;return o.length===0&&this.moveTo(0,0),W0.curveTo(r,i,n,s,o),this},e.prototype.bezierCurveTo=function(r,i,n,s,o,a){return this._initCurve(),z0.curveTo(r,i,n,s,o,a,this.currentPath.points),this},e.prototype.arcTo=function(r,i,n,s,o){this._initCurve(r,i);var a=this.currentPath.points,l=oh.curveTo(r,i,n,s,o,a);if(l){var h=l.cx,u=l.cy,f=l.radius,c=l.startAngle,d=l.endAngle,v=l.anticlockwise;this.arc(h,u,f,c,d,v)}return this},e.prototype.arc=function(r,i,n,s,o,a){if(a===void 0&&(a=!1),s===o)return this;!a&&o<=s?o+=_i:a&&s<=o&&(s+=_i);var l=o-s;if(l===0)return this;var h=r+Math.cos(s)*n,u=i+Math.sin(s)*n,f=this._geometry.closePointEps,c=this.currentPath?this.currentPath.points:null;if(c){var d=Math.abs(c[c.length-2]-h),v=Math.abs(c[c.length-1]-u);d<f&&v<f||c.push(h,u)}else this.moveTo(h,u),c=this.currentPath.points;return oh.arc(h,u,r,i,n,s,o,a,c),this},e.prototype.beginFill=function(r,i){return r===void 0&&(r=0),i===void 0&&(i=1),this.beginTextureFill({texture:lt.WHITE,color:r,alpha:i})},e.prototype.beginTextureFill=function(r){r=Object.assign({texture:lt.WHITE,color:16777215,alpha:1,matrix:null},r),this.currentPath&&this.startPoly();var i=r.alpha>0;return i?(r.matrix&&(r.matrix=r.matrix.clone(),r.matrix.invert()),Object.assign(this._fillStyle,{visible:i},r)):this._fillStyle.reset(),this},e.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},e.prototype.drawRect=function(r,i,n,s){return this.drawShape(new G(r,i,n,s))},e.prototype.drawRoundedRect=function(r,i,n,s,o){return this.drawShape(new om(r,i,n,s,o))},e.prototype.drawCircle=function(r,i,n){return this.drawShape(new nm(r,i,n))},e.prototype.drawEllipse=function(r,i,n,s){return this.drawShape(new sm(r,i,n,s))},e.prototype.drawPolygon=function(){for(var r=arguments,i=[],n=0;n<arguments.length;n++)i[n]=r[n];var s,o=!0,a=i[0];a.points?(o=a.closeStroke,s=a.points):Array.isArray(i[0])?s=i[0]:s=i;var l=new Kn(s);return l.closeStroke=o,this.drawShape(l),this},e.prototype.drawShape=function(r){return this._holeMode?this._geometry.drawHole(r,this._matrix):this._geometry.drawShape(r,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},e.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},e.prototype.isFastRect=function(){var r=this._geometry.graphicsData;return r.length===1&&r[0].shape.type===V.RECT&&!r[0].matrix&&!r[0].holes.length&&!(r[0].lineStyle.visible&&r[0].lineStyle.width)},e.prototype._render=function(r){this.finishPoly();var i=this._geometry;i.updateBatches(),i.batchable?(this.batchDirty!==i.batchDirty&&this._populateBatches(),this._renderBatched(r)):(r.batch.flush(),this._renderDirect(r))},e.prototype._populateBatches=function(){var r=this._geometry,i=this.blendMode,n=r.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=r.batchDirty,this.batches.length=n,this.vertexData=new Float32Array(r.points);for(var s=0;s<n;s++){var o=r.batches[s],a=o.style.color,l=new Float32Array(this.vertexData.buffer,o.attribStart*4*2,o.attribSize*2),h=new Float32Array(r.uvsFloat32.buffer,o.attribStart*4*2,o.attribSize*2),u=new Uint16Array(r.indicesUint16.buffer,o.start*2,o.size),f={vertexData:l,blendMode:i,indices:u,uvs:h,_batchRGB:tr(a),_tintRGB:a,_texture:o.style.texture,alpha:o.style.alpha,worldAlpha:1};this.batches[s]=f}},e.prototype._renderBatched=function(r){if(this.batches.length){r.batch.setObjectRenderer(r.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var i=0,n=this.batches.length;i<n;i++){var s=this.batches[i];s.worldAlpha=this.worldAlpha*s.alpha,r.plugins[this.pluginName].render(s)}}},e.prototype._renderDirect=function(r){var i=this._resolveDirectShader(r),n=this._geometry,s=this.tint,o=this.worldAlpha,a=i.uniforms,l=n.drawCalls;a.translationMatrix=this.transform.worldTransform,a.tint[0]=(s>>16&255)/255*o,a.tint[1]=(s>>8&255)/255*o,a.tint[2]=(s&255)/255*o,a.tint[3]=o,r.shader.bind(i),r.geometry.bind(n,i),r.state.set(this.state);for(var h=0,u=l.length;h<u;h++)this._renderDrawCallDirect(r,n.drawCalls[h])},e.prototype._renderDrawCallDirect=function(r,i){for(var n=i.texArray,s=i.type,o=i.size,a=i.start,l=n.count,h=0;h<l;h++)r.texture.bind(n.elements[h],h);r.geometry.draw(s,o,a)},e.prototype._resolveDirectShader=function(r){var i=this.shader,n=this.pluginName;if(!i){if(!Ss[n]){for(var s=r.plugins[n].MAX_TEXTURES,o=new Int32Array(s),a=0;a<s;a++)o[a]=a;var l={tint:new Float32Array([1,1,1,1]),translationMatrix:new at,default:De.from({uSamplers:o},!0)},h=r.plugins[n]._shader.program;Ss[n]=new ds(h,l)}i=Ss[n]}return i},e.prototype._calculateBounds=function(){this.finishPoly();var r=this._geometry;if(r.graphicsData.length){var i=r.bounds,n=i.minX,s=i.minY,o=i.maxX,a=i.maxY;this._bounds.addFrame(this.transform,n,s,o,a)}},e.prototype.containsPoint=function(r){return this.worldTransform.applyInverse(r,e._TEMP_POINT),this._geometry.containsPoint(e._TEMP_POINT)},e.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var r=tr(this.tint,j0),i=0;i<this.batches.length;i++){var n=this.batches[i],s=n._batchRGB,o=r[0]*s[0]*255,a=r[1]*s[1]*255,l=r[2]*s[2]*255,h=(o<<16)+(a<<8)+(l|0);n._tintRGB=(h>>16)+(h&65280)+((h&255)<<16)}}},e.prototype.calculateVertices=function(){var r=this.transform._worldID;if(this._transformID!==r){this._transformID=r;for(var i=this.transform.worldTransform,n=i.a,s=i.b,o=i.c,a=i.d,l=i.tx,h=i.ty,u=this._geometry.points,f=this.vertexData,c=0,d=0;d<u.length;d+=2){var v=u[d],y=u[d+1];f[c++]=n*v+o*y+l,f[c++]=a*y+s*v+h}}},e.prototype.closePath=function(){var r=this.currentPath;return r&&(r.closeStroke=!0,this.finishPoly()),this},e.prototype.setMatrix=function(r){return this._matrix=r,this},e.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},e.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},e.prototype.destroy=function(r){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,t.prototype.destroy.call(this,r)},e.nextRoundedRectBehavior=!1,e._TEMP_POINT=new X,e}(mt);/*!
|
|
636
|
+
* @pixi/text - v6.5.7
|
|
637
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
638
|
+
*
|
|
639
|
+
* @pixi/text is licensed under the MIT License.
|
|
640
|
+
* http://www.opensource.org/licenses/mit-license
|
|
641
|
+
*//*! *****************************************************************************
|
|
642
|
+
Copyright (c) Microsoft Corporation.
|
|
643
|
+
|
|
644
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
645
|
+
purpose with or without fee is hereby granted.
|
|
646
|
+
|
|
647
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
648
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
649
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
650
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
651
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
652
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
653
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
654
|
+
***************************************************************************** */var Ns=function(t,e){return Ns=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Ns(t,e)};function Z0(t,e){Ns(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Fi;(function(t){t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"})(Fi||(Fi={}));var Os={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Fi.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},q0=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],lr=function(){function t(e){this.styleID=0,this.reset(),Ms(this,e,e)}return t.prototype.clone=function(){var e={};return Ms(e,this,Os),new t(e)},t.prototype.reset=function(){Ms(this,Os,Os)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(e){var r=Ls(e);this._dropShadowColor!==r&&(this._dropShadowColor=r,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(e){this._dropShadowDistance!==e&&(this._dropShadowDistance=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(e){var r=Ls(e);this._fill!==r&&(this._fill=r,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(e){J0(this._fillGradientStops,e)||(this._fillGradientStops=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this.fontFamily!==e&&(this._fontFamily=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._fontSize!==e&&(this._fontSize=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(e){this._fontStyle!==e&&(this._fontStyle=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(e){this._fontVariant!==e&&(this._fontVariant=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(e){this._fontWeight!==e&&(this._fontWeight=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(e){this._lineHeight!==e&&(this._lineHeight=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leading",{get:function(){return this._leading},set:function(e){this._leading!==e&&(this._leading=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(e){this._lineJoin!==e&&(this._lineJoin=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(e){this._miterLimit!==e&&(this._miterLimit=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this._padding},set:function(e){this._padding!==e&&(this._padding=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stroke",{get:function(){return this._stroke},set:function(e){var r=Ls(e);this._stroke!==r&&(this._stroke=r,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(e){this._strokeThickness!==e&&(this._strokeThickness=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(e){this._textBaseline!==e&&(this._textBaseline=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trim",{get:function(){return this._trim},set:function(e){this._trim!==e&&(this._trim=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(e){this._wordWrap!==e&&(this._wordWrap=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.styleID++)},enumerable:!1,configurable:!0}),t.prototype.toFontString=function(){var e=typeof this.fontSize=="number"?this.fontSize+"px":this.fontSize,r=this.fontFamily;Array.isArray(this.fontFamily)||(r=this.fontFamily.split(","));for(var i=r.length-1;i>=0;i--){var n=r[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&q0.indexOf(n)<0&&(n='"'+n+'"'),r[i]=n}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+e+" "+r.join(",")},t}();function hh(t){return typeof t=="number"?di(t):(typeof t=="string"&&t.indexOf("0x")===0&&(t=t.replace("0x","#")),t)}function Ls(t){if(Array.isArray(t)){for(var e=0;e<t.length;++e)t[e]=hh(t[e]);return t}else return hh(t)}function J0(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(var r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}function Ms(t,e,r){for(var i in r)Array.isArray(e[i])?t[i]=e[i].slice():t[i]=e[i]}var Ri={willReadFrequently:!0},re=function(){function t(e,r,i,n,s,o,a,l,h){this.text=e,this.style=r,this.width=i,this.height=n,this.lines=s,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h}return t.measureText=function(e,r,i,n){n===void 0&&(n=t._canvas),i=i??r.wordWrap;var s=r.toFontString(),o=t.measureFont(s);o.fontSize===0&&(o.fontSize=r.fontSize,o.ascent=r.fontSize);var a=n.getContext("2d",Ri);a.font=s;for(var l=i?t.wordWrap(e,r,n):e,h=l.split(/(?:\r\n|\r|\n)/),u=new Array(h.length),f=0,c=0;c<h.length;c++){var d=a.measureText(h[c]).width+(h[c].length-1)*r.letterSpacing;u[c]=d,f=Math.max(f,d)}var v=f+r.strokeThickness;r.dropShadow&&(v+=r.dropShadowDistance);var y=r.lineHeight||o.fontSize+r.strokeThickness,m=Math.max(y,o.fontSize+r.strokeThickness)+(h.length-1)*(y+r.leading);return r.dropShadow&&(m+=r.dropShadowDistance),new t(e,r,v,m,h,u,y+r.leading,f,o)},t.wordWrap=function(e,r,i){i===void 0&&(i=t._canvas);for(var n=i.getContext("2d",Ri),s=0,o="",a="",l=Object.create(null),h=r.letterSpacing,u=r.whiteSpace,f=t.collapseSpaces(u),c=t.collapseNewlines(u),d=!f,v=r.wordWrapWidth+h,y=t.tokenize(e),m=0;m<y.length;m++){var g=y[m];if(t.isNewline(g)){if(!c){a+=t.addLine(o),d=!f,o="",s=0;continue}g=" "}if(f){var x=t.isBreakingSpace(g),_=t.isBreakingSpace(o[o.length-1]);if(x&&_)continue}var P=t.getFromCache(g,h,l,n);if(P>v)if(o!==""&&(a+=t.addLine(o),o="",s=0),t.canBreakWords(g,r.breakWords))for(var w=t.wordWrapSplit(g),b=0;b<w.length;b++){for(var T=w[b],E=1;w[b+E];){var I=w[b+E],C=T[T.length-1];if(!t.canBreakChars(C,I,g,b,r.breakWords))T+=I;else break;E++}b+=T.length-1;var O=t.getFromCache(T,h,l,n);O+s>v&&(a+=t.addLine(o),d=!1,o="",s=0),o+=T,s+=O}else{o.length>0&&(a+=t.addLine(o),o="",s=0);var L=m===y.length-1;a+=t.addLine(g,!L),d=!1,o="",s=0}else P+s>v&&(d=!1,a+=t.addLine(o),o="",s=0),(o.length>0||!t.isBreakingSpace(g)||d)&&(o+=g,s+=P)}return a+=t.addLine(o,!1),a},t.addLine=function(e,r){return r===void 0&&(r=!0),e=t.trimRight(e),e=r?e+`
|
|
655
|
+
`:e,e},t.getFromCache=function(e,r,i,n){var s=i[e];if(typeof s!="number"){var o=e.length*r;s=n.measureText(e).width+o,i[e]=s}return s},t.collapseSpaces=function(e){return e==="normal"||e==="pre-line"},t.collapseNewlines=function(e){return e==="normal"},t.trimRight=function(e){if(typeof e!="string")return"";for(var r=e.length-1;r>=0;r--){var i=e[r];if(!t.isBreakingSpace(i))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return typeof e!="string"?!1:t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e,r){return typeof e!="string"?!1:t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var r=[],i="";if(typeof e!="string")return r;for(var n=0;n<e.length;n++){var s=e[n],o=e[n+1];if(t.isBreakingSpace(s,o)||t.isNewline(s)){i!==""&&(r.push(i),i=""),r.push(s);continue}i+=s}return i!==""&&r.push(i),r},t.canBreakWords=function(e,r){return r},t.canBreakChars=function(e,r,i,n,s){return!0},t.wordWrapSplit=function(e){return e.split("")},t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var r={ascent:0,descent:0,fontSize:0},i=t._canvas,n=t._context;n.font=e;var s=t.METRICS_STRING+t.BASELINE_SYMBOL,o=Math.ceil(n.measureText(s).width),a=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),l=Math.ceil(t.HEIGHT_MULTIPLIER*a);a=a*t.BASELINE_MULTIPLIER|0,i.width=o,i.height=l,n.fillStyle="#f00",n.fillRect(0,0,o,l),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(s,0,a);var h=n.getImageData(0,0,o,l).data,u=h.length,f=o*4,c=0,d=0,v=!1;for(c=0;c<a;++c){for(var y=0;y<f;y+=4)if(h[d+y]!==255){v=!0;break}if(!v)d+=f;else break}for(r.ascent=a-c,d=u-f,v=!1,c=l;c>a;--c){for(var y=0;y<f;y+=4)if(h[d+y]!==255){v=!0;break}if(!v)d-=f;else break}return r.descent=c-a,r.fontSize=r.ascent+r.descent,t._fonts[e]=r,r},t.clearMetrics=function(e){e===void 0&&(e=""),e?delete t._fonts[e]:t._fonts={}},Object.defineProperty(t,"_canvas",{get:function(){if(!t.__canvas){var e=void 0;try{var r=new OffscreenCanvas(0,0),i=r.getContext("2d",Ri);if(i&&i.measureText)return t.__canvas=r,r;e=R.ADAPTER.createCanvas()}catch{e=R.ADAPTER.createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas},enumerable:!1,configurable:!0}),Object.defineProperty(t,"_context",{get:function(){return t.__context||(t.__context=t._canvas.getContext("2d",Ri)),t.__context},enumerable:!1,configurable:!0}),t}();re._fonts={},re.METRICS_STRING="|\xC9q\xC5",re.BASELINE_SYMBOL="M",re.BASELINE_MULTIPLIER=1.4,re.HEIGHT_MULTIPLIER=2,re._newlines=[10,13],re._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var Q0={texture:!0,children:!1,baseTexture:!0},Mr=function(t){Z0(e,t);function e(r,i,n){var s=this,o=!1;n||(n=R.ADAPTER.createCanvas(),o=!0),n.width=3,n.height=3;var a=lt.from(n);return a.orig=new G,a.trim=new G,s=t.call(this,a)||this,s._ownCanvas=o,s.canvas=n,s.context=n.getContext("2d",{willReadFrequently:!0}),s._resolution=R.RESOLUTION,s._autoResolution=!0,s._text=null,s._style=null,s._styleListener=null,s._font="",s.text=r,s.style=i,s.localStyleID=-1,s}return e.prototype.updateText=function(r){var i=this._style;if(this.localStyleID!==i.styleID&&(this.dirty=!0,this.localStyleID=i.styleID),!(!this.dirty&&r)){this._font=this._style.toFontString();var n=this.context,s=re.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),o=s.width,a=s.height,l=s.lines,h=s.lineHeight,u=s.lineWidths,f=s.maxLineWidth,c=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,o)+i.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,a)+i.padding*2)*this._resolution),n.scale(this._resolution,this._resolution),n.clearRect(0,0,this.canvas.width,this.canvas.height),n.font=this._font,n.lineWidth=i.strokeThickness,n.textBaseline=i.textBaseline,n.lineJoin=i.lineJoin,n.miterLimit=i.miterLimit;for(var d,v,y=i.dropShadow?2:1,m=0;m<y;++m){var g=i.dropShadow&&m===0,x=g?Math.ceil(Math.max(1,a)+i.padding*2):0,_=x*this._resolution;if(g){n.fillStyle="black",n.strokeStyle="black";var P=i.dropShadowColor,w=tr(typeof P=="number"?P:er(P)),b=i.dropShadowBlur*this._resolution,T=i.dropShadowDistance*this._resolution;n.shadowColor="rgba("+w[0]*255+","+w[1]*255+","+w[2]*255+","+i.dropShadowAlpha+")",n.shadowBlur=b,n.shadowOffsetX=Math.cos(i.dropShadowAngle)*T,n.shadowOffsetY=Math.sin(i.dropShadowAngle)*T+_}else n.fillStyle=this._generateFillStyle(i,l,s),n.strokeStyle=i.stroke,n.shadowColor="black",n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0;var E=(h-c.fontSize)/2;(!e.nextLineHeightBehavior||h-c.fontSize<0)&&(E=0);for(var I=0;I<l.length;I++)d=i.strokeThickness/2,v=i.strokeThickness/2+I*h+c.ascent+E,i.align==="right"?d+=f-u[I]:i.align==="center"&&(d+=(f-u[I])/2),i.stroke&&i.strokeThickness&&this.drawLetterSpacing(l[I],d+i.padding,v+i.padding-x,!0),i.fill&&this.drawLetterSpacing(l[I],d+i.padding,v+i.padding-x)}this.updateTexture()}},e.prototype.drawLetterSpacing=function(r,i,n,s){s===void 0&&(s=!1);var o=this._style,a=o.letterSpacing,l=e.experimentalLetterSpacing&&("letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype);if(a===0||l){l&&(this.context.letterSpacing=a,this.context.textLetterSpacing=a),s?this.context.strokeText(r,i,n):this.context.fillText(r,i,n);return}for(var h=i,u=Array.from?Array.from(r):r.split(""),f=this.context.measureText(r).width,c=0,d=0;d<u.length;++d){var v=u[d];s?this.context.strokeText(v,h,n):this.context.fillText(v,h,n);for(var y="",m=d+1;m<u.length;++m)y+=u[m];c=this.context.measureText(y).width,h+=f-c+a,f=c}},e.prototype.updateTexture=function(){var r=this.canvas;if(this._style.trim){var i=tm(r);i.data&&(r.width=i.width,r.height=i.height,this.context.putImageData(i.data,0,0))}var n=this._texture,s=this._style,o=s.trim?0:s.padding,a=n.baseTexture;n.trim.width=n._frame.width=r.width/this._resolution,n.trim.height=n._frame.height=r.height/this._resolution,n.trim.x=-o,n.trim.y=-o,n.orig.width=n._frame.width-o*2,n.orig.height=n._frame.height-o*2,this._onTextureUpdate(),a.setRealSize(r.width,r.height,this._resolution),n.updateUvs(),this.dirty=!1},e.prototype._render=function(r){this._autoResolution&&this._resolution!==r.resolution&&(this._resolution=r.resolution,this.dirty=!0),this.updateText(!0),t.prototype._render.call(this,r)},e.prototype.updateTransform=function(){this.updateText(!0),t.prototype.updateTransform.call(this)},e.prototype.getBounds=function(r,i){return this.updateText(!0),this._textureID===-1&&(r=!1),t.prototype.getBounds.call(this,r,i)},e.prototype.getLocalBounds=function(r){return this.updateText(!0),t.prototype.getLocalBounds.call(this,r)},e.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)},e.prototype._generateFillStyle=function(r,i,n){var s=r.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;var o,a=r.dropShadow?r.dropShadowDistance:0,l=r.padding||0,h=this.canvas.width/this._resolution-a-l*2,u=this.canvas.height/this._resolution-a-l*2,f=s.slice(),c=r.fillGradientStops.slice();if(!c.length)for(var d=f.length+1,v=1;v<d;++v)c.push(v/d);if(f.unshift(s[0]),c.unshift(0),f.push(s[s.length-1]),c.push(1),r.fillGradientType===Fi.LINEAR_VERTICAL){o=this.context.createLinearGradient(h/2,l,h/2,u+l);for(var y=n.fontProperties.fontSize+r.strokeThickness,v=0;v<i.length;v++){var m=n.lineHeight*(v-1)+y,g=n.lineHeight*v,x=g;v>0&&m>g&&(x=(g+m)/2);var _=g+y,P=n.lineHeight*(v+1),w=_;v+1<i.length&&P<_&&(w=(_+P)/2);for(var b=(w-x)/u,T=0;T<f.length;T++){var E=0;typeof c[T]=="number"?E=c[T]:E=T/f.length;var I=Math.min(1,Math.max(0,x/u+E*b));I=Number(I.toFixed(5)),o.addColorStop(I,f[T])}}}else{o=this.context.createLinearGradient(l,u/2,h+l,u/2);for(var C=f.length+1,O=1,v=0;v<f.length;v++){var L=void 0;typeof c[v]=="number"?L=c[v]:L=O/C,o.addColorStop(L,f[v]),O++}}return o},e.prototype.destroy=function(r){typeof r=="boolean"&&(r={children:r}),r=Object.assign({},Q0,r),t.prototype.destroy.call(this,r),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(e.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(r){this.updateText(!0);var i=rr(this.scale.x)||1;this.scale.x=i*r/this._texture.orig.width,this._width=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(r){this.updateText(!0);var i=rr(this.scale.y)||1;this.scale.y=i*r/this._texture.orig.height,this._height=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(r){r=r||{},r instanceof lr?this._style=r:this._style=new lr(r),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(r){r=String(r??""),this._text!==r&&(this._text=r,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(r){this._autoResolution=!1,this._resolution!==r&&(this._resolution=r,this.dirty=!0)},enumerable:!1,configurable:!0}),e.nextLineHeightBehavior=!1,e.experimentalLetterSpacing=!1,e}(zt);/*!
|
|
656
|
+
* @pixi/canvas-text - v6.5.7
|
|
657
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
658
|
+
*
|
|
659
|
+
* @pixi/canvas-text is licensed under the MIT License.
|
|
660
|
+
* http://www.opensource.org/licenses/mit-license
|
|
661
|
+
*/Mr.prototype._renderCanvas=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),zt.prototype._renderCanvas.call(this,e)};/*!
|
|
662
|
+
* @pixi/mixin-get-child-by-name - v6.5.7
|
|
663
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
664
|
+
*
|
|
665
|
+
* @pixi/mixin-get-child-by-name is licensed under the MIT License.
|
|
666
|
+
* http://www.opensource.org/licenses/mit-license
|
|
667
|
+
*/ee.prototype.name=null,mt.prototype.getChildByName=function(e,r){for(var i=0,n=this.children.length;i<n;i++)if(this.children[i].name===e)return this.children[i];if(r)for(var i=0,n=this.children.length;i<n;i++){var s=this.children[i];if(s.getChildByName){var o=s.getChildByName(e,!0);if(o)return o}}return null};/*!
|
|
668
|
+
* @pixi/unsafe-eval - v6.5.7
|
|
669
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
670
|
+
*
|
|
671
|
+
* @pixi/unsafe-eval is licensed under the MIT License.
|
|
672
|
+
* http://www.opensource.org/licenses/mit-license
|
|
673
|
+
*/var K0={float:function(t,e,r,i){r!==i&&(r.v=i,t.uniform1f(e,i))},vec2:function(t,e,r,i){(r[0]!==i[0]||r[1]!==i[1])&&(r[0]=i[0],r[1]=i[1],t.uniform2f(e,i[0],i[1]))},vec3:function(t,e,r,i){(r[0]!==i[0]||r[1]!==i[1]||r[2]!==i[2])&&(r[0]=i[0],r[1]=i[1],r[2]=i[2],t.uniform3f(e,i[0],i[1],i[2]))},int:function(t,e,r,i){t.uniform1i(e,i)},ivec2:function(t,e,r,i){t.uniform2i(e,i[0],i[1])},ivec3:function(t,e,r,i){t.uniform3i(e,i[0],i[1],i[2])},ivec4:function(t,e,r,i){t.uniform4i(e,i[0],i[1],i[2],i[3])},uint:function(t,e,r,i){t.uniform1ui(e,i)},uvec2:function(t,e,r,i){t.uniform2ui(e,i[0],i[1])},uvec3:function(t,e,r,i){t.uniform3ui(e,i[0],i[1],i[2])},uvec4:function(t,e,r,i){t.uniform4ui(e,i[0],i[1],i[2],i[3])},bool:function(t,e,r,i){r!==i&&(r.v=i,t.uniform1i(e,Number(i)))},bvec2:function(t,e,r,i){t.uniform2i(e,i[0],i[1])},bvec3:function(t,e,r,i){t.uniform3i(e,i[0],i[1],i[2])},bvec4:function(t,e,r,i){t.uniform4i(e,i[0],i[1],i[2],i[3])},mat2:function(t,e,r,i){t.uniformMatrix2fv(e,!1,i)},mat3:function(t,e,r,i){t.uniformMatrix3fv(e,!1,i)},mat4:function(t,e,r,i){t.uniformMatrix4fv(e,!1,i)},sampler2D:function(t,e,r,i){t.uniform1i(e,i)},samplerCube:function(t,e,r,i){t.uniform1i(e,i)},sampler2DArray:function(t,e,r,i){t.uniform1i(e,i)}},ty={float:function(t,e,r,i){t.uniform1fv(e,i)},vec2:function(t,e,r,i){t.uniform2fv(e,i)},vec3:function(t,e,r,i){t.uniform3fv(e,i)},vec4:function(t,e,r,i){t.uniform4fv(e,i)},int:function(t,e,r,i){t.uniform1iv(e,i)},ivec2:function(t,e,r,i){t.uniform2iv(e,i)},ivec3:function(t,e,r,i){t.uniform3iv(e,i)},ivec4:function(t,e,r,i){t.uniform4iv(e,i)},uint:function(t,e,r,i){t.uniform1uiv(e,i)},uvec2:function(t,e,r,i){t.uniform2uiv(e,i)},uvec3:function(t,e,r,i){t.uniform3uiv(e,i)},uvec4:function(t,e,r,i){t.uniform4uiv(e,i)},bool:function(t,e,r,i){t.uniform1iv(e,i)},bvec2:function(t,e,r,i){t.uniform2iv(e,i)},bvec3:function(t,e,r,i){t.uniform3iv(e,i)},bvec4:function(t,e,r,i){t.uniform4iv(e,i)},sampler2D:function(t,e,r,i){t.uniform1iv(e,i)},samplerCube:function(t,e,r,i){t.uniform1iv(e,i)},sampler2DArray:function(t,e,r,i){t.uniform1iv(e,i)}};function ey(t,e,r,i,n){var s=0,o=null,a=null,l=n.gl;for(var h in t.uniforms){var u=e[h],f=i[h],c=r[h],d=t.uniforms[h];if(!u){d.group&&n.shader.syncUniformGroup(f);continue}if(u.type==="float"&&u.size===1)f!==c.value&&(c.value=f,l.uniform1f(c.location,f));else if((u.type==="sampler2D"||u.type==="samplerCube"||u.type==="sampler2DArray")&&u.size===1&&!u.isArray)n.texture.bind(f,s),c.value!==s&&(c.value=s,l.uniform1i(c.location,s)),s++;else if(u.type==="mat3"&&u.size===1)d.a!==void 0?l.uniformMatrix3fv(c.location,!1,f.toArray(!0)):l.uniformMatrix3fv(c.location,!1,f);else if(u.type==="vec2"&&u.size===1)d.x!==void 0?(a=c.value,o=f,(a[0]!==o.x||a[1]!==o.y)&&(a[0]=o.x,a[1]=o.y,l.uniform2f(c.location,o.x,o.y))):(a=c.value,o=f,(a[0]!==o[0]||a[1]!==o[1])&&(a[0]=o[0],a[1]=o[1],l.uniform2f(c.location,o[0],o[1])));else if(u.type==="vec4"&&u.size===1)d.width!==void 0?(a=c.value,o=f,(a[0]!==o.x||a[1]!==o.y||a[2]!==o.width||a[3]!==o.height)&&(a[0]=o.x,a[1]=o.y,a[2]=o.width,a[3]=o.height,l.uniform4f(c.location,o.x,o.y,o.width,o.height))):(a=c.value,o=f,(a[0]!==o[0]||a[1]!==o[1]||a[2]!==o[2]||a[3]!==o[3])&&(a[0]=o[0],a[1]=o[1],a[2]=o[2],a[3]=o[3],l.uniform4f(c.location,o[0],o[1],o[2],o[3])));else{var v=u.size===1?K0:ty;v[u.type].call(null,l,c.location,c.value,f)}}}function ry(t){var e=t.ShaderSystem;if(!e)throw new Error("Unable to patch ShaderSystem, class not found.");Object.assign(e.prototype,{systemCheck:function(){},syncUniforms:function(r,i){var n=this,s=n.shader,o=n.renderer;ey(r,s.program.uniformData,i.uniformData,r.uniforms,o)}})}/*!
|
|
674
|
+
* @pixi/interaction - v6.5.7
|
|
675
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
676
|
+
*
|
|
677
|
+
* @pixi/interaction is licensed under the MIT License.
|
|
678
|
+
* http://www.opensource.org/licenses/mit-license
|
|
679
|
+
*/var uh=function(){function t(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new X,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(t.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),t.prototype.getLocalPosition=function(e,r,i){return e.worldTransform.applyInverse(i||this.global,r)},t.prototype.copyEvent=function(e){"isPrimary"in e&&e.isPrimary&&(this.isPrimary=!0),this.button="button"in e&&e.button;var r="buttons"in e&&e.buttons;this.buttons=Number.isInteger(r)?r:"which"in e&&e.which,this.width="width"in e&&e.width,this.height="height"in e&&e.height,this.tiltX="tiltX"in e&&e.tiltX,this.tiltY="tiltY"in e&&e.tiltY,this.pointerType="pointerType"in e&&e.pointerType,this.pressure="pressure"in e&&e.pressure,this.rotationAngle="rotationAngle"in e&&e.rotationAngle,this.twist="twist"in e&&e.twist||0,this.tangentialPressure="tangentialPressure"in e&&e.tangentialPressure||0},t.prototype.reset=function(){this.isPrimary=!1},t}();/*! *****************************************************************************
|
|
680
|
+
Copyright (c) Microsoft Corporation.
|
|
681
|
+
|
|
682
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
683
|
+
purpose with or without fee is hereby granted.
|
|
684
|
+
|
|
685
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
686
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
687
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
688
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
689
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
690
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
691
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
692
|
+
***************************************************************************** */var Fs=function(t,e){return Fs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Fs(t,e)};function iy(t,e){Fs(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var ny=function(){function t(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return t.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},t.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},t}(),Rs=function(){function t(e){this._pointerId=e,this._flags=t.FLAGS.NONE}return t.prototype._doSet=function(e,r){r?this._flags=this._flags|e:this._flags=this._flags&~e},Object.defineProperty(t.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flags",{get:function(){return this._flags},set:function(e){this._flags=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"none",{get:function(){return this._flags===t.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"over",{get:function(){return(this._flags&t.FLAGS.OVER)!==0},set:function(e){this._doSet(t.FLAGS.OVER,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightDown",{get:function(){return(this._flags&t.FLAGS.RIGHT_DOWN)!==0},set:function(e){this._doSet(t.FLAGS.RIGHT_DOWN,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftDown",{get:function(){return(this._flags&t.FLAGS.LEFT_DOWN)!==0},set:function(e){this._doSet(t.FLAGS.LEFT_DOWN,e)},enumerable:!1,configurable:!0}),t.FLAGS=Object.freeze({NONE:0,OVER:1<<0,LEFT_DOWN:1<<1,RIGHT_DOWN:1<<2}),t}(),sy=function(){function t(){this._tempPoint=new X}return t.prototype.recursiveFindHit=function(e,r,i,n,s){var o;if(!r||!r.visible)return!1;var a=e.data.global;s=r.interactive||s;var l=!1,h=s,u=!0;if(r.hitArea)n&&(r.worldTransform.applyInverse(a,this._tempPoint),r.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?l=!0:(n=!1,u=!1)),h=!1;else if(r._mask&&n){var f=r._mask.isMaskData?r._mask.maskObject:r._mask;f&&!(!((o=f.containsPoint)===null||o===void 0)&&o.call(f,a))&&(n=!1)}if(u&&r.interactiveChildren&&r.children)for(var c=r.children,d=c.length-1;d>=0;d--){var v=c[d],y=this.recursiveFindHit(e,v,i,n,h);if(y){if(!v.parent)continue;h=!1,y&&(e.target&&(n=!1),l=!0)}}return s&&(n&&!e.target&&!r.hitArea&&r.containsPoint&&r.containsPoint(a)&&(l=!0),r.interactive&&(l&&!e.target&&(e.target=r),i&&i(e,r,!!l))),l},t.prototype.findHit=function(e,r,i,n){this.recursiveFindHit(e,r,i,n,!1)},t}(),oy={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return this.cursor==="pointer"},set buttonMode(t){t?this.cursor="pointer":this.cursor==="pointer"&&(this.cursor=null)},cursor:null,get trackedPointers(){return this._trackedPointers===void 0&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};ee.mixin(oy);var ki=1,Ui={target:null,data:{global:null}},ay=function(t){iy(e,t);function e(r,i){var n=t.call(this)||this;return i=i||{},n.renderer=r,n.autoPreventDefault=i.autoPreventDefault!==void 0?i.autoPreventDefault:!0,n.interactionFrequency=i.interactionFrequency||10,n.mouse=new uh,n.mouse.identifier=ki,n.mouse.global.set(-999999),n.activeInteractionData={},n.activeInteractionData[ki]=n.mouse,n.interactionDataPool=[],n.eventData=new ny,n.interactionDOMElement=null,n.moveWhenInside=!1,n.eventsAdded=!1,n.tickerAdded=!1,n.mouseOverRenderer=!("PointerEvent"in globalThis),n.supportsTouchEvents="ontouchstart"in globalThis,n.supportsPointerEvents=!!globalThis.PointerEvent,n.onPointerUp=n.onPointerUp.bind(n),n.processPointerUp=n.processPointerUp.bind(n),n.onPointerCancel=n.onPointerCancel.bind(n),n.processPointerCancel=n.processPointerCancel.bind(n),n.onPointerDown=n.onPointerDown.bind(n),n.processPointerDown=n.processPointerDown.bind(n),n.onPointerMove=n.onPointerMove.bind(n),n.processPointerMove=n.processPointerMove.bind(n),n.onPointerOut=n.onPointerOut.bind(n),n.processPointerOverOut=n.processPointerOverOut.bind(n),n.onPointerOver=n.onPointerOver.bind(n),n.cursorStyles={default:"inherit",pointer:"pointer"},n.currentCursorMode=null,n.cursor=null,n.resolution=1,n.delayedEvents=[],n.search=new sy,n._tempDisplayObject=new sl,n._eventListenerOptions={capture:!0,passive:!1},n._useSystemTicker=i.useSystemTicker!==void 0?i.useSystemTicker:!0,n.setTargetElement(n.renderer.view,n.renderer.resolution),n}return Object.defineProperty(e.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(r){this._useSystemTicker=r,r?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),e.prototype.hitTest=function(r,i){return Ui.target=null,Ui.data.global=r,i||(i=this.lastObjectRendered),this.processInteractive(Ui,i,null,!0),Ui.target},e.prototype.setTargetElement=function(r,i){i===void 0&&(i=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=r,this.resolution=i,this.addEvents(),this.addTickerListener()},e.prototype.addTickerListener=function(){this.tickerAdded||!this.interactionDOMElement||!this._useSystemTicker||(vt.system.add(this.tickerUpdate,this,me.INTERACTION),this.tickerAdded=!0)},e.prototype.removeTickerListener=function(){this.tickerAdded&&(vt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},e.prototype.addEvents=function(){if(!(this.eventsAdded||!this.interactionDOMElement)){var r=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(r.msContentZooming="none",r.msTouchAction="none"):this.supportsPointerEvents&&(r.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},e.prototype.removeEvents=function(){if(!(!this.eventsAdded||!this.interactionDOMElement)){var r=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(r.msContentZooming="",r.msTouchAction=""):this.supportsPointerEvents&&(r.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},e.prototype.tickerUpdate=function(r){this._deltaTime+=r,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())},e.prototype.update=function(){if(this.interactionDOMElement){if(this._didMove){this._didMove=!1;return}this.cursor=null;for(var r in this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(r)){var i=this.activeInteractionData[r];if(i.originalEvent&&i.pointerType!=="touch"){var n=this.configureInteractionEventForDOMEvent(this.eventData,i.originalEvent,i);this.processInteractive(n,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},e.prototype.setCursorMode=function(r){r=r||"default";var i=!0;if(globalThis.OffscreenCanvas&&this.interactionDOMElement instanceof OffscreenCanvas&&(i=!1),this.currentCursorMode!==r){this.currentCursorMode=r;var n=this.cursorStyles[r];if(n)switch(typeof n){case"string":i&&(this.interactionDOMElement.style.cursor=n);break;case"function":n(r);break;case"object":i&&Object.assign(this.interactionDOMElement.style,n);break}else i&&typeof r=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,r)&&(this.interactionDOMElement.style.cursor=r)}},e.prototype.dispatchEvent=function(r,i,n){(!n.stopPropagationHint||r===n.stopsPropagatingAt)&&(n.currentTarget=r,n.type=i,r.emit(i,n),r[i]&&r[i](n))},e.prototype.delayDispatchEvent=function(r,i,n){this.delayedEvents.push({displayObject:r,eventString:i,eventData:n})},e.prototype.mapPositionToPoint=function(r,i,n){var s;this.interactionDOMElement.parentElement?s=this.interactionDOMElement.getBoundingClientRect():s={x:0,y:0,width:this.interactionDOMElement.width,height:this.interactionDOMElement.height,left:0,top:0};var o=1/this.resolution;r.x=(i-s.left)*(this.interactionDOMElement.width/s.width)*o,r.y=(n-s.top)*(this.interactionDOMElement.height/s.height)*o},e.prototype.processInteractive=function(r,i,n,s){var o=this.search.findHit(r,i,n,s),a=this.delayedEvents;if(!a.length)return o;r.stopPropagationHint=!1;var l=a.length;this.delayedEvents=[];for(var h=0;h<l;h++){var u=a[h],f=u.displayObject,c=u.eventString,d=u.eventData;d.stopsPropagatingAt===f&&(d.stopPropagationHint=!0),this.dispatchEvent(f,c,d)}return o},e.prototype.onPointerDown=function(r){if(!(this.supportsTouchEvents&&r.pointerType==="touch")){var i=this.normalizeToPointerData(r);if(this.autoPreventDefault&&i[0].isNormalized){var n=r.cancelable||!("cancelable"in r);n&&r.preventDefault()}for(var s=i.length,o=0;o<s;o++){var a=i[o],l=this.getInteractionDataForPointerId(a),h=this.configureInteractionEventForDOMEvent(this.eventData,a,l);if(h.data.originalEvent=r,this.processInteractive(h,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",h),a.pointerType==="touch")this.emit("touchstart",h);else if(a.pointerType==="mouse"||a.pointerType==="pen"){var u=a.button===2;this.emit(u?"rightdown":"mousedown",this.eventData)}}}},e.prototype.processPointerDown=function(r,i,n){var s=r.data,o=r.data.identifier;if(n){if(i.trackedPointers[o]||(i.trackedPointers[o]=new Rs(o)),this.dispatchEvent(i,"pointerdown",r),s.pointerType==="touch")this.dispatchEvent(i,"touchstart",r);else if(s.pointerType==="mouse"||s.pointerType==="pen"){var a=s.button===2;a?i.trackedPointers[o].rightDown=!0:i.trackedPointers[o].leftDown=!0,this.dispatchEvent(i,a?"rightdown":"mousedown",r)}}},e.prototype.onPointerComplete=function(r,i,n){var s=this.normalizeToPointerData(r),o=s.length,a=r.target;r.composedPath&&r.composedPath().length>0&&(a=r.composedPath()[0]);for(var l=a!==this.interactionDOMElement?"outside":"",h=0;h<o;h++){var u=s[h],f=this.getInteractionDataForPointerId(u),c=this.configureInteractionEventForDOMEvent(this.eventData,u,f);if(c.data.originalEvent=r,this.processInteractive(c,this.lastObjectRendered,n,i||!l),this.emit(i?"pointercancel":"pointerup"+l,c),u.pointerType==="mouse"||u.pointerType==="pen"){var d=u.button===2;this.emit(d?"rightup"+l:"mouseup"+l,c)}else u.pointerType==="touch"&&(this.emit(i?"touchcancel":"touchend"+l,c),this.releaseInteractionDataForPointerId(u.pointerId))}},e.prototype.onPointerCancel=function(r){this.supportsTouchEvents&&r.pointerType==="touch"||this.onPointerComplete(r,!0,this.processPointerCancel)},e.prototype.processPointerCancel=function(r,i){var n=r.data,s=r.data.identifier;i.trackedPointers[s]!==void 0&&(delete i.trackedPointers[s],this.dispatchEvent(i,"pointercancel",r),n.pointerType==="touch"&&this.dispatchEvent(i,"touchcancel",r))},e.prototype.onPointerUp=function(r){this.supportsTouchEvents&&r.pointerType==="touch"||this.onPointerComplete(r,!1,this.processPointerUp)},e.prototype.processPointerUp=function(r,i,n){var s=r.data,o=r.data.identifier,a=i.trackedPointers[o],l=s.pointerType==="touch",h=s.pointerType==="mouse"||s.pointerType==="pen",u=!1;if(h){var f=s.button===2,c=Rs.FLAGS,d=f?c.RIGHT_DOWN:c.LEFT_DOWN,v=a!==void 0&&a.flags&d;n?(this.dispatchEvent(i,f?"rightup":"mouseup",r),v&&(this.dispatchEvent(i,f?"rightclick":"click",r),u=!0)):v&&this.dispatchEvent(i,f?"rightupoutside":"mouseupoutside",r),a&&(f?a.rightDown=!1:a.leftDown=!1)}n?(this.dispatchEvent(i,"pointerup",r),l&&this.dispatchEvent(i,"touchend",r),a&&((!h||u)&&this.dispatchEvent(i,"pointertap",r),l&&(this.dispatchEvent(i,"tap",r),a.over=!1))):a&&(this.dispatchEvent(i,"pointerupoutside",r),l&&this.dispatchEvent(i,"touchendoutside",r)),a&&a.none&&delete i.trackedPointers[o]},e.prototype.onPointerMove=function(r){if(!(this.supportsTouchEvents&&r.pointerType==="touch")){var i=this.normalizeToPointerData(r);(i[0].pointerType==="mouse"||i[0].pointerType==="pen")&&(this._didMove=!0,this.cursor=null);for(var n=i.length,s=0;s<n;s++){var o=i[s],a=this.getInteractionDataForPointerId(o),l=this.configureInteractionEventForDOMEvent(this.eventData,o,a);l.data.originalEvent=r,this.processInteractive(l,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",l),o.pointerType==="touch"&&this.emit("touchmove",l),(o.pointerType==="mouse"||o.pointerType==="pen")&&this.emit("mousemove",l)}i[0].pointerType==="mouse"&&this.setCursorMode(this.cursor)}},e.prototype.processPointerMove=function(r,i,n){var s=r.data,o=s.pointerType==="touch",a=s.pointerType==="mouse"||s.pointerType==="pen";a&&this.processPointerOverOut(r,i,n),(!this.moveWhenInside||n)&&(this.dispatchEvent(i,"pointermove",r),o&&this.dispatchEvent(i,"touchmove",r),a&&this.dispatchEvent(i,"mousemove",r))},e.prototype.onPointerOut=function(r){if(!(this.supportsTouchEvents&&r.pointerType==="touch")){var i=this.normalizeToPointerData(r),n=i[0];n.pointerType==="mouse"&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var s=this.getInteractionDataForPointerId(n),o=this.configureInteractionEventForDOMEvent(this.eventData,n,s);o.data.originalEvent=n,this.processInteractive(o,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",o),n.pointerType==="mouse"||n.pointerType==="pen"?this.emit("mouseout",o):this.releaseInteractionDataForPointerId(s.identifier)}},e.prototype.processPointerOverOut=function(r,i,n){var s=r.data,o=r.data.identifier,a=s.pointerType==="mouse"||s.pointerType==="pen",l=i.trackedPointers[o];n&&!l&&(l=i.trackedPointers[o]=new Rs(o)),l!==void 0&&(n&&this.mouseOverRenderer?(l.over||(l.over=!0,this.delayDispatchEvent(i,"pointerover",r),a&&this.delayDispatchEvent(i,"mouseover",r)),a&&this.cursor===null&&(this.cursor=i.cursor)):l.over&&(l.over=!1,this.dispatchEvent(i,"pointerout",this.eventData),a&&this.dispatchEvent(i,"mouseout",r),l.none&&delete i.trackedPointers[o]))},e.prototype.onPointerOver=function(r){if(!(this.supportsTouchEvents&&r.pointerType==="touch")){var i=this.normalizeToPointerData(r),n=i[0],s=this.getInteractionDataForPointerId(n),o=this.configureInteractionEventForDOMEvent(this.eventData,n,s);o.data.originalEvent=n,n.pointerType==="mouse"&&(this.mouseOverRenderer=!0),this.emit("pointerover",o),(n.pointerType==="mouse"||n.pointerType==="pen")&&this.emit("mouseover",o)}},e.prototype.getInteractionDataForPointerId=function(r){var i=r.pointerId,n;return i===ki||r.pointerType==="mouse"?n=this.mouse:this.activeInteractionData[i]?n=this.activeInteractionData[i]:(n=this.interactionDataPool.pop()||new uh,n.identifier=i,this.activeInteractionData[i]=n),n.copyEvent(r),n},e.prototype.releaseInteractionDataForPointerId=function(r){var i=this.activeInteractionData[r];i&&(delete this.activeInteractionData[r],i.reset(),this.interactionDataPool.push(i))},e.prototype.configureInteractionEventForDOMEvent=function(r,i,n){return r.data=n,this.mapPositionToPoint(n.global,i.clientX,i.clientY),i.pointerType==="touch"&&(i.globalX=n.global.x,i.globalY=n.global.y),n.originalEvent=i,r.reset(),r},e.prototype.normalizeToPointerData=function(r){var i=[];if(this.supportsTouchEvents&&r instanceof TouchEvent)for(var n=0,s=r.changedTouches.length;n<s;n++){var o=r.changedTouches[n];typeof o.button>"u"&&(o.button=r.touches.length?1:0),typeof o.buttons>"u"&&(o.buttons=r.touches.length?1:0),typeof o.isPrimary>"u"&&(o.isPrimary=r.touches.length===1&&r.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,i.push(o)}else if(!globalThis.MouseEvent||r instanceof MouseEvent&&(!this.supportsPointerEvents||!(r instanceof globalThis.PointerEvent))){var a=r;typeof a.isPrimary>"u"&&(a.isPrimary=!0),typeof a.width>"u"&&(a.width=1),typeof a.height>"u"&&(a.height=1),typeof a.tiltX>"u"&&(a.tiltX=0),typeof a.tiltY>"u"&&(a.tiltY=0),typeof a.pointerType>"u"&&(a.pointerType="mouse"),typeof a.pointerId>"u"&&(a.pointerId=ki),typeof a.pressure>"u"&&(a.pressure=.5),typeof a.twist>"u"&&(a.twist=0),typeof a.tangentialPressure>"u"&&(a.tangentialPressure=0),a.isNormalized=!0,i.push(a)}else i.push(r);return i},e.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},e.extension={name:"interaction",type:[dt.RendererPlugin,dt.CanvasRendererPlugin]},e}(ye);/*!
|
|
693
|
+
* @pixi/canvas-renderer - v6.5.7
|
|
694
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
695
|
+
*
|
|
696
|
+
* @pixi/canvas-renderer is licensed under the MIT License.
|
|
697
|
+
* http://www.opensource.org/licenses/mit-license
|
|
698
|
+
*//*! *****************************************************************************
|
|
699
|
+
Copyright (c) Microsoft Corporation.
|
|
700
|
+
|
|
701
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
702
|
+
purpose with or without fee is hereby granted.
|
|
703
|
+
|
|
704
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
705
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
706
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
707
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
708
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
709
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
710
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
711
|
+
***************************************************************************** */var ks=function(t,e){return ks=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},ks(t,e)};function ly(t,e){ks(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var hy=function(){function t(e){this._foundShapes=[],this.renderer=e}return t.prototype.pushMask=function(e){var r=this.renderer,i=e.maskObject||e;r.context.save();var n=this._foundShapes;if(this.recursiveFindShapes(i,n),n.length>0){var s=r.context;s.beginPath();for(var o=0;o<n.length;o++){var a=n[o],l=a.transform.worldTransform;this.renderer.setContextTransform(l),this.renderGraphicsShape(a)}n.length=0,s.clip()}},t.prototype.recursiveFindShapes=function(e,r){e.geometry&&e.geometry.graphicsData&&r.push(e);var i=e.children;if(i)for(var n=0;n<i.length;n++)this.recursiveFindShapes(i[n],r)},t.prototype.renderGraphicsShape=function(e){e.finishPoly();var r=this.renderer.context,i=e.geometry.graphicsData,n=i.length;if(n!==0)for(var s=0;s<n;s++){var o=i[s],a=o.shape;if(a.type===V.POLY){var l=a.points,h=o.holes,u=void 0,f=void 0,c=void 0,d=void 0;r.moveTo(l[0],l[1]);for(var v=1;v<l.length/2;v++)r.lineTo(l[v*2],l[v*2+1]);if(h.length>0){u=0,c=l[0],d=l[1];for(var v=2;v+2<l.length;v+=2)u+=(l[v]-c)*(l[v+3]-d)-(l[v+2]-c)*(l[v+1]-d);for(var y=0;y<h.length;y++)if(l=h[y].shape.points,!!l){f=0,c=l[0],d=l[1];for(var v=2;v+2<l.length;v+=2)f+=(l[v]-c)*(l[v+3]-d)-(l[v+2]-c)*(l[v+1]-d);if(f*u<0){r.moveTo(l[0],l[1]);for(var v=2;v<l.length;v+=2)r.lineTo(l[v],l[v+1])}else{r.moveTo(l[l.length-2],l[l.length-1]);for(var v=l.length-4;v>=0;v-=2)r.lineTo(l[v],l[v+1])}h[y].shape.closeStroke&&r.closePath()}}l[0]===l[l.length-2]&&l[1]===l[l.length-1]&&r.closePath()}else if(a.type===V.RECT)r.rect(a.x,a.y,a.width,a.height),r.closePath();else if(a.type===V.CIRC)r.arc(a.x,a.y,a.radius,0,2*Math.PI),r.closePath();else if(a.type===V.ELIP){var m=a.width*2,g=a.height*2,x=a.x-m/2,_=a.y-g/2,P=.5522848,w=m/2*P,b=g/2*P,T=x+m,E=_+g,I=x+m/2,C=_+g/2;r.moveTo(x,C),r.bezierCurveTo(x,C-b,I-w,_,I,_),r.bezierCurveTo(I+w,_,T,C-b,T,C),r.bezierCurveTo(T,C+b,I+w,E,I,E),r.bezierCurveTo(I-w,E,x,C+b,x,C),r.closePath()}else if(a.type===V.RREC){var O=a.x,L=a.y,M=a.width,U=a.height,S=a.radius,k=Math.min(M,U)/2;S=S>k?k:S,r.moveTo(O,L+S),r.lineTo(O,L+U-S),r.quadraticCurveTo(O,L+U,O+S,L+U),r.lineTo(O+M-S,L+U),r.quadraticCurveTo(O+M,L+U,O+M,L+U-S),r.lineTo(O+M,L+S),r.quadraticCurveTo(O+M,L,O+M-S,L),r.lineTo(O+S,L),r.quadraticCurveTo(O,L,O,L+S),r.closePath()}}},t.prototype.popMask=function(e){e.context.restore(),e.invalidateBlendMode()},t.prototype.destroy=function(){},t}();function fh(t){var e=R.ADAPTER.createCanvas(6,1),r=e.getContext("2d");return r.fillStyle=t,r.fillRect(0,0,6,1),e}function ch(){if(typeof document>"u")return!1;var t=fh("#ff00ff"),e=fh("#ffff00"),r=R.ADAPTER.createCanvas(6,1),i=r.getContext("2d");i.globalCompositeOperation="multiply",i.drawImage(t,0,0),i.drawImage(e,2,0);var n=i.getImageData(2,0,1,1);if(!n)return!1;var s=n.data;return s[0]===255&&s[1]===0&&s[2]===0}function uy(t){return t===void 0&&(t=[]),ch()?(t[A.NORMAL]="source-over",t[A.ADD]="lighter",t[A.MULTIPLY]="multiply",t[A.SCREEN]="screen",t[A.OVERLAY]="overlay",t[A.DARKEN]="darken",t[A.LIGHTEN]="lighten",t[A.COLOR_DODGE]="color-dodge",t[A.COLOR_BURN]="color-burn",t[A.HARD_LIGHT]="hard-light",t[A.SOFT_LIGHT]="soft-light",t[A.DIFFERENCE]="difference",t[A.EXCLUSION]="exclusion",t[A.HUE]="hue",t[A.SATURATION]="saturation",t[A.COLOR]="color",t[A.LUMINOSITY]="luminosity"):(t[A.NORMAL]="source-over",t[A.ADD]="lighter",t[A.MULTIPLY]="source-over",t[A.SCREEN]="source-over",t[A.OVERLAY]="source-over",t[A.DARKEN]="source-over",t[A.LIGHTEN]="source-over",t[A.COLOR_DODGE]="source-over",t[A.COLOR_BURN]="source-over",t[A.HARD_LIGHT]="source-over",t[A.SOFT_LIGHT]="source-over",t[A.DIFFERENCE]="source-over",t[A.EXCLUSION]="source-over",t[A.HUE]="source-over",t[A.SATURATION]="source-over",t[A.COLOR]="source-over",t[A.LUMINOSITY]="source-over"),t[A.NORMAL_NPM]=t[A.NORMAL],t[A.ADD_NPM]=t[A.ADD],t[A.SCREEN_NPM]=t[A.SCREEN],t[A.SRC_IN]="source-in",t[A.SRC_OUT]="source-out",t[A.SRC_ATOP]="source-atop",t[A.DST_OVER]="destination-over",t[A.DST_IN]="destination-in",t[A.DST_OUT]="destination-out",t[A.DST_ATOP]="destination-atop",t[A.XOR]="xor",t[A.SUBTRACT]="source-over",t}var fy=new at,Bi=function(t){ly(e,t);function e(r){var i=t.call(this,Ze.CANVAS,r)||this;if(i.refresh=!0,i.maskManager=new hy(i),i.smoothProperty="imageSmoothingEnabled",i.blendModes=uy(),i.renderingToScreen=!1,i._activeBlendMode=null,i._projTransform=null,i._outerBlend=!1,i.rootContext=i.view.getContext("2d",{alpha:i.useContextAlpha}),i.context=i.rootContext,!i.rootContext.imageSmoothingEnabled){var n=i.rootContext;n.webkitImageSmoothingEnabled?i.smoothProperty="webkitImageSmoothingEnabled":n.mozImageSmoothingEnabled?i.smoothProperty="mozImageSmoothingEnabled":n.oImageSmoothingEnabled?i.smoothProperty="oImageSmoothingEnabled":n.msImageSmoothingEnabled&&(i.smoothProperty="msImageSmoothingEnabled")}return i.initPlugins(e.__plugins),ja("Canvas"),i.resize(i.options.width,i.options.height),i}return e.prototype.addSystem=function(){return this},e.prototype.render=function(r,i){if(this.view){var n,s,o,a;i&&(i instanceof Ht||i instanceof bi?(Kt("6.0.0","CanvasRenderer#render arguments changed, use options instead."),n=i,s=arguments[2],o=arguments[3],a=arguments[4]):(n=i.renderTexture,s=i.clear,o=i.transform,a=i.skipUpdateTransform)),this.renderingToScreen=!n,this.emit("prerender");var l=this.resolution;n?(n=n.castToBaseTexture(),n._canvasRenderTarget||(n._canvasRenderTarget=new rl(n.width,n.height,n.resolution),n.resource=new Al(n._canvasRenderTarget.canvas),n.valid=!0),this.context=n._canvasRenderTarget.context,this.resolution=n._canvasRenderTarget.resolution):this.context=this.rootContext;var h=this.context;if(this._projTransform=o||null,n||(this._lastObjectRendered=r),!a){var u=r.enableTempParent();r.updateTransform(),r.disableTempParent(u)}if(h.save(),h.setTransform(1,0,0,1,0,0),h.globalAlpha=1,this._activeBlendMode=A.NORMAL,this._outerBlend=!1,h.globalCompositeOperation=this.blendModes[A.NORMAL],s!==void 0?s:this.clearBeforeRender)if(this.renderingToScreen)h.clearRect(0,0,this.width,this.height),this.backgroundAlpha>0&&(h.globalAlpha=this.useContextAlpha?this.backgroundAlpha:1,h.fillStyle=this._backgroundColorString,h.fillRect(0,0,this.width,this.height),h.globalAlpha=1);else{n=n,n._canvasRenderTarget.clear();var f=n.clearColor;f[3]>0&&(h.globalAlpha=this.useContextAlpha?f[3]:1,h.fillStyle=di(vi(f)),h.fillRect(0,0,n.realWidth,n.realHeight),h.globalAlpha=1)}var c=this.context;this.context=h,r.renderCanvas(this),this.context=c,h.restore(),this.resolution=l,this._projTransform=null,this.emit("postrender")}},e.prototype.setContextTransform=function(r,i,n){var s=r,o=this._projTransform,a=this.resolution;n=n||a,o&&(s=fy,s.copyFrom(r),s.prepend(o)),i?this.context.setTransform(s.a*n,s.b*n,s.c*n,s.d*n,s.tx*a|0,s.ty*a|0):this.context.setTransform(s.a*n,s.b*n,s.c*n,s.d*n,s.tx*a,s.ty*a)},e.prototype.clear=function(r,i){r===void 0&&(r=this._backgroundColorString),i===void 0&&(i=this.backgroundAlpha);var n=this.context;n.clearRect(0,0,this.width,this.height),r&&(n.globalAlpha=this.useContextAlpha?i:1,n.fillStyle=r,n.fillRect(0,0,this.width,this.height),n.globalAlpha=1)},e.prototype.setBlendMode=function(r,i){var n=r===A.SRC_IN||r===A.SRC_OUT||r===A.DST_IN||r===A.DST_ATOP;!i&&n&&(r=A.NORMAL),this._activeBlendMode!==r&&(this._activeBlendMode=r,this._outerBlend=n,this.context.globalCompositeOperation=this.blendModes[r])},e.prototype.destroy=function(r){t.prototype.destroy.call(this,r),this.context=null,this.refresh=!0,this.maskManager.destroy(),this.maskManager=null,this.smoothProperty=null},e.prototype.resize=function(r,i){t.prototype.resize.call(this,r,i),this.smoothProperty&&(this.rootContext[this.smoothProperty]=R.SCALE_MODE===xt.LINEAR)},e.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},e.registerPlugin=function(r,i){Kt("6.5.0","CanvasRenderer.registerPlugin() has been deprecated, please use extensions.add() instead."),Gt.add({name:r,type:dt.CanvasRendererPlugin,ref:i})},e.__plugins={},e}(ql);Gt.handleByMap(dt.CanvasRendererPlugin,Bi.__plugins);var yt={canvas:null,getTintedCanvas:function(t,e){var r=t.texture;e=yt.roundColor(e);var i="#"+("00000"+(e|0).toString(16)).slice(-6);r.tintCache=r.tintCache||{};var n=r.tintCache[i],s;if(n){if(n.tintId===r._updateID)return r.tintCache[i];s=r.tintCache[i]}else s=R.ADAPTER.createCanvas();return yt.tintMethod(r,e,s),s.tintId=r._updateID,r.tintCache[i]=s,s},getTintedPattern:function(t,e){e=yt.roundColor(e);var r="#"+("00000"+(e|0).toString(16)).slice(-6);t.patternCache=t.patternCache||{};var i=t.patternCache[r];return i&&i.tintId===t._updateID||(yt.canvas||(yt.canvas=R.ADAPTER.createCanvas()),yt.tintMethod(t,e,yt.canvas),i=yt.canvas.getContext("2d").createPattern(yt.canvas,"repeat"),i.tintId=t._updateID,t.patternCache[r]=i),i},tintWithMultiply:function(t,e,r){var i=r.getContext("2d"),n=t._frame.clone(),s=t.baseTexture.resolution;n.x*=s,n.y*=s,n.width*=s,n.height*=s,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.fillStyle="#"+("00000"+(e|0).toString(16)).slice(-6),i.fillRect(0,0,n.width,n.height),i.globalCompositeOperation="multiply";var o=t.baseTexture.getDrawableSource();i.drawImage(o,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.globalCompositeOperation="destination-atop",i.drawImage(o,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore()},tintWithOverlay:function(t,e,r){var i=r.getContext("2d"),n=t._frame.clone(),s=t.baseTexture.resolution;n.x*=s,n.y*=s,n.width*=s,n.height*=s,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.fillStyle="#"+("00000"+(e|0).toString(16)).slice(-6),i.fillRect(0,0,n.width,n.height),i.globalCompositeOperation="destination-atop",i.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore()},tintWithPerPixel:function(t,e,r){var i=r.getContext("2d"),n=t._frame.clone(),s=t.baseTexture.resolution;n.x*=s,n.y*=s,n.width*=s,n.height*=s,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore();for(var o=tr(e),a=o[0],l=o[1],h=o[2],u=i.getImageData(0,0,n.width,n.height),f=u.data,c=0;c<f.length;c+=4)f[c+0]*=a,f[c+1]*=l,f[c+2]*=h;i.putImageData(u,0,0)},roundColor:function(t){var e=yt.cacheStepsPerColorChannel,r=tr(t);return r[0]=Math.min(255,r[0]/e*e),r[1]=Math.min(255,r[1]/e*e),r[2]=Math.min(255,r[2]/e*e),vi(r)},cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:ch(),tintMethod:null};yt.tintMethod=yt.canUseMultiply?yt.tintWithMultiply:yt.tintWithPerPixel;var cy=nr.create;nr.create=function(e){var r=e&&e.forceCanvas;if(!r)try{return cy(e)}catch{}return new Bi(e)},Z.prototype.getDrawableSource=function(){var e=this.resource;return e?e.bitmap||e.source:null},bi.prototype._canvasRenderTarget=null,lt.prototype.patternCache=null,lt.prototype.tintCache=null;/*!
|
|
712
|
+
* @pixi/canvas-extract - v6.5.7
|
|
713
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
714
|
+
*
|
|
715
|
+
* @pixi/canvas-extract is licensed under the MIT License.
|
|
716
|
+
* http://www.opensource.org/licenses/mit-license
|
|
717
|
+
*/var ph=new G,py=function(){function t(e){this.renderer=e}return t.prototype.image=function(e,r,i){var n=new Image;return n.src=this.base64(e,r,i),n},t.prototype.base64=function(e,r,i){return this.canvas(e).toDataURL(r,i)},t.prototype.canvas=function(e,r){var i=this.renderer,n,s,o;e&&(e instanceof Ht?o=e:o=i.generateTexture(e)),o?(n=o.baseTexture._canvasRenderTarget.context,s=o.baseTexture._canvasRenderTarget.resolution,r=r??o.frame):(n=i.rootContext,s=i.resolution,r||(r=ph,r.width=i.width,r.height=i.height));var a=Math.round(r.x*s),l=Math.round(r.y*s),h=Math.round(r.width*s),u=Math.round(r.height*s),f=new rl(h,u,1),c=n.getImageData(a,l,h,u);return f.context.putImageData(c,0,0),f.canvas},t.prototype.pixels=function(e,r){var i=this.renderer,n,s,o;e&&(e instanceof Ht?o=e:o=i.generateTexture(e)),o?(n=o.baseTexture._canvasRenderTarget.context,s=o.baseTexture._canvasRenderTarget.resolution,r=r??o.frame):(n=i.rootContext,s=i.resolution,r||(r=ph,r.width=i.width,r.height=i.height));var a=Math.round(r.x*s),l=Math.round(r.y*s),h=Math.round(r.width*s),u=Math.round(r.height*s);return n.getImageData(a,l,h,u).data},t.prototype.destroy=function(){this.renderer=null},t.extension={name:"extract",type:dt.CanvasRendererPlugin},t}();/*!
|
|
718
|
+
* @pixi/canvas-graphics - v6.5.7
|
|
719
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
720
|
+
*
|
|
721
|
+
* @pixi/canvas-graphics is licensed under the MIT License.
|
|
722
|
+
* http://www.opensource.org/licenses/mit-license
|
|
723
|
+
*/var dh=function(){function t(){}return t.offsetPolygon=function(e,r){var i=[],n=e.length;r=t.isPolygonClockwise(e)?r:-1*r;for(var s=0;s<n;s+=2){var o=s-2;o<0&&(o+=n);var a=(s+2)%n,l=e[s]-e[o],h=e[s+1]-e[o+1],u=Math.sqrt(l*l+h*h);l/=u,h/=u,l*=r,h*=r;var f=-h,c=l,d=[e[o]+f,e[o+1]+c],v=[e[s]+f,e[s+1]+c],y=e[a]-e[s],m=e[a+1]-e[s+1];u=Math.sqrt(y*y+m*m),y/=u,m/=u,y*=r,m*=r;var g=-m,x=y,_=[e[s]+g,e[s+1]+x],P=[e[a]+g,e[a+1]+x],w=t.findIntersection(d[0],d[1],v[0],v[1],_[0],_[1],P[0],P[1]);w&&i.push.apply(i,w)}return i},t.findIntersection=function(e,r,i,n,s,o,a,l){var h=(l-o)*(i-e)-(a-s)*(n-r),u=(a-s)*(r-o)-(l-o)*(e-s),f=(i-e)*(r-o)-(n-r)*(e-s);if(h===0)return u===0&&f===0?[(e+i)/2,(r+n)/2]:null;var c=u/h;return[e+c*(i-e),r+c*(n-r)]},t.isPolygonClockwise=function(e){for(var r=0,i=0,n=e.length-2;i<e.length;n=i,i+=2)r+=(e[i]-e[n])*(e[i+1]+e[n+1]);return r>0},t}(),dy=function(){function t(e){this._svgMatrix=null,this._tempMatrix=new at,this.renderer=e}return t.prototype._calcCanvasStyle=function(e,r){var i;return e.texture&&e.texture.baseTexture!==lt.WHITE.baseTexture?e.texture.valid?(i=yt.getTintedPattern(e.texture,r),this.setPatternTransform(i,e.matrix||at.IDENTITY)):i="#808080":i="#"+("00000"+(r|0).toString(16)).slice(-6),i},t.prototype.render=function(e){var r=this.renderer,i=r.context,n=e.worldAlpha,s=e.transform.worldTransform;r.setContextTransform(s),r.setBlendMode(e.blendMode);for(var o=e.geometry.graphicsData,a,l,h=(e.tint>>16&255)/255,u=(e.tint>>8&255)/255,f=(e.tint&255)/255,c=0;c<o.length;c++){var d=o[c],v=d.shape,y=d.fillStyle,m=d.lineStyle,g=d.fillStyle.color|0,x=d.lineStyle.color|0;if(d.matrix&&r.setContextTransform(s.copyTo(this._tempMatrix).append(d.matrix)),y.visible){var _=((g>>16&255)/255*h*255<<16)+((g>>8&255)/255*u*255<<8)+(g&255)/255*f*255;a=this._calcCanvasStyle(y,_)}if(m.visible){var P=((x>>16&255)/255*h*255<<16)+((x>>8&255)/255*u*255<<8)+(x&255)/255*f*255;l=this._calcCanvasStyle(m,P)}if(i.lineWidth=m.width,i.lineCap=m.cap,i.lineJoin=m.join,i.miterLimit=m.miterLimit,d.type===V.POLY){i.beginPath();var w=v,b=w.points,T=d.holes,E=void 0,I=void 0,C=void 0,O=void 0,L=void 0;i.moveTo(b[0],b[1]);for(var M=2;M<b.length;M+=2)i.lineTo(b[M],b[M+1]);if(w.closeStroke&&i.closePath(),T.length>0){L=[],E=0,C=b[0],O=b[1];for(var M=2;M+2<b.length;M+=2)E+=(b[M]-C)*(b[M+3]-O)-(b[M+2]-C)*(b[M+1]-O);for(var U=0;U<T.length;U++)if(b=T[U].shape.points,!!b){I=0,C=b[0],O=b[1];for(var M=2;M+2<b.length;M+=2)I+=(b[M]-C)*(b[M+3]-O)-(b[M+2]-C)*(b[M+1]-O);if(I*E<0){i.moveTo(b[0],b[1]);for(var M=2;M<b.length;M+=2)i.lineTo(b[M],b[M+1])}else{i.moveTo(b[b.length-2],b[b.length-1]);for(var M=b.length-4;M>=0;M-=2)i.lineTo(b[M],b[M+1])}T[U].shape.closeStroke&&i.closePath(),L[U]=I*E<0}}y.visible&&(i.globalAlpha=y.alpha*n,i.fillStyle=a,i.fill()),m.visible&&this.paintPolygonStroke(w,m,l,T,L,n,i)}else if(d.type===V.RECT){var w=v;if(y.visible&&(i.globalAlpha=y.alpha*n,i.fillStyle=a,i.fillRect(w.x,w.y,w.width,w.height)),m.visible){var S=m.width*(.5-(1-m.alignment)),k=w.width+2*S,D=w.height+2*S;i.globalAlpha=m.alpha*n,i.strokeStyle=l,i.strokeRect(w.x-S,w.y-S,k,D)}}else if(d.type===V.CIRC){var w=v;if(i.beginPath(),i.arc(w.x,w.y,w.radius,0,2*Math.PI),i.closePath(),y.visible&&(i.globalAlpha=y.alpha*n,i.fillStyle=a,i.fill()),m.visible){if(m.alignment!==.5){var S=m.width*(.5-(1-m.alignment));i.beginPath(),i.arc(w.x,w.y,w.radius+S,0,2*Math.PI),i.closePath()}i.globalAlpha=m.alpha*n,i.strokeStyle=l,i.stroke()}}else if(d.type===V.ELIP){var w=v,gt=m.alignment===1;if(gt||this.paintEllipse(w,y,m,a,n,i),m.visible){if(m.alignment!==.5){var Ae=.5522848,S=m.width*(.5-(1-m.alignment)),Yt=(w.width+S)*2,Vt=(w.height+S)*2,Nt=w.x-Yt/2,Ot=w.y-Vt/2,Ee=Yt/2*Ae,Se=Vt/2*Ae,fe=Nt+Yt,ce=Ot+Vt,Bt=Nt+Yt/2,_t=Ot+Vt/2;i.beginPath(),i.moveTo(Nt,_t),i.bezierCurveTo(Nt,_t-Se,Bt-Ee,Ot,Bt,Ot),i.bezierCurveTo(Bt+Ee,Ot,fe,_t-Se,fe,_t),i.bezierCurveTo(fe,_t+Se,Bt+Ee,ce,Bt,ce),i.bezierCurveTo(Bt-Ee,ce,Nt,_t+Se,Nt,_t),i.closePath()}i.globalAlpha=m.alpha*n,i.strokeStyle=l,i.stroke()}gt&&this.paintEllipse(w,y,m,a,n,i)}else if(d.type===V.RREC){var w=v,gt=m.alignment===1;if(gt||this.paintRoundedRectangle(w,y,m,a,n,i),m.visible){if(m.alignment!==.5){var k=w.width,D=w.height,S=m.width*(.5-(1-m.alignment)),et=w.x-S,rt=w.y-S,ht=w.width+2*S,Lt=w.height+2*S,jr=S*(m.alignment>=1?Math.min(ht/k,Lt/D):Math.min(k/ht,D/Lt)),Pt=w.radius+jr,Zr=Math.min(ht,Lt)/2;Pt=Pt>Zr?Zr:Pt,i.beginPath(),i.moveTo(et,rt+Pt),i.lineTo(et,rt+Lt-Pt),i.quadraticCurveTo(et,rt+Lt,et+Pt,rt+Lt),i.lineTo(et+ht-Pt,rt+Lt),i.quadraticCurveTo(et+ht,rt+Lt,et+ht,rt+Lt-Pt),i.lineTo(et+ht,rt+Pt),i.quadraticCurveTo(et+ht,rt,et+ht-Pt,rt),i.lineTo(et+Pt,rt),i.quadraticCurveTo(et,rt,et,rt+Pt),i.closePath()}i.globalAlpha=m.alpha*n,i.strokeStyle=l,i.stroke()}gt&&this.paintRoundedRectangle(w,y,m,a,n,i)}}},t.prototype.paintPolygonStroke=function(e,r,i,n,s,o,a){if(r.alignment!==.5){var l=r.width*(.5-(1-r.alignment)),h=dh.offsetPolygon(e.points,l),u=void 0;a.beginPath(),a.moveTo(h[0],h[1]);for(var f=2;f<h.length;f+=2)a.lineTo(h[f],h[f+1]);e.closeStroke&&a.closePath();for(var c=0;c<n.length;c++){if(u=n[c].shape.points,h=dh.offsetPolygon(u,l),s[c]){a.moveTo(h[0],h[1]);for(var f=2;f<h.length;f+=2)a.lineTo(h[f],h[f+1])}else{a.moveTo(h[h.length-2],h[h.length-1]);for(var f=h.length-4;f>=0;f-=2)a.lineTo(h[f],h[f+1])}n[c].shape.closeStroke&&a.closePath()}}a.globalAlpha=r.alpha*o,a.strokeStyle=i,a.stroke()},t.prototype.paintEllipse=function(e,r,i,n,s,o){var a=e.width*2,l=e.height*2,h=e.x-a/2,u=e.y-l/2,f=.5522848,c=a/2*f,d=l/2*f,v=h+a,y=u+l,m=h+a/2,g=u+l/2;i.alignment===0&&o.save(),o.beginPath(),o.moveTo(h,g),o.bezierCurveTo(h,g-d,m-c,u,m,u),o.bezierCurveTo(m+c,u,v,g-d,v,g),o.bezierCurveTo(v,g+d,m+c,y,m,y),o.bezierCurveTo(m-c,y,h,g+d,h,g),o.closePath(),i.alignment===0&&o.clip(),r.visible&&(o.globalAlpha=r.alpha*s,o.fillStyle=n,o.fill()),i.alignment===0&&o.restore()},t.prototype.paintRoundedRectangle=function(e,r,i,n,s,o){var a=e.x,l=e.y,h=e.width,u=e.height,f=e.radius,c=Math.min(h,u)/2;f=f>c?c:f,i.alignment===0&&o.save(),o.beginPath(),o.moveTo(a,l+f),o.lineTo(a,l+u-f),o.quadraticCurveTo(a,l+u,a+f,l+u),o.lineTo(a+h-f,l+u),o.quadraticCurveTo(a+h,l+u,a+h,l+u-f),o.lineTo(a+h,l+f),o.quadraticCurveTo(a+h,l,a+h-f,l),o.lineTo(a+f,l),o.quadraticCurveTo(a,l,a,l+f),o.closePath(),i.alignment===0&&o.clip(),r.visible&&(o.globalAlpha=r.alpha*s,o.fillStyle=n,o.fill()),i.alignment===0&&o.restore()},t.prototype.setPatternTransform=function(e,r){if(this._svgMatrix!==!1){if(!this._svgMatrix){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i&&i.createSVGMatrix&&(this._svgMatrix=i.createSVGMatrix()),!this._svgMatrix||!e.setTransform){this._svgMatrix=!1;return}}this._svgMatrix.a=r.a,this._svgMatrix.b=r.b,this._svgMatrix.c=r.c,this._svgMatrix.d=r.d,this._svgMatrix.e=r.tx,this._svgMatrix.f=r.ty,e.setTransform(this._svgMatrix.inverse())}},t.prototype.destroy=function(){this.renderer=null,this._svgMatrix=null,this._tempMatrix=null},t.extension={name:"graphics",type:dt.CanvasRendererPlugin},t}(),Us,Fr=new at;wt.prototype.generateCanvasTexture=function(e,r){r===void 0&&(r=1);var i=this.getLocalBounds(),n=Ht.create({width:i.width,height:i.height,scaleMode:e,resolution:r});Us||(Us=new Bi),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(Fr),Fr.invert(),Fr.tx-=i.x,Fr.ty-=i.y,Us.render(this,{renderTexture:n,clear:!0,transform:Fr});var s=lt.from(n.baseTexture._canvasRenderTarget.canvas,{scaleMode:e});return s.baseTexture.setResolution(r),s},wt.prototype.cachedGraphicsData=[],wt.prototype._renderCanvas=function(e){this.isMask!==!0&&(this.finishPoly(),e.plugins.graphics.render(this))};/*!
|
|
724
|
+
* @pixi/prepare - v6.5.7
|
|
725
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
726
|
+
*
|
|
727
|
+
* @pixi/prepare is licensed under the MIT License.
|
|
728
|
+
* http://www.opensource.org/licenses/mit-license
|
|
729
|
+
*/R.UPLOADS_PER_FRAME=4;/*! *****************************************************************************
|
|
730
|
+
Copyright (c) Microsoft Corporation.
|
|
731
|
+
|
|
732
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
733
|
+
purpose with or without fee is hereby granted.
|
|
734
|
+
|
|
735
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
736
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
737
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
738
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
739
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
740
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
741
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
742
|
+
***************************************************************************** */var Bs=function(t,e){return Bs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Bs(t,e)};function vy(t,e){Bs(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var my=function(){function t(e){this.maxItemsPerFrame=e,this.itemsLeft=0}return t.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},t.prototype.allowedToUpload=function(){return this.itemsLeft-- >0},t}();function yy(t,e){var r=!1;if(t&&t._textures&&t._textures.length){for(var i=0;i<t._textures.length;i++)if(t._textures[i]instanceof lt){var n=t._textures[i].baseTexture;e.indexOf(n)===-1&&(e.push(n),r=!0)}}return r}function gy(t,e){if(t.baseTexture instanceof Z){var r=t.baseTexture;return e.indexOf(r)===-1&&e.push(r),!0}return!1}function _y(t,e){if(t._texture&&t._texture instanceof lt){var r=t._texture.baseTexture;return e.indexOf(r)===-1&&e.push(r),!0}return!1}function xy(t,e){return e instanceof Mr?(e.updateText(!0),!0):!1}function wy(t,e){if(e instanceof lr){var r=e.toFontString();return re.measureFont(r),!0}return!1}function Py(t,e){if(t instanceof Mr){e.indexOf(t.style)===-1&&e.push(t.style),e.indexOf(t)===-1&&e.push(t);var r=t._texture.baseTexture;return e.indexOf(r)===-1&&e.push(r),!0}return!1}function by(t,e){return t instanceof lr?(e.indexOf(t)===-1&&e.push(t),!0):!1}var vh=function(){function t(e){var r=this;this.limiter=new my(R.UPLOADS_PER_FRAME),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){r.queue&&r.prepareItems()},this.registerFindHook(Py),this.registerFindHook(by),this.registerFindHook(yy),this.registerFindHook(gy),this.registerFindHook(_y),this.registerUploadHook(xy),this.registerUploadHook(wy)}return t.prototype.upload=function(e,r){var i=this;return typeof e=="function"&&(r=e,e=null),r&&Kt("6.5.0","BasePrepare.upload callback is deprecated, use the return Promise instead."),new Promise(function(n){e&&i.add(e);var s=function(){r?.(),n()};i.queue.length?(i.completes.push(s),i.ticking||(i.ticking=!0,vt.system.addOnce(i.tick,i,me.UTILITY))):s()})},t.prototype.tick=function(){setTimeout(this.delayedTick,0)},t.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var e=this.queue[0],r=!1;if(e&&!e._destroyed){for(var i=0,n=this.uploadHooks.length;i<n;i++)if(this.uploadHooks[i](this.uploadHookHelper,e)){this.queue.shift(),r=!0;break}}r||this.queue.shift()}if(this.queue.length)vt.system.addOnce(this.tick,this,me.UTILITY);else{this.ticking=!1;var s=this.completes.slice(0);this.completes.length=0;for(var i=0,n=s.length;i<n;i++)s[i]()}},t.prototype.registerFindHook=function(e){return e&&this.addHooks.push(e),this},t.prototype.registerUploadHook=function(e){return e&&this.uploadHooks.push(e),this},t.prototype.add=function(e){for(var r=0,i=this.addHooks.length;r<i&&!this.addHooks[r](e,this.queue);r++);if(e instanceof mt)for(var r=e.children.length-1;r>=0;r--)this.add(e.children[r]);return this},t.prototype.destroy=function(){this.ticking&&vt.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},t}();function mh(t,e){return e instanceof Z?(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0):!1}function Ty(t,e){if(!(e instanceof wt))return!1;var r=e.geometry;e.finishPoly(),r.updateBatches();for(var i=r.batches,n=0;n<i.length;n++){var s=i[n].style.texture;s&&mh(t,s.baseTexture)}return r.batchable||t.geometry.bind(r,e._resolveDirectShader(t)),!0}function Iy(t,e){return t instanceof wt?(e.push(t),!0):!1}(function(t){vy(e,t);function e(r){var i=t.call(this,r)||this;return i.uploadHookHelper=i.renderer,i.registerFindHook(Iy),i.registerUploadHook(mh),i.registerUploadHook(Ty),i}return e.extension={name:"prepare",type:dt.RendererPlugin},e})(vh);/*!
|
|
743
|
+
* @pixi/canvas-prepare - v6.5.7
|
|
744
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
745
|
+
*
|
|
746
|
+
* @pixi/canvas-prepare is licensed under the MIT License.
|
|
747
|
+
* http://www.opensource.org/licenses/mit-license
|
|
748
|
+
*//*! *****************************************************************************
|
|
749
|
+
Copyright (c) Microsoft Corporation.
|
|
750
|
+
|
|
751
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
752
|
+
purpose with or without fee is hereby granted.
|
|
753
|
+
|
|
754
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
755
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
756
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
757
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
758
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
759
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
760
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
761
|
+
***************************************************************************** */var Ds=function(t,e){return Ds=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Ds(t,e)};function Cy(t,e){Ds(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var yh=16;function Ay(t,e){var r=t;if(e instanceof Z){var i=e.source,n=i.width===0?r.canvas.width:Math.min(r.canvas.width,i.width),s=i.height===0?r.canvas.height:Math.min(r.canvas.height,i.height);return r.ctx.drawImage(i,0,0,n,s,0,0,r.canvas.width,r.canvas.height),!0}return!1}var Ey=function(t){Cy(e,t);function e(r){var i=t.call(this,r)||this;return i.uploadHookHelper=i,i.canvas=R.ADAPTER.createCanvas(yh,yh),i.ctx=i.canvas.getContext("2d"),i.registerUploadHook(Ay),i}return e.prototype.destroy=function(){t.prototype.destroy.call(this),this.ctx=null,this.canvas=null},e.extension={name:"prepare",type:dt.CanvasRendererPlugin},e}(vh);/*!
|
|
762
|
+
* @pixi/canvas-sprite - v6.5.7
|
|
763
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
764
|
+
*
|
|
765
|
+
* @pixi/canvas-sprite is licensed under the MIT License.
|
|
766
|
+
* http://www.opensource.org/licenses/mit-license
|
|
767
|
+
*/var gh=new at,Sy=function(){function t(e){this.renderer=e}return t.prototype.render=function(e){var r=e._texture,i=this.renderer,n=i.context;if(r.valid){var s=r._frame.width,o=r._frame.height,a=r._frame.width,l=r._frame.height;r.trim&&(q.isVertical(r.rotate)?(a=r.trim.height,l=r.trim.width):(a=r.trim.width,l=r.trim.height));var h=e.transform.worldTransform,u=0,f=0,c=r.baseTexture.getDrawableSource();if(!(r.orig.width<=0||r.orig.height<=0||!r.valid||!c)){i.setBlendMode(e.blendMode,!0),i.context.globalAlpha=e.worldAlpha;var d=r.baseTexture.scaleMode===xt.LINEAR;i.smoothProperty&&i.context[i.smoothProperty]!==d&&(n[i.smoothProperty]=d),r.trim?(u=r.trim.width/2+r.trim.x-e.anchor.x*r.orig.width,f=r.trim.height/2+r.trim.y-e.anchor.y*r.orig.height):(u=(.5-e.anchor.x)*r.orig.width,f=(.5-e.anchor.y)*r.orig.height),r.rotate&&(h.copyTo(gh),h=gh,q.matrixAppendRotationInv(h,r.rotate,u,f),u=0,f=0),u-=a/2,f-=l/2,i.setContextTransform(h,e.roundPixels,1),e.roundPixels&&(u=u|0,f=f|0);var v=r.baseTexture.resolution,y=i._outerBlend;y&&(n.save(),n.beginPath(),n.rect(u*i.resolution,f*i.resolution,a*i.resolution,l*i.resolution),n.clip()),e.tint!==16777215?((e._cachedTint!==e.tint||e._tintedCanvas.tintId!==e._texture._updateID)&&(e._cachedTint=e.tint,e._tintedCanvas=yt.getTintedCanvas(e,e.tint)),n.drawImage(e._tintedCanvas,0,0,Math.floor(s*v),Math.floor(o*v),Math.floor(u*i.resolution),Math.floor(f*i.resolution),Math.floor(a*i.resolution),Math.floor(l*i.resolution))):n.drawImage(c,r._frame.x*v,r._frame.y*v,Math.floor(s*v),Math.floor(o*v),Math.floor(u*i.resolution),Math.floor(f*i.resolution),Math.floor(a*i.resolution),Math.floor(l*i.resolution)),y&&n.restore(),i.setBlendMode(A.NORMAL)}}},t.prototype.destroy=function(){this.renderer=null},t.extension={name:"sprite",type:dt.CanvasRendererPlugin},t}();zt.prototype._tintedCanvas=null,zt.prototype._renderCanvas=function(e){e.plugins.sprite.render(this)};/*!
|
|
768
|
+
* @pixi/filter-color-matrix - v6.5.7
|
|
769
|
+
* Compiled Thu, 20 Oct 2022 15:13:33 UTC
|
|
770
|
+
*
|
|
771
|
+
* @pixi/filter-color-matrix is licensed under the MIT License.
|
|
772
|
+
* http://www.opensource.org/licenses/mit-license
|
|
773
|
+
*//*! *****************************************************************************
|
|
774
|
+
Copyright (c) Microsoft Corporation.
|
|
775
|
+
|
|
776
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
777
|
+
purpose with or without fee is hereby granted.
|
|
778
|
+
|
|
779
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
780
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
781
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
782
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
783
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
784
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
785
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
786
|
+
***************************************************************************** */var Xs=function(t,e){return Xs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Xs(t,e)};function Ny(t,e){Xs(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Oy=`varying vec2 vTextureCoord;
|
|
787
|
+
uniform sampler2D uSampler;
|
|
788
|
+
uniform float m[20];
|
|
789
|
+
uniform float uAlpha;
|
|
790
|
+
|
|
791
|
+
void main(void)
|
|
792
|
+
{
|
|
793
|
+
vec4 c = texture2D(uSampler, vTextureCoord);
|
|
794
|
+
|
|
795
|
+
if (uAlpha == 0.0) {
|
|
796
|
+
gl_FragColor = c;
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
801
|
+
if (c.a > 0.0) {
|
|
802
|
+
c.rgb /= c.a;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
vec4 result;
|
|
806
|
+
|
|
807
|
+
result.r = (m[0] * c.r);
|
|
808
|
+
result.r += (m[1] * c.g);
|
|
809
|
+
result.r += (m[2] * c.b);
|
|
810
|
+
result.r += (m[3] * c.a);
|
|
811
|
+
result.r += m[4];
|
|
812
|
+
|
|
813
|
+
result.g = (m[5] * c.r);
|
|
814
|
+
result.g += (m[6] * c.g);
|
|
815
|
+
result.g += (m[7] * c.b);
|
|
816
|
+
result.g += (m[8] * c.a);
|
|
817
|
+
result.g += m[9];
|
|
818
|
+
|
|
819
|
+
result.b = (m[10] * c.r);
|
|
820
|
+
result.b += (m[11] * c.g);
|
|
821
|
+
result.b += (m[12] * c.b);
|
|
822
|
+
result.b += (m[13] * c.a);
|
|
823
|
+
result.b += m[14];
|
|
824
|
+
|
|
825
|
+
result.a = (m[15] * c.r);
|
|
826
|
+
result.a += (m[16] * c.g);
|
|
827
|
+
result.a += (m[17] * c.b);
|
|
828
|
+
result.a += (m[18] * c.a);
|
|
829
|
+
result.a += m[19];
|
|
830
|
+
|
|
831
|
+
vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
|
|
832
|
+
|
|
833
|
+
// Premultiply alpha again.
|
|
834
|
+
rgb *= result.a;
|
|
835
|
+
|
|
836
|
+
gl_FragColor = vec4(rgb, result.a);
|
|
837
|
+
}
|
|
838
|
+
`,Gs=function(t){Ny(e,t);function e(){var r=this,i={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};return r=t.call(this,L0,Oy,i)||this,r.alpha=1,r}return e.prototype._loadMatrix=function(r,i){i===void 0&&(i=!1);var n=r;i&&(this._multiply(n,this.uniforms.m,r),n=this._colorMatrix(n)),this.uniforms.m=n},e.prototype._multiply=function(r,i,n){return r[0]=i[0]*n[0]+i[1]*n[5]+i[2]*n[10]+i[3]*n[15],r[1]=i[0]*n[1]+i[1]*n[6]+i[2]*n[11]+i[3]*n[16],r[2]=i[0]*n[2]+i[1]*n[7]+i[2]*n[12]+i[3]*n[17],r[3]=i[0]*n[3]+i[1]*n[8]+i[2]*n[13]+i[3]*n[18],r[4]=i[0]*n[4]+i[1]*n[9]+i[2]*n[14]+i[3]*n[19]+i[4],r[5]=i[5]*n[0]+i[6]*n[5]+i[7]*n[10]+i[8]*n[15],r[6]=i[5]*n[1]+i[6]*n[6]+i[7]*n[11]+i[8]*n[16],r[7]=i[5]*n[2]+i[6]*n[7]+i[7]*n[12]+i[8]*n[17],r[8]=i[5]*n[3]+i[6]*n[8]+i[7]*n[13]+i[8]*n[18],r[9]=i[5]*n[4]+i[6]*n[9]+i[7]*n[14]+i[8]*n[19]+i[9],r[10]=i[10]*n[0]+i[11]*n[5]+i[12]*n[10]+i[13]*n[15],r[11]=i[10]*n[1]+i[11]*n[6]+i[12]*n[11]+i[13]*n[16],r[12]=i[10]*n[2]+i[11]*n[7]+i[12]*n[12]+i[13]*n[17],r[13]=i[10]*n[3]+i[11]*n[8]+i[12]*n[13]+i[13]*n[18],r[14]=i[10]*n[4]+i[11]*n[9]+i[12]*n[14]+i[13]*n[19]+i[14],r[15]=i[15]*n[0]+i[16]*n[5]+i[17]*n[10]+i[18]*n[15],r[16]=i[15]*n[1]+i[16]*n[6]+i[17]*n[11]+i[18]*n[16],r[17]=i[15]*n[2]+i[16]*n[7]+i[17]*n[12]+i[18]*n[17],r[18]=i[15]*n[3]+i[16]*n[8]+i[17]*n[13]+i[18]*n[18],r[19]=i[15]*n[4]+i[16]*n[9]+i[17]*n[14]+i[18]*n[19]+i[19],r},e.prototype._colorMatrix=function(r){var i=new Float32Array(r);return i[4]/=255,i[9]/=255,i[14]/=255,i[19]/=255,i},e.prototype.brightness=function(r,i){var n=[r,0,0,0,0,0,r,0,0,0,0,0,r,0,0,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.tint=function(r,i){var n=r>>16&255,s=r>>8&255,o=r&255,a=[n/255,0,0,0,0,0,s/255,0,0,0,0,0,o/255,0,0,0,0,0,1,0];this._loadMatrix(a,i)},e.prototype.greyscale=function(r,i){var n=[r,r,r,0,0,r,r,r,0,0,r,r,r,0,0,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.blackAndWhite=function(r){var i=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(i,r)},e.prototype.hue=function(r,i){r=(r||0)/180*Math.PI;var n=Math.cos(r),s=Math.sin(r),o=Math.sqrt,a=1/3,l=o(a),h=n+(1-n)*a,u=a*(1-n)-l*s,f=a*(1-n)+l*s,c=a*(1-n)+l*s,d=n+a*(1-n),v=a*(1-n)-l*s,y=a*(1-n)-l*s,m=a*(1-n)+l*s,g=n+a*(1-n),x=[h,u,f,0,0,c,d,v,0,0,y,m,g,0,0,0,0,0,1,0];this._loadMatrix(x,i)},e.prototype.contrast=function(r,i){var n=(r||0)+1,s=-.5*(n-1),o=[n,0,0,0,s,0,n,0,0,s,0,0,n,0,s,0,0,0,1,0];this._loadMatrix(o,i)},e.prototype.saturate=function(r,i){r===void 0&&(r=0);var n=r*2/3+1,s=(n-1)*-.5,o=[n,s,s,0,0,s,n,s,0,0,s,s,n,0,0,0,0,0,1,0];this._loadMatrix(o,i)},e.prototype.desaturate=function(){this.saturate(-1)},e.prototype.negative=function(r){var i=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(i,r)},e.prototype.sepia=function(r){var i=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(i,r)},e.prototype.technicolor=function(r){var i=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(i,r)},e.prototype.polaroid=function(r){var i=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(i,r)},e.prototype.toBGR=function(r){var i=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(i,r)},e.prototype.kodachrome=function(r){var i=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(i,r)},e.prototype.browni=function(r){var i=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(i,r)},e.prototype.vintage=function(r){var i=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(i,r)},e.prototype.colorTone=function(r,i,n,s,o){r=r||.2,i=i||.15,n=n||16770432,s=s||3375104;var a=(n>>16&255)/255,l=(n>>8&255)/255,h=(n&255)/255,u=(s>>16&255)/255,f=(s>>8&255)/255,c=(s&255)/255,d=[.3,.59,.11,0,0,a,l,h,r,0,u,f,c,i,0,a-u,l-f,h-c,0,0];this._loadMatrix(d,o)},e.prototype.night=function(r,i){r=r||.1;var n=[r*-2,-r,0,0,0,-r,0,r,0,0,0,r,r*2,0,0,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.predator=function(r,i){var n=[11.224130630493164*r,-4.794486999511719*r,-2.8746118545532227*r,0*r,.40342438220977783*r,-3.6330697536468506*r,9.193157196044922*r,-2.951810836791992*r,0*r,-1.316135048866272*r,-3.2184197902679443*r,-4.2375030517578125*r,7.476448059082031*r,0*r,.8044459223747253*r,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.lsd=function(r){var i=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(i,r)},e.prototype.reset=function(){var r=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(r,!1)},Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(r){this.uniforms.m=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(r){this.uniforms.uAlpha=r},enumerable:!1,configurable:!0}),e}(zl);Gs.prototype.grayscale=Gs.prototype.greyscale;function Ly(t){return function(r){if(!(this._activeParentLayer&&this._activeParentLayer!==r._activeLayer)){if(!this.visible){this.displayOrder=0;return}this.displayOrder=r.incDisplayOrder(),!(this.worldAlpha<=0||!this.renderable)&&(r._activeLayer=null,t.call(this,r),r._activeLayer=this._activeParentLayer)}}}function My(t){if(!(this._activeParentLayer&&this._activeParentLayer!==t._activeLayer)){if(!this.visible){this.displayOrder=0;return}this.displayOrder=t.incDisplayOrder(),!(this.worldAlpha<=0||!this.renderable)&&(t._activeLayer=null,this.containerRenderWebGL(t),t._activeLayer=this._activeParentLayer)}}function Fy(){if(ee.prototype.displayOrder!==void 0)return;Object.assign(ee.prototype,{parentLayer:null,_activeParentLayer:null,parentGroup:null,zOrder:0,zIndex:0,updateOrder:0,displayOrder:0,layerableChildren:!0,isLayer:!1});const t=mt.prototype;t.containerRenderWebGL=t.render,t.render=My}class Ry{constructor(){this._tempPoint=new X,this._queue=[[],[]],this._eventDisplayOrder=0,this.worksWithLayers=!0}recursiveFindHit(e,r,i,n,s){if(!r||!r.visible)return 0;let o=0,a=n=r.interactive||n;r.hitArea&&(a=!1),r._activeParentLayer&&(s=!1);const l=r._mask;i<1/0&&l&&l.containsPoint&&!l.containsPoint(e)&&(s=!0),i<1/0&&r.filterArea&&(r.filterArea.contains(e.x,e.y)||(s=!0));const h=r.children;if(r.interactiveChildren&&h)for(let u=h.length-1;u>=0;u--){const f=h[u],c=this.recursiveFindHit(e,f,i,a,s);if(c){if(!f.parent)continue;o=c,i=c}}return n&&(s?r.interactive&&this._queueAdd(r,0):(i<r.displayOrder&&(r.hitArea?(r.worldTransform.applyInverse(e,this._tempPoint),r.hitArea.contains(this._tempPoint.x,this._tempPoint.y)&&(o=r.displayOrder)):r.containsPoint&&r.containsPoint(e)&&(o=r.displayOrder)),r.interactive&&this._queueAdd(r,o===1/0?0:o))),o}findHit(e,r,i,n){const s=e.data.global;this._startInteractionProcess(),this.recursiveFindHit(s,r,n?0:1/0,!1,!1),this._finishInteractionProcess(e,i)}_startInteractionProcess(){this._eventDisplayOrder=1,this._queue||(this._queue=[[],[]]),this._queue[0].length=0,this._queue[1].length=0}_queueAdd(e,r){const i=this._queue;if(r<this._eventDisplayOrder)i[0].push(e);else{if(r>this._eventDisplayOrder){this._eventDisplayOrder=r;const n=i[1];for(let s=0,o=n.length;s<o;s++)i[0].push(n[s]);i[1].length=0}i[1].push(e)}}_finishInteractionProcess(e,r){const i=this._queue;let n=i[0];for(let s=0,o=n.length;s<o;s++)r&&r(e,n[s],!1);n=i[1];for(let s=0,o=n.length;s<o;s++)e.target||(e.target=n[s]),r&&r(e,n[s],!0)}}function ky(t){return function(r,i,n,s,o){(!i||!i.renderTexture&&!i.baseTexture)&&(this._lastDisplayOrder=0),this._activeLayer=null,r.isStage&&r.updateStage(),this.plugins.interaction&&!this.plugins.interaction.search.worksWithLayers&&(this.plugins.interaction.search=new Ry),t.call(this,r,i,n,s,o)}}function _h(t){const e=t.prototype;e._oldRender||(Object.assign(e,{_lastDisplayOrder:0,_activeLayer:null,incDisplayOrder(){return++this._lastDisplayOrder},_oldRender:nr.prototype.render}),e._oldRender=e.render,e.render=ky(e.render))}function Uy(t){if(!t){console.log("@pixi/layers: Canvas mixin was called with empty parameter. Are you sure that you even need this line?");return}_h(t);const e=mt.prototype;e.containerRenderCanvas||(e.containerRenderCanvas=e.renderCanvas,e.renderCanvas=Ly(e.renderCanvas))}class St extends ye{constructor(e=0,r=!1){super(),this.useRenderTexture=!1,this.useDoubleBuffer=!1,this.sortPriority=0,this.clearColor=new Float32Array([0,0,0,0]),this.canDrawWithoutLayer=!1,this.canDrawInParentStage=!0,this._activeLayer=null,this._activeStage=null,this._activeChildren=[],this._lastUpdateId=-1,this.zIndex=e||0,this.enableSort=!!r,typeof r=="function"&&this.on("sort",r)}doSort(e,r){if(this.listeners("sort",!0))for(let i=0;i<r.length;i++)this.emit("sort",r[i]);r.sort(St.compareZIndex)}static compareZIndex(e,r){return e.zOrder<r.zOrder?-1:e.zOrder>r.zOrder?1:e.updateOrder-r.updateOrder}clear(){this._activeLayer=null,this._activeStage=null,this._activeChildren.length=0}_resolveChildDisplayObject(e,r){this.check(e),r._activeParentLayer=this._activeLayer,this._activeLayer?this._activeLayer._activeChildren.push(r):this._activeChildren.push(r)}_resolveLayer(e,r){this.check(e),this._activeLayer&&St.conflict(),this._activeLayer=r,this._activeStage=e}check(e){if(this._lastUpdateId<St._layerUpdateId)this._lastUpdateId=St._layerUpdateId,this.clear(),this._activeStage=e;else if(this.canDrawInParentStage){let r=this._activeStage;for(;r&&r!==e;)r=r._activeParentStage;this._activeStage=r,r===null&&this.clear()}}static conflict(){St._lastLayerConflict+5e3<Date.now()&&(St._lastLayerConflict=Date.now(),console.log("@pixi/layers found two layers with the same group in one stage - that's not healthy. Please place a breakpoint here and debug it"))}}St._layerUpdateId=0,St._lastLayerConflict=0;class xh{constructor(e){this.layer=e,this.renderTexture=null,this.doubleBuffer=null,this.currentBufferIndex=0,this._tempRenderTarget=null,this._tempRenderTargetSource=new G,this._tempRenderTargetDestination=new G}init(e){const r=e?e.screen.width:100,i=e?e.screen.height:100,n=e?e.resolution:R.RESOLUTION;this.renderTexture=Ht.create({width:r,height:i,resolution:n}),this.layer.group.useDoubleBuffer&&(this.doubleBuffer=[Ht.create({width:r,height:i,resolution:n}),Ht.create({width:r,height:i,resolution:n})])}getRenderTexture(){return this.renderTexture||this.init(),this.renderTexture}pushTexture(e){const r=e.screen;this.renderTexture||this.init(e);const i=this.renderTexture,n=this.layer.group,s=this.doubleBuffer;if((i.width!==r.width||i.height!==r.height||i.baseTexture.resolution!==e.resolution)&&(i.baseTexture.resolution=e.resolution,i.resize(r.width,r.height),s&&(s[0].baseTexture.resolution=e.resolution,s[0].resize(r.width,r.height),s[1].baseTexture.resolution=e.resolution,s[1].resize(r.width,r.height))),s&&(s[0].framebuffer.multisample=i.framebuffer.multisample,s[1].framebuffer.multisample=i.framebuffer.multisample),this._tempRenderTarget=e.renderTexture.current,this._tempRenderTargetSource.copyFrom(e.renderTexture.sourceFrame),this._tempRenderTargetDestination.copyFrom(e.renderTexture.destinationFrame),e.batch.flush(),n.useDoubleBuffer){let a=s[this.currentBufferIndex];a.baseTexture._glTextures[e.CONTEXT_UID]||(e.renderTexture.bind(a,void 0,void 0),e.texture.bind(a),n.clearColor&&e.renderTexture.clear(n.clearColor)),e.texture.unbind(i.baseTexture),i.baseTexture._glTextures=a.baseTexture._glTextures,i.baseTexture.framebuffer=a.baseTexture.framebuffer,a=s[1-this.currentBufferIndex],e.renderTexture.bind(a,void 0,void 0)}else e.renderTexture.bind(i,void 0,void 0);n.clearColor&&e.renderTexture.clear(n.clearColor);const o=e.filter.defaultFilterStack;o.length>1&&(o[o.length-1].renderTexture=e.renderTexture.current)}popTexture(e){e.batch.flush(),e.framebuffer.blit();const r=e.filter.defaultFilterStack;r.length>1&&(r[r.length-1].renderTexture=this._tempRenderTarget),e.renderTexture.bind(this._tempRenderTarget,this._tempRenderTargetSource,this._tempRenderTargetDestination),this._tempRenderTarget=null;const i=this.renderTexture,n=this.layer.group,s=this.doubleBuffer;if(n.useDoubleBuffer){e.texture.unbind(i.baseTexture),this.currentBufferIndex=1-this.currentBufferIndex;const o=s[this.currentBufferIndex];i.baseTexture._glTextures=o.baseTexture._glTextures,i.baseTexture.framebuffer=o.baseTexture.framebuffer}}destroy(){this.renderTexture&&(this.renderTexture.destroy(),this.doubleBuffer&&(this.doubleBuffer[0].destroy(!0),this.doubleBuffer[1].destroy(!0)))}}class Di extends mt{constructor(e=null){super(),this.isLayer=!0,this.group=null,this._activeChildren=[],this._tempChildren=null,this._activeStageParent=null,this._sortedChildren=[],this._tempLayerParent=null,this.insertChildrenBeforeActive=!0,this.insertChildrenAfterActive=!0,e?(this.group=e,this.zIndex=e.zIndex):this.group=new St(0,!1),this._tempChildren=this.children}get useRenderTexture(){return this.group.useRenderTexture}set useRenderTexture(e){this.group.useRenderTexture=e}get useDoubleBuffer(){return this.group.useDoubleBuffer}set useDoubleBuffer(e){this.group.useDoubleBuffer=e}get clearColor(){return this.group.clearColor}set clearColor(e){this.group.clearColor=e}get sortPriority(){return this.group.sortPriority}set sortPriority(e){this.group.sortPriority=e}getRenderTexture(){return this.textureCache||(this.textureCache=new xh(this)),this.textureCache.getRenderTexture()}doSort(){this.group.doSort(this,this._sortedChildren)}destroy(e){this.textureCache&&(this.textureCache.destroy(),this.textureCache=null),super.destroy(e)}render(e){this.prerender(e)&&(this.group.useRenderTexture&&(this.textureCache||(this.textureCache=new xh(this)),this.textureCache.pushTexture(e)),this.containerRenderWebGL(e),this.postrender(e),this.group.useRenderTexture&&this.textureCache.popTexture(e))}layerRenderCanvas(e){this.prerender(e)&&(this.containerRenderCanvas(e),this.postrender(e))}_onBeginLayerSubtreeTraversal(e){const r=this._activeChildren;this._activeStageParent=e,this.group._resolveLayer(e,this);const i=this.group._activeChildren;r.length=0;for(let n=0;n<i.length;n++)i[n]._activeParentLayer=this,r.push(i[n]);i.length=0}_onEndLayerSubtreeTraversal(){const e=this.children,r=this._activeChildren,i=this._sortedChildren;for(let n=0;n<r.length;n++)this.emit("display",r[n]);if(i.length=0,this.insertChildrenBeforeActive)for(let n=0;n<e.length;n++)i.push(e[n]);for(let n=0;n<r.length;n++)i.push(r[n]);if(!this.insertChildrenBeforeActive&&this.insertChildrenAfterActive)for(let n=0;n<e.length;n++)i.push(e[n]);this.group.enableSort&&this.doSort()}prerender(e){return this._activeParentLayer&&this._activeParentLayer!=e._activeLayer?!1:this.visible?(this.displayOrder=e.incDisplayOrder(),this.worldAlpha<=0||!this.renderable?!1:(this.children!==this._sortedChildren&&this._tempChildren!==this.children&&(this._tempChildren=this.children),this._boundsID++,this.children=this._sortedChildren,this._tempLayerParent=e._activeLayer,e._activeLayer=this,!0)):(this.displayOrder=0,!1)}postrender(e){this.children=this._tempChildren,e._activeLayer=this._tempLayerParent,this._tempLayerParent=null}}Di.prototype.renderCanvas=Di.prototype.layerRenderCanvas;class Vr extends Di{constructor(){super(...arguments),this.isStage=!0,this._tempGroups=[],this._activeLayers=[],this._activeParentStage=null}clear(){this._activeLayers.length=0,this._tempGroups.length=0}destroy(e){this.clear(),super.destroy(e)}updateStage(){this._activeParentStage=null,St._layerUpdateId++,this._updateStageInner()}updateAsChildStage(e){this._activeParentStage=e,Vr._updateOrderCounter=0,this._updateStageInner()}_updateStageInner(){this.clear(),this._addRecursive(this);const e=this._activeLayers;for(let r=0;r<e.length;r++){const i=e[r];if(i.group.sortPriority){i._onEndLayerSubtreeTraversal();const n=i._sortedChildren;for(let s=0;s<n.length;s++)this._addRecursiveChildren(n[s])}}for(let r=0;r<e.length;r++){const i=e[r];i.group.sortPriority||i._onEndLayerSubtreeTraversal()}}_addRecursive(e){if(!e.visible)return;if(e.isLayer){const s=e;this._activeLayers.push(s),s._onBeginLayerSubtreeTraversal(this)}if(e!==this&&e.isStage){e.updateAsChildStage(this);return}e._activeParentLayer=null;let r=e.parentGroup;r&&r._resolveChildDisplayObject(this,e);const i=e.parentLayer;if(i&&(r=i.group,r._resolveChildDisplayObject(this,e)),e.updateOrder=++Vr._updateOrderCounter,e.alpha<=0||!e.renderable||!e.layerableChildren||r&&r.sortPriority)return;const n=e.children;if(n&&n.length)for(let s=0;s<n.length;s++)this._addRecursive(n[s])}_addRecursiveChildren(e){if(e.alpha<=0||!e.renderable||!e.layerableChildren)return;const r=e.children;if(r&&r.length)for(let i=0;i<r.length;i++)this._addRecursive(r[i])}}Vr._updateOrderCounter=0,Fy(),_h(nr);var By={},ie={},ne={},wh;function Hs(){if(wh)return ne;wh=1;var t=jt&&jt.__awaiter||function(o,a,l,h){function u(f){return f instanceof l?f:new l(function(c){c(f)})}return new(l||(l=Promise))(function(f,c){function d(m){try{y(h.next(m))}catch(g){c(g)}}function v(m){try{y(h.throw(m))}catch(g){c(g)}}function y(m){m.done?f(m.value):u(m.value).then(d,v)}y((h=h.apply(o,a||[])).next())})};Object.defineProperty(ne,"__esModule",{value:!0}),ne.SpaceApiError=ne.callSpaceAPIWithConfig=ne.getRequestHeaders=void 0;const e=zs();function r(o){var a;const l=new Headers;switch(o.type){case"secret":l.set("authorization",`AL-Secret-Token ${o.secretAccessToken}`);break;case"temporary":l.set("authorization",`${(a=o.temporaryAccessToken)===null||a===void 0?void 0:a.authorization}`)}return o.sdkVersion&&l.set("x-sdk-version",o.sdkVersion),l}ne.getRequestHeaders=r;function i(o){return o.status>=200&&o.status<400?o:o.json().then(a=>{const l=a?.message||a?.error||a;switch(typeof l){case"string":return Promise.reject(new s(l,o.status,void 0));case"object":return Promise.reject(new s(l.message,o.status,l.data));default:return Promise.reject(new s(null,null,a))}})}function n(o,a,l={},h){return t(this,void 0,void 0,function*(){const u=new URL((0,e.getSpaceApiUrl)()+a),f=r(h);let c=!1;switch(h.type==="publishable"&&u.searchParams.set("pubtoken",h.publishableAccessToken),o){case"GET":l&&typeof l=="object"&&Object.entries(l).forEach(([d,v])=>{typeof v<"u"&&u.searchParams.set(d,v.toString())});break;case"POST":case"PUT":f.set("content-type","application/json"),c=!0;break;case"DELETE":break;default:return Promise.reject(new s("Programming error, unsupported method: "+o,void 0,void 0))}return fetch(u.toString(),{method:o,headers:f,body:c?JSON.stringify(l):void 0}).then(i,d=>{throw d}).then(d=>d.json()).catch(d=>Promise.reject(d))})}ne.callSpaceAPIWithConfig=n;class s extends Error{constructor(a,l,h){super(a||"There was a problem. Please check your internet connection and try again."),this.name="SpaceApiError",this.stack=new Error().stack,this.code=l,this.data=h}}return ne.SpaceApiError=s,ne}var Ph;function zs(){if(Ph)return ie;Ph=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.getTokenConfig=ie.getSpaceApiUrl=ie.setSpaceApiUrl=void 0;const t=Hs();let e="https://api.archilogic.com";const r=s=>{e=s};ie.setSpaceApiUrl=r;const i=()=>e;ie.getSpaceApiUrl=i;function n(s){let o;if(s.secretAccessToken)o={type:"secret",secretAccessToken:s.secretAccessToken};else if(s.temporaryAccessToken||s.temporaryAccessTokenFunction)o={type:"temporary",temporaryAccessToken:s.temporaryAccessToken};else if(s.publishableAccessToken)o={type:"publishable",publishableAccessToken:s.publishableAccessToken};else throw new t.SpaceApiError("Programming error: token is not provided.",void 0,void 0);return s.sdkVersion&&(o.sdkVersion=s.sdkVersion),o}return ie.getTokenConfig=n,ie}var Rr={},Ws=jt&&jt.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(u){try{h(i.next(u))}catch(f){o(f)}}function l(u){try{h(i.throw(u))}catch(f){o(f)}}function h(u){u.done?s(u.value):n(u.value).then(a,l)}h((i=i.apply(t,e||[])).next())})};Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.Connection=void 0;const Dy=zs(),kr=Hs();class Xy{constructor(e){this.tempScopes=[{resource:"floor",action:"readPublic"},{resource:"floor",action:"readPrivate"},{resource:"floor",action:"queryPublic"},{resource:"floor",action:"queryPrivate"},{resource:"floor",action:"archive"},{resource:"customFields",action:"readPublic"},{resource:"customFields",action:"readPrivate"},{resource:"customFields",action:"write"}],this.durationSeconds=3600,this.getTemporaryAccessToken=()=>Ws(this,void 0,void 0,function*(){this.temporaryAccessTokenPromise||(this.temporaryAccessTokenPromise=new Promise((r,i)=>Ws(this,void 0,void 0,function*(){var n;let s=this.initialTemporaryAccessToken;if(s&&s.expiresAt>new Date().getTime()/1e3?r(s):this.initialTemporaryAccessToken=void 0,this.temporaryAccessTokenFunction&&(s=yield(n=this.temporaryAccessTokenFunction)===null||n===void 0?void 0:n.call(this,{scopes:this.tempScopes,durationSeconds:this.durationSeconds}),s&&s.expiresAt>new Date().getTime()/1e3&&r(s)),s){const o=new Date;o.setTime(s.expiresAt*1e3),i(new kr.SpaceApiError(`Temporary access token expired at ${o.toString()}`,void 0,void 0))}else i(new kr.SpaceApiError("Temporary access token not defined",void 0,void 0))})));try{return yield this.temporaryAccessTokenPromise}catch(r){throw this.temporaryAccessTokenPromise=void 0,r}}),this.config=(0,Dy.getTokenConfig)(e),(e.temporaryAccessToken||e.temporaryAccessTokenFunction)&&(this.temporaryAccessTokenFunction=e.temporaryAccessTokenFunction,this.initialTemporaryAccessToken=e.temporaryAccessToken),e.temporaryAccessTokenScopes&&(this.tempScopes=e.temporaryAccessTokenScopes)}callSpaceAPI(e,r,i={},n=this.config){return Ws(this,void 0,void 0,function*(){switch(n.type){case"secret":return(0,kr.callSpaceAPIWithConfig)(e,r,i,n);case"publishable":return(0,kr.callSpaceAPIWithConfig)(e,r,i,n);case"temporary":const s=yield this.getTemporaryAccessToken(),o=Object.assign(Object.assign({},n),{temporaryAccessToken:s});return(0,kr.callSpaceAPIWithConfig)(e,r,i,o)}})}}Rr.Connection=Xy;var Xi={};Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.SpaceAPI=void 0;const Gy=Rr;class Hy{constructor(e,r={}){this.connection=new Gy.Connection(e);for(const[i,n]of Object.entries(r))this[i]=n}getFloorById(e,r=!1,i=!0,n=!1){const s=`?includeRelations=${i}&includeAddress=${n}`;return this.connection.callSpaceAPI("GET",`/v2/floor/${e}/${r?"geo-json":""}${s}`)}getFloorStatistics(e){return this.connection.callSpaceAPI("GET",`/v2/floor/${e}/statistics`)}queryFloors(e){return this.connection.callSpaceAPI("GET","/v2/floor",e)}getFloorplanImage(e,r){return this.connection.callSpaceAPI("POST",`/v2/floor/${e}/2d-image`,r)}getSceneStructure(e,r=!1){return this.connection.callSpaceAPI("GET",`/v2/floor/${e}/scene-structure`,{includeMetadata:r})}assignLabel(e,r){return this.connection.callSpaceAPI("PUT",`/v2/floor/${e}/label/${r}`)}removeLabel(e,r){return this.connection.callSpaceAPI("DELETE",`/v2/floor/${e}/label/${r}`)}getSpaceById(e,r=!1,i=!0){const n=`?includeRelations=${i}`;return this.connection.callSpaceAPI("GET",`/v2/space/${e}/${r?"geo-json":""}${n}`)}querySpaces(e){return this.connection.callSpaceAPI("GET","/v2/space",e)}getAllSpacesByFloorId(e,r=!1,i){return this.querySpaces({floorId:e,geometry:r,includeRelations:i})}getAssetById(e,r=!1,i=!0){const n=`?includeRelations=${i}`;return this.connection.callSpaceAPI("GET",`/v2/asset/${e}/${r?"geo-json":""}${n}`)}queryAssets(e){return this.connection.callSpaceAPI("GET","/v2/asset",e)}getAllAssetsByFloorId(e,r=!1,i){return this.queryAssets({floorId:e,geometry:r,includeRelations:i})}getAllAssetsBySpaceId(e,r=!1,i){return this.queryAssets({spaceId:e,geometry:r,includeRelations:i})}getCustomField(e,r,i){return this.connection.callSpaceAPI("GET",`/v2/${e}/${r}/custom-field/${i}`)}getAllCustomFields(e,r){return this.connection.callSpaceAPI("GET",`/v2/${e}/${r}/custom-field`)}setCustomField(e,r,i,n){return this.connection.callSpaceAPI("PUT",`/v2/${e}/${r}/custom-field/${i}`,n)}deleteCustomField(e,r,i){return this.connection.callSpaceAPI("DELETE",`/v2/${e}/${r}/custom-field/${i}`)}getLabel(e){return this.connection.callSpaceAPI("GET",`/v2/label/${e}`)}listLabels(){return this.connection.callSpaceAPI("GET","/v2/label/")}createOrUpdateLabel(e,r){return this.connection.callSpaceAPI("PUT",`/v2/label/${e}`,r)}deleteLabel(e){return this.connection.callSpaceAPI("DELETE",`/v2/label/${e}`)}}Xi.SpaceAPI=Hy,function(t){var e=jt&&jt.__createBinding||(Object.create?function(i,n,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(n,s);(!a||("get"in a?!n.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return n[s]}}),Object.defineProperty(i,o,a)}:function(i,n,s,o){o===void 0&&(o=s),i[o]=n[s]}),r=jt&&jt.__exportStar||function(i,n){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(n,s)&&e(n,i,s)};Object.defineProperty(t,"__esModule",{value:!0}),r(zs(),t),r(Hs(),t),r(Rr,t),r(Xi,t)}(By);var p={};p.version="6.4.2.2",p.use_lines=!0,p.use_xyz=!1;var bh=function(t,e){var r;if(typeof Object.getOwnPropertyNames>"u"){for(r in e.prototype)(typeof t.prototype[r]>"u"||t.prototype[r]===Object.prototype[r])&&(t.prototype[r]=e.prototype[r]);for(r in e)typeof t[r]>"u"&&(t[r]=e[r]);t.$baseCtor=e}else{for(var i=Object.getOwnPropertyNames(e.prototype),n=0;n<i.length;n++)typeof Object.getOwnPropertyDescriptor(t.prototype,i[n])>"u"&&Object.defineProperty(t.prototype,i[n],Object.getOwnPropertyDescriptor(e.prototype,i[n]));for(r in e)typeof t[r]>"u"&&(t[r]=e[r]);t.$baseCtor=e}};p.Path=function(){return[]},p.Path.prototype.push=Array.prototype.push,p.Paths=function(){return[]},p.Paths.prototype.push=Array.prototype.push,p.PolyNode=function(){this.m_Parent=null,this.m_polygon=new p.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1},p.PolyNode.prototype.IsHoleNode=function(){for(var t=!0,e=this.m_Parent;e!==null;)t=!t,e=e.m_Parent;return t},p.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length},p.PolyNode.prototype.Contour=function(){return this.m_polygon},p.PolyNode.prototype.AddChild=function(t){var e=this.m_Childs.length;this.m_Childs.push(t),t.m_Parent=this,t.m_Index=e},p.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()},p.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},p.PolyNode.prototype.Childs=function(){return this.m_Childs},p.PolyNode.prototype.Parent=function(){return this.m_Parent},p.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},p.PolyTree=function(){this.m_AllPolys=[],p.PolyNode.call(this)},p.PolyTree.prototype.Clear=function(){for(var t=this,e=0,r=this.m_AllPolys.length;e<r;e++)t.m_AllPolys[e]=null;this.m_AllPolys.length=0,this.m_Childs.length=0},p.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null},p.PolyTree.prototype.Total=function(){var t=this.m_AllPolys.length;return t>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&t--,t},bh(p.PolyTree,p.PolyNode),p.Clear=function(t){t.length=0},p.PI=3.141592653589793,p.PI2=2*3.141592653589793,p.FPoint=function(){var t=arguments,e=t.length;if(this.X=0,this.Y=0,p.use_xyz)if(this.Z=0,e===3)this.X=t[0],this.Y=t[1],this.Z=t[2];else if(e===2)this.X=t[0],this.Y=t[1],this.Z=0;else if(e===1)if(t[0]instanceof p.FPoint){var r=t[0];this.X=r.X,this.Y=r.Y,this.Z=0}else{var i=t[0];typeof i.Z>"u"&&(i.Z=0),this.X=i.X,this.Y=i.Y,this.Z=i.Z}else this.X=0,this.Y=0,this.Z=0;else if(e===2)this.X=t[0],this.Y=t[1];else if(e===1)if(t[0]instanceof p.FPoint){var r=t[0];this.X=r.X,this.Y=r.Y}else{var i=t[0];this.X=i.X,this.Y=i.Y}else this.X=0,this.Y=0},p.FPoint.op_Equality=function(t,e){return t.X===e.X&&t.Y===e.Y},p.FPoint.op_Inequality=function(t,e){return t.X!==e.X||t.Y!==e.Y},p.FPoint0=function(){this.X=0,this.Y=0,p.use_xyz&&(this.Z=0)},p.FPoint0.prototype=p.FPoint.prototype,p.FPoint1=function(t){this.X=t.X,this.Y=t.Y,p.use_xyz&&(typeof t.Z>"u"?this.Z=0:this.Z=t.Z)},p.FPoint1.prototype=p.FPoint.prototype,p.FPoint1dp=function(t){this.X=t.X,this.Y=t.Y,p.use_xyz&&(this.Z=0)},p.FPoint1dp.prototype=p.FPoint.prototype,p.FPoint2=function(t,e,r){this.X=t,this.Y=e,p.use_xyz&&(typeof r>"u"?this.Z=0:this.Z=r)},p.FPoint2.prototype=p.FPoint.prototype,p.FRect=function(){var t=arguments,e=t.length;if(e===4)this.left=t[0],this.top=t[1],this.right=t[2],this.bottom=t[3];else if(e===1){var r=t[0];this.left=r.left,this.top=r.top,this.right=r.right,this.bottom=r.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},p.FRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},p.FRect0.prototype=p.FRect.prototype,p.FRect1=function(t){this.left=t.left,this.top=t.top,this.right=t.right,this.bottom=t.bottom},p.FRect1.prototype=p.FRect.prototype,p.FRect4=function(t,e,r,i){this.left=t,this.top=e,this.right=r,this.bottom=i},p.FRect4.prototype=p.FRect.prototype,p.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},p.PolyType={ptSubject:0,ptClip:1},p.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},p.JoinType={jtSquare:0,jtRound:1,jtMiter:2},p.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},p.EdgeSide={esLeft:0,esRight:1},p.Direction={dRightToLeft:0,dLeftToRight:1},p.TEdge=function(){this.Bot=new p.FPoint0,this.Curr=new p.FPoint0,this.Top=new p.FPoint0,this.Delta=new p.FPoint0,this.Dx=0,this.PolyTyp=p.PolyType.ptSubject,this.Side=p.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null},p.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new p.FPoint0},p.MyIntersectNodeSort=function(){},p.MyIntersectNodeSort.Compare=function(t,e){var r=e.Pt.Y-t.Pt.Y;return r>0?1:r<0?-1:0},p.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},p.Scanbeam=function(){this.Y=0,this.Next=null},p.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},p.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},p.OutPt=function(){this.Idx=0,this.Pt=new p.FPoint0,this.Next=null,this.Prev=null},p.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new p.FPoint0},p.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},p.ClipperBase.horizontal=-34e37,p.ClipperBase.Skip=-2,p.ClipperBase.Unassigned=-1,p.ClipperBase.tolerance=1e-20,p.ClipperBase.maxValue=Math.sqrt(Number.MAX_VALUE),p.ClipperBase.minValue=Math.sqrt(Number.MIN_VALUE),p.ClipperBase.near_zero=function(t){return t>-p.ClipperBase.tolerance&&t<p.ClipperBase.tolerance},p.ClipperBase.IsHorizontal=function(t){return t.Delta.Y===0},p.ClipperBase.prototype.PointIsVertex=function(t,e){var r=e;do{if(p.FPoint.op_Equality(r.Pt,t))return!0;r=r.Next}while(r!==e);return!1},p.ClipperBase.prototype.PointOnLineSegment=function(t,e,r){return t.X===e.X&&t.Y===e.Y||t.X===r.X&&t.Y===r.Y||t.X>e.X==t.X<r.X&&t.Y>e.Y==t.Y<r.Y&&(t.X-e.X)*(r.Y-e.Y)===(r.X-e.X)*(t.Y-e.Y)},p.ClipperBase.prototype.PointOnPolygon=function(t,e){for(var r=this,i=e;;){if(r.PointOnLineSegment(t,i.Pt,i.Next.Pt))return!0;if(i=i.Next,i===e)break}return!1},p.ClipperBase.prototype.SlopesEqual=p.ClipperBase.SlopesEqual=function(){var t=arguments,e=t.length,r,i,n,s,o,a;return e===2?(r=t[0],i=t[1],r.Delta.Y*i.Delta.X===r.Delta.X*i.Delta.Y):e===3?(n=t[0],s=t[1],o=t[2],(n.Y-s.Y)*(s.X-o.X)-(n.X-s.X)*(s.Y-o.Y)===0):(n=t[0],s=t[1],o=t[2],a=t[3],(n.Y-s.Y)*(o.X-a.X)-(n.X-s.X)*(o.Y-a.Y)===0)},p.ClipperBase.SlopesEqual3=function(t,e){return t.Delta.Y*e.Delta.X===t.Delta.X*e.Delta.Y},p.ClipperBase.SlopesEqual4=function(t,e,r){return(t.Y-e.Y)*(e.X-r.X)-(t.X-e.X)*(e.Y-r.Y)===0},p.ClipperBase.SlopesEqual5=function(t,e,r,i){return(t.Y-e.Y)*(r.X-i.X)-(t.X-e.X)*(r.Y-i.Y)===0},p.ClipperBase.prototype.Clear=function(){var t=this;this.DisposeLocalMinimaList();for(var e=0,r=this.m_edges.length;e<r;++e){for(var i=0,n=this.m_edges[e].length;i<n;++i)t.m_edges[e][i]=null;p.Clear(t.m_edges[e])}p.Clear(this.m_edges),this.m_HasOpenPaths=!1},p.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(var t=this;this.m_MinimaList!==null;){var e=t.m_MinimaList.Next;t.m_MinimaList=null,t.m_MinimaList=e}this.m_CurrentLM=null},p.ClipperBase.prototype.RangeTest=function(t){(t.X>p.ClipperBase.maxValue||t.X<-p.ClipperBase.maxValue||t.Y>p.ClipperBase.maxValue||t.Y<-p.ClipperBase.maxValue||t.X>0&&t.X<p.ClipperBase.minValue||t.Y>0&&t.Y<p.ClipperBase.minValue||t.X<0&&t.X>-p.ClipperBase.minValue||t.Y<0&&t.Y>-p.ClipperBase.minValue)&&p.Error("Coordinate outside allowed range in RangeTest().")},p.ClipperBase.prototype.InitEdge=function(t,e,r,i){t.Next=e,t.Prev=r,t.Curr.X=i.X,t.Curr.Y=i.Y,p.use_xyz&&(t.Curr.Z=i.Z),t.OutIdx=-1},p.ClipperBase.prototype.InitEdge2=function(t,e){t.Curr.Y>=t.Next.Curr.Y?(t.Bot.X=t.Curr.X,t.Bot.Y=t.Curr.Y,p.use_xyz&&(t.Bot.Z=t.Curr.Z),t.Top.X=t.Next.Curr.X,t.Top.Y=t.Next.Curr.Y,p.use_xyz&&(t.Top.Z=t.Next.Curr.Z)):(t.Top.X=t.Curr.X,t.Top.Y=t.Curr.Y,p.use_xyz&&(t.Top.Z=t.Curr.Z),t.Bot.X=t.Next.Curr.X,t.Bot.Y=t.Next.Curr.Y,p.use_xyz&&(t.Bot.Z=t.Next.Curr.Z)),this.SetDx(t),t.PolyTyp=e},p.ClipperBase.prototype.FindNextLocMin=function(t){for(var e;;){for(;p.FPoint.op_Inequality(t.Bot,t.Prev.Bot)||p.FPoint.op_Equality(t.Curr,t.Top);)t=t.Next;if(t.Dx!==p.ClipperBase.horizontal&&t.Prev.Dx!==p.ClipperBase.horizontal)break;for(;t.Prev.Dx===p.ClipperBase.horizontal;)t=t.Prev;for(e=t;t.Dx===p.ClipperBase.horizontal;)t=t.Next;if(t.Top.Y!==t.Prev.Bot.Y){e.Prev.Bot.X<t.Bot.X&&(t=e);break}}return t},p.ClipperBase.prototype.ProcessBound=function(t,e){var r=this,i,n=t,s;if(n.OutIdx===p.ClipperBase.Skip){if(t=n,e){for(;t.Top.Y===t.Next.Bot.Y;)t=t.Next;for(;t!==n&&t.Dx===p.ClipperBase.horizontal;)t=t.Prev}else{for(;t.Top.Y===t.Prev.Bot.Y;)t=t.Prev;for(;t!==n&&t.Dx===p.ClipperBase.horizontal;)t=t.Next}if(t===n)e?n=t.Next:n=t.Prev;else{e?t=n.Next:t=n.Prev;var o=new p.LocalMinima;o.Next=null,o.Y=t.Bot.Y,o.LeftBound=null,o.RightBound=t,t.WindDelta=0,n=this.ProcessBound(t,e),this.InsertLocalMinima(o)}return n}if(t.Dx===p.ClipperBase.horizontal&&(e?i=t.Prev:i=t.Next,i.Dx===p.ClipperBase.horizontal?i.Bot.X!==t.Bot.X&&i.Top.X!==t.Bot.X&&this.ReverseHorizontal(t):i.Bot.X!==t.Bot.X&&this.ReverseHorizontal(t)),i=t,e){for(;n.Top.Y===n.Next.Bot.Y&&n.Next.OutIdx!==p.ClipperBase.Skip;)n=n.Next;if(n.Dx===p.ClipperBase.horizontal&&n.Next.OutIdx!==p.ClipperBase.Skip){for(s=n;s.Prev.Dx===p.ClipperBase.horizontal;)s=s.Prev;s.Prev.Top.X>n.Next.Top.X&&(n=s.Prev)}for(;t!==n;)t.NextInLML=t.Next,t.Dx===p.ClipperBase.horizontal&&t!==i&&t.Bot.X!==t.Prev.Top.X&&r.ReverseHorizontal(t),t=t.Next;t.Dx===p.ClipperBase.horizontal&&t!==i&&t.Bot.X!==t.Prev.Top.X&&this.ReverseHorizontal(t),n=n.Next}else{for(;n.Top.Y===n.Prev.Bot.Y&&n.Prev.OutIdx!==p.ClipperBase.Skip;)n=n.Prev;if(n.Dx===p.ClipperBase.horizontal&&n.Prev.OutIdx!==p.ClipperBase.Skip){for(s=n;s.Next.Dx===p.ClipperBase.horizontal;)s=s.Next;(s.Next.Top.X===n.Prev.Top.X||s.Next.Top.X>n.Prev.Top.X)&&(n=s.Next)}for(;t!==n;)t.NextInLML=t.Prev,t.Dx===p.ClipperBase.horizontal&&t!==i&&t.Bot.X!==t.Next.Top.X&&r.ReverseHorizontal(t),t=t.Prev;t.Dx===p.ClipperBase.horizontal&&t!==i&&t.Bot.X!==t.Next.Top.X&&this.ReverseHorizontal(t),n=n.Prev}return n},p.ClipperBase.prototype.AddPath=function(t,e,r){var i=this;p.use_lines?!r&&e===p.PolyType.ptClip&&p.Error("AddPath: Open paths must be subject."):r||p.Error("AddPath: Open paths have been disabled.");var n=t.length-1;if(r)for(;n>0&&p.FPoint.op_Equality(t[n],t[0]);)--n;for(;n>0&&p.FPoint.op_Equality(t[n],t[n-1]);)--n;if(r&&n<2||!r&&n<1)return!1;for(var s=new Array,o=0;o<=n;o++)s.push(new p.TEdge);var a=!0;s[1].Curr.X=t[1].X,s[1].Curr.Y=t[1].Y,p.use_xyz&&(s[1].Curr.Z=t[1].Z),this.RangeTest(t[0]),this.RangeTest(t[n]),this.InitEdge(s[0],s[1],s[n],t[0]),this.InitEdge(s[n],s[0],s[n-1],t[n]);for(var o=n-1;o>=1;--o)i.RangeTest(t[o]),i.InitEdge(s[o],s[o+1],s[o-1],t[o]);for(var l=s[0],h=l,u=l;;){if(h.Curr===h.Next.Curr&&(r||h.Next!==l)){if(h===h.Next)break;h===l&&(l=h.Next),h=i.RemoveEdge(h),u=h;continue}if(h.Prev===h.Next)break;if(r&&p.ClipperBase.SlopesEqual4(h.Prev.Curr,h.Curr,h.Next.Curr)&&(!i.PreserveCollinear||!i.Pt2IsBetweenPt1AndPt3(h.Prev.Curr,h.Curr,h.Next.Curr))){h===l&&(l=h.Next),h=i.RemoveEdge(h),h=h.Prev,u=h;continue}if(h=h.Next,h===u||!r&&h.Next===l)break}if(!r&&h===h.Next||r&&h.Prev===h.Next)return!1;r||(this.m_HasOpenPaths=!0,l.Prev.OutIdx=p.ClipperBase.Skip),h=l;do i.InitEdge2(h,e),h=h.Next,a&&h.Curr.Y!==l.Curr.Y&&(a=!1);while(h!==l);if(a){if(r)return!1;h.Prev.OutIdx=p.ClipperBase.Skip;var f=new p.LocalMinima;for(f.Next=null,f.Y=h.Bot.Y,f.LeftBound=null,f.RightBound=h,f.RightBound.Side=p.EdgeSide.esRight,f.RightBound.WindDelta=0;h.Bot.X!==h.Prev.Top.X&&i.ReverseHorizontal(h),h.Next.OutIdx!==p.ClipperBase.Skip;)h.NextInLML=h.Next,h=h.Next;return this.InsertLocalMinima(f),this.m_edges.push(s),!0}this.m_edges.push(s);var c,d=null;for(p.FPoint.op_Equality(h.Prev.Bot,h.Prev.Top)&&(h=h.Next);h=i.FindNextLocMin(h),h!==d;){d===null&&(d=h);var f=new p.LocalMinima;f.Next=null,f.Y=h.Bot.Y,h.Dx<h.Prev.Dx?(f.LeftBound=h.Prev,f.RightBound=h,c=!1):(f.LeftBound=h,f.RightBound=h.Prev,c=!0),f.LeftBound.Side=p.EdgeSide.esLeft,f.RightBound.Side=p.EdgeSide.esRight,r?f.LeftBound.Next===f.RightBound?f.LeftBound.WindDelta=-1:f.LeftBound.WindDelta=1:f.LeftBound.WindDelta=0,f.RightBound.WindDelta=-f.LeftBound.WindDelta,h=i.ProcessBound(f.LeftBound,c),h.OutIdx===p.ClipperBase.Skip&&(h=i.ProcessBound(h,c));var v=i.ProcessBound(f.RightBound,!c);v.OutIdx===p.ClipperBase.Skip&&(v=i.ProcessBound(v,!c)),f.LeftBound.OutIdx===p.ClipperBase.Skip?f.LeftBound=null:f.RightBound.OutIdx===p.ClipperBase.Skip&&(f.RightBound=null),i.InsertLocalMinima(f),c||(h=v)}return!0},p.ClipperBase.prototype.AddPaths=function(t,e,r){for(var i=this,n=!1,s=0,o=t.length;s<o;++s)i.AddPath(t[s],e,r)&&(n=!0);return n},p.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(t,e,r){return p.FPoint.op_Equality(t,r)||p.FPoint.op_Equality(t,e)||p.FPoint.op_Equality(r,e)?!1:t.X!==r.X?e.X>t.X==e.X<r.X:e.Y>t.Y==e.Y<r.Y},p.ClipperBase.prototype.RemoveEdge=function(t){t.Prev.Next=t.Next,t.Next.Prev=t.Prev;var e=t.Next;return t.Prev=null,e},p.ClipperBase.prototype.SetDx=function(t){t.Delta.X=t.Top.X-t.Bot.X,t.Delta.Y=t.Top.Y-t.Bot.Y,t.Delta.Y===0?t.Dx=p.ClipperBase.horizontal:t.Dx=t.Delta.X/t.Delta.Y},p.ClipperBase.prototype.InsertLocalMinima=function(t){if(this.m_MinimaList===null)this.m_MinimaList=t;else if(t.Y>=this.m_MinimaList.Y)t.Next=this.m_MinimaList,this.m_MinimaList=t;else{for(var e=this.m_MinimaList;e.Next!==null&&t.Y<e.Next.Y;)e=e.Next;t.Next=e.Next,e.Next=t}},p.ClipperBase.prototype.PopLocalMinima=function(t,e){return e.v=this.m_CurrentLM,this.m_CurrentLM!==null&&this.m_CurrentLM.Y===t?(this.m_CurrentLM=this.m_CurrentLM.Next,!0):!1},p.ClipperBase.prototype.ReverseHorizontal=function(t){var e=t.Top.X;t.Top.X=t.Bot.X,t.Bot.X=e,p.use_xyz&&(e=t.Top.Z,t.Top.Z=t.Bot.Z,t.Bot.Z=e)},p.ClipperBase.prototype.Reset=function(){var t=this;if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!==null){this.m_Scanbeam=null;for(var e=this.m_MinimaList;e!==null;){t.InsertScanbeam(e.Y);var r=e.LeftBound;r!==null&&(r.Curr.X=r.Bot.X,r.Curr.Y=r.Bot.Y,p.use_xyz&&(r.Curr.Z=r.Bot.Z),r.OutIdx=p.ClipperBase.Unassigned),r=e.RightBound,r!==null&&(r.Curr.X=r.Bot.X,r.Curr.Y=r.Bot.Y,p.use_xyz&&(r.Curr.Z=r.Bot.Z),r.OutIdx=p.ClipperBase.Unassigned),e=e.Next}this.m_ActiveEdges=null}},p.ClipperBase.prototype.InsertScanbeam=function(t){if(this.m_Scanbeam===null)this.m_Scanbeam=new p.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=t;else if(t>this.m_Scanbeam.Y){var e=new p.Scanbeam;e.Y=t,e.Next=this.m_Scanbeam,this.m_Scanbeam=e}else{for(var r=this.m_Scanbeam;r.Next!==null&&t<=r.Next.Y;)r=r.Next;if(t===r.Y)return;var i=new p.Scanbeam;i.Y=t,i.Next=r.Next,r.Next=i}},p.ClipperBase.prototype.PopScanbeam=function(t){return this.m_Scanbeam===null?(t.v=0,!1):(t.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},p.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null},p.ClipperBase.prototype.CreateOutRec=function(){var t=new p.OutRec;return t.Idx=p.ClipperBase.Unassigned,t.IsHole=!1,t.IsOpen=!1,t.FirstLeft=null,t.Pts=null,t.BottomPt=null,t.PolyNode=null,this.m_PolyOuts.push(t),t.Idx=this.m_PolyOuts.length-1,t},p.ClipperBase.prototype.DisposeOutRec=function(t){var e=this.m_PolyOuts[t];e.Pts=null,e=null,this.m_PolyOuts[t]=null},p.ClipperBase.prototype.UpdateEdgeIntoAEL=function(t){t.NextInLML===null&&p.Error("UpdateEdgeIntoAEL: invalid call");var e=t.PrevInAEL,r=t.NextInAEL;return t.NextInLML.OutIdx=t.OutIdx,e!==null?e.NextInAEL=t.NextInLML:this.m_ActiveEdges=t.NextInLML,r!==null&&(r.PrevInAEL=t.NextInLML),t.NextInLML.Side=t.Side,t.NextInLML.WindDelta=t.WindDelta,t.NextInLML.WindCnt=t.WindCnt,t.NextInLML.WindCnt2=t.WindCnt2,t=t.NextInLML,t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.PrevInAEL=e,t.NextInAEL=r,p.ClipperBase.IsHorizontal(t)||this.InsertScanbeam(t.Top.Y),t},p.ClipperBase.prototype.SwapPositionsInAEL=function(t,e){if(!(t.NextInAEL===t.PrevInAEL||e.NextInAEL===e.PrevInAEL)){if(t.NextInAEL===e){var r=e.NextInAEL;r!==null&&(r.PrevInAEL=t);var i=t.PrevInAEL;i!==null&&(i.NextInAEL=e),e.PrevInAEL=i,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=r}else if(e.NextInAEL===t){var n=t.NextInAEL;n!==null&&(n.PrevInAEL=e);var s=e.PrevInAEL;s!==null&&(s.NextInAEL=t),t.PrevInAEL=s,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=n}else{var o=t.NextInAEL,a=t.PrevInAEL;t.NextInAEL=e.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=e.PrevInAEL,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t),e.NextInAEL=o,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=a,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e)}t.PrevInAEL===null?this.m_ActiveEdges=t:e.PrevInAEL===null&&(this.m_ActiveEdges=e)}},p.ClipperBase.prototype.DeleteFromAEL=function(t){var e=t.PrevInAEL,r=t.NextInAEL;e===null&&r===null&&t!==this.m_ActiveEdges||(e!==null?e.NextInAEL=r:this.m_ActiveEdges=r,r!==null&&(r.PrevInAEL=e),t.NextInAEL=null,t.PrevInAEL=null)},p.Clipper=function(t){typeof t>"u"&&(t=0),this.m_PolyOuts=null,this.m_ClipType=p.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=p.PolyFillType.pftEvenOdd,this.m_SubjFillType=p.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,p.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=p.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&t)!==0,this.StrictlySimple=(2&t)!==0,this.PreserveCollinear=(4&t)!==0,p.use_xyz&&(this.ZFillFunction=null)},p.Clipper.ioReverseSolution=1,p.Clipper.ioStrictlySimple=2,p.Clipper.ioPreserveCollinear=4,p.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),p.ClipperBase.prototype.Clear.call(this))},p.Clipper.prototype.InsertMaxima=function(t){var e=new p.Maxima;if(e.X=t,this.m_Maxima===null)this.m_Maxima=e,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(t<this.m_Maxima.X)e.Next=this.m_Maxima,e.Prev=null,this.m_Maxima=e;else{for(var r=this.m_Maxima;r.Next!==null&&t>=r.Next.X;)r=r.Next;if(t===r.X)return;e.Next=r.Next,e.Prev=r,r.Next!==null&&(r.Next.Prev=e),r.Next=e}},p.Clipper.prototype.Execute=function(){var t=arguments,e=t.length,r=t[1]instanceof p.PolyTree;if(e===4&&!r){var i=t[0],n=t[1],s=t[2],o=t[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&p.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,p.Clear(n),this.m_SubjFillType=s,this.m_ClipFillType=o,this.m_ClipType=i,this.m_UsingPolyTree=!1;try{var a=this.ExecuteInternal();a&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return a}else if(e===4&&r){var i=t[0],l=t[1],s=t[2],o=t[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=s,this.m_ClipFillType=o,this.m_ClipType=i,this.m_UsingPolyTree=!0;try{var a=this.ExecuteInternal();a&&this.BuildResult2(l)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return a}else if(e===2&&!r){var i=t[0],n=t[1];return this.Execute(i,n,p.PolyFillType.pftEvenOdd,p.PolyFillType.pftEvenOdd)}else if(e===2&&r){var i=t[0],l=t[1];return this.Execute(i,l,p.PolyFillType.pftEvenOdd,p.PolyFillType.pftEvenOdd)}},p.Clipper.prototype.FixHoleLinkage=function(t){if(!(t.FirstLeft===null||t.IsHole!==t.FirstLeft.IsHole&&t.FirstLeft.Pts!==null)){for(var e=t.FirstLeft;e!==null&&(e.IsHole===t.IsHole||e.Pts===null);)e=e.FirstLeft;t.FirstLeft=e}},p.Clipper.prototype.ExecuteInternal=function(){var t=this;try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var e={},r={};if(!this.PopScanbeam(e))return!1;for(this.InsertLocalMinimaIntoAEL(e.v);this.PopScanbeam(r)||this.LocalMinimaPending();){if(t.ProcessHorizontals(),t.m_GhostJoins.length=0,!t.ProcessIntersections(r.v))return!1;t.ProcessEdgesAtTopOfScanbeam(r.v),e.v=r.v,t.InsertLocalMinimaIntoAEL(e.v)}var i,n,s;for(n=0,s=this.m_PolyOuts.length;n<s;n++)i=t.m_PolyOuts[n],!(i.Pts===null||i.IsOpen)&&(i.IsHole^t.ReverseSolution)==t.Area$1(i)>0&&t.ReversePolyPtLinks(i.Pts);for(this.JoinCommonEdges(),n=0,s=this.m_PolyOuts.length;n<s;n++)i=t.m_PolyOuts[n],i.Pts!==null&&(i.IsOpen?t.FixupOutPolyline(i):t.FixupOutPolygon(i));return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0}},p.Clipper.prototype.DisposeAllPolyPts=function(){for(var t=this,e=0,r=this.m_PolyOuts.length;e<r;++e)t.DisposeOutRec(e);p.Clear(this.m_PolyOuts)},p.Clipper.prototype.AddJoin=function(t,e,r){var i=new p.Join;i.OutPt1=t,i.OutPt2=e,i.OffPt.X=r.X,i.OffPt.Y=r.Y,p.use_xyz&&(i.OffPt.Z=r.Z),this.m_Joins.push(i)},p.Clipper.prototype.AddGhostJoin=function(t,e){var r=new p.Join;r.OutPt1=t,r.OffPt.X=e.X,r.OffPt.Y=e.Y,p.use_xyz&&(r.OffPt.Z=e.Z),this.m_GhostJoins.push(r)},p.Clipper.prototype.SetZ=function(t,e,r){if(this.ZFillFunction!==null){if(t.Z!==0||this.ZFillFunction===null)return;p.FPoint.op_Equality(t,e.Bot)?t.Z=e.Bot.Z:p.FPoint.op_Equality(t,e.Top)?t.Z=e.Top.Z:p.FPoint.op_Equality(t,r.Bot)?t.Z=r.Bot.Z:p.FPoint.op_Equality(t,r.Top)?t.Z=r.Top.Z:this.ZFillFunction(e.Bot,e.Top,r.Bot,r.Top,t)}},p.Clipper.prototype.InsertLocalMinimaIntoAEL=function(t){for(var e=this,r={},i,n;this.PopLocalMinima(t,r);){i=r.v.LeftBound,n=r.v.RightBound;var s=null;if(i===null?(e.InsertEdgeIntoAEL(n,null),e.SetWindingCount(n),e.IsContributing(n)&&(s=e.AddOutPt(n,n.Bot))):n===null?(e.InsertEdgeIntoAEL(i,null),e.SetWindingCount(i),e.IsContributing(i)&&(s=e.AddOutPt(i,i.Bot)),e.InsertScanbeam(i.Top.Y)):(e.InsertEdgeIntoAEL(i,null),e.InsertEdgeIntoAEL(n,i),e.SetWindingCount(i),n.WindCnt=i.WindCnt,n.WindCnt2=i.WindCnt2,e.IsContributing(i)&&(s=e.AddLocalMinPoly(i,n,i.Bot)),e.InsertScanbeam(i.Top.Y)),n!==null&&(p.ClipperBase.IsHorizontal(n)?(n.NextInLML!==null&&e.InsertScanbeam(n.NextInLML.Top.Y),e.AddEdgeToSEL(n)):e.InsertScanbeam(n.Top.Y)),!(i===null||n===null)){if(s!==null&&p.ClipperBase.IsHorizontal(n)&&e.m_GhostJoins.length>0&&n.WindDelta!==0)for(var o=0,a=this.m_GhostJoins.length;o<a;o++){var l=e.m_GhostJoins[o];e.HorzSegmentsOverlap(l.OutPt1.Pt.X,l.OffPt.X,n.Bot.X,n.Top.X)&&e.AddJoin(l.OutPt1,s,l.OffPt)}if(i.OutIdx>=0&&i.PrevInAEL!==null&&i.PrevInAEL.Curr.X===i.Bot.X&&i.PrevInAEL.OutIdx>=0&&p.ClipperBase.SlopesEqual5(i.PrevInAEL.Curr,i.PrevInAEL.Top,i.Curr,i.Top)&&i.WindDelta!==0&&i.PrevInAEL.WindDelta!==0){var h=e.AddOutPt(i.PrevInAEL,i.Bot);e.AddJoin(s,h,i.Top)}if(i.NextInAEL!==n){if(n.OutIdx>=0&&n.PrevInAEL.OutIdx>=0&&p.ClipperBase.SlopesEqual5(n.PrevInAEL.Curr,n.PrevInAEL.Top,n.Curr,n.Top)&&n.WindDelta!==0&&n.PrevInAEL.WindDelta!==0){var h=e.AddOutPt(n.PrevInAEL,n.Bot);e.AddJoin(s,h,n.Top)}var u=i.NextInAEL;if(u!==null)for(;u!==n;)e.IntersectEdges(n,u,i.Curr),u=u.NextInAEL}}}},p.Clipper.prototype.InsertEdgeIntoAEL=function(t,e){if(this.m_ActiveEdges===null)t.PrevInAEL=null,t.NextInAEL=null,this.m_ActiveEdges=t;else if(e===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,t))t.PrevInAEL=null,t.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=t,this.m_ActiveEdges=t;else{for(e===null&&(e=this.m_ActiveEdges);e.NextInAEL!==null&&!this.E2InsertsBeforeE1(e.NextInAEL,t);)e=e.NextInAEL;t.NextInAEL=e.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=t),t.PrevInAEL=e,e.NextInAEL=t}},p.Clipper.prototype.E2InsertsBeforeE1=function(t,e){return e.Curr.X===t.Curr.X?e.Top.Y>t.Top.Y?e.Top.X<p.Clipper.TopX(t,e.Top.Y):t.Top.X>p.Clipper.TopX(e,t.Top.Y):e.Curr.X<t.Curr.X},p.Clipper.prototype.IsEvenOddFillType=function(t){return t.PolyTyp===p.PolyType.ptSubject?this.m_SubjFillType===p.PolyFillType.pftEvenOdd:this.m_ClipFillType===p.PolyFillType.pftEvenOdd},p.Clipper.prototype.IsEvenOddAltFillType=function(t){return t.PolyTyp===p.PolyType.ptSubject?this.m_ClipFillType===p.PolyFillType.pftEvenOdd:this.m_SubjFillType===p.PolyFillType.pftEvenOdd},p.Clipper.prototype.IsContributing=function(t){var e,r;switch(t.PolyTyp===p.PolyType.ptSubject?(e=this.m_SubjFillType,r=this.m_ClipFillType):(e=this.m_ClipFillType,r=this.m_SubjFillType),e){case p.PolyFillType.pftEvenOdd:if(t.WindDelta===0&&t.WindCnt!==1)return!1;break;case p.PolyFillType.pftNonZero:if(Math.abs(t.WindCnt)!==1)return!1;break;case p.PolyFillType.pftPositive:if(t.WindCnt!==1)return!1;break;default:if(t.WindCnt!==-1)return!1;break}switch(this.m_ClipType){case p.ClipType.ctIntersection:switch(r){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return t.WindCnt2!==0;case p.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case p.ClipType.ctUnion:switch(r){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return t.WindCnt2===0;case p.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}case p.ClipType.ctDifference:if(t.PolyTyp===p.PolyType.ptSubject)switch(r){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return t.WindCnt2===0;case p.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else switch(r){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return t.WindCnt2!==0;case p.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case p.ClipType.ctXor:if(t.WindDelta===0)switch(r){case p.PolyFillType.pftEvenOdd:case p.PolyFillType.pftNonZero:return t.WindCnt2===0;case p.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else return!0}return!0},p.Clipper.prototype.SetWindingCount=function(t){for(var e=t.PrevInAEL;e!==null&&(e.PolyTyp!==t.PolyTyp||e.WindDelta===0);)e=e.PrevInAEL;if(e===null){var r=t.PolyTyp===p.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;t.WindDelta===0?t.WindCnt=r===p.PolyFillType.pftNegative?-1:1:t.WindCnt=t.WindDelta,t.WindCnt2=0,e=this.m_ActiveEdges}else if(t.WindDelta===0&&this.m_ClipType!==p.ClipType.ctUnion)t.WindCnt=1,t.WindCnt2=e.WindCnt2,e=e.NextInAEL;else if(this.IsEvenOddFillType(t)){if(t.WindDelta===0){for(var i=!0,n=e.PrevInAEL;n!==null;)n.PolyTyp===e.PolyTyp&&n.WindDelta!==0&&(i=!i),n=n.PrevInAEL;t.WindCnt=i?0:1}else t.WindCnt=t.WindDelta;t.WindCnt2=e.WindCnt2,e=e.NextInAEL}else e.WindCnt*e.WindDelta<0?Math.abs(e.WindCnt)>1?e.WindDelta*t.WindDelta<0?t.WindCnt=e.WindCnt:t.WindCnt=e.WindCnt+t.WindDelta:t.WindCnt=t.WindDelta===0?1:t.WindDelta:t.WindDelta===0?t.WindCnt=e.WindCnt<0?e.WindCnt-1:e.WindCnt+1:e.WindDelta*t.WindDelta<0?t.WindCnt=e.WindCnt:t.WindCnt=e.WindCnt+t.WindDelta,t.WindCnt2=e.WindCnt2,e=e.NextInAEL;if(this.IsEvenOddAltFillType(t))for(;e!==t;)e.WindDelta!==0&&(t.WindCnt2=t.WindCnt2===0?1:0),e=e.NextInAEL;else for(;e!==t;)t.WindCnt2+=e.WindDelta,e=e.NextInAEL},p.Clipper.prototype.AddEdgeToSEL=function(t){this.m_SortedEdges===null?(this.m_SortedEdges=t,t.PrevInSEL=null,t.NextInSEL=null):(t.NextInSEL=this.m_SortedEdges,t.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=t,this.m_SortedEdges=t)},p.Clipper.prototype.PopEdgeFromSEL=function(t){if(t.v=this.m_SortedEdges,t.v===null)return!1;var e=t.v;return this.m_SortedEdges=t.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),e.NextInSEL=null,e.PrevInSEL=null,!0},p.Clipper.prototype.CopyAELToSEL=function(){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;t!==null;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t=t.NextInAEL},p.Clipper.prototype.SwapPositionsInSEL=function(t,e){if(!(t.NextInSEL===null&&t.PrevInSEL===null)&&!(e.NextInSEL===null&&e.PrevInSEL===null)){if(t.NextInSEL===e){var r=e.NextInSEL;r!==null&&(r.PrevInSEL=t);var i=t.PrevInSEL;i!==null&&(i.NextInSEL=e),e.PrevInSEL=i,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=r}else if(e.NextInSEL===t){var r=t.NextInSEL;r!==null&&(r.PrevInSEL=e);var i=e.PrevInSEL;i!==null&&(i.NextInSEL=t),t.PrevInSEL=i,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=r}else{var r=t.NextInSEL,i=t.PrevInSEL;t.NextInSEL=e.NextInSEL,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=e.PrevInSEL,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t),e.NextInSEL=r,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=i,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e)}t.PrevInSEL===null?this.m_SortedEdges=t:e.PrevInSEL===null&&(this.m_SortedEdges=e)}},p.Clipper.prototype.AddLocalMaxPoly=function(t,e,r){this.AddOutPt(t,r),e.WindDelta===0&&this.AddOutPt(e,r),t.OutIdx===e.OutIdx?(t.OutIdx=-1,e.OutIdx=-1):t.OutIdx<e.OutIdx?this.AppendPolygon(t,e):this.AppendPolygon(e,t)},p.Clipper.prototype.AddLocalMinPoly=function(t,e,r){var i,n,s;if(p.ClipperBase.IsHorizontal(e)||t.Dx>e.Dx?(i=this.AddOutPt(t,r),e.OutIdx=t.OutIdx,t.Side=p.EdgeSide.esLeft,e.Side=p.EdgeSide.esRight,n=t,n.PrevInAEL===e?s=e.PrevInAEL:s=n.PrevInAEL):(i=this.AddOutPt(e,r),t.OutIdx=e.OutIdx,t.Side=p.EdgeSide.esRight,e.Side=p.EdgeSide.esLeft,n=e,n.PrevInAEL===t?s=t.PrevInAEL:s=n.PrevInAEL),s!==null&&s.OutIdx>=0&&s.Top.Y<r.Y&&n.Top.Y<r.Y){var o=p.Clipper.TopX(s,r.Y),a=p.Clipper.TopX(n,r.Y);if(o===a&&n.WindDelta!==0&&s.WindDelta!==0&&p.ClipperBase.SlopesEqual5(new p.FPoint2(o,r.Y),s.Top,new p.FPoint2(a,r.Y),n.Top)){var l=this.AddOutPt(s,r);this.AddJoin(i,l,n.Top)}}return i},p.Clipper.prototype.AddOutPt=function(t,e){if(t.OutIdx<0){var r=this.CreateOutRec();r.IsOpen=t.WindDelta===0;var i=new p.OutPt;return r.Pts=i,i.Idx=r.Idx,i.Pt.X=e.X,i.Pt.Y=e.Y,p.use_xyz&&(i.Pt.Z=e.Z),i.Next=i,i.Prev=i,r.IsOpen||this.SetHoleState(t,r),t.OutIdx=r.Idx,i}else{var r=this.m_PolyOuts[t.OutIdx],n=r.Pts,s=t.Side===p.EdgeSide.esLeft;if(s&&p.FPoint.op_Equality(e,n.Pt))return n;if(!s&&p.FPoint.op_Equality(e,n.Prev.Pt))return n.Prev;var i=new p.OutPt;return i.Idx=r.Idx,i.Pt.X=e.X,i.Pt.Y=e.Y,p.use_xyz&&(i.Pt.Z=e.Z),i.Next=n,i.Prev=n.Prev,i.Prev.Next=i,n.Prev=i,s&&(r.Pts=i),i}},p.Clipper.prototype.GetLastOutPt=function(t){var e=this.m_PolyOuts[t.OutIdx];return t.Side===p.EdgeSide.esLeft?e.Pts:e.Pts.Prev},p.Clipper.prototype.SwapPoints=function(t,e){var r=new p.FPoint1(t.Value);t.Value.X=e.Value.X,t.Value.Y=e.Value.Y,p.use_xyz&&(t.Value.Z=e.Value.Z),e.Value.X=r.X,e.Value.Y=r.Y,p.use_xyz&&(e.Value.Z=r.Z)},p.Clipper.prototype.HorzSegmentsOverlap=function(t,e,r,i){var n;return t>e&&(n=t,t=e,e=n),r>i&&(n=r,r=i,i=n),t<i&&r<e},p.Clipper.prototype.SetHoleState=function(t,e){for(var r=t.PrevInAEL,i=null;r!==null;)r.OutIdx>=0&&r.WindDelta!==0&&(i===null?i=r:i.OutIdx===r.OutIdx&&(i=null)),r=r.PrevInAEL;i===null?(e.FirstLeft=null,e.IsHole=!1):(e.FirstLeft=this.m_PolyOuts[i.OutIdx],e.IsHole=!e.FirstLeft.IsHole)},p.Clipper.prototype.GetDx=function(t,e){return t.Y===e.Y?p.ClipperBase.horizontal:(e.X-t.X)/(e.Y-t.Y)},p.Clipper.prototype.FirstIsBottomPt=function(t,e){for(var r=t.Prev;p.FPoint.op_Equality(r.Pt,t.Pt)&&r!==t;)r=r.Prev;var i=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=t.Next;p.FPoint.op_Equality(r.Pt,t.Pt)&&r!==t;)r=r.Next;var n=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=e.Prev;p.FPoint.op_Equality(r.Pt,e.Pt)&&r!==e;)r=r.Prev;var s=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=e.Next;p.FPoint.op_Equality(r.Pt,e.Pt)&&r!==e;)r=r.Next;var o=Math.abs(this.GetDx(e.Pt,r.Pt));return Math.max(i,n)===Math.max(s,o)&&Math.min(i,n)===Math.min(s,o)?this.Area(t)>0:i>=s&&i>=o||n>=s&&n>=o},p.Clipper.prototype.GetBottomPt=function(t){for(var e=this,r=null,i=t.Next;i!==t;)i.Pt.Y>t.Pt.Y?(t=i,r=null):i.Pt.Y===t.Pt.Y&&i.Pt.X<=t.Pt.X&&(i.Pt.X<t.Pt.X?(r=null,t=i):i.Next!==t&&i.Prev!==t&&(r=i)),i=i.Next;if(r!==null)for(;r!==i;)for(e.FirstIsBottomPt(i,r)||(t=r),r=r.Next;p.FPoint.op_Inequality(r.Pt,t.Pt);)r=r.Next;return t},p.Clipper.prototype.GetLowermostRec=function(t,e){t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts)),e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts));var r=t.BottomPt,i=e.BottomPt;return r.Pt.Y>i.Pt.Y?t:r.Pt.Y<i.Pt.Y?e:r.Pt.X<i.Pt.X?t:r.Pt.X>i.Pt.X||r.Next===r?e:i.Next===i||this.FirstIsBottomPt(r,i)?t:e},p.Clipper.prototype.OutRec1RightOfOutRec2=function(t,e){do if(t=t.FirstLeft,t===e)return!0;while(t!==null);return!1},p.Clipper.prototype.GetOutRec=function(t){for(var e=this,r=this.m_PolyOuts[t];r!==this.m_PolyOuts[r.Idx];)r=e.m_PolyOuts[r.Idx];return r},p.Clipper.prototype.AppendPolygon=function(t,e){var r=this.m_PolyOuts[t.OutIdx],i=this.m_PolyOuts[e.OutIdx],n;this.OutRec1RightOfOutRec2(r,i)?n=i:this.OutRec1RightOfOutRec2(i,r)?n=r:n=this.GetLowermostRec(r,i);var s=r.Pts,o=s.Prev,a=i.Pts,l=a.Prev;t.Side===p.EdgeSide.esLeft?e.Side===p.EdgeSide.esLeft?(this.ReversePolyPtLinks(a),a.Next=s,s.Prev=a,o.Next=l,l.Prev=o,r.Pts=l):(l.Next=s,s.Prev=l,a.Prev=o,o.Next=a,r.Pts=a):e.Side===p.EdgeSide.esRight?(this.ReversePolyPtLinks(a),o.Next=l,l.Prev=o,a.Next=s,s.Prev=a):(o.Next=a,a.Prev=o,s.Prev=l,l.Next=s),r.BottomPt=null,n===i&&(i.FirstLeft!==r&&(r.FirstLeft=i.FirstLeft),r.IsHole=i.IsHole),i.Pts=null,i.BottomPt=null,i.FirstLeft=r;var h=t.OutIdx,u=e.OutIdx;t.OutIdx=-1,e.OutIdx=-1;for(var f=this.m_ActiveEdges;f!==null;){if(f.OutIdx===u){f.OutIdx=h,f.Side=t.Side;break}f=f.NextInAEL}i.Idx=r.Idx},p.Clipper.prototype.ReversePolyPtLinks=function(t){if(t!==null){var e,r;e=t;do r=e.Next,e.Next=e.Prev,e.Prev=r,e=r;while(e!==t)}},p.Clipper.SwapSides=function(t,e){var r=t.Side;t.Side=e.Side,e.Side=r},p.Clipper.SwapPolyIndexes=function(t,e){var r=t.OutIdx;t.OutIdx=e.OutIdx,e.OutIdx=r},p.Clipper.prototype.IntersectEdges=function(t,e,r){var i=t.OutIdx>=0,n=e.OutIdx>=0;if(p.use_xyz&&this.SetZ(r,t,e),p.use_lines&&(t.WindDelta===0||e.WindDelta===0)){if(t.WindDelta===0&&e.WindDelta===0)return;t.PolyTyp===e.PolyTyp&&t.WindDelta!==e.WindDelta&&this.m_ClipType===p.ClipType.ctUnion?t.WindDelta===0?n&&(this.AddOutPt(t,r),i&&(t.OutIdx=-1)):i&&(this.AddOutPt(e,r),n&&(e.OutIdx=-1)):t.PolyTyp!==e.PolyTyp&&(t.WindDelta===0&&Math.abs(e.WindCnt)===1&&(this.m_ClipType!==p.ClipType.ctUnion||e.WindCnt2===0)?(this.AddOutPt(t,r),i&&(t.OutIdx=-1)):e.WindDelta===0&&Math.abs(t.WindCnt)===1&&(this.m_ClipType!==p.ClipType.ctUnion||t.WindCnt2===0)&&(this.AddOutPt(e,r),n&&(e.OutIdx=-1)));return}if(t.PolyTyp===e.PolyTyp)if(this.IsEvenOddFillType(t)){var s=t.WindCnt;t.WindCnt=e.WindCnt,e.WindCnt=s}else t.WindCnt+e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt+=e.WindDelta,e.WindCnt-t.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt-=t.WindDelta;else this.IsEvenOddFillType(e)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2+=e.WindDelta,this.IsEvenOddFillType(t)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2-=t.WindDelta;var o,a,l,h;t.PolyTyp===p.PolyType.ptSubject?(o=this.m_SubjFillType,l=this.m_ClipFillType):(o=this.m_ClipFillType,l=this.m_SubjFillType),e.PolyTyp===p.PolyType.ptSubject?(a=this.m_SubjFillType,h=this.m_ClipFillType):(a=this.m_ClipFillType,h=this.m_SubjFillType);var u,f;switch(o){case p.PolyFillType.pftPositive:u=t.WindCnt;break;case p.PolyFillType.pftNegative:u=-t.WindCnt;break;default:u=Math.abs(t.WindCnt);break}switch(a){case p.PolyFillType.pftPositive:f=e.WindCnt;break;case p.PolyFillType.pftNegative:f=-e.WindCnt;break;default:f=Math.abs(e.WindCnt);break}if(i&&n)u!==0&&u!==1||f!==0&&f!==1||t.PolyTyp!==e.PolyTyp&&this.m_ClipType!==p.ClipType.ctXor?this.AddLocalMaxPoly(t,e,r):(this.AddOutPt(t,r),this.AddOutPt(e,r),p.Clipper.SwapSides(t,e),p.Clipper.SwapPolyIndexes(t,e));else if(i)(f===0||f===1)&&(this.AddOutPt(t,r),p.Clipper.SwapSides(t,e),p.Clipper.SwapPolyIndexes(t,e));else if(n)(u===0||u===1)&&(this.AddOutPt(e,r),p.Clipper.SwapSides(t,e),p.Clipper.SwapPolyIndexes(t,e));else if((u===0||u===1)&&(f===0||f===1)){var c,d;switch(l){case p.PolyFillType.pftPositive:c=t.WindCnt2;break;case p.PolyFillType.pftNegative:c=-t.WindCnt2;break;default:c=Math.abs(t.WindCnt2);break}switch(h){case p.PolyFillType.pftPositive:d=e.WindCnt2;break;case p.PolyFillType.pftNegative:d=-e.WindCnt2;break;default:d=Math.abs(e.WindCnt2);break}if(t.PolyTyp!==e.PolyTyp)this.AddLocalMinPoly(t,e,r);else if(u===1&&f===1)switch(this.m_ClipType){case p.ClipType.ctIntersection:c>0&&d>0&&this.AddLocalMinPoly(t,e,r);break;case p.ClipType.ctUnion:c<=0&&d<=0&&this.AddLocalMinPoly(t,e,r);break;case p.ClipType.ctDifference:(t.PolyTyp===p.PolyType.ptClip&&c>0&&d>0||t.PolyTyp===p.PolyType.ptSubject&&c<=0&&d<=0)&&this.AddLocalMinPoly(t,e,r);break;case p.ClipType.ctXor:this.AddLocalMinPoly(t,e,r);break}else p.Clipper.SwapSides(t,e)}},p.Clipper.prototype.DeleteFromSEL=function(t){var e=t.PrevInSEL,r=t.NextInSEL;e===null&&r===null&&t!==this.m_SortedEdges||(e!==null?e.NextInSEL=r:this.m_SortedEdges=r,r!==null&&(r.PrevInSEL=e),t.NextInSEL=null,t.PrevInSEL=null)},p.Clipper.prototype.ProcessHorizontals=function(){for(var t=this,e={};this.PopEdgeFromSEL(e);)t.ProcessHorizontal(e.v)},p.Clipper.prototype.GetHorzDirection=function(t,e){t.Bot.X<t.Top.X?(e.Left=t.Bot.X,e.Right=t.Top.X,e.Dir=p.Direction.dLeftToRight):(e.Left=t.Top.X,e.Right=t.Bot.X,e.Dir=p.Direction.dRightToLeft)},p.Clipper.prototype.ProcessHorizontal=function(t){var e=this,r={Dir:null,Left:null,Right:null};this.GetHorzDirection(t,r);for(var i=r.Dir,n=r.Left,s=r.Right,o=t.WindDelta===0,a=t,l=null;a.NextInLML!==null&&p.ClipperBase.IsHorizontal(a.NextInLML);)a=a.NextInLML;a.NextInLML===null&&(l=this.GetMaximaPair(a));var h=this.m_Maxima;if(h!==null)if(i===p.Direction.dLeftToRight){for(;h!==null&&h.X<=t.Bot.X;)h=h.Next;h!==null&&h.X>=a.Top.X&&(h=null)}else{for(;h.Next!==null&&h.Next.X<t.Bot.X;)h=h.Next;h.X<=a.Top.X&&(h=null)}for(var u=null;;){for(var f=t===a,c=e.GetNextInAEL(t,i);c!==null;){if(h!==null)if(i===p.Direction.dLeftToRight)for(;h!==null&&h.X<c.Curr.X;)t.OutIdx>=0&&!o&&e.AddOutPt(t,new p.FPoint2(h.X,t.Bot.Y)),h=h.Next;else for(;h!==null&&h.X>c.Curr.X;)t.OutIdx>=0&&!o&&e.AddOutPt(t,new p.FPoint2(h.X,t.Bot.Y)),h=h.Prev;if(i===p.Direction.dLeftToRight&&c.Curr.X>s||i===p.Direction.dRightToLeft&&c.Curr.X<n||c.Curr.X===t.Top.X&&t.NextInLML!==null&&c.Dx<t.NextInLML.Dx)break;if(t.OutIdx>=0&&!o){p.use_xyz&&(i===p.Direction.dLeftToRight?e.SetZ(c.Curr,t,c):e.SetZ(c.Curr,c,t)),u=e.AddOutPt(t,c.Curr);for(var d=e.m_SortedEdges;d!==null;){if(d.OutIdx>=0&&e.HorzSegmentsOverlap(t.Bot.X,t.Top.X,d.Bot.X,d.Top.X)){var v=e.GetLastOutPt(d);e.AddJoin(v,u,d.Top)}d=d.NextInSEL}e.AddGhostJoin(u,t.Bot)}if(c===l&&f){t.OutIdx>=0&&e.AddLocalMaxPoly(t,l,t.Top),e.DeleteFromAEL(t),e.DeleteFromAEL(l);return}if(i===p.Direction.dLeftToRight){var y=new p.FPoint2(c.Curr.X,t.Curr.Y);e.IntersectEdges(t,c,y)}else{var y=new p.FPoint2(c.Curr.X,t.Curr.Y);e.IntersectEdges(c,t,y)}var m=e.GetNextInAEL(c,i);e.SwapPositionsInAEL(t,c),c=m}if(t.NextInLML===null||!p.ClipperBase.IsHorizontal(t.NextInLML))break;t=e.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&e.AddOutPt(t,t.Bot),r={Dir:i,Left:n,Right:s},e.GetHorzDirection(t,r),i=r.Dir,n=r.Left,s=r.Right}if(t.OutIdx>=0&&u===null){u=this.GetLastOutPt(t);for(var d=this.m_SortedEdges;d!==null;){if(d.OutIdx>=0&&e.HorzSegmentsOverlap(t.Bot.X,t.Top.X,d.Bot.X,d.Top.X)){var v=e.GetLastOutPt(d);e.AddJoin(v,u,d.Top)}d=d.NextInSEL}this.AddGhostJoin(u,t.Top)}if(t.NextInLML!==null)if(t.OutIdx>=0){if(u=this.AddOutPt(t,t.Top),t=this.UpdateEdgeIntoAEL(t),t.WindDelta===0)return;var g=t.PrevInAEL,m=t.NextInAEL;if(g!==null&&g.Curr.X===t.Bot.X&&g.Curr.Y===t.Bot.Y&&g.WindDelta===0&&g.OutIdx>=0&&g.Curr.Y>g.Top.Y&&p.ClipperBase.SlopesEqual3(t,g)){var v=this.AddOutPt(g,t.Bot);this.AddJoin(u,v,t.Top)}else if(m!==null&&m.Curr.X===t.Bot.X&&m.Curr.Y===t.Bot.Y&&m.WindDelta!==0&&m.OutIdx>=0&&m.Curr.Y>m.Top.Y&&p.ClipperBase.SlopesEqual3(t,m)){var v=this.AddOutPt(m,t.Bot);this.AddJoin(u,v,t.Top)}}else t=this.UpdateEdgeIntoAEL(t);else t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t)},p.Clipper.prototype.GetNextInAEL=function(t,e){return e===p.Direction.dLeftToRight?t.NextInAEL:t.PrevInAEL},p.Clipper.prototype.IsMinima=function(t){return t!==null&&t.Prev.NextInLML!==t&&t.Next.NextInLML!==t},p.Clipper.prototype.IsMaxima=function(t,e){return t!==null&&t.Top.Y===e&&t.NextInLML===null},p.Clipper.prototype.IsIntermediate=function(t,e){return t.Top.Y===e&&t.NextInLML!==null},p.Clipper.prototype.GetMaximaPair=function(t){return p.FPoint.op_Equality(t.Next.Top,t.Top)&&t.Next.NextInLML===null?t.Next:p.FPoint.op_Equality(t.Prev.Top,t.Top)&&t.Prev.NextInLML===null?t.Prev:null},p.Clipper.prototype.GetMaximaPairEx=function(t){var e=this.GetMaximaPair(t);return e===null||e.OutIdx===p.ClipperBase.Skip||e.NextInAEL===e.PrevInAEL&&!p.ClipperBase.IsHorizontal(e)?null:e},p.Clipper.prototype.ProcessIntersections=function(t){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(t),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,p.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0},p.Clipper.prototype.BuildIntersectList=function(t){var e=this;if(this.m_ActiveEdges!==null){var r=this.m_ActiveEdges;for(this.m_SortedEdges=r;r!==null;)r.PrevInSEL=r.PrevInAEL,r.NextInSEL=r.NextInAEL,r.Curr.X=p.Clipper.TopX(r,t),r=r.NextInAEL;for(var i=!0;i&&this.m_SortedEdges!==null;){for(i=!1,r=e.m_SortedEdges;r.NextInSEL!==null;){var n=r.NextInSEL,s=new p.FPoint0;if(r.Curr.X>n.Curr.X){e.IntersectPoint(r,n,s),s.Y<t&&(s=new p.FPoint2(p.Clipper.TopX(r,t),t));var o=new p.IntersectNode;o.Edge1=r,o.Edge2=n,o.Pt.X=s.X,o.Pt.Y=s.Y,p.use_xyz&&(o.Pt.Z=s.Z),e.m_IntersectList.push(o),e.SwapPositionsInSEL(r,n),i=!0}else r=n}if(r.PrevInSEL!==null)r.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}},p.Clipper.prototype.EdgesAdjacent=function(t){return t.Edge1.NextInSEL===t.Edge2||t.Edge1.PrevInSEL===t.Edge2},p.Clipper.IntersectNodeSort=function(t,e){return e.Pt.Y-t.Pt.Y},p.Clipper.prototype.FixupIntersectionOrder=function(){var t=this;this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var e=this.m_IntersectList.length,r=0;r<e;r++){if(!t.EdgesAdjacent(t.m_IntersectList[r])){for(var i=r+1;i<e&&!this.EdgesAdjacent(this.m_IntersectList[i]);)i++;if(i===e)return!1;var n=t.m_IntersectList[r];t.m_IntersectList[r]=t.m_IntersectList[i],t.m_IntersectList[i]=n}t.SwapPositionsInSEL(t.m_IntersectList[r].Edge1,t.m_IntersectList[r].Edge2)}return!0},p.Clipper.prototype.ProcessIntersectList=function(){for(var t=this,e=0,r=this.m_IntersectList.length;e<r;e++){var i=t.m_IntersectList[e];t.IntersectEdges(i.Edge1,i.Edge2,i.Pt),t.SwapPositionsInAEL(i.Edge1,i.Edge2)}this.m_IntersectList.length=0},p.Clipper.TopX=function(t,e){return e===t.Top.Y?t.Top.X:t.Bot.X+t.Dx*(e-t.Bot.Y)},p.Clipper.prototype.IntersectPoint=function(t,e,r){r.X=0,r.Y=0;var i,n;if(t.Dx===e.Dx){r.Y=t.Curr.Y,r.X=p.Clipper.TopX(t,r.Y);return}if(t.Delta.X===0)r.X=t.Bot.X,p.ClipperBase.IsHorizontal(e)?r.Y=e.Bot.Y:(n=e.Bot.Y-e.Bot.X/e.Dx,r.Y=r.X/e.Dx+n);else if(e.Delta.X===0)r.X=e.Bot.X,p.ClipperBase.IsHorizontal(t)?r.Y=t.Bot.Y:(i=t.Bot.Y-t.Bot.X/t.Dx,r.Y=r.X/t.Dx+i);else{i=t.Bot.X-t.Bot.Y*t.Dx,n=e.Bot.X-e.Bot.Y*e.Dx;var s=(n-i)/(t.Dx-e.Dx);r.Y=s,Math.abs(t.Dx)<Math.abs(e.Dx)?r.X=t.Dx*s+i:r.X=e.Dx*s+n}if(r.Y<t.Top.Y||r.Y<e.Top.Y){if(t.Top.Y>e.Top.Y)return r.Y=t.Top.Y,r.X=p.Clipper.TopX(e,t.Top.Y),r.X<t.Top.X;r.Y=e.Top.Y,Math.abs(t.Dx)<Math.abs(e.Dx)?r.X=p.Clipper.TopX(t,r.Y):r.X=p.Clipper.TopX(e,r.Y)}r.Y>t.Curr.Y&&(r.Y=t.Curr.Y,Math.abs(t.Dx)>Math.abs(e.Dx)?r.X=p.Clipper.TopX(e,r.Y):r.X=p.Clipper.TopX(t,r.Y))},p.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(t){for(var e=this,r=this.m_ActiveEdges;r!==null;){var i=e.IsMaxima(r,t);if(i){var n=e.GetMaximaPairEx(r);i=n===null||!p.ClipperBase.IsHorizontal(n)}if(i){e.StrictlySimple&&e.InsertMaxima(r.Top.X);var s=r.PrevInAEL;e.DoMaxima(r),s===null?r=e.m_ActiveEdges:r=s.NextInAEL}else{if(e.IsIntermediate(r,t)&&p.ClipperBase.IsHorizontal(r.NextInLML)?(r=e.UpdateEdgeIntoAEL(r),r.OutIdx>=0&&e.AddOutPt(r,r.Bot),e.AddEdgeToSEL(r)):(r.Curr.X=p.Clipper.TopX(r,t),r.Curr.Y=t),p.use_xyz&&(r.Top.Y===t?r.Curr.Z=r.Top.Z:r.Bot.Y===t?r.Curr.Z=r.Bot.Z:r.Curr.Z=0),e.StrictlySimple){var s=r.PrevInAEL;if(r.OutIdx>=0&&r.WindDelta!==0&&s!==null&&s.OutIdx>=0&&s.Curr.X===r.Curr.X&&s.WindDelta!==0){var o=new p.FPoint1(r.Curr);p.use_xyz&&e.SetZ(o,s,r);var a=e.AddOutPt(s,o),l=e.AddOutPt(r,o);e.AddJoin(a,l,o)}}r=r.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,r=this.m_ActiveEdges;r!==null;){if(e.IsIntermediate(r,t)){var a=null;r.OutIdx>=0&&(a=e.AddOutPt(r,r.Top)),r=e.UpdateEdgeIntoAEL(r);var s=r.PrevInAEL,h=r.NextInAEL;if(s!==null&&s.Curr.X===r.Bot.X&&s.Curr.Y===r.Bot.Y&&a!==null&&s.OutIdx>=0&&s.Curr.Y===s.Top.Y&&p.ClipperBase.SlopesEqual5(r.Curr,r.Top,s.Curr,s.Top)&&r.WindDelta!==0&&s.WindDelta!==0){var l=e.AddOutPt(ePrev2,r.Bot);e.AddJoin(a,l,r.Top)}else if(h!==null&&h.Curr.X===r.Bot.X&&h.Curr.Y===r.Bot.Y&&a!==null&&h.OutIdx>=0&&h.Curr.Y===h.Top.Y&&p.ClipperBase.SlopesEqual5(r.Curr,r.Top,h.Curr,h.Top)&&r.WindDelta!==0&&h.WindDelta!==0){var l=e.AddOutPt(h,r.Bot);e.AddJoin(a,l,r.Top)}}r=r.NextInAEL}},p.Clipper.prototype.DoMaxima=function(t){var e=this,r=this.GetMaximaPairEx(t);if(r===null){t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t);return}for(var i=t.NextInAEL;i!==null&&i!==r;)e.IntersectEdges(t,i,t.Top),e.SwapPositionsInAEL(t,i),i=t.NextInAEL;t.OutIdx===-1&&r.OutIdx===-1?(this.DeleteFromAEL(t),this.DeleteFromAEL(r)):t.OutIdx>=0&&r.OutIdx>=0?(t.OutIdx>=0&&this.AddLocalMaxPoly(t,r,t.Top),this.DeleteFromAEL(t),this.DeleteFromAEL(r)):p.use_lines&&t.WindDelta===0?(t.OutIdx>=0&&(this.AddOutPt(t,t.Top),t.OutIdx=p.ClipperBase.Unassigned),this.DeleteFromAEL(t),r.OutIdx>=0&&(this.AddOutPt(r,t.Top),r.OutIdx=p.ClipperBase.Unassigned),this.DeleteFromAEL(r)):p.Error("DoMaxima error")},p.Clipper.ReversePaths=function(t){for(var e=0,r=t.length;e<r;e++)t[e].reverse()},p.Clipper.Orientation=function(t){return p.Clipper.Area(t)>=0},p.Clipper.prototype.PointCount=function(t){if(t===null)return 0;var e=0,r=t;do e++,r=r.Next;while(r!==t);return e},p.Clipper.prototype.BuildResult=function(t){var e=this;p.Clear(t);for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=e.m_PolyOuts[r];if(n.Pts!==null){var s=n.Pts.Prev,o=e.PointCount(s);if(!(o<2)){for(var a=new Array(o),l=0;l<o;l++)a[l]=s.Pt,s=s.Prev;t.push(a)}}}},p.Clipper.prototype.BuildResult2=function(t){var e=this;t.Clear();for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=e.m_PolyOuts[r],s=e.PointCount(n.Pts);if(!(n.IsOpen&&s<2||!n.IsOpen&&s<3)){e.FixHoleLinkage(n);var o=new p.PolyNode;t.m_AllPolys.push(o),n.PolyNode=o,o.m_polygon.length=s;for(var a=n.Pts.Prev,l=0;l<s;l++)o.m_polygon[l]=a.Pt,a=a.Prev}}for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=e.m_PolyOuts[r];n.PolyNode!==null&&(n.IsOpen?(n.PolyNode.IsOpen=!0,t.AddChild(n.PolyNode)):n.FirstLeft!==null&&n.FirstLeft.PolyNode!==null?n.FirstLeft.PolyNode.AddChild(n.PolyNode):t.AddChild(n.PolyNode))}},p.Clipper.prototype.FixupOutPolyline=function(t){for(var e=t.Pts,r=e.Prev;e!==r;)if(e=e.Next,p.FPoint.op_Equality(e.Pt,e.Prev.Pt)){e===r&&(r=e.Prev);var i=e.Prev;i.Next=e.Next,e.Next.Prev=i,e=i}e===e.Prev&&(t.Pts=null)},p.Clipper.prototype.FixupOutPolygon=function(t){var e=this,r=null;t.BottomPt=null;for(var i=t.Pts,n=this.PreserveCollinear||this.StrictlySimple;;){if(i.Prev===i||i.Prev===i.Next){t.Pts=null;return}if(p.FPoint.op_Equality(i.Pt,i.Next.Pt)||p.FPoint.op_Equality(i.Pt,i.Prev.Pt)||p.ClipperBase.SlopesEqual4(i.Prev.Pt,i.Pt,i.Next.Pt)&&(!n||!e.Pt2IsBetweenPt1AndPt3(i.Prev.Pt,i.Pt,i.Next.Pt)))r=null,i.Prev.Next=i.Next,i.Next.Prev=i.Prev,i=i.Prev;else{if(i===r)break;r===null&&(r=i),i=i.Next}}t.Pts=i},p.Clipper.prototype.DupOutPt=function(t,e){var r=new p.OutPt;return r.Pt.X=t.Pt.X,r.Pt.Y=t.Pt.Y,p.use_xyz&&(r.Pt.Z=t.Pt.Z),r.Idx=t.Idx,e?(r.Next=t.Next,r.Prev=t,t.Next.Prev=r,t.Next=r):(r.Prev=t.Prev,r.Next=t,t.Prev.Next=r,t.Prev=r),r},p.Clipper.prototype.GetOverlap=function(t,e,r,i,n){return t<e?r<i?(n.Left=Math.max(t,r),n.Right=Math.min(e,i)):(n.Left=Math.max(t,i),n.Right=Math.min(e,r)):r<i?(n.Left=Math.max(e,r),n.Right=Math.min(t,i)):(n.Left=Math.max(e,i),n.Right=Math.min(t,r)),n.Left<n.Right},p.Clipper.prototype.JoinHorz=function(t,e,r,i,n,s){var o=t.Pt.X>e.Pt.X?p.Direction.dRightToLeft:p.Direction.dLeftToRight,a=r.Pt.X>i.Pt.X?p.Direction.dRightToLeft:p.Direction.dLeftToRight;if(o===a)return!1;if(o===p.Direction.dLeftToRight){for(;t.Next.Pt.X<=n.X&&t.Next.Pt.X>=t.Pt.X&&t.Next.Pt.Y===n.Y;)t=t.Next;s&&t.Pt.X!==n.X&&(t=t.Next),e=this.DupOutPt(t,!s),p.FPoint.op_Inequality(e.Pt,n)&&(t=e,t.Pt.X=n.X,t.Pt.Y=n.Y,p.use_xyz&&(t.Pt.Z=n.Z),e=this.DupOutPt(t,!s))}else{for(;t.Next.Pt.X>=n.X&&t.Next.Pt.X<=t.Pt.X&&t.Next.Pt.Y===n.Y;)t=t.Next;!s&&t.Pt.X!==n.X&&(t=t.Next),e=this.DupOutPt(t,s),p.FPoint.op_Inequality(e.Pt,n)&&(t=e,t.Pt.X=n.X,t.Pt.Y=n.Y,p.use_xyz&&(t.Pt.Z=n.Z),e=this.DupOutPt(t,s))}if(a===p.Direction.dLeftToRight){for(;r.Next.Pt.X<=n.X&&r.Next.Pt.X>=r.Pt.X&&r.Next.Pt.Y===n.Y;)r=r.Next;s&&r.Pt.X!==n.X&&(r=r.Next),i=this.DupOutPt(r,!s),p.FPoint.op_Inequality(i.Pt,n)&&(r=i,r.Pt.X=n.X,r.Pt.Y=n.Y,p.use_xyz&&(r.Pt.Z=n.Z),i=this.DupOutPt(r,!s))}else{for(;r.Next.Pt.X>=n.X&&r.Next.Pt.X<=r.Pt.X&&r.Next.Pt.Y===n.Y;)r=r.Next;!s&&r.Pt.X!==n.X&&(r=r.Next),i=this.DupOutPt(r,s),p.FPoint.op_Inequality(i.Pt,n)&&(r=i,r.Pt.X=n.X,r.Pt.Y=n.Y,p.use_xyz&&(r.Pt.Z=n.Z),i=this.DupOutPt(r,s))}return o===p.Direction.dLeftToRight===s?(t.Prev=r,r.Next=t,e.Next=i,i.Prev=e):(t.Next=r,r.Prev=t,e.Prev=i,i.Next=e),!0},p.Clipper.prototype.JoinPoints=function(t,e,r){var i=t.OutPt1,n=new p.OutPt,s=t.OutPt2,o=new p.OutPt,a=t.OutPt1.Pt.Y===t.OffPt.Y;if(a&&p.FPoint.op_Equality(t.OffPt,t.OutPt1.Pt)&&p.FPoint.op_Equality(t.OffPt,t.OutPt2.Pt)){if(e!==r)return!1;for(n=t.OutPt1.Next;n!==i&&p.FPoint.op_Equality(n.Pt,t.OffPt);)n=n.Next;var l=n.Pt.Y>t.OffPt.Y;for(o=t.OutPt2.Next;o!==s&&p.FPoint.op_Equality(o.Pt,t.OffPt);)o=o.Next;var h=o.Pt.Y>t.OffPt.Y;return l===h?!1:l?(n=this.DupOutPt(i,!1),o=this.DupOutPt(s,!0),i.Prev=s,s.Next=i,n.Next=o,o.Prev=n,t.OutPt1=i,t.OutPt2=n,!0):(n=this.DupOutPt(i,!0),o=this.DupOutPt(s,!1),i.Next=s,s.Prev=i,n.Prev=o,o.Next=n,t.OutPt1=i,t.OutPt2=n,!0)}else if(a){for(n=i;i.Prev.Pt.Y===i.Pt.Y&&i.Prev!==n&&i.Prev!==s;)i=i.Prev;for(;n.Next.Pt.Y===n.Pt.Y&&n.Next!==i&&n.Next!==s;)n=n.Next;if(n.Next===i||n.Next===s)return!1;for(o=s;s.Prev.Pt.Y===s.Pt.Y&&s.Prev!==o&&s.Prev!==n;)s=s.Prev;for(;o.Next.Pt.Y===o.Pt.Y&&o.Next!==s&&o.Next!==i;)o=o.Next;if(o.Next===s||o.Next===i)return!1;var u={Left:null,Right:null};if(!this.GetOverlap(i.Pt.X,n.Pt.X,s.Pt.X,o.Pt.X,u))return!1;var f=u.Left,c=u.Right,d=new p.FPoint0,v;return i.Pt.X>=f&&i.Pt.X<=c?(d.X=i.Pt.X,d.Y=i.Pt.Y,p.use_xyz&&(d.Z=i.Pt.Z),v=i.Pt.X>n.Pt.X):s.Pt.X>=f&&s.Pt.X<=c?(d.X=s.Pt.X,d.Y=s.Pt.Y,p.use_xyz&&(d.Z=s.Pt.Z),v=s.Pt.X>o.Pt.X):n.Pt.X>=f&&n.Pt.X<=c?(d.X=n.Pt.X,d.Y=n.Pt.Y,p.use_xyz&&(d.Z=n.Pt.Z),v=n.Pt.X>i.Pt.X):(d.X=o.Pt.X,d.Y=o.Pt.Y,p.use_xyz&&(d.Z=o.Pt.Z),v=o.Pt.X>s.Pt.X),t.OutPt1=i,t.OutPt2=s,this.JoinHorz(i,n,s,o,d,v)}else{for(n=i.Next;p.FPoint.op_Equality(n.Pt,i.Pt)&&n!==i;)n=n.Next;var y=n.Pt.Y>i.Pt.Y||!p.ClipperBase.SlopesEqual4(i.Pt,n.Pt,t.OffPt);if(y){for(n=i.Prev;p.FPoint.op_Equality(n.Pt,i.Pt)&&n!==i;)n=n.Prev;if(n.Pt.Y>i.Pt.Y||!p.ClipperBase.SlopesEqual4(i.Pt,n.Pt,t.OffPt))return!1}for(o=s.Next;p.FPoint.op_Equality(o.Pt,s.Pt)&&o!==s;)o=o.Next;var m=o.Pt.Y>s.Pt.Y||!p.ClipperBase.SlopesEqual4(s.Pt,o.Pt,t.OffPt);if(m){for(o=s.Prev;p.FPoint.op_Equality(o.Pt,s.Pt)&&o!==s;)o=o.Prev;if(o.Pt.Y>s.Pt.Y||!p.ClipperBase.SlopesEqual4(s.Pt,o.Pt,t.OffPt))return!1}return n===i||o===s||n===o||e===r&&y===m?!1:y?(n=this.DupOutPt(i,!1),o=this.DupOutPt(s,!0),i.Prev=s,s.Next=i,n.Next=o,o.Prev=n,t.OutPt1=i,t.OutPt2=n,!0):(n=this.DupOutPt(i,!0),o=this.DupOutPt(s,!1),i.Next=s,s.Prev=i,n.Prev=o,o.Next=n,t.OutPt1=i,t.OutPt2=n,!0)}},p.Clipper.GetBounds=function(t){for(var e=0,r=t.length;e<r&&t[e].length===0;)e++;if(e===r)return new p.FRect(0,0,0,0);var i=new p.FRect;for(i.left=t[e][0].X,i.right=i.left,i.top=t[e][0].Y,i.bottom=i.top;e<r;e++)for(var n=0,s=t[e].length;n<s;n++)t[e][n].X<i.left?i.left=t[e][n].X:t[e][n].X>i.right&&(i.right=t[e][n].X),t[e][n].Y<i.top?i.top=t[e][n].Y:t[e][n].Y>i.bottom&&(i.bottom=t[e][n].Y);return i},p.Clipper.prototype.GetBounds2=function(t){var e=t,r=new p.FRect;for(r.left=t.Pt.X,r.right=t.Pt.X,r.top=t.Pt.Y,r.bottom=t.Pt.Y,t=t.Next;t!==e;)t.Pt.X<r.left&&(r.left=t.Pt.X),t.Pt.X>r.right&&(r.right=t.Pt.X),t.Pt.Y<r.top&&(r.top=t.Pt.Y),t.Pt.Y>r.bottom&&(r.bottom=t.Pt.Y),t=t.Next;return r},p.Clipper.PointInPolygon=function(t,e){var r=0,i=e.length;if(i<3)return 0;for(var n=e[0],s=1;s<=i;++s){var o=s===i?e[0]:e[s];if(o.Y===t.Y&&(o.X===t.X||n.Y===t.Y&&o.X>t.X==n.X<t.X))return-1;if(n.Y<t.Y!=o.Y<t.Y){if(n.X>=t.X)if(o.X>t.X)r=1-r;else{var a=(n.X-t.X)*(o.Y-t.Y)-(o.X-t.X)*(n.Y-t.Y);if(a===0)return-1;a>0==o.Y>n.Y&&(r=1-r)}else if(o.X>t.X){var a=(n.X-t.X)*(o.Y-t.Y)-(o.X-t.X)*(n.Y-t.Y);if(a===0)return-1;a>0==o.Y>n.Y&&(r=1-r)}}n=o}return r},p.Clipper.prototype.PointInPolygon=function(t,e){var r=0,i=e,n=t.X,s=t.Y,o=e.Pt.X,a=e.Pt.Y;do{e=e.Next;var l=e.Pt.X,h=e.Pt.Y;if(h===s&&(l===n||a===s&&l>n==o<n))return-1;if(a<s!=h<s){if(o>=n)if(l>n)r=1-r;else{var u=(o-n)*(h-s)-(l-n)*(a-s);if(u===0)return-1;u>0==h>a&&(r=1-r)}else if(l>n){var u=(o-n)*(h-s)-(l-n)*(a-s);if(u===0)return-1;u>0==h>a&&(r=1-r)}}o=l,a=h}while(i!==e);return r},p.Clipper.prototype.Poly2ContainsPoly1=function(t,e){var r=this,i=t;do{var n=r.PointInPolygon(i.Pt,e);if(n>=0)return n>0;i=i.Next}while(i!==t);return!0},p.Clipper.prototype.FixupFirstLefts1=function(t,e){for(var r=this,i,n,s=0,o=this.m_PolyOuts.length;s<o;s++)i=r.m_PolyOuts[s],n=p.Clipper.ParseFirstLeft(i.FirstLeft),i.Pts!==null&&n===t&&r.Poly2ContainsPoly1(i.Pts,e.Pts)&&(i.FirstLeft=e)},p.Clipper.prototype.FixupFirstLefts2=function(t,e){for(var r=this,i=e.FirstLeft,n,s,o=0,a=this.m_PolyOuts.length;o<a;o++)n=r.m_PolyOuts[o],!(n.Pts===null||n===e||n===t)&&(s=p.Clipper.ParseFirstLeft(n.FirstLeft),!(s!==i&&s!==t&&s!==e)&&(r.Poly2ContainsPoly1(n.Pts,t.Pts)?n.FirstLeft=t:r.Poly2ContainsPoly1(n.Pts,e.Pts)?n.FirstLeft=e:(n.FirstLeft===t||n.FirstLeft===e)&&(n.FirstLeft=i)))},p.Clipper.prototype.FixupFirstLefts3=function(t,e){for(var r=this,i,n,s=0,o=this.m_PolyOuts.length;s<o;s++)i=r.m_PolyOuts[s],n=p.Clipper.ParseFirstLeft(i.FirstLeft),i.Pts!==null&&n===t&&(i.FirstLeft=e)},p.Clipper.ParseFirstLeft=function(t){for(;t!==null&&t.Pts===null;)t=t.FirstLeft;return t},p.Clipper.prototype.JoinCommonEdges=function(){for(var t=this,e=0,r=this.m_Joins.length;e<r;e++){var i=t.m_Joins[e],n=t.GetOutRec(i.OutPt1.Idx),s=t.GetOutRec(i.OutPt2.Idx);if(!(n.Pts===null||s.Pts===null)&&!(n.IsOpen||s.IsOpen)){var o;n===s?o=n:t.OutRec1RightOfOutRec2(n,s)?o=s:t.OutRec1RightOfOutRec2(s,n)?o=n:o=t.GetLowermostRec(n,s),t.JoinPoints(i,n,s)&&(n===s?(n.Pts=i.OutPt1,n.BottomPt=null,s=t.CreateOutRec(),s.Pts=i.OutPt2,t.UpdateOutPtIdxs(s),t.Poly2ContainsPoly1(s.Pts,n.Pts)?(s.IsHole=!n.IsHole,s.FirstLeft=n,t.m_UsingPolyTree&&t.FixupFirstLefts2(s,n),(s.IsHole^t.ReverseSolution)==t.Area$1(s)>0&&t.ReversePolyPtLinks(s.Pts)):t.Poly2ContainsPoly1(n.Pts,s.Pts)?(s.IsHole=n.IsHole,n.IsHole=!s.IsHole,s.FirstLeft=n.FirstLeft,n.FirstLeft=s,t.m_UsingPolyTree&&t.FixupFirstLefts2(n,s),(n.IsHole^t.ReverseSolution)==t.Area$1(n)>0&&t.ReversePolyPtLinks(n.Pts)):(s.IsHole=n.IsHole,s.FirstLeft=n.FirstLeft,t.m_UsingPolyTree&&t.FixupFirstLefts1(n,s))):(s.Pts=null,s.BottomPt=null,s.Idx=n.Idx,n.IsHole=o.IsHole,o===s&&(n.FirstLeft=s.FirstLeft),s.FirstLeft=n,t.m_UsingPolyTree&&t.FixupFirstLefts3(s,n)))}}},p.Clipper.prototype.UpdateOutPtIdxs=function(t){var e=t.Pts;do e.Idx=t.Idx,e=e.Prev;while(e!==t.Pts)},p.Clipper.prototype.DoSimplePolygons=function(){for(var t=this,e=0;e<this.m_PolyOuts.length;){var r=t.m_PolyOuts[e++],i=r.Pts;if(!(i===null||r.IsOpen))do{for(var n=i.Next;n!==r.Pts;){if(p.FPoint.op_Equality(i.Pt,n.Pt)&&n.Next!==i&&n.Prev!==i){var s=i.Prev,o=n.Prev;i.Prev=o,o.Next=i,n.Prev=s,s.Next=n,r.Pts=i;var a=t.CreateOutRec();a.Pts=n,t.UpdateOutPtIdxs(a),t.Poly2ContainsPoly1(a.Pts,r.Pts)?(a.IsHole=!r.IsHole,a.FirstLeft=r,t.m_UsingPolyTree&&t.FixupFirstLefts2(a,r)):t.Poly2ContainsPoly1(r.Pts,a.Pts)?(a.IsHole=r.IsHole,r.IsHole=!a.IsHole,a.FirstLeft=r.FirstLeft,r.FirstLeft=a,t.m_UsingPolyTree&&t.FixupFirstLefts2(r,a)):(a.IsHole=r.IsHole,a.FirstLeft=r.FirstLeft,t.m_UsingPolyTree&&t.FixupFirstLefts1(r,a)),n=i}n=n.Next}i=i.Next}while(i!==r.Pts)}},p.Clipper.Area=function(t){if(!Array.isArray(t))return 0;var e=t.length;if(e<3)return 0;for(var r=0,i=0,n=e-1;i<e;++i)r+=(t[n].X+t[i].X)*(t[n].Y-t[i].Y),n=i;return-r*.5},p.Clipper.prototype.Area=function(t){var e=t;if(t===null)return 0;var r=0;do r=r+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!==e);return r*.5},p.Clipper.prototype.Area$1=function(t){return this.Area(t.Pts)},p.Clipper.SimplifyPolygon=function(t,e){var r=new Array,i=new p.Clipper(0);return i.StrictlySimple=!0,i.AddPath(t,p.PolyType.ptSubject,!0),i.Execute(p.ClipType.ctUnion,r,e,e),r},p.Clipper.SimplifyPolygons=function(t,e){typeof e>"u"&&(e=p.PolyFillType.pftEvenOdd);var r=new Array,i=new p.Clipper(0);return i.StrictlySimple=!0,i.AddPaths(t,p.PolyType.ptSubject,!0),i.Execute(p.ClipType.ctUnion,r,e,e),r},p.Clipper.DistanceSqrd=function(t,e){var r=t.X-e.X,i=t.Y-e.Y;return r*r+i*i},p.Clipper.DistanceFromLineSqrd=function(t,e,r){var i=e.Y-r.Y,n=r.X-e.X,s=i*e.X+n*e.Y;return s=i*t.X+n*t.Y-s,s*s/(i*i+n*n)},p.Clipper.SlopesNearCollinear=function(t,e,r,i){return Math.abs(t.X-e.X)>Math.abs(t.Y-e.Y)?t.X>e.X==t.X<r.X?p.Clipper.DistanceFromLineSqrd(t,e,r)<i:e.X>t.X==e.X<r.X?p.Clipper.DistanceFromLineSqrd(e,t,r)<i:p.Clipper.DistanceFromLineSqrd(r,t,e)<i:t.Y>e.Y==t.Y<r.Y?p.Clipper.DistanceFromLineSqrd(t,e,r)<i:e.Y>t.Y==e.Y<r.Y?p.Clipper.DistanceFromLineSqrd(e,t,r)<i:p.Clipper.DistanceFromLineSqrd(r,t,e)<i},p.Clipper.PointsAreClose=function(t,e,r){var i=t.X-e.X,n=t.Y-e.Y;return i*i+n*n<=r},p.Clipper.ExcludeOp=function(t){var e=t.Prev;return e.Next=t.Next,t.Next.Prev=e,e.Idx=0,e},p.Clipper.CleanPolygon=function(t,e){typeof e>"u"&&(e=1.415);var r=t.length;if(r===0)return new Array;for(var i=new Array(r),n=0;n<r;++n)i[n]=new p.OutPt;for(var n=0;n<r;++n)i[n].Pt=t[n],i[n].Next=i[(n+1)%r],i[n].Next.Prev=i[n],i[n].Idx=0;for(var s=e*e,o=i[0];o.Idx===0&&o.Next!==o.Prev;)p.Clipper.PointsAreClose(o.Pt,o.Prev.Pt,s)?(o=p.Clipper.ExcludeOp(o),r--):p.Clipper.PointsAreClose(o.Prev.Pt,o.Next.Pt,s)?(p.Clipper.ExcludeOp(o.Next),o=p.Clipper.ExcludeOp(o),r-=2):p.Clipper.SlopesNearCollinear(o.Prev.Pt,o.Pt,o.Next.Pt,s)?(o=p.Clipper.ExcludeOp(o),r--):(o.Idx=1,o=o.Next);r<3&&(r=0);for(var a=new Array(r),n=0;n<r;++n)a[n]=new p.FPoint1(o.Pt),o=o.Next;return i=null,a},p.Clipper.CleanPolygons=function(t,e){for(var r=new Array(t.length),i=0,n=t.length;i<n;i++)r[i]=p.Clipper.CleanPolygon(t[i],e);return r},p.Clipper.Minkowski=function(t,e,r,i){var n=i?1:0,s=t.length,o=e.length,a=new Array;if(r)for(var l=0;l<o;l++){for(var h=new Array(s),u=0,f=t.length,c=t[u];u<f;u++,c=t[u])h[u]=new p.FPoint2(e[l].X+c.X,e[l].Y+c.Y);a.push(h)}else for(var l=0;l<o;l++){for(var h=new Array(s),u=0,f=t.length,c=t[u];u<f;u++,c=t[u])h[u]=new p.FPoint2(e[l].X-c.X,e[l].Y-c.Y);a.push(h)}for(var d=new Array,l=0;l<o-1+n;l++)for(var u=0;u<s;u++){var v=new Array;v.push(a[l%o][u%s]),v.push(a[(l+1)%o][u%s]),v.push(a[(l+1)%o][(u+1)%s]),v.push(a[l%o][(u+1)%s]),p.Clipper.Orientation(v)||v.reverse(),d.push(v)}return d},p.Clipper.MinkowskiSum=function(t,e,r){if(e[0]instanceof Array){for(var n=e,o=new p.Paths,s=new p.Clipper,a=0;a<n.length;++a){var l=p.Clipper.Minkowski(t,n[a],!0,r);if(s.AddPaths(l,p.PolyType.ptSubject,!0),r){var i=p.Clipper.TranslatePath(n[a],t[0]);s.AddPath(i,p.PolyType.ptClip,!0)}}return s.Execute(p.ClipType.ctUnion,o,p.PolyFillType.pftNonZero,p.PolyFillType.pftNonZero),o}else{var i=e,n=p.Clipper.Minkowski(t,i,!0,r),s=new p.Clipper;return s.AddPaths(n,p.PolyType.ptSubject,!0),s.Execute(p.ClipType.ctUnion,n,p.PolyFillType.pftNonZero,p.PolyFillType.pftNonZero),n}},p.Clipper.TranslatePath=function(t,e){for(var r=new p.Path,i=0;i<t.length;i++)r.push(new p.FPoint2(t[i].X+e.X,t[i].Y+e.Y));return r},p.Clipper.MinkowskiDiff=function(t,e){var r=p.Clipper.Minkowski(t,e,!1,!0),i=new p.Clipper;return i.AddPaths(r,p.PolyType.ptSubject,!0),i.Execute(p.ClipType.ctUnion,r,p.PolyFillType.pftNonZero,p.PolyFillType.pftNonZero),r},p.Clipper.PolyTreeToPaths=function(t){var e=new Array;return p.Clipper.AddPolyNodeToPaths(t,p.Clipper.NodeType.ntAny,e),e},p.Clipper.AddPolyNodeToPaths=function(t,e,r){var i=!0;switch(e){case p.Clipper.NodeType.ntOpen:return;case p.Clipper.NodeType.ntClosed:i=!t.IsOpen;break}t.m_polygon.length>0&&i&&r.push(t.m_polygon);for(var n=0,s=t.Childs(),o=s.length,a=s[n];n<o;n++,a=s[n])p.Clipper.AddPolyNodeToPaths(a,e,r)},p.Clipper.OpenPathsFromPolyTree=function(t){for(var e=new p.Paths,r=0,i=t.ChildCount();r<i;r++)t.Childs()[r].IsOpen&&e.push(t.Childs()[r].m_polygon);return e},p.Clipper.ClosedPathsFromPolyTree=function(t){var e=new p.Paths;return p.Clipper.AddPolyNodeToPaths(t,p.Clipper.NodeType.ntClosed,e),e},bh(p.Clipper,p.ClipperBase),p.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},p.ClipperOffset=function(t,e){typeof t>"u"&&(t=2),typeof e>"u"&&(e=p.ClipperOffset.def_arc_tolerance),this.m_destPolys=new p.Paths,this.m_srcPoly=new p.Path,this.m_destPoly=new p.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new p.FPoint0,this.m_polyNodes=new p.PolyNode,this.MiterLimit=t,this.ArcTolerance=e,this.m_lowest.X=-1},p.ClipperOffset.two_pi=6.28318530717959,p.ClipperOffset.def_arc_tolerance=.25,p.ClipperOffset.prototype.Clear=function(){p.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1},p.ClipperOffset.prototype.AddPath=function(t,e,r){var i=t.length-1;if(!(i<0)){var n=new p.PolyNode;if(n.m_jointype=e,n.m_endtype=r,r===p.EndType.etClosedLine||r===p.EndType.etClosedPolygon)for(;i>0&&p.FPoint.op_Equality(t[0],t[i]);)i--;n.m_polygon.push(t[0]);for(var s=0,o=0,a=1;a<=i;a++)p.FPoint.op_Inequality(n.m_polygon[s],t[a])&&(s++,n.m_polygon.push(t[a]),(t[a].Y>n.m_polygon[o].Y||t[a].Y===n.m_polygon[o].Y&&t[a].X<n.m_polygon[o].X)&&(o=s));if(!(r===p.EndType.etClosedPolygon&&s<2)&&(this.m_polyNodes.AddChild(n),r===p.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new p.FPoint2(this.m_polyNodes.ChildCount()-1,o);else{var l=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[o].Y>l.Y||n.m_polygon[o].Y===l.Y&&n.m_polygon[o].X<l.X)&&(this.m_lowest=new p.FPoint2(this.m_polyNodes.ChildCount()-1,o))}}},p.ClipperOffset.prototype.AddPaths=function(t,e,r){for(var i=this,n=0,s=t.length;n<s;n++)i.AddPath(t[n],e,r)},p.ClipperOffset.prototype.FixOrientations=function(){var t=this;if(this.m_lowest.X>=0&&!p.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var e=0;e<this.m_polyNodes.ChildCount();e++){var r=t.m_polyNodes.Childs()[e];(r.m_endtype===p.EndType.etClosedPolygon||r.m_endtype===p.EndType.etClosedLine&&p.Clipper.Orientation(r.m_polygon))&&r.m_polygon.reverse()}else for(var e=0;e<this.m_polyNodes.ChildCount();e++){var r=t.m_polyNodes.Childs()[e];r.m_endtype===p.EndType.etClosedLine&&!p.Clipper.Orientation(r.m_polygon)&&r.m_polygon.reverse()}},p.ClipperOffset.GetUnitNormal=function(t,e){var r=e.X-t.X,i=e.Y-t.Y;if(r===0&&i===0)return new p.FPoint2(0,0);var n=1/Math.sqrt(r*r+i*i);return r*=n,i*=n,new p.FPoint2(i,-r)},p.ClipperOffset.prototype.DoOffset=function(t){var e=this;if(this.m_destPolys=new Array,this.m_delta=t,p.ClipperBase.near_zero(t)){for(var r=0;r<this.m_polyNodes.ChildCount();r++){var i=e.m_polyNodes.Childs()[r];i.m_endtype===p.EndType.etClosedPolygon&&e.m_destPolys.push(i.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var n;this.ArcTolerance<=0?n=p.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(t)*p.ClipperOffset.def_arc_tolerance?n=Math.abs(t)*p.ClipperOffset.def_arc_tolerance:n=this.ArcTolerance;var s=3.14159265358979/Math.acos(1-n/Math.abs(t));this.m_sin=Math.sin(p.ClipperOffset.two_pi/s),this.m_cos=Math.cos(p.ClipperOffset.two_pi/s),this.m_StepsPerRad=s/p.ClipperOffset.two_pi,t<0&&(this.m_sin=-this.m_sin);for(var r=0;r<this.m_polyNodes.ChildCount();r++){var i=e.m_polyNodes.Childs()[r];e.m_srcPoly=i.m_polygon;var o=e.m_srcPoly.length;if(!(o===0||t<=0&&(o<3||i.m_endtype!==p.EndType.etClosedPolygon))){if(e.m_destPoly=new Array,o===1){if(i.m_jointype===p.JoinType.jtRound)for(var a=1,l=0,h=1;h<=s;h++){e.m_destPoly.push(new p.FPoint2(e.m_srcPoly[0].X+a*t,e.m_srcPoly[0].Y+l*t));var u=a;a=a*e.m_cos-e.m_sin*l,l=u*e.m_sin+l*e.m_cos}else for(var a=-1,l=-1,h=0;h<4;++h)e.m_destPoly.push(new p.FPoint2(e.m_srcPoly[0].X+a*t,e.m_srcPoly[0].Y+l*t)),a<0?a=1:l<0?l=1:a=-1;e.m_destPolys.push(e.m_destPoly);continue}e.m_normals.length=0;for(var h=0;h<o-1;h++)e.m_normals.push(p.ClipperOffset.GetUnitNormal(e.m_srcPoly[h],e.m_srcPoly[h+1]));if(i.m_endtype===p.EndType.etClosedLine||i.m_endtype===p.EndType.etClosedPolygon?e.m_normals.push(p.ClipperOffset.GetUnitNormal(e.m_srcPoly[o-1],e.m_srcPoly[0])):e.m_normals.push(new p.FPoint1(e.m_normals[o-2])),i.m_endtype===p.EndType.etClosedPolygon){for(var f=o-1,h=0;h<o;h++)f=e.OffsetPoint(h,f,i.m_jointype);e.m_destPolys.push(e.m_destPoly)}else if(i.m_endtype===p.EndType.etClosedLine){for(var f=o-1,h=0;h<o;h++)f=e.OffsetPoint(h,f,i.m_jointype);e.m_destPolys.push(e.m_destPoly),e.m_destPoly=new Array;for(var c=e.m_normals[o-1],h=o-1;h>0;h--)e.m_normals[h]=new p.FPoint2(-e.m_normals[h-1].X,-e.m_normals[h-1].Y);e.m_normals[0]=new p.FPoint2(-c.X,-c.Y),f=0;for(var h=o-1;h>=0;h--)f=e.OffsetPoint(h,f,i.m_jointype);e.m_destPolys.push(e.m_destPoly)}else{for(var f=0,h=1;h<o-1;++h)f=e.OffsetPoint(h,f,i.m_jointype);var d;if(i.m_endtype===p.EndType.etOpenButt){var h=o-1;d=new p.FPoint2(e.m_srcPoly[h].X+e.m_normals[h].X*t,e.m_srcPoly[h].Y+e.m_normals[h].Y*t),e.m_destPoly.push(d),d=new p.FPoint2(e.m_srcPoly[h].X-e.m_normals[h].X*t,e.m_srcPoly[h].Y-e.m_normals[h].Y*t),e.m_destPoly.push(d)}else{var h=o-1;f=o-2,e.m_sinA=0,e.m_normals[h]=new p.FPoint2(-e.m_normals[h].X,-e.m_normals[h].Y),i.m_endtype===p.EndType.etOpenSquare?e.DoSquare(h,f):e.DoRound(h,f)}for(var h=o-1;h>0;h--)e.m_normals[h]=new p.FPoint2(-e.m_normals[h-1].X,-e.m_normals[h-1].Y);e.m_normals[0]=new p.FPoint2(-e.m_normals[1].X,-e.m_normals[1].Y),f=o-1;for(var h=f-1;h>0;--h)f=e.OffsetPoint(h,f,i.m_jointype);i.m_endtype===p.EndType.etOpenButt?(d=new p.FPoint2(e.m_srcPoly[0].X-e.m_normals[0].X*t,e.m_srcPoly[0].Y-e.m_normals[0].Y*t),e.m_destPoly.push(d),d=new p.FPoint2(e.m_srcPoly[0].X+e.m_normals[0].X*t,e.m_srcPoly[0].Y+e.m_normals[0].Y*t),e.m_destPoly.push(d)):(f=1,e.m_sinA=0,i.m_endtype===p.EndType.etOpenSquare?e.DoSquare(0,1):e.DoRound(0,1)),e.m_destPolys.push(e.m_destPoly)}}}},p.ClipperOffset.prototype.Execute=function(){var t=arguments,e=t[0]instanceof p.PolyTree;if(e){var r=t[0],i=t[1];r.Clear(),this.FixOrientations(),this.DoOffset(i);var n=new p.Clipper(0);if(n.AddPaths(this.m_destPolys,p.PolyType.ptSubject,!0),i>0)n.Execute(p.ClipType.ctUnion,r,p.PolyFillType.pftPositive,p.PolyFillType.pftPositive);else{var s=p.Clipper.GetBounds(this.m_destPolys),o=new p.Path;if(o.push(new p.FPoint2(s.left-10,s.bottom+10)),o.push(new p.FPoint2(s.right+10,s.bottom+10)),o.push(new p.FPoint2(s.right+10,s.top-10)),o.push(new p.FPoint2(s.left-10,s.top-10)),n.AddPath(o,p.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(p.ClipType.ctUnion,r,p.PolyFillType.pftNegative,p.PolyFillType.pftNegative),r.ChildCount()===1&&r.Childs()[0].ChildCount()>0){var a=r.Childs()[0];r.Childs()[0]=a.Childs()[0],r.Childs()[0].m_Parent=r;for(var l=1;l<a.ChildCount();l++)r.AddChild(a.Childs()[l])}else r.Clear()}}else{var r=t[0],i=t[1];p.Clear(r),this.FixOrientations(),this.DoOffset(i);var n=new p.Clipper(0);if(n.AddPaths(this.m_destPolys,p.PolyType.ptSubject,!0),i>0)n.Execute(p.ClipType.ctUnion,r,p.PolyFillType.pftPositive,p.PolyFillType.pftPositive);else{var s=p.Clipper.GetBounds(this.m_destPolys),o=new p.Path;o.push(new p.FPoint2(s.left-10,s.bottom+10)),o.push(new p.FPoint2(s.right+10,s.bottom+10)),o.push(new p.FPoint2(s.right+10,s.top-10)),o.push(new p.FPoint2(s.left-10,s.top-10)),n.AddPath(o,p.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(p.ClipType.ctUnion,r,p.PolyFillType.pftNegative,p.PolyFillType.pftNegative),r.length>0&&r.splice(0,1)}}},p.ClipperOffset.prototype.OffsetPoint=function(t,e,r){if(this.m_sinA=this.m_normals[e].X*this.m_normals[t].Y-this.m_normals[t].X*this.m_normals[e].Y,this.m_sinA===0)return e;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new p.FPoint2(this.m_srcPoly[t].X+this.m_normals[e].X*this.m_delta,this.m_srcPoly[t].Y+this.m_normals[e].Y*this.m_delta)),this.m_destPoly.push(new p.FPoint1(this.m_srcPoly[t])),this.m_destPoly.push(new p.FPoint2(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta,this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta));else switch(r){case p.JoinType.jtMiter:var i=1+(this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y);i>=this.m_miterLim?this.DoMiter(t,e,i):this.DoSquare(t,e);break;case p.JoinType.jtSquare:this.DoSquare(t,e);break;case p.JoinType.jtRound:this.DoRound(t,e);break}return e=t,e},p.ClipperOffset.prototype.DoSquare=function(t,e){var r=Math.tan(Math.atan2(this.m_sinA,this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y)/4);this.m_destPoly.push(new p.FPoint2(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[e].X-this.m_normals[e].Y*r),this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[e].Y+this.m_normals[e].X*r))),this.m_destPoly.push(new p.FPoint2(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[t].X+this.m_normals[t].Y*r),this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[t].Y-this.m_normals[t].X*r)))},p.ClipperOffset.prototype.DoMiter=function(t,e,r){var i=this.m_delta/r;this.m_destPoly.push(new p.FPoint2(this.m_srcPoly[t].X+(this.m_normals[e].X+this.m_normals[t].X)*i,this.m_srcPoly[t].Y+(this.m_normals[e].Y+this.m_normals[t].Y)*i))},p.ClipperOffset.prototype.DoRound=function(t,e){for(var r=this,i=Math.atan2(this.m_sinA,this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y),n=Math.max(Math.round(this.m_StepsPerRad*Math.abs(i)),1),s=this.m_normals[e].X,o=this.m_normals[e].Y,a,l=0;l<n;++l)r.m_destPoly.push(new p.FPoint2(r.m_srcPoly[t].X+s*r.m_delta,r.m_srcPoly[t].Y+o*r.m_delta)),a=s,s=s*r.m_cos-r.m_sin*o,o=a*r.m_sin+o*r.m_cos;this.m_destPoly.push(new p.FPoint2(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta,this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta))},p.Error=function(t){try{throw new Error(t)}catch(e){alert(e.message)}},p.JS={},p.JS.AreaOfPolygon=function(t){return p.Clipper.Area(t)},p.JS.AreaOfPolygons=function(t){for(var e=0,r=0;r<t.length;r++)e+=p.Clipper.Area(t[r]);return e},p.JS.BoundsOfPath=function(t){return p.JS.BoundsOfPaths([t])},p.JS.BoundsOfPaths=function(t){var e=p.Clipper.GetBounds(t);return e},p.JS.Clean=function(i,e){if(!(i instanceof Array))return[];var r=i[0]instanceof Array,i=p.JS.Clone(i);if(typeof e!="number"||e===null)return p.Error("Delta is not a number in Clean()."),i;if(i.length===0||i.length===1&&i[0].length===0||e<0)return i;r||(i=[i]);for(var n=i.length,s,o,a,l,h,u,f,c=[],d=0;d<n;d++)if(o=i[d],s=o.length,s!==0){if(s<3){a=o,c.push(a);continue}for(a=o,l=e*e,h=o[0],u=1,f=1;f<s;f++)(o[f].X-h.X)*(o[f].X-h.X)+(o[f].Y-h.Y)*(o[f].Y-h.Y)<=l||(a[u]=o[f],h=o[f],u++);h=o[u-1],(o[0].X-h.X)*(o[0].X-h.X)+(o[0].Y-h.Y)*(o[0].Y-h.Y)<=l&&u--,u<s&&a.splice(u,s-u),a.length&&c.push(a)}return!r&&c.length?c=c[0]:!r&&c.length===0?c=[]:r&&c.length===0&&(c=[[]]),c},p.JS.Clone=function(t){if(!(t instanceof Array))return[];if(t.length===0)return[];if(t.length===1&&t[0].length===0)return[[]];var e=t[0]instanceof Array;e||(t=[t]);var r=t.length,i,n,s,o,a=new Array(r);for(n=0;n<r;n++){for(i=t[n].length,o=new Array(i),s=0;s<i;s++)o[s]={X:t[n][s].X,Y:t[n][s].Y};a[n]=o}return e||(a=a[0]),a},p.JS.Lighten=function(t,e){if(!(t instanceof Array))return[];if(typeof e!="number"||e===null)return p.Error("Tolerance is not a number in Lighten()."),p.JS.Clone(t);if(t.length===0||t.length===1&&t[0].length===0||e<0)return p.JS.Clone(t);var r=t[0]instanceof Array;r||(t=[t]);var i,n,s,o,a,l,h,u,f,c,d,v,y,m,g,x,_,P=t.length,w=e*e,b=[];for(i=0;i<P;i++)if(s=t[i],l=s.length,l!==0){for(o=0;o<1e6;o++){for(a=[],l=s.length,s[l-1].X!==s[0].X||s[l-1].Y!==s[0].Y?(v=1,s.push({X:s[0].X,Y:s[0].Y}),l=s.length):v=0,d=[],n=0;n<l-2;n++)h=s[n],f=s[n+1],u=s[n+2],x=h.X,_=h.Y,y=u.X-x,m=u.Y-_,(y!==0||m!==0)&&(g=((f.X-x)*y+(f.Y-_)*m)/(y*y+m*m),g>1?(x=u.X,_=u.Y):g>0&&(x+=y*g,_+=m*g)),y=f.X-x,m=f.Y-_,c=y*y+m*m,c<=w&&(d[n+1]=1,n++);for(a.push({X:s[0].X,Y:s[0].Y}),n=1;n<l-1;n++)d[n]||a.push({X:s[n].X,Y:s[n].Y});if(a.push({X:s[l-1].X,Y:s[l-1].Y}),v&&s.pop(),d.length)s=a;else break}l=a.length,a[l-1].X===a[0].X&&a[l-1].Y===a[0].Y&&a.pop(),a.length>2&&b.push(a)}return r||(b=b[0]),typeof b>"u"&&(b=[]),b},p.JS.PerimeterOfPath=function(t,e){if(typeof t>"u")return 0;var r=Math.sqrt,i=0,n,s,o=0,a=0,l=0,h=0,u=t.length;if(u<2)return 0;for(e&&(t[u]=t[0],u++);--u;)n=t[u],o=n.X,a=n.Y,s=t[u-1],l=s.X,h=s.Y,i+=r((o-l)*(o-l)+(a-h)*(a-h));return e&&t.pop(),i},p.JS.PerimeterOfPaths=function(t,e){for(var r=0,i=0;i<t.length;i++)r+=p.JS.PerimeterOfPath(t[i],e);return r},p.ExPolygons=function(){return[]},p.ExPolygon=function(){this.outer=null,this.holes=null},p.JS.AddOuterPolyNodeToExPolygons=function(t,e){var r=new p.ExPolygon;r.outer=t.Contour();var i=t.Childs(),n=i.length;r.holes=new Array(n);var s,o,a,l,h,u;for(a=0;a<n;a++)for(s=i[a],r.holes[a]=s.Contour(),l=0,h=s.Childs(),u=h.length;l<u;l++)o=h[l],p.JS.AddOuterPolyNodeToExPolygons(o,e);e.push(r)},p.JS.ExPolygonsToPaths=function(t){var e,r,i,n,s=new p.Paths;for(e=0,i=t.length;e<i;e++)for(s.push(t[e].outer),r=0,n=t[e].holes.length;r<n;r++)s.push(t[e].holes[r]);return s},p.JS.PolyTreeToExPolygons=function(t){var e=new p.ExPolygons,r,i,n,s;for(i=0,n=t.Childs(),s=n.length;i<s;i++)r=n[i],p.JS.AddOuterPolyNodeToExPolygons(r,e);return e};var J=p,Gi={},zy={get exports(){return Gi},set exports(t){Gi=t}};class Wy{constructor(e=[],r=$y){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:i}=this,n=r[e];for(;e>0;){const s=e-1>>1,o=r[s];if(i(n,o)>=0)break;r[e]=o,e=s}r[e]=n}_down(e){const{data:r,compare:i}=this,n=this.length>>1,s=r[e];for(;e<n;){let o=(e<<1)+1,a=r[o];const l=o+1;if(l<this.length&&i(r[l],a)<0&&(o=l,a=r[l]),i(a,s)>=0)break;r[e]=a,e=o}r[e]=s}}function $y(t,e){return t<e?-1:t>e?1:0}var Yy=Object.freeze({__proto__:null,default:Wy}),Vy=jo(Yy),Hi=Vy;Hi.default&&(Hi=Hi.default),zy.exports=Th,Gi.default=Th;function Th(t,e,r){e=e||1;for(var i,n,s,o,a=0;a<t[0].length;a++){var l=t[0][a];(!a||l[0]<i)&&(i=l[0]),(!a||l[1]<n)&&(n=l[1]),(!a||l[0]>s)&&(s=l[0]),(!a||l[1]>o)&&(o=l[1])}var h=s-i,u=o-n,f=Math.min(h,u),c=f/2;if(f===0){var d=[i,n];return d.distance=0,d}for(var v=new Hi(void 0,jy),y=i;y<s;y+=f)for(var m=n;m<o;m+=f)v.push(new we(y+c,m+c,c,t));var g=qy(t),x=new we(i+h/2,n+u/2,0,t);x.d>g.d&&(g=x);for(var _=v.length;v.length;){var P=v.pop();P.d>g.d&&(g=P,r&&console.log("found best %d after %d probes",Math.round(1e4*P.d)/1e4,_)),!(P.max-g.d<=e)&&(c=P.h/2,v.push(new we(P.x-c,P.y-c,c,t)),v.push(new we(P.x+c,P.y-c,c,t)),v.push(new we(P.x-c,P.y+c,c,t)),v.push(new we(P.x+c,P.y+c,c,t)),_+=4)}r&&(console.log("num probes: "+_),console.log("best distance: "+g.d));var w=[g.x,g.y];return w.distance=g.d,w}function jy(t,e){return e.max-t.max}function we(t,e,r,i){this.x=t,this.y=e,this.h=r,this.d=Zy(t,e,i),this.max=this.d+this.h*Math.SQRT2}function Zy(t,e,r){for(var i=!1,n=1/0,s=0;s<r.length;s++)for(var o=r[s],a=0,l=o.length,h=l-1;a<l;h=a++){var u=o[a],f=o[h];u[1]>e!=f[1]>e&&t<(f[0]-u[0])*(e-u[1])/(f[1]-u[1])+u[0]&&(i=!i),n=Math.min(n,Jy(t,e,u,f))}return n===0?0:(i?1:-1)*Math.sqrt(n)}function qy(t){for(var e=0,r=0,i=0,n=t[0],s=0,o=n.length,a=o-1;s<o;a=s++){var l=n[s],h=n[a],u=l[0]*h[1]-h[0]*l[1];r+=(l[0]+h[0])*u,i+=(l[1]+h[1])*u,e+=u*3}return e===0?new we(n[0][0],n[0][1],0,t):new we(r/e,i/e,0,t)}function Jy(t,e,r,i){var n=r[0],s=r[1],o=i[0]-n,a=i[1]-s;if(o!==0||a!==0){var l=((t-n)*o+(e-s)*a)/(o*o+a*a);l>1?(n=i[0],s=i[1]):l>0&&(n+=o*l,s+=a*l)}return o=t-n,a=e-s,o*o+a*a}var Ur=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function Ih(){var t=new Ur(6);return Ur!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function Qy(t,e,r){var i=e[0],n=e[1],s=e[2],o=e[3],a=e[4],l=e[5],h=Math.sin(r),u=Math.cos(r);return t[0]=i*u+s*h,t[1]=n*u+o*h,t[2]=i*-h+s*u,t[3]=n*-h+o*u,t[4]=a,t[5]=l,t}function Ky(t,e,r){var i=e[0],n=e[1],s=e[2],o=e[3],a=e[4],l=e[5],h=r[0],u=r[1];return t[0]=i,t[1]=n,t[2]=s,t[3]=o,t[4]=i*h+s*u+a,t[5]=n*h+o*u+l,t}function tg(t,e){var r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=r,t[2]=-r,t[3]=i,t[4]=0,t[5]=0,t}function eg(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function zi(){var t=new Ur(2);return Ur!=Float32Array&&(t[0]=0,t[1]=0),t}function Wi(t,e){var r=new Ur(2);return r[0]=t,r[1]=e,r}function rg(t,e){return t[0]=-e[0],t[1]=-e[1],t}function Ch(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[2]*n+r[4],t[1]=r[1]*i+r[3]*n+r[5],t}(function(){var t=zi();return function(e,r,i,n,s,o){var a,l;for(r||(r=2),i||(i=0),n?l=Math.min(n*r+i,e.length):l=e.length,a=i;a<l;a+=r)t[0]=e[a],t[1]=e[a+1],s(t,t,o),e[a]=t[0],e[a+1]=t[1];return e}})();var $s={},ig={get exports(){return $s},set exports(t){$s=t}};function Ys(){}Ys.prototype={on:function(t,e,r){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var i=this;function n(){i.off(t,n),e.apply(r,arguments)}return n._=e,this.on(t,n,r)},emit:function(t){var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),i=0,n=r.length;for(i;i<n;i++)r[i].fn.apply(r[i].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),i=r[t],n=[];if(i&&e)for(var s=0,o=i.length;s<o;s++)i[s].fn!==e&&i[s].fn._!==e&&n.push(i[s]);return n.length?r[t]=n:delete r[t],this}},ig.exports=Ys;var Ah=$s.TinyEmitter=Ys,Vs={},ng={get exports(){return Vs},set exports(t){Vs=t}};(function(t,e){var r=function(){var i={},n=Math.PI/180,s=180/Math.PI,o=6378137,a=20037508342789244e-9;function l(u){return Number(u)===u&&u%1!==0}function h(u){if(u=u||{},this.size=u.size||256,this.expansion=u.antimeridian===!0?2:1,!i[this.size]){var f=this.size,c=i[this.size]={};c.Bc=[],c.Cc=[],c.zc=[],c.Ac=[];for(var d=0;d<30;d++)c.Bc.push(f/360),c.Cc.push(f/(2*Math.PI)),c.zc.push(f/2),c.Ac.push(f),f*=2}this.Bc=i[this.size].Bc,this.Cc=i[this.size].Cc,this.zc=i[this.size].zc,this.Ac=i[this.size].Ac}return h.prototype.px=function(u,f){if(l(f)){var c=this.size*Math.pow(2,f),d=c/2,v=c/360,y=c/(2*Math.PI),m=c,g=Math.min(Math.max(Math.sin(n*u[1]),-.9999),.9999),x=d+u[0]*v,_=d+.5*Math.log((1+g)/(1-g))*-y;return x>m*this.expansion&&(x=m*this.expansion),_>m&&(_=m),[x,_]}else{var d=this.zc[f],g=Math.min(Math.max(Math.sin(n*u[1]),-.9999),.9999),x=Math.round(d+u[0]*this.Bc[f]),_=Math.round(d+.5*Math.log((1+g)/(1-g))*-this.Cc[f]);return x>this.Ac[f]*this.expansion&&(x=this.Ac[f]*this.expansion),_>this.Ac[f]&&(_=this.Ac[f]),[x,_]}},h.prototype.ll=function(u,f){if(l(f)){var c=this.size*Math.pow(2,f),d=c/360,v=c/(2*Math.PI),y=c/2,m=(u[1]-y)/-v,g=(u[0]-y)/d,x=s*(2*Math.atan(Math.exp(m))-.5*Math.PI);return[g,x]}else{var m=(u[1]-this.zc[f])/-this.Cc[f],g=(u[0]-this.zc[f])/this.Bc[f],x=s*(2*Math.atan(Math.exp(m))-.5*Math.PI);return[g,x]}},h.prototype.bbox=function(u,f,c,d,v){d&&(f=Math.pow(2,c)-1-f);var y=[u*this.size,(+f+1)*this.size],m=[(+u+1)*this.size,f*this.size],g=this.ll(y,c).concat(this.ll(m,c));return v==="900913"?this.convert(g,"900913"):g},h.prototype.xyz=function(u,f,c,d){d==="900913"&&(u=this.convert(u,"WGS84"));var v=[u[0],u[1]],y=[u[2],u[3]],m=this.px(v,f),g=this.px(y,f),x=[Math.floor(m[0]/this.size),Math.floor((g[0]-1)/this.size)],_=[Math.floor(g[1]/this.size),Math.floor((m[1]-1)/this.size)],P={minX:Math.min.apply(Math,x)<0?0:Math.min.apply(Math,x),minY:Math.min.apply(Math,_)<0?0:Math.min.apply(Math,_),maxX:Math.max.apply(Math,x),maxY:Math.max.apply(Math,_)};if(c){var w={minY:Math.pow(2,f)-1-P.maxY,maxY:Math.pow(2,f)-1-P.minY};P.minY=w.minY,P.maxY=w.maxY}return P},h.prototype.convert=function(u,f){return f==="900913"?this.forward(u.slice(0,2)).concat(this.forward(u.slice(2,4))):this.inverse(u.slice(0,2)).concat(this.inverse(u.slice(2,4)))},h.prototype.forward=function(u){var f=[o*u[0]*n,o*Math.log(Math.tan(Math.PI*.25+.5*u[1]*n))];return f[0]>a&&(f[0]=a),f[0]<-a&&(f[0]=-a),f[1]>a&&(f[1]=a),f[1]<-a&&(f[1]=-a),f},h.prototype.inverse=function(u){return[u[0]*s/o,(Math.PI*.5-2*Math.atan(Math.exp(-u[1]/o)))*s]},h}();t.exports=r})(ng);var sg=Vs;function Eh(t,e){e||(e={x:0,z:0});const r=ag(e,t);return Math.sqrt(r.x*r.x+r.z*r.z)}function Sh(t){const e=Eh(t);return{x:t.x/e,z:t.z/e}}function og(t,e){return t||(t={x:0,z:0}),lg(Math.atan2(-e.z+t.z,e.x-t.x)*180/Math.PI,2)}function ag(t,e){return{x:t.x-e.x,z:t.z-e.z}}function lg(t,e=0){const r=Math.pow(10,e);return Math.round(t*r)/r}function Nh(t){const e=Pe(t),r=J.Clipper.GetBounds(e);return{x:r.left,x2:r.right,z:r.top,z2:r.bottom,length:r.right-r.left,width:r.bottom-r.top}}function Oh(t){if(Array.isArray(t)){if(!t.length||!t[0])throw new Error("Union failed, empty Array")}else throw new Error("Union failed, input not Array");const e=Pe(t),r=[e[0]],i=e.slice(1),n=new J.Clipper;n.AddPaths(r,J.PolyType.ptSubject,!0),n.AddPaths(i,J.PolyType.ptClip,!0);var s=new J.Paths;return n.Execute(J.ClipType.ctUnion,s,J.PolyFillType.pftNonZero,J.PolyFillType.pftNonZero),Yi(s)}var Lh;(function(t){t[t.etOpenSquare=0]="etOpenSquare",t[t.etOpenRound=1]="etOpenRound",t[t.etOpenButt=2]="etOpenButt",t[t.etClosedLine=3]="etClosedLine",t[t.etClosedPolygon=4]="etClosedPolygon"})(Lh||(Lh={}));function Mh(t,e=.1,r,i){if(r===void 0&&(r=J.EndType.etClosedPolygon),t=i?t:hg(t),!t.length||!t[0].length)return[];e=e&&typeof e=="number"?e:.1;const s=Pe(t),o=new J.ClipperOffset(2),a=new J.Paths;return o.AddPaths(s,J.JoinType.jtMiter,r),o.Execute(a,e),Yi(a)}function Fh(t=[],e=[],r=!1){if(Array.isArray(t)){if(!t.length||!t[0])throw new Error("Intersection failed, empty Array")}else throw new Error("Intersection failed, input not Array");const i=Pe(t),n=e.length&&Pe(e),s=n?i:[i[0]],o=n||i.slice(1),a=new J.Clipper;a.AddPaths(s,J.PolyType.ptSubject,!r),a.AddPaths(o,J.PolyType.ptClip,!0);var l=J.PolyFillType.pftNonZero,h=J.PolyFillType.pftNonZero,u=J.ClipType.ctIntersection,f=r?new J.PolyTree:new J.Paths;a.Execute(u,f,l,h);var c=r?J.Clipper.PolyTreeToPaths(f):f;return Yi(c)}function $i(t,e,r=[]){const i=new J.FPoint(t[0],t[1]),n=Pe([e])[0];let s=J.Clipper.PointInPolygon(i,n);return r.forEach(o=>{let a=$i(t,o);a===1?s=0:a===-1&&(s=-1)}),s}function Rh(t){let e=Pe([t]);return J.JS.AreaOfPolygon(e[0])}function js(t){return Math.abs(Rh(t))}function hg(t,e=.01){let r=Pe(t);const i=J.Clipper.CleanPolygons(r,e);return Yi(i)}function Pe(t=[]){let e=[];for(var r=0;r<t.length;r++){var i=t[r]||[];e[r]=[];for(var n=0;n<i.length;n++){var s=i[n];Number.isFinite(s[0])&&Number.isFinite(s[1])?e[r][n]={X:s[0],Y:s[1]}:console.warn("invalid number",s[0],s[1])}}const o=[];for(const a of e)!a.length?console.warn("empty polygon"):o.push(a);if(!o.length)throw new Error("empty polygon invalid input");return o}function Yi(t){let e=[];for(var r=0;r<t.length;r++){var i=t[r]||[];e[r]=[];for(var n=0;n<i.length;n++){var s=i[n];e[r][n]=[s.X,s.Y]}}return e}function ug(t){let e=[1/0,1/0],r=[-1/0,-1/0];return t.forEach(i=>{i[0]<e[0]&&(e[0]=i[0]),i[1]<e[1]&&(e[1]=i[1]),i[0]>r[0]&&(r[0]=i[0]),i[1]>r[1]&&(r[1]=i[1])}),{min:e,max:r}}function fg(t,e=!0){let r=0;const i=e?t.length:t.length-1;for(var n=0;n<i;n++){let s={x:t[n][0],z:t[n][1]},o={x:t[n<t.length-1?n+1:0][0],z:t[n<t.length-1?n+1:0][1]};r+=Eh(s,o)}return r}function cg(t){const{min:e,max:r}=ug(t);return[e[0]+(r[0]-e[0])/2,e[1]+(r[1]-e[1])/2]}function kh(t,e=[]){return js(t)<.1?cg(t):Gi([t,...e],.1)}function Uh(t,e,r=!1){let i=0,n=e.x,s=e.z;if(e.controlLine&&e.w&&(i=e.controlLine==="front"?e.w:e.controlLine==="center"?e.w/2:0),i){let v=e.ry/180*Math.PI;n-=i*Math.sin(v),s-=i*Math.cos(v)}const o=t.ry||0,a=e.ry||0,l=Wi(t.x,t.z),h=Wi(n,s),u=-a*Math.PI/180;let f=Ih(),c=zi();eg(f,h),Qy(f,f,u),Ch(c,l,f);const d={x:c[0],z:c[1],y:t.y+e.y||0,ry:o+a};return r?Object.assign(t,d):Object.assign({},t,d)}function pg(t,e,r=!1){let i=0,n=e.x,s=e.z;if(e.controlLine&&e.w&&(i=e.controlLine==="front"?e.w:e.controlLine==="center"?e.w/2:0),i){let y=e.ry/180*Math.PI;n-=i*Math.sin(y),s-=i*Math.cos(y)}const o=t.ry||0,a=e.ry||0,l=Wi(t.x,t.z),h=Wi(n,s),u=a*Math.PI/180;let f=Ih(),c=zi(),d=zi();rg(d,h),tg(f,u),Ky(f,f,d),Ch(c,l,f);const v={x:c[0],z:c[1],y:t.y-e.y||0,ry:o-a};return r?Object.assign(t,v):Object.assign({},t,v)}function dg(t){if(typeof t!="object")throw new Error("Get el data, invalid type");let{x:e,z:r,l:i,ry:n}={...t},s=t.type==="a:helper:spaceDivider";if(!s&&!Number.isFinite(t.w)||!Number.isFinite(i)||!Number.isFinite(e)||!Number.isFinite(r)){let w={type:t.type,id:t.id,x:e,z:r,l:i,ry:n,w:t.w};throw new Error(`Get el vectors, params missing ${JSON.stringify(w)}`)}let o,a,l,h,u,f,c,d,v,y,m,g,x,_,P;return o=n/180*Math.PI,a=t.barCounter?t.w+.25:t.w,s&&(a=0),u={x:a*Math.sin(o),z:a*Math.cos(o)},f=s?u:Sh(u),c={x:i*Math.cos(o),z:-i*Math.sin(o)},d=Sh(c),l=t.barCounter?e+f.x*-.25:e,h=t.barCounter?r+f.z*-.25:r,P=0,t.controlLine==="front"?P=-t.w:t.controlLine==="center"&&(P=-t.w/2),x={x:l,z:h},_={x:l+c.x,z:h+c.z},v={x:x.x+f.x*P,z:x.z+f.z*P},y={x:v.x+c.x,z:v.z+c.z},m={x:v.x+u.x,z:v.z+u.z},g={x:y.x+u.x,z:y.z+u.z},{l1:x,l2:_,p1:v,p2:y,p3:m,p4:g,w:u,l:c,nW:f,nL:d}}function vg(t){if(t.type!=="column")return;let e=[];if(t.shape==="square"){let r=t.l/2;e=[[-r,-r],[r,-r],[r,r],[-r,r]],e=He(t,e)}else if(t.shape==="circle"){const i=Math.PI*2/25;let n=0,s=t.l/2;for(let o=0;o<25;o++)e.push([t.x-s*Math.cos(n),t.z+s*Math.sin(n)]),n+=i}else t.shape==="polygon"&&(e=He(t,t.polygon));return e}function mg(t){let e,r,i;return t.type==="column"?r=vg(t):(e=dg(t),t.type==="a:helper:spaceDivider"?i=[e.l1,e.l2]:i=[e.p1,e.p2,e.p4,e.p3],r=i.map(n=>[n.x,n.z])),r}function He(t,e){return e.map(r=>{let i=Uh({x:r[0],z:r[1]},t);return[i.x,i.z]})}const Bh=(t,e={})=>{let r={};const i=e.keepTransient;return Object.keys(t).forEach(n=>{let s=n.slice(0,1)==="_";if(n==="_ryOrg"){r.ry=t[n];return}else{if(s&&!i)return;if(t[n]===null||t[n]===void 0)return;n!=="children"&&(r[n]=t[n])}}),t.children?r.children=t.children.map(n=>Bh(n,e)):r.children=[],r},Zs=["a:helper:spaceDivider","a:reference:externalId","a:reference:ifcElement","a:reference:ifcFile","a:relation:wall","a:settings:display","a:settings:generatedGroup","box","camera-bookmark","closet","column","curtain","door","floor","floorplan","floorplanDxf","group","interior","kitchen","level","object","pic","plan","polybox","polyfloor","railing","stairs","tag","wall","window"],Dh=(t,e)=>{if(!e||!e.properties){console.warn(`schema is missing for type ${t}`);return}const r={};return Object.keys(e.properties).forEach(i=>{const n=e.properties[i],s=n.const||n.default;s!==void 0&&(r[i]=s)}),t==="interior"&&!r.src&&(r.src="!7dddc882-1def-4497-80e3-d1de834a1a7b"),qr(r)};function yg(t,e={}){const r=Xh(t,{});return Hh(t,null,null,r),e.exportIdMap&&(t.idMap=r),t}function Xh(t,e){return t.id!==void 0&&(e[t.id]=Ne()),t.children.forEach(r=>Xh(r,e)),e}const Gh=t=>Object.prototype.toString.call(t)==="[object Object]",gg=t=>Object.prototype.toString.call(t)==="[object Array]";function Hh(t,e,r,i){typeof t=="string"?(e!==void 0&&r!==void 0&&i[t]&&(e[r]=i[t]),typeof r=="string"&&e!==void 0&&r!==void 0&&i[r]&&(e[i[r]]=t,delete e[r])):(Gh(t)||gg(t))&&(Gh(t)&&t.type&&t.id===void 0&&(t.id=Ne()),Object.entries(t).forEach(([n,s])=>Hh(s,t,n,i)))}const _g={properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"},ry:{type:"number"},id:{type:"string"}}},xg=(t,e,r,i)=>{let n=r;if(typeof r=="string"&&(n=Number(n),console.log(t.type+"."+e,"converted from string to number")),!Number.isFinite(n))throw new Error(`${t.type}.${e} = ${r} is invalid`);const{minimum:s,maximum:o}=i,a=Number.isFinite(s)&&n<s,l=Number.isFinite(o)&&n>o;if(a||l){let h=a?"min:"+s:"max:"+o;throw new Error(`${t.type}.${e} = ${n} is out of range ${h}`)}return n},wg=(t,e,r,i)=>{if(typeof r!="string")throw new Error(`${t.type}.${e} = '${r}' is invalid`);if(i.enum&&!i.enum.includes(r))throw new Error(`${t.type}.${e} = '${r}' is invalid`);return r},Pg=(t,e,r,i)=>i.type==="number"?xg(t,e,r,i):i.type==="string"?wg(t,e,r,i):r,zh=(t,e,r)=>{const{properties:i}=r||_g;for(const n in e){const s=i?.[n],o=r&&!s,a=n.startsWith("_");if(o&&!a){delete e[n];continue}t[n]=Pg(t,n,e[n],s||{type:void 0}),a&&!t[n]&&delete t[n]}return t},Wh={colorDiffuse:{type:"array"},colorSpecular:{type:"array"},wireframeColor:{type:"array"},size:{type:"array"},specularCoef:{type:"number"},opacity:{type:"number"},wireframeOpacity:{type:"number"},wireframeThickness:{type:"number"},wireframeThresholdAngle:{type:"number"},lightEmissionCoef:{type:"number"},bsdfType:{type:"string"},wrap:{type:"string"},receiveRealTimeShadows:{type:"boolean"},hideAfterBaking:{type:"boolean"},castRealTimeShadows:{type:"boolean"},no2dOutline:{type:"boolean"},mapDiffuse:{type:"string"},mapDiffusePreview:{type:"string"},mapDiffuseSource:{type:"string"},mapDiffuseKey:{type:"string"},mapSpecular:{type:"string"},mapSpecularPreview:{type:"string"},mapSpecularSource:{type:"string"},mapSpecularKey:{type:"string"},mapNormal:{type:"string"},mapNormalPreview:{type:"string"},mapNormalSource:{type:"string"},mapNormalKey:{type:"string"},mapAlpha:{type:"string"},mapAlphaPreview:{type:"string"},mapAlphaSource:{type:"string"},mapAlphaKey:{type:"string"}},$h=t=>{let e=typeof t;return t===null?"null":e==="object"&&Array.isArray(t)?"array":e==="number"&&!Number.isFinite(t)?"undefined":e},bg=Object.keys(Wh),Tg=t=>{const e=$h(t),r=e==="string",i=e==="object"&&Object.keys(t).every(n=>{var s;const o=bg.includes(n),a=o&&$h(t[n])===((s=Wh[n])==null?void 0:s.type);return o&&a});return r||i};function Ig(t){return!t||typeof t!="string"?"":t.toLowerCase().replace(/[()+&!?;,:_)]/g,"").replace(/\s+/g,"-")}const Cg={group:"a:settings:generatedGroup"};class Ag{}class wn extends Ag{constructor({node:e,parent:r,scene:i,emitter:n,options:s={}}){super();var o;if(typeof e!="object")throw new Error("node has to be type object: "+e);if(!e.type)throw new Error("node invalid, type is missing: "+JSON.stringify(e));s.setDefaults===void 0&&(s.setDefaults=!1),s.regenerateIds===void 0&&(s.regenerateIds=!1),this._scene=i,this._emitter=n;const a=e.children||[];e.children=[],!e.id||s.setDefaults||s.regenerateIds?this._update(Eg(e,this.schema,s)):this._update(e),this._parent=r,r&&r.children.push(this),(o=this._scene)!=null&&o.registerNode&&this._scene.registerNode(this);const l="add-child";this._emitter&&this._emitter.emit(l,{node:r,args:this,options:s,event:l}),a.filter(h=>(h.type||console.warn("Prevent import from scene structure: Invalid type",h.type+""),h.type)).forEach(h=>this.addChild(h,s))}get parent(){return this._parent}get scene(){return this._scene}get schema(){var e;return(e=this._scene)==null?void 0:e.schema}_update(e={}){var r,i;zh(this,e,(i=(r=this._scene)==null?void 0:r.schema)==null?void 0:i[this.type])}set(e={},r={}){if(this.locked&&!r.force){let n=[];for(let s in e)switch(s){case"locked":case"_highlight":case"_isSelected":n.push(s)}if(n.length>0){let s={};for(const o of n)s[o]=e[o];e=s}else{console.log(`Node ID ${this.id} is locked and cannot be altered.`);return}}e.id&&delete e.id,e.src&&delete e.src,e.children&&delete e.children;let i={};for(let n in e)i[n]=this[n];try{this._update(e)}catch(n){console.warn(n.message);return}if(this._emitter){let n=0,s=0;for(let l in e)switch(e[l]===i[l]&&(delete e[l],delete i[l]),n++,l){case"x":case"y":case"z":case"ry":s++;break}const a=s===n?"set-transform":"set";Object.keys(e).length&&this._emitter.emit(a,{node:this,args:e,prevState:i,options:r,event:a})}}setTransform({x:e,y:r,z:i,ry:n}={},s={}){if(this.locked&&!s.force){console.log(`Node ID ${this.id} is locked and cannot be altered.`);return}let o={},a={};if(e!==void 0){let h=Number(e);this.x!==h&&Number.isFinite(h)&&(a.x=this.x,o.x=this.x=h)}if(r!==void 0){let h=Number(r);this.y!==h&&Number.isFinite(h)&&(a.y=this.y,o.y=this.y=h)}if(i!==void 0){let h=Number(i);this.z!==h&&Number.isFinite(h)&&(a.z=this.z,o.z=this.z=h)}if(n!==void 0){let h=Number(n);this.ry!==h&&Number.isFinite(h)&&(a.ry=this.ry,o.ry=this.ry=h)}const l="set-transform";this._emitter&&Object.keys(o).length&&this._emitter.emit(l,{node:this,args:o,prevState:a,options:s,event:l})}setMaterials(e={},r={}){if(this.locked&&!r.force){console.log(`Node ID ${this.id} is locked and cannot set materials.`);return}let i=0,n={};for(let a in e){const l=e[a];Tg(l)&&(n[a]=(this.materials||{})[a],e[a],i++)}if(i<1){console.log("no valid material definitions in",e);return}const s={...this.materials||{},...e};try{this._update({materials:s})}catch(a){console.warn(a.message);return}const o="set-materials";this._emitter&&this._emitter.emit(o,{node:this,args:e,prevState:n,options:r,event:o})}setTransient(e={},r={}){let i={},n=0,s={};for(let a in e)a[0]==="_"&&(s[a]=this[a],i[a]=e[a],n++);if(n<1){console.log("no transient values in",e,"use underscore");return}try{this._update({...i})}catch(a){console.warn(a.message);return}const o="set-transient";this._emitter&&this._emitter.emit(o,{node:this,args:e,prevState:s,options:r,event:o})}setHighlight(e={},r={}){let i={_highlight:this._highlight};const{fill:n,fillOpacity:s,outline:o,outlineWidth:a}=e;let l;n&&Array.isArray(n)&&(l={fill:n,fillOpacity:s}),o&&Array.isArray(o)&&(l={...l||{},outline:o,outlineWidth:a});const h={_highlight:l};try{this._update(h)}catch(f){console.warn(f.message);return}const u="set-transient";this._emitter&&this._emitter.emit(u,{node:this,args:h,prevState:i,options:r,event:u})}find(e={}){if(!e.id&&(!e.type||typeof e.type!="string"||!Zs.includes(e.type)))return console.warn("type missing or invalid"),null;let r;return this.traverse(i=>{r||(e.id&&i.id===e.id||e.type&&i.type===e.type)&&(r=i)}),r}findAll(e={}){if(!e.type||typeof e.type!="string"||!Zs.includes(e.type))return console.warn("type missing or invalid"),[];let r=[];return this.traverse(i=>i.type===e.type&&r.push(i)),r}addChild(e,r={}){var i,n,s;if(!e.type||typeof e.type!="string"||!Zs.includes(e.type)){console.warn("type missing or invalid");return}else if(this.locked&&!["level","plan"].includes(this.type)&&!r.force){console.log(`Node ID ${this.id} is locked and cannot add children.`);return}if(e.id&&((n=(i=this.scene)==null?void 0:i.nodesById)!=null&&n[e.id])&&!r.regenerateIds){console.warn(`Node with id ${e.id} already exists and can not be added - use options.regenerateIds = true`);return}const o=r.setDefaults!==!1;let a;if(o){const l=(s=this.schema)==null?void 0:s[e.type],h=Dh(e.type,l)||{};a=zh(h,e,l)}else a=e;return new wn({node:a,parent:this,scene:this._scene,emitter:this._emitter,options:{...r,setDefaults:o}})}removeChild(e,r={}){var i;if(e.id){if(this.locked&&!["level","plan"].includes(this.type)&&!r.force){console.log(`Node ID ${this.id} is locked and cannot remove children.`);return}}else{console.error("not valid");return}let n;for(let l=0;l<this.children.length;l++)if(this.children[l].id===e.id){n=l;break}if(!Number.isFinite(n)){console.warn("Node does not exist or is already removed",e);return}let s=e.children||[];for(let l=s.length-1;l>=0;l--)e instanceof wn&&s[l]&&e.removeChild(s[l],r);(i=this._scene)!=null&&i.unregisterNode&&this._scene.unregisterNode(e),this.children.splice(n,1);const o="remove-child";this._emitter&&this._emitter.emit(o,{node:this,args:e,options:r,event:o}),(e?.getReferringNodes?e.getReferringNodes():[]).forEach(l=>l.remove(r))}remove(e){if(this.locked&&!e.force){console.warn(`Node ID ${this.id} is locked and cannot be removed.`);return}else this.parent.removeChild(this,e)}getReferringNodes(){var e,r;let i=[],n=(e=this._scene)==null?void 0:e.nodesByType["a:relation:"+this.type];n&&n.forEach(a=>{var l;(l=a?.nodeIds)!=null&&l.hasOwnProperty(this.id)&&i.push(a)});let s=Cg[this.type]||"a:settings:"+this.type,o=(r=this._scene)==null?void 0:r.nodesByType[s];return o&&o.forEach(a=>{a?.nodeId==this.id&&i.push(a)}),i}getWorldPosition(){return Yh(this)}getLocalPositionFromWorld(e){const r=this.getParents();return r?.length&&r.reverse().forEach(i=>{e=pg(e,i)}),e}getParents(){return Vh(this)}toJson(e={}){let r=Bh(this,e),i=qr(r);return e.regenerateIds&&yg(i,e),i}traverse(e){typeof e=="function"&&(e(this),this.children.forEach(r=>{r.traverse(e)}))}}const Yh=(t,e)=>{const r=e?e.parent:t.parent;if(!r)return console.warn("no parent found"),t;let i=Uh(t,r);return r.parent&&(i=Yh(i,r)),i},Vh=t=>{let e=[];const r=t.parent;return r&&e.push(r),r?.parent&&(e=e.concat(Vh(r))),e},Eg=(t,e,{setDefaults:r,regenerateIds:i})=>{if(!e&&r)throw new Error("schema is missing");if(!t)throw new Error("node missing");const n=e&&e[t.type];let s;if(n&&r){if(s=Dh(t.type,n),!s)throw new Error("no defaults found")}else s={};let o=Object.assign({},s,t);if(!o)throw new Error("applying defaults failed");return(!t.id||i)&&(o.id=Ne()),o};var N;(function(t){t.residential="residential",t.office="office",t.parking="parking"})(N||(N={}));const Vi={work:{name:"Work",isHidden:!0,description:"space for individual head-down work",spaceUsage:{privateOffice:{name:"Private office",category:[N.office]},focusRoom:{name:"Focus room",category:[N.office]},openWorkspace:{name:"Open workspace",category:[N.office]},enclosedWorkspace:{name:"Enclosed workspace",category:[N.office]},closedWorkspace:{name:"Closed workspace",isDeprecated:!0,category:[N.office]},executiveOffice:{name:"Executive office",isDeprecated:!0,category:[N.office]}}},meet:{name:"Meet",isHidden:!0,spaceUsage:{meetingRoom:{name:"Meeting room",category:[N.office]},hub:{name:"Hub",category:[N.office]},assembly:{name:"Assembly",category:[N.office]},boardRoom:{name:"Board room",category:[N.office]},trainingRoom:{name:"Training room",category:[N.office]},collaboration:{name:"Collaboration",isDeprecated:!0,category:[N.office]}}},live:{name:"live",isHidden:!0,spaceUsage:{living:{name:"Living",category:[N.residential]},dining:{name:"Dining",category:[N.residential]},dining_living:{name:"Living & Dining",category:[N.residential]},homeOffice:{name:"Home office",category:[N.residential]},bedroom:{name:"Bedroom",category:[N.residential]}}},socialize:{name:"Socialize",isHidden:!0,spaceUsage:{lobby:{name:"Lobby",category:[N.office,N.residential]},reception:{name:"Reception",category:[N.office]},lounge:{name:"Lounge",category:[N.office]},cafe:{name:"Cafe",category:[N.office]},canteen:{name:"Canteen",category:[N.office]},pantry:{name:"Pantry",category:[N.office]},terrace:{name:"Terrace",isOutdoor:!0,category:[N.office,N.residential]},balcony:{name:"Balcony",isOutdoor:!0,category:[N.office,N.residential]},rooftop:{name:"Rooftop",isOutdoor:!0,category:[N.office,N.residential]},courtyard:{name:"Courtyard",isOutdoor:!0,category:[N.office,N.residential]},garden:{name:"Garden",isOutdoor:!0,category:[N.residential]},common:{name:"Common",isDeprecated:!0,category:[N.office]}}},support:{name:"Support",isHidden:!0,spaceUsage:{serviceKitchen:{name:"Service kitchen",category:[N.office]},printStation:{name:"Print station",category:[N.office]},storage:{name:"Storage",category:[N.residential,N.office,N.parking]},mailRoom:{name:"Mail room",category:[N.office]},operationalRoom:{name:"Operational room",category:[N.office,N.parking]},serviceRoom:{name:"Service room",category:[N.office]},laundryRoom:{name:"Laundry room",category:[N.residential]},operate:{name:"Operate",isDeprecated:!0,category:[N.office]},services:{name:"Services",isDeprecated:!0,category:[N.office,N.residential]}}},care:{name:"Care",isHidden:!0,spaceUsage:{kitchen:{name:"Kitchen",category:[N.residential]},wellnessRoom:{name:"Wellness room",category:[N.office]},restroom:{name:"Restroom",category:[N.office,N.parking]},bathroom:{name:"Bathroom",category:[N.residential]},shower:{name:"Shower",category:[N.office,N.residential]},toilet:{name:"Toilet",category:[N.residential]}}},circulate:{name:"Circulate",isHidden:!0,spaceUsage:{corridor:{name:"Corridor",category:[N.residential,N.office,N.parking]},foyer:{name:"Foyer",category:[N.residential,N.office,N.parking]},staircase:{name:"Staircase",isVertical:!0,category:[N.residential,N.office,N.parking]},elevator:{name:"Elevator",isVertical:!0,category:[N.residential,N.office,N.parking]}}},drive:{name:"Drive",isHidden:!0,spaceUsage:{parkingSpot:{name:"Parking spot",category:[N.parking]},driveway:{name:"Driveway",category:[N.parking]},garage:{name:"Garage",category:[N.residential]}}},void:{isHidden:!0,name:"Void",spaceUsage:{shaft:{name:"Shaft",isVertical:!0,category:[N.residential,N.office,N.parking]},buildingOpening:{name:"Building opening",isVertical:!0,category:[N.residential,N.office,N.parking]},floorOpening:{name:"Floor opening",isVertical:!0,category:[N.residential,N.office,N.parking]}}},undefined:{isHidden:!0,spaceUsage:{undefined:{name:"Undefined",category:[N.residential,N.office],isHidden:!0}}}},hr={};Object.keys(Vi).forEach(t=>{const e=Vi[t];hr[t]={name:e.name,type:"program",category:[]},e.isHidden&&(hr[t].isHidden=e.isHidden);const r={};Object.keys(Vi[t].spaceUsage).forEach(n=>{const s=Vi[t].spaceUsage[n];hr[n]={...s,type:"space",program:t},s.category.forEach(o=>{r[o]=!0})}),hr[t].category=Object.keys(r)});const jh=(t="")=>{const e=hr[t];let r;return e&&(r=e.type==="program"?t:e.program),r};function Sg(t){let e=[];return t.shape==="square"?e.push({type:"rectangle",position:[-t.l/2,-t.l/2],dimensions:[t.l,t.l]}):t.shape==="circle"?e.push({type:"circle",position:[0,0],radius:t.l/2}):t.shape==="polygon"&&e.push({type:"polygon",points:t.polygon}),e}function Ng(t,e){const r=t.doorType||"singleSwing",i=t.l,n=e.w;let s=[],o=t.doorAngle;const a=t.hinge==="right",l=t.side==="back",h=e.controlLine==="front"?-n:e.controlLine==="center"?-n/2:0;if(o<20&&(o=20),r==="singleSwing"){let u=o*Math.PI/180,f,c,d,v;l?(f=a?0:180-o,c=a?o:180,d=a?[0,h]:[i,h],v=[d[0]+i*Math.cos(u)*(a?1:-1),d[1]+-i*Math.sin(u)]):(f=a?-180:360-o,c=a?-180+o:360,d=a?[i,n+h]:[0,n+h],v=[d[0]+i*Math.cos(u)*(a?-1:1),d[1]+i*Math.sin(u)]),s.push({type:"arc",radius:i,position:d,startAngle:f,endAngle:c},{type:"line",start:d,end:v})}else if(r==="doubleSwing"){const u=o*Math.PI/180;let f,c,d,v,y,m,g,x;l?(f=0,c=o,d=[0,h],v=[d[0]+i/2*Math.cos(u),d[1]+-i/2*Math.sin(u)],g=[i,h],x=[g[0]+-i/2*Math.cos(u),g[1]+-i/2*Math.sin(u)],y=180-o,m=180):(f=360-o,c=360,d=[0,n+h],v=[d[0]+i/2*Math.cos(u),d[1]+i/2*Math.sin(u)],g=[i,n+h],x=[g[0]+-i/2*Math.cos(u),g[1]+i/2*Math.sin(u)],y=180,m=180+o),s.push({type:"arc",radius:i/2,position:d,startAngle:f,endAngle:c},{type:"line",start:d,end:v}),s.push({type:"arc",radius:i/2,position:g,startAngle:y,endAngle:m},{type:"line",start:g,end:x})}return s.push({type:"rectangle",position:[0,h],dimensions:[t.l,n]}),s}function Og(t){let e=[];const r=/90$/g.test(t.cooktopType),i=Lg(t),n=Mg(t,i,r),s=Fg(t,n),o=Rg(t,n),a=kg(t,n),l=.25,h=.6;e.push(ur([0,t.barCounter?-l:0],t.l,t.barCounter?t.w+l:t.w)),n.forEach(f=>{e.push(Ft([f,t.w],[f,t.w-.075]))}),i&&t.barCounter&&e.push(Ft([t.highCabinetLeft*t.elementLength,0],[t.l-t.highCabinetRight*t.elementLength,0]));for(let f of s){const c=n[f],d=c-h;e.push(Ft([d||0,t.w],[d||0,0]),Ft([d||0,0],[c,t.w]),Ft([d||0,t.w],[c,0]),Ft([c,t.w],[c,0]))}const u={fill:!1};if(o&&n[o-2]){let f={type:"group",position:[n[o-2],0],children:[ur([.05,t.w-.5],t.sinkType!=="double"?.5:1.1,.45,u),ur([.1,t.w-.4],t.sinkType!=="double"?.4:.35,.3,u),ur([t.sinkType!=="double"?t.elementLength/2-.02:.48,t.w-.45],.04,.18,u)]};t.sinkType==="double"&&f.children.push(ur([.55,t.w-.4],.35,.3,u),Ft([.95,t.w-.4],[.95,t.w-.1]),Ft([1,t.w-.4],[1,t.w-.1]),Ft([1.05,t.w-.4],[1.05,t.w-.1]),Ft([1.1,t.w-.4],[1.1,t.w-.1])),e.push(f)}if(a&&n[a-2]){let f={type:"group",position:[n[a-2],0],children:[ur([.05,t.w-.55],r?.8:.5,.5,u)]};r?f.children.push(se([.225,t.w-.4],.08,u),se([.675,t.w-.4],.08,u),se([.45,t.w-.3],.08,u),se([.225,t.w-.2],.08,u),se([.675,t.w-.2],.08,u)):f.children.push(se([.2,t.w-.4],.08,u),se([.4,t.w-.4],.08,u),se([.2,t.w-.2],.08,u),se([.4,t.w-.2],.08,u)),e.push(f)}return i&&t.wallCabinet&&e.push(Ft([t.highCabinetLeft*t.elementLength,t.wallCabinetWidth],[t.l-t.highCabinetRight*t.elementLength,t.wallCabinetWidth])),e}function Lg(t){const e=t.elementLength,r=t.highCabinetLeft*e,i=t.highCabinetRight*e;return Math.max(0,t.l-r-i)}function Mg(t,e,r){const i=t.elementLength,n=.9,s=t.highCabinetLeft*i;let o,a=[],l=0,h=0;for(o=0;o<t.highCabinetLeft;o++){let u=t.l-l;l+=u>i?i:u,a[o]=l,h++}for(;l+i<s+e;){let u=h===t.cooktopPos-1&&t.cooktopType!=="none"&&r;l+=u?n:i,h++,a.push(l)}for(o=t.highCabinetRight;o>0;o--)l=t.l-i*o+i,a.push(l);return a=a.map(u=>Math.round(u*10)/10),a}function Fg(t,e){let r,i=[];for(r=0;r<t.highCabinetLeft;r++)i.push(r);for(r=0;r<t.highCabinetRight;r++)i.push(e.length-1-r);return i}function Rg(t,e){return typeof t.sinkPos=="number"&&t.sinkPos>t.highCabinetLeft&&t.sinkPos<=e.length-t.highCabinetRight&&t.sinkType!=="none"?t.sinkPos:null}function kg(t,e){return typeof t.cooktopPos=="number"&&t.cooktopPos>t.highCabinetLeft&&t.cooktopPos<=e.length-t.highCabinetRight&&t.cooktopType!=="none"?t.cooktopPos:null}function Ft(t,e){return{type:"line",start:t,end:e}}function ur(t,e,r,i){return{type:"rectangle",position:t,dimensions:[e,r],style:i}}function se(t,e,r){return{type:"circle",position:t,radius:e,style:r}}function Ug(t){let e;return t.controlLine==="center"?e=-t.w/2:t.controlLine==="front"?e=-t.w:e=0,[{type:"rectangle",position:[0,e],dimensions:[t.l,t.w]}]}function Br(t,e,r=.5){let i=[e[0]-t[0],e[1]-t[1]];return[t[0]+i[0]*r,t[1]+i[1]*r]}function Bg(t,e,r,i=5){const n=[];let s,o,a,l=0;for(let h=0;h<=i;++h)l=h/i,s=Br(t,e,l),o=Br(e,r,l),a=Br(s,o,l),n.push(a);return n}const Dg=48,Xg=12,Gg=100,Zh=(t,e)=>{const r=Math.ceil(Dg/(Math.PI*2)*t*e),i=Math.ceil(Xg/(Math.PI*2)*t);return Math.min(Gg,Math.max(i,r))},qh=t=>{const e={type:"polygon",points:[]};switch(t.type){case"circle":const r=t.radius,i=Zh(Math.PI*2,r),n=t.position,s=Math.PI*2/i;let o=0;for(let l=0;l<i;l++)e.points.push([r*Math.cos(o)+n[0],-r*Math.sin(o)+n[1]]),o+=s;break;case"polygon":e.points=t.points;break;case"rectangle":const a=t.dimensions;e.points=[[0,0],[0,a[1]],[a[0],a[1]],[a[0],0]];break;case"composite":for(const l of t.segments){let h=qs(l);e.points.push(...h.points)}break}return e},qs=t=>{const e={type:"polyline",points:[]};switch(t.type){case"line":e.points=[t.start,t.end];break;case"arc":const r=t.startAngle/180*Math.PI,n=t.endAngle/180*Math.PI-r,s=t.radius,o=Zh(Math.abs(n),s),a=t.position,l=n/o;let h=r;for(let u=0;u<o+1;u++)e.points.push([s*Math.cos(h)+a[0],-s*Math.sin(h)+a[1]]),h+=l;break;case"polyline":e.points=t.points;break;case"quadraticBezier":e.points.push(t.points[0]);for(let u=0;u<=t.points.length-3;u++){let f=t.points[u],c=t.points[u+1],d=t.points[u+2],v=u===0?f:Br(f,c),y=u===t.points.length-3?d:Br(c,d),m=Bg(v,c,y);e.points.push(...m.slice(1))}break}return e};function Hg(t,e={}){const r="straight",i=e.style!=="labelled",n=t.circulation==="left",s=.3;let o=t.stairType||r,a=t.l;const l=t.stepWidth;t.stairType==="straightLanding"?a=t.l-1:t.stairType==="lShaped"?a=t.l+t.w-2*l:t.stairType==="winder"?a=t.l+t.w-l:t.stairType==="halfLanding"?a=(t.l-l)*2:t.stairType==="2QuarterLanding"?a=(t.l-l)*2+t.w-l*2:t.stairType==="doubleWinder"&&(a=t.l*2+t.w-l*2);const h=(a/t.h+1.2321)/.10357/100,u=Math.round(a/h),f=!n&&t.railing==="left"||n&&t.railing==="right"||t.railing==="both",c=!n&&t.railing==="right"||n&&t.railing==="left"||t.railing==="both",d=.05;let v=a/u,y={shape:[],runs:[],railings:[]},m,g,x;switch(o){case"straight":case"straightLanding":y.shape=[[0,0],[t.l,0],[t.l,t.w],[0,t.w]];break;case"lShaped":case"winder":y.shape=[[0,0],[t.l,0],[t.l,t.w],[t.l-l,t.w],[t.l-l,l],[0,l]];break;case"halfLanding":case"2QuarterLanding":case"doubleWinder":y.shape=[[0,0],[t.l,0],[t.l,t.w],[0,t.w],[0,t.w-l],[t.l-l,t.w-l],[t.l-l,l],[0,l]];break}if(y.railings=$g(y.shape,d,f,c),i)switch(o){case"straight":y.runs=[{type:"straight",data:[0,0,u,v,0]}];break;case"straightLanding":m=Math.ceil(u/2),g=u-m,y.runs=[{type:"straight",data:[0,0,m,v,0]},{type:"straight",data:[m*v+1,0,g,v,0]}];break;case"lShaped":m=Math.floor((t.l-l)/v),g=u-m,y.runs=[{type:"straight",data:[0,0,m,(t.l-l)/m,0]},{type:"straight",data:[t.l,l,g,(t.w-l)/g,-90]}];break;case"winder":g=2*Math.round((l/2+s)/v),m=Math.round((t.l-l-s)/v),x=u-m-g,y.runs=[{type:"straight",data:[0,0,m,(t.l-l-s)/m,0]},{type:"winder",data:[t.l-l-s,0,g,0]}],x>0&&y.runs.push({type:"straight",data:[t.l,l+s,x,(t.w-l-s)/x,-90]});break;case"halfLanding":m=u/2,g=u/2,y.runs=[{type:"straight",data:[0,0,m,v,0]},{type:"straight",data:[m*v,t.w,g,v,180]}];break;case"2QuarterLanding":m=Math.round((t.l-l)/v),x=m,g=u-m*2,v=(t.l-l)/m,y.runs=[{type:"straight",data:[0,0,m,(t.l-l)/m,0]},{type:"straight",data:[t.l,l,g,(t.w-l*2)/g,-90]},{type:"straight",data:[m*v,t.w,x,(t.l-l)/m,180]}];break;case"doubleWinder":g=4*Math.round((l/2+s)/v),x=Math.round((t.w-(l+s)*2)/v),m=Math.round((u-g-x)/2),y.runs=[],m>0&&y.runs.push({type:"straight",data:[0,0,m,(t.l-l-s)/m,0]}),y.runs.push({type:"winder",data:[t.l-l-s,0,g/2,0]}),x>0&&y.runs.push({type:"straight",data:[t.l,l+s,x,(t.w-(l+s)*2)/x,-90]}),y.runs.push({type:"winder",data:[t.l,t.w-l-s,g/2,-90]}),m>0&&y.runs.push({type:"straight",data:[t.l-l-s,t.w,m,(t.l-l-s)/m,180]});break}let _,P=[];if(e.style!=="labelled"){let T=[[v/2-.06,l/2+.12],[v/2+.06,l/2],[v/2-.06,l/2-.12]];P.push({type:"polyline",points:T})}if(o!=="spiral")_={type:"polygon",points:y.shape},y.runs.forEach(T=>{T.type==="straight"?P=P.concat(zg(...T.data,l)):T.type==="winder"&&(P=P.concat(Wg(...T.data,l,s)))});else if(o==="spiral"){const T=t.w,E=T-l,I=E+l/2;let C=t.l/I;const O=C/u;C>2*Math.PI&&(C=2*Math.PI-.01);let L=[0,t.w],M=C/Math.PI*180-90;_={type:"composite",segments:[{type:"arc",radius:T,position:L,startAngle:-M,endAngle:90},{type:"arc",radius:E,position:L,startAngle:90,endAngle:-M}]},y.railings=[];const U=T-d,S=E+d;if(f&&y.railings.push({type:"arc",radius:U,position:L,startAngle:-M,endAngle:90}),c&&y.railings.push({type:"arc",radius:S,position:L,startAngle:-M,endAngle:90}),i){let k=0;for(var w=0;w<u&&!(k>=C);w++){const D=[Math.sin(k)*T,Math.cos(k)*T-T],gt=[Math.sin(k)*E,Math.cos(k)*E-T];P.push({type:"polyline",points:[[D[0],-D[1]],[gt[0],-gt[1]]]}),k+=O}}}let b=[_,...P,...y.railings];return n&&(b=b.map(T=>(T.type==="composite"&&(T=qh(T)),T.type==="arc"&&(T=qs(T)),(T.type==="polygon"||T.type==="polyline")&&T.points.forEach(E=>{E[1]=-E[1]+t.w}),T))),b}function zg(t,e,r,i,n=0,s){n=n||0;const o=[];for(var a=0;a<r;a++){let l=[[a*i,0],[a*i,s]];l=He({x:t,z:e,ry:n},l),o.push({type:"polyline",points:l})}return o}function Wg(t,e,r,i,n,s){let o=0,a=0;i=i||0;const l=[];let h=s,u=r/2,f=(n+h)/u,c=h/u,d=0,v=0;for(var y=0;y<u;y++){let m=[[o+d,a+n],[o+v,a]];m=He({x:t,z:e,ry:i},m),l.push({type:"polyline",points:m}),d+=c,v+=f}for(o+=d,d=0,v=0,y=0;y<u;y++){let m=[[o,a+n+d],[o+n,a+v]];m=He({x:t,z:e,ry:i},m),l.push({type:"polyline",points:m}),d+=c,v+=f}return l}function $g(t,e,r,i){const n=[];if(!r&&!i)return[];let s=[];t.length===4?s=t.map((l,h)=>[l[0],l[1]+(h<2?e:-e)]):t.length===6?s=t.map((l,h)=>{let u=[...l];return h<2?u[1]+=e:h>3&&(u[1]-=e),h===1||h===2?u[0]-=e:(h===3||h===4)&&(u[0]+=e),u}):t.length===8&&(s=t.map((l,h)=>{let u=[...l];return h<2||h>3&&h<6?u[1]+=e:(h<4||h>5)&&(u[1]-=e),(h===1||h===2)&&(u[0]-=e),(h===5||h===6)&&(u[0]+=e),u}));const o=s.slice(0,s.length/2),a=s.slice(s.length/2,s.length);return r&&n.push({type:"polyline",points:o}),i&&n.push({type:"polyline",points:a}),n}new sg({size:256});class Tt{polygons=[];clone(){var e=new Tt;return e.polygons=this.polygons.map(function(r){return r.clone()}),e}toPolygons(){return this.polygons}union(e){var r=new Tt.Node(this.clone().polygons),i=new Tt.Node(e.clone().polygons);return r.clipTo(i),i.clipTo(r),i.invert(),i.clipTo(r),i.invert(),r.build(i.allPolygons()),Tt.fromPolygons(r.allPolygons())}subtract(e){var r=new Tt.Node(this.clone().polygons),i=new Tt.Node(e.clone().polygons);return r.invert(),r.clipTo(i),i.clipTo(r),i.invert(),i.clipTo(r),i.invert(),r.build(i.allPolygons()),r.invert(),Tt.fromPolygons(r.allPolygons())}intersect(e){var r=new Tt.Node(this.clone().polygons),i=new Tt.Node(e.clone().polygons);return r.invert(),i.clipTo(r),i.invert(),r.clipTo(i),i.clipTo(r),r.build(i.allPolygons()),r.invert(),Tt.fromPolygons(r.allPolygons())}inverse(){var e=this.clone();return e.polygons.map(function(r){r.flip()}),e}}(function(t){function e(u){var f=new t;return f.polygons=u,f}t.fromPolygons=e;function r(u){u=u||{};var f=new t.Vector(u.center||[0,0,0]),c=u.radius?u.radius.length?u.radius:[u.radius,u.radius,u.radius]:[1,1,1];return t.fromPolygons([[[0,4,6,2],[-1,0,0]],[[1,3,7,5],[1,0,0]],[[0,1,5,4],[0,-1,0]],[[2,6,7,3],[0,1,0]],[[0,2,3,1],[0,0,-1]],[[4,5,7,6],[0,0,1]]].map(function(d){return new t.Polygon(d[0].map(function(v){let y=v&1?c[0]:-c[0],m=v&2?c[1]:-c[1],g=v&4?c[2]:-c[2],x=new t.Vector(f.x+y,f.y+m,f.z+g);return new t.Vertex(x,new t.Vector(d[1]))}))}))}t.cube=r;function i(u){u=u||{};var f=new t.Vector(u.center||[0,0,0]),c=u.radius||1,d=u.slices||16,v=u.stacks||8,y=[],m;function g(P,w){P*=Math.PI*2,w*=Math.PI;var b=new t.Vector(Math.cos(P)*Math.sin(w),Math.cos(w),Math.sin(P)*Math.sin(w));m.push(new t.Vertex(f.plus(b.times(c)),b))}for(var x=0;x<d;x++)for(var _=0;_<v;_++)m=[],g(x/d,_/v),_>0&&g((x+1)/d,_/v),_<v-1&&g((x+1)/d,(_+1)/v),g(x/d,(_+1)/v),y.push(new t.Polygon(m));return t.fromPolygons(y)}t.sphere=i;function n(u){u=u||{};var f=new t.Vector(u.start||[0,-1,0]),c=new t.Vector(u.end||[0,1,0]),d=c.minus(f),v=u.radius||1,y=u.slices||16,m=d.unit(),g=Math.abs(m.y)>.5,x=new t.Vector(g,!g,0).cross(m).unit(),_=x.cross(m).unit(),P=new t.Vertex(f,m.negated()),w=new t.Vertex(c,m.unit()),b=[];function T(O,L,M){var U=L*Math.PI*2,S=x.times(Math.cos(U)).plus(_.times(Math.sin(U))),k=f.plus(d.times(O)).plus(S.times(v)),D=S.times(1-Math.abs(M)).plus(m.times(M));return new t.Vertex(k,D)}for(var E=0;E<y;E++){var I=E/y,C=(E+1)/y;b.push(new t.Polygon([P,T(0,I,-1),T(0,C,-1)])),b.push(new t.Polygon([T(0,C,0),T(0,I,0),T(1,I,0),T(1,C,0)])),b.push(new t.Polygon([w,T(1,C,1),T(1,I,1)]))}return t.fromPolygons(b)}t.cylinder=n;class s{x;y;z;constructor(f,c,d){arguments.length==3?(this.x=f,this.y=c,this.z=d):"x"in f?(this.x=f.x,this.y=f.y,this.z=f.z):(this.x=f[0],this.y=f[1],this.z=f[2])}clone(){return new t.Vector(this.x,this.y,this.z)}negated(){return new t.Vector(-this.x,-this.y,-this.z)}plus(f){return new t.Vector(this.x+f.x,this.y+f.y,this.z+f.z)}minus(f){return new t.Vector(this.x-f.x,this.y-f.y,this.z-f.z)}times(f){return new t.Vector(this.x*f,this.y*f,this.z*f)}dividedBy(f){return new t.Vector(this.x/f,this.y/f,this.z/f)}dot(f){return this.x*f.x+this.y*f.y+this.z*f.z}lerp(f,c){return this.plus(f.minus(this).times(c))}length(){return Math.sqrt(this.dot(this))}unit(){return this.dividedBy(this.length())}cross(f){return new t.Vector(this.y*f.z-this.z*f.y,this.z*f.x-this.x*f.z,this.x*f.y-this.y*f.x)}}t.Vector=s;class o{pos;normal;constructor(f,c){this.pos=new t.Vector(f),this.normal=new t.Vector(c)}clone(){return new t.Vertex(this.pos.clone(),this.normal.clone())}flip(){this.normal=this.normal.negated()}interpolate(f,c){return new t.Vertex(this.pos.lerp(f.pos,c),this.normal.lerp(f.normal,c))}}t.Vertex=o;class a{normal;w;constructor(f,c){this.normal=f,this.w=c}static EPSILON=1e-5;static fromPoints=function(f,c,d){var v=c.minus(f).cross(d.minus(f)).unit();return new t.Plane(v,v.dot(f))};clone(){return new t.Plane(this.normal.clone(),this.w)}flip(){this.normal=this.normal.negated(),this.w=-this.w}splitPolygon(f,c,d,v,y){for(var m=0,g=1,x=2,_=3,P=0,w=[],b=0;b<f.vertices.length;b++){var T=this.normal.dot(f.vertices[b].pos)-this.w,E=T<-t.Plane.EPSILON?x:T>t.Plane.EPSILON?g:m;P|=E,w.push(E)}switch(P){case m:(this.normal.dot(f.plane.normal)>0?c:d).push(f);break;case g:v.push(f);break;case x:y.push(f);break;case _:for(var I=[],C=[],b=0;b<f.vertices.length;b++){var O=(b+1)%f.vertices.length,L=w[b],M=w[O],U=f.vertices[b],S=f.vertices[O];if(L!=x&&I.push(U),L!=g&&C.push(L!=x?U.clone():U),(L|M)==_){var T=(this.w-this.normal.dot(U.pos))/this.normal.dot(S.pos.minus(U.pos)),k=U.interpolate(S,T);I.push(k),C.push(k.clone())}}I.length>=3&&v.push(new t.Polygon(I,f.shared)),C.length>=3&&y.push(new t.Polygon(C,f.shared));break}}}t.Plane=a;class l{vertices;shared;plane;constructor(f,c){this.vertices=f,this.shared=c,this.plane=t.Plane.fromPoints(f[0].pos,f[1].pos,f[2].pos)}clone(){var f=this.vertices.map(function(c){return c.clone()});return new t.Polygon(f,this.shared)}flip(){this.vertices.reverse().map(function(f){f.flip()}),this.plane.flip()}}t.Polygon=l;class h{plane=null;front=null;back=null;polygons=[];constructor(f){f&&this.build(f)}clone(){var f=new t.Node;return f.plane=this.plane&&this.plane.clone(),f.front=this.front&&this.front.clone(),f.back=this.back&&this.back.clone(),f.polygons=this.polygons.map(function(c){return c.clone()}),f}invert(){for(var f=0;f<this.polygons.length;f++)this.polygons[f].flip();this.plane.flip(),this.front&&this.front.invert(),this.back&&this.back.invert();var c=this.front;this.front=this.back,this.back=c}clipPolygons(f){if(!this.plane)return f.slice();for(var c=[],d=[],v=0;v<f.length;v++)this.plane.splitPolygon(f[v],c,d,c,d);return this.front&&(c=this.front.clipPolygons(c)),this.back?d=this.back.clipPolygons(d):d=[],c.concat(d)}clipTo(f){this.polygons=f.clipPolygons(this.polygons),this.front&&this.front.clipTo(f),this.back&&this.back.clipTo(f)}allPolygons(){var f=this.polygons.slice();return this.front&&(f=f.concat(this.front.allPolygons())),this.back&&(f=f.concat(this.back.allPolygons())),f}build(f){if(f.length){this.plane||(this.plane=f[0].plane.clone());for(var c=[],d=[],v=0;v<f.length;v++)this.plane.splitPolygon(f[v],this.polygons,this.polygons,c,d);c.length&&(this.front||(this.front=new t.Node),this.front.build(c)),d.length&&(this.back||(this.back=new t.Node),this.back.build(d))}}}t.Node=h})(Tt||(Tt={}));function oe(t,e){return[t[0]+e[0],t[1]+e[1]]}function ji(t){let e;return t[0]===0?t[1]>0?e=Math.PI/2:t[1]<0?e=3*Math.PI/2:e=0:(e=Math.atan2(t[1],t[0]),e<0&&(e+=2*Math.PI)),e}function Jh(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Js(t,e,r){let i=t[0]+r*(e[0]-t[0]),n=t[1]+r*(e[1]-t[1]);return[i,n]}function Zi(t){let e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]}function qi(t){return[-t[1],t[0]]}function Dr(t,e){return[t[0]*e,t[1]*e]}function ze(t,e){return[t[0]-e[0],t[1]-e[1]]}function Qh(t,e,r){let i=e[0]-t[0],n=e[1]-t[1],s=r[0]-t[0],o=r[1]-t[1],a=i*o-s*n;return a>0?1:a<0?-1:0}function Qs(t,e){let r=!1,i=t[0],n=t[1];for(let s=0;s<e.length;s++){let o=e[s],a=s===e.length-1?e[0]:e[s+1];if(o[1]<n&&a[1]>=n||a[1]<n&&o[1]>=n){let l=a[0]-o[0],h=a[1]-o[1];Math.abs(h)>=1e-9&&o[0]+(n-o[1])/h*l<i&&(r=!r)}}return r}function Kh(t){let e=0;for(let r=0;r<t.length;r++){let i=r,n=r<t.length-1?r+1:0,s=t[i],o=t[n];e+=s[0]*o[1]-o[0]*s[1]}return e>0}const Yg="miter",Vg=.05,jg=.15,Zg=2.5,qg=0;function Ks(t){let e={};for(let r of t){let i=r.indices[0],n=r.indices[1],s=Math.min(i,n),o=Math.max(i,n),a=s.toString()+"_"+o.toString();e[a]=r}return e}function Jg(t,e){return{position:[t,e],edges:[],geometry:{parameters:{joinStyle:{type:Yg,parameters:{distance:Vg}}}}}}function tu(t,e){return{indices:[t,e],faces:[-1,-1],geometry:{parameters:{width:jg,height:Zg,offset:qg},fragments:[{angle:0,points:[],joinPoints:[],sidePoints:[]},{angle:0,points:[],joinPoints:[],sidePoints:[]}],computed:{sidePoints1:[],sidePoints2:[],joinPoints1:[],joinPoints2:[]}},openings:[]}}function Ji(t,e){return{level:-1,parent:void 0,children:[],face:void 0,indices:t,edges:e,geometry:{computed:{points:[]}}}}function Qg(t,e){return{level:-1,parent:void 0,children:[],cycle:void 0,boundary:t,holes:e}}function Kg(t,e){return{vertices:t,edges:e,cycles:[],faces:[]}}function t_(t){let{vertices:e,edges:r}=t,i=[];for(let n=0;n<e.length;n++){let s=e[n],o={index:n,x:s.position[0],y:s.position[1],adj:[]};i.push(o)}for(let n of r){let s=i[n.indices[0]],o=i[n.indices[1]];s.adj.push(o),o.adj.push(s)}return i}function e_(t,e){let r=Ks(t.edges),i=[];for(let n of e){let s=Ji([],[]);for(let o of n)s.indices.push(o.index);for(let o=0;o<n.length;o++){let a=o,l=o<n.length-1?o+1:0,h=n[a].index,u=n[l].index,f=Math.min(h,u),c=Math.max(h,u),d=f.toString()+"_"+c.toString(),v=r[d];if(!v){console.warn("Edge not found.");continue}s.edges.push(v)}i.push(s)}return i}function r_(t,e){let r=[];for(;t.length>0;){let i=i_(t),n=s_(n_(i));n.length>2&&r.push(n),eu(n[0],n[1]),t=ru(n[0],t),t=ru(n[1],t)}return r}function i_(t){return t.reduce((e,r)=>{let i=r.x-e.x;return i<0?r:i>0||r.y-e.y<0?e:r})}function n_(t){let e=[],r=t,i;do e.push(r),[r,i]=o_(r,i);while(r!==t);return e}function s_(t){for(let e=1;e<t.length;e++){let r=t.lastIndexOf(t[e]);r>e&&t.splice(e+1,r-e)}return t}function Qi(t,e){return e.filter(r=>r!==t)}function eu(t,e){t.adj=Qi(e,t.adj),e.adj=Qi(t,e.adj)}function ru(t,e){let r=t,i;for(;r&&r.adj.length<2;)e=Qi(r,e),i=r.adj[0],i&&eu(r,i),r=i;return e}function o_(t,e){return[t.adj.length==1?t.adj[0]:a_(e,t,e?"ccw":"cw"),t]}function a_(t,e,r){let i,n=e.adj;return t?(i=to(e,t),n=Qi(t,n)):i={x:0,y:-1},n.reduce((s,o)=>l_(o,s,e,i,r))}function l_(t,e,r,i,n){let s=to(t,r),o=to(e,r),a=eo(o,i)>0,l=eo(i,s),h=eo(o,s),u;return n=="cw"?u=a&&(l>=0||h>=0)||!a&&l>=0&&h>=0:u=!a&&(l<0||h<0)||a&&l<0&&h<0,u?t:e}function to(t,e){return{x:t.x-e.x,y:t.y-e.y}}function eo(t,e){return t.x*e.y-e.x*t.y}function h_(t,e){let r=t.indices,i=e.indices;for(let n=0;n<r.length;n++){let s=r[n],o=r[(n+1)%r.length],a=i.indexOf(s);if(a===-1)continue;let l=a===0?i.length-1:a-1,h=(a+1)%i.length;if(i[l]===o||i[h]===o)return!0}return!1}function u_(t,e,r){let i=e.boundary.indices.map(n=>t[n].position);if(!Qs(r,i))return!1;for(let n of e.holes){let s=n.indices.map(o=>t[o].position);if(Qs(r,s))return!1}return!0}function f_(t){let{vertices:e,edges:r}=t,i=[];for(let l of r){let h=l.indices[0],u=l.indices[1];i[h]=!0,i[u]=!0}let n=[],s=[],o=[],a=0;for(let l=0;l<e.length;l++){let h=e[l];i[l]&&(n.push(h),s[l]=a,o[a]=l,a++)}for(let l of r){let h=l.indices[0],u=l.indices[1];l.indices[0]=s[h],l.indices[1]=s[u]}return t.vertices=n,{allToIncluded:s,includedToAll:o}}function c_(t,e){let{includedToAll:r}=e,{edges:i}=t;for(let n of i){let s=n.indices[0],o=n.indices[1];n.indices[0]=r[s],n.indices[1]=r[o]}}function iu(t,e){let{vertices:r}=t;for(let i of e)i.level=0,i.parent=null,i.children=[];for(let i=0;i<2;i++)for(let n of e){let s=n.indices.map(o=>r[o].position);for(let o of e){if(n===o||h_(n,o))continue;let a=!0;for(let l of o.indices){if(n.indices.indexOf(l)>-1)continue;let h=r[l].position;if(!Qs(h,s)){a=!1;break}}a&&(i===0?o.level++:o.level===n.level+1&&(o.parent=n,n.children.push(o)))}}}function p_(t,e){let r={},i=e.children;for(let l of i){let{indices:h,edges:u}=l;for(let f=0;f<h.length;f++){let c=u[f],d=f,v=f<h.length-1?f+1:0,y=h[d],m=h[v],{width:g,height:x,offset:_}=c.geometry.parameters,P=Math.min(y,m),w=Math.max(y,m),b=P.toString()+"_"+w.toString();if(r[b])delete r[b];else{let T=tu(y,m);T.geometry.parameters={width:g,height:x,offset:_},r[b]=T}}}let{vertices:n}=t,s=Object.values(r),o=[],a=Ji([],[]);for(;s.length>0;){let l=s.splice(0,1)[0];for(;;){a.indices.push(l.indices[0]),a.edges.push(l);let h=s.findIndex(u=>l.indices[1]===u.indices[0]||l.indices[1]===u.indices[1]);if(h>-1)l=s.splice(h,1)[0];else{let u=a.indices.map(f=>n[f].position);Kh(u)||a.indices.reverse(),o.push(a),a=Ji([],[]);break}}}return o}function d_(t,e){for(let r=0;r<e.length;r++){let i=e[r],n=i.indices[0],s=i.indices[1],o=Math.min(n,s),a=Math.max(n,s),l=o.toString()+"_"+a.toString();t[l]?e[r]=t[l]:console.warn(`Edge [${n}, ${s}] not found.`)}}function v_(t){t.faces=[];let e=Ks(t.edges),r=[],i=t.cycles;for(let n of i){let{indices:s,edges:o}=n,a=Ji(s,o);r.push(a);let l=p_(t,n);for(let u of l)d_(e,u.edges);let h=Qg(a,l);h.cycle=n,n.face=h,a.face=h;for(let u of l)u.face=h;t.faces.push(h)}iu(t,r);for(let n of t.faces){let s=n.boundary;n.level=s.level,n.parent=s.parent?s.parent.face:null,n.children=s.children.map(o=>o.face)}}function nu(t,e){for(let r of e)r.faces[0]===-1?r.faces[0]=t:r.faces[1]===-1?r.faces[1]=t:console.warn(`Face ${t} visited more than twice.`)}function m_(t){let{edges:e,faces:r}=t;for(let i of e)i.faces=[-1,-1];for(let i=0;i<r.length;i++){let n=r[i];nu(i,n.boundary.edges);for(let s of n.holes)nu(i,s.edges)}}function y_(t){let{vertices:e,edges:r,faces:i}=t;for(let n of r){if(n.faces[0]!==-1||n.faces[1]!==-1)continue;let s=n.indices[0],o=n.indices[1],a=e[s].position,l=e[o].position,h=.5*(a[0]+l[0]),u=.5*(a[1]+l[1]),f=[h,u];for(let c=0;c<i.length;c++){let d=i[c];if(u_(e,d,f)){n.faces[0]=c,n.faces[1]=c;break}}}}function g_(t){let{vertices:e,edges:r}=t;for(let i of e)i.edges=[];for(let i of r){let n=i.indices[0],s=i.indices[1];e[n].edges.push(i),e[s].edges.push(i)}}function __(t){let{vertices:e}=t;for(let r=0;r<e.length;r++){let i=e[r],n=i.edges,s=[];for(let o of n){let a=r===o.indices[0]?o.indices[1]:o.indices[0],l=e[a],h=l.position[0]-i.position[0],u=l.position[1]-i.position[1],f={angle:ji([h,u]),points:[],joinPoints:[],sidePoints:[[],[]]},c={edge:o,fragment:f};r===o.indices[0]?o.geometry.fragments[0]=f:o.geometry.fragments[1]=f,s.push(c)}s.sort((o,a)=>o.fragment.angle-a.fragment.angle),i.edges=s.map(o=>o.edge)}}function x_(t){let e=t.vertices,r=f_(t),i=t_(t),n=r_(i);t.cycles=e_(t,n),t.vertices=e,c_(t,r),iu(t,t.cycles),v_(t),m_(t),y_(t),g_(t),__(t)}function Ki(t,e,r,i){const n=9999999999999998e-30;let s=[e[0]-t[0],e[1]-t[1]],o=[i[0]-r[0],i[1]-r[1]],a=r[0]-t[0],l=r[1]-t[1],h=s[0]*o[1]-s[1]*o[0],u=h*h,f=s[0]*s[0]+s[1]*s[1],c=o[0]*o[0]+o[1]*o[1];if(u>n*f*c){let d=(a*o[1]-l*o[0])/h,v=(a*s[1]-l*s[0])/h,y=t[0]+d*s[0],m=t[1]+d*s[1];return{tag:2,intersect:!0,p:[y,m],u:d,v}}else{let d=a*a+l*l;return h=a*s[1]-l*s[0],u=h*h,u>n*f*d?{tag:0,intersect:!1}:{tag:1,intersect:!0}}}function w_(t,e,r){let i=2*(r-e);for(;;){i*=.5;let n=t*Math.cos(.5*i);if(t-n<=2e-4)break}return i}function P_(t,e,r){let i=ze(e,t),n=ze(r,t),s=ji(i),o=ji(n);s>o&&(o+=2*Math.PI);let a=Jh(i),l=w_(a,s,o),h=(o-s)/l+1;h%2===0&&(h++,l=(o-s)/h);let u=[];u.push(e);let f=s+l;for(let c=0;c<h-2;c++){let d=t[0]+Math.cos(f)*a,v=t[1]+Math.sin(f)*a;u.push([d,v]),f+=l}return u.push(r),u}function b_(t,e,r,i,n,s){let o,a=Ki(e,r,i,n);if(a.tag===2){let l=a.p,h=ze(r,e),u=ze(n,i),f=Zi(h),c=Zi(u),d=oe(l,Dr(f,-s)),v=oe(l,Dr(c,-s)),y=qi(f),m=qi(c),g=oe(d,y),x=oe(v,m),_=Ki(d,g,v,x);if(_.tag===2){let P=_.p;o=P_(P,d,v)}else console.log("Edge line normals do not intersect."),o=[d,t,v]}else console.warn("Edge lines do not intersect."),o=[r,t,n];return o}function T_(t,e){let r=Ks(e),i=[];for(let s of e){if(s.geometry.parameters.width===0)continue;let o=s.indices[0],a=s.indices[1];i[o]=!0,i[a]=!0;let l=s.geometry;l.fragments[0].joinPoints=[],l.fragments[0].sidePoints[0]=[],l.fragments[0].sidePoints[1]=[],l.fragments[1].joinPoints=[],l.fragments[1].sidePoints[0]=[],l.fragments[1].sidePoints[1]=[],l.computed={sidePoints1:[],sidePoints2:[],joinPoints1:[],joinPoints2:[]}}let{vertices:n}=t;for(let s=0;s<n.length;s++){if(!i[s])continue;let o=n[s],a=o.position,l=[];for(let h of o.edges){if(h.geometry.parameters.width===0)continue;let u=h.indices[0],f=h.indices[1],c=Math.min(u,f),d=Math.max(u,f),v=c.toString()+"_"+d.toString();r[v]&&l.push(h)}if(l.length===1){let h=l[0],u,f,c;h.indices[0]===s?(u=h.geometry.fragments[0],f=u.points[0],c=u.points[1]):(u=h.geometry.fragments[1],f=u.points[1],c=u.points[0]),u.joinPoints.push(f),u.joinPoints.push(c),u.sidePoints[0].push(f),u.sidePoints[1].push(c)}else for(let h=0;h<l.length;h++){let u=l[h],f=h<l.length-1?l[h+1]:l[0],c,d,v,y,m,g;u.indices[0]===s?(c=u.geometry.fragments[0],d=u.geometry.fragments[1],v=d.points[0],y=c.points[0]):(c=u.geometry.fragments[1],d=u.geometry.fragments[0],v=d.points[1],y=c.points[1]);let x,_,P,w;f.indices[0]===s?(x=f.geometry.fragments[0],_=f.geometry.fragments[1],P=_.points[1],w=x.points[1]):(x=f.geometry.fragments[1],_=f.geometry.fragments[0],P=_.points[0],w=x.points[0]);let b=Ki(v,y,P,w);if(b.tag===2){let T=b.p;if(Qh(v,T,P)===1){let E=o.geometry.parameters.joinStyle;switch(E.type){case"dent":c.joinPoints.length===0?(c.joinPoints.push(y,a),c.sidePoints[0]=[y]):(c.joinPoints.push(y),c.sidePoints[1]=[y]),x.joinPoints.length===0?(x.joinPoints.push(w,a),x.sidePoints[0]=[w]):(x.joinPoints.push(w),x.sidePoints[1]=[w]);break;case"bevel":let I=Js(y,w,.5);c.joinPoints.length===0?(c.joinPoints.push(I,a),c.sidePoints[0]=[y,I]):(c.joinPoints.push(I),c.sidePoints[1]=[I,y]),x.joinPoints.length===0?(x.joinPoints.push(I,a),x.sidePoints[0]=[w,I]):(x.joinPoints.push(I),x.sidePoints[1]=[I,w]);break;case"miter":b.u<1&&(y=T),b.v<1&&(w=T);let C=x.angle-c.angle;if(C<0&&(C+=2*Math.PI),2*Math.PI-C<=Math.PI/4){let U=Js(y,w,.5);c.joinPoints.length===0?(c.joinPoints.push(U,a),c.sidePoints[0]=[y,U]):(c.joinPoints.push(U),c.sidePoints[1]=[U,y]),x.joinPoints.length===0?(x.joinPoints.push(U,a),x.sidePoints[0]=[w,U]):(x.joinPoints.push(U),x.sidePoints[1]=[U,w])}else c.joinPoints.length===0?(c.joinPoints.push(T,a),c.sidePoints[0]=[T]):(c.joinPoints.push(T),c.sidePoints[1]=[T]),x.joinPoints.length===0?(x.joinPoints.push(T,a),x.sidePoints[0]=[T]):(x.joinPoints.push(T),x.sidePoints[1]=[T]);break;case"round":let O=b_(a,v,y,P,w,E.parameters.distance),L=(O.length-1)/2;m=O.slice(0,L+1),g=O.slice(L,O.length);let M=O[L];c.joinPoints.length===0?(c.joinPoints.push(M,a),c.sidePoints[0]=m):(c.joinPoints.push(M),c.sidePoints[1]=m.reverse()),x.joinPoints.length===0?(x.joinPoints.push(M,a),x.sidePoints[0]=g.reverse()):(x.joinPoints.push(M),x.sidePoints[1]=g);break}}else c.joinPoints.length===0?(c.joinPoints.push(T,a),c.sidePoints[0].push(T)):(c.joinPoints.push(T),c.sidePoints[1].push(T)),x.joinPoints.length===0?(x.joinPoints.push(T,a),x.sidePoints[0].push(T)):(x.joinPoints.push(T),x.sidePoints[1].push(T))}else c.joinPoints.length===0?(c.joinPoints.push(y,a),c.sidePoints[0].push(y)):(c.joinPoints.push(y),c.sidePoints[1].push(y)),x.joinPoints.length===0?(x.joinPoints.push(w,a),x.sidePoints[0].push(w)):(x.joinPoints.push(w),x.sidePoints[1].push(w))}}}function I_(t){let{vertices:e,edges:r}=t;for(let i of r){let n=i.indices[0],s=i.indices[1],o=i.geometry.parameters.width,a=i.geometry.parameters.offset,l=e[n].position,h=e[s].position,u=ze(h,l),f=qi(Zi(u)),c=Dr(f,.5*o+a),d=Dr(f,-.5*o+a),v=oe(l,c),y=oe(l,d),m=oe(h,c),g=oe(h,d);i.geometry.fragments[0].points=[v,y],i.geometry.fragments[1].points=[m,g]}}function C_(t,e){for(let r of e){if(r.geometry.parameters.width===0)continue;let i=r.geometry.fragments[0],n=r.geometry.fragments[1],s=[...i.joinPoints],o=[...n.joinPoints],a=[...i.sidePoints[0]],l=[...i.sidePoints[1]],h=[...n.sidePoints[0]],u=[...n.sidePoints[1]],f=s[0],c=o[o.length-1],d=s[s.length-1],v=o[0],y=Ki(f,c,d,v);y.tag===2&&y.u>=0&&y.u<=1&&y.v>=0&&y.v<=1&&(o.reverse(),h.reverse(),u.reverse(),[h,u]=[u,h]),r.geometry.computed.sidePoints1=u.concat(a),r.geometry.computed.sidePoints2=l.concat(h),r.geometry.computed.joinPoints1=s,r.geometry.computed.joinPoints2=o}}function A_(t,e){T_(t,e),C_(t,e)}function su(t,e){let{vertices:r}=t,i=e.indices.map(n=>r[n].position);return Kh(i)||i.reverse(),i}function E_(t,e){for(let r of e){r.boundary.geometry.computed.points=su(t,r.boundary);for(let i of r.holes)i.geometry.computed.points=su(t,i)}}function S_(t){I_(t),E_(t,t.faces),A_(t,t.edges)}class N_{constructor(){this.vertexIndices=[],this.edges=[],this.geometryProfile=[]}}function O_(t,e){let r=[],i=[],n=[];for(let a of e)for(let l of a.vertexIndices)if(!i[l]){let h=t.spatialGraph.vertices[l],u=Jg(h.position[0],h.position[1]);u.reference=l;let f=r.push(u)-1;n[l]=f,i[l]=!0}let s=[],o={};for(let a of e){let l=a.vertexIndices[0],h=a.vertexIndices[1],u=n[l],f=n[h],c=tu(u,f),d=a.element;if(d===null)c.geometry.parameters={width:0,height:0,offset:0};else if(d?.type==="layout:wall"){let{width:v,height:y,offset:m}=d.parameters;c.geometry.parameters={width:v,height:y,offset:m}}else{console.error("Undefined or invalid element reference in edge: ",a);continue}c.reference=a,s.push(c),o[a.id]=!0}return Kg(r,s)}function L_(){let t=Math.random(),e=Math.random(),r=Math.random(),i=Math.round(255*t).toString(16).padStart(2,"0"),n=Math.round(255*e).toString(16).padStart(2,"0"),s=Math.round(255*r).toString(16).padStart(2,"0");return"#"+i+n+s}const fr={top:"#202020",bottom:"#000000",side1:"asm:basic-wall",side2:"asm:basic-wall",join1:"#0080FF",join2:"#0080FF"},tn={top:"#FFFFFF",bottom:"#FFFFFF",side1:"#FFFFFF",side2:"#FFFFFF"};function M_(t,e,r,i,n){let s=n.sharedResources.geometries,o=i.parameters.dimensions[0],a=i.parameters.dimensions[1],l=e.parameters.width,h=e.parameters.offset,u=e.edge.vertexIndices[0],f=e.edge.vertexIndices[1],c=t.spatialGraph.vertices[u].position,d=t.spatialGraph.vertices[f].position,v=ze(d,c),y=Jh(v),m=i.parameters.position[0]/y,g=Js(c,d,m),x=qi(Zi(v));g=oe(g,Dr(x,-.5*l+h));let _=i.parameters.position[1],P=[g[0],_,g[1]],w=ze(d,c),b=-ji(w),T=i.parameters.materials,E={type:"geometry:cuboid",position:P,rotation:180*b/Math.PI,dimensions:[o,a,l],surfaces:{top:[0],bottom:[1],frontBack:[2,4],side1:[3],side2:[5]}},I={top:T.top??tn.top,bottom:T.bottom??tn.bottom,frontBack:"#FFFFFF",side1:T.side1??tn.side1,side2:T.side2??tn.side2};E.materials=I,s[r]=E;let C=e.geometries[0],O=s[C];O.geometries??(O.geometries=[]),O.geometries.push({type:"csg:subtract",geometry:r})}function F_(t,e,r,i=!1){let{sidePoints1:n,sidePoints2:s,joinPoints1:o,joinPoints2:a}=e.geometryProfile,l=e.edge.vertexIndices[0],h=e.edge.vertexIndices[1],u=t.spatialGraph.vertices[l],f=t.spatialGraph.vertices[h],c=u.edges.filter(b=>{var T;return((T=b.element)==null?void 0:T.type)==="layout:wall"}),d=f.edges.filter(b=>{var T;return((T=b.element)==null?void 0:T.type)==="layout:wall"}),v=c.length===1,y=d.length===1,m=n[n.length-1],g=n[0],x=s[s.length-1];Qh(m,g,x)===-1&&(n.reverse(),s.reverse(),o.reverse(),a.reverse(),[o,a]=[a,o],[v,y]=[y,v]);let _={type:"geometry:extrusion",position:[0,0,0],height:e.parameters.height,profile:{type:"curve:composite",segments:[{type:"curve:polyline",points:n},{type:"curve:polyline",points:o},{type:"curve:polyline",points:s},{type:"curve:polyline",points:a}]}},P={top:[0],bottom:[1],side1:[2],side2:[4]},w={top:i?L_():r.top??fr.top,bottom:r.bottom??fr.bottom,side1:r.side1??fr.side1,side2:r.side2??fr.side2};return v&&(P.join1=[3],w.join1=r.join1??fr.join1),y&&(P.join2=[5],w.join2=r.join2??fr.join2),_.surfaces=P,_.materials=w,_}function R_(t,e){let r=e.sharedResources.geometries,i=t.elements.filter(n=>n.type==="layout:wall");for(let n of i){let s=n.parameters.materials,o=F_(t,n,s),a="wallGeometry-"+n.id;r[a]=o,n.geometries=[a];for(let l=0;l<n.elements.length;l++){let h=n.elements[l];if(h.type!=="layout:opening")continue;let u=a+"-opening-"+(l+1);M_(t,n,u,h,e)}}}var en,k_=new Uint8Array(16);function U_(){if(!en&&(en=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!en))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return en(k_)}const B_=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function D_(t){return typeof t=="string"&&B_.test(t)}for(var ft=[],ro=0;ro<256;++ro)ft.push((ro+256).toString(16).substr(1));function X_(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(ft[t[e+0]]+ft[t[e+1]]+ft[t[e+2]]+ft[t[e+3]]+"-"+ft[t[e+4]]+ft[t[e+5]]+"-"+ft[t[e+6]]+ft[t[e+7]]+"-"+ft[t[e+8]]+ft[t[e+9]]+"-"+ft[t[e+10]]+ft[t[e+11]]+ft[t[e+12]]+ft[t[e+13]]+ft[t[e+14]]+ft[t[e+15]]).toLowerCase();if(!D_(r))throw TypeError("Stringified UUID is invalid");return r}function ou(t,e,r){t=t||{};var i=t.random||(t.rng||U_)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){r=r||0;for(var n=0;n<16;++n)e[r+n]=i[n];return e}return X_(i)}function G_(t,e){let r=e.slice().sort((i,n)=>i-n);for(let i of t.spaces){let n=i.boundaries[0];if(n.vertexIndices.length===r.length&&n.vertexIndices.slice().sort((s,o)=>s-o).every((s,o)=>r[o]===s))return i}}function H_(t,e){let r={};for(let n=0;n<e.faces.length;n++){let s=e.faces[n],o=[],a=[];o.push(s.boundary);for(let u of s.holes)o.push(u);for(let u of o){let f=new N_;f.vertexIndices=[];for(let c of u.indices){let d=e.vertices[c].reference;f.vertexIndices.push(d)}for(let c of u.edges){let d=c.reference;f.edges.push(d)}f.geometryProfile=u.geometry.computed.points.slice(),a.push(f)}let l=a[0],h=G_(t,l.vertexIndices);if(h){if(h.boundaries=a,h.slabs.length===1){let u=h.slabs[0];u.boundaries=a}r[h.id]=!0}else{let u=ou(),f=t.createSpace(u,a),c=ou();t.createSlab(c,"floor",f.boundaries,f),r[u]=!0}}let i=t.spaces.slice();for(let n of i)r[n.id]||t.removeSpace(n);for(let n of e.edges){let s=n.reference,o=n.faces[0],a=n.faces[1];s.spaces[0]=o!==-1?t.spaces[o]:null,s.spaces[1]=a!==-1?t.spaces[a]:null;let l=s.element;if(l?.type==="layout:wall"){let{sidePoints1:h,sidePoints2:u,joinPoints1:f,joinPoints2:c}=n.geometry.computed;l.geometryProfile={sidePoints1:h.slice(),sidePoints2:u.slice(),joinPoints1:f.slice(),joinPoints2:c.slice()}}}}function z_(t){let e=t.spatialGraph.edges,r=O_(t,e);x_(r),S_(r),H_(t,r)}function W_(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function i(){if(this instanceof i){var n=[null];n.push.apply(n,arguments);var s=Function.bind.apply(e,n);return new s}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}const $_={},Y_=Object.freeze(Object.defineProperty({__proto__:null,default:$_},Symbol.toStringTag,{value:"Module"})),io=W_(Y_);var it={},au=io,no=it.ValidationError=function(t,e,r,i,n,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(a,l){return a+hu(l)},"instance")):i!==void 0&&(this.property=i),t&&(this.message=t),r){var o=r.$id||r.id;this.schema=o||r}e!==void 0&&(this.instance=e),this.name=n,this.argument=s,this.stack=this.toString()};no.prototype.toString=function(){return this.property+" "+this.message};var rn=it.ValidatorResult=function(t,e,r,i){this.instance=t,this.schema=e,this.options=r,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=r&&r.throwError,this.throwFirst=r&&r.throwFirst,this.throwAll=r&&r.throwAll,this.disableFormat=r&&r.disableFormat===!0};rn.prototype.addError=function(t){var e;if(typeof t=="string")e=new no(t,this.instance,this.schema,this.path);else{if(!t)throw new Error("Missing error detail");if(!t.message)throw new Error("Missing error message");if(!t.name)throw new Error("Missing validator type");e=new no(t.message,this.instance,this.schema,this.path,t.name,t.argument)}if(this.errors.push(e),this.throwFirst)throw new We(this);if(this.throwError)throw e;return e},rn.prototype.importErrors=function(t){typeof t=="string"||t&&t.validatorType?this.addError(t):t&&t.errors&&Array.prototype.push.apply(this.errors,t.errors)};function V_(t,e){return e+": "+t.toString()+`
|
|
839
|
+
`}rn.prototype.toString=function(t){return this.errors.map(V_).join("")},Object.defineProperty(rn.prototype,"valid",{get:function(){return!this.errors.length}}),it.ValidatorResultError=We;function We(t){Error.captureStackTrace&&Error.captureStackTrace(this,We),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}We.prototype=new Error,We.prototype.constructor=We,We.prototype.name="Validation Error";var lu=it.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),Error.captureStackTrace(this,t)};lu.prototype=Object.create(Error.prototype,{constructor:{value:lu,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var so=it.SchemaContext=function(t,e,r,i,n){this.schema=t,this.options=e,Array.isArray(r)?(this.path=r,this.propertyPath=r.reduce(function(s,o){return s+hu(o)},"instance")):this.propertyPath=r,this.base=i,this.schemas=n};so.prototype.resolve=function(t){return au.resolve(this.base,t)},so.prototype.makeChild=function(t,e){var r=e===void 0?this.path:this.path.concat([e]),i=t.$id||t.id,n=au.resolve(this.base,i||""),s=new so(t,this.options,r,n,Object.create(this.schemas));return i&&!s.schemas[n]&&(s.schemas[n]=t),s};var Rt=it.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+-.]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/\s*(.+?):\s*([^;]+);?/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/};Rt.regexp=Rt.regex,Rt.pattern=Rt.regex,Rt.ipv4=Rt["ip-address"],it.isFormat=function(t,e,r){if(typeof t=="string"&&Rt[e]!==void 0){if(Rt[e]instanceof RegExp)return Rt[e].test(t);if(typeof Rt[e]=="function")return Rt[e](t)}else if(r&&r.customFormats&&typeof r.customFormats[e]=="function")return r.customFormats[e](t);return!0};var hu=it.makeSuffix=function(t){return t=t.toString(),!t.match(/[.\s\[\]]/)&&!t.match(/^[\d]/)?"."+t:t.match(/^\d+$/)?"["+t+"]":"["+JSON.stringify(t)+"]"};it.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(s,o){return t(e[o],r[o])});if(typeof e=="object"){if(!e||!r)return e===r;var i=Object.keys(e),n=Object.keys(r);return i.length!==n.length?!1:i.every(function(s){return t(e[s],r[s])})}return e===r};function j_(t,e,r,i){typeof r=="object"?e[i]=oo(t[i],r):t.indexOf(r)===-1&&e.push(r)}function Z_(t,e,r){e[r]=t[r]}function q_(t,e,r,i){typeof e[i]!="object"||!e[i]?r[i]=e[i]:t[i]?r[i]=oo(t[i],e[i]):r[i]=e[i]}function oo(t,e){var r=Array.isArray(e),i=r&&[]||{};return r?(t=t||[],i=i.concat(t),e.forEach(j_.bind(null,t,i))):(t&&typeof t=="object"&&Object.keys(t).forEach(Z_.bind(null,t,i)),Object.keys(e).forEach(q_.bind(null,t,e,i))),i}it.deepMerge=oo,it.objectGetPath=function(t,e){for(var r=e.split("/").slice(1),i;typeof(i=r.shift())=="string";){var n=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(n in t))return;t=t[n]}return t};function J_(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}it.encodePath=function(t){return t.map(J_).join("")},it.getDecimalPlaces=function(t){var e=0;if(isNaN(t))return e;typeof t!="number"&&(t=Number(t));var r=t.toString().split("e");if(r.length===2){if(r[1][0]!=="-")return e;e=Number(r[1].slice(1))}var i=r[0].split(".");return i.length===2&&(e+=i[1].length),e},it.isSchema=function(t){return typeof t=="object"&&t||typeof t=="boolean"};var Ct=it,z=Ct.ValidatorResult,be=Ct.SchemaError,ao={};ao.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var W=ao.validators={};W.type=function(t,e,r,i){if(t===void 0)return null;var n=new z(t,e,r,i),s=Array.isArray(e.type)?e.type:[e.type];if(!s.some(this.testType.bind(this,t,e,r,i))){var o=s.map(function(a){if(a){var l=a.$id||a.id;return l?"<"+l+">":a+""}});n.addError({name:"type",argument:o,message:"is not of a type(s) "+o})}return n};function lo(t,e,r,i,n){var s=e.throwError,o=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,n,e,r);return e.throwError=s,e.throwAll=o,!a.valid&&i instanceof Function&&i(a),a.valid}W.anyOf=function(t,e,r,i){if(t===void 0)return null;var n=new z(t,e,r,i),s=new z(t,e,r,i);if(!Array.isArray(e.anyOf))throw new be("anyOf must be an array");if(!e.anyOf.some(lo.bind(this,t,r,i,function(a){s.importErrors(a)}))){var o=e.anyOf.map(function(a,l){var h=a.$id||a.id;return h?"<"+h+">":a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+l+"]"});r.nestedErrors&&n.importErrors(s),n.addError({name:"anyOf",argument:o,message:"is not any of "+o.join(",")})}return n},W.allOf=function(t,e,r,i){if(t===void 0)return null;if(!Array.isArray(e.allOf))throw new be("allOf must be an array");var n=new z(t,e,r,i),s=this;return e.allOf.forEach(function(o,a){var l=s.validateSchema(t,o,r,i);if(!l.valid){var h=o.$id||o.id,u=h||o.title&&JSON.stringify(o.title)||o.$ref&&"<"+o.$ref+">"||"[subschema "+a+"]";n.addError({name:"allOf",argument:{id:u,length:l.errors.length,valid:l},message:"does not match allOf schema "+u+" with "+l.errors.length+" error[s]:"}),n.importErrors(l)}}),n},W.oneOf=function(t,e,r,i){if(t===void 0)return null;if(!Array.isArray(e.oneOf))throw new be("oneOf must be an array");var n=new z(t,e,r,i),s=new z(t,e,r,i),o=e.oneOf.filter(lo.bind(this,t,r,i,function(l){s.importErrors(l)})).length,a=e.oneOf.map(function(l,h){var u=l.$id||l.id;return u||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+h+"]"});return o!==1&&(r.nestedErrors&&n.importErrors(s),n.addError({name:"oneOf",argument:a,message:"is not exactly one from "+a.join(",")})),n},W.if=function(t,e,r,i){if(t===void 0)return null;if(!Ct.isSchema(e.if))throw new Error('Expected "if" keyword to be a schema');var n=lo.call(this,t,r,i,null,e.if),s=new z(t,e,r,i),o;if(n){if(e.then===void 0)return;if(!Ct.isSchema(e.then))throw new Error('Expected "then" keyword to be a schema');o=this.validateSchema(t,e.then,r,i.makeChild(e.then)),s.importErrors(o)}else{if(e.else===void 0)return;if(!Ct.isSchema(e.else))throw new Error('Expected "else" keyword to be a schema');o=this.validateSchema(t,e.else,r,i.makeChild(e.else)),s.importErrors(o)}return s};function ho(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}W.propertyNames=function(t,e,r,i){if(this.types.object(t)){var n=new z(t,e,r,i),s=e.propertyNames!==void 0?e.propertyNames:{};if(!Ct.isSchema(s))throw new be('Expected "propertyNames" to be a schema (object or boolean)');for(var o in t)if(ho(t,o)!==void 0){var a=this.validateSchema(o,s,r,i.makeChild(s));n.importErrors(a)}return n}},W.properties=function(t,e,r,i){if(this.types.object(t)){var n=new z(t,e,r,i),s=e.properties||{};for(var o in s){var a=s[o];if(a!==void 0){if(a===null)throw new be('Unexpected null, expected schema in "properties"');typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,o,a,r,i);var l=ho(t,o),h=this.validateSchema(l,a,r,i.makeChild(a,o));h.instance!==n.instance[o]&&(n.instance[o]=h.instance),n.importErrors(h)}}return n}};function uu(t,e,r,i,n,s){if(this.types.object(t)&&!(e.properties&&e.properties[n]!==void 0))if(e.additionalProperties===!1)s.addError({name:"additionalProperties",argument:n,message:"is not allowed to have the additional property "+JSON.stringify(n)});else{var o=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,n,o,r,i);var a=this.validateSchema(t[n],o,r,i.makeChild(o,n));a.instance!==s.instance[n]&&(s.instance[n]=a.instance),s.importErrors(a)}}W.patternProperties=function(t,e,r,i){if(this.types.object(t)){var n=new z(t,e,r,i),s=e.patternProperties||{};for(var o in t){var a=!0;for(var l in s){var h=s[l];if(h!==void 0){if(h===null)throw new be('Unexpected null, expected schema in "patternProperties"');try{var u=new RegExp(l,"u")}catch{u=new RegExp(l)}if(u.test(o)){a=!1,typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,o,h,r,i);var f=this.validateSchema(t[o],h,r,i.makeChild(h,o));f.instance!==n.instance[o]&&(n.instance[o]=f.instance),n.importErrors(f)}}}a&&uu.call(this,t,e,r,i,o,n)}return n}},W.additionalProperties=function(t,e,r,i){if(this.types.object(t)){if(e.patternProperties)return null;var n=new z(t,e,r,i);for(var s in t)uu.call(this,t,e,r,i,s,n);return n}},W.minProperties=function(t,e,r,i){if(this.types.object(t)){var n=new z(t,e,r,i),s=Object.keys(t);return s.length>=e.minProperties||n.addError({name:"minProperties",argument:e.minProperties,message:"does not meet minimum property length of "+e.minProperties}),n}},W.maxProperties=function(t,e,r,i){if(this.types.object(t)){var n=new z(t,e,r,i),s=Object.keys(t);return s.length<=e.maxProperties||n.addError({name:"maxProperties",argument:e.maxProperties,message:"does not meet maximum property length of "+e.maxProperties}),n}},W.items=function(t,e,r,i){var n=this;if(this.types.array(t)&&e.items){var s=new z(t,e,r,i);return t.every(function(o,a){var l=Array.isArray(e.items)?e.items[a]||e.additionalItems:e.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var h=n.validateSchema(o,l,r,i.makeChild(l,a));return h.instance!==s.instance[a]&&(s.instance[a]=h.instance),s.importErrors(h),!0}),s}},W.minimum=function(t,e,r,i){if(this.types.number(t)){var n=new z(t,e,r,i);return e.exclusiveMinimum&&e.exclusiveMinimum===!0?t>e.minimum||n.addError({name:"minimum",argument:e.minimum,message:"must be greater than "+e.minimum}):t>=e.minimum||n.addError({name:"minimum",argument:e.minimum,message:"must be greater than or equal to "+e.minimum}),n}},W.maximum=function(t,e,r,i){if(this.types.number(t)){var n=new z(t,e,r,i);return e.exclusiveMaximum&&e.exclusiveMaximum===!0?t<e.maximum||n.addError({name:"maximum",argument:e.maximum,message:"must be less than "+e.maximum}):t<=e.maximum||n.addError({name:"maximum",argument:e.maximum,message:"must be less than or equal to "+e.maximum}),n}},W.exclusiveMinimum=function(t,e,r,i){if(typeof e.exclusiveMaximum!="boolean"&&this.types.number(t)){var n=new z(t,e,r,i),s=t>e.exclusiveMinimum;return s||n.addError({name:"exclusiveMinimum",argument:e.exclusiveMinimum,message:"must be strictly greater than "+e.exclusiveMinimum}),n}},W.exclusiveMaximum=function(t,e,r,i){if(typeof e.exclusiveMaximum!="boolean"&&this.types.number(t)){var n=new z(t,e,r,i),s=t<e.exclusiveMaximum;return s||n.addError({name:"exclusiveMaximum",argument:e.exclusiveMaximum,message:"must be strictly less than "+e.exclusiveMaximum}),n}};var fu=function(t,e,r,i,n,s){if(this.types.number(t)){var o=e[n];if(o==0)throw new be(n+" cannot be zero");var a=new z(t,e,r,i),l=Ct.getDecimalPlaces(t),h=Ct.getDecimalPlaces(o),u=Math.max(l,h),f=Math.pow(10,u);return Math.round(t*f)%Math.round(o*f)!==0&&a.addError({name:n,argument:o,message:s+JSON.stringify(o)}),a}};W.multipleOf=function(t,e,r,i){return fu.call(this,t,e,r,i,"multipleOf","is not a multiple of (divisible by) ")},W.divisibleBy=function(t,e,r,i){return fu.call(this,t,e,r,i,"divisibleBy","is not divisible by (multiple of) ")},W.required=function(t,e,r,i){var n=new z(t,e,r,i);return t===void 0&&e.required===!0?n.addError({name:"required",message:"is required"}):this.types.object(t)&&Array.isArray(e.required)&&e.required.forEach(function(s){ho(t,s)===void 0&&n.addError({name:"required",argument:s,message:"requires property "+JSON.stringify(s)})}),n},W.pattern=function(t,e,r,i){if(this.types.string(t)){var n=new z(t,e,r,i),s=e.pattern;try{var o=new RegExp(s,"u")}catch{o=new RegExp(s)}return t.match(o)||n.addError({name:"pattern",argument:e.pattern,message:"does not match pattern "+JSON.stringify(e.pattern.toString())}),n}},W.format=function(t,e,r,i){if(t!==void 0){var n=new z(t,e,r,i);return!n.disableFormat&&!Ct.isFormat(t,e.format,this)&&n.addError({name:"format",argument:e.format,message:"does not conform to the "+JSON.stringify(e.format)+" format"}),n}},W.minLength=function(t,e,r,i){if(this.types.string(t)){var n=new z(t,e,r,i),s=t.match(/[\uDC00-\uDFFF]/g),o=t.length-(s?s.length:0);return o>=e.minLength||n.addError({name:"minLength",argument:e.minLength,message:"does not meet minimum length of "+e.minLength}),n}},W.maxLength=function(t,e,r,i){if(this.types.string(t)){var n=new z(t,e,r,i),s=t.match(/[\uDC00-\uDFFF]/g),o=t.length-(s?s.length:0);return o<=e.maxLength||n.addError({name:"maxLength",argument:e.maxLength,message:"does not meet maximum length of "+e.maxLength}),n}},W.minItems=function(t,e,r,i){if(this.types.array(t)){var n=new z(t,e,r,i);return t.length>=e.minItems||n.addError({name:"minItems",argument:e.minItems,message:"does not meet minimum length of "+e.minItems}),n}},W.maxItems=function(t,e,r,i){if(this.types.array(t)){var n=new z(t,e,r,i);return t.length<=e.maxItems||n.addError({name:"maxItems",argument:e.maxItems,message:"does not meet maximum length of "+e.maxItems}),n}};function Q_(t,e,r){var i,n=r.length;for(i=e+1,n;i<n;i++)if(Ct.deepCompareStrict(t,r[i]))return!1;return!0}W.uniqueItems=function(t,e,r,i){if(e.uniqueItems===!0&&this.types.array(t)){var n=new z(t,e,r,i);return t.every(Q_)||n.addError({name:"uniqueItems",message:"contains duplicate item"}),n}},W.dependencies=function(t,e,r,i){if(this.types.object(t)){var n=new z(t,e,r,i);for(var s in e.dependencies)if(t[s]!==void 0){var o=e.dependencies[s],a=i.makeChild(o,s);if(typeof o=="string"&&(o=[o]),Array.isArray(o))o.forEach(function(h){t[h]===void 0&&n.addError({name:"dependencies",argument:a.propertyPath,message:"property "+h+" not found, required by "+a.propertyPath})});else{var l=this.validateSchema(t,o,r,a);n.instance!==l.instance&&(n.instance=l.instance),l&&l.errors.length&&(n.addError({name:"dependencies",argument:a.propertyPath,message:"does not meet dependency required by "+a.propertyPath}),n.importErrors(l))}}return n}},W.enum=function(t,e,r,i){if(t===void 0)return null;if(!Array.isArray(e.enum))throw new be("enum expects an array",e);var n=new z(t,e,r,i);return e.enum.some(Ct.deepCompareStrict.bind(null,t))||n.addError({name:"enum",argument:e.enum,message:"is not one of enum values: "+e.enum.map(String).join(",")}),n},W.const=function(t,e,r,i){if(t===void 0)return null;var n=new z(t,e,r,i);return Ct.deepCompareStrict(e.const,t)||n.addError({name:"const",argument:e.const,message:"does not exactly match expected constant: "+e.const}),n},W.not=W.disallow=function(t,e,r,i){var n=this;if(t===void 0)return null;var s=new z(t,e,r,i),o=e.not||e.disallow;return o?(Array.isArray(o)||(o=[o]),o.forEach(function(a){if(n.testType(t,e,r,i,a)){var l=a&&(a.$id||a.id),h=l||a;s.addError({name:"not",argument:h,message:"is of prohibited type "+h})}}),s):null};var K_=ao,uo={},cu=io,tx=it;uo.SchemaScanResult=pu;function pu(t,e){this.id=t,this.ref=e}uo.scan=function(t,e){function r(a,l){if(!(!l||typeof l!="object")){if(l.$ref){var h=cu.resolve(a,l.$ref);o[h]=o[h]?o[h]+1:0;return}var u=l.$id||l.id,f=u?cu.resolve(a,u):a;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!tx.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),r(f+"/additionalItems",l.additionalItems),n(f+"/properties",l.properties),r(f+"/additionalProperties",l.additionalProperties),n(f+"/definitions",l.definitions),n(f+"/patternProperties",l.patternProperties),n(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),r(f+"/not",l.not)}}function i(a,l){if(Array.isArray(l))for(var h=0;h<l.length;h++)r(a+"/"+h,l[h])}function n(a,l){if(!(!l||typeof l!="object"))for(var h in l)r(a+"/"+h,l[h])}var s={},o={};return r(t,e),new pu(s,o)};var du=io,vu=K_,$e=it,mu=uo.scan,yu=$e.ValidatorResult,ex=$e.ValidatorResultError,Xr=$e.SchemaError,gu=$e.SchemaContext,_u="/",ct=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Wt),this.attributes=Object.create(vu.validators)};ct.prototype.customFormats={},ct.prototype.schemas=null,ct.prototype.types=null,ct.prototype.attributes=null,ct.prototype.unresolvedRefs=null,ct.prototype.addSchema=function(t,e){var r=this;if(!t)return null;var i=mu(e||_u,t),n=e||t.$id||t.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(o){return typeof r.schemas[o]>"u"}),this.schemas[n]},ct.prototype.addSubSchemaArray=function(t,e){if(Array.isArray(e))for(var r=0;r<e.length;r++)this.addSubSchema(t,e[r])},ct.prototype.addSubSchemaObject=function(t,e){if(!(!e||typeof e!="object"))for(var r in e)this.addSubSchema(t,e[r])},ct.prototype.setSchemas=function(t){this.schemas=t},ct.prototype.getSchema=function(t){return this.schemas[t]},ct.prototype.validate=function(t,e,r,i){if(typeof e!="boolean"&&typeof e!="object"||e===null)throw new Xr("Expected `schema` to be an object or boolean");r||(r={});var n=e.$id||e.id,s=du.resolve(r.base||_u,n||"");if(!i){i=new gu(e,r,[],s,Object.create(this.schemas)),i.schemas[s]||(i.schemas[s]=e);var o=mu(s,e);for(var a in o.id){var l=o.id[a];i.schemas[a]=l}}if(r.required&&t===void 0){var h=new yu(t,e,r,i);return h.addError("is required, but is undefined"),h}var h=this.validateSchema(t,e,r,i);if(h){if(r.throwAll&&h.errors.length)throw new ex(h)}else throw new Error("Result undefined");return h};function xu(t){var e=typeof t=="string"?t:t.$ref;return typeof e=="string"?e:!1}ct.prototype.validateSchema=function(t,e,r,i){var n=new yu(t,e,r,i);if(typeof e=="boolean")e===!0?e={}:e===!1&&(e={type:[]});else if(!e)throw new Error("schema is undefined");if(e.extends)if(Array.isArray(e.extends)){var s={schema:e,ctx:i};e.extends.forEach(this.schemaTraverser.bind(this,s)),e=s.schema,s.schema=null,s.ctx=null,s=null}else e=$e.deepMerge(e,this.superResolve(e.extends,i));var o=xu(e);if(o){var a=this.resolve(e,o,i),l=new gu(a.subschema,r,i.path,a.switchSchema,i.schemas);return this.validateSchema(t,a.subschema,r,l)}var h=r&&r.skipAttributes||[];for(var u in e)if(!vu.ignoreProperties[u]&&h.indexOf(u)<0){var f=null,c=this.attributes[u];if(c)f=c.call(this,t,e,r,i);else if(r.allowUnknownAttributes===!1)throw new Xr("Unsupported attribute: "+u,e);f&&n.importErrors(f)}if(typeof r.rewrite=="function"){var d=r.rewrite.call(this,t,e,r,i);n.instance=d}return n},ct.prototype.schemaTraverser=function(t,e){t.schema=$e.deepMerge(t.schema,this.superResolve(e,t.ctx))},ct.prototype.superResolve=function(t,e){var r=xu(t);return r?this.resolve(t,r,e).subschema:t},ct.prototype.resolve=function(t,e,r){if(e=r.resolve(e),r.schemas[e])return{subschema:r.schemas[e],switchSchema:e};var i=du.parse(e),n=i&&i.hash,s=n&&n.length&&e.substr(0,e.length-n.length);if(!s||!r.schemas[s])throw new Xr("no such schema <"+e+">",t);var o=$e.objectGetPath(r.schemas[s],n.substr(1));if(o===void 0)throw new Xr("no such schema "+n+" located in <"+s+">",t);return{subschema:o,switchSchema:e}},ct.prototype.testType=function(t,e,r,i,n){if(n!==void 0){if(n===null)throw new Xr('Unexpected null in "type" keyword');if(typeof this.types[n]=="function")return this.types[n].call(this,t);if(n&&typeof n=="object"){var s=this.validateSchema(t,n,r,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Wt=ct.prototype.types={};Wt.string=function(t){return typeof t=="string"},Wt.number=function(t){return typeof t=="number"&&isFinite(t)},Wt.integer=function(t){return typeof t=="number"&&t%1===0},Wt.boolean=function(t){return typeof t=="boolean"},Wt.array=function(t){return Array.isArray(t)},Wt.null=function(t){return t===null},Wt.date=function(t){return t instanceof Date},Wt.any=function(t){return!0},Wt.object=function(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof Date)},it.ValidatorResult,it.ValidatorResultError,it.ValidationError,it.SchemaError;function fo(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function wu(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const i=fo(r);return(n,s)=>i.then(o=>s(o.transaction(e,n).objectStore(e)))}let co;function Pu(){return co||(co=wu("keyval-store","keyval")),co}function rx(t,e=Pu()){return e("readonly",r=>fo(r.get(t)))}function ix(t,e,r=Pu()){return r("readwrite",i=>(i.put(e,t),fo(i.transaction)))}const B={new_york:"#0c1829",stone:"#4d586b",warsaw:"#929baa",oslo:"#72849e",athens:"#e8ebef",gray:"#cfd5de",stone_08:"#f1f2f3",whisper:"#f7f8fa",white:"#ffffff",zurich:"#bdd8ff",zurich_48:"#dfecff",blue_ribbon:"#3355ff",flamingo:"#ef5533"},ae={api:{productDataCacheAge:24*3600*1e3,productContourCacheAge:10*24*3600*1e3},hideElements:[],panZoom:!0,planRotation:0,preserveViewbox:"center-center",roomStampSize:null,showCeilingLamps:!1,xrayMode:!1,destroyOnDomRemove:!1,ui:{scale:!0,coordinates:!1},spaceLabelMapping:{},theme:{fontFamily:"Avenir, Verdana, sans-serif",background:{color:B.whisper,showGrid:!1},wallContours:!1,showAssetTextures:!1,elements:{floorPlan:{grayscale:!1},roomStamp:{showArea:!0,showUsage:!0}}},units:{system:"metric",areaDecimals:0,lengthDecimals:3,roomDimensions:"area"},zoomRange:[3,300]};let po="archilogic/product",nn="https://storage.3d.io";const nx=t=>{t&&typeof t=="object"&&(ae.api={...ae.api,...t})},sn={getProduct(t){return bu(`${nn}/${po}/json/${t}.json`)},getProductThumbnailUrl(t){return`${nn}/${po}/thumb/${t}.png`},getProductOutline(t){return bu(`${nn}/${po}/outline/${t}.json`)}};function bu(t){return fetch(t).then(e=>{if(e.ok)return e.json();throw Error(e.statusText)})}const sx="al-kvs",ox="al-keyval",vo=typeof window>"u"||typeof process<"u",Tu=!vo&&wu(sx,ox);let Iu=!0;async function Cu(t,e,r){if(vo)return Promise.resolve();r=r||30*24*3600*1e3;try{const i={timeStamp:new Date().getTime(),content:e,maxAge:r};return Iu&&await ix(t,i,Tu),t}catch{return}}async function Au(t,e){if(vo)return Promise.resolve();const r=e||30*24*3600*1e3,i=new Date().getTime();let n;try{Iu&&(n=await rx(t,Tu));const s=i-n.timeStamp,o=Math.min(n.maxAge,r);if(s>o)return;if(n.content)return n.content}catch{return}}function ax(t){const e={10:["ceilingLight","wallLight"],9:["modularMeetingRoom","phoneBooth"],8:["floorLamp","tableLamp","deskDivider","cushion","plant","officeSupply","tableware","decoration","laundry","electronics","kitchen","car"],7:["shelf","cabinet","wardrobe","storageCombination","outdoor","bicycle","people","sink"],6:["highTable","diningTable","conferenceTable","desk"],5:["sofa","armchair","loungeChair","ottoman","sideboard","pedestal"],4:["taskChair","diningChair","conferenceChair","stool","barStool","bench"],3:["shower"],2:["singleBed","doubleBed","daybed","toilet","bathtub"],1:["sideTable","coffeeTable","radiator","nightstand"],0:["rug"]};let r=0;return t.subCategories.forEach(i=>{Object.keys(e).forEach(n=>{let s=parseInt(n);e[n].includes(i)&&s>r&&(r=s)})}),r===1&&t.categories.includes("tables")&&t.boundingBox.height>.6&&(r=6),r}const Eu={kitchen:Og,column:Sg,stairs:Hg,wall:Ug,door:Ng};function lx(t,e,r){if(Eu[t.type])return Eu[t.type](t,e);if(mo[t.type])return mo[t.type](t,e,r)}const mo={box:t=>Gr(t),curtain:t=>{const e=Math.min(Math.max(t.folds||10,Math.round(t.l*5)),Math.max(1,Math.round(t.l*15))),r=.05,i=t.w,n=t.l/e;let s=[],o=[];var a,l,h,u=0,f=i/2,c=r/2;let d=t.id.replace(/-/gi,""),v=d.length;for(var y=0;y<e;y++){l=c,h=f;let m=parseInt(d[y%v],16)/20;c=r/2+m*r/2*(y%2===0?-1:1),f=i/2+m*i/2*(y%2===0?-1:1),a=u,u=n*(y+1),o.push([a,h]),s.push([a,l]),y===e-1&&(o.push([u,f]),s.push([u,c]))}return[{type:"composite",segments:[{type:"quadraticBezier",points:s},{type:"quadraticBezier",points:o.reverse()}]}]},railing:t=>Gr(t),floor:t=>Gr(t),window:(t,e)=>Gr(t,e),closet:t=>Gr(t),interior:(t,e,r)=>{if(!r)return[{type:"circle",position:[0,0],radius:.01}];if(r=r.sort((i,n)=>js(i)>js(n)?-1:1),!(!r||!r.length))return[{type:"polygon",points:r[0],holes:r.slice(1)}]},polyfloor:t=>[{type:"polygon",points:t.polygon,holes:t.polygonHoles||[]}],polybox:t=>[{type:"polygon",points:t.polygon}],"a:helper:spaceDivider":t=>[{type:"rectangle",position:[0,-.02],dimensions:[t.l,.04]}],floorplan:t=>[{type:"rectangle",position:[-t.l/2,-t.w/2],dimensions:[t.l,t.w],style:{fill:!1}}]};function Gr(t,e){let r=0,i=t.w;return t.type==="wall"&&(r=t.controlLine==="front"?t.w:t.controlLine==="center"?t.w/2:0),t.type==="window"&&(i=e.w,r=e.controlLine==="front"?e.w:e.controlLine==="center"?e.w/2:0),[{type:"polygon",points:[[0,0-r],[t.l,0-r],[t.l,i-r],[0,i-r]]}]}const hx="fpe-pr1-",Su="fpe-dc2-";var on=(t=>(t[t.None=0]="None",t[t.Default=1]="Default",t[t.Grayscale=2]="Grayscale",t))(on||{});let ux=class extends Ah{constructor(e,r){var i,n,s;super(),this.productQueue={},this.textureQueue={},this.promiseCache=new Map,this.loadStages={product:!0,productContour:!0,productTexture:!1},this.isSceneStructureLoaded=!1,this.initialLoading=!0,this._loadCounter=0,this.resources=e,this.productContourCacheAge=(i=r.api)==null?void 0:i.productContourCacheAge,this.productDataCacheAge=(n=r.api)==null?void 0:n.productDataCacheAge,this.loadStages.productTexture=!!((s=r.theme)!=null&&s.showAssetTextures)&&r.loadTextures!==!1,this.on("product-load-stage",this.loadStatus,this)}loadStatus({args:e}){const r=Object.values(this.textureQueue).reduce((s,o)=>s+o.nodes.size,0),i=Object.values(this.productQueue).reduce((s,o)=>s+o.nodes.size,0),n=r+i;this._loadCounter++,this.emit("loading-status",{totalCount:n,doneCount:this._loadCounter}),n===this._loadCounter&&this.emit("loading-done",{totalCount:n})}reset(){this.resources.spaces=[],this.resources.assets=[],this.resources.products={},this.resources.productContours={},this.resources.productBoundingBoxes={},this.textureQueue={},this.productQueue={},this._loadCounter=0,this.promiseCache=new Map,this.initialLoading=!0}};async function fx(t,e){if(e.promiseCache||(e.promiseCache=new Map),!t||!t.product)return;const r=t.product;e.productQueue[r]||(e.productQueue[r]={loadStage:0,nodes:new Set}),e.productQueue[r].nodes.add(t),e.productQueue[r].loadStage<1&&await yx(r,e),e.loadStages.productContour&&cx(t,e)}async function cx(t,e){const r=t.product,i=e.resources.products[r];if(!i||!e.productQueue[r])return;const n=r;if(mx(e.resources,t),!e.textureQueue[n]){const s=sn.getProductThumbnailUrl(n);e.textureQueue[n]={productId:r,loadStage:0,nodes:new Set,textureUrl:s,applyFilter:1},e.loadStages.productTexture&&e.emit("product-load-texture",{textureId:n,productData:i})}if(e.textureQueue[n].nodes.add(t),e.textureQueue[n].loadStage===2){e.emit("product-load-stage",{node:t,args:{_loadStage:3,_textureId:n}});return}e.resources.productBoundingBoxes[r]||(e.resources.productBoundingBoxes[r]=px(i),e.productQueue[r].loadStage=2),e.productQueue[r].loadStage===2&&e.emit("product-load-stage",{node:t,args:{_loadStage:2}}),e.resources.productContours[r]||dx(i,e).then(()=>{var s,o;((s=e.textureQueue[n])==null?void 0:s.loadStage)===1||(o=e.textureQueue[n])!=null&&o.error?e.emit("product-contour",n):e.loadStages.productTexture||e.emit("product-load-stage",{node:t,args:{_loadStage:3}})})}const px=t=>{const e=t.boundingPoints;let r;if(e)return r=[[e.min[0],e.min[2]],[e.min[0],e.max[2]],[e.max[0],e.max[2]],[e.max[0],e.min[2]]],t._loadStage=1,[r]},dx=async(t,e)=>{const{productId:r}=t,i=Su+r,n=e.promiseCache.get(i);if(n)return n;const s=gx(r,e).then(o=>{const a=o;e.resources.productContours[r]=a,e.resources.products[r]._shapes=mo.interior({type:"interior"},null,a),e.productQueue[r].loadStage=3}).catch(()=>{});return e.promiseCache.set(i,s),s};function vx(t){if(!t)return;const e=t.subCategories.includes("ceilingLight"),r=t.subCategories.includes("rug"),i=t.productResourceId,n=sn.getProductThumbnailUrl(i);return{preview:t.preview,manufacturer:t.manufacturer,productId:i,name:t.productDisplayName,fileKey:t.fileKey,tags:t.tags,categories:t.categories,subCategories:t.subCategories,boundingPoints:t.boundingPoints,boundingBox:t.boundingBox,seatCapacity:t.seatCapacity,texture:n,materials:[],matColors:t.matColors,colours:t.colours,order:ax(t),isCeilingLamp:e,isCarpet:r,createdAt:t.createdAt,updatedAt:t.updatedAt,link:t.link}}function mx(t,e){if(!e||e.type!=="layout:asset")return;let r=e.product;if(!r)return;let i=r;i&&!t.products[r].materials.includes(i)&&t.products[r].materials.splice(0,0,i)}function yx(t,e){const r=e.productDataCacheAge,i=r||24*3600*1e3;if(!t)return Promise.reject("product id missing");const n=hx+t,s=e.promiseCache.get(n);if(s)return s;const o=Au(n,r).then(a=>!a||!a.matColors?sn.getProduct(t).then(l=>(l.matColors={},l.colours&&l.colours.length&&l.colours.forEach(h=>{if(!h.includes(":"))return;let u=h.split(":"),f=Ig(u[1]);l.matColors[f]=u[2]}),Cu(n,l,i),l)):a).then(a=>{const l=vx(a);e.resources.products[t]=l,e.productQueue[t].loadStage=1,e.emit("product-data",{productId:t,data:l})}).catch(a=>{console.warn(a.message)});return e.promiseCache.set(n,o),o}function gx(t,e){const r=e.productContourCacheAge,i=r||10*24*3600*1e3;if(!t)return Promise.reject("product id missing");const n=Su+t,s=e.promiseCache.get(n);if(s)return s;const o=Au(n,r).then(a=>a||sn.getProductOutline(t).then(l=>(Cu(n,l,i),l))).catch(a=>{console.warn(a)});return e.promiseCache.set(n,o),o}const _x=t=>{var e;return((e=t.src)==null?void 0:e.substring(1))||""},xx=t=>{const e=[];return t.layout.elements.forEach(r=>{"product"in r&&e.push(r)}),Promise.all(e.map(r=>fx(r,t.loader).catch(i=>console.error(i)))).then(()=>{})};class Nu{constructor({options:e={},scene:r}={}){this.settings=qr(ae),this.fpeId="fpe-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,3),this.resources={spaces:[],assets:[],products:{},productContours:{},productBoundingBoxes:{}},this.computed={wallContours:[],relations:{spaces:[]},snapPoints:[],snapMargin:0},this.isBrowser=typeof process!="object"&&typeof window<"u",this._emitter=new Ah,this.set(e),this.loader=new ux(this.resources,this.settings),this.utils={polygonOffset:Mh,polygonIntersection:Fh,pointInPolygon:$i,polygonUnion:Oh}}on(e,r,i){return this._emitter.on(e,r,i),this}once(e,r,i){return this._emitter.once(e,r,i),this}off(e,r){return this._emitter.off(e,r),this}emit(e,...r){return this._emitter.emit(e,...r),this}loadLayout(e){this.loader.initialLoading||this.loader.reset(),z_(e),R_(e,this),this.layout=e,setTimeout(()=>{this.loader.emit("assets-loaded"),this.loader.emit("spaces-loaded")},0),xx(this).then(()=>{const r=this.settings.hideElements.includes("interior"),i=Object.keys(this.sharedResources.products).length===0;this.loader.emit("assets-loaded",!0),(r||i)&&this.loader.emit("loading-done",{totalCount:0})}),this.loader.initialLoading=!1}set(e={}){var r,i,n,s,o;(r=this.settings.hideElements)==null||r.includes("interior");let a=qr(e);a.theme&&(a.theme=Yo(ae.theme,a.theme)),a.ui&&(a.ui={...ae.ui,...a.ui}),a.api&&(a.api={...ae.api,...a.api}),a.units&&(a.units={...ae.units,...a.units}),(i=a.hideElements)!=null&&i.includes("interior");for(let l in a)this.settings[l]=a[l];if((o=(s=(n=this.settings.theme)==null?void 0:n.elements)==null?void 0:s.space)!=null&&o.program){const l=this.settings.theme.elements.space.program,h={wash:"care",operate:"support",common:"socialize"};Object.keys(l).forEach(u=>{Object.keys(h).includes(u)&&(l[h[u]]=l[u],delete l[u])})}this.emit("update-settings",this.settings)}getResourcesFromPosition(e){const r=this.resources.spaces.filter(n=>$i(e,n.polygons[0],n.polygons.slice(1))),i=[];return r.forEach(n=>{let s=this.resources.assets.filter(o=>n.assets.includes(o.id)).filter(o=>{var a;if(!((a=this.resources.products[o.productId])!=null&&a.isCeilingLamp&&!this.settings.showCeilingLamps)&&!(!o.polygon||!o.polygon.length))return $i(e,o.polygon)});i.push(...s)}),{spaces:r,assets:i}}getElementBoundingBox(e,r=0){if(!e)return;let i;if(e instanceof wn&&(i=e.getWorldPosition()),!i)return;let n;if(i.type==="interior"&&i.src){let o=_x(i),a=this.resources.productBoundingBoxes[o]||this.resources.productContours[o];n=a&&He(i,a[0])}else i.type==="polyfloor"?n=He(i,i.polygon):i.type!=="group"?n=mg(i):n=[[i.x-2,i.z-2],[i.x+2,i.z-2],[i.x+2,i.z+2],[i.x-2,i.z+2]];const s=Nh([n]);return{x:s.x-r,z:s.z-r,x2:s.x2+r,z2:s.z2+r,length:s.length+r*2,width:s.width+r*2}}destroy(){delete this.layout,delete this.resources,delete this.settings,delete this.utils}}Nu.version="5.0.0-beta.8";const Ou=(t,e,r=.15)=>{let i,n,s;for(const o of e)if(i=Math.abs(t[0]-o[0]),!(i>r)&&(n=Math.abs(t[1]-o[1]),i<r&&n<r)){s=o;break}return s};function wx(t,e,r){const i=new MutationObserver(()=>{function n(s){return s.parentNode===e?!1:s.parentNode===null?!0:n(s.parentNode)}n(t)&&(i.disconnect(),r())});i.observe(e,{childList:!0,subtree:!0})}function Px(t,e,r){let{x:i,z:n,x2:s,z2:o,length:a,width:l}=t;const h=e/r;if(a/l>h){const u=l;l=a/h;const f=(u-l)/2;n+=f,o-=f}else{const u=a;a=l*h;const f=(u-a)/2;i+=f,s-=f}return{x:i,x2:s,z:n,z2:o,length:a,width:l}}function bx(t,e){var r,i;let n=t.getArea(),s="";if(jh(s)==="void")return[];let{showUsage:o,showArea:a,roomStampDisplay:l}=((r=e.theme.elements)==null?void 0:r.roomStamp)||{};const h=e.spaceLabelMapping||{};let u;h[s]!==void 0&&(u=h[s]),h[t.id]!==void 0&&(u=h[t.id]);let f;switch(e.units.roomDimensions){case"area":f=Wo(n,e.units.system,e.units.areaDecimals);break;case"boundingBox":default:f="";break}let c="";if(!c&&s!=="undefined"&&(c=wf("")),u!==void 0&&(typeof u!="string"?console.warn("space label mapping has to be a string"):u.length>50?console.warn("space label mapping has to be less than 50 characters"):c=u),!l){const v=((i=e.theme.elements)==null?void 0:i.roomStamp)!==!1,y=o!==void 0||a!==void 0;l=[],v&&y?(o&&l.push("usage"),a&&l.push("area")):v&&l.push("usage","area")}const d=[];return l.forEach(v=>{switch(v){case"name":t.name&&d.push(t.name);break;case"customId":t.customId&&d.push(t.customId);break;case"usage":d.push(c);break;case"area":d.push(f);break}}),d}var yo={},Tx={get exports(){return yo},set exports(t){yo=t}};(function(t,e){(function(){var r,i;i=function(n){return t.exports=n},r={linear:function(n,s,o,a){return o*n/a+s},easeInQuad:function(n,s,o,a){return o*(n/=a)*n+s},easeOutQuad:function(n,s,o,a){return-o*(n/=a)*(n-2)+s},easeInOutQuad:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n+s:-o/2*(--n*(n-2)-1)+s},easeInCubic:function(n,s,o,a){return o*(n/=a)*n*n+s},easeOutCubic:function(n,s,o,a){return o*((n=n/a-1)*n*n+1)+s},easeInOutCubic:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n+s:o/2*((n-=2)*n*n+2)+s},easeInQuart:function(n,s,o,a){return o*(n/=a)*n*n*n+s},easeOutQuart:function(n,s,o,a){return-o*((n=n/a-1)*n*n*n-1)+s},easeInOutQuart:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n+s:-o/2*((n-=2)*n*n*n-2)+s},easeInQuint:function(n,s,o,a){return o*(n/=a)*n*n*n*n+s},easeOutQuint:function(n,s,o,a){return o*((n=n/a-1)*n*n*n*n+1)+s},easeInOutQuint:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n*n+s:o/2*((n-=2)*n*n*n*n+2)+s},easeInSine:function(n,s,o,a){return-o*Math.cos(n/a*(Math.PI/2))+o+s},easeOutSine:function(n,s,o,a){return o*Math.sin(n/a*(Math.PI/2))+s},easeInOutSine:function(n,s,o,a){return-o/2*(Math.cos(Math.PI*n/a)-1)+s},easeInExpo:function(n,s,o,a){return n===0?s:o*Math.pow(2,10*(n/a-1))+s},easeOutExpo:function(n,s,o,a){return n===a?s+o:o*(-Math.pow(2,-10*n/a)+1)+s},easeInOutExpo:function(n,s,o,a){return(n/=a/2)<1?o/2*Math.pow(2,10*(n-1))+s:o/2*(-Math.pow(2,-10*--n)+2)+s},easeInCirc:function(n,s,o,a){return-o*(Math.sqrt(1-(n/=a)*n)-1)+s},easeOutCirc:function(n,s,o,a){return o*Math.sqrt(1-(n=n/a-1)*n)+s},easeInOutCirc:function(n,s,o,a){return(n/=a/2)<1?-o/2*(Math.sqrt(1-n*n)-1)+s:o/2*(Math.sqrt(1-(n-=2)*n)+1)+s},easeInElastic:function(n,s,o,a){var l,h,u;return u=1.70158,h=0,l=o,n===0||(n/=a),h||(h=a*.3),l<Math.abs(o)?(l=o,u=h/4):u=h/(2*Math.PI)*Math.asin(o/l),-(l*Math.pow(2,10*(n-=1))*Math.sin((n*a-u)*(2*Math.PI)/h))+s},easeOutElastic:function(n,s,o,a){var l,h,u;return u=1.70158,h=0,l=o,n===0||(n/=a),h||(h=a*.3),l<Math.abs(o)?(l=o,u=h/4):u=h/(2*Math.PI)*Math.asin(o/l),l*Math.pow(2,-10*n)*Math.sin((n*a-u)*(2*Math.PI)/h)+o+s},easeInOutElastic:function(n,s,o,a){var l,h,u;return u=1.70158,h=0,l=o,n===0||(n/=a/2),h||(h=a*(.3*1.5)),l<Math.abs(o)?(l=o,u=h/4):u=h/(2*Math.PI)*Math.asin(o/l),n<1?-.5*(l*Math.pow(2,10*(n-=1))*Math.sin((n*a-u)*(2*Math.PI)/h))+s:l*Math.pow(2,-10*(n-=1))*Math.sin((n*a-u)*(2*Math.PI)/h)*.5+o+s},easeInBack:function(n,s,o,a,l){return l===void 0&&(l=1.70158),o*(n/=a)*n*((l+1)*n-l)+s},easeOutBack:function(n,s,o,a,l){return l===void 0&&(l=1.70158),o*((n=n/a-1)*n*((l+1)*n+l)+1)+s},easeInOutBack:function(n,s,o,a,l){return l===void 0&&(l=1.70158),(n/=a/2)<1?o/2*(n*n*(((l*=1.525)+1)*n-l))+s:o/2*((n-=2)*n*(((l*=1.525)+1)*n+l)+2)+s},easeInBounce:function(n,s,o,a){var l;return l=r.easeOutBounce(a-n,0,o,a),o-l+s},easeOutBounce:function(n,s,o,a){return(n/=a)<1/2.75?o*(7.5625*n*n)+s:n<2/2.75?o*(7.5625*(n-=1.5/2.75)*n+.75)+s:n<2.5/2.75?o*(7.5625*(n-=2.25/2.75)*n+.9375)+s:o*(7.5625*(n-=2.625/2.75)*n+.984375)+s},easeInOutBounce:function(n,s,o,a){var l;return n<a/2?(l=r.easeInBounce(n*2,0,o,a),l*.5+s):(l=r.easeOutBounce(n*2-a,0,o,a),l*.5+o*.5+s)}},i(r)}).call(jt)})(Tx);var Ix=yo;class At{constructor(e){this.parent=e,this.paused=!1}destroy(){}down(e){return!1}move(e){return!1}up(e){return!1}wheel(e){return!1}update(e){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var Cx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ax(t,e,r){return r={path:e,exports:{},require:function(i,n){return Ex(i,n??r.path)}},t(r,r.exports),r.exports}function Ex(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Lu=Ax(function(t,e){(function(){var r,i;i=function(n){return t.exports=n},r={linear:function(n,s,o,a){return o*n/a+s},easeInQuad:function(n,s,o,a){return o*(n/=a)*n+s},easeOutQuad:function(n,s,o,a){return-o*(n/=a)*(n-2)+s},easeInOutQuad:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n+s:-o/2*(--n*(n-2)-1)+s},easeInCubic:function(n,s,o,a){return o*(n/=a)*n*n+s},easeOutCubic:function(n,s,o,a){return o*((n=n/a-1)*n*n+1)+s},easeInOutCubic:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n+s:o/2*((n-=2)*n*n+2)+s},easeInQuart:function(n,s,o,a){return o*(n/=a)*n*n*n+s},easeOutQuart:function(n,s,o,a){return-o*((n=n/a-1)*n*n*n-1)+s},easeInOutQuart:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n+s:-o/2*((n-=2)*n*n*n-2)+s},easeInQuint:function(n,s,o,a){return o*(n/=a)*n*n*n*n+s},easeOutQuint:function(n,s,o,a){return o*((n=n/a-1)*n*n*n*n+1)+s},easeInOutQuint:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n*n+s:o/2*((n-=2)*n*n*n*n+2)+s},easeInSine:function(n,s,o,a){return-o*Math.cos(n/a*(Math.PI/2))+o+s},easeOutSine:function(n,s,o,a){return o*Math.sin(n/a*(Math.PI/2))+s},easeInOutSine:function(n,s,o,a){return-o/2*(Math.cos(Math.PI*n/a)-1)+s},easeInExpo:function(n,s,o,a){return n===0?s:o*Math.pow(2,10*(n/a-1))+s},easeOutExpo:function(n,s,o,a){return n===a?s+o:o*(-Math.pow(2,-10*n/a)+1)+s},easeInOutExpo:function(n,s,o,a){return(n/=a/2)<1?o/2*Math.pow(2,10*(n-1))+s:o/2*(-Math.pow(2,-10*--n)+2)+s},easeInCirc:function(n,s,o,a){return-o*(Math.sqrt(1-(n/=a)*n)-1)+s},easeOutCirc:function(n,s,o,a){return o*Math.sqrt(1-(n=n/a-1)*n)+s},easeInOutCirc:function(n,s,o,a){return(n/=a/2)<1?-o/2*(Math.sqrt(1-n*n)-1)+s:o/2*(Math.sqrt(1-(n-=2)*n)+1)+s},easeInElastic:function(n,s,o,a){var l,h,u;return u=1.70158,h=0,l=o,n===0||(n/=a),h||(h=a*.3),l<Math.abs(o)?(l=o,u=h/4):u=h/(2*Math.PI)*Math.asin(o/l),-(l*Math.pow(2,10*(n-=1))*Math.sin((n*a-u)*(2*Math.PI)/h))+s},easeOutElastic:function(n,s,o,a){var l,h,u;return u=1.70158,h=0,l=o,n===0||(n/=a),h||(h=a*.3),l<Math.abs(o)?(l=o,u=h/4):u=h/(2*Math.PI)*Math.asin(o/l),l*Math.pow(2,-10*n)*Math.sin((n*a-u)*(2*Math.PI)/h)+o+s},easeInOutElastic:function(n,s,o,a){var l,h,u;return u=1.70158,h=0,l=o,n===0||(n/=a/2),h||(h=a*(.3*1.5)),l<Math.abs(o)?(l=o,u=h/4):u=h/(2*Math.PI)*Math.asin(o/l),n<1?-.5*(l*Math.pow(2,10*(n-=1))*Math.sin((n*a-u)*(2*Math.PI)/h))+s:l*Math.pow(2,-10*(n-=1))*Math.sin((n*a-u)*(2*Math.PI)/h)*.5+o+s},easeInBack:function(n,s,o,a,l){return l===void 0&&(l=1.70158),o*(n/=a)*n*((l+1)*n-l)+s},easeOutBack:function(n,s,o,a,l){return l===void 0&&(l=1.70158),o*((n=n/a-1)*n*((l+1)*n+l)+1)+s},easeInOutBack:function(n,s,o,a,l){return l===void 0&&(l=1.70158),(n/=a/2)<1?o/2*(n*n*(((l*=1.525)+1)*n-l))+s:o/2*((n-=2)*n*(((l*=1.525)+1)*n+l)+2)+s},easeInBounce:function(n,s,o,a){var l;return l=r.easeOutBounce(a-n,0,o,a),o-l+s},easeOutBounce:function(n,s,o,a){return(n/=a)<1/2.75?o*(7.5625*n*n)+s:n<2/2.75?o*(7.5625*(n-=1.5/2.75)*n+.75)+s:n<2.5/2.75?o*(7.5625*(n-=2.25/2.75)*n+.9375)+s:o*(7.5625*(n-=2.625/2.75)*n+.984375)+s},easeInOutBounce:function(n,s,o,a){var l;return n<a/2?(l=r.easeInBounce(n*2,0,o,a),l*.5+s):(l=r.easeOutBounce(n*2-a,0,o,a),l*.5+o*.5+s)}},i(r)}).call(Cx)});function an(t,e){if(t){if(typeof t=="function")return t;if(typeof t=="string")return Lu[t]}else return Lu[e]}const Sx={removeOnInterrupt:!1,ease:"linear",time:1e3};class ue extends At{__init(){this.startWidth=null}__init2(){this.startHeight=null}__init3(){this.deltaWidth=null}__init4(){this.deltaHeight=null}__init5(){this.width=null}__init6(){this.height=null}__init7(){this.time=0}constructor(e,r={}){super(e),ue.prototype.__init.call(this),ue.prototype.__init2.call(this),ue.prototype.__init3.call(this),ue.prototype.__init4.call(this),ue.prototype.__init5.call(this),ue.prototype.__init6.call(this),ue.prototype.__init7.call(this),this.options=Object.assign({},Sx,r),this.options.ease=an(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),this.keepCenter||this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(e){if(this.paused)return;this.time+=e;const r=new X(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,n=this.parent.height;this.complete(),(i!==this.parent.width||n!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:r,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const n=this.startWidth,s=this.deltaWidth;this.parent.fitWidth(n+s*i,this.keepCenter,this.height===null)}if(this.height!==null){const n=this.startHeight,s=this.deltaHeight;this.parent.fitHeight(n+s*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const n=this.startX,s=this.startY,o=this.deltaX,a=this.deltaY,l=new X(this.parent.x,this.parent.y);this.parent.moveCenter(n+o*i,s+a*i),this.parent.emit("moved",{viewport:this.parent,original:l,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:r,type:"animate"})}}}function ln(t){let e,r=t[0],i=1;for(;i<t.length;){const n=t[i],s=t[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&r==null)return;n==="access"||n==="optionalAccess"?(e=r,r=s(r)):(n==="call"||n==="optionalCall")&&(r=s((...o)=>r.call(e,...o)),e=void 0)}return r}const Nx={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class Ox extends At{constructor(e,r={}){super(e),this.options=Object.assign({},Nx,r),this.ease=an(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(e){if(!this.paused){if(this.bounce(),this.toX){const r=this.toX;r.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),r.time>=this.options.time?(this.parent.x=r.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(r.time,r.start,r.delta,this.options.time)}if(this.toY){const r=this.toY;r.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),r.time>=this.options.time?(this.parent.y=r.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(r.time,r.start,r.delta,this.options.time)}}}calcUnderflowX(){let e;switch(this.underflowX){case-1:e=0;break;case 1:e=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:e=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return e}calcUnderflowY(){let e;switch(this.underflowY){case-1:e=0;break;case 1:e=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:e=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return e}oob(){const e=this.options.bounceBox;if(e){const r=typeof e.x>"u"?0:e.x,i=typeof e.y>"u"?0:e.y,n=typeof e.width>"u"?this.parent.worldWidth:e.width,s=typeof e.height>"u"?this.parent.worldHeight:e.height;return{left:this.parent.left<r,right:this.parent.right>n,top:this.parent.top<i,bottom:this.parent.bottom>s,topLeft:new X(r*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new X(n*this.parent.scale.x-this.parent.screenWidth,s*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new X(0,0),bottomRight:new X(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){if(this.paused)return;let e,r=this.parent.plugins.get("decelerate",!0);r&&(r.x||r.y)&&(r.x&&r.percentChangeX===ln([r,"access",s=>s.options,"optionalAccess",s=>s.friction])||r.y&&r.percentChangeY===ln([r,"access",s=>s.options,"optionalAccess",s=>s.friction]))&&(e=this.oob(),(e.left&&this.left||e.right&&this.right)&&(r.percentChangeX=this.options.friction),(e.top&&this.top||e.bottom&&this.bottom)&&(r.percentChangeY=this.options.friction));const i=this.parent.plugins.get("drag",!0)||{},n=this.parent.plugins.get("pinch",!0)||{};if(r=r||{},!ln([i,"optionalAccess",s=>s.active])&&!ln([n,"optionalAccess",s=>s.active])&&(!this.toX||!this.toY)&&(!r.x||!r.y)){e=e||this.oob();const s=e.topLeft,o=e.bottomRight;if(!this.toX&&!r.x){let a=null;e.left&&this.left?a=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-s.x:e.right&&this.right&&(a=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-o.x),a!==null&&this.parent.x!==a&&(this.toX={time:0,start:this.parent.x,delta:a-this.parent.x,end:a},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!r.y){let a=null;e.top&&this.top?a=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-s.y:e.bottom&&this.bottom&&(a=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-o.y),a!==null&&this.parent.y!==a&&(this.toY={time:0,start:this.parent.y,delta:a-this.parent.y,end:a},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const Lx={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class Mx extends At{constructor(e,r={}){super(e),this.options=Object.assign({},Lx,r),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const e=this.options.underflow.toLowerCase();e==="none"?this.noUnderflow=!0:e==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=e.indexOf("left")!==-1?-1:e.indexOf("right")!==-1?1:0,this.underflowY=e.indexOf("top")!==-1?-1:e.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const e={x:this.parent.x,y:this.parent.y},r=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,r.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,r.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:e,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,r.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,r.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:e,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const Fx={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class Rx extends At{constructor(e,r={}){super(e),this.options=Object.assign({},Fx,r),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let e=this.parent.worldScreenWidth,r=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&e<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,e=this.parent.worldScreenWidth,r=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&e>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,e=this.parent.worldScreenWidth,r=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&r<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,e=this.parent.worldScreenWidth,r=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&r>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const e={x:null,y:null},r={x:null,y:null};if(typeof this.options.minScale=="number")e.x=this.options.minScale,e.y=this.options.minScale;else if(this.options.minScale!==null){const s=this.options.minScale;e.x=typeof s.x>"u"?null:s.x,e.y=typeof s.y>"u"?null:s.y}if(typeof this.options.maxScale=="number")r.x=this.options.maxScale,r.y=this.options.maxScale;else if(this.options.maxScale!==null){const s=this.options.maxScale;r.x=typeof s.x>"u"?null:s.x,r.y=typeof s.y>"u"?null:s.y}let i=this.parent.scale.x,n=this.parent.scale.y;e.x!==null&&i<e.x&&(i=e.x),r.x!==null&&i>r.x&&(i=r.x),e.y!==null&&n<e.y&&(n=e.y),r.y!==null&&n>r.y&&(n=r.y),(i!==this.parent.scale.x||n!==this.parent.scale.y)&&(this.parent.scale.set(i,n),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const kx={friction:.98,bounce:.8,minSpeed:.01},Te=16;class Ux extends At{constructor(e,r={}){super(e),this.options=Object.assign({},kx,r),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.moved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const e=this.parent.input.count();return(e===1||e>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}moved(e){if(this.saved.length){const r=this.saved[this.saved.length-1];e.type==="clamp-x"?r.x===e.original.x&&(r.x=this.parent.x):e.type==="clamp-y"&&r.y===e.original.y&&(r.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const e=performance.now();for(const r of this.saved)if(r.time>=e-100){const i=e-r.time;this.x=(this.parent.x-r.x)/i,this.y=(this.parent.y-r.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(e){e=e||{},typeof e.x<"u"&&(this.x=e.x,this.percentChangeX=this.options.friction),typeof e.y<"u"&&(this.y=e.y,this.percentChangeY=this.options.friction)}update(e){if(this.paused)return;const r=this.x||this.y,i=this.timeSinceRelease,n=this.timeSinceRelease+e;if(this.x){const s=this.percentChangeX,o=Math.log(s);this.parent.x+=this.x*Te/o*(Math.pow(s,n/Te)-Math.pow(s,i/Te)),this.x*=Math.pow(this.percentChangeX,e/Te)}if(this.y){const s=this.percentChangeY,o=Math.log(s);this.parent.y+=this.y*Te/o*(Math.pow(s,n/Te)-Math.pow(s,i/Te)),this.y*=Math.pow(this.percentChangeY,e/Te)}this.timeSinceRelease+=e,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),r&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const Bx={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class Dx extends At{constructor(e,r={}){super(e),this.options=Object.assign({},Bx,r),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(e){window.addEventListener("keydown",r=>{e.includes(r.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",r=>{e.includes(r.code)&&(this.keyIsPressed=!1)})}mouseButtons(e){!e||e==="all"?this.mouse=[!0,!0,!0]:this.mouse=[e.indexOf("left")!==-1,e.indexOf("middle")!==-1,e.indexOf("right")!==-1]}parseUnderflow(){const e=this.options.underflow.toLowerCase();e==="center"?(this.underflowX=0,this.underflowY=0):(e.includes("left")?this.underflowX=-1:e.includes("right")?this.underflowX=1:this.underflowX=0,e.includes("top")?this.underflowY=-1:e.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(e){const r=e.data.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!r||this.mouse[e.data.button]))}checkKeyPress(e){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&e.data.pointerType==="touch"}down(e){return this.paused||!this.options.pressDrag?!1:this.checkButtons(e)&&this.checkKeyPress(e)?(this.last={x:e.data.global.x,y:e.data.global.y},this.current=e.data.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(e){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===e.data.pointerId){const r=e.data.global.x,i=e.data.global.y,n=this.parent.input.count();if(n===1||n>1&&!this.parent.plugins.get("pinch",!0)){const s=r-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(s)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:r,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:e,screen:new X(this.last.x,this.last.y),world:this.parent.toWorld(new X(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(e){if(this.paused)return!1;const r=this.parent.input.touches;if(r.length===1){const i=r[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new X(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:e,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(e){if(this.paused)return!1;if(this.options.wheel){const r=this.parent.plugins.get("wheel",!0);if(!r||!r.options.wheelZoom&&!e.ctrlKey){const i=e.deltaMode?this.options.lineHeight:1,n=[e.deltaX,e.deltaY],[s,o]=this.options.wheelSwapAxes?n.reverse():n;return this.xDirection&&(this.parent.x+=s*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||e.preventDefault(),this.parent.options.stopPropagation&&e.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const e=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,e.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,e.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,e.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,e.y=0)}}const Xx={speed:0,acceleration:null,radius:null};class Gx extends At{constructor(e,r,i={}){super(e),this.target=r,this.options=Object.assign({},Xx,i),this.velocity={x:0,y:0}}update(e){if(this.paused)return;const r=this.parent.center;let i=this.target.x,n=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-r.y,2)+Math.pow(this.target.x-r.x,2))>this.options.radius){const l=Math.atan2(this.target.y-r.y,this.target.x-r.x);i=this.target.x-Math.cos(l)*this.options.radius,n=this.target.y-Math.sin(l)*this.options.radius}else return;const s=i-r.x,o=n-r.y;if(s||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(n-r.y,i-r.x),l=Math.sqrt(Math.pow(s,2)+Math.pow(o,2));if(l){const h=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);l>h?this.velocity={x:Math.min(this.velocity.x+this.options.acceleration*e,this.options.speed),y:Math.min(this.velocity.y+this.options.acceleration*e,this.options.speed)}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const u=Math.cos(a)*this.velocity.x,f=Math.sin(a)*this.velocity.y,c=Math.abs(u)>Math.abs(s)?i:r.x+u,d=Math.abs(f)>Math.abs(o)?n:r.y+f;this.parent.moveCenter(c,d),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(n-r.y,i-r.x),l=Math.cos(a)*this.options.speed,h=Math.sin(a)*this.options.speed,u=Math.abs(l)>Math.abs(s)?i:r.x+l,f=Math.abs(h)>Math.abs(o)?n:r.y+h;this.parent.moveCenter(u,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,n),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const Hx={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class zx extends At{constructor(e,r={}){super(e),this.options=Object.assign({},Hx,r),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const e=this.options.distance;e!==null?(this.left=e,this.top=e,this.right=this.parent.screenWidth-e,this.bottom=this.parent.screenHeight-e):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(e){if(this.paused||e.data.pointerType!=="mouse"&&e.data.identifier!==1||!this.options.allowButtons&&e.data.buttons!==0)return!1;const r=e.data.global.x,i=e.data.global.y;if(this.radiusSquared){const n=this.parent.toScreen(this.parent.center);if(Math.pow(n.x-r,2)+Math.pow(n.y-i,2)>=this.radiusSquared){const o=Math.atan2(n.y-i,n.x-r);this.options.linear?(this.horizontal=Math.round(Math.cos(o))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(o))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(o)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(o)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&r<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&r>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const e=this.parent.plugins.get("decelerate",!0);this.horizontal&&e&&!this.options.noDecelerate&&e.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const e=this.parent.plugins.get("decelerate",!0);this.vertical&&e&&!this.options.noDecelerate&&e.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const e=this.parent.center;this.horizontal&&(e.x+=this.horizontal*this.options.speed),this.vertical&&(e.y+=this.vertical*this.options.speed),this.parent.moveCenter(e),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const Wx={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class Yr extends At{__init(){this.active=!1}__init2(){this.pinching=!1}__init3(){this.moved=!1}constructor(e,r={}){super(e),Yr.prototype.__init.call(this),Yr.prototype.__init2.call(this),Yr.prototype.__init3.call(this),this.options=Object.assign({},Wx,r)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(e){if(this.paused||!this.active)return!1;const r=e.data.global.x,i=e.data.global.y,n=this.parent.input.touches;if(n.length>=2){const s=n[0],o=n[1],a=s.last&&o.last?Math.sqrt(Math.pow(o.last.x-s.last.x,2)+Math.pow(o.last.y-s.last.y,2)):null;if(s.id===e.data.pointerId?s.last={x:r,y:i,data:e.data}:o.id===e.data.pointerId&&(o.last={x:r,y:i,data:e.data}),a){let l;const h={x:s.last.x+(o.last.x-s.last.x)/2,y:s.last.y+(o.last.y-s.last.y)/2};this.options.center||(l=this.parent.toLocal(h));let u=Math.sqrt(Math.pow(o.last.x-s.last.x,2)+Math.pow(o.last.y-s.last.y,2));u=u===0?u=1e-10:u;const f=(1-a/u)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=f),this.isAxisY()&&(this.parent.scale.y+=f),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:h});const c=this.parent.plugins.get("clamp-zoom",!0);if(c&&c.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const d=this.parent.toGlobal(l);this.parent.x+=(h.x-d.x)*this.options.factor,this.parent.y+=(h.y-d.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(h.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(h.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=h,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const $x={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class Yx extends At{constructor(e,r,i,n={}){super(e),this.options=Object.assign({},$x,n),this.ease=an(n.ease,"easeInOutSine"),this.x=r,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const e=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-e.x,this.deltaY=this.y-e.y,this.startX=e.x,this.startY=e.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const e=this.parent.plugins.get("decelerate",!0);e&&(e.x||e.y)&&(e.percentChangeX=e.percentChangeY=this.options.friction)}return!1}update(e){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const r=this.snapping;r.time+=e;let i,n,s;const o=this.startX,a=this.startY,l=this.deltaX,h=this.deltaY;if(r.time>this.options.time)i=!0,n=o+l,s=a+h;else{const u=this.ease(r.time,0,1,this.options.time);n=o+l*u,s=a+h*u}this.options.topLeft?this.parent.moveCorner(n,s):this.parent.moveCenter(n,s),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const r=this.options.topLeft?this.parent.corner:this.parent.center;(r.x!==this.x||r.y!==this.y)&&this.snapStart()}}}const Vx={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class jx extends At{constructor(e,r={}){super(e),this.options=Object.assign({},Vx,r),this.ease=an(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=e.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=e.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(e.container.scale.x=this.xScale,e.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):r.forceStart&&this.createSnapping()}createSnapping(){const e=this.parent.worldScreenWidth,r=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,n=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:e,startY:r,deltaX:i-e,deltaY:n-r},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(e){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let r;if(!this.options.center&&!this.options.noMove&&(r=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=e,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const s=this.snapping,o=this.ease(s.time,s.startX,s.deltaX,this.options.time),a=this.ease(s.time,s.startY,s.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const n=this.parent.plugins.get("clamp-zoom",!0);n&&n.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(r))}}resume(){this.snapping=null,super.resume()}}const Zx={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class qx extends At{constructor(e,r={}){super(e),this.options=Object.assign({},Zx,r),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(e){window.addEventListener("keydown",r=>{e.includes(r.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",r=>{e.includes(r.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const e=this.smoothingCenter,r=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x+=r.x),this.isAxisY()&&(this.parent.scale.y+=r.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const n=this.parent.plugins.get("clamp-zoom",!0);if(n&&n.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const s=this.parent.toGlobal(i);this.parent.x+=e.x-s.x,this.parent.y+=e.y-s.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(e){if(this.paused)return;const r=this.parent.input.getPointerPosition(e),i=-e.deltaY*(e.deltaMode?this.options.lineHeight:1)/200,n=Math.pow(2,(1+this.options.percent)*i);let s;this.options.center||(s=this.parent.toLocal(r)),this.isAxisX()&&(this.parent.scale.x*=n),this.isAxisY()&&(this.parent.scale.y*=n),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(s);this.parent.x+=r.x-a.x,this.parent.y+=r.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:e.deltaX,dy:e.deltaY,dz:e.deltaZ},event:e,viewport:this.parent})}wheel(e){if(this.paused||!this.checkKeyPress())return!1;if(e.ctrlKey&&this.options.trackpadPinch)this.pinch(e);else if(this.options.wheelZoom){const r=this.parent.input.getPointerPosition(e),n=(this.options.reverse?-1:1)*-e.deltaY*(e.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*n);if(this.options.smooth){const o={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+o.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+o.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=r}else{let o;this.options.center||(o=this.parent.toLocal(r)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const a=this.parent.plugins.get("clamp-zoom",!0);if(a&&a.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const l=this.parent.toGlobal(o);this.parent.x+=r.x-l.x,this.parent.y+=r.y-l.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:e.deltaX,dy:e.deltaY,dz:e.deltaZ},event:e,viewport:this.parent})}return!this.parent.options.passiveWheel}}class Jx{constructor(e){this.viewport=e,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new G(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.on("pointerout",this.up,this),this.wheelFunction=e=>this.handleWheel(e),this.viewport.options.divWheel.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.divWheel.removeEventListener("wheel",this.wheelFunction)}down(e){if(this.viewport.pause||!this.viewport.worldVisible)return;if(e.data.pointerType==="mouse"?this.isMouseDown=!0:this.get(e.data.pointerId)||this.touches.push({id:e.data.pointerId,last:null}),this.count()===1){this.last=e.data.global.clone();const i=this.viewport.plugins.get("decelerate",!0),n=this.viewport.plugins.get("bounce",!0);(!i||!i.isActive())&&(!n||!n.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(e)&&this.viewport.options.stopPropagation&&e.stopPropagation()}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(e){return Math.abs(e)>=this.viewport.threshold}move(e){if(this.viewport.pause||!this.viewport.worldVisible)return;const r=this.viewport.plugins.move(e);if(this.clickedAvailable&&this.last){const i=e.data.global.x-this.last.x,n=e.data.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(n))&&(this.clickedAvailable=!1)}r&&this.viewport.options.stopPropagation&&e.stopPropagation()}up(e){if(this.viewport.pause||!this.viewport.worldVisible)return;e.data.pointerType==="mouse"&&(this.isMouseDown=!1),e.data.pointerType!=="mouse"&&this.remove(e.data.pointerId);const r=this.viewport.plugins.up(e);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:e,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this}),this.clickedAvailable=!1),r&&this.viewport.options.stopPropagation&&e.stopPropagation()}getPointerPosition(e){const r=new X;if(this.viewport.options.interaction)this.viewport.options.interaction.mapPositionToPoint(r,e.clientX,e.clientY);else if(this.viewport.options.useDivWheelForInputManager&&this.viewport.options.divWheel){const i=this.viewport.options.divWheel.getBoundingClientRect();r.x=e.clientX-i.left,r.y=e.clientY-i.top}else r.x=e.clientX,r.y=e.clientY;return r}handleWheel(e){if(this.viewport.pause||!this.viewport.worldVisible||this.viewport.options.interaction&&this.viewport.options.interaction.interactionDOMElement!==e.target)return;const r=this.viewport.toLocal(this.getPointerPosition(e));this.viewport.left<=r.x&&r.x<=this.viewport.right&&this.viewport.top<=r.y&&r.y<=this.viewport.bottom&&this.viewport.plugins.wheel(e)&&!this.viewport.options.passiveWheel&&e.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(e){for(const r of this.touches)if(r.id===e)return r;return null}remove(e){for(let r=0;r<this.touches.length;r++)if(this.touches[r].id===e){this.touches.splice(r,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}function go(t){let e,r=t[0],i=1;for(;i<t.length;){const n=t[i],s=t[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&r==null)return;n==="access"||n==="optionalAccess"?(e=r,r=s(r)):(n==="call"||n==="optionalCall")&&(r=s((...o)=>r.call(e,...o)),e=void 0)}return r}const Hr=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class Qx{constructor(e){this.viewport=e,this.list=[],this.plugins={}}add(e,r,i=Hr.length){this.plugins[e]=r;const n=Hr.indexOf(e);n!==-1&&Hr.splice(n,1),Hr.splice(i,0,e),this.sort()}get(e,r){return r&&go([this,"access",i=>i.plugins,"access",i=>i[e],"optionalAccess",i=>i.paused])?null:this.plugins[e]}update(e){for(const r of this.list)r.update(e)}resize(){for(const e of this.list)e.resize()}reset(){for(const e of this.list)e.reset()}removeAll(){this.plugins={},this.sort()}remove(e){this.plugins[e]&&(delete this.plugins[e],this.viewport.emit(`${e}-remove`),this.sort())}pause(e){go([this,"access",r=>r.plugins,"access",r=>r[e],"optionalAccess",r=>r.pause,"call",r=>r()])}resume(e){go([this,"access",r=>r.plugins,"access",r=>r[e],"optionalAccess",r=>r.resume,"call",r=>r()])}sort(){this.list=[];for(const e of Hr)this.plugins[e]&&this.list.push(this.plugins[e])}down(e){let r=!1;for(const i of this.list)i.down(e)&&(r=!0);return r}move(e){let r=!1;for(const i of this.viewport.plugins.list)i.move(e)&&(r=!0);return r}up(e){let r=!1;for(const i of this.list)i.up(e)&&(r=!0);return r}wheel(e){let r=!1;for(const i of this.list)i.wheel(e)&&(r=!0);return r}}const Kx={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,interaction:null,disableOnContextMenu:!1,ticker:vt.shared};class Do extends mt{__init(){this._disableOnContextMenu=e=>e.preventDefault()}constructor(e={}){super(),Do.prototype.__init.call(this),this.options=Object.assign({},{divWheel:document.body},Kx,e),this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.divWheel=this.options.divWheel||document.body,this.options.disableOnContextMenu&&this.options.divWheel.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new Jx(this),this.plugins=new Qx(this)}destroy(e){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.divWheel.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(e)}update(e){this.pause||(this.plugins.update(e),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new G(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(e=window.innerWidth,r=window.innerHeight,i,n){this.screenWidth=e,this.screenHeight=r,typeof i<"u"&&(this._worldWidth=i),typeof n<"u"&&(this._worldHeight=n),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(e){this._worldWidth=e,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(e){this._worldHeight=e,this.plugins.resize()}getVisibleBounds(){return new G(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(e,r){return arguments.length===2?this.toLocal(new X(e,r)):this.toLocal(e)}toScreen(e,r){return arguments.length===2?this.toGlobal(new X(e,r)):this.toGlobal(e)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new X(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(e){this.moveCenter(e)}moveCenter(...e){let r,i;typeof e[0]=="number"?(r=e[0],i=e[1]):(r=e[0].x,i=e[0].y);const n=(this.worldScreenWidth/2-r)*this.scale.x,s=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==n||this.y!==s)&&(this.position.set(n,s),this.plugins.reset(),this.dirty=!0),this}get corner(){return new X(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(e){this.moveCorner(e)}moveCorner(...e){let r,i;return e.length===1?(r=-e[0].x*this.scale.x,i=-e[0].y*this.scale.y):(r=-e[0]*this.scale.x,i=-e[1]*this.scale.y),(r!==this.x||i!==this.y)&&(this.position.set(r,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(e){return this.screenWidth/e}findFitHeight(e){return this.screenHeight/e}findFit(e,r){const i=this.screenWidth/e,n=this.screenHeight/r;return Math.min(i,n)}findCover(e,r){const i=this.screenWidth/e,n=this.screenHeight/r;return Math.max(i,n)}fitWidth(e=this.worldWidth,r,i=!0,n){let s;r&&(s=this.center),this.scale.x=this.screenWidth/e,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!n&&o&&o.clamp(),r&&s&&this.moveCenter(s),this}fitHeight(e=this.worldHeight,r,i=!0,n){let s;r&&(s=this.center),this.scale.y=this.screenHeight/e,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!n&&o&&o.clamp(),r&&s&&this.moveCenter(s),this}fitWorld(e){let r;e&&(r=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),e&&r&&this.moveCenter(r),this}fit(e,r=this.worldWidth,i=this.worldHeight){let n;e&&(n=this.center),this.scale.x=this.screenWidth/r,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&n&&this.moveCenter(n),this}setZoom(e,r){let i;r&&(i=this.center),this.scale.set(e);const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),r&&i&&this.moveCenter(i),this}zoomPercent(e,r){return this.setZoom(this.scale.x+this.scale.x*e,r)}zoom(e,r){return this.fitWidth(e+this.worldScreenWidth,r),this}get scaled(){return this.scale.x}set scaled(e){this.setZoom(e,!0)}snapZoom(e){return this.plugins.add("snap-zoom",new jx(this,e)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new X(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(e){this.x=-e*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(e){this.x=-e*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(e){this.y=-e*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(e){this.y=-e*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(e){this._dirty=e}get forceHitArea(){return this._forceHitArea}set forceHitArea(e){e?(this._forceHitArea=e,this.hitArea=e):(this._forceHitArea=null,this.hitArea=new G(0,0,this.worldWidth,this.worldHeight))}drag(e){return this.plugins.add("drag",new Dx(this,e)),this}clamp(e){return this.plugins.add("clamp",new Mx(this,e)),this}decelerate(e){return this.plugins.add("decelerate",new Ux(this,e)),this}bounce(e){return this.plugins.add("bounce",new Ox(this,e)),this}pinch(e){return this.plugins.add("pinch",new Yr(this,e)),this}snap(e,r,i){return this.plugins.add("snap",new Yx(this,e,r,i)),this}follow(e,r){return this.plugins.add("follow",new Gx(this,e,r)),this}wheel(e){return this.plugins.add("wheel",new qx(this,e)),this}animate(e){return this.plugins.add("animate",new ue(this,e)),this}clampZoom(e){return this.plugins.add("clamp-zoom",new Rx(this,e)),this}mouseEdges(e){return this.plugins.add("mouse-edges",new zx(this,e)),this}get pause(){return!!this._pause}set pause(e){this._pause=e,this.lastViewport=null,this.moving=!1,this.zooming=!1,e&&this.input.pause()}ensureVisible(e,r,i,n,s){s&&(i>this.worldScreenWidth||n>this.worldScreenHeight)&&(this.fit(!0,i,n),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;e<this.left?(this.left=e,o=!0):e+i>this.right&&(this.right=e+i,o=!0),r<this.top?(this.top=r,o=!0):r+n>this.bottom&&(this.bottom=r+n,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}var tw=Object.defineProperty,ew=(t,e,r)=>e in t?tw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pt=(t,e,r)=>(ew(t,typeof e!="symbol"?e+"":e,r),r);const Q=100;var _o={},rw={get exports(){return _o},set exports(t){_o=t}};function xo(){}xo.prototype={on:function(t,e,r){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var i=this;function n(){i.off(t,n),e.apply(r,arguments)}return n._=e,this.on(t,n,r)},emit:function(t){var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),i=0,n=r.length;for(i;i<n;i++)r[i].fn.apply(r[i].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),i=r[t],n=[];if(i&&e)for(var s=0,o=i.length;s<o;s++)i[s].fn!==e&&i[s].fn._!==e&&n.push(i[s]);return n.length?r[t]=n:delete r[t],this}},rw.exports=xo;var Mu=_o.TinyEmitter=xo;class hn extends Mu{constructor({floorPlan:e,helperId:r}){super(),this.floorPlan=e,this.helperId=r}destroy(){delete this.floorPlan.helper[this.helperId],this.floorPlan=null}}class iw extends hn{constructor({floorPlan:e,parentEl:r,helperId:i}){super({floorPlan:e,helperId:i}),!(!r||!e)&&(this.data={cursor:["0","0"]},this.floorPlan.on("mousemove",this.update,this),this.mount(r),this.update())}update(){this.rootEl&&this.setData({cursor:[Tn(this.floorPlan.interaction.cursor[0],this.floorPlan.settings.units.system,this.floorPlan.settings.units.lengthDecimals),Tn(this.floorPlan.interaction.cursor[1],this.floorPlan.settings.units.system,this.floorPlan.settings.units.lengthDecimals)]})}setData(e={}){for(let r in e)this.data[r]=e[r];this.rootEl.innerHTML=this.template(this.data)}template(e={}){return`<span class="fpe-coordinates__unit">x:${e.cursor[0]}</span>
|
|
840
|
+
<span class="fpe-coordinates__unit">z:${e.cursor[1]}</span>`}mount(e){this.rootEl||(this.rootEl=document.createElement("div"),this.rootEl.classList.add("fpe-coordinates"),e.appendChild(this.rootEl))}destroy(){this.floorPlan.off("mousemove",this.update),this.rootEl.remove(),delete this.floorPlan,delete this.data}}class nw extends hn{constructor({floorPlan:e,parentEl:r,helperId:i}){super({floorPlan:e,helperId:i}),!(!r||!e)&&(this.data={width:10,height:.4,margin:.2,style:"lines",box:{},scaleStep:null,scaleDisplay:null,steps:[],leftHanded:!1,isImperial:e.settings.units.system==="imperial"},this.floorPlan.view.on("zoom",this.update,this),this.floorPlan.on("update-settings",this.update,this),this.mount(r),this.update())}update(){this.data.isImperial=this.floorPlan.settings.units.system==="imperial";const e=this.data.isImperial?3.28084:1;if(!this.floorPlan.view.viewbox||!this.floorPlan.view.viewbox.length)return;this.data.box=this.floorPlan.view.viewbox;const r=Math.min(this.floorPlan.view.client[0],this.floorPlan.view.client[1]),i=Math.min(this.data.box.length,this.data.box.width),n=r/i;if(!n)return;const s=200/n;i<=.5/e?this.data.scaleStep=.01/e:i<=1/e?this.data.scaleStep=.05/e:i<=2.5/e?this.data.scaleStep=.1/e:i<=5.4/e?this.data.scaleStep=.2/e:i<=12/e?this.data.scaleStep=.5/e:i<=25/e?this.data.scaleStep=1/e:i<=50/e?this.data.scaleStep=2/e:i<=100/e?this.data.scaleStep=5/e:i<=200/e?this.data.scaleStep=10/e:i<=550/e?this.data.scaleStep=20/e:this.data.scaleStep=50/e,this.data.scaleDisplay=this.data.scaleStep*e;const o=this.data.width,a=o*this.data.scaleStep/s,l=this.leftHanded?0:o;let h=0,u=[];if(this.data.leftHanded)for(;h<o-a;){let f=a<o-h?a:o-h;u.push([h+l,f]),h+=a}else for(;h>-o+a;){let f=a;u.push([h+l,-f]),h-=a}this.data.steps=u,this.setData()}setData(e={}){for(let r in e)this.data[r]=e[r];this.rootEl.setAttribute("viewBox",`-${this.data.margin} -${this.data.margin*3} ${this.data.width+this.data.margin*2} ${this.data.height+this.data.margin*2}`),this.rootEl.innerHTML=this.template(this.data)}template(e={}){let r="";return e.steps[0]&&(r+=`<rect
|
|
841
|
+
class="fpe-scale-bar__background"
|
|
842
|
+
style="fill:${this.backgroundClr()}"
|
|
843
|
+
y="${-e.height*2.5}"
|
|
844
|
+
x="${e.width+e.steps[0][1]-e.margin}"
|
|
845
|
+
width="${-e.steps[0][1]+e.margin*2}"
|
|
846
|
+
height="${e.height*4}"
|
|
847
|
+
/>`),r+=`<text x="${e.leftHanded?0:e.width}" text-anchor="${e.leftHanded?"start":"end"}" y="-0.3">
|
|
848
|
+
${e.scaleDisplay} ${e.isImperial?"ft":"m"}
|
|
849
|
+
</text>`,e.style==="lines"&&(r+=`<path d="${this.stepStr(e.steps)}" />`),e.style==="solid"&&(r+="<g>",e.steps.forEach((i,n)=>{r+=`<rect
|
|
850
|
+
class="${n%2!==0?"white":""}"
|
|
851
|
+
x="${i[0]}"
|
|
852
|
+
y="0"
|
|
853
|
+
width="${i[1]}"
|
|
854
|
+
height="0.5"
|
|
855
|
+
/>`}),r+="</g>"),r}backgroundClr(){function e(n,s=1){if(If(n)){const{r:o,g:a,b:l}=Tf(n);return`rgba(${o},${a},${l},${s})`}}const r="rgba(255, 255, 255, 0.8)";let i=this.floorPlan.settings&&e(this.floorPlan.settings.theme.background.color);return i||(i=r),i+"!important"}stepStr(e){if(!e)return"";let r="",i=this.data.height;return e.forEach((n,s)=>{if(s>=1&&!this.data.leftHanded)return;n=n.map(l=>Math.round(l*1e3)/1e3);let o=s%2===0?0:i,a=s%2===0?i:0;s===0&&(r+=`M ${n[0]} ${i} L ${n[0]} 0`),r+=`L ${n[0]+n[1]} ${o} `,r+=`L ${n[0]+n[1]} ${a} `}),r}mount(e){this.rootEl||(this.rootEl=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.rootEl.classList.add("fpe-scale-bar"),e.appendChild(this.rootEl))}destroy(){this.floorPlan.view.off("viewbox",this.update),this.floorPlan.off("update-settings",this.update),this.rootEl.remove(),delete this.floorPlan.helper.scaleBar,delete this.floorPlan,delete this.data}}const sw=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
|
|
856
|
+
<g fill="none" stroke="#000" stroke-width="1.2" stroke-miterlimit="10">
|
|
857
|
+
<path d="M11.8 11.8l16.4 16.4M11.8 28.2l16.3-16.4" />
|
|
858
|
+
</g>
|
|
859
|
+
</svg>`,Fu={w:100,h:80,tip:15};class ow{constructor({width:e,height:r,pos:i=[0,0],html:n="",closeButton:s=!0,floorPlan:o}={}){this._floorPlan=o,this.pos=i,this.html=n,this.closeButton=s,this._anchorPos=null;let a=e||Fu.w;this.width=Math.max(100,a);let l=r||Fu.h;this.height=Math.max(50,l),this._getPosition=()=>{this._anchorPos=this._floorPlan.getScreenPosition(this.pos),this._updateInfoWindow()},this._getPosition(),this._createInfoWindow(),this._floorPlan.view.on("viewbox",this._getPosition,this),this._floorPlan.view.on("resize-canvas",this._getPosition,this)}_createInfoWindow(){const e=document.querySelector(`#${this._floorPlan.fpeId}.fpe`),r=e.querySelector("canvas");this.el||(this.el=document.createElement("div"),this.el.classList.add("fpe-info-window"),e.appendChild(this.el),this.el.addEventListener("wheel",i=>{let n=new WheelEvent(i.type,i);r.dispatchEvent(n)})),this._setContent(),this._updateInfoWindow()}_setContent(){let e=`<div class="fpe-info-window__content">${this.html}</div>`;this.closeButton&&(e+=`<div class="fpe-info-window__close" @click="infoWindow.remove">${sw}</div>`),this.el.innerHTML=e;const r=this.el.querySelector(".fpe-info-window__close");r&&r.addEventListener("click",this.remove.bind(this))}_updateInfoWindow(){if(!this.el)return;const e=this._floorPlan.interaction.isPanning?"pointer-events: none;":"",r=this._anchorPos[0]-47,i=this._anchorPos[1]-this.height-15,n=1e3+this.pos[1]*2,s=this.height,o=this.width;this.el.setAttribute("style",`transform: translate(${r}px, ${i}px);${e} height:${s}px; width:${o}px; z-index:${n}`)}set({width:e,height:r,pos:i,html:n,closeButton:s}){i!==void 0&&(this.pos=i),e!==void 0&&(this.width=Math.max(100,e)),r!==void 0&&(this.height=Math.max(50,r)),n!==void 0&&(this.html=n),s!==void 0&&(this.closeButton=s),(n!==void 0||s!==void 0)&&this._setContent(),this._getPosition()}remove(){this._floorPlan.view.off("viewbox",this._getPosition),this._floorPlan.view.off("resize-canvas",this._getPosition),this.el.remove(),this._floorPlan=null}}const aw=([t,e],r,i=0)=>r.x-i<t&&r.x+r.length+i>t&&r.z-i<e&&r.z+r.width+i>e;class lw{constructor({pos:e=[0,0],offset:r=[0,0],el:i,floorPlan:n}){if(this._updateHtmlMarker=()=>{this.el&&(this.isHidden=!aw(this.pos,this._floorPlan.view.viewbox,5),this.el.classList.toggle("fpe-marker--hidden",this.isHidden),this.isHidden||(this._anchorPos=this._floorPlan.getScreenPosition(this.pos),this._updateHtmlMarkerStyle()))},!n)return;if(!(i instanceof HTMLElement)){console.warn("no Element provided");return}this.el=i;const s=document.querySelector(`#${n.fpeId}.fpe`),o=s.querySelector("canvas");s.appendChild(this.el),this.el.classList.add("fpe-marker");const{width:a,height:l}=i.getBoundingClientRect();this.el.addEventListener("wheel",h=>{let u=new WheelEvent(h.type,h);o.dispatchEvent(u)}),this.id=Ne(),this._floorPlan=n,this.pos=e,this.size=[a,l],this.offset=r,this._updateHtmlMarker(),this._floorPlan.view.on("viewbox",this._updateHtmlMarker),this._floorPlan.on("drag-end",this._updateHtmlMarker),this._floorPlan.view.on("resize-canvas",this._updateHtmlMarker)}_updateHtmlMarkerStyle(){const e=this._floorPlan.interaction.isPanning,r=this.offset?this.offset:[0,0],i=this._anchorPos[0]-this.size[0]/2+r[0],n=this._anchorPos[1]-this.size[1]/2+r[1];this.el.style.pointerEvents=e?"none":"",this.el.style.transform=`translate(${i}px, ${n}px)`}set({pos:e,offset:r}){e!==void 0&&(this.pos=e),r!==void 0&&(this.offset=r),this._updateHtmlMarker()}remove(){this._floorPlan.view.off("viewbox",this._updateHtmlMarker),this._floorPlan.view.off("resize-canvas",this._updateHtmlMarker),this._floorPlan.off("drag-end",this._updateHtmlMarker),this.el.remove(),this._floorPlan=null}}ry({ShaderSystem:Zl}),Gt.add(th),Gt.add(ay),Gt.add(py),Gt.add(dy),Gt.add(Ey),Gt.add(Sy);const Ru={ColorMatrixFilter:Gs};Uy(Bi);class hw{constructor({pos:e,color:r,size:i,floorPlan:n}){this.pos=e,this.color=r,this.size=i,this.floorPlan=n,this.id=Ne(),this.draw()}draw(){const e=this.size/4e3;this.layer=this.floorPlan.addLayer({id:"fpe-markers"});let r=[{type:"composite",segments:[{type:"arc",position:[0,-27.8],radius:12.4,startAngle:-25,endAngle:205},{type:"line",end:[0,0],start:[-11.2,-22.5]}],style:{fill:er(this.color),stroke:6710886,strokeWidth:.5/e}},{type:"circle",position:[0,-28],radius:5,style:{fill:1,fillOpacity:.2}}];this.graphic=this.layer.addGraphic({shapes:r,position:this.pos,id:"marker_"+this.id,scale:e,scaleOnZoom:!0})}remove(){this.off("click"),this.layer.deleteGraphic(this.graphic),delete this.floorPlan,this.layer.graphics.size===0&&this.layer.destroy()}on(e="click",r,i){this.graphic.gfx.interactive=!0,this.graphic.gfx.on(e,r,i)}off(e="click",r){this.graphic.gfx.off(e,r)}set(e){let r=["pos","color","size"];Object.keys(e).forEach(i=>{r.includes(i)&&(this[i]=e[i])}),this.draw()}}function le(t){if(t!=null&&t.children)for(var e=t.children.length-1;e>=0;e--)t.children[e].destroy({children:!0}),t.removeChild(t.children[e])}function uw(t,e,r){const i=new zt(t);return i.x=0,i.y=0,i.anchor.x=.5,i.anchor.y=.5,i.rotation=0,e&&(i.width=e),r&&(i.height=r),i}function fw(t,e,r,i){var n;if(e.getChildByName(t.id)?.destroy(!0),i.hideElements.includes("roomStamp"))return;const{text:o,textOutline:a=!0}=((n=i.theme.elements)==null?void 0:n.roomStamp)||{},l=i.theme.background.color,h=l!=="transparent"?l:"#eee",u=o?di(vi(o.map(x=>x/255))):"#333333",f=new lr({fontFamily:i.theme.fontFamily||ae.theme.fontFamily,fontSize:16,align:"center",fill:u,stroke:h,strokeThickness:a?3:0});let c=t.boundaries.map(x=>[...x.geometryProfile].reverse()),d=c[0],v=c.slice(1),y=kh(d,v),m=bx(t,i).join(`
|
|
860
|
+
`);const g=new Mr(m,f);g.x=y[0]*Q,g.y=y[1]*Q,g.anchor.x=.5,g.anchor.y=.5,ku(g,r,t),g.name=t.id,e.addChild(g)}function ku(t,e,r){let i=Math.min(1/e,2);t.scale.x=i,t.scale.y=i,t.visible=r.getArea()>i*1.5}function cw(t="linear"){return Ix[t]}function pw({sceneBoundingBox:t,rectLeft:e,rectTop:r,rectRight:i,rectBottom:n,viewportWidth:s,viewportHeight:o}){if([e,r,i,n].some(a=>a>0)&&s&&o){const a=i-e,l=n-r,h=Px(t,a,l);let{x:u,z:f,length:c,width:d}=h;const v=s/a,y=o/l;return c*=v,d*=y,u-=e/s*c,f-=r/o*d,{x:u,z:f,x2:u+c,z2:f+d,length:c,width:d}}return t}function dw({margin:t=0,animate:e,floorPlan:r,boundingBox:i}){if(!r.view.sceneContainer)return Promise.resolve(!1);if(i)return un({bb:i,animate:e,view:r.view});let{x:n,z:s,length:o,width:a}=r.getSceneBoundingBox();n-=t,s-=t,o+=t*2,a+=t*2;const l={x:n,z:s,x2:n+o,z2:s+a,length:o,width:a};return un({bb:l,animate:e,view:r.view})}function un({bb:t,animate:e=!1,view:r}){const i=r._viewport;if(!i)throw new Error("no viewport");return r.viewportPaused&&r.startAnimationLoop(),new Promise(n=>{Number.isFinite(t.x)||n(!1),Object.keys(t).forEach(a=>{t[a]=t[a]*Q});let s=0;typeof e=="number"&&Number.isFinite(e)?s=e:e===!0&&(s=500);let o={x:t.x+t.length/2,y:t.z+t.width/2,width:t.length,height:t.width};if(!s)i.fit(!1,o.width,o.height).moveCenter(o.x,o.y),fn.bind(r)({type:"animation"}),r.viewportNeedsUpdate=!0,n(!0);else{let a={x:i.center.x,y:i.center.y,width:i.worldScreenWidth,height:i.worldScreenHeight},l={x:a.x-o.x,y:a.y-o.y,width:a.width-o.width,height:a.height-o.height};r._zoomTarget={delta:l,start:a,target:o,time:0,duration:s,destroy:()=>{r.ticker.remove("animateView"),delete r._zoomTarget,n(!0)},ease:cw("easeInOutQuad"),updateViewport:fn.bind(r)},r.ticker.add("animateView",vw,r)}})}function vw(t){let e=this._zoomTarget,r=!1;e.time+=t;let i=e.ease(e.time,0,1,e.duration),n={x:e.start.x-e.delta.x*i,y:e.start.y-e.delta.y*i,width:e.start.width-e.delta.width*i,height:e.start.height-e.delta.height*i};e.time>e.duration&&(n=e.target,r=!0),this._viewport.fit(!1,n.width,n.height).moveCenter(n.x,n.y),this.viewportNeedsUpdate=!0,e.updateViewport({type:"animation"});const s=this._viewport.input.count()!==0;(r||s)&&e.destroy()}function fn(t){this.viewportNeedsUpdate=!0,this.viewportPaused&&this.startAnimationLoop();const e=this._viewport;t.type!=="animation"&&this._zoomTarget&&this._zoomTarget.destroy();const r=Q,i=e.scale._x,n=e.left,s=e.top,o=e.worldScreenWidth,a=e.worldScreenHeight;this.viewbox={x:n/r,z:s/r,x2:(n+o)/r,z2:(s+a)/r,length:o/r,width:a/r},this.client=[e.screenWidth,e.screenHeight];const l=this.zoom!==i;this.zoom=i;const h={sourceEvent:{type:t.type},viewbox:this.viewbox,zoom:this.zoom};l?this.emit("zoom",h):this.emit("pan",h),this.emit("viewbox",h)}function mw({pos:t,nodeId:e}){Uu(this.interaction,{cursor:t,cursorTarget:e&&this.layout.elementsById[e]||this.layout.spacesById[e]})}function Uu(t,e){for(const r in e)t[r]=e[r],r==="cursorAction"&&yw(e[r])}function yw(t){let e="";switch(t){case"split-wall":e="var(--fpe-split-cursor) 16 16, pointer";break;case"duplicate":e="var(--fpe-duplicate-cursor) 16 16, pointer";break;case"move":e="move";break;default:e="default";break}document.body.style.cursor=e}function gw(t){var e,r,i,n;if(((r=(e=t?.data)==null?void 0:e.originalEvent)==null?void 0:r.button)===2)return;if(!this)throw new Error("Viewport context is missing");const s=400,o=10,a=5;let l=this.interaction._dragStart||{x:0,y:0},h=t.data.global||{x:0,y:0},u=Math.abs(h.x-l.x),f=Math.abs(h.y-l.y);if(!(u<a&&f<a))return;let c=new Date().getTime(),d;if(this.interaction.lastClick){let P=c-this.interaction.lastClick.time,w=this.interaction.lastClick.pos&&Math.max(Math.abs(h.x-this.interaction.lastClick.pos.x),Math.abs(h.y-this.interaction.lastClick.pos.y));d=P<s&&w<o}this.interaction.lastClick={time:c,pos:{...h}};const v=d?"dblclick":"click",y=(i=t.target)==null?void 0:i._nodeId,{x:m,y:g}=((n=t.data)==null?void 0:n.global)||{},x=this.getPlanPosition([m,g]);Uu(this.interaction,{cursor:[x[0],x[1]]});let _={sourceEvent:t,nodeId:y,pos:x,isDoubleClick:!!d};this.emit(v,_)}function _w(t){var e;const{x:r,y:i}=t.data.global;this.view.windowPos=[r,i],this.interaction.lastSceneClick=this.getPlanPosition(this.view.windowPos);const n=(e=t.target)==null?void 0:e._nodeId;this.emit("context-menu",{sourceEvent:t,nodeId:n})}const xw=t=>{const{view:e,interaction:r}=t,i=(o,a)=>{e.viewportInFocus&&(o.key==="Alt"&&a==="keyup"&&r.preventFocusoutOnAltKeyup&&o.preventDefault(),r.shiftKey=o.shiftKey,r.ctrlKey=o.ctrlKey,r.altKey=o.altKey,r.metaKey=o.metaKey,t.emit(a,{key:o.key,lowerCaseKey:o.key&&o.key.toLowerCase(),sourceEvent:o}))},n=o=>i(o,"keyup"),s=o=>i(o,"key");document.addEventListener("keydown",s),document.addEventListener("keyup",n)};function Bu(t){t.drag().pinch({percent:4}).wheel()}function ww(t){t.plugins.remove("wheel"),t.plugins.remove("pinch"),t.plugins.remove("drag")}function Pw(t){const{settings:e,view:r}=t;e.panZoom&&Bu(r._viewport),r._viewport.on("pointerdown",bw,t).on("pointerup",Du,t).on("pointerup",gw,t).on("rightup",_w,t).on("pointerupoutside",Du,t).on("pointermove",Tw,t).on("moved",fn,r).on("zoomed",fn,r),Iw(t),xw(t),t.on("mousemove",mw,t)}function bw(t){this.interaction._dragStart={x:t.data.global.x,y:t.data.global.y},this.emit("drag-start",{pos:this.interaction.cursor,sourceEvent:t})}function Du(){this.view.resume("drag"),this.emit("drag-end",{pos:this.interaction.cursor,sourceEvent:{}}),this.interaction.isDragging=!1,this.interaction.dragOffset=null}function Tw(t){var e;const{srcElement:r}=((e=t?.data)==null?void 0:e.originalEvent)||{};if(!r)return;const i=this.view._viewport.options.divWheel;if(r!==i)return;const n=t.data.getLocalPosition(this.view._viewport);let s=[n.x/Q,n.y/Q];const o=t.target&&t.target._nodeId;if(this.interaction.cursor=s,this.interaction.isDragging){const a=[n.x,n.y];this.emit("drag-move",{pos:this.interaction.cursor,screenPos:a,sourceEvent:t})}this.emit("mousemove",{sourceEvent:t,nodeId:o,pos:s})}const Iw=t=>{const e=document.querySelector(`#${t.fpeId} .fpe__plan`);e&&(e.addEventListener("mouseleave",()=>t.view.emit("focus",!1,t.view)),e.addEventListener("mouseenter",()=>t.view.emit("focus",!0,t.view)),document.addEventListener("visibilitychange",()=>t.view.emit("focus",document.visibilityState==="visible",t.view)),e.addEventListener("contextmenu",function(r){return r.preventDefault(),!1},!1))};function Xu(t,e,r=!1,i=16,n=8){let s=[];for(let y=0;y<e.length-1;y+=2)s.push({x:e[y],y:e[y+1]});let o,a,l,h=0,u=0,f=r?1:0;for(o=0;o<s.length-f;o++){a=s[o],o==s.length-1?l=s[0]:l=s[o+1];let y=l.x-a.x,m=l.y-a.y;var c=Math.sqrt(y*y+m*m),d={x:y/c,y:m/c},v=0;for(t.moveTo(a.x+u*d.x,a.y+u*d.y);v<=c;)v+=u,h>0?v+=h:v+=i,v>c?(h=v-c,v=c):h=0,t.lineTo(a.x+v*d.x,a.y+v*d.y),v+=n,v>c&&h==0?u=v-c:(u=0,t.moveTo(a.x+v*d.x,a.y+v*d.y))}}function $t(t){if(typeof t=="number")return t;if(typeof t=="string")return er(t);if(Array.isArray(t))return vi(t.map(e=>e/255))}function wo(t){return t.stroke?{alpha:t.strokeOpacity||1,color:$t(t.stroke),native:t.strokeWidth==="native",width:typeof t.strokeWidth=="number"?t.strokeWidth:1}:{}}function cr({shape:t,settings:e,gfx:r,style:i={}}){var n,s,o;if(!r||!r.lineStyle)return;let a={...i,...t.style||{}};const l=Q,h=!["line","polyline","arc"].includes(t.type)&&!!a.fill;if(h&&a.fill&&r.beginFill($t(a.fill),a.fillOpacity),r.lineStyle(wo(a)),t.type==="rectangle"){let{position:u,dimensions:f}=t;r.drawRect(u[0]*l,u[1]*l,f[0]*l,f[1]*l)}else if(t.type==="circle"||t.type==="composite"){let u=qh(t);Gu(u.points,[],a,l,r,h)}else if(t.type==="arc"||t.type==="quadraticBezier")qs(t).points.forEach((u,f)=>{f===0?r.moveTo(u[0]*l,u[1]*l):r.lineTo(u[0]*l,u[1]*l)});else if(t.type==="polygon"){let{points:u,holes:f}=t;Gu(u,f,a,l,r,h)}else if(t.type==="line"){let{start:u=[],end:f=[]}=t;r.moveTo(u[0]*l,u[1]*l),r.lineTo(f[0]*l,f[1]*l)}else if(t.type==="polyline"){let{points:u}=t;a.dash?Xu(r,u.flat().map(f=>f*l),!0):u.forEach((f,c)=>{c===0?r.moveTo(f[0]*l,f[1]*l):r.lineTo(f[0]*l,f[1]*l)})}else if(t.type==="group"){let{position:u=[0,0],rotation:f=0}=t,c=new wt;c.x=u[0]*l,c.y=u[1]*l,c.rotation=-Math.PI/180*f,t.children.forEach(d=>cr({shape:d,settings:e,gfx:c,style:i})),r.addChild(c)}else if(t.type==="text"){let u=(n=t.style)!=null&&n.fill?$t(t.style.fill):0,f=(s=t.style)!=null&&s.stroke?$t(t.style.stroke):16777215,{position:c=[0,0],rotation:d=0,text:v,alignH:y="center",alignV:m="center",fontSize:g=16}=t;const x=new lr({fontFamily:((o=e?.theme)==null?void 0:o.fontFamily)||ae.theme.fontFamily,fontSize:g,fill:u,align:y,stroke:f,strokeThickness:3});let _=new Mr(v,x);_.x=c[0]*l,_.y=c[1]*l,_.rotation=-Math.PI/180*d,_.anchor.x=.5,_.anchor.y=m==="center"?.5:m==="bottom"?1:0,r.addChild(_)}h&&r.endFill()}function Gu(t=[],e=[],r={},i=100,n,s){if(!t||!Array.isArray(t)||!t.length)return n;n.lineStyle(wo(r));let o=t.flat().map(a=>a*i);if(r.dash?(Xu(n,o),s&&(n.lineStyle(0),n.drawPolygon(o))):n.drawPolygon(o),e.length){s&&n.beginHole();for(const a of e){let l=a.flat().map(h=>h*i);n.drawPolygon(l)}s&&n.endHole()}return n}const Ie={fill:B.white,stroke:B.warsaw,strokeWidth:.5,selectFill:B.zurich_48,selectStroke:B.blue_ribbon,selectStrokeWidth:1,fillOpacity:1};function Cw({node:t,settings:e}){const r=e?.theme.showAssetTextures;return{wallContour:{stroke:B.new_york,strokeWidth:1.5},wall:{fill:B.stone,stroke:B.stone,selectFill:B.oslo},curtain:{fill:B.stone_08},column:{fill:B.stone,stroke:B.stone,selectFill:B.oslo},interior:{fill:r?null:B.stone_08,selectFill:r?null:B.zurich_48,selectStrokeWidth:2.5},stairs:{fill:B.whisper},door:{},window:{},railing:{},polyfloor:(()=>{if(t.type!=="polyfloor")return{};const i=t.usage!=="kitchen"&&jh(t.usage);let n={care:B.gray,circulate:B.whisper,fallback:B.white};const s=i&&n[i]||n.fallback;let o;return i==="void"&&(o=t._isSelected?.5:.05),{fill:s,stroke:13620702,fillOpacity:o}})(),"a:helper:spaceDivider":{fill:B.gray,stroke:B.gray,strokeOpacity:.8,strokeWidth:1,selectStrokeWidth:1},floorplan:{}}[t.type]}const Aw=({settings:t,node:e})=>{var r,i,n,s;let o=t.theme.elements,a=e.type,l;a==="column"&&(a="wall"),(a==="polyfloor"||a==="floor")&&(a="space"),a==="interior"&&(a="asset"),e.class&&(a==="door"&&e.class.includes("entryDoor")?l="entryDoor":a==="window"&&e.class.includes("balconyDoor")?l="balconyDoor":a==="window"&&e.class.includes("slidingDoor")?l="slidingDoor":a==="box"&&e.class.includes("preWall")&&(l="preWall"));let h=o[l]||o[a]||{};if(a==="space"){let v=hr[e.usage]||{},y=v.type==="program"?e.usage:v.program;h.usage&&h.usage[e.usage]?h=h.usage[e.usage]:h.program&&h.program[y]&&(h=h.program[y])}else a==="stairs"&&!o[a]&&((i=(r=o?.space)==null?void 0:r.usage)!=null&&i.staircase?h=o.space.usage.staircase:(s=(n=o?.space)==null?void 0:n.program)!=null&&s.circulate&&(h=o.space.program.circulate));let{fill:u,fillOpacity:f,stroke:c}=h,d={};return u&&(d.fill=$t(u),d.selectFill=$t(u)),c&&(d.stroke=$t(c)),f&&Number.isFinite(f)&&(d.fillOpacity=Math.max(Math.min(f,1),0)),d},Ew=({isSelected:t,settings:e,node:r})=>{var i,n,s,o,a,l,h,u,f;const c=Cw({node:r,settings:e}),d=Aw({node:r,settings:e});let v={};if((i=r._highlight)!=null&&i.fill&&Array.isArray((n=r._highlight)==null?void 0:n.fill)){let g=r._highlight.fill;Math.max(...g)<=1&&g.forEach(_=>_=Math.round(_*255));const x=$t(g);v={fill:x,selectFill:x},Number.isFinite((s=r._highlight)==null?void 0:s.fillOpacity)&&(v.fillOpacity=Math.max(Math.min((o=r._highlight)==null?void 0:o.fillOpacity,1),0))}if((a=r._highlight)!=null&&a.outline&&Array.isArray((l=r._highlight)==null?void 0:l.outline)){const g=r._highlight.outline,x=$t(g);v={...v,stroke:x,selectStroke:x},Number.isFinite((h=r._highlight)==null?void 0:h.outlineWidth)&&(v.strokeWidth=(u=r._highlight)==null?void 0:u.outlineWidth,v.selectStrokeWidth=(f=r._highlight)==null?void 0:f.outlineWidth)}const y={...c,...d,...v};let m={fill:y.fill!==void 0?y.fill:Ie.fill,fillOpacity:y.fillOpacity!==void 0?y.fillOpacity:Ie.fillOpacity,stroke:y.stroke??Ie.stroke,strokeWidth:y.strokeWidth??Ie.strokeWidth};return t&&(m={fill:y.selectFill!==void 0?y.selectFill:Ie.selectFill,fillOpacity:y.fillOpacity!==void 0?y.fillOpacity:Ie.fillOpacity,stroke:y.selectStroke??Ie.selectStroke,strokeWidth:y.selectStrokeWidth??Ie.selectStrokeWidth}),m.strokeWidth="native",m};function Sw(t,e){e.on("product-load-texture",({textureId:i,productData:n})=>{Mw(e,{textureId:i,productData:n}),Ow({view:t,resourceId:i,loader:e})}),e.on("product-contour",i=>Po(i,t,e));const r=new wt;r.lineStyle({native:!0,color:3355443}),r.drawCircle(0,0,1),t._dummyTexture=t._renderer.generateTexture(r)}function Nw(t){return new Promise((e,r)=>{var i=new Image;i.addEventListener("load",()=>{URL.revokeObjectURL(i.src),e(new lt(new Z(i)))}),i.addEventListener("error",()=>{URL.revokeObjectURL(i.src),r("image loading failed: "+t)});const n=t.includes("/storage/get/"),s=t.startsWith("https://")?t:nn+t;i.src=s,i.crossOrigin=n?"use-credentials":"anonymous"})}function Ow({resourceId:t,loader:e,view:r}){var i;if((i=e.textureQueue[t])!=null&&i.texture)return Promise.resolve();if(!e.textureQueue[t])return Promise.reject(`no texture data to load ${t}`);let{textureUrl:n,productId:s}=e.textureQueue[t];return el(),new Promise(o=>{Nw(n).then(a=>{e.textureQueue[t].imageData=a,e.textureQueue[t].loadStage=1,(!s||e.productQueue[s].loadStage===3)&&Po(t,r,e),o()}).catch(a=>{e.textureQueue[t].error=a,e.textureQueue[t].loadStage=1,(!s||e.productQueue[s].loadStage===3)&&Po(t,r,e),o()})})}function Hu(t,e){let r=new wt,i;for(const n of t)cr({shape:n,gfx:r,style:e});return i=r.generateCanvasTexture(xt.LINEAR,2),r.destroy(),i}function Lw(t,e){switch(e){case on.Default:{const r=new Ru.ColorMatrixFilter;r.matrix=[.7,0,0,0,.25,0,.7,0,0,.25,0,0,.7,0,.25,0,0,0,1,0],t.filters=[r];break}case on.Grayscale:{const r=new Ru.ColorMatrixFilter;r.blackAndWhite(!0),t.filters=[r];break}case on.None:}return t}function Po(t,e,r){const i=e?._renderer,n=r.textureQueue[t],s=n.error;if(el(),!n.texture){const o=n?.productId,a=r.resources.products[o],l=new mt;let h;s||(h=new zt(n.imageData),h=Lw(h,n.applyFilter),l.addChild(h));let u;const f=o&&r.resources.products[o]._shapes||[];if(f.length){let c;s?c={strokeWidth:.5,stroke:1,fill:16316664}:(c=Ew({settings:{theme:{showAssetTextures:!0,elements:{}}},node:{type:"interior"}}),c.stroke=B.stone),u=Hu(f,c);const d=new zt(u);if(d.anchor.x=n.anchor.x,d.anchor.y=n.anchor.y,!s){let v=h.width/a.boundingBox.length,y=n?.offset||{x:0,y:0};d.scale.x=h.width/d.width,d.scale.y=h.height/d.height,d.x=h.width/2-y.x*v,d.y=h.height/2-y.y*v}l.addChild(d)}n.texture=i.generateTexture(l,{scaleMode:xt.LINEAR,resolution:1.5}),n.loadStage=2,l.destroy(!0),u&&u.destroy(!0)}n.nodes.forEach(o=>{r.emit("product-load-stage",{node:o,args:{_loadStage:3,_textureId:t}})})}function Mw(t,{textureId:e,productData:r}){if(!r||!r.boundingPoints)return;let i={x:r.boundingPoints.min[0],y:r.boundingPoints.min[2]},n={x:Math.abs(r.boundingPoints.min[0]/r.boundingBox.length),y:Math.abs(r.boundingPoints.min[2]/r.boundingBox.width)},s={x:r.boundingPoints.max[0]-r.boundingBox.length/2,y:r.boundingPoints.max[2]-r.boundingBox.width/2};t.textureQueue[e].offset=s,t.textureQueue[e].anchor=n,t.textureQueue[e].position=i}var Fw=1e-6,kt=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function Rw(){var t=new kt(9);return kt!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function zu(){var t=new kt(16);return kt!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function kw(t,e,r){var i=e[0],n=e[1],s=e[2],o=e[3],a=i+i,l=n+n,h=s+s,u=i*a,f=i*l,c=i*h,d=n*l,v=n*h,y=s*h,m=o*a,g=o*l,x=o*h;return t[0]=1-(d+y),t[1]=f+x,t[2]=c-g,t[3]=0,t[4]=f-x,t[5]=1-(u+y),t[6]=v+m,t[7]=0,t[8]=c+g,t[9]=v-m,t[10]=1-(u+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function bo(){var t=new kt(3);return kt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Uw(t){var e=t[0],r=t[1],i=t[2];return Math.hypot(e,r,i)}function To(t,e,r){var i=new kt(3);return i[0]=t,i[1]=e,i[2]=r,i}function Bw(t,e){var r=e[0],i=e[1],n=e[2],s=r*r+i*i+n*n;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function Dw(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Io(t,e,r){var i=e[0],n=e[1],s=e[2],o=r[0],a=r[1],l=r[2];return t[0]=n*l-s*a,t[1]=s*o-i*l,t[2]=i*a-n*o,t}function Xw(t,e,r){var i=e[0],n=e[1],s=e[2],o=r[3]*i+r[7]*n+r[11]*s+r[15];return o=o||1,t[0]=(r[0]*i+r[4]*n+r[8]*s+r[12])/o,t[1]=(r[1]*i+r[5]*n+r[9]*s+r[13])/o,t[2]=(r[2]*i+r[6]*n+r[10]*s+r[14])/o,t}var Gw=Uw;(function(){var t=bo();return function(e,r,i,n,s,o){var a,l;for(r||(r=3),i||(i=0),n?l=Math.min(n*r+i,e.length):l=e.length,a=i;a<l;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],s(t,t,o),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2];return e}})();function Hw(){var t=new kt(4);return kt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function zw(t,e){var r=e[0],i=e[1],n=e[2],s=e[3],o=r*r+i*i+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=i*o,t[2]=n*o,t[3]=s*o,t}(function(){var t=Hw();return function(e,r,i,n,s,o){var a,l;for(r||(r=4),i||(i=0),n?l=Math.min(n*r+i,e.length):l=e.length,a=i;a<l;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],t[3]=e[a+3],s(t,t,o),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=t[3];return e}})();function Co(){var t=new kt(4);return kt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Wu(t,e,r){r=r*.5;var i=Math.sin(r);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(r),t}function Ao(t,e,r,i){var n=e[0],s=e[1],o=e[2],a=e[3],l=r[0],h=r[1],u=r[2],f=r[3],c,d,v,y,m;return d=n*l+s*h+o*u+a*f,d<0&&(d=-d,l=-l,h=-h,u=-u,f=-f),1-d>Fw?(c=Math.acos(d),v=Math.sin(c),y=Math.sin((1-i)*c)/v,m=Math.sin(i*c)/v):(y=1-i,m=i),t[0]=y*n+m*l,t[1]=y*s+m*h,t[2]=y*o+m*u,t[3]=y*a+m*f,t}function Ww(t,e){var r=e[0]+e[4]+e[8],i;if(r>0)i=Math.sqrt(r+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var n=0;e[4]>e[0]&&(n=1),e[8]>e[n*3+n]&&(n=2);var s=(n+1)%3,o=(n+2)%3;i=Math.sqrt(e[n*3+n]-e[s*3+s]-e[o*3+o]+1),t[n]=.5*i,i=.5/i,t[3]=(e[s*3+o]-e[o*3+s])*i,t[s]=(e[s*3+n]+e[n*3+s])*i,t[o]=(e[o*3+n]+e[n*3+o])*i}return t}var $u=zw;(function(){var t=bo(),e=To(1,0,0),r=To(0,1,0);return function(i,n,s){var o=Dw(n,s);return o<-.999999?(Io(t,e,n),Gw(t)<1e-6&&Io(t,r,n),Bw(t,t),Wu(i,t,Math.PI),i):o>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Io(t,n,s),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+o,$u(i,i))}})(),function(){var t=Co(),e=Co();return function(r,i,n,s,o,a){return Ao(t,i,o,a),Ao(e,n,s,a),Ao(r,t,e,2*a*(1-a)),r}}(),function(){var t=Rw();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],$u(e,Ww(e,t))}}();class It{constructor(){pt(this,"polygons",[])}clone(){var e=new It;return e.polygons=this.polygons.map(function(r){return r.clone()}),e}toPolygons(){return this.polygons}union(e){var r=new It.Node(this.clone().polygons),i=new It.Node(e.clone().polygons);return r.clipTo(i),i.clipTo(r),i.invert(),i.clipTo(r),i.invert(),r.build(i.allPolygons()),It.fromPolygons(r.allPolygons())}subtract(e){var r=new It.Node(this.clone().polygons),i=new It.Node(e.clone().polygons);return r.invert(),r.clipTo(i),i.clipTo(r),i.invert(),i.clipTo(r),i.invert(),r.build(i.allPolygons()),r.invert(),It.fromPolygons(r.allPolygons())}intersect(e){var r=new It.Node(this.clone().polygons),i=new It.Node(e.clone().polygons);return r.invert(),i.clipTo(r),i.invert(),r.clipTo(i),i.clipTo(r),r.build(i.allPolygons()),r.invert(),It.fromPolygons(r.allPolygons())}inverse(){var e=this.clone();return e.polygons.map(function(r){r.flip()}),e}}(function(t){function e(u){var f=new t;return f.polygons=u,f}t.fromPolygons=e;function r(u){u=u||{};var f=new t.Vector(u.center||[0,0,0]),c=u.radius?u.radius.length?u.radius:[u.radius,u.radius,u.radius]:[1,1,1];return t.fromPolygons([[[0,4,6,2],[-1,0,0]],[[1,3,7,5],[1,0,0]],[[0,1,5,4],[0,-1,0]],[[2,6,7,3],[0,1,0]],[[0,2,3,1],[0,0,-1]],[[4,5,7,6],[0,0,1]]].map(function(d){return new t.Polygon(d[0].map(function(v){let y=v&1?c[0]:-c[0],m=v&2?c[1]:-c[1],g=v&4?c[2]:-c[2],x=new t.Vector(f.x+y,f.y+m,f.z+g);return new t.Vertex(x,new t.Vector(d[1]))}))}))}t.cube=r;function i(u){u=u||{};var f=new t.Vector(u.center||[0,0,0]),c=u.radius||1,d=u.slices||16,v=u.stacks||8,y=[],m;function g(P,w){P*=Math.PI*2,w*=Math.PI;var b=new t.Vector(Math.cos(P)*Math.sin(w),Math.cos(w),Math.sin(P)*Math.sin(w));m.push(new t.Vertex(f.plus(b.times(c)),b))}for(var x=0;x<d;x++)for(var _=0;_<v;_++)m=[],g(x/d,_/v),_>0&&g((x+1)/d,_/v),_<v-1&&g((x+1)/d,(_+1)/v),g(x/d,(_+1)/v),y.push(new t.Polygon(m));return t.fromPolygons(y)}t.sphere=i;function n(u){u=u||{};var f=new t.Vector(u.start||[0,-1,0]),c=new t.Vector(u.end||[0,1,0]),d=c.minus(f),v=u.radius||1,y=u.slices||16,m=d.unit(),g=Math.abs(m.y)>.5,x=new t.Vector(g,!g,0).cross(m).unit(),_=x.cross(m).unit(),P=new t.Vertex(f,m.negated()),w=new t.Vertex(c,m.unit()),b=[];function T(O,L,M){var U=L*Math.PI*2,S=x.times(Math.cos(U)).plus(_.times(Math.sin(U))),k=f.plus(d.times(O)).plus(S.times(v)),D=S.times(1-Math.abs(M)).plus(m.times(M));return new t.Vertex(k,D)}for(var E=0;E<y;E++){var I=E/y,C=(E+1)/y;b.push(new t.Polygon([P,T(0,I,-1),T(0,C,-1)])),b.push(new t.Polygon([T(0,C,0),T(0,I,0),T(1,I,0),T(1,C,0)])),b.push(new t.Polygon([w,T(1,C,1),T(1,I,1)]))}return t.fromPolygons(b)}t.cylinder=n;class s{constructor(f,c,d){pt(this,"x"),pt(this,"y"),pt(this,"z"),arguments.length==3?(this.x=f,this.y=c,this.z=d):"x"in f?(this.x=f.x,this.y=f.y,this.z=f.z):(this.x=f[0],this.y=f[1],this.z=f[2])}clone(){return new t.Vector(this.x,this.y,this.z)}negated(){return new t.Vector(-this.x,-this.y,-this.z)}plus(f){return new t.Vector(this.x+f.x,this.y+f.y,this.z+f.z)}minus(f){return new t.Vector(this.x-f.x,this.y-f.y,this.z-f.z)}times(f){return new t.Vector(this.x*f,this.y*f,this.z*f)}dividedBy(f){return new t.Vector(this.x/f,this.y/f,this.z/f)}dot(f){return this.x*f.x+this.y*f.y+this.z*f.z}lerp(f,c){return this.plus(f.minus(this).times(c))}length(){return Math.sqrt(this.dot(this))}unit(){return this.dividedBy(this.length())}cross(f){return new t.Vector(this.y*f.z-this.z*f.y,this.z*f.x-this.x*f.z,this.x*f.y-this.y*f.x)}}t.Vector=s;class o{constructor(f,c){pt(this,"pos"),pt(this,"normal"),this.pos=new t.Vector(f),this.normal=new t.Vector(c)}clone(){return new t.Vertex(this.pos.clone(),this.normal.clone())}flip(){this.normal=this.normal.negated()}interpolate(f,c){return new t.Vertex(this.pos.lerp(f.pos,c),this.normal.lerp(f.normal,c))}}t.Vertex=o;class a{constructor(f,c){pt(this,"normal"),pt(this,"w"),this.normal=f,this.w=c}clone(){return new t.Plane(this.normal.clone(),this.w)}flip(){this.normal=this.normal.negated(),this.w=-this.w}splitPolygon(f,c,d,v,y){for(var m=0,g=1,x=2,_=3,P=0,w=[],b=0;b<f.vertices.length;b++){var T=this.normal.dot(f.vertices[b].pos)-this.w,E=T<-t.Plane.EPSILON?x:T>t.Plane.EPSILON?g:m;P|=E,w.push(E)}switch(P){case m:(this.normal.dot(f.plane.normal)>0?c:d).push(f);break;case g:v.push(f);break;case x:y.push(f);break;case _:for(var I=[],C=[],b=0;b<f.vertices.length;b++){var O=(b+1)%f.vertices.length,L=w[b],M=w[O],U=f.vertices[b],S=f.vertices[O];if(L!=x&&I.push(U),L!=g&&C.push(L!=x?U.clone():U),(L|M)==_){var T=(this.w-this.normal.dot(U.pos))/this.normal.dot(S.pos.minus(U.pos)),k=U.interpolate(S,T);I.push(k),C.push(k.clone())}}I.length>=3&&v.push(new t.Polygon(I,f.shared)),C.length>=3&&y.push(new t.Polygon(C,f.shared));break}}}pt(a,"EPSILON",1e-5),pt(a,"fromPoints",function(u,f,c){var d=f.minus(u).cross(c.minus(u)).unit();return new t.Plane(d,d.dot(u))}),t.Plane=a;class l{constructor(f,c){pt(this,"vertices"),pt(this,"shared"),pt(this,"plane"),this.vertices=f,this.shared=c,this.plane=t.Plane.fromPoints(f[0].pos,f[1].pos,f[2].pos)}clone(){var f=this.vertices.map(function(c){return c.clone()});return new t.Polygon(f,this.shared)}flip(){this.vertices.reverse().map(function(f){f.flip()}),this.plane.flip()}}t.Polygon=l;class h{constructor(f){pt(this,"plane",null),pt(this,"front",null),pt(this,"back",null),pt(this,"polygons",[]),f&&this.build(f)}clone(){var f=new t.Node;return f.plane=this.plane&&this.plane.clone(),f.front=this.front&&this.front.clone(),f.back=this.back&&this.back.clone(),f.polygons=this.polygons.map(function(c){return c.clone()}),f}invert(){for(var f=0;f<this.polygons.length;f++)this.polygons[f].flip();this.plane.flip(),this.front&&this.front.invert(),this.back&&this.back.invert();var c=this.front;this.front=this.back,this.back=c}clipPolygons(f){if(!this.plane)return f.slice();for(var c=[],d=[],v=0;v<f.length;v++)this.plane.splitPolygon(f[v],c,d,c,d);return this.front&&(c=this.front.clipPolygons(c)),this.back?d=this.back.clipPolygons(d):d=[],c.concat(d)}clipTo(f){this.polygons=f.clipPolygons(this.polygons),this.front&&this.front.clipTo(f),this.back&&this.back.clipTo(f)}allPolygons(){var f=this.polygons.slice();return this.front&&(f=f.concat(this.front.allPolygons())),this.back&&(f=f.concat(this.back.allPolygons())),f}build(f){if(f.length){this.plane||(this.plane=f[0].plane.clone());for(var c=[],d=[],v=0;v<f.length;v++)this.plane.splitPolygon(f[v],this.polygons,this.polygons,c,d);c.length&&(this.front||(this.front=new t.Node),this.front.build(c)),d.length&&(this.back||(this.back=new t.Node),this.back.build(d))}}}t.Node=h})(It||(It={}));var Eo={},$w={get exports(){return Eo},set exports(t){Eo=t}};$w.exports=cn,Eo.default=cn;function cn(t,e,r){r=r||2;var i=e&&e.length,n=i?e[0]*r:t.length,s=Yu(t,0,n,r,!0),o=[];if(!s||s.next===s.prev)return o;var a,l,h,u,f,c,d;if(i&&(s=qw(t,e,s,r)),t.length>80*r){a=h=t[0],l=u=t[1];for(var v=r;v<n;v+=r)f=t[v],c=t[v+1],f<a&&(a=f),c<l&&(l=c),f>h&&(h=f),c>u&&(u=c);d=Math.max(h-a,u-l),d=d!==0?32767/d:0}return zr(s,o,r,a,l,d,0),o}function Yu(t,e,r,i,n){var s,o;if(n===Oo(t,e,r,i)>0)for(s=e;s<r;s+=i)o=Zu(s,t[s],t[s+1],o);else for(s=r-i;s>=e;s-=i)o=Zu(s,t[s],t[s+1],o);return o&&pn(o,o.next)&&($r(o),o=o.next),o}function Ye(t,e){if(!t)return t;e||(e=t);var r=t,i;do if(i=!1,!r.steiner&&(pn(r,r.next)||tt(r.prev,r,r.next)===0)){if($r(r),r=e=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function zr(t,e,r,i,n,s,o){if(t){!o&&s&&eP(t,i,n,s);for(var a=t,l,h;t.prev!==t.next;){if(l=t.prev,h=t.next,s?Vw(t,i,n,s):Yw(t)){e.push(l.i/r|0),e.push(t.i/r|0),e.push(h.i/r|0),$r(t),t=h.next,a=h.next;continue}if(t=h,t===a){o?o===1?(t=jw(Ye(t),e,r),zr(t,e,r,i,n,s,2)):o===2&&Zw(t,e,r,i,n,s):zr(Ye(t),e,r,i,n,s,1);break}}}}function Yw(t){var e=t.prev,r=t,i=t.next;if(tt(e,r,i)>=0)return!1;for(var n=e.x,s=r.x,o=i.x,a=e.y,l=r.y,h=i.y,u=n<s?n<o?n:o:s<o?s:o,f=a<l?a<h?a:h:l<h?l:h,c=n>s?n>o?n:o:s>o?s:o,d=a>l?a>h?a:h:l>h?l:h,v=i.next;v!==e;){if(v.x>=u&&v.x<=c&&v.y>=f&&v.y<=d&&pr(n,a,s,l,o,h,v.x,v.y)&&tt(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Vw(t,e,r,i){var n=t.prev,s=t,o=t.next;if(tt(n,s,o)>=0)return!1;for(var a=n.x,l=s.x,h=o.x,u=n.y,f=s.y,c=o.y,d=a<l?a<h?a:h:l<h?l:h,v=u<f?u<c?u:c:f<c?f:c,y=a>l?a>h?a:h:l>h?l:h,m=u>f?u>c?u:c:f>c?f:c,g=So(d,v,e,r,i),x=So(y,m,e,r,i),_=t.prevZ,P=t.nextZ;_&&_.z>=g&&P&&P.z<=x;){if(_.x>=d&&_.x<=y&&_.y>=v&&_.y<=m&&_!==n&&_!==o&&pr(a,u,l,f,h,c,_.x,_.y)&&tt(_.prev,_,_.next)>=0||(_=_.prevZ,P.x>=d&&P.x<=y&&P.y>=v&&P.y<=m&&P!==n&&P!==o&&pr(a,u,l,f,h,c,P.x,P.y)&&tt(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;_&&_.z>=g;){if(_.x>=d&&_.x<=y&&_.y>=v&&_.y<=m&&_!==n&&_!==o&&pr(a,u,l,f,h,c,_.x,_.y)&&tt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;P&&P.z<=x;){if(P.x>=d&&P.x<=y&&P.y>=v&&P.y<=m&&P!==n&&P!==o&&pr(a,u,l,f,h,c,P.x,P.y)&&tt(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function jw(t,e,r){var i=t;do{var n=i.prev,s=i.next.next;!pn(n,s)&&Vu(n,i,i.next,s)&&Wr(n,s)&&Wr(s,n)&&(e.push(n.i/r|0),e.push(i.i/r|0),e.push(s.i/r|0),$r(i),$r(i.next),i=t=s),i=i.next}while(i!==t);return Ye(i)}function Zw(t,e,r,i,n,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&nP(o,a)){var l=ju(o,a);o=Ye(o,o.next),l=Ye(l,l.next),zr(o,e,r,i,n,s,0),zr(l,e,r,i,n,s,0);return}a=a.next}o=o.next}while(o!==t)}function qw(t,e,r,i){var n=[],s,o,a,l,h;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:t.length,h=Yu(t,a,l,i,!1),h===h.next&&(h.steiner=!0),n.push(iP(h));for(n.sort(Jw),s=0;s<n.length;s++)r=Qw(n[s],r);return r}function Jw(t,e){return t.x-e.x}function Qw(t,e){var r=Kw(t,e);if(!r)return e;var i=ju(r,t);return Ye(i,i.next),Ye(r,r.next)}function Kw(t,e){var r=e,i=t.x,n=t.y,s=-1/0,o;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){var a=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s&&(s=a,o=r.x<r.next.x?r:r.next,a===i))return o}r=r.next}while(r!==e);if(!o)return null;var l=o,h=o.x,u=o.y,f=1/0,c;r=o;do i>=r.x&&r.x>=h&&i!==r.x&&pr(n<u?i:s,n,h,u,n<u?s:i,n,r.x,r.y)&&(c=Math.abs(n-r.y)/(i-r.x),Wr(r,t)&&(c<f||c===f&&(r.x>o.x||r.x===o.x&&tP(o,r)))&&(o=r,f=c)),r=r.next;while(r!==l);return o}function tP(t,e){return tt(t.prev,t,e.prev)<0&&tt(e.next,t,t.next)<0}function eP(t,e,r,i){var n=t;do n.z===0&&(n.z=So(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,rP(n)}function rP(t){var e,r,i,n,s,o,a,l,h=1;do{for(r=t,t=null,s=null,o=0;r;){for(o++,i=r,a=0,e=0;e<h&&(a++,i=i.nextZ,!!i);e++);for(l=h;a>0||l>0&&i;)a!==0&&(l===0||!i||r.z<=i.z)?(n=r,r=r.nextZ,a--):(n=i,i=i.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=i}s.nextZ=null,h*=2}while(o>1);return t}function So(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function iP(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function pr(t,e,r,i,n,s,o,a){return(n-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(i-a)>=(r-o)*(e-a)&&(r-o)*(s-a)>=(n-o)*(i-a)}function nP(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!sP(t,e)&&(Wr(t,e)&&Wr(e,t)&&oP(t,e)&&(tt(t.prev,t,e.prev)||tt(t,e.prev,e))||pn(t,e)&&tt(t.prev,t,t.next)>0&&tt(e.prev,e,e.next)>0)}function tt(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function pn(t,e){return t.x===e.x&&t.y===e.y}function Vu(t,e,r,i){var n=vn(tt(t,e,r)),s=vn(tt(t,e,i)),o=vn(tt(r,i,t)),a=vn(tt(r,i,e));return!!(n!==s&&o!==a||n===0&&dn(t,r,e)||s===0&&dn(t,i,e)||o===0&&dn(r,t,i)||a===0&&dn(r,e,i))}function dn(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function vn(t){return t>0?1:t<0?-1:0}function sP(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Vu(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Wr(t,e){return tt(t.prev,t,t.next)<0?tt(t,e,t.next)>=0&&tt(t,t.prev,e)>=0:tt(t,e,t.prev)<0||tt(t,t.next,e)<0}function oP(t,e){var r=t,i=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}function ju(t,e){var r=new No(t.i,t.x,t.y),i=new No(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function Zu(t,e,r,i){var n=new No(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function $r(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function No(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}cn.deviation=function(t,e,r,i){var n=e&&e.length,s=n?e[0]*r:t.length,o=Math.abs(Oo(t,0,s,r));if(n)for(var a=0,l=e.length;a<l;a++){var h=e[a]*r,u=a<l-1?e[a+1]*r:t.length;o-=Math.abs(Oo(t,h,u,r))}var f=0;for(a=0;a<i.length;a+=3){var c=i[a]*r,d=i[a+1]*r,v=i[a+2]*r;f+=Math.abs((t[c]-t[v])*(t[d+1]-t[c+1])-(t[c]-t[d])*(t[v+1]-t[c+1]))}return o===0&&f===0?0:Math.abs((f-o)/o)};function Oo(t,e,r,i){for(var n=0,s=e,o=r-i;s<r;s+=i)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}cn.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},i=0,n=0;n<t.length;n++){for(var s=0;s<t[n].length;s++)for(var o=0;o<e;o++)r.vertices.push(t[n][s][o]);n>0&&(i+=t[n-1].length,r.holes.push(i))}return r};function aP(t=0,e=[0,1,0]){let r=t*Math.PI/180,i=Co();return Wu(i,e,r),i}function lP(t,e,r){if(t[0]!==0||t[1]!==0||t[2]!==0||e!==0){let i=zu(),n=To(t[0],t[1],t[2]),s=aP(e,r);return kw(i,s,n),i}else return zu()}const hP=48,uP=12;function fP(t,e){let r=Math.ceil(hP/(Math.PI*2)*t*e);const i=Math.ceil(uP/(Math.PI*2)*t);return Math.max(i,r)}function qu(t,e){let r=e*Math.cos(t),i=-e*Math.sin(t);return[r,i]}function Ju(t,e,r,i=!0){let n=[],s=e-t,o=fP(Math.abs(s),r),a=s/o;for(let l=0;l<o;l++){let h=t+l*a,u=qu(h,r);n.push(u)}if(i){let l=qu(e,r);n.push(l)}return n}function cP(t){let e=[];switch(t.type){case"curve:line":e.push(t.start,t.end);break;case"curve:arc":let r=Math.PI*t.startAngle/180,i=Math.PI*t.endAngle/180;e=Ju(r,i,t.radius);break;case"curve:polyline":e=t.points;break}return e}function Qu(t){let e=[],r=[];switch(t.type){case"curve:circle":e=Ju(0,2*Math.PI,t.radius,!1),r.push({index:0,count:e.length});break;case"curve:polygon":e=t.points;for(let o=0;o<e.length;o++)r.push({index:o,count:1});break;case"curve:rectangle":let{dimensions:i}=t,n=i[0],s=i[1];e=[[0,0],[0,s],[n,s],[n,0]];for(let o=0;o<e.length;o++)r.push({index:o,count:1});break;case"curve:composite":for(let o of t.segments){let a=cP(o);r.push({index:e.length,count:a.length}),e.push(...a)}break}return{points:e,segmentRanges:r}}for(var pP=[],Lo=0;Lo<256;++Lo)pP.push((Lo+256).toString(16).substr(1));function dP(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function i(){if(this instanceof i){var n=[null];n.push.apply(n,arguments);var s=Function.bind.apply(e,n);return new s}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}const vP={},mP=Object.freeze(Object.defineProperty({__proto__:null,default:vP},Symbol.toStringTag,{value:"Module"})),yP=dP(mP);var st={},Ku=yP,Mo=st.ValidationError=function(t,e,r,i,n,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(a,l){return a+ef(l)},"instance")):i!==void 0&&(this.property=i),t&&(this.message=t),r){var o=r.$id||r.id;this.schema=o||r}e!==void 0&&(this.instance=e),this.name=n,this.argument=s,this.stack=this.toString()};Mo.prototype.toString=function(){return this.property+" "+this.message};var mn=st.ValidatorResult=function(t,e,r,i){this.instance=t,this.schema=e,this.options=r,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=r&&r.throwError,this.throwFirst=r&&r.throwFirst,this.throwAll=r&&r.throwAll,this.disableFormat=r&&r.disableFormat===!0};mn.prototype.addError=function(t){var e;if(typeof t=="string")e=new Mo(t,this.instance,this.schema,this.path);else{if(!t)throw new Error("Missing error detail");if(!t.message)throw new Error("Missing error message");if(!t.name)throw new Error("Missing validator type");e=new Mo(t.message,this.instance,this.schema,this.path,t.name,t.argument)}if(this.errors.push(e),this.throwFirst)throw new Ve(this);if(this.throwError)throw e;return e},mn.prototype.importErrors=function(t){typeof t=="string"||t&&t.validatorType?this.addError(t):t&&t.errors&&Array.prototype.push.apply(this.errors,t.errors)};function gP(t,e){return e+": "+t.toString()+`
|
|
861
|
+
`}mn.prototype.toString=function(t){return this.errors.map(gP).join("")},Object.defineProperty(mn.prototype,"valid",{get:function(){return!this.errors.length}}),st.ValidatorResultError=Ve;function Ve(t){Error.captureStackTrace&&Error.captureStackTrace(this,Ve),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Ve.prototype=new Error,Ve.prototype.constructor=Ve,Ve.prototype.name="Validation Error";var tf=st.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),Error.captureStackTrace(this,t)};tf.prototype=Object.create(Error.prototype,{constructor:{value:tf,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var Fo=st.SchemaContext=function(t,e,r,i,n){this.schema=t,this.options=e,Array.isArray(r)?(this.path=r,this.propertyPath=r.reduce(function(s,o){return s+ef(o)},"instance")):this.propertyPath=r,this.base=i,this.schemas=n};Fo.prototype.resolve=function(t){return Ku.resolve(this.base,t)},Fo.prototype.makeChild=function(t,e){var r=e===void 0?this.path:this.path.concat([e]),i=t.$id||t.id,n=Ku.resolve(this.base,i||""),s=new Fo(t,this.options,r,n,Object.create(this.schemas));return i&&!s.schemas[n]&&(s.schemas[n]=t),s};var Ut=st.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+-.]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/\s*(.+?):\s*([^;]+);?/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/};Ut.regexp=Ut.regex,Ut.pattern=Ut.regex,Ut.ipv4=Ut["ip-address"],st.isFormat=function(t,e,r){if(typeof t=="string"&&Ut[e]!==void 0){if(Ut[e]instanceof RegExp)return Ut[e].test(t);if(typeof Ut[e]=="function")return Ut[e](t)}else if(r&&r.customFormats&&typeof r.customFormats[e]=="function")return r.customFormats[e](t);return!0};var ef=st.makeSuffix=function(t){return t=t.toString(),!t.match(/[.\s\[\]]/)&&!t.match(/^[\d]/)?"."+t:t.match(/^\d+$/)?"["+t+"]":"["+JSON.stringify(t)+"]"};st.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(s,o){return t(e[o],r[o])});if(typeof e=="object"){if(!e||!r)return e===r;var i=Object.keys(e),n=Object.keys(r);return i.length!==n.length?!1:i.every(function(s){return t(e[s],r[s])})}return e===r};function _P(t,e,r,i){typeof r=="object"?e[i]=Ro(t[i],r):t.indexOf(r)===-1&&e.push(r)}function xP(t,e,r){e[r]=t[r]}function wP(t,e,r,i){typeof e[i]!="object"||!e[i]?r[i]=e[i]:t[i]?r[i]=Ro(t[i],e[i]):r[i]=e[i]}function Ro(t,e){var r=Array.isArray(e),i=r&&[]||{};return r?(t=t||[],i=i.concat(t),e.forEach(_P.bind(null,t,i))):(t&&typeof t=="object"&&Object.keys(t).forEach(xP.bind(null,t,i)),Object.keys(e).forEach(wP.bind(null,t,e,i))),i}st.deepMerge=Ro,st.objectGetPath=function(t,e){for(var r=e.split("/").slice(1),i;typeof(i=r.shift())=="string";){var n=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(n in t))return;t=t[n]}return t};function PP(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}st.encodePath=function(t){return t.map(PP).join("")},st.getDecimalPlaces=function(t){var e=0;if(isNaN(t))return e;typeof t!="number"&&(t=Number(t));var r=t.toString().split("e");if(r.length===2){if(r[1][0]!=="-")return e;e=Number(r[1].slice(1))}var i=r[0].split(".");return i.length===2&&(e+=i[1].length),e},st.isSchema=function(t){return typeof t=="object"&&t||typeof t=="boolean"};var Et=st,$=Et.ValidatorResult,Ce=Et.SchemaError,Y={};Y.type=function(t,e,r,i){if(t===void 0)return null;var n=new $(t,e,r,i),s=Array.isArray(e.type)?e.type:[e.type];if(!s.some(this.testType.bind(this,t,e,r,i))){var o=s.map(function(a){if(a){var l=a.$id||a.id;return l?"<"+l+">":a+""}});n.addError({name:"type",argument:o,message:"is not of a type(s) "+o})}return n};function ko(t,e,r,i,n){var s=e.throwError,o=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,n,e,r);return e.throwError=s,e.throwAll=o,!a.valid&&i instanceof Function&&i(a),a.valid}Y.anyOf=function(t,e,r,i){if(t===void 0)return null;var n=new $(t,e,r,i),s=new $(t,e,r,i);if(!Array.isArray(e.anyOf))throw new Ce("anyOf must be an array");if(!e.anyOf.some(ko.bind(this,t,r,i,function(a){s.importErrors(a)}))){var o=e.anyOf.map(function(a,l){var h=a.$id||a.id;return h?"<"+h+">":a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+l+"]"});r.nestedErrors&&n.importErrors(s),n.addError({name:"anyOf",argument:o,message:"is not any of "+o.join(",")})}return n},Y.allOf=function(t,e,r,i){if(t===void 0)return null;if(!Array.isArray(e.allOf))throw new Ce("allOf must be an array");var n=new $(t,e,r,i),s=this;return e.allOf.forEach(function(o,a){var l=s.validateSchema(t,o,r,i);if(!l.valid){var h=o.$id||o.id,u=h||o.title&&JSON.stringify(o.title)||o.$ref&&"<"+o.$ref+">"||"[subschema "+a+"]";n.addError({name:"allOf",argument:{id:u,length:l.errors.length,valid:l},message:"does not match allOf schema "+u+" with "+l.errors.length+" error[s]:"}),n.importErrors(l)}}),n},Y.oneOf=function(t,e,r,i){if(t===void 0)return null;if(!Array.isArray(e.oneOf))throw new Ce("oneOf must be an array");var n=new $(t,e,r,i),s=new $(t,e,r,i),o=e.oneOf.filter(ko.bind(this,t,r,i,function(l){s.importErrors(l)})).length,a=e.oneOf.map(function(l,h){var u=l.$id||l.id;return u||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+h+"]"});return o!==1&&(r.nestedErrors&&n.importErrors(s),n.addError({name:"oneOf",argument:a,message:"is not exactly one from "+a.join(",")})),n},Y.if=function(t,e,r,i){if(t===void 0)return null;if(!Et.isSchema(e.if))throw new Error('Expected "if" keyword to be a schema');var n=ko.call(this,t,r,i,null,e.if),s=new $(t,e,r,i),o;if(n){if(e.then===void 0)return;if(!Et.isSchema(e.then))throw new Error('Expected "then" keyword to be a schema');o=this.validateSchema(t,e.then,r,i.makeChild(e.then)),s.importErrors(o)}else{if(e.else===void 0)return;if(!Et.isSchema(e.else))throw new Error('Expected "else" keyword to be a schema');o=this.validateSchema(t,e.else,r,i.makeChild(e.else)),s.importErrors(o)}return s};function Uo(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}Y.propertyNames=function(t,e,r,i){if(this.types.object(t)){var n=new $(t,e,r,i),s=e.propertyNames!==void 0?e.propertyNames:{};if(!Et.isSchema(s))throw new Ce('Expected "propertyNames" to be a schema (object or boolean)');for(var o in t)if(Uo(t,o)!==void 0){var a=this.validateSchema(o,s,r,i.makeChild(s));n.importErrors(a)}return n}},Y.properties=function(t,e,r,i){if(this.types.object(t)){var n=new $(t,e,r,i),s=e.properties||{};for(var o in s){var a=s[o];if(a!==void 0){if(a===null)throw new Ce('Unexpected null, expected schema in "properties"');typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,o,a,r,i);var l=Uo(t,o),h=this.validateSchema(l,a,r,i.makeChild(a,o));h.instance!==n.instance[o]&&(n.instance[o]=h.instance),n.importErrors(h)}}return n}};function rf(t,e,r,i,n,s){if(this.types.object(t)&&!(e.properties&&e.properties[n]!==void 0))if(e.additionalProperties===!1)s.addError({name:"additionalProperties",argument:n,message:"is not allowed to have the additional property "+JSON.stringify(n)});else{var o=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,n,o,r,i);var a=this.validateSchema(t[n],o,r,i.makeChild(o,n));a.instance!==s.instance[n]&&(s.instance[n]=a.instance),s.importErrors(a)}}Y.patternProperties=function(t,e,r,i){if(this.types.object(t)){var n=new $(t,e,r,i),s=e.patternProperties||{};for(var o in t){var a=!0;for(var l in s){var h=s[l];if(h!==void 0){if(h===null)throw new Ce('Unexpected null, expected schema in "patternProperties"');try{var u=new RegExp(l,"u")}catch{u=new RegExp(l)}if(u.test(o)){a=!1,typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,o,h,r,i);var f=this.validateSchema(t[o],h,r,i.makeChild(h,o));f.instance!==n.instance[o]&&(n.instance[o]=f.instance),n.importErrors(f)}}}a&&rf.call(this,t,e,r,i,o,n)}return n}},Y.additionalProperties=function(t,e,r,i){if(this.types.object(t)){if(e.patternProperties)return null;var n=new $(t,e,r,i);for(var s in t)rf.call(this,t,e,r,i,s,n);return n}},Y.minProperties=function(t,e,r,i){if(this.types.object(t)){var n=new $(t,e,r,i),s=Object.keys(t);return s.length>=e.minProperties||n.addError({name:"minProperties",argument:e.minProperties,message:"does not meet minimum property length of "+e.minProperties}),n}},Y.maxProperties=function(t,e,r,i){if(this.types.object(t)){var n=new $(t,e,r,i),s=Object.keys(t);return s.length<=e.maxProperties||n.addError({name:"maxProperties",argument:e.maxProperties,message:"does not meet maximum property length of "+e.maxProperties}),n}},Y.items=function(t,e,r,i){var n=this;if(this.types.array(t)&&e.items){var s=new $(t,e,r,i);return t.every(function(o,a){var l=Array.isArray(e.items)?e.items[a]||e.additionalItems:e.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var h=n.validateSchema(o,l,r,i.makeChild(l,a));return h.instance!==s.instance[a]&&(s.instance[a]=h.instance),s.importErrors(h),!0}),s}},Y.minimum=function(t,e,r,i){if(this.types.number(t)){var n=new $(t,e,r,i);return e.exclusiveMinimum&&e.exclusiveMinimum===!0?t>e.minimum||n.addError({name:"minimum",argument:e.minimum,message:"must be greater than "+e.minimum}):t>=e.minimum||n.addError({name:"minimum",argument:e.minimum,message:"must be greater than or equal to "+e.minimum}),n}},Y.maximum=function(t,e,r,i){if(this.types.number(t)){var n=new $(t,e,r,i);return e.exclusiveMaximum&&e.exclusiveMaximum===!0?t<e.maximum||n.addError({name:"maximum",argument:e.maximum,message:"must be less than "+e.maximum}):t<=e.maximum||n.addError({name:"maximum",argument:e.maximum,message:"must be less than or equal to "+e.maximum}),n}},Y.exclusiveMinimum=function(t,e,r,i){if(typeof e.exclusiveMaximum!="boolean"&&this.types.number(t)){var n=new $(t,e,r,i),s=t>e.exclusiveMinimum;return s||n.addError({name:"exclusiveMinimum",argument:e.exclusiveMinimum,message:"must be strictly greater than "+e.exclusiveMinimum}),n}},Y.exclusiveMaximum=function(t,e,r,i){if(typeof e.exclusiveMaximum!="boolean"&&this.types.number(t)){var n=new $(t,e,r,i),s=t<e.exclusiveMaximum;return s||n.addError({name:"exclusiveMaximum",argument:e.exclusiveMaximum,message:"must be strictly less than "+e.exclusiveMaximum}),n}};var nf=function(t,e,r,i,n,s){if(this.types.number(t)){var o=e[n];if(o==0)throw new Ce(n+" cannot be zero");var a=new $(t,e,r,i),l=Et.getDecimalPlaces(t),h=Et.getDecimalPlaces(o),u=Math.max(l,h),f=Math.pow(10,u);return Math.round(t*f)%Math.round(o*f)!==0&&a.addError({name:n,argument:o,message:s+JSON.stringify(o)}),a}};Y.multipleOf=function(t,e,r,i){return nf.call(this,t,e,r,i,"multipleOf","is not a multiple of (divisible by) ")},Y.divisibleBy=function(t,e,r,i){return nf.call(this,t,e,r,i,"divisibleBy","is not divisible by (multiple of) ")},Y.required=function(t,e,r,i){var n=new $(t,e,r,i);return t===void 0&&e.required===!0?n.addError({name:"required",message:"is required"}):this.types.object(t)&&Array.isArray(e.required)&&e.required.forEach(function(s){Uo(t,s)===void 0&&n.addError({name:"required",argument:s,message:"requires property "+JSON.stringify(s)})}),n},Y.pattern=function(t,e,r,i){if(this.types.string(t)){var n=new $(t,e,r,i),s=e.pattern;try{var o=new RegExp(s,"u")}catch{o=new RegExp(s)}return t.match(o)||n.addError({name:"pattern",argument:e.pattern,message:"does not match pattern "+JSON.stringify(e.pattern.toString())}),n}},Y.format=function(t,e,r,i){if(t!==void 0){var n=new $(t,e,r,i);return!n.disableFormat&&!Et.isFormat(t,e.format,this)&&n.addError({name:"format",argument:e.format,message:"does not conform to the "+JSON.stringify(e.format)+" format"}),n}},Y.minLength=function(t,e,r,i){if(this.types.string(t)){var n=new $(t,e,r,i),s=t.match(/[\uDC00-\uDFFF]/g),o=t.length-(s?s.length:0);return o>=e.minLength||n.addError({name:"minLength",argument:e.minLength,message:"does not meet minimum length of "+e.minLength}),n}},Y.maxLength=function(t,e,r,i){if(this.types.string(t)){var n=new $(t,e,r,i),s=t.match(/[\uDC00-\uDFFF]/g),o=t.length-(s?s.length:0);return o<=e.maxLength||n.addError({name:"maxLength",argument:e.maxLength,message:"does not meet maximum length of "+e.maxLength}),n}},Y.minItems=function(t,e,r,i){if(this.types.array(t)){var n=new $(t,e,r,i);return t.length>=e.minItems||n.addError({name:"minItems",argument:e.minItems,message:"does not meet minimum length of "+e.minItems}),n}},Y.maxItems=function(t,e,r,i){if(this.types.array(t)){var n=new $(t,e,r,i);return t.length<=e.maxItems||n.addError({name:"maxItems",argument:e.maxItems,message:"does not meet maximum length of "+e.maxItems}),n}};function bP(t,e,r){var i,n=r.length;for(i=e+1,n;i<n;i++)if(Et.deepCompareStrict(t,r[i]))return!1;return!0}Y.uniqueItems=function(t,e,r,i){if(e.uniqueItems===!0&&this.types.array(t)){var n=new $(t,e,r,i);return t.every(bP)||n.addError({name:"uniqueItems",message:"contains duplicate item"}),n}},Y.dependencies=function(t,e,r,i){if(this.types.object(t)){var n=new $(t,e,r,i);for(var s in e.dependencies)if(t[s]!==void 0){var o=e.dependencies[s],a=i.makeChild(o,s);if(typeof o=="string"&&(o=[o]),Array.isArray(o))o.forEach(function(h){t[h]===void 0&&n.addError({name:"dependencies",argument:a.propertyPath,message:"property "+h+" not found, required by "+a.propertyPath})});else{var l=this.validateSchema(t,o,r,a);n.instance!==l.instance&&(n.instance=l.instance),l&&l.errors.length&&(n.addError({name:"dependencies",argument:a.propertyPath,message:"does not meet dependency required by "+a.propertyPath}),n.importErrors(l))}}return n}},Y.enum=function(t,e,r,i){if(t===void 0)return null;if(!Array.isArray(e.enum))throw new Ce("enum expects an array",e);var n=new $(t,e,r,i);return e.enum.some(Et.deepCompareStrict.bind(null,t))||n.addError({name:"enum",argument:e.enum,message:"is not one of enum values: "+e.enum.map(String).join(",")}),n},Y.const=function(t,e,r,i){if(t===void 0)return null;var n=new $(t,e,r,i);return Et.deepCompareStrict(e.const,t)||n.addError({name:"const",argument:e.const,message:"does not exactly match expected constant: "+e.const}),n},Y.not=Y.disallow=function(t,e,r,i){var n=this;if(t===void 0)return null;var s=new $(t,e,r,i),o=e.not||e.disallow;return o?(Array.isArray(o)||(o=[o]),o.forEach(function(a){if(n.testType(t,e,r,i,a)){var l=a&&(a.$id||a.id),h=l||a;s.addError({name:"not",argument:h,message:"is of prohibited type "+h})}}),s):null};var yn=st;yn.ValidatorResult,yn.ValidatorResultError,yn.SchemaError,yn.SchemaContext;var he={};he.string=function(t){return typeof t=="string"},he.number=function(t){return typeof t=="number"&&isFinite(t)},he.integer=function(t){return typeof t=="number"&&t%1===0},he.boolean=function(t){return typeof t=="boolean"},he.array=function(t){return Array.isArray(t)},he.null=function(t){return t===null},he.date=function(t){return t instanceof Date},he.any=function(t){return!0},he.object=function(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof Date)},st.ValidatorResult,st.ValidatorResultError,st.ValidationError,st.SchemaError;function TP(t,e){let r=bo();for(let i of t)r[0]=i[0],r[1]=0,r[2]=i[1],Xw(r,r,e),i[0]=r[0],i[1]=r[2]}function IP(t,e){let r=e[t];if(r.type!=="geometry:extrusion")return[];let i=[],{points:n}=Qu(r.profile);i.push({type:"polygon",points:n});for(let s of r.geometries||[])if(typeof s!="string"&&s.type==="csg:subtract"){let o=e[s.geometry];if(o.type==="geometry:cuboid"){let{points:a}=Qu({type:"curve:rectangle",dimensions:[o.dimensions[0],o.dimensions[2]]}),l=lP(o.position,o.rotation,s.rotationAxis);TP(a,l),i.push({type:"polygon",points:a,style:{fill:16777215}})}}return i}const Bo={"layout:wall":{default:{fill:B.warsaw,stroke:B.stone},selected:{fill:B.oslo,stroke:B.blue_ribbon}},"layout:space":{default:{fill:B.white},selected:{fill:B.zurich_48}},fallback:{fill:B.white,stroke:B.warsaw}};function gn({element:t,ctx:e,parent:r,floorPlan:i,update:n=null}){var s,o,a;if(!t||"space"in t)return;const{view:l,settings:h,loader:u,sharedResources:f,resources:c}=i,d=((s=n?.args)==null?void 0:s.style)==="selected",v=Q,y=n&&n.container||new mt,m=l.gfxLayers.scene;"position"in t&&(y.x=t.position[0]*v,y.y=t.position[2]*v,y.rotation=-Math.PI/180*t.rotation||0);const{theme:g}=h,x=l.gfxNodes[t.id];let _=[];y.parentLayer=m,y.zOrder=5;let P,w;if("geometries"in t)for(let T of t.geometries){let E=IP(T,f.geometries);for(let I of E)I&&_.push(I)}if("boundaries"in t){let T=t.boundaries.map(C=>[...C.geometryProfile].reverse()),E=T[0],I=T.slice(1);_.push({type:"polygon",points:E,holes:I}),y.zOrder=0}if("product"in t){const T=t.product,E=c.products[T],I=c.productContours[T]||c.productBoundingBoxes[T];if(_=lx({type:"interior"},{},I)||[],n&&le(y),x?.loadStage===2)P=new wt;else if(!g.showAssetTextures&&x?.loadStage===3)P=new wt;else if(x?.loadStage>2&&g.showAssetTextures&&E!=null&&E.boundingPoints&&x!=null&&x.textureId){const C=u.textureQueue[x.textureId];if(C!=null&&C.texture){let O=E.boundingBox.length*v,L=E.boundingBox.width*v;P=uw(C.texture,O,L),P.anchor.x=C.anchor.x,P.anchor.y=C.anchor.y,P.zIndex=1}C&&d&&(C.contourTexture||(C.contourTexture=Hu(E._shapes||[],{stroke:B.blue_ribbon,strokeWidth:1})),w=new zt(C.contourTexture),w.anchor.x=C.anchor.x,w.anchor.y=C.anchor.y,w.zIndex=5,P.tint=er(B.zurich_48))}else P=new zt(l._dummyTexture)}else n&&le(y),P=new wt;let b=(d?(o=Bo[t.type])==null?void 0:o.selected:(a=Bo[t.type])==null?void 0:a.default)||Bo.fallback;b.fillOpacity=1,b.strokeWidth="native";for(const T of _)cr({shape:T,settings:h,gfx:w||P,style:b});if(P&&(P.interactive=!0,y.addChild(P),P._nodeId=t.id),w&&y.addChild(w),y.alpha=1,(!n||n.updateChildren||t.type==="layout:wall")&&t&&"elements"in t)for(const T of t.elements)gn({element:T,ctx:y,parent:t,floorPlan:i});l.gfxNodes[t.id]||(l.gfxNodes[t.id]={}),l.gfxNodes[t.id].nodeContainer=y,n||e.addChild(y)}function sf({floorPlan:t,update:e=!1}){const{layout:r,view:i,settings:n}=t,{_renderer:s,_viewport:o}=i;let a=n.theme.background.color;a.length===4&&(a=a[0]+a[1]+a[1]+a[2]+a[2]+a[3]+a[3]),s.backgroundColor=er(a);const l=i.sceneContainer;le(l);for(let h of r.spaces)gn({element:h,ctx:l,floorPlan:t});for(let h of r.elements)h.parent||gn({element:h,ctx:l,floorPlan:t});of(t,!0),i.emit("scene-rendered",{update:e}),i.viewportNeedsUpdate=!0,e&&(n.panZoom?Bu(o):ww(o)),i.viewportPaused&&i.startAnimationLoop()}function of(t,e=!1){const{view:r,layout:i,settings:n}=t,s=t.addLayer({id:"fpe-room-stamp",baseLayer:"annotation"});e?(le(s.container),i.spaces.forEach(o=>fw(o,s.container,r.zoom,n))):s.container.children.forEach(o=>{let a=i.spaces.find(l=>l.id===o.name);ku(o,r.zoom,a)})}class CP extends Do{}const _n=(t,e=!1)=>new Di(new St(t,e)),AP={top:0,left:0,center:.5,right:1,bottom:1};class EP{constructor(){this.methods={},this.add=(e,r,i)=>{this.methods[e]={fn:r,ctx:i}},this.remove=e=>{delete this.methods[e]}}}class SP extends Mu{constructor(e,r,i){var n;super(),this.windowPos=[0,0],this.zoom=1,this.client=[0,0],this.layers=new Map,this.viewbox={x:0,z:0,x2:0,z2:0,length:0,width:0},this.viewportNeedsUpdate=!1,this.viewportPaused=!1,this.viewportInFocus=!1,this.sceneContainer=new mt,this.gfxNodes={},this.ticker=new EP,this._oldTime=Date.now(),lp(),this.parentEl=document.getElementById(i);const s=this.parentEl.querySelector(".fpe__plan");let o=this.parentEl.clientWidth,a=this.parentEl.clientHeight;this._settings=r;const l=window.devicePixelRatio||1;let h=r.theme.background.color;const u=h==="transparent";this._renderer=N0({width:o,height:a,view:s,antialias:!0,backgroundAlpha:u?0:1,autoDensity:!0,resolution:l,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.parentEl.appendChild(this._renderer.view),h.length===4&&(h=h[0]+h[1]+h[1]+h[2]+h[2]+h[3]+h[3]),u||(this._renderer.backgroundColor=er(h)),this._stage=new Vr,this._stage.sortableChildren=!0,this._viewport=new CP({screenWidth:o,screenHeight:a,worldWidth:o,worldHeight:a,interaction:this._renderer.plugins.interaction,noTicker:!0,passiveWheel:!1,divWheel:document.querySelector(`#${i} .fpe__plan`)}),this._viewport.addChild(this.sceneContainer),(n=vt)!=null&&n.system&&vt.system.stop(),this.startAnimationLoop(),this.watchResize(),this._stage.addChild(this._viewport),this.on("focus",f=>{f&&this.viewportPaused?this.startAnimationLoop():f||this.stopAnimationLoop(),this.viewportInFocus=f}),this.gfxLayers=af(this._stage,this.parentEl.clientWidth),Sw(this,e)}draw(){var e;const r=Date.now();let i=r-this._oldTime;this._oldTime=r,i<0&&(i=0),i>1e3&&(i=1e3);let n=Object.keys(this.ticker.methods).length;(this.viewportNeedsUpdate||n)&&((e=this.ticker)!=null&&e.methods&&Object.values(this.ticker.methods).forEach(({fn:s,ctx:o})=>{typeof s=="function"&&(o?s.call(o,i):s(i))}),this._viewport.update(i),this._renderer.render(this._stage)),this.viewportPaused||requestAnimationFrame(()=>this.draw()),this.viewportNeedsUpdate=!1}startAnimationLoop(){this._oldTime=Date.now(),this.viewportNeedsUpdate=!0,this.viewportPaused=!1,requestAnimationFrame(()=>this.draw())}stopAnimationLoop(){this.viewportPaused=!0}updateView(){if(!this.parentEl.clientWidth||!this.parentEl.clientHeight)return;const e=this._viewport,r=this._renderer,i=Q,n=e.screenWidth,s=e.screenHeight,o=this.parentEl.clientWidth,a=this.parentEl.clientHeight;r.resize(o,a),e.resize(o,a);const l=n-o,h=s-a,u=this._settings.preserveViewbox,[f=.5,c=.5]=u.split("-").map(_=>AP[_]),d=f*l,v=c*h;e.position.set(e.x-d,e.y-v),e.plugins.get("clamp-zoom")||e.clampZoom({minHeight:this._settings.zoomRange[0]*i,maxHeight:this._settings.zoomRange[1]*i}),r.render(this._stage);let y=e.left,m=e.top,g=e.worldScreenWidth,x=e.worldScreenHeight;this.viewbox={x:y/i,z:m/i,x2:(y+g)/i,z2:(m+x)/i,length:g/i,width:x/i},this.client=[e.screenWidth,e.screenHeight]}async watchResize(){new ResizeObserver(()=>{this.updateView(),this.emit("resize-canvas",this.viewbox)}).observe(this.parentEl)}get gfxNodeCount(){return Object.keys(this.gfxNodes).length}reset(){this.gfxNodes={},this.gfxLayers=af(this._stage,this.parentEl.clientWidth)}pause(e="drag"){this._viewport.plugins.pause(e)}resume(e="drag"){this._viewport.plugins.resume(e)}}const af=(t,e)=>{const r=_n(0);t.addChild(r);const i=_n(1,!0);i.width=i.height=e,t.addChild(i);const n=_n(2);t.addChild(n);const s=_n(3);return t.addChild(s),{base:r,scene:i,annotation:n,helper:s}};function NP(t,e){lf({...t,floorPlan:e})}function lf({node:t,args:e,event:r,floorPlan:i}){i=i||this;const{view:n,resources:s,settings:o}=i;r==="set-materials"&&(e={materials:e});const{nodeContainer:a}=n.gfxNodes[t.id]||{};a&&(e._loadStage&&(n.gfxNodes[t.id].loadStage=e._loadStage),e._textureId&&(n.gfxNodes[t.id].textureId=e._textureId),le(a),gn({element:t,ctx:a.parent,floorPlan:i,update:{container:a,args:e,updateChildren:e._isSelected!==void 0}}),n.viewportNeedsUpdate=!0,n.viewportPaused&&n.startAnimationLoop())}class OP{constructor({shapes:e=[],position:r=[0,0],alpha:i=1,scale:n=1,clearLayer:s=!1,interactive:o=!1,id:a,isHandler:l=!1,scaleOnZoom:h=!1,baseLayer:u,container:f,floorPlan:c}){if(this.shapes=e,this.gfxScale=n,this.scaleOnZoom=h,this.container=f,this.floorPlan=c,!this.container)return;s&&le(this.container);let d=new wt;this.gfx=d,d.alpha=i;const v=Math.min(1/this.floorPlan.view.zoom)*this.gfxScale;r&&(d.x=r[0]*Q,d.y=r[1]*Q),o&&(d.interactive=!0),d._nodeId=a,l&&(d._isHandler=!0),d.parentLayer=u,v&&h&&(d.scale.x=d.scale.y=v),this.container.addChild(d),e.forEach(y=>cr({shape:y,settings:this.floorPlan.settings,gfx:d})),this.floorPlan.view.viewportNeedsUpdate=!0,this.floorPlan.view.viewportPaused&&this.floorPlan.view.startAnimationLoop()}set({position:e,style:r,shapes:i}={}){const n=Math.min(1/this.floorPlan.view.zoom)*this.gfxScale,s=this.gfx;if(e&&(s.x=e[0]*Q,s.y=e[1]*Q),i&&(this.shapes=i,s.clear(),le(s),i.forEach(o=>cr({shape:o,settings:this.floorPlan.settings,gfx:s}))),n&&this.scaleOnZoom&&(s.scale.x=s.scale.y=n),r){const o=wo(r);r.fill&&(s.geometry.graphicsData[0].fillStyle.color=$t(r.fill)),s.geometry.graphicsData[0].lineStyle.color=o.color,s.geometry.graphicsData[0].lineStyle.width=o.width,s.geometry.graphicsData[0].lineStyle.native=o.native,s.geometry.invalidate()}this.floorPlan.view.viewportNeedsUpdate=!0,this.floorPlan.view.viewportPaused&&this.floorPlan.view.startAnimationLoop()}on(e,r,i){return this.gfx.interactive=!0,e==="drag"?this.addDragEvent(r,i):this.gfx.on(e,r,i),this}off(e,r){return e==="drag"?this.removeDragEvent():this.gfx.off(e,r),this}destroy(){this.gfx.destroy(),this.floorPlan.view.viewportNeedsUpdate=!0,this.floorPlan.view.viewportPaused&&this.floorPlan.view.startAnimationLoop()}addDragEvent(e,r){function i(){this.floorPlan.interaction.isDragging=!0,this.floorPlan.view.pause("drag"),this.floorPlan.on("mousemove",e,r)}function n(){this.floorPlan.interaction.isDragging=!1,this.floorPlan.view.resume("drag"),this.floorPlan.off("mousemove",e)}this.on("pointerdown",i,this),this.on("pointerup",n,this),this.on("pointerupoutside",n,this),this.on("pointercancel",n,this)}removeDragEvent(){this.off("pointerdown"),this.off("pointerup"),this.off("pointerupoutside"),this.off("pointercancel")}}class hf{constructor(e,r,i){this.graphics=new Set;const n=e.view._viewport;this.container=new mt,this.id=i,this.baseLayer=e.view.gfxLayers[r]||e.view.gfxLayers.helper,this.container.parentLayer=this.baseLayer,this.floorPlan=e,n.addChild(this.container)}addGraphic(e){const r=new OP({...e,floorPlan:this.floorPlan,baseLayer:this.baseLayer,container:this.container});return this.graphics.add(r),r}deleteGraphic(e){this.graphics.delete(e),e.destroy()}draw(e){return this.addGraphic(e)}drawImage({url:e,width:r,height:i,mask:n,options:s}){if(s!=null&&s.pixelated?R.SCALE_MODE=xt.NEAREST:R.SCALE_MODE=xt.LINEAR,!this.container)return;le(this.container);let o=zt.from(e);if(o.width=r*Q,o.height=i*Q,o.parentLayer=this.baseLayer,n){let{x:a,z:l,length:h,width:u}=Nh([n]);o.x=(a+h/2)*Q,o.y=(l+u/2)*Q,o.anchor.set(.5);let f=new wt;cr({shape:{type:"polygon",points:n,style:{fill:16724736}},settings:this.floorPlan.settings,gfx:f}),this.container.addChild(f),o.mask=f}this.container.addChild(o),this.floorPlan.view.viewportNeedsUpdate=!0,this.floorPlan.view.viewportPaused&&this.floorPlan.view.startAnimationLoop(),setTimeout(()=>{this.floorPlan.view.viewportNeedsUpdate=!0},100)}clear(){le(this.container),this.floorPlan.view.viewportNeedsUpdate=!0,this.floorPlan.view.viewportPaused&&this.floorPlan.view.startAnimationLoop()}destroy(){this.container&&(this.floorPlan.view.layers.delete(this.id),this.container.destroy({children:!0,texture:!0,baseTexture:!0}),this.floorPlan.view.viewportNeedsUpdate=!0,this.floorPlan.view.viewportPaused&&this.floorPlan.view.startAnimationLoop(),delete this.container,delete this.floorPlan)}}function LP(t,{format:e="png",quality:r=.95}){return new Promise(i=>{let n;e==="jpg"?n=t.toDataURL("image/jpeg",r):n=t.toDataURL(),i(n)})}function MP(t,{format:e,fileName:r,quality:i}={}){if(e==="svg")return;const n=new Image;n.src=t,n.onload=function(){const s=document.createElement("canvas");s.width=n.naturalWidth,s.height=n.naturalHeight;const o=s.getContext("2d");o.imageSmoothingEnabled=!1,o.drawImage(n,0,0),FP(s,{format:e,fileName:r,quality:i})}}function FP(t,{format:e="png",fileName:r="floorplan",quality:i=.95}){const n=document.createElement("a");n.download=r+"."+e;let s=e==="png"?"image/png":"image/jpeg";t.toBlob(function(o){n.href=URL.createObjectURL(o),n.click()},s,i)}const xn=B.blue_ribbon,RP=B.zurich,kP=B.white,UP=xn,BP=xn,DP=RP,XP=xn,GP=xn,HP=kP;class zP extends hn{constructor({floorPlan:e,helperId:r,mode:i="distance"}){super({floorPlan:e,helperId:r}),this.drawing=!1,this.polygonsOrPolylines=[],this.floorPlan=e,this.mode=i,this.floorPlan.on("mousemove",this.handlePointerMove,this),this.floorPlan.on("click",this.handlePointerDown,this),this.floorPlan.on("dblclick",this.handlePointerDown,this),this.floorPlan.on("update-settings",this.draw,this),this.startDrawing()}get isInAreaMode(){return this.mode==="area"}get isDrawing(){return this.drawing}set({mode:e}){this.mode=e,this.draw()}handlePointerMove(e){this.setSnapCursor(e)}handlePointerDown(e){this.setSnapCursor(e),this.drawPoint(e)}setSnapCursor({pos:e}){this._snapCursor??(this._snapCursor=this.floorPlan.addHelper("snapCursor",{pos:e}));const{snapPoints:r,snapMargin:i}=this.floorPlan.computed;if(!r.length){this._snapCursor.set({pos:e}),this.draw();return}const n=Ou(e,r,i);this._snapCursor.isSnapping=!!n,this._snapCursor.set({pos:n||e}),this.draw()}stopDrawing(){this.polygonsOrPolylines[this.polygonsOrPolylines.length-1].points.length>1&&this.drawing&&this.polygonDone()}cancelDrawing(){this.destroy()}startDrawing(){this.drawing=!0,this.polygonsOrPolylines.push({points:[],isClosed:!1,length:0,area:0,areaDisplay:"",lengthDisplay:"",contour:null,label:null,pointGraphics:[]})}removeLastPoint(){var e,r;const i=this.polygonsOrPolylines[this.polygonsOrPolylines.length-1];if(i?.points.length>0){i.points.pop();const n=i.pointGraphics.pop();n&&this.layer.deleteGraphic(n),i.points.length<=1&&(i.contour&&((e=this.layer)==null||e.deleteGraphic(i.contour),i.contour=null),i.label&&((r=this.layer)==null||r.deleteGraphic(i.label),i.label=null)),i.points.length===0?(this.polygonsOrPolylines.pop(),this.drawing=!1):this.draw()}}polygonDone(){this.drawing=!1,this.emit("polygon-done",{}),this.draw()}drawPoint(e){var r;this.drawing||this.startDrawing();const i=this.polygonsOrPolylines.length-1,n=this.polygonsOrPolylines[i];if((r=e.nodeId)!=null&&r.startsWith(`point/${i}/`)||e.isDoubleClick){const u=e.nodeId===`point/${i}/0`;this.mode==="distance"&&u&&(n.isClosed=!0),this.polygonDone();return}const{pos:s}=this._snapCursor;n.points.push([...s]);const o=n.points.length-1,a=`point/${i}/${o}`;this.layer||(this.layer=this.floorPlan.addLayer());const l=this.layer.addGraphic({shapes:[{type:"circle",position:[0,0],radius:.15,style:{fill:XP,fillOpacity:.1}},{type:"circle",position:[0,0],radius:.05,style:{stroke:GP,fill:HP,strokeWidth:1.5}}],position:s,scaleOnZoom:!0,id:a,isHandler:!0});n.pointGraphics[o]=l;function h(){this.updatePolygon(i,o,this.floorPlan.interaction.cursor),l.set({position:n.points[o]})}l.on("drag",h,this)}updatePolygon(e,r,i){const n=i,{snapPoints:s,snapMargin:o}=this.floorPlan.computed,a=s.length&&Ou(n,s,o),l=this.polygonsOrPolylines[e];l.points[r]=a||n,this.draw()}getLengthText(e){const{units:r}=this.floorPlan.settings;return Tn(e,r.system,r.lengthDecimals)}getAreaText(e){const{units:r}=this.floorPlan.settings;return Wo(e,r.system,r.areaDecimals)}reset(){this.drawing=!1,this.polygonsOrPolylines=[],this.floorPlan.removeHelper("snapCursor"),this._snapCursor=null,this.layer&&(this.layer.destroy(),this.layer=null)}draw(){this.polygonsOrPolylines.length&&(this.layer||(this.layer=this.floorPlan.addLayer()),this.polygonsOrPolylines.forEach((e,r)=>{if(!e.points.length)return;const i=this.drawing&&this._snapCursor&&r===this.polygonsOrPolylines.length-1?[...e.points,this._snapCursor.pos]:e.points;if(i.length<2)return;e.length=fg(i,e.isClosed),e.lengthDisplay=this.getLengthText(e.length);const n=i.length<2?0:og({x:i[0][0],z:i[0][1]},{x:i[1][0],z:i[1][1]}),s=i.map(v=>v.map(y=>Number(y.toFixed(10)))).slice(0,this.isInAreaMode?void 0:2),o=this.isInAreaMode?kh(s):[s[0][0]+(s[1][0]-s[0][0])/2,s[0][1]+(s[1][1]-s[0][1])/2];e.area=Math.abs(Rh(i)),e.areaDisplay=this.getAreaText(e.area);const a=this.isInAreaMode||e.isClosed?"polygon":"polyline",l={stroke:DP,dash:!0,strokeWidth:"native"};let h=e.lengthDisplay,u=n;this.isInAreaMode&&(l.fill=BP,l.fillOpacity=.04,h=e.areaDisplay,u=0);const f=[{type:a,points:i,style:l}],c={shapes:[{type:"text",text:h,position:[0,0],rotation:u,alignV:"bottom",fontSize:15,style:{fill:UP}}],id:"text",position:o,scaleOnZoom:!0};e.contour?e.contour.set({shapes:f}):e.contour=this.layer.addGraphic({shapes:f}),e.label?e.label.set(c):e.label=this.layer.addGraphic(c);const d=this.isInAreaMode?{area:e.area}:{distance:e.length};this.emit("polygon-draw",d)}))}destroy(){this.reset(),this.floorPlan.off("mousemove",this.handlePointerMove),this.floorPlan.off("click",this.handlePointerDown),this.floorPlan.off("dblclick",this.handlePointerDown),this.floorPlan.off("update-settings",this.draw),super.destroy()}}class WP extends hn{constructor({floorPlan:e,helperId:r,pos:i}){super({floorPlan:e,helperId:r}),this.pos=[0,0],this.floorPlan.on("mousemove",this.draw,this),this.isSnapping=!1,this.isEdge=!1,i&&(this.pos=i)}draw(){if(this.layer||(this.layer=this.floorPlan.addLayer({id:"fpe-snap-cursor"})),!this.cursor)this.cursor=this.layer.addGraphic({shapes:[{type:"circle",position:[0,0],radius:.06,style:{stroke:B.blue_ribbon,strokeWidth:1.5}}],position:this.pos,scaleOnZoom:!0});else{const e=this.isSnapping?B.blue_ribbon:B.warsaw,r=this.isSnapping?2:1.5;this.cursor.set({position:this.pos,style:{stroke:e,strokeWidth:r}})}}set({pos:e,isSnapping:r,isEdge:i,node:n}){this.pos=e,this.isSnapping=r,this.isEdge=i,this.node=n,this.draw()}snapState(){return this.isSnapping?this.isEdge?"edge":"point":""}destroy(){this.floorPlan.off("mousemove",this.draw),this.layer&&this.layer.destroy(),this.layer=void 0,this.cursor=null,super.destroy()}}const $P={lastSceneClick:[0,0],cursor:[0,0],cursorTarget:null,isDragging:!1,altKey:!1,shiftKey:!1,metaKey:!1,ctrlKey:!1,dragOffset:null,cursorAction:"none",isPanning:!1,lastClick:{time:null,pos:{x:0,y:0}},_dragStart:{x:0,y:0},preventFocusoutOnAltKeyup:!1};class YP extends Nu{constructor({container:e,options:r={},scene:i}={}){super({options:r,scene:i}),this.interaction=$P,this.availableHelpers={cursorCoordinates:iw,scaleBar:nw},this.helper={};let n;e instanceof Element?n=e:n=document.body,this.mountFloorPlan(n),this.availableHelpers.polygonHelper=zP,this.availableHelpers.snapCursor=WP}prevent(e){e.preventDefault()}on(e,r,i){return this._emitter.on(e,r,i),this}once(e,r,i){return this._emitter.once(e,r,i),this}off(e,r){return this._emitter.off(e,r),this}emit(e,...r){return this._emitter.emit(e,...r),this}handleDrop(e){var r;e.preventDefault(),e.stopPropagation();const i=[e.offsetX,e.offsetY],n=this.getPlanPosition(i);this.interaction.cursor=[...n];const{spaces:s}=this.getResourcesFromPosition(n),o=((r=s[0])==null?void 0:r.node.y)||0;this.emit("drop",{pos:n,sourceEvent:e,verticalPos:o})}set(e){super.set(e),this.view&&sf({floorPlan:this,update:!0})}changeNodeStyle(e,r){let i=this.layout.elementsById[e]||this.layout.spacesById[e];i&&lf({node:i,args:{style:r},floorPlan:this})}mountFloorPlan(e){const r=e.querySelector(".fpe");r&&r.remove();const i=document.createElement("div");i.id=this.fpeId,i.classList.add("fpe"),e.appendChild(i);const n=document.createElement("canvas");n.classList.add("fpe__plan"),i.appendChild(n),this.fpeNode=i,nx(this.settings.api),this.view=new SP(this.loader,this.settings,this.fpeId),this.loader.on("product-load-stage",s=>NP(s,this)),this.loader.on("spaces-loaded",this.initDrawing,this),n.addEventListener("drop",this.handleDrop.bind(this)),n.addEventListener("gesturestart",this.prevent),n.addEventListener("gesturechange",this.prevent),n.addEventListener("gestureend",this.prevent),n.addEventListener("dragover",this.prevent),this.settings.destroyOnDomRemove&&wx(i,e,()=>this.destroy()),Pw(this),this.view.on("scene-rendered",({update:s})=>{s||this.zoomExtents(1,0)}),this.view.on("zoom",()=>{this.view.layers.forEach(s=>{s.graphics.forEach(o=>{o.scaleOnZoom&&!o.gfx.destroyed&&o.set()})}),of(this)}),this.generateUi()}initDrawing(){this.loader.initialLoading||this.view.reset(),sf({floorPlan:this}),this.loader.initialLoading&&this.initDrawingEvents()}initDrawingEvents(){}generateUi(){this.settings.ui.coordinates?this.addHelper("cursorCoordinates",{parentEl:this.fpeNode}):this.helper.cursorCoordinates&&this.removeHelper("cursorCoordinates"),this.settings.ui.scale?this.addHelper("scaleBar",{parentEl:this.fpeNode}):this.helper.scaleBar&&this.removeHelper("scaleBar")}getSceneBoundingBox(e=0){var r;if(!((r=this.view)!=null&&r._viewport))return;let i=this.view.sceneContainer;if(!i)return;let{x:n,y:s,width:o,height:a}=i.getLocalBounds(),l=n/Q-e,h=s/Q-e,u=o/Q+e*2,f=a/Q+e*2;return{x:l,x2:l+u,z:h,z2:h+f,length:u,width:f}}getZoomExtentsBoundingBox(e,r,i,n,s,o,a){return pw({sceneBoundingBox:e,rectLeft:r,rectTop:i,rectRight:n,rectBottom:s,viewportWidth:o,viewportHeight:a})}zoomExtents(e=1,r=!1,i=null){return dw({margin:e,animate:r,floorPlan:this,boundingBox:i})}zoomToElement(e,r=1,i){const n=this.getElementBoundingBox(e,r);return un({bb:n,animate:i,view:this.view})}setZoom(e,r=!0){return un({bb:e,animate:r,view:this.view})}zoomByFactor(e,r=!0){if(!Number.isFinite(e)||e<=0)return Promise.reject("factor is not a positive number");let{x:i,z:n,length:s,width:o}=this.view.viewbox;const a=s/e,l=o/e;i-=(a-s)/2,n-=(l-o)/2;const h=i+s,u=n+o;return this.setZoom({x:i,z:n,length:a,width:l,x2:h,z2:u},r)}addInfoWindow(e={}){return new ow({...e,floorPlan:this})}addHtmlMarker(e={}){return new lw({...e,floorPlan:this})}addMarker({pos:e=[0,0],color:r="#669cff",size:i=40}={}){return new hw({pos:e,color:r,size:i,floorPlan:this})}getPlanPosition(e){const r=this.view._viewport.toWorld(e[0],e[1]);return[r.x/Q,r.y/Q]}getScreenPosition(e){const r=e.map(n=>n*Q),i=this.view._viewport.toScreen(r[0],r[1]);return[i.x,i.y]}addLayer({id:e,baseLayer:r}={}){if(e||(e=Ne()),this.view.layers.has(e)){const n=this.view.layers.get(e);if(n!=null&&n.container)return n}const i=new hf(this,r,e);return this.view.layers.set(e,i),i}getLayer(e){return this.view.layers.get(e)}addPlanGraphic(){return new hf(this)}addHelper(e,r={}){let i=r?.helperId;return i||(typeof e=="string"?i=e:i=Ne()),this.helper[i]&&this.removeHelper(i),typeof e=="string"?this.availableHelpers[e]?this.helper[i]=new this.availableHelpers[e]({floorPlan:this,helperId:i,...r}):console.warn(`No helper registered for: ${e}`):this.helper[i]=new e({floorPlan:this,helperId:i,...r}),this.helper[i]}removeHelper(e){var r,i;(i=(r=this.helper[e])==null?void 0:r.destroy)==null||i.call(r),delete this.helper[e]}async exportImage({format:e="png",fileName:r,quality:i=90,output:n="base64",maxWidth:s,download:o=!1}={}){let a={format:e,quality:i,output:n,maxWidth:s};o&&(a.format="png");const l=document.querySelector("#"+this.fpeId+" canvas"),h=await LP(l,a).catch(u=>u);if(o)MP(h,{format:e,fileName:r,quality:i});else return h}destroy(){var e;(e=this.view._viewport)==null||e.destroy(),this.view.reset(),this.loader.reset(),delete this.layout,delete this.resources,delete this.utils,this.fpeNode&&this.fpeNode.remove(),delete this.fpeNode}}export{YP as FloorPlanEngine,Fh as polygonIntersection,Mh as polygonOffset,Oh as polygonUnion};
|