convex-pixel
Version:
The library for creating pseudo 3d interactive scenes based on webgl
52 lines (50 loc) • 531 kB
JavaScript
import t,{parse as e}from"url";import{__extends as i}from"tslib";class r{constructor(t=0,e=0){this.x=t,this.y=e}static get poolCount(){return this._pool.length}static new(t=0,e=0){if(r._pool.length>0){const i=r._pool.pop();if(i)return i.set(t,e)}return new r(t,e)}set(t,e){return this.x=t,this.y=e,this}move(t,e){return this.x=t,this.y=e,this}from(t){return this.x=t.x,this.y=t.y,this}free(){r._pool.push(this)}valueOf(){return{x:this.x,y:this.y}}clone(){return r.new(this.x,this.y)}add(t,e=!0){return e?r.new(this.x+t.x,this.y+t.y):(this.x+=t.x,this.y+=t.y,this)}deduct(t,e=!0){return e?r.new(this.x-t.x,this.y-t.y):(this.x-=t.x,this.y-=t.y,this)}measureDistance(t,e=!0,i=!0){const r=Math.max(this.x,t.x)-Math.min(this.x,t.x),n=Math.max(this.y,t.y)-Math.min(this.y,t.y);return e&&i?Math.sqrt(Math.pow(r,2)+Math.pow(n,2)):e?r:i?n:0}comparePoint(t){return this.x===t.x&&this.y===t.y}empty(){this.x=this.y=0}}r._pool=new Array;class n{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}static get poolCount(){return this._pool.length}static new(t=0,e=0,i=0){if(n._pool.length>0){const r=n._pool.pop();if(r)return r.set(t,e,i)}return new n(t,e,i)}set(t,e,i){return this.x=t,this.y=e,this.z=i,this}free(){n._pool.push(this)}valueOf(){return{x:this.x,y:this.y,z:this.z}}}n._pool=new Array;class s{constructor(t=0,e=0,i=0,r=0){this.x=t,this.y=e,this.z=i,this.t=r}static get poolCount(){return this._pool.length}static new(t=0,e=0,i=0,r=0){if(s._pool.length>0){const n=s._pool.pop();if(n)return n.set(t,e,i,r)}return new s(t,e,i,r)}set(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.t=r,this}free(){s._pool.push(this)}valueOf(){return{x:this.x,y:this.y,z:this.z,t:this.t}}}var o;s._pool=new Array,function(t){t[t.NONE=0]="NONE",t[t.FILL=1]="FILL",t[t.SHOW_ALL=2]="SHOW_ALL",t[t.O_FILL=3]="O_FILL",t[t.O_SHOW_ALL=4]="O_SHOW_ALL"}(o||(o={}));const a=(t,e,i,r,n=o.NONE)=>{let s,a;switch(n){case o.SHOW_ALL:return s=i/t,a=r/e,Math.min(s,a);case o.FILL:return s=i/t,a=r/e,Math.max(s,a);case o.O_SHOW_ALL:case o.O_FILL:return s=i<t?i/t:t/i,a=r<e?r/e:e/r,Math.min(s,a);case o.NONE:default:return 1}},h=(t,e,i=0)=>{let r;if(e&&e.to&&(r=e.to),!t)return s.new();const n=s.new(t.x,t.y,t.scale.x,t.scale.y);if(t.parent){r&&t.parent;const s=h(t.parent,e,i++);n.x+=s.x||0,n.y+=s.y||0,n.z*=s.z||1,n.t*=s.t||1,s.free()}return n};var u=Object.freeze({get RatioFitTypes(){return o},getRatio:a,getAbsolutePosition:h});var l;!function(t){t.CHANGE="change",t.LOST_CONTEXT="lost-context"}(l||(l={}));class c{constructor(t=500){this._poolDetectors=new Array,this._timerId=void 0,this._tickHandler=()=>{for(let t=0,e=this._poolDetectors.length;t<e;t++)this._poolDetectors[t].detectChanges()},this._interval=t}static create(){return c.instance||(c.instance=new c),c.instance}run(){this._timerId=setInterval(this._tickHandler,this._interval)}stop(){this._timerId&&(clearInterval(this._timerId),this._timerId=void 0)}add(t){this._poolDetectors.indexOf(t)>-1||this._poolDetectors.push(t)}remove(t){const e=this._poolDetectors.indexOf(t);-1!==e&&this._poolDetectors.splice(e,1)}removeAll(){for(;this._poolDetectors.length>0;){const t=this._poolDetectors.pop();t&&t.destroy()}}destroy(){this.stop(),this.removeAll(),this._poolDetectors.length=0}}var d="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p(t,e){return t(e={exports:{}},e.exports),e.exports}var f=p((function(t,e){!function(t){var i=t.Promise,r=i&&"resolve"in i&&"reject"in i&&"all"in i&&"race"in i&&function(){var t;return new i((function(e){t=e})),"function"==typeof t}();e?(e.Promise=r?i:y,e.Polyfill=y):r||(t.Promise=y);var n=function(){};function s(t){return"[object Array]"===Object.prototype.toString.call(t)}var o,a="undefined"!=typeof setImmediate?setImmediate:setTimeout,h=[];function u(){for(var t=0;t<h.length;t++)h[t][0](h[t][1]);h=[],o=!1}function l(t,e){h.push([t,e]),o||(o=!0,a(u,0))}function c(t){var e=t.owner,i=e.state_,r=e.data_,n=t[i],s=t.then;if("function"==typeof n){i="fulfilled";try{r=n(r)}catch(t){_(s,t)}}d(s,r)||("fulfilled"===i&&p(s,r),"rejected"===i&&_(s,r))}function d(t,e){var i;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(e&&("function"==typeof e||"object"==typeof e)){var r=e.then;if("function"==typeof r)return r.call(e,(function(r){i||(i=!0,e!==r?p(t,r):f(t,r))}),(function(e){i||(i=!0,_(t,e))})),!0}}catch(e){return i||_(t,e),!0}return!1}function p(t,e){t!==e&&d(t,e)||f(t,e)}function f(t,e){"pending"===t.state_&&(t.state_="sealed",t.data_=e,l(g,t))}function _(t,e){"pending"===t.state_&&(t.state_="sealed",t.data_=e,l(v,t))}function m(t){var e=t.then_;t.then_=void 0;for(var i=0;i<e.length;i++)c(e[i])}function g(t){t.state_="fulfilled",m(t)}function v(t){t.state_="rejected",m(t)}function y(t){if("function"!=typeof t)throw new TypeError("Promise constructor takes a function argument");if(this instanceof y==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[],function(t,e){function i(t){_(e,t)}try{t((function(t){p(e,t)}),i)}catch(t){i(t)}}(t,this)}y.prototype={constructor:y,state_:"pending",then_:null,data_:void 0,then:function(t,e){var i={owner:this,then:new this.constructor(n),fulfilled:t,rejected:e};return"fulfilled"===this.state_||"rejected"===this.state_?l(c,i):this.then_.push(i),i.then},catch:function(t){return this.then(null,t)}},y.all=function(t){if(!s(t))throw new TypeError("You must pass an array to Promise.all().");return new this((function(e,i){var r=[],n=0;function s(t){return n++,function(i){r[t]=i,--n||e(r)}}for(var o,a=0;a<t.length;a++)(o=t[a])&&"function"==typeof o.then?o.then(s(a),i):r[a]=o;n||e(r)}))},y.race=function(t){if(!s(t))throw new TypeError("You must pass an array to Promise.race().");return new this((function(e,i){for(var r,n=0;n<t.length;n++)(r=t[n])&&"function"==typeof r.then?r.then(e,i):e(r)}))},y.resolve=function(t){return t&&"object"==typeof t&&t.constructor===this?t:new this((function(e){e(t)}))},y.reject=function(t){return new this((function(e,i){i(t)}))}}("undefined"!=typeof window?window:void 0!==d?d:"undefined"!=typeof self?self:d)})),_=(f.Promise,f.Polyfill),m=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;function y(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}var x=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},i=0;i<10;i++)e["_"+String.fromCharCode(i)]=i;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var i,r,n=y(t),s=1;s<arguments.length;s++){for(var o in i=Object(arguments[s]))g.call(i,o)&&(n[o]=i[o]);if(m){r=m(i);for(var a=0;a<r.length;a++)v.call(i,r[a])&&(n[r[a]]=i[r[a]])}}return n};
/*!
* @pixi/polyfill - v5.3.3
* Compiled Tue, 04 Aug 2020 16:23:09 UTC
*
* @pixi/polyfill is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/window.Promise||(window.Promise=_),Object.assign||(Object.assign=x);if(Date.now&&Date.prototype.getTime||(Date.now=function(){return(new Date).getTime()}),!window.performance||!window.performance.now){var b=Date.now();window.performance||(window.performance={}),window.performance.now=function(){return Date.now()-b}}for(var T=Date.now(),w=["ms","moz","webkit","o"],E=0;E<w.length&&!window.requestAnimationFrame;++E){var P=w[E];window.requestAnimationFrame=window[P+"RequestAnimationFrame"],window.cancelAnimationFrame=window[P+"CancelAnimationFrame"]||window[P+"CancelRequestAnimationFrame"]}window.requestAnimationFrame||(window.requestAnimationFrame=function(t){if("function"!=typeof t)throw new TypeError(t+"is not a function");var e=Date.now(),i=16+T-e;return i<0&&(i=0),T=e,window.setTimeout((function(){T=Date.now(),t(performance.now())}),i)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){return clearTimeout(t)}),Math.sign||(Math.sign=function(t){return 0===(t=Number(t))||isNaN(t)?t:t>0?1:-1}),Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),window.ArrayBuffer||(window.ArrayBuffer=Array),window.Float32Array||(window.Float32Array=Array),window.Uint32Array||(window.Uint32Array=Array),window.Uint16Array||(window.Uint16Array=Array),window.Uint8Array||(window.Uint8Array=Array),window.Int32Array||(window.Int32Array=Array);var O=/iPhone/i,S=/iPod/i,A=/iPad/i,C=/\biOS-universal(?:.+)Mac\b/i,I=/\bAndroid(?:.+)Mobile\b/i,M=/Android/i,R=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,D=/Silk/i,L=/Windows Phone/i,N=/\bWindows(?:.+)ARM\b/i,F=/BlackBerry/i,k=/BB10/i,U=/Opera Mini/i,B=/\b(CriOS|Chrome)(?:.+)Mobile/i,j=/Mobile(?:.+)Firefox\b/i,X=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};
/*!
* @pixi/settings - v5.3.3
* Compiled Tue, 04 Aug 2020 16:23:09 UTC
*
* @pixi/settings is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/
var H=function(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var i=e.userAgent,r=i.split("[FBAN");void 0!==r[1]&&(i=r[0]),void 0!==(r=i.split("Twitter"))[1]&&(i=r[0]);var n=function(t){return function(e){return e.test(t)}}(i),s={apple:{phone:n(O)&&!n(L),ipod:n(S),tablet:!n(O)&&(n(A)||X(e))&&!n(L),universal:n(C),device:(n(O)||n(S)||n(A)||n(C)||X(e))&&!n(L)},amazon:{phone:n(R),tablet:!n(R)&&n(D),device:n(R)||n(D)},android:{phone:!n(L)&&n(R)||!n(L)&&n(I),tablet:!n(L)&&!n(R)&&!n(I)&&(n(D)||n(M)),device:!n(L)&&(n(R)||n(D)||n(I)||n(M))||n(/\bokhttp\b/i)},windows:{phone:n(L),tablet:n(N),device:n(L)||n(N)},other:{blackberry:n(F),blackberry10:n(k),opera:n(U),firefox:n(j),chrome:n(B),device:n(F)||n(k)||n(U)||n(j)||n(B)},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}(window.navigator);var z,G={MIPMAP_TEXTURES:1,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,SPRITE_MAX_TEXTURES:function(t){var e=!0;if(H.tablet||H.phone){var i;if(H.apple.device)if(i=navigator.userAgent.match(/OS (\d+)_(\d+)?/))parseInt(i[1],10)<11&&(e=!1);if(H.android.device)if(i=navigator.userAgent.match(/Android\s([0-9.]*)/))parseInt(i[1],10)<7&&(e=!1)}return e?t:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,transparent:!1,backgroundColor:0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:0,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:33071,SCALE_MODE:1,PRECISION_VERTEX:"highp",PRECISION_FRAGMENT:H.apple.device?"highp":"mediump",CAN_UPLOAD_SAME_BUFFER:!H.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},V=2*Math.PI,Y=180/Math.PI,W=Math.PI/180;
/*!
* @pixi/math - v5.3.3
* Compiled Tue, 04 Aug 2020 16:23:09 UTC
*
* @pixi/math is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/!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"}(z||(z={}));var q=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r),this.type=z.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(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},t.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},t.prototype.contains=function(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height)},t.prototype.pad=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this},t.prototype.fit=function(t){var e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this},t.prototype.ceil=function(t,e){void 0===t&&(t=1),void 0===e&&(e=.001);var i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this},t.prototype.enlarge=function(t){var e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this},t}(),Z=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.radius=i,this.type=z.CIRC}return t.prototype.clone=function(){return new t(this.x,this.y,this.radius)},t.prototype.contains=function(t,e){if(this.radius<=0)return!1;var i=this.radius*this.radius,r=this.x-t,n=this.y-e;return(r*=r)+(n*=n)<=i},t.prototype.getBounds=function(){return new q(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},t}(),K=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.width=i,this.height=r,this.type=z.ELIP}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=(t-this.x)/this.width,r=(e-this.y)/this.height;return(i*=i)+(r*=r)<=1},t.prototype.getBounds=function(){return new q(this.x-this.width,this.y-this.height,this.width,this.height)},t}(),J=function(){function t(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];var r=Array.isArray(e[0])?e[0]:e;if("number"!=typeof r[0]){for(var n=[],s=0,o=r.length;s<o;s++)n.push(r[s].x,r[s].y);r=n}this.points=r,this.type=z.POLY,this.closeStroke=!0}return t.prototype.clone=function(){var e=new t(this.points.slice());return e.closeStroke=this.closeStroke,e},t.prototype.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,s=r-1;n<r;s=n++){var o=this.points[2*n],a=this.points[2*n+1],h=this.points[2*s],u=this.points[2*s+1];a>e!=u>e&&t<(e-a)/(u-a)*(h-o)+o&&(i=!i)}return i},t}(),Q=function(){function t(t,e,i,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=20),this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n,this.type=z.RREC}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height,this.radius)},t.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){if(e>=this.y+this.radius&&e<=this.y+this.height-this.radius||t>=this.x+this.radius&&t<=this.x+this.width-this.radius)return!0;var i=t-(this.x+this.radius),r=e-(this.y+this.radius),n=this.radius*this.radius;if(i*i+r*r<=n)return!0;if((i=t-(this.x+this.width-this.radius))*i+r*r<=n)return!0;if(i*i+(r=e-(this.y+this.height-this.radius))*r<=n)return!0;if((i=t-(this.x+this.radius))*i+r*r<=n)return!0}return!1},t}(),$=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},t.prototype.copyTo=function(t){return t.set(this.x,this.y),t},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},t}(),tt=function(){function t(t,e,i,r){void 0===i&&(i=0),void 0===r&&(r=0),this._x=i,this._y=r,this.cb=t,this.scope=e}return t.prototype.clone=function(e,i){return void 0===e&&(e=this.cb),void 0===i&&(i=this.scope),new t(e,i,this._x,this._y)},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this._x===t&&this._y===e||(this._x=t,this._y=e,this.cb.call(this.scope)),this},t.prototype.copyFrom=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),t}(),et=function(){function t(t,e,i,r,n,s){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),void 0===n&&(n=0),void 0===s&&(s=0),this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=s}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,e,i,r,n,s){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=s,this},t.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var i=e||this.array;return t?(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(t,e){e=e||new $;var i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.ty,e},t.prototype.applyInverse=function(t,e){e=e||new $;var i=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*i*r+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*r+(-this.ty*this.a+this.tx*this.b)*i,e},t.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},t.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},t.prototype.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,s=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=s*e-this.ty*i,this.ty=s*i+this.ty*e,this},t.prototype.append=function(t){var e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this},t.prototype.setTransform=function(t,e,i,r,n,s,o,a,h){return this.a=Math.cos(o+h)*n,this.b=Math.sin(o+h)*n,this.c=-Math.sin(o-a)*s,this.d=Math.cos(o-a)*s,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*this.d),this},t.prototype.prepend=function(t){var e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this},t.prototype.decompose=function(t){var e=this.a,i=this.b,r=this.c,n=this.d,s=-Math.atan2(-r,n),o=Math.atan2(i,e),a=Math.abs(s+o);return a<1e-5||Math.abs(V-a)<1e-5?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=s,t.skew.y=o),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx,t.position.y=this.ty,t},t.prototype.invert=function(){var t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,s=t*r-e*i;return this.a=r/s,this.b=-e/s,this.c=-i/s,this.d=t/s,this.tx=(i*this.ty-r*n)/s,this.ty=-(t*this.ty-e*n)/s,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(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},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}(),it=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],rt=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],nt=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],st=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ot=[],at=[],ht=Math.sign;!function(){for(var t=0;t<16;t++){var e=[];ot.push(e);for(var i=0;i<16;i++)for(var r=ht(it[t]*it[i]+nt[t]*rt[i]),n=ht(rt[t]*it[i]+st[t]*rt[i]),s=ht(it[t]*nt[i]+nt[t]*st[i]),o=ht(rt[t]*nt[i]+st[t]*st[i]),a=0;a<16;a++)if(it[a]===r&&rt[a]===n&&nt[a]===s&&st[a]===o){e.push(a);break}}for(t=0;t<16;t++){var h=new et;h.set(it[t],rt[t],nt[t],st[t],0,0),at.push(h)}}();var ut,lt,ct,dt,pt,ft,_t,mt,gt,vt,yt,xt,bt,Tt,wt,Et,Pt,Ot={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 it[t]},uY:function(t){return rt[t]},vX:function(t){return nt[t]},vY:function(t){return st[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,e){return ot[t][e]},sub:function(t,e){return ot[t][Ot.inv(e)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,e){return 2*Math.abs(t)<=Math.abs(e)?e>=0?Ot.S:Ot.N:2*Math.abs(e)<=Math.abs(t)?t>0?Ot.E:Ot.W:e>0?t>0?Ot.SE:Ot.SW:t>0?Ot.NE:Ot.NW},matrixAppendRotationInv:function(t,e,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var n=at[Ot.inv(e)];n.tx=i,n.ty=r,t.append(n)}},St=function(){function t(){this.worldTransform=new et,this.localTransform=new et,this.position=new tt(this.onChange,this,0,0),this.scale=new tt(this.onChange,this,1,1),this.pivot=new tt(this.onChange,this,0,0),this.skew=new tt(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.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var e=this.localTransform;if(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),this._parentID!==t._worldID){var i=t.worldTransform,r=this.worldTransform;r.a=e.a*i.a+e.b*i.c,r.b=e.a*i.b+e.b*i.d,r.c=e.c*i.a+e.d*i.c,r.d=e.c*i.b+e.d*i.d,r.tx=e.tx*i.a+e.ty*i.c+i.tx,r.ty=e.tx*i.b+e.ty*i.d+i.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),t.IDENTITY=new t,t}(),At=p((function(t){var e=Object.prototype.hasOwnProperty,i="~";function r(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function s(t,e,r,s,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new n(r,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,r,n=[];if(0===this._eventsCount)return n;for(r in t=this._events)e.call(t,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,s=r.length,o=new Array(s);n<s;n++)o[n]=r[n].fn;return o},a.prototype.listenerCount=function(t){var e=i?i+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,n,s,o){var a=i?i+t:t;if(!this._events[a])return!1;var h,u,l=this._events[a],c=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,n),!0;case 5:return l.fn.call(l.context,e,r,n,s),!0;case 6:return l.fn.call(l.context,e,r,n,s,o),!0}for(u=1,h=new Array(c-1);u<c;u++)h[u-1]=arguments[u];l.fn.apply(l.context,h)}else{var d,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),c){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,r);break;case 4:l[u].fn.call(l[u].context,e,r,n);break;default:if(!h)for(d=1,h=new Array(c-1);d<c;d++)h[d-1]=arguments[d];l[u].fn.apply(l[u].context,h)}}return!0},a.prototype.on=function(t,e,i){return s(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return s(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,r,n){var s=i?i+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==e||n&&!a.once||r&&a.context!==r||o(this,s);else{for(var h=0,u=[],l=a.length;h<l;h++)(a[h].fn!==e||n&&!a[h].once||r&&a[h].context!==r)&&u.push(a[h]);u.length?this._events[s]=1===u.length?u[0]:u:o(this,s)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&o(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a})),Ct=Mt,It=Mt;function Mt(t,e,i){i=i||2;var r,n,s,o,a,h,u,l=e&&e.length,c=l?e[0]*i:t.length,d=Rt(t,0,c,i,!0),p=[];if(!d||d.next===d.prev)return p;if(l&&(d=function(t,e,i,r){var n,s,o,a,h,u=[];for(n=0,s=e.length;n<s;n++)o=e[n]*r,a=n<s-1?e[n+1]*r:t.length,(h=Rt(t,o,a,r,!1))===h.next&&(h.steiner=!0),u.push(zt(h));for(u.sort(Bt),n=0;n<u.length;n++)jt(u[n],i),i=Dt(i,i.next);return i}(t,e,d,i)),t.length>80*i){r=s=t[0],n=o=t[1];for(var f=i;f<c;f+=i)(a=t[f])<r&&(r=a),(h=t[f+1])<n&&(n=h),a>s&&(s=a),h>o&&(o=h);u=0!==(u=Math.max(s-r,o-n))?1/u:0}return Lt(d,p,i,r,n,u),p}function Rt(t,e,i,r,n){var s,o;if(n===ie(t,e,i,r)>0)for(s=e;s<i;s+=r)o=$t(s,t[s],t[s+1],o);else for(s=i-r;s>=e;s-=r)o=$t(s,t[s],t[s+1],o);return o&&Wt(o,o.next)&&(te(o),o=o.next),o}function Dt(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Wt(r,r.next)&&0!==Yt(r.prev,r,r.next))r=r.next;else{if(te(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function Lt(t,e,i,r,n,s,o){if(t){!o&&s&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=Ht(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,s,o,a,h,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,r=i,a=0,e=0;e<u&&(a++,r=r.nextZ);e++);for(h=u;a>0||h>0&&r;)0!==a&&(0===h||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,h--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=r}s.nextZ=null,u*=2}while(o>1)}(n)}(t,r,n,s);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,s?Ft(t,r,n,s):Nt(t))e.push(a.i/i),e.push(t.i/i),e.push(h.i/i),te(t),t=h.next,u=h.next;else if((t=h)===u){o?1===o?Lt(t=kt(Dt(t),e,i),e,i,r,n,s,2):2===o&&Ut(t,e,i,r,n,s):Lt(Dt(t),e,i,r,n,s,1);break}}}function Nt(t){var e=t.prev,i=t,r=t.next;if(Yt(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(Gt(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&Yt(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Ft(t,e,i,r){var n=t.prev,s=t,o=t.next;if(Yt(n,s,o)>=0)return!1;for(var a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,h=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,u=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,l=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,c=Ht(a,h,e,i,r),d=Ht(u,l,e,i,r),p=t.prevZ,f=t.nextZ;p&&p.z>=c&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&Gt(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Yt(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&Gt(n.x,n.y,s.x,s.y,o.x,o.y,f.x,f.y)&&Yt(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&Gt(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Yt(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&Gt(n.x,n.y,s.x,s.y,o.x,o.y,f.x,f.y)&&Yt(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function kt(t,e,i){var r=t;do{var n=r.prev,s=r.next.next;!Wt(n,s)&&qt(n,r,r.next,s)&&Jt(n,s)&&Jt(s,n)&&(e.push(n.i/i),e.push(r.i/i),e.push(s.i/i),te(r),te(r.next),r=t=s),r=r.next}while(r!==t);return Dt(r)}function Ut(t,e,i,r,n,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Vt(o,a)){var h=Qt(o,a);return o=Dt(o,o.next),h=Dt(h,h.next),Lt(o,e,i,r,n,s),void Lt(h,e,i,r,n,s)}a=a.next}o=o.next}while(o!==t)}function Bt(t,e){return t.x-e.x}function jt(t,e){if(e=function(t,e){var i,r=e,n=t.x,s=t.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>o){if(o=a,a===n){if(s===r.y)return r;if(s===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!i)return null;if(n===o)return i;var h,u=i,l=i.x,c=i.y,d=1/0;r=i;do{n>=r.x&&r.x>=l&&n!==r.x&&Gt(s<c?n:o,s,l,c,s<c?o:n,s,r.x,r.y)&&(h=Math.abs(s-r.y)/(n-r.x),Jt(r,t)&&(h<d||h===d&&(r.x>i.x||r.x===i.x&&Xt(i,r)))&&(i=r,d=h)),r=r.next}while(r!==u);return i}(t,e)){var i=Qt(e,t);Dt(e,e.next),Dt(i,i.next)}}function Xt(t,e){return Yt(t.prev,t,e.prev)<0&&Yt(e.next,t,t.next)<0}function Ht(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function zt(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Gt(t,e,i,r,n,s,o,a){return(n-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(r-a)-(i-o)*(e-a)>=0&&(i-o)*(s-a)-(n-o)*(r-a)>=0}function Vt(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&qt(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Jt(t,e)&&Jt(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(Yt(t.prev,t,e.prev)||Yt(t,e.prev,e))||Wt(t,e)&&Yt(t.prev,t,t.next)>0&&Yt(e.prev,e,e.next)>0)}function Yt(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Wt(t,e){return t.x===e.x&&t.y===e.y}function qt(t,e,i,r){var n=Kt(Yt(t,e,i)),s=Kt(Yt(t,e,r)),o=Kt(Yt(i,r,t)),a=Kt(Yt(i,r,e));return n!==s&&o!==a||(!(0!==n||!Zt(t,i,e))||(!(0!==s||!Zt(t,r,e))||(!(0!==o||!Zt(i,t,r))||!(0!==a||!Zt(i,e,r)))))}function Zt(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Kt(t){return t>0?1:t<0?-1:0}function Jt(t,e){return Yt(t.prev,t,t.next)<0?Yt(t,e,t.next)>=0&&Yt(t,t.prev,e)>=0:Yt(t,e,t.prev)<0||Yt(t,t.next,e)<0}function Qt(t,e){var i=new ee(t.i,t.x,t.y),r=new ee(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function $t(t,e,i,r){var n=new ee(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function te(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 ee(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ie(t,e,i,r){for(var n=0,s=e,o=i-r;s<i;s+=r)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}Mt.deviation=function(t,e,i,r){var n=e&&e.length,s=n?e[0]*i:t.length,o=Math.abs(ie(t,0,s,i));if(n)for(var a=0,h=e.length;a<h;a++){var u=e[a]*i,l=a<h-1?e[a+1]*i:t.length;o-=Math.abs(ie(t,u,l,i))}var c=0;for(a=0;a<r.length;a+=3){var d=r[a]*i,p=r[a+1]*i,f=r[a+2]*i;c+=Math.abs((t[d]-t[f])*(t[p+1]-t[d+1])-(t[d]-t[p])*(t[f+1]-t[d+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},Mt.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,n=0;n<t.length;n++){for(var s=0;s<t[n].length;s++)for(var o=0;o<e;o++)i.vertices.push(t[n][s][o]);n>0&&(r+=t[n-1].length,i.holes.push(r))}return i},Ct.default=It,function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"}(ut||(ut={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(lt||(lt={})),function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"}(ct||(ct={})),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"}(dt||(dt={})),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"}(pt||(pt={})),function(t){t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",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"}(ft||(ft={})),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"}(_t||(_t={})),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.FLOAT=5126]="FLOAT",t[t.HALF_FLOAT=36193]="HALF_FLOAT"}(mt||(mt={})),function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"}(gt||(gt={})),function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(vt||(vt={})),function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON"}(yt||(yt={})),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"}(xt||(xt={})),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"}(bt||(bt={})),function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"}(Tt||(Tt={})),function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"}(wt||(wt={})),function(t){t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE"}(Et||(Et={})),function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"}(Pt||(Pt={})),
/*!
* @pixi/utils - v5.3.3
* Compiled Tue, 04 Aug 2020 16:23:09 UTC
*
* @pixi/utils is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/
G.RETINA_PREFIX=/@([0-9\.]+)x/,G.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!0;var re,ne=!1;function se(t,e){return void 0===e&&(e=[]),e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}function oe(t){var e=t.toString(16);return"#"+(e="000000".substr(0,6-e.length)+e)}function ae(t){return"string"==typeof t&&"#"===t[0]&&(t=t.substr(1)),parseInt(t,16)}var he=function(){for(var t=[],e=[],i=0;i<32;i++)t[i]=i,e[i]=i;t[dt.NORMAL_NPM]=dt.NORMAL,t[dt.ADD_NPM]=dt.ADD,t[dt.SCREEN_NPM]=dt.SCREEN,e[dt.NORMAL]=dt.NORMAL_NPM,e[dt.ADD]=dt.ADD_NPM,e[dt.SCREEN]=dt.SCREEN_NPM;var r=[];return r.push(e),r.push(t),r}();function ue(t,e){return he[e?1:0][t]}function le(t,e){if(1===e)return(255*e<<24)+t;if(0===e)return 0;var i=t>>16&255,r=t>>8&255,n=255&t;return(255*e<<24)+((i=i*e+.5|0)<<16)+((r=r*e+.5|0)<<8)+(n=n*e+.5|0)}function ce(t,e,i,r){return(i=i||new Float32Array(4))[0]=(t>>16&255)/255,i[1]=(t>>8&255)/255,i[2]=(255&t)/255,(r||void 0===r)&&(i[0]*=e,i[1]*=e,i[2]*=e),i[3]=e,i}function de(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function pe(t){return!(t&t-1||!t)}function fe(t){var e=(t>65535?1:0)<<4,i=((t>>>=e)>255?1:0)<<3;return e|=i,e|=i=((t>>>=i)>15?1:0)<<2,(e|=i=((t>>>=i)>3?1:0)<<1)|(t>>>=i)>>1}function _e(t,e,i){var r,n=t.length;if(!(e>=n||0===i)){var s=n-(i=e+i>n?n-e:i);for(r=e;r<s;++r)t[r]=t[r+i];t.length=s}}function me(t){return 0===t?0:t<0?-1:1}var ge=0;function ve(){return++ge}var ye={};function xe(t,e,i){if(void 0===i&&(i=3),!ye[e]){var r=(new Error).stack;void 0===r?console.warn("PixiJS Deprecation Warning: ",e+"\nDeprecated since v"+t):(r=r.split("\n").splice(i).join("\n"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",e+"\nDeprecated since v"+t),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",e+"\nDeprecated since v"+t),console.warn(r))),ye[e]=!0}}var be,Te={},we=Object.create(null),Ee=Object.create(null),Pe=function(){function t(t,e,i){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.resolution=i||G.RESOLUTION,this.resize(t,e)}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(t,e){this.canvas.width=t*this.resolution,this.canvas.height=e*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(t){this.canvas.width=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.canvas.height},set:function(t){this.canvas.height=t},enumerable:!1,configurable:!0}),t}();function Oe(t,e){var i=G.RETINA_PREFIX.exec(t);return i?parseFloat(i[1]):void 0!==e?e:1}
/*!
* @pixi/display - v5.3.3
* Compiled Tue, 04 Aug 2020 16:23:09 UTC
*
* @pixi/display is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/G.SORTABLE_CHILDREN=!1;var Se=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(t){return this.minX>this.maxX||this.minY>this.maxY?q.EMPTY:((t=t||new q(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},t.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},t.prototype.addQuad=function(t){var e=this.minX,i=this.minY,r=this.maxX,n=this.maxY,s=t[0],o=t[1];e=s<e?s:e,i=o<i?o:i,r=s>r?s:r,n=o>n?o:n,e=(s=t[2])<e?s:e,i=(o=t[3])<i?o:i,r=s>r?s:r,n=o>n?o:n,e=(s=t[4])<e?s:e,i=(o=t[5])<i?o:i,r=s>r?s:r,n=o>n?o:n,e=(s=t[6])<e?s:e,i=(o=t[7])<i?o:i,r=s>r?s:r,n=o>n?o:n,this.minX=e,this.minY=i,this.maxX=r,this.maxY=n},t.prototype.addFrame=function(t,e,i,r,n){this.addFrameMatrix(t.worldTransform,e,i,r,n)},t.prototype.addFrameMatrix=function(t,e,i,r,n){var s=t.a,o=t.b,a=t.c,h=t.d,u=t.tx,l=t.ty,c=this.minX,d=this.minY,p=this.maxX,f=this.maxY,_=s*e+a*i+u,m=o*e+h*i+l;c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,f=m>f?m:f,c=(_=s*r+a*i+u)<c?_:c,d=(m=o*r+h*i+l)<d?m:d,p=_>p?_:p,f=m>f?m:f,c=(_=s*e+a*n+u)<c?_:c,d=(m=o*e+h*n+l)<d?m:d,p=_>p?_:p,f=m>f?m:f,c=(_=s*r+a*n+u)<c?_:c,d=(m=o*r+h*n+l)<d?m:d,p=_>p?_:p,f=m>f?m:f,this.minX=c,this.minY=d,this.maxX=p,this.maxY=f},t.prototype.addVertexData=function(t,e,i){for(var r=this.minX,n=this.minY,s=this.maxX,o=this.maxY,a=e;a<i;a+=2){var h=t[a],u=t[a+1];r=h<r?h:r,n=u<n?u:n,s=h>s?h:s,o=u>o?u:o}this.minX=r,this.minY=n,this.maxX=s,this.maxY=o},t.prototype.addVertices=function(t,e,i,r){this.addVerticesMatrix(t.worldTransform,e,i,r)},t.prototype.addVerticesMatrix=function(t,e,i,r,n,s){void 0===n&&(n=0),void 0===s&&(s=n);for(var o=t.a,a=t.b,h=t.c,u=t.d,l=t.tx,c=t.ty,d=this.minX,p=this.minY,f=this.maxX,_=this.maxY,m=i;m<r;m+=2){var g=e[m],v=e[m+1],y=o*g+h*v+l,x=u*v+a*g+c;d=Math.min(d,y-n),f=Math.max(f,y+n),p=Math.min(p,x-s),_=Math.max(_,x+s)}this.minX=d,this.minY=p,this.maxX=f,this.maxY=_},t.prototype.addBounds=function(t){var e=this.minX,i=this.minY,r=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n},t.prototype.addBoundsMask=function(t,e){var i=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,s=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&r<=s){var o=this.minX,a=this.minY,h=this.maxX,u=this.maxY;this.minX=i<o?i:o,this.minY=r<a?r:a,this.maxX=n>h?n:h,this.maxY=s>u?s:u}},t.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},t.prototype.addBoundsArea=function(t,e){var i=t.minX>e.x?t.minX:e.x,r=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,s=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&r<=s){var o=this.minX,a=this.minY,h=this.maxX,u=this.maxY;this.minX=i<o?i:o,this.minY=r<a?r:a,this.maxX=n>h?n:h,this.maxY=s>u?s:u}},t.prototype.pad=function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},t.prototype.addFramePad=function(t,e,i,r,n,s){t-=n,e-=s,i+=n,r+=s,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>r?this.maxY:r},t}(),Ae=function(t,e){return(Ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function Ce(t,e){function i(){this.constructor=t}Ae(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var Ie=function(t){function e(){var e=t.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new St,e.alpha=1,e.visible=!0,e.renderable=!0,e.parent=null,e.worldAlpha=1,e._lastSortedIndex=0,e._zIndex=0,e.filterArea=null,e.filters=null,e._enabledFilters=null,e._bounds=new Se,e._localBounds=null,e._boundsID=0,e._boundsRect=null,e._localBoundsRect=null,e._mask=null,e._destroyed=!1,e.isSprite=!1,e.isMask=!1,e}return Ce(e,t),e.mixin=function(t){for(var i=Object.keys(t),r=0;r<i.length;++r){var n=i[r];Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t,n))}},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(t,e){return t||(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),e||(this._boundsRect||(this._boundsRect=new q),e=this._boundsRect),this._bounds.getRectangle(e)},e.prototype.getLocalBounds=function(t){t||(this._localBoundsRect||(this._localBoundsRect=new q),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Se);var e=this.transform,i=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var r=this._bounds,n=this._boundsID;this._bounds=this._localBounds;var s=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=r,this._bounds.updateID+=this._boundsID-n,s},e.prototype.toGlobal=function(t,e,i){return void 0===i&&(i=!1),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)},e.prototype.toLocal=function(t,e,i,r){return e&&(t=e.toGlobal(t,i,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)},e.prototype.setParent=function(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t},e.prototype.setTransform=function(t,e,i,r,n,s,o,a,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=1),void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=r||1,this.rotation=n,this.skew.x=s,this.skew.y=o,this.pivot.x=a,this.pivot.y=h,this},e.prototype.destroy=function(t){this.parent&&this.parent.removeChild(this),this.removeAllListeners(),this.transform=null,this.parent=null,this._bounds=null,this._mask=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this._destroyed=!0},Object.defineProperty(e.prototype,"_tempDisplayObjectParent",{get:function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new Me),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),e.prototype.enableTempParent=function(){var t=this.parent;return this.parent=this._tempDisplayObjectParent,t},e.prototype.disableTempParent=function(t){this.parent=t},Object.defineProperty(e.prototype,"x",{get:function(){return this.position.x},set:function(t){this.transform.position.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.position.y},set:function(t){this.transform.position.y=t},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(t){this.transform.position.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(t){this.transform.pivot.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skew",{get:function(){return this.transform.skew},set:function(t){this.transform.skew.copyFro