-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
1 lines (1 loc) · 599 KB
/
main.js
File metadata and controls
1 lines (1 loc) · 599 KB
1
!function(r){var n={};function i(t){if(n[t])return n[t].exports;var e=n[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}i.m=r,i.c=n,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=42)}([,function(t,e,r){var a;!function(){"use strict";function n(t){return.5*(Math.exp(t)+Math.exp(-t))}function i(t){return.5*(Math.exp(t)-Math.exp(-t))}function u(){throw SyntaxError("Invalid Param")}function h(t,e){var r=Math.abs(t),n=Math.abs(e);return 0===t?Math.log(n):0===e?Math.log(r):r<3e3&&n<3e3?.5*Math.log(t*t+e*e):Math.log(t/Math.cos(Math.atan2(e,t)))}var o=function(t,e){var r={re:0,im:0};if(null==t)r.re=r.im=0;else if(void 0!==e)r.re=t,r.im=e;else switch(typeof t){case"object":if("im"in t&&"re"in t)r.re=t.re,r.im=t.im;else if("abs"in t&&"arg"in t){if(!Number.isFinite(t.abs)&&Number.isFinite(t.arg))return l.INFINITY;r.re=t.abs*Math.cos(t.arg),r.im=t.abs*Math.sin(t.arg)}else if("r"in t&&"phi"in t){if(!Number.isFinite(t.r)&&Number.isFinite(t.phi))return l.INFINITY;r.re=t.r*Math.cos(t.phi),r.im=t.r*Math.sin(t.phi)}else 2===t.length?(r.re=t[0],r.im=t[1]):u();break;case"string":r.im=r.re=0;var n=t.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,o=0;null===n&&u();for(var a=0;a<n.length;a++){var s=n[a];" "===s||"\t"===s||"\n"===s||("+"===s?i++:"-"===s?o++:i=o=("i"===s||"I"===s?(i+o===0&&u()," "===n[a+1]||isNaN(n[a+1])?r.im+=parseFloat((o%2?"-":"")+"1"):(r.im+=parseFloat((o%2?"-":"")+n[a+1]),a++)):(i+o!==0&&!isNaN(s)||u(),"i"===n[a+1]||"I"===n[a+1]?(r.im+=parseFloat((o%2?"-":"")+s),a++):r.re+=parseFloat((o%2?"-":"")+s)),0))}0<i+o&&u();break;case"number":r.im=0,r.re=t;break;default:u()}return isNaN(r.re)||isNaN(r.im),r};function l(t,e){if(!(this instanceof l))return new l(t,e);var r=o(t,e);this.re=r.re,this.im=r.im}l.prototype={re:0,im:0,sign:function(){var t=this.abs();return new l(this.re/t,this.im/t)},add:function(t,e){var r=new l(t,e);return this.isInfinite()&&r.isInfinite()?l.NAN:this.isInfinite()||r.isInfinite()?l.INFINITY:new l(this.re+r.re,this.im+r.im)},sub:function(t,e){var r=new l(t,e);return this.isInfinite()&&r.isInfinite()?l.NAN:this.isInfinite()||r.isInfinite()?l.INFINITY:new l(this.re-r.re,this.im-r.im)},mul:function(t,e){var r=new l(t,e);return this.isInfinite()&&r.isZero()||this.isZero()&&r.isInfinite()?l.NAN:this.isInfinite()||r.isInfinite()?l.INFINITY:0===r.im&&0===this.im?new l(this.re*r.re,0):new l(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(t,e){var r=new l(t,e);if(this.isZero()&&r.isZero()||this.isInfinite()&&r.isInfinite())return l.NAN;if(this.isInfinite()||r.isZero())return l.INFINITY;if(this.isZero()||r.isInfinite())return l.ZERO;t=this.re,e=this.im;var n,i,o=r.re,a=r.im;return 0===a?new l(t/o,e/o):Math.abs(o)<Math.abs(a)?new l((t*(i=o/a)+e)/(n=o*i+a),(e*i-t)/n):new l((t+e*(i=a/o))/(n=a*i+o),(e-t*i)/n)},pow:function(t,e){var r=new l(t,e);if(t=this.re,e=this.im,r.isZero())return l.ONE;if(0===r.im){if(0===e&&0<=t)return new l(Math.pow(t,r.re),0);if(0===t)switch((r.re%4+4)%4){case 0:return new l(Math.pow(e,r.re),0);case 1:return new l(0,Math.pow(e,r.re));case 2:return new l(-Math.pow(e,r.re),0);case 3:return new l(0,-Math.pow(e,r.re))}}if(0===t&&0===e&&0<r.re&&0<=r.im)return l.ZERO;var n=Math.atan2(e,t),i=h(t,e);return t=Math.exp(r.re*i-r.im*n),e=r.im*i+r.re*n,new l(t*Math.cos(e),t*Math.sin(e))},sqrt:function(){var t,e,r=this.re,n=this.im,i=this.abs();if(0<=r){if(0===n)return new l(Math.sqrt(r),0);t=.5*Math.sqrt(2*(i+r))}else t=Math.abs(n)/Math.sqrt(2*(i-r));return e=r<=0?.5*Math.sqrt(2*(i-r)):Math.abs(n)/Math.sqrt(2*(i+r)),new l(t,n<0?-e:e)},exp:function(){var t=Math.exp(this.re);return this.im,new l(t*Math.cos(this.im),t*Math.sin(this.im))},expm1:function(){var t=this.re,e=this.im;return new l(Math.expm1(t)*Math.cos(e)+function(t){var e=Math.PI/4;if(t<-e||e<t)return Math.cos(t)-1;var r=t*t;return r*(r*(1/24+r*(-1/720+r*(1/40320+r*(-1/3628800+r*(1/4790014600+r*(-1/87178291200+1/20922789888e3*r))))))-.5)}(e),Math.exp(t)*Math.sin(e))},log:function(){var t=this.re,e=this.im;return new l(h(t,e),Math.atan2(e,t))},abs:function(){return t=this.re,e=this.im,r=Math.abs(t),n=Math.abs(e),r<3e3&&n<3e3?Math.sqrt(r*r+n*n):(n=r<n?(r=n,t/e):e/t,r*Math.sqrt(1+n*n));var t,e,r,n},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var t=this.re,e=this.im;return new l(Math.sin(t)*n(e),Math.cos(t)*i(e))},cos:function(){var t=this.re,e=this.im;return new l(Math.cos(t)*n(e),-Math.sin(t)*i(e))},tan:function(){var t=2*this.re,e=2*this.im,r=Math.cos(t)+n(e);return new l(Math.sin(t)/r,i(e)/r)},cot:function(){var t=2*this.re,e=2*this.im,r=Math.cos(t)-n(e);return new l(-Math.sin(t)/r,i(e)/r)},sec:function(){var t=this.re,e=this.im,r=.5*n(2*e)+.5*Math.cos(2*t);return new l(Math.cos(t)*n(e)/r,Math.sin(t)*i(e)/r)},csc:function(){var t=this.re,e=this.im,r=.5*n(2*e)-.5*Math.cos(2*t);return new l(Math.sin(t)*n(e)/r,-Math.cos(t)*i(e)/r)},asin:function(){var t=this.re,e=this.im,r=new l(e*e-t*t+1,-2*t*e).sqrt(),n=new l(r.re-e,r.im+t).log();return new l(n.im,-n.re)},acos:function(){var t=this.re,e=this.im,r=new l(e*e-t*t+1,-2*t*e).sqrt(),n=new l(r.re-e,r.im+t).log();return new l(Math.PI/2-n.im,n.re)},atan:function(){var t=this.re,e=this.im;if(0===t){if(1===e)return new l(0,1/0);if(-1===e)return new l(0,-1/0)}var r=t*t+(1-e)*(1-e),n=new l((1-e*e-t*t)/r,-2*t/r).log();return new l(-.5*n.im,.5*n.re)},acot:function(){var t=this.re,e=this.im;if(0===e)return new l(Math.atan2(1,t),0);var r=t*t+e*e;return 0!=r?new l(t/r,-e/r).atan():new l(0!==t?t/0:0,0!==e?-e/0:0).atan()},asec:function(){var t=this.re,e=this.im;if(0===t&&0===e)return new l(0,1/0);var r=t*t+e*e;return 0!=r?new l(t/r,-e/r).acos():new l(0!==t?t/0:0,0!==e?-e/0:0).acos()},acsc:function(){var t=this.re,e=this.im;if(0===t&&0===e)return new l(Math.PI/2,1/0);var r=t*t+e*e;return 0!=r?new l(t/r,-e/r).asin():new l(0!==t?t/0:0,0!==e?-e/0:0).asin()},sinh:function(){var t=this.re,e=this.im;return new l(i(t)*Math.cos(e),n(t)*Math.sin(e))},cosh:function(){var t=this.re,e=this.im;return new l(n(t)*Math.cos(e),i(t)*Math.sin(e))},tanh:function(){var t=2*this.re,e=2*this.im,r=n(t)+Math.cos(e);return new l(i(t)/r,Math.sin(e)/r)},coth:function(){var t=2*this.re,e=2*this.im,r=n(t)-Math.cos(e);return new l(i(t)/r,-Math.sin(e)/r)},csch:function(){var t=this.re,e=this.im,r=Math.cos(2*e)-n(2*t);return new l(-2*i(t)*Math.cos(e)/r,2*n(t)*Math.sin(e)/r)},sech:function(){var t=this.re,e=this.im,r=Math.cos(2*e)+n(2*t);return new l(2*n(t)*Math.cos(e)/r,-2*i(t)*Math.sin(e)/r)},asinh:function(){var t=this.im;this.im=-this.re,this.re=t;var e=this.asin();return this.re=-this.im,this.im=t,t=e.re,e.re=-e.im,e.im=t,e},acosh:function(){var t,e=this.acos();return e.im<=0?(t=e.re,e.re=-e.im,e.im=t):(t=e.im,e.im=-e.re,e.re=t),e},atanh:function(){var t=this.re,e=this.im,r=1<t&&0===e,n=1-t,i=1+t,o=n*n+e*e,a=0!=o?new l((i*n-e*e)/o,(e*n+i*e)/o):new l(-1!==t?t/0:0,0!==e?e/0:0),s=a.re;return a.re=h(a.re,a.im)/2,a.im=Math.atan2(a.im,s)/2,r&&(a.im=-a.im),a},acoth:function(){var t=this.re,e=this.im;if(0===t&&0===e)return new l(0,Math.PI/2);var r=t*t+e*e;return 0!=r?new l(t/r,-e/r).atanh():new l(0!==t?t/0:0,0!==e?-e/0:0).atanh()},acsch:function(){var t=this.re,e=this.im;if(0===e)return new l(0!==t?Math.log(t+Math.sqrt(t*t+1)):1/0,0);var r=t*t+e*e;return 0!=r?new l(t/r,-e/r).asinh():new l(0!==t?t/0:0,0!==e?-e/0:0).asinh()},asech:function(){var t=this.re,e=this.im;if(this.isZero())return l.INFINITY;var r=t*t+e*e;return 0!=r?new l(t/r,-e/r).acosh():new l(0!==t?t/0:0,0!==e?-e/0:0).acosh()},inverse:function(){if(this.isZero())return l.INFINITY;if(this.isInfinite())return l.ZERO;var t=this.re,e=this.im,r=t*t+e*e;return new l(t/r,-e/r)},conjugate:function(){return new l(this.re,-this.im)},neg:function(){return new l(-this.re,-this.im)},ceil:function(t){return t=Math.pow(10,t||0),new l(Math.ceil(this.re*t)/t,Math.ceil(this.im*t)/t)},floor:function(t){return t=Math.pow(10,t||0),new l(Math.floor(this.re*t)/t,Math.floor(this.im*t)/t)},round:function(t){return t=Math.pow(10,t||0),new l(Math.round(this.re*t)/t,Math.round(this.im*t)/t)},equals:function(t,e){var r=new l(t,e);return Math.abs(r.re-this.re)<=l.EPSILON&&Math.abs(r.im-this.im)<=l.EPSILON},clone:function(){return new l(this.re,this.im)},toString:function(){var t=this.re,e=this.im,r="";return this.isNaN()?"NaN":this.isZero()?"0":this.isInfinite()?"Infinity":(0!==t&&(r+=t),0!==e&&(0!==t?r+=e<0?" - ":" + ":e<0&&(r+="-"),1!==(e=Math.abs(e))&&(r+=e),r+="i"),r||"0")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return!(0!==this.re&&-0!==this.re||0!==this.im&&-0!==this.im)},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},l.ZERO=new l(0,0),l.ONE=new l(1,0),l.I=new l(0,1),l.PI=new l(Math.PI,0),l.E=new l(Math.E,0),l.INFINITY=new l(1/0,1/0),l.NAN=new l(NaN,NaN),l.EPSILON=1e-16,void 0===(a=function(){return l}.apply(e,[]))||(t.exports=a)}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=(n(s,[{key:"detach",value:function(){return null!==this._owner&&(this._owner.detach(this),!0)}}]),s);function s(t,e,r){void 0===e&&(e=!1),o(this,s),this._fn=t,this._once=e,this._thisArg=r,this._next=this._prev=this._owner=null}function u(t,e){return t._head?(t._tail._next=e)._prev=t._tail:t._head=e,(t._tail=e)._owner=t,e}var h=(n(l,[{key:"handlers",value:function(t){var e=!(arguments.length<=0||void 0===t)&&t,r=this._head;if(e)return!!r;for(var n=[];r;)n.push(r),r=r._next;return n}},{key:"has",value:function(t){if(!(t instanceof a))throw new Error("MiniSignal#has(): First arg must be a MiniSignalBinding object.");return t._owner===this}},{key:"dispatch",value:function(){var t=this._head;if(!t)return!1;for(;t;)t._once&&this.detach(t),t._fn.apply(t._thisArg,arguments),t=t._next;return!0}},{key:"add",value:function(t,e){var r=arguments.length<=1||void 0===e?null:e;if("function"!=typeof t)throw new Error("MiniSignal#add(): First arg must be a Function.");return u(this,new a(t,!1,r))}},{key:"once",value:function(t,e){var r=arguments.length<=1||void 0===e?null:e;if("function"!=typeof t)throw new Error("MiniSignal#once(): First arg must be a Function.");return u(this,new a(t,!0,r))}},{key:"detach",value:function(t){if(!(t instanceof a))throw new Error("MiniSignal#detach(): First arg must be a MiniSignalBinding object.");return t._owner!==this||(t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t===this._head?(this._head=t._next,null===t._next&&(this._tail=null)):t===this._tail&&(this._tail=t._prev,this._tail._next=null),t._owner=null),this}},{key:"detachAll",value:function(){var t=this._head;if(!t)return this;for(this._head=this._tail=null;t;)t._owner=null,t=t._next;return this}}]),l);function l(){o(this,l),this._head=this._tail=void 0}h.MiniSignalBinding=a,e.default=h,t.exports=e.default},function(r,i,t){var o;!function(){"use strict";var v={s:1,n:0,d:1};function t(e){function t(){var t=Error.apply(this,arguments);t.name=this.name=e,this.stack=t.stack,this.message=t.message}function r(){}return r.prototype=Error.prototype,t.prototype=new r,t}var m=l.DivisionByZero=t("DivisionByZero"),e=l.InvalidParameter=t("InvalidParameter");function g(t,e){return isNaN(t=parseInt(t,10))&&y(),t*e}function y(){throw new e}var n=function(t,e){var r,n=0,i=1,o=1,a=0,s=0,u=0,h=1,l=1,c=0,f=1,d=1,p=1;if(null!=t)if(void 0!==e)o=(n=t)*(i=e);else switch(typeof t){case"object":"d"in t&&"n"in t?(n=t.n,i=t.d,"s"in t&&(n*=t.s)):0 in t?(n=t[0],1 in t&&(i=t[1])):y(),o=n*i;break;case"number":if(t<0&&(t=-(o=t)),t%1==0)n=t;else if(0<t){for(1<=t&&(t/=l=Math.pow(10,Math.floor(1+Math.log(t)/Math.LN10)));f<=1e7&&p<=1e7;){if(t===(r=(c+d)/(f+p))){i=f+p<=1e7?(n=c+d,f+p):f<p?(n=d,p):(n=c,f);break}r<t?(c+=d,f+=p):(d+=c,p+=f),i=1e7<f?(n=d,p):(n=c,f)}n*=l}else(isNaN(t)||isNaN(e))&&(i=n=NaN);break;case"string":if(null===(f=t.match(/\d+|./g))&&y(),"-"===f[c]?(o=-1,c++):"+"===f[c]&&c++,f.length===c+1?s=g(f[c++],o):"."===f[c+1]||"."===f[c]?("."!==f[c]&&(a=g(f[c++],o)),(++c+1===f.length||"("===f[c+1]&&")"===f[c+3]||"'"===f[c+1]&&"'"===f[c+3])&&(s=g(f[c],o),h=Math.pow(10,f[c].length),c++),("("===f[c]&&")"===f[c+2]||"'"===f[c]&&"'"===f[c+2])&&(u=g(f[c+1],o),l=Math.pow(10,f[c+1].length)-1,c+=3)):"/"===f[c+1]||":"===f[c+1]?(s=g(f[c],o),h=g(f[c+2],1),c+=3):"/"===f[c+3]&&" "===f[c+1]&&(a=g(f[c],o),s=g(f[c+2],o),h=g(f[c+4],1),c+=5),f.length<=c){o=n=u+(i=h*l)*a+l*s;break}default:y()}if(0===i)throw new m;v.s=o<0?-1:1,v.n=Math.abs(n),v.d=Math.abs(i)};function u(t,e,r){for(var n=1,i=function(t,e,r){for(var n=1;0<e;t=t*t%r,e>>=1)1&e&&(n=n*t%r);return n}(10,r,e),o=0;o<300;o++){if(n===i)return o;n=10*n%e,i=10*i%e}return 0}function h(t,e){if(!t)return e;if(!e)return t;for(;;){if(!(t%=e))return e;if(!(e%=t))return t}}function l(t,e){if(!(this instanceof l))return new l(t,e);n(t,e),t=l.REDUCE?h(v.d,v.n):1,this.s=v.s,this.n=v.n/t,this.d=v.d/t}l.REDUCE=1,l.prototype={s:1,n:0,d:1,abs:function(){return new l(this.n,this.d)},neg:function(){return new l(-this.s*this.n,this.d)},add:function(t,e){return n(t,e),new l(this.s*this.n*v.d+v.s*this.d*v.n,this.d*v.d)},sub:function(t,e){return n(t,e),new l(this.s*this.n*v.d-v.s*this.d*v.n,this.d*v.d)},mul:function(t,e){return n(t,e),new l(this.s*v.s*this.n*v.n,this.d*v.d)},div:function(t,e){return n(t,e),new l(this.s*v.s*this.n*v.d,this.d*v.n)},clone:function(){return new l(this)},mod:function(t,e){return isNaN(this.n)||isNaN(this.d)?new l(NaN):void 0===t?new l(this.s*this.n%this.d,1):(n(t,e),0===v.n&&0===this.d&&l(0,0),new l(this.s*(v.d*this.n)%(v.n*this.d),v.d*this.d))},gcd:function(t,e){return n(t,e),new l(h(v.n,this.n)*h(v.d,this.d),v.d*this.d)},lcm:function(t,e){return n(t,e),0===v.n&&0===this.n?new l:new l(v.n*this.n,h(v.n,this.n)*h(v.d,this.d))},ceil:function(t){return t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d)?new l(NaN):new l(Math.ceil(t*this.s*this.n/this.d),t)},floor:function(t){return t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d)?new l(NaN):new l(Math.floor(t*this.s*this.n/this.d),t)},round:function(t){return t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d)?new l(NaN):new l(Math.round(t*this.s*this.n/this.d),t)},inverse:function(){return new l(this.s*this.d,this.n)},pow:function(t){return t<0?new l(Math.pow(this.s*this.d,-t),Math.pow(this.n,-t)):new l(Math.pow(this.s*this.n,t),Math.pow(this.d,t))},equals:function(t,e){return n(t,e),this.s*this.n*v.d==v.s*v.n*this.d},compare:function(t,e){n(t,e);var r=this.s*this.n*v.d-v.s*v.n*this.d;return(0<r)-(r<0)},simplify:function(t){if(isNaN(this.n)||isNaN(this.d))return this;var e=this.abs().toContinued();t=t||.001;for(var r=0;r<e.length;r++){var n=function t(e){return 1===e.length?new l(e[0]):t(e.slice(1)).inverse().add(e[0])}(e.slice(0,r+1));if(n.sub(this.abs()).abs().valueOf()<t)return n.mul(this.s)}return this},divisible:function(t,e){return n(t,e),!(!(v.n*this.d)||this.n*v.d%(v.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(t){var e,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(t&&0<(e=Math.floor(n/i))&&(r+=e,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(t){var e,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(t&&0<(e=Math.floor(n/i))&&(r+=e,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var t,e=this.n,r=this.d,n=[];if(isNaN(this.n)||isNaN(this.d))return n;for(;n.push(Math.floor(e/r)),t=e%r,e=r,r=t,1!==e;);return n},toString:function(t){var e,r=this.n,n=this.d;if(isNaN(r)||isNaN(n))return"NaN";l.REDUCE||(r/=e=h(r,n),n/=e),t=t||15;var i=function(t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(1===t)return 0;for(var e=10%t,r=1;1!==e;r++)if(e=10*e%t,2e3<r)return 0;return r}(n),o=u(0,n,i),a=-1===this.s?"-":"";if(a+=r/n|0,r%=n,(r*=10)&&(a+="."),i){for(var s=o;s--;)a+=r/n|0,r%=n,r*=10;a+="(";for(s=i;s--;)a+=r/n|0,r%=n,r*=10;a+=")"}else for(s=t;r&&s--;)a+=r/n|0,r%=n,r*=10;return a}},void 0===(o=function(){return l}.apply(i,[]))||(r.exports=o)}()},function(t,e){t.exports=function e(t,r){"use strict";function n(t){return e.insensitive&&(""+t).toLowerCase()||""+t}var i,o,a=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,s=/(^[ ]*|[ ]*$)/g,u=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,h=/^0x[0-9a-f]+$/i,l=/^0/,c=n(t).replace(s,"")||"",f=n(r).replace(s,"")||"",d=c.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=f.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),v=parseInt(c.match(h),16)||1!==d.length&&c.match(u)&&Date.parse(c),m=parseInt(f.match(h),16)||v&&f.match(u)&&Date.parse(f)||null;if(m){if(v<m)return-1;if(m<v)return 1}for(var g=0,y=Math.max(d.length,p.length);g<y;g++){if(i=!(d[g]||"").match(l)&&parseFloat(d[g])||d[g]||0,o=!(p[g]||"").match(l)&&parseFloat(p[g])||p[g]||0,isNaN(i)!==isNaN(o))return isNaN(i)?1:-1;if(typeof i!=typeof o&&(i+="",o+=""),i<o)return-1;if(o<i)return 1}return 0}},function(t,e){var r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var D=r(23),R=r(25);function O(){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}e.parse=o,e.resolve=function(t,e){return o(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?o(t,!1,!0).resolveObject(e):e},e.format=function(t){R.isString(t)&&(t=o(t));return t instanceof O?t.format():O.prototype.format.call(t)},e.Url=O;var F=/^([a-z0-9.+-]+:)/i,n=/:[0-9]*$/,L=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,i=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),k=["'"].concat(i),B=["%","/","?",";","#"].concat(k),U=["/","?","#"],j=/^[+a-z0-9A-Z_-]{0,63}$/,z=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,H={javascript:!0,"javascript:":!0},G={javascript:!0,"javascript:":!0},X={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},V=r(26);function o(t,e,r){if(t&&R.isObject(t)&&t instanceof O)return t;var n=new O;return n.parse(t,e,r),n}O.prototype.parse=function(t,e,r){if(!R.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),i=-1!==n&&n<t.indexOf("#")?"?":"#",o=t.split(i);o[0]=o[0].replace(/\\/g,"/");var a=(a=t=o.join(i)).trim();if(!r&&1===t.split("#").length){var s=L.exec(a);if(s)return this.path=a,this.href=a,this.pathname=s[1],s[2]?(this.search=s[2],this.query=e?V.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var u,h,l=F.exec(a);if(l&&(u=(l=l[0]).toLowerCase(),this.protocol=u,a=a.substr(l.length)),(r||l||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(!(h="//"===a.substr(0,2))||l&&G[l]||(a=a.substr(2),this.slashes=!0)),!G[l]&&(h||l&&!X[l])){for(var c,f,d=-1,p=0;p<U.length;p++){-1!==(v=a.indexOf(U[p]))&&(-1===d||v<d)&&(d=v)}-1!==(f=-1===d?a.lastIndexOf("@"):a.lastIndexOf("@",d))&&(c=a.slice(0,f),a=a.slice(f+1),this.auth=decodeURIComponent(c)),d=-1;for(var v,p=0;p<B.length;p++){-1!==(v=a.indexOf(B[p]))&&(-1===d||v<d)&&(d=v)}-1===d&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var m="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!m)for(var g=this.hostname.split(/\./),p=0,y=g.length;p<y;p++){var _=g[p];if(_&&!_.match(j)){for(var x="",b=0,w=_.length;b<w;b++)127<_.charCodeAt(b)?x+="x":x+=_[b];if(!x.match(j)){var T=g.slice(0,p),E=g.slice(p+1),A=_.match(z);A&&(T.push(A[1]),E.unshift(A[2])),E.length&&(a="/"+E.join(".")+a),this.hostname=T.join(".");break}}}255<this.hostname.length?this.hostname="":this.hostname=this.hostname.toLowerCase(),m||(this.hostname=D.toASCII(this.hostname));var S=this.port?":"+this.port:"",O=this.hostname||"";this.host=O+S,this.href+=this.host,m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!H[u])for(p=0,y=k.length;p<y;p++){var M,P=k[p];-1!==a.indexOf(P)&&((M=encodeURIComponent(P))===P&&(M=escape(P)),a=a.split(P).join(M))}var C=a.indexOf("#");-1!==C&&(this.hash=a.substr(C),a=a.slice(0,C));var I,N=a.indexOf("?");return-1!==N?(this.search=a.substr(N),this.query=a.substr(N+1),e&&(this.query=V.parse(this.query)),a=a.slice(0,N)):e&&(this.search="",this.query={}),a&&(this.pathname=a),X[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),(this.pathname||this.search)&&(S=this.pathname||"",I=this.search||"",this.path=S+I),this.href=this.format(),this},O.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,o="";this.host?i=t+this.host:this.hostname&&(i=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&R.isObject(this.query)&&Object.keys(this.query).length&&(o=V.stringify(this.query));var a=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||X[e])&&!1!==i?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i=i||"",n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),e+i+(r=r.replace(/[?#]/g,function(t){return encodeURIComponent(t)}))+(a=a.replace("#","%23"))+n},O.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},O.prototype.resolveObject=function(t){var e;R.isString(t)&&((e=new O).parse(t,!1,!0),t=e);for(var r,n,i=new O,o=Object.keys(this),a=0;a<o.length;a++){var s=o[a];i[s]=this[s]}if(i.hash=t.hash,""===t.href)return i.href=i.format(),i;if(t.slashes&&!t.protocol){for(var u=Object.keys(t),h=0;h<u.length;h++){var l=u[h];"protocol"!==l&&(i[l]=t[l])}return X[i.protocol]&&i.hostname&&!i.pathname&&(i.path=i.pathname="/"),i.href=i.format(),i}if(t.protocol&&t.protocol!==i.protocol){if(!X[t.protocol]){for(var c=Object.keys(t),f=0;f<c.length;f++){var d=c[f];i[d]=t[d]}return i.href=i.format(),i}if(i.protocol=t.protocol,t.host||G[t.protocol])i.pathname=t.pathname;else{for(var p=(t.pathname||"").split("/");p.length&&!(t.host=p.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),i.pathname=p.join("/")}return i.search=t.search,i.query=t.query,i.host=t.host||"",i.auth=t.auth,i.hostname=t.hostname||t.host,i.port=t.port,(i.pathname||i.search)&&(r=i.pathname||"",n=i.search||"",i.path=r+n),i.slashes=i.slashes||t.slashes,i.href=i.format(),i}var v=i.pathname&&"/"===i.pathname.charAt(0),m=t.host||t.pathname&&"/"===t.pathname.charAt(0),g=m||v||i.host&&t.pathname,y=g,_=i.pathname&&i.pathname.split("/")||[],p=t.pathname&&t.pathname.split("/")||[],x=i.protocol&&!X[i.protocol];if(x&&(i.hostname="",i.port=null,i.host&&(""===_[0]?_[0]=i.host:_.unshift(i.host)),i.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===p[0]?p[0]=t.host:p.unshift(t.host)),t.host=null),g=g&&(""===p[0]||""===_[0])),m)i.host=t.host||""===t.host?t.host:i.host,i.hostname=t.hostname||""===t.hostname?t.hostname:i.hostname,i.search=t.search,i.query=t.query,_=p;else if(p.length)(_=_||[]).pop(),_=_.concat(p),i.search=t.search,i.query=t.query;else if(!R.isNullOrUndefined(t.search)){return x&&(i.hostname=i.host=_.shift(),(A=!!(i.host&&0<i.host.indexOf("@"))&&i.host.split("@"))&&(i.auth=A.shift(),i.host=i.hostname=A.shift())),i.search=t.search,i.query=t.query,R.isNull(i.pathname)&&R.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i}if(!_.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var b=_.slice(-1)[0],w=(i.host||t.host||1<_.length)&&("."===b||".."===b)||""===b,T=0,E=_.length;0<=E;E--)"."===(b=_[E])?_.splice(E,1):".."===b?(_.splice(E,1),T++):T&&(_.splice(E,1),T--);if(!g&&!y)for(;T--;)_.unshift("..");!g||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),w&&"/"!==_.join("/").substr(-1)&&_.push("");var A,S=""===_[0]||_[0]&&"/"===_[0].charAt(0);return x&&(i.hostname=i.host=!S&&_.length?_.shift():"",(A=!!(i.host&&0<i.host.indexOf("@"))&&i.host.split("@"))&&(i.auth=A.shift(),i.host=i.hostname=A.shift())),(g=g||i.host&&_.length)&&!S&&_.unshift(""),_.length?i.pathname=_.join("/"):(i.pathname=null,i.path=null),R.isNull(i.pathname)&&R.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=t.auth||i.auth,i.slashes=i.slashes||t.slashes,i.href=i.format(),i},O.prototype.parseHost=function(){var t=this.host,e=n.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},,function(o,t,e){"use strict";var l=e(14),c=e(32),f=e(33),d=e(35);function p(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),o=0,a=0;o<t.length;++o)o!==e&&(i[a++]=t[n][o]);return r}function v(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",v(t.slice(0,e)),",",v(t.slice(e)),")"].join("")}function m(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;r<t.length;++r)e.push(["scale(",v(m(p(t,r))),",",1&r?"-":"",t[0][r],")"].join(""));return e}function a(t){for(var e=[],r=[],n=function(t){for(var e=new Array(t),r=0;r<t;++r){e[r]=new Array(t);for(var n=0;n<t;++n)e[r][n]=["m",n,"[",t-r-1,"]"].join("")}return e}(t),i=[],o=0;o<t;++o)0==(1&o)?e.push.apply(e,m(p(n,o))):r.push.apply(r,m(p(n,o))),i.push("m"+o);var a=v(e),s=v(r),u="orientation"+t+"Exact",h=["function ",u,"(",i.join(),"){var p=",a,",n=",s,",d=sub(p,n);return d[d.length-1];};return ",u].join("");return new Function("sum","prod","scale","sub",h)(c,l,f,d)}var u=a(3),b=a(4),s=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,r){var n,i=(t[1]-r[1])*(e[0]-r[0]),o=(t[0]-r[0])*(e[1]-r[1]),a=i-o;if(0<i){if(o<=0)return a;n=i+o}else{if(!(i<0))return a;if(0<=o)return a;n=-(i+o)}var s=33306690738754716e-32*n;return s<=a||a<=-s?a:u(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],o=e[0]-n[0],a=r[0]-n[0],s=t[1]-n[1],u=e[1]-n[1],h=r[1]-n[1],l=t[2]-n[2],c=e[2]-n[2],f=r[2]-n[2],d=o*h,p=a*u,v=a*s,m=i*h,g=i*u,y=o*s,_=l*(d-p)+c*(v-m)+f*(g-y),x=7771561172376103e-31*((Math.abs(d)+Math.abs(p))*Math.abs(l)+(Math.abs(v)+Math.abs(m))*Math.abs(c)+(Math.abs(g)+Math.abs(y))*Math.abs(f));return x<_||x<-_?_:b(t,e,r,n)}];!function(){for(;s.length<=5;)s.push(a(s.length));for(var t=[],e=["slow"],r=0;r<=5;++r)t.push("a"+r),e.push("o"+r);for(var n=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],r=2;r<=5;++r)n.push("case ",r,":return o",r,"(",t.slice(0,r).join(),");");n.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),e.push(n.join(""));var i=Function.apply(void 0,e);for(o.exports=i.apply(void 0,[function(t){return(s[t.length]||(s[t.length]=a(t.length))).apply(void 0,t)}].concat(s)),r=0;r<=5;++r)o.exports[r]=s[r]}()},function(t,e,r){"use strict";t.exports=function(t,e){e=e||{};for(var n={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},r=n.parser[e.strictMode?"strict":"loose"].exec(t),i={},o=14;o--;)i[n.key[o]]=r[o]||"";return i[n.q.name]={},i[n.key[12]].replace(n.q.parser,function(t,e,r){e&&(i[n.q.name][e]=r)}),i}},function(t,e,r){"use strict";var n,i,o;i=[],void 0===(o="function"==typeof(n=function(){function R(){return true}function rt(){return false}function nt(){return undefined}function F(){var t=[{name:"number",test:function(t){return typeof t==="number"}},{name:"string",test:function(t){return typeof t==="string"}},{name:"boolean",test:function(t){return typeof t==="boolean"}},{name:"Function",test:function(t){return typeof t==="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(t){return t instanceof Date}},{name:"RegExp",test:function(t){return t instanceof RegExp}},{name:"Object",test:function(t){return typeof t==="object"&&t!==null&&t.constructor===Object}},{name:"null",test:function(t){return t===null}},{name:"undefined",test:function(t){return t===undefined}}];var n={name:"any",test:R};var e=[];var r=[];var z={types:t,conversions:r,ignore:e};function u(e){var t=tt(z.types,function(t){return t.name===e});if(t){return t}if(e==="any"){return n}var r=tt(z.types,function(t){return t.name.toLowerCase()===e.toLowerCase()});throw new TypeError('Unknown type "'+e+'"'+(r?'. Did you mean "'+r.name+'"?':""))}function h(t){if(t===n){return 999}return z.types.indexOf(t)}function f(e){var t=tt(z.types,function(t){return t.test(e)});if(t){return t.name}throw new TypeError("Value has unknown type. Value: "+e)}function i(t,e){if(!t.signatures){throw new TypeError("Function is no typed-function")}var r;if(typeof e==="string"){r=e.split(",");for(var n=0;n<r.length;n++){r[n]=r[n].trim()}}else if(Array.isArray(e)){r=e}else{throw new TypeError("String array or a comma separated string expected")}var i=r.join(",");var o=t.signatures[i];if(o){return o}throw new TypeError("Signature not found (signature: "+(t.name||"unnamed")+"("+r.join(", ")+"))")}function o(t,e){var r=f(t);if(e===r){return t}for(var n=0;n<z.conversions.length;n++){var i=z.conversions[n];if(i.from===r&&i.to===e){return i.convert(t)}}throw new Error("Cannot convert from "+r+" to "+e)}function H(t){return t.map(function(t){var e=t.types.map(c);return(t.restParam?"...":"")+e.join("|")}).join(",")}function a(t,r){var e=t.indexOf("...")===0;var n=!e?t:t.length>3?t.slice(3):"any";var i=n.split("|").map(T).filter(E).filter(w);var o=_(r,i);var a=i.map(function(t){var e=u(t);return{name:t,typeIndex:h(e),test:e.test,conversion:null,conversionIndex:-1}});var s=o.map(function(t){var e=u(t.from);return{name:t.from,typeIndex:h(e),test:e.test,conversion:t,conversionIndex:r.indexOf(t)}});return{types:a.concat(s),restParam:e}}function G(t,e,i){var r=[];if(t.trim()!==""){r=t.split(",").map(T).map(function(t,e,r){var n=a(t,i);if(n.restParam&&e!==r.length-1){throw new SyntaxError('Unexpected rest parameter "'+t+'": '+"only allowed for the last parameter")}return n})}if(r.some(A)){return null}return{params:r,fn:e}}function X(t){var e=O(t);return e?e.restParam:false}function s(t){return t.types.some(function(t){return t.conversion!=null})}function V(t){if(!t||t.types.length===0){return R}else if(t.types.length===1){return u(t.types[0].name).test}else if(t.types.length===2){var r=u(t.types[0].name).test;var n=u(t.types[1].name).test;return function t(e){return r(e)||n(e)}}else{var i=t.types.map(function(t){return u(t.name).test});return function t(e){for(var r=0;r<i.length;r++){if(i[r](e)){return true}}return false}}}function Y(t){var n,r,i;if(X(t)){n=S(t).map(V);var o=n.length;var a=V(O(t));var s=function(t){for(var e=o;e<t.length;e++){if(!a(t[e])){return false}}return true};return function t(e){for(var r=0;r<n.length;r++){if(!n[r](e[r])){return false}}return s(e)&&e.length>=o+1}}else{if(t.length===0){return function t(e){return e.length===0}}else if(t.length===1){r=V(t[0]);return function t(e){return r(e[0])&&e.length===1}}else if(t.length===2){r=V(t[0]);i=V(t[1]);return function t(e){return r(e[0])&&i(e[1])&&e.length===2}}else{n=t.map(V);return function t(e){for(var r=0;r<n.length;r++){if(!n[r](e[r])){return false}}return e.length===n.length}}}}function d(t,e){return e<t.params.length?t.params[e]:X(t.params)?O(t.params):null}function l(t,e,r){var n=d(t,e);var i=n?r?n.types.filter(p):n.types:[];return i.map(c)}function c(t){return t.name}function p(t){return t.conversion===null||t.conversion===undefined}function v(t,e){var r=I(et(t,function(t){return l(t,e,false)}));return r.indexOf("any")!==-1?["any"]:r}function W(t,r,e){var n,i;var o=t||"unnamed";var a=e;var s;for(s=0;s<r.length;s++){var u=a.filter(function(t){var e=V(d(t,s));return(s<t.params.length||X(t.params))&&e(r[s])});if(u.length===0){i=v(a,s);if(i.length>0){var h=f(r[s]);n=new TypeError("Unexpected type of argument in function "+o+" (expected: "+i.join(" or ")+", actual: "+h+", index: "+s+")");n.data={category:"wrongType",fn:o,index:s,actual:h,expected:i};return n}}else{a=u}}var l=a.map(function(t){return X(t.params)?Infinity:t.params.length});if(r.length<Math.min.apply(null,l)){i=v(a,s);n=new TypeError("Too few arguments in function "+o+" (expected: "+i.join(" or ")+", index: "+r.length+")");n.data={category:"tooFewArgs",fn:o,index:r.length,expected:i};return n}var c=Math.max.apply(null,l);if(r.length>c){n=new TypeError("Too many arguments in function "+o+" (expected: "+c+", actual: "+r.length+")");n.data={category:"tooManyArgs",fn:o,index:r.length,expectedLength:c};return n}n=new TypeError('Arguments of type "'+r.join(", ")+'" do not match any of the defined signatures of function '+o+".");n.data={category:"mismatch",actual:r.map(f)};return n}function m(t){var e=999;for(var r=0;r<t.types.length;r++){if(p(t.types[r])){e=Math.min(e,t.types[r].typeIndex)}}return e}function g(t){var e=999;for(var r=0;r<t.types.length;r++){if(!p(t.types[r])){e=Math.min(e,t.types[r].conversionIndex)}}return e}function y(t,e){var r;r=t.restParam-e.restParam;if(r!==0){return r}r=s(t)-s(e);if(r!==0){return r}r=m(t)-m(e);if(r!==0){return r}return g(t)-g(e)}function q(t,e){var r=Math.min(t.params.length,e.params.length);var n;var i;i=t.params.some(s)-e.params.some(s);if(i!==0){return i}for(n=0;n<r;n++){i=s(t.params[n])-s(e.params[n]);if(i!==0){return i}}for(n=0;n<r;n++){i=y(t.params[n],e.params[n]);if(i!==0){return i}}return t.params.length-e.params.length}function _(t,e){var r={};t.forEach(function(t){if(e.indexOf(t.from)===-1&&e.indexOf(t.to)!==-1&&!r[t.from]){r[t.from]=t}});return Object.keys(r).map(function(t){return r[t]})}function Z(t,i){var e=i;if(t.some(s)){var o=X(t);var a=t.map(x);e=function t(){var e=[];var r=o?arguments.length-1:arguments.length;for(var n=0;n<r;n++){e[n]=a[n](arguments[n])}if(o){e[r]=arguments[r].map(a[r])}return i.apply(null,e)}}var r=e;if(X(t)){var n=t.length-1;r=function t(){return e.apply(null,M(arguments,0,n).concat([M(arguments,n)]))}}return r}function x(t){var r,n,i,o;var a=[];var s=[];t.types.forEach(function(t){if(t.conversion){a.push(u(t.conversion.from).test);s.push(t.conversion.convert)}});switch(s.length){case 0:return function t(e){return e};case 1:r=a[0];i=s[0];return function t(e){if(r(e)){return i(e)}return e};case 2:r=a[0];n=a[1];i=s[0];o=s[1];return function t(e){if(r(e)){return i(e)}if(n(e)){return o(e)}return e};default:return function t(e){for(var r=0;r<s.length;r++){if(a[r](e)){return s[r](e)}}return e}}}function K(t){var r={};t.forEach(function(e){if(!e.params.some(s)){$(e.params,true).forEach(function(t){r[H(t)]=e.fn})}});return r}function $(t,u){function h(r,e,n){if(e<r.length){var t=r[e];var i=u?t.types.filter(p):t.types;var o;if(t.restParam){var a=i.filter(p);o=a.length<i.length?[a,i]:[i]}else{o=i.map(function(t){return[t]})}return et(o,function(t){return h(r,e+1,n.concat([t]))})}else{var s=n.map(function(t,e){return{types:t,restParam:e===r.length-1&&X(r)}});return[s]}}return h(t,0,[])}function J(t,e){var r=Math.max(t.params.length,e.params.length);for(var n=0;n<r;n++){var i=l(t,n,true);var o=l(e,n,true);if(!C(i,o)){return false}}var a=t.params.length;var s=e.params.length;var u=X(t.params);var h=X(e.params);return u?h?a===s:s>=a:h?a>=s:a===s}function b(r,e){if(Object.keys(e).length===0){throw new SyntaxError("No signatures provided")}var n=[];Object.keys(e).map(function(t){return G(t,e[t],z.conversions)}).filter(Q).forEach(function(e){var t=tt(n,function(t){return J(t,e)});if(t){throw new TypeError('Conflicting signatures "'+H(t.params)+'" and "'+H(e.params)+'".')}n.push(e)});var i=et(n,function(e){var t=e?$(e.params,false):[];return t.map(function(t){return{params:t,fn:e.fn}})}).filter(Q);i.sort(q);var t=i[0]&&i[0].params.length<=2&&!X(i[0].params);var o=i[1]&&i[1].params.length<=2&&!X(i[1].params);var a=i[2]&&i[2].params.length<=2&&!X(i[2].params);var s=i[3]&&i[3].params.length<=2&&!X(i[3].params);var u=i[4]&&i[4].params.length<=2&&!X(i[4].params);var h=i[5]&&i[5].params.length<=2&&!X(i[5].params);var l=t&&o&&a&&s&&u&&h;var c=i.map(function(t){return Y(t.params)});var f=t?V(i[0].params[0]):rt;var d=o?V(i[1].params[0]):rt;var p=a?V(i[2].params[0]):rt;var v=s?V(i[3].params[0]):rt;var m=u?V(i[4].params[0]):rt;var g=h?V(i[5].params[0]):rt;var y=t?V(i[0].params[1]):rt;var _=o?V(i[1].params[1]):rt;var x=a?V(i[2].params[1]):rt;var b=s?V(i[3].params[1]):rt;var w=u?V(i[4].params[1]):rt;var T=h?V(i[5].params[1]):rt;var E=i.map(function(t){return Z(t.params,t.fn)});var A=t?E[0]:nt;var S=o?E[1]:nt;var O=a?E[2]:nt;var M=s?E[3]:nt;var P=u?E[4]:nt;var C=h?E[5]:nt;var I=t?i[0].params.length:-1;var N=o?i[1].params.length:-1;var D=a?i[2].params.length:-1;var R=s?i[3].params.length:-1;var F=u?i[4].params.length:-1;var L=h?i[5].params.length:-1;var k=l?6:0;var B=i.length;var U=function t(){"use strict";for(var e=k;e<B;e++){if(c[e](arguments)){return E[e].apply(null,arguments)}}throw W(r,arguments,i)};var j=function t(e,r){"use strict";if(arguments.length===I&&f(e)&&y(r)){return A.apply(null,arguments)}if(arguments.length===N&&d(e)&&_(r)){return S.apply(null,arguments)}if(arguments.length===D&&p(e)&&x(r)){return O.apply(null,arguments)}if(arguments.length===R&&v(e)&&b(r)){return M.apply(null,arguments)}if(arguments.length===F&&m(e)&&w(r)){return P.apply(null,arguments)}if(arguments.length===L&&g(e)&&T(r)){return C.apply(null,arguments)}return U.apply(null,arguments)};try{Object.defineProperty(j,"name",{value:r})}catch(t){}j.signatures=K(i);return j}function w(t){return z.ignore.indexOf(t)===-1}function T(t){return t.trim()}function E(t){return!!t}function Q(t){return t!==null}function A(t){return t.types.length===0}function S(t){return t.slice(0,t.length-1)}function O(t){return t[t.length-1]}function M(t,e,r){return Array.prototype.slice.call(t,e,r)}function P(t,e){return t.indexOf(e)!==-1}function C(t,e){for(var r=0;r<t.length;r++){if(P(e,t[r])){return true}}return false}function tt(t,e){for(var r=0;r<t.length;r++){if(e(t[r])){return t[r]}}return undefined}function I(t){var e={};for(var r=0;r<t.length;r++){e[t[r]]=true}return Object.keys(e)}function et(t,e){return Array.prototype.concat.apply([],t.map(e))}function N(t){var e="";for(var r=0;r<t.length;r++){var n=t[r];if((typeof n.signatures==="object"||typeof n.signature==="string")&&n.name!==""){if(e===""){e=n.name}else if(e!==n.name){var i=new Error("Function names do not match (expected: "+e+", actual: "+n.name+")");i.data={actual:n.name,expected:e};throw i}}}return e}function D(t){var r;var n={};function e(t,e){if(n.hasOwnProperty(t)&&e!==n[t]){r=new Error('Signature "'+t+'" is defined twice');r.data={signature:t};throw r}}for(var i=0;i<t.length;i++){var o=t[i];if(typeof o.signatures==="object"){for(var a in o.signatures){if(o.signatures.hasOwnProperty(a)){e(a,o.signatures[a]);n[a]=o.signatures[a]}}}else if(typeof o.signature==="string"){e(o.signature,o);n[o.signature]=o}else{r=new TypeError("Function is no typed-function (index: "+i+")");r.data={index:i};throw r}}return n}z=b("typed",{"string, Object":b,Object:function(t){var e=[];for(var r in t){if(t.hasOwnProperty(r)){e.push(t[r])}}var n=N(e);return b(n,t)},"...Function":function(t){return b(N(t),D(t))},"string, ...Function":function(t,e){return b(t,D(e))}});z.create=F;z.types=t;z.conversions=r;z.ignore=e;z.convert=o;z.find=i;z.addType=function(t,e){if(!t||typeof t.name!=="string"||typeof t.test!=="function"){throw new TypeError("Object with properties {name: string, test: function} expected")}if(e!==false){for(var r=0;r<z.types.length;r++){if(z.types[r].name==="Object"){z.types.splice(r,0,t);return}}}z.types.push(t)};z.addConversion=function(t){if(!t||typeof t.from!=="string"||typeof t.to!=="string"||typeof t.convert!=="function"){throw new TypeError("Object with properties {from: string, to: string, convert: function} expected")}z.conversions.push(t)};return z}return F()})?n.apply(e,i):n)||(t.exports=o)},function(d,t,e){"use strict";(function(t){var s=256,i=[],o=void 0===t?window:t,a=Math.pow(s,6),u=Math.pow(2,52),h=2*u,e=Math.random;function l(t){var e,r=t.length,a=this,n=0,i=a.i=a.j=0,o=a.S=[];for(r||(t=[r++]);n<s;)o[n]=n++;for(n=0;n<s;n++)o[n]=o[i=255&i+t[n%r]+(e=o[n])],o[i]=e;(a.g=function(t){for(var e,r=0,n=a.i,i=a.j,o=a.S;t--;)e=o[n=255&n+1],r=r*s+o[255&(o[n]=o[i=255&i+e])+(o[i]=e)];return a.i=n,a.j=i,r})(s)}function c(t,e){for(var r,n=t+"",i=0;i<n.length;)e[255&i]=255&(r^=19*e[255&i])+n.charCodeAt(i++);return f(e)}function f(t){return String.fromCharCode.apply(0,t)}d.exports=function(t,e){if(e&&!0===e.global)return e.global=!1,Math.random=d.exports(t,e),e.global=!0,Math.random;var r=[],n=(c(function t(e,r){var n,i=[],o=(typeof e)[0];if(r&&"o"==o)for(n in e)try{i.push(t(e[n],r-1))}catch(t){}return i.length?i:"s"==o?e:e+"\0"}(e&&e.entropy||!1?[t,f(i)]:0 in arguments?t:function(t){try{return o.crypto.getRandomValues(t=new Uint8Array(s)),f(t)}catch(t){return[+new Date,o,o.navigator&&o.navigator.plugins,o.screen,f(i)]}}(),3),r),new l(r));return c(f(n.S),i),function(){for(var t=n.g(6),e=a,r=0;t<u;)t=(t+r)*s,e*=s,r=n.g(1);for(;h<=t;)t/=2,e/=2,r>>>=1;return(t+r)/e}},d.exports.resetGlobal=function(){Math.random=e},c(Math.random(),i)}).call(this,e(5))},function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty,d="~";function i(){}function s(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function o(t,e,r,n,i){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new s(r,n||t,i),a=d?d+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],o]:t._events[a].push(o):(t._events[a]=o,t._eventsCount++),t}function h(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(d=!1)),a.prototype.eventNames=function(){var t,e,r=[];if(0===this._eventsCount)return r;for(e in t=this._events)n.call(t,e)&&r.push(d?e.slice(1):e);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=d?d+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,i=r.length,o=new Array(i);n<i;n++)o[n]=r[n].fn;return o},a.prototype.listenerCount=function(t){var e=d?d+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,n,i,o){var a=d?d+t:t;if(!this._events[a])return!1;var s,u=this._events[a],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,n),!0;case 5:return u.fn.call(u.context,e,r,n,i),!0;case 6:return u.fn.call(u.context,e,r,n,i,o),!0}for(f=1,s=new Array(h-1);f<h;f++)s[f-1]=arguments[f];u.fn.apply(u.context,s)}else for(var l,c=u.length,f=0;f<c;f++)switch(u[f].once&&this.removeListener(t,u[f].fn,void 0,!0),h){case 1:u[f].fn.call(u[f].context);break;case 2:u[f].fn.call(u[f].context,e);break;case 3:u[f].fn.call(u[f].context,e,r);break;case 4:u[f].fn.call(u[f].context,e,r,n);break;default:if(!s)for(l=1,s=new Array(h-1);l<h;l++)s[l-1]=arguments[l];u[f].fn.apply(u[f].context,s)}return!0},a.prototype.on=function(t,e,r){return o(this,t,e,r,!1)},a.prototype.once=function(t,e,r){return o(this,t,e,r,!0)},a.prototype.removeListener=function(t,e,r,n){var i=d?d+t:t;if(!this._events[i])return this;if(!e)return h(this,i),this;var o=this._events[i];if(o.fn)o.fn!==e||n&&!o.once||r&&o.context!==r||h(this,i);else{for(var a=0,s=[],u=o.length;a<u;a++)(o[a].fn!==e||n&&!o[a].once||r&&o[a].context!==r)&&s.push(o[a]);s.length?this._events[i]=1===s.length?s[0]:s:h(this,i)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=d?d+t:t,this._events[e]&&h(this,e)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=d,a.EventEmitter=a,t.exports=a},function(t,e,r){"use strict";function n(t,e,r){r=r||2;var n,i,o,a,s,u,h,l=e&&e.length,c=l?e[0]*r:t.length,f=v(t,0,c,r,!0),d=[];if(!f||f.next===f.prev)return d;if(l&&(f=function(t,e,r,n){var i,o,a,s,u,h=[];for(i=0,o=e.length;i<o;i++)a=e[i]*n,s=i<o-1?e[i+1]*n:t.length,(u=v(t,a,s,n,!1))===u.next&&(u.steiner=!0),h.push(function(t){var e=t,r=t;for(;(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next,e!==t;);return r}(u));for(h.sort(y),i=0;i<h.length;i++)!function(t,e){{var r;(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&a<s){if((a=s)===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===a)return r;var u,h=r,l=r.x,c=r.y,f=1/0;n=r;for(;i>=n.x&&n.x>=l&&i!==n.x&&x(o<c?i:a,o,l,c,o<c?a:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),w(n,t)&&(u<f||u===f&&(n.x>r.x||n.x===r.x&&function(t,e){return b(t.prev,t,e.prev)<0&&b(e.next,t,t.next)<0}(r,n)))&&(r=n,f=u)),n=n.next,n!==h;);return r}(t,e))&&(r=T(e,t),m(e,e.next),m(r,r.next))}}(h[i],r),r=m(r,r.next);return r}(t,e,f,r)),t.length>80*r){n=o=t[0],i=a=t[1];for(var p=r;p<c;p+=r)(s=t[p])<n&&(n=s),(u=t[p+1])<i&&(i=u),o<s&&(o=s),a<u&&(a=u);h=0!==(h=Math.max(o-n,a-i))?1/h:0}return g(f,d,r,n,i,h),d}function v(t,e,r,n,i){var o,a;if(i===0<E(t,e,r,n))for(o=e;o<r;o+=n)a=s(o,t[o],t[o+1],a);else for(o=r-n;e<=o;o-=n)a=s(o,t[o],t[o+1],a);return a&&l(a,a.next)&&(f(a),a=a.next),a}function m(t,e){if(!t)return t;e=e||t;var r,n=t;do{if(r=!1,n.steiner||!l(n,n.next)&&0!==b(n.prev,n,n.next))n=n.next;else{if(f(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function g(t,e,r,n,i,o,a){if(t){!a&&o&&function(t,e,r,n){var i=t;for(;null===i.z&&(i.z=_(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next,i!==t;);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,a,s,u,h=1;do{for(r=t,o=t=null,a=0;r;){for(a++,n=r,e=s=0;e<h&&(s++,n=n.nextZ);e++);for(u=h;0<s||0<u&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(r=(i=r).nextZ,s--):(n=(i=n).nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,h*=2}while(1<a)}(i)}(t,n,i,o);for(var s,u,h=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?function(t,e,r,n){var i=t.prev,o=t,a=t.next;if(0<=b(i,o,a))return!1;var s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,u=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,h=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,l=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,c=_(s,u,e,r,n),f=_(h,l,e,r,n),d=t.prevZ,p=t.nextZ;for(;d&&d.z>=c&&p&&p.z<=f;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=b(d.prev,d,d.next))return!1;if(d=d.prevZ,p!==t.prev&&p!==t.next&&x(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=b(p.prev,p,p.next))return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&x(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=b(d.prev,d,d.next))return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&x(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=b(p.prev,p,p.next))return!1;p=p.nextZ}return!0}(t,n,i,o):function(t){var e=t.prev,r=t,n=t.next;if(0<=b(e,r,n))return!1;var i=t.next.next;for(;i!==t.prev;){if(x(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&0<=b(i.prev,i,i.next))return!1;i=i.next}return!0}(t))e.push(s.i/r),e.push(t.i/r),e.push(u.i/r),f(t),t=u.next,h=u.next;else if((t=u)===h){a?1===a?g(t=function(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!l(i,o)&&c(i,n,n.next,o)&&w(i,o)&&w(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),f(n),f(n.next),n=t=o),n=n.next}while(n!==t);return m(n)}(m(t),e,r),e,r,n,i,o,2):2===a&&function(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(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&&c(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(w(t,e)&&w(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;for(;r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next,r!==t;);return n}(t,e)&&(b(t.prev,t,e.prev)||b(t,e.prev,e))||l(t,e)&&0<b(t.prev,t,t.next)&&0<b(e.prev,e,e.next))}(a,s)){var u=T(a,s);return a=m(a,a.next),u=m(u,u.next),g(a,e,r,n,i,o),g(u,e,r,n,i,o)}s=s.next}a=a.next}while(a!==t)}(t,e,r,n,i,o):g(m(t),e,r,n,i,o,1);break}}}function y(t,e){return t.x-e.x}function _(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function x(t,e,r,n,i,o,a,s){return 0<=(i-a)*(e-s)-(t-a)*(o-s)&&0<=(t-a)*(n-s)-(r-a)*(e-s)&&0<=(r-a)*(o-s)-(i-a)*(n-s)}function b(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function l(t,e){return t.x===e.x&&t.y===e.y}function c(t,e,r,n){var i=h(b(t,e,r)),o=h(b(t,e,n)),a=h(b(r,n,t)),s=h(b(r,n,e));return i!==o&&a!==s||(0===i&&u(t,r,e)||(0===o&&u(t,n,e)||(0===a&&u(r,t,n)||!(0!==s||!u(r,e,n)))))}function u(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 h(t){return 0<t?1:t<0?-1:0}function w(t,e){return b(t.prev,t,t.next)<0?0<=b(t,e,t.next)&&0<=b(t,t.prev,e):b(t,e,t.prev)<0||b(t,t.next,e)<0}function T(t,e){var r=new a(t.i,t.x,t.y),n=new a(e.i,e.x,e.y),i=t.next,o=e.prev;return(t.next=e).prev=t,(r.next=i).prev=r,(n.next=r).prev=n,(o.next=n).prev=o,n}function s(t,e,r,n){var i=new a(t,e,r);return n?(i.next=n.next,(i.prev=n).next.prev=i,n.next=i):(i.prev=i).next=i,i}function f(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 a(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function E(t,e,r,n){for(var i=0,o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}t.exports=n,(t.exports.default=n).deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(E(t,0,o,r));if(i)for(var s=0,u=e.length;s<u;s++){var h=e[s]*r,l=s<u-1?e[s+1]*r:t.length;a-=Math.abs(E(t,h,l,r))}for(var c=0,s=0;s<n.length;s+=3){var f=n[s]*r,d=n[s+1]*r,p=n[s+2]*r;c+=Math.abs((t[f]-t[p])*(t[1+d]-t[1+f])-(t[f]-t[d])*(t[1+p]-t[1+f]))}return 0===a&&0===c?0:Math.abs((c-a)/a)},n.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);0<i&&(n+=t[i-1].length,r.holes.push(n))}return r}},function(t,e,r){"use strict";t.exports=function(t,e,r){var n=t*e,i=c*t,o=i-(i-t),a=t-o,s=c*e,u=s-(s-e),h=e-u,l=a*h-(n-o*u-a*u-o*h);if(r)return r[0]=l,r[1]=n,r;return[l,n]};var c=+(Math.pow(2,27)+1)},function(O,M,P){(function(t,A){var S;!function(t){var e,r=t.Promise,n=r&&"resolve"in r&&"reject"in r&&"all"in r&&"race"in r&&(new r(function(t){e=t}),"function"==typeof e);M?(M.Promise=n?r:E,M.Polyfill=E):void 0===(S=function(){return n?r:E}.call(M,P,M,O))||(O.exports=S);function i(){}var o="pending",a="sealed",s="fulfilled",u="rejected";function h(t){return"[object Array]"===Object.prototype.toString.call(t)}var l,c=void 0!==A?A:setTimeout,f=[];function d(){for(var t=0;t<f.length;t++)f[t][0](f[t][1]);l=!(f=[])}function p(t,e){f.push([t,e]),l||(l=!0,c(d,0))}function v(t,e){function r(t){x(e,t)}try{t(function(t){y(e,t)},r)}catch(t){r(t)}}function m(t){var e=t.owner,r=e.state_,n=e.data_,i=t[r],o=t.then;if("function"==typeof i){r=s;try{n=i(n)}catch(t){x(o,t)}}g(o,n)||(r===s&&y(o,n),r===u&&x(o,n))}function g(e,r){var n;try{if(e===r)throw new TypeError("A promises callback cannot return that same promise.");if(r&&("function"==typeof r||"object"==typeof r)){var t=r.then;if("function"==typeof t)return t.call(r,function(t){n||(n=!0,(r!==t?y:_)(e,t))},function(t){n||(n=!0,x(e,t))}),1}}catch(t){return n||x(e,t),1}}function y(t,e){t!==e&&g(t,e)||_(t,e)}function _(t,e){t.state_===o&&(t.state_=a,t.data_=e,p(w,t))}function x(t,e){t.state_===o&&(t.state_=a,t.data_=e,p(T,t))}function b(t){var e=t.then_;t.then_=void 0;for(var r=0;r<e.length;r++)m(e[r])}function w(t){t.state_=s,b(t)}function T(t){t.state_=u,b(t)}function E(t){if("function"!=typeof t)throw new TypeError("Promise constructor takes a function argument");if(this instanceof E==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[],v(t,this)}E.prototype={constructor:E,state_:o,then_:null,data_:void 0,then:function(t,e){var r={owner:this,then:new this.constructor(i),fulfilled:t,rejected:e};return this.state_===s||this.state_===u?p(m,r):this.then_.push(r),r.then},catch:function(t){return this.then(null,t)}},E.all=function(a){if(!h(a))throw new TypeError("You must pass an array to Promise.all().");return new this(function(r,t){var n=[],i=0;for(var e,o=0;o<a.length;o++)(e=a[o])&&"function"==typeof e.then?e.then(function(e){return i++,function(t){n[e]=t,--i||r(n)}}(o),t):n[o]=e;i||r(n)})},E.race=function(i){if(!h(i))throw new TypeError("You must pass an array to Promise.race().");return new this(function(t,e){for(var r,n=0;n<i.length;n++)(r=i[n])&&"function"==typeof r.then?r.then(t,e):t(r)})},E.resolve=function(e){return e&&"object"==typeof e&&e.constructor===this?e:new this(function(t){t(e)})},E.reject=function(r){return new this(function(t,e){e(r)})}}("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:this)}).call(this,P(5),P(20).setImmediate)},function(t,e,r){"use strict";var u=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},n)).join("")?void 0:1}catch(t){return}}()?Object.assign:function(t,e){for(var r,n,i=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var a in r=Object(arguments[o]))h.call(r,a)&&(i[a]=r[a]);if(u){n=u(r);for(var s=0;s<n.length;s++)l.call(r,n[s])&&(i[n[s]]=r[n[s]])}}return i}},function(i,f,t){(function(r){var n;!function(){"use strict";function t(){this.init()}t.prototype={init:function(){var t=this||_;return t._counter=1e3,t._html5AudioPool=[],t.html5PoolSize=10,t._codecs={},t._howls=[],t._muted=!1,t._volume=1,t._canPlayEvent="canplaythrough",t._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,t.masterGain=null,t.noAudio=!1,t.usingWebAudio=!0,t.autoSuspend=!0,t.ctx=null,t.autoUnlock=!0,t._setup(),t},volume:function(t){var e=this||_;if(t=parseFloat(t),e.ctx||c(),void 0!==t&&0<=t&&t<=1){if(e._volume=t,e._muted)return e;e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t,_.ctx.currentTime);for(var r=0;r<e._howls.length;r++)if(!e._howls[r]._webAudio)for(var n=e._howls[r]._getSoundIds(),i=0;i<n.length;i++){var o=e._howls[r]._soundById(n[i]);o&&o._node&&(o._node.volume=o._volume*t)}return e}return e._volume},mute:function(t){var e=this||_;e.ctx||c(),e._muted=t,e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t?0:e._volume,_.ctx.currentTime);for(var r=0;r<e._howls.length;r++)if(!e._howls[r]._webAudio)for(var n=e._howls[r]._getSoundIds(),i=0;i<n.length;i++){var o=e._howls[r]._soundById(n[i]);o&&o._node&&(o._node.muted=!!t||o._muted)}return e},stop:function(){for(var t=this||_,e=0;e<t._howls.length;e++)t._howls[e].stop();return t},unload:function(){for(var t=this||_,e=t._howls.length-1;0<=e;e--)t._howls[e].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,c()),t},codecs:function(t){return(this||_)._codecs[t.replace(/^x-/,"")]},_setup:function(){var e=this||_;if(e.state=e.ctx&&e.ctx.state||"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(e._canPlayEvent="canplay")}catch(t){e.noAudio=!0}else e.noAudio=!0;try{(new Audio).muted&&(e.noAudio=!0)}catch(t){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||_,t=null;try{t="undefined"!=typeof Audio?new Audio:null}catch(t){return e}if(!t||"function"!=typeof t.canPlayType)return e;var r=t.canPlayType("audio/mpeg;").replace(/^no$/,""),n=e._navigator&&e._navigator.userAgent.match(/OPR\/([0-6].)/g),i=n&&parseInt(n[0].split("/")[1],10)<33;return e._codecs={mp3:!(i||!r&&!t.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!r,opus:!!t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!t.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!t.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!t.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/m4a;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(t.canPlayType("audio/x-m4b;")||t.canPlayType("audio/m4b;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(t.canPlayType("audio/x-mp4;")||t.canPlayType("audio/mp4;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),webm:!!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),dolby:!!t.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(t.canPlayType("audio/x-flac;")||t.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var s=this||_;if(!s._audioUnlocked&&s.ctx){s._audioUnlocked=!1,s.autoUnlock=!1,s._mobileUnloaded||44100===s.ctx.sampleRate||(s._mobileUnloaded=!0,s.unload()),s._scratchBuffer=s.ctx.createBuffer(1,1,22050);var u=function(t){for(;s._html5AudioPool.length<s.html5PoolSize;)try{var e=new Audio;e._unlocked=!0,s._releaseHtml5Audio(e)}catch(t){s.noAudio=!0;break}for(var r=0;r<s._howls.length;r++)if(!s._howls[r]._webAudio)for(var n=s._howls[r]._getSoundIds(),i=0;i<n.length;i++){var o=s._howls[r]._soundById(n[i]);o&&o._node&&!o._node._unlocked&&(o._node._unlocked=!0,o._node.load())}s._autoResume();var a=s.ctx.createBufferSource();a.buffer=s._scratchBuffer,a.connect(s.ctx.destination),void 0===a.start?a.noteOn(0):a.start(0),"function"==typeof s.ctx.resume&&s.ctx.resume(),a.onended=function(){a.disconnect(0),s._audioUnlocked=!0,document.removeEventListener("touchstart",u,!0),document.removeEventListener("touchend",u,!0),document.removeEventListener("click",u,!0);for(var t=0;t<s._howls.length;t++)s._howls[t]._emit("unlock")}};return document.addEventListener("touchstart",u,!0),document.addEventListener("touchend",u,!0),document.addEventListener("click",u,!0),s}},_obtainHtml5Audio:function(){var t=this||_;if(t._html5AudioPool.length)return t._html5AudioPool.pop();var e=(new Audio).play();return e&&"undefined"!=typeof Promise&&(e instanceof Promise||"function"==typeof e.then)&&e.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(t){var e=this||_;return t._unlocked&&e._html5AudioPool.push(t),e},_autoSuspend:function(){var e=this;if(e.autoSuspend&&e.ctx&&void 0!==e.ctx.suspend&&_.usingWebAudio){for(var t=0;t<e._howls.length;t++)if(e._howls[t]._webAudio)for(var r=0;r<e._howls[t]._sounds.length;r++)if(!e._howls[t]._sounds[r]._paused)return e;return e._suspendTimer&&clearTimeout(e._suspendTimer),e._suspendTimer=setTimeout(function(){var t;e.autoSuspend&&(e._suspendTimer=null,e.state="suspending",t=function(){e.state="suspended",e._resumeAfterSuspend&&(delete e._resumeAfterSuspend,e._autoResume())},e.ctx.suspend().then(t,t))},3e4),e}},_autoResume:function(){var e=this;if(e.ctx&&void 0!==e.ctx.resume&&_.usingWebAudio)return"running"===e.state&&"interrupted"!==e.ctx.state&&e._suspendTimer?(clearTimeout(e._suspendTimer),e._suspendTimer=null):"suspended"===e.state||"running"===e.state&&"interrupted"===e.ctx.state?(e.ctx.resume().then(function(){e.state="running";for(var t=0;t<e._howls.length;t++)e._howls[t]._emit("resume")}),e._suspendTimer&&(clearTimeout(e._suspendTimer),e._suspendTimer=null)):"suspending"===e.state&&(e._resumeAfterSuspend=!0),e}};function e(t){t.src&&0!==t.src.length?this.init(t):console.error("An array of source files must be passed with any new Howl.")}var _=new t;e.prototype={init:function(t){var e=this;return _.ctx||c(),e._autoplay=t.autoplay||!1,e._format="string"!=typeof t.format?t.format:[t.format],e._html5=t.html5||!1,e._muted=t.mute||!1,e._loop=t.loop||!1,e._pool=t.pool||5,e._preload="boolean"!=typeof t.preload&&"metadata"!==t.preload||t.preload,e._rate=t.rate||1,e._sprite=t.sprite||{},e._src="string"!=typeof t.src?t.src:[t.src],e._volume=void 0!==t.volume?t.volume:1,e._xhr={method:t.xhr&&t.xhr.method?t.xhr.method:"GET",headers:t.xhr&&t.xhr.headers?t.xhr.headers:null,withCredentials:!(!t.xhr||!t.xhr.withCredentials)&&t.xhr.withCredentials},e._duration=0,e._state="unloaded",e._sounds=[],e._endTimers={},e._queue=[],e._playLock=!1,e._onend=t.onend?[{fn:t.onend}]:[],e._onfade=t.onfade?[{fn:t.onfade}]:[],e._onload=t.onload?[{fn:t.onload}]:[],e._onloaderror=t.onloaderror?[{fn:t.onloaderror}]:[],e._onplayerror=t.onplayerror?[{fn:t.onplayerror}]:[],e._onpause=t.onpause?[{fn:t.onpause}]:[],e._onplay=t.onplay?[{fn:t.onplay}]:[],e._onstop=t.onstop?[{fn:t.onstop}]:[],e._onmute=t.onmute?[{fn:t.onmute}]:[],e._onvolume=t.onvolume?[{fn:t.onvolume}]:[],e._onrate=t.onrate?[{fn:t.onrate}]:[],e._onseek=t.onseek?[{fn:t.onseek}]:[],e._onunlock=t.onunlock?[{fn:t.onunlock}]:[],e._onresume=[],e._webAudio=_.usingWebAudio&&!e._html5,void 0!==_.ctx&&_.ctx&&_.autoUnlock&&_._unlockAudio(),_._howls.push(e),e._autoplay&&e._queue.push({event:"play",action:function(){e.play()}}),e._preload&&"none"!==e._preload&&e.load(),e},load:function(){var t=this,e=null;if(_.noAudio)t._emit("loaderror",null,"No audio support.");else{"string"==typeof t._src&&(t._src=[t._src]);for(var r,n,i=0;i<t._src.length;i++){if(t._format&&t._format[i])r=t._format[i];else{if("string"!=typeof(n=t._src[i])){t._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}r=(r=(r=/^data:audio\/([^;,]+);/i.exec(n))||/\.([^.]+)$/.exec(n.split("?",1)[0]))&&r[1].toLowerCase()}if(r||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),r&&_.codecs(r)){e=t._src[i];break}}if(e)return t._src=e,t._state="loading","https:"===window.location.protocol&&"http:"===e.slice(0,5)&&(t._html5=!0,t._webAudio=!1),new o(t),t._webAudio&&s(t),t;t._emit("loaderror",null,"No codec support for selected audio sources.")}},play:function(e,r){var n=this,t=null;if("number"==typeof e)t=e,e=null;else{if("string"==typeof e&&"loaded"===n._state&&!n._sprite[e])return null;if(void 0===e&&(e="__default",!n._playLock)){for(var i=0,o=0;o<n._sounds.length;o++)n._sounds[o]._paused&&!n._sounds[o]._ended&&(i++,t=n._sounds[o]._id);1===i?e=null:t=null}}var a=t?n._soundById(t):n._inactiveSound();if(!a)return null;if(t&&!e&&(e=a._sprite||"__default"),"loaded"!==n._state){a._sprite=e,a._ended=!1;var s=a._id;return n._queue.push({event:"play",action:function(){n.play(s)}}),s}if(t&&!a._paused)return r||n._loadQueue("play"),a._id;n._webAudio&&_._autoResume();var u=Math.max(0,0<a._seek?a._seek:n._sprite[e][0]/1e3),h=Math.max(0,(n._sprite[e][0]+n._sprite[e][1])/1e3-u),l=1e3*h/Math.abs(a._rate),c=n._sprite[e][0]/1e3,f=(n._sprite[e][0]+n._sprite[e][1])/1e3;a._sprite=e,a._ended=!1;function d(){a._paused=!1,a._seek=u,a._start=c,a._stop=f,a._loop=!(!a._loop&&!n._sprite[e][2])}if(!(f<=u)){var p,v,m,g,y=a._node;return n._webAudio?(p=function(){n._playLock=!1,d(),n._refreshBuffer(a);var t=a._muted||n._muted?0:a._volume;y.gain.setValueAtTime(t,_.ctx.currentTime),a._playStart=_.ctx.currentTime,void 0===y.bufferSource.start?a._loop?y.bufferSource.noteGrainOn(0,u,86400):y.bufferSource.noteGrainOn(0,u,h):a._loop?y.bufferSource.start(0,u,86400):y.bufferSource.start(0,u,h),l!=1/0&&(n._endTimers[a._id]=setTimeout(n._ended.bind(n,a),l)),r||setTimeout(function(){n._emit("play",a._id),n._loadQueue()},0)},"running"===_.state&&"interrupted"!==_.ctx.state?p():(n._playLock=!0,n.once("resume",p),n._clearTimer(a._id))):(v=function(){y.currentTime=u,y.muted=a._muted||n._muted||_._muted||y.muted,y.volume=a._volume*_.volume(),y.playbackRate=a._rate;try{var t=y.play();if(t&&"undefined"!=typeof Promise&&(t instanceof Promise||"function"==typeof t.then)?(n._playLock=!0,d(),t.then(function(){n._playLock=!1,y._unlocked=!0,r||(n._emit("play",a._id),n._loadQueue())}).catch(function(){n._playLock=!1,n._emit("playerror",a._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),a._ended=!0,a._paused=!0})):r||(n._playLock=!1,d(),n._emit("play",a._id),n._loadQueue()),y.playbackRate=a._rate,y.paused)return void n._emit("playerror",a._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||a._loop?n._endTimers[a._id]=setTimeout(n._ended.bind(n,a),l):(n._endTimers[a._id]=function(){n._ended(a),y.removeEventListener("ended",n._endTimers[a._id],!1)},y.addEventListener("ended",n._endTimers[a._id],!1))}catch(t){n._emit("playerror",a._id,t)}},"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===y.src&&(y.src=n._src,y.load()),m=window&&window.ejecta||!y.readyState&&_._navigator.isCocoonJS,3<=y.readyState||m?v():(n._playLock=!0,g=function(){v(),y.removeEventListener(_._canPlayEvent,g,!1)},y.addEventListener(_._canPlayEvent,g,!1),n._clearTimer(a._id))),a._id}n._ended(a)},pause:function(t){var e=this;if("loaded"!==e._state||e._playLock)return e._queue.push({event:"pause",action:function(){e.pause(t)}}),e;for(var r=e._getSoundIds(t),n=0;n<r.length;n++){e._clearTimer(r[n]);var i=e._soundById(r[n]);if(i&&!i._paused&&(i._seek=e.seek(r[n]),i._rateSeek=0,i._paused=!0,e._stopFade(r[n]),i._node))if(e._webAudio){if(!i._node.bufferSource)continue;void 0===i._node.bufferSource.stop?i._node.bufferSource.noteOff(0):i._node.bufferSource.stop(0),e._cleanBuffer(i._node)}else isNaN(i._node.duration)&&i._node.duration!==1/0||i._node.pause();arguments[1]||e._emit("pause",i?i._id:null)}return e},stop:function(t,e){var r=this;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"stop",action:function(){r.stop(t)}}),r;for(var n=r._getSoundIds(t),i=0;i<n.length;i++){r._clearTimer(n[i]);var o=r._soundById(n[i]);o&&(o._seek=o._start||0,o._rateSeek=0,o._paused=!0,o._ended=!0,r._stopFade(n[i]),o._node&&(r._webAudio?o._node.bufferSource&&(void 0===o._node.bufferSource.stop?o._node.bufferSource.noteOff(0):o._node.bufferSource.stop(0),r._cleanBuffer(o._node)):isNaN(o._node.duration)&&o._node.duration!==1/0||(o._node.currentTime=o._start||0,o._node.pause(),o._node.duration===1/0&&r._clearSound(o._node))),e||r._emit("stop",o._id))}return r},mute:function(t,e){var r=this;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"mute",action:function(){r.mute(t,e)}}),r;if(void 0===e){if("boolean"!=typeof t)return r._muted;r._muted=t}for(var n=r._getSoundIds(e),i=0;i<n.length;i++){var o=r._soundById(n[i]);o&&(o._muted=t,o._interval&&r._stopFade(o._id),r._webAudio&&o._node?o._node.gain.setValueAtTime(t?0:o._volume,_.ctx.currentTime):o._node&&(o._node.muted=!!_._muted||t),r._emit("mute",o._id))}return r},volume:function(){var t,e,r,n=this,i=arguments;if(0===i.length)return n._volume;if(1===i.length||2===i.length&&void 0===i[1]?0<=n._getSoundIds().indexOf(i[0])?e=parseInt(i[0],10):t=parseFloat(i[0]):2<=i.length&&(t=parseFloat(i[0]),e=parseInt(i[1],10)),!(void 0!==t&&0<=t&&t<=1))return(r=e?n._soundById(e):n._sounds[0])?r._volume:0;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"volume",action:function(){n.volume.apply(n,i)}}),n;void 0===e&&(n._volume=t),e=n._getSoundIds(e);for(var o=0;o<e.length;o++)(r=n._soundById(e[o]))&&(r._volume=t,i[2]||n._stopFade(e[o]),n._webAudio&&r._node&&!r._muted?r._node.gain.setValueAtTime(t,_.ctx.currentTime):r._node&&!r._muted&&(r._node.volume=t*_.volume()),n._emit("volume",r._id));return n},fade:function(t,e,r,n){var i=this;if("loaded"!==i._state||i._playLock)return i._queue.push({event:"fade",action:function(){i.fade(t,e,r,n)}}),i;t=Math.min(Math.max(0,parseFloat(t)),1),e=Math.min(Math.max(0,parseFloat(e)),1),r=parseFloat(r),i.volume(t,n);for(var o=i._getSoundIds(n),a=0;a<o.length;a++){var s,u,h=i._soundById(o[a]);h&&(n||i._stopFade(o[a]),i._webAudio&&!h._muted&&(u=(s=_.ctx.currentTime)+r/1e3,h._volume=t,h._node.gain.setValueAtTime(t,s),h._node.gain.linearRampToValueAtTime(e,u)),i._startFadeInterval(h,t,e,r,o[a],void 0===n))}return i},_startFadeInterval:function(e,r,n,i,t,o){var a=this,s=r,u=n-r,h=Math.abs(u/.01),l=Math.max(4,0<h?i/h:i),c=Date.now();e._fadeTo=n,e._interval=setInterval(function(){var t=(Date.now()-c)/i;c=Date.now(),s+=u*t,s=u<0?Math.max(n,s):Math.min(n,s),s=Math.round(100*s)/100,a._webAudio?e._volume=s:a.volume(s,e._id,!0),o&&(a._volume=s),(n<r&&s<=n||r<n&&n<=s)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,a.volume(n,e._id),a._emit("fade",e._id))},l)},_stopFade:function(t){var e=this,r=e._soundById(t);return r&&r._interval&&(e._webAudio&&r._node.gain.cancelScheduledValues(_.ctx.currentTime),clearInterval(r._interval),r._interval=null,e.volume(r._fadeTo,t),r._fadeTo=null,e._emit("fade",t)),e},loop:function(){var t,e,r,n=this,i=arguments;if(0===i.length)return n._loop;if(1===i.length){if("boolean"!=typeof i[0])return!!(r=n._soundById(parseInt(i[0],10)))&&r._loop;t=i[0],n._loop=t}else 2===i.length&&(t=i[0],e=parseInt(i[1],10));for(var o=n._getSoundIds(e),a=0;a<o.length;a++)(r=n._soundById(o[a]))&&(r._loop=t,n._webAudio&&r._node&&r._node.bufferSource&&(r._node.bufferSource.loop=t)&&(r._node.bufferSource.loopStart=r._start||0,r._node.bufferSource.loopEnd=r._stop));return n},rate:function(){var t,e,r=this,n=arguments;if(0===n.length?e=r._sounds[0]._id:1===n.length?0<=r._getSoundIds().indexOf(n[0])?e=parseInt(n[0],10):t=parseFloat(n[0]):2===n.length&&(t=parseFloat(n[0]),e=parseInt(n[1],10)),"number"!=typeof t)return(a=r._soundById(e))?a._rate:r._rate;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"rate",action:function(){r.rate.apply(r,n)}}),r;void 0===e&&(r._rate=t),e=r._getSoundIds(e);for(var i,o,a,s=0;s<e.length;s++){(a=r._soundById(e[s]))&&(r.playing(e[s])&&(a._rateSeek=r.seek(e[s]),a._playStart=r._webAudio?_.ctx.currentTime:a._playStart),a._rate=t,r._webAudio&&a._node&&a._node.bufferSource?a._node.bufferSource.playbackRate.setValueAtTime(t,_.ctx.currentTime):a._node&&(a._node.playbackRate=t),i=r.seek(e[s]),o=1e3*((r._sprite[a._sprite][0]+r._sprite[a._sprite][1])/1e3-i)/Math.abs(a._rate),!r._endTimers[e[s]]&&a._paused||(r._clearTimer(e[s]),r._endTimers[e[s]]=setTimeout(r._ended.bind(r,a),o)),r._emit("rate",a._id))}return r},seek:function(){var t,e,r=this,n=arguments;if(0===n.length?e=r._sounds[0]._id:1===n.length?0<=r._getSoundIds().indexOf(n[0])?e=parseInt(n[0],10):r._sounds.length&&(e=r._sounds[0]._id,t=parseFloat(n[0])):2===n.length&&(t=parseFloat(n[0]),e=parseInt(n[1],10)),void 0===e)return r;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"seek",action:function(){r.seek.apply(r,n)}}),r;var i=r._soundById(e);if(i){if(!("number"==typeof t&&0<=t)){if(r._webAudio){var o=r.playing(e)?_.ctx.currentTime-i._playStart:0,a=i._rateSeek?i._rateSeek-i._seek:0;return i._seek+(a+o*Math.abs(i._rate))}return i._node.currentTime}var s=r.playing(e);s&&r.pause(e,!0),i._seek=t,i._ended=!1,r._clearTimer(e),r._webAudio||!i._node||isNaN(i._node.duration)||(i._node.currentTime=t);var u,h=function(){r._emit("seek",e),s&&r.play(e,!0)};s&&!r._webAudio?(u=function(){r._playLock?setTimeout(u,0):h()},setTimeout(u,0)):h()}return r},playing:function(t){if("number"==typeof t){var e=this._soundById(t);return!!e&&!e._paused}for(var r=0;r<this._sounds.length;r++)if(!this._sounds[r]._paused)return!0;return!1},duration:function(t){var e=this._duration,r=this._soundById(t);return r&&(e=this._sprite[r._sprite][1]/1e3),e},state:function(){return this._state},unload:function(){for(var t=this,e=t._sounds,r=0;r<e.length;r++)e[r]._paused||t.stop(e[r]._id),t._webAudio||(t._clearSound(e[r]._node),e[r]._node.removeEventListener("error",e[r]._errorFn,!1),e[r]._node.removeEventListener(_._canPlayEvent,e[r]._loadFn,!1),_._releaseHtml5Audio(e[r]._node)),delete e[r]._node,t._clearTimer(e[r]._id);var n=_._howls.indexOf(t);0<=n&&_._howls.splice(n,1);for(var i=!0,r=0;r<_._howls.length;r++)if(_._howls[r]._src===t._src||0<=t._src.indexOf(_._howls[r]._src)){i=!1;break}return a&&i&&delete a[t._src],_.noAudio=!1,t._state="unloaded",t._sounds=[],t=null},on:function(t,e,r,n){var i=this["_on"+t];return"function"==typeof e&&i.push(n?{id:r,fn:e,once:n}:{id:r,fn:e}),this},off:function(t,e,r){var n=this,i=n["_on"+t],o=0;if("number"==typeof e&&(r=e,e=null),e||r)for(o=0;o<i.length;o++){var a=r===i[o].id;if(e===i[o].fn&&a||!e&&a){i.splice(o,1);break}}else if(t)n["_on"+t]=[];else for(var s=Object.keys(n),o=0;o<s.length;o++)0===s[o].indexOf("_on")&&Array.isArray(n[s[o]])&&(n[s[o]]=[]);return n},once:function(t,e,r){return this.on(t,e,r,1),this},_emit:function(t,e,r){for(var n=this,i=n["_on"+t],o=i.length-1;0<=o;o--)i[o].id&&i[o].id!==e&&"load"!==t||(setTimeout(function(t){t.call(this,e,r)}.bind(n,i[o].fn),0),i[o].once&&n.off(t,i[o].fn,i[o].id));return n._loadQueue(t),n},_loadQueue:function(t){var e,r=this;return 0<r._queue.length&&((e=r._queue[0]).event===t&&(r._queue.shift(),r._loadQueue()),t||e.action()),r},_ended:function(t){var e=this,r=t._sprite;if(!e._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime<t._stop)return setTimeout(e._ended.bind(e,t),100),e;var n,i=!(!t._loop&&!e._sprite[r][2]);return e._emit("end",t._id),!e._webAudio&&i&&e.stop(t._id,!0).play(t._id),e._webAudio&&i&&(e._emit("play",t._id),t._seek=t._start||0,t._rateSeek=0,t._playStart=_.ctx.currentTime,n=1e3*(t._stop-t._start)/Math.abs(t._rate),e._endTimers[t._id]=setTimeout(e._ended.bind(e,t),n)),e._webAudio&&!i&&(t._paused=!0,t._ended=!0,t._seek=t._start||0,t._rateSeek=0,e._clearTimer(t._id),e._cleanBuffer(t._node),_._autoSuspend()),e._webAudio||i||e.stop(t._id,!0),e},_clearTimer:function(t){var e,r=this;return r._endTimers[t]&&("function"!=typeof r._endTimers[t]?clearTimeout(r._endTimers[t]):(e=r._soundById(t))&&e._node&&e._node.removeEventListener("ended",r._endTimers[t],!1),delete r._endTimers[t]),r},_soundById:function(t){for(var e=0;e<this._sounds.length;e++)if(t===this._sounds[e]._id)return this._sounds[e];return null},_inactiveSound:function(){var t=this;t._drain();for(var e=0;e<t._sounds.length;e++)if(t._sounds[e]._ended)return t._sounds[e].reset();return new o(t)},_drain:function(){var t=this,e=t._pool,r=0,n=0;if(!(t._sounds.length<e)){for(n=0;n<t._sounds.length;n++)t._sounds[n]._ended&&r++;for(n=t._sounds.length-1;0<=n;n--){if(r<=e)return;t._sounds[n]._ended&&(t._webAudio&&t._sounds[n]._node&&t._sounds[n]._node.disconnect(0),t._sounds.splice(n,1),r--)}}},_getSoundIds:function(t){if(void 0!==t)return[t];for(var e=[],r=0;r<this._sounds.length;r++)e.push(this._sounds[r]._id);return e},_refreshBuffer:function(t){return t._node.bufferSource=_.ctx.createBufferSource(),t._node.bufferSource.buffer=a[this._src],t._panner?t._node.bufferSource.connect(t._panner):t._node.bufferSource.connect(t._node),t._node.bufferSource.loop=t._loop,t._loop&&(t._node.bufferSource.loopStart=t._start||0,t._node.bufferSource.loopEnd=t._stop||0),t._node.bufferSource.playbackRate.setValueAtTime(t._rate,_.ctx.currentTime),this},_cleanBuffer:function(t){var e=_._navigator&&0<=_._navigator.vendor.indexOf("Apple");if(_._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),e))try{t.bufferSource.buffer=_._scratchBuffer}catch(t){}return t.bufferSource=null,this},_clearSound:function(t){/MSIE |Trident\//.test(_._navigator&&_._navigator.userAgent)||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var o=function(t){this._parent=t,this.init()};o.prototype={init:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++_._counter,e._sounds.push(t),t.create(),t},create:function(){var t=this,e=t._parent,r=_._muted||t._muted||t._parent._muted?0:t._volume;return e._webAudio?(t._node=void 0===_.ctx.createGain?_.ctx.createGainNode():_.ctx.createGain(),t._node.gain.setValueAtTime(r,_.ctx.currentTime),t._node.paused=!0,t._node.connect(_.masterGain)):_.noAudio||(t._node=_._obtainHtml5Audio(),t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(_._canPlayEvent,t._loadFn,!1),t._node.src=e._src,t._node.preload=!0===e._preload?"auto":e._preload,t._node.volume=r*_.volume(),t._node.load()),t},reset:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++_._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorFn,!1)},_loadListener:function(){var t=this._parent;t._duration=Math.ceil(10*this._node.duration)/10,0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue()),this._node.removeEventListener(_._canPlayEvent,this._loadFn,!1)}};var a={},s=function(e){var t=e._src;if(a[t])return e._duration=a[t].duration,void l(e);if(/^data:[^;]+;base64,/.test(t)){for(var r=atob(t.split(",")[1]),n=new Uint8Array(r.length),i=0;i<r.length;++i)n[i]=r.charCodeAt(i);h(n.buffer,e)}else{var o=new XMLHttpRequest;o.open(e._xhr.method,t,!0),o.withCredentials=e._xhr.withCredentials,o.responseType="arraybuffer",e._xhr.headers&&Object.keys(e._xhr.headers).forEach(function(t){o.setRequestHeader(t,e._xhr.headers[t])}),o.onload=function(){var t=(o.status+"")[0];"0"===t||"2"===t||"3"===t?h(o.response,e):e._emit("loaderror",null,"Failed loading audio file with status: "+o.status+".")},o.onerror=function(){e._webAudio&&(e._html5=!0,e._webAudio=!1,e._sounds=[],delete a[t],e.load())},u(o)}},u=function(e){try{e.send()}catch(t){e.onerror()}},h=function(t,e){function r(){e._emit("loaderror",null,"Decoding audio data failed.")}function n(t){t&&0<e._sounds.length?(a[e._src]=t,l(e,t)):r()}"undefined"!=typeof Promise&&1===_.ctx.decodeAudioData.length?_.ctx.decodeAudioData(t).then(n).catch(r):_.ctx.decodeAudioData(t,n,r)},l=function(t,e){e&&!t._duration&&(t._duration=e.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},c=function(){if(_.usingWebAudio){try{"undefined"!=typeof AudioContext?_.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?_.ctx=new webkitAudioContext:_.usingWebAudio=!1}catch(t){_.usingWebAudio=!1}_.ctx||(_.usingWebAudio=!1);var t,e=/iP(hone|od|ad)/.test(_._navigator&&_._navigator.platform),r=_._navigator&&_._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),n=r?parseInt(r[1],10):null;e&&n&&n<9&&(t=/safari/.test(_._navigator&&_._navigator.userAgent.toLowerCase()),_._navigator&&!t&&(_.usingWebAudio=!1)),_.usingWebAudio&&(_.masterGain=void 0===_.ctx.createGain?_.ctx.createGainNode():_.ctx.createGain(),_.masterGain.gain.setValueAtTime(_._muted?0:_._volume,_.ctx.currentTime),_.masterGain.connect(_.ctx.destination)),_._setup()}};void 0===(n=function(){return{Howler:_,Howl:e}}.apply(f,[]))||(i.exports=n),f.Howler=_,f.Howl=e,void 0!==r?(r.HowlerGlobal=t,r.Howler=_,r.Howl=e,r.Sound=o):"undefined"!=typeof window&&(window.HowlerGlobal=t,window.Howler=_,window.Howl=e,window.Sound=o)}(),function(){"use strict";var r,n,i;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var e=this;if(!e.ctx||!e.ctx.listener)return e;for(var r=e._howls.length-1;0<=r;r--)e._howls[r].stereo(t);return e},HowlerGlobal.prototype.pos=function(t,e,r){var n=this;return n.ctx&&n.ctx.listener?(e="number"!=typeof e?n._pos[1]:e,r="number"!=typeof r?n._pos[2]:r,"number"!=typeof t?n._pos:(n._pos=[t,e,r],void 0!==n.ctx.listener.positionX?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]),n)):n},HowlerGlobal.prototype.orientation=function(t,e,r,n,i,o){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return e="number"!=typeof e?s[1]:e,r="number"!=typeof r?s[2]:r,n="number"!=typeof n?s[3]:n,i="number"!=typeof i?s[4]:i,o="number"!=typeof o?s[5]:o,"number"!=typeof t?s:(a._orientation=[t,e,r,n,i,o],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(i,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(o,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(t,e,r,n,i,o),a)},Howl.prototype.init=(r=Howl.prototype.init,function(t){var e=this;return e._orientation=t.orientation||[1,0,0],e._stereo=t.stereo||null,e._pos=t.pos||null,e._pannerAttr={coneInnerAngle:void 0!==t.coneInnerAngle?t.coneInnerAngle:360,coneOuterAngle:void 0!==t.coneOuterAngle?t.coneOuterAngle:360,coneOuterGain:void 0!==t.coneOuterGain?t.coneOuterGain:0,distanceModel:void 0!==t.distanceModel?t.distanceModel:"inverse",maxDistance:void 0!==t.maxDistance?t.maxDistance:1e4,panningModel:void 0!==t.panningModel?t.panningModel:"HRTF",refDistance:void 0!==t.refDistance?t.refDistance:1,rolloffFactor:void 0!==t.rolloffFactor?t.rolloffFactor:1},e._onstereo=t.onstereo?[{fn:t.onstereo}]:[],e._onpos=t.onpos?[{fn:t.onpos}]:[],e._onorientation=t.onorientation?[{fn:t.onorientation}]:[],r.call(this,t)}),Howl.prototype.stereo=function(t,e){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(t,e)}}),r;var n=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===e){if("number"!=typeof t)return r._stereo;r._stereo=t,r._pos=[t,0,0]}for(var i=r._getSoundIds(e),o=0;o<i.length;o++){var a=r._soundById(i[o]);if(a){if("number"!=typeof t)return a._stereo;a._stereo=t,a._pos=[t,0,0],a._node&&(a._pannerAttr.panningModel="equalpower",a._panner&&a._panner.pan||h(a,n),"spatial"==n?void 0!==a._panner.positionX?(a._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),a._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),a._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):a._panner.setPosition(t,0,0):a._panner.pan.setValueAtTime(t,Howler.ctx.currentTime)),r._emit("stereo",a._id)}}return r},Howl.prototype.pos=function(t,e,r,n){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"pos",action:function(){i.pos(t,e,r,n)}}),i;if(e="number"!=typeof e?0:e,r="number"!=typeof r?-.5:r,void 0===n){if("number"!=typeof t)return i._pos;i._pos=[t,e,r]}for(var o=i._getSoundIds(n),a=0;a<o.length;a++){var s=i._soundById(o[a]);if(s){if("number"!=typeof t)return s._pos;s._pos=[t,e,r],s._node&&(s._panner&&!s._panner.pan||h(s,"spatial"),void 0!==s._panner.positionX?(s._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),s._panner.positionY.setValueAtTime(e,Howler.ctx.currentTime),s._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):s._panner.setPosition(t,e,r)),i._emit("pos",s._id)}}return i},Howl.prototype.orientation=function(t,e,r,n){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"orientation",action:function(){i.orientation(t,e,r,n)}}),i;if(e="number"!=typeof e?i._orientation[1]:e,r="number"!=typeof r?i._orientation[2]:r,void 0===n){if("number"!=typeof t)return i._orientation;i._orientation=[t,e,r]}for(var o=i._getSoundIds(n),a=0;a<o.length;a++){var s=i._soundById(o[a]);if(s){if("number"!=typeof t)return s._orientation;s._orientation=[t,e,r],s._node&&(s._panner||(s._pos||(s._pos=i._pos||[0,0,-.5]),h(s,"spatial")),void 0!==s._panner.orientationX?(s._panner.orientationX.setValueAtTime(t,Howler.ctx.currentTime),s._panner.orientationY.setValueAtTime(e,Howler.ctx.currentTime),s._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):s._panner.setOrientation(t,e,r)),i._emit("orientation",s._id)}}return i},Howl.prototype.pannerAttr=function(){var t,e,r=this,n=arguments;if(!r._webAudio)return r;if(0===n.length)return r._pannerAttr;if(1===n.length){if("object"!=typeof n[0])return(a=r._soundById(parseInt(n[0],10)))?a._pannerAttr:r._pannerAttr;t=n[0],void 0===e&&(t.pannerAttr||(t.pannerAttr={coneInnerAngle:t.coneInnerAngle,coneOuterAngle:t.coneOuterAngle,coneOuterGain:t.coneOuterGain,distanceModel:t.distanceModel,maxDistance:t.maxDistance,refDistance:t.refDistance,rolloffFactor:t.rolloffFactor,panningModel:t.panningModel}),r._pannerAttr={coneInnerAngle:void 0!==t.pannerAttr.coneInnerAngle?t.pannerAttr.coneInnerAngle:r._coneInnerAngle,coneOuterAngle:void 0!==t.pannerAttr.coneOuterAngle?t.pannerAttr.coneOuterAngle:r._coneOuterAngle,coneOuterGain:void 0!==t.pannerAttr.coneOuterGain?t.pannerAttr.coneOuterGain:r._coneOuterGain,distanceModel:void 0!==t.pannerAttr.distanceModel?t.pannerAttr.distanceModel:r._distanceModel,maxDistance:void 0!==t.pannerAttr.maxDistance?t.pannerAttr.maxDistance:r._maxDistance,refDistance:void 0!==t.pannerAttr.refDistance?t.pannerAttr.refDistance:r._refDistance,rolloffFactor:void 0!==t.pannerAttr.rolloffFactor?t.pannerAttr.rolloffFactor:r._rolloffFactor,panningModel:void 0!==t.pannerAttr.panningModel?t.pannerAttr.panningModel:r._panningModel})}else 2===n.length&&(t=n[0],e=parseInt(n[1],10));for(var i,o,a,s=r._getSoundIds(e),u=0;u<s.length;u++){(a=r._soundById(s[u]))&&(i=a._pannerAttr,i={coneInnerAngle:void 0!==t.coneInnerAngle?t.coneInnerAngle:i.coneInnerAngle,coneOuterAngle:void 0!==t.coneOuterAngle?t.coneOuterAngle:i.coneOuterAngle,coneOuterGain:void 0!==t.coneOuterGain?t.coneOuterGain:i.coneOuterGain,distanceModel:void 0!==t.distanceModel?t.distanceModel:i.distanceModel,maxDistance:void 0!==t.maxDistance?t.maxDistance:i.maxDistance,refDistance:void 0!==t.refDistance?t.refDistance:i.refDistance,rolloffFactor:void 0!==t.rolloffFactor?t.rolloffFactor:i.rolloffFactor,panningModel:void 0!==t.panningModel?t.panningModel:i.panningModel},(o=a._panner)?(o.coneInnerAngle=i.coneInnerAngle,o.coneOuterAngle=i.coneOuterAngle,o.coneOuterGain=i.coneOuterGain,o.distanceModel=i.distanceModel,o.maxDistance=i.maxDistance,o.refDistance=i.refDistance,o.rolloffFactor=i.rolloffFactor,o.panningModel=i.panningModel):(a._pos||(a._pos=r._pos||[0,0,-.5]),h(a,"spatial")))}return r},Sound.prototype.init=(n=Sound.prototype.init,function(){var t=this,e=t._parent;t._orientation=e._orientation,t._stereo=e._stereo,t._pos=e._pos,t._pannerAttr=e._pannerAttr,n.call(this),t._stereo?e.stereo(t._stereo):t._pos&&e.pos(t._pos[0],t._pos[1],t._pos[2],t._id)}),Sound.prototype.reset=(i=Sound.prototype.reset,function(){var t=this,e=t._parent;return t._orientation=e._orientation,t._stereo=e._stereo,t._pos=e._pos,t._pannerAttr=e._pannerAttr,t._stereo?e.stereo(t._stereo):t._pos?e.pos(t._pos[0],t._pos[1],t._pos[2],t._id):t._panner&&(t._panner.disconnect(0),t._panner=void 0,e._refreshBuffer(t)),i.call(this)});var h=function(t,e){"spatial"===(e=e||"spatial")?(t._panner=Howler.ctx.createPanner(),t._panner.coneInnerAngle=t._pannerAttr.coneInnerAngle,t._panner.coneOuterAngle=t._pannerAttr.coneOuterAngle,t._panner.coneOuterGain=t._pannerAttr.coneOuterGain,t._panner.distanceModel=t._pannerAttr.distanceModel,t._panner.maxDistance=t._pannerAttr.maxDistance,t._panner.refDistance=t._pannerAttr.refDistance,t._panner.rolloffFactor=t._pannerAttr.rolloffFactor,t._panner.panningModel=t._pannerAttr.panningModel,void 0!==t._panner.positionX?(t._panner.positionX.setValueAtTime(t._pos[0],Howler.ctx.currentTime),t._panner.positionY.setValueAtTime(t._pos[1],Howler.ctx.currentTime),t._panner.positionZ.setValueAtTime(t._pos[2],Howler.ctx.currentTime)):t._panner.setPosition(t._pos[0],t._pos[1],t._pos[2]),void 0!==t._panner.orientationX?(t._panner.orientationX.setValueAtTime(t._orientation[0],Howler.ctx.currentTime),t._panner.orientationY.setValueAtTime(t._orientation[1],Howler.ctx.currentTime),t._panner.orientationZ.setValueAtTime(t._orientation[2],Howler.ctx.currentTime)):t._panner.setOrientation(t._orientation[0],t._orientation[1],t._orientation[2])):(t._panner=Howler.ctx.createStereoPanner(),t._panner.pan.setValueAtTime(t._stereo,Howler.ctx.currentTime)),t._panner.connect(t._node),t._paused||t._parent.pause(t._id,!0).play(t._id,!0)}}()}).call(this,t(5))},function(t,e,r){"use strict";var n=r(29),i=r(30),o=r(36);t.exports=function(t){var e=t.length;{if(0===e)return[];if(1===e)return[[0]]}var r=t[0].length;{if(0===r)return[];if(1===r)return n(t);if(2===r)return i(t)}return o(t,r)}},function(e,kt,Bt){var Ut;!function(){"use strict";var c,C,a,s=9e15,v=1e9,m="0123456789abcdef",n="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",i="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",u={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-s,maxE:s,crypto:!1},_=!0,h="[DecimalError] ",g=h+"Invalid argument: ",o=h+"Precision limit exceeded",l=h+"crypto unavailable",I=Math.floor,y=Math.pow,f=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,d=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,p=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,x=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,N=1e7,D=7,b=n.length-1,w=i.length-1,T={name:"[object Decimal]"};function E(t){var e,r,n,i=t.length-1,o="",a=t[0];if(0<i){for(o+=a,e=1;e<i;e++)n=t[e]+"",(r=D-n.length)&&(o+=H(r)),o+=n;a=t[e],(r=D-(n=a+"").length)&&(o+=H(r))}else if(0===a)return"0";for(;a%10==0;)a/=10;return o+a}function A(t,e,r){if(t!==~~t||t<e||r<t)throw Error(g+t)}function S(t,e,r,n){for(var i,o,a=t[0];10<=a;a/=10)--e;return--e<0?(e+=D,i=0):(i=Math.ceil((e+1)/D),e%=D),a=y(10,D-e),o=t[i]%a|0,null==n?e<3?(0==e?o=o/100|0:1==e&&(o=o/10|0),r<4&&99999==o||3<r&&49999==o||5e4==o||0==o):(r<4&&o+1==a||3<r&&o+1==a/2)&&(t[i+1]/a/100|0)==y(10,e-2)-1||(o==a/2||0==o)&&0==(t[i+1]/a/100|0):e<4?(0==e?o=o/1e3|0:1==e?o=o/100|0:2==e&&(o=o/10|0),(n||r<4)&&9999==o||!n&&3<r&&4999==o):((n||r<4)&&o+1==a||!n&&3<r&&o+1==a/2)&&(t[i+1]/a/1e3|0)==y(10,e-3)-1}function O(t,e,r){for(var n,i,o=[0],a=0,s=t.length;a<s;){for(i=o.length;i--;)o[i]*=e;for(o[0]+=m.indexOf(t.charAt(a++)),n=0;n<o.length;n++)o[n]>r-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}T.absoluteValue=T.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),k(t)},T.ceil=function(){return k(new this.constructor(this),this.e+1,2)},T.comparedTo=T.cmp=function(t){var e,r,n,i,o=this,a=o.d,s=(t=new o.constructor(t)).d,u=o.s,h=t.s;if(!a||!s)return u&&h?u!==h?u:a===s?0:!a^u<0?1:-1:NaN;if(!a[0]||!s[0])return a[0]?u:s[0]?-h:0;if(u!==h)return u;if(o.e!==t.e)return o.e>t.e^u<0?1:-1;for(e=0,r=(n=a.length)<(i=s.length)?n:i;e<r;++e)if(a[e]!==s[e])return a[e]>s[e]^u<0?1:-1;return n===i?0:i<n^u<0?1:-1},T.cosine=T.cos=function(){var t,e,r=this,n=r.constructor;return r.d?r.d[0]?(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+D,n.rounding=1,r=function(t,e){var r,n,i=e.d.length;n=i<32?(r=Math.ceil(i/3),(1/K(4,r)).toString()):(r=16,"2.3283064365386962890625e-10");t.precision+=r,e=Z(t,1,e.times(n),new t(1));for(var o=r;o--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return t.precision-=r,e}(n,$(n,r)),n.precision=t,n.rounding=e,k(2==a||3==a?r.neg():r,t,e,!0)):new n(1):new n(NaN)},T.cubeRoot=T.cbrt=function(){var t,e,r,n,i,o,a,s,u,h,l=this,c=l.constructor;if(!l.isFinite()||l.isZero())return new c(l);for(_=!1,(o=l.s*y(l.s*l,1/3))&&Math.abs(o)!=1/0?n=new c(o.toString()):(r=E(l.d),(o=((t=l.e)-r.length+1)%3)&&(r+=1==o||-2==o?"0":"00"),o=y(r,1/3),t=I((t+1)/3)-(t%3==(t<0?-1:2)),(n=new c(r=o==1/0?"5e"+t:(r=o.toExponential()).slice(0,r.indexOf("e")+1)+t)).s=l.s),a=(t=c.precision)+3;;)if(h=(u=(s=n).times(s).times(s)).plus(l),n=M(h.plus(l).times(s),h.plus(u),a+2,1),E(s.d).slice(0,a)===(r=E(n.d)).slice(0,a)){if("9999"!=(r=r.slice(a-3,a+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(k(n,t+1,1),e=!n.times(n).times(n).eq(l));break}if(!i&&(k(s,t+1,0),s.times(s).times(s).eq(l))){n=s;break}a+=4,i=1}return _=!0,k(n,t,c.rounding,e)},T.decimalPlaces=T.dp=function(){var t,e=this.d,r=NaN;if(e){if(r=((t=e.length-1)-I(this.e/D))*D,t=e[t])for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r},T.dividedBy=T.div=function(t){return M(this,new this.constructor(t))},T.dividedToIntegerBy=T.divToInt=function(t){var e=this.constructor;return k(M(this,new e(t),0,1,1),e.precision,e.rounding)},T.equals=T.eq=function(t){return 0===this.cmp(t)},T.floor=function(){return k(new this.constructor(this),this.e+1,3)},T.greaterThan=T.gt=function(t){return 0<this.cmp(t)},T.greaterThanOrEqualTo=T.gte=function(t){var e=this.cmp(t);return 1==e||0===e},T.hyperbolicCosine=T.cosh=function(){var t,e,r,n,i,o=this,a=o.constructor,s=new a(1);if(!o.isFinite())return new a(o.s?1/0:NaN);if(o.isZero())return s;r=a.precision,n=a.rounding,a.precision=r+Math.max(o.e,o.sd())+4,a.rounding=1,e=(i=o.d.length)<32?(1/K(4,t=Math.ceil(i/3))).toString():(t=16,"2.3283064365386962890625e-10"),o=Z(a,1,o.times(e),new a(1),!0);for(var u,h=t,l=new a(8);h--;)u=o.times(o),o=s.minus(u.times(l.minus(u.times(l))));return k(o,a.precision=r,a.rounding=n,!0)},T.hyperbolicSine=T.sinh=function(){var t,e,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,r=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,(n=i.d.length)<3)i=Z(o,2,i,i,!0);else{t=16<(t=1.4*Math.sqrt(n))?16:0|t,i=Z(o,2,i=i.times(1/K(5,t)),i,!0);for(var a,s=new o(5),u=new o(16),h=new o(20);t--;)a=i.times(i),i=i.times(s.plus(a.times(u.times(a).plus(h))))}return k(i,o.precision=e,o.rounding=r,!0)},T.hyperbolicTangent=T.tanh=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+7,n.rounding=1,M(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)},T.inverseCosine=T.acos=function(){var t,e=this,r=e.constructor,n=e.abs().cmp(1),i=r.precision,o=r.rounding;return-1!==n?0===n?e.isNeg()?j(r,i,o):new r(0):new r(NaN):e.isZero()?j(r,i+4,o).times(.5):(r.precision=i+6,r.rounding=1,e=e.asin(),t=j(r,i+4,o).times(.5),r.precision=i,r.rounding=o,t.minus(e))},T.inverseHyperbolicCosine=T.acosh=function(){var t,e,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(t=n.precision,e=n.rounding,n.precision=t+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,_=!1,r=r.times(r).minus(1).sqrt().plus(r),_=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)},T.inverseHyperbolicSine=T.asinh=function(){var t,e,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,_=!1,r=r.times(r).plus(1).sqrt().plus(r),_=!0,n.precision=t,n.rounding=e,r.ln())},T.inverseHyperbolicTangent=T.atanh=function(){var t,e,r,n,i=this,o=i.constructor;return i.isFinite()?0<=i.e?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,n=i.sd(),Math.max(n,t)<2*-i.e-1?k(new o(i),t,e,!0):(o.precision=r=n-i.e,i=M(i.plus(1),new o(1).minus(i),r+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5))):new o(NaN)},T.inverseSine=T.asin=function(){var t,e,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),r=o.precision,n=o.rounding,-1!==e?0===e?((t=j(o,r+4,n).times(.5)).s=i.s,t):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2)))},T.inverseTangent=T.atan=function(){var t,e,r,n,i,o,a,s,u,h=this,l=h.constructor,c=l.precision,f=l.rounding;if(h.isFinite()){if(h.isZero())return new l(h);if(h.abs().eq(1)&&c+4<=w)return(a=j(l,c+4,f).times(.25)).s=h.s,a}else{if(!h.s)return new l(NaN);if(c+4<=w)return(a=j(l,c+4,f).times(.5)).s=h.s,a}for(l.precision=s=c+10,l.rounding=1,t=r=Math.min(28,s/D+2|0);t;--t)h=h.div(h.times(h).plus(1).sqrt().plus(1));for(_=!1,e=Math.ceil(s/D),n=1,u=h.times(h),a=new l(h),i=h;-1!==t;)if(i=i.times(u),o=a.minus(i.div(n+=2)),i=i.times(u),void 0!==(a=o.plus(i.div(n+=2))).d[e])for(t=e;a.d[t]===o.d[t]&&t--;);return r&&(a=a.times(2<<r-1)),_=!0,k(a,l.precision=c,l.rounding=f,!0)},T.isFinite=function(){return!!this.d},T.isInteger=T.isInt=function(){return!!this.d&&I(this.e/D)>this.d.length-2},T.isNaN=function(){return!this.s},T.isNegative=T.isNeg=function(){return this.s<0},T.isPositive=T.isPos=function(){return 0<this.s},T.isZero=function(){return!!this.d&&0===this.d[0]},T.lessThan=T.lt=function(t){return this.cmp(t)<0},T.lessThanOrEqualTo=T.lte=function(t){return this.cmp(t)<1},T.logarithm=T.log=function(t){var e,r,n,i,o,a,s,u,h=this,l=h.constructor,c=l.precision,f=l.rounding;if(null==t)t=new l(10),e=!0;else{if(r=(t=new l(t)).d,t.s<0||!r||!r[0]||t.eq(1))return new l(NaN);e=t.eq(10)}if(r=h.d,h.s<0||!r||!r[0]||h.eq(1))return new l(r&&!r[0]?-1/0:1!=h.s?NaN:r?0:1/0);if(e)if(1<r.length)o=!0;else{for(i=r[0];i%10==0;)i/=10;o=1!==i}if(_=!1,a=Y(h,s=c+5),n=e?U(l,s+10):Y(t,s),S((u=M(a,n,s,1)).d,i=c,f))do{if(a=Y(h,s+=10),n=e?U(l,s+10):Y(t,s),u=M(a,n,s,1),!o){+E(u.d).slice(i+1,i+15)+1==1e14&&(u=k(u,c+1,0));break}}while(S(u.d,i+=10,f));return _=!0,k(u,c,f)},T.minus=T.sub=function(t){var e,r,n,i,o,a,s,u,h,l,c,f,d=this,p=d.constructor;if(t=new p(t),!d.d||!t.d)return d.s&&t.s?d.d?t.s=-t.s:t=new p(t.d||d.s!==t.s?d:NaN):t=new p(NaN),t;if(d.s!=t.s)return t.s=-t.s,d.plus(t);if(h=d.d,f=t.d,s=p.precision,u=p.rounding,!h[0]||!f[0]){if(f[0])t.s=-t.s;else{if(!h[0])return new p(3===u?-0:0);t=new p(d)}return _?k(t,s,u):t}if(r=I(t.e/D),l=I(d.e/D),h=h.slice(),o=l-r){for(a=(c=o<0)?(e=h,o=-o,f.length):(e=f,r=l,h.length),(n=Math.max(Math.ceil(s/D),a)+2)<o&&(o=n,e.length=1),e.reverse(),n=o;n--;)e.push(0);e.reverse()}else{for((c=(n=h.length)<(a=f.length))&&(a=n),n=0;n<a;n++)if(h[n]!=f[n]){c=h[n]<f[n];break}o=0}for(c&&(e=h,h=f,f=e,t.s=-t.s),a=h.length,n=f.length-a;0<n;--n)h[a++]=0;for(n=f.length;o<n;){if(h[--n]<f[n]){for(i=n;i&&0===h[--i];)h[i]=N-1;--h[i],h[n]+=N}h[n]-=f[n]}for(;0===h[--a];)h.pop();for(;0===h[0];h.shift())--r;return h[0]?(t.d=h,t.e=B(h,r),_?k(t,s,u):t):new p(3===u?-0:0)},T.modulo=T.mod=function(t){var e,r=this,n=r.constructor;return t=new n(t),!r.d||!t.s||t.d&&!t.d[0]?new n(NaN):!t.d||r.d&&!r.d[0]?k(new n(r),n.precision,n.rounding):(_=!1,9==n.modulo?(e=M(r,t.abs(),0,3,1)).s*=t.s:e=M(r,t,0,n.modulo,1),e=e.times(t),_=!0,r.minus(e))},T.naturalExponential=T.exp=function(){return V(this)},T.naturalLogarithm=T.ln=function(){return Y(this)},T.negated=T.neg=function(){var t=new this.constructor(this);return t.s=-t.s,k(t)},T.plus=T.add=function(t){var e,r,n,i,o,a,s,u,h,l,c=this,f=c.constructor;if(t=new f(t),!c.d||!t.d)return c.s&&t.s?c.d||(t=new f(t.d||c.s===t.s?c:NaN)):t=new f(NaN),t;if(c.s!=t.s)return t.s=-t.s,c.minus(t);if(h=c.d,l=t.d,s=f.precision,u=f.rounding,!h[0]||!l[0])return l[0]||(t=new f(c)),_?k(t,s,u):t;if(o=I(c.e/D),n=I(t.e/D),h=h.slice(),i=o-n){for((a=(a=i<0?(r=h,i=-i,l.length):(r=l,n=o,h.length))<(o=Math.ceil(s/D))?o+1:a+1)<i&&(i=a,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((a=h.length)-(i=l.length)<0&&(i=a,r=l,l=h,h=r),e=0;i;)e=(h[--i]=h[i]+l[i]+e)/N|0,h[i]%=N;for(e&&(h.unshift(e),++n),a=h.length;0==h[--a];)h.pop();return t.d=h,t.e=B(h,n),_?k(t,s,u):t},T.precision=T.sd=function(t){var e;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(g+t);return this.d?(e=z(this.d),t&&this.e+1>e&&(e=this.e+1)):e=NaN,e},T.round=function(){var t=this.constructor;return k(new t(this),this.e+1,t.rounding)},T.sine=T.sin=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+D,n.rounding=1,r=function(t,e){var r,n=e.d.length;if(n<3)return Z(t,2,e,e);r=16<(r=1.4*Math.sqrt(n))?16:0|r,e=e.times(1/K(5,r)),e=Z(t,2,e,e);for(var i,o=new t(5),a=new t(16),s=new t(20);r--;)i=e.times(e),e=e.times(o.plus(i.times(a.times(i).minus(s))));return e}(n,$(n,r)),n.precision=t,n.rounding=e,k(2<a?r.neg():r,t,e,!0)):new n(NaN)},T.squareRoot=T.sqrt=function(){var t,e,r,n,i,o,a=this,s=a.d,u=a.e,h=a.s,l=a.constructor;if(1!==h||!s||!s[0])return new l(!h||h<0&&(!s||s[0])?NaN:s?a:1/0);for(_=!1,n=0==(h=Math.sqrt(+a))||h==1/0?(((e=E(s)).length+u)%2==0&&(e+="0"),h=Math.sqrt(e),u=I((u+1)/2)-(u<0||u%2),new l(e=h==1/0?"1e"+u:(e=h.toExponential()).slice(0,e.indexOf("e")+1)+u)):new l(h.toString()),r=(u=l.precision)+3;;)if(n=(o=n).plus(M(a,o,r+2,1)).times(.5),E(o.d).slice(0,r)===(e=E(n.d)).slice(0,r)){if("9999"!=(e=e.slice(r-3,r+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(k(n,u+1,1),t=!n.times(n).eq(a));break}if(!i&&(k(o,u+1,0),o.times(o).eq(a))){n=o;break}r+=4,i=1}return _=!0,k(n,u,l.rounding,t)},T.tangent=T.tan=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+10,n.rounding=1,(r=r.sin()).s=1,r=M(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,k(2==a||4==a?r.neg():r,t,e,!0)):new n(NaN)},T.times=T.mul=function(t){var e,r,n,i,o,a,s,u,h,l=this.constructor,c=this.d,f=(t=new l(t)).d;if(t.s*=this.s,!(c&&c[0]&&f&&f[0]))return new l(!t.s||c&&!c[0]&&!f||f&&!f[0]&&!c?NaN:c&&f?0*t.s:t.s/0);for(r=I(this.e/D)+I(t.e/D),(u=c.length)<(h=f.length)&&(o=c,c=f,f=o,a=u,u=h,h=a),o=[],n=a=u+h;n--;)o.push(0);for(n=h;0<=--n;){for(e=0,i=u+n;n<i;)s=o[i]+f[n]*c[i-n-1]+e,o[i--]=s%N|0,e=s/N|0;o[i]=(o[i]+e)%N|0}for(;!o[--a];)o.pop();return e?++r:o.shift(),t.d=o,t.e=B(o,r),_?k(t,l.precision,l.rounding):t},T.toBinary=function(t,e){return r(this,2,t,e)},T.toDecimalPlaces=T.toDP=function(t,e){var r=this.constructor,n=new r(this);return void 0===t?n:(A(t,0,v),void 0===e?e=r.rounding:A(e,0,8),k(n,t+n.e+1,e))},T.toExponential=function(t,e){var r=this,n=r.constructor,i=void 0===t?P(r,!0):(A(t,0,v),void 0===e?e=n.rounding:A(e,0,8),P(r=k(new n(r),t+1,e),!0,t+1));return r.isNeg()&&!r.isZero()?"-"+i:i},T.toFixed=function(t,e){var r,n=this,i=n.constructor,o=void 0===t?P(n):(A(t,0,v),void 0===e?e=i.rounding:A(e,0,8),P(r=k(new i(n),t+n.e+1,e),!1,t+r.e+1));return n.isNeg()&&!n.isZero()?"-"+o:o},T.toFraction=function(t){var e,r,n,i,o,a,s,u,h,l,c,f,d=this,p=d.d,v=d.constructor;if(!p)return new v(d);if(h=r=new v(1),n=u=new v(0),a=(o=(e=new v(n)).e=z(p)-d.e-1)%D,e.d[0]=y(10,a<0?D+a:a),null==t)t=0<o?e:h;else{if(!(s=new v(t)).isInt()||s.lt(h))throw Error(g+s);t=s.gt(e)?0<o?e:h:s}for(_=!1,s=new v(E(p)),l=v.precision,v.precision=o=p.length*D*2;c=M(s,e,0,1,1),1!=(i=r.plus(c.times(n))).cmp(t);)r=n,n=i,i=h,h=u.plus(c.times(i)),u=i,i=e,e=s.minus(c.times(i)),s=i;return i=M(t.minus(r),n,0,1,1),u=u.plus(i.times(h)),r=r.plus(i.times(n)),u.s=h.s=d.s,f=M(h,n,o,1).minus(d).abs().cmp(M(u,r,o,1).minus(d).abs())<1?[h,n]:[u,r],v.precision=l,_=!0,f},T.toHexadecimal=T.toHex=function(t,e){return r(this,16,t,e)},T.toNearest=function(t,e){var r=(n=this).constructor,n=new r(n);if(null==t){if(!n.d)return n;t=new r(1),e=r.rounding}else{if(t=new r(t),void 0===e?e=r.rounding:A(e,0,8),!n.d)return t.s?n:t;if(!t.d)return t.s&&(t.s=n.s),t}return t.d[0]?(_=!1,n=M(n,t,0,e,1).times(t),_=!0,k(n)):(t.s=n.s,n=t),n},T.toNumber=function(){return+this},T.toOctal=function(t,e){return r(this,8,t,e)},T.toPower=T.pow=function(t){var e,r,n,i,o,a,s=this,u=s.constructor,h=+(t=new u(t));if(!(s.d&&t.d&&s.d[0]&&t.d[0]))return new u(y(+s,h));if((s=new u(s)).eq(1))return s;if(n=u.precision,o=u.rounding,t.eq(1))return k(s,n,o);if((e=I(t.e/D))>=t.d.length-1&&(r=h<0?-h:h)<=9007199254740991)return i=G(u,s,r,n),t.s<0?new u(1).div(i):k(i,n,o);if((a=s.s)<0){if(e<t.d.length-1)return new u(NaN);if(0==(1&t.d[e])&&(a=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=a,s}return(e=0!=(r=y(+s,h))&&isFinite(r)?new u(r+"").e:I(h*(Math.log("0."+E(s.d))/Math.LN10+s.e+1)))>u.maxE+1||e<u.minE-1?new u(0<e?a/0:0):(_=!1,u.rounding=s.s=1,r=Math.min(12,(e+"").length),(i=V(t.times(Y(s,n+r)),n)).d&&S((i=k(i,n+5,1)).d,n,o)&&(e=n+10,+E((i=k(V(t.times(Y(s,e+r)),e),e+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=k(i,n+1,0))),i.s=a,_=!0,k(i,n,u.rounding=o))},T.toPrecision=function(t,e){var r=this,n=r.constructor,i=void 0===t?P(r,r.e<=n.toExpNeg||r.e>=n.toExpPos):(A(t,1,v),void 0===e?e=n.rounding:A(e,0,8),P(r=k(new n(r),t,e),t<=r.e||r.e<=n.toExpNeg,t));return r.isNeg()&&!r.isZero()?"-"+i:i},T.toSignificantDigits=T.toSD=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(A(t,1,v),void 0===e?e=r.rounding:A(e,0,8)),k(new r(this),t,e)},T.toString=function(){var t=this,e=t.constructor,r=P(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r},T.truncated=T.trunc=function(){return k(new this.constructor(this),this.e+1,1)},T.valueOf=T.toJSON=function(){var t=this,e=t.constructor,r=P(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};var M=function(t,e,r,n,i,o){var a,s,u,h,l,c,f,d,p,v,m,g,y,_,x,b,w,T,E,A,S=t.constructor,O=t.s==e.s?1:-1,M=t.d,P=e.d;if(!(M&&M[0]&&P&&P[0]))return new S(t.s&&e.s&&(M?!P||M[0]!=P[0]:P)?M&&0==M[0]||!P?0*O:O/0:NaN);for(s=o?(l=1,t.e-e.e):(o=N,l=D,I(t.e/l)-I(e.e/l)),E=P.length,w=M.length,v=(p=new S(O)).d=[],u=0;P[u]==(M[u]||0);u++);if(P[u]>(M[u]||0)&&s--,null==r?(_=r=S.precision,n=S.rounding):_=i?r+(t.e-e.e)+1:r,_<0)v.push(1),c=!0;else{if(_=_/l+2|0,u=0,1==E){for(P=P[h=0],_++;(u<w||h)&&_--;u++)x=h*o+(M[u]||0),v[u]=x/P|0,h=x%P|0;c=h||u<w}else{for(1<(h=o/(P[0]+1)|0)&&(P=R(P,h,o),M=R(M,h,o),E=P.length,w=M.length),b=E,g=(m=M.slice(0,E)).length;g<E;)m[g++]=0;for((A=P.slice()).unshift(0),T=P[0],P[1]>=o/2&&++T;h=0,(a=F(P,m,E,g))<0?(y=m[0],E!=g&&(y=y*o+(m[1]||0)),1<(h=y/T|0)?(o<=h&&(h=o-1),1==(a=F(f=R(P,h,o),m,d=f.length,g=m.length))&&(h--,L(f,E<d?A:P,d,o))):(0==h&&(a=h=1),f=P.slice()),(d=f.length)<g&&f.unshift(0),L(m,f,g,o),-1==a&&(a=F(P,m,E,g=m.length))<1&&(h++,L(m,E<g?A:P,g,o)),g=m.length):0===a&&(h++,m=[0]),v[u++]=h,a&&m[0]?m[g++]=M[b]||0:(m=[M[b]],g=1),(b++<w||void 0!==m[0])&&_--;);c=void 0!==m[0]}v[0]||v.shift()}if(1==l)p.e=s,C=c;else{for(u=1,h=v[0];10<=h;h/=10)u++;p.e=u+s*l-1,k(p,i?r+p.e+1:r,n,c)}return p};function R(t,e,r){var n,i=0,o=t.length;for(t=t.slice();o--;)n=t[o]*e+i,t[o]=n%r|0,i=n/r|0;return i&&t.unshift(i),t}function F(t,e,r,n){var i,o;if(r!=n)o=n<r?1:-1;else for(i=o=0;i<r;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function L(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&1<t.length;)t.shift()}function k(t,e,r,n){var i,o,a,s,u,h,l,c,f,d=t.constructor;t:if(null!=e){if(!(c=t.d))return t;for(i=1,s=c[0];10<=s;s/=10)i++;if((o=e-i)<0)o+=D,a=e,u=(l=c[f=0])/y(10,i-a-1)%10|0;else if(f=Math.ceil((o+1)/D),(s=c.length)<=f){if(!n)break t;for(;s++<=f;)c.push(0);l=u=0,a=(o%=D)-D+(i=1)}else{for(l=s=c[f],i=1;10<=s;s/=10)i++;u=(a=(o%=D)-D+i)<0?0:l/y(10,i-a-1)%10|0}if(n=n||e<0||void 0!==c[f+1]||(a<0?l:l%y(10,i-a-1)),h=r<4?(u||n)&&(0==r||r==(t.s<0?3:2)):5<u||5==u&&(4==r||n||6==r&&(0<o?0<a?l/y(10,i-a):0:c[f-1])%10&1||r==(t.s<0?8:7)),e<1||!c[0])return c.length=0,h?(e-=t.e+1,c[0]=y(10,(D-e%D)%D),t.e=-e||0):c[0]=t.e=0,t;if(0==o?(c.length=f,s=1,f--):(c.length=f+1,s=y(10,D-o),c[f]=0<a?(l/y(10,i-a)%y(10,a)|0)*s:0),h)for(;;){if(0==f){for(o=1,a=c[0];10<=a;a/=10)o++;for(a=c[0]+=s,s=1;10<=a;a/=10)s++;o!=s&&(t.e++,c[0]==N&&(c[0]=1));break}if(c[f]+=s,c[f]!=N)break;c[f--]=0,s=1}for(o=c.length;0===c[--o];)c.pop()}return _&&(t.e>d.maxE?(t.d=null,t.e=NaN):t.e<d.minE&&(t.e=0,t.d=[0])),t}function P(t,e,r){if(!t.isFinite())return W(t);var n,i=t.e,o=E(t.d),a=o.length;return e?(r&&0<(n=r-a)?o=o.charAt(0)+"."+o.slice(1)+H(n):1<a&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+H(-i-1)+o,r&&0<(n=r-a)&&(o+=H(n))):a<=i?(o+=H(i+1-a),r&&0<(n=r-i-1)&&(o=o+"."+H(n))):((n=i+1)<a&&(o=o.slice(0,n)+"."+o.slice(n)),r&&0<(n=r-a)&&(i+1===a&&(o+="."),o+=H(n))),o}function B(t,e){var r=t[0];for(e*=D;10<=r;r/=10)e++;return e}function U(t,e,r){if(b<e)throw _=!0,r&&(t.precision=r),Error(o);return k(new t(n),e,1,!0)}function j(t,e,r){if(w<e)throw Error(o);return k(new t(i),e,r,!0)}function z(t){var e=t.length-1,r=e*D+1;if(e=t[e]){for(;e%10==0;e/=10)r--;for(e=t[0];10<=e;e/=10)r++}return r}function H(t){for(var e="";t--;)e+="0";return e}function G(t,e,r,n){var i,o=new t(1),a=Math.ceil(n/D+4);for(_=!1;;){if(r%2&&J((o=o.times(e)).d,a)&&(i=!0),0===(r=I(r/2))){r=o.d.length-1,i&&0===o.d[r]&&++o.d[r];break}J((e=e.times(e)).d,a)}return _=!0,o}function X(t){return 1&t.d[t.d.length-1]}function t(t,e,r){for(var n,i=new t(e[0]),o=0;++o<e.length;){if(!(n=new t(e[o])).s){i=n;break}i[r](n)&&(i=n)}return i}function V(t,e){var r,n,i,o,a,s,u,h=0,l=0,c=0,f=t.constructor,d=f.rounding,p=f.precision;if(!t.d||!t.d[0]||17<t.e)return new f(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(u=null==e?(_=!1,p):e,s=new f(.03125);-2<t.e;)t=t.times(s),c+=5;for(u+=n=Math.log(y(2,c))/Math.LN10*2+5|0,r=o=a=new f(1),f.precision=u;;){if(o=k(o.times(t),u,1),r=r.times(++l),E((s=a.plus(M(o,r,u,1))).d).slice(0,u)===E(a.d).slice(0,u)){for(i=c;i--;)a=k(a.times(a),u,1);if(null!=e)return f.precision=p,a;if(!(h<3&&S(a.d,u-n,d,h)))return k(a,f.precision=p,d,_=!0);f.precision=u+=10,r=o=s=new f(1),l=0,h++}a=s}}function Y(t,e){var r,n,i,o,a,s,u,h,l,c,f,d=1,p=t,v=p.d,m=p.constructor,g=m.rounding,y=m.precision;if(p.s<0||!v||!v[0]||!p.e&&1==v[0]&&1==v.length)return new m(v&&!v[0]?-1/0:1!=p.s?NaN:v?0:p);if(l=null==e?(_=!1,y):e,m.precision=l+=10,n=(r=E(v)).charAt(0),!(Math.abs(o=p.e)<15e14))return h=U(m,l+2,y).times(o+""),p=Y(new m(n+"."+r.slice(1)),l-10).plus(h),m.precision=y,null==e?k(p,y,g,_=!0):p;for(;n<7&&1!=n||1==n&&3<r.charAt(1);)n=(r=E((p=p.times(t)).d)).charAt(0),d++;for(o=p.e,1<n?(p=new m("0."+r),o++):p=new m(n+"."+r.slice(1)),u=a=p=M((c=p).minus(1),p.plus(1),l,1),f=k(p.times(p),l,1),i=3;;){if(a=k(a.times(f),l,1),E((h=u.plus(M(a,new m(i),l,1))).d).slice(0,l)===E(u.d).slice(0,l)){if(u=u.times(2),0!==o&&(u=u.plus(U(m,l+2,y).times(o+""))),u=M(u,new m(d),l,1),null!=e)return m.precision=y,u;if(!S(u.d,l-10,g,s))return k(u,m.precision=y,g,_=!0);m.precision=l+=10,h=a=p=M(c.minus(1),c.plus(1),l,1),f=k(p.times(p),l,1),i=s=1}u=h,i+=2}}function W(t){return String(t.s*t.s/0)}function q(t,e){var r,n,i;for(-1<(r=e.indexOf("."))&&(e=e.replace(".","")),0<(n=e.search(/e/i))?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;48===e.charCodeAt(n);n++);for(i=e.length;48===e.charCodeAt(i-1);--i);if(e=e.slice(n,i)){if(i-=n,t.e=r=r-n-1,t.d=[],n=(r+1)%D,r<0&&(n+=D),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=D;n<i;)t.d.push(+e.slice(n,n+=D));e=e.slice(n),n=D-e.length}else n-=i;for(;n--;)e+="0";t.d.push(+e),_&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function Z(t,e,r,n,i){var o,a,s,u,h=t.precision,l=Math.ceil(h/D);for(_=!1,u=r.times(r),s=new t(n);;){if(a=M(s.times(u),new t(e++*e++),h,1),s=i?n.plus(a):n.minus(a),n=M(a.times(u),new t(e++*e++),h,1),void 0!==(a=s.plus(n)).d[l]){for(o=l;a.d[o]===s.d[o]&&o--;);if(-1==o)break}o=s,s=n,n=a,a=o,0}return _=!0,a.d.length=l+1,a}function K(t,e){for(var r=t;--e;)r*=t;return r}function $(t,e){var r,n=e.s<0,i=j(t,t.precision,1),o=i.times(.5);if((e=e.abs()).lte(o))return a=n?4:1,e;if((r=e.divToInt(i)).isZero())a=n?3:2;else{if((e=e.minus(r.times(i))).lte(o))return a=X(r)?n?2:3:n?4:1,e;a=X(r)?n?1:4:n?3:2}return e.minus(i).abs()}function r(t,e,r,n){var i,o,a,s,u,h,l,c,f,d=t.constructor,p=void 0!==r;if(p?(A(r,1,v),void 0===n?n=d.rounding:A(n,0,8)):(r=d.precision,n=d.rounding),t.isFinite()){for(p?(i=2,16==e?r=4*r-3:8==e&&(r=3*r-2)):i=e,0<=(a=(l=P(t)).indexOf("."))&&(l=l.replace(".",""),(f=new d(1)).e=l.length-a,f.d=O(P(f),10,i),f.e=f.d.length),o=u=(c=O(l,10,i)).length;0==c[--u];)c.pop();if(c[0]){if(a<0?o--:((t=new d(t)).d=c,t.e=o,c=(t=M(t,f,r,n,0,i)).d,o=t.e,h=C),a=c[r],s=i/2,h=h||void 0!==c[r+1],h=n<4?(void 0!==a||h)&&(0===n||n===(t.s<0?3:2)):s<a||a===s&&(4===n||h||6===n&&1&c[r-1]||n===(t.s<0?8:7)),c.length=r,h)for(;++c[--r]>i-1;)c[r]=0,r||(++o,c.unshift(1));for(u=c.length;!c[u-1];--u);for(a=0,l="";a<u;a++)l+=m.charAt(c[a]);if(p){if(1<u)if(16==e||8==e){for(a=16==e?4:3,--u;u%a;u++)l+="0";for(u=(c=O(l,i,e)).length;!c[u-1];--u);for(a=1,l="1.";a<u;a++)l+=m.charAt(c[a])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>u)for(o-=u;o--;)l+="0";else o<u&&(l=l.slice(0,o)+"."+l.slice(o))}else l=p?"0p+0":"0";l=(16==e?"0x":2==e?"0b":8==e?"0o":"")+l}else l=W(t);return t.s<0?"-"+l:l}function J(t,e){return t.length>e&&(t.length=e,1)}function Q(t){return new this(t).abs()}function tt(t){return new this(t).acos()}function et(t){return new this(t).acosh()}function rt(t,e){return new this(t).plus(e)}function nt(t){return new this(t).asin()}function it(t){return new this(t).asinh()}function ot(t){return new this(t).atan()}function at(t){return new this(t).atanh()}function st(t,e){t=new this(t),e=new this(e);var r,n=this.precision,i=this.rounding,o=n+4;return t.s&&e.s?t.d||e.d?!e.d||t.isZero()?(r=e.s<0?j(this,n,i):new this(0)).s=t.s:!t.d||e.isZero()?(r=j(this,o,1).times(.5)).s=t.s:r=e.s<0?(this.precision=o,this.rounding=1,r=this.atan(M(t,e,o,1)),e=j(this,o,1),this.precision=n,this.rounding=i,t.s<0?r.minus(e):r.plus(e)):this.atan(M(t,e,o,1)):(r=j(this,o,1).times(0<e.s?.25:.75)).s=t.s:r=new this(NaN),r}function ut(t){return new this(t).cbrt()}function ht(t){return k(t=new this(t),t.e+1,2)}function lt(t){if(!t||"object"!=typeof t)throw Error(h+"Object expected");for(var e,r,n=!0===t.defaults,i=["precision",1,v,"rounding",0,8,"toExpNeg",-s,0,"toExpPos",0,s,"maxE",0,s,"minE",-s,0,"modulo",0,9],o=0;o<i.length;o+=3)if(e=i[o],n&&(this[e]=u[e]),void 0!==(r=t[e])){if(!(I(r)===r&&i[o+1]<=r&&r<=i[o+2]))throw Error(g+e+": "+r);this[e]=r}if(e="crypto",n&&(this[e]=u[e]),void 0!==(r=t[e])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(g+e+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(l);this[e]=!0}else this[e]=!1}return this}function ct(t){return new this(t).cos()}function ft(t){return new this(t).cosh()}function dt(t,e){return new this(t).div(e)}function pt(t){return new this(t).exp()}function vt(t){return k(t=new this(t),t.e+1,3)}function mt(){var t,e,r=new this(0);for(_=!1,t=0;t<arguments.length;)if((e=new this(arguments[t++])).d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return _=!0,new this(1/0);r=e}return _=!0,r.sqrt()}function gt(t){return t instanceof c||t&&"[object Decimal]"===t.name||!1}function yt(t){return new this(t).ln()}function _t(t,e){return new this(t).log(e)}function xt(t){return new this(t).log(2)}function bt(t){return new this(t).log(10)}function wt(){return t(this,arguments,"lt")}function Tt(){return t(this,arguments,"gt")}function Et(t,e){return new this(t).mod(e)}function At(t,e){return new this(t).mul(e)}function St(t,e){return new this(t).pow(e)}function Ot(t){var e,r,n,i,o=0,a=new this(1),s=[];if(void 0===t?t=this.precision:A(t,1,v),n=Math.ceil(t/D),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));o<n;)429e7<=(i=e[o])?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:s[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(l);for(e=crypto.randomBytes(n*=4);o<n;)214e7<=(i=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((127&e[o+3])<<24))?crypto.randomBytes(4).copy(e,o):(s.push(i%1e7),o+=4);o=n/4}else for(;o<n;)s[o++]=1e7*Math.random()|0;for(n=s[--o],t%=D,n&&t&&(i=y(10,D-t),s[o]=(n/i|0)*i);0===s[o];o--)s.pop();if(o<0)s=[r=0];else{for(r=-1;0===s[0];r-=D)s.shift();for(n=1,i=s[0];10<=i;i/=10)n++;n<D&&(r-=D-n)}return a.e=r,a.d=s,a}function Mt(t){return k(t=new this(t),t.e+1,this.rounding)}function Pt(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function Ct(t){return new this(t).sin()}function It(t){return new this(t).sinh()}function Nt(t){return new this(t).sqrt()}function Dt(t,e){return new this(t).sub(e)}function Rt(t){return new this(t).tan()}function Ft(t){return new this(t).tanh()}function Lt(t){return k(t=new this(t),t.e+1,1)}(c=function t(e){var r,n,i;function o(t){var e,r,n,i=this;if(!(i instanceof o))return new o(t);if(t instanceof(i.constructor=o))return i.s=t.s,void(_?!t.d||t.e>o.maxE?(i.e=NaN,i.d=null):t.e<o.minE?(i.e=0,i.d=[0]):(i.e=t.e,i.d=t.d.slice()):(i.e=t.e,i.d=t.d?t.d.slice():t.d));if("number"==(n=typeof t)){if(0===t)return i.s=1/t<0?-1:1,i.e=0,void(i.d=[0]);if(t<0?(t=-t,i.s=-1):i.s=1,t===~~t&&t<1e7){for(e=0,r=t;10<=r;r/=10)e++;return void(_?o.maxE<e?(i.e=NaN,i.d=null):e<o.minE?(i.e=0,i.d=[0]):(i.e=e,i.d=[t]):(i.e=e,i.d=[t]))}return 0*t!=0?(t||(i.s=NaN),i.e=NaN,void(i.d=null)):q(i,t.toString())}if("string"!=n)throw Error(g+t);return 45===(r=t.charCodeAt(0))?(t=t.slice(1),i.s=-1):(43===r&&(t=t.slice(1)),i.s=1),(x.test(t)?q:function(t,e){var r,n,i,o,a,s,u,h,l;if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(d.test(e))r=16,e=e.toLowerCase();else if(f.test(e))r=2;else{if(!p.test(e))throw Error(g+e);r=8}for(a=0<=(o=(e=0<(o=e.search(/p/i))?(u=+e.slice(o+1),e.substring(2,o)):e.slice(2)).indexOf(".")),n=t.constructor,a&&(o=(s=(e=e.replace(".","")).length)-o,i=G(n,new n(r),o,2*o)),o=l=(h=O(e,r,N)).length-1;0===h[o];--o)h.pop();return o<0?new n(0*t.s):(t.e=B(h,l),t.d=h,_=!1,a&&(t=M(t,i,4*s)),u&&(t=t.times(Math.abs(u)<54?y(2,u):c.pow(2,u))),_=!0,t)})(i,t)}if(o.prototype=T,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=lt,o.clone=t,o.isDecimal=gt,o.abs=Q,o.acos=tt,o.acosh=et,o.add=rt,o.asin=nt,o.asinh=it,o.atan=ot,o.atanh=at,o.atan2=st,o.cbrt=ut,o.ceil=ht,o.cos=ct,o.cosh=ft,o.div=dt,o.exp=pt,o.floor=vt,o.hypot=mt,o.ln=yt,o.log=_t,o.log10=bt,o.log2=xt,o.max=wt,o.min=Tt,o.mod=Et,o.mul=At,o.pow=St,o.random=Ot,o.round=Mt,o.sign=Pt,o.sin=Ct,o.sinh=It,o.sqrt=Nt,o.sub=Dt,o.tan=Rt,o.tanh=Ft,o.trunc=Lt,void 0===e&&(e={}),e&&!0!==e.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<i.length;)e.hasOwnProperty(n=i[r++])||(e[n]=this[n]);return o.config(e),o}(u)).default=c.Decimal=c,n=new c(n),i=new c(i),void 0===(Ut=function(){return c}.call(kt,Bt,kt,e))||(e.exports=Ut)}()},function(t,i,o){(function(t){var e=void 0!==t&&t||"undefined"!=typeof self&&self||window,r=Function.prototype.apply;function n(t,e){this._id=t,this._clearFn=e}i.setTimeout=function(){return new n(r.call(setTimeout,e,arguments),clearTimeout)},i.setInterval=function(){return new n(r.call(setInterval,e,arguments),clearInterval)},i.clearTimeout=i.clearInterval=function(t){t&&t.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(e,this._id)},i.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},i.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},i._unrefActive=i.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;0<=e&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},o(21),i.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,i.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,o(5))},function(t,e,r){(function(t,p){!function(r,n){"use strict";var i,o,a,s,u,h,e,l,t;function c(t){delete o[t]}function f(t){if(a)setTimeout(f,0,t);else{var e=o[t];if(e){a=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}(e)}finally{c(t),a=!1}}}}function d(t){t.source===r&&"string"==typeof t.data&&0===t.data.indexOf(l)&&f(+t.data.slice(l.length))}r.setImmediate||(i=1,a=!(o={}),s=r.document,t=(t=Object.getPrototypeOf&&Object.getPrototypeOf(r))&&t.setTimeout?t:r,u="[object process]"==={}.toString.call(r.process)?function(t){p.nextTick(function(){f(t)})}:function(){if(r.postMessage&&!r.importScripts){var t=!0,e=r.onmessage;return r.onmessage=function(){t=!1},r.postMessage("","*"),r.onmessage=e,t}}()?(l="setImmediate$"+Math.random()+"$",r.addEventListener?r.addEventListener("message",d,!1):r.attachEvent("onmessage",d),function(t){r.postMessage(l+t,"*")}):r.MessageChannel?((e=new MessageChannel).port1.onmessage=function(t){f(t.data)},function(t){e.port2.postMessage(t)}):s&&"onreadystatechange"in s.createElement("script")?(h=s.documentElement,function(t){var e=s.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,h.removeChild(e),e=null},h.appendChild(e)}):function(t){setTimeout(f,0,t)},t.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var n={callback:t,args:e};return o[i]=n,u(i),i++},t.clearImmediate=c)}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,r(5),r(22))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var u,h=[],l=!1,c=-1;function f(){l&&u&&(l=!1,u.length?h=u.concat(h):c=-1,h.length&&d())}function d(){if(!l){var t=s(f);l=!0;for(var e=h.length;e;){for(u=h,h=[];++c<e;)u&&u[c].run();c=-1,e=h.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function v(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];h.push(new p(t,e)),1!==h.length||l||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,m,I){(function(d,p){var v;!function(){m&&m.nodeType,d&&d.nodeType;var t="object"==typeof p&&p;t.global!==t&&t.window!==t&&t.self;var e,g=2147483647,y=36,_=1,x=26,i=38,o=700,b=72,w=128,T="-",r=/^xn--/,n=/[^\x20-\x7E]/,a=/[\x2E\u3002\uFF0E\uFF61]/g,s={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},u=y-_,E=Math.floor,A=String.fromCharCode;function S(t){throw new RangeError(s[t])}function h(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function l(t,e){var r=t.split("@"),n="";return 1<r.length&&(n=r[0]+"@",t=r[1]),n+h((t=t.replace(a,".")).split("."),e).join(".")}function O(t){for(var e,r,n=[],i=0,o=t.length;i<o;)55296<=(e=t.charCodeAt(i++))&&e<=56319&&i<o?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function M(t){return h(t,function(t){var e="";return 65535<t&&(e+=A((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=A(t)}).join("")}function P(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function C(t,e,r){var n=0;for(t=r?E(t/o):t>>1,t+=E(t/e);u*x>>1<t;n+=y)t=E(t/u);return E(n+(u+1)*t/(t+i))}function c(t){var e,r,n,i,o,a,s,u,h,l,c=[],f=t.length,d=0,p=w,v=b,m=t.lastIndexOf(T);for(m<0&&(m=0),r=0;r<m;++r)128<=t.charCodeAt(r)&&S("not-basic"),c.push(t.charCodeAt(r));for(n=0<m?m+1:0;n<f;){for(i=d,o=1,a=y;f<=n&&S("invalid-input"),l=t.charCodeAt(n++),(y<=(s=l-48<10?l-22:l-65<26?l-65:l-97<26?l-97:y)||s>E((g-d)/o))&&S("overflow"),d+=s*o,!(s<(u=a<=v?_:v+x<=a?x:a-v));a+=y)o>E(g/(h=y-u))&&S("overflow"),o*=h;v=C(d-i,e=c.length+1,0==i),E(d/e)>g-p&&S("overflow"),p+=E(d/e),d%=e,c.splice(d++,0,p)}return M(c)}function f(t){for(var e,r,n,i,o,a,s,u,h,l,c,f=[],d=(t=O(t)).length,p=w,v=b,m=e=0;m<d;++m)(u=t[m])<128&&f.push(A(u));for(r=n=f.length,n&&f.push(T);r<d;){for(i=g,m=0;m<d;++m)p<=(u=t[m])&&u<i&&(i=u);for(i-p>E((g-e)/(h=r+1))&&S("overflow"),e+=(i-p)*h,p=i,m=0;m<d;++m)if((u=t[m])<p&&++e>g&&S("overflow"),u==p){for(o=e,a=y;!(o<(s=a<=v?_:v+x<=a?x:a-v));a+=y)c=o-s,l=y-s,f.push(A(P(s+c%l,0))),o=E(c/l);f.push(A(P(o,0))),v=C(e,h,r==n),e=0,++r}++e,++p}return f.join("")}e={version:"1.4.1",ucs2:{decode:O,encode:M},decode:c,encode:f,toASCII:function(t){return l(t,function(t){return n.test(t)?"xn--"+f(t):t})},toUnicode:function(t){return l(t,function(t){return r.test(t)?c(t.slice(4).toLowerCase()):t})}},void 0===(v=function(){return e}.call(m,I,m,d))||(d.exports=v)}()}).call(this,I(24)(t),I(5))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,r){"use strict";e.decode=e.parse=r(27),e.encode=e.stringify=r(28)},function(t,e,r){"use strict";t.exports=function(t,e,r,n){e=e||"&",r=r||"=";var i={};if("string"!=typeof t||0===t.length)return i;var o=/\+/g;t=t.split(e);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var s=t.length;0<a&&a<s&&(s=a);for(var u,h,l=0;l<s;++l){var c,f=t[l].replace(o,"%20"),d=f.indexOf(r),p=0<=d?(c=f.substr(0,d),f.substr(d+1)):(c=f,""),v=decodeURIComponent(c),m=decodeURIComponent(p);u=i,h=v,Object.prototype.hasOwnProperty.call(u,h)?g(i[v])?i[v].push(m):i[v]=[i[v],m]:i[v]=m}return i};var g=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){"use strict";function o(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}}t.exports=function(r,n,i,t){return n=n||"&",i=i||"=",null===r&&(r=void 0),"object"==typeof r?s(u(r),function(t){var e=encodeURIComponent(o(t))+i;return a(r[t])?s(r[t],function(t){return e+encodeURIComponent(o(t))}).join(n):e+encodeURIComponent(o(r[t]))}).join(n):t?encodeURIComponent(o(t))+i+encodeURIComponent(o(r)):""};var a=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function s(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var u=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},function(t,e,r){"use strict";t.exports=function(t){for(var e=0,r=0,n=1;n<t.length;++n)t[n][0]<t[e][0]&&(e=n),t[n][0]>t[r][0]&&(r=n);return e<r?[[e],[r]]:r<e?[[r],[e]]:[[e]]}},function(t,e,r){"use strict";t.exports=function(t){var e=s(t),r=e.length;if(r<=2)return[];for(var n=new Array(r),i=e[r-1],o=0;o<r;++o){var a=e[o];n[o]=[i,a],i=a}return n};var s=r(31)},function(t,e,r){"use strict";t.exports=function(n){var t=n.length;if(t<3){for(var e=new Array(t),r=0;r<t;++r)e[r]=r;return 2===t&&n[0][0]===n[1][0]&&n[0][1]===n[1][1]?[0]:e}for(var i=new Array(t),r=0;r<t;++r)i[r]=r;i.sort(function(t,e){var r=n[t][0]-n[e][0];return r||n[t][1]-n[e][1]});for(var o=[i[0],i[1]],a=[i[0],i[1]],r=2;r<t;++r){for(var s=i[r],u=n[s],h=o.length;1<h&&d(n[o[h-2]],n[o[h-1]],u)<=0;)--h,o.pop();for(o.push(s),h=a.length;1<h&&0<=d(n[a[h-2]],n[a[h-1]],u);)--h,a.pop();a.push(s)}for(var e=new Array(a.length+o.length-2),l=0,r=0,c=o.length;r<c;++r)e[l++]=o[r];for(var f=a.length-2;0<f;--f)e[l++]=a[f];return e};var d=r(8)[3]},function(t,e,r){"use strict";t.exports=function(t,e){var r=0|t.length,n=0|e.length;if(1==r&&1==n)return function(t,e){var r=t+e,n=r-t,i=t-(r-n)+(e-n);if(i)return[i,r];return[r]}(t[0],e[0]);var i,o,a=new Array(r+n),s=0,u=0,h=0,l=Math.abs,c=t[u],f=l(c),d=e[h],p=l(d);f<p?(o=c,(u+=1)<r&&(c=t[u],f=l(c))):(o=d,(h+=1)<n&&(d=e[h],p=l(d)));u<r&&f<p||n<=h?(i=c,(u+=1)<r&&(c=t[u],f=l(c))):(i=d,(h+=1)<n&&(d=e[h],p=l(d)));var v,m,g=i+o,y=g-i,_=o-y,x=_,b=g;for(;u<r&&h<n;)f<p?(i=c,(u+=1)<r&&(c=t[u],f=l(c))):(i=d,(h+=1)<n&&(d=e[h],p=l(d))),(_=(o=x)-(y=(g=i+o)-i))&&(a[s++]=_),x=b-((v=b+g)-(m=v-b))+(g-m),b=v;for(;u<r;)(_=(o=x)-(y=(g=(i=c)+o)-i))&&(a[s++]=_),x=b-((v=b+g)-(m=v-b))+(g-m),b=v,(u+=1)<r&&(c=t[u]);for(;h<n;)(_=(o=x)-(y=(g=(i=d)+o)-i))&&(a[s++]=_),x=b-((v=b+g)-(m=v-b))+(g-m),b=v,(h+=1)<n&&(d=e[h]);x&&(a[s++]=x);b&&(a[s++]=b);s||(a[s++]=0);return a.length=s,a}},function(t,e,r){"use strict";var p=r(14),v=r(34);t.exports=function(t,e){var r=t.length;if(1===r){var n=p(t[0],e);return n[0]?n:[n[1]]}var i=new Array(2*r),o=[.1,.1],a=[.1,.1],s=0;p(t[0],e,o),o[0]&&(i[s++]=o[0]);for(var u=1;u<r;++u){p(t[u],e,a);var h=o[1];v(h,a[0],o),o[0]&&(i[s++]=o[0]);var l=a[1],c=o[1],f=l+c,d=c-(f-l);o[1]=f,d&&(i[s++]=d)}o[1]&&(i[s++]=o[1]);0===s&&(i[s++]=0);return i.length=s,i}},function(t,e,r){"use strict";t.exports=function(t,e,r){var n=t+e,i=n-t,o=e-i,a=t-(n-i);if(r)return r[0]=a+o,r[1]=n,r;return[a+o,n]}},function(t,e,r){"use strict";t.exports=function(t,e){var r=0|t.length,n=0|e.length;if(1==r&&1==n)return function(t,e){var r=t+e,n=r-t,i=t-(r-n)+(e-n);if(i)return[i,r];return[r]}(t[0],-e[0]);var i,o,a=new Array(r+n),s=0,u=0,h=0,l=Math.abs,c=t[u],f=l(c),d=-e[h],p=l(d);f<p?(o=c,(u+=1)<r&&(c=t[u],f=l(c))):(o=d,(h+=1)<n&&(d=-e[h],p=l(d)));u<r&&f<p||n<=h?(i=c,(u+=1)<r&&(c=t[u],f=l(c))):(i=d,(h+=1)<n&&(d=-e[h],p=l(d)));var v,m,g=i+o,y=g-i,_=o-y,x=_,b=g;for(;u<r&&h<n;)f<p?(i=c,(u+=1)<r&&(c=t[u],f=l(c))):(i=d,(h+=1)<n&&(d=-e[h],p=l(d))),(_=(o=x)-(y=(g=i+o)-i))&&(a[s++]=_),x=b-((v=b+g)-(m=v-b))+(g-m),b=v;for(;u<r;)(_=(o=x)-(y=(g=(i=c)+o)-i))&&(a[s++]=_),x=b-((v=b+g)-(m=v-b))+(g-m),b=v,(u+=1)<r&&(c=t[u]);for(;h<n;)(_=(o=x)-(y=(g=(i=d)+o)-i))&&(a[s++]=_),x=b-((v=b+g)-(m=v-b))+(g-m),b=v,(h+=1)<n&&(d=-e[h]);x&&(a[s++]=x);b&&(a[s++]=b);s||(a[s++]=0);return a.length=s,a}},function(t,e,r){"use strict";t.exports=function(e,r){try{return o(e,!0)}catch(t){var n=a(e);if(n.length<=r)return[];var i=function(t,e){for(var r=t.length,n=new Array(r),i=0;i<e.length;++i)n[i]=t[e[i]];for(var o=e.length,i=0;i<r;++i)e.indexOf(i)<0&&(n[o++]=t[i]);return n}(e,n);return function(t,e){for(var r=t.length,n=e.length,i=0;i<r;++i)for(var o=t[i],a=0;a<o.length;++a){var s=o[a];if(s<n)o[a]=e[s];else{s-=n;for(var u=0;u<n;++u)s>=e[u]&&(s+=1);o[a]=s}}return t}(o(i,!0),n)}};var o=r(37),a=r(41)},function(t,e,r){"use strict";t.exports=function(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var n=t[0].length;if(r<=n)throw new Error("Must input at least d+1 points");var i=t.slice(0,n+1),o=x.apply(void 0,i);if(0===o)throw new Error("Input not in general position");for(var a=new Array(n+1),s=0;s<=n;++s)a[s]=s;o<0&&(a[0]=1,a[1]=0);for(var u=new N(a,new Array(n+1),!1),h=u.adjacent,l=new Array(n+2),s=0;s<=n;++s){for(var c=a.slice(),f=0;f<=n;++f)f===s&&(c[f]=-1);var d=c[0];c[0]=c[1],c[1]=d;var p=new N(c,new Array(n+1),!0);h[s]=p,l[s]=p}l[n+1]=u;for(s=0;s<=n;++s)for(var c=h[s].vertices,v=h[s].adjacent,f=0;f<=n;++f){var m=c[f];if(m<0)v[f]=u;else for(var g=0;g<=n;++g)h[g].vertices.indexOf(m)<0&&(v[f]=h[g])}for(var y=new b(n,i,l),_=!!e,s=n+1;s<r;++s)y.insert(t[s],_);return y.boundary()};var x=r(8),n=r(38).compareCells;function N(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function D(t,e,r){this.vertices=t,this.cell=e,this.index=r}function R(t,e){return n(t.vertices,e.vertices)}N.prototype.flip=function(){var t=this.vertices[0];this.vertices[0]=this.vertices[1],this.vertices[1]=t;var e=this.adjacent[0];this.adjacent[0]=this.adjacent[1],this.adjacent[1]=e};var o=[];function b(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;n<=t;++n)this.tuple[n]=this.vertices[n];var i=(i=o[t])||(o[t]=function(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)0<r&&e.push(","),e.push("tuple[",r,"]");return e.push(")}return orient"),new Function("test",e.join(""))(x[t+1]||x)}(t));this.orient=i}var i=b.prototype;i.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,o=this.vertices,a=[t];for(t.lastVisited=-n;0<a.length;){(t=a.pop()).vertices;for(var s=t.adjacent,u=0;u<=r;++u){var h=s[u];if(h.boundary&&!(h.lastVisited<=-n)){for(var l=h.vertices,c=0;c<=r;++c){var f=l[c];i[c]=f<0?e:o[f]}var d=this.orient();if(0<d)return h;h.lastVisited=-n,0===d&&a.push(h)}}}return null},i.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,o=this.tuple,a=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[a];t:for(;!s.boundary;){for(var u=s.vertices,h=s.adjacent,l=0;l<=n;++l)o[l]=i[u[l]];s.lastVisited=r;for(l=0;l<=n;++l){var c=h[l];if(!(c.lastVisited>=r)){var f=o[l];o[l]=t;var d=this.orient();if(o[l]=f,d<0){s=c;continue t}c.boundary?c.lastVisited=-r:c.lastVisited=r}}return}return s},i.addPeaks=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,o=this.tuple,a=this.interior,s=this.simplices,u=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,a.push(e);for(var h=[];0<u.length;){var l=(e=u.pop()).vertices,c=e.adjacent,f=l.indexOf(r);if(!(f<0))for(var d=0;d<=n;++d)if(d!==f){var p=c[d];if(p.boundary&&!(p.lastVisited>=r)){var v=p.vertices;if(p.lastVisited!==-r){for(var m=0,g=0;g<=n;++g)v[g]<0?o[m=g]=t:o[g]=i[v[g]];if(0<this.orient()){v[m]=r,p.boundary=!1,a.push(p),u.push(p),p.lastVisited=r;continue}p.lastVisited=-r}var y=p.adjacent,_=l.slice(),x=c.slice(),b=new N(_,x,!0);s.push(b);var w=y.indexOf(e);if(!(w<0)){y[w]=b,x[f]=p,_[d]=-1,x[d]=e,(c[d]=b).flip();for(g=0;g<=n;++g){var T=_[g];if(!(T<0||T===r)){for(var E=new Array(n-1),A=0,S=0;S<=n;++S){var O=_[S];O<0||S===g||(E[A++]=O)}h.push(new D(E,b,g))}}}}}}h.sort(R);for(d=0;d+1<h.length;d+=2){var M=h[d],P=h[d+1],C=M.index,I=P.index;C<0||I<0||(M.cell.adjacent[M.index]=P.cell,P.cell.adjacent[P.index]=M.cell)}},i.insert=function(t,e){var r=this.vertices;r.push(t);var n=this.walk(t,e);if(n){for(var i=this.dimension,o=this.tuple,a=0;a<=i;++a){var s=n.vertices[a];o[a]=s<0?t:r[s]}var u=this.orient(o);u<0||0===u&&!(n=this.handleBoundaryDegeneracy(n,t))||this.addPeaks(t,n)}},i.boundary=function(){for(var t=this.dimension,e=[],r=this.simplices,n=r.length,i=0;i<n;++i){var o=r[i];if(o.boundary){for(var a,s=new Array(t),u=o.vertices,h=0,l=0,c=0;c<=t;++c)0<=u[c]?s[h++]=u[c]:l=1&c;l===(1&t)&&(a=s[0],s[0]=s[1],s[1]=a),e.push(s)}}return e}},function(t,e,r){"use strict";var p=r(39),c=r(40);function v(t,e){var r=t.length,n=t.length-e.length,i=Math.min;if(n)return n;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return(s=t[0]+t[1]-e[0]-e[1])?s:i(t[0],t[1])-i(e[0],e[1]);case 3:var o=t[0]+t[1],a=e[0]+e[1];if(s=o+t[2]-(a+e[2]))return s;var s,u=i(t[0],t[1]),h=i(e[0],e[1]);return(s=i(u,t[2])-i(h,e[2]))?s:i(u+t[2],o)-i(h+e[2],a);default:var l=t.slice(0);l.sort();var c=e.slice(0);c.sort();for(var f=0;f<r;++f)if(n=l[f]-c[f])return n;return 0}}function o(t,e){return v(t[0],e[0])}function f(t,e){if(e){for(var r=t.length,n=new Array(r),i=0;i<r;++i)n[i]=[t[i],e[i]];n.sort(o);for(i=0;i<r;++i)t[i]=n[i][0],e[i]=n[i][1];return t}return t.sort(v),t}function d(t){if(0===t.length)return[];for(var e=1,r=t.length,n=1;n<r;++n){var i=t[n];if(v(i,t[n-1])){if(n===e){e++;continue}t[e++]=i}}return t.length=e,t}function m(t,e){for(var r=0,n=t.length-1,i=-1;r<=n;){var o=r+n>>1,a=v(t[o],e);a<=0?(0===a&&(i=o),r=1+o):0<a&&(n=o-1)}return i}function u(t,e){for(var r=new Array(t.length),n=0,i=r.length;n<i;++n)r[n]=[];for(var o=[],n=0,a=e.length;n<a;++n)for(var s=e[n],u=s.length,h=1,l=1<<u;h<l;++h){o.length=p.popCount(h);for(var c=0,f=0;f<u;++f)h&1<<f&&(o[c++]=s[f]);var d=m(t,o);if(!(d<0))for(;r[d++].push(n),!(d>=t.length||0!==v(t[d],o)););}return r}function g(t,e){if(e<0)return[];for(var r=[],n=(1<<e+1)-1,i=0;i<t.length;++i)for(var o=t[i],a=n;a<1<<o.length;a=p.nextCombination(a)){for(var s=new Array(e+1),u=0,h=0;h<o.length;++h)a&1<<h&&(s[u++]=o[h]);r.push(s)}return f(r)}e.dimension=function(t){for(var e=0,r=Math.max,n=0,i=t.length;n<i;++n)e=r(e,t[n].length);return e-1},e.countVertices=function(t){for(var e=-1,r=Math.max,n=0,i=t.length;n<i;++n)for(var o=t[n],a=0,s=o.length;a<s;++a)e=r(e,o[a]);return e+1},e.cloneCells=function(t){for(var e=new Array(t.length),r=0,n=t.length;r<n;++r)e[r]=t[r].slice(0);return e},e.compareCells=v,e.normalize=f,e.unique=d,e.findCell=m,e.incidence=u,e.dual=function(t,e){if(!e)return u(d(g(t,0)),t);for(var r=new Array(e),n=0;n<e;++n)r[n]=[];for(var n=0,i=t.length;n<i;++n)for(var o=t[n],a=0,s=o.length;a<s;++a)r[o[a]].push(n);return r},e.explode=function(t){for(var e=[],r=0,n=t.length;r<n;++r)for(var i=t[r],o=0|i.length,a=1,s=1<<o;a<s;++a){for(var u=[],h=0;h<o;++h)a>>>h&1&&u.push(i[h]);e.push(u)}return f(e)},e.skeleton=g,e.boundary=function(t){for(var e=[],r=0,n=t.length;r<n;++r)for(var i=t[r],o=0,a=i.length;o<a;++o){for(var s=new Array(i.length-1),u=0,h=0;u<a;++u)u!==o&&(s[h++]=i[u]);e.push(s)}return f(e)},e.connectedComponents=function(t,e){return e?function(t,e){for(var r=new c(e),n=0;n<t.length;++n)for(var i=t[n],o=0;o<i.length;++o)for(var a=o+1;a<i.length;++a)r.link(i[o],i[a]);for(var s=[],u=r.ranks,n=0;n<u.length;++n)u[n]=-1;for(n=0;n<t.length;++n){var h=r.find(t[n][0]);u[h]<0?(u[h]=s.length,s.push([t[n].slice(0)])):s[u[h]].push(t[n].slice(0))}return s}(t,e):function(t){for(var e=d(f(g(t,0))),r=new c(e.length),n=0;n<t.length;++n)for(var i=t[n],o=0;o<i.length;++o)for(var a=m(e,[i[o]]),s=o+1;s<i.length;++s)r.link(a,m(e,[i[s]]));for(var u=[],h=r.ranks,n=0;n<h.length;++n)h[n]=-1;for(n=0;n<t.length;++n){var l=r.find(m(e,[t[n][0]]));h[l]<0?(h[l]=u.length,u.push([t[n].slice(0)])):u[h[l]].push(t[n].slice(0))}return u}(t)}},function(t,e,r){"use strict";function n(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&--e,e}e.INT_BITS=32,e.INT_MAX=2147483647,e.INT_MIN=-1<<31,e.sign=function(t){return(0<t)-(t<0)},e.abs=function(t){var e=t>>31;return(t^e)-e},e.min=function(t,e){return e^(t^e)&-(t<e)},e.max=function(t,e){return t^(t^e)&-(t<e)},e.isPow2=function(t){return!(t&t-1||!t)},e.log2=function(t){var e,r=(65535<t)<<4;return r|=e=(255<(t>>>=r))<<3,r|=e=(15<(t>>>=e))<<2,(r|=e=(3<(t>>>=e))<<1)|(t>>>=e)>>1},e.log10=function(t){return 1e9<=t?9:1e8<=t?8:1e7<=t?7:1e6<=t?6:1e5<=t?5:1e4<=t?4:1e3<=t?3:100<=t?2:10<=t?1:0},e.popCount=function(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},e.countTrailingZeros=n,e.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},e.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},e.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<<i&255}}(i),e.reverse=function(t){return i[255&t]<<24|i[t>>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},e.interleave2=function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},e.deinterleave2=function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},e.interleave3=function(t,e,r){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(r=1227133513&((r=3272356035&((r=251719695&((r=4278190335&((r&=1023)|r<<16))|r<<8))|r<<4))|r<<2))<<2},e.deinterleave3=function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},e.nextCombination=function(t){var e=t|t-1;return 1+e|(~e&-~e)-1>>>n(t)+1}},function(t,e,r){"use strict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;e<t;++e)this.roots[e]=e,this.ranks[e]=0}var i=(t.exports=n).prototype;Object.defineProperty(i,"length",{get:function(){return this.roots.length}}),i.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},i.find=function(t){for(var e=t,r=this.roots;r[t]!==t;)t=r[t];for(;r[e]!==t;){var n=r[e];r[e]=t,e=n}return t},i.link=function(t,e){var r,n,i,o,a=this.find(t),s=this.find(e);a!==s&&(r=this.ranks,n=this.roots,(i=r[a])<(o=r[s])?n[a]=s:o<i?n[s]=a:++r[n[s]=a])}},function(t,e,r){"use strict";t.exports=function(t){var e=t.length;if(0===e)return[];if(1===e)return[0];for(var r=t[0].length,n=[t[0]],i=[0],o=1;o<e;++o)if(n.push(t[o]),function(t,e){for(var r=new Array(e+1),n=0;n<t.length;++n)r[n]=t[n];for(n=0;n<=t.length;++n){for(var i=t.length;i<=e;++i){for(var o=new Array(e),a=0;a<e;++a)o[a]=Math.pow(i+1-n,a);r[i]=o}if(s.apply(void 0,r))return!0}return!1}(n,r)){if(i.push(o),i.length===r+1)return i}else n.pop();return i};var s=r(8)},function(t,e,r){"use strict";r.r(e);var n=r(15),i=r(16),o=r.n(i);window.Promise||(window.Promise=n.Polyfill),Object.assign||(Object.assign=o.a);var a;Date.now&&Date.prototype.getTime||(Date.now=function(){return(new Date).getTime()}),window.performance&&window.performance.now||(a=Date.now(),window.performance||(window.performance={}),window.performance.now=function(){return Date.now()-a});for(var s=Date.now(),u=["ms","moz","webkit","o"],h=0;h<u.length&&!window.requestAnimationFrame;++h){var l=u[h];window.requestAnimationFrame=window[l+"RequestAnimationFrame"],window.cancelAnimationFrame=window[l+"CancelAnimationFrame"]||window[l+"CancelRequestAnimationFrame"]}window.requestAnimationFrame||(window.requestAnimationFrame=function(t){if("function"!=typeof t)throw new TypeError(t+"is not a function");var e=Date.now(),r=16+s-e;return r<0&&(r=0),s=e,window.setTimeout(function(){s=Date.now(),t(performance.now())},r)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){return clearTimeout(t)}),Math.sign||(Math.sign=function(t){return 0===(t=Number(t))||isNaN(t)?t:0<t?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);function c(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&1<t.maxTouchPoints&&"undefined"==typeof MSStream}var f=/iPhone/i,d=/iPod/i,p=/iPad/i,v=/\biOS-universal(?:.+)Mac\b/i,m=/\bAndroid(?:.+)Mobile\b/i,g=/Android/i,y=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,_=/Silk/i,x=/Windows Phone/i,b=/\bWindows(?:.+)ARM\b/i,w=/BlackBerry/i,T=/BB10/i,E=/Opera Mini/i,A=/\b(CriOS|Chrome)(?:.+)Mobile/i,S=/Mobile(?:.+)Firefox\b/i;var O=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 r=e.userAgent,n=r.split("[FBAN");void 0!==n[1]&&(r=n[0]),void 0!==(n=r.split("Twitter"))[1]&&(r=n[0]);var i,o=(i=r,function(t){return t.test(i)}),a={apple:{phone:o(f)&&!o(x),ipod:o(d),tablet:!o(f)&&(o(p)||c(e))&&!o(x),universal:o(v),device:(o(f)||o(d)||o(p)||o(v)||c(e))&&!o(x)},amazon:{phone:o(y),tablet:!o(y)&&o(_),device:o(y)||o(_)},android:{phone:!o(x)&&o(y)||!o(x)&&o(m),tablet:!o(x)&&!o(y)&&!o(m)&&(o(_)||o(g)),device:!o(x)&&(o(y)||o(_)||o(m)||o(g))||o(/\bokhttp\b/i)},windows:{phone:o(x),tablet:o(b),device:o(x)||o(b)},other:{blackberry:o(w),blackberry10:o(T),opera:o(E),firefox:o(S),chrome:o(A),device:o(w)||o(T)||o(E)||o(S)||o(A)},any:!1,phone:!1,tablet:!1};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}(window.navigator);var M,P,C,I,N,D,R,F,L,k,B,U,j,z,H,G,X,V,Y,W,q,Z,K,$,J,Q,tt,et,rt,nt,it,ot,at,st,ut,ht,lt,ct={MIPMAP_TEXTURES:1,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,SPRITE_MAX_TEXTURES:(M=32,C=!0,(O.tablet||O.phone)&&(O.apple.device&&(P=navigator.userAgent.match(/OS (\d+)_(\d+)?/))&&parseInt(P[1],10)<11&&(C=!1),O.android.device&&(P=navigator.userAgent.match(/Android\s([0-9.]*)/))&&parseInt(P[1],10)<7&&(C=!1)),C?M:4),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:O.apple.device?"highp":"mediump",CAN_UPLOAD_SAME_BUFFER:!O.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},ft=r(12),dt=r.n(ft),pt=r(13),vt=r.n(pt),mt=r(6),gt=r.n(mt);(N=I=I||{})[N.WEBGL_LEGACY=0]="WEBGL_LEGACY",N[N.WEBGL=1]="WEBGL",N[N.WEBGL2=2]="WEBGL2",(R=D=D||{})[R.UNKNOWN=0]="UNKNOWN",R[R.WEBGL=1]="WEBGL",R[R.CANVAS=2]="CANVAS",(L=F=F||{})[L.COLOR=16384]="COLOR",L[L.DEPTH=256]="DEPTH",L[L.STENCIL=1024]="STENCIL",(B=k=k||{})[B.NORMAL=0]="NORMAL",B[B.ADD=1]="ADD",B[B.MULTIPLY=2]="MULTIPLY",B[B.SCREEN=3]="SCREEN",B[B.OVERLAY=4]="OVERLAY",B[B.DARKEN=5]="DARKEN",B[B.LIGHTEN=6]="LIGHTEN",B[B.COLOR_DODGE=7]="COLOR_DODGE",B[B.COLOR_BURN=8]="COLOR_BURN",B[B.HARD_LIGHT=9]="HARD_LIGHT",B[B.SOFT_LIGHT=10]="SOFT_LIGHT",B[B.DIFFERENCE=11]="DIFFERENCE",B[B.EXCLUSION=12]="EXCLUSION",B[B.HUE=13]="HUE",B[B.SATURATION=14]="SATURATION",B[B.COLOR=15]="COLOR",B[B.LUMINOSITY=16]="LUMINOSITY",B[B.NORMAL_NPM=17]="NORMAL_NPM",B[B.ADD_NPM=18]="ADD_NPM",B[B.SCREEN_NPM=19]="SCREEN_NPM",B[B.NONE=20]="NONE",B[B.SRC_OVER=0]="SRC_OVER",B[B.SRC_IN=21]="SRC_IN",B[B.SRC_OUT=22]="SRC_OUT",B[B.SRC_ATOP=23]="SRC_ATOP",B[B.DST_OVER=24]="DST_OVER",B[B.DST_IN=25]="DST_IN",B[B.DST_OUT=26]="DST_OUT",B[B.DST_ATOP=27]="DST_ATOP",B[B.ERASE=26]="ERASE",B[B.SUBTRACT=28]="SUBTRACT",B[B.XOR=29]="XOR",(j=U=U||{})[j.POINTS=0]="POINTS",j[j.LINES=1]="LINES",j[j.LINE_LOOP=2]="LINE_LOOP",j[j.LINE_STRIP=3]="LINE_STRIP",j[j.TRIANGLES=4]="TRIANGLES",j[j.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",j[j.TRIANGLE_FAN=6]="TRIANGLE_FAN",(H=z=z||{})[H.RGBA=6408]="RGBA",H[H.RGB=6407]="RGB",H[H.ALPHA=6406]="ALPHA",H[H.LUMINANCE=6409]="LUMINANCE",H[H.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",H[H.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",H[H.DEPTH_STENCIL=34041]="DEPTH_STENCIL",(X=G=G||{})[X.TEXTURE_2D=3553]="TEXTURE_2D",X[X.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",X[X.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",X[X.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",X[X.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",X[X.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",X[X.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",X[X.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",X[X.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",(Y=V=V||{})[Y.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",Y[Y.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",Y[Y.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",Y[Y.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",Y[Y.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",Y[Y.FLOAT=5126]="FLOAT",Y[Y.HALF_FLOAT=36193]="HALF_FLOAT",(q=W=W||{})[q.NEAREST=0]="NEAREST",q[q.LINEAR=1]="LINEAR",(K=Z=Z||{})[K.CLAMP=33071]="CLAMP",K[K.REPEAT=10497]="REPEAT",K[K.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",(J=$=$||{})[J.OFF=0]="OFF",J[J.POW2=1]="POW2",J[J.ON=2]="ON",(tt=Q=Q||{})[tt.NPM=0]="NPM",tt[tt.UNPACK=1]="UNPACK",tt[tt.PMA=2]="PMA",tt[tt.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",tt[tt.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",tt[tt.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",(rt=et=et||{})[rt.NO=0]="NO",rt[rt.YES=1]="YES",rt[rt.AUTO=2]="AUTO",rt[rt.BLEND=0]="BLEND",rt[rt.CLEAR=1]="CLEAR",rt[rt.BLIT=2]="BLIT",(it=nt=nt||{})[it.AUTO=0]="AUTO",it[it.MANUAL=1]="MANUAL",(at=ot=ot||{}).LOW="lowp",at.MEDIUM="mediump",at.HIGH="highp",(ut=st=st||{})[ut.NONE=0]="NONE",ut[ut.SCISSOR=1]="SCISSOR",ut[ut.STENCIL=2]="STENCIL",ut[ut.SPRITE=3]="SPRITE",(lt=ht=ht||{})[lt.NONE=0]="NONE",lt[lt.LOW=2]="LOW",lt[lt.MEDIUM=4]="MEDIUM",lt[lt.HIGH=8]="HIGH",ct.RETINA_PREFIX=/@([0-9\.]+)x/;var yt,_t=!(ct.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!0),xt="5.3.0";function bt(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 wt(t){var e=t.toString(16);return"#"+(e="000000".substr(0,6-e.length)+e)}function Tt(t){return"string"==typeof t&&"#"===t[0]&&(t=t.substr(1)),parseInt(t,16)}var Et=function(){for(var t=[],e=[],r=0;r<32;r++)e[t[r]=r]=r;t[k.NORMAL_NPM]=k.NORMAL,t[k.ADD_NPM]=k.ADD,t[k.SCREEN_NPM]=k.SCREEN,e[k.NORMAL]=k.NORMAL_NPM,e[k.ADD]=k.ADD_NPM,e[k.SCREEN]=k.SCREEN_NPM;var n=[];return n.push(e),n.push(t),n}();function At(t,e){return Et[e?1:0][t]}function St(t,e){return 1===e?(255*e<<24)+t:0===e?0:(255*e<<24)+(((t>>16&255)*e+.5|0)<<16)+(((t>>8&255)*e+.5|0)<<8)+((255&t)*e+.5|0)}function Ot(t,e,r,n){return(r=r||new Float32Array(4))[0]=(t>>16&255)/255,r[1]=(t>>8&255)/255,r[2]=(255&t)/255,!n&&void 0!==n||(r[0]*=e,r[1]*=e,r[2]*=e),r[3]=e,r}Float32Array,Uint32Array,Int32Array,Uint8Array;function Mt(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 Pt(t){return!(t&t-1||!t)}function Ct(t){var e=(65535<t?1:0)<<4,r=(255<(t>>>=e)?1:0)<<3;return e|=r,e|=r=(15<(t>>>=r)?1:0)<<2,(e|=r=(3<(t>>>=r)?1:0)<<1)|(t>>>=r)>>1}function It(t,e,r){var n=t.length;if(!(n<=e||0===r)){for(var i=n-(r=n<e+r?n-e:r),o=e;o<i;++o)t[o]=t[o+r];t.length=i}}function Nt(t){return 0===t?0:t<0?-1:1}var Dt=0;function Rt(){return++Dt}var Ft={};function Lt(t,e,r){var n;void 0===r&&(r=3),Ft[e]||(void 0===(n=(new Error).stack)?console.warn("PixiJS Deprecation Warning: ",e+"\nDeprecated since v"+t):(n=n.split("\n").splice(r).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(n),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",e+"\nDeprecated since v"+t),console.warn(n))),Ft[e]=!0)}var kt={},Bt=Object.create(null),Ut=Object.create(null);var jt=(zt.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},zt.prototype.resize=function(t,e){this.canvas.width=t*this.resolution,this.canvas.height=e*this.resolution},zt.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(zt.prototype,"width",{get:function(){return this.canvas.width},set:function(t){this.canvas.width=t},enumerable:!1,configurable:!0}),Object.defineProperty(zt.prototype,"height",{get:function(){return this.canvas.height},set:function(t){this.canvas.height=t},enumerable:!1,configurable:!0}),zt);function zt(t,e,r){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.resolution=r||ct.RESOLUTION,this.resize(t,e)}var Ht;function Gt(t,e){var r=ct.RETINA_PREFIX.exec(t);return r?parseFloat(r[1]):void 0!==e?e:1}var Xt,Vt,Yt=2*Math.PI,Wt=180/Math.PI,qt=Math.PI/180;(Vt=Xt=Xt||{})[Vt.POLY=0]="POLY",Vt[Vt.RECT=1]="RECT",Vt[Vt.CIRC=2]="CIRC",Vt[Vt.ELIP=3]="ELIP",Vt[Vt.RREC=4]="RREC";var Zt=(Object.defineProperty(Kt.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(Kt.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(Kt.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(Kt.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(Kt,"EMPTY",{get:function(){return new Kt(0,0,0,0)},enumerable:!1,configurable:!0}),Kt.prototype.clone=function(){return new Kt(this.x,this.y,this.width,this.height)},Kt.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},Kt.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},Kt.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},Kt.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},Kt.prototype.fit=function(t){var e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),n=Math.max(this.y,t.y),i=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=n,this.height=Math.max(i-n,0),this},Kt.prototype.ceil=function(t,e){void 0===t&&(t=1),void 0===e&&(e=.001);var r=Math.ceil((this.x+this.width-e)*t)/t,n=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=r-this.x,this.height=n-this.y,this},Kt.prototype.enlarge=function(t){var e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),i=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=n,this.height=i-n,this},Kt);function Kt(t,e,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(n),this.type=Xt.RECT}var $t=(Jt.prototype.clone=function(){return new Jt(this.x,this.y,this.radius)},Jt.prototype.contains=function(t,e){if(this.radius<=0)return!1;var r=this.radius*this.radius,n=this.x-t,i=this.y-e;return(n*=n)+(i*=i)<=r},Jt.prototype.getBounds=function(){return new Zt(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},Jt);function Jt(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.radius=r,this.type=Xt.CIRC}var Qt=(te.prototype.clone=function(){return new te(this.x,this.y,this.width,this.height)},te.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var r=(t-this.x)/this.width,n=(e-this.y)/this.height;return(r*=r)+(n*=n)<=1},te.prototype.getBounds=function(){return new Zt(this.x-this.width,this.y-this.height,this.width,this.height)},te);function te(t,e,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=r,this.height=n,this.type=Xt.ELIP}var ee=(re.prototype.clone=function(){var t=new re(this.points.slice());return t.closeStroke=this.closeStroke,t},re.prototype.contains=function(t,e){for(var r=!1,n=this.points.length/2,i=0,o=n-1;i<n;o=i++){var a=this.points[2*i],s=this.points[2*i+1],u=this.points[2*o],h=this.points[2*o+1];e<s!=e<h&&t<(e-s)/(h-s)*(u-a)+a&&(r=!r)}return r},re);function re(){for(var t=arguments,e=[],r=0;r<arguments.length;r++)e[r]=t[r];var n=Array.isArray(e[0])?e[0]:e;if("number"!=typeof n[0]){for(var i=[],o=0,a=n.length;o<a;o++)i.push(n[o].x,n[o].y);n=i}this.points=n,this.type=Xt.POLY,this.closeStroke=!0}var ne=(ie.prototype.clone=function(){return new ie(this.x,this.y,this.width,this.height,this.radius)},ie.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 r=t-(this.x+this.radius),n=e-(this.y+this.radius),i=this.radius*this.radius;if(r*r+n*n<=i)return!0;if((r=t-(this.x+this.width-this.radius))*r+n*n<=i)return!0;if(r*r+(n=e-(this.y+this.height-this.radius))*n<=i)return!0;if((r=t-(this.x+this.radius))*r+n*n<=i)return!0}return!1},ie);function ie(t,e,r,n,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===i&&(i=20),this.x=t,this.y=e,this.width=r,this.height=n,this.radius=i,this.type=Xt.RREC}var oe=(ae.prototype.clone=function(){return new ae(this.x,this.y)},ae.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},ae.prototype.copyTo=function(t){return t.set(this.x,this.y),t},ae.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},ae.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},ae);function ae(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var se=(ue.prototype.clone=function(t,e){return void 0===t&&(t=this.cb),void 0===e&&(e=this.scope),new ue(t,e,this._x,this._y)},ue.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},ue.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},ue.prototype.copyTo=function(t){return t.set(this._x,this._y),t},ue.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},Object.defineProperty(ue.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(ue.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}),ue);function ue(t,e,r,n){void 0===r&&(r=0),void 0===n&&(n=0),this._x=r,this._y=n,this.cb=t,this.scope=e}var he=(le.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]},le.prototype.set=function(t,e,r,n,i,o){return this.a=t,this.b=e,this.c=r,this.d=n,this.tx=i,this.ty=o,this},le.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0),r[8]=1,r},le.prototype.apply=function(t,e){e=e||new oe;var r=t.x,n=t.y;return e.x=this.a*r+this.c*n+this.tx,e.y=this.b*r+this.d*n+this.ty,e},le.prototype.applyInverse=function(t,e){e=e||new oe;var r=1/(this.a*this.d+this.c*-this.b),n=t.x,i=t.y;return e.x=this.d*r*n+-this.c*r*i+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*i+-this.b*r*n+(-this.ty*this.a+this.tx*this.b)*r,e},le.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},le.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},le.prototype.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),n=this.a,i=this.c,o=this.tx;return this.a=n*e-this.b*r,this.b=n*r+this.b*e,this.c=i*e-this.d*r,this.d=i*r+this.d*e,this.tx=o*e-this.ty*r,this.ty=o*r+this.ty*e,this},le.prototype.append=function(t){var e=this.a,r=this.b,n=this.c,i=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*r+t.b*i,this.c=t.c*e+t.d*n,this.d=t.c*r+t.d*i,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*r+t.ty*i+this.ty,this},le.prototype.setTransform=function(t,e,r,n,i,o,a,s,u){return this.a=Math.cos(a+u)*i,this.b=Math.sin(a+u)*i,this.c=-Math.sin(a-s)*o,this.d=Math.cos(a-s)*o,this.tx=t-(r*this.a+n*this.c),this.ty=e-(r*this.b+n*this.d),this},le.prototype.prepend=function(t){var e,r,n=this.tx;return 1===t.a&&0===t.b&&0===t.c&&1===t.d||(e=this.a,r=this.c,this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d),this.tx=n*t.a+this.ty*t.c+t.tx,this.ty=n*t.b+this.ty*t.d+t.ty,this},le.prototype.decompose=function(t){var e=this.a,r=this.b,n=this.c,i=this.d,o=-Math.atan2(-n,i),a=Math.atan2(r,e),s=Math.abs(o+a);return s<1e-5||Math.abs(Yt-s)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=a),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(n*n+i*i),t.position.x=this.tx,t.position.y=this.ty,t},le.prototype.invert=function(){var t=this.a,e=this.b,r=this.c,n=this.d,i=this.tx,o=t*n-e*r;return this.a=n/o,this.b=-e/o,this.c=-r/o,this.d=t/o,this.tx=(r*this.ty-n*i)/o,this.ty=-(t*this.ty-e*i)/o,this},le.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},le.prototype.clone=function(){var t=new le;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},le.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},le.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(le,"IDENTITY",{get:function(){return new le},enumerable:!1,configurable:!0}),Object.defineProperty(le,"TEMP_MATRIX",{get:function(){return new le},enumerable:!1,configurable:!0}),le);function le(t,e,r,n,i,o){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),this.array=null,this.a=t,this.b=e,this.c=r,this.d=n,this.tx=i,this.ty=o}var ce=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],fe=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],de=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],pe=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ve=[],me=[],ge=Math.sign;!function(){for(var t=0;t<16;t++){var e=[];ve.push(e);for(var r=0;r<16;r++)for(var n=ge(ce[t]*ce[r]+de[t]*fe[r]),i=ge(fe[t]*ce[r]+pe[t]*fe[r]),o=ge(ce[t]*de[r]+de[t]*pe[r]),a=ge(fe[t]*de[r]+pe[t]*pe[r]),s=0;s<16;s++)if(ce[s]===n&&fe[s]===i&&de[s]===o&&pe[s]===a){e.push(s);break}}for(t=0;t<16;t++){var u=new he;u.set(ce[t],fe[t],de[t],pe[t],0,0),me.push(u)}}();var ye={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 ce[t]},uY:function(t){return fe[t]},vX:function(t){return de[t]},vY:function(t){return pe[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,e){return ve[t][e]},sub:function(t,e){return ve[t][ye.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)?0<=e?ye.S:ye.N:2*Math.abs(e)<=Math.abs(t)?0<t?ye.E:ye.W:0<e?0<t?ye.SE:ye.SW:0<t?ye.NE:ye.NW},matrixAppendRotationInv:function(t,e,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var i=me[ye.inv(e)];i.tx=r,i.ty=n,t.append(i)}},_e=(xe.prototype.onChange=function(){this._localID++},xe.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++},xe.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)},xe.prototype.updateTransform=function(t){var e,r,n=this.localTransform;this._localID!==this._currentLocalID&&(n.a=this._cx*this.scale.x,n.b=this._sx*this.scale.x,n.c=this._cy*this.scale.y,n.d=this._sy*this.scale.y,n.tx=this.position.x-(this.pivot.x*n.a+this.pivot.y*n.c),n.ty=this.position.y-(this.pivot.x*n.b+this.pivot.y*n.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID&&(e=t.worldTransform,(r=this.worldTransform).a=n.a*e.a+n.b*e.c,r.b=n.a*e.b+n.b*e.d,r.c=n.c*e.a+n.d*e.c,r.d=n.c*e.b+n.d*e.d,r.tx=n.tx*e.a+n.ty*e.c+e.tx,r.ty=n.tx*e.b+n.ty*e.d+e.ty,this._parentID=t._worldID,this._worldID++)},xe.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(xe.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),xe.IDENTITY=new xe,xe);function xe(){this.worldTransform=new he,this.localTransform=new he,this.position=new se(this.onChange,this,0,0),this.scale=new se(this.onChange,this,1,1),this.pivot=new se(this.onChange,this,0,0),this.skew=new se(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}ct.SORTABLE_CHILDREN=!1;var be=(we.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},we.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},we.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?Zt.EMPTY:((t=t||new Zt(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},we.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)},we.prototype.addQuad=function(t){var e=this.minX,r=this.minY,n=this.maxX,i=this.maxY,o=t[0],a=t[1],e=o<e?o:e,r=a<r?a:r,n=n<o?o:n,i=i<a?a:i;e=(o=t[2])<e?o:e,r=(a=t[3])<r?a:r,n=n<o?o:n,i=i<a?a:i,e=(o=t[4])<e?o:e,r=(a=t[5])<r?a:r,n=n<o?o:n,i=i<a?a:i,e=(o=t[6])<e?o:e,r=(a=t[7])<r?a:r,n=n<o?o:n,i=i<a?a:i,this.minX=e,this.minY=r,this.maxX=n,this.maxY=i},we.prototype.addFrame=function(t,e,r,n,i){this.addFrameMatrix(t.worldTransform,e,r,n,i)},we.prototype.addFrameMatrix=function(t,e,r,n,i){var o=t.a,a=t.b,s=t.c,u=t.d,h=t.tx,l=t.ty,c=o*e+s*r+h,f=a*e+u*r+l,d=c<(d=this.minX)?c:d,p=f<(p=this.minY)?f:p,v=(v=this.maxX)<c?c:v,m=(m=this.maxY)<f?f:m;d=(c=o*n+s*r+h)<d?c:d,p=(f=a*n+u*r+l)<p?f:p,v=v<c?c:v,m=m<f?f:m,d=(c=o*e+s*i+h)<d?c:d,p=(f=a*e+u*i+l)<p?f:p,v=v<c?c:v,m=m<f?f:m,d=(c=o*n+s*i+h)<d?c:d,p=(f=a*n+u*i+l)<p?f:p,v=v<c?c:v,m=m<f?f:m,this.minX=d,this.minY=p,this.maxX=v,this.maxY=m},we.prototype.addVertexData=function(t,e,r){for(var n=this.minX,i=this.minY,o=this.maxX,a=this.maxY,s=e;s<r;s+=2)var u=t[s],h=t[s+1],n=u<n?u:n,i=h<i?h:i,o=o<u?u:o,a=a<h?h:a;this.minX=n,this.minY=i,this.maxX=o,this.maxY=a},we.prototype.addVertices=function(t,e,r,n){this.addVerticesMatrix(t.worldTransform,e,r,n)},we.prototype.addVerticesMatrix=function(t,e,r,n,i,o){void 0===i&&(i=0),void 0===o&&(o=i);for(var a=t.a,s=t.b,u=t.c,h=t.d,l=t.tx,c=t.ty,f=this.minX,d=this.minY,p=this.maxX,v=this.maxY,m=r;m<n;m+=2)var g=e[m],y=e[m+1],_=a*g+u*y+l,x=h*y+s*g+c,f=Math.min(f,_-i),p=Math.max(p,_+i),d=Math.min(d,x-o),v=Math.max(v,x+o);this.minX=f,this.minY=d,this.maxX=p,this.maxY=v},we.prototype.addBounds=function(t){var e=this.minX,r=this.minY,n=this.maxX,i=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<r?t.minY:r,this.maxX=t.maxX>n?t.maxX:n,this.maxY=t.maxY>i?t.maxY:i},we.prototype.addBoundsMask=function(t,e){var r,n,i,o,a=t.minX>e.minX?t.minX:e.minX,s=t.minY>e.minY?t.minY:e.minY,u=t.maxX<e.maxX?t.maxX:e.maxX,h=t.maxY<e.maxY?t.maxY:e.maxY;a<=u&&s<=h&&(r=this.minX,n=this.minY,i=this.maxX,o=this.maxY,this.minX=a<r?a:r,this.minY=s<n?s:n,this.maxX=i<u?u:i,this.maxY=o<h?h:o)},we.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},we.prototype.addBoundsArea=function(t,e){var r,n,i,o,a=t.minX>e.x?t.minX:e.x,s=t.minY>e.y?t.minY:e.y,u=t.maxX<e.x+e.width?t.maxX:e.x+e.width,h=t.maxY<e.y+e.height?t.maxY:e.y+e.height;a<=u&&s<=h&&(r=this.minX,n=this.minY,i=this.maxX,o=this.maxY,this.minX=a<r?a:r,this.minY=s<n?s:n,this.maxX=i<u?u:i,this.maxY=o<h?h:o)},we.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)},we.prototype.addFramePad=function(t,e,r,n,i,o){t-=i,e-=o,r+=i,n+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>r?this.maxX:r,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>n?this.maxY:n},we);function we(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}var Te=function(t,e){return(Te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function Ee(t,e){function r(){this.constructor=t}Te(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var Ae,Se=(Ee(Oe,Ae=dt.a),Oe.mixin=function(t){for(var e=Object.keys(t),r=0;r<e.length;++r){var n=e[r];Object.defineProperty(Oe.prototype,n,Object.getOwnPropertyDescriptor(t,n))}},Oe.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},Oe.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},Oe.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 Zt),e=this._boundsRect),this._bounds.getRectangle(e)},Oe.prototype.getLocalBounds=function(t){t||(this._localBoundsRect||(this._localBoundsRect=new Zt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new be);var e=this.transform,r=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var n=this._bounds,i=this._boundsID;this._bounds=this._localBounds;var o=this.getBounds(!1,t);return this.parent=r,this.transform=e,this._bounds=n,this._bounds.updateID+=this._boundsID-i,o},Oe.prototype.toGlobal=function(t,e,r){return void 0===r&&(r=!1),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)},Oe.prototype.toLocal=function(t,e,r,n){return e&&(t=e.toGlobal(t,r,n)),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,r)},Oe.prototype.setParent=function(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t},Oe.prototype.setTransform=function(t,e,r,n,i,o,a,s,u){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=1),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=0),this.position.x=t,this.position.y=e,this.scale.x=r||1,this.scale.y=n||1,this.rotation=i,this.skew.x=o,this.skew.y=a,this.pivot.x=s,this.pivot.y=u,this},Oe.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(Oe.prototype,"_tempDisplayObjectParent",{get:function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new Pe),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),Oe.prototype.enableTempParent=function(){var t=this.parent;return this.parent=this._tempDisplayObjectParent,t},Oe.prototype.disableTempParent=function(t){this.parent=t},Object.defineProperty(Oe.prototype,"x",{get:function(){return this.position.x},set:function(t){this.transform.position.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"y",{get:function(){return this.position.y},set:function(t){this.transform.position.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.position.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(t){this.transform.pivot.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"skew",{get:function(){return this.transform.skew},set:function(t){this.transform.skew.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(t){this.transform.rotation=t},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"angle",{get:function(){return this.transform.rotation*Wt},set:function(t){this.transform.rotation=t*qt},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"worldVisible",{get:function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"mask",{get:function(){return this._mask},set:function(t){var e;this._mask&&((e=this._mask.maskObject||this._mask).renderable=!0,e.isMask=!1),this._mask=t,this._mask&&((e=this._mask.maskObject||this._mask).renderable=!1,e.isMask=!0)},enumerable:!1,configurable:!0}),Oe);function Oe(){var t=Ae.call(this)||this;return t.tempDisplayObjectParent=null,t.transform=new _e,t.alpha=1,t.visible=!0,t.renderable=!0,t.parent=null,t.worldAlpha=1,t._lastSortedIndex=0,t._zIndex=0,t.filterArea=null,t.filters=null,t._enabledFilters=null,t._bounds=new be,t._localBounds=null,t._boundsID=0,t._boundsRect=null,t._localBoundsRect=null,t._mask=null,t._destroyed=!1,t.isSprite=!1,t.isMask=!1,t}var Me,Pe=(Ee(Ce,Me=Se),Ce);function Ce(){var t=null!==Me&&Me.apply(this,arguments)||this;return t.sortDirty=null,t}function Ie(t,e){return t.zIndex===e.zIndex?t._lastSortedIndex-e._lastSortedIndex:t.zIndex-e.zIndex}Se.prototype.displayObjectUpdateTransform=Se.prototype.updateTransform;var Ne,De=(Ee(Re,Ne=Se),Re.prototype.onChildrenChange=function(t){},Re.prototype.addChild=function(){for(var t=arguments,e=[],r=0;r<arguments.length;r++)e[r]=t[r];if(1<e.length)for(var n=0;n<e.length;n++)this.addChild(e[n]);else{var i=e[0];i.parent&&i.parent.removeChild(i),(i.parent=this).sortDirty=!0,i.transform._parentID=-1,this.children.push(i),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",i,this,this.children.length-1),i.emit("added",this)}return e[0]},Re.prototype.addChildAt=function(t,e){if(e<0||e>this.children.length)throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),(t.parent=this).sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t},Re.prototype.swapChildren=function(t,e){var r,n;t!==e&&(r=this.getChildIndex(t),n=this.getChildIndex(e),this.children[r]=e,this.children[n]=t,this.onChildrenChange(r<n?r:n))},Re.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},Re.prototype.setChildIndex=function(t,e){if(e<0||e>=this.children.length)throw new Error("The index "+e+" supplied is out of bounds "+this.children.length);var r=this.getChildIndex(t);It(this.children,r,1),this.children.splice(e,0,t),this.onChildrenChange(e)},Re.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},Re.prototype.removeChild=function(){for(var t=arguments,e=[],r=0;r<arguments.length;r++)e[r]=t[r];if(1<e.length)for(var n=0;n<e.length;n++)this.removeChild(e[n]);else{var i=e[0],o=this.children.indexOf(i);if(-1===o)return null;i.parent=null,i.transform._parentID=-1,It(this.children,o,1),this._boundsID++,this.onChildrenChange(o),i.emit("removed",this),this.emit("childRemoved",i,this,o)}return e[0]},Re.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,It(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e},Re.prototype.removeChildren=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.children.length);var r,n=e-t;if(0<n&&n<=e){r=this.children.splice(t,n);for(var i=0;i<r.length;++i)r[i].parent=null,r[i].transform&&(r[i].transform._parentID=-1);for(this._boundsID++,this.onChildrenChange(t),i=0;i<r.length;++i)r[i].emit("removed",this),this.emit("childRemoved",r[i],this,i);return r}if(0==n&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},Re.prototype.sortChildren=function(){for(var t=!1,e=0,r=this.children.length;e<r;++e){var n=this.children[e];n._lastSortedIndex=e,t||0===n.zIndex||(t=!0)}t&&1<this.children.length&&this.children.sort(Ie),this.sortDirty=!1},Re.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 t=0,e=this.children.length;t<e;++t){var r=this.children[t];r.visible&&r.updateTransform()}},Re.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var t=0;t<this.children.length;t++){var e,r=this.children[t];r.visible&&r.renderable&&(r.calculateBounds(),r._mask?((e=r._mask.maskObject||r._mask).calculateBounds(),this._bounds.addBoundsMask(r._bounds,e._bounds)):r.filterArea?this._bounds.addBoundsArea(r._bounds,r.filterArea):this._bounds.addBounds(r._bounds))}this._bounds.updateID=this._boundsID},Re.prototype.getLocalBounds=function(t,e){void 0===e&&(e=!1);var r=Ne.prototype.getLocalBounds.call(this,t);if(!e)for(var n=0,i=this.children.length;n<i;++n){var o=this.children[n];o.visible&&o.updateTransform()}return r},Re.prototype._calculateBounds=function(){},Re.prototype.render=function(t){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(t);else{this._render(t);for(var e=0,r=this.children.length;e<r;++e)this.children[e].render(t)}},Re.prototype.renderAdvanced=function(t){t.batch.flush();var e=this.filters,r=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]);for(var n=this._enabledFilters.length=0;n<e.length;n++)e[n].enabled&&this._enabledFilters.push(e[n]);this._enabledFilters.length&&t.filter.push(this,this._enabledFilters)}r&&t.mask.push(this,this._mask),this._render(t);for(var n=0,i=this.children.length;n<i;n++)this.children[n].render(t);t.batch.flush(),r&&t.mask.pop(this),e&&this._enabledFilters&&this._enabledFilters.length&&t.filter.pop()},Re.prototype._render=function(t){},Re.prototype.destroy=function(t){Ne.prototype.destroy.call(this),this.sortDirty=!1;var e="boolean"==typeof t?t:t&&t.children,r=this.removeChildren(0,this.children.length);if(e)for(var n=0;n<r.length;++n)r[n].destroy(t)},Object.defineProperty(Re.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(t){var e=this.getLocalBounds().width;this.scale.x=0!==e?t/e:1,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(Re.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(t){var e=this.getLocalBounds().height;this.scale.y=0!==e?t/e:1,this._height=t},enumerable:!1,configurable:!0}),Re);function Re(){var t=Ne.call(this)||this;return t.children=[],t.sortableChildren=ct.SORTABLE_CHILDREN,t.sortDirty=!1,t}De.prototype.containerUpdateTransform=De.prototype.updateTransform;Se.mixin({accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1});var Fe,Le,ke=(Object.defineProperty(Be.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(Be.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),Be.prototype.createTouchHook=function(){var t=this,e=document.createElement("button");e.style.width="1px",e.style.height="1px",e.style.position="absolute",e.style.top="-1000px",e.style.left="-1000px",e.style.zIndex=2..toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessability for this content",e.addEventListener("focus",function(){t._isMobileAccessibility=!0,t.activate(),t.destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e},Be.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},Be.prototype.activate=function(){this._isActive||(this._isActive=!0,window.document.addEventListener("mousemove",this._onMouseMove,!0),window.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode&&this.renderer.view.parentNode.appendChild(this.div))},Be.prototype.deactivate=function(){this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,window.document.removeEventListener("mousemove",this._onMouseMove,!0),window.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode&&this.div.parentNode.removeChild(this.div))},Be.prototype.updateAccessibleObjects=function(t){if(t.visible&&t.accessibleChildren){t.accessible&&t.interactive&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);for(var e=t.children,r=0;r<e.length;r++)this.updateAccessibleObjects(e[r])}},Be.prototype.update=function(){var t=performance.now();if(!(O.android.device&&t<this.androidUpdateCount)&&(this.androidUpdateCount=t+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var e=this.renderer.view.getBoundingClientRect(),r=this.renderer.resolution,n=e.width/this.renderer.width*r,i=e.height/this.renderer.height*r,o=this.div;o.style.left=e.left+"px",o.style.top=e.top+"px",o.style.width=this.renderer.width+"px",o.style.height=this.renderer.height+"px";for(var a=0;a<this.children.length;a++){var s,u,h=this.children[a];h.renderId!==this.renderId?(h._accessibleActive=!1,It(this.children,a,1),this.div.removeChild(h._accessibleDiv),this.pool.push(h._accessibleDiv),h._accessibleDiv=null,a--):(o=h._accessibleDiv,s=h.hitArea,u=h.worldTransform,h.hitArea?(o.style.left=(u.tx+s.x*u.a)*n+"px",o.style.top=(u.ty+s.y*u.d)*i+"px",o.style.width=s.width*u.a*n+"px",o.style.height=s.height*u.d*i+"px"):(s=h.getBounds(),this.capHitArea(s),o.style.left=s.x*n+"px",o.style.top=s.y*i+"px",o.style.width=s.width*n+"px",o.style.height=s.height*i+"px",o.title!==h.accessibleTitle&&null!==h.accessibleTitle&&(o.title=h.accessibleTitle),o.getAttribute("aria-label")!==h.accessibleHint&&null!==h.accessibleHint&&o.setAttribute("aria-label",h.accessibleHint)),h.accessibleTitle===o.title&&h.tabIndex===o.tabIndex||(o.title=h.accessibleTitle,o.tabIndex=h.tabIndex,this.debug&&this.updateDebugHTML(o)))}this.renderId++}},Be.prototype.updateDebugHTML=function(t){t.innerHTML="type: "+t.type+"</br> title : "+t.title+"</br> tabIndex: "+t.tabIndex},Be.prototype.capHitArea=function(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0),t.x+t.width>this.renderer.width&&(t.width=this.renderer.width-t.x),t.y+t.height>this.renderer.height&&(t.height=this.renderer.height-t.y)},Be.prototype.addChild=function(t){var e=this.pool.pop();e||((e=document.createElement("button")).style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..toString(),e.style.borderStyle="none",-1<navigator.userAgent.toLowerCase().indexOf("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title="displayObject "+t.tabIndex),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,(t._accessibleDiv=e).displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex},Be.prototype._onClick=function(t){var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"click",e.eventData),e.dispatchEvent(t.target.displayObject,"pointertap",e.eventData),e.dispatchEvent(t.target.displayObject,"tap",e.eventData)},Be.prototype._onFocus=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive");var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"mouseover",e.eventData)},Be.prototype._onFocusOut=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite");var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"mouseout",e.eventData)},Be.prototype._onKeyDown=function(t){9===t.keyCode&&this.activate()},Be.prototype._onMouseMove=function(t){0===t.movementX&&0===t.movementY||this.deactivate()},Be.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,window.document.removeEventListener("mousemove",this._onMouseMove,!0),window.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},Be);function Be(t){this._hookDiv=null,(O.tablet||O.phone)&&this.createTouchHook();var e=document.createElement("div");e.style.width="100px",e.style.height="100px",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.zIndex=2..toString(),this.div=e,this.pool=[],this.renderId=0,this.debug=!1,this.renderer=t,this.children=[],this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._isActive=!1,this._isMobileAccessibility=!1,this.androidUpdateCount=0,this.androidUpdateFrequency=500,window.addEventListener("keydown",this._onKeyDown,!1)}ct.TARGET_FPMS=.06,(Le=Fe=Fe||{})[Le.INTERACTION=50]="INTERACTION",Le[Le.HIGH=25]="HIGH",Le[Le.NORMAL=0]="NORMAL",Le[Le.LOW=-25]="LOW",Le[Le.UTILITY=-50]="UTILITY";var Ue=(je.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},je.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},je.prototype.connect=function(t){(this.previous=t).next&&(t.next.previous=this),this.next=t.next,t.next=this},je.prototype.destroy=function(t){void 0===t&&(t=!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 e=this.next;return this.next=t?null:e,this.previous=null,e},je);function je(t,e,r,n){void 0===e&&(e=null),void 0===r&&(r=0),void 0===n&&(n=!1),this.fn=t,this.context=e,this.priority=r,this.once=n,this.next=null,this.previous=null,this._destroyed=!1}var ze=(He.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},He.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},He.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},He.prototype.add=function(t,e,r){return void 0===r&&(r=Fe.NORMAL),this._addListener(new Ue(t,e,r))},He.prototype.addOnce=function(t,e,r){return void 0===r&&(r=Fe.NORMAL),this._addListener(new Ue(t,e,r,!0))},He.prototype._addListener=function(t){var e=this._head.next,r=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(r);break}e=(r=e).next}t.previous||t.connect(r)}else t.connect(r);return this._startIfPossible(),this},He.prototype.remove=function(t,e){for(var r=this._head.next;r;)r=r.match(t,e)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(He.prototype,"count",{get:function(){if(!this._head)return 0;for(var t=0,e=this._head;e=e.next;)t++;return t},enumerable:!1,configurable:!0}),He.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},He.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},He.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},He.prototype.update=function(t){var e;if(void 0===t&&(t=performance.now()),t>this.lastTime){if((e=this.elapsedMS=t-this.lastTime)>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var r=t-this._lastFrame|0;if(r<this._minElapsedMS)return;this._lastFrame=t-r%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*ct.TARGET_FPMS;for(var n=this._head,i=n.next;i;)i=i.emit(this.deltaTime);n.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t},Object.defineProperty(He.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(He.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(t){var e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,ct.TARGET_FPMS);this._maxElapsedMS=1/r},enumerable:!1,configurable:!0}),Object.defineProperty(He.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(t){var e;0===t?this._minElapsedMS=0:(e=Math.max(this.minFPS,t),this._minElapsedMS=1/(e/1e3))},enumerable:!1,configurable:!0}),Object.defineProperty(He,"shared",{get:function(){var t;return He._shared||((t=He._shared=new He).autoStart=!0,t._protected=!0),He._shared},enumerable:!1,configurable:!0}),Object.defineProperty(He,"system",{get:function(){var t;return He._system||((t=He._system=new He).autoStart=!0,t._protected=!0),He._system},enumerable:!1,configurable:!0}),He);function He(){var e=this;this._head=new Ue(null,null,1/0),this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this.autoStart=!1,this.deltaTime=1,this.deltaMS=1/ct.TARGET_FPMS,this.elapsedMS=1/ct.TARGET_FPMS,this.lastTime=-1,this.speed=1,this.started=!1,this._protected=!1,this._lastFrame=-1,this._tick=function(t){e._requestId=null,e.started&&(e.update(t),e.started&&null===e._requestId&&e._head.next&&(e._requestId=requestAnimationFrame(e._tick)))}}var Ge=(Xe.init=function(t){var e=this;t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set:function(t){this._ticker&&this._ticker.remove(this.render,this),(this._ticker=t)&&t.add(this.render,this,Fe.LOW)},get:function(){return this._ticker}}),this.stop=function(){e._ticker.stop()},this.start=function(){e._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ze.shared:new ze,t.autoStart&&this.start()},Xe.destroy=function(){var t;this._ticker&&(t=this._ticker,this.ticker=null,t.destroy())},Xe);function Xe(){}var Ve=(Object.defineProperty(Ye.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),Ye.prototype.getLocalPosition=function(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)},Ye.prototype.copyEvent=function(t){"isPrimary"in t&&t.isPrimary&&(this.isPrimary=!0),this.button="button"in t&&t.button;var e="buttons"in t&&t.buttons;this.buttons=Number.isInteger(e)?e:"which"in t&&t.which,this.width="width"in t&&t.width,this.height="height"in t&&t.height,this.tiltX="tiltX"in t&&t.tiltX,this.tiltY="tiltY"in t&&t.tiltY,this.pointerType="pointerType"in t&&t.pointerType,this.pressure="pressure"in t&&t.pressure,this.rotationAngle="rotationAngle"in t&&t.rotationAngle,this.twist="twist"in t&&t.twist||0,this.tangentialPressure="tangentialPressure"in t&&t.tangentialPressure||0},Ye.prototype.reset=function(){this.isPrimary=!1},Ye);function Ye(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new oe,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}var We=function(t,e){return(We=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var qe=(Ze.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},Ze.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},Ze);function Ze(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}var Ke=($e.prototype._doSet=function(t,e){this._flags=e?this._flags|t:this._flags&~t},Object.defineProperty($e.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty($e.prototype,"flags",{get:function(){return this._flags},set:function(t){this._flags=t},enumerable:!1,configurable:!0}),Object.defineProperty($e.prototype,"none",{get:function(){return this._flags===$e.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty($e.prototype,"over",{get:function(){return 0!=(this._flags&$e.FLAGS.OVER)},set:function(t){this._doSet($e.FLAGS.OVER,t)},enumerable:!1,configurable:!0}),Object.defineProperty($e.prototype,"rightDown",{get:function(){return 0!=(this._flags&$e.FLAGS.RIGHT_DOWN)},set:function(t){this._doSet($e.FLAGS.RIGHT_DOWN,t)},enumerable:!1,configurable:!0}),Object.defineProperty($e.prototype,"leftDown",{get:function(){return 0!=(this._flags&$e.FLAGS.LEFT_DOWN)},set:function(t){this._doSet($e.FLAGS.LEFT_DOWN,t)},enumerable:!1,configurable:!0}),$e.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),$e);function $e(t){this._pointerId=t,this._flags=$e.FLAGS.NONE}var Je=(Qe.prototype.recursiveFindHit=function(t,e,r,n,i){if(!e||!e.visible)return!1;var o=t.data.global,a=!1,s=i=e.interactive||i,u=!0;if(e.hitArea?(n&&(e.worldTransform.applyInverse(o,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?a=!0:u=n=!1),s=!1):e._mask&&n&&(e._mask.containsPoint&&e._mask.containsPoint(o)||(n=!1)),u&&e.interactiveChildren&&e.children)for(var h=e.children,l=h.length-1;0<=l;l--){var c=h[l],f=this.recursiveFindHit(t,c,r,n,s);if(f){if(!c.parent)continue;s=!1,f&&(t.target&&(n=!1),a=!0)}}return i&&(n&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(o)&&(a=!0),e.interactive&&(a&&!t.target&&(t.target=e),r&&r(t,e,!!a))),a},Qe.prototype.findHit=function(t,e,r,n){this.recursiveFindHit(t,e,r,n,!1)},Qe);function Qe(){this._tempPoint=new oe}var tr={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(t){t?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};Se.mixin(tr);var er,rr,nr,ir={target:null,data:{global:null}},or=(er=dt.a,We(rr=sr,nr=er),rr.prototype=null===nr?Object.create(nr):(ar.prototype=nr.prototype,new ar),Object.defineProperty(sr.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(t){(this._useSystemTicker=t)?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(sr.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),sr.prototype.hitTest=function(t,e){return ir.target=null,ir.data.global=t,e=e||this.lastObjectRendered,this.processInteractive(ir,e,null,!0),ir.target},sr.prototype.setTargetElement=function(t,e){void 0===e&&(e=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=t,this.resolution=e,this.addEvents(),this.addTickerListener()},sr.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(ze.system.add(this.tickerUpdate,this,Fe.INTERACTION),this.tickerAdded=!0)},sr.prototype.removeTickerListener=function(){this.tickerAdded&&(ze.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},sr.prototype.addEvents=function(){var t;!this.eventsAdded&&this.interactionDOMElement&&(t=this.interactionDOMElement.style,window.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(window.document.addEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,!0),window.addEventListener("pointercancel",this.onPointerCancel,!0),window.addEventListener("pointerup",this.onPointerUp,!0)):(window.document.addEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,!0),window.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,!0)),this.eventsAdded=!0)},sr.prototype.removeEvents=function(){var t;this.eventsAdded&&this.interactionDOMElement&&(t=this.interactionDOMElement.style,window.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(window.document.removeEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,!0),window.removeEventListener("pointercancel",this.onPointerCancel,!0),window.removeEventListener("pointerup",this.onPointerUp,!0)):(window.document.removeEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,!0),window.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.interactionDOMElement=null,this.eventsAdded=!1)},sr.prototype.tickerUpdate=function(t){this._deltaTime+=t,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())},sr.prototype.update=function(){if(this.interactionDOMElement)if(this._didMove)this._didMove=!1;else{for(var t in this.cursor=null,this.activeInteractionData){var e,r;!this.activeInteractionData.hasOwnProperty(t)||(e=this.activeInteractionData[t]).originalEvent&&"touch"!==e.pointerType&&(r=this.configureInteractionEventForDOMEvent(this.eventData,e.originalEvent,e),this.processInteractive(r,this.lastObjectRendered,this.processPointerOverOut,!0))}this.setCursorMode(this.cursor)}},sr.prototype.setCursorMode=function(t){if(t=t||"default",this.currentCursorMode!==t){this.currentCursorMode=t;var e=this.cursorStyles[t];if(e)switch(typeof e){case"string":this.interactionDOMElement.style.cursor=e;break;case"function":e(t);break;case"object":Object.assign(this.interactionDOMElement.style,e)}else"string"!=typeof t||Object.prototype.hasOwnProperty.call(this.cursorStyles,t)||(this.interactionDOMElement.style.cursor=t)}},sr.prototype.dispatchEvent=function(t,e,r){r.stopPropagationHint&&t!==r.stopsPropagatingAt||(r.currentTarget=t,r.type=e,t.emit(e,r),t[e]&&t[e](r))},sr.prototype.delayDispatchEvent=function(t,e,r){this.delayedEvents.push({displayObject:t,eventString:e,eventData:r})},sr.prototype.mapPositionToPoint=function(t,e,r){var n=this.interactionDOMElement.parentElement?this.interactionDOMElement.getBoundingClientRect():{x:0,y:0,width:0,height:0},i=1/this.resolution;t.x=(e-n.left)*(this.interactionDOMElement.width/n.width)*i,t.y=(r-n.top)*(this.interactionDOMElement.height/n.height)*i},sr.prototype.processInteractive=function(t,e,r,n){var i=this.search.findHit(t,e,r,n),o=this.delayedEvents;if(!o.length)return i;t.stopPropagationHint=!1;var a=o.length;this.delayedEvents=[];for(var s=0;s<a;s++){var u=o[s],h=u.displayObject,l=u.eventString,c=u.eventData;c.stopsPropagatingAt===h&&(c.stopPropagationHint=!0),this.dispatchEvent(h,l,c)}return i},sr.prototype.onPointerDown=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);!this.autoPreventDefault||!e[0].isNormalized||!t.cancelable&&"cancelable"in t||t.preventDefault();for(var r=e.length,n=0;n<r;n++){var i,o=e[n],a=this.getInteractionDataForPointerId(o),s=this.configureInteractionEventForDOMEvent(this.eventData,o,a);s.data.originalEvent=t,this.processInteractive(s,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",s),"touch"===o.pointerType?this.emit("touchstart",s):"mouse"!==o.pointerType&&"pen"!==o.pointerType||(i=2===o.button,this.emit(i?"rightdown":"mousedown",this.eventData))}}},sr.prototype.processPointerDown=function(t,e,r){var n,i=t.data,o=t.data.identifier;r&&(e.trackedPointers[o]||(e.trackedPointers[o]=new Ke(o)),this.dispatchEvent(e,"pointerdown",t),"touch"===i.pointerType?this.dispatchEvent(e,"touchstart",t):"mouse"!==i.pointerType&&"pen"!==i.pointerType||((n=2===i.button)?e.trackedPointers[o].rightDown=!0:e.trackedPointers[o].leftDown=!0,this.dispatchEvent(e,n?"rightdown":"mousedown",t)))},sr.prototype.onPointerComplete=function(t,e,r){for(var n=this.normalizeToPointerData(t),i=n.length,o=t.target!==this.interactionDOMElement?"outside":"",a=0;a<i;a++){var s,u=n[a],h=this.getInteractionDataForPointerId(u),l=this.configureInteractionEventForDOMEvent(this.eventData,u,h);l.data.originalEvent=t,this.processInteractive(l,this.lastObjectRendered,r,e||!o),this.emit(e?"pointercancel":"pointerup"+o,l),"mouse"===u.pointerType||"pen"===u.pointerType?(s=2===u.button,this.emit(s?"rightup"+o:"mouseup"+o,l)):"touch"===u.pointerType&&(this.emit(e?"touchcancel":"touchend"+o,l),this.releaseInteractionDataForPointerId(u.pointerId))}},sr.prototype.onPointerCancel=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!0,this.processPointerCancel)},sr.prototype.processPointerCancel=function(t,e){var r=t.data,n=t.data.identifier;void 0!==e.trackedPointers[n]&&(delete e.trackedPointers[n],this.dispatchEvent(e,"pointercancel",t),"touch"===r.pointerType&&this.dispatchEvent(e,"touchcancel",t))},sr.prototype.onPointerUp=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!1,this.processPointerUp)},sr.prototype.processPointerUp=function(t,e,r){var n,i,o,a,s=t.data,u=t.data.identifier,h=e.trackedPointers[u],l="touch"===s.pointerType,c="mouse"===s.pointerType||"pen"===s.pointerType,f=!1;c&&(n=2===s.button,i=Ke.FLAGS,o=n?i.RIGHT_DOWN:i.LEFT_DOWN,a=void 0!==h&&h.flags&o,r?(this.dispatchEvent(e,n?"rightup":"mouseup",t),a&&(this.dispatchEvent(e,n?"rightclick":"click",t),f=!0)):a&&this.dispatchEvent(e,n?"rightupoutside":"mouseupoutside",t),h&&(n?h.rightDown=!1:h.leftDown=!1)),r?(this.dispatchEvent(e,"pointerup",t),l&&this.dispatchEvent(e,"touchend",t),h&&(c&&!f||this.dispatchEvent(e,"pointertap",t),l&&(this.dispatchEvent(e,"tap",t),h.over=!1))):h&&(this.dispatchEvent(e,"pointerupoutside",t),l&&this.dispatchEvent(e,"touchendoutside",t)),h&&h.none&&delete e.trackedPointers[u]},sr.prototype.onPointerMove=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);"mouse"!==e[0].pointerType&&"pen"!==e[0].pointerType||(this._didMove=!0,this.cursor=null);for(var r=e.length,n=0;n<r;n++){var i=e[n],o=this.getInteractionDataForPointerId(i),a=this.configureInteractionEventForDOMEvent(this.eventData,i,o);a.data.originalEvent=t,this.processInteractive(a,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",a),"touch"===i.pointerType&&this.emit("touchmove",a),"mouse"!==i.pointerType&&"pen"!==i.pointerType||this.emit("mousemove",a)}"mouse"===e[0].pointerType&&this.setCursorMode(this.cursor)}},sr.prototype.processPointerMove=function(t,e,r){var n=t.data,i="touch"===n.pointerType,o="mouse"===n.pointerType||"pen"===n.pointerType;o&&this.processPointerOverOut(t,e,r),this.moveWhenInside&&!r||(this.dispatchEvent(e,"pointermove",t),i&&this.dispatchEvent(e,"touchmove",t),o&&this.dispatchEvent(e,"mousemove",t))},sr.prototype.onPointerOut=function(t){var e,r,n;this.supportsTouchEvents&&"touch"===t.pointerType||("mouse"===(e=this.normalizeToPointerData(t)[0]).pointerType&&(this.mouseOverRenderer=!1,this.setCursorMode(null)),r=this.getInteractionDataForPointerId(e),(n=this.configureInteractionEventForDOMEvent(this.eventData,e,r)).data.originalEvent=e,this.processInteractive(n,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",n),"mouse"===e.pointerType||"pen"===e.pointerType?this.emit("mouseout",n):this.releaseInteractionDataForPointerId(r.identifier))},sr.prototype.processPointerOverOut=function(t,e,r){var n=t.data,i=t.data.identifier,o="mouse"===n.pointerType||"pen"===n.pointerType,a=e.trackedPointers[i];r&&!a&&(a=e.trackedPointers[i]=new Ke(i)),void 0!==a&&(r&&this.mouseOverRenderer?(a.over||(a.over=!0,this.delayDispatchEvent(e,"pointerover",t),o&&this.delayDispatchEvent(e,"mouseover",t)),o&&null===this.cursor&&(this.cursor=e.cursor)):a.over&&(a.over=!1,this.dispatchEvent(e,"pointerout",this.eventData),o&&this.dispatchEvent(e,"mouseout",t),a.none&&delete e.trackedPointers[i]))},sr.prototype.onPointerOver=function(t){var e=this.normalizeToPointerData(t)[0],r=this.getInteractionDataForPointerId(e),n=this.configureInteractionEventForDOMEvent(this.eventData,e,r);"mouse"===(n.data.originalEvent=e).pointerType&&(this.mouseOverRenderer=!0),this.emit("pointerover",n),"mouse"!==e.pointerType&&"pen"!==e.pointerType||this.emit("mouseover",n)},sr.prototype.getInteractionDataForPointerId=function(t){var e,r=t.pointerId;return 1===r||"mouse"===t.pointerType?e=this.mouse:this.activeInteractionData[r]?e=this.activeInteractionData[r]:((e=this.interactionDataPool.pop()||new Ve).identifier=r,this.activeInteractionData[r]=e),e.copyEvent(t),e},sr.prototype.releaseInteractionDataForPointerId=function(t){var e=this.activeInteractionData[t];e&&(delete this.activeInteractionData[t],e.reset(),this.interactionDataPool.push(e))},sr.prototype.configureInteractionEventForDOMEvent=function(t,e,r){return t.data=r,this.mapPositionToPoint(r.global,e.clientX,e.clientY),"touch"===e.pointerType&&(e.globalX=r.global.x,e.globalY=r.global.y),r.originalEvent=e,t.reset(),t},sr.prototype.normalizeToPointerData=function(t){var e,r=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var n=0,i=t.changedTouches.length;n<i;n++){var o=t.changedTouches[n];void 0===o.button&&(o.button=t.touches.length?1:0),void 0===o.buttons&&(o.buttons=t.touches.length?1:0),void 0===o.isPrimary&&(o.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===o.width&&(o.width=o.radiusX||1),void 0===o.height&&(o.height=o.radiusY||1),void 0===o.tiltX&&(o.tiltX=0),void 0===o.tiltY&&(o.tiltY=0),void 0===o.pointerType&&(o.pointerType="touch"),void 0===o.pointerId&&(o.pointerId=o.identifier||0),void 0===o.pressure&&(o.pressure=o.force||.5),void 0===o.twist&&(o.twist=0),void 0===o.tangentialPressure&&(o.tangentialPressure=0),void 0===o.layerX&&(o.layerX=o.offsetX=o.clientX),void 0===o.layerY&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,r.push(o)}else!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof window.PointerEvent?r.push(t):(void 0===(e=t).isPrimary&&(e.isPrimary=!0),void 0===e.width&&(e.width=1),void 0===e.height&&(e.height=1),void 0===e.tiltX&&(e.tiltX=0),void 0===e.tiltY&&(e.tiltY=0),void 0===e.pointerType&&(e.pointerType="mouse"),void 0===e.pointerId&&(e.pointerId=1),void 0===e.pressure&&(e.pressure=.5),void 0===e.twist&&(e.twist=0),void 0===e.tangentialPressure&&(e.tangentialPressure=0),e.isNormalized=!0,r.push(e));return r},sr.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},sr);function ar(){this.constructor=rr}function sr(t,e){var r=er.call(this)||this;return e=e||{},r.renderer=t,r.autoPreventDefault=void 0===e.autoPreventDefault||e.autoPreventDefault,r.interactionFrequency=e.interactionFrequency||10,r.mouse=new Ve,r.mouse.identifier=1,r.mouse.global.set(-999999),r.activeInteractionData={},r.activeInteractionData[1]=r.mouse,r.interactionDataPool=[],r.eventData=new qe,r.interactionDOMElement=null,r.moveWhenInside=!1,r.eventsAdded=!1,r.tickerAdded=!1,r.mouseOverRenderer=!1,r.supportsTouchEvents="ontouchstart"in window,r.supportsPointerEvents=!!window.PointerEvent,r.onPointerUp=r.onPointerUp.bind(r),r.processPointerUp=r.processPointerUp.bind(r),r.onPointerCancel=r.onPointerCancel.bind(r),r.processPointerCancel=r.processPointerCancel.bind(r),r.onPointerDown=r.onPointerDown.bind(r),r.processPointerDown=r.processPointerDown.bind(r),r.onPointerMove=r.onPointerMove.bind(r),r.processPointerMove=r.processPointerMove.bind(r),r.onPointerOut=r.onPointerOut.bind(r),r.processPointerOverOut=r.processPointerOverOut.bind(r),r.onPointerOver=r.onPointerOver.bind(r),r.cursorStyles={default:"inherit",pointer:"pointer"},r.currentCursorMode=null,r.cursor=null,r.resolution=1,r.delayedEvents=[],r.search=new Je,r._tempDisplayObject=new Pe,r._useSystemTicker=void 0===e.useSystemTicker||e.useSystemTicker,r.setTargetElement(r.renderer.view,r.renderer.resolution),r}var ur=(hr.prototype.emit=function(t,e,r,n,i,o,a,s){if(8<arguments.length)throw new Error("max arguments reached");var u=this.name,h=this.items;this._aliasCount++;for(var l=0,c=h.length;l<c;l++)h[l][u](t,e,r,n,i,o,a,s);return h===this.items&&this._aliasCount--,this},hr.prototype.ensureNonAliasedItems=function(){0<this._aliasCount&&1<this.items.length&&(this._aliasCount=0,this.items=this.items.slice(0))},hr.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},hr.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},hr.prototype.contains=function(t){return-1!==this.items.indexOf(t)},hr.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},hr.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(hr.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(hr.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),hr);function hr(t){this.items=[],this._name=t,this._aliasCount=0}Object.defineProperties(ur.prototype,{dispatch:{value:ur.prototype.emit},run:{value:ur.prototype.emit}}),ct.PREFER_ENV=O.any?I.WEBGL:I.WEBGL2,ct.STRICT_TEXTURE_CACHE=!1;var lr=[];function cr(t,e){if(!t)return null;var r,n="";"string"!=typeof t||(r=/\.(\w{3,4})(?:$|\?|#)/i.exec(t))&&(n=r[1].toLowerCase());for(var i=lr.length-1;0<=i;--i){var o=lr[i];if(o.test&&o.test(t,n))return new o(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var fr=function(t,e){return(fr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function dr(t,e){function r(){this.constructor=t}fr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var pr=(vr.prototype.bind=function(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},vr.prototype.unbind=function(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)},vr.prototype.resize=function(t,e){t===this._width&&e===this._height||(this._width=t,this._height=e,this.onResize.emit(t,e))},Object.defineProperty(vr.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),vr.prototype.update=function(){this.destroyed||this.onUpdate.emit()},vr.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(vr.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(vr.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),vr.prototype.style=function(t,e,r){return!1},vr.prototype.dispose=function(){},vr.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)},vr.test=function(t,e){return!1},vr);function vr(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ur("setRealSize"),this.onUpdate=new ur("update"),this.onError=new ur("onError")}var mr,gr=(dr(yr,mr=pr),yr.prototype.upload=function(t,e,r){var n=t.gl;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Q.UNPACK),r.width===e.width&&r.height===e.height?n.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.type,this.data):(r.width=e.width,r.height=e.height,n.texImage2D(e.target,0,r.internalFormat,e.width,e.height,0,e.format,r.type,this.data)),!0},yr.prototype.dispose=function(){this.data=null},yr.test=function(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array},yr);function yr(t,e){var r=this,n=e||{},i=n.width,o=n.height;if(!i||!o)throw new Error("BufferResource width or height invalid");return(r=mr.call(this,i,o)||this).data=t,r}var _r,xr={scaleMode:W.NEAREST,format:z.RGBA,alphaMode:Q.NPM},br=(dr(wr,_r=dt.a),Object.defineProperty(wr.prototype,"realWidth",{get:function(){return Math.ceil(this.width*this.resolution-1e-4)},enumerable:!1,configurable:!0}),Object.defineProperty(wr.prototype,"realHeight",{get:function(){return Math.ceil(this.height*this.resolution-1e-4)},enumerable:!1,configurable:!0}),wr.prototype.setStyle=function(t,e){var r;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this},wr.prototype.setSize=function(t,e,r){return this.resolution=r||this.resolution,this.width=t,this.height=e,this._refreshPOT(),this.update(),this},wr.prototype.setRealSize=function(t,e,r){return this.resolution=r||this.resolution,this.width=t/this.resolution,this.height=e/this.resolution,this._refreshPOT(),this.update(),this},wr.prototype._refreshPOT=function(){this.isPowerOfTwo=Pt(this.realWidth)&&Pt(this.realHeight)},wr.prototype.setResolution=function(t){var e=this.resolution;return e===t||(this.resolution=t,this.valid&&(this.width=this.width*e/t,this.height=this.height*e/t,this.emit("update",this)),this._refreshPOT()),this},wr.prototype.setResource=function(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this},wr.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):0<this.width&&0<this.height&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},wr.prototype.onError=function(t){this.emit("error",this,t)},wr.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Ut[this.cacheId],delete Bt[this.cacheId],this.cacheId=null),this.dispose(),wr.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},wr.prototype.dispose=function(){this.emit("dispose",this)},wr.prototype.castToBaseTexture=function(){return this},wr.from=function(t,e,r){void 0===r&&(r=ct.STRICT_TEXTURE_CACHE);var n="string"==typeof t,i=null,i=n?t:(t._pixiId||(t._pixiId="pixiid_"+Rt()),t._pixiId),o=Ut[i];if(n&&r&&!o)throw new Error('The cacheId "'+i+'" does not exist in BaseTextureCache.');return o||((o=new wr(t,e)).cacheId=i,wr.addToCache(o,i)),o},wr.fromBuffer=function(t,e,r,n){t=t||new Float32Array(e*r*4);var i=new gr(t,{width:e,height:r}),o=t instanceof Float32Array?V.FLOAT:V.UNSIGNED_BYTE;return new wr(i,Object.assign(xr,n||{width:e,height:r,type:o}))},wr.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),Ut[e]&&console.warn("BaseTexture added to the cache with an id ["+e+"] that already had an entry"),Ut[e]=t)},wr.removeFromCache=function(t){if("string"==typeof t){var e=Ut[t];if(e){var r=e.textureCacheIds.indexOf(t);return-1<r&&e.textureCacheIds.splice(r,1),delete Ut[t],e}}else if(t&&t.textureCacheIds){for(var n=0;n<t.textureCacheIds.length;++n)delete Ut[t.textureCacheIds[n]];return t.textureCacheIds.length=0,t}return null},wr._globalBatch=0,wr);function wr(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var r=_r.call(this)||this,n=(e=e||{}).alphaMode,i=e.mipmap,o=e.anisotropicLevel,a=e.scaleMode,s=e.width,u=e.height,h=e.wrapMode,l=e.format,c=e.type,f=e.target,d=e.resolution,p=e.resourceOptions;return!t||t instanceof pr||((t=cr(t,p)).internal=!0),r.width=s||0,r.height=u||0,r.resolution=d||ct.RESOLUTION,r.mipmap=void 0!==i?i:ct.MIPMAP_TEXTURES,r.anisotropicLevel=void 0!==o?o:ct.ANISOTROPIC_LEVEL,r.wrapMode=h||ct.WRAP_MODE,r.scaleMode=void 0!==a?a:ct.SCALE_MODE,r.format=l||z.RGBA,r.type=c||V.UNSIGNED_BYTE,r.target=f||G.TEXTURE_2D,r.alphaMode=void 0!==n?n:Q.UNPACK,void 0!==e.premultiplyAlpha&&(r.premultiplyAlpha=e.premultiplyAlpha),r.uid=Rt(),r.touched=0,r.isPowerOfTwo=!1,r._refreshPOT(),r._glTextures={},r.dirtyId=0,r.dirtyStyleId=0,r.cacheId=null,r.valid=0<s&&0<u,r.textureCacheIds=[],r.destroyed=!1,r.resource=null,r._batchEnabled=0,r._batchLocation=0,r.parentTextureArray=null,r.setResource(t),r}var Tr,Er=(dr(Ar,Tr=pr),Ar.prototype.initFromArray=function(t,e){for(var r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof pr?this.addResourceAt(t[r],r):this.addResourceAt(cr(t[r],e),r))},Ar.prototype.dispose=function(){for(var t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},Ar.prototype.addResourceAt=function(t,e){if(!this.items[e])throw new Error("Index "+e+" is out of bounds");return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this},Ar.prototype.bind=function(t){if(null!==this.baseTexture)throw new Error("Only one base texture per TextureArray is allowed");Tr.prototype.bind.call(this,t);for(var e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)},Ar.prototype.unbind=function(t){Tr.prototype.unbind.call(this,t);for(var e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)},Ar.prototype.load=function(){var n=this;if(this._load)return this._load;var t=this.items.map(function(t){return t.resource}).filter(function(t){return t}).map(function(t){return t.load()});return this._load=Promise.all(t).then(function(){var t=n.items[0],e=t.realWidth,r=t.realHeight;return n.resize(e,r),Promise.resolve(n)}),this._load},Ar);function Ar(t,e){var r=this,n=e||{},i=n.width,o=n.height;(r=Tr.call(this,i,o)||this).items=[],r.itemDirtyIds=[];for(var a=0;a<t;a++){var s=new br;r.items.push(s),r.itemDirtyIds.push(-2)}return r.length=t,r._load=null,r.baseTexture=null,r}var Sr,Or=(dr(Mr,Sr=Er),Mr.prototype.addBaseTextureAt=function(t,e){if(!t.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(t.resource,e),this},Mr.prototype.bind=function(t){Sr.prototype.bind.call(this,t),t.target=G.TEXTURE_2D_ARRAY},Mr.prototype.upload=function(t,e,r){var n=this.length,i=this.itemDirtyIds,o=this.items,a=t.gl;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,e.format,this._width,this._height,n,0,e.format,e.type,null);for(var s=0;s<n;s++){var u=o[s];i[s]<u.dirtyId&&(i[s]=u.dirtyId,u.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,s,u.resource.width,u.resource.height,1,e.format,e.type,u.resource.source))}return!0},Mr);function Mr(t,e){var r,n=this,i=e||{},o=i.width,a=i.height,s=Array.isArray(t)?(r=t).length:t,n=Sr.call(this,s,{width:o,height:a})||this;return r&&n.initFromArray(r,e),n}var Pr,Cr=(dr(Ir,Pr=pr),Ir.crossOrigin=function(t,e,r){void 0===r&&0!==e.indexOf("data:")?t.crossOrigin=function(t,e){if(void 0===e&&(e=window.location),0===t.indexOf("data:"))return"";e=e||window.location,(Ht=Ht||document.createElement("a")).href=t;var r=Object(mt.parse)(Ht.href),n=!r.port&&""===e.port||r.port===e.port;return r.hostname===e.hostname&&n&&r.protocol===e.protocol?"":"anonymous"}(e):!1!==r&&(t.crossOrigin="string"==typeof r?r:"anonymous")},Ir.prototype.upload=function(t,e,r,n){var i=t.gl,o=e.realWidth,a=e.realHeight;return n=n||this.source,i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Q.UNPACK),this.noSubImage||e.target!==i.TEXTURE_2D||r.width!==o||r.height!==a?(r.width=o,r.height=a,i.texImage2D(e.target,0,e.format,e.format,e.type,n)):i.texSubImage2D(i.TEXTURE_2D,0,0,0,e.format,e.type,n),!0},Ir.prototype.update=function(){var t,e,r;this.destroyed||(e=(t=this.source).naturalWidth||t.videoWidth||t.width,r=t.naturalHeight||t.videoHeight||t.height,this.resize(e,r),Pr.prototype.update.call(this))},Ir.prototype.dispose=function(){this.source=null},Ir);function Ir(t){var e=this,r=t.naturalWidth||t.videoWidth||t.width,n=t.naturalHeight||t.videoHeight||t.height;return(e=Pr.call(this,r,n)||this).source=t,e.noSubImage=!1,e}var Nr,Dr=(dr(Rr,Nr=Cr),Rr.test=function(t){var e=window.OffscreenCanvas;return!!(e&&t instanceof e)||t instanceof HTMLCanvasElement},Rr);function Rr(){return null!==Nr&&Nr.apply(this,arguments)||this}var Fr,Lr=(dr(kr,Fr=Er),kr.prototype.bind=function(t){Fr.prototype.bind.call(this,t),t.target=G.TEXTURE_CUBE_MAP},kr.prototype.addBaseTextureAt=function(t,e,r){if(void 0===r&&(r=this.linkBaseTexture),!this.items[e])throw new Error("Index "+e+" is out of bounds");if(!this.linkBaseTexture||t.parentTextureArray||0<Object.keys(t._glTextures).length){if(!t.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(t.resource,e)}else t.target=G.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this},kr.prototype.upload=function(t,e,r){for(var n=this.itemDirtyIds,i=0;i<kr.SIDES;i++){var o=this.items[i];n[i]<o.dirtyId&&(o.valid&&o.resource?(o.resource.upload(t,o,r),n[i]=o.dirtyId):n[i]<-1&&(t.gl.texImage2D(o.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),n[i]=-1))}return!0},kr.test=function(t){return Array.isArray(t)&&t.length===kr.SIDES},kr.SIDES=6,kr);function kr(t,e){var r=this,n=e||{},i=n.width,o=n.height,a=n.autoLoad,s=n.linkBaseTexture;if(t&&t.length!==kr.SIDES)throw new Error("Invalid length. Got "+t.length+", expected 6");r=Fr.call(this,6,{width:i,height:o})||this;for(var u=0;u<kr.SIDES;u++)r.items[u].target=G.TEXTURE_CUBE_MAP_POSITIVE_X+u;return r.linkBaseTexture=!1!==s,t&&r.initFromArray(t,e),!1!==a&&r.load(),r}var Br,Ur=(dr(jr,Br=Cr),jr.prototype.load=function(t){var i=this;return this._load||(void 0!==t&&(this.createBitmap=t),this._load=new Promise(function(t,e){var r=i.source;function n(){i.destroyed||(r.onload=null,r.onerror=null,i.resize(r.width,r.height),i._load=null,i.createBitmap?t(i.process()):t(i))}i.url=r.src,r.complete&&r.src?n():(r.onload=n,r.onerror=function(t){e(t),i.onError.emit(t)})})),this._load},jr.prototype.process=function(){var e=this,t=this.source;return null!==this._process?this._process:null===this.bitmap&&window.createImageBitmap?(this._process=window.createImageBitmap(t,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===Q.UNPACK?"premultiply":"none"}).then(function(t){return e.destroyed?Promise.reject():(e.bitmap=t,e.update(),e._process=null,Promise.resolve(e))}),this._process):Promise.resolve(this)},jr.prototype.upload=function(t,e,r){if("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),!this.createBitmap)return Br.prototype.upload.call(this,t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(Br.prototype.upload.call(this,t,e,r,this.bitmap),!this.preserveBitmap){var n=!0,i=e._glTextures;for(var o in i){var a=i[o];if(a!==r&&a.dirtyId!==e.dirtyId){n=!1;break}}n&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},jr.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,Br.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},jr.test=function(t){return"string"==typeof t||t instanceof HTMLImageElement},jr);function jr(t,e){var r,n=this;return e=e||{},t instanceof HTMLImageElement||(r=new Image,Cr.crossOrigin(r,t,e.crossorigin),r.src=t,t=r),n=Br.call(this,t)||this,!t.complete&&n._width&&n._height&&(n._width=0,n._height=0),n.url=t.src,n._process=null,n.preserveBitmap=!1,n.createBitmap=(void 0!==e.createBitmap?e.createBitmap:ct.CREATE_IMAGE_BITMAP)&&!!window.createImageBitmap,n.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,void 0!==e.premultiplyAlpha&&(n.premultiplyAlpha=e.premultiplyAlpha),n.bitmap=null,n._load=null,!1!==e.autoLoad&&n.load(),n}var zr,Hr=(dr(Gr,zr=Cr),Gr.prototype.load=function(){var e=this;return this._load||(this._load=new Promise(function(t){if(e._resolve=function(){e.resize(e.source.width,e.source.height),t(e)},/^\<svg/.test(e.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");e.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e.svg)))}e._loadSvg()})),this._load},Gr.prototype._loadSvg=function(){var o=this,a=new Image;Cr.crossOrigin(a,this.svg,this._crossorigin),a.src=this.svg,a.onerror=function(t){o._resolve&&(a.onerror=null,o.onError.emit(t))},a.onload=function(){if(o._resolve){var t=a.width,e=a.height;if(!t||!e)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var r=t*o.scale,n=e*o.scale;(o._overrideWidth||o._overrideHeight)&&(r=o._overrideWidth||o._overrideHeight/e*t,n=o._overrideHeight||o._overrideWidth/t*e),r=Math.round(r),n=Math.round(n);var i=o.source;i.width=r,i.height=n,i._pixiId="canvas_"+Rt(),i.getContext("2d").drawImage(a,0,0,t,e,0,0,r,n),o._resolve(),o._resolve=null}}},Gr.getSize=function(t){var e=Gr.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r},Gr.prototype.dispose=function(){zr.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},Gr.test=function(t,e){return"svg"===e||"string"==typeof t&&0===t.indexOf("data:image/svg+xml;base64")||"string"==typeof t&&0===t.indexOf("<svg")},Gr.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,Gr);function Gr(t,e){var r=this;return e=e||{},(r=zr.call(this,document.createElement("canvas"))||this)._width=0,r._height=0,r.svg=t,r.scale=e.scale||1,r._overrideWidth=e.width,r._overrideHeight=e.height,r._resolve=null,r._crossorigin=e.crossorigin,r._load=null,!1!==e.autoLoad&&r.load(),r}var Xr,Vr=(dr(Yr,Xr=Cr),Yr.prototype.update=function(t){var e;void 0===t&&(t=0),this.destroyed||(e=ze.shared.elapsedMS*this.source.playbackRate,this._msToNextUpdate=Math.floor(this._msToNextUpdate-e),(!this._updateFPS||this._msToNextUpdate<=0)&&(Xr.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0))},Yr.prototype.load=function(){var e=this;if(this._load)return this._load;var r=this.source;return(r.readyState===r.HAVE_ENOUGH_DATA||r.readyState===r.HAVE_FUTURE_DATA)&&r.width&&r.height&&(r.complete=!0),r.addEventListener("play",this._onPlayStart.bind(this)),r.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(r.addEventListener("canplay",this._onCanPlay),r.addEventListener("canplaythrough",this._onCanPlay),r.addEventListener("error",this._onError,!0)),this._load=new Promise(function(t){e.valid?t(e):(e._resolve=t,r.load())}),this._load},Yr.prototype._onError=function(){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(event)},Yr.prototype._isSourcePlaying=function(){var t=this.source;return 0<t.currentTime&&!1===t.paused&&!1===t.ended&&2<t.readyState},Yr.prototype._isSourceReady=function(){var t=this.source;return 3===t.readyState||4===t.readyState},Yr.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(ze.shared.add(this.update,this),this._isConnectedToTicker=!0)},Yr.prototype._onPlayStop=function(){this._isConnectedToTicker&&(ze.shared.remove(this.update,this),this._isConnectedToTicker=!1)},Yr.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},Yr.prototype.dispose=function(){this._isConnectedToTicker&&ze.shared.remove(this.update,this);var t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),Xr.prototype.dispose.call(this)},Object.defineProperty(Yr.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ze.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(ze.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(Yr.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),Yr.test=function(t,e){return t instanceof HTMLVideoElement||-1<Yr.TYPES.indexOf(e)},Yr.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Yr.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},Yr);function Yr(t,e){var r=this;if(e=e||{},!(t instanceof HTMLVideoElement)){var n=document.createElement("video");n.setAttribute("preload","auto"),n.setAttribute("webkit-playsinline",""),n.setAttribute("playsinline",""),"string"==typeof t&&(t=[t]);var i=t[0].src||t[0];Cr.crossOrigin(n,i,e.crossorigin);for(var o=0;o<t.length;++o){var a=document.createElement("source"),s=t[o],u=s.src,h=s.mime,l=(u=u||t[o]).split("?").shift().toLowerCase(),c=l.substr(l.lastIndexOf(".")+1),h=h||Yr.MIME_TYPES[c]||"video/"+c;a.src=u,a.type=h,n.appendChild(a)}t=n}return(r=Xr.call(this,t)||this).noSubImage=!0,r._autoUpdate=!0,r._isConnectedToTicker=!1,r._updateFPS=e.updateFPS||0,r._msToNextUpdate=0,r.autoPlay=!1!==e.autoPlay,r._load=null,r._resolve=null,r._onCanPlay=r._onCanPlay.bind(r),r._onError=r._onError.bind(r),!1!==e.autoLoad&&r.load(),r}var Wr,qr=(dr(Zr,Wr=Cr),Zr.test=function(t){return!!window.createImageBitmap&&t instanceof ImageBitmap},Zr);function Zr(){return null!==Wr&&Wr.apply(this,arguments)||this}lr.push(Ur,qr,Dr,Vr,Hr,gr,Lr,Or);var Kr=($r.prototype.destroy=function(){this.renderer=null},$r);function $r(t){this.renderer=t}var Jr,Qr=(dr(tn,Jr=gr),tn.prototype.upload=function(t,e,r){var n=t.gl;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Q.UNPACK),r.width===e.width&&r.height===e.height?n.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.type,this.data):(r.width=e.width,r.height=e.height,n.texImage2D(e.target,0,1===t.context.webGLVersion?n.DEPTH_COMPONENT:n.DEPTH_COMPONENT16,e.width,e.height,0,e.format,e.type,this.data)),!0},tn);function tn(){return null!==Jr&&Jr.apply(this,arguments)||this}var en=(Object.defineProperty(rn.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),rn.prototype.addColorTexture=function(t,e){return void 0===t&&(t=0),this.colorTextures[t]=e||new br(null,{scaleMode:W.NEAREST,resolution:1,mipmap:$.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},rn.prototype.addDepthTexture=function(t){return this.depthTexture=t||new br(new Qr(null,{width:this.width,height:this.height}),{scaleMode:W.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:$.OFF,format:z.DEPTH_COMPONENT,type:V.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},rn.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},rn.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},rn.prototype.resize=function(t,e){if(t=Math.ceil(t),e=Math.ceil(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var r=0;r<this.colorTextures.length;r++){var n=this.colorTextures[r],i=n.resolution;n.setSize(t/i,e/i)}this.depthTexture&&(i=this.depthTexture.resolution,this.depthTexture.setSize(t/i,e/i))}},rn.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},rn.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},rn);function rn(t,e){this.width=Math.ceil(t||100),this.height=Math.ceil(e||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 ur("disposeFramebuffer"),this.multisample=ht.NONE}var nn,on=(dr(an,nn=br),an.prototype.resize=function(t,e){t=Math.ceil(t),e=Math.ceil(e),this.framebuffer.resize(t*this.resolution,e*this.resolution)},an.prototype.dispose=function(){this.framebuffer.dispose(),nn.prototype.dispose.call(this)},an.prototype.destroy=function(){nn.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},an);function an(t){var e=this;"number"==typeof t&&(t={width:arguments[0],height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}),e=nn.call(this,null,t)||this;var r=t||{},n=r.width,i=r.height;return e.mipmap=0,e.width=Math.ceil(n)||100,e.height=Math.ceil(i)||100,e.valid=!0,e.clearColor=[0,0,0,0],e.framebuffer=new en(e.width*e.resolution,e.height*e.resolution).addColorTexture(0,e),e.maskStack=[],e.filterStack=[{}],e}var sn=(un.prototype.set=function(t,e,r){var n,i,o,a,s=e.width,u=e.height;r?(n=t.width/2/s,i=t.height/2/u,o=t.x/s+n,a=t.y/u+i,r=ye.add(r,ye.NW),this.x0=o+n*ye.uX(r),this.y0=a+i*ye.uY(r),r=ye.add(r,2),this.x1=o+n*ye.uX(r),this.y1=a+i*ye.uY(r),r=ye.add(r,2),this.x2=o+n*ye.uX(r),this.y2=a+i*ye.uY(r),r=ye.add(r,2),this.x3=o+n*ye.uX(r),this.y3=a+i*ye.uY(r)):(this.x0=t.x/s,this.y0=t.y/u,this.x1=(t.x+t.width)/s,this.y1=t.y/u,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/u,this.x3=t.x/s,this.y3=(t.y+t.height)/u),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},un);function un(){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)}var hn,ln=new sn,cn=(dr(fn,hn=dt.a),fn.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},fn.prototype.onBaseTextureUpdated=function(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)},fn.prototype.destroy=function(t){var e;this.baseTexture&&(t&&((e=this.baseTexture)&&e.url&&Bt[e.url]&&fn.removeFromCache(e.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,fn.removeFromCache(this),this.textureCacheIds=null},fn.prototype.clone=function(){return new fn(this.baseTexture,this.frame.clone(),this.orig.clone(),this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor)},fn.prototype.updateUvs=function(){this._uvs===ln&&(this._uvs=new sn),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},fn.from=function(t,e,r){void 0===e&&(e={}),void 0===r&&(r=ct.STRICT_TEXTURE_CACHE);var n="string"==typeof t,i=null,i=n?t:(t._pixiId||(t._pixiId="pixiid_"+Rt()),t._pixiId),o=Bt[i];if(n&&r&&!o)throw new Error('The cacheId "'+i+'" does not exist in TextureCache.');return o||(e.resolution||(e.resolution=Gt(t)),(o=new fn(new br(t,e))).baseTexture.cacheId=i,br.addToCache(o.baseTexture,i),fn.addToCache(o,i)),o},fn.fromURL=function(t,e){var r=Object.assign({autoLoad:!1},null==e?void 0:e.resourceOptions),n=fn.from(t,Object.assign({resourceOptions:r},e),!1),i=n.baseTexture.resource;return n.baseTexture.valid?Promise.resolve(n):i.load().then(function(){return Promise.resolve(n)})},fn.fromBuffer=function(t,e,r,n){return new fn(br.fromBuffer(t,e,r,n))},fn.fromLoader=function(t,e,r){var n=new Ur(t);n.url=e;var i=new fn(new br(n,{scaleMode:ct.SCALE_MODE,resolution:Gt(e)}));return r=r||e,br.addToCache(i.baseTexture,r),fn.addToCache(i,r),r!==e&&(br.addToCache(i.baseTexture,e),fn.addToCache(i,e)),i},fn.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),Bt[e]&&console.warn("Texture added to the cache with an id ["+e+"] that already had an entry"),Bt[e]=t)},fn.removeFromCache=function(t){if("string"==typeof t){var e=Bt[t];if(e){var r=e.textureCacheIds.indexOf(t);return-1<r&&e.textureCacheIds.splice(r,1),delete Bt[t],e}}else if(t&&t.textureCacheIds){for(var n=0;n<t.textureCacheIds.length;++n)Bt[t.textureCacheIds[n]]===t&&delete Bt[t.textureCacheIds[n]];return t.textureCacheIds.length=0,t}return null},Object.defineProperty(fn.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(fn.prototype,"frame",{get:function(){return this._frame},set:function(t){this._frame=t,this.noFrame=!1;var e=t.x,r=t.y,n=t.width,i=t.height,o=e+n>this.baseTexture.width,a=r+i>this.baseTexture.height;if(o||a){var s=o&&a?"and":"or",u="X: "+e+" + "+n+" = "+(e+n)+" > "+this.baseTexture.width,h="Y: "+r+" + "+i+" = "+(r+i)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+u+" "+s+" "+h)}this.valid=n&&i&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(fn.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(fn.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(fn.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),fn.prototype.castToBaseTexture=function(){return this.baseTexture},fn);function fn(t,e,r,n,i,o){var a=hn.call(this)||this;if(a.noFrame=!1,e||(a.noFrame=!0,e=new Zt(0,0,1,1)),t instanceof fn&&(t=t.baseTexture),a.baseTexture=t,a._frame=e,a.trim=n,a.valid=!1,a._uvs=ln,a.uvMatrix=null,a.orig=r||e,a._rotate=Number(i||0),!0===i)a._rotate=2;else if(a._rotate%2!=0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return a.defaultAnchor=o?new oe(o.x,o.y):new oe(0,0),a._updateID=0,a.textureCacheIds=[],t.valid?a.noFrame?t.valid&&a.onBaseTextureUpdated(t):a.frame=e:t.once("loaded",a.onBaseTextureUpdated,a),a.noFrame&&t.on("update",a.onBaseTextureUpdated,a),a}function dn(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}cn.EMPTY=new cn(new br),dn(cn.EMPTY),dn(cn.EMPTY.baseTexture),cn.WHITE=function(){var t=document.createElement("canvas");t.width=16,t.height=16;var e=t.getContext("2d");return e.fillStyle="white",e.fillRect(0,0,16,16),new cn(new br(new Dr(t)))}(),dn(cn.WHITE),dn(cn.WHITE.baseTexture);var pn,vn=(dr(mn,pn=cn),Object.defineProperty(mn.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),mn.prototype.resize=function(t,e,r){void 0===r&&(r=!0),t=Math.ceil(t),e=Math.ceil(e),this.valid=0<t&&0<e,this._frame.width=this.orig.width=t,this._frame.height=this.orig.height=e,r&&this.baseTexture.resize(t,e),this.updateUvs()},mn.prototype.setResolution=function(t){var e=this.baseTexture;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))},mn.create=function(t){return"number"==typeof t&&(t={width:t,height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}),new mn(new on(t))},mn);function mn(t,e){var r,n,i,o,a=this,s=null;return t instanceof on||(r=arguments[1],n=arguments[2],i=arguments[3],o=arguments[4],console.warn("Please use RenderTexture.create("+r+", "+n+") instead of the ctor directly."),s=arguments[0],e=null,t=new on({width:r,height:n,scaleMode:i,resolution:o})),(a=pn.call(this,t,e)||this).legacyRenderer=s,a.valid=!0,a.filterFrame=null,a.filterPoolKey=null,a.updateUvs(),a}var gn=(yn.prototype.createTexture=function(t,e){var r=new on(Object.assign({width:t,height:e,resolution:1},this.textureOptions));return new vn(r)},yn.prototype.getOptimalTexture=function(t,e,r){void 0===r&&(r=1);var n=yn.SCREEN_KEY;t*=r,e*=r,this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight||(n=(65535&(t=Mt(t)))<<16|65535&(e=Mt(e))),this.texturePool[n]||(this.texturePool[n]=[]);var i=this.texturePool[n].pop();return(i=i||this.createTexture(t,e)).filterPoolKey=n,i.setResolution(r),i},yn.prototype.getFilterTexture=function(t,e){var r=this.getOptimalTexture(t.width,t.height,e||t.resolution);return r.filterFrame=t.filterFrame,r},yn.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},yn.prototype.returnFilterTexture=function(t){this.returnTexture(t)},yn.prototype.clear=function(t){if(t=!1!==t)for(var e in this.texturePool){var r=this.texturePool[e];if(r)for(var n=0;n<r.length;n++)r[n].destroy(!0)}this.texturePool={}},yn.prototype.setScreenSize=function(t){if(t.width!==this._pixelsWidth||t.height!==this._pixelsHeight){var e=yn.SCREEN_KEY,r=this.texturePool[e];if(this.enableFullScreen=0<t.width&&0<t.height,r)for(var n=0;n<r.length;n++)r[n].destroy(!0);this.texturePool[e]=[],this._pixelsWidth=t.width,this._pixelsHeight=t.height}},yn.SCREEN_KEY="screen",yn);function yn(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}var _n=(xn.prototype.destroy=function(){this.buffer=null},xn.from=function(t,e,r,n,i){return new xn(t,e,r,n,i)},xn);function xn(t,e,r,n,i,o,a){void 0===e&&(e=0),void 0===r&&(r=!1),void 0===n&&(n=5126),this.buffer=t,this.size=e,this.normalized=r,this.type=n,this.stride=i,this.start=o,this.instance=a}var bn=0,wn=(Tn.prototype.update=function(t){this.data=t||this.data,this._updateID++},Tn.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},Tn.prototype.destroy=function(){this.dispose(),this.data=null},Tn.from=function(t){return t instanceof Array&&(t=new Float32Array(t)),new Tn(t)},Tn);function Tn(t,e,r){void 0===e&&(e=!0),void 0===r&&(r=!1),this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=bn++,this.disposeRunner=new ur("disposeBuffer")}function En(t){if(4===t.BYTES_PER_ELEMENT)return t instanceof Float32Array?"Float32Array":t instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===t.BYTES_PER_ELEMENT){if(t instanceof Uint16Array)return"Uint16Array"}else if(1===t.BYTES_PER_ELEMENT&&t instanceof Uint8Array)return"Uint8Array";return null}var An={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};var Sn={5126:4,5123:2,5121:1},On=0,Mn={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array},Pn=(Cn.prototype.addAttribute=function(t,e,r,n,i,o,a,s){if(void 0===r&&(r=0),void 0===n&&(n=!1),void 0===s&&(s=!1),!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof wn||(e instanceof Array&&(e=new Float32Array(e)),e=new wn(e));var u=t.split("|");if(1<u.length){for(var h=0;h<u.length;h++)this.addAttribute(u[h],e,r,n,i);return this}var l=this.buffers.indexOf(e);return-1===l&&(this.buffers.push(e),l=this.buffers.length-1),this.attributes[t]=new _n(l,r,n,i,o,a,s),this.instanced=this.instanced||s,this},Cn.prototype.getAttribute=function(t){return this.attributes[t]},Cn.prototype.getBuffer=function(t){return this.buffers[this.getAttribute(t).buffer]},Cn.prototype.addIndex=function(t){return t instanceof wn||(t instanceof Array&&(t=new Uint16Array(t)),t=new wn(t)),t.index=!0,this.indexBuffer=t,-1===this.buffers.indexOf(t)&&this.buffers.push(t),this},Cn.prototype.getIndex=function(){return this.indexBuffer},Cn.prototype.interleave=function(){if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;var t,e=[],r=[],n=new wn;for(t in this.attributes){var i=this.attributes[t],o=this.buffers[i.buffer];e.push(o.data),r.push(i.size*Sn[i.type]/4),i.buffer=0}for(n.data=function(t,e){for(var r=0,n=0,i={},o=0;o<t.length;o++)n+=e[o],r+=t[o].length;for(var a=new ArrayBuffer(4*r),s=null,u=0,o=0;o<t.length;o++){var h=e[o],l=t[o],c=En(l);i[c]||(i[c]=new An[c](a)),s=i[c];for(var f=0;f<l.length;f++)s[(f/h|0)*n+u+f%h]=l[f];u+=h}return new Float32Array(a)}(e,r),t=0;t<this.buffers.length;t++)this.buffers[t]!==this.indexBuffer&&this.buffers[t].destroy();return this.buffers=[n],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},Cn.prototype.getSize=function(){for(var t in this.attributes){var e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0},Cn.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},Cn.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},Cn.prototype.clone=function(){for(var t=new Cn,e=0;e<this.buffers.length;e++)t.buffers[e]=new wn(this.buffers[e].data.slice(0));for(var e in this.attributes){var r=this.attributes[e];t.attributes[e]=new _n(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.index=!0),t},Cn.merge=function(t){for(var e,r=new Cn,n=[],i=[],o=[],a=0;a<t.length;a++){e=t[a];for(var s=0;s<e.buffers.length;s++)i[s]=i[s]||0,i[s]+=e.buffers[s].data.length,o[s]=0}for(a=0;a<e.buffers.length;a++)n[a]=new(Mn[En(e.buffers[a].data)])(i[a]),r.buffers[a]=new wn(n[a]);for(a=0;a<t.length;a++)for(e=t[a],s=0;s<e.buffers.length;s++)n[s].set(e.buffers[s].data,o[s]),o[s]+=e.buffers[s].data.length;if(r.attributes=e.attributes,e.indexBuffer){r.indexBuffer=r.buffers[e.buffers.indexOf(e.indexBuffer)],r.indexBuffer.index=!0;for(var u=0,h=0,l=0,c=0,a=0;a<e.buffers.length;a++)if(e.buffers[a]!==e.indexBuffer){c=a;break}for(var a in e.attributes){var f=e.attributes[a];(0|f.buffer)===c&&(h+=f.size*Sn[f.type]/4)}for(a=0;a<t.length;a++){for(var d=t[a].indexBuffer.data,s=0;s<d.length;s++)r.indexBuffer.data[s+l]+=u;u+=e.buffers[c].data.length/h,l+=d.length}}return r},Cn);function Cn(t,e){void 0===t&&(t=[]),void 0===e&&(e={}),this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=On++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ur("disposeGeometry"),this.refCount=0}var In,Nn=(dr(Dn,In=Pn),Dn);function Dn(){var t=In.call(this)||this;return t.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),t}var Rn,Fn=(dr(Ln,Rn=Pn),Ln.prototype.map=function(t,e){var r,n;return this.uvs[0]=0,this.uvs[1]=0,this.uvs[2]=0+e.width/t.width,this.uvs[3]=0,this.uvs[4]=0+e.width/t.width,this.uvs[5]=0+e.height/t.height,this.uvs[6]=0,this.uvs[7]=0+e.height/t.height,r=e.x,n=e.y,this.vertices[0]=r,this.vertices[1]=n,this.vertices[2]=r+e.width,this.vertices[3]=n,this.vertices[4]=r+e.width,this.vertices[5]=n+e.height,this.vertices[6]=r,this.vertices[7]=n+e.height,this.invalidate(),this},Ln.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},Ln);function Ln(){var t=Rn.call(this)||this;return t.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),t.uvs=new Float32Array([0,0,1,0,1,1,0,1]),t.vertexBuffer=new wn(t.vertices),t.uvBuffer=new wn(t.uvs),t.addAttribute("aVertexPosition",t.vertexBuffer).addAttribute("aTextureCoord",t.uvBuffer).addIndex([0,1,2,0,2,3]),t}var kn=0,Bn=(Un.prototype.update=function(){this.dirtyId++},Un.prototype.add=function(t,e,r){this.uniforms[t]=new Un(e,r)},Un.from=function(t,e){return new Un(t,e)},Un);function Un(t,e){this.uniforms=t,this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=kn++,this.static=!!e}var jn=(zn.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},zn);function zn(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.sourceFrame=new Zt,this.destinationFrame=new Zt,this.filters=[]}var Hn,Gn=(dr(Xn,Hn=Kr),Xn.prototype.push=function(t,e){for(var r=this.renderer,n=this.defaultFilterStack,i=this.statePool.pop()||new jn,o=e[0].resolution,a=e[0].padding,s=e[0].autoFit,u=e[0].legacy,h=1;h<e.length;h++)var l=e[h],o=Math.min(o,l.resolution),a=this.useMaxPadding?Math.max(a,l.padding):a+l.padding,s=s||l.autoFit,u=u||l.legacy;1===n.length&&(this.defaultFilterStack[0].renderTexture=r.renderTexture.current),n.push(i),i.resolution=o,i.legacy=u,i.target=t,i.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),i.sourceFrame.pad(a),s&&i.sourceFrame.fit(this.renderer.renderTexture.sourceFrame),i.sourceFrame.ceil(o),i.renderTexture=this.getOptimalFilterTexture(i.sourceFrame.width,i.sourceFrame.height,o),i.filters=e,i.destinationFrame.width=i.renderTexture.width,i.destinationFrame.height=i.renderTexture.height,i.renderTexture.filterFrame=i.sourceFrame,r.renderTexture.bind(i.renderTexture,i.sourceFrame),r.renderTexture.clear()},Xn.prototype.pop=function(){var t=this.defaultFilterStack,e=t.pop(),r=e.filters;this.activeState=e;var n=this.globalUniforms.uniforms;n.outputFrame=e.sourceFrame,n.resolution=e.resolution;var i,o=n.inputSize,a=n.inputPixel,s=n.inputClamp;o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],a[0]=o[0]*e.resolution,a[1]=o[1]*e.resolution,a[2]=1/a[0],a[3]=1/a[1],s[0]=.5*a[2],s[1]=.5*a[3],s[2]=e.sourceFrame.width*o[2]-.5*a[2],s[3]=e.sourceFrame.height*o[3]-.5*a[3],e.legacy&&((i=n.filterArea)[0]=e.destinationFrame.width,i[1]=e.destinationFrame.height,i[2]=e.sourceFrame.x,i[3]=e.sourceFrame.y,n.filterClamp=n.inputClamp),this.globalUniforms.update();var u=t[t.length-1];if(1<e.renderTexture.framebuffer.multisample&&this.renderer.framebuffer.blit(),1===r.length)r[0].apply(this,e.renderTexture,u.renderTexture,et.BLEND,e),this.returnFilterTexture(e.renderTexture);else{var h=e.renderTexture;(f=this.getOptimalFilterTexture(h.width,h.height,e.resolution)).filterFrame=h.filterFrame;for(var l=0,l=0;l<r.length-1;++l){r[l].apply(this,h,f,et.CLEAR,e);var c=h,h=f,f=c}r[l].apply(this,h,u.renderTexture,et.BLEND,e),this.returnFilterTexture(h),this.returnFilterTexture(f)}e.clear(),this.statePool.push(e)},Xn.prototype.bindAndClear=function(t,e){void 0===e&&(e=et.CLEAR),this.renderer.renderTexture.bind(t,t?t.filterFrame:null),"boolean"==typeof e&&(e=e?et.CLEAR:et.BLEND,Lt("5.2.1","Use CLEAR_MODES when using clear applyFilter option")),(e===et.CLEAR||e===et.BLIT&&this.forceClear)&&this.renderer.renderTexture.clear()},Xn.prototype.applyFilter=function(t,e,r,n){var i=this.renderer;this.bindAndClear(r,n),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,i.state.set(t.state),i.shader.bind(t),t.legacy?(this.quadUv.map(e._frame,e.filterFrame),i.geometry.bind(this.quadUv),i.geometry.draw(U.TRIANGLES)):(i.geometry.bind(this.quad),i.geometry.draw(U.TRIANGLE_STRIP))},Xn.prototype.calculateSpriteMatrix=function(t,e){var r=this.activeState,n=r.sourceFrame,i=r.destinationFrame,o=e._texture.orig,a=t.set(i.width,0,0,i.height,n.x,n.y),s=e.worldTransform.copyTo(he.TEMP_MATRIX);return s.invert(),a.prepend(s),a.scale(1/o.width,1/o.height),a.translate(e.anchor.x,e.anchor.y),a},Xn.prototype.destroy=function(){this.texturePool.clear(!1)},Xn.prototype.getOptimalFilterTexture=function(t,e,r){return void 0===r&&(r=1),this.texturePool.getOptimalTexture(t,e,r)},Xn.prototype.getFilterTexture=function(t,e){var r;"number"==typeof t&&(r=t,t=e,e=r),t=t||this.activeState.renderTexture;var n=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution);return n.filterFrame=t.filterFrame,n},Xn.prototype.returnFilterTexture=function(t){this.texturePool.returnTexture(t)},Xn.prototype.emptyPool=function(){this.texturePool.clear(!0)},Xn.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},Xn);function Xn(t){var e=Hn.call(this,t)||this;return e.defaultFilterStack=[{}],e.texturePool=new gn,e.texturePool.setScreenSize(t.view),e.statePool=[],e.quad=new Nn,e.quadUv=new Fn,e.tempRect=new Zt,e.activeState={},e.globalUniforms=new Bn({outputFrame:e.tempRect,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),e.forceClear=!1,e.useMaxPadding=!1,e}var Vn=(Yn.prototype.flush=function(){},Yn.prototype.destroy=function(){this.renderer=null},Yn.prototype.start=function(){},Yn.prototype.stop=function(){this.flush()},Yn.prototype.render=function(t){},Yn);function Yn(t){this.renderer=t}var Wn,qn=(dr(Zn,Wn=Kr),Zn.prototype.setObjectRenderer=function(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())},Zn.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},Zn.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},Zn.prototype.copyBoundTextures=function(t,e){for(var r=this.renderer.texture.boundTextures,n=e-1;0<=n;--n)t[n]=r[n]||null,t[n]&&(t[n]._batchLocation=n)},Zn.prototype.boundArray=function(t,e,r,n){for(var i=t.elements,o=t.ids,a=t.count,s=0,u=0;u<a;u++){var h=i[u],l=h._batchLocation;if(0<=l&&l<n&&e[l]===h)o[u]=l;else for(;s<n;){var c=e[s];if(!c||c._batchEnabled!==r||c._batchLocation!==s){o[u]=s,e[h._batchLocation=s]=h;break}s++}}},Zn);function Zn(t){var e=Wn.call(this,t)||this;return e.emptyRenderer=new Vn(t),e.currentRenderer=e.emptyRenderer,e}var Kn,$n=0,Jn=(dr(Qn,Kn=Kr),Object.defineProperty(Qn.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),Qn.prototype.contextChange=function(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=$n++,t.isContextLost()&&t.getExtension("WEBGL_lose_context")&&t.getExtension("WEBGL_lose_context").restoreContext()},Qn.prototype.initFromContext=function(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=$n++,this.renderer.runners.contextChange.emit(t)},Qn.prototype.initFromOptions=function(t){var e=this.createContext(this.renderer.view,t);this.initFromContext(e)},Qn.prototype.createContext=function(t,e){var r;if(ct.PREFER_ENV>=I.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,!(r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),this.gl},Qn.prototype.getExtensions=function(){var t=this.gl;1===this.webGLVersion?Object.assign(this.extensions,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),loseContext:t.getExtension("WEBGL_lose_context"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,{anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),colorBufferFloat:t.getExtension("EXT_color_buffer_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear")})},Qn.prototype.handleContextLost=function(t){t.preventDefault()},Qn.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},Qn.prototype.destroy=function(){var t=this.renderer.view;t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},Qn.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},Qn.prototype.validateContext=function(t){t.getContextAttributes().stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var e="WebGL2RenderingContext"in window&&t instanceof window.WebGL2RenderingContext||!!t.getExtension("OES_element_index_uint");(this.supports.uint32Indices=e)||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},Qn);function Qn(t){var e=Kn.call(this,t)||this;return e.webGLVersion=1,e.extensions={},e.supports={uint32Indices:!1},e.handleContextLost=e.handleContextLost.bind(e),e.handleContextRestored=e.handleContextRestored.bind(e),t.view.addEventListener("webglcontextlost",e.handleContextLost,!1),t.view.addEventListener("webglcontextrestored",e.handleContextRestored,!1),e}var ti,ei=function(t){this.framebuffer=t,this.stencil=null,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.multisample=ht.NONE,this.msaaBuffer=null,this.blitFramebuffer=null},ri=new Zt,ni=(dr(ii,ti=Kr),ii.prototype.contextChange=function(){var e,t,r=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Zt,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion?(e=this.renderer.context.extensions.drawBuffers,t=this.renderer.context.extensions.depthTexture,ct.PREFER_ENV===I.WEBGL_LEGACY&&(t=e=null),e?r.drawBuffers=function(t){return e.drawBuffersWEBGL(t)}:(this.hasMRT=!1,r.drawBuffers=function(){}),t||(this.writeDepthTexture=!1)):this.msaaSamples=r.getInternalformatParameter(r.RENDERBUFFER,r.RGBA8,r.SAMPLES)},ii.prototype.bind=function(t,e){var r=this.gl;if(t){var n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,this.updateFramebuffer(t)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var i=0;i<t.colorTextures.length;i++){var o=t.colorTextures[i];this.renderer.texture.unbind(o.parentTextureArray||o)}t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,t.width,t.height)}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},ii.prototype.setViewport=function(t,e,r,n){var i=this.viewport;i.width===r&&i.height===n&&i.x===t&&i.y===e||(i.x=t,i.y=e,i.width=r,i.height=n,this.gl.viewport(t,e,r,n))},Object.defineProperty(ii.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}),ii.prototype.clear=function(t,e,r,n,i){void 0===i&&(i=F.COLOR|F.DEPTH);var o=this.gl;o.clearColor(t,e,r,n),o.clear(i)},ii.prototype.initFramebuffer=function(t){var e=this.gl,r=new ei(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r},ii.prototype.resizeFramebuffer=function(t){var e=this.gl,r=t.glFramebuffers[this.CONTEXT_UID];r.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,r.stencil),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));for(var n=t.colorTextures,i=0;i<n.length;i++)this.renderer.texture.bind(n[i],0);t.depthTexture&&this.renderer.texture.bind(t.depthTexture,0)},ii.prototype.updateFramebuffer=function(t){var e=this.gl,r=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures.length;e.drawBuffers||(n=Math.min(n,1)),1<r.multisample&&(r.msaaBuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,e.RGBA8,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,r.msaaBuffer));for(var i,o,a,s=[],u=0;u<n;u++)0===u&&1<r.multisample||(o=(i=t.colorTextures[u]).parentTextureArray||i,this.renderer.texture.bind(o,0),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+u,i.target,o._glTextures[this.CONTEXT_UID].texture,0),s.push(e.COLOR_ATTACHMENT0+u));1<s.length&&e.drawBuffers(s),t.depthTexture&&this.writeDepthTexture&&(a=t.depthTexture,this.renderer.texture.bind(a,0),e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a._glTextures[this.CONTEXT_UID].texture,0)),r.stencil||!t.stencil&&!t.depth||(r.stencil=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,r.stencil),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height),t.depthTexture||e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r.stencil))},ii.prototype.detectSamples=function(t){var e=this.msaaSamples,r=ht.NONE;if(t<=1||null===e)return r;for(var n=0;n<e.length;n++)if(e[n]<=t){r=e[n];break}return 1===r&&(r=ht.NONE),r},ii.prototype.blit=function(t,e,r){var n=this.current,i=this.renderer,o=this.gl,a=this.CONTEXT_UID;if(2===i.context.webGLVersion&&n){var s=n.glFramebuffers[a];if(s){if(!t){if(s.multisample<=1)return;s.blitFramebuffer||(s.blitFramebuffer=new en(n.width,n.height),s.blitFramebuffer.addColorTexture(0,n.colorTextures[0])),(t=s.blitFramebuffer).width=n.width,t.height=n.height}e||((e=ri).width=n.width,e.height=n.height),r=r||e;var u=e.width===r.width&&e.height===r.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,s.framebuffer),o.blitFramebuffer(e.x,e.y,e.width,e.height,r.x,r.y,r.width,r.height,o.COLOR_BUFFER_BIT,u?o.NEAREST:o.LINEAR)}}},ii.prototype.disposeFramebuffer=function(t,e){var r,n=t.glFramebuffers[this.CONTEXT_UID],i=this.gl;n&&(delete t.glFramebuffers[this.CONTEXT_UID],0<=(r=this.managedFramebuffers.indexOf(t))&&this.managedFramebuffers.splice(r,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(n.framebuffer),n.stencil&&i.deleteRenderbuffer(n.stencil)))},ii.prototype.disposeAll=function(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var r=0;r<e.length;r++)this.disposeFramebuffer(e[r],t)},ii.prototype.forceStencil=function(){var t,e,r,n,i,o=this.current;!o||(t=o.glFramebuffers[this.CONTEXT_UID])&&!t.stencil&&(o.enableStencil(),e=o.width,r=o.height,i=(n=this.gl).createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,i),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,e,r),t.stencil=i,n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,i))},ii.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new Zt},ii);function ii(t){var e=ti.call(this,t)||this;return e.managedFramebuffers=[],e.unknownFramebuffer=new en(10,10),e.msaaSamples=null,e}var oi,ai=function(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0},si={5126:4,5123:2,5121:1},ui=(dr(hi,oi=Kr),hi.prototype.contextChange=function(){this.disposeAll(!0);var e,o,t=this.gl=this.renderer.gl,r=this.renderer.context;this.CONTEXT_UID=this.renderer.CONTEXT_UID,t.createVertexArray||(e=this.renderer.context.extensions.vertexArrayObject,ct.PREFER_ENV===I.WEBGL_LEGACY&&(e=null),e?(t.createVertexArray=function(){return e.createVertexArrayOES()},t.bindVertexArray=function(t){return e.bindVertexArrayOES(t)},t.deleteVertexArray=function(t){return e.deleteVertexArrayOES(t)}):(this.hasVao=!1,t.createVertexArray=function(){return null},t.bindVertexArray=function(){return null},t.deleteVertexArray=function(){return null})),t.vertexAttribDivisor||((o=t.getExtension("ANGLE_instanced_arrays"))?(t.vertexAttribDivisor=function(t,e){return o.vertexAttribDivisorANGLE(t,e)},t.drawElementsInstanced=function(t,e,r,n,i){return o.drawElementsInstancedANGLE(t,e,r,n,i)},t.drawArraysInstanced=function(t,e,r,n){return o.drawArraysInstancedANGLE(t,e,r,n)}):this.hasInstance=!1),this.canUseUInt32ElementIndex=2===r.webGLVersion||!!r.extensions.uint32ElementIndex},hi.prototype.bind=function(t,e){e=e||this.renderer.shader.shader;var r=this.gl,n=t.glVertexArrayObjects[this.CONTEXT_UID];n||((this.managedGeometries[t.id]=t).disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=n={});var i=n[e.program.id]||this.initGeometryVao(t,e.program);this._activeGeometry=t,this._activeVao!==i&&(this._activeVao=i,this.hasVao?r.bindVertexArray(i):this.activateVao(t,e.program)),this.updateBuffers()},hi.prototype.reset=function(){this.unbind()},hi.prototype.updateBuffers=function(){for(var t=this._activeGeometry,e=this.gl,r=0;r<t.buffers.length;r++){var n,i,o=t.buffers[r],a=o._glBuffers[this.CONTEXT_UID];o._updateID!==a.updateID&&(a.updateID=o._updateID,n=o.index?e.ELEMENT_ARRAY_BUFFER:e.ARRAY_BUFFER,e.bindBuffer(n,a.buffer),(this._boundBuffer=a).byteLength>=o.data.byteLength?e.bufferSubData(n,0,o.data):(i=o.static?e.STATIC_DRAW:e.DYNAMIC_DRAW,a.byteLength=o.data.byteLength,e.bufferData(n,o.data,i)))}},hi.prototype.checkCompatibility=function(t,e){var r=t.attributes,n=e.attributeData;for(var i in n)if(!r[i])throw new Error('shader and geometry incompatible, geometry missing the "'+i+'" attribute')},hi.prototype.getSignature=function(t,e){var r=t.attributes,n=e.attributeData,i=["g",t.id];for(var o in r)n[o]&&i.push(o);return i.join("-")},hi.prototype.initGeometryVao=function(t,e){this.checkCompatibility(t,e);var r=this.gl,n=this.CONTEXT_UID,i=this.getSignature(t,e),o=t.glVertexArrayObjects[this.CONTEXT_UID],a=o[i];if(a)return o[e.id]=a;var s=t.buffers,u=t.attributes,h={},l={};for(var c in s)h[c]=0,l[c]=0;for(var c in u)!u[c].size&&e.attributeData[c]?u[c].size=e.attributeData[c].size:u[c].size||console.warn("PIXI Geometry attribute '"+c+"' size cannot be determined (likely the bound shader does not have the attribute)"),h[u[c].buffer]+=u[c].size*si[u[c].type];for(var c in u){var f=u[c],d=f.size;void 0===f.stride&&(h[f.buffer]===d*si[f.type]?f.stride=0:f.stride=h[f.buffer]),void 0===f.start&&(f.start=l[f.buffer],l[f.buffer]+=d*si[f.type])}a=r.createVertexArray(),r.bindVertexArray(a);for(var p=0;p<s.length;p++){var v=s[p];v._glBuffers[n]||(v._glBuffers[n]=new ai(r.createBuffer()),(this.managedBuffers[v.id]=v).disposeRunner.add(this)),v._glBuffers[n].refCount++}return this.activateVao(t,e),this._activeVao=a,o[e.id]=a,o[i]=a},hi.prototype.disposeBuffer=function(t,e){var r,n;this.managedBuffers[t.id]&&(delete this.managedBuffers[t.id],r=t._glBuffers[this.CONTEXT_UID],n=this.gl,t.disposeRunner.remove(this),r&&(e||n.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID]))},hi.prototype.disposeGeometry=function(t,e){if(this.managedGeometries[t.id]){delete this.managedGeometries[t.id];var r=t.glVertexArrayObjects[this.CONTEXT_UID],n=this.gl,i=t.buffers;if(t.disposeRunner.remove(this),r){for(var o,a=0;a<i.length;a++){var s=i[a]._glBuffers[this.CONTEXT_UID];s.refCount--,0!==s.refCount||e||this.disposeBuffer(i[a],e)}if(!e)for(var u in r)"g"===u[0]&&(o=r[u],this._activeVao===o&&this.unbind(),n.deleteVertexArray(o));delete t.glVertexArrayObjects[this.CONTEXT_UID]}}},hi.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedGeometries),r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t);for(e=Object.keys(this.managedBuffers),r=0;r<e.length;r++)this.disposeBuffer(this.managedBuffers[e[r]],t)},hi.prototype.activateVao=function(t,e){var r=this.gl,n=this.CONTEXT_UID,i=t.buffers,o=t.attributes;t.indexBuffer&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.indexBuffer._glBuffers[n].buffer);var a=null;for(var s in o){var u=o[s],h=i[u.buffer]._glBuffers[n];if(e.attributeData[s]){a!==h&&(r.bindBuffer(r.ARRAY_BUFFER,h.buffer),a=h);var l=e.attributeData[s].location;if(r.enableVertexAttribArray(l),r.vertexAttribPointer(l,u.size,u.type||r.FLOAT,u.normalized,u.stride,u.start),u.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");r.vertexAttribDivisor(l,1)}}}},hi.prototype.draw=function(t,e,r,n){var i,o,a=this.gl,s=this._activeGeometry;return s.indexBuffer?(o=2===(i=s.indexBuffer.data.BYTES_PER_ELEMENT)?a.UNSIGNED_SHORT:a.UNSIGNED_INT,2===i||4===i&&this.canUseUInt32ElementIndex?s.instanced?a.drawElementsInstanced(t,e||s.indexBuffer.data.length,o,(r||0)*i,n||1):a.drawElements(t,e||s.indexBuffer.data.length,o,(r||0)*i):console.warn("unsupported index buffer type: uint32")):s.instanced?a.drawArraysInstanced(t,r,e||s.getSize(),n||1):a.drawArrays(t,r,e||s.getSize()),this},hi.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},hi);function hi(t){var e=oi.call(this,t)||this;return e._activeGeometry=null,e._activeVao=null,e.hasVao=!0,e.hasInstance=!0,e.canUseUInt32ElementIndex=!1,e.managedGeometries={},e.managedBuffers={},e}var li=(ci.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=st.NONE,this.autoDetect=!0),this._target=null},ci.prototype.copyCountersOrReset=function(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},ci);function ci(t){void 0===t&&(t=null),this.type=st.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._target=null}function fi(t,e,r){var n=t.createShader(e);return t.shaderSource(n,r),t.compileShader(n),n}function di(t,e,r,n){var i=fi(t,t.VERTEX_SHADER,e),o=fi(t,t.FRAGMENT_SHADER,r),a=t.createProgram();if(t.attachShader(a,i),t.attachShader(a,o),n)for(var s in n)t.bindAttribLocation(a,n[s],s);return t.linkProgram(a),t.getProgramParameter(a,t.LINK_STATUS)||(t.getShaderParameter(i,t.COMPILE_STATUS)||(console.warn(e),console.error(t.getShaderInfoLog(i))),t.getShaderParameter(o,t.COMPILE_STATUS)||(console.warn(r),console.error(t.getShaderInfoLog(o))),console.error("Pixi.js Error: Could not initialize shader."),console.error("gl.VALIDATE_STATUS",t.getProgramParameter(a,t.VALIDATE_STATUS)),console.error("gl.getError()",t.getError()),""!==t.getProgramInfoLog(a)&&console.warn("Pixi.js Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(a)),t.deleteProgram(a),a=null),t.deleteShader(i),t.deleteShader(o),a}function pi(t){for(var e=new Array(t),r=0;r<e.length;r++)e[r]=!1;return e}function vi(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"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"bool":return!1;case"bvec2":return pi(2*e);case"bvec3":return pi(3*e);case"bvec4":return pi(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 mi,gi={},yi=gi;function _i(){var t,e;return(yi===gi||yi&&yi.isContextLost())&&(t=document.createElement("canvas"),e=void 0,ct.PREFER_ENV>=I.WEBGL2&&(e=t.getContext("webgl2",{})),e||((e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}))?e.getExtension("WEBGL_draw_buffers"):e=null),yi=e),yi}function xi(t,e,r){if("precision"===t.substring(0,9))return r!==ot.HIGH&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t;var n=e;return e===ot.HIGH&&r!==ot.HIGH&&(n=ot.MEDIUM),"precision "+n+" float;\n"+t}var bi={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};var wi=null,Ti={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray"};function Ei(t,e){if(!wi){var r=Object.keys(Ti);wi={};for(var n=0;n<r.length;++n){var i=r[n];wi[t[i]]=Ti[i]}}return wi[e]}var Ai=[{test:function(t){return"float"===t.type&&1===t.size},code:function(t){return'\n if(uv["'+t+'"] !== ud["'+t+'"].value)\n {\n ud["'+t+'"].value = uv["'+t+'"]\n gl.uniform1f(ud["'+t+'"].location, uv["'+t+'"])\n }\n '}},{test:function(t){return("sampler2D"===t.type||"samplerCube"===t.type||"sampler2DArray"===t.type)&&1===t.size&&!t.isArray},code:function(t){return't = syncData.textureCount++;\n\n renderer.texture.bind(uv["'+t+'"], t);\n\n if(ud["'+t+'"].value !== t)\n {\n ud["'+t+'"].value = t;\n gl.uniform1i(ud["'+t+'"].location, t);\n; // eslint-disable-line max-len\n }'}},{test:function(t,e){return"mat3"===t.type&&1===t.size&&void 0!==e.a},code:function(t){return'\n gl.uniformMatrix3fv(ud["'+t+'"].location, false, uv["'+t+'"].toArray(true));\n '}},{test:function(t,e){return"vec2"===t.type&&1===t.size&&void 0!==e.x},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud["'+t+'"].location, v.x, v.y);\n }'}},{test:function(t){return"vec2"===t.type&&1===t.size},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud["'+t+'"].location, v[0], v[1]);\n }\n '}},{test:function(t,e){return"vec4"===t.type&&1===t.size&&void 0!==e.width},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud["'+t+'"].location, v.x, v.y, v.width, v.height)\n }'}},{test:function(t){return"vec4"===t.type&&1===t.size},code:function(t){return'\n cv = ud["'+t+'"].value;\n v = uv["'+t+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud["'+t+'"].location, v[0], v[1], v[2], v[3])\n }'}}],Si={float:"\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }",vec2:"\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }",vec3:"\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }",vec4:"gl.uniform4f(location, v[0], v[1], v[2], v[3])",int:"gl.uniform1i(location, v)",ivec2:"gl.uniform2i(location, v[0], v[1])",ivec3:"gl.uniform3i(location, v[0], v[1], v[2])",ivec4:"gl.uniform4i(location, v[0], v[1], v[2], v[3])",bool:"gl.uniform1i(location, v)",bvec2:"gl.uniform2i(location, v[0], v[1])",bvec3:"gl.uniform3i(location, v[0], v[1], v[2])",bvec4:"gl.uniform4i(location, v[0], v[1], v[2], v[3])",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"gl.uniform1i(location, v)",samplerCube:"gl.uniform1i(location, v)",sampler2DArray:"gl.uniform1i(location, v)"},Oi={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)",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)"};var Mi,Pi=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function Ci(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var r=e.createShader(e.FRAGMENT_SHADER);;){var n=Pi.replace(/%forloop%/gi,function(t){for(var e="",r=0;r<t;++r)0<r&&(e+="\nelse "),r<t-1&&(e+="if(test == "+r+".0){}");return e}(t));if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))break;t=t/2|0}return t}var Ii=0,Ni={},Di=(Ri.prototype.extractData=function(t,e){var r,n=_i();n?(r=di(n,t,e),this.attributeData=this.getAttributeData(r,n),this.uniformData=this.getUniformData(r,n),n.deleteProgram(r)):(this.uniformData={},this.attributeData={})},Ri.prototype.getAttributeData=function(t,e){for(var r={},n=[],i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),o=0;o<i;o++){var a=e.getActiveAttrib(t,o),s=Ei(e,a.type),u={type:s,name:a.name,size:bi[s],location:0};r[a.name]=u,n.push(u)}for(n.sort(function(t,e){return t.name>e.name?1:-1}),o=0;o<n.length;o++)n[o].location=o;return r},Ri.prototype.getUniformData=function(t,e){for(var r={},n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),i=0;i<n;i++){var o=e.getActiveUniform(t,i),a=o.name.replace(/\[.*?\]$/,""),s=o.name.match(/\[.*?\]$/),u=Ei(e,o.type);r[a]={type:u,size:o.size,isArray:s,value:vi(u,o.size)}}return r},Object.defineProperty(Ri,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(Ri,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"},enumerable:!1,configurable:!0}),Ri.from=function(t,e,r){var n=t+e,i=kt[n];return i||(kt[n]=i=new Ri(t,e,r)),i},Ri);function Ri(t,e,r){var n,i;void 0===r&&(r="pixi-shader"),this.id=Ii++,this.vertexSrc=t||Ri.defaultVertexSrc,this.fragmentSrc=e||Ri.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),"#version"!==this.vertexSrc.substring(0,8)&&(r=r.replace(/\s+/g,"-"),Ni[r]?(Ni[r]++,r+="-"+Ni[r]):Ni[r]=1,this.vertexSrc="#define SHADER_NAME "+r+"\n"+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+r+"\n"+this.fragmentSrc,this.vertexSrc=xi(this.vertexSrc,ct.PRECISION_VERTEX,ot.HIGH),this.fragmentSrc=xi(this.fragmentSrc,ct.PRECISION_FRAGMENT,(mi||(mi=ot.MEDIUM,(n=_i())&&n.getShaderPrecisionFormat&&(i=n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT),mi=i.precision?ot.HIGH:ot.MEDIUM)),mi))),this.extractData(this.vertexSrc,this.fragmentSrc),this.glPrograms={},this.syncUniforms=null}var Fi=(Li.prototype.checkUniformExists=function(t,e){if(e.uniforms[t])return!0;for(var r in e.uniforms){var n=e.uniforms[r];if(n.group&&this.checkUniformExists(t,n))return!0}return!1},Li.prototype.destroy=function(){this.uniformGroup=null},Object.defineProperty(Li.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),Li.from=function(t,e,r){return new Li(Di.from(t,e),r)},Li);function Li(t,e){for(var r in this.program=t,this.uniformGroup=e?e instanceof Bn?e:new Bn(e):new Bn({}),t.uniformData)this.uniformGroup.uniforms[r]instanceof Array&&(this.uniformGroup.uniforms[r]=new Float32Array(this.uniformGroup.uniforms[r]))}var ki=(Object.defineProperty(Bi.prototype,"blend",{get:function(){return!!(1&this.data)},set:function(t){!!(1&this.data)!==t&&(this.data^=1)},enumerable:!1,configurable:!0}),Object.defineProperty(Bi.prototype,"offsets",{get:function(){return!!(2&this.data)},set:function(t){!!(2&this.data)!==t&&(this.data^=2)},enumerable:!1,configurable:!0}),Object.defineProperty(Bi.prototype,"culling",{get:function(){return!!(4&this.data)},set:function(t){!!(4&this.data)!==t&&(this.data^=4)},enumerable:!1,configurable:!0}),Object.defineProperty(Bi.prototype,"depthTest",{get:function(){return!!(8&this.data)},set:function(t){!!(8&this.data)!==t&&(this.data^=8)},enumerable:!1,configurable:!0}),Object.defineProperty(Bi.prototype,"clockwiseFrontFace",{get:function(){return!!(16&this.data)},set:function(t){!!(16&this.data)!==t&&(this.data^=16)},enumerable:!1,configurable:!0}),Object.defineProperty(Bi.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){this.blend=t!==k.NONE,this._blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(Bi.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(t){this.offsets=!!t,this._polygonOffset=t},enumerable:!1,configurable:!0}),Bi.for2d=function(){var t=new Bi;return t.depthTest=!1,t.blend=!0,t},Bi);function Bi(){this.data=0,this.blendMode=k.NORMAL,this.polygonOffset=0,this.blend=!0}var Ui,ji=(dr(zi,Ui=Fi),zi.prototype.apply=function(t,e,r,n,i){t.applyFilter(this,e,r,n)},Object.defineProperty(zi.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(zi,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(zi,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"},enumerable:!1,configurable:!0}),zi);function zi(t,e,r){var n=this,i=Di.from(t||zi.defaultVertexSrc,e||zi.defaultFragmentSrc);return(n=Ui.call(this,i,r)||this).padding=0,n.resolution=ct.FILTER_RESOLUTION,n.enabled=!0,n.autoFit=!0,n.legacy=!!n.program.attributeData.aTextureCoord,n.state=new ki,n}var Hi=new he,Gi=(Object.defineProperty(Xi.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture=t,this._updateID=-1},enumerable:!1,configurable:!0}),Xi.prototype.multiplyUvs=function(t,e){void 0===e&&(e=t);for(var r=this.mapCoord,n=0;n<t.length;n+=2){var i=t[n],o=t[n+1];e[n]=i*r.a+o*r.c+r.tx,e[n+1]=i*r.b+o*r.d+r.ty}return e},Xi.prototype.update=function(t){var e=this._texture;if(!e||!e.valid)return!1;if(!t&&this._updateID===e._updateID)return!1;this._updateID=e._updateID;var r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);var n=e.orig,i=e.trim;i&&(Hi.set(n.width/i.width,0,0,n.height/i.height,-i.x/i.width,-i.y/i.height),this.mapCoord.append(Hi));var o=e.baseTexture,a=this.uClampFrame,s=this.clampMargin/o.resolution,u=this.clampOffset;return a[0]=(e._frame.x+s+u)/o.width,a[1]=(e._frame.y+s+u)/o.height,a[2]=(e._frame.x+e._frame.width-s+u)/o.width,a[3]=(e._frame.y+e._frame.height-s+u)/o.height,this.uClampOffset[0]=u/o.realWidth,this.uClampOffset[1]=u/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&0===e.rotate,!0},Xi);function Xi(t,e){this._texture=t,this.mapCoord=new he,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._updateID=-1,this.clampOffset=0,this.clampMargin=void 0===e?.5:e,this.isSimple=!1}var Vi,Yi=(dr(Wi,Vi=ji),Wi.prototype.apply=function(t,e,r,n){var i=this.maskSprite,o=i._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new Gi(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,i).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=i.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,r,n))},Wi);function Wi(t){var e=this,r=new he,e=Vi.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n")||this;return t.renderable=!1,e.maskSprite=t,e.maskMatrix=r,e}var qi,Zi=(dr(Ki,qi=Kr),Ki.prototype.setMaskStack=function(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)},Ki.prototype.push=function(t,e){var r,n=e;switch(n.isMaskData||((r=this.maskDataPool.pop()||new li).pooled=!0,r.maskObject=e,n=r),n.autoDetect&&this.detect(n),n.copyCountersOrReset(this.maskStack[this.maskStack.length-1]),n._target=t,n.type){case st.SCISSOR:this.maskStack.push(n),this.renderer.scissor.push(n);break;case st.STENCIL:this.maskStack.push(n),this.renderer.stencil.push(n);break;case st.SPRITE:n.copyCountersOrReset(null),this.pushSpriteMask(n),this.maskStack.push(n)}},Ki.prototype.pop=function(t){var e=this.maskStack.pop();if(e&&e._target===t){switch(e.type){case st.SCISSOR:this.renderer.scissor.pop();break;case st.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case st.SPRITE:this.popSpriteMask()}e.reset(),e.pooled&&this.maskDataPool.push(e)}},Ki.prototype.detect=function(t){var e,r,n,i=t.maskObject;i.isSprite?t.type=st.SPRITE:(t.type=st.STENCIL,this.enableScissor&&i.isFastRect&&i.isFastRect()&&(e=i.worldTransform,r=Math.atan2(e.b,e.a),n=Math.atan2(e.d,e.c),r=Math.round(r*(180/Math.PI)*100),n=((n=Math.round(n*(180/Math.PI)*100)-r)%18e3+18e3)%18e3,0==(r=(r%9e3+9e3)%9e3)&&9e3==n&&(t.type=st.SCISSOR)))},Ki.prototype.pushSpriteMask=function(t){var e=t.maskObject,r=t._target,n=this.alphaMaskPool[this.alphaMaskIndex];(n=n||(this.alphaMaskPool[this.alphaMaskIndex]=[new Yi(e)]))[0].resolution=this.renderer.resolution,n[0].maskSprite=e;var i=r.filterArea;r.filterArea=e.getBounds(!0),this.renderer.filter.push(r,n),r.filterArea=i,this.alphaMaskIndex++},Ki.prototype.popSpriteMask=function(){this.renderer.filter.pop(),this.alphaMaskIndex--},Ki);function Ki(t){var e=qi.call(this,t)||this;return e.enableScissor=!1,e.alphaMaskPool=[],e.maskDataPool=[],e.maskStack=[],e.alphaMaskIndex=0,e}var $i,Ji=(dr(Qi,$i=Kr),Qi.prototype.getStackLength=function(){return this.maskStack.length},Qi.prototype.setMaskStack=function(t){var e=this.renderer.gl,r=this.getStackLength();this.maskStack=t;var n=this.getStackLength();n!==r&&(0===n?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))},Qi.prototype._useCurrent=function(){},Qi.prototype.destroy=function(){$i.prototype.destroy.call(this),this.maskStack=null},Qi);function Qi(t){var e=$i.call(this,t)||this;return e.maskStack=[],e.glConst=0,e}var to,eo=(dr(ro,to=Ji),ro.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0},ro.prototype.push=function(t){var e=t.maskObject;e.renderable=!0;var r=t._scissorRect,n=e.getBounds(!0),i=this.renderer.gl;e.renderable=!1,r?n.fit(r):i.enable(i.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=n,this._useCurrent()},ro.prototype.pop=function(){var t=this.renderer.gl;0<this.getStackLength()?this._useCurrent():t.disable(t.SCISSOR_TEST)},ro.prototype._useCurrent=function(){var t=this.maskStack[this.maskStack.length-1]._scissorRect,e=this.renderer.renderTexture.current,r=this.renderer.projection,n=r.transform,i=r.sourceFrame,o=r.destinationFrame,a=e?e.resolution:this.renderer.resolution,s=(t.x-i.x)*a+o.x,u=(t.y-i.y)*a+o.y,h=t.width*a,l=t.height*a;n&&(s+=n.tx*a,u+=n.ty*a),e||(u=this.renderer.height-l-u),this.renderer.gl.scissor(s,u,h,l)},ro);function ro(t){var e=to.call(this,t)||this;return e.glConst=WebGLRenderingContext.SCISSOR_TEST,e}var no,io=(dr(oo,no=Ji),oo.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},oo.prototype.push=function(t){var e=t.maskObject,r=this.renderer.gl,n=t._stencilCounter;0===n&&(this.renderer.framebuffer.forceStencil(),r.enable(r.STENCIL_TEST)),t._stencilCounter++,r.colorMask(!1,!1,!1,!1),r.stencilFunc(r.EQUAL,n,this._getBitwiseMask()),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,this._useCurrent()},oo.prototype.pop=function(t){var e=this.renderer.gl;0===this.getStackLength()?(e.disable(e.STENCIL_TEST),e.clear(e.STENCIL_BUFFER_BIT),e.clearStencil(0)):(e.colorMask(!1,!1,!1,!1),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,this._useCurrent())},oo.prototype._useCurrent=function(){var t=this.renderer.gl;t.colorMask(!0,!0,!0,!0),t.stencilFunc(t.EQUAL,this.getStackLength(),this._getBitwiseMask()),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},oo.prototype._getBitwiseMask=function(){return(1<<this.getStackLength())-1},oo);function oo(t){var e=no.call(this,t)||this;return e.glConst=WebGLRenderingContext.STENCIL_TEST,e}var ao,so=(dr(uo,ao=Kr),uo.prototype.update=function(t,e,r,n){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,n),this.transform&&this.projectionMatrix.append(this.transform);var i=this.renderer;i.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,i.globalUniforms.update(),i.shader.shader&&i.shader.syncUniformGroup(i.shader.shader.uniforms.globals)},uo.prototype.calculateProjection=function(t,e,r,n){var i=this.projectionMatrix,o=n?-1:1;i.a=1/t.width*2*r,i.d=o*(1/t.height*2)*r,i.tx=-1-e.x*i.a,i.ty=-o-e.y*i.d},uo.prototype.setTransform=function(t){},uo);function uo(t){var e=ao.call(this,t)||this;return e.destinationFrame=null,e.sourceFrame=null,e.defaultFrame=null,e.projectionMatrix=new he,e.transform=null,e}var ho,lo=new Zt,co=(dr(fo,ho=Kr),fo.prototype.bind=function(t,e,r){void 0===t&&(t=null),this.current=t;var n,i,o=this.renderer;t?(i=(n=t.baseTexture).resolution,r||(lo.width=n.realWidth,lo.height=n.realHeight,r=lo),e=e||r,this.renderer.framebuffer.bind(n.framebuffer,r),this.renderer.projection.update(r,e,i,!1),this.renderer.mask.setMaskStack(n.maskStack)):(i=this.renderer.resolution,r||(lo.width=o.width,lo.height=o.height,r=lo),e=e||r,o.framebuffer.bind(null,r),this.renderer.projection.update(r,e,i,!0),this.renderer.mask.setMaskStack(this.defaultMaskStack)),this.sourceFrame.copyFrom(e),this.destinationFrame.x=r.x/i,this.destinationFrame.y=r.y/i,this.destinationFrame.width=r.width/i,this.destinationFrame.height=r.height/i,e===r&&this.sourceFrame.copyFrom(this.destinationFrame)},fo.prototype.clear=function(t,e){t=this.current?t||this.current.baseTexture.clearColor:t||this.clearColor,this.renderer.framebuffer.clear(t[0],t[1],t[2],t[3],e)},fo.prototype.resize=function(){this.bind(null)},fo.prototype.reset=function(){this.bind(null)},fo);function fo(t){var e=ho.call(this,t)||this;return e.clearColor=t._backgroundColorRgba,e.defaultMaskStack=[],e.current=null,e.sourceFrame=new Zt,e.destinationFrame=new Zt,e}var po=(vo.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.program=null},vo);function vo(t,e){this.program=t,this.uniformData=e,this.uniformGroups={}}var mo,go=0,yo={textureCount:0},_o=(dr(xo,mo=Kr),xo.prototype.systemCheck=function(){if(!function(){if("boolean"==typeof Mi)return Mi;try{var t=new Function("param1","param2","param3","return param1[param2] === param3;");Mi=!0===t({a:"b"},"a","b")}catch(t){Mi=!1}return Mi}())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},xo.prototype.contextChange=function(t){this.gl=t,this.reset()},xo.prototype.bind=function(t,e){t.uniforms.globals=this.renderer.globalUniforms;var r=t.program,n=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateShader(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(n.program)),e||(yo.textureCount=0,this.syncUniformGroup(t.uniformGroup,yo)),n},xo.prototype.setUniforms=function(t){var e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)},xo.prototype.syncUniformGroup=function(t,e){var r=this.getglProgram();t.static&&t.dirtyId===r.uniformGroups[t.id]||(r.uniformGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))},xo.prototype.syncUniforms=function(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)},xo.prototype.createSyncGroups=function(t){var e=this.getSignature(t,this.shader.program.uniformData);return this.cache[e]||(this.cache[e]=function(t,e){var r=["\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n "];for(var n in t.uniforms){var i=e[n];if(i){for(var o,a=t.uniforms[n],s=!1,u=0;u<Ai.length;u++)if(Ai[u].test(i,a)){r.push(Ai[u].code(n,a)),s=!0;break}s||(o=(1===i.size?Si:Oi)[i.type].replace("location",'ud["'+n+'"].location'),r.push('\n cv = ud["'+n+'"].value;\n v = uv["'+n+'"];\n '+o+";"))}else t.uniforms[n].group&&r.push('\n renderer.shader.syncUniformGroup(uv["'+n+'"], syncData);\n ')}return new Function("ud","uv","renderer","syncData",r.join("\n"))}(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]},xo.prototype.getSignature=function(t,e){var r=t.uniforms,n=[];for(var i in r)n.push(i),e[i]&&n.push(e[i].type);return n.join("-")},xo.prototype.getglProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},xo.prototype.generateShader=function(t){var e=this.gl,r=t.program,n={};for(var i in r.attributeData)n[i]=r.attributeData[i].location;var o=di(e,r.vertexSrc,r.fragmentSrc,n),a={};for(var i in r.uniformData){var s=r.uniformData[i];a[i]={location:e.getUniformLocation(o,i),value:vi(s.type,s.size)}}var u=new po(o,a);return r.glPrograms[this.renderer.CONTEXT_UID]=u},xo.prototype.reset=function(){this.program=null,this.shader=null},xo.prototype.destroy=function(){this.destroyed=!0},xo);function xo(t){var e=mo.call(this,t)||this;return e.destroyed=!1,e.systemCheck(),e.gl=null,e.shader=null,e.program=null,e.cache={},e.id=go++,e}var bo,wo=(dr(To,bo=Kr),To.prototype.contextChange=function(t){var e,r;this.gl=t,this.blendModes=(e=t,void 0===r&&(r=[]),r[k.NORMAL]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.ADD]=[e.ONE,e.ONE],r[k.MULTIPLY]=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.SCREEN]=[e.ONE,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.OVERLAY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.DARKEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.LIGHTEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.COLOR_DODGE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.COLOR_BURN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.HARD_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.SOFT_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.DIFFERENCE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.EXCLUSION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.HUE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.SATURATION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.COLOR]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.LUMINOSITY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.NONE]=[0,0],r[k.NORMAL_NPM]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.ADD_NPM]=[e.SRC_ALPHA,e.ONE,e.ONE,e.ONE],r[k.SCREEN_NPM]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],r[k.SRC_IN]=[e.DST_ALPHA,e.ZERO],r[k.SRC_OUT]=[e.ONE_MINUS_DST_ALPHA,e.ZERO],r[k.SRC_ATOP]=[e.DST_ALPHA,e.ONE_MINUS_SRC_ALPHA],r[k.DST_OVER]=[e.ONE_MINUS_DST_ALPHA,e.ONE],r[k.DST_IN]=[e.ZERO,e.SRC_ALPHA],r[k.DST_OUT]=[e.ZERO,e.ONE_MINUS_SRC_ALPHA],r[k.DST_ATOP]=[e.ONE_MINUS_DST_ALPHA,e.SRC_ALPHA],r[k.XOR]=[e.ONE_MINUS_DST_ALPHA,e.ONE_MINUS_SRC_ALPHA],r[k.SUBTRACT]=[e.ONE,e.ONE,e.ONE,e.ONE,e.FUNC_REVERSE_SUBTRACT,e.FUNC_ADD],r),this.set(this.defaultState),this.reset()},To.prototype.set=function(t){if(t=t||this.defaultState,this.stateId!==t.data){for(var e=this.stateId^t.data,r=0;e;)1&e&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(r=0;r<this.checks.length;r++)this.checks[r](this,t)},To.prototype.forceState=function(t){t=t||this.defaultState;for(var e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data},To.prototype.setBlend=function(t){this.updateCheck(To.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)},To.prototype.setOffset=function(t){this.updateCheck(To.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},To.prototype.setDepthTest=function(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)},To.prototype.setCullFace=function(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)},To.prototype.setFrontFace=function(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])},To.prototype.setBlendMode=function(t){var e,r;t!==this.blendMode&&(this.blendMode=t,e=this.blendModes[t],r=this.gl,2===e.length?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),6===e.length?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD)))},To.prototype.setPolygonOffset=function(t,e){this.gl.polygonOffset(t,e)},To.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)},To.prototype.updateCheck=function(t,e){var r=this.checks.indexOf(t);e&&-1===r?this.checks.push(t):e||-1===r||this.checks.splice(r,1)},To.checkBlendMode=function(t,e){t.setBlendMode(e.blendMode)},To.checkPolygonOffset=function(t,e){t.setPolygonOffset(1,e.polygonOffset)},To);function To(t){var e=bo.call(this,t)||this;return e.gl=null,e.stateId=0,e.polygonOffset=0,e.blendMode=k.NONE,e._blendEq=!1,e.map=[],e.map[0]=e.setBlend,e.map[1]=e.setOffset,e.map[2]=e.setCullFace,e.map[3]=e.setDepthTest,e.map[4]=e.setFrontFace,e.checks=[],e.defaultState=new ki,e.defaultState.blend=!0,e}var Eo,Ao=(dr(So,Eo=Kr),So.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==nt.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},So.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,r=!1,n=0;n<e.length;n++){var i=e[n];!i.framebuffer&&this.count-i.touched>this.maxIdle&&(t.destroyTexture(i,!0),r=!(e[n]=null))}if(r){for(var o=0,n=0;n<e.length;n++)null!==e[n]&&(e[o++]=e[n]);e.length=o}},So.prototype.unload=function(t){var e,r=this.renderer.texture;null!==(e=t._texture)&&void 0!==e&&e.framebuffer&&r.destroyTexture(t._texture);for(var n=t.children.length-1;0<=n;n--)this.unload(t.children[n])},So);function So(t){var e=Eo.call(this,t)||this;return e.count=0,e.checkCount=0,e.maxIdle=ct.GC_MAX_IDLE,e.checkCountMax=ct.GC_MAX_CHECK_COUNT,e.mode=ct.GC_MODE,e}var Oo,Mo=function(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=6408,this.internalFormat=5121},Po=(dr(Co,Oo=Kr),Co.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion;var e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(var r=0;r<e;r++)this.boundTextures[r]=null;this.emptyTextures={};var n=new Mo(t.createTexture());for(t.bindTexture(t.TEXTURE_2D,n.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=n,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Mo(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture),r=0;r<6;r++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);for(t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR),r=0;r<this.boundTextures.length;r++)this.bind(null,r)},Co.prototype.bind=function(t,e){void 0===e&&(e=0);var r,n=this.gl;if(t){if((t=t.castToBaseTexture()).parentTextureArray)return;t.valid&&(t.touched=this.renderer.textureGC.count,r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t),this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,n.activeTexture(n.TEXTURE0+e)),n.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId&&(this.currentLocation!==e&&(this.currentLocation=e,n.activeTexture(n.TEXTURE0+e)),this.updateTexture(t)),this.boundTextures[e]=t)}else this.currentLocation!==e&&(this.currentLocation=e,n.activeTexture(n.TEXTURE0+e)),n.bindTexture(n.TEXTURE_2D,this.emptyTextures[n.TEXTURE_2D].texture),this.boundTextures[e]=null},Co.prototype.reset=function(){this._unknownBoundTextures=!0,this.currentLocation=-1;for(var t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture},Co.prototype.unbind=function(t){var e=this.gl,r=this.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var n=0;n<r.length;n++)r[n]===this.unknownTexture&&this.bind(null,n)}for(n=0;n<r.length;n++)r[n]===t&&(this.currentLocation!==n&&(e.activeTexture(e.TEXTURE0+n),this.currentLocation=n),e.bindTexture(e.TEXTURE_2D,this.emptyTextures[t.target].texture),r[n]=null)},Co.prototype.initTexture=function(t){var e=new Mo(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e},Co.prototype.initTextureType=function(t,e){var r;e.internalFormat=t.format,e.type=t.type,2===this.webGLVersion&&(r=this.renderer.gl,t.type===r.FLOAT&&t.format===r.RGBA&&(e.internalFormat=r.RGBA32F),t.type===V.HALF_FLOAT&&(e.type=r.HALF_FLOAT),e.type===r.HALF_FLOAT&&t.format===r.RGBA&&(e.internalFormat=r.RGBA16F))},Co.prototype.updateTexture=function(t){var e,r,n,i,o=t._glTextures[this.CONTEXT_UID];o&&(e=this.renderer,this.initTextureType(t,o),t.resource&&t.resource.upload(e,t,o)||(r=t.realWidth,n=t.realHeight,i=e.gl,(o.width!==r||o.height!==n||o.dirtyId<0)&&(o.width=r,o.height=n,i.texImage2D(t.target,0,o.internalFormat,r,n,0,t.format,o.type,null))),t.dirtyStyleId!==o.dirtyStyleId&&this.updateTextureStyle(t),o.dirtyId=t.dirtyId)},Co.prototype.destroyTexture=function(t,e){var r,n=this.gl;(t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),n.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],e||-1!==(r=this.managedTextures.indexOf(t))&&It(this.managedTextures,r,1))},Co.prototype.updateTextureStyle=function(t){var e=t._glTextures[this.CONTEXT_UID];e&&(t.mipmap!==$.POW2&&2===this.webGLVersion||t.isPowerOfTwo?e.mipmap=1<=t.mipmap:e.mipmap=!1,2===this.webGLVersion||t.isPowerOfTwo?e.wrapMode=t.wrapMode:e.wrapMode=Z.CLAMP,t.resource&&t.resource.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)},Co.prototype.setStyle=function(t,e){var r,n,i=this.gl;e.mipmap&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap?(i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===W.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST),(r=this.renderer.context.extensions.anisotropicFiltering)&&0<t.anisotropicLevel&&t.scaleMode===W.LINEAR&&(n=Math.min(t.anisotropicLevel,i.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),i.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n))):i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===W.LINEAR?i.LINEAR:i.NEAREST),i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===W.LINEAR?i.LINEAR:i.NEAREST)},Co);function Co(t){var e=Oo.call(this,t)||this;return e.boundTextures=[],e.currentLocation=-1,e.managedTextures=[],e._unknownBoundTextures=!1,e.unknownTexture=new br,e}var Io,No=new he,Do=(dr(Ro,Io=dt.a),Ro.prototype.initPlugins=function(t){for(var e in t)this.plugins[e]=new t[e](this)},Object.defineProperty(Ro.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(Ro.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),Ro.prototype.resize=function(t,e){this.screen.width=t,this.screen.height=e,this.view.width=t*this.resolution,this.view.height=e*this.resolution,this.autoDensity&&(this.view.style.width=t+"px",this.view.style.height=e+"px"),this.emit("resize",t,e)},Ro.prototype.generateTexture=function(t,e,r,n){0===(n=n||t.getLocalBounds(null,!0)).width&&(n.width=1),0===n.height&&(n.height=1);var i=vn.create({width:0|n.width,height:0|n.height,scaleMode:e,resolution:r});return No.tx=-n.x,No.ty=-n.y,this.render(t,i,!1,No,!!t.parent),i},Ro.prototype.destroy=function(t){for(var e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null;t&&this.view.parentNode&&this.view.parentNode.removeChild(this.view),this.plugins=null,this.type=D.UNKNOWN,this.view=null,this.screen=null,this._tempDisplayObjectParent=null,this.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(Ro.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._backgroundColorString=wt(t),bt(t,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Ro);function Ro(t,e){void 0===t&&(t=D.UNKNOWN);var r=Io.call(this)||this;return(e=Object.assign({},ct.RENDER_OPTIONS,e)).roundPixels&&(ct.ROUND_PIXELS=e.roundPixels,Lt("5.0.0","Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS",2)),r.options=e,r.type=t,r.screen=new Zt(0,0,e.width,e.height),r.view=e.view||document.createElement("canvas"),r.resolution=e.resolution||ct.RESOLUTION,r.transparent=e.transparent,r.autoDensity=e.autoDensity||e.autoResize||!1,r.preserveDrawingBuffer=e.preserveDrawingBuffer,r.clearBeforeRender=e.clearBeforeRender,r._backgroundColor=0,r._backgroundColorRgba=[0,0,0,0],r._backgroundColorString="#000000",r.backgroundColor=e.backgroundColor||r._backgroundColor,r._lastObjectRendered=null,r.plugins={},r}var Fo,Lo=(dr(ko,Fo=Do),ko.create=function(t){if(void 0===yt&&(yt=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:ct.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!window.WebGLRenderingContext)return!1;var e,r=document.createElement("canvas"),n=r.getContext("webgl",t)||r.getContext("experimental-webgl",t),i=!(!n||!n.getContextAttributes().stencil);return!n||(e=n.getExtension("WEBGL_lose_context"))&&e.loseContext(),n=null,i}catch(t){return!1}}()),yt)return new ko(t);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},ko.prototype.addSystem=function(t,e){e=e||t.name;var r=new t(this);if(this[e])throw new Error('Whoops! The name "'+e+'" is already in use');for(var n in this[e]=r,this.runners)this.runners[n].add(r);return this},ko.prototype.render=function(t,e,r,n,i){var o;this.renderingToScreen=!e,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=n,this.context.isLost||(e||(this._lastObjectRendered=t),i||(o=t.enableTempParent(),t.updateTransform(),t.disableTempParent(o)),this.renderTexture.bind(e),this.batch.currentRenderer.start(),(void 0!==r?r:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),e&&e.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender"))},ko.prototype.resize=function(t,e){Fo.prototype.resize.call(this,t,e),this.runners.resize.emit(t,e)},ko.prototype.reset=function(){return this.runners.reset.emit(),this},ko.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},ko.prototype.destroy=function(t){for(var e in this.runners.destroy.emit(),this.runners)this.runners[e].destroy();Fo.prototype.destroy.call(this,t),this.gl=null},ko.registerPlugin=function(t,e){(ko.__plugins=ko.__plugins||{})[t]=e},ko);function ko(t){var e,r,n,i=Fo.call(this,D.WEBGL,t)||this;return t=i.options,i.gl=null,i.CONTEXT_UID=0,i.runners={destroy:new ur("destroy"),contextChange:new ur("contextChange"),reset:new ur("reset"),update:new ur("update"),postrender:new ur("postrender"),prerender:new ur("prerender"),resize:new ur("resize")},i.globalUniforms=new Bn({projectionMatrix:new he},!0),i.addSystem(Zi,"mask").addSystem(Jn,"context").addSystem(wo,"state").addSystem(_o,"shader").addSystem(Po,"texture").addSystem(ui,"geometry").addSystem(ni,"framebuffer").addSystem(eo,"scissor").addSystem(io,"stencil").addSystem(so,"projection").addSystem(Ao,"textureGC").addSystem(Gn,"filter").addSystem(co,"renderTexture").addSystem(qn,"batch"),i.initPlugins(ko.__plugins),t.context?i.context.initFromContext(t.context):i.context.initFromOptions({alpha:!!i.transparent,antialias:t.antialias,premultipliedAlpha:i.transparent&&"notMultiplied"!==i.transparent,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:i.options.powerPreference}),i.renderingToScreen=!0,e=2===i.context.webGLVersion?"WebGL 2":"WebGL 1",_t||(-1<navigator.userAgent.toLowerCase().indexOf("chrome")?(n=["\n %c %c %c PixiJS "+xt+" - ✰ "+e+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","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;"],(r=window.console).log.apply(r,n)):window.console&&window.console.log("PixiJS "+xt+" - "+e+" - http://www.pixijs.com/"),_t=!0),i.resize(i.options.width,i.options.height),i}var Bo="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",Uo=function(){this.texArray=null,this.blend=0,this.type=U.TRIANGLES,this.start=0,this.size=0,this.data=null},jo=(zo.prototype.clear=function(){for(var t=0;t<this.count;t++)this.elements[t]=null;this.count=0},zo);function zo(){this.elements=[],this.ids=[],this.count=0}var Ho=(Object.defineProperty(Go.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(Go.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(Go.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(Go.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(Go.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),Go.prototype.view=function(t){return this[t+"View"]},Go.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},Go.sizeOf=function(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(t+" isn't a valid view type")}},Go);function Go(t){this.rawBinaryData=new ArrayBuffer(t),this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}var Xo,Vo=(dr(Yo,Xo=Vn),Yo.prototype.contextChange=function(){var t=this.renderer.gl;ct.PREFER_ENV===I.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ct.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=Ci(this.MAX_TEXTURES,t)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()},Yo.prototype.initFlushBuffers=function(){for(var t=Yo._drawCallPool,e=Yo._textureArrayPool,r=this.size/4,n=Math.floor(r/this.MAX_TEXTURES)+1;t.length<r;)t.push(new Uo);for(;e.length<n;)e.push(new jo);for(var i=0;i<this.MAX_TEXTURES;i++)this._tempBoundTextures[i]=null},Yo.prototype.onPrerender=function(){this._flushId=0},Yo.prototype.render=function(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},Yo.prototype.buildTexturesAndDrawCalls=function(){var t=this._bufferedTextures,e=this.MAX_TEXTURES,r=Yo._textureArrayPool,n=this.renderer.batch,i=this._tempBoundTextures,o=this.renderer.textureGC.count,a=++br._globalBatch,s=0,u=r[0],h=0;n.copyBoundTextures(i,e);for(var l=0;l<this._bufferSize;++l){var c=t[l];t[l]=null,c._batchEnabled!==a&&(u.count>=e&&(n.boundArray(u,i,a,e),this.buildDrawCalls(u,h,l),h=l,u=r[++s],++a),c._batchEnabled=a,c.touched=o,u.elements[u.count++]=c)}for(0<u.count&&(n.boundArray(u,i,a,e),this.buildDrawCalls(u,h,this._bufferSize),++s,++a),l=0;l<i.length;l++)i[l]=null;br._globalBatch=a},Yo.prototype.buildDrawCalls=function(t,e,r){var n=this._bufferedElements,i=this._attributeBuffer,o=this._indexBuffer,a=this.vertexSize,s=Yo._drawCallPool,u=this._dcIndex,h=this._aIndex,l=this._iIndex,c=s[u];c.start=this._iIndex,c.texArray=t;for(var f=e;f<r;++f){var d=n[f],p=d._texture.baseTexture,v=Et[p.alphaMode?1:0][d.blendMode];n[f]=null,e<f&&c.blend!==v&&(c.size=l-c.start,e=f,(c=s[++u]).texArray=t,c.start=l),this.packInterleavedGeometry(d,i,o,h,l),h+=d.vertexData.length/2*a,l+=d.indices.length,c.blend=v}e<r&&(c.size=l-c.start,++u),this._dcIndex=u,this._aIndex=h,this._iIndex=l},Yo.prototype.bindAndClearTexArray=function(t){for(var e=this.renderer.texture,r=0;r<t.count;r++)e.bind(t.elements[r],t.ids[r]),t.elements[r]=null;t.count=0},Yo.prototype.updateGeometry=function(){var t=this._packedGeometries,e=this._attributeBuffer,r=this._indexBuffer;ct.CAN_UPLOAD_SAME_BUFFER?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},Yo.prototype.drawBatches=function(){for(var t=this._dcIndex,e=this.renderer,r=e.gl,n=e.state,i=Yo._drawCallPool,o=null,a=0;a<t;a++){var s=i[a],u=s.texArray,h=s.type,l=s.size,c=s.start,f=s.blend;o!==u&&(o=u,this.bindAndClearTexArray(u)),this.state.blendMode=f,n.set(this.state),r.drawElements(h,l,r.UNSIGNED_SHORT,2*c)}},Yo.prototype.flush=function(){0!==this._vertexCount&&(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)},Yo.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.shader.bind(this._shader),ct.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},Yo.prototype.stop=function(){this.flush()},Yo.prototype.destroy=function(){for(var t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].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),Xo.prototype.destroy.call(this)},Yo.prototype.getAttributeBuffer=function(t){var e=Mt(Math.ceil(t/8)),r=Ct(e),n=8*e;this._aBuffers.length<=r&&(this._iBuffers.length=r+1);var i=this._aBuffers[n];return i||(this._aBuffers[n]=i=new Ho(n*this.vertexSize*4)),i},Yo.prototype.getIndexBuffer=function(t){var e=Mt(Math.ceil(t/12)),r=Ct(e),n=12*e;this._iBuffers.length<=r&&(this._iBuffers.length=r+1);var i=this._iBuffers[r];return i||(this._iBuffers[r]=i=new Uint16Array(n)),i},Yo.prototype.packInterleavedGeometry=function(t,e,r,n,i){for(var o=e.uint32View,a=e.float32View,s=n/this.vertexSize,u=t.uvs,h=t.indices,l=t.vertexData,c=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),d=f<1&&t._texture.baseTexture.alphaMode?St(t._tintRGB,f):t._tintRGB+(255*f<<24),p=0;p<l.length;p+=2)a[n++]=l[p],a[n++]=l[p+1],a[n++]=u[p],a[n++]=u[p+1],o[n++]=d,a[n++]=c;for(p=0;p<h.length;p++)r[i++]=s+h[p]},Yo._drawCallPool=[],Yo._textureArrayPool=[],Yo);function Yo(t){var e=Xo.call(this,t)||this;return e.shaderGenerator=null,e.geometryClass=null,e.vertexSize=null,e.state=ki.for2d(),e.size=4*ct.SPRITE_BATCH_SIZE,e._vertexCount=0,e._indexCount=0,e._bufferedElements=[],e._bufferedTextures=[],e._bufferSize=0,e._shader=null,e._packedGeometries=[],e._packedGeometryPoolSize=2,e._flushId=0,e._aBuffers={},e._iBuffers={},e.MAX_TEXTURES=1,e.renderer.on("prerender",e.onPrerender,e),t.runners.contextChange.add(e),e._dcIndex=0,e._aIndex=0,e._iIndex=0,e._attributeBuffer=null,e._indexBuffer=null,e._tempBoundTextures=[],e}var Wo=(qo.prototype.generateShader=function(t){if(!this.programCache[t]){for(var e=new Int32Array(t),r=0;r<t;r++)e[r]=r;this.defaultGroupCache[t]=Bn.from({uSamplers:e},!0);var n=this.fragTemplate;n=(n=n.replace(/%count%/gi,""+t)).replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new Di(this.vertexSrc,n)}var i={tint:new Float32Array([1,1,1,1]),translationMatrix:new he,default:this.defaultGroupCache[t]};return new Fi(this.programCache[t],i)},qo.prototype.generateSampleSrc=function(t){var e="";e+="\n",e+="\n";for(var r=0;r<t;r++)0<r&&(e+="\nelse "),r<t-1&&(e+="if(vTextureId < "+r+".5)"),e+="\n{",e+="\n\tcolor = texture2D(uSamplers["+r+"], vTextureCoord);",e+="\n}";return e+="\n",e+="\n"},qo);function qo(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},e.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(e.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}var Zo,Ko=(dr($o,Zo=Pn),$o);function $o(t){void 0===t&&(t=!1);var e=Zo.call(this)||this;return e._buffer=new wn(null,t,!1),e._indexBuffer=new wn(null,t,!0),e.addAttribute("aVertexPosition",e._buffer,2,!1,V.FLOAT).addAttribute("aTextureCoord",e._buffer,2,!1,V.FLOAT).addAttribute("aColor",e._buffer,4,!0,V.UNSIGNED_BYTE).addAttribute("aTextureId",e._buffer,1,!0,V.FLOAT).addIndex(e._indexBuffer),e}var Jo="precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n",Qo="varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n";function ta(){}var ea=(ta.create=function(t){var r,e=Object.assign({vertex:Jo,fragment:Qo,geometryClass:Ko,vertexSize:6},t),n=e.vertex,i=e.fragment,o=e.vertexSize,a=e.geometryClass;return dr(s,r=Vo),s;function s(t){var e=r.call(this,t)||this;return e.shaderGenerator=new Wo(n,i),e.geometryClass=a,e.vertexSize=o,e}},Object.defineProperty(ta,"defaultVertexSrc",{get:function(){return Jo},enumerable:!1,configurable:!0}),Object.defineProperty(ta,"defaultFragmentTemplate",{get:function(){return Qo},enumerable:!1,configurable:!0}),ta).create(),ra=(na.registerPlugin=function(t){na._plugins.push(t)},na.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(na.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(na.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),na.prototype.destroy=function(t,e){var r=this,n=na._plugins.slice(0);n.reverse(),n.forEach(function(t){t.destroy.call(r)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null},na);function na(e){var t,r=this;e=Object.assign({forceCanvas:!1},e),this.renderer=(t=e,Lo.create(t)),this.stage=new De,na._plugins.forEach(function(t){t.init.call(r,e)})}ra._plugins=[];var ia=(oa.init=function(t){var n=this;Object.defineProperty(this,"resizeTo",{set:function(t){window.removeEventListener("resize",this.queueResize),(this._resizeTo=t)&&(window.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){n._resizeTo&&(n.cancelResize(),n._resizeId=requestAnimationFrame(function(){return n.resize()}))},this.cancelResize=function(){n._resizeId&&(cancelAnimationFrame(n._resizeId),n._resizeId=null)},this.resize=function(){var t,e,r;n._resizeTo&&(n.cancelResize(),r=n._resizeTo===window?(e=window.innerWidth,window.innerHeight):(e=(t=n._resizeTo).clientWidth,t.clientHeight),n.renderer.resize(e,r))},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null},oa.destroy=function(){this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},oa);function oa(){}ra.registerPlugin(ia);var aa=new Zt,sa=(ua.prototype.image=function(t,e,r){var n=new Image;return n.src=this.base64(t,e,r),n},ua.prototype.base64=function(t,e,r){return this.canvas(t).toDataURL(e,r)},ua.prototype.canvas=function(t){var e,r,n,i=this.renderer,o=!1,a=!1;t&&(t instanceof vn?n=t:(n=this.renderer.generateTexture(t),a=!0)),n?(e=n.baseTexture.resolution,r=n.frame,o=!1,i.renderTexture.bind(n)):(e=this.renderer.resolution,o=!0,(r=aa).width=this.renderer.width,r.height=this.renderer.height,i.renderTexture.bind(null));var s=Math.floor(r.width*e+1e-4),u=Math.floor(r.height*e+1e-4),h=new jt(s,u,1),l=new Uint8Array(4*s*u),c=i.gl;c.readPixels(r.x*e,r.y*e,s,u,c.RGBA,c.UNSIGNED_BYTE,l);var f,d=h.context.getImageData(0,0,s,u);return ua.arrayPostDivide(l,d.data),h.context.putImageData(d,0,0),o&&((f=new jt(h.width,h.height,1)).context.scale(1,-1),f.context.drawImage(h.canvas,0,-u),h.destroy(),h=f),a&&n.destroy(!0),h.canvas},ua.prototype.pixels=function(t){var e,r,n,i=this.renderer,o=!1;t&&(t instanceof vn?n=t:(n=this.renderer.generateTexture(t),o=!0)),n?(e=n.baseTexture.resolution,r=n.frame,i.renderTexture.bind(n)):(e=i.resolution,(r=aa).width=i.width,r.height=i.height,i.renderTexture.bind(null));var a=r.width*e,s=r.height*e,u=new Uint8Array(4*a*s),h=i.gl;return h.readPixels(r.x*e,r.y*e,a,s,h.RGBA,h.UNSIGNED_BYTE,u),o&&n.destroy(!0),ua.arrayPostDivide(u,u),u},ua.prototype.destroy=function(){this.renderer.extract=null,this.renderer=null},ua.arrayPostDivide=function(t,e){for(var r=0;r<t.length;r+=4){var n=e[r+3]=t[r+3];0!==n?(e[r]=Math.round(Math.min(255*t[r]/n,255)),e[r+1]=Math.round(Math.min(255*t[r+1]/n,255)),e[r+2]=Math.round(Math.min(255*t[r+2]/n,255))):(e[r]=t[r],e[r+1]=t[r+1],e[r+2]=t[r+2])}},ua);function ua(t){(this.renderer=t).extract=this}var ha=r(9),la=r.n(ha),ca=r(2),fa=r.n(ca);function da(){}function pa(r,n,i,o){var a=0,s=r.length;!function t(e){e||a===s?i&&i(e):o?setTimeout(function(){n(r[a++],t)},1):n(r[a++],t)}()}function va(e,t){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var r=0,i={_tasks:[],concurrency:t,saturated:da,unsaturated:da,buffer:t/4,empty:da,drain:da,error:da,started:!1,paused:!1,push:function(t,e){n(t,!1,e)},kill:function(){r=0,i.drain=da,i.started=!1,i._tasks=[]},unshift:function(t,e){n(t,!0,e)},process:function(){for(;!i.paused&&r<i.concurrency&&i._tasks.length;){var t=i._tasks.shift();0===i._tasks.length&&i.empty(),(r+=1)===i.concurrency&&i.saturated(),e(t.data,function(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}}(function(e){return function(t){--r,e.callback.apply(e,arguments),null!=t&&i.error(t,e.data),r<=i.concurrency-i.buffer&&i.unsaturated(),i.idle()&&i.drain(),i.process()}}(t)))}},length:function(){return i._tasks.length},running:function(){return r},idle:function(){return i._tasks.length+r===0},pause:function(){!0!==i.paused&&(i.paused=!0)},resume:function(){if(!1!==i.paused){i.paused=!1;for(var t=1;t<=i.concurrency;t++)i.process()}}};function n(t,e,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");var n;i.started=!0,null==t&&i.idle()?setTimeout(function(){return i.drain()},1):(n={data:t,callback:"function"==typeof r?r:da},e?i._tasks.unshift(n):i._tasks.push(n),setTimeout(function(){return i.process()},1))}return i}var ma={};function ga(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ya(t,e,r){return e&&ga(t.prototype,e),r&&ga(t,r),t}var _a=!(!window.XDomainRequest||"withCredentials"in new XMLHttpRequest),xa=null;function ba(){}var wa=function(){function o(t,e,r){if("string"!=typeof t||"string"!=typeof e)throw new Error("Both name and url are required for constructing a resource.");r=r||{},this._flags=0,this._setFlag(o.STATUS_FLAGS.DATA_URL,0===e.indexOf("data:")),this.name=t,this.url=e,this.extension=this._getExtension(),this.data=null,this.crossOrigin=!0===r.crossOrigin?"anonymous":r.crossOrigin,this.timeout=r.timeout||0,this.loadType=r.loadType||this._determineLoadType(),this.xhrType=r.xhrType,this.metadata=r.metadata||{},this.error=null,this.xhr=null,this.children=[],this.type=o.TYPE.UNKNOWN,this.progressChunk=0,this._dequeue=ba,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=this.complete.bind(this),this._boundOnError=this._onError.bind(this),this._boundOnProgress=this._onProgress.bind(this),this._boundOnTimeout=this._onTimeout.bind(this),this._boundXhrOnError=this._xhrOnError.bind(this),this._boundXhrOnTimeout=this._xhrOnTimeout.bind(this),this._boundXhrOnAbort=this._xhrOnAbort.bind(this),this._boundXhrOnLoad=this._xhrOnLoad.bind(this),this.onStart=new fa.a,this.onProgress=new fa.a,this.onComplete=new fa.a,this.onAfterMiddleware=new fa.a}o.setExtensionLoadType=function(t,e){Ta(o._loadTypeMap,t,e)},o.setExtensionXhrType=function(t,e){Ta(o._xhrTypeMap,t,e)};var t=o.prototype;return t.complete=function(){this._clearEvents(),this._finish()},t.abort=function(t){if(!this.error){if(this.error=new Error(t),this._clearEvents(),this.xhr)this.xhr.abort();else if(this.xdr)this.xdr.abort();else if(this.data)if(this.data.src)this.data.src=o.EMPTY_GIF;else for(;this.data.firstChild;)this.data.removeChild(this.data.firstChild);this._finish()}},t.load=function(t){var e=this;if(!this.isLoading)if(this.isComplete)t&&setTimeout(function(){return t(e)},1);else switch(t&&this.onComplete.once(t),this._setFlag(o.STATUS_FLAGS.LOADING,!0),this.onStart.dispatch(this),!1!==this.crossOrigin&&"string"==typeof this.crossOrigin||(this.crossOrigin=this._determineCrossOrigin(this.url)),this.loadType){case o.LOAD_TYPE.IMAGE:this.type=o.TYPE.IMAGE,this._loadElement("image");break;case o.LOAD_TYPE.AUDIO:this.type=o.TYPE.AUDIO,this._loadSourceElement("audio");break;case o.LOAD_TYPE.VIDEO:this.type=o.TYPE.VIDEO,this._loadSourceElement("video");break;case o.LOAD_TYPE.XHR:default:_a&&this.crossOrigin?this._loadXdr():this._loadXhr()}},t._hasFlag=function(t){return 0!=(this._flags&t)},t._setFlag=function(t,e){this._flags=e?this._flags|t:this._flags&~t},t._clearEvents=function(){clearTimeout(this._elementTimer),this.data&&this.data.removeEventListener&&(this.data.removeEventListener("error",this._boundOnError,!1),this.data.removeEventListener("load",this._boundComplete,!1),this.data.removeEventListener("progress",this._boundOnProgress,!1),this.data.removeEventListener("canplaythrough",this._boundComplete,!1)),this.xhr&&(this.xhr.removeEventListener?(this.xhr.removeEventListener("error",this._boundXhrOnError,!1),this.xhr.removeEventListener("timeout",this._boundXhrOnTimeout,!1),this.xhr.removeEventListener("abort",this._boundXhrOnAbort,!1),this.xhr.removeEventListener("progress",this._boundOnProgress,!1),this.xhr.removeEventListener("load",this._boundXhrOnLoad,!1)):(this.xhr.onerror=null,this.xhr.ontimeout=null,this.xhr.onprogress=null,this.xhr.onload=null))},t._finish=function(){if(this.isComplete)throw new Error("Complete called again for an already completed resource.");this._setFlag(o.STATUS_FLAGS.COMPLETE,!0),this._setFlag(o.STATUS_FLAGS.LOADING,!1),this.onComplete.dispatch(this)},t._loadElement=function(t){this.metadata.loadElement?this.data=this.metadata.loadElement:"image"===t&&void 0!==window.Image?this.data=new Image:this.data=document.createElement(t),this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),this.metadata.skipSource||(this.data.src=this.url),this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},t._loadSourceElement=function(t){if(this.metadata.loadElement?this.data=this.metadata.loadElement:"audio"===t&&void 0!==window.Audio?this.data=new Audio:this.data=document.createElement(t),null!==this.data){if(this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),!this.metadata.skipSource)if(navigator.isCocoonJS)this.data.src=Array.isArray(this.url)?this.url[0]:this.url;else if(Array.isArray(this.url))for(var e=this.metadata.mimeType,r=0;r<this.url.length;++r)this.data.appendChild(this._createSource(t,this.url[r],Array.isArray(e)?e[r]:e));else{var n=this.metadata.mimeType;this.data.appendChild(this._createSource(t,this.url,Array.isArray(n)?n[0]:n))}this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.data.addEventListener("canplaythrough",this._boundComplete,!1),this.data.load(),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))}else this.abort("Unsupported element: "+t)},t._loadXhr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var t=this.xhr=new XMLHttpRequest;t.open("GET",this.url,!0),t.timeout=this.timeout,this.xhrType===o.XHR_RESPONSE_TYPE.JSON||this.xhrType===o.XHR_RESPONSE_TYPE.DOCUMENT?t.responseType=o.XHR_RESPONSE_TYPE.TEXT:t.responseType=this.xhrType,t.addEventListener("error",this._boundXhrOnError,!1),t.addEventListener("timeout",this._boundXhrOnTimeout,!1),t.addEventListener("abort",this._boundXhrOnAbort,!1),t.addEventListener("progress",this._boundOnProgress,!1),t.addEventListener("load",this._boundXhrOnLoad,!1),t.send()},t._loadXdr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var t=this.xhr=new XDomainRequest;t.timeout=this.timeout||5e3,t.onerror=this._boundXhrOnError,t.ontimeout=this._boundXhrOnTimeout,t.onprogress=this._boundOnProgress,t.onload=this._boundXhrOnLoad,t.open("GET",this.url,!0),setTimeout(function(){return t.send()},1)},t._createSource=function(t,e,r){r=r||t+"/"+this._getExtension(e);var n=document.createElement("source");return n.src=e,n.type=r,n},t._onError=function(t){this.abort("Failed to load element using: "+t.target.nodeName)},t._onProgress=function(t){t&&t.lengthComputable&&this.onProgress.dispatch(this,t.loaded/t.total)},t._onTimeout=function(){this.abort("Load timed out.")},t._xhrOnError=function(){var t=this.xhr;this.abort(Ea(t)+" Request failed. Status: "+t.status+', text: "'+t.statusText+'"')},t._xhrOnTimeout=function(){var t=this.xhr;this.abort(Ea(t)+" Request timed out.")},t._xhrOnAbort=function(){var t=this.xhr;this.abort(Ea(t)+" Request was aborted by the user.")},t._xhrOnLoad=function(){var t,e,r=this.xhr,n="",i=void 0===r.status?200:r.status;if(""!==r.responseType&&"text"!==r.responseType&&void 0!==r.responseType||(n=r.responseText),0===i&&(0<n.length||r.responseType===o.XHR_RESPONSE_TYPE.BUFFER)?i=200:1223===i&&(i=204),2==(i/100|0)){if(this.xhrType===o.XHR_RESPONSE_TYPE.TEXT)this.data=n,this.type=o.TYPE.TEXT;else if(this.xhrType===o.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(n),this.type=o.TYPE.JSON}catch(t){return void this.abort("Error trying to parse loaded json: "+t)}else if(this.xhrType===o.XHR_RESPONSE_TYPE.DOCUMENT)try{window.DOMParser?(t=new DOMParser,this.data=t.parseFromString(n,"text/xml")):((e=document.createElement("div")).innerHTML=n,this.data=e),this.type=o.TYPE.XML}catch(t){return void this.abort("Error trying to parse loaded xml: "+t)}else this.data=r.response||n;this.complete()}else this.abort("["+r.status+"] "+r.statusText+": "+r.responseURL)},t._determineCrossOrigin=function(t,e){if(0===t.indexOf("data:"))return"";if(window.origin!==window.location.origin)return"anonymous";e=e||window.location,(xa=xa||document.createElement("a")).href=t;var r=!(t=la()(xa.href,{strictMode:!0})).port&&""===e.port||t.port===e.port,n=t.protocol?t.protocol+":":"";return t.host===e.hostname&&r&&n===e.protocol?"":"anonymous"},t._determineXhrType=function(){return o._xhrTypeMap[this.extension]||o.XHR_RESPONSE_TYPE.TEXT},t._determineLoadType=function(){return o._loadTypeMap[this.extension]||o.LOAD_TYPE.XHR},t._getExtension=function(){var t,e,r,n,i=this.url;return(this.isDataUrl?(t=i.indexOf("/"),i.substring(t+1,i.indexOf(";",t))):(e=i.indexOf("?"),r=i.indexOf("#"),n=Math.min(-1<e?e:i.length,-1<r?r:i.length),(i=i.substring(0,n)).substring(i.lastIndexOf(".")+1))).toLowerCase()},t._getMimeFromXhrType=function(t){switch(t){case o.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case o.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case o.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case o.XHR_RESPONSE_TYPE.JSON:return"application/json";case o.XHR_RESPONSE_TYPE.DEFAULT:case o.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},ya(o,[{key:"isDataUrl",get:function(){return this._hasFlag(o.STATUS_FLAGS.DATA_URL)}},{key:"isComplete",get:function(){return this._hasFlag(o.STATUS_FLAGS.COMPLETE)}},{key:"isLoading",get:function(){return this._hasFlag(o.STATUS_FLAGS.LOADING)}}]),o}();function Ta(t,e,r){e&&0===e.indexOf(".")&&(e=e.substring(1)),e&&(t[e]=r)}function Ea(t){return t.toString().replace("object ","")}wa.STATUS_FLAGS={NONE:0,DATA_URL:1,COMPLETE:2,LOADING:4},wa.TYPE={UNKNOWN:0,JSON:1,XML:2,IMAGE:3,AUDIO:4,VIDEO:5,TEXT:6},wa.LOAD_TYPE={XHR:1,IMAGE:2,AUDIO:3,VIDEO:4},wa.XHR_RESPONSE_TYPE={DEFAULT:"text",BUFFER:"arraybuffer",BLOB:"blob",DOCUMENT:"document",JSON:"json",TEXT:"text"},wa._loadTypeMap={gif:wa.LOAD_TYPE.IMAGE,png:wa.LOAD_TYPE.IMAGE,bmp:wa.LOAD_TYPE.IMAGE,jpg:wa.LOAD_TYPE.IMAGE,jpeg:wa.LOAD_TYPE.IMAGE,tif:wa.LOAD_TYPE.IMAGE,tiff:wa.LOAD_TYPE.IMAGE,webp:wa.LOAD_TYPE.IMAGE,tga:wa.LOAD_TYPE.IMAGE,svg:wa.LOAD_TYPE.IMAGE,"svg+xml":wa.LOAD_TYPE.IMAGE,mp3:wa.LOAD_TYPE.AUDIO,ogg:wa.LOAD_TYPE.AUDIO,wav:wa.LOAD_TYPE.AUDIO,mp4:wa.LOAD_TYPE.VIDEO,webm:wa.LOAD_TYPE.VIDEO},wa._xhrTypeMap={xhtml:wa.XHR_RESPONSE_TYPE.DOCUMENT,html:wa.XHR_RESPONSE_TYPE.DOCUMENT,htm:wa.XHR_RESPONSE_TYPE.DOCUMENT,xml:wa.XHR_RESPONSE_TYPE.DOCUMENT,tmx:wa.XHR_RESPONSE_TYPE.DOCUMENT,svg:wa.XHR_RESPONSE_TYPE.DOCUMENT,tsx:wa.XHR_RESPONSE_TYPE.DOCUMENT,gif:wa.XHR_RESPONSE_TYPE.BLOB,png:wa.XHR_RESPONSE_TYPE.BLOB,bmp:wa.XHR_RESPONSE_TYPE.BLOB,jpg:wa.XHR_RESPONSE_TYPE.BLOB,jpeg:wa.XHR_RESPONSE_TYPE.BLOB,tif:wa.XHR_RESPONSE_TYPE.BLOB,tiff:wa.XHR_RESPONSE_TYPE.BLOB,webp:wa.XHR_RESPONSE_TYPE.BLOB,tga:wa.XHR_RESPONSE_TYPE.BLOB,json:wa.XHR_RESPONSE_TYPE.JSON,text:wa.XHR_RESPONSE_TYPE.TEXT,txt:wa.XHR_RESPONSE_TYPE.TEXT,ttf:wa.XHR_RESPONSE_TYPE.BUFFER,otf:wa.XHR_RESPONSE_TYPE.BUFFER},wa.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";var Aa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var Sa=window.URL||window.webkitURL;var Oa={caching:function(t,e){var r=this;ma[t.url]?(t.data=ma[t.url],t.complete()):t.onComplete.once(function(){return ma[r.url]=r.data}),e()},parsing:function(t,e){if(t.data){if(t.xhr&&t.xhrType===wa.XHR_RESPONSE_TYPE.BLOB)if(window.Blob&&"string"!=typeof t.data){if(0===t.data.type.indexOf("image")){var r=Sa.createObjectURL(t.data);return t.blob=t.data,t.data=new Image,t.data.src=r,t.type=wa.TYPE.IMAGE,void(t.data.onload=function(){Sa.revokeObjectURL(r),t.data.onload=null,e()})}}else{var n=t.xhr.getResponseHeader("content-type");if(n&&0===n.indexOf("image"))return t.data=new Image,t.data.src="data:"+n+";base64,"+function(t){for(var e="",r=0;r<t.length;){for(var n=[0,0,0],i=[0,0,0,0],o=0;o<n.length;++o)r<t.length?n[o]=255&t.charCodeAt(r++):n[o]=0;switch(i[0]=n[0]>>2,i[1]=(3&n[0])<<4|n[1]>>4,i[2]=(15&n[1])<<2|n[2]>>6,i[3]=63&n[2],r-(t.length-1)){case 2:i[3]=64,i[2]=64;break;case 1:i[3]=64}for(var a=0;a<i.length;++a)e+=Aa.charAt(i[a])}return e}(t.xhr.responseText),t.type=wa.TYPE.IMAGE,void(t.data.onload=function(){t.data.onload=null,e()})}e()}else e()}},Ma=/(#[\w-]+)?$/,Pa=function(){function o(t,e){var r=this;void 0===t&&(t=""),void 0===e&&(e=10),this.baseUrl=t,this.progress=0,this.loading=!1,this.defaultQueryString="",this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(t,e){return r._loadResource(t,e)},this._queue=va(this._boundLoadResource,e),this._queue.pause(),this.resources={},this.onProgress=new fa.a,this.onError=new fa.a,this.onLoad=new fa.a,this.onStart=new fa.a,this.onComplete=new fa.a;for(var n=0;n<o._defaultBeforeMiddleware.length;++n)this.pre(o._defaultBeforeMiddleware[n]);for(var i=0;i<o._defaultAfterMiddleware.length;++i)this.use(o._defaultAfterMiddleware[i])}var t=o.prototype;return t.add=function(t,e,r,n){if(Array.isArray(t)){for(var i=0;i<t.length;++i)this.add(t[i]);return this}if("object"==typeof t&&(n=e||t.callback||t.onComplete,e=(r=t).url,t=t.name||t.key||t.url),"string"!=typeof e&&(n=r,r=e,e=t),"string"!=typeof e)throw new Error("No url passed to add resource to loader.");if("function"==typeof r&&(n=r,r=null),this.loading&&(!r||!r.parentResource))throw new Error("Cannot add resources while the loader is running.");if(this.resources[t])throw new Error('Resource named "'+t+'" already exists.');if(e=this._prepareUrl(e),this.resources[t]=new wa(t,e,r),"function"==typeof n&&this.resources[t].onAfterMiddleware.once(n),this.loading){for(var o=r.parentResource,a=[],s=0;s<o.children.length;++s)o.children[s].isComplete||a.push(o.children[s]);var u=o.progressChunk*(a.length+1)/(a.length+2);o.children.push(this.resources[t]),o.progressChunk=u;for(var h=0;h<a.length;++h)a[h].progressChunk=u;this.resources[t].progressChunk=u}return this._queue.push(this.resources[t]),this},t.pre=function(t){return this._beforeMiddleware.push(t),this},t.use=function(t){return this._afterMiddleware.push(t),this},t.reset=function(){for(var t in this.progress=0,this.loading=!1,this._queue.kill(),this._queue.pause(),this.resources){var e=this.resources[t];e._onLoadBinding&&e._onLoadBinding.detach(),e.isLoading&&e.abort()}return this.resources={},this},t.load=function(t){if("function"==typeof t&&this.onComplete.once(t),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var e=100/this._queue._tasks.length,r=0;r<this._queue._tasks.length;++r)this._queue._tasks[r].data.progressChunk=e;this._onStart(),this._queue.resume()}return this},t._prepareUrl=function(t){var e,r,n=la()(t,{strictMode:!0});return r=n.protocol||!n.path||0===t.indexOf("//")?t:this.baseUrl.length&&this.baseUrl.lastIndexOf("/")!==this.baseUrl.length-1&&"/"!==t.charAt(0)?this.baseUrl+"/"+t:this.baseUrl+t,this.defaultQueryString&&(e=Ma.exec(r)[0],-1!==(r=r.substr(0,r.length-e.length)).indexOf("?")?r+="&"+this.defaultQueryString:r+="?"+this.defaultQueryString,r+=e),r},t._loadResource=function(r,t){var n=this;r._dequeue=t,pa(this._beforeMiddleware,function(t,e){t.call(n,r,function(){e(r.isComplete?{}:null)})},function(){r.isComplete?n._onLoad(r):(r._onLoadBinding=r.onComplete.once(n._onLoad,n),r.load())},!0)},t._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},t._onComplete=function(){this.progress=100,this.loading=!1,this.onComplete.dispatch(this,this.resources)},t._onLoad=function(r){var n=this;r._onLoadBinding=null,this._resourcesParsing.push(r),r._dequeue(),pa(this._afterMiddleware,function(t,e){t.call(n,r,e)},function(){r.onAfterMiddleware.dispatch(r),n.progress=Math.min(100,n.progress+r.progressChunk),n.onProgress.dispatch(n,r),r.error?n.onError.dispatch(r.error,n,r):n.onLoad.dispatch(n,r),n._resourcesParsing.splice(n._resourcesParsing.indexOf(r),1),n._queue.idle()&&0===n._resourcesParsing.length&&n._onComplete()},!0)},ya(o,[{key:"concurrency",get:function(){return this._queue.concurrency},set:function(t){this._queue.concurrency=t}}]),o}();Pa._defaultBeforeMiddleware=[],Pa._defaultAfterMiddleware=[],Pa.pre=function(t){return Pa._defaultBeforeMiddleware.push(t),Pa},Pa.use=function(t){return Pa._defaultAfterMiddleware.push(t),Pa};var Ca=wa,Ia=function(t,e){return(Ia=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Na=(Da.use=function(t,e){t.data&&t.type===wa.TYPE.IMAGE&&(t.texture=cn.fromLoader(t.data,t.url,t.name)),e()},Da);function Da(){}var Ra,Fa,La,ka=(Ia(Fa=Ua,La=Ra=Pa),Fa.prototype=null===La?Object.create(La):(Ba.prototype=La.prototype,new Ba),Ua.prototype.destroy=function(){this._protected||this.reset()},Object.defineProperty(Ua,"shared",{get:function(){var t=Ua._shared;return t||((t=new Ua)._protected=!0,Ua._shared=t),t},enumerable:!1,configurable:!0}),Ua.registerPlugin=function(t){return Ua._plugins.push(t),t.add&&t.add(),Ua},Ua._plugins=[],Ua);function Ba(){this.constructor=Fa}function Ua(t,e){for(var r=Ra.call(this,t,e)||this,n=0;n<Ua._plugins.length;++n){var i=Ua._plugins[n],o=i.pre,a=i.use;o&&r.pre(o),a&&r.use(a)}return r._protected=!1,r}ka.registerPlugin({use:Oa.parsing}),ka.registerPlugin(Na);var ja=(za.init=function(t){t=Object.assign({sharedLoader:!1},t),this.loader=t.sharedLoader?ka.shared:new ka},za.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},za);function za(){}var Ha=function(t,e){return(Ha=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function Ga(t,e){function r(){this.constructor=t}Ha(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var Xa;Ga(Va,Xa=De),Va.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},Va.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(Va.prototype,"tint",{get:function(){return this._tint},set:function(t){bt(this._tint=t,this.tintRgb)},enumerable:!1,configurable:!0}),Va.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return e.onChildrenChange(0)})),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},Va.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID},Va.prototype.dispose=function(){if(this._buffers){for(var t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}},Va.prototype.destroy=function(t){Xa.prototype.destroy.call(this,t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null};function Va(t,e,r,n){void 0===t&&(t=1500),void 0===r&&(r=16384),void 0===n&&(n=!1);var i=Xa.call(this)||this;return 16384<r&&(r=16384),i._properties=[!1,!0,!1,!1,!1],i._maxSize=t,i._batchSize=r,i._buffers=null,i._bufferUpdateIDs=[],i._updateID=0,i.interactiveChildren=!1,i.blendMode=k.NORMAL,i.autoResize=n,i.roundPixels=!0,i.baseTexture=null,i.setProperties(e),i._tint=0,i.tintRgb=new Float32Array(4),i.tint=16777215,i}var Ya=(Wa.prototype.initBuffers=function(){var t=this.geometry,e=0;this.indexBuffer=new wn(function(t,e){void 0===e&&(e=null);var r=6*t;if((e=e||new Uint16Array(r)).length!==r)throw new Error("Out buffer length is incorrect, got "+e.length+" and expected "+r);for(var n=0,i=0;n<r;n+=6,i+=4)e[n+0]=i+0,e[n+1]=i+1,e[n+2]=i+2,e[n+3]=i+0,e[n+4]=i+2,e[n+5]=i+3;return e}(this.size),!0,!0),t.addIndex(this.indexBuffer);for(var r=this.dynamicStride=0;r<this.dynamicProperties.length;++r)(a=this.dynamicProperties[r]).offset=e,e+=a.size,this.dynamicStride+=a.size;var n=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(n),this.dynamicDataUint32=new Uint32Array(n),this.dynamicBuffer=new wn(this.dynamicData,!1,!1);for(var i=0,r=this.staticStride=0;r<this.staticProperties.length;++r)(a=this.staticProperties[r]).offset=i,i+=a.size,this.staticStride+=a.size;var o=new ArrayBuffer(this.size*this.staticStride*4*4);for(this.staticData=new Float32Array(o),this.staticDataUint32=new Uint32Array(o),this.staticBuffer=new wn(this.staticData,!0,!1),r=0;r<this.dynamicProperties.length;++r){var a=this.dynamicProperties[r];t.addAttribute(a.attributeName,this.dynamicBuffer,0,a.type===V.UNSIGNED_BYTE,a.type,4*this.dynamicStride,4*a.offset)}for(r=0;r<this.staticProperties.length;++r)a=this.staticProperties[r],t.addAttribute(a.attributeName,this.staticBuffer,0,a.type===V.UNSIGNED_BYTE,a.type,4*this.staticStride,4*a.offset)},Wa.prototype.uploadDynamic=function(t,e,r){for(var n=0;n<this.dynamicProperties.length;n++){var i=this.dynamicProperties[n];i.uploadFunction(t,e,r,i.type===V.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,i.offset)}this.dynamicBuffer._updateID++},Wa.prototype.uploadStatic=function(t,e,r){for(var n=0;n<this.staticProperties.length;n++){var i=this.staticProperties[n];i.uploadFunction(t,e,r,i.type===V.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,i.offset)}this.staticBuffer._updateID++},Wa.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},Wa);function Wa(t,e,r){this.geometry=new Pn,this.indexBuffer=null,this.size=r,this.dynamicProperties=[],this.staticProperties=[];for(var n=0;n<t.length;++n){var i={attributeName:(i=t[n]).attributeName,size:i.size,uploadFunction:i.uploadFunction,type:i.type||V.FLOAT,offset:i.offset};e[n]?this.dynamicProperties.push(i):this.staticProperties.push(i)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}var qa,Za,Ka,$a,Ja,Qa=(Ga(ts,qa=Vn),ts.prototype.render=function(t){var e=t.children,r=t._maxSize,n=t._batchSize,i=this.renderer,o=e.length;if(0!==o){r<o&&!t.autoResize&&(o=r);var a=(a=t._buffers)||(t._buffers=this.generateBuffers(t)),s=e[0]._texture.baseTexture;this.state.blendMode=At(t.blendMode,s.alphaMode),i.state.set(this.state);var u,h,l,c,f=i.gl,d=t.worldTransform.copyTo(this.tempMatrix);d.prepend(i.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=d.toArray(!0),this.shader.uniforms.uColor=(u=t.tintRgb,h=t.worldAlpha,l=this.shader.uniforms.uColor,c=s.alphaMode,l=l||new Float32Array(4),c||void 0===c?(l[0]=u[0]*h,l[1]=u[1]*h,l[2]=u[2]*h):(l[0]=u[0],l[1]=u[1],l[2]=u[2]),l[3]=h,l),this.shader.uniforms.uSampler=s,this.renderer.shader.bind(this.shader);for(var p=!1,v=0,m=0;v<o;v+=n,m+=1){var g=o-v;n<g&&(g=n),m>=a.length&&a.push(this._generateOneMoreBuffer(t));var y=a[m];y.uploadDynamic(e,v,g);var _=t._bufferUpdateIDs[m]||0;(p=p||y._updateID<_)&&(y._updateID=t._updateID,y.uploadStatic(e,v,g)),i.geometry.bind(y.geometry),f.drawElements(f.TRIANGLES,6*g,f.UNSIGNED_SHORT,0)}}},ts.prototype.generateBuffers=function(t){for(var e=[],r=t._maxSize,n=t._batchSize,i=t._properties,o=0;o<r;o+=n)e.push(new Ya(this.properties,i,n));return e},ts.prototype._generateOneMoreBuffer=function(t){var e=t._batchSize,r=t._properties;return new Ya(this.properties,r,e)},ts.prototype.uploadVertices=function(t,e,r,n,i,o){for(var a=0,s=0,u=0,h=0,l=0;l<r;++l){var c=t[e+l],f=c._texture,d=c.scale.x,p=c.scale.y,v=f.trim,m=f.orig;v?(a=(s=v.x-c.anchor.x*m.width)+v.width,u=(h=v.y-c.anchor.y*m.height)+v.height):(a=m.width*(1-c.anchor.x),s=m.width*-c.anchor.x,u=m.height*(1-c.anchor.y),h=m.height*-c.anchor.y),n[o]=s*d,n[o+1]=h*p,n[o+i]=a*d,n[o+i+1]=h*p,n[o+2*i]=a*d,n[o+2*i+1]=u*p,n[o+3*i]=s*d,n[o+3*i+1]=u*p,o+=4*i}},ts.prototype.uploadPosition=function(t,e,r,n,i,o){for(var a=0;a<r;a++){var s=t[e+a].position;n[o]=s.x,n[o+1]=s.y,n[o+i]=s.x,n[o+i+1]=s.y,n[o+2*i]=s.x,n[o+2*i+1]=s.y,n[o+3*i]=s.x,n[o+3*i+1]=s.y,o+=4*i}},ts.prototype.uploadRotation=function(t,e,r,n,i,o){for(var a=0;a<r;a++){var s=t[e+a].rotation;n[o]=s,n[o+i]=s,n[o+2*i]=s,n[o+3*i]=s,o+=4*i}},ts.prototype.uploadUvs=function(t,e,r,n,i,o){for(var a=0;a<r;++a){var s=t[e+a]._texture._uvs;s?(n[o]=s.x0,n[o+1]=s.y0,n[o+i]=s.x1,n[o+i+1]=s.y1,n[o+2*i]=s.x2,n[o+2*i+1]=s.y2,n[o+3*i]=s.x3,n[o+3*i+1]=s.y3):(n[o]=0,n[o+1]=0,n[o+i]=0,n[o+i+1]=0,n[o+2*i]=0,n[o+2*i+1]=0,n[o+3*i]=0,n[o+3*i+1]=0),o+=4*i}},ts.prototype.uploadTint=function(t,e,r,n,i,o){for(var a=0;a<r;++a){var s=t[e+a],u=0<s._texture.baseTexture.alphaMode,h=s.alpha,l=h<1&&u?St(s._tintRGB,h):s._tintRGB+(255*h<<24);n[o]=l,n[o+i]=l,n[o+2*i]=l,n[o+3*i]=l,o+=4*i}},ts.prototype.destroy=function(){qa.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},ts);function ts(t){var e=qa.call(this,t)||this;return e.shader=null,e.properties=null,e.tempMatrix=new he,e.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:e.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:e.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:e.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:e.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:V.UNSIGNED_BYTE,uploadFunction:e.uploadTint,offset:0}],e.shader=Fi.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}",{}),e.state=ki.for2d(),e}(Ka=Za=Za||{}).MITER="miter",Ka.BEVEL="bevel",Ka.ROUND="round",(Ja=$a=$a||{}).BUTT="butt",Ja.ROUND="round",Ja.SQUARE="square";var es={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(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}},rs=(ns.prototype.clone=function(){var t=new ns;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},ns.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=cn.WHITE,this.matrix=null,this.visible=!1},ns.prototype.destroy=function(){this.texture=null,this.matrix=null},ns);function ns(){this.color=16777215,this.alpha=1,this.texture=cn.WHITE,this.matrix=null,this.visible=!1,this.reset()}var is=function(t,e){return(is=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function os(t,e){function r(){this.constructor=t}is(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var as={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var r=t.points,n=t.holes,i=e.points,o=e.indices;if(6<=r.length){for(var a=[],s=0;s<n.length;s++){var u=n[s];a.push(r.length/2),r=r.concat(u.points)}var h=vt()(r,a,2);if(!h)return;for(var l=i.length/2,s=0;s<h.length;s+=3)o.push(h[s]+l),o.push(h[s+1]+l),o.push(h[s+2]+l);for(s=0;s<r.length;s++)i.push(r[s])}}},ss={build:function(t){var e,r,n,i=t.shape,o=t.points,a=i.x,s=i.y;if(o.length=0,n=t.type===Xt.CIRC?(r=i.radius,i.radius):(r=(e=t.shape).width,e.height),0!==r&&0!==n){var u=Math.floor(30*Math.sqrt(i.radius))||Math.floor(15*Math.sqrt(r+n));u/=2.3;for(var h=2*Math.PI/u,l=0;l<u-.5;l++)o.push(a+Math.sin(-h*l)*r,s+Math.cos(-h*l)*n);o.push(o[0],o[1])}},triangulate:function(t,e){var r=t.points,n=e.points,i=e.indices,o=n.length/2,a=o,s=t.shape,u=t.matrix,h=s.x,l=s.y;n.push(t.matrix?u.a*h+u.c*l+u.tx:h,t.matrix?u.b*h+u.d*l+u.ty:l);for(var c=0;c<r.length;c+=2)n.push(r[c],r[c+1]),i.push(o++,a,o)}},us={build:function(t){var e=t.shape,r=e.x,n=e.y,i=e.width,o=e.height,a=t.points;a.length=0,a.push(r,n,r+i,n,r+i,n+o,r,n+o)},triangulate:function(t,e){var r=t.points,n=e.points,i=n.length/2;n.push(r[0],r[1],r[2],r[3],r[6],r[7],r[4],r[5]),e.indices.push(i,1+i,2+i,1+i,2+i,3+i)}};function hs(t,e,r){return t+(e-t)*r}function ls(t,e,r,n,i,o,a){void 0===a&&(a=[]);for(var s,u,h,l,c,f,d,p=a,v=0;v<=20;++v)s=hs(t,r,d=v/20),u=hs(e,n,d),h=hs(r,i,d),l=hs(n,o,d),c=hs(s,h,d),f=hs(u,l,d),p.push(c,f);return p}var cs={build:function(t){var e=t.shape,r=t.points,n=e.x,i=e.y,o=e.width,a=e.height,s=Math.max(0,Math.min(e.radius,Math.min(o,a)/2));r.length=0,s?(ls(n,i+s,n,i,n+s,i,r),ls(n+o-s,i,n+o,i,n+o,i+s,r),ls(n+o,i+a-s,n+o,i+a,n+o-s,i+a,r),ls(n+s,i+a,n,i+a,n,i+a-s,r)):r.push(n,i,n+o,i,n+o,i+a,n,i+a)},triangulate:function(t,e){for(var r=t.points,n=e.points,i=e.indices,o=n.length/2,a=vt()(r,null,2),s=0,u=a.length;s<u;s+=3)i.push(a[s]+o),i.push(a[s+1]+o),i.push(a[s+2]+o);for(s=0,u=r.length;s<u;s++)n.push(r[s],r[++s])}};function fs(t,e,r,n,i,o,a,s){var u,h=a?(u=n,-r):(u=-n,r),l=t-r*i+u,c=e-n*i+h,f=t+r*o+u,d=e+n*o+h;return s.push(l,c),s.push(f,d),2}function ds(t,e,r,n,i,o,a,s){var u=r-t,h=n-e,l=Math.atan2(u,h),c=Math.atan2(i-t,o-e);s&&l<c?l+=2*Math.PI:!s&&c<l&&(c+=2*Math.PI);var f=l,d=c-l,p=Math.abs(d),v=Math.sqrt(u*u+h*h),m=1+(15*p*Math.sqrt(v)/Math.PI>>0),g=d/m;if(f+=g,s){a.push(t,e),a.push(r,n);for(var y=1,_=f;y<m;y++,_+=g)a.push(t,e),a.push(t+Math.sin(_)*v,e+Math.cos(_)*v);a.push(t,e),a.push(i,o)}else{a.push(r,n),a.push(t,e);for(y=1,_=f;y<m;y++,_+=g)a.push(t+Math.sin(_)*v,e+Math.cos(_)*v),a.push(t,e);a.push(i,o),a.push(t,e)}return 2*m}function ps(t,e){(t.lineStyle.native?function(t,e){var r=0,n=t.shape,i=t.points||n.points,o=n.type!==Xt.POLY||n.closeStroke;if(0!==i.length){var a=e.points,s=e.indices,u=i.length/2,h=a.length/2,l=h;for(a.push(i[0],i[1]),r=1;r<u;r++)a.push(i[2*r],i[2*r+1]),s.push(l,l+1),l++;o&&s.push(l,h)}}:function(t,e){var r=t.shape,n=t.points||r.points.slice(),i=e.closePointEps;if(0!==n.length){var o,a,s=t.lineStyle,u=new oe(n[0],n[1]),h=new oe(n[n.length-2],n[n.length-1]),l=r.type!==Xt.POLY||r.closeStroke,c=Math.abs(u.x-h.x)<i&&Math.abs(u.y-h.y)<i;l&&(n=n.slice(),c&&(n.pop(),n.pop(),h.set(n[n.length-2],n[n.length-1])),o=.5*(u.x+h.x),a=.5*(h.y+u.y),n.unshift(o,a),n.push(o,a));var f,d,p=e.points,v=n.length/2,m=n.length,g=p.length/2,y=s.width/2,_=y*y,x=s.miterLimit*s.miterLimit,b=n[0],w=n[1],T=n[2],E=n[3],A=0,S=0,O=-(w-E),M=b-T,P=Math.sqrt(O*O+M*M);O/=P,M/=P,O*=y,M*=y;var C=s.alignment,I=2*(1-C),N=2*C;l||(s.cap===$a.ROUND?m+=ds(b-O*(I-N)*.5,w-M*(I-N)*.5,b-O*I,w-M*I,b+O*N,w+M*N,p,!0)+2:s.cap===$a.SQUARE&&(m+=fs(b,w,O,M,I,N,!0,p))),p.push(b-O*I,w-M*I),p.push(b+O*N,w+M*N);for(var D=1;D<v-1;++D){b=n[2*(D-1)],w=n[2*(D-1)+1],T=n[2*D],E=n[2*D+1],A=n[2*(D+1)],S=n[2*(D+1)+1],O=-(w-E),M=b-T,O/=P=Math.sqrt(O*O+M*M),M/=P,O*=y,M*=y,f=-(E-S),d=T-A,f/=P=Math.sqrt(f*f+d*d),d/=P,f*=y,d*=y;var R,F,L,k,B,U,j,z,H,G,X,V,Y,W,q,Z,K,$,J,Q,tt,et,rt=T-b,nt=w-E,it=T-A,ot=S-E,at=nt*it-ot*rt,st=at<0;Math.abs(at)<.1?(p.push(T-O*I,E-M*I),p.push(T+O*N,E+M*N)):(B=((L=(rt*(F=(-f+A)*(-d+E)-(-f+T)*(-d+S))-it*(R=(-O+b)*(-M+E)-(-O+T)*(-M+w)))/at)-T)*(L-T)+((k=(ot*R-nt*F)/at)-E)*(k-E),U=T+(L-T)*I,j=E+(k-E)*I,z=T-(L-T)*N,H=E-(k-E)*N,V=A-f*I,Y=S-d*I,W=b+O*N,q=w+M*N,Z=A+f*N,K=S+d*N,Q=($=S-w)*(T-(G=b-O*I))+(J=-(A-b))*(E-(X=w-M*I)),st?(tt=$*(U-G)+J*(j-X),.1<Math.abs(Q-tt)&&Math.sign(Q)!==Math.sign(tt)&&(U=.5*(G+V),j=.5*(X+Y))):(et=$*(z-G)+J*(H-X),.1<Math.abs(Q-et)&&Math.sign(Q)!==Math.sign(et)&&(z=.5*(W+Z),H=.5*(q+K))),s.join===Za.BEVEL||x<B/_?(st?(p.push(U,j),p.push(T+O*N,E+M*N),p.push(U,j),p.push(T+f*N,E+d*N)):(p.push(T-O*I,E-M*I),p.push(z,H),p.push(T-f*I,E-d*I),p.push(z,H)),m+=2):s.join===Za.ROUND?st?(p.push(U,j),p.push(T+O*N,E+M*N),m+=ds(T,E,T+O*N,E+M*N,T+f*N,E+d*N,p,!0)+4,p.push(U,j),p.push(T+f*N,E+d*N)):(p.push(T-O*I,E-M*I),p.push(z,H),m+=ds(T,E,T-O*I,E-M*I,T-f*I,E-d*I,p,!1)+4,p.push(T-f*I,E-d*I),p.push(z,H)):(p.push(U,j),p.push(z,H)))}b=n[2*(v-2)],w=n[2*(v-2)+1],T=n[2*(v-1)],O=-(w-(E=n[2*(v-1)+1])),M=b-T,O/=P=Math.sqrt(O*O+M*M),M/=P,O*=y,M*=y,p.push(T-O*I,E-M*I),p.push(T+O*N,E+M*N),l||(s.cap===$a.ROUND?m+=ds(T-O*(I-N)*.5,E-M*(I-N)*.5,T-O*I,E-M*I,T+O*N,E+M*N,p,!1)+2:s.cap===$a.SQUARE&&(m+=fs(T,E,O,M,I,N,!1,p)));for(var ut=e.indices,ht=es.epsilon*es.epsilon,D=g;D<m+g-2;++D)b=p[2*D],w=p[2*D+1],T=p[2*(D+1)],E=p[2*(D+1)+1],A=p[2*(D+2)],S=p[2*(D+2)+1],Math.abs(b*(E-S)+T*(S-w)+A*(w-E))<ht||ut.push(D,D+1,D+2)}})(t,e)}var vs,ms=(os(gs,vs=ee),gs);function gs(t,e,r,n,i,o){void 0===o&&(o=0);i=i||n/2;for(var a=-1*Math.PI/2+o,s=2*r,u=Yt/s,h=[],l=0;l<s;l++){var c=l%2?i:n,f=l*u+a;h.push(t+c*Math.cos(f),e+c*Math.sin(f))}return vs.call(this,h)||this}var ys=(_s.curveTo=function(t,e,r,n,i,o){var a=o[o.length-2],s=o[o.length-1]-e,u=a-t,h=n-e,l=r-t,c=Math.abs(s*l-u*h);if(c<1e-8||0===i)return o[o.length-2]===t&&o[o.length-1]===e||o.push(t,e),null;var f=s*s+u*u,d=h*h+l*l,p=s*h+u*l,v=i*Math.sqrt(f)/c,m=i*Math.sqrt(d)/c,g=v*p/f,y=m*p/d,_=v*l+m*u,x=v*h+m*s,b=u*(m+g),w=s*(m+g),T=l*(v+y),E=h*(v+y);return{cx:_+t,cy:x+e,radius:i,startAngle:Math.atan2(w-x,b-_),endAngle:Math.atan2(E-x,T-_),anticlockwise:l*s<u*h}},_s.arc=function(t,e,r,n,i,o,a,s,u){for(var h=a-o,l=es._segmentsCount(Math.abs(h)*i,40*Math.ceil(Math.abs(h)/Yt)),c=h/(2*l),f=2*c,d=Math.cos(c),p=Math.sin(c),v=l-1,m=v%1/v,g=0;g<=v;++g){var y=c+o+f*(g+m*g),_=Math.cos(y),x=-Math.sin(y);u.push((d*_+p*x)*i+r,(d*-x+p*_)*i+n)}},_s);function _s(){}var xs=(bs.curveLength=function(t,e,r,n,i,o,a,s){for(var u,h,l,c,f,d,p,v,m,g,y=0,_=t,x=e,b=1;b<=10;++b)m=_-(p=(d=(f=(c=1-(u=b/10))*c)*c)*t+3*f*u*r+3*c*(h=u*u)*i+(l=h*u)*a),g=x-(v=d*e+3*f*u*n+3*c*h*o+l*s),_=p,x=v,y+=Math.sqrt(m*m+g*g);return y},bs.curveTo=function(t,e,r,n,i,o,a){var s=a[a.length-2],u=a[a.length-1];a.length-=2;var h,l,c,f,d,p=es._segmentsCount(bs.curveLength(s,u,t,e,r,n,i,o));a.push(s,u);for(var v,m=1;m<=p;++m)c=(l=(h=1-(v=m/p))*h)*h,d=(f=v*v)*v,a.push(c*s+3*l*v*t+3*h*f*r+d*i,c*u+3*l*v*e+3*h*f*n+d*o)},bs);function bs(){}var ws=(Ts.curveLength=function(t,e,r,n,i,o){var a=t-2*r+i,s=e-2*n+o,u=2*r-2*t,h=2*n-2*e,l=4*(a*a+s*s),c=4*(a*u+s*h),f=u*u+h*h,d=2*Math.sqrt(l+c+f),p=Math.sqrt(l),v=2*l*p,m=2*Math.sqrt(f),g=c/p;return(v*d+p*c*(d-m)+(4*f*l-c*c)*Math.log((2*p+g+d)/(g+m)))/(4*v)},Ts.curveTo=function(t,e,r,n,i){for(var o=i[i.length-2],a=i[i.length-1],s=es._segmentsCount(Ts.curveLength(o,a,t,e,r,n)),u=1;u<=s;++u){var h=u/s,l=o+(t-o)*h,c=a+(e-a)*h;i.push(l+(t+(r-t)*h-l)*h,c+(e+(n-e)*h-c)*h)}},Ts);function Ts(){}var Es,As=(Ss.prototype.begin=function(t,e,r){this.reset(),this.style=t,this.start=e,this.attribStart=r},Ss.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},Ss.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},Ss);function Ss(){this.reset()}var Os=((Es={})[Xt.POLY]=as,Es[Xt.CIRC]=ss,Es[Xt.ELIP]=ss,Es[Xt.RECT]=us,Es[Xt.RREC]=cs,Es),Ms=[],Ps=[],Cs=(Is.prototype.clone=function(){return new Is(this.shape,this.fillStyle,this.lineStyle,this.matrix)},Is.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},Is);function Is(t,e,r,n){void 0===e&&(e=null),void 0===r&&(r=null),void 0===n&&(n=null),this.shape=t,this.lineStyle=r,this.fillStyle=e,this.matrix=n,this.type=t.type,this.points=[],this.holes=[]}var Ns,Ds=new oe,Rs=new be,Fs=(os(Ls,Ns=Ko),Object.defineProperty(Ls.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),Ls.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;for(var t=this.textureIds.length=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Ps.push(this.drawCalls[t]);for(t=this.drawCalls.length=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),Ms.push(e)}this.batches.length=0},Ls.prototype.clear=function(){return 0<this.graphicsData.length&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},Ls.prototype.drawShape=function(t,e,r,n){void 0===e&&(e=null),void 0===r&&(r=null),void 0===n&&(n=null);var i=new Cs(t,e,r,n);return this.graphicsData.push(i),this.dirty++,this},Ls.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var r=new Cs(t,null,null,e),n=this.graphicsData[this.graphicsData.length-1];return r.lineStyle=n.lineStyle,n.holes.push(r),this.dirty++,this},Ls.prototype.destroy=function(){Ns.prototype.destroy.call(this);for(var t=0;t<this.graphicsData.length;++t)this.graphicsData[t].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},Ls.prototype.containsPoint=function(t){for(var e=this.graphicsData,r=0;r<e.length;++r){var n=e[r];if(n.fillStyle.visible&&n.shape&&(n.matrix?n.matrix.applyInverse(t,Ds):Ds.copyFrom(t),n.shape.contains(Ds.x,Ds.y))){var i=!1;if(n.holes)for(var o=0;o<n.holes.length;o++)if(n.holes[o].shape.contains(Ds.x,Ds.y)){i=!0;break}if(!i)return!0}}return!1},Ls.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,r=this.graphicsData,n=null,i=null;0<this.batches.length&&(i=(n=this.batches[this.batches.length-1]).style);for(var o=this.shapeIndex;o<r.length;o++){this.shapeIndex++;var a=r[o],s=a.fillStyle,u=a.lineStyle;Os[a.type].build(a),a.matrix&&this.transformPoints(a.points,a.matrix);for(var h=0;h<2;h++){var l,c,f,d,p=0===h?s:u;p.visible&&(l=p.texture.baseTexture,c=this.indices.length,f=this.points.length/2,l.wrapMode=Z.REPEAT,0===h?this.processFill(a):this.processLine(a),0!=(d=this.points.length/2-f)&&(n&&!this._compareStyles(i,p)&&(n.end(c,f),n=null),n||((n=Ms.pop()||new As).begin(p,c,f),this.batches.push(n),i=p),this.addUvs(this.points,e,p.texture,f,d,p.matrix)))}}var v,m=this.indices.length,g=this.points.length/2;n&&n.end(m,g),0!==this.batches.length?(this.indicesUint16&&this.indices.length===this.indicesUint16.length?this.indicesUint16.set(this.indices):(v=65535<g&&t,this.indicesUint16=new(v?Uint32Array:Uint16Array)(this.indices)),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()):this.batchable=!0}}else this.batchable=!0},Ls.prototype._compareStyles=function(t,e){return!(!t||!e)&&t.texture.baseTexture===e.texture.baseTexture&&t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native},Ls.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var r=this.graphicsData[t],n=r.fillStyle,i=r.lineStyle;if(n&&!n.texture.baseTexture.valid)return!1;if(i&&!i.texture.baseTexture.valid)return!1}return!0},Ls.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,r=t.length;e<r;e++)for(var n=t[e],i=0;i<n.size;i++){var o=n.start+i;this.indicesUint16[o]=this.indicesUint16[o]-n.attribStart}},Ls.prototype.isBatchable=function(){if(131070<this.points.length)return!1;for(var t=this.batches,e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*Ls.BATCHABLE_SIZE},Ls.prototype.buildDrawCalls=function(){for(var t=++br._globalBatch,e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),Ps.push(this.drawCalls[e]);this.drawCalls.length=0;var r=this.colors,n=this.textureIds,i=Ps.pop();i||((i=new Uo).texArray=new jo),i.texArray.count=0,i.start=0,i.size=0,i.type=U.TRIANGLES;var o,a=0,s=null,u=!1,h=U.TRIANGLES,l=0;for(this.drawCalls.push(i),e=0;e<this.batches.length;e++){var c=this.batches[e],f=c.style,d=f.texture.baseTexture;u!==!!f.native&&(h=(u=!!f.native)?U.LINES:U.TRIANGLES,s=null,a=8,t++),s!==d&&(s=d)._batchEnabled!==t&&(8===a&&(t++,(a=0)<i.size&&((i=Ps.pop())||((i=new Uo).texArray=new jo),this.drawCalls.push(i)),i.start=l,i.size=0,i.texArray.count=0,i.type=h),d.touched=1,d._batchEnabled=t,d._batchLocation=a,d.wrapMode=10497,i.texArray.elements[i.texArray.count++]=d,a++),i.size+=c.size,l+=c.size,o=d._batchLocation,this.addColors(r,f.color,f.alpha,c.attribSize),this.addTextureIds(n,o,c.attribSize)}br._globalBatch=t,this.packAttributes()},Ls.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,r=this.colors,n=this.textureIds,i=new ArrayBuffer(3*t.length*4),o=new Float32Array(i),a=new Uint32Array(i),s=0,u=0;u<t.length/2;u++)o[s++]=t[2*u],o[s++]=t[2*u+1],o[s++]=e[2*u],o[s++]=e[2*u+1],a[s++]=r[u],o[s++]=n[u];this._buffer.update(i),this._indexBuffer.update(this.indicesUint16)},Ls.prototype.processFill=function(t){t.holes.length?(this.processHoles(t.holes),as.triangulate(t,this)):Os[t.type].triangulate(t,this)},Ls.prototype.processLine=function(t){ps(t,this);for(var e=0;e<t.holes.length;e++)ps(t.holes[e],this)},Ls.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var r=t[e];Os[r.type].build(r),r.matrix&&this.transformPoints(r.points,r.matrix)}},Ls.prototype.calculateBounds=function(){var t=this._bounds,e=Rs,r=he.IDENTITY;this._bounds.clear(),e.clear();for(var n=0;n<this.graphicsData.length;n++){var i,o=this.graphicsData[n],a=o.shape,s=o.type,u=o.lineStyle,h=o.matrix||he.IDENTITY,l=0;u&&u.visible&&(i=u.alignment,l=u.width,s===Xt.POLY?l*=.5+Math.abs(.5-i):l*=Math.max(0,i)),r!==h&&(e.isEmpty()||(t.addBoundsMatrix(e,r),e.clear()),r=h),s===Xt.RECT||s===Xt.RREC?e.addFramePad(a.x,a.y,a.x+a.width,a.y+a.height,l,l):s===Xt.CIRC?e.addFramePad(a.x,a.y,a.x,a.y,a.radius+l,a.radius+l):s===Xt.ELIP?e.addFramePad(a.x,a.y,a.x,a.y,a.width+l,a.height+l):t.addVerticesMatrix(r,a.points,0,a.points.length,l,l)}e.isEmpty()||t.addBoundsMatrix(e,r),t.pad(this.boundsPadding,this.boundsPadding)},Ls.prototype.transformPoints=function(t,e){for(var r=0;r<t.length/2;r++){var n=t[2*r],i=t[2*r+1];t[2*r]=e.a*n+e.c*i+e.tx,t[2*r+1]=e.b*n+e.d*i+e.ty}},Ls.prototype.addColors=function(t,e,r,n){for(var i=St((e>>16)+(65280&e)+((255&e)<<16),r);0<n--;)t.push(i)},Ls.prototype.addTextureIds=function(t,e,r){for(;0<r--;)t.push(e)},Ls.prototype.addUvs=function(t,e,r,n,i,o){void 0===o&&(o=null);for(var a=0,s=e.length,u=r.frame;a<i;){var h,l=t[2*(n+a)],c=t[2*(n+a)+1];o&&(h=o.a*l+o.c*c+o.tx,c=o.b*l+o.d*c+o.ty,l=h),a++,e.push(l/u.width,c/u.height)}var f=r.baseTexture;(u.width<f.width||u.height<f.height)&&this.adjustUvs(e,r,s,i)},Ls.prototype.adjustUvs=function(t,e,r,n){for(var i=e.baseTexture,o=r+2*n,a=e.frame,s=a.width/i.width,u=a.height/i.height,h=a.x/a.width,l=a.y/a.height,c=Math.floor(t[r]+1e-6),f=Math.floor(t[r+1]+1e-6),d=r+2;d<o;d+=2)c=Math.min(c,Math.floor(t[d]+1e-6)),f=Math.min(f,Math.floor(t[d+1]+1e-6));for(h-=c,l-=f,d=r;d<o;d+=2)t[d]=(t[d]+h)*s,t[d+1]=(t[d+1]+l)*u},Ls.BATCHABLE_SIZE=100,Ls);function Ls(){var t=Ns.call(this)||this;return t.uvsFloat32=null,t.indicesUint16=null,t.points=[],t.colors=[],t.uvs=[],t.indices=[],t.textureIds=[],t.graphicsData=[],t.dirty=0,t.batchDirty=-1,t.cacheDirty=-1,t.clearDirty=0,t.drawCalls=[],t.batches=[],t.shapeIndex=0,t._bounds=new be,t.boundsDirty=-1,t.boundsPadding=0,t.batchable=!1,t.indicesUint16=null,t.uvsFloat32=null,t.closePointEps=1e-4,t}var ks,Bs=(os(Us,ks=rs),Us.prototype.clone=function(){var t=new Us;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},Us.prototype.reset=function(){ks.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},Us);function Us(){var t=null!==ks&&ks.apply(this,arguments)||this;return t.width=0,t.alignment=.5,t.native=!1,t.cap=$a.BUTT,t.join=Za.MITER,t.miterLimit=10,t}var js,zs=new Float32Array(3),Hs={},Gs=(os(Xs,js=De),Object.defineProperty(Xs.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),Xs.prototype.clone=function(){return this.finishPoly(),new Xs(this._geometry)},Object.defineProperty(Xs.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(Xs.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(Xs.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(Xs.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),Xs.prototype.lineStyle=function(t){var e;return void 0===t&&(t=null),"number"==typeof t&&(t={width:(e=arguments)[0]||0,color:e[1]||0,alpha:void 0!==e[2]?e[2]:1,alignment:void 0!==e[3]?e[3]:.5,native:!!e[4]}),this.lineTextureStyle(t)},Xs.prototype.lineTextureStyle=function(e){var t;"number"==typeof e&&(Lt("v5.2.0","Please use object-based options for Graphics#lineTextureStyle"),e={width:(t=arguments)[0],texture:t[1],color:t[2],alpha:t[3],matrix:t[4],alignment:t[5],native:t[6]},Object.keys(e).forEach(function(t){return void 0===e[t]&&delete e[t]})),e=Object.assign({width:0,texture:cn.WHITE,color:e&&e.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:$a.BUTT,join:Za.MITER,miterLimit:10},e),this.currentPath&&this.startPoly();var r=0<e.width&&0<e.alpha;return r?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:r},e)):this._lineStyle.reset(),this},Xs.prototype.startPoly=function(){var t,e;this.currentPath?(t=this.currentPath.points,2<(e=this.currentPath.points.length)&&(this.drawShape(this.currentPath),this.currentPath=new ee,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))):(this.currentPath=new ee,this.currentPath.closeStroke=!1)},Xs.prototype.finishPoly=function(){this.currentPath&&(2<this.currentPath.points.length?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},Xs.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},Xs.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var r=this.currentPath.points,n=r[r.length-2],i=r[r.length-1];return n===t&&i===e||r.push(t,e),this},Xs.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},Xs.prototype.quadraticCurveTo=function(t,e,r,n){this._initCurve();var i=this.currentPath.points;return 0===i.length&&this.moveTo(0,0),ws.curveTo(t,e,r,n,i),this},Xs.prototype.bezierCurveTo=function(t,e,r,n,i,o){return this._initCurve(),xs.curveTo(t,e,r,n,i,o,this.currentPath.points),this},Xs.prototype.arcTo=function(t,e,r,n,i){this._initCurve(t,e);var o,a,s,u,h,l,c=this.currentPath.points,f=ys.curveTo(t,e,r,n,i,c);return f&&(o=f.cx,a=f.cy,s=f.radius,u=f.startAngle,h=f.endAngle,l=f.anticlockwise,this.arc(o,a,s,u,h,l)),this},Xs.prototype.arc=function(t,e,r,n,i,o){if(void 0===o&&(o=!1),n===i)return this;if(!o&&i<=n?i+=Yt:o&&n<=i&&(n+=Yt),0==i-n)return this;var a,s,u=t+Math.cos(n)*r,h=e+Math.sin(n)*r,l=this._geometry.closePointEps,c=this.currentPath?this.currentPath.points:null;return c?(a=Math.abs(c[c.length-2]-u),s=Math.abs(c[c.length-1]-h),a<l&&s<l||c.push(u,h)):(this.moveTo(u,h),c=this.currentPath.points),ys.arc(u,h,t,e,r,n,i,o,c),this},Xs.prototype.beginFill=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1),this.beginTextureFill({texture:cn.WHITE,color:t,alpha:e})},Xs.prototype.beginTextureFill=function(e){var t;e instanceof cn&&(Lt("v5.2.0","Please use object-based options for Graphics#beginTextureFill"),e={texture:(t=arguments)[0],color:t[1],alpha:t[2],matrix:t[3]},Object.keys(e).forEach(function(t){return void 0===e[t]&&delete e[t]})),e=Object.assign({texture:cn.WHITE,color:16777215,alpha:1,matrix:null},e),this.currentPath&&this.startPoly();var r=0<e.alpha;return r?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:r},e)):this._fillStyle.reset(),this},Xs.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},Xs.prototype.drawRect=function(t,e,r,n){return this.drawShape(new Zt(t,e,r,n))},Xs.prototype.drawRoundedRect=function(t,e,r,n,i){return this.drawShape(new ne(t,e,r,n,i))},Xs.prototype.drawCircle=function(t,e,r){return this.drawShape(new $t(t,e,r))},Xs.prototype.drawEllipse=function(t,e,r,n){return this.drawShape(new Qt(t,e,r,n))},Xs.prototype.drawPolygon=function(){for(var t=arguments,e=[],r=0;r<arguments.length;r++)e[r]=t[r];var n=!0,i=e[0],o=i.points?(n=i.closeStroke,i.points):Array.isArray(e[0])?e[0]:e,a=new ee(o);return a.closeStroke=n,this.drawShape(a),this},Xs.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},Xs.prototype.drawStar=function(t,e,r,n,i,o){return void 0===o&&(o=0),this.drawPolygon(new ms(t,e,r,n,i,o))},Xs.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},Xs.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===Xt.RECT&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)},Xs.prototype._render=function(t){this.finishPoly();var e=this._geometry,r=t.context.supports.uint32Indices;e.updateBatches(r),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},Xs.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,r=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=r,this.vertexData=new Float32Array(t.points);for(var n=0;n<r;n++){var i=t.batches[n],o=i.style.color,a=new Float32Array(this.vertexData.buffer,4*i.attribStart*2,2*i.attribSize),s=new Float32Array(t.uvsFloat32.buffer,4*i.attribStart*2,2*i.attribSize),u={vertexData:a,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*i.start,i.size),uvs:s,_batchRGB:bt(o),_tintRGB:o,_texture:i.style.texture,alpha:i.style.alpha,worldAlpha:1};this.batches[n]=u}},Xs.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,r=this.batches.length;e<r;e++){var n=this.batches[e];n.worldAlpha=this.worldAlpha*n.alpha,t.plugins[this.pluginName].render(n)}}},Xs.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),r=this._geometry,n=this.tint,i=this.worldAlpha,o=e.uniforms,a=r.drawCalls;o.translationMatrix=this.transform.worldTransform,o.tint[0]=(n>>16&255)/255*i,o.tint[1]=(n>>8&255)/255*i,o.tint[2]=(255&n)/255*i,o.tint[3]=i,t.shader.bind(e),t.geometry.bind(r,e),t.state.set(this.state);for(var s=0,u=a.length;s<u;s++)this._renderDrawCallDirect(t,r.drawCalls[s])},Xs.prototype._renderDrawCallDirect=function(t,e){for(var r=e.texArray,n=e.type,i=e.size,o=e.start,a=r.count,s=0;s<a;s++)t.texture.bind(r.elements[s],s);t.geometry.draw(n,i,o)},Xs.prototype._resolveDirectShader=function(t){var e=this.shader,r=this.pluginName;if(!e){if(!Hs[r]){for(var n=new Int32Array(16),i=0;i<16;i++)n[i]=i;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new he,default:Bn.from({uSamplers:n},!0)},a=t.plugins[r]._shader.program;Hs[r]=new Fi(a,o)}e=Hs[r]}return e},Xs.prototype._calculateBounds=function(){this.finishPoly();var t,e,r,n,i,o=this._geometry;o.graphicsData.length&&(e=(t=o.bounds).minX,r=t.minY,n=t.maxX,i=t.maxY,this._bounds.addFrame(this.transform,e,r,n,i))},Xs.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,Xs._TEMP_POINT),this._geometry.containsPoint(Xs._TEMP_POINT)},Xs.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=bt(this.tint,zs),e=0;e<this.batches.length;e++){var r=this.batches[e],n=r._batchRGB,i=(t[0]*n[0]*255<<16)+(t[1]*n[1]*255<<8)+(0|t[2]*n[2]*255);r._tintRGB=(i>>16)+(65280&i)+((255&i)<<16)}}},Xs.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,r=e.a,n=e.b,i=e.c,o=e.d,a=e.tx,s=e.ty,u=this._geometry.points,h=this.vertexData,l=0,c=0;c<u.length;c+=2){var f=u[c],d=u[c+1];h[l++]=r*f+i*d+a,h[l++]=o*d+n*f+s}}},Xs.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0),this},Xs.prototype.setMatrix=function(t){return this._matrix=t,this},Xs.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},Xs.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},Xs.prototype.destroy=function(t){js.prototype.destroy.call(this,t),this._geometry.refCount--,0===this._geometry.refCount&&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,js.prototype.destroy.call(this,t)},Xs._TEMP_POINT=new oe,Xs);function Xs(t){void 0===t&&(t=null);var e=js.call(this)||this;return e._geometry=t||new Fs,e._geometry.refCount++,e.shader=null,e.state=ki.for2d(),e._fillStyle=new rs,e._lineStyle=new Bs,e._matrix=null,e._holeMode=!1,e.currentPath=null,e.batches=[],e.batchTint=-1,e.batchDirty=-1,e.vertexData=null,e.pluginName="batch",e._transformID=-1,e.tint=16777215,e.blendMode=k.NORMAL,e}var Vs=function(t,e){return(Vs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Ys,Ws,qs,Zs=new oe,Ks=new Uint16Array([0,1,2,0,2,3]),$s=(Vs(Ws=Qs,qs=Ys=De),Ws.prototype=null===qs?Object.create(qs):(Js.prototype=qs.prototype,new Js),Qs.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Nt(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Nt(this.scale.y)*this._height/this._texture.orig.height)},Qs.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},Qs.prototype.calculateVertices=function(){var t=this._texture;if(this._transformID!==this.transform._worldID||this._textureID!==t._updateID){this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;var e=this.transform.worldTransform,r=e.a,n=e.b,i=e.c,o=e.d,a=e.tx,s=e.ty,u=this.vertexData,h=t.trim,l=t.orig,c=this._anchor,f=0,d=0,p=0,v=0,p=h?(f=(d=h.x-c._x*l.width)+h.width,(v=h.y-c._y*l.height)+h.height):(f=(d=-c._x*l.width)+l.width,(v=-c._y*l.height)+l.height);if(u[0]=r*d+i*v+a,u[1]=o*v+n*d+s,u[2]=r*f+i*v+a,u[3]=o*v+n*f+s,u[4]=r*f+i*p+a,u[5]=o*p+n*f+s,u[6]=r*d+i*p+a,u[7]=o*p+n*d+s,this._roundPixels)for(var m=ct.RESOLUTION,g=0;g<u.length;++g)u[g]=Math.round((u[g]*m|0)/m)}},Qs.prototype.calculateTrimmedVertices=function(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var t=this._texture,e=this.vertexTrimmedData,r=t.orig,n=this._anchor,i=this.transform.worldTransform,o=i.a,a=i.b,s=i.c,u=i.d,h=i.tx,l=i.ty,c=-n._x*r.width,f=c+r.width,d=-n._y*r.height,p=d+r.height;e[0]=o*c+s*d+h,e[1]=u*d+a*c+l,e[2]=o*f+s*d+h,e[3]=u*d+a*f+l,e[4]=o*f+s*p+h,e[5]=u*p+a*f+l,e[6]=o*c+s*p+h,e[7]=u*p+a*c+l},Qs.prototype._render=function(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)},Qs.prototype._calculateBounds=function(){var t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},Qs.prototype.getLocalBounds=function(t){return 0===this.children.length?(this._bounds.minX=this._texture.orig.width*-this._anchor._x,this._bounds.minY=this._texture.orig.height*-this._anchor._y,this._bounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._bounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new Zt),t=this._localBoundsRect),this._bounds.getRectangle(t)):Ys.prototype.getLocalBounds.call(this,t)},Qs.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,Zs);var e,r=this._texture.orig.width,n=this._texture.orig.height,i=-r*this.anchor.x;return Zs.x>=i&&Zs.x<i+r&&(e=-n*this.anchor.y,Zs.y>=e&&Zs.y<e+n)},Qs.prototype.destroy=function(t){var e;Ys.prototype.destroy.call(this,t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,("boolean"==typeof t?t:t&&t.texture)&&(e="boolean"==typeof t?t:t&&t.baseTexture,this._texture.destroy(!!e)),this._texture=null},Qs.from=function(t,e){return new Qs(t instanceof cn?t:cn.from(t,e))},Object.defineProperty(Qs.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(Qs.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){var e=Nt(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(Qs.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){var e=Nt(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(Qs.prototype,"anchor",{get:function(){return this._anchor},set:function(t){this._anchor.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(Qs.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(Qs.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||cn.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),Qs);function Js(){this.constructor=Ws}function Qs(t){var e=Ys.call(this)||this;return e._anchor=new se(e._onAnchorUpdate,e,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),e._texture=null,e._width=0,e._height=0,e._tint=null,e._tintRGB=null,e.tint=16777215,e.blendMode=k.NORMAL,e._cachedTint=16777215,e.uvs=null,e.texture=t||cn.EMPTY,e.vertexData=new Float32Array(8),e.vertexTrimmedData=null,e._transformID=-1,e._textureID=-1,e._transformTrimmedID=-1,e._textureTrimmedID=-1,e.indices=Ks,e.pluginName="batch",e.isSprite=!0,e._roundPixels=ct.ROUND_PIXELS,e}var tu,eu,ru=function(t,e){return(ru=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};(eu=tu=tu||{})[eu.LINEAR_VERTICAL=0]="LINEAR_VERTICAL";var nu={align:"left",breakWords:!(eu[eu.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"),dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:tu.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},iu=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ou=(au.prototype.clone=function(){var t={};return hu(t,this,nu),new au(t)},au.prototype.reset=function(){hu(this,nu,nu)},Object.defineProperty(au.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=uu(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=uu(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){!function(t,e){if(Array.isArray(t)&&Array.isArray(e)&&t.length===e.length){for(var r=0;r<t.length;++r)if(t[r]!==e[r])return;return 1}}(this._fillGradientStops,t)&&(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=uu(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),au.prototype.toFontString=function(){var t="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var r=e.length-1;0<=r;r--){var n=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&iu.indexOf(n)<0&&(n='"'+n+'"'),e[r]=n}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},au);function au(t){this.styleID=0,this.reset(),hu(this,t,t)}function su(t){return"number"==typeof t?wt(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function uu(t){if(Array.isArray(t)){for(var e=0;e<t.length;++e)t[e]=su(t[e]);return t}return su(t)}function hu(t,e,r){for(var n in r)Array.isArray(e[n])?t[n]=e[n].slice():t[n]=e[n]}var lu=(cu.measureText=function(t,e,r,n){void 0===n&&(n=cu._canvas),r=null==r?e.wordWrap:r;var i=e.toFontString(),o=cu.measureFont(i);0===o.fontSize&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);var a=n.getContext("2d");a.font=i;for(var s=(r?cu.wordWrap(t,e,n):t).split(/(?:\r\n|\r|\n)/),u=new Array(s.length),h=0,l=0;l<s.length;l++){var c=a.measureText(s[l]).width+(s[l].length-1)*e.letterSpacing;u[l]=c,h=Math.max(h,c)}var f=h+e.strokeThickness;e.dropShadow&&(f+=e.dropShadowDistance);var d=e.lineHeight||o.fontSize+e.strokeThickness,p=Math.max(d,o.fontSize+e.strokeThickness)+(s.length-1)*(d+e.leading);return e.dropShadow&&(p+=e.dropShadowDistance),new cu(t,e,f,p,s,u,d+e.leading,h,o)},cu.wordWrap=function(t,e,r){void 0===r&&(r=cu._canvas);for(var n=r.getContext("2d"),i=0,o="",a="",s={},u=e.letterSpacing,h=e.whiteSpace,l=cu.collapseSpaces(h),c=cu.collapseNewlines(h),f=!l,d=e.wordWrapWidth+u,p=cu.tokenize(t),v=0;v<p.length;v++){var m=p[v];if(cu.isNewline(m)){if(!c){a+=cu.addLine(o),f=!l,o="",i=0;continue}m=" "}if(l){var g=cu.isBreakingSpace(m),y=cu.isBreakingSpace(o[o.length-1]);if(g&&y)continue}var _=cu.getFromCache(m,u,s,n);if(d<_)if(""!==o&&(a+=cu.addLine(o),o="",i=0),cu.canBreakWords(m,e.breakWords))for(var x=cu.wordWrapSplit(m),b=0;b<x.length;b++){for(var w=x[b],T=1;x[b+T];){var E=x[b+T],A=w[w.length-1];if(cu.canBreakChars(A,E,m,b,e.breakWords))break;w+=E,T++}b+=w.length-1;var S=cu.getFromCache(w,u,s,n);d<S+i&&(a+=cu.addLine(o),f=!1,o="",i=0),o+=w,i+=S}else{0<o.length&&(a+=cu.addLine(o),o="",i=0);var O=v===p.length-1;a+=cu.addLine(m,!O),f=!1,o="",i=0}else d<_+i&&(f=!1,a+=cu.addLine(o),o="",i=0),(0<o.length||!cu.isBreakingSpace(m)||f)&&(o+=m,i+=_)}return a+=cu.addLine(o,!1)},cu.addLine=function(t,e){return void 0===e&&(e=!0),t=cu.trimRight(t),t=e?t+"\n":t},cu.getFromCache=function(t,e,r,n){var i,o=r[t];return void 0===o&&(i=t.length*e,o=n.measureText(t).width+i,r[t]=o),o},cu.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},cu.collapseNewlines=function(t){return"normal"===t},cu.trimRight=function(t){if("string"!=typeof t)return"";for(var e=t.length-1;0<=e;e--){var r=t[e];if(!cu.isBreakingSpace(r))break;t=t.slice(0,-1)}return t},cu.isNewline=function(t){return"string"==typeof t&&0<=cu._newlines.indexOf(t.charCodeAt(0))},cu.isBreakingSpace=function(t){return"string"==typeof t&&0<=cu._breakingSpaces.indexOf(t.charCodeAt(0))},cu.tokenize=function(t){var e=[],r="";if("string"!=typeof t)return e;for(var n=0;n<t.length;n++){var i=t[n];cu.isBreakingSpace(i)||cu.isNewline(i)?(""!==r&&(e.push(r),r=""),e.push(i)):r+=i}return""!==r&&e.push(r),e},cu.canBreakWords=function(t,e){return e},cu.canBreakChars=function(t,e,r,n,i){return!0},cu.wordWrapSplit=function(t){return t.split("")},cu.measureFont=function(t){if(cu._fonts[t])return cu._fonts[t];var e={ascent:0,descent:0,fontSize:0},r=cu._canvas,n=cu._context;n.font=t;var i=cu.METRICS_STRING+cu.BASELINE_SYMBOL,o=Math.ceil(n.measureText(i).width),a=2*(s=Math.ceil(n.measureText(cu.BASELINE_SYMBOL).width)),s=s*cu.BASELINE_MULTIPLIER|0;r.width=o,r.height=a,n.fillStyle="#f00",n.fillRect(0,0,o,a),n.font=t,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(i,0,s);for(var u=n.getImageData(0,0,o,a).data,h=u.length,l=4*o,c=0,f=0,d=!1,c=0;c<s;++c){for(var p=0;p<l;p+=4)if(255!==u[f+p]){d=!0;break}if(d)break;f+=l}for(e.ascent=s-c,f=h-l,d=!1,c=a;s<c;--c){for(p=0;p<l;p+=4)if(255!==u[f+p]){d=!0;break}if(d)break;f-=l}return e.descent=c-s,e.fontSize=e.ascent+e.descent,cu._fonts[t]=e},cu.clearMetrics=function(t){void 0===t&&(t=""),t?delete cu._fonts[t]:cu._fonts={}},cu);function cu(t,e,r,n,i,o,a,s,u){this.text=t,this.style=e,this.width=r,this.height=n,this.lines=i,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=s,this.fontProperties=u}var fu=function(){try{var t=new OffscreenCanvas(0,0),e=t.getContext("2d");return e&&e.measureText?t:document.createElement("canvas")}catch(t){return document.createElement("canvas")}}();fu.width=fu.height=10,lu._canvas=fu,lu._context=fu.getContext("2d"),lu._fonts={},lu.METRICS_STRING="|ÉqÅ",lu.BASELINE_SYMBOL="M",lu.BASELINE_MULTIPLIER=1.4,lu._newlines=[10,13];var du,pu,vu,mu={texture:!0,children:!(lu._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]),baseTexture:!0},gu=(ru(pu=_u,vu=du=$s),pu.prototype=null===vu?Object.create(vu):(yu.prototype=vu.prototype,new yu),_u.prototype.updateText=function(t){var e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),this.dirty||!t){this._font=this._style.toFontString();var r,n,i=this.context,o=lu.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),a=o.width,s=o.height,u=o.lines,h=o.lineHeight,l=o.lineWidths,c=o.maxLineWidth,f=o.fontProperties;this.canvas.width=Math.ceil((Math.max(1,a)+2*e.padding)*this._resolution),this.canvas.height=Math.ceil((Math.max(1,s)+2*e.padding)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;for(var d=e.dropShadow?2:1,p=0;p<d;++p){var v,m,g=e.dropShadow&&0===p,y=g?2*s:0,_=y*this.resolution;g?(i.fillStyle="black",i.strokeStyle="black",m=bt("number"==typeof(v=e.dropShadowColor)?v:Tt(v)),i.shadowColor="rgba("+255*m[0]+","+255*m[1]+","+255*m[2]+","+e.dropShadowAlpha+")",i.shadowBlur=e.dropShadowBlur,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*e.dropShadowDistance,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*e.dropShadowDistance+_):(i.fillStyle=this._generateFillStyle(e,u,o),i.strokeStyle=e.stroke,i.shadowColor="0",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0);for(var x=0;x<u.length;x++)r=e.strokeThickness/2,n=e.strokeThickness/2+x*h+f.ascent,"right"===e.align?r+=c-l[x]:"center"===e.align&&(r+=(c-l[x])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(u[x],r+e.padding,n+e.padding-y,!0),e.fill&&this.drawLetterSpacing(u[x],r+e.padding,n+e.padding-y)}this.updateTexture()}},_u.prototype.drawLetterSpacing=function(t,e,r,n){void 0===n&&(n=!1);var i=this._style.letterSpacing;if(0!==i)for(var o,a=e,s=Array.from?Array.from(t):t.split(""),u=this.context.measureText(t).width,h=0;h<s.length;++h){var l=s[h];n?this.context.strokeText(l,a,r):this.context.fillText(l,a,r),a+=u-(o=this.context.measureText(t.substring(h+1)).width)+i,u=o}else n?this.context.strokeText(t,e,r):this.context.fillText(t,e,r)},_u.prototype.updateTexture=function(){var t,e=this.canvas;!this._style.trim||(t=function(t){for(var e,r,n=t.width,i=t.height,o=t.getContext("2d"),a=o.getImageData(0,0,n,i).data,s=a.length,u={top:null,left:null,right:null,bottom:null},h=null,l=0;l<s;l+=4)0!==a[l+3]&&(e=l/4%n,r=~~(l/4/n),null===u.top&&(u.top=r),(null===u.left||e<u.left)&&(u.left=e),(null===u.right||u.right<e)&&(u.right=1+e),(null===u.bottom||u.bottom<r)&&(u.bottom=r));return null!==u.top&&(n=u.right-u.left,i=u.bottom-u.top+1,h=o.getImageData(u.left,u.top,n,i)),{height:i,width:n,data:h}}(e)).data&&(e.width=t.width,e.height=t.height,this.context.putImageData(t.data,0,0));var r=this._texture,n=this._style,i=n.trim?0:n.padding,o=r.baseTexture;r.trim.width=r._frame.width=Math.ceil(e.width/this._resolution),r.trim.height=r._frame.height=Math.ceil(e.height/this._resolution),r.trim.x=-i,r.trim.y=-i,r.orig.width=r._frame.width-2*i,r.orig.height=r._frame.height-2*i,this._onTextureUpdate(),o.setRealSize(e.width,e.height,this._resolution),this.dirty=!1},_u.prototype._render=function(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),du.prototype._render.call(this,t)},_u.prototype.getLocalBounds=function(t){return this.updateText(!0),du.prototype.getLocalBounds.call(this,t)},_u.prototype._calculateBounds=function(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)},_u.prototype._generateFillStyle=function(t,e,r){var n,i=t.fill;if(!Array.isArray(i))return i;if(1===i.length)return i[0];var o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,s=Math.ceil(this.canvas.width/this._resolution)-o-2*a,u=Math.ceil(this.canvas.height/this._resolution)-o-2*a,h=i.slice(),l=t.fillGradientStops.slice();if(!l.length)for(var c=h.length+1,f=1;f<c;++f)l.push(f/c);if(h.unshift(i[0]),l.unshift(0),h.push(i[i.length-1]),l.push(1),t.fillGradientType===tu.LINEAR_VERTICAL){n=this.context.createLinearGradient(s/2,a,s/2,u+a);for(var d=0,p=(r.fontProperties.fontSize+t.strokeThickness)/u,f=0;f<e.length;f++)for(var v=r.lineHeight*f,m=0;m<h.length;m++){var g=v/u+("number"==typeof l[m]?l[m]:m/h.length)*p,y=Math.max(d,g),y=Math.min(y,1);n.addColorStop(y,h[m]),d=y}}else{n=this.context.createLinearGradient(a,u/2,s+a,u/2);for(var _=h.length+1,x=1,f=0;f<h.length;f++){var b=void 0,b="number"==typeof l[f]?l[f]:x/_;n.addColorStop(b,h[f]),x++}}return n},_u.prototype.destroy=function(t){"boolean"==typeof t&&(t={children:t}),t=Object.assign({},mu,t),du.prototype.destroy.call(this,t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(_u.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var e=Nt(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(_u.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var e=Nt(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(_u.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},this._style=t instanceof ou?t:new ou(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(_u.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(_u.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),_u);function yu(){this.constructor=pu}function _u(t,e,r){var n=this,i=!1;r||(r=document.createElement("canvas"),i=!0),r.width=3,r.height=3;var o=cn.from(r);return o.orig=new Zt,o.trim=new Zt,(n=du.call(this,o)||this)._ownCanvas=i,n.canvas=r,n.context=n.canvas.getContext("2d"),n._resolution=ct.RESOLUTION,n._autoResolution=!0,n._text=null,n._style=null,n._styleListener=null,n._font="",n.text=t,n.style=e,n.localStyleID=-1,n}ct.UPLOADS_PER_FRAME=4;var xu=function(t,e){return(xu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var bu=(wu.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},wu.prototype.allowedToUpload=function(){return 0<this.itemsLeft--},wu);function wu(t){this.maxItemsPerFrame=t,this.itemsLeft=0}function Tu(t,e){var r=!1;if(t&&t._textures&&t._textures.length)for(var n,i=0;i<t._textures.length;i++){t._textures[i]instanceof cn&&(n=t._textures[i].baseTexture,-1===e.indexOf(n)&&(e.push(n),r=!0))}return r}function Eu(t,e){if(t.baseTexture instanceof br){var r=t.baseTexture;return-1===e.indexOf(r)&&e.push(r),!0}return!1}function Au(t,e){if(t._texture&&t._texture instanceof cn){var r=t._texture.baseTexture;return-1===e.indexOf(r)&&e.push(r),!0}return!1}function Su(t,e){return e instanceof gu&&(e.updateText(!0),!0)}function Ou(t,e){if(e instanceof ou){var r=e.toFontString();return lu.measureFont(r),!0}return!1}function Mu(t,e){if(t instanceof gu){-1===e.indexOf(t.style)&&e.push(t.style),-1===e.indexOf(t)&&e.push(t);var r=t._texture.baseTexture;return-1===e.indexOf(r)&&e.push(r),!0}return!1}function Pu(t,e){return t instanceof ou&&(-1===e.indexOf(t)&&e.push(t),!0)}var Cu=(Iu.prototype.upload=function(t,e){"function"==typeof t&&(e=t,t=null),t&&this.add(t),this.queue.length?(e&&this.completes.push(e),this.ticking||(this.ticking=!0,ze.system.addOnce(this.tick,this,Fe.UTILITY))):e&&e()},Iu.prototype.tick=function(){setTimeout(this.delayedTick,0)},Iu.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var t=this.queue[0],e=!1;if(t&&!t._destroyed)for(var r=0,n=this.uploadHooks.length;r<n;r++)if(this.uploadHooks[r](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}e||this.queue.shift()}if(this.queue.length)ze.system.addOnce(this.tick,this,Fe.UTILITY);else{this.ticking=!1;for(var i=this.completes.slice(0),r=this.completes.length=0,n=i.length;r<n;r++)i[r]()}},Iu.prototype.registerFindHook=function(t){return t&&this.addHooks.push(t),this},Iu.prototype.registerUploadHook=function(t){return t&&this.uploadHooks.push(t),this},Iu.prototype.add=function(t){for(var e=0,r=this.addHooks.length;e<r&&!this.addHooks[e](t,this.queue);e++);if(t instanceof De)for(e=t.children.length-1;0<=e;e--)this.add(t.children[e]);return this},Iu.prototype.destroy=function(){this.ticking&&ze.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},Iu);function Iu(t){var e=this;this.limiter=new bu(ct.UPLOADS_PER_FRAME),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){e.queue&&e.prepareItems()},this.registerFindHook(Mu),this.registerFindHook(Pu),this.registerFindHook(Tu),this.registerFindHook(Eu),this.registerFindHook(Au),this.registerUploadHook(Su),this.registerUploadHook(Ou)}function Nu(t,e){return e instanceof br&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function Du(t,e){if(!(e instanceof Gs))return!1;var r=e.geometry;e.finishPoly(),r.updateBatches();for(var n=r.batches,i=0;i<n.length;i++){var o=n[i].style.texture;o&&Nu(t,o.baseTexture)}return r.batchable||t.geometry.bind(r,e._resolveDirectShader(t)),!0}function Ru(t,e){return t instanceof Gs&&(e.push(t),!0)}var Fu,Lu,ku,Bu=(xu(Lu=ju,ku=Fu=Cu),Lu.prototype=null===ku?Object.create(ku):(Uu.prototype=ku.prototype,new Uu),ju);function Uu(){this.constructor=Lu}function ju(t){var e=Fu.call(this,t)||this;return e.uploadHookHelper=e.renderer,e.registerFindHook(Ru),e.registerUploadHook(Nu),e.registerUploadHook(Du),e}zu.prototype.beginFrame=function(){this.frameStart=Date.now()},zu.prototype.allowedToUpload=function(){return Date.now()-this.frameStart<this.maxMilliseconds};function zu(t){this.maxMilliseconds=t,this.frameStart=0}var Hu=(Gu.prototype._updateResolution=function(t){void 0===t&&(t=null);var e=this.data.meta.scale,r=Gt(t,null);return null===r&&(r=void 0!==e?parseFloat(e):1),1!==r&&this.baseTexture.setResolution(r),r},Gu.prototype.parse=function(t){this._batchIndex=0,this._callback=t,this._frameKeys.length<=Gu.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()},Gu.prototype._processFrames=function(t){for(var e=t,r=Gu.BATCH_SIZE;e-t<r&&e<this._frameKeys.length;){var n,i,o,a,s=this._frameKeys[e],u=this._frames[s],h=u.frame;h&&(n=a=null,i=!1!==u.trimmed&&u.sourceSize?u.sourceSize:u.frame,o=new Zt(0,0,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution),a=u.rotated?new Zt(Math.floor(h.x)/this.resolution,Math.floor(h.y)/this.resolution,Math.floor(h.h)/this.resolution,Math.floor(h.w)/this.resolution):new Zt(Math.floor(h.x)/this.resolution,Math.floor(h.y)/this.resolution,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution),!1!==u.trimmed&&u.spriteSourceSize&&(n=new Zt(Math.floor(u.spriteSourceSize.x)/this.resolution,Math.floor(u.spriteSourceSize.y)/this.resolution,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution)),this.textures[s]=new cn(this.baseTexture,a,o,n,u.rotated?2:0,u.anchor),cn.addToCache(this.textures[s],s)),e++}},Gu.prototype._processAnimations=function(){var t=this.data.animations||{};for(var e in t){this.animations[e]=[];for(var r=0;r<t[e].length;r++){var n=t[e][r];this.animations[e].push(this.textures[n])}}},Gu.prototype._parseComplete=function(){var t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)},Gu.prototype._nextBatch=function(){var t=this;this._processFrames(this._batchIndex*Gu.BATCH_SIZE),this._batchIndex++,setTimeout(function(){t._batchIndex*Gu.BATCH_SIZE<t._frameKeys.length?t._nextBatch():(t._processAnimations(),t._parseComplete())},0)},Gu.prototype.destroy=function(t){var e;for(var r in void 0===t&&(t=!1),this.textures)this.textures[r].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(null!==(e=this._texture)&&void 0!==e&&e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null},Gu.BATCH_SIZE=1e3,Gu);function Gu(t,e,r){void 0===r&&(r=null),this._texture=t instanceof cn?t:null,this.baseTexture=t instanceof br?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;var n=this.baseTexture.resource;this.resolution=this._updateResolution(r||(n?n.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}var Xu=(Vu.use=function(r,n){var t,e,i=r.name+"_image";r.data&&r.type===Ca.TYPE.JSON&&r.data.frames&&!this.resources[i]?(t={crossOrigin:r.crossOrigin,metadata:r.metadata.imageMetadata,parentResource:r},e=Vu.getResourcePath(r,this.baseUrl),this.add(i,e,t,function(t){var e;t.error?n(t.error):(e=new Hu(t.texture,r.data,r.url)).parse(function(){r.spritesheet=e,r.textures=e.textures,n()})})):n()},Vu.getResourcePath=function(t,e){return t.isDataUrl?t.data.meta.image:gt.a.resolve(t.url.replace(e,""),t.data.meta.image)},Vu);function Vu(){}var Yu=function(t,e){return(Yu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function Wu(t,e){function r(){this.constructor=t}Yu(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var qu,Zu=new oe;Wu(Ku,qu=$s),Object.defineProperty(Ku.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(Ku.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(t){this.tileTransform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(Ku.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(t){this.tileTransform.position.copyFrom(t)},enumerable:!1,configurable:!0}),Ku.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},Ku.prototype._render=function(t){var e=this._texture;e&&e.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))},Ku.prototype._calculateBounds=function(){var t=this._width*-this._anchor._x,e=this._height*-this._anchor._y,r=this._width*(1-this._anchor._x),n=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,r,n)},Ku.prototype.getLocalBounds=function(t){return 0===this.children.length?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new Zt),t=this._localBoundsRect),this._bounds.getRectangle(t)):qu.prototype.getLocalBounds.call(this,t)},Ku.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,Zu);var e=this._width,r=this._height,n=-e*this.anchor._x;if(Zu.x>=n&&Zu.x<n+e){var i=-r*this.anchor._y;if(Zu.y>=i&&Zu.y<i+r)return!0}return!1},Ku.prototype.destroy=function(t){qu.prototype.destroy.call(this,t),this.tileTransform=null,this.uvMatrix=null},Ku.from=function(t,e){return"number"==typeof e&&(Lt("5.3.0","TilingSprite.from use options instead of width and height args"),e={width:e,height:arguments[2]}),new Ku(cn.from(t,e),e.width,e.height)},Object.defineProperty(Ku.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(Ku.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0});function Ku(t,e,r){void 0===e&&(e=100),void 0===r&&(r=100);var n=qu.call(this,t)||this;return n.tileTransform=new _e,n._width=e,n._height=r,n.uvMatrix=t.uvMatrix||new Gi(t),n.pluginName="tilingSprite",n.uvRespectAnchor=!1,n}var $u,Ju="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n",Qu=new he,th=(Wu(eh,$u=Vn),eh.prototype.render=function(t){var e=this.renderer,r=this.quad,n=r.vertices;n[0]=n[6]=t._width*-t.anchor.x,n[1]=n[3]=t._height*-t.anchor.y,n[2]=n[4]=t._width*(1-t.anchor.x),n[5]=n[7]=t._height*(1-t.anchor.y),t.uvRespectAnchor&&((n=r.uvs)[0]=n[6]=-t.anchor.x,n[1]=n[3]=-t.anchor.y,n[2]=n[4]=1-t.anchor.x,n[5]=n[7]=1-t.anchor.y),r.invalidate();var i=t._texture,o=i.baseTexture,a=t.tileTransform.localTransform,s=t.uvMatrix,u=o.isPowerOfTwo&&i.frame.width===o.width&&i.frame.height===o.height;u&&(o._glTextures[e.CONTEXT_UID]?u=o.wrapMode!==Z.CLAMP:o.wrapMode===Z.CLAMP&&(o.wrapMode=Z.REPEAT));var h=u?this.simpleShader:this.shader,l=i.width,c=i.height,f=t._width,d=t._height;Qu.set(a.a*l/f,a.b*l/d,a.c*c/f,a.d*c/d,a.tx/f,a.ty/d),Qu.invert(),u?Qu.prepend(s.mapCoord):(h.uniforms.uMapCoord=s.mapCoord.toArray(!0),h.uniforms.uClampFrame=s.uClampFrame,h.uniforms.uClampOffset=s.uClampOffset),h.uniforms.uTransform=Qu.toArray(!0),h.uniforms.uColor=Ot(t.tint,t.worldAlpha,h.uniforms.uColor,o.alphaMode),h.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),h.uniforms.uSampler=i,e.shader.bind(h),e.geometry.bind(r),this.state.blendMode=At(t.blendMode,o.alphaMode),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},eh);function eh(t){var e=$u.call(this,t)||this,r={globals:e.renderer.globalUniforms};return e.shader=Fi.from(Ju,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord - floor(vTextureCoord - uClampOffset);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture2D(uSampler, coord);\n gl_FragColor = texSample * uColor;\n}\n",r),e.simpleShader=Fi.from(Ju,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 sample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = sample * uColor;\n}\n",r),e.quad=new Fn,e.state=ki.for2d(),e}var rh=function(t,e){return(rh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function nh(t,e){function r(){this.constructor=t}rh(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var ih=(oh.prototype.update=function(t){var e;!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID||(this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID,e=this.uvBuffer.data,this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++)},oh);function oh(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}var ah,sh=new oe,uh=new ee,hh=(nh(lh,ah=De),Object.defineProperty(lh.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(lh.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(lh.prototype,"material",{get:function(){return this.shader},set:function(t){this.shader=t},enumerable:!1,configurable:!0}),Object.defineProperty(lh.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(lh.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(lh.prototype,"tint",{get:function(){return this.shader.tint},set:function(t){this.shader.tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(lh.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture=t},enumerable:!1,configurable:!0}),lh.prototype._render=function(t){var e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===U.TRIANGLES&&e.length<2*lh.BATCHABLE_SIZE?this._renderToBatch(t):this._renderDefault(t)},lh.prototype._renderDefault=function(t){var e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.program.uniformData.translationMatrix&&(e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0)),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},lh.prototype._renderToBatch=function(t){var e=this.geometry;this.shader.uvMatrix&&(this.shader.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=this.shader._tintRGB,this._texture=this.shader.texture;var r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)},lh.prototype.calculateVertices=function(){var t=this.geometry,e=t.buffers[0].data;if(t.vertexDirtyId!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));for(var r=this.transform.worldTransform,n=r.a,i=r.b,o=r.c,a=r.d,s=r.tx,u=r.ty,h=this.vertexData,l=0;l<h.length/2;l++){var c=e[2*l],f=e[2*l+1];h[2*l]=n*c+o*f+s,h[2*l+1]=i*c+a*f+u}if(this._roundPixels)for(var d=ct.RESOLUTION,l=0;l<h.length;++l)h[l]=Math.round((h[l]*d|0)/d);this.vertexDirty=t.vertexDirtyId}},lh.prototype.calculateUvs=function(){var t=this.geometry.buffers[1];this.shader.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new ih(t,this.shader.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},lh.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},lh.prototype.containsPoint=function(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,sh);for(var e=this.geometry.getBuffer("aVertexPosition").data,r=uh.points,n=this.geometry.getIndex().data,i=n.length,o=4===this.drawMode?3:1,a=0;a+2<i;a+=o){var s=2*n[a],u=2*n[a+1],h=2*n[a+2];if(r[0]=e[s],r[1]=e[1+s],r[2]=e[u],r[3]=e[1+u],r[4]=e[h],r[5]=e[1+h],uh.contains(sh.x,sh.y))return!0}return!1},lh.prototype.destroy=function(t){ah.prototype.destroy.call(this,t),this.geometry.refCount--,0===this.geometry.refCount&&this.geometry.dispose(),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},lh.BATCHABLE_SIZE=100,lh);function lh(t,e,r,n){void 0===n&&(n=U.TRIANGLES);var i=ah.call(this)||this;return(i.geometry=t).refCount++,i.shader=e,i.state=r||ki.for2d(),i.drawMode=n,i.start=0,i.size=0,i.uvs=null,i.indices=null,i.vertexData=new Float32Array(1),i.vertexDirty=0,i._transformID=-1,i.tint=16777215,i.blendMode=k.NORMAL,i._roundPixels=ct.ROUND_PIXELS,i.batchUvs=null,i}var ch,fh=(nh(dh,ch=Fi),Object.defineProperty(dh.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(t){this.uniforms.uSampler!==t&&(this.uniforms.uSampler=t,this.uvMatrix.texture=t)},enumerable:!1,configurable:!0}),Object.defineProperty(dh.prototype,"alpha",{get:function(){return this._alpha},set:function(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(dh.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),dh.prototype.update=function(){var t;this._colorDirty&&(this._colorDirty=!1,t=this.texture.baseTexture,Ot(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)),this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},dh);function dh(t,e){var r=this,n={uSampler:t,alpha:1,uTextureMatrix:he.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e)).uniforms&&Object.assign(n,e.uniforms),(r=ch.call(this,e.program||Di.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n","varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"),n)||this)._colorDirty=!1,r.uvMatrix=new Gi(t),r.batchable=void 0===e.program,r.pluginName=e.pluginName,r.tint=e.tint,r.alpha=e.alpha,r}var ph,vh=(nh(mh,ph=Pn),Object.defineProperty(mh.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),mh);function mh(t,e,r){var n=ph.call(this)||this,i=new wn(t),o=new wn(e,!0),a=new wn(r,!0,!0);return n.addAttribute("aVertexPosition",i,2,!1,V.FLOAT).addAttribute("aTextureCoord",o,2,!1,V.FLOAT).addIndex(a),n._updateId=-1,n}var gh=function(t,e){return(gh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var yh=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[]};function _h(){}function xh(){}var bh=[(_h.test=function(t){return"string"==typeof t&&0===t.indexOf("info face=")},_h.parse=function(t){var e=t.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[]};for(var n in e){var i=e[n].match(/^[a-z]+/gm)[0],o=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),a={};for(var s in o){var u=o[s].split("="),h=u[0],l=u[1].replace(/"/gm,""),c=parseFloat(l),f=isNaN(c)?l:c;a[h]=f}r[i].push(a)}var d=new yh;return r.info.forEach(function(t){return d.info.push({face:t.face,size:parseInt(t.size,10)})}),r.common.forEach(function(t){return d.common.push({lineHeight:parseInt(t.lineHeight,10)})}),r.page.forEach(function(t){return d.page.push({id:parseInt(t.id,10),file:t.file})}),r.char.forEach(function(t){return d.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)})}),r.kerning.forEach(function(t){return d.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)})}),d},_h),(xh.test=function(t){return t instanceof XMLDocument&&t.getElementsByTagName("page").length&&null!==t.getElementsByTagName("info")[0].getAttribute("face")},xh.parse=function(t){for(var e=new yh,r=t.getElementsByTagName("info"),n=t.getElementsByTagName("common"),i=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),s=0;s<r.length;s++)e.info.push({face:r[s].getAttribute("face"),size:parseInt(r[s].getAttribute("size"),10)});for(s=0;s<n.length;s++)e.common.push({lineHeight:parseInt(n[s].getAttribute("lineHeight"),10)});for(s=0;s<i.length;s++)e.page.push({id:parseInt(i[s].getAttribute("id"),10)||0,file:i[s].getAttribute("file")});for(s=0;s<o.length;s++){var u=o[s];e.char.push({id:parseInt(u.getAttribute("id"),10),page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xoffset:parseInt(u.getAttribute("xoffset"),10),yoffset:parseInt(u.getAttribute("yoffset"),10),xadvance:parseInt(u.getAttribute("xadvance"),10)})}for(s=0;s<a.length;s++)e.kerning.push({first:parseInt(a[s].getAttribute("first"),10),second:parseInt(a[s].getAttribute("second"),10),amount:parseInt(a[s].getAttribute("amount"),10)});return e},xh)];function wh(t){for(var e=0;e<bh.length;e++)if(bh[e].test(t))return bh[e];return null}function Th(t,e,r,n,i,o){var a,s=r.fill;if(!Array.isArray(s))return s;if(1===s.length)return s[0];var u=r.dropShadow?r.dropShadowDistance:0,h=r.padding||0,l=Math.ceil(t.width/n)-u-2*h,c=Math.ceil(t.height/n)-u-2*h,f=s.slice(),d=r.fillGradientStops.slice();if(!d.length)for(var p=f.length+1,v=1;v<p;++v)d.push(v/p);if(f.unshift(s[0]),d.unshift(0),f.push(s[s.length-1]),d.push(1),r.fillGradientType===tu.LINEAR_VERTICAL){a=e.createLinearGradient(l/2,h,l/2,c+h);for(var m=0,g=(o.fontProperties.fontSize+r.strokeThickness)/c,v=0;v<i.length;v++)for(var y=o.lineHeight*v,_=0;_<f.length;_++){var x=y/c+("number"==typeof d[_]?d[_]:_/f.length)*g,b=Math.max(m,x),b=Math.min(b,1);a.addColorStop(b,f[_]),m=b}}else{a=e.createLinearGradient(h,c/2,l+h,c/2);for(var w=f.length+1,T=1,v=0;v<f.length;v++){var E=void 0,E="number"==typeof d[v]?d[v]:T/w;a.addColorStop(E,f[v]),T++}}return a}var Eh=(Ah.prototype.destroy=function(){for(var t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(var t in this.pageTextures)this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null},Ah.install=function(t,e){var r;if(t instanceof yh)r=t;else{var n=wh(t);if(!n)throw new Error("Unrecognized data format for font.");r=n.parse(t)}e instanceof cn&&(e=[e]);var i=new Ah(r,e);return Ah.available[i.font]=i},Ah.uninstall=function(t){var e=Ah.available[t];if(!e)throw new Error("No font found named '"+t+"'");e.destroy(),delete Ah.available[t]},Ah.from=function(t,e,r){if(!t)throw new Error("[BitmapFont] Property `name` is required.");var n=Object.assign({},Ah.defaultOptions,r),i=n.chars,o=n.padding,a=n.resolution,s=n.textureWidth,u=n.textureHeight,h=function(t){"string"==typeof t&&(t=[t]);for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(Array.isArray(i)){if(2!==i.length)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+i.length+".");var o=i[0].charCodeAt(0),a=i[1].charCodeAt(0);if(a<o)throw new Error("[BitmapFont]: Invalid character range.");for(var s=o,u=a;s<=u;s++)e.push(String.fromCharCode(s))}else e.push.apply(e,i.split(""))}if(0===e.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}(i),l=e instanceof ou?e:new ou(e),c=s,f=new yh;f.info[0]={face:l.fontFamily,size:l.fontSize},f.common[0]={lineHeight:l.fontSize};for(var d,p,v,m=0,g=0,y=0,_=[],x=0;x<h.length;x++){d||((d=document.createElement("canvas")).width=s,d.height=u,p=d.getContext("2d"),v=new br(d,{resolution:a}),_.push(new cn(v)),f.page.push({id:_.length-1,file:""}));var b=lu.measureText(h[x],l,!1,d),w=b.width,T=Math.ceil(b.height),E=Math.ceil(("italic"===l.fontStyle?2:1)*w);if(u-T*a<=g){if(0===g)throw new Error("[BitmapFont] textureHeight "+u+"px is too small for "+l.fontSize+"px fonts");v=p=d=null,y=m=g=0}else{var A,y=Math.max(T+b.fontProperties.descent,y);c<=E*a+m?(--x,g+=y*a,g=Math.ceil(g),y=m=0):(function(t,e,r,n,i,o,a){var s=r.text,u=r.fontProperties;e.translate(n,i),e.scale(o,o);var h=a.strokeThickness/2,l=-a.strokeThickness/2;e.font=a.toFontString(),e.lineWidth=a.strokeThickness,e.textBaseline=a.textBaseline,e.lineJoin=a.lineJoin,e.miterLimit=a.miterLimit,e.fillStyle=Th(t,e,a,o,[s],r),e.strokeStyle=a.stroke,e.font=a.toFontString(),e.lineWidth=a.strokeThickness,e.textBaseline=a.textBaseline,e.lineJoin=a.lineJoin,e.miterLimit=a.miterLimit,e.fillStyle=Th(t,e,a,o,[s],r),e.strokeStyle=a.stroke;var c=a.dropShadowColor,f=bt("number"==typeof c?c:Tt(c));a.dropShadow?(e.shadowColor="rgba("+255*f[0]+","+255*f[1]+","+255*f[2]+","+a.dropShadowAlpha+")",e.shadowBlur=a.dropShadowBlur,e.shadowOffsetX=Math.cos(a.dropShadowAngle)*a.dropShadowDistance,e.shadowOffsetY=Math.sin(a.dropShadowAngle)*a.dropShadowDistance):(e.shadowColor="0",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),a.stroke&&a.strokeThickness&&e.strokeText(s,h,l+r.lineHeight-u.descent),a.fill&&e.fillText(s,h,l+r.lineHeight-u.descent),e.setTransform(),e.fillStyle="rgba(0, 0, 0, 0)"}(d,p,b,m,g,a,l),A=b.text.charCodeAt(0),f.char[A]={id:A,page:_.length-1,x:m/a,y:g/a,width:E,height:T,xoffset:0,yoffset:0,xadvance:Math.ceil(w-(l.dropShadow?l.dropShadowDistance:0)-(l.stroke?l.strokeThickness:0))},m+=(E+2*o)*a,m=Math.ceil(m))}}var S=new Ah(f,_);return void 0!==Ah.available[t]&&Ah.uninstall(t),Ah.available[t]=S},Ah.ALPHA=[["a","z"],["A","Z"]," "],Ah.NUMERIC=[["0","9"]],Ah.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Ah.ASCII=[[" ","~"]],Ah.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Ah.ALPHANUMERIC},Ah.available={},Ah);function Ah(t,e){var r=t.info[0],n=t.common[0],i=Gt(t.page[0].file),o={};for(var a in this.font=r.face,this.size=r.size,this.lineHeight=n.lineHeight/i,this.chars={},this.pageTextures=o,t.page){var s=t.page[a],u=s.id,h=s.file;o[u]=e instanceof Array?e[a]:e[h]}for(var a in t.char){var l=t.char[a],u=l.id,c=l.page,f=t.char[a],d=f.x,p=f.y,v=f.width,m=f.height,g=f.xoffset,y=f.yoffset,_=f.xadvance;p/=i,v/=i,m/=i,g/=i,y/=i,_/=i;var x=new Zt((d/=i)+o[c].frame.x/i,p+o[c].frame.y/i,v,m);this.chars[u]={xOffset:g,yOffset:y,xAdvance:_,kerning:{},texture:new cn(o[c].baseTexture,x),page:c}}for(var a in t.kerning){var b=t.kerning[a],w=b.first,T=b.second,E=b.amount;w/=i,T/=i,E/=i,this.chars[T]&&(this.chars[T].kerning[w]=E)}}var Sh,Oh,Mh,Ph=[],Ch=[];gh(Oh=Nh,Mh=Sh=De),Oh.prototype=null===Mh?Object.create(Mh):(Ih.prototype=Mh.prototype,new Ih),Nh.prototype.updateText=function(){for(var t,e=Eh.available[this._fontName],r=this._fontSize/e.size,n=new oe,i=[],o=[],a=this._text.replace(/(?:\r\n|\r)/g,"\n")||" ",s=a.length,u=this._maxWidth*e.size/this._fontSize,h=null,l=0,c=0,f=0,d=-1,p=0,v=0,m=0,g=0;g<s;g++){var y,_,x=a.charCodeAt(g),b=a.charAt(g);/(?:\s)/.test(b)&&(d=g,p=l),"\r"!==b&&"\n"!==b?(y=e.chars[x])&&(h&&y.kerning[h]&&(n.x+=y.kerning[h]),(_=Ch.pop()||{texture:cn.EMPTY,line:0,charCode:0,position:new oe}).texture=y.texture,_.line=f,_.charCode=x,_.position.x=n.x+y.xOffset+this._letterSpacing/2,_.position.y=n.y+y.yOffset,i.push(_),n.x+=y.xAdvance+this._letterSpacing,l=n.x,m=Math.max(m,y.yOffset+y.texture.height),h=x,-1!==d&&0<u&&n.x>u&&(It(i,1+d-++v,1+g-d),g=d,d=-1,o.push(p),c=Math.max(c,p),f++,n.x=0,n.y+=e.lineHeight,h=null)):(o.push(l),c=Math.max(c,l),++f,++v,n.x=0,n.y+=e.lineHeight,h=null)}var w=a.charAt(a.length-1);"\r"!==w&&"\n"!==w&&(/(?:\s)/.test(w)&&(l=p),o.push(l),c=Math.max(c,l));for(var T=[],g=0;g<=f;g++){var E=0;"right"===this._align?E=c-o[g]:"center"===this._align&&(E=(c-o[g])/2),T.push(E)}for(var A=i.length,S={},O=[],M=this._activePagesMeshData,g=0;g<M.length;g++)Ph.push(M[g]);for(g=0;g<A;g++){var P,C,I=(D=i[g].texture).baseTexture.uid;S[I]||((j=Ph.pop())||(P=new vh,C=new fh(cn.EMPTY),j={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:new hh(P,C),vertices:null,uvs:null,indices:null}),j.index=0,j.indexCount=0,j.vertexCount=0,j.uvsCount=0,j.total=0,j.mesh.texture=new cn(D.baseTexture),j.mesh.tint=this._tint,O.push(j),S[I]=j),S[I].total++}for(g=0;g<M.length;g++)-1===O.indexOf(M[g])&&this.removeChild(M[g].mesh);for(g=0;g<O.length;g++)O[g].mesh.parent!==this&&this.addChild(O[g].mesh);for(var g in this._activePagesMeshData=O,S){var N=(j=S[g]).total;(null===(t=j.indices)||void 0===t?void 0:t.length)>6*N&&!(j.vertices.length<2*hh.BATCHABLE_SIZE)||(j.vertices=new Float32Array(8*N),j.uvs=new Float32Array(8*N),j.indices=new Uint16Array(6*N)),j.mesh.size=6*N}for(g=0;g<A;g++){var D,R=((b=i[g]).position.x+T[b.line])*r,F=b.position.y*r,L=S[(D=b.texture).baseTexture.uid],k=D.frame,B=D._uvs,U=L.index++;L.indices[6*U+0]=0+4*U,L.indices[6*U+1]=1+4*U,L.indices[6*U+2]=2+4*U,L.indices[6*U+3]=0+4*U,L.indices[6*U+4]=2+4*U,L.indices[6*U+5]=3+4*U,L.vertices[8*U+0]=R,L.vertices[8*U+1]=F,L.vertices[8*U+2]=R+k.width*r,L.vertices[8*U+3]=F,L.vertices[8*U+4]=R+k.width*r,L.vertices[8*U+5]=F+k.height*r,L.vertices[8*U+6]=R,L.vertices[8*U+7]=F+k.height*r,L.uvs[8*U+0]=B.x0,L.uvs[8*U+1]=B.y0,L.uvs[8*U+2]=B.x1,L.uvs[8*U+3]=B.y1,L.uvs[8*U+4]=B.x2,L.uvs[8*U+5]=B.y2,L.uvs[8*U+6]=B.x3,L.uvs[8*U+7]=B.y3}for(var g in this._textWidth=c*r,this._textHeight=(n.y+e.lineHeight)*r,S){var j=S[g];if(0!==this.anchor.x||0!==this.anchor.y)for(var z=0,H=this._textWidth*this.anchor.x,G=this._textHeight*this.anchor.y,X=0;X<j.total;X++)j.vertices[z++]-=H,j.vertices[z++]-=G,j.vertices[z++]-=H,j.vertices[z++]-=G,j.vertices[z++]-=H,j.vertices[z++]-=G,j.vertices[z++]-=H,j.vertices[z++]-=G;this._maxLineHeight=m*r;var V=j.mesh.geometry.getBuffer("aVertexPosition"),Y=j.mesh.geometry.getBuffer("aTextureCoord"),W=j.mesh.geometry.getIndex();V.data=j.vertices,Y.data=j.uvs,W.data=j.indices,V.update(),Y.update(),W.update()}for(g=0;g<i.length;g++)Ch.push(i[g])},Nh.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},Nh.prototype.getLocalBounds=function(){return this.validate(),Sh.prototype.getLocalBounds.call(this)},Nh.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},Object.defineProperty(Nh.prototype,"tint",{get:function(){return this._tint},set:function(t){if(this._tint!==t){this._tint=t;for(var e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}},enumerable:!1,configurable:!0}),Object.defineProperty(Nh.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(Nh.prototype,"fontName",{get:function(){return this._fontName},set:function(t){if(!Eh.available[t])throw new Error('Missing BitmapFont "'+t+'"');this._fontName!==t&&(this._fontName=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(Nh.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(Nh.prototype,"anchor",{get:function(){return this._anchor},set:function(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(Nh.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(Nh.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(Nh.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(Nh.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(Nh.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(Nh.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),Nh.prototype._upgradeStyle=function(t){var e;"string"==typeof t.font?(e=t.font.split(" "),t.fontName=1===e.length?e[0]:e.slice(1).join(" "),2<=e.length&&(t.fontSize=parseInt(e[0],10))):(t.fontName=t.font.name,t.fontSize="number"==typeof t.font.size?t.font.size:parseInt(t.font.size,10))},Nh.registerFont=function(t,e){return Lt("5.3.0","PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install"),Eh.install(t,e)},Object.defineProperty(Nh,"fonts",{get:function(){return Lt("5.3.0","PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available"),Eh.available},enumerable:!1,configurable:!0}),Nh.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};function Ih(){this.constructor=Oh}function Nh(t,e){void 0===e&&(e={});var r=Sh.call(this)||this;r._tint=16777215,e.font&&(Lt("5.3.0","PIXI.BitmapText constructor style.font property is deprecated."),r._upgradeStyle(e));var n=Object.assign({},Nh.styleDefaults,e),i=n.align,o=n.tint,a=n.maxWidth,s=n.letterSpacing,u=n.fontName,h=n.fontSize;if(!Eh.available[u])throw new Error('Missing BitmapFont "'+u+'"');return r._activePagesMeshData=[],r._textWidth=0,r._textHeight=0,r._align=i,r._tint=o,r._fontName=u,r._fontSize=h||Eh.available[u].size,r._text=t,r._maxWidth=a,r._maxLineHeight=0,r._letterSpacing=s,r._anchor=new se(function(){r.dirty=!0},r,0,0),r.roundPixels=ct.ROUND_PIXELS,r.dirty=!0,r}var Dh=(Rh.add=function(){Ca.setExtensionXhrType("fnt",Ca.XHR_RESPONSE_TYPE.DOCUMENT)},Rh.use=function(e,r){var t=wh(e.data);if(t)for(var n=Rh.getBaseUrl(this,e),i=t.parse(e.data),o={},a=function(t){o[t.metadata.pageFile]=t.texture,Object.keys(o).length===i.page.length&&(e.bitmapFont=Eh.install(i,o),r())},s=0;s<i.page.length;++s){var u,h=i.page[s].file,l=n+h,c=!1;for(var f in this.resources){var d=this.resources[f];if(d.url===l){d.metadata.pageFile=h,d.texture?a(d):d.onAfterMiddleware.add(a),c=!0;break}}c||(u={crossOrigin:e.crossOrigin,loadType:Ca.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:h},e.metadata.imageMetadata),parentResource:e},this.add(l,u,a))}else r()},Rh.getBaseUrl=function(t,e){var r=e.isDataUrl?"":Rh.dirname(e.url);return e.isDataUrl&&("."===r&&(r=""),t.baseUrl&&r&&"/"===t.baseUrl.charAt(t.baseUrl.length-1)&&(r+="/")),(r=r.replace(t.baseUrl,""))&&"/"!==r.charAt(r.length-1)&&(r+="/"),r},Rh.dirname=function(t){var e=t.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return e===t?".":""===e?"/":e},Rh);function Rh(){}var Fh=function(t,e){return(Fh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Lh,kh,Bh;Fh(kh=jh,Bh=Lh=ji),kh.prototype=null===Bh?Object.create(Bh):(Uh.prototype=Bh.prototype,new Uh),Object.defineProperty(jh.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0});function Uh(){this.constructor=kh}function jh(t){void 0===t&&(t=1);var e=Lh.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n",{uAlpha:1})||this;return e.alpha=t,e}var zh=function(t,e){return(zh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function Hh(t,e){function r(){this.constructor=t}zh(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var Gh="\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }";var Xh,Vh,Yh,Wh,qh,Zh,Kh,$h,Jh,Qh,tl,el,rl,nl,il,ol,al,sl,ul={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},hl=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join("\n");(Xh={})[Xh.WEBGL_LEGACY=0]="WEBGL_LEGACY",Xh[Xh.WEBGL=1]="WEBGL",Xh[Xh.WEBGL2=2]="WEBGL2",(Vh={})[Vh.UNKNOWN=0]="UNKNOWN",Vh[Vh.WEBGL=1]="WEBGL",Vh[Vh.CANVAS=2]="CANVAS",(Yh={})[Yh.COLOR=16384]="COLOR",Yh[Yh.DEPTH=256]="DEPTH",Yh[Yh.STENCIL=1024]="STENCIL",(Wh={})[Wh.NORMAL=0]="NORMAL",Wh[Wh.ADD=1]="ADD",Wh[Wh.MULTIPLY=2]="MULTIPLY",Wh[Wh.SCREEN=3]="SCREEN",Wh[Wh.OVERLAY=4]="OVERLAY",Wh[Wh.DARKEN=5]="DARKEN",Wh[Wh.LIGHTEN=6]="LIGHTEN",Wh[Wh.COLOR_DODGE=7]="COLOR_DODGE",Wh[Wh.COLOR_BURN=8]="COLOR_BURN",Wh[Wh.HARD_LIGHT=9]="HARD_LIGHT",Wh[Wh.SOFT_LIGHT=10]="SOFT_LIGHT",Wh[Wh.DIFFERENCE=11]="DIFFERENCE",Wh[Wh.EXCLUSION=12]="EXCLUSION",Wh[Wh.HUE=13]="HUE",Wh[Wh.SATURATION=14]="SATURATION",Wh[Wh.COLOR=15]="COLOR",Wh[Wh.LUMINOSITY=16]="LUMINOSITY",Wh[Wh.NORMAL_NPM=17]="NORMAL_NPM",Wh[Wh.ADD_NPM=18]="ADD_NPM",Wh[Wh.SCREEN_NPM=19]="SCREEN_NPM",Wh[Wh.NONE=20]="NONE",Wh[Wh.SRC_OVER=0]="SRC_OVER",Wh[Wh.SRC_IN=21]="SRC_IN",Wh[Wh.SRC_OUT=22]="SRC_OUT",Wh[Wh.SRC_ATOP=23]="SRC_ATOP",Wh[Wh.DST_OVER=24]="DST_OVER",Wh[Wh.DST_IN=25]="DST_IN",Wh[Wh.DST_OUT=26]="DST_OUT",Wh[Wh.DST_ATOP=27]="DST_ATOP",Wh[Wh.ERASE=26]="ERASE",Wh[Wh.SUBTRACT=28]="SUBTRACT",Wh[Wh.XOR=29]="XOR",(qh={})[qh.POINTS=0]="POINTS",qh[qh.LINES=1]="LINES",qh[qh.LINE_LOOP=2]="LINE_LOOP",qh[qh.LINE_STRIP=3]="LINE_STRIP",qh[qh.TRIANGLES=4]="TRIANGLES",qh[qh.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",qh[qh.TRIANGLE_FAN=6]="TRIANGLE_FAN",(Zh={})[Zh.RGBA=6408]="RGBA",Zh[Zh.RGB=6407]="RGB",Zh[Zh.ALPHA=6406]="ALPHA",Zh[Zh.LUMINANCE=6409]="LUMINANCE",Zh[Zh.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",Zh[Zh.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",Zh[Zh.DEPTH_STENCIL=34041]="DEPTH_STENCIL",(Kh={})[Kh.TEXTURE_2D=3553]="TEXTURE_2D",Kh[Kh.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",Kh[Kh.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",Kh[Kh.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",Kh[Kh.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",Kh[Kh.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",Kh[Kh.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",Kh[Kh.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",Kh[Kh.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",($h={})[$h.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",$h[$h.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",$h[$h.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",$h[$h.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",$h[$h.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",$h[$h.FLOAT=5126]="FLOAT",$h[$h.HALF_FLOAT=36193]="HALF_FLOAT",(Jh={})[Jh.NEAREST=0]="NEAREST",Jh[Jh.LINEAR=1]="LINEAR",(Qh={})[Qh.CLAMP=33071]="CLAMP",Qh[Qh.REPEAT=10497]="REPEAT",Qh[Qh.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",(tl={})[tl.OFF=0]="OFF",tl[tl.POW2=1]="POW2",tl[tl.ON=2]="ON",(el={})[el.NPM=0]="NPM",el[el.UNPACK=1]="UNPACK",el[el.PMA=2]="PMA",el[el.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",el[el.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",el[el.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",(nl=rl=rl||{})[nl.NO=0]="NO",nl[nl.YES=1]="YES",nl[nl.AUTO=2]="AUTO",nl[nl.BLEND=0]="BLEND",nl[nl.CLEAR=1]="CLEAR",nl[nl.BLIT=2]="BLIT",(il={})[il.AUTO=0]="AUTO",il[il.MANUAL=1]="MANUAL",(ol={}).LOW="lowp",ol.MEDIUM="mediump",ol.HIGH="highp",(al={})[al.NONE=0]="NONE",al[al.SCISSOR=1]="SCISSOR",al[al.STENCIL=2]="STENCIL",al[al.SPRITE=3]="SPRITE",(sl={})[sl.NONE=0]="NONE",sl[sl.LOW=2]="LOW",sl[sl.MEDIUM=4]="MEDIUM",sl[sl.HIGH=8]="HIGH";var ll,cl=(Hh(fl,ll=ji),fl.prototype.apply=function(t,e,r,n){if(r?this.horizontal?this.uniforms.strength=1/r.width*(r.width/e.width):this.uniforms.strength=1/r.height*(r.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,r,n);else{var i=t.getFilterTexture(),o=t.renderer,a=e,s=i;this.state.blend=!1,t.applyFilter(this,a,s,rl.CLEAR);for(var u=1;u<this.passes-1;u++){t.bindAndClear(a,rl.BLIT);var h=this.uniforms.uSampler=s,s=a,a=h;o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,s,r,n),t.returnFilterTexture(i)}},Object.defineProperty(fl.prototype,"blur",{get:function(){return this.strength},set:function(t){this.padding=1+2*Math.abs(t),this.strength=t},enumerable:!1,configurable:!0}),Object.defineProperty(fl.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=t,this.passes=t},enumerable:!1,configurable:!0}),fl);function fl(t,e,r,n,i){void 0===e&&(e=8),void 0===r&&(r=4),void 0===n&&(n=ct.RESOLUTION),void 0===i&&(i=5);var o=this,a=function(t,e){for(var r=Math.ceil(t/2),n=Gh,i="",o=e?"vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);",a=0;a<t;a++){i+=o.replace("%index%",a.toString()).replace("%sampleIndex%",a-(r-1)+".0"),i+="\n"}return n=(n=n.replace("%blur%",i)).replace("%size%",t.toString())}(i,t),s=function(t){for(var e=ul[t],r=e.length,n=hl,i="",o=0;o<t;o++){var a="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%",o.toString()),s=r<=o?t-o-1:o;i+=a=a.replace("%value%",e[s].toString()),i+="\n"}return n=(n=n.replace("%blur%",i)).replace("%size%",t.toString())}(i);return(o=ll.call(this,a,s)||this).horizontal=t,o.resolution=n,o._quality=0,o.quality=r,o.blur=e,o}var dl;Hh(pl,dl=ji),pl.prototype.apply=function(t,e,r,n){var i,o=Math.abs(this.blurXFilter.strength),a=Math.abs(this.blurYFilter.strength);o&&a?(i=t.getFilterTexture(),this.blurXFilter.apply(t,e,i,rl.CLEAR),this.blurYFilter.apply(t,i,r,n),t.returnFilterTexture(i)):a?this.blurYFilter.apply(t,e,r,n):this.blurXFilter.apply(t,e,r,n)},pl.prototype.updatePadding=function(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))},Object.defineProperty(pl.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(pl.prototype,"quality",{get:function(){return this.blurXFilter.quality},set:function(t){this.blurXFilter.quality=this.blurYFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(pl.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(pl.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(pl.prototype,"blendMode",{get:function(){return this.blurYFilter.blendMode},set:function(t){this.blurYFilter.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(pl.prototype,"repeatEdgePixels",{get:function(){return this._repeatEdgePixels},set:function(t){this._repeatEdgePixels=t,this.updatePadding()},enumerable:!1,configurable:!0});function pl(t,e,r,n){void 0===t&&(t=8),void 0===e&&(e=4),void 0===r&&(r=ct.RESOLUTION),void 0===n&&(n=5);var i=dl.call(this)||this;return i.blurXFilter=new cl(!0,t,e,r,n),i.blurYFilter=new cl(!1,t,e,r,n),i.resolution=r,i.quality=e,i.blur=t,i.repeatEdgePixels=!1,i}var vl=function(t,e){return(vl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var ml,gl,yl,_l=(vl(gl=bl,yl=ml=ji),gl.prototype=null===yl?Object.create(yl):(xl.prototype=yl.prototype,new xl),bl.prototype._loadMatrix=function(t,e){void 0===e&&(e=!1);var r=t;e&&(this._multiply(r,this.uniforms.m,t),r=this._colorMatrix(r)),this.uniforms.m=r},bl.prototype._multiply=function(t,e,r){return t[0]=e[0]*r[0]+e[1]*r[5]+e[2]*r[10]+e[3]*r[15],t[1]=e[0]*r[1]+e[1]*r[6]+e[2]*r[11]+e[3]*r[16],t[2]=e[0]*r[2]+e[1]*r[7]+e[2]*r[12]+e[3]*r[17],t[3]=e[0]*r[3]+e[1]*r[8]+e[2]*r[13]+e[3]*r[18],t[4]=e[0]*r[4]+e[1]*r[9]+e[2]*r[14]+e[3]*r[19]+e[4],t[5]=e[5]*r[0]+e[6]*r[5]+e[7]*r[10]+e[8]*r[15],t[6]=e[5]*r[1]+e[6]*r[6]+e[7]*r[11]+e[8]*r[16],t[7]=e[5]*r[2]+e[6]*r[7]+e[7]*r[12]+e[8]*r[17],t[8]=e[5]*r[3]+e[6]*r[8]+e[7]*r[13]+e[8]*r[18],t[9]=e[5]*r[4]+e[6]*r[9]+e[7]*r[14]+e[8]*r[19]+e[9],t[10]=e[10]*r[0]+e[11]*r[5]+e[12]*r[10]+e[13]*r[15],t[11]=e[10]*r[1]+e[11]*r[6]+e[12]*r[11]+e[13]*r[16],t[12]=e[10]*r[2]+e[11]*r[7]+e[12]*r[12]+e[13]*r[17],t[13]=e[10]*r[3]+e[11]*r[8]+e[12]*r[13]+e[13]*r[18],t[14]=e[10]*r[4]+e[11]*r[9]+e[12]*r[14]+e[13]*r[19]+e[14],t[15]=e[15]*r[0]+e[16]*r[5]+e[17]*r[10]+e[18]*r[15],t[16]=e[15]*r[1]+e[16]*r[6]+e[17]*r[11]+e[18]*r[16],t[17]=e[15]*r[2]+e[16]*r[7]+e[17]*r[12]+e[18]*r[17],t[18]=e[15]*r[3]+e[16]*r[8]+e[17]*r[13]+e[18]*r[18],t[19]=e[15]*r[4]+e[16]*r[9]+e[17]*r[14]+e[18]*r[19]+e[19],t},bl.prototype._colorMatrix=function(t){var e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e},bl.prototype.brightness=function(t,e){var r=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},bl.prototype.greyscale=function(t,e){var r=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},bl.prototype.blackAndWhite=function(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)},bl.prototype.hue=function(t,e){t=(t||0)/180*Math.PI;var r=Math.cos(t),n=Math.sin(t),i=(0,Math.sqrt)(1/3),o=[r+1/3*(1-r),1/3*(1-r)-i*n,1/3*(1-r)+i*n,0,0,1/3*(1-r)+i*n,r+1/3*(1-r),1/3*(1-r)-i*n,0,0,1/3*(1-r)-i*n,1/3*(1-r)+i*n,r+1/3*(1-r),0,0,0,0,0,1,0];this._loadMatrix(o,e)},bl.prototype.contrast=function(t,e){var r=(t||0)+1,n=-.5*(r-1),i=[r,0,0,0,n,0,r,0,0,n,0,0,r,0,n,0,0,0,1,0];this._loadMatrix(i,e)},bl.prototype.saturate=function(t,e){void 0===t&&(t=0);var r=2*t/3+1,n=-.5*(r-1),i=[r,n,n,0,0,n,r,n,0,0,n,n,r,0,0,0,0,0,1,0];this._loadMatrix(i,e)},bl.prototype.desaturate=function(){this.saturate(-1)},bl.prototype.negative=function(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)},bl.prototype.sepia=function(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)},bl.prototype.technicolor=function(t){this._loadMatrix([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],t)},bl.prototype.polaroid=function(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)},bl.prototype.toBGR=function(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)},bl.prototype.kodachrome=function(t){this._loadMatrix([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],t)},bl.prototype.browni=function(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)},bl.prototype.vintage=function(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)},bl.prototype.colorTone=function(t,e,r,n,i){var o=((r=r||16770432)>>16&255)/255,a=(r>>8&255)/255,s=(255&r)/255,u=((n=n||3375104)>>16&255)/255,h=(n>>8&255)/255,l=(255&n)/255,c=[.3,.59,.11,0,0,o,a,s,t=t||.2,0,u,h,l,e=e||.15,0,o-u,a-h,s-l,0,0];this._loadMatrix(c,i)},bl.prototype.night=function(t,e){var r=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},bl.prototype.predator=function(t,e){var r=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(r,e)},bl.prototype.lsd=function(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)},bl.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(bl.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(t){this.uniforms.m=t},enumerable:!1,configurable:!0}),Object.defineProperty(bl.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),bl);function xl(){this.constructor=gl}function bl(){var t=this,e={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(t=ml.call(this,Bo,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",e)||this).alpha=1,t}_l.prototype.grayscale=_l.prototype.greyscale;var wl=function(t,e){return(wl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Tl,El,Al;wl(El=Ol,Al=Tl=ji),El.prototype=null===Al?Object.create(Al):(Sl.prototype=Al.prototype,new Sl),Ol.prototype.apply=function(t,e,r,n){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var i=this.maskSprite.worldTransform,o=Math.sqrt(i.a*i.a+i.b*i.b),a=Math.sqrt(i.c*i.c+i.d*i.d);0!==o&&0!==a&&(this.uniforms.rotation[0]=i.a/o,this.uniforms.rotation[1]=i.b/o,this.uniforms.rotation[2]=i.c/a,this.uniforms.rotation[3]=i.d/a),t.applyFilter(this,e,r,n)},Object.defineProperty(Ol.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(t){this.uniforms.mapSampler=t},enumerable:!1,configurable:!0});function Sl(){this.constructor=El}function Ol(t,e){var r=this,n=new he;return t.renderable=!1,(r=Tl.call(this,"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:t._texture,filterMatrix:n,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this).maskSprite=t,r.maskMatrix=n,null==e&&(e=20),r.scale=new oe(e,e),r}var Ml=function(t,e){return(Ml=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Pl,Cl,Il;Ml(Cl=Dl,Il=Pl=ji),Cl.prototype=null===Il?Object.create(Il):(Nl.prototype=Il.prototype,new Nl);function Nl(){this.constructor=Cl}function Dl(){return Pl.call(this,"\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputPixel;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputPixel;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')||this}var Rl=function(t,e){return(Rl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Fl,Ll,kl;Rl(Ll=Ul,kl=Fl=ji),Ll.prototype=null===kl?Object.create(kl):(Bl.prototype=kl.prototype,new Bl),Object.defineProperty(Ul.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(t){this.uniforms.uNoise=t},enumerable:!1,configurable:!0}),Object.defineProperty(Ul.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(t){this.uniforms.uSeed=t},enumerable:!1,configurable:!0});function Bl(){this.constructor=Ll}function Ul(t,e){void 0===t&&(t=.5),void 0===e&&(e=Math.random());var r=Fl.call(this,Bo,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0})||this;return r.noise=t,r.seed=e,r}var jl=new he;Se.prototype._cacheAsBitmap=!1,Se.prototype._cacheData=null;var zl=function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null};Object.defineProperties(Se.prototype,{cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var e;this._cacheAsBitmap!==t&&((this._cacheAsBitmap=t)?(this._cacheData||(this._cacheData=new zl),(e=this._cacheData).originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((e=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea))}}}),Se.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},Se.prototype._initCachedDisplayObject=function(t){var e,r,n,i,o,a,s,u,h,l;this._cacheData&&this._cacheData.sprite||(e=this.alpha,this.alpha=1,t.batch.flush(),r=this.getLocalBounds(null,!0).clone(),this.filters&&(n=this.filters[0].padding,r.pad(n)),r.ceil(ct.RESOLUTION),i=t.renderTexture.current,o=t.renderTexture.sourceFrame.clone(),a=t.projection.transform,s=vn.create({width:r.width,height:r.height}),u="cacheAsBitmap_"+Rt(),this._cacheData.textureCacheId=u,br.addToCache(s.baseTexture,u),cn.addToCache(s,u),(h=jl).tx=-r.x,h.ty=-r.y,this.transform.worldTransform.identity(),this.render=this._cacheData.originalRender,t.render(this,s,!0,h,!0),t.projection.transform=a,t.renderTexture.bind(i,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,(l=new $s(s)).transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(r.x/r.width),l.anchor.y=-(r.y/r.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=l.containsPoint.bind(l))},Se.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},Se.prototype._initCachedDisplayObjectCanvas=function(t){var e,r,n,i,o,a,s,u;this._cacheData&&this._cacheData.sprite||(e=this.getLocalBounds(null,!0),r=this.alpha,this.alpha=1,n=t.context,i=t._projTransform,e.ceil(ct.RESOLUTION),o=vn.create({width:e.width,height:e.height}),a="cacheAsBitmap_"+Rt(),this._cacheData.textureCacheId=a,br.addToCache(o.baseTexture,a),cn.addToCache(o,a),s=jl,this.transform.localTransform.copyTo(s),s.invert(),s.tx-=e.x,s.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,o,!0,s,!1),t.context=n,t._projTransform=i,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,(u=new $s(o)).transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=r,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u))},Se.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Se.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Se.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,br.removeFromCache(this._cacheData.textureCacheId),cn.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Se.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},Se.prototype.name=null,De.prototype.getChildByName=function(t,e){for(var r=0,n=this.children.length;r<n;r++)if(this.children[r].name===t)return this.children[r];if(e)for(r=0,n=this.children.length;r<n;r++){if(this.children[r].getChildByName){var i=this.children[r].getChildByName(t,!0);if(i)return i}}return null},Se.prototype.getGlobalPosition=function(t,e){return void 0===t&&(t=new oe),void 0===e&&(e=!1),this.parent?this.parent.toGlobal(this.position,t,e):(t.x=this.position.x,t.y=this.position.y),t};var Hl=function(t,e){return(Hl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function Gl(t,e){function r(){this.constructor=t}Hl(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var Xl,Vl=(Gl(Yl,Xl=vh),Yl.prototype.build=function(){for(var t=this.segWidth*this.segHeight,e=[],r=[],n=[],i=this.segWidth-1,o=this.segHeight-1,a=this.width/i,s=this.height/o,u=0;u<t;u++){var h=u%this.segWidth,l=u/this.segWidth|0;e.push(h*a,l*s),r.push(h/i,l/o)}for(var c=i*o,u=0;u<c;u++){var f=u%i,d=u/i|0,p=d*this.segWidth+f,v=d*this.segWidth+f+1,m=(1+d)*this.segWidth+f,g=(1+d)*this.segWidth+f+1;n.push(p,v,m,v,g,m)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(r),this.indexBuffer.data=new Uint16Array(n),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},Yl);function Yl(t,e,r,n){void 0===t&&(t=100),void 0===e&&(e=100),void 0===r&&(r=10),void 0===n&&(n=10);var i=Xl.call(this)||this;return i.segWidth=r,i.segHeight=n,i.width=t,i.height=e,i.build(),i}var Wl,ql=(Gl(Zl,Wl=vh),Object.defineProperty(Zl.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Zl.prototype.build=function(){var t=this.points;if(t){var e=this.getBuffer("aVertexPosition"),r=this.getBuffer("aTextureCoord"),n=this.getIndex();if(!(t.length<1)){e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),r.data=new Float32Array(4*t.length),n.data=new Uint16Array(6*(t.length-1)));var i=r.data,o=n.data;i[0]=0,i[1]=0,i[2]=0,i[3]=1;for(var a=0,s=t[0],u=this._width*this.textureScale,h=t.length,l=0;l<h;l++){var c,f,d,p=4*l;0<this.textureScale?(c=s.x-t[l].x,f=s.y-t[l].y,d=Math.sqrt(c*c+f*f),s=t[l],a+=d/u):a=l/(h-1),i[p]=a,i[p+1]=0,i[p+2]=a,i[p+3]=1}for(var v=0,l=0;l<h-1;l++)p=2*l,o[v++]=p,o[v++]=p+1,o[v++]=p+2,o[v++]=p+2,o[v++]=p+1,o[v++]=p+3;r.update(),n.update(),this.updateVertices()}}},Zl.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var e=t[0],r=this.buffers[0].data,n=t.length,i=0;i<n;i++){var o,a=t[i],s=4*i,u=-((o=i<t.length-1?t[i+1]:a).x-e.x),h=o.y-e.y,l=Math.sqrt(h*h+u*u),c=0<this.textureScale?this.textureScale*this._width/2:this._width/2;h/=l,u/=l,h*=c,u*=c,r[s]=a.x+h,r[1+s]=a.y+u,r[2+s]=a.x-h,r[3+s]=a.y-u,e=a}this.buffers[0].update()}},Zl.prototype.update=function(){0<this.textureScale?this.build():this.updateVertices()},Zl);function Zl(t,e,r){void 0===t&&(t=200),void 0===r&&(r=0);var n=Wl.call(this,new Float32Array(4*e.length),new Float32Array(4*e.length),new Uint16Array(6*(e.length-1)))||this;return n.points=e,n._width=t,n.textureScale=r,n.build(),n}var Kl;Gl($l,Kl=hh),$l.prototype._render=function(t){var e=this.geometry;!this.autoUpdate&&e._width===this.shader.texture.height||(e._width=this.shader.texture.height,e.update()),Kl.prototype._render.call(this,t)};function $l(t,e,r){void 0===r&&(r=0);var n=this,i=new ql(t.height,e,r),o=new fh(t);return 0<r&&(t.baseTexture.wrapMode=Z.REPEAT),(n=Kl.call(this,i,o)||this).autoUpdate=!0,n}var Jl,Ql=(Gl(tc,Jl=hh),tc.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry;t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build()},Object.defineProperty(tc.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),tc.prototype._render=function(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),Jl.prototype._render.call(this,t)},tc);function tc(t,e,r){var n=this,i=new Vl(t.width,t.height,e,r),o=new fh(cn.WHITE);return(n=Jl.call(this,i,o)||this).texture=t,n}var ec;Gl(rc,ec=hh),Object.defineProperty(rc.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),rc.prototype._render=function(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),ec.prototype._render.call(this,t)};function rc(t,e,r,n,i){void 0===t&&(t=cn.EMPTY);var o=this,a=new vh(e,r,n);a.getBuffer("aVertexPosition").static=!1;var s=new fh(t);return(o=ec.call(this,a,s,null,i)||this).autoUpdate=!0,o}var nc;Gl(ic,nc=Ql),ic.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(ic.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),ic.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height},ic.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width},ic.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,r=this._topHeight+this._bottomHeight,n=this._height>r?1:this._height/r;return Math.min(e,n)},Object.defineProperty(ic.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(ic.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(ic.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(ic.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(ic.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(ic.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),ic.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var r=1/this._origWidth,n=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[9]=e[11]=e[13]=e[15]=n*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-n*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()};function ic(t,e,r,n,i){void 0===e&&(e=10),void 0===r&&(r=10),void 0===n&&(n=10),void 0===i&&(i=10);var o=nc.call(this,cn.WHITE,4,4)||this;return o._origWidth=t.orig.width,o._origHeight=t.orig.height,o._width=o._origWidth,o._height=o._origHeight,o._leftWidth=e,o._rightWidth=n,o._topHeight=r,o._bottomHeight=i,o.texture=t,o}var oc=function(t,e){return(oc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var ac,sc,uc;oc(sc=lc,uc=ac=$s),sc.prototype=null===uc?Object.create(uc):(hc.prototype=uc.prototype,new hc),lc.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ze.shared.remove(this.update,this),this._isConnectedToTicker=!1))},lc.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ze.shared.add(this.update,this,Fe.HIGH),this._isConnectedToTicker=!0))},lc.prototype.gotoAndStop=function(t){this.stop();var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()},lc.prototype.gotoAndPlay=function(t){var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture(),this.play()},lc.prototype.update=function(t){var e=this.animationSpeed*t,r=this.currentFrame;if(null!==this._durations){var n=this._currentTime%1*this._durations[this.currentFrame];for(n+=e/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];var i=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*i,this._currentTime+=i;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(0<this.animationSpeed&&this.currentFrame<r||this.animationSpeed<0&&this.currentFrame>r)&&this.onLoop(),this.updateTexture())},lc.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},lc.prototype.destroy=function(t){this.stop(),ac.prototype.destroy.call(this,t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},lc.fromFrames=function(t){for(var e=[],r=0;r<t.length;++r)e.push(cn.from(t[r]));return new lc(e)},lc.fromImages=function(t){for(var e=[],r=0;r<t.length;++r)e.push(cn.from(t[r]));return new lc(e)},Object.defineProperty(lc.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(lc.prototype,"textures",{get:function(){return this._textures},set:function(t){if(t[0]instanceof cn)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(var e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(lc.prototype,"currentFrame",{get:function(){var t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t},enumerable:!1,configurable:!0}),Object.defineProperty(lc.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(lc.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ze.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ze.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0});function hc(){this.constructor=sc}function lc(t,e){void 0===e&&(e=!0);var r=ac.call(this,t[0]instanceof cn?t[0]:t[0].texture)||this;return r._textures=null,r._durations=null,r._autoUpdate=e,r._isConnectedToTicker=!1,r.animationSpeed=1,r.loop=!0,r.updateAnchor=!1,r.onComplete=null,r.onFrameChange=null,r.onLoop=null,r._currentTime=0,r._playing=!1,r._previousFrame=null,r.textures=t,r}Lo.registerPlugin("accessibility",ke),Lo.registerPlugin("extract",sa),Lo.registerPlugin("interaction",or),Lo.registerPlugin("particle",Qa),Lo.registerPlugin("prepare",Bu),Lo.registerPlugin("batch",ea),Lo.registerPlugin("tilingSprite",th),ka.registerPlugin(Dh),ka.registerPlugin(Xu),ra.registerPlugin(Ge),ra.registerPlugin(ja);var cc=Object.freeze({Cf:{val:11,name:"Cf",main:"C",alt:"f"},C:{val:0,name:"C",main:"C",alt:""},Cs:{val:1,name:"Cs",main:"C",alt:"s"},Df:{val:1,name:"Df",main:"D",alt:"f"},D:{val:2,name:"D",main:"D",alt:""},Ds:{val:3,name:"Ds",main:"D",alt:"s"},Ef:{val:3,name:"Ef",main:"E",alt:"f"},E:{val:4,name:"E",main:"E",alt:""},Es:{val:5,name:"Es",main:"E",alt:"s"},Ff:{val:4,name:"Ff",main:"F",alt:"f"},F:{val:5,name:"F",main:"F",alt:""},Fs:{val:6,name:"Fs",main:"F",alt:"s"},Gf:{val:6,name:"Gf",main:"G",alt:"f"},G:{val:7,name:"G",main:"G",alt:""},Gs:{val:8,name:"Gs",main:"G",alt:"s"},Af:{val:8,name:"Af",main:"A",alt:"f"},A:{val:9,name:"A",main:"A",alt:""},As:{val:10,name:"As",main:"A",alt:"s"},Bf:{val:10,name:"Bf",main:"B",alt:"f"},B:{val:11,name:"B",main:"B",alt:""},Bs:{val:0,name:"Bs",main:"B",alt:"s"},Tone:{create:function(t,e){var r=Object.create(this);return r.tone=t,r.octave=e,r},str:function(){return this.tone.name+"_"+this.octave}}}),fc=[cc.C,cc.Cs,cc.D,cc.Ds,cc.E,cc.F,cc.Fs,cc.G,cc.Gs,cc.A,cc.As,cc.B],dc=[cc.C,cc.Df,cc.D,cc.Ef,cc.E,cc.F,cc.Gf,cc.G,cc.Af,cc.A,cc.Bf,cc.B];function pc(t,e){var r=this;De.call(this);function n(t,e){switch(t){case"f":return e;case"":return 2+e;case"s":return 4+e}}var i={C:0,D:1,E:2,F:3,G:4,A:5,B:6};this.passiveTex=e["assets/tones.png"].texture.clone(),this.activeTex=this.passiveTex.clone(),this.passiveTex.frame=new Zt(64*n(t.alt,!1),64*i[t.main],64,64),this.activeTex.frame=new Zt(64*n(t.alt,!0),64*i[t.main],64,64),this.toneSprite=new $s(this.passiveTex),this.toneSprite.interactive=!0,this.addChild(this.toneSprite);var o=e["assets/tokens.png"].texture.clone();this.tokens={},this.tokenSprites={};for(var a=0,s=[3,4,5];a<s.length;a++)!function(){var t=s[a];r.tokens[t]={},r.tokens[t]["+"]=o.clone(),r.tokens[t]["+"].frame=new Zt(0,64*(t-3),64,64),r.tokens[t]["-"]=o.clone(),r.tokens[t]["-"].frame=new Zt(64,64*(t-3),64,64),r.tokenSprites[t]=new $s(r.tokens[t]["+"]),r.tokenSprites[t].position.set(80,22.4+.7*(t-4)*64),r.tokenSprites[t].scale.set(.35,.35),r.tokenSprites[t].interactive=!0;var e=r.tokenSprites[t].visible=!1;r.tokenSprites[t].on("mouseover",function(){e=!0}).on("mouseout",function(){e=!1}).on("mousedown",function(){e&&r.emit("tonetriggered",t)}),r.addChild(r.tokenSprites[t])}();this.interactive=!0;function u(t){for(var e in r.tokenSprites)r.tokenSprites[e].visible=t}this.selected=!1,this.toneSpriteHovered=!1,this.toneSprite.on("mouseover",function(){r.toneSpriteHovered=!0,r.setActive(!0),u(!0)}).on("mouseout",function(){r.toneSpriteHovered=!1,r.setActive(r.selected),u(r.selected)}).on("mousedown",function(){r.selected=!r.selected,u(r.selected)}),this.pivot.set(32,32)}(pc.prototype=Object.create(De.prototype)).setActive=function(t){t?this.toneSprite.texture=this.activeTex:this.toneSpriteHovered||this.selected||(this.toneSprite.texture=this.passiveTex)},pc.prototype.setSelectedOctaves=function(t){var r=this;for(var e in this.tokenSprites)!function(e){0<=t.findIndex(function(t){return t==e})?r.tokenSprites[e].texture=r.tokens[e]["-"]:r.tokenSprites[e].texture=r.tokens[e]["+"]}(e)},pc.assets=["assets/tones.png","assets/tokens.png"];var vc=pc,mc=r(17);var gc=50175,yc=.75;function _c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function xc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bc(){xc(this,bc),this.tones=[],this.coords=[]}var wc=function(){function t(){xc(this,t),this.chords=[],this.current=-1}var e,r,n;return e=t,(r=[{key:"next",value:function(){++this.current,this.current==this.chords.length&&this.chords.push(new bc)}},{key:"getCurrent",value:function(){return this.chords[this.current]}},{key:"setCurrentChord",value:function(t,e){this.chords[this.current].tones=t,this.chords[this.current].coords=e}},{key:"appendToCurrentChord",value:function(t,e){this.chords[this.current].tones.push(t),this.chords[this.current].coords.push(e)}},{key:"removeFromCurrentChord",value:function(e){var t=this.chords[this.current].tones.findIndex(function(t){return t.tone==e.tone&&t.octave==e.octave});this.chords[this.current].tones.splice(t,1),this.chords[this.current].coords.splice(t,1)}},{key:"setCurrent",value:function(t){for(;t>=this.chords.length;)this.chords.push(new bc);this.current=t}}])&&_c(e.prototype,r),n&&_c(e,n),t}(),Tc=function t(){xc(this,t),this.tune=new wc},Ec=r(18),Ac=r.n(Ec),Sc={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function Oc(t){return(Oc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Mc(t){return"number"==typeof t}function Pc(t){return t&&!0===t.constructor.prototype.isBigNumber||!1}function Cc(t){return t&&"object"===Oc(t)&&!0===Object.getPrototypeOf(t).isComplex||!1}function Ic(t){return t&&"object"===Oc(t)&&!0===Object.getPrototypeOf(t).isFraction||!1}function Nc(t){return t&&!0===t.constructor.prototype.isUnit||!1}function Dc(t){return"string"==typeof t}var Rc=Array.isArray;function Fc(t){return t&&!0===t.constructor.prototype.isMatrix||!1}function Lc(t){return Array.isArray(t)||Fc(t)}function kc(t){return t&&t.isDenseMatrix&&!0===t.constructor.prototype.isMatrix||!1}function Bc(t){return t&&t.isSparseMatrix&&!0===t.constructor.prototype.isMatrix||!1}function Uc(t){return t&&!0===t.constructor.prototype.isRange||!1}function jc(t){return t&&!0===t.constructor.prototype.isIndex||!1}function zc(t){return"boolean"==typeof t}function Hc(t){return t&&!0===t.constructor.prototype.isResultSet||!1}function Gc(t){return t&&!0===t.constructor.prototype.isHelp||!1}function Xc(t){return"function"==typeof t}function Vc(t){return t instanceof Date}function Yc(t){return t instanceof RegExp}function Wc(t){return!(!t||"object"!==Oc(t)||t.constructor!==Object||Cc(t)||Ic(t))}function qc(t){return null===t}function Zc(t){return void 0===t}function Kc(t){return t&&!0===t.isAccessorNode&&!0===t.constructor.prototype.isNode||!1}function $c(t){return t&&!0===t.isArrayNode&&!0===t.constructor.prototype.isNode||!1}function Jc(t){return t&&!0===t.isAssignmentNode&&!0===t.constructor.prototype.isNode||!1}function Qc(t){return t&&!0===t.isBlockNode&&!0===t.constructor.prototype.isNode||!1}function tf(t){return t&&!0===t.isConditionalNode&&!0===t.constructor.prototype.isNode||!1}function ef(t){return t&&!0===t.isConstantNode&&!0===t.constructor.prototype.isNode||!1}function rf(t){return t&&!0===t.isFunctionAssignmentNode&&!0===t.constructor.prototype.isNode||!1}function nf(t){return t&&!0===t.isFunctionNode&&!0===t.constructor.prototype.isNode||!1}function of(t){return t&&!0===t.isIndexNode&&!0===t.constructor.prototype.isNode||!1}function af(t){return t&&!0===t.isNode&&!0===t.constructor.prototype.isNode||!1}function sf(t){return t&&!0===t.isObjectNode&&!0===t.constructor.prototype.isNode||!1}function uf(t){return t&&!0===t.isOperatorNode&&!0===t.constructor.prototype.isNode||!1}function hf(t){return t&&!0===t.isParenthesisNode&&!0===t.constructor.prototype.isNode||!1}function lf(t){return t&&!0===t.isRangeNode&&!0===t.constructor.prototype.isNode||!1}function cf(t){return t&&!0===t.isSymbolNode&&!0===t.constructor.prototype.isNode||!1}function ff(t){return t&&!0===t.constructor.prototype.isChain||!1}function df(t){var e=Oc(t);return"object"===e?null===t?"null":Array.isArray(t)?"Array":t instanceof Date?"Date":t instanceof RegExp?"RegExp":Pc(t)?"BigNumber":Cc(t)?"Complex":Ic(t)?"Fraction":Fc(t)?"Matrix":Nc(t)?"Unit":jc(t)?"Index":Uc(t)?"Range":Hc(t)?"ResultSet":af(t)?t.type:ff(t)?"Chain":Gc(t)?"Help":"Object":"function"===e?"Function":e}function pf(t){return(pf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function vf(t){var e=pf(t);if("number"===e||"string"===e||"boolean"===e||null==t)return t;if("function"==typeof t.clone)return t.clone();if(Array.isArray(t))return t.map(vf);if(t instanceof Date)return new Date(t.valueOf());if(Pc(t))return t;if(t instanceof RegExp)throw new TypeError("Cannot clone "+t);return mf(t,vf)}function mf(t,e){var r={};for(var n in t)_f(t,n)&&(r[n]=e(t[n]));return r}function gf(t,e){for(var r in e)_f(e,r)&&(t[r]=e[r]);return t}function yf(t,e){var r,n,i;if(Array.isArray(t)){if(!Array.isArray(e))return;if(t.length!==e.length)return;for(n=0,i=t.length;n<i;n++)if(!yf(t[n],e[n]))return;return 1}if("function"==typeof t)return t===e;if(t instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return;for(r in t)if(!(r in e&&yf(t[r],e[r])))return;for(r in e)if(!(r in t&&yf(t[r],e[r])))return;return 1}return t===e}function _f(t,e){return t&&Object.hasOwnProperty.call(t,e)}var xf=["Matrix","Array"],bf=["number","BigNumber","Fraction"];function wf(){return(wf=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function Tf(t){if(t)throw new Error("The global config is readonly. \nPlease create a mathjs instance if you want to change the default configuration. \nExample:\n\n import { create, all } from 'mathjs';\n const mathjs = create(all);\n mathjs.config({ number: 'BigNumber' });\n");return Object.freeze(Sc)}function Ef(t){return"boolean"==typeof t||!!isFinite(t)&&t===Math.round(t)}wf(Tf,Sc,{MATRIX_OPTIONS:xf,NUMBER_OPTIONS:bf});Math.sign,Math.log2,Math.log10,Math.log1p,Math.cbrt,Math.expm1;function Af(t,e){if("function"==typeof e)return e(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var r,n="auto";switch(e&&(e.notation&&(n=e.notation),Mc(e)?r=e:Mc(e.precision)&&(r=e.precision)),n){case"fixed":return Of(t,r);case"exponential":return Mf(t,r);case"engineering":return function(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=Pf(Sf(t),e),n=r.exponent,i=r.coefficients,o=n%3==0?n:n<0?n-3-n%3:n-n%3;if(Mc(e))for(;e>i.length||n-o+1>i.length;)i.push(0);else for(var a=Math.abs(n-o)-(i.length-1),s=0;s<a;s++)i.push(0);var u=Math.abs(n-o),h=1;for(;0<u;)h++,u--;var l=i.slice(h).join(""),c=Mc(e)&&l.length||l.match(/[1-9]/)?"."+l:"",f=i.slice(0,h).join("")+c+"e"+(0<=n?"+":"")+o.toString();return r.sign+f}(t,r);case"auto":return function(t,e,r){if(isNaN(t)||!isFinite(t))return String(t);var n=r&&void 0!==r.lowerExp?r.lowerExp:-3,i=r&&void 0!==r.upperExp?r.upperExp:5,o=Sf(t),a=e?Pf(o,e):o;{if(a.exponent<n||a.exponent>=i)return Mf(t,e);var s=a.coefficients,u=a.exponent;s.length<e&&(s=s.concat(Cf(e-s.length))),s=s.concat(Cf(u-s.length+1+(s.length<e?e-s.length:0))),s=Cf(-u).concat(s);var h=0<u?u:0;return h<s.length-1&&s.splice(h+1,0,"."),a.sign+s.join("")}}(t,r,e&&e).replace(/((\.\d*?)(0+))($|e)/,function(){var t=arguments[2],e=arguments[4];return"."!==t?t+e:e});default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", or "fixed".')}}function Sf(t){var e=String(t).toLowerCase().match(/^0*?(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+t);var r=e[1],n=e[2],i=parseFloat(e[4]||"0"),o=n.indexOf(".");i+=-1!==o?o-1:n.length-1;var a=n.replace(".","").replace(/^0*/,function(t){return i-=t.length,""}).replace(/0*$/,"").split("").map(function(t){return parseInt(t)});return 0===a.length&&(a.push(0),i++),{sign:r,coefficients:a,exponent:i}}function Of(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=Sf(t),n="number"==typeof e?Pf(r,r.exponent+1+e):r,i=n.coefficients,o=n.exponent+1,a=o+(e||0);return i.length<a&&(i=i.concat(Cf(a-i.length))),o<0&&(i=Cf(1-o).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),n.sign+i.join("")}function Mf(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=Sf(t),n=e?Pf(r,e):r,i=n.coefficients,o=n.exponent;i.length<e&&(i=i.concat(Cf(e-i.length)));var a=i.shift();return n.sign+a+(0<i.length?"."+i.join(""):"")+"e"+(0<=o?"+":"")+o}function Pf(t,e){for(var r={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},n=r.coefficients;e<=0;)n.unshift(0),r.exponent++,e++;if(n.length>e&&5<=n.splice(e,n.length-e)[0]){var i=e-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),n[--i]++}return r}function Cf(t){for(var e=[],r=0;r<t;r++)e.push(0);return e}var If=Number.EPSILON||2220446049250313e-31;function Nf(t,e,r){if(null==r)return t===e;if(t===e)return!0;if(isNaN(t)||isNaN(e))return!1;if(isFinite(t)&&isFinite(e)){var n=Math.abs(t-e);return n<If||n<=Math.max(Math.abs(t),Math.abs(e))*r}return!1}Math.acosh,Math.asinh,Math.atanh,Math.cosh,Math.sinh,Math.tanh;function Df(t,e){if("function"==typeof e)return e(t);if(!t.isFinite())return t.isNaN()?"NaN":t.gt(0)?"Infinity":"-Infinity";var r,n,i="auto";switch(void 0!==e&&(e.notation&&(i=e.notation),"number"==typeof e?r=e:e.precision&&(r=e.precision)),i){case"fixed":return n=r,t.toFixed(n);case"exponential":return Rf(t,r);case"engineering":return function(t,e){var r=t.e,n=r%3==0?r:r<0?r-3-r%3:r-r%3,i=t.mul(Math.pow(10,-n)),o=i.toPrecision(e);-1!==o.indexOf("e")&&(o=i.toString());return o+"e"+(0<=r?"+":"")+n.toString()}(t,r);case"auto":var o=e&&void 0!==e.lowerExp?e.lowerExp:-3,a=e&&void 0!==e.upperExp?e.upperExp:5;if(t.isZero())return"0";var s=t.toSignificantDigits(r),u=s.e;return(o<=u&&u<a?s.toFixed():Rf(t,r)).replace(/((\.\d*?)(0+))($|e)/,function(){var t=arguments[2],e=arguments[4];return"."!==t?t+e:e});default:throw new Error('Unknown notation "'+i+'". Choose "auto", "exponential", or "fixed".')}}function Rf(t,e){return void 0!==e?t.toExponential(e-1):t.toExponential()}function Ff(t){return(Ff="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Lf(e,r){return"number"==typeof e?Af(e,r):Pc(e)?Df(e,r):(t=e)&&"object"===Ff(t)&&"number"==typeof t.s&&"number"==typeof t.n&&"number"==typeof t.d?r&&"decimal"===r.fraction?e.toString():e.s*e.n+"/"+e.d:Array.isArray(e)?function t(e,r){{if(Array.isArray(e)){for(var n="[",i=e.length,o=0;o<i;o++)0!==o&&(n+=", "),n+=t(e[o],r);return n+="]"}return Lf(e,r)}}(e,r):Dc(e)?'"'+e+'"':"function"==typeof e?e.syntax?String(e.syntax):"function":e&&"object"===Ff(e)?"function"==typeof e.format?e.format(r):e&&e.toString(r)!=={}.toString()?e.toString(r):"{"+Object.keys(e).map(function(t){return'"'+t+'": '+Lf(e[t],r)}).join(", ")+"}":String(e);var t}function kf(t,e,r){if(!(this instanceof kf))throw new SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=e,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=(new Error).stack}function Bf(t,e,r){if(!(this instanceof Bf))throw new SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=r),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=(new Error).stack}function Uf(t){for(var e=[];Array.isArray(t);)e.push(t.length),t=t[0];return e}function jf(t,e){if(0===e.length){if(Array.isArray(t))throw new kf(t.length,0)}else!function t(e,r,n){var i=e.length;if(i!==r[n])throw new kf(i,r[n]);if(n<r.length-1)for(var o=n+1,a=0;a<i;a++){var s=e[a];if(!Array.isArray(s))throw new kf(r.length-1,r.length,"<");t(e[a],r,o)}else for(a=0;a<i;a++)if(Array.isArray(e[a]))throw new kf(r.length+1,r.length,">")}(t,e,0)}function zf(t,e){if(!Mc(t)||!Ef(t))throw new TypeError("Index must be an integer (value: "+t+")");if(t<0||"number"==typeof e&&e<=t)throw new Bf(t,e)}function Hf(t,e,r){if(!Array.isArray(t)||!Array.isArray(e))throw new TypeError("Array expected");if(0===e.length)throw new Error("Resizing to scalar is not supported");return e.forEach(function(t){if(!Mc(t)||!Ef(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Lf(e)+")")}),function t(e,r,n,i){var o;var a;var s=e.length;var u=r[n];var h=Math.min(s,u);e.length=u;if(n<r.length-1){var l=n+1;for(o=0;o<h;o++)a=e[o],Array.isArray(a)||(a=[a],e[o]=a),t(a,r,l,i);for(o=h;o<u;o++)a=[],e[o]=a,t(a,r,l,i)}else{for(o=0;o<h;o++)for(;Array.isArray(e[o]);)e[o]=e[o][0];for(o=h;o<u;o++)e[o]=i}}(t,e,0,void 0!==r?r:0),t}function Gf(e,r){var t,n=Vf(e);function i(t){return t.reduce(function(t,e){return t*e})}if(!Array.isArray(e)||!Array.isArray(r))throw new TypeError("Array expected");if(0===r.length)throw new kf(0,i(Uf(e)),"!=");for(var o=1,a=0;a<r.length;a++)o*=r[a];if(n.length!==o)throw new kf(i(r),i(Uf(e)),"!=");try{t=function(t,e){for(var r,n=t,i=e.length-1;0<i;i--){var o=e[i];r=[];for(var a=n.length/o,s=0;s<a;s++)r.push(n.slice(s*o,(s+1)*o));n=r}return n}(n,r)}catch(t){if(t instanceof kf)throw new kf(i(r),i(Uf(e)),"!=");throw t}return t}function Xf(t,e,r,n){var i=n||Uf(t);if(r)for(var o=0;o<r;o++)t=[t],i.unshift(1);for(t=function t(e,r,n){var i,o;if(Array.isArray(e)){var a=n+1;for(i=0,o=e.length;i<o;i++)e[i]=t(e[i],r,a)}else for(var s=n;s<r;s++)e=[e];return e}(t,e,0);i.length<e;)i.push(1);return t}function Vf(t){if(!Array.isArray(t))return t;var r=[];return t.forEach(function t(e){Array.isArray(e)?e.forEach(t):r.push(e)}),r}function Yf(t,e){for(var r,n=0,i=0;i<t.length;i++){var o=t[i],a=Array.isArray(o);if(0===i&&a&&(n=o.length),a&&o.length!==n)return;var s=a?Yf(o,e):e(o);if(void 0===r)r=s;else if(r!==s)return"mixed"}return r}function Wf(r,n,i,t){function e(t){var e=function(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n],o=t[i];void 0!==o&&(r[i]=o)}return r}(t,n.map(qf));return function(t,e,r){if(!e.filter(function(t){return!((e=t)&&"?"===e[0]);var e}).every(function(t){return void 0!==r[t]})){var n=e.filter(function(t){return void 0===r[t]});throw new Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(n.map(function(t){return'"'.concat(t,'"')}).join(", "),"."))}}(r,n,t),i(e)}return e.isFactory=!0,e.fn=r,e.dependencies=n.slice().sort(),t&&(e.meta=t),e}function qf(t){return t&&"?"===t[0]?t.slice(1):t}(kf.prototype=new RangeError).constructor=RangeError,kf.prototype.name="DimensionError",kf.prototype.isDimensionError=!0,(Bf.prototype=new RangeError).constructor=RangeError,Bf.prototype.name="IndexError";Bf.prototype.isIndexError=!0;var Zf=r(1),Kf=r.n(Zf);function $f(t){return($f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Jf=Wf("Complex",[],function(){return Kf.a.prototype.type="Complex",Kf.a.prototype.isComplex=!0,Kf.a.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Kf.a.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Kf.a.prototype.format=function(t){var e,r=this.im,n=this.re,i=Af(this.re,t),o=Af(this.im,t),a=Mc(t)?t:t?t.precision:null;return null!==a&&(e=Math.pow(10,-a),Math.abs(n/r)<e&&(n=0),Math.abs(r/n)<e&&(r=0)),0===r?i:0===n?1===r?"i":-1===r?"-i":o+"i":r<0?-1===r?i+" - i":i+" - "+o.substring(1)+"i":1===r?i+" + i":i+" + "+o+"i"},Kf.a.fromPolar=function(t){switch(arguments.length){case 1:var e=t;if("object"===$f(e))return Kf()(e);throw new TypeError("Input has to be an object with r and phi keys.");case 2:var r=t,n=arguments[1];if(Mc(r)){if(Nc(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),Mc(n))return new Kf.a({r:r,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.");default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Kf.a.prototype.valueOf=Kf.a.prototype.toString,Kf.a.fromJSON=function(t){return new Kf.a(t)},Kf.a.compare=function(t,e){return t.re>e.re?1:t.re<e.re?-1:t.im>e.im?1:t.im<e.im?-1:0},Kf.a},{isClass:!0});function Qf(t){return(Qf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function td(i,o){return function t(){"object"!==Qf(t.cache)&&(t.cache={});for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=o?o(e):JSON.stringify(e);return n in t.cache||(t.cache[n]=i.apply(i,e)),t.cache[n]}}td(function(t){return new t(1).exp()},rd),td(function(t){return new t(1).plus(new t(5).sqrt()).div(2)},rd);var ed=td(function(t){return t.acos(-1)},rd);td(function(t){return ed(t).times(2)},rd);function rd(t){return t[0].precision}var nd=Math.PI,id=(Math.PI,Math.E,od("pi",["config","?BigNumber"],function(t){var e=t.config,r=t.BigNumber;return"BigNumber"===e.number?ed(r):nd}));function od(t,e,r){return Wf(t,e,r,{recreateOnConfigChange:!0})}var ad=r(19),sd=r.n(ad),ud=Wf("BigNumber",["?on","config"],function(t){var e=t.on,r=t.config,n=sd.a.clone({precision:r.precision});return n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(t){return new n(t.value)},e&&e("config",function(t,e){t.precision!==e.precision&&n.config({precision:t.precision})}),n},{isClass:!0}),hd=Wf("Matrix",[],function(){function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator")}return t.prototype.type="Matrix",t.prototype.isMatrix=!0,t.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},t.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},t.prototype.create=function(t,e){throw new Error("Cannot invoke create on a Matrix interface")},t.prototype.subset=function(t,e,r){throw new Error("Cannot invoke subset on a Matrix interface")},t.prototype.get=function(t){throw new Error("Cannot invoke get on a Matrix interface")},t.prototype.set=function(t,e,r){throw new Error("Cannot invoke set on a Matrix interface")},t.prototype.resize=function(t,e){throw new Error("Cannot invoke resize on a Matrix interface")},t.prototype.reshape=function(t,e){throw new Error("Cannot invoke reshape on a Matrix interface")},t.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},t.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},t.prototype.map=function(t,e){throw new Error("Cannot invoke map on a Matrix interface")},t.prototype.forEach=function(t){throw new Error("Cannot invoke forEach on a Matrix interface")},t.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},t.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},t.prototype.format=function(t){throw new Error("Cannot invoke format on a Matrix interface")},t.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},t},{isClass:!0});ld("fineStructure",.0072973525693),ld("weakMixingAngle",.2229),ld("efimovFactor",22.7),ld("sackurTetrode",-1.16487052358);function ld(t,n){return Wf(t,["config","BigNumber"],function(t){var e=t.config,r=t.BigNumber;return"BigNumber"===e.number?new r(n):n})}var cd=r(3),fd=r.n(cd),dd=Wf("Fraction",[],function(){return fd.a.prototype.type="Fraction",fd.a.prototype.isFraction=!0,fd.a.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},fd.a.fromJSON=function(t){return new fd.a(t)},fd.a},{isClass:!0}),pd=Wf("DenseMatrix",["Matrix"],function(t){var e=t.Matrix;function d(t,e){if(!(this instanceof d))throw new SyntaxError("Constructor must be called with the new operator");if(e&&!Dc(e))throw new Error("Invalid datatype: "+e);if(Fc(t))"DenseMatrix"===t.type?(this._data=vf(t._data),this._size=vf(t._size)):(this._data=t.toArray(),this._size=t.size()),this._datatype=e||t._datatype;else if(t&&Rc(t.data)&&Rc(t.size))this._data=t.data,this._size=t.size,jf(this._data,this._size),this._datatype=e||t.datatype;else if(Rc(t))this._data=function t(e){for(var r=0,n=e.length;r<n;r++){var i=e[r];Rc(i)?e[r]=t(i):i&&!0===i.isMatrix&&(e[r]=t(i.valueOf()))}return e}(t),this._size=Uf(this._data),jf(this._data,this._size),this._datatype=e;else{if(t)throw new TypeError("Unsupported type of data ("+df(t)+")");this._data=[],this._size=[0],this._datatype=e}}function s(t,e,r){if(0!==e.length)return t._size=e.slice(0),t._data=Hf(t._data,t._size,r),t;for(var n=t._data;Rc(n);)n=n[0];return n}function c(t,e,r){for(var n=t._size.slice(0),i=!1;n.length<e.length;)n.push(0),i=!0;for(var o=0,a=e.length;o<a;o++)e[o]>n[o]&&(n[o]=e[o],i=!0);i&&s(t,n,r)}return(d.prototype=new e).createDenseMatrix=function(t,e){return new d(t,e)},d.prototype.type="DenseMatrix",d.prototype.isDenseMatrix=!0,d.prototype.getDataType=function(){return Yf(this._data,df)},d.prototype.storage=function(){return"dense"},d.prototype.datatype=function(){return this._datatype},d.prototype.create=function(t,e){return new d(t,e)},d.prototype.subset=function(t,e,r){switch(arguments.length){case 1:return function(t,e){if(!jc(e))throw new TypeError("Invalid index");{if(e.isScalar())return t.get(e.min());var r=e.size();if(r.length!==t._size.length)throw new kf(r.length,t._size.length);for(var n=e.min(),i=e.max(),o=0,a=t._size.length;o<a;o++)zf(n[o],t._size[o]),zf(i[o],t._size[o]);return new d(function r(n,i,o,a){var t=a===o-1;var e=i.dimension(a);return t?e.map(function(t){return zf(t,n.length),n[t]}).valueOf():e.map(function(t){zf(t,n.length);var e=n[t];return r(e,i,o,a+1)}).valueOf()}(t._data,e,r.length,0),t._datatype)}}(this,t);case 2:case 3:return function(t,e,r,n){if(!e||!0!==e.isIndex)throw new TypeError("Invalid index");var i,o=e.size(),a=e.isScalar();Fc(r)?(i=r.size(),r=r.valueOf()):i=Uf(r);if(a){if(0!==i.length)throw new TypeError("Scalar expected");t.set(e.min(),r,n)}else{if(o.length<t._size.length)throw new kf(o.length,t._size.length,"<");if(i.length<o.length){for(var s=0,u=0;1===o[s]&&1===i[s];)s++;for(;1===o[s];)u++,s++;r=Xf(r,o.length,u,i)}if(!yf(o,i))throw new kf(o,i,">");var h=e.max().map(function(t){return t+1});c(t,h,n);var l=o.length;!function r(n,i,o,a,s){var t=s===a-1;var e=i.dimension(s);t?e.forEach(function(t,e){zf(t),n[t]=o[e[0]]}):e.forEach(function(t,e){zf(t),r(n[t],i,o[e[0]],a,s+1)})}(t._data,e,r,l,0)}return t}(this,t,e,r);default:throw new SyntaxError("Wrong number of arguments")}},d.prototype.get=function(t){if(!Rc(t))throw new TypeError("Array expected");if(t.length!==this._size.length)throw new kf(t.length,this._size.length);for(var e=0;e<t.length;e++)zf(t[e],this._size[e]);for(var r=this._data,n=0,i=t.length;n<i;n++){var o=t[n];zf(o,r.length),r=r[o]}return r},d.prototype.set=function(t,e,r){if(!Rc(t))throw new TypeError("Array expected");if(t.length<this._size.length)throw new kf(t.length,this._size.length,"<");var n;c(this,t.map(function(t){return t+1}),r);for(var i=this._data,o=0,a=t.length-1;o<a;o++)zf(n=t[o],i.length),i=i[n];return zf(n=t[t.length-1],i.length),i[n]=e,this},d.prototype.resize=function(t,e,r){if(!Lc(t))throw new TypeError("Array or Matrix expected");var n=t.valueOf().map(function(t){return Array.isArray(t)&&1===t.length?t[0]:t});return s(r?this.clone():this,n,e)},d.prototype.reshape=function(t,e){var r=e?this.clone():this;return r._data=Gf(r._data,t),r._size=t.slice(0),r},d.prototype.clone=function(){return new d({data:vf(this._data),size:vf(this._size),datatype:this._datatype})},d.prototype.size=function(){return this._size.slice(0)},d.prototype.map=function(e){var i=this,t=function r(t,n){return Rc(t)?t.map(function(t,e){return r(t,n.concat(e))}):e(t,n,i)}(this._data,[]);return new d(t,void 0!==this._datatype?Yf(t,df):void 0)},d.prototype.forEach=function(e){var i=this;!function r(t,n){Rc(t)?t.forEach(function(t,e){r(t,n.concat(e))}):e(t,n,i)}(this._data,[])},d.prototype.toArray=function(){return vf(this._data)},d.prototype.valueOf=function(){return this._data},d.prototype.format=function(t){return Lf(this._data,t)},d.prototype.toString=function(){return Lf(this._data)},d.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},d.prototype.diagonal=function(t){if(t){if(Pc(t)&&(t=t.toNumber()),!Mc(t)||!Ef(t))throw new TypeError("The parameter k must be an integer number")}else t=0;for(var e=0<t?t:0,r=t<0?-t:0,n=this._size[0],i=this._size[1],o=Math.min(n-r,i-e),a=[],s=0;s<o;s++)a[s]=this._data[s+r][s+e];return new d({data:a,size:[o],datatype:this._datatype})},d.diagonal=function(t,e,r,n){if(!Rc(t))throw new TypeError("Array expected, size parameter");if(2!==t.length)throw new Error("Only two dimensions matrix are supported");if(t=t.map(function(t){if(Pc(t)&&(t=t.toNumber()),!Mc(t)||!Ef(t)||t<1)throw new Error("Size values must be positive integers");return t}),r){if(Pc(r)&&(r=r.toNumber()),!Mc(r)||!Ef(r))throw new TypeError("The parameter k must be an integer number")}else r=0;var i,o=0<r?r:0,a=r<0?-r:0,s=t[0],u=t[1],h=Math.min(s-a,u-o);if(Rc(e)){if(e.length!==h)throw new Error("Invalid value array length");i=function(t){return e[t]}}else if(Fc(e)){var l=e.size();if(1!==l.length||l[0]!==h)throw new Error("Invalid matrix length");i=function(t){return e.get([t])}}else i=function(){return e};n=n||(Pc(i(0))?i(0).mul(0):0);var c=[];if(0<t.length){c=Hf(c,t,n);for(var f=0;f<h;f++)c[f+a][f+o]=i(f)}return new d({data:c,size:[s,u]})},d.fromJSON=function(t){return new d(t)},d.prototype.swapRows=function(t,e){if(!(Mc(t)&&Ef(t)&&Mc(e)&&Ef(e)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return zf(t,this._size[0]),zf(e,this._size[0]),d._swapRows(t,e,this._data),this},d._swapRows=function(t,e,r){var n=r[t];r[t]=r[e],r[e]=n},d},{isClass:!0}),vd=r(10),md=r.n(vd),gd=function(){return gd=md.a.create,md.a},yd=Wf("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(t){var r=t.BigNumber,n=t.Complex,e=t.DenseMatrix,i=t.Fraction,o=gd();return o.types=[{name:"number",test:Mc},{name:"Complex",test:Cc},{name:"BigNumber",test:Pc},{name:"Fraction",test:Ic},{name:"Unit",test:Nc},{name:"string",test:Dc},{name:"Chain",test:ff},{name:"Array",test:Rc},{name:"Matrix",test:Fc},{name:"DenseMatrix",test:kc},{name:"SparseMatrix",test:Bc},{name:"Range",test:Uc},{name:"Index",test:jc},{name:"boolean",test:zc},{name:"ResultSet",test:Hc},{name:"Help",test:Gc},{name:"function",test:Xc},{name:"Date",test:Vc},{name:"RegExp",test:Yc},{name:"null",test:qc},{name:"undefined",test:Zc},{name:"AccessorNode",test:Kc},{name:"ArrayNode",test:$c},{name:"AssignmentNode",test:Jc},{name:"BlockNode",test:Qc},{name:"ConditionalNode",test:tf},{name:"ConstantNode",test:ef},{name:"FunctionNode",test:nf},{name:"FunctionAssignmentNode",test:rf},{name:"IndexNode",test:of},{name:"Node",test:af},{name:"ObjectNode",test:sf},{name:"OperatorNode",test:uf},{name:"ParenthesisNode",test:hf},{name:"RangeNode",test:lf},{name:"SymbolNode",test:cf},{name:"Object",test:Wc}],o.conversions=[{from:"number",to:"BigNumber",convert:function(t){if(r||_d(t),15<t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+t+"). Use function bignumber(x) to convert to BigNumber.");return new r(t)}},{from:"number",to:"Complex",convert:function(t){return n||xd(t),new n(t,0)}},{from:"number",to:"string",convert:function(t){return t+""}},{from:"BigNumber",to:"Complex",convert:function(t){return n||xd(t),new n(t.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(t){return n||xd(t),new n(t.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(t){i||bd(t);var e=new i(t);if(e.valueOf()!==t)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+t+"). Use function fraction(x) to convert to Fraction.");return e}},{from:"string",to:"number",convert:function(t){var e=Number(t);if(isNaN(e))throw new Error('Cannot convert "'+t+'" to a number');return e}},{from:"string",to:"BigNumber",convert:function(e){r||_d(e);try{return new r(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||bd(e);try{return new i(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){n||xd(e);try{return new n(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(t){return+t}},{from:"boolean",to:"BigNumber",convert:function(t){return r||_d(t),new r(+t)}},{from:"boolean",to:"Fraction",convert:function(t){return i||bd(t),new i(+t)}},{from:"boolean",to:"string",convert:function(t){return String(t)}},{from:"Array",to:"Matrix",convert:function(t){return e||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new e(t)}},{from:"Matrix",to:"Array",convert:function(t){return t.valueOf()}}],o});function _d(t){throw new Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function xd(t){throw new Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function bd(t){throw new Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}function wd(t){for(var e=0;e<t.length;e++)if(Lc(t[e]))return 1}function Td(t,e){Fc(t)&&(t=t.valueOf());for(var r=0,n=t.length;r<n;r++){var i=t[r];Array.isArray(i)?Td(i,e):e(i)}}function Ed(t,e,r){return t&&"function"==typeof t.map?t.map(function(t){return Ed(t,e,r)}):e(t)}function Ad(t,e,r){var n=Array.isArray(t)?Uf(t):t.size();if(e<0||e>=n.length)throw new Bf(e,n.length);return Fc(t)?t.create(Sd(t.valueOf(),e,r)):Sd(t,e,r)}function Sd(t,e,r){var n,i,o,a;if(e<=0){if(Array.isArray(t[0])){for(a=function(t){var e,r,n=t.length,i=t[0].length,o=[];for(r=0;r<i;r++){var a=[];for(e=0;e<n;e++)a.push(t[e][r]);o.push(a)}return o}(t),i=[],n=0;n<a.length;n++)i[n]=Sd(a[n],e-1,r);return i}for(o=t[0],n=1;n<t.length;n++)o=r(o,t[n]);return o}for(i=[],n=0;n<t.length;n++)i[n]=Sd(t[n],e-1,r);return i}var Od="number";Ef.signature=Od;function Md(t,e,r){if(null==r)return t.eq(e);if(t.eq(e))return!0;if(t.isNaN()||e.isNaN())return!1;if(t.isFinite()&&e.isFinite()){var n=t.minus(e).abs();if(n.isZero())return!0;var i=t.constructor.max(t.abs(),e.abs());return n.lte(i.times(r))}return!1}var Pd="equalScalar",Cd=Wf(Pd,["typed","config"],function(t){var e=t.typed,o=t.config,r=e(Pd,{"boolean, boolean":function(t,e){return t===e},"number, number":function(t,e){return Nf(t,e,o.epsilon)},"BigNumber, BigNumber":function(t,e){return t.eq(e)||Md(t,e,o.epsilon)},"Fraction, Fraction":function(t,e){return t.equals(e)},"Complex, Complex":function(t,e){return r=t,n=e,i=o.epsilon,Nf(r.re,n.re,i)&&Nf(r.im,n.im,i);var r,n,i},"Unit, Unit":function(t,e){if(!t.equalBase(e))throw new Error("Cannot compare units with different base");return r(t.value,e.value)}});return r}),Id=(Wf(Pd,["typed","config"],function(t){var e=t.typed,r=t.config;return e(Pd,{"number, number":function(t,e){return Nf(t,e,r.epsilon)}})}),Wf("number",["typed"],function(t){var e=(0,t.typed)("number",{"":function(){return 0},number:function(t){return t},string:function(t){if("NaN"===t)return NaN;var e=Number(t);if(isNaN(e))throw new SyntaxError('String "'+t+'" is no valid number');return e},BigNumber:function(t){return t.toNumber()},Fraction:function(t){return t.valueOf()},Unit:function(){throw new Error("Second argument with valueless unit expected")},null:function(){return 0},"Unit, string | Unit":function(t,e){return t.toNumber(e)},"Array | Matrix":function(t){return Ed(t,e)}});return e.fromJSON=function(t){return parseFloat(t.value)},e})),Nd="number",Dd="number, number";function Rd(t){return Math.abs(t)}function Fd(t,e){return t+e}function Ld(t,e){return t*e}function kd(t){return-t}function Bd(t,e){return t*t<1&&e===1/0||1<t*t&&e===-1/0?0:Math.pow(t,e)}function Ud(t){return parseFloat(Of(t,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0))}Rd.signature=Nd,Ld.signature=Fd.signature=Dd,kd.signature=Nd,Ud.signature=Bd.signature=Dd;var jd=Wf("multiplyScalar",["typed"],function(t){var n=(0,t.typed)("multiplyScalar",{"number, number":Ld,"Complex, Complex":function(t,e){return t.mul(e)},"BigNumber, BigNumber":function(t,e){return t.times(e)},"Fraction, Fraction":function(t,e){return t.mul(e)},"number | Fraction | BigNumber | Complex, Unit":function(t,e){var r=e.clone();return r.value=null===r.value?r._normalize(t):n(r.value,t),r},"Unit, number | Fraction | BigNumber | Complex":function(t,e){var r=t.clone();return r.value=null===r.value?r._normalize(e):n(r.value,e),r},"Unit, Unit":function(t,e){return t.multiply(e)}});return n});var zd="number, number";var Hd="number, number";Math.pow(2,53);var Gd="number";r(11);var Xd=Wf("fraction",["typed","Fraction"],function(t){var e=t.typed,r=t.Fraction,n=e("fraction",{number:function(t){if(!isFinite(t)||isNaN(t))throw new Error(t+" cannot be represented as a fraction");return new r(t)},string:function(t){return new r(t)},"number, number":function(t,e){return new r(t,e)},null:function(){return new r(0)},BigNumber:function(t){return new r(t.toString())},Fraction:function(t){return t},Object:function(t){return new r(t)},"Array | Matrix":function(t){return Ed(t,n)}});return n}),Vd="unaryMinus",Yd=Wf(Vd,["typed"],function(t){var r=(0,t.typed)(Vd,{number:kd,Complex:function(t){return t.neg()},BigNumber:function(t){return t.neg()},Fraction:function(t){return t.neg()},Unit:function(t){var e=t.clone();return e.value=r(t.value),e},"Array | Matrix":function(t){return Ed(t,r,!0)}});return r}),Wd=Wf("addScalar",["typed"],function(t){var n=(0,t.typed)("addScalar",{"number, number":Fd,"Complex, Complex":function(t,e){return t.add(e)},"BigNumber, BigNumber":function(t,e){return t.plus(e)},"Fraction, Fraction":function(t,e){return t.add(e)},"Unit, Unit":function(t,e){if(null===t.value||void 0===t.value)throw new Error("Parameter x contains a unit with undefined value");if(null===e.value||void 0===e.value)throw new Error("Parameter y contains a unit with undefined value");if(!t.equalBase(e))throw new Error("Units do not match");var r=t.clone();return r.value=n(r.value,e.value),r.fixPrefix=!1,r}});return n}),qd=Wf("sqrt",["config","typed","Complex"],function(t){var e=t.config,r=t.typed,n=t.Complex,i=r("sqrt",{number:o,Complex:function(t){return t.sqrt()},BigNumber:function(t){return!t.isNegative()||e.predictable?t.sqrt():o(t.toNumber())},"Array | Matrix":function(t){return Ed(t,i,!0)},Unit:function(t){return t.pow(.5)}});function o(t){return isNaN(t)?NaN:0<=t||e.predictable?Math.sqrt(t):new n(t,0).sqrt()}return i}),Zd=Wf("conj",["typed"],function(t){var e=(0,t.typed)("conj",{number:function(t){return t},BigNumber:function(t){return t},Complex:function(t){return t.conjugate()},"Array | Matrix":function(t){return Ed(t,e)}});return e});var Kd=Wf("cos",["typed"],function(t){var e=(0,t.typed)("cos",{number:Math.cos,Complex:function(t){return t.cos()},BigNumber:function(t){return t.cos()},Unit:function(t){if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return e(t.value)},"Array | Matrix":function(t){return Ed(t,e)}});return e}),$d=Wf("sin",["typed"],function(t){var e=(0,t.typed)("sin",{number:Math.sin,Complex:function(t){return t.sin()},BigNumber:function(t){return t.sin()},Unit:function(t){if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sin is no angle");return e(t.value)},"Array | Matrix":function(t){return Ed(t,e,!0)}});return e});var Jd=Wf("SparseMatrix",["typed","equalScalar","Matrix"],function(t){var T=t.typed,E=t.equalScalar,e=t.Matrix;function A(t,e){if(!(this instanceof A))throw new SyntaxError("Constructor must be called with the new operator");if(e&&!Dc(e))throw new Error("Invalid datatype: "+e);if(Fc(t))r=this,i=e,"SparseMatrix"===(n=t).type?(r._values=n._values?vf(n._values):void 0,r._index=vf(n._index),r._ptr=vf(n._ptr),r._size=vf(n._size),r._datatype=i||n._datatype):o(r,n.valueOf(),i||n._datatype);else if(t&&Rc(t.index)&&Rc(t.ptr)&&Rc(t.size))this._values=t.values,this._index=t.index,this._ptr=t.ptr,this._size=t.size,this._datatype=e||t.datatype;else if(Rc(t))o(this,t,e);else{if(t)throw new TypeError("Unsupported type of data ("+df(t)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=e}var r,n,i}function o(t,e,r){t._values=[],t._index=[],t._ptr=[],t._datatype=r;var n=e.length,i=0,o=E,a=0;if(Dc(r)&&(o=T.find(E,[r,r])||E,a=T.convert(0,r)),0<n){var s=0;do{t._ptr.push(t._index.length);for(var u=0;u<n;u++){var h,l=e[u];Rc(l)?(0===s&&i<l.length&&(i=l.length),s<l.length&&(o(h=l[s],a)||(t._values.push(h),t._index.push(u)))):(0===s&&i<1&&(i=1),o(l,a)||(t._values.push(l),t._index.push(u)))}s++}while(s<i)}t._ptr.push(t._index.length),t._size=[n,i]}function g(t,e,r,n){if(r-e==0)return r;for(var i=e;i<r;i++)if(n[i]===t)return i;return e}function y(t,e,r,n,i,o,a){i.splice(t,0,n),o.splice(t,0,e);for(var s=r+1;s<a.length;s++)a[s]++}function l(t,e,r,n){var i=n||0,o=E,a=0;Dc(t._datatype)&&(o=T.find(E,[t._datatype,t._datatype])||E,a=T.convert(0,t._datatype),i=T.convert(i,t._datatype));var s=!o(i,a),u=t._size[0],h=t._size[1];if(h<r){for(c=h;c<r;c++)if(t._ptr[c]=t._values.length,s)for(d=0;d<u;d++)t._values.push(i),t._index.push(d);t._ptr[r]=t._values.length}else r<h&&(t._ptr.splice(r+1,h-r),t._values.splice(t._ptr[r],t._values.length),t._index.splice(t._ptr[r],t._index.length));if(h=r,u<e){if(s){for(var l=0,c=0;c<h;c++){t._ptr[c]=t._ptr[c]+l,g=t._ptr[c+1]+l;for(var f=0,d=u;d<e;d++,f++)t._values.splice(g+f,0,i),t._index.splice(g+f,0,d),l++}t._ptr[h]=t._values.length}}else if(e<u){var p=0;for(c=0;c<h;c++){t._ptr[c]=t._ptr[c]-p;for(var v=t._ptr[c],m=t._ptr[c+1]-p,g=v;g<m;g++)e-1<(d=t._index[g])&&(t._values.splice(g,1),t._index.splice(g,1),p++)}t._ptr[c]=t._values.length}return t._size[0]=e,t._size[1]=r,t}function r(t,e,r,n,i){for(var o,a=n[0],s=n[1],u=[],h=0;h<a;h++)for(u[h]=[],o=0;o<s;o++)u[h][o]=0;for(o=0;o<s;o++)for(var l=r[o],c=r[o+1],f=l;f<c;f++)u[h=e[f]][o]=t?i?vf(t[f]):t[f]:1;return u}return(A.prototype=new e).createSparseMatrix=function(t,e){return new A(t,e)},A.prototype.type="SparseMatrix",A.prototype.isSparseMatrix=!0,A.prototype.getDataType=function(){return Yf(this._values,df)},A.prototype.storage=function(){return"sparse"},A.prototype.datatype=function(){return this._datatype},A.prototype.create=function(t,e){return new A(t,e)},A.prototype.density=function(){var t=this._size[0],e=this._size[1];return 0!==t&&0!==e?this._index.length/(t*e):0},A.prototype.subset=function(t,e,r){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(t,e){if(!jc(e))throw new TypeError("Invalid index");if(e.isScalar())return t.get(e.min());var r,n,i,o,a=e.size();if(a.length!==t._size.length)throw new kf(a.length,t._size.length);var s=e.min(),u=e.max();for(r=0,n=t._size.length;r<n;r++)zf(s[r],t._size[r]),zf(u[r],t._size[r]);var h=t._values,l=t._index,c=t._ptr,f=e.dimension(0),d=e.dimension(1),p=[],v=[];f.forEach(function(t,e){v[t]=e[0],p[t]=!0});var m=h?[]:void 0,g=[],y=[];return d.forEach(function(t){for(y.push(g.length),i=c[t],o=c[t+1];i<o;i++)r=l[i],!0===p[r]&&(g.push(v[r]),m&&m.push(h[i]))}),y.push(g.length),new A({values:m,index:g,ptr:y,size:a,datatype:t._datatype})}(this,t);case 2:case 3:return function(t,e,r,n){if(!e||!0!==e.isIndex)throw new TypeError("Invalid index");var i,o=e.size(),a=e.isScalar();Fc(r)?(i=r.size(),r=r.toArray()):i=Uf(r);if(a){if(0!==i.length)throw new TypeError("Scalar expected");t.set(e.min(),r,n)}else{if(1!==o.length&&2!==o.length)throw new kf(o.length,t._size.length,"<");if(i.length<o.length){for(var s=0,u=0;1===o[s]&&1===i[s];)s++;for(;1===o[s];)u++,s++;r=Xf(r,o.length,u,i)}if(!yf(o,i))throw new kf(o,i,">");for(var h=e.min()[0],l=e.min()[1],c=i[0],f=i[1],d=0;d<c;d++)for(var p=0;p<f;p++){var v=r[d][p];t.set([d+h,p+l],v,n)}}return t}(this,t,e,r);default:throw new SyntaxError("Wrong number of arguments")}},A.prototype.get=function(t){if(!Rc(t))throw new TypeError("Array expected");if(t.length!==this._size.length)throw new kf(t.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var e=t[0],r=t[1];zf(e,this._size[0]),zf(r,this._size[1]);var n=g(e,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===e?this._values[n]:0},A.prototype.set=function(t,e,r){if(!Rc(t))throw new TypeError("Array expected");if(t.length!==this._size.length)throw new kf(t.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var n=t[0],i=t[1],o=this._size[0],a=this._size[1],s=E,u=0;Dc(this._datatype)&&(s=T.find(E,[this._datatype,this._datatype])||E,u=T.convert(0,this._datatype)),(o-1<n||a-1<i)&&(l(this,Math.max(n+1,o),Math.max(i+1,a),r),o=this._size[0],a=this._size[1]),zf(n,o),zf(i,a);var h=g(n,this._ptr[i],this._ptr[i+1],this._index);return h<this._ptr[i+1]&&this._index[h]===n?s(e,u)?function(t,e,r,n,i){r.splice(t,1),n.splice(t,1);for(var o=e+1;o<i.length;o++)i[o]--}(h,i,this._values,this._index,this._ptr):this._values[h]=e:y(h,n,i,e,this._values,this._index,this._ptr),this},A.prototype.resize=function(t,e,r){if(!Lc(t))throw new TypeError("Array or Matrix expected");var n=t.valueOf().map(function(t){return Array.isArray(t)&&1===t.length?t[0]:t});if(2!==n.length)throw new Error("Only two dimensions matrix are supported");return n.forEach(function(t){if(!Mc(t)||!Ef(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Lf(n)+")")}),l(r?this.clone():this,n[0],n[1],e)},A.prototype.reshape=function(e,t){if(!Rc(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");if(e.forEach(function(t){if(!Mc(t)||!Ef(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Lf(e)+")")}),this._size[0]*this._size[1]!=e[0]*e[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var r=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return r;for(var n=[],i=0;i<r._ptr.length;i++)for(var o=0;o<r._ptr[i+1]-r._ptr[i];o++)n.push(i);for(var a=r._values.slice(),s=r._index.slice(),u=0;u<r._index.length;u++){var h=s[u],l=n[u],c=h*r._size[1]+l;n[u]=c%e[1],s[u]=Math.floor(c/e[1])}r._values.length=0,r._index.length=0,r._ptr.length=e[1]+1,r._size=e.slice();for(var f=0;f<r._ptr.length;f++)r._ptr[f]=0;for(var d=0;d<a.length;d++){var p=s[d],v=n[d],m=a[d];y(g(p,r._ptr[v],r._ptr[v+1],r._index),p,v,m,r._values,r._index,r._ptr)}return r},A.prototype.clone=function(){return new A({values:this._values?vf(this._values):void 0,index:vf(this._index),ptr:vf(this._ptr),size:vf(this._size),datatype:this._datatype})},A.prototype.size=function(){return this._size.slice(0)},A.prototype.map=function(n,t){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var i=this;return function(t,e,r,n,i,o,a){var s=[],u=[],h=[],l=E,c=0;Dc(t._datatype)&&(l=T.find(E,[t._datatype,t._datatype])||E,c=T.convert(0,t._datatype));for(var f=function(t,e,r){t=o(t,e,r),l(t,c)||(s.push(t),u.push(e))},d=n;d<=i;d++){h.push(s.length);var p=t._ptr[d],v=t._ptr[d+1];if(a)for(var m=p;m<v;m++){var g=t._index[m];e<=g&&g<=r&&f(t._values[m],g-e,d-n)}else{for(var y={},_=p;_<v;_++){var x=t._index[_];y[x]=t._values[_]}for(var b=e;b<=r;b++){var w=b in y?y[b]:0;f(w,b-e,d-n)}}}return h.push(s.length),new A({values:s,index:u,ptr:h,size:[r-e+1,i-n+1]})}(this,0,this._size[0]-1,0,this._size[1]-1,function(t,e,r){return n(t,[e,r],i)},t)},A.prototype.forEach=function(t,e){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],n=this._size[1],i=0;i<n;i++){var o=this._ptr[i],a=this._ptr[i+1];if(e)for(var s=o;s<a;s++){var u=this._index[s];t(this._values[s],[u,i],this)}else{for(var h={},l=o;l<a;l++){h[this._index[l]]=this._values[l]}for(var c=0;c<r;c++){t(c in h?h[c]:0,[c,i],this)}}}},A.prototype.toArray=function(){return r(this._values,this._index,this._ptr,this._size,!0)},A.prototype.valueOf=function(){return r(this._values,this._index,this._ptr,this._size,!1)},A.prototype.format=function(t){for(var e=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+Lf(e,t)+" x "+Lf(r,t)+"] density: "+Lf(n,t)+"\n",o=0;o<r;o++)for(var a=this._ptr[o],s=this._ptr[o+1],u=a;u<s;u++){i+="\n ("+Lf(this._index[u],t)+", "+Lf(o,t)+") ==> "+(this._values?Lf(this._values[u],t):"X")}return i},A.prototype.toString=function(){return Lf(this.toArray())},A.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},A.prototype.diagonal=function(t){if(t){if(Pc(t)&&(t=t.toNumber()),!Mc(t)||!Ef(t))throw new TypeError("The parameter k must be an integer number")}else t=0;var e=0<t?t:0,r=t<0?-t:0,n=this._size[0],i=this._size[1],o=Math.min(n-r,i-e),a=[],s=[],u=[];u[0]=0;for(var h=e;h<i&&a.length<o;h++)for(var l=this._ptr[h],c=this._ptr[h+1],f=l;f<c;f++){var d=this._index[f];if(d===h-e+r){a.push(this._values[f]),s[a.length-1]=d-r;break}}return u.push(a.length),new A({values:a,index:s,ptr:u,size:[o,1]})},A.fromJSON=function(t){return new A(t)},A.diagonal=function(t,e,r,n,i){if(!Rc(t))throw new TypeError("Array expected, size parameter");if(2!==t.length)throw new Error("Only two dimensions matrix are supported");if(t=t.map(function(t){if(Pc(t)&&(t=t.toNumber()),!Mc(t)||!Ef(t)||t<1)throw new Error("Size values must be positive integers");return t}),r){if(Pc(r)&&(r=r.toNumber()),!Mc(r)||!Ef(r))throw new TypeError("The parameter k must be an integer number")}else r=0;var o=E,a=0;Dc(i)&&(o=T.find(E,[i,i])||E,a=T.convert(0,i));var s,u=0<r?r:0,h=r<0?-r:0,l=t[0],c=t[1],f=Math.min(l-h,c-u);if(Rc(e)){if(e.length!==f)throw new Error("Invalid value array length");s=function(t){return e[t]}}else if(Fc(e)){var d=e.size();if(1!==d.length||d[0]!==f)throw new Error("Invalid matrix length");s=function(t){return e.get([t])}}else s=function(){return e};for(var p=[],v=[],m=[],g=0;g<c;g++){m.push(p.length);var y,_=g-u;0<=_&&_<f&&(o(y=s(_),a)||(v.push(_+h),p.push(y)))}return m.push(p.length),new A({values:p,index:v,ptr:m,size:[l,c]})},A.prototype.swapRows=function(t,e){if(!(Mc(t)&&Ef(t)&&Mc(e)&&Ef(e)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return zf(t,this._size[0]),zf(e,this._size[0]),A._swapRows(t,e,this._size[1],this._values,this._index,this._ptr),this},A._forEachRow=function(t,e,r,n,i){for(var o=n[t],a=n[t+1],s=o;s<a;s++)i(r[s],e[s])},A._swapRows=function(t,e,r,n,i,o){for(var a=0;a<r;a++){var s,u,h,l=o[a],c=o[a+1],f=g(t,l,c,i),d=g(e,l,c,i);f<c&&d<c&&i[f]===t&&i[d]===e?n&&(s=n[f],n[f]=n[d],n[d]=s):f<c&&i[f]===t&&(c<=d||i[d]!==e)?(u=n?n[f]:void 0,i.splice(d,0,e),n&&n.splice(d,0,u),i.splice(d<=f?f+1:f,1),n&&n.splice(d<=f?f+1:f,1)):d<c&&i[d]===e&&(c<=f||i[f]!==t)&&(h=n?n[d]:void 0,i.splice(f,0,t),n&&n.splice(f,0,h),i.splice(f<=d?d+1:d,1),n&&n.splice(f<=d?d+1:d,1))}},A},{isClass:!0}),Qd=Wf("matrix",["typed","Matrix","DenseMatrix","SparseMatrix"],function(t){var e=t.typed,n=(t.Matrix,t.DenseMatrix),i=t.SparseMatrix;return e("matrix",{"":function(){return r([])},string:function(t){return r([],t)},"string, string":function(t,e){return r([],t,e)},Array:function(t){return r(t)},Matrix:function(t){return r(t,t.storage())},"Array | Matrix, string":r,"Array | Matrix, string, string":r});function r(t,e,r){if("dense"===e||"default"===e||void 0===e)return new n(t,r);if("sparse"===e)return new i(t,r);throw new TypeError("Unknown matrix type "+JSON.stringify(e)+".")}}),tp=Wf("algorithm01",["typed"],function(t){var A=t.typed;return function(t,e,r,n){var i=t._data,o=t._size,a=t._datatype,s=e._values,u=e._index,h=e._ptr,l=e._size,c=e._datatype;if(o.length!==l.length)throw new kf(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");for(var f=o[0],d=o[1],p="string"==typeof a&&a===c?a:void 0,v=p?A.find(r,[p,p]):r,m=[],g=0;g<f;g++)m[g]=[];for(var y=[],_=[],x=0;x<d;x++){for(var b=x+1,w=h[x],T=h[x+1],E=w;E<T;E++)y[g=u[E]]=n?v(s[E],i[g][x]):v(i[g][x],s[E]),_[g]=b;for(g=0;g<f;g++)_[g]===b?m[g][x]=y[g]:m[g][x]=i[g][x]}return t.createDenseMatrix({data:m,size:[f,d],datatype:p})}}),ep=Wf("algorithm04",["typed","equalScalar"],function(t){var D=t.typed,R=t.equalScalar;return function(t,e,r){var n=t._values,i=t._index,o=t._ptr,a=t._size,s=t._datatype,u=e._values,h=e._index,l=e._ptr,c=e._size,f=e._datatype;if(a.length!==c.length)throw new kf(a.length,c.length);if(a[0]!==c[0]||a[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");var d,p=a[0],v=a[1],m=R,g=0,y=r;"string"==typeof s&&s===f&&(d=s,m=D.find(R,[d,d]),g=D.convert(0,d),y=D.find(r,[d,d]));for(var _=n&&u?[]:void 0,x=[],b=[],w=n&&u?[]:void 0,T=n&&u?[]:void 0,E=[],A=[],S=0;S<v;S++){b[S]=x.length;for(var O,M,P=S+1,C=o[S],I=o[S+1],N=C;N<I;N++)M=i[N],x.push(M),E[M]=P,w&&(w[M]=n[N]);for(C=l[S],I=l[S+1],N=C;N<I;N++){E[M=h[N]]===P?w&&(m(O=y(w[M],u[N]),g)?E[M]=null:w[M]=O):(x.push(M),A[M]=P,T&&(T[M]=u[N]))}if(w&&T)for(N=b[S];N<x.length;)E[M=x[N]]===P?(_[N]=w[M],N++):A[M]===P?(_[N]=T[M],N++):x.splice(N,1)}return b[v]=x.length,t.createSparseMatrix({values:_,index:x,ptr:b,size:[p,v],datatype:d})}}),rp=Wf("algorithm10",["typed","DenseMatrix"],function(t){var T=t.typed,E=t.DenseMatrix;return function(t,e,r,n){var i=t._values,o=t._index,a=t._ptr,s=t._size,u=t._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h,l=s[0],c=s[1],f=r;"string"==typeof u&&(h=u,e=T.convert(e,h),f=T.find(r,[h,h]));for(var d=[],p=[],v=[],m=0;m<c;m++){for(var g=m+1,y=a[m],_=a[m+1],x=y;x<_;x++){var b=o[x];p[b]=i[x],v[b]=g}for(var w=0;w<l;w++)0===m&&(d[w]=[]),v[w]===g?d[w][m]=n?f(e,p[w]):f(p[w],e):d[w][m]=e}return new E({data:d,size:[l,c],datatype:h})}}),np=Wf("algorithm13",["typed"],function(t){var p=t.typed;return function(t,e,r){var n=t._data,i=t._size,o=t._datatype,a=e._data,s=e._size,u=e._datatype,h=[];if(i.length!==s.length)throw new kf(i.length,s.length);for(var l,c=0;c<i.length;c++){if(i[c]!==s[c])throw new RangeError("Dimension mismatch. Matrix A ("+i+") must match Matrix B ("+s+")");h[c]=i[c]}var f=r;"string"==typeof o&&o===u&&(l=o,f=p.find(r,[l,l]));var d=0<h.length?function t(e,r,n,i,o,a){var s=[];if(r===n.length-1)for(var u=0;u<i;u++)s[u]=e(o[u],a[u]);else for(var h=0;h<i;h++)s[h]=t(e,r+1,n,n[r+1],o[h],a[h]);return s}(f,0,h,h[0],n,a):[];return t.createDenseMatrix({data:d,size:h,datatype:l})}}),ip=Wf("algorithm14",["typed"],function(t){var l=t.typed;return function(t,e,r,n){var i,o=t._data,a=t._size,s=t._datatype,u=r;"string"==typeof s&&(i=s,e=l.convert(e,i),u=l.find(r,[i,i]));var h=0<a.length?function t(e,r,n,i,o,a,s){var u=[];if(r===n.length-1)for(var h=0;h<i;h++)u[h]=s?e(a,o[h]):e(o[h],a);else for(var l=0;l<i;l++)u[l]=t(e,r+1,n,n[r+1],o[l],a,s);return u}(u,0,a,a[0],o,e,n):[];return t.createDenseMatrix({data:h,size:vf(a),datatype:i})}}),op=Wf("algorithm02",["typed","equalScalar"],function(t){var O=t.typed,M=t.equalScalar;return function(t,e,r,n){var i=t._data,o=t._size,a=t._datatype,s=e._values,u=e._index,h=e._ptr,l=e._size,c=e._datatype;if(o.length!==l.length)throw new kf(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var f,d=o[0],p=o[1],v=M,m=0,g=r;"string"==typeof a&&a===c&&(f=a,v=O.find(M,[f,f]),m=O.convert(0,f),g=O.find(r,[f,f]));for(var y=[],_=[],x=[],b=0;b<p;b++){x[b]=_.length;for(var w=h[b],T=h[b+1],E=w;E<T;E++){var A=u[E],S=n?g(s[E],i[A][b]):g(i[A][b],s[E]);v(S,m)||(_.push(A),y.push(S))}}return x[p]=_.length,e.createSparseMatrix({values:y,index:_,ptr:x,size:[d,p],datatype:f})}}),ap=Wf("algorithm03",["typed"],function(t){var M=t.typed;return function(t,e,r,n){var i=t._data,o=t._size,a=t._datatype,s=e._values,u=e._index,h=e._ptr,l=e._size,c=e._datatype;if(o.length!==l.length)throw new kf(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var f,d=o[0],p=o[1],v=0,m=r;"string"==typeof a&&a===c&&(f=a,v=M.convert(0,f),m=M.find(r,[f,f]));for(var g=[],y=0;y<d;y++)g[y]=[];for(var _=[],x=[],b=0;b<p;b++){for(var w=b+1,T=h[b],E=h[b+1],A=T;A<E;A++){var S=u[A];_[S]=n?m(s[A],i[S][b]):m(i[S][b],s[A]),x[S]=w}for(var O=0;O<d;O++)x[O]===w?g[O][b]=_[O]:g[O][b]=n?m(v,i[O][b]):m(i[O][b],v)}return t.createDenseMatrix({data:g,size:[d,p],datatype:f})}}),sp=Wf("algorithm05",["typed","equalScalar"],function(t){var R=t.typed,F=t.equalScalar;return function(t,e,r){var n=t._values,i=t._index,o=t._ptr,a=t._size,s=t._datatype,u=e._values,h=e._index,l=e._ptr,c=e._size,f=e._datatype;if(a.length!==c.length)throw new kf(a.length,c.length);if(a[0]!==c[0]||a[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");var d,p=a[0],v=a[1],m=F,g=0,y=r;"string"==typeof s&&s===f&&(d=s,m=R.find(F,[d,d]),g=R.convert(0,d),y=R.find(r,[d,d]));for(var _,x=n&&u?[]:void 0,b=[],w=[],T=x?[]:void 0,E=x?[]:void 0,A=[],S=[],O=0;O<v;O++){w[O]=b.length;for(var M=O+1,P=o[O],C=o[O+1];P<C;P++)_=i[P],b.push(_),A[_]=M,T&&(T[_]=n[P]);for(P=l[O],C=l[O+1];P<C;P++)A[_=h[P]]!==M&&b.push(_),S[_]=M,E&&(E[_]=u[P]);if(x)for(P=w[O];P<b.length;){var I,N=A[_=b[P]],D=S[_];N!==M&&D!==M||(m(I=y(N===M?T[_]:g,D===M?E[_]:g),g)?b.splice(P,1):(x.push(I),P++))}}return w[v]=b.length,t.createSparseMatrix({values:x,index:b,ptr:w,size:[p,v],datatype:d})}}),up=Wf("algorithm11",["typed","equalScalar"],function(t){var E=t.typed,A=t.equalScalar;return function(t,e,r,n){var i=t._values,o=t._index,a=t._ptr,s=t._size,u=t._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h,l=s[0],c=s[1],f=A,d=0,p=r;"string"==typeof u&&(h=u,f=E.find(A,[h,h]),d=E.convert(0,h),e=E.convert(e,h),p=E.find(r,[h,h]));for(var v=[],m=[],g=[],y=0;y<c;y++){g[y]=m.length;for(var _=a[y],x=a[y+1],b=_;b<x;b++){var w=o[b],T=n?p(e,i[b]):p(i[b],e);f(T,d)||(m.push(w),v.push(T))}}return g[c]=m.length,t.createSparseMatrix({values:v,index:m,ptr:g,size:[l,c],datatype:h})}}),hp=Wf("algorithm12",["typed","DenseMatrix"],function(t){var T=t.typed,E=t.DenseMatrix;return function(t,e,r,n){var i=t._values,o=t._index,a=t._ptr,s=t._size,u=t._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h,l=s[0],c=s[1],f=r;"string"==typeof u&&(h=u,e=T.convert(e,h),f=T.find(r,[h,h]));for(var d=[],p=[],v=[],m=0;m<c;m++){for(var g=m+1,y=a[m],_=a[m+1],x=y;x<_;x++){var b=o[x];p[b]=i[x],v[b]=g}for(var w=0;w<l;w++)0===m&&(d[w]=[]),v[w]===g?d[w][m]=n?f(e,p[w]):f(p[w],e):d[w][m]=n?f(e,0):f(0,e)}return new E({data:d,size:[l,c],datatype:h})}}),lp=Wf("algorithm07",["typed","DenseMatrix"],function(t){var w=t.typed,T=t.DenseMatrix;return function(t,e,r){var n=t._size,i=t._datatype,o=e._size,a=e._datatype;if(n.length!==o.length)throw new kf(n.length,o.length);if(n[0]!==o[0]||n[1]!==o[1])throw new RangeError("Dimension mismatch. Matrix A ("+n+") must match Matrix B ("+o+")");var s,u=n[0],h=n[1],l=0,c=r;"string"==typeof i&&i===a&&(s=i,l=w.convert(0,s),c=w.find(r,[s,s]));for(var f=[],d=0;d<u;d++)f[d]=[];for(var p=[],v=[],m=[],g=[],y=0;y<h;y++){var _=y+1;for(E(t,y,m,p,_),E(e,y,g,v,_),d=0;d<u;d++){var x=m[d]===_?p[d]:l,b=g[d]===_?v[d]:l;f[d][y]=c(x,b)}}return new T({data:f,size:[u,h],datatype:s})};function E(t,e,r,n,i){for(var o=t._values,a=t._index,s=t._ptr,u=s[e],h=s[e+1];u<h;u++){var l=a[u];r[l]=i,n[l]=o[u]}}});var cp=Wf("identity",["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],function(t){var e=t.typed,r=t.config,n=t.matrix,l=t.BigNumber,c=t.DenseMatrix,f=t.SparseMatrix;return e("identity",{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(t){return n(t)},"number | BigNumber":function(t){return o(t,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(t,e){return o(t,t,e)},"number | BigNumber, number | BigNumber":function(t,e){return o(t,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":o,Array:function(t){return i(t)},"Array, string":i,Matrix:function(t){return i(t.valueOf(),t.storage())},"Matrix, string":function(t,e){return i(t.valueOf(),e)}});function i(t,e){switch(t.length){case 0:return e?n(e):[];case 1:return o(t[0],t[0],e);case 2:return o(t[0],t[1],e);default:throw new Error("Vector containing two values expected")}}function o(t,e,r){var n=Pc(t)||Pc(e)?l:null;if(Pc(t)&&(t=t.toNumber()),Pc(e)&&(e=e.toNumber()),!Ef(t)||t<1)throw new Error("Parameters in function identity must be positive integers");if(!Ef(e)||e<1)throw new Error("Parameters in function identity must be positive integers");var i=n?new l(1):1,o=n?new n(0):0,a=[t,e];if(r){if("sparse"===r)return f.diagonal(a,i,0,o);if("dense"===r)return c.diagonal(a,i,0,o);throw new TypeError('Unknown matrix type "'.concat(r,'"'))}for(var s=Hf([],a,o),u=t<e?t:e,h=0;h<u;h++)s[h][h]=i;return s}});function fp(){throw new Error('No "bignumber" implementation available')}function dp(){throw new Error('No "fraction" implementation available')}function pp(){throw new Error('No "matrix" implementation available')}var vp=Wf("size",["typed","config","?matrix"],function(t){var e=t.typed,r=t.config,n=t.matrix;return e("size",{Matrix:function(t){return t.create(t.size())},Array:Uf,string:function(t){return"Array"===r.matrix?[t.length]:n([t.length])},"number | Complex | BigNumber | Unit | boolean | null":function(){return"Array"===r.matrix?[]:n?n([]):pp()}})});var mp=Wf("zeros",["typed","config","matrix","BigNumber"],function(t){var e=t.typed,r=t.config,a=t.matrix,s=t.BigNumber;return e("zeros",{"":function(){return"Array"===r.matrix?n([]):n([],"default")},"...number | BigNumber | string":function(t){if("string"!=typeof t[t.length-1])return"Array"===r.matrix?n(t):n(t,"default");var e=t.pop();return n(t,e)},Array:n,Matrix:function(t){var e=t.storage();return n(t.valueOf(),e)},"Array | Matrix, string":function(t,e){return n(t.valueOf(),e)}});function n(t,e){var n,r=(n=!1,t.forEach(function(t,e,r){Pc(t)&&(n=!0,r[e]=t.toNumber())}),n)?new s(0):0;if(t.forEach(function(t){if("number"!=typeof t||!Ef(t)||t<0)throw new Error("Parameters in function zeros must be positive integers")}),e){var i=a(e);return 0<t.length?i.resize(t,r):i}var o=[];return 0<t.length?Hf(o,t,r):o}});function gp(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function yp(i){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?gp(Object(o),!0).forEach(function(t){var e,r,n;e=i,n=o[r=t],r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(o)):gp(Object(o)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(o,t))})}return i}var _p="Number of decimals in function round must be an integer",xp="round",bp=Wf(xp,["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],function(t){var e=t.typed,r=t.matrix,n=t.equalScalar,i=t.zeros,o=t.BigNumber,a=t.DenseMatrix,s=up({typed:e,equalScalar:n}),u=hp({typed:e,DenseMatrix:a}),h=ip({typed:e}),l=e(xp,yp(yp({},wp),{},{Complex:function(t){return t.round()},"Complex, number":function(t,e){if(e%1)throw new TypeError(_p);return t.round(e)},"Complex, BigNumber":function(t,e){if(!e.isInteger())throw new TypeError(_p);var r=e.toNumber();return t.round(r)},"number, BigNumber":function(t,e){if(!e.isInteger())throw new TypeError(_p);return new o(t).toDecimalPlaces(e.toNumber())},BigNumber:function(t){return t.toDecimalPlaces(0)},"BigNumber, BigNumber":function(t,e){if(!e.isInteger())throw new TypeError(_p);return t.toDecimalPlaces(e.toNumber())},Fraction:function(t){return t.round()},"Fraction, number":function(t,e){if(e%1)throw new TypeError(_p);return t.round(e)},"Array | Matrix":function(t){return Ed(t,l,!0)},"SparseMatrix, number | BigNumber":function(t,e){return s(t,e,l,!1)},"DenseMatrix, number | BigNumber":function(t,e){return h(t,e,l,!1)},"number | Complex | BigNumber, SparseMatrix":function(t,e){return n(t,0)?i(e.size(),e.storage()):u(e,t,l,!0)},"number | Complex | BigNumber, DenseMatrix":function(t,e){return n(t,0)?i(e.size(),e.storage()):h(e,t,l,!0)},"Array, number | BigNumber":function(t,e){return h(r(t),e,l,!1).valueOf()},"number | Complex | BigNumber, Array":function(t,e){return h(r(e),t,l,!0).valueOf()}}));return l}),wp={number:Ud,"number, number":function(t,e){if(!Ef(e))throw new TypeError(_p);if(e<0||15<e)throw new Error("Number of decimals in function round must be in te range of 0-15");return Ud(t,e)}},Tp="smaller",Ep=Wf(Tp,["typed","config","matrix","DenseMatrix"],function(t){var e=t.typed,r=t.config,n=t.matrix,i=t.DenseMatrix,o=ap({typed:e}),a=lp({typed:e,DenseMatrix:i}),s=hp({typed:e,DenseMatrix:i}),u=np({typed:e}),h=ip({typed:e}),l=e(Tp,{"boolean, boolean":function(t,e){return t<e},"number, number":function(t,e){return t<e&&!Nf(t,e,r.epsilon)},"BigNumber, BigNumber":function(t,e){return t.lt(e)&&!Md(t,e,r.epsilon)},"Fraction, Fraction":function(t,e){return-1===t.compare(e)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(t,e){if(!t.equalBase(e))throw new Error("Cannot compare units with different base");return l(t.value,e.value)},"SparseMatrix, SparseMatrix":function(t,e){return a(t,e,l)},"SparseMatrix, DenseMatrix":function(t,e){return o(e,t,l,!0)},"DenseMatrix, SparseMatrix":function(t,e){return o(t,e,l,!1)},"DenseMatrix, DenseMatrix":function(t,e){return u(t,e,l)},"Array, Array":function(t,e){return l(n(t),n(e)).valueOf()},"Array, Matrix":function(t,e){return l(n(t),e)},"Matrix, Array":function(t,e){return l(t,n(e))},"SparseMatrix, any":function(t,e){return s(t,e,l,!1)},"DenseMatrix, any":function(t,e){return h(t,e,l,!1)},"any, SparseMatrix":function(t,e){return s(e,t,l,!0)},"any, DenseMatrix":function(t,e){return h(e,t,l,!0)},"Array, any":function(t,e){return h(n(t),e,l,!1).valueOf()},"any, Array":function(t,e){return h(n(e),t,l,!0).valueOf()}});return l}),Ap="larger",Sp=Wf(Ap,["typed","config","matrix","DenseMatrix"],function(t){var e=t.typed,r=t.config,n=t.matrix,i=t.DenseMatrix,o=ap({typed:e}),a=lp({typed:e,DenseMatrix:i}),s=hp({typed:e,DenseMatrix:i}),u=np({typed:e}),h=ip({typed:e}),l=e(Ap,{"boolean, boolean":function(t,e){return e<t},"number, number":function(t,e){return e<t&&!Nf(t,e,r.epsilon)},"BigNumber, BigNumber":function(t,e){return t.gt(e)&&!Md(t,e,r.epsilon)},"Fraction, Fraction":function(t,e){return 1===t.compare(e)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(t,e){if(!t.equalBase(e))throw new Error("Cannot compare units with different base");return l(t.value,e.value)},"SparseMatrix, SparseMatrix":function(t,e){return a(t,e,l)},"SparseMatrix, DenseMatrix":function(t,e){return o(e,t,l,!0)},"DenseMatrix, SparseMatrix":function(t,e){return o(t,e,l,!1)},"DenseMatrix, DenseMatrix":function(t,e){return u(t,e,l)},"Array, Array":function(t,e){return l(n(t),n(e)).valueOf()},"Array, Matrix":function(t,e){return l(n(t),e)},"Matrix, Array":function(t,e){return l(t,n(e))},"SparseMatrix, any":function(t,e){return s(t,e,l,!1)},"DenseMatrix, any":function(t,e){return h(t,e,l,!1)},"any, SparseMatrix":function(t,e){return s(e,t,l,!0)},"any, DenseMatrix":function(t,e){return h(e,t,l,!0)},"Array, any":function(t,e){return h(n(t),e,l,!1).valueOf()},"any, Array":function(t,e){return h(n(e),t,l,!0).valueOf()}});return l}),Op="unequal",Mp=(Wf(Op,["typed","equalScalar"],function(t){var e=t.typed,r=t.equalScalar;return e(Op,{"any, any":function(t,e){return null===t?null!==e:null===e?null!==t:void 0===t?void 0!==e:void 0===e?void 0!==t:!r(t,e)}})}),Wf("FibonacciHeap",["smaller","larger"],function(t){var c=t.smaller,f=t.larger,d=1/Math.log((1+Math.sqrt(5))/2);function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function i(t,e,r){e.left.right=e.right,e.right.left=e.left,r.degree--,r.child===e&&(r.child=e.right),0===r.degree&&(r.child=null),e.left=t,e.right=t.right,((t.right=e).right.left=e).parent=null,e.mark=!1}e.prototype.type="FibonacciHeap",e.prototype.isFibonacciHeap=!0,e.prototype.insert=function(t,e){var r,n={key:t,value:e,degree:0};return this._minimum?(r=this._minimum,n.left=r,n.right=r.right,(r.right=n).right.left=n,c(t,r.key)&&(this._minimum=n)):((n.left=n).right=n,this._minimum=n),this._size++,n},e.prototype.size=function(){return this._size},e.prototype.clear=function(){this._minimum=null,this._size=0},e.prototype.isEmpty=function(){return 0===this._size},e.prototype.extractMinimum=function(){var t=this._minimum;if(null===t)return t;for(var e=this._minimum,r=t.degree,n=t.child;0<r;){var i=n.right;n.left.right=n.right,n.right.left=n.left,n.left=e,n.right=e.right,((e.right=n).right.left=n).parent=null,n=i,r--}return t.left.right=t.right,t.right.left=t.left,e=t===t.right?null:function(t,e){var r,n=Math.floor(Math.log(e)*d)+1,i=new Array(n),o=0,a=t;if(a)for(o++,a=a.right;a!==t;)o++,a=a.right;for(;0<o;){for(var s,u=a.degree,h=a.right;r=i[u];){f(a.key,r.key)&&(s=r,r=a,a=s),p(r,a),i[u]=null,u++}i[u]=a,a=h,o--}t=null;for(var l=0;l<n;l++)(r=i[l])&&(t?(r.left.right=r.right,r.right.left=r.left,r.left=t,r.right=t.right,(t.right=r).right.left=r,c(r.key,t.key)&&(t=r)):t=r);return t}(e=t.right,this._size),this._size--,this._minimum=e,t},e.prototype.remove=function(t){this._minimum=function(t,e,r){e.key=r;var n=e.parent;n&&c(e.key,n.key)&&(i(t,e,n),function t(e,r){var n=r.parent;if(!n)return;r.mark?(i(e,r,n),t(n)):r.mark=!0}(t,n));c(e.key,t.key)&&(t=e);return t}(this._minimum,t,-1),this.extractMinimum()};var p=function(t,e){t.left.right=t.right,t.right.left=t.left,(t.parent=e).child?(t.left=e.child,t.right=e.child.right,(e.child.right=t).right.left=t):((e.child=t).right=t).left=t,e.degree++,t.mark=!1};return e},{isClass:!0})),Pp=Wf("algorithm09",["typed","equalScalar"],function(t){var N=t.typed,D=t.equalScalar;return function(t,e,r){var n=t._values,i=t._index,o=t._ptr,a=t._size,s=t._datatype,u=e._values,h=e._index,l=e._ptr,c=e._size,f=e._datatype;if(a.length!==c.length)throw new kf(a.length,c.length);if(a[0]!==c[0]||a[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");var d,p=a[0],v=a[1],m=D,g=0,y=r;"string"==typeof s&&s===f&&(d=s,m=N.find(D,[d,d]),g=N.convert(0,d),y=N.find(r,[d,d]));for(var _,x,b,w=n&&u?[]:void 0,T=[],E=[],A=w?[]:void 0,S=[],O=0;O<v;O++){E[O]=T.length;var M=O+1;if(A)for(x=l[O],b=l[O+1],_=x;_<b;_++)S[I=h[_]]=M,A[I]=u[_];for(x=o[O],b=o[O+1],_=x;_<b;_++){var P,C,I=i[_];A?(P=S[I]===M?A[I]:g,m(C=y(n[_],P),g)||(T.push(I),w.push(C))):T.push(I)}}return E[v]=T.length,t.createSparseMatrix({values:w,index:T,ptr:E,size:[p,v],datatype:d})}}),Cp=Wf("atan2",["typed","matrix","equalScalar","BigNumber","DenseMatrix"],function(t){var e=t.typed,r=t.matrix,n=t.equalScalar,i=t.BigNumber,o=t.DenseMatrix,a=op({typed:e,equalScalar:n}),s=ap({typed:e}),u=Pp({typed:e,equalScalar:n}),h=up({typed:e,equalScalar:n}),l=hp({typed:e,DenseMatrix:o}),c=np({typed:e}),f=ip({typed:e}),d=e("atan2",{"number, number":Math.atan2,"BigNumber, BigNumber":function(t,e){return i.atan2(t,e)},"SparseMatrix, SparseMatrix":function(t,e){return u(t,e,d,!1)},"SparseMatrix, DenseMatrix":function(t,e){return a(e,t,d,!0)},"DenseMatrix, SparseMatrix":function(t,e){return s(t,e,d,!1)},"DenseMatrix, DenseMatrix":function(t,e){return c(t,e,d)},"Array, Array":function(t,e){return d(r(t),r(e)).valueOf()},"Array, Matrix":function(t,e){return d(r(t),e)},"Matrix, Array":function(t,e){return d(t,r(e))},"SparseMatrix, number | BigNumber":function(t,e){return h(t,e,d,!1)},"DenseMatrix, number | BigNumber":function(t,e){return f(t,e,d,!1)},"number | BigNumber, SparseMatrix":function(t,e){return l(e,t,d,!0)},"number | BigNumber, DenseMatrix":function(t,e){return f(e,t,d,!0)},"Array, number | BigNumber":function(t,e){return f(r(t),e,d,!1).valueOf()},"number | BigNumber, Array":function(t,e){return f(r(e),t,d,!0).valueOf()}});return d}),Ip=Wf("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix"],function(t){var e=t.typed,r=t.matrix,n=t.addScalar,i=t.equalScalar,o=t.DenseMatrix,a=(t.SparseMatrix,tp({typed:e})),s=ep({typed:e,equalScalar:i}),u=rp({typed:e,DenseMatrix:o}),h=np({typed:e}),l=ip({typed:e}),c=e("add",gf({"DenseMatrix, DenseMatrix":function(t,e){return h(t,e,n)},"DenseMatrix, SparseMatrix":function(t,e){return a(t,e,n,!1)},"SparseMatrix, DenseMatrix":function(t,e){return a(e,t,n,!0)},"SparseMatrix, SparseMatrix":function(t,e){return s(t,e,n)},"Array, Array":function(t,e){return c(r(t),r(e)).valueOf()},"Array, Matrix":function(t,e){return c(r(t),e)},"Matrix, Array":function(t,e){return c(t,r(e))},"DenseMatrix, any":function(t,e){return l(t,e,n,!1)},"SparseMatrix, any":function(t,e){return u(t,e,n,!1)},"any, DenseMatrix":function(t,e){return l(e,t,n,!0)},"any, SparseMatrix":function(t,e){return u(e,t,n,!0)},"Array, any":function(t,e){return l(r(t),e,n,!1).valueOf()},"any, Array":function(t,e){return l(r(e),t,n,!0).valueOf()},"any, any":n,"any, any, ...any":function(t,e,r){for(var n=c(t,e),i=0;i<r.length;i++)n=c(n,r[i]);return n}},n.signatures));return c}),Np=Wf("dot",["typed","addScalar","multiplyScalar","conj","size"],function(t){var x=t.typed,b=t.addScalar,w=t.multiplyScalar,T=t.conj,e=t.size;return x("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(t,e){var r=E(t,e),n=Fc(t)?t._data:t,i=Fc(t)?t._datatype:void 0,o=Fc(e)?e._data:e,a=Fc(e)?e._datatype:void 0,s=2===A(t).length,u=2===A(e).length,h=b,l=w;{var c;i&&a&&i===a&&"string"==typeof i&&(c=i,h=x.find(b,[c,c]),l=x.find(w,[c,c]))}if(!s&&!u){for(var f=l(T(n[0]),o[0]),d=1;d<r;d++)f=h(f,l(T(n[d]),o[d]));return f}if(!s&&u){for(var p=l(T(n[0]),o[0][0]),v=1;v<r;v++)p=h(p,l(T(n[v]),o[v][0]));return p}if(s&&!u){for(var m=l(T(n[0][0]),o[0]),g=1;g<r;g++)m=h(m,l(T(n[g][0]),o[g]));return m}if(s&&u){for(var y=l(T(n[0][0]),o[0][0]),_=1;_<r;_++)y=h(y,l(T(n[_][0]),o[_][0]));return y}},"SparseMatrix, SparseMatrix":function(t,e){E(t,e);var r=t._index,n=t._values,i=e._index,o=e._values,a=0,s=b,u=w,h=0,l=0;for(;h<r.length&&l<i.length;){var c=r[h],f=i[l];c<f?h++:f<c?l++:c===f&&(a=s(a,u(n[h],o[l])),h++,l++)}return a}});function E(t,e){var r,n,i=A(t),o=A(e);if(1===i.length)r=i[0];else{if(2!==i.length||1!==i[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");r=i[0]}if(1===o.length)n=o[0];else{if(2!==o.length||1!==o[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+o.join(", ")+")");n=o[0]}if(r!==n)throw new RangeError("Vectors must have equal length ("+r+" != "+n+")");if(0===r)throw new RangeError("Cannot calculate the dot product of empty vectors");return r}function A(t){return Fc(t)?t.size():e(t)}}),Dp=Wf("abs",["typed"],function(t){var e=(0,t.typed)("abs",{number:Rd,Complex:function(t){return t.abs()},BigNumber:function(t){return t.abs()},Fraction:function(t){return t.abs()},"Array | Matrix":function(t){return Ed(t,e,!0)},Unit:function(t){return t.abs()}});return e}),Rp=Wf("floor",["typed","config","round"],function(t){var e=t.typed,r=t.config,n=t.round,i=e("floor",{number:function(t){return Nf(t,n(t),r.epsilon)?n(t):Math.floor(t)},Complex:function(t){return t.floor()},BigNumber:function(t){return Md(t,n(t),r.epsilon)?n(t):t.floor()},Fraction:function(t){return t.floor()},"Array | Matrix":function(t){return Ed(t,i,!0)}});return i}),Fp=Wf("multiply",["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],function(t){var L=t.typed,n=t.matrix,k=t.addScalar,B=t.multiplyScalar,R=t.equalScalar,i=t.dot,r=up({typed:L,equalScalar:R}),o=ip({typed:L}),a=L("multiply",gf({"Array, Array":function(t,e){s(Uf(t),Uf(e));var r=a(n(t),n(e));return Fc(r)?r.valueOf():r},"Matrix, Matrix":function(t,e){var r=t.size(),n=e.size();return s(r,n),1===r.length?1===n.length?function(t,e,r){if(0!==r)return i(t,e);throw new Error("Cannot multiply two empty vectors")}(t,e,r[0]):function(t,e){if("dense"===e.storage())return function(t,e){var r,n=t._data,i=t._size,o=t._datatype,a=e._data,s=e._size,u=e._datatype,h=i[0],l=s[1],c=k,f=B;o&&u&&o===u&&"string"==typeof o&&(r=o,c=L.find(k,[r,r]),f=L.find(B,[r,r]));for(var d=[],p=0;p<l;p++){for(var v=f(n[0],a[0][p]),m=1;m<h;m++)v=c(v,f(n[m],a[m][p]));d[p]=v}return t.createDenseMatrix({data:d,size:[l],datatype:r})}(t,e);throw new Error("Support for SparseMatrix not implemented")}(t,e):(1===n.length?u:h)(t,e)},"Matrix, Array":function(t,e){return a(t,n(e))},"Array, Matrix":function(t,e){return a(n(t,e.storage()),e)},"SparseMatrix, any":function(t,e){return r(t,e,B,!1)},"DenseMatrix, any":function(t,e){return o(t,e,B,!1)},"any, SparseMatrix":function(t,e){return r(e,t,B,!0)},"any, DenseMatrix":function(t,e){return o(e,t,B,!0)},"Array, any":function(t,e){return o(n(t),e,B,!1).valueOf()},"any, Array":function(t,e){return o(n(e),t,B,!0).valueOf()},"any, any":B,"any, any, ...any":function(t,e,r){for(var n=a(t,e),i=0;i<r.length;i++)n=a(n,r[i]);return n}},B.signatures));function s(t,e){switch(t.length){case 1:switch(e.length){case 1:if(t[0]!==e[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(t[0]!==e[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+t[0]+") must match Matrix rows ("+e[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+e.length+" dimensions)")}break;case 2:switch(e.length){case 1:if(t[1]!==e[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+t[1]+") must match Vector length ("+e[0]+")");break;case 2:if(t[1]!==e[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+t[1]+") must match Matrix B rows ("+e[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+e.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+t.length+" dimensions)")}}var u=L("_multiplyMatrixVector",{"DenseMatrix, any":function(t,e){var r,n=t._data,i=t._size,o=t._datatype,a=e._data,s=e._datatype,u=i[0],h=i[1],l=k,c=B;o&&s&&o===s&&"string"==typeof o&&(r=o,l=L.find(k,[r,r]),c=L.find(B,[r,r]));for(var f=[],d=0;d<u;d++){for(var p=n[d],v=c(p[0],a[0]),m=1;m<h;m++)v=l(v,c(p[m],a[m]));f[d]=v}return t.createDenseMatrix({data:f,size:[u],datatype:r})},"SparseMatrix, any":function(t,e){var r=t._values,n=t._index,i=t._ptr,o=t._datatype;if(!r)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var a,s=e._data,u=e._datatype,h=t._size[0],l=e._size[0],c=[],f=[],d=[],p=k,v=B,m=R,g=0;o&&u&&o===u&&"string"==typeof o&&(a=o,p=L.find(k,[a,a]),v=L.find(B,[a,a]),m=L.find(R,[a,a]),g=L.convert(0,a));for(var y=[],_=[],x=d[0]=0;x<l;x++){var b=s[x];if(!m(b,g))for(var w=i[x],T=i[x+1],E=w;E<T;E++){var A=n[E];_[A]?y[A]=p(y[A],v(b,r[E])):(_[A]=!0,f.push(A),y[A]=v(b,r[E]))}}for(var S=f.length,O=0;O<S;O++){var M=f[O];c[O]=y[M]}return d[1]=f.length,t.createSparseMatrix({values:c,index:f,ptr:d,size:[h,1],datatype:a})}}),h=L("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(t,e){var r,n=t._data,i=t._size,o=t._datatype,a=e._data,s=e._size,u=e._datatype,h=i[0],l=i[1],c=s[1],f=k,d=B;o&&u&&o===u&&"string"==typeof o&&(r=o,f=L.find(k,[r,r]),d=L.find(B,[r,r]));for(var p=[],v=0;v<h;v++){var m=n[v];p[v]=[];for(var g=0;g<c;g++){for(var y=d(m[0],a[0][g]),_=1;_<l;_++)y=f(y,d(m[_],a[_][g]));p[v][g]=y}}return t.createDenseMatrix({data:p,size:[h,c],datatype:r})},"DenseMatrix, SparseMatrix":function(t,e){var r=t._data,n=t._size,i=t._datatype,o=e._values,a=e._index,s=e._ptr,u=e._size,h=e._datatype;if(!o)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var l,c=n[0],f=u[1],d=k,p=B,v=R,m=0;i&&h&&i===h&&"string"==typeof i&&(l=i,d=L.find(k,[l,l]),p=L.find(B,[l,l]),v=L.find(R,[l,l]),m=L.convert(0,l));for(var g=[],y=[],_=[],x=e.createSparseMatrix({values:g,index:y,ptr:_,size:[c,f],datatype:l}),b=0;b<f;b++){_[b]=y.length;var w=s[b],T=s[b+1];if(w<T)for(var E=0,A=0;A<c;A++){for(var S=A+1,O=void 0,M=w;M<T;M++){var P=a[M];E!==S?(O=p(r[A][P],o[M]),E=S):O=d(O,p(r[A][P],o[M]))}E!==S||v(O,m)||(y.push(A),g.push(O))}}return _[f]=y.length,x},"SparseMatrix, DenseMatrix":function(t,e){var r=t._values,n=t._index,i=t._ptr,o=t._datatype;if(!r)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var a,s=e._data,u=e._datatype,h=t._size[0],l=e._size[0],c=e._size[1],f=k,d=B,p=R,v=0;o&&u&&o===u&&"string"==typeof o&&(a=o,f=L.find(k,[a,a]),d=L.find(B,[a,a]),p=L.find(R,[a,a]),v=L.convert(0,a));for(var m=[],g=[],y=[],_=t.createSparseMatrix({values:m,index:g,ptr:y,size:[h,c],datatype:a}),x=[],b=[],w=0;w<c;w++){y[w]=g.length;for(var T=w+1,E=0;E<l;E++){var A=s[E][w];if(!p(A,v))for(var S=i[E],O=i[E+1],M=S;M<O;M++){var P=n[M];b[P]!==T?(b[P]=T,g.push(P),x[P]=d(A,r[M])):x[P]=f(x[P],d(A,r[M]))}}for(var C=y[w],I=g.length,N=C;N<I;N++){var D=g[N];m[N]=x[D]}}return y[c]=g.length,_},"SparseMatrix, SparseMatrix":function(t,e){var r,n=t._values,i=t._index,o=t._ptr,a=t._datatype,s=e._values,u=e._index,h=e._ptr,l=e._datatype,c=t._size[0],f=e._size[1],d=n&&s,p=k,v=B;a&&l&&a===l&&"string"==typeof a&&(r=a,p=L.find(k,[r,r]),v=L.find(B,[r,r]));for(var m,g,y,_,x,b,w,T,E=d?[]:void 0,A=[],S=[],O=t.createSparseMatrix({values:E,index:A,ptr:S,size:[c,f],datatype:r}),M=d?[]:void 0,P=[],C=0;C<f;C++){S[C]=A.length;var I=C+1;for(x=h[C],b=h[C+1],_=x;_<b;_++)if(T=u[_],d)for(g=o[T],y=o[T+1],m=g;m<y;m++)w=i[m],P[w]!==I?(P[w]=I,A.push(w),M[w]=v(s[_],n[m])):M[w]=p(M[w],v(s[_],n[m]));else for(g=o[T],y=o[T+1],m=g;m<y;m++)w=i[m],P[w]!==I&&(P[w]=I,A.push(w));if(d)for(var N=S[C],D=A.length,R=N;R<D;R++){var F=A[R];E[R]=M[F]}}return S[f]=A.length,O}});return a});(new Error).constructor=Error;var Lp=Wf("pow",["typed","config","identity","multiply","matrix","fraction","number","Complex"],function(t){var e=t.typed,i=t.config,o=t.identity,a=t.multiply,r=t.matrix,s=t.number,u=t.fraction,h=t.Complex;return e("pow",{"number, number":n,"Complex, Complex":function(t,e){return t.pow(e)},"BigNumber, BigNumber":function(t,e){return e.isInteger()||0<=t||i.predictable?t.pow(e):new h(t.toNumber(),0).pow(e.toNumber(),0)},"Fraction, Fraction":function(t,e){if(1===e.d)return t.pow(e);if(i.predictable)throw new Error("Function pow does not support non-integer exponents for fractions.");return n(t.valueOf(),e.valueOf())},"Array, number":l,"Array, BigNumber":function(t,e){return l(t,e.toNumber())},"Matrix, number":c,"Matrix, BigNumber":function(t,e){return c(t,e.toNumber())},"Unit, number | BigNumber":function(t,e){return t.pow(e)}});function n(t,e){if(i.predictable&&!Ef(e)&&t<0)try{var r=u(e),n=s(r);if((e===n||Math.abs((e-n)/e)<1e-14)&&r.d%2==1)return(r.n%2==0?1:-1)*Math.pow(-t,e)}catch(t){}return i.predictable&&(t<-1&&e===1/0||-1<t&&t<0&&e===-1/0)?NaN:Ef(e)||0<=t||i.predictable?Bd(t,e):t*t<1&&e===1/0||1<t*t&&e===-1/0?0:new h(t,0).pow(e,0)}function l(t,e){if(!Ef(e)||e<0)throw new TypeError("For A^b, b must be a positive integer (value is "+e+")");var r=Uf(t);if(2!==r.length)throw new Error("For A^b, A must be 2 dimensional (A has "+r.length+" dimensions)");if(r[0]!==r[1])throw new Error("For A^b, A must be square (size is "+r[0]+"x"+r[1]+")");for(var n=o(r[0]).valueOf(),i=t;1<=e;)1==(1&e)&&(n=a(i,n)),e>>=1,i=a(i,i);return n}function c(t,e){return r(l(t.valueOf(),e))}});r(4);var kp=Wf("bignumber",["typed","BigNumber"],function(t){var e=t.typed,r=t.BigNumber,n=e("bignumber",{"":function(){return new r(0)},number:function(t){return new r(t+"")},string:function(t){return new r(t)},BigNumber:function(t){return t},Fraction:function(t){return new r(t.n).div(t.d).times(t.s)},null:function(){return new r(0)},"Array | Matrix":function(t){return Ed(t,n)}});return n}),Bp=Wf("numeric",["number","?bignumber","?fraction"],function(t){var e=t.number,r=t.bignumber,n=t.fraction,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:function(t){return e(t)},BigNumber:r?function(t){return r(t)}:fp,Fraction:n?function(t){return n(t)}:dp};return function(t,e){var r=df(t);if(!(r in i))throw new TypeError("Cannot convert "+t+' of type "'+r+'"; valid input types are '+Object.keys(i).join(", "));if(!(e in o))throw new TypeError("Cannot convert "+t+' to type "'+e+'"; valid output types are '+Object.keys(o).join(", "));return e===r?t:o[e](t)}});function Up(t,e,r){var n;return-1!==String(t).indexOf("Unexpected type")?(n=2<arguments.length?" (type: "+df(r)+", value: "+JSON.stringify(r)+")":" (type: "+t.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+n)):-1!==String(t).indexOf("complex numbers")?(n=2<arguments.length?" (type: "+df(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+n)):t}var jp=Wf("min",["typed","config","numeric","smaller"],function(t){var e=t.typed,n=t.config,i=t.numeric,o=t.smaller;return e("min",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(t,e){return Ad(t,e.valueOf(),r)},"...":function(t){if(wd(t))throw new TypeError("Scalar values expected in function min");return a(t)}});function r(t,e){try{return o(t,e)?t:e}catch(t){throw Up(t,"min",e)}}function a(t){var r;if(Td(t,function(e){try{isNaN(e)&&"number"==typeof e?r=NaN:void 0!==r&&!o(e,r)||(r=e)}catch(t){throw Up(t,"min",e)}}),void 0===r)throw new Error("Cannot calculate min of an empty array");return"string"==typeof r&&(r=i(r,n.number)),r}});var zp=Wf("subtract",["typed","matrix","equalScalar","addScalar","unaryMinus","DenseMatrix"],function(t){var e=t.typed,r=t.matrix,n=t.equalScalar,i=t.addScalar,o=t.unaryMinus,a=t.DenseMatrix,s=tp({typed:e}),u=ap({typed:e}),h=sp({typed:e,equalScalar:n}),l=rp({typed:e,DenseMatrix:a}),c=np({typed:e}),f=ip({typed:e}),d=e("subtract",{"number, number":function(t,e){return t-e},"Complex, Complex":function(t,e){return t.sub(e)},"BigNumber, BigNumber":function(t,e){return t.minus(e)},"Fraction, Fraction":function(t,e){return t.sub(e)},"Unit, Unit":function(t,e){if(null===t.value)throw new Error("Parameter x contains a unit with undefined value");if(null===e.value)throw new Error("Parameter y contains a unit with undefined value");if(!t.equalBase(e))throw new Error("Units do not match");var r=t.clone();return r.value=d(r.value,e.value),r.fixPrefix=!1,r},"SparseMatrix, SparseMatrix":function(t,e){return Hp(t,e),h(t,e,d)},"SparseMatrix, DenseMatrix":function(t,e){return Hp(t,e),u(e,t,d,!0)},"DenseMatrix, SparseMatrix":function(t,e){return Hp(t,e),s(t,e,d,!1)},"DenseMatrix, DenseMatrix":function(t,e){return Hp(t,e),c(t,e,d)},"Array, Array":function(t,e){return d(r(t),r(e)).valueOf()},"Array, Matrix":function(t,e){return d(r(t),e)},"Matrix, Array":function(t,e){return d(t,r(e))},"SparseMatrix, any":function(t,e){return l(t,o(e),i)},"DenseMatrix, any":function(t,e){return f(t,e,d)},"any, SparseMatrix":function(t,e){return l(e,t,d,!0)},"any, DenseMatrix":function(t,e){return f(e,t,d,!0)},"Array, any":function(t,e){return f(r(t),e,d,!1).valueOf()},"any, Array":function(t,e){return f(r(e),t,d,!0).valueOf()}});return d});function Hp(t,e){var r=t.size(),n=e.size();if(r.length!==n.length)throw new kf(r.length,n.length)}var Gp="divideScalar",Xp=Wf(Gp,["typed","numeric"],function(t){var e=t.typed,i=t.numeric,o=e(Gp,{"number, number":function(t,e){return t/e},"Complex, Complex":function(t,e){return t.div(e)},"BigNumber, BigNumber":function(t,e){return t.div(e)},"Fraction, Fraction":function(t,e){return t.div(e)},"Unit, number | Fraction | BigNumber":function(t,e){var r=t.clone(),n=i(1,df(e));return r.value=o(null===r.value?r._normalize(n):r.value,e),r},"number | Fraction | BigNumber, Unit":function(t,e){var r=(r=e.clone()).pow(-1),n=i(1,df(t));return r.value=o(t,null===e.value?e._normalize(n):e.value),r},"Unit, Unit":function(t,e){return t.divide(e)}});return o});var Vp="equal",Yp=(Wf(Vp,["typed","equalScalar"],function(t){var e=t.typed,r=t.equalScalar;return e(Vp,{"any, any":function(t,e){return null===t?null===e:null===e?null===t:void 0===t?void 0===e:void 0===e?void 0===t:r(t,e)}})}),Wf("max",["typed","config","numeric","larger"],function(t){var e=t.typed,n=t.config,i=t.numeric,o=t.larger;return e("max",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(t,e){return Ad(t,e.valueOf(),r)},"...":function(t){if(wd(t))throw new TypeError("Scalar values expected in function max");return a(t)}});function r(t,e){try{return o(t,e)?t:e}catch(t){throw Up(t,"max",e)}}function a(t){var r;if(Td(t,function(e){try{isNaN(e)&&"number"==typeof e?r=NaN:void 0!==r&&!o(e,r)||(r=e)}catch(t){throw Up(t,"max",e)}}),void 0===r)throw new Error("Cannot calculate max of an empty array");return"string"==typeof r&&(r=i(r,n.number)),r}}));var Wp=Wf("Spa",["addScalar","equalScalar","FibonacciHeap"],function(t){var n=t.addScalar,h=t.equalScalar,e=t.FibonacciHeap;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new e}return r.prototype.type="Spa",r.prototype.isSpa=!0,r.prototype.set=function(t,e){var r;this._values[t]?this._values[t].value=e:(r=this._heap.insert(t,e),this._values[t]=r)},r.prototype.get=function(t){var e=this._values[t];return e?e.value:0},r.prototype.accumulate=function(t,e){var r=this._values[t];r?r.value=n(r.value,e):(r=this._heap.insert(t,e),this._values[t]=r)},r.prototype.forEach=function(t,e,r){var n=this._heap,i=this._values,o=[];for((s=n.extractMinimum())&&o.push(s);s&&s.key<=e;)s.key>=t&&(h(s.value,0)||r(s.key,s.value,this)),(s=n.extractMinimum())&&o.push(s);for(var a=0;a<o.length;a++){var s,u=o[a];i[(s=n.insert(u.key,u.value)).key]=s}},r.prototype.swap=function(t,e){var r,n=this._values[t],i=this._values[e];!n&&i?(n=this._heap.insert(t,i.value),this._heap.remove(i),this._values[t]=n,this._values[e]=void 0):n&&!i?(i=this._heap.insert(e,n.value),this._heap.remove(n),this._values[e]=i,this._values[t]=void 0):n&&i&&(r=n.value,n.value=i.value,i.value=r)},r},{isClass:!0}),qp=Wf("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtract","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],function(t){var e=t.typed,r=t.matrix,O=t.abs,E=t.addScalar,M=t.divideScalar,P=t.multiplyScalar,A=t.subtract,C=t.larger,I=t.equalScalar,N=t.unaryMinus,S=t.DenseMatrix,D=t.SparseMatrix,R=t.Spa;return e("lup",{DenseMatrix:n,SparseMatrix:function(t){var l,c,f,d=t._size[0],e=t._size[1],r=Math.min(d,e),p=t._values,v=t._index,m=t._ptr,g=[],y=[],_=[],x=[d,r],b=[],w=[],T=[],E=[r,e],A=[],S=[];for(l=0;l<d;l++)A[l]=l,S[l]=l;function n(){var i=new R;c<d&&(_.push(g.length),g.push(1),y.push(c)),T.push(b.length);var t=m[c],e=m[c+1];for(f=t;f<e;f++)l=v[f],i.set(A[l],p[f]);0<c&&i.forEach(0,c-1,function(r,n){D._forEachRow(r,g,y,_,function(t,e){r<t&&i.accumulate(t,N(P(e,n)))})});var r,n,o,a,s=c,u=i.get(c),h=O(u);i.forEach(c+1,d-1,function(t,e){var r=O(e);C(r,h)&&(s=t,h=r,u=e)}),c!==s&&(D._swapRows(c,s,x[1],g,y,_),D._swapRows(c,s,E[1],b,w,T),i.swap(c,s),n=s,o=S[r=c],a=S[n],A[o]=n,A[a]=r,S[r]=a,S[n]=o),i.forEach(0,d-1,function(t,e){t<=c?(b.push(e),w.push(t)):(e=M(e,u),I(e,0)||(g.push(e),y.push(t)))})}for(c=0;c<e;c++)n();return T.push(b.length),_.push(g.length),{L:new D({values:g,index:y,ptr:_,size:x}),U:new D({values:b,index:w,ptr:T,size:E}),p:A,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}},Array:function(t){var e=n(r(t));return{L:e.L.valueOf(),U:e.U.valueOf(),p:e.p}}});function n(t){var e,r=t._size[0],n=t._size[1],i=Math.min(r,n),o=vf(t._data),a=[],s=[r,i],u=[],h=[i,n],l=[];for(g=0;g<r;g++)l[g]=g;for(e=0;e<n;e++){if(0<e)for(g=0;g<r;g++){for(var c=Math.min(g,e),f=0,d=0;d<c;d++)f=E(f,P(o[g][d],o[d][e]));o[g][e]=A(o[g][e],f)}for(var p=e,v=0,m=0,g=e;g<r;g++){var y=o[g][e],_=O(y);C(_,v)&&(p=g,v=_,m=y)}if(e!==p&&(l[e]=[l[p],l[p]=l[e]][0],S._swapRows(e,p,o)),e<r)for(g=e+1;g<r;g++){var x=o[g][e];I(x,0)||(o[g][e]=M(o[g][e],m))}}for(e=0;e<n;e++)for(g=0;g<r;g++)0===e&&(g<n&&(u[g]=[]),a[g]=[]),g<e?(g<n&&(u[g][e]=o[g][e]),e<r&&(a[g][e]=0)):g!==e?(g<n&&(u[g][e]=0),e<r&&(a[g][e]=o[g][e])):(g<n&&(u[g][e]=o[g][e]),e<r&&(a[g][e]=1));var b=new S({data:a,size:s}),w=new S({data:u,size:h}),T=[];for(g=0,i=l.length;g<i;g++)T[l[g]]=g;return{L:b,U:w,p:T,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}}),Zp=Wf("det",["typed","matrix","subtract","multiply","unaryMinus","lup"],function(t){var e=t.typed,n=t.matrix,l=t.subtract,c=t.multiply,f=t.unaryMinus,d=t.lup;return e("det",{any:vf,"Array | Matrix":function(t){var e=Fc(t)?t.size():Array.isArray(t)?(t=n(t)).size():[];switch(e.length){case 0:return vf(t);case 1:if(1===e[0])return vf(t.valueOf()[0]);throw new RangeError("Matrix must be square (size: "+Lf(e)+")");case 2:var r=e[0];if(r===e[1])return function(t,e){{if(1===e)return vf(t[0][0]);if(2===e)return l(c(t[0][0],t[1][1]),c(t[1][0],t[0][1]));for(var r=d(t),n=r.U[0][0],i=1;i<e;i++)n=c(n,r.U[i][i]);for(var o=0,a=0,s=[];;){for(;s[a];)a++;if(e<=a)break;for(var u=a,h=0;!s[r.p[u]];)s[r.p[u]]=!0,u=r.p[u],h++;h%2==0&&o++}return o%2==0?n:f(n)}}(t.clone().valueOf(),r);throw new RangeError("Matrix must be square (size: "+Lf(e)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+Lf(e)+")")}}})});var Kp=Wf("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],function(t){var e=t.typed,i=t.matrix,y=t.divideScalar,_=t.addScalar,x=t.multiply,b=t.unaryMinus,w=t.det,T=t.identity,E=t.abs;return e("inv",{"Array | Matrix":function(t){var e=Fc(t)?t.size():Uf(t);switch(e.length){case 1:if(1===e[0])return Fc(t)?i([y(1,t.valueOf()[0])]):[y(1,t[0])];throw new RangeError("Matrix must be square (size: "+Lf(e)+")");case 2:var r=e[0],n=e[1];if(r===n)return Fc(t)?i(o(t.valueOf(),r,n),t.storage()):o(t,r,n);throw new RangeError("Matrix must be square (size: "+Lf(e)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+Lf(e)+")")}},any:function(t){return y(1,t)}});function o(t,e,r){var n,i,o,a;if(1===e){if(0===(o=t[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[y(1,o)]]}if(2===e){var s=w(t);if(0===s)throw Error("Cannot calculate inverse, determinant is zero");return[[y(t[1][1],s),y(b(t[0][1]),s)],[y(b(t[1][0]),s),y(t[0][0],s)]]}var u=t.concat();for(d=0;d<e;d++)u[d]=u[d].concat();for(var h=T(e).valueOf(),l=0;l<r;l++){for(var c=E(u[l][l]),f=l,d=l+1;d<e;)E(u[d][l])>c&&(c=E(u[d][l]),f=d),d++;if(0===c)throw Error("Cannot calculate inverse, determinant is zero");(d=f)!==l&&(a=u[l],u[l]=u[d],u[d]=a,a=h[l],h[l]=h[d],h[d]=a);var p=u[l],v=h[l];for(d=0;d<e;d++){var m=u[d],g=h[d];if(d!==l){if(0!==m[l]){for(i=y(b(m[l]),p[l]),n=l;n<r;n++)m[n]=_(m[n],x(i,p[n]));for(n=0;n<r;n++)g[n]=_(g[n],x(i,v[n]))}}else{for(i=p[l],n=l;n<r;n++)m[n]=y(m[n],i);for(n=0;n<r;n++)g[n]=y(g[n],i)}}}return h}}),$p=Wf("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],function(t){var e=t.typed,r=t.matrix,n=t.multiply,i=t.equalScalar,o=t.divideScalar,a=t.inv,s=up({typed:e,equalScalar:i}),u=ip({typed:e});return e("divide",gf({"Array | Matrix, Array | Matrix":function(t,e){return n(t,a(e))},"DenseMatrix, any":function(t,e){return u(t,e,o,!1)},"SparseMatrix, any":function(t,e){return s(t,e,o,!1)},"Array, any":function(t,e){return u(r(t),e,o,!1).valueOf()},"any, Array | Matrix":function(t,e){return n(t,a(e))}},o.signatures))}),Jp=Jf({}),Qp=ud({config:Tf}),tv=hd({}),ev=id({BigNumber:Qp,config:Tf}),rv=dd({}),nv=pd({Matrix:tv}),iv=yd({BigNumber:Qp,Complex:Jp,DenseMatrix:nv,Fraction:rv}),ov=Cd({config:Tf,typed:iv}),av=Id({typed:iv}),sv=jd({typed:iv}),uv=Xd({Fraction:rv,typed:iv}),hv=Yd({typed:iv}),lv=Wd({typed:iv}),cv=qd({Complex:Jp,config:Tf,typed:iv}),fv=Zd({typed:iv}),dv=Kd({typed:iv}),pv=$d({typed:iv}),vv=Jd({Matrix:tv,equalScalar:ov,typed:iv}),mv=Qd({DenseMatrix:nv,Matrix:tv,SparseMatrix:vv,typed:iv}),gv=cp({BigNumber:Qp,DenseMatrix:nv,SparseMatrix:vv,config:Tf,matrix:mv,typed:iv}),yv=vp({matrix:mv,config:Tf,typed:iv}),_v=mp({BigNumber:Qp,config:Tf,matrix:mv,typed:iv}),xv=bp({BigNumber:Qp,DenseMatrix:nv,equalScalar:ov,matrix:mv,typed:iv,zeros:_v}),bv=Ep({DenseMatrix:nv,config:Tf,matrix:mv,typed:iv}),wv=Sp({DenseMatrix:nv,config:Tf,matrix:mv,typed:iv}),Tv=Mp({larger:wv,smaller:bv}),Ev=Cp({BigNumber:Qp,DenseMatrix:nv,equalScalar:ov,matrix:mv,typed:iv}),Av=Ip({DenseMatrix:nv,SparseMatrix:vv,addScalar:lv,equalScalar:ov,matrix:mv,typed:iv}),Sv=Np({addScalar:lv,conj:fv,multiplyScalar:sv,size:yv,typed:iv}),Ov=Dp({typed:iv}),Mv=Rp({config:Tf,round:xv,typed:iv}),Pv=Fp({addScalar:lv,dot:Sv,equalScalar:ov,matrix:mv,multiplyScalar:sv,typed:iv}),Cv=Lp({Complex:Jp,config:Tf,fraction:uv,identity:gv,matrix:mv,multiply:Pv,number:av,typed:iv}),Iv=kp({BigNumber:Qp,typed:iv}),Nv=Bp({bignumber:Iv,fraction:uv,number:av}),Dv=jp({config:Tf,numeric:Nv,smaller:bv,typed:iv}),Rv=zp({DenseMatrix:nv,addScalar:lv,equalScalar:ov,matrix:mv,typed:iv,unaryMinus:hv}),Fv=Xp({numeric:Nv,typed:iv}),Lv=Yp({config:Tf,larger:wv,numeric:Nv,typed:iv}),kv=qp({DenseMatrix:nv,Spa:Wp({FibonacciHeap:Tv,addScalar:lv,equalScalar:ov}),SparseMatrix:vv,abs:Ov,addScalar:lv,divideScalar:Fv,equalScalar:ov,larger:wv,matrix:mv,multiplyScalar:sv,subtract:Rv,typed:iv,unaryMinus:hv}),Bv=Zp({lup:kv,matrix:mv,multiply:Pv,subtract:Rv,typed:iv,unaryMinus:hv}),Uv=Kp({abs:Ov,addScalar:lv,det:Bv,divideScalar:Fv,identity:gv,matrix:mv,multiply:Pv,typed:iv,unaryMinus:hv}),jv=$p({divideScalar:Fv,equalScalar:ov,inv:Uv,matrix:mv,multiply:Pv,typed:iv}),zv={create:function(t){var e=Object.create(this);return e.trans=t,e.inv=Uv(t),e},cellToWorld:function(t){return Pv(this.trans,t)},worldToCell:function(t){return xv(Pv(this.inv,t))}};function Hv(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Gv(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gv(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Gv(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Xv(t,e,r,n){var i=this;De.call(this),this.interactive=!0,this.grid=zv.create(mv([[.5,-.5],[-.5*cv(3),-.5*cv(3)]])),this.localWidth=7.5,this.localScale=1/192,this.unitCell={size1:3,size2:4,toneValue:function(t,e){var r=t%3;r<0&&(r+=3);var n=e%4;return n<0&&(n+=4),0==r&&0==n?0:1==r&&0==n?4:2==r&&0==n?8:0==r&&1==n?9:1==r&&1==n?1:2==r&&1==n?5:0==r&&2==n?6:1==r&&2==n?10:2==r&&2==n?2:0==r&&3==n?3:1==r&&3==n?7:2==r&&3==n?11:void 0}},this.mask=new Gs,this.addChild(this.mask),this.resize(e),this.selection=t,this.resources=r,this.populate(),this.hovered=!1,this.pointerTriangle=[],this.triangleCursor=new Gs,this.triangleCursor.zIndex=0,this.addChild(this.triangleCursor),this.currentChord=new Gs,this.currentChord.zIndex=0,this.currentChord.interactive=!0,this.addChildAt(this.currentChord),this.currentChordHull=[],this.ticker=n,this.sortChildren(),this.on("mousemove",this.onMouseMove).on("mouseover",function(){this.hovered=!0}).on("mouseout",function(){this.hovered=!1;var t,e=Hv(this.pointerTriangle);try{for(e.s();!(t=e.n()).done;){var r=t.value;this.setSpriteActive(r.get([0,0]),r.get([1,0]),!1)}}catch(t){e.e(t)}finally{e.f()}this.pointerTriangle=[],this.triangleCursor.clear()}).on("mousedown",this.onMouseDown);var o=!1;this.currentChord.on("mouseover",function(){i.emit("mouseout"),o=!0;var t,e=Hv(i.currentChordCoords);try{for(e.s();!(t=e.n()).done;){var r=t.value;i.setSpriteActive(r.get([0,0]),r.get([1,0]),!0)}}catch(t){e.e(t)}finally{e.f()}}).on("mouseout",function(){o=!1;var t,e=Hv(i.currentChordCoords);try{for(e.s();!(t=e.n()).done;){var r=t.value;i.setSpriteActive(r.get([0,0]),r.get([1,0]),!1)}}catch(t){e.e(t)}finally{e.f()}i.emit("mouseover")}).on("mousedown",function(){o&&i.emit("currentchordtriggered")})}Object.create(zv).create=function(){return zv.create(mv([[1,dv(ev/3)],[0,pv(ev/3)]]))},(Xv.prototype=Object.create(De.prototype)).setSpriteActive=function(t,e,r){t in this.toneSprites&&e in this.toneSprites[t]&&this.toneSprites[t][e].setActive(r)},Xv.prototype.onMouseMove=function(t){if(this.hovered){var e,r=this.toLocal(t.data.global),n=this.grid.worldToCell(mv([[r.x],[r.y]])),i=this.grid.cellToWorld(n),o=Mv(Ev(r.y-i.get([1,0]),r.x-i.get([0,0]))/ev*3);switch(o){case-1:e=[n,Av(n,mv([[1],[-1]])),Av(n,mv([[1],[0]]))];break;case-2:e=[n,Av(n,mv([[1],[0]])),Av(n,mv([[0],[1]]))];break;case 3:case-3:e=[n,Av(n,mv([[0],[1]])),Av(n,mv([[-1],[1]]))];break;case 0:e=[n,Av(n,mv([[1],[-1]])),Av(n,mv([[0],[-1]]))];break;case 1:e=[n,Av(n,mv([[0],[-1]])),Av(n,mv([[-1],[0]]))];break;case 2:e=[n,Av(n,mv([[-1],[0]])),Av(n,mv([[-1],[1]]))];break;default:throw new Error("unexpected sextant value: "+o)}if(!function(t,e){if(t.length!=e.length)return!1;var r,n=Hv(t);try{for(n.s();!(r=n.n()).done;){var i,o=r.value,a=!1,s=Hv(e);try{for(s.s();!(i=s.n()).done;){var u=i.value;if(o.get([0,0])==u.get([0,0])&&o.get([1,0])==u.get([1,0])){a=!0;break}}}catch(t){s.e(t)}finally{s.f()}if(!a)return!1}}catch(t){n.e(t)}finally{n.f()}return!0}(this.pointerTriangle,e)){var a,s=Hv(this.pointerTriangle);try{for(s.s();!(a=s.n()).done;){var u=a.value;this.setSpriteActive(u.get([0,0]),u.get([1,0]),!1)}}catch(t){s.e(t)}finally{s.f()}this.pointerTriangle=e;var h,l=Hv(this.pointerTriangle);try{for(l.s();!(h=l.n()).done;){var c=h.value;this.setSpriteActive(c.get([0,0]),c.get([1,0]),!0)}}catch(t){l.e(t)}finally{l.f()}this.triangleCursor.clear().lineStyle(1/128,gc,1),this.drawPolygon(this.pointerTriangle,this.triangleCursor)}}},Xv.prototype.onMouseDown=function(t){var e,r=this;this.hovered&&0==t.data.button&&(e=this.pointerTriangle.map(function(t){return cc.Tone.create(r.selection[r.unitCell.toneValue(t.get([0,0]),t.get([1,0]))],4)}),this.emit("tonestriggered",e,this.pointerTriangle))},Xv.prototype.worldToTransformedFrame=function(t){var e=Mv(Pv(this.grid.inv,mv([[t.x],[t.y]]))),r=Mv(Pv(this.grid.inv,mv([[t.x+t.width],[t.y]]))),n=Mv(Pv(this.grid.inv,mv([[t.x],[t.y+t.height]]))),i=Mv(Pv(this.grid.inv,mv([[t.x+t.width],[t.y+t.height]]))),o=Dv(e.get([0,0]),r.get([0,0]),n.get([0,0]),i.get([0,0])),a=Lv(e.get([0,0]),r.get([0,0]),n.get([0,0]),i.get([0,0])),s=Dv(e.get([1,0]),r.get([1,0]),n.get([1,0]),i.get([1,0])),u=Lv(e.get([1,0]),r.get([1,0]),n.get([1,0]),i.get([1,0]));return new Zt(o,s,a-o+1,u-s+1)},Xv.prototype.toneFromCell=function(t,e){var r=t%this.unitCell.size1,n=e%this.unitCell.size2;r<0&&(r+=this.unitCell.size1),n<0&&(n+=this.unitCell.size2);var i=this.unitCell.toneValue(r,n);return this.selection[i]},Xv.prototype.populate=function(){var u=this,e=this.worldToTransformedFrame(this.localFrame);this.toneSprites={};for(var t=e.x;t<e.x+e.width;++t)!function(s){for(var t=e.y;t<e.y+e.height;++t)!function(e){var t=s%u.unitCell.size1,r=e%u.unitCell.size2;t<0&&(t+=u.unitCell.size1),r<0&&(r+=u.unitCell.size2);var n=u.unitCell.toneValue(t,r),i=u.selection[n],o=new vc(i,u.resources);o.zIndex=1;var a=u.grid.cellToWorld(mv([[s],[e]]));o.position.set(a.get([0,0]),a.get([1,0])),o.scale.set(u.localScale,u.localScale),u.addChild(o),s in u.toneSprites||(u.toneSprites[s]={}),(u.toneSprites[s][e]=o).on("mouseover",function(){u.emit("mouseout")}).on("mouseout",function(){u.emit("mouseover")}).on("tonetriggered",function(t){u.emit("singletonetriggered",cc.Tone.create(i,t),mv([[s],[e]]))})}(t)}(t)},Xv.prototype.resize=function(t){var e=t.width/this.localWidth;this.scale.set(e,e);var r=t.height/t.width;this.localFrame=new Zt(-this.localWidth/2,-r*this.localWidth/2,this.localWidth,r*this.localWidth),this.position.set(t.x+t.width/2,t.y+t.height/2),this.mask.clear(),this.mask.beginFill(16777215).drawRect(this.localFrame.x,this.localFrame.y,this.localFrame.width,this.localFrame.height).endFill(),this.hitArea=this.localFrame.clone()},Xv.prototype.setCurrentChord=function(t,e){var r=this;if(this.currentChordCoords=e.map(function(t){return t.clone()}),this.currentChord.clear(),0!=e.length)for(var n in this.currentChordHull=Ac()(e.map(function(t){return[t.get([0,0]),t.get([1,0])]})).map(function(t){return e[t[0]]}),this.currentChord.lineStyle(1/128,gc,1),this.drawPolygon(this.currentChordHull,this.currentChord),this.currentChord.hitArea=new ee(this.currentChordHull.map(function(t){var e=r.grid.cellToWorld(t);return new oe(e.get([0,0]),e.get([1,0]))})),this.toneSprites)for(var i in this.toneSprites[n]){for(var o=[],a=0;a<e.length;++a)e[a].get([0,0])==n&&e[a].get([1,0])==i&&o.push(t[a].octave);this.toneSprites[n][i].setSelectedOctaves(o)}},Xv.prototype.drawPolygon=function(t,e){var r=this.grid.cellToWorld(t[0]);e.moveTo(r.get([0,0]),r.get([1,0]));var n,i=Hv(t.slice(1));try{for(i.s();!(n=i.n()).done;){var o=n.value,a=this.grid.cellToWorld(o);e.lineTo(a.get([0,0]),a.get([1,0]))}}catch(t){i.e(t)}finally{i.f()}e.lineTo(r.get([0,0]),r.get([1,0])),e.closePath()},Xv.prototype.onCurrentChordTriggered=function(){var e=this,r=new Gs,n=1;this.addChildAt(r,0);var i=this.currentChordHull.map(function(t){return t.clone()});this.ticker.add(function t(){(n-=.01)<0?(e.removeChild(r),e.ticker.remove(t),r.destroy()):(r.clear(),r.beginFill(gc,n),e.drawPolygon(i,r),r.endFill())})},Xv.prototype.coordFromToneClosestTo=function(a,s){var u=this,t=Object.keys(this.toneSprites).reduce(function(t,o){var e=Object.keys(u.toneSprites[o]).reduce(function(t,e){if(a.tone!=u.toneFromCell(o,e))return t;var r=mv([[o],[e]]),n=Rv(r,s),i=Cv(n.get([0,0]),2)+Cv(n.get([1,0]),2);return t=i<t.val?{val:i,i:o,j:e}:t},{val:1e4,i:o,j:0});return t=e.val<t.val?e:t},{val:1e4,i:0,j:0});return mv([[t.i],[t.j]])};var Vv=Xv;function Yv(t){return(Yv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Wv(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}(t,e)||Zv(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qv(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=Zv(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Zv(t,e){if(t){if("string"==typeof t)return Kv(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Kv(t,e):void 0}}function Kv(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function $v(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Jv(t,e){return(Jv=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Qv(o){var a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e,r,n,i=tm(o);return e=a?(t=tm(this).constructor,Reflect.construct(i,arguments,t)):i.apply(this,arguments),r=this,!(n=e)||"object"!==Yv(n)&&"function"!=typeof n?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(r):n}}function tm(t){return(tm=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var em=function(){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Jv(t,e)}(o,De);var t,e,r,i=Qv(o);function o(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(r=i.call(this)).selection=t,r.octaves=3,r.minOctave=3,r.chordsCount=16,r.topOffset=2,r.graph=new Gs,r.addChild(r.graph),r.cursorCell=[-1,-1],r.cursor=new Gs,r.addChild(r.cursor),r.chords=new Gs,r.addChild(r.chords),r.interactive=!0,r.hitArea=new Zt(0,0,r.chordsCount,12*r.octaves+r.topOffset);var n=!1;return r.on("mouseover",function(){return n=!0}).on("mouseout",function(){n=!1,r.cursor.clear(),r.cursorCell=[-1,-1]}).on("mousemove",function(t){n&&r.drawCursor(t)}).on("mousedown",function(t){n&&r.onMouseDown(t)}),r.initTones(),r.resize(e),r.draw(),r}return t=o,(e=[{key:"initTones",value:function(){this.tones=[];for(var t=this.octaves-1;0<=t;--t)for(var e=11;0<=e;--e)this.tones.push(cc.Tone.create(this.selection[e],t+this.minOctave))}},{key:"resize",value:function(t){this.position.set(t.x,t.y);var e=t.height/(12*this.octaves+this.topOffset),r=t.width/this.chordsCount;this.scale.set(r,e)}},{key:"drawCursor",value:function(t){var e=this.toLocal(t.data.global),r=Mv(e.x),n=Mv(e.y);r==this.cursorCell[0]&&n==this.cursorCell[1]||(this.cursorCell=[r,n],this.cursor.clear(),this.cursor.lineStyle(1/32,gc).beginFill(gc,.25).drawRect(r,0,1,12*this.octaves).endFill().beginFill(gc),n<this.topOffset?this.cursor.drawRect(r,0,1,2):this.cursor.drawRect(r,n,1,1),this.cursor.endFill())}},{key:"draw",value:function(){this.graph.clear(),this.graph.lineStyle(1/16,gc,1),this.graph.drawRect(0,0,this.chordsCount,this.topOffset),this.graph.lineStyle(1/8,gc,1),this.graph.moveTo(0,2).lineTo(this.chordsCount,2),this.graph.moveTo(0,0).lineTo(0,12*this.octaves+this.topOffset),this.graph.lineStyle(1/16,gc,1);for(var t=0;t<3;++t)this.graph.drawRect(0,12*t+this.topOffset,this.chordsCount,1).beginFill(gc,.5).drawRect(0,12*t+1+this.topOffset,this.chordsCount,1).endFill().drawRect(0,12*t+2+this.topOffset,this.chordsCount,1).beginFill(gc,.5).drawRect(0,12*t+3+this.topOffset,this.chordsCount,1).endFill().drawRect(0,12*t+4+this.topOffset,this.chordsCount,1).beginFill(gc,.5).drawRect(0,12*t+5+this.topOffset,this.chordsCount,1).endFill().drawRect(0,12*t+6+this.topOffset,this.chordsCount,1).drawRect(0,12*t+7+this.topOffset,this.chordsCount,1).beginFill(gc,.5).drawRect(0,12*t+8+this.topOffset,this.chordsCount,1).endFill().drawRect(0,12*t+9+this.topOffset,this.chordsCount,1).beginFill(gc,.5).drawRect(0,12*t+10+this.topOffset,this.chordsCount,1).endFill().drawRect(0,12*t+11+this.topOffset,this.chordsCount,1);for(var e=1;e<this.chordsCount;++e)this.graph.moveTo(e,0),this.graph.lineTo(e,12*this.octaves+this.topOffset)}},{key:"onMouseDown",value:function(t){var e=this.toLocal(t.data.global),r=[Mv(e.x),Mv(e.y)];r[1]<this.topOffset?this.emit("chordTriggered",r[0]):this.emit("toneTriggered",r[0],this.tones[r[1]-this.topOffset])}},{key:"drawChords",value:function(t){this.chords.clear();var e,r=qv(t.entries());try{for(r.s();!(e=r.n()).done;){var n,i=Wv(e.value,2),o=i[0],a=qv(i[1].tones);try{for(a.s();!(n=a.n()).done;){var s=n.value;this.chords.beginFill(gc).drawRect(o,12*(this.octaves+this.minOctave-s.octave)-s.tone.val-1+this.topOffset,1,1).endFill()}}catch(t){a.e(t)}finally{a.f()}}}catch(t){r.e(t)}finally{r.f()}}}])&&$v(t.prototype,e),r&&$v(t,r),o}();function rm(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return nm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nm(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function nm(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function im(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var om=function(){function s(n,t,e){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),this.app=n;var r=new Zt(n.screen.x,n.screen.y,yc*n.screen.width,n.screen.height);this.tonesPlane=new Vv(fc,r,t,n.ticker);var o=new Zt(n.screen.x+yc*n.screen.width,n.screen.y,(1-yc)*n.screen.width,n.screen.height);this.tuneGrid=new em(fc,o),this.toneSounds=e,this.app.stage.addChild(this.tonesPlane),this.app.stage.addChild(this.tuneGrid),this.app.renderer.render(this.app.stage),this.playing=[];function a(){var t=i.app.view.parentNode;i.app.renderer.resize(t.clientWidth,t.clientHeight);var e=new Zt(n.screen.x,n.screen.y,yc*n.screen.width,n.screen.height),r=new Zt(n.screen.x+yc*n.screen.width,n.screen.y,(1-yc)*n.screen.width,n.screen.height);i.tonesPlane.resize(e),i.tuneGrid.resize(r)}window.addEventListener("resize",a),a()}var t,e,r;return t=s,(e=[{key:"playTones",value:function(t){var e,r=this,n=rm(this.playing);try{for(n.s();!(e=n.n()).done;){var i=e.value;this.toneSounds.fade(1,0,50,i)}}catch(t){n.e(t)}finally{n.f()}this.playing=t.map(function(t){return r.toneSounds.play(t.str())})}}])&&im(t.prototype,e),r&&im(t,r),s}();function am(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var sm=function(){function n(t,e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),this.model=t,this.view=e,this.model.tune.next(),this.view.tonesPlane.on("tonestriggered",function(t,e){return r.onTonesTriggered(t,e)}),this.view.tonesPlane.on("singletonetriggered",function(t,e){return r.onSingleToneTriggered(t,e)}),this.view.tonesPlane.on("currentchordtriggered",function(){return r.onCurrentChordTriggered()}),this.view.tuneGrid.on("toneTriggered",function(t,e){return r.onTuneToneTriggered(t,e)}),this.view.tuneGrid.on("chordTriggered",function(t){return r.onTuneChordTriggered(t)})}var t,e,r;return t=n,(e=[{key:"onTonesTriggered",value:function(t,e){this.model.tune.setCurrentChord(t,e),this.view.tonesPlane.setCurrentChord(this.model.tune.getCurrent().tones,this.model.tune.getCurrent().coords),this.view.tuneGrid.drawChords(this.model.tune.chords),this.onCurrentChordTriggered()}},{key:"onSingleToneTriggered",value:function(e,t){-1==this.model.tune.getCurrent().tones.findIndex(function(t){return t.tone==e.tone&&t.octave==e.octave})?this.model.tune.appendToCurrentChord(e,t):this.model.tune.removeFromCurrentChord(e),this.view.tonesPlane.setCurrentChord(this.model.tune.getCurrent().tones,this.model.tune.getCurrent().coords),this.view.tuneGrid.drawChords(this.model.tune.chords),this.onCurrentChordTriggered()}},{key:"onCurrentChordTriggered",value:function(){0<this.model.tune.getCurrent().tones.length&&(this.view.playTones(this.model.tune.getCurrent().tones),this.view.tonesPlane.onCurrentChordTriggered())}},{key:"onTuneToneTriggered",value:function(t,e){this.model.tune.setCurrent(t);var r=this.model.tune.getCurrent(),n=jv(r.coords.reduce(function(t,e){return Av(t,e)}),r.coords.length),i=this.view.tonesPlane.coordFromToneClosestTo(e,n);this.onSingleToneTriggered(e,i),this.view.tonesPlane.setCurrentChord(r.tones,r.coords),this.onCurrentChordTriggered()}},{key:"onTuneChordTriggered",value:function(t){this.model.tune.setCurrent(t),this.view.tonesPlane.setCurrentChord(this.model.tune.getCurrent().tones,this.model.tune.getCurrent().coords),this.onCurrentChordTriggered()}}])&&am(t.prototype,e),r&&am(t,r),n}(),um=function(){var t=new ra({autoResize:!0,resolution:devicePixelRatio,antialias:!0});document.querySelector("#main").appendChild(t.view);var e=t.view.parentNode;return t.renderer.resize(e.clientWidth,e.clientHeight),t}(),hm=function(n){var i=new Gs;n.stage.addChild(i),i.position.set(n.screen.x/2,n.screen.y/2);var o=0,a=8;return n.ticker.add(function(){var t=n.screen.width/4,e=n.screen.width/16;i.clear(),i.lineStyle(1,gc),i.drawRect(n.screen.width/2-t/2,n.screen.height/2-32,t,64);var r=o+a;t<=r+e?a=-8:r<=0?a=8:o=r,i.beginFill(gc),i.drawRect(n.screen.width/2-t/2+o,n.screen.height/2-32,e,64),i.endFill()}),i}(um);um.stage.addChild(hm);var lm=function(){for(var t={src:"assets/tones.mp3",sprite:{}},e=3;e<6;++e)for(var r=0;r<12;++r)t.sprite[cc.Tone.create(fc[r],e).str()]=[8e3*(12*(e-3)+r),8e3],t.sprite[cc.Tone.create(dc[r],e).str()]=[8e3*(12*(e-3)+r),8e3];return new mc.Howl(t)}();lm.once("load",function(){ka.shared.add(vc.assets).load(function(t,e){var r;um.stage.removeChild(hm),r=e,new sm(new Tc,new om(um,r,lm)),lm.play(cc.Tone.create(cc.C,3).str()),lm.play(cc.Tone.create(cc.C,4).str()),lm.play(cc.Tone.create(cc.E,4).str()),lm.play(cc.Tone.create(cc.G,4).str())})})}]);