@luceosports/play-rendering 2.1.2 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,5 +20,5 @@
20
20
  * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
21
21
  * MIT Licence
22
22
  */
23
- var qe,_e,$e=9e15,tr="0123456789abcdef",nr="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",er="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",rr={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-$e,maxE:$e,crypto:!1},ir=!0,ur="[DecimalError] Invalid argument: ",Mr="[object Decimal]",Nr=Math.floor,or=Math.pow,cr=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ar=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Dr=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,sr=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Tr=1e7,gr=nr.length-1,lr=er.length-1,Ir={toStringTag:Mr};function jr(t){var n,e,r,i=t.length-1,u="",M=t[0];if(i>0){for(u+=M,n=1;n<i;n++)(e=7-(r=t[n]+"").length)&&(u+=dr(e)),u+=r;(e=7-(r=(M=t[n])+"").length)&&(u+=dr(e))}else if(0===M)return"0";for(;M%10==0;)M/=10;return u+M}function yr(t,n,e){if(t!==~~t||t<n||t>e)throw Error(ur+t)}function hr(t,n,e,r){var i,u,M,N;for(u=t[0];u>=10;u/=10)--n;return--n<0?(n+=7,i=0):(i=Math.ceil((n+1)/7),n%=7),u=or(10,7-n),N=t[i]%u|0,null==r?n<3?(0==n?N=N/100|0:1==n&&(N=N/10|0),M=e<4&&99999==N||e>3&&49999==N||5e4==N||0==N):M=(e<4&&N+1==u||e>3&&N+1==u/2)&&(t[i+1]/u/100|0)==or(10,n-2)-1||(N==u/2||0==N)&&0==(t[i+1]/u/100|0):n<4?(0==n?N=N/1e3|0:1==n?N=N/100|0:2==n&&(N=N/10|0),M=(r||e<4)&&9999==N||!r&&e>3&&4999==N):M=((r||e<4)&&N+1==u||!r&&e>3&&N+1==u/2)&&(t[i+1]/u/1e3|0)==or(10,n-3)-1,M}function zr(t,n,e){for(var r,i,u=[0],M=0,N=t.length;M<N;){for(i=u.length;i--;)u[i]*=n;for(u[0]+=tr.indexOf(t.charAt(M++)),r=0;r<u.length;r++)u[r]>e-1&&(void 0===u[r+1]&&(u[r+1]=0),u[r+1]+=u[r]/e|0,u[r]%=e)}return u.reverse()}Ir.absoluteValue=Ir.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),Ar(t)},Ir.ceil=function(){return Ar(new this.constructor(this),this.e+1,2)},Ir.clampedTo=Ir.clamp=function(t,n){var e=this,r=e.constructor;if(t=new r(t),n=new r(n),!t.s||!n.s)return new r(NaN);if(t.gt(n))throw Error(ur+n);return e.cmp(t)<0?t:e.cmp(n)>0?n:new r(e)},Ir.comparedTo=Ir.cmp=function(t){var n,e,r,i,u=this,M=u.d,N=(t=new u.constructor(t)).d,o=u.s,c=t.s;if(!M||!N)return o&&c?o!==c?o:M===N?0:!M^o<0?1:-1:NaN;if(!M[0]||!N[0])return M[0]?o:N[0]?-c:0;if(o!==c)return o;if(u.e!==t.e)return u.e>t.e^o<0?1:-1;for(n=0,e=(r=M.length)<(i=N.length)?r:i;n<e;++n)if(M[n]!==N[n])return M[n]>N[n]^o<0?1:-1;return r===i?0:r>i^o<0?1:-1},Ir.cosine=Ir.cos=function(){var t,n,e=this,r=e.constructor;return e.d?e.d[0]?(t=r.precision,n=r.rounding,r.precision=t+Math.max(e.e,e.sd())+7,r.rounding=1,e=function(t,n){var e,r,i;if(n.isZero())return n;(r=n.d.length)<32?(e=Math.ceil(r/3),i=(1/Fr(4,e)).toString()):(e=16,i="2.3283064365386962890625e-10");t.precision+=e,n=mr(t,1,n.times(i),new t(1));for(var u=e;u--;){var M=n.times(n);n=M.times(M).minus(M).times(8).plus(1)}return t.precision-=e,n}(r,Rr(r,e)),r.precision=t,r.rounding=n,Ar(2==_e||3==_e?e.neg():e,t,n,!0)):new r(1):new r(NaN)},Ir.cubeRoot=Ir.cbrt=function(){var t,n,e,r,i,u,M,N,o,c,a=this,D=a.constructor;if(!a.isFinite()||a.isZero())return new D(a);for(ir=!1,(u=a.s*or(a.s*a,1/3))&&Math.abs(u)!=1/0?r=new D(u.toString()):(e=jr(a.d),(u=((t=a.e)-e.length+1)%3)&&(e+=1==u||-2==u?"0":"00"),u=or(e,1/3),t=Nr((t+1)/3)-(t%3==(t<0?-1:2)),(r=new D(e=u==1/0?"5e"+t:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+t)).s=a.s),M=(t=D.precision)+3;;)if(c=(o=(N=r).times(N).times(N)).plus(a),r=Or(c.plus(a).times(N),c.plus(o),M+2,1),jr(N.d).slice(0,M)===(e=jr(r.d)).slice(0,M)){if("9999"!=(e=e.slice(M-3,M+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(Ar(r,t+1,1),n=!r.times(r).times(r).eq(a));break}if(!i&&(Ar(N,t+1,0),N.times(N).times(N).eq(a))){r=N;break}M+=4,i=1}return ir=!0,Ar(r,t,D.rounding,n)},Ir.decimalPlaces=Ir.dp=function(){var t,n=this.d,e=NaN;if(n){if(e=7*((t=n.length-1)-Nr(this.e/7)),t=n[t])for(;t%10==0;t/=10)e--;e<0&&(e=0)}return e},Ir.dividedBy=Ir.div=function(t){return Or(this,new this.constructor(t))},Ir.dividedToIntegerBy=Ir.divToInt=function(t){var n=this.constructor;return Ar(Or(this,new n(t),0,1,1),n.precision,n.rounding)},Ir.equals=Ir.eq=function(t){return 0===this.cmp(t)},Ir.floor=function(){return Ar(new this.constructor(this),this.e+1,3)},Ir.greaterThan=Ir.gt=function(t){return this.cmp(t)>0},Ir.greaterThanOrEqualTo=Ir.gte=function(t){var n=this.cmp(t);return 1==n||0===n},Ir.hyperbolicCosine=Ir.cosh=function(){var t,n,e,r,i,u=this,M=u.constructor,N=new M(1);if(!u.isFinite())return new M(u.s?1/0:NaN);if(u.isZero())return N;e=M.precision,r=M.rounding,M.precision=e+Math.max(u.e,u.sd())+4,M.rounding=1,(i=u.d.length)<32?n=(1/Fr(4,t=Math.ceil(i/3))).toString():(t=16,n="2.3283064365386962890625e-10"),u=mr(M,1,u.times(n),new M(1),!0);for(var o,c=t,a=new M(8);c--;)o=u.times(u),u=N.minus(o.times(a.minus(o.times(a))));return Ar(u,M.precision=e,M.rounding=r,!0)},Ir.hyperbolicSine=Ir.sinh=function(){var t,n,e,r,i=this,u=i.constructor;if(!i.isFinite()||i.isZero())return new u(i);if(n=u.precision,e=u.rounding,u.precision=n+Math.max(i.e,i.sd())+4,u.rounding=1,(r=i.d.length)<3)i=mr(u,2,i,i,!0);else{t=(t=1.4*Math.sqrt(r))>16?16:0|t,i=mr(u,2,i=i.times(1/Fr(5,t)),i,!0);for(var M,N=new u(5),o=new u(16),c=new u(20);t--;)M=i.times(i),i=i.times(N.plus(M.times(o.times(M).plus(c))))}return u.precision=n,u.rounding=e,Ar(i,n,e,!0)},Ir.hyperbolicTangent=Ir.tanh=function(){var t,n,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(t=r.precision,n=r.rounding,r.precision=t+7,r.rounding=1,Or(e.sinh(),e.cosh(),r.precision=t,r.rounding=n)):new r(e.s)},Ir.inverseCosine=Ir.acos=function(){var t,n=this,e=n.constructor,r=n.abs().cmp(1),i=e.precision,u=e.rounding;return-1!==r?0===r?n.isNeg()?pr(e,i,u):new e(0):new e(NaN):n.isZero()?pr(e,i+4,u).times(.5):(e.precision=i+6,e.rounding=1,n=n.asin(),t=pr(e,i+4,u).times(.5),e.precision=i,e.rounding=u,t.minus(n))},Ir.inverseHyperbolicCosine=Ir.acosh=function(){var t,n,e=this,r=e.constructor;return e.lte(1)?new r(e.eq(1)?0:NaN):e.isFinite()?(t=r.precision,n=r.rounding,r.precision=t+Math.max(Math.abs(e.e),e.sd())+4,r.rounding=1,ir=!1,e=e.times(e).minus(1).sqrt().plus(e),ir=!0,r.precision=t,r.rounding=n,e.ln()):new r(e)},Ir.inverseHyperbolicSine=Ir.asinh=function(){var t,n,e=this,r=e.constructor;return!e.isFinite()||e.isZero()?new r(e):(t=r.precision,n=r.rounding,r.precision=t+2*Math.max(Math.abs(e.e),e.sd())+6,r.rounding=1,ir=!1,e=e.times(e).plus(1).sqrt().plus(e),ir=!0,r.precision=t,r.rounding=n,e.ln())},Ir.inverseHyperbolicTangent=Ir.atanh=function(){var t,n,e,r,i=this,u=i.constructor;return i.isFinite()?i.e>=0?new u(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=u.precision,n=u.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?Ar(new u(i),t,n,!0):(u.precision=e=r-i.e,i=Or(i.plus(1),new u(1).minus(i),e+t,1),u.precision=t+4,u.rounding=1,i=i.ln(),u.precision=t,u.rounding=n,i.times(.5))):new u(NaN)},Ir.inverseSine=Ir.asin=function(){var t,n,e,r,i=this,u=i.constructor;return i.isZero()?new u(i):(n=i.abs().cmp(1),e=u.precision,r=u.rounding,-1!==n?0===n?((t=pr(u,e+4,r).times(.5)).s=i.s,t):new u(NaN):(u.precision=e+6,u.rounding=1,i=i.div(new u(1).minus(i.times(i)).sqrt().plus(1)).atan(),u.precision=e,u.rounding=r,i.times(2)))},Ir.inverseTangent=Ir.atan=function(){var t,n,e,r,i,u,M,N,o,c=this,a=c.constructor,D=a.precision,s=a.rounding;if(c.isFinite()){if(c.isZero())return new a(c);if(c.abs().eq(1)&&D+4<=lr)return(M=pr(a,D+4,s).times(.25)).s=c.s,M}else{if(!c.s)return new a(NaN);if(D+4<=lr)return(M=pr(a,D+4,s).times(.5)).s=c.s,M}for(a.precision=N=D+10,a.rounding=1,t=e=Math.min(28,N/7+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(ir=!1,n=Math.ceil(N/7),r=1,o=c.times(c),M=new a(c),i=c;-1!==t;)if(i=i.times(o),u=M.minus(i.div(r+=2)),i=i.times(o),void 0!==(M=u.plus(i.div(r+=2))).d[n])for(t=n;M.d[t]===u.d[t]&&t--;);return e&&(M=M.times(2<<e-1)),ir=!0,Ar(M,a.precision=D,a.rounding=s,!0)},Ir.isFinite=function(){return!!this.d},Ir.isInteger=Ir.isInt=function(){return!!this.d&&Nr(this.e/7)>this.d.length-2},Ir.isNaN=function(){return!this.s},Ir.isNegative=Ir.isNeg=function(){return this.s<0},Ir.isPositive=Ir.isPos=function(){return this.s>0},Ir.isZero=function(){return!!this.d&&0===this.d[0]},Ir.lessThan=Ir.lt=function(t){return this.cmp(t)<0},Ir.lessThanOrEqualTo=Ir.lte=function(t){return this.cmp(t)<1},Ir.logarithm=Ir.log=function(t){var n,e,r,i,u,M,N,o,c=this.constructor,a=c.precision,D=c.rounding;if(null==t)t=new c(10),n=!0;else{if(e=(t=new c(t)).d,t.s<0||!e||!e[0]||t.eq(1))return new c(NaN);n=t.eq(10)}if(e=this.d,this.s<0||!e||!e[0]||this.eq(1))return new c(e&&!e[0]?-1/0:1!=this.s?NaN:e?0:1/0);if(n)if(e.length>1)u=!0;else{for(i=e[0];i%10==0;)i/=10;u=1!==i}if(ir=!1,M=Lr(this,N=a+5),r=n?fr(c,N+10):Lr(t,N),hr((o=Or(M,r,N,1)).d,i=a,D))do{if(M=Lr(this,N+=10),r=n?fr(c,N+10):Lr(t,N),o=Or(M,r,N,1),!u){+jr(o.d).slice(i+1,i+15)+1==1e14&&(o=Ar(o,a+1,0));break}}while(hr(o.d,i+=10,D));return ir=!0,Ar(o,a,D)},Ir.minus=Ir.sub=function(t){var n,e,r,i,u,M,N,o,c,a,D,s,T=this,g=T.constructor;if(t=new g(t),!T.d||!t.d)return T.s&&t.s?T.d?t.s=-t.s:t=new g(t.d||T.s!==t.s?T:NaN):t=new g(NaN),t;if(T.s!=t.s)return t.s=-t.s,T.plus(t);if(c=T.d,s=t.d,N=g.precision,o=g.rounding,!c[0]||!s[0]){if(s[0])t.s=-t.s;else{if(!c[0])return new g(3===o?-0:0);t=new g(T)}return ir?Ar(t,N,o):t}if(e=Nr(t.e/7),a=Nr(T.e/7),c=c.slice(),u=a-e){for((D=u<0)?(n=c,u=-u,M=s.length):(n=s,e=a,M=c.length),u>(r=Math.max(Math.ceil(N/7),M)+2)&&(u=r,n.length=1),n.reverse(),r=u;r--;)n.push(0);n.reverse()}else{for((D=(r=c.length)<(M=s.length))&&(M=r),r=0;r<M;r++)if(c[r]!=s[r]){D=c[r]<s[r];break}u=0}for(D&&(n=c,c=s,s=n,t.s=-t.s),M=c.length,r=s.length-M;r>0;--r)c[M++]=0;for(r=s.length;r>u;){if(c[--r]<s[r]){for(i=r;i&&0===c[--i];)c[i]=Tr-1;--c[i],c[r]+=Tr}c[r]-=s[r]}for(;0===c[--M];)c.pop();for(;0===c[0];c.shift())--e;return c[0]?(t.d=c,t.e=Er(c,e),ir?Ar(t,N,o):t):new g(3===o?-0:0)},Ir.modulo=Ir.mod=function(t){var n,e=this,r=e.constructor;return t=new r(t),!e.d||!t.s||t.d&&!t.d[0]?new r(NaN):!t.d||e.d&&!e.d[0]?Ar(new r(e),r.precision,r.rounding):(ir=!1,9==r.modulo?(n=Or(e,t.abs(),0,3,1)).s*=t.s:n=Or(e,t,0,r.modulo,1),n=n.times(t),ir=!0,e.minus(n))},Ir.naturalExponential=Ir.exp=function(){return Sr(this)},Ir.naturalLogarithm=Ir.ln=function(){return Lr(this)},Ir.negated=Ir.neg=function(){var t=new this.constructor(this);return t.s=-t.s,Ar(t)},Ir.plus=Ir.add=function(t){var n,e,r,i,u,M,N,o,c,a,D=this,s=D.constructor;if(t=new s(t),!D.d||!t.d)return D.s&&t.s?D.d||(t=new s(t.d||D.s===t.s?D:NaN)):t=new s(NaN),t;if(D.s!=t.s)return t.s=-t.s,D.minus(t);if(c=D.d,a=t.d,N=s.precision,o=s.rounding,!c[0]||!a[0])return a[0]||(t=new s(D)),ir?Ar(t,N,o):t;if(u=Nr(D.e/7),r=Nr(t.e/7),c=c.slice(),i=u-r){for(i<0?(e=c,i=-i,M=a.length):(e=a,r=u,M=c.length),i>(M=(u=Math.ceil(N/7))>M?u+1:M+1)&&(i=M,e.length=1),e.reverse();i--;)e.push(0);e.reverse()}for((M=c.length)-(i=a.length)<0&&(i=M,e=a,a=c,c=e),n=0;i;)n=(c[--i]=c[i]+a[i]+n)/Tr|0,c[i]%=Tr;for(n&&(c.unshift(n),++r),M=c.length;0==c[--M];)c.pop();return t.d=c,t.e=Er(c,r),ir?Ar(t,N,o):t},Ir.precision=Ir.sd=function(t){var n,e=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(ur+t);return e.d?(n=Ur(e.d),t&&e.e+1>n&&(n=e.e+1)):n=NaN,n},Ir.round=function(){var t=this,n=t.constructor;return Ar(new n(t),t.e+1,n.rounding)},Ir.sine=Ir.sin=function(){var t,n,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(t=r.precision,n=r.rounding,r.precision=t+Math.max(e.e,e.sd())+7,r.rounding=1,e=function(t,n){var e,r=n.d.length;if(r<3)return n.isZero()?n:mr(t,2,n,n);e=(e=1.4*Math.sqrt(r))>16?16:0|e,n=n.times(1/Fr(5,e)),n=mr(t,2,n,n);for(var i,u=new t(5),M=new t(16),N=new t(20);e--;)i=n.times(n),n=n.times(u.plus(i.times(M.times(i).minus(N))));return n}(r,Rr(r,e)),r.precision=t,r.rounding=n,Ar(_e>2?e.neg():e,t,n,!0)):new r(NaN)},Ir.squareRoot=Ir.sqrt=function(){var t,n,e,r,i,u,M=this,N=M.d,o=M.e,c=M.s,a=M.constructor;if(1!==c||!N||!N[0])return new a(!c||c<0&&(!N||N[0])?NaN:N?M:1/0);for(ir=!1,0==(c=Math.sqrt(+M))||c==1/0?(((n=jr(N)).length+o)%2==0&&(n+="0"),c=Math.sqrt(n),o=Nr((o+1)/2)-(o<0||o%2),r=new a(n=c==1/0?"5e"+o:(n=c.toExponential()).slice(0,n.indexOf("e")+1)+o)):r=new a(c.toString()),e=(o=a.precision)+3;;)if(r=(u=r).plus(Or(M,u,e+2,1)).times(.5),jr(u.d).slice(0,e)===(n=jr(r.d)).slice(0,e)){if("9999"!=(n=n.slice(e-3,e+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(Ar(r,o+1,1),t=!r.times(r).eq(M));break}if(!i&&(Ar(u,o+1,0),u.times(u).eq(M))){r=u;break}e+=4,i=1}return ir=!0,Ar(r,o,a.rounding,t)},Ir.tangent=Ir.tan=function(){var t,n,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(t=r.precision,n=r.rounding,r.precision=t+10,r.rounding=1,(e=e.sin()).s=1,e=Or(e,new r(1).minus(e.times(e)).sqrt(),t+10,0),r.precision=t,r.rounding=n,Ar(2==_e||4==_e?e.neg():e,t,n,!0)):new r(NaN)},Ir.times=Ir.mul=function(t){var n,e,r,i,u,M,N,o,c,a=this,D=a.constructor,s=a.d,T=(t=new D(t)).d;if(t.s*=a.s,!(s&&s[0]&&T&&T[0]))return new D(!t.s||s&&!s[0]&&!T||T&&!T[0]&&!s?NaN:s&&T?0*t.s:t.s/0);for(e=Nr(a.e/7)+Nr(t.e/7),(o=s.length)<(c=T.length)&&(u=s,s=T,T=u,M=o,o=c,c=M),u=[],r=M=o+c;r--;)u.push(0);for(r=c;--r>=0;){for(n=0,i=o+r;i>r;)N=u[i]+T[r]*s[i-r-1]+n,u[i--]=N%Tr|0,n=N/Tr|0;u[i]=(u[i]+n)%Tr|0}for(;!u[--M];)u.pop();return n?++e:u.shift(),t.d=u,t.e=Er(u,e),ir?Ar(t,D.precision,D.rounding):t},Ir.toBinary=function(t,n){return br(this,2,t,n)},Ir.toDecimalPlaces=Ir.toDP=function(t,n){var e=this,r=e.constructor;return e=new r(e),void 0===t?e:(yr(t,0,1e9),void 0===n?n=r.rounding:yr(n,0,8),Ar(e,t+e.e+1,n))},Ir.toExponential=function(t,n){var e,r=this,i=r.constructor;return void 0===t?e=xr(r,!0):(yr(t,0,1e9),void 0===n?n=i.rounding:yr(n,0,8),e=xr(r=Ar(new i(r),t+1,n),!0,t+1)),r.isNeg()&&!r.isZero()?"-"+e:e},Ir.toFixed=function(t,n){var e,r,i=this,u=i.constructor;return void 0===t?e=xr(i):(yr(t,0,1e9),void 0===n?n=u.rounding:yr(n,0,8),e=xr(r=Ar(new u(i),t+i.e+1,n),!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+e:e},Ir.toFraction=function(t){var n,e,r,i,u,M,N,o,c,a,D,s,T=this,g=T.d,l=T.constructor;if(!g)return new l(T);if(c=e=new l(1),r=o=new l(0),M=(u=(n=new l(r)).e=Ur(g)-T.e-1)%7,n.d[0]=or(10,M<0?7+M:M),null==t)t=u>0?n:c;else{if(!(N=new l(t)).isInt()||N.lt(c))throw Error(ur+N);t=N.gt(n)?u>0?n:c:N}for(ir=!1,N=new l(jr(g)),a=l.precision,l.precision=u=7*g.length*2;D=Or(N,n,0,1,1),1!=(i=e.plus(D.times(r))).cmp(t);)e=r,r=i,i=c,c=o.plus(D.times(i)),o=i,i=n,n=N.minus(D.times(i)),N=i;return i=Or(t.minus(e),r,0,1,1),o=o.plus(i.times(c)),e=e.plus(i.times(r)),o.s=c.s=T.s,s=Or(c,r,u,1).minus(T).abs().cmp(Or(o,e,u,1).minus(T).abs())<1?[c,r]:[o,e],l.precision=a,ir=!0,s},Ir.toHexadecimal=Ir.toHex=function(t,n){return br(this,16,t,n)},Ir.toNearest=function(t,n){var e=this,r=e.constructor;if(e=new r(e),null==t){if(!e.d)return e;t=new r(1),n=r.rounding}else{if(t=new r(t),void 0===n?n=r.rounding:yr(n,0,8),!e.d)return t.s?e:t;if(!t.d)return t.s&&(t.s=e.s),t}return t.d[0]?(ir=!1,e=Or(e,t,0,n,1).times(t),ir=!0,Ar(e)):(t.s=e.s,e=t),e},Ir.toNumber=function(){return+this},Ir.toOctal=function(t,n){return br(this,8,t,n)},Ir.toPower=Ir.pow=function(t){var n,e,r,i,u,M,N=this,o=N.constructor,c=+(t=new o(t));if(!(N.d&&t.d&&N.d[0]&&t.d[0]))return new o(or(+N,c));if((N=new o(N)).eq(1))return N;if(r=o.precision,u=o.rounding,t.eq(1))return Ar(N,r,u);if((n=Nr(t.e/7))>=t.d.length-1&&(e=c<0?-c:c)<=9007199254740991)return i=Cr(o,N,e,r),t.s<0?new o(1).div(i):Ar(i,r,u);if((M=N.s)<0){if(n<t.d.length-1)return new o(NaN);if(0==(1&t.d[n])&&(M=1),0==N.e&&1==N.d[0]&&1==N.d.length)return N.s=M,N}return(n=0!=(e=or(+N,c))&&isFinite(e)?new o(e+"").e:Nr(c*(Math.log("0."+jr(N.d))/Math.LN10+N.e+1)))>o.maxE+1||n<o.minE-1?new o(n>0?M/0:0):(ir=!1,o.rounding=N.s=1,e=Math.min(12,(n+"").length),(i=Sr(t.times(Lr(N,r+e)),r)).d&&hr((i=Ar(i,r+5,1)).d,r,u)&&(n=r+10,+jr((i=Ar(Sr(t.times(Lr(N,n+e)),n),n+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=Ar(i,r+1,0))),i.s=M,ir=!0,o.rounding=u,Ar(i,r,u))},Ir.toPrecision=function(t,n){var e,r=this,i=r.constructor;return void 0===t?e=xr(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(yr(t,1,1e9),void 0===n?n=i.rounding:yr(n,0,8),e=xr(r=Ar(new i(r),t,n),t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+e:e},Ir.toSignificantDigits=Ir.toSD=function(t,n){var e=this.constructor;return void 0===t?(t=e.precision,n=e.rounding):(yr(t,1,1e9),void 0===n?n=e.rounding:yr(n,0,8)),Ar(new e(this),t,n)},Ir.toString=function(){var t=this,n=t.constructor,e=xr(t,t.e<=n.toExpNeg||t.e>=n.toExpPos);return t.isNeg()&&!t.isZero()?"-"+e:e},Ir.truncated=Ir.trunc=function(){return Ar(new this.constructor(this),this.e+1,1)},Ir.valueOf=Ir.toJSON=function(){var t=this,n=t.constructor,e=xr(t,t.e<=n.toExpNeg||t.e>=n.toExpPos);return t.isNeg()?"-"+e:e};var Or=function(){function t(t,n,e){var r,i=0,u=t.length;for(t=t.slice();u--;)r=t[u]*n+i,t[u]=r%e|0,i=r/e|0;return i&&t.unshift(i),t}function n(t,n,e,r){var i,u;if(e!=r)u=e>r?1:-1;else for(i=u=0;i<e;i++)if(t[i]!=n[i]){u=t[i]>n[i]?1:-1;break}return u}function e(t,n,e,r){for(var i=0;e--;)t[e]-=i,i=t[e]<n[e]?1:0,t[e]=i*r+t[e]-n[e];for(;!t[0]&&t.length>1;)t.shift()}return function(r,i,u,M,N,o){var c,a,D,s,T,g,l,I,j,y,h,z,O,A,x,E,f,p,U,d,C=r.constructor,Q=r.s==i.s?1:-1,w=r.d,S=i.d;if(!(w&&w[0]&&S&&S[0]))return new C(r.s&&i.s&&(w?!S||w[0]!=S[0]:S)?w&&0==w[0]||!S?0*Q:Q/0:NaN);for(o?(T=1,a=r.e-i.e):(o=Tr,T=7,a=Nr(r.e/T)-Nr(i.e/T)),U=S.length,f=w.length,y=(j=new C(Q)).d=[],D=0;S[D]==(w[D]||0);D++);if(S[D]>(w[D]||0)&&a--,null==u?(A=u=C.precision,M=C.rounding):A=N?u+(r.e-i.e)+1:u,A<0)y.push(1),g=!0;else{if(A=A/T+2|0,D=0,1==U){for(s=0,S=S[0],A++;(D<f||s)&&A--;D++)x=s*o+(w[D]||0),y[D]=x/S|0,s=x%S|0;g=s||D<f}else{for((s=o/(S[0]+1)|0)>1&&(S=t(S,s,o),w=t(w,s,o),U=S.length,f=w.length),E=U,z=(h=w.slice(0,U)).length;z<U;)h[z++]=0;(d=S.slice()).unshift(0),p=S[0],S[1]>=o/2&&++p;do{s=0,(c=n(S,h,U,z))<0?(O=h[0],U!=z&&(O=O*o+(h[1]||0)),(s=O/p|0)>1?(s>=o&&(s=o-1),1==(c=n(l=t(S,s,o),h,I=l.length,z=h.length))&&(s--,e(l,U<I?d:S,I,o))):(0==s&&(c=s=1),l=S.slice()),(I=l.length)<z&&l.unshift(0),e(h,l,z,o),-1==c&&(c=n(S,h,U,z=h.length))<1&&(s++,e(h,U<z?d:S,z,o)),z=h.length):0===c&&(s++,h=[0]),y[D++]=s,c&&h[0]?h[z++]=w[E]||0:(h=[w[E]],z=1)}while((E++<f||void 0!==h[0])&&A--);g=void 0!==h[0]}y[0]||y.shift()}if(1==T)j.e=a,qe=g;else{for(D=1,s=y[0];s>=10;s/=10)D++;j.e=D+a*T-1,Ar(j,N?u+j.e+1:u,M,g)}return j}}();function Ar(t,n,e,r){var i,u,M,N,o,c,a,D,s,T=t.constructor;t:if(null!=n){if(!(D=t.d))return t;for(i=1,N=D[0];N>=10;N/=10)i++;if((u=n-i)<0)u+=7,M=n,o=(a=D[s=0])/or(10,i-M-1)%10|0;else if((s=Math.ceil((u+1)/7))>=(N=D.length)){if(!r)break t;for(;N++<=s;)D.push(0);a=o=0,i=1,M=(u%=7)-7+1}else{for(a=N=D[s],i=1;N>=10;N/=10)i++;o=(M=(u%=7)-7+i)<0?0:a/or(10,i-M-1)%10|0}if(r=r||n<0||void 0!==D[s+1]||(M<0?a:a%or(10,i-M-1)),c=e<4?(o||r)&&(0==e||e==(t.s<0?3:2)):o>5||5==o&&(4==e||r||6==e&&(u>0?M>0?a/or(10,i-M):0:D[s-1])%10&1||e==(t.s<0?8:7)),n<1||!D[0])return D.length=0,c?(n-=t.e+1,D[0]=or(10,(7-n%7)%7),t.e=-n||0):D[0]=t.e=0,t;if(0==u?(D.length=s,N=1,s--):(D.length=s+1,N=or(10,7-u),D[s]=M>0?(a/or(10,i-M)%or(10,M)|0)*N:0),c)for(;;){if(0==s){for(u=1,M=D[0];M>=10;M/=10)u++;for(M=D[0]+=N,N=1;M>=10;M/=10)N++;u!=N&&(t.e++,D[0]==Tr&&(D[0]=1));break}if(D[s]+=N,D[s]!=Tr)break;D[s--]=0,N=1}for(u=D.length;0===D[--u];)D.pop()}return ir&&(t.e>T.maxE?(t.d=null,t.e=NaN):t.e<T.minE&&(t.e=0,t.d=[0])),t}function xr(t,n,e){if(!t.isFinite())return kr(t);var r,i=t.e,u=jr(t.d),M=u.length;return n?(e&&(r=e-M)>0?u=u.charAt(0)+"."+u.slice(1)+dr(r):M>1&&(u=u.charAt(0)+"."+u.slice(1)),u=u+(t.e<0?"e":"e+")+t.e):i<0?(u="0."+dr(-i-1)+u,e&&(r=e-M)>0&&(u+=dr(r))):i>=M?(u+=dr(i+1-M),e&&(r=e-i-1)>0&&(u=u+"."+dr(r))):((r=i+1)<M&&(u=u.slice(0,r)+"."+u.slice(r)),e&&(r=e-M)>0&&(i+1===M&&(u+="."),u+=dr(r))),u}function Er(t,n){var e=t[0];for(n*=7;e>=10;e/=10)n++;return n}function fr(t,n,e){if(n>gr)throw ir=!0,e&&(t.precision=e),Error("[DecimalError] Precision limit exceeded");return Ar(new t(nr),n,1,!0)}function pr(t,n,e){if(n>lr)throw Error("[DecimalError] Precision limit exceeded");return Ar(new t(er),n,e,!0)}function Ur(t){var n=t.length-1,e=7*n+1;if(n=t[n]){for(;n%10==0;n/=10)e--;for(n=t[0];n>=10;n/=10)e++}return e}function dr(t){for(var n="";t--;)n+="0";return n}function Cr(t,n,e,r){var i,u=new t(1),M=Math.ceil(r/7+4);for(ir=!1;;){if(e%2&&Br((u=u.times(n)).d,M)&&(i=!0),0===(e=Nr(e/2))){e=u.d.length-1,i&&0===u.d[e]&&++u.d[e];break}Br((n=n.times(n)).d,M)}return ir=!0,u}function Qr(t){return 1&t.d[t.d.length-1]}function wr(t,n,e){for(var r,i=new t(n[0]),u=0;++u<n.length;){if(!(r=new t(n[u])).s){i=r;break}i[e](r)&&(i=r)}return i}function Sr(t,n){var e,r,i,u,M,N,o,c=0,a=0,D=0,s=t.constructor,T=s.rounding,g=s.precision;if(!t.d||!t.d[0]||t.e>17)return new s(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(null==n?(ir=!1,o=g):o=n,N=new s(.03125);t.e>-2;)t=t.times(N),D+=5;for(o+=r=Math.log(or(2,D))/Math.LN10*2+5|0,e=u=M=new s(1),s.precision=o;;){if(u=Ar(u.times(t),o,1),e=e.times(++a),jr((N=M.plus(Or(u,e,o,1))).d).slice(0,o)===jr(M.d).slice(0,o)){for(i=D;i--;)M=Ar(M.times(M),o,1);if(null!=n)return s.precision=g,M;if(!(c<3&&hr(M.d,o-r,T,c)))return Ar(M,s.precision=g,T,ir=!0);s.precision=o+=10,e=u=N=new s(1),a=0,c++}M=N}}function Lr(t,n){var e,r,i,u,M,N,o,c,a,D,s,T=1,g=t,l=g.d,I=g.constructor,j=I.rounding,y=I.precision;if(g.s<0||!l||!l[0]||!g.e&&1==l[0]&&1==l.length)return new I(l&&!l[0]?-1/0:1!=g.s?NaN:l?0:g);if(null==n?(ir=!1,a=y):a=n,I.precision=a+=10,r=(e=jr(l)).charAt(0),!(Math.abs(u=g.e)<15e14))return c=fr(I,a+2,y).times(u+""),g=Lr(new I(r+"."+e.slice(1)),a-10).plus(c),I.precision=y,null==n?Ar(g,y,j,ir=!0):g;for(;r<7&&1!=r||1==r&&e.charAt(1)>3;)r=(e=jr((g=g.times(t)).d)).charAt(0),T++;for(u=g.e,r>1?(g=new I("0."+e),u++):g=new I(r+"."+e.slice(1)),D=g,o=M=g=Or(g.minus(1),g.plus(1),a,1),s=Ar(g.times(g),a,1),i=3;;){if(M=Ar(M.times(s),a,1),jr((c=o.plus(Or(M,new I(i),a,1))).d).slice(0,a)===jr(o.d).slice(0,a)){if(o=o.times(2),0!==u&&(o=o.plus(fr(I,a+2,y).times(u+""))),o=Or(o,new I(T),a,1),null!=n)return I.precision=y,o;if(!hr(o.d,a-10,j,N))return Ar(o,I.precision=y,j,ir=!0);I.precision=a+=10,c=M=g=Or(D.minus(1),D.plus(1),a,1),s=Ar(g.times(g),a,1),i=N=1}o=c,i+=2}}function kr(t){return String(t.s*t.s/0)}function vr(t,n){var e,r,i;for((e=n.indexOf("."))>-1&&(n=n.replace(".","")),(r=n.search(/e/i))>0?(e<0&&(e=r),e+=+n.slice(r+1),n=n.substring(0,r)):e<0&&(e=n.length),r=0;48===n.charCodeAt(r);r++);for(i=n.length;48===n.charCodeAt(i-1);--i);if(n=n.slice(r,i)){if(i-=r,t.e=e=e-r-1,t.d=[],r=(e+1)%7,e<0&&(r+=7),r<i){for(r&&t.d.push(+n.slice(0,r)),i-=7;r<i;)t.d.push(+n.slice(r,r+=7));r=7-(n=n.slice(r)).length}else r-=i;for(;r--;)n+="0";t.d.push(+n),ir&&(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 Yr(t,n){var e,r,i,u,M,N,o,c,a;if(n.indexOf("_")>-1){if(n=n.replace(/(\d)_(?=\d)/g,"$1"),sr.test(n))return vr(t,n)}else if("Infinity"===n||"NaN"===n)return+n||(t.s=NaN),t.e=NaN,t.d=null,t;if(ar.test(n))e=16,n=n.toLowerCase();else if(cr.test(n))e=2;else{if(!Dr.test(n))throw Error(ur+n);e=8}for((u=n.search(/p/i))>0?(o=+n.slice(u+1),n=n.substring(2,u)):n=n.slice(2),M=(u=n.indexOf("."))>=0,r=t.constructor,M&&(u=(N=(n=n.replace(".","")).length)-u,i=Cr(r,new r(e),u,2*u)),u=a=(c=zr(n,e,Tr)).length-1;0===c[u];--u)c.pop();return u<0?new r(0*t.s):(t.e=Er(c,a),t.d=c,ir=!1,M&&(t=Or(t,i,4*N)),o&&(t=t.times(Math.abs(o)<54?or(2,o):di.pow(2,o))),ir=!0,t)}function mr(t,n,e,r,i){var u,M,N,o,c=t.precision,a=Math.ceil(c/7);for(ir=!1,o=e.times(e),N=new t(r);;){if(M=Or(N.times(o),new t(n++*n++),c,1),N=i?r.plus(M):r.minus(M),r=Or(M.times(o),new t(n++*n++),c,1),void 0!==(M=N.plus(r)).d[a]){for(u=a;M.d[u]===N.d[u]&&u--;);if(-1==u)break}u=N,N=r,r=M,M=u}return ir=!0,M.d.length=a+1,M}function Fr(t,n){for(var e=t;--n;)e*=t;return e}function Rr(t,n){var e,r=n.s<0,i=pr(t,t.precision,1),u=i.times(.5);if((n=n.abs()).lte(u))return _e=r?4:1,n;if((e=n.divToInt(i)).isZero())_e=r?3:2;else{if((n=n.minus(e.times(i))).lte(u))return _e=Qr(e)?r?2:3:r?4:1,n;_e=Qr(e)?r?1:4:r?3:2}return n.minus(i).abs()}function br(t,n,e,r){var i,u,M,N,o,c,a,D,s,T=t.constructor,g=void 0!==e;if(g?(yr(e,1,1e9),void 0===r?r=T.rounding:yr(r,0,8)):(e=T.precision,r=T.rounding),t.isFinite()){for(g?(i=2,16==n?e=4*e-3:8==n&&(e=3*e-2)):i=n,(M=(a=xr(t)).indexOf("."))>=0&&(a=a.replace(".",""),(s=new T(1)).e=a.length-M,s.d=zr(xr(s),10,i),s.e=s.d.length),u=o=(D=zr(a,10,i)).length;0==D[--o];)D.pop();if(D[0]){if(M<0?u--:((t=new T(t)).d=D,t.e=u,D=(t=Or(t,s,e,r,0,i)).d,u=t.e,c=qe),M=D[e],N=i/2,c=c||void 0!==D[e+1],c=r<4?(void 0!==M||c)&&(0===r||r===(t.s<0?3:2)):M>N||M===N&&(4===r||c||6===r&&1&D[e-1]||r===(t.s<0?8:7)),D.length=e,c)for(;++D[--e]>i-1;)D[e]=0,e||(++u,D.unshift(1));for(o=D.length;!D[o-1];--o);for(M=0,a="";M<o;M++)a+=tr.charAt(D[M]);if(g){if(o>1)if(16==n||8==n){for(M=16==n?4:3,--o;o%M;o++)a+="0";for(o=(D=zr(a,i,n)).length;!D[o-1];--o);for(M=1,a="1.";M<o;M++)a+=tr.charAt(D[M])}else a=a.charAt(0)+"."+a.slice(1);a=a+(u<0?"p":"p+")+u}else if(u<0){for(;++u;)a="0"+a;a="0."+a}else if(++u>o)for(u-=o;u--;)a+="0";else u<o&&(a=a.slice(0,u)+"."+a.slice(u))}else a=g?"0p+0":"0";a=(16==n?"0x":2==n?"0b":8==n?"0o":"")+a}else a=kr(t);return t.s<0?"-"+a:a}function Br(t,n){if(t.length>n)return t.length=n,!0}function Zr(t){return new this(t).abs()}function Vr(t){return new this(t).acos()}function Wr(t){return new this(t).acosh()}function Gr(t,n){return new this(t).plus(n)}function Pr(t){return new this(t).asin()}function Jr(t){return new this(t).asinh()}function Hr(t){return new this(t).atan()}function Xr(t){return new this(t).atanh()}function Kr(t,n){t=new this(t),n=new this(n);var e,r=this.precision,i=this.rounding,u=r+4;return t.s&&n.s?t.d||n.d?!n.d||t.isZero()?(e=n.s<0?pr(this,r,i):new this(0)).s=t.s:!t.d||n.isZero()?(e=pr(this,u,1).times(.5)).s=t.s:n.s<0?(this.precision=u,this.rounding=1,e=this.atan(Or(t,n,u,1)),n=pr(this,u,1),this.precision=r,this.rounding=i,e=t.s<0?e.minus(n):e.plus(n)):e=this.atan(Or(t,n,u,1)):(e=pr(this,u,1).times(n.s>0?.25:.75)).s=t.s:e=new this(NaN),e}function qr(t){return new this(t).cbrt()}function _r(t){return Ar(t=new this(t),t.e+1,2)}function $r(t,n,e){return new this(t).clamp(n,e)}function ti(t){if(!t||"object"!=typeof t)throw Error("[DecimalError] Object expected");var n,e,r,i=!0===t.defaults,u=["precision",1,1e9,"rounding",0,8,"toExpNeg",-$e,0,"toExpPos",0,$e,"maxE",0,$e,"minE",-$e,0,"modulo",0,9];for(n=0;n<u.length;n+=3)if(e=u[n],i&&(this[e]=rr[e]),void 0!==(r=t[e])){if(!(Nr(r)===r&&r>=u[n+1]&&r<=u[n+2]))throw Error(ur+e+": "+r);this[e]=r}if(e="crypto",i&&(this[e]=rr[e]),void 0!==(r=t[e])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(ur+e+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error("[DecimalError] crypto unavailable");this[e]=!0}else this[e]=!1}return this}function ni(t){return new this(t).cos()}function ei(t){return new this(t).cosh()}function ri(t,n){return new this(t).div(n)}function ii(t){return new this(t).exp()}function ui(t){return Ar(t=new this(t),t.e+1,3)}function Mi(){var t,n,e=new this(0);for(ir=!1,t=0;t<arguments.length;)if((n=new this(arguments[t++])).d)e.d&&(e=e.plus(n.times(n)));else{if(n.s)return ir=!0,new this(1/0);e=n}return ir=!0,e.sqrt()}function Ni(t){return t instanceof di||t&&t.toStringTag===Mr||!1}function oi(t){return new this(t).ln()}function ci(t,n){return new this(t).log(n)}function ai(t){return new this(t).log(2)}function Di(t){return new this(t).log(10)}function si(){return wr(this,arguments,"lt")}function Ti(){return wr(this,arguments,"gt")}function gi(t,n){return new this(t).mod(n)}function li(t,n){return new this(t).mul(n)}function Ii(t,n){return new this(t).pow(n)}function ji(t){var n,e,r,i,u=0,M=new this(1),N=[];if(void 0===t?t=this.precision:yr(t,1,1e9),r=Math.ceil(t/7),this.crypto)if(crypto.getRandomValues)for(n=crypto.getRandomValues(new Uint32Array(r));u<r;)(i=n[u])>=429e7?n[u]=crypto.getRandomValues(new Uint32Array(1))[0]:N[u++]=i%1e7;else{if(!crypto.randomBytes)throw Error("[DecimalError] crypto unavailable");for(n=crypto.randomBytes(r*=4);u<r;)(i=n[u]+(n[u+1]<<8)+(n[u+2]<<16)+((127&n[u+3])<<24))>=214e7?crypto.randomBytes(4).copy(n,u):(N.push(i%1e7),u+=4);u=r/4}else for(;u<r;)N[u++]=1e7*Math.random()|0;for(t%=7,(r=N[--u])&&t&&(i=or(10,7-t),N[u]=(r/i|0)*i);0===N[u];u--)N.pop();if(u<0)e=0,N=[0];else{for(e=-1;0===N[0];e-=7)N.shift();for(r=1,i=N[0];i>=10;i/=10)r++;r<7&&(e-=7-r)}return M.e=e,M.d=N,M}function yi(t){return Ar(t=new this(t),t.e+1,this.rounding)}function hi(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function zi(t){return new this(t).sin()}function Oi(t){return new this(t).sinh()}function Ai(t){return new this(t).sqrt()}function xi(t,n){return new this(t).sub(n)}function Ei(){var t=0,n=arguments,e=new this(n[t]);for(ir=!1;e.s&&++t<n.length;)e=e.plus(n[t]);return ir=!0,Ar(e,this.precision,this.rounding)}function fi(t){return new this(t).tan()}function pi(t){return new this(t).tanh()}function Ui(t){return Ar(t=new this(t),t.e+1,1)}Ir[Symbol.for("nodejs.util.inspect.custom")]=Ir.toString,Ir[Symbol.toStringTag]="Decimal";var di=Ir.constructor=function t(n){var e,r,i;function u(t){var n,e,r,i=this;if(!(i instanceof u))return new u(t);if(i.constructor=u,Ni(t))return i.s=t.s,void(ir?!t.d||t.e>u.maxE?(i.e=NaN,i.d=null):t.e<u.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"===(r=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(n=0,e=t;e>=10;e/=10)n++;return void(ir?n>u.maxE?(i.e=NaN,i.d=null):n<u.minE?(i.e=0,i.d=[0]):(i.e=n,i.d=[t]):(i.e=n,i.d=[t]))}return 0*t!=0?(t||(i.s=NaN),i.e=NaN,void(i.d=null)):vr(i,t.toString())}if("string"!==r)throw Error(ur+t);return 45===(e=t.charCodeAt(0))?(t=t.slice(1),i.s=-1):(43===e&&(t=t.slice(1)),i.s=1),sr.test(t)?vr(i,t):Yr(i,t)}if(u.prototype=Ir,u.ROUND_UP=0,u.ROUND_DOWN=1,u.ROUND_CEIL=2,u.ROUND_FLOOR=3,u.ROUND_HALF_UP=4,u.ROUND_HALF_DOWN=5,u.ROUND_HALF_EVEN=6,u.ROUND_HALF_CEIL=7,u.ROUND_HALF_FLOOR=8,u.EUCLID=9,u.config=u.set=ti,u.clone=t,u.isDecimal=Ni,u.abs=Zr,u.acos=Vr,u.acosh=Wr,u.add=Gr,u.asin=Pr,u.asinh=Jr,u.atan=Hr,u.atanh=Xr,u.atan2=Kr,u.cbrt=qr,u.ceil=_r,u.clamp=$r,u.cos=ni,u.cosh=ei,u.div=ri,u.exp=ii,u.floor=ui,u.hypot=Mi,u.ln=oi,u.log=ci,u.log10=Di,u.log2=ai,u.max=si,u.min=Ti,u.mod=gi,u.mul=li,u.pow=Ii,u.random=ji,u.round=yi,u.sign=hi,u.sin=zi,u.sinh=Oi,u.sqrt=Ai,u.sub=xi,u.sum=Ei,u.tan=fi,u.tanh=pi,u.trunc=Ui,void 0===n&&(n={}),n&&!0!==n.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<i.length;)n.hasOwnProperty(r=i[e++])||(n[r]=this[r]);return u.config(n),u}(rr);nr=new di(nr),er=new di(er);var Ci=di;function Qi(t){return"boolean"==typeof t||!!isFinite(t)&&t===Math.round(t)}var wi=Math.sign||function(t){return t>0?1:t<0?-1:0},Si=Math.log2||function(t){return Math.log(t)/Math.LN2},Li=Math.log10||function(t){return Math.log(t)/Math.LN10},ki=(Math.log1p,Math.cbrt||function(t){if(0===t)return t;var n,e=t<0;return e&&(t=-t),n=isFinite(t)?(t/((n=Math.exp(Math.log(t)/3))*n)+2*n)/3:t,e?-n:n}),vi=Math.expm1||function(t){return t>=2e-4||t<=-2e-4?Math.exp(t)-1:t+t*t/2+t*t*t/6};function Yi(t,n,e){var r={2:"0b",8:"0o",16:"0x"}[n],i="";if(e){if(e<1)throw new Error("size must be in greater than 0");if(!Qi(e))throw new Error("size must be an integer");if(t>2**(e-1)-1||t<-(2**(e-1)))throw new Error("Value must be in range [-2^".concat(e-1,", 2^").concat(e-1,"-1]"));if(!Qi(t))throw new Error("Value must be an integer");t<0&&(t+=2**e),i="i".concat(e)}var u="";return t<0&&(t=-t,u="-"),"".concat(u).concat(r).concat(t.toString(n)).concat(i)}function mi(t,n){if("function"==typeof n)return n(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var{notation:e,precision:r,wordSize:i}=Fi(n);switch(e){case"fixed":return bi(t,r);case"exponential":return Bi(t,r);case"engineering":return function(t,n){if(isNaN(t)||!isFinite(t))return String(t);var e=Zi(Ri(t),n),r=e.exponent,i=e.coefficients,u=r%3==0?r:r<0?r-3-r%3:r-r%3;if(ie(n))for(;n>i.length||r-u+1>i.length;)i.push(0);else for(var M=Math.abs(r-u)-(i.length-1),N=0;N<M;N++)i.push(0);var o=Math.abs(r-u),c=1;for(;o>0;)c++,o--;var a=i.slice(c).join(""),D=ie(n)&&a.length||a.match(/[1-9]/)?"."+a:"",s=i.slice(0,c).join("")+D+"e"+(r>=0?"+":"")+u.toString();return e.sign+s}(t,r);case"bin":return Yi(t,2,i);case"oct":return Yi(t,8,i);case"hex":return Yi(t,16,i);case"auto":return function(t,n,e){if(isNaN(t)||!isFinite(t))return String(t);var r=qi(null==e?void 0:e.lowerExp,-3),i=qi(null==e?void 0:e.upperExp,5),u=Ri(t),M=n?Zi(u,n):u;if(M.exponent<r||M.exponent>=i)return Bi(t,n);var N=M.coefficients,o=M.exponent;N.length<n&&(N=N.concat(Vi(n-N.length))),N=N.concat(Vi(o-N.length+1+(N.length<n?n-N.length:0))),N=Vi(-o).concat(N);var c=o>0?o:0;return c<N.length-1&&N.splice(c+1,0,"."),M.sign+N.join("")}(t,r,n).replace(/((\.\d*?)(0+))($|e)/,(function(){var t=arguments[2],n=arguments[4];return"."!==t?t+n:n}));default:throw new Error('Unknown notation "'+e+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Fi(t){var n,e,r="auto";if(void 0!==t)if(ie(t))n=t;else if(ue(t))n=t.toNumber();else{if(!xe(t))throw new Error("Unsupported type of options, number, BigNumber, or object expected");void 0!==t.precision&&(n=Ki(t.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),void 0!==t.wordSize&&(e=Ki(t.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),t.notation&&(r=t.notation)}return{notation:r,precision:n,wordSize:e}}function Ri(t){var n=String(t).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!n)throw new SyntaxError("Invalid number "+t);var e=n[1],r=n[2],i=parseFloat(n[4]||"0"),u=r.indexOf(".");i+=-1!==u?u-1:r.length-1;var M=r.replace(".","").replace(/^0*/,(function(t){return i-=t.length,""})).replace(/0*$/,"").split("").map((function(t){return parseInt(t)}));return 0===M.length&&(M.push(0),i++),{sign:e,coefficients:M,exponent:i}}function bi(t,n){if(isNaN(t)||!isFinite(t))return String(t);var e=Ri(t),r="number"==typeof n?Zi(e,e.exponent+1+n):e,i=r.coefficients,u=r.exponent+1,M=u+(n||0);return i.length<M&&(i=i.concat(Vi(M-i.length))),u<0&&(i=Vi(1-u).concat(i),u=1),u<i.length&&i.splice(u,0,0===u?"0.":"."),r.sign+i.join("")}function Bi(t,n){if(isNaN(t)||!isFinite(t))return String(t);var e=Ri(t),r=n?Zi(e,n):e,i=r.coefficients,u=r.exponent;i.length<n&&(i=i.concat(Vi(n-i.length)));var M=i.shift();return r.sign+M+(i.length>0?"."+i.join(""):"")+"e"+(u>=0?"+":"")+u}function Zi(t,n){for(var e={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},r=e.coefficients;n<=0;)r.unshift(0),e.exponent++,n++;if(r.length>n&&r.splice(n,r.length-n)[0]>=5){var i=n-1;for(r[i]++;10===r[i];)r.pop(),0===i&&(r.unshift(0),e.exponent++,i++),r[--i]++}return e}function Vi(t){for(var n=[],e=0;e<t;e++)n.push(0);return n}var Wi=Number.EPSILON||2220446049250313e-31;function Gi(t,n,e){if(null==e)return t===n;if(t===n)return!0;if(isNaN(t)||isNaN(n))return!1;if(isFinite(t)&&isFinite(n)){var r=Math.abs(t-n);return r<=Wi||r<=Math.max(Math.abs(t),Math.abs(n))*e}return!1}var Pi=Math.acosh||function(t){return Math.log(Math.sqrt(t*t-1)+t)},Ji=Math.asinh||function(t){return Math.log(Math.sqrt(t*t+1)+t)},Hi=Math.atanh||function(t){return Math.log((1+t)/(1-t))/2},Xi=(Math.cosh,Math.sinh||function(t){return(Math.exp(t)-Math.exp(-t))/2});Math.tanh;function Ki(t,n){return ie(t)?t:ue(t)?t.toNumber():void n()}function qi(t,n){return ie(t)?t:ue(t)?t.toNumber():n}function _i(t,n,e){var r=new(0,t.constructor)(2),i="";if(e){if(e<1)throw new Error("size must be in greater than 0");if(!Qi(e))throw new Error("size must be an integer");if(t.greaterThan(r.pow(e-1).sub(1))||t.lessThan(r.pow(e-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(e-1,", 2^").concat(e-1,"-1]"));if(!t.isInteger())throw new Error("Value must be an integer");t.lessThan(0)&&(t=t.add(r.pow(e))),i="i".concat(e)}switch(n){case 2:return"".concat(t.toBinary()).concat(i);case 8:return"".concat(t.toOctal()).concat(i);case 16:return"".concat(t.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(n," not supported "))}}function $i(t,n){if("function"==typeof n)return n(t);if(!t.isFinite())return t.isNaN()?"NaN":t.gt(0)?"Infinity":"-Infinity";var{notation:e,precision:r,wordSize:i}=Fi(n);switch(e){case"fixed":return function(t,n){return t.toFixed(n)}(t,r);case"exponential":return tu(t,r);case"engineering":return function(t,n){var e=t.e,r=e%3==0?e:e<0?e-3-e%3:e-e%3,i=t.mul(Math.pow(10,-r)).toPrecision(n);if(-1!==i.indexOf("e")){var u=t.constructor;i=new u(i).toFixed()}return i+"e"+(e>=0?"+":"")+r.toString()}(t,r);case"bin":return _i(t,2,i);case"oct":return _i(t,8,i);case"hex":return _i(t,16,i);case"auto":var u=nu(null==n?void 0:n.lowerExp,-3),M=nu(null==n?void 0:n.upperExp,5);if(t.isZero())return"0";var N=t.toSignificantDigits(r),o=N.e;return(o>=u&&o<M?N.toFixed():tu(t,r)).replace(/((\.\d*?)(0+))($|e)/,(function(){var t=arguments[2],n=arguments[4];return"."!==t?t+n:n}));default:throw new Error('Unknown notation "'+e+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function tu(t,n){return void 0!==n?t.toExponential(n-1):t.toExponential()}function nu(t,n){return ie(t)?t:ue(t)?t.toNumber():n}function eu(t,n){var e=function(t,n){if("number"==typeof t)return mi(t,n);if(ue(t))return $i(t,n);if(function(t){return t&&"object"==typeof t&&"number"==typeof t.s&&"number"==typeof t.n&&"number"==typeof t.d||!1}(t))return n&&"decimal"===n.fraction?t.toString():t.s*t.n+"/"+t.d;if(Array.isArray(t))return function t(n,e){if(Array.isArray(n)){for(var r="[",i=n.length,u=0;u<i;u++)0!==u&&(r+=", "),r+=t(n[u],e);return r+="]"}return eu(n,e)}(t,n);if(ce(t))return ru(t);if("function"==typeof t)return t.syntax?String(t.syntax):"function";if(t&&"object"==typeof t){return"function"==typeof t.format?t.format(n):t&&t.toString(n)!=={}.toString()?t.toString(n):"{"+Object.keys(t).map(e=>ru(e)+": "+eu(t[e],n)).join(", ")+"}"}return String(t)}(t,n);return n&&"object"==typeof n&&"truncate"in n&&e.length>n.truncate?e.substring(0,n.truncate-3)+"...":e}function ru(t){for(var n=String(t),e="",r=0;r<n.length;){var i=n.charAt(r);e+=i in iu?iu[i]:i,r++}return'"'+e+'"'}var iu={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"};function uu(t,n){if(!ce(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Ve(t)+", index: 0)");if(!ce(n))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Ve(n)+", index: 1)");return t===n?0:t>n?1:-1}function Mu(t,n,e){if(!(this instanceof Mu))throw new SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=n,this.relation=e,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(n)?"["+n.join(", ")+"]":n)+")",this.stack=(new Error).stack}function Nu(t,n,e){if(!(this instanceof Nu))throw new SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=n):(this.min=n,this.max=e),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 ou(t){for(var n=[];Array.isArray(t);)n.push(t.length),t=t[0];return n}function cu(t,n){if(0===n.length){if(Array.isArray(t))throw new Mu(t.length,0)}else!function t(n,e,r){var i,u=n.length;if(u!==e[r])throw new Mu(u,e[r]);if(r<e.length-1){var M=r+1;for(i=0;i<u;i++){var N=n[i];if(!Array.isArray(N))throw new Mu(e.length-1,e.length,"<");t(n[i],e,M)}}else for(i=0;i<u;i++)if(Array.isArray(n[i]))throw new Mu(e.length+1,e.length,">")}(t,n,0)}function au(t,n){if(void 0!==t){if(!ie(t)||!Qi(t))throw new TypeError("Index must be an integer (value: "+t+")");if(t<0||"number"==typeof n&&t>=n)throw new Nu(t,n)}}function Du(t,n,e){if(!Array.isArray(n))throw new TypeError("Array expected");if(0===n.length)throw new Error("Resizing to scalar is not supported");return n.forEach((function(t){if(!ie(t)||!Qi(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+eu(n)+")")})),(ie(t)||ue(t))&&(t=[t]),function t(n,e,r,i){var u,M,N=n.length,o=e[r],c=Math.min(N,o);if(n.length=o,r<e.length-1){var a=r+1;for(u=0;u<c;u++)M=n[u],Array.isArray(M)||(M=[M],n[u]=M),t(M,e,a,i);for(u=c;u<o;u++)M=[],n[u]=M,t(M,e,a,i)}else{for(u=0;u<c;u++)for(;Array.isArray(n[u]);)n[u]=n[u][0];for(u=c;u<o;u++)n[u]=i}}(t,n,0,void 0!==e?e:0),t}function su(t,n){var e=Iu(t),r=e.length;if(!Array.isArray(t)||!Array.isArray(n))throw new TypeError("Array expected");if(0===n.length)throw new Mu(0,r,"!=");var i=gu(n=Tu(n,r));if(r!==i)throw new Mu(i,r,"!=");try{return function(t,n){for(var e,r=t,i=n.length-1;i>0;i--){var u=n[i];e=[];for(var M=r.length/u,N=0;N<M;N++)e.push(r.slice(N*u,(N+1)*u));r=e}return r}(e,n)}catch(t){if(t instanceof Mu)throw new Mu(i,r,"!=");throw t}}function Tu(t,n){var e=gu(t),r=t.slice(),i=t.indexOf(-1);if(t.indexOf(-1,i+1)>=0)throw new Error("More than one wildcard in sizes");if(i>=0){if(!(n%e==0))throw new Error("Could not replace wildcard, since "+n+" is no multiple of "+-e);r[i]=-n/e}return r}function gu(t){return t.reduce((t,n)=>t*n,1)}function lu(t,n,e,r){var i=r||ou(t);if(e)for(var u=0;u<e;u++)t=[t],i.unshift(1);for(t=function t(n,e,r){var i,u;if(Array.isArray(n)){var M=r+1;for(i=0,u=n.length;i<u;i++)n[i]=t(n[i],e,M)}else for(var N=r;N<e;N++)n=[n];return n}(t,n,0);i.length<n;)i.push(1);return t}function Iu(t){if(!Array.isArray(t))return t;var n=[];return t.forEach((function t(e){Array.isArray(e)?e.forEach(t):n.push(e)})),n}function ju(t,n){for(var e,r=0,i=0;i<t.length;i++){var u=t[i],M=Array.isArray(u);if(0===i&&M&&(r=u.length),M&&u.length!==r)return;var N=M?ju(u,n):n(u);if(void 0===e)e=N;else if(e!==N)return"mixed"}return e}function yu(t,n,e,r){if(r<e){if(t.length!==n.length)throw new Mu(t.length,n.length);for(var i=[],u=0;u<t.length;u++)i[u]=yu(t[u],n[u],e,r+1);return i}return t.concat(n)}function hu(){var t=Array.prototype.slice.call(arguments,0,-1),n=Array.prototype.slice.call(arguments,-1);if(1===t.length)return t[0];if(t.length>1)return t.slice(1).reduce((function(t,e){return yu(t,e,n,0)}),t[0]);throw new Error("Wrong number of arguments in function concat")}function zu(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];for(var r=n.map(t=>t.length),i=Math.max(...r),u=new Array(i).fill(null),M=0;M<n.length;M++)for(var N=n[M],o=r[M],c=0;c<o;c++){var a=i-o+c;N[c]>u[a]&&(u[a]=N[c])}for(var D=0;D<n.length;D++)Ou(n[D],u);return u}function Ou(t,n){for(var e=n.length,r=t.length,i=0;i<r;i++){var u=e-r+i;if(t[i]<n[u]&&t[i]>1||t[i]>n[u])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(t,") not possible to broadcast dimension ").concat(r," with size ").concat(t[i]," to size ").concat(n[u]))}}function Au(t,n){var e=ou(t);if(Pe(e,n))return t;Ou(e,n);var r,i,u,M=zu(e,n),N=M.length,o=[...Array(N-e.length).fill(1),...e],c=function(t){return ee()([],t)}(t);e.length<N&&(e=ou(c=su(c,o)));for(var a=0;a<N;a++)e[a]<M[a]&&(r=c,i=M[a],u=a,e=ou(c=hu(...Array(i).fill(r),u)));return c}function xu(t,n,e,r){function i(r){var i=function(t,n){for(var e={},r=0;r<n.length;r++){var i=n[r],u=t[i];void 0!==u&&(e[i]=u)}return e}(r,n.map(Eu));return function(t,n,e){if(!n.filter(t=>!function(t){return t&&"?"===t[0]}(t)).every(t=>void 0!==e[t])){var r=n.filter(t=>void 0===e[t]);throw new Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(r.map(t=>'"'.concat(t,'"')).join(", "),"."))}}(t,n,r),e(i)}return i.isFactory=!0,i.fn=t,i.dependencies=n.slice().sort(),r&&(i.meta=r),i}function Eu(t){return t&&"?"===t[0]?t.slice(1):t}Mu.prototype=new RangeError,Mu.prototype.constructor=RangeError,Mu.prototype.name="DimensionError",Mu.prototype.isDimensionError=!0,Nu.prototype=new RangeError,Nu.prototype.constructor=RangeError,Nu.prototype.name="IndexError",Nu.prototype.isIndexError=!0;var fu=xu("BigNumber",["?on","config"],t=>{var{on:n,config:e}=t,r=Ci.clone({precision:e.precision,modulo:Ci.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(t){return new r(t.value)},n&&n("config",(function(t,n){t.precision!==n.precision&&r.config({precision:t.precision})})),r},{isClass:!0}),pu=e(10),Uu=e.n(pu),du=xu("Complex",[],()=>(Object.defineProperty(Uu.a,"name",{value:"Complex"}),Uu.a.prototype.constructor=Uu.a,Uu.a.prototype.type="Complex",Uu.a.prototype.isComplex=!0,Uu.a.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Uu.a.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Uu.a.prototype.format=function(t){var n=this.im,e=this.re,r=mi(this.re,t),i=mi(this.im,t),u=ie(t)?t:t?t.precision:null;if(null!==u){var M=Math.pow(10,-u);Math.abs(e/n)<M&&(e=0),Math.abs(n/e)<M&&(n=0)}return 0===n?r:0===e?1===n?"i":-1===n?"-i":i+"i":n<0?-1===n?r+" - i":r+" - "+i.substring(1)+"i":1===n?r+" + i":r+" + "+i+"i"},Uu.a.fromPolar=function(t){switch(arguments.length){case 1:var n=arguments[0];if("object"==typeof n)return Uu()(n);throw new TypeError("Input has to be an object with r and phi keys.");case 2:var e=arguments[0],r=arguments[1];if(ie(e)){if(oe(r)&&r.hasBase("ANGLE")&&(r=r.toNumber("rad")),ie(r))return new Uu.a({r:e,phi:r});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")}},Uu.a.prototype.valueOf=Uu.a.prototype.toString,Uu.a.fromJSON=function(t){return new Uu.a(t)},Uu.a.compare=function(t,n){return t.re>n.re?1:t.re<n.re?-1:t.im>n.im?1:t.im<n.im?-1:0},Uu.a),{isClass:!0});function Cu(t){var n=0,e=1,r=Object.create(null),i=Object.create(null),u=0,M=function(t){var M=i[t];if(M&&(delete r[M],delete i[t],--n,e===M)){if(!n)return u=0,void(e=1);for(;!Object.prototype.hasOwnProperty.call(r,++e););}};return t=Math.abs(t),{hit:function(N){var o=i[N],c=++u;if(r[c]=N,i[N]=c,!o){if(++n<=t)return;return N=r[e],M(N),N}if(delete r[o],e===o)for(;!Object.prototype.hasOwnProperty.call(r,++e););},delete:M,clear:function(){n=u=0,e=1,r=Object.create(null),i=Object.create(null)}}}function Qu(t){var{hasher:n,limit:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e=null==e?Number.POSITIVE_INFINITY:e,n=null==n?JSON.stringify:n,function r(){"object"!=typeof r.cache&&(r.cache={values:new Map,lru:Cu(e||Number.POSITIVE_INFINITY)});for(var i=[],u=0;u<arguments.length;u++)i[u]=arguments[u];var M=n(i);if(r.cache.values.has(M))return r.cache.lru.hit(M),r.cache.values.get(M);var N=t.apply(t,i);return r.cache.values.set(M,N),r.cache.values.delete(r.cache.lru.hit(M)),N}}function wu(t){return Object.keys(t.signatures||{}).reduce((function(t,n){var e=(n.match(/,/g)||[]).length+1;return Math.max(t,e)}),-1)}Qu((function(t){return new t(1).exp()}),{hasher:Lu}),Qu((function(t){return new t(1).plus(new t(5).sqrt()).div(2)}),{hasher:Lu});var Su=Qu((function(t){return t.acos(-1)}),{hasher:Lu});Qu((function(t){return Su(t).times(2)}),{hasher:Lu});function Lu(t){return t[0].precision}Math.PI,Math.PI,Math.E;ku("fineStructure",.0072973525693),ku("weakMixingAngle",.2229),ku("efimovFactor",22.7),ku("sackurTetrode",-1.16487052358);function ku(t,n){return xu(t,["config","BigNumber"],t=>{var{config:e,BigNumber:r}=t;return"BigNumber"===e.number?new r(n):n})}var vu=e(16),Yu=e.n(vu),mu=xu("Fraction",[],()=>(Object.defineProperty(Yu.a,"name",{value:"Fraction"}),Yu.a.prototype.constructor=Yu.a,Yu.a.prototype.type="Fraction",Yu.a.prototype.isFraction=!0,Yu.a.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Yu.a.fromJSON=function(t){return new Yu.a(t)},Yu.a),{isClass:!0}),Fu=xu("Matrix",[],()=>{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,n){throw new Error("Cannot invoke create on a Matrix interface")},t.prototype.subset=function(t,n,e){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,n,e){throw new Error("Cannot invoke set on a Matrix interface")},t.prototype.resize=function(t,n){throw new Error("Cannot invoke resize on a Matrix interface")},t.prototype.reshape=function(t,n){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,n){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[Symbol.iterator]=function(){throw new Error("Cannot iterate 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}),Ru=xu("DenseMatrix",["Matrix"],t=>{var{Matrix:n}=t;function e(t,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");if(n&&!ce(n))throw new Error("Invalid datatype: "+n);if(De(t))"DenseMatrix"===t.type?(this._data=We(t._data),this._size=We(t._size),this._datatype=n||t._datatype):(this._data=t.toArray(),this._size=t.size(),this._datatype=n||t._datatype);else if(t&&ae(t.data)&&ae(t.size))this._data=t.data,this._size=t.size,cu(this._data,this._size),this._datatype=n||t.datatype;else if(ae(t))this._data=N(t),this._size=ou(this._data),cu(this._data,this._size),this._datatype=n;else{if(t)throw new TypeError("Unsupported type of data ("+Ve(t)+")");this._data=[],this._size=[0],this._datatype=n}}function r(t,n){if(!Ie(n))throw new TypeError("Invalid index");if(n.isScalar())return t.get(n.min());var r=n.size();if(r.length!==t._size.length)throw new Mu(r.length,t._size.length);for(var i=n.min(),u=n.max(),M=0,N=t._size.length;M<N;M++)au(i[M],t._size[M]),au(u[M],t._size[M]);return new e(function t(n,e,r,i){var u=i===r-1,M=e.dimension(i);return u?M.map((function(t){return au(t,n.length),n[t]})).valueOf():M.map((function(u){au(u,n.length);var M=n[u];return t(M,e,r,i+1)})).valueOf()}(t._data,n,r.length,0),t._datatype)}function i(t,n,e,r){if(!n||!0!==n.isIndex)throw new TypeError("Invalid index");var i,u=n.size(),N=n.isScalar();if(De(e)?(i=e.size(),e=e.valueOf()):i=ou(e),N){if(0!==i.length)throw new TypeError("Scalar expected");t.set(n.min(),e,r)}else{if(!Pe(i,u))try{i=ou(e=0===i.length?Au([e],u):Au(e,u))}catch(t){}if(u.length<t._size.length)throw new Mu(u.length,t._size.length,"<");if(i.length<u.length){for(var o=0,c=0;1===u[o]&&1===i[o];)o++;for(;1===u[o];)c++,o++;e=lu(e,u.length,c,i)}if(!Pe(u,i))throw new Mu(u,i,">");M(t,n.max().map((function(t){return t+1})),r);var a=u.length;!function t(n,e,r,i,u){var M=u===i-1,N=e.dimension(u);M?N.forEach((function(t,e){au(t),n[t]=r[e[0]]})):N.forEach((function(M,N){au(M),t(n[M],e,r[N[0]],i,u+1)}))}(t._data,n,e,a,0)}return t}function u(t,n,e){if(0===n.length){for(var r=t._data;ae(r);)r=r[0];return r}return t._size=n.slice(0),t._data=Du(t._data,t._size,e),t}function M(t,n,e){for(var r=t._size.slice(0),i=!1;r.length<n.length;)r.push(0),i=!0;for(var M=0,N=n.length;M<N;M++)n[M]>r[M]&&(r[M]=n[M],i=!0);i&&u(t,r,e)}function N(t){return De(t)?N(t.valueOf()):ae(t)?t.map(N):t}return e.prototype=new n,e.prototype.createDenseMatrix=function(t,n){return new e(t,n)},Object.defineProperty(e,"name",{value:"DenseMatrix"}),e.prototype.constructor=e,e.prototype.type="DenseMatrix",e.prototype.isDenseMatrix=!0,e.prototype.getDataType=function(){return ju(this._data,Ve)},e.prototype.storage=function(){return"dense"},e.prototype.datatype=function(){return this._datatype},e.prototype.create=function(t,n){return new e(t,n)},e.prototype.subset=function(t,n,e){switch(arguments.length){case 1:return r(this,t);case 2:case 3:return i(this,t,n,e);default:throw new SyntaxError("Wrong number of arguments")}},e.prototype.get=function(t){if(!ae(t))throw new TypeError("Array expected");if(t.length!==this._size.length)throw new Mu(t.length,this._size.length);for(var n=0;n<t.length;n++)au(t[n],this._size[n]);for(var e=this._data,r=0,i=t.length;r<i;r++){var u=t[r];au(u,e.length),e=e[u]}return e},e.prototype.set=function(t,n,e){if(!ae(t))throw new TypeError("Array expected");if(t.length<this._size.length)throw new Mu(t.length,this._size.length,"<");var r,i,u;M(this,t.map((function(t){return t+1})),e);var N=this._data;for(r=0,i=t.length-1;r<i;r++)au(u=t[r],N.length),N=N[u];return au(u=t[t.length-1],N.length),N[u]=n,this},e.prototype.resize=function(t,n,e){if(!se(t))throw new TypeError("Array or Matrix expected");var r=t.valueOf().map(t=>Array.isArray(t)&&1===t.length?t[0]:t);return u(e?this.clone():this,r,n)},e.prototype.reshape=function(t,n){var e=n?this.clone():this;e._data=su(e._data,t);var r=e._size.reduce((t,n)=>t*n);return e._size=Tu(t,r),e},e.prototype.clone=function(){return new e({data:We(this._data),size:We(this._size),datatype:this._datatype})},e.prototype.size=function(){return this._size.slice(0)},e.prototype.map=function(t){var n=this,r=wu(t),i=function e(i,u){return ae(i)?i.map((function(t,n){return e(t,u.concat(n))})):1===r?t(i):2===r?t(i,u):t(i,u,n)}(this._data,[]);return new e(i,void 0!==this._datatype?ju(i,Ve):void 0)},e.prototype.forEach=function(t){var n=this;!function e(r,i){ae(r)?r.forEach((function(t,n){e(t,i.concat(n))})):t(r,i,n)}(this._data,[])},e.prototype[Symbol.iterator]=function*(){yield*function*t(n,e){if(ae(n))for(var r=0;r<n.length;r++)yield*t(n[r],e.concat(r));else yield{value:n,index:e}}(this._data,[])},e.prototype.rows=function(){var t=[];if(2!==this.size().length)throw new TypeError("Rows can only be returned for a 2D matrix.");var n=this._data;for(var r of n)t.push(new e([r],this._datatype));return t},e.prototype.columns=function(){var t=this,n=[],r=this.size();if(2!==r.length)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,u=function(r){var u=i.map(t=>[t[r]]);n.push(new e(u,t._datatype))},M=0;M<r[1];M++)u(M);return n},e.prototype.toArray=function(){return We(this._data)},e.prototype.valueOf=function(){return this._data},e.prototype.format=function(t){return eu(this._data,t)},e.prototype.toString=function(){return eu(this._data)},e.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},e.prototype.diagonal=function(t){if(t){if(ue(t)&&(t=t.toNumber()),!ie(t)||!Qi(t))throw new TypeError("The parameter k must be an integer number")}else t=0;for(var n=t>0?t:0,r=t<0?-t:0,i=this._size[0],u=this._size[1],M=Math.min(i-r,u-n),N=[],o=0;o<M;o++)N[o]=this._data[o+r][o+n];return new e({data:N,size:[M],datatype:this._datatype})},e.diagonal=function(t,n,r,i){if(!ae(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(ue(t)&&(t=t.toNumber()),!ie(t)||!Qi(t)||t<1)throw new Error("Size values must be positive integers");return t})),r){if(ue(r)&&(r=r.toNumber()),!ie(r)||!Qi(r))throw new TypeError("The parameter k must be an integer number")}else r=0;var u,M=r>0?r:0,N=r<0?-r:0,o=t[0],c=t[1],a=Math.min(o-N,c-M);if(ae(n)){if(n.length!==a)throw new Error("Invalid value array length");u=function(t){return n[t]}}else if(De(n)){var D=n.size();if(1!==D.length||D[0]!==a)throw new Error("Invalid matrix length");u=function(t){return n.get([t])}}else u=function(){return n};i||(i=ue(u(0))?u(0).mul(0):0);var s=[];if(t.length>0){s=Du(s,t,i);for(var T=0;T<a;T++)s[T+N][T+M]=u(T)}return new e({data:s,size:[o,c]})},e.fromJSON=function(t){return new e(t)},e.prototype.swapRows=function(t,n){if(!(ie(t)&&Qi(t)&&ie(n)&&Qi(n)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return au(t,this._size[0]),au(n,this._size[0]),e._swapRows(t,n,this._data),this},e._swapRows=function(t,n,e){var r=e[t];e[t]=e[n],e[n]=r},e},{isClass:!0});function bu(){return!0}function Bu(){return!1}function Zu(){}var Vu=function t(){function n(t){return"object"==typeof t&&null!==t&&t.constructor===Object}const e=[{name:"number",test:function(t){return"number"==typeof t}},{name:"string",test:function(t){return"string"==typeof t}},{name:"boolean",test:function(t){return"boolean"==typeof t}},{name:"Function",test:function(t){return"function"==typeof t}},{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:n},{name:"null",test:function(t){return null===t}},{name:"undefined",test:function(t){return void 0===t}}],r={name:"any",test:bu,isAny:!0};let i,u,M=0,N={createCount:0};function o(t){const n=i.get(t);if(n)return n;let e='Unknown type "'+t+'"';const r=t.toLowerCase();let M;for(M of u)if(M.toLowerCase()===r){e+='. Did you mean "'+M+'" ?';break}throw new TypeError(e)}function c(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any";const e=n?o(n).index:u.length,r=[];for(let n=0;n<t.length;++n){if(!t[n]||"string"!=typeof t[n].name||"function"!=typeof t[n].test)throw new TypeError("Object with properties {name: string, test: function} expected");const u=t[n].name;if(i.has(u))throw new TypeError('Duplicate type name "'+u+'"');r.push(u),i.set(u,{name:u,test:t[n].test,isAny:t[n].isAny,index:e+n,conversionsTo:[]})}const M=u.slice(e);u=u.slice(0,e).concat(r).concat(M);for(let t=e+r.length;t<u.length;++t)i.get(u[t]).index=t}function a(){i=new Map,u=[],M=0,c([r],!1)}function D(t){const n=u.filter(n=>{const e=i.get(n);return!e.isAny&&e.test(t)});return n.length?n:["any"]}function s(t){return t&&"function"==typeof t&&"_typedFunctionData"in t}function T(t,n,e){if(!s(t))throw new TypeError("Argument is not a typed-function.");const r=e&&e.exact,i=y(Array.isArray(n)?n.join(","):n),u=g(i);if(!r||u in t.signatures){const n=t._typedFunctionData.signatureMap.get(u);if(n)return n}const M=i.length;let N,o;if(r){let n;for(n in N=[],t.signatures)N.push(t._typedFunctionData.signatureMap.get(n))}else N=t._typedFunctionData.signatures;for(let t=0;t<M;++t){const n=i[t],e=[];let r;for(r of N){const i=A(r.params,t);if(i&&(!n.restParam||i.restParam)){if(!i.hasAny){const t=j(i);if(n.types.some(n=>!t.has(n.name)))continue}e.push(r)}}if(N=e,0===N.length)break}for(o of N)if(o.params.length<=M)return o;throw new TypeError("Signature not found (signature: "+(t.name||"unnamed")+"("+g(i,", ")+"))")}function g(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return t.map(t=>t.name).join(n)}function l(t){const n=0===t.indexOf("..."),e=(n?t.length>3?t.slice(3):"any":t).split("|").map(t=>o(t.trim()));let r=!1,i=n?"...":"";return{types:e.map((function(t){return r=t.isAny||r,i+=t.name+"|",{name:t.name,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:null,conversionIndex:-1}})),name:i.slice(0,-1),hasAny:r,hasConversion:!1,restParam:n}}function I(t){const n=function(t){if(0===t.length)return[];const n=t.map(o);t.length>1&&n.sort((t,n)=>t.index-n.index);let e=n[0].conversionsTo;if(1===t.length)return e;e=e.concat([]);const r=new Set(t);for(let t=1;t<n.length;++t){let i;for(i of n[t].conversionsTo)r.has(i.from)||(e.push(i),r.add(i.from))}return e}(t.types.map(t=>t.name));let e=t.hasAny,r=t.name;const i=n.map((function(t){const n=o(t.from);return e=n.isAny||e,r+="|"+t.from,{name:t.from,typeIndex:n.index,test:n.test,isAny:n.isAny,conversion:t,conversionIndex:t.index}}));return{types:t.types.concat(i),name:r,hasAny:e,hasConversion:i.length>0,restParam:t.restParam}}function j(t){return t.typeSet||(t.typeSet=new Set,t.types.forEach(n=>t.typeSet.add(n.name))),t.typeSet}function y(t){const n=[];if("string"!=typeof t)throw new TypeError("Signatures must be strings");const e=t.trim();if(""===e)return n;const r=e.split(",");for(let t=0;t<r.length;++t){const e=l(r[t].trim());if(e.restParam&&t!==r.length-1)throw new SyntaxError('Unexpected rest parameter "'+r[t]+'": only allowed for the last parameter');if(0===e.types.length)return null;n.push(e)}return n}function h(t){const n=b(t);return!!n&&n.restParam}function z(t){if(t&&0!==t.types.length){if(1===t.types.length)return o(t.types[0].name).test;if(2===t.types.length){const n=o(t.types[0].name).test,e=o(t.types[1].name).test;return function(t){return n(t)||e(t)}}{const n=t.types.map((function(t){return o(t.name).test}));return function(t){for(let e=0;e<n.length;e++)if(n[e](t))return!0;return!1}}}return bu}function O(t){let n,e,r;if(h(t)){n=R(t).map(z);const e=n.length,r=z(b(t)),i=function(t){for(let n=e;n<t.length;n++)if(!r(t[n]))return!1;return!0};return function(t){for(let e=0;e<n.length;e++)if(!n[e](t[e]))return!1;return i(t)&&t.length>=e+1}}return 0===t.length?function(t){return 0===t.length}:1===t.length?(e=z(t[0]),function(t){return e(t[0])&&1===t.length}):2===t.length?(e=z(t[0]),r=z(t[1]),function(t){return e(t[0])&&r(t[1])&&2===t.length}):(n=t.map(z),function(t){for(let e=0;e<n.length;e++)if(!n[e](t[e]))return!1;return t.length===n.length})}function A(t,n){return n<t.length?t[n]:h(t)?b(t):null}function x(t,n){const e=A(t,n);return e?j(e):new Set}function E(t){return null===t.conversion||void 0===t.conversion}function f(t,n){const e=new Set;return t.forEach(t=>{const r=x(t.params,n);let i;for(i of r)e.add(i)}),e.has("any")?["any"]:Array.from(e)}function p(t,n,e){let r,i;const u=t||"unnamed";let M,N=e;for(M=0;M<n.length;M++){const t=[];if(N.forEach(e=>{const r=z(A(e.params,M));(M<e.params.length||h(e.params))&&r(n[M])&&t.push(e)}),0===t.length){if(i=f(N,M),i.length>0){const t=D(n[M]);return r=new TypeError("Unexpected type of argument in function "+u+" (expected: "+i.join(" or ")+", actual: "+t.join(" | ")+", index: "+M+")"),r.data={category:"wrongType",fn:u,index:M,actual:t,expected:i},r}}else N=t}const o=N.map((function(t){return h(t.params)?1/0:t.params.length}));if(n.length<Math.min.apply(null,o))return i=f(N,M),r=new TypeError("Too few arguments in function "+u+" (expected: "+i.join(" or ")+", index: "+n.length+")"),r.data={category:"tooFewArgs",fn:u,index:n.length,expected:i},r;const c=Math.max.apply(null,o);if(n.length>c)return r=new TypeError("Too many arguments in function "+u+" (expected: "+c+", actual: "+n.length+")"),r.data={category:"tooManyArgs",fn:u,index:n.length,expectedLength:c},r;const a=[];for(let t=0;t<n.length;++t)a.push(D(n[t]).join("|"));return r=new TypeError('Arguments of type "'+a.join(", ")+'" do not match any of the defined signatures of function '+u+"."),r.data={category:"mismatch",actual:a},r}function U(t){let n=u.length+1;for(let e=0;e<t.types.length;e++)E(t.types[e])&&(n=Math.min(n,t.types[e].typeIndex));return n}function d(t){let n=M+1;for(let e=0;e<t.types.length;e++)E(t.types[e])||(n=Math.min(n,t.types[e].conversionIndex));return n}function C(t,n){if(t.hasAny){if(!n.hasAny)return 1}else if(n.hasAny)return-1;if(t.restParam){if(!n.restParam)return 1}else if(n.restParam)return-1;if(t.hasConversion){if(!n.hasConversion)return 1}else if(n.hasConversion)return-1;const e=U(t)-U(n);if(e<0)return-1;if(e>0)return 1;const r=d(t)-d(n);return r<0?-1:r>0?1:0}function Q(t,n){const e=t.params,r=n.params,i=b(e),u=b(r),M=h(e),N=h(r);if(M&&i.hasAny){if(!N||!u.hasAny)return 1}else if(N&&u.hasAny)return-1;let o,c=0,a=0;for(o of e)o.hasAny&&++c,o.hasConversion&&++a;let D=0,s=0;for(o of r)o.hasAny&&++D,o.hasConversion&&++s;if(c!==D)return c-D;if(M&&i.hasConversion){if(!N||!u.hasConversion)return 1}else if(N&&u.hasConversion)return-1;if(a!==s)return a-s;if(M){if(!N)return 1}else if(N)return-1;const T=(e.length-r.length)*(M?-1:1);if(0!==T)return T;const g=[];let l,I=0;for(let t=0;t<e.length;++t){const n=C(e[t],r[t]);g.push(n),I+=n}if(0!==I)return I;for(l of g)if(0!==l)return l;return 0}function w(t,n){let e=n;if(t.some(t=>t.hasConversion)){const r=h(t),i=t.map(S);e=function(){const t=[],e=r?arguments.length-1:arguments.length;for(let n=0;n<e;n++)t[n]=i[n](arguments[n]);return r&&(t[e]=arguments[e].map(i[e])),n.apply(this,t)}}let r=e;if(h(t)){const n=t.length-1;r=function(){return e.apply(this,B(arguments,0,n).concat([B(arguments,n)]))}}return r}function S(t){let n,e,r,i;const u=[],M=[];switch(t.types.forEach((function(t){t.conversion&&(u.push(o(t.conversion.from).test),M.push(t.conversion.convert))})),M.length){case 0:return function(t){return t};case 1:return n=u[0],r=M[0],function(t){return n(t)?r(t):t};case 2:return n=u[0],e=u[1],r=M[0],i=M[1],function(t){return n(t)?r(t):e(t)?i(t):t};default:return function(t){for(let n=0;n<M.length;n++)if(u[n](t))return M[n](t);return t}}}function L(t){return function t(n,e,r){if(e<n.length){const M=n[e];let N=[];if(M.restParam){const t=M.types.filter(E);t.length<M.types.length&&N.push({types:t,name:"..."+t.map(t=>t.name).join("|"),hasAny:t.some(t=>t.isAny),hasConversion:!1,restParam:!0}),N.push(M)}else N=M.types.map((function(t){return{types:[t],name:t.name,hasAny:t.isAny,hasConversion:t.conversion,restParam:!1}}));return i=N,u=function(i){return t(n,e+1,r.concat([i]))},Array.prototype.concat.apply([],i.map(u))}return[r];var i,u}(t,0,[])}function k(t,n){const e=Math.max(t.length,n.length);for(let r=0;r<e;r++){const e=x(t,r),i=x(n,r);let u,M=!1;for(u of i)if(e.has(u)){M=!0;break}if(!M)return!1}const r=t.length,i=n.length,u=h(t),M=h(n);return u?M?r===i:i>=r:M?r>=i:r===i}function v(t,n,e){const r=[];let i;for(i of t){let t=e[i];if("number"!=typeof t)throw new TypeError('No definition for referenced signature "'+i+'"');if(t=n[t],"function"!=typeof t)return!1;r.push(t)}return r}function Y(t,n,e){const r=function(t){return t.map(t=>G(t)?V(t.referToSelf.callback):W(t)?Z(t.referTo.references,t.referTo.callback):t)}(t),i=new Array(r.length).fill(!1);let u=!0;for(;u;){u=!1;let t=!0;for(let M=0;M<r.length;++M){if(i[M])continue;const N=r[M];if(G(N))r[M]=N.referToSelf.callback(e),r[M].referToSelf=N.referToSelf,i[M]=!0,t=!1;else if(W(N)){const e=v(N.referTo.references,r,n);e?(r[M]=N.referTo.callback.apply(this,e),r[M].referTo=N.referTo,i[M]=!0,t=!1):u=!0}}if(t&&u)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return r}function m(t,n){if(N.createCount++,0===Object.keys(n).length)throw new SyntaxError("No signatures provided");N.warnAgainstDeprecatedThis&&function(t){const n=/\bthis(\(|\.signatures\b)/;Object.keys(t).forEach(e=>{const r=t[e];if(n.test(r.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}(n);const e=[],r=[],i={},u=[];let M;for(M in n){if(!Object.prototype.hasOwnProperty.call(n,M))continue;const t=y(M);if(!t)continue;e.forEach((function(n){if(k(n,t))throw new TypeError('Conflicting signatures "'+g(n)+'" and "'+g(t)+'".')})),e.push(t);const N=r.length;r.push(n[M]);const o=t.map(I);let c;for(c of L(o)){const t=g(c);u.push({params:c,name:t,fn:N}),c.every(t=>!t.hasConversion)&&(i[t]=N)}}u.sort(Q);const o=Y(r,i,ut);let c;for(c in i)Object.prototype.hasOwnProperty.call(i,c)&&(i[c]=o[i[c]]);const a=[],D=new Map;for(c of u)D.has(c.name)||(c.fn=o[c.fn],a.push(c),D.set(c.name,c));const s=a[0]&&a[0].params.length<=2&&!h(a[0].params),T=a[1]&&a[1].params.length<=2&&!h(a[1].params),l=a[2]&&a[2].params.length<=2&&!h(a[2].params),j=a[3]&&a[3].params.length<=2&&!h(a[3].params),A=a[4]&&a[4].params.length<=2&&!h(a[4].params),x=a[5]&&a[5].params.length<=2&&!h(a[5].params),E=s&&T&&l&&j&&A&&x;for(let t=0;t<a.length;++t)a[t].test=O(a[t].params);const f=s?z(a[0].params[0]):Bu,p=T?z(a[1].params[0]):Bu,U=l?z(a[2].params[0]):Bu,d=j?z(a[3].params[0]):Bu,C=A?z(a[4].params[0]):Bu,S=x?z(a[5].params[0]):Bu,v=s?z(a[0].params[1]):Bu,m=T?z(a[1].params[1]):Bu,F=l?z(a[2].params[1]):Bu,R=j?z(a[3].params[1]):Bu,b=A?z(a[4].params[1]):Bu,B=x?z(a[5].params[1]):Bu;for(let t=0;t<a.length;++t)a[t].implementation=w(a[t].params,a[t].fn);const Z=s?a[0].implementation:Zu,V=T?a[1].implementation:Zu,W=l?a[2].implementation:Zu,G=j?a[3].implementation:Zu,P=A?a[4].implementation:Zu,J=x?a[5].implementation:Zu,H=s?a[0].params.length:-1,X=T?a[1].params.length:-1,K=l?a[2].params.length:-1,q=j?a[3].params.length:-1,_=A?a[4].params.length:-1,$=x?a[5].params.length:-1,tt=E?6:0,nt=a.length,et=a.map(t=>t.test),rt=a.map(t=>t.implementation),it=function(){for(let t=tt;t<nt;t++)if(et[t](arguments))return rt[t].apply(this,arguments);return N.onMismatch(t,arguments,a)};function ut(t,n){return arguments.length===H&&f(t)&&v(n)?Z.apply(this,arguments):arguments.length===X&&p(t)&&m(n)?V.apply(this,arguments):arguments.length===K&&U(t)&&F(n)?W.apply(this,arguments):arguments.length===q&&d(t)&&R(n)?G.apply(this,arguments):arguments.length===_&&C(t)&&b(n)?P.apply(this,arguments):arguments.length===$&&S(t)&&B(n)?J.apply(this,arguments):it.apply(this,arguments)}try{Object.defineProperty(ut,"name",{value:t})}catch(t){}return ut.signatures=i,ut._typedFunctionData={signatures:a,signatureMap:D},ut}function F(t,n,e){throw p(t,n,e)}function R(t){return B(t,0,t.length-1)}function b(t){return t[t.length-1]}function B(t,n,e){return Array.prototype.slice.call(t,n,e)}function Z(t,n){return{referTo:{references:t,callback:n}}}function V(t){if("function"!=typeof t)throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:t}}}function W(t){return t&&"object"==typeof t.referTo&&Array.isArray(t.referTo.references)&&"function"==typeof t.referTo.callback}function G(t){return t&&"object"==typeof t.referToSelf&&"function"==typeof t.referToSelf.callback}function P(t,n){if(!t)return n;if(n&&n!==t){const e=new Error("Function names do not match (expected: "+t+", actual: "+n+")");throw e.data={actual:n,expected:t},e}return t}function J(t){let n;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(s(t[e])||"string"==typeof t[e].signature)&&(n=P(n,t[e].name));return n}function H(t,n){let e;for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){if(e in t&&n[e]!==t[e]){const r=new Error('Signature "'+e+'" is defined twice');throw r.data={signature:e,sourceFunction:n[e],destFunction:t[e]},r}t[e]=n[e]}}a(),c(e);const X=N;function K(t){if(!t||"string"!=typeof t.from||"string"!=typeof t.to||"function"!=typeof t.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(t.to===t.from)throw new SyntaxError('Illegal to define conversion from "'+t.from+'" to itself.')}return N=function(t){const e="string"==typeof t,r=e?1:0;let i=e?t:"";const u={};for(let t=r;t<arguments.length;++t){const r=arguments[t];let M,N={};if("function"==typeof r?(M=r.name,"string"==typeof r.signature?N[r.signature]=r:s(r)&&(N=r.signatures)):n(r)&&(N=r,e||(M=J(r))),0===Object.keys(N).length){const n=new TypeError("Argument to 'typed' at index "+t+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw n.data={index:t,argument:r},n}e||(i=P(i,M)),H(u,N)}return m(i||"",u)},N.create=t,N.createCount=X.createCount,N.onMismatch=F,N.throwMismatchError=F,N.createError=p,N.clear=a,N.clearConversions=function(){let t;for(t of u)i.get(t).conversionsTo=[];M=0},N.addTypes=c,N._findType=o,N.referTo=function(){const t=R(arguments).map(t=>g(y(t))),n=b(arguments);if("function"!=typeof n)throw new TypeError("Callback function expected as last argument");return Z(t,n)},N.referToSelf=V,N.convert=function(t,n){const e=o(n);if(e.test(t))return t;const r=e.conversionsTo;if(0===r.length)throw new Error("There are no conversions to "+n+" defined.");for(let n=0;n<r.length;n++){if(o(r[n].from).test(t))return r[n].convert(t)}throw new Error("Cannot convert "+t+" to "+n)},N.findSignature=T,N.find=function(t,n,e){return T(t,n,e).implementation},N.isTypedFunction=s,N.warnAgainstDeprecatedThis=!0,N.addType=function(t,n){let e="any";!1!==n&&i.has("Object")&&(e="Object"),N.addTypes([t],e)},N.addConversion=function(t){K(t);const n=o(t.to);if(!n.conversionsTo.every((function(n){return n.from!==t.from})))throw new Error('There is already a conversion from "'+t.from+'" to "'+n.name+'"');n.conversionsTo.push({from:t.from,convert:t.convert,index:M++})},N.addConversions=function(t){t.forEach(N.addConversion)},N.removeConversion=function(t){K(t);const n=o(t.to),e=function(t,n){for(let e=0;e<t.length;e++)if(n(t[e]))return t[e]}(n.conversionsTo,n=>n.from===t.from);if(!e)throw new Error("Attempt to remove nonexistent conversion from "+t.from+" to "+t.to);if(e.convert!==t.convert)throw new Error("Conversion to remove does not match existing conversion");const r=n.conversionsTo.indexOf(e);n.conversionsTo.splice(r,1)},N.resolve=function(t,n){if(!s(t))throw new TypeError("Argument is not a typed-function.");const e=t._typedFunctionData.signatures;for(let t=0;t<e.length;++t)if(e[t].test(n))return e[t];return null},N}();function Wu(t,n){if(Hu(t)&&Pu(t,n))return t[n];if("function"==typeof t[n]&&Ju(t,n))throw new Error('Cannot access method "'+n+'" as a property');throw new Error('No access to property "'+n+'"')}function Gu(t,n,e){if(Hu(t)&&Pu(t,n))return t[n]=e,e;throw new Error('No access to property "'+n+'"')}function Pu(t,n){return!(!t||"object"!=typeof t)&&(!!Je(Xu,n)||!(n in Object.prototype)&&!(n in Function.prototype))}function Ju(t,n){return null!=t&&"function"==typeof t[n]&&(!(Je(t,n)&&Object.getPrototypeOf&&n in Object.getPrototypeOf(t))&&(!!Je(Ku,n)||!(n in Object.prototype)&&!(n in Function.prototype)))}function Hu(t){return"object"==typeof t&&t&&t.constructor===Object}var Xu={length:!0,name:!0},Ku={toString:!0,valueOf:!0,toLocaleString:!0};class qu{constructor(t){this.wrappedObject=t,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(t){return Wu(this.wrappedObject,t)}set(t,n){return Gu(this.wrappedObject,t,n),this}has(t){return n=this.wrappedObject,t in n;var n}entries(){return _u(this.keys(),t=>[t,this.get(t)])}forEach(t){for(var n of this.keys())t(this.get(n),n,this)}delete(t){delete this.wrappedObject[t]}clear(){for(var t of this.keys())this.delete(t)}get size(){return Object.keys(this.wrappedObject).length}}function _u(t,n){return{next:()=>{var e=t.next();return e.done?e:{value:n(e.value),done:!1}}}}function $u(t){return!!t&&(t instanceof Map||t instanceof qu||"function"==typeof t.set&&"function"==typeof t.get&&"function"==typeof t.keys&&"function"==typeof t.has)}var tM=function(){return tM=Vu.create,Vu},nM=xu("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],(function(t){var{BigNumber:n,Complex:e,DenseMatrix:r,Fraction:i}=t,u=tM();return u.clear(),u.addTypes([{name:"number",test:ie},{name:"Complex",test:Me},{name:"BigNumber",test:ue},{name:"Fraction",test:Ne},{name:"Unit",test:oe},{name:"identifier",test:t=>ce&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(t)},{name:"string",test:ce},{name:"Chain",test:Ze},{name:"Array",test:ae},{name:"Matrix",test:De},{name:"DenseMatrix",test:Te},{name:"SparseMatrix",test:ge},{name:"Range",test:le},{name:"Index",test:Ie},{name:"boolean",test:je},{name:"ResultSet",test:ye},{name:"Help",test:he},{name:"function",test:ze},{name:"Date",test:Oe},{name:"RegExp",test:Ae},{name:"null",test:Ee},{name:"undefined",test:fe},{name:"AccessorNode",test:pe},{name:"ArrayNode",test:Ue},{name:"AssignmentNode",test:de},{name:"BlockNode",test:Ce},{name:"ConditionalNode",test:Qe},{name:"ConstantNode",test:we},{name:"FunctionNode",test:Le},{name:"FunctionAssignmentNode",test:Se},{name:"IndexNode",test:ke},{name:"Node",test:ve},{name:"ObjectNode",test:Ye},{name:"OperatorNode",test:me},{name:"ParenthesisNode",test:Fe},{name:"RangeNode",test:Re},{name:"RelationalNode",test:be},{name:"SymbolNode",test:Be},{name:"Map",test:$u},{name:"Object",test:xe}]),u.addConversions([{from:"number",to:"BigNumber",convert:function(t){if(n||eM(t),t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)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 n(t)}},{from:"number",to:"Complex",convert:function(t){return e||rM(t),new e(t,0)}},{from:"BigNumber",to:"Complex",convert:function(t){return e||rM(t),new e(t.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(t){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 e||rM(t),new e(t.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(t){i||iM(t);var n=new i(t);if(n.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 n}},{from:"string",to:"number",convert:function(t){var n=Number(t);if(isNaN(n))throw new Error('Cannot convert "'+t+'" to a number');return n}},{from:"string",to:"BigNumber",convert:function(t){n||eM(t);try{return new n(t)}catch(n){throw new Error('Cannot convert "'+t+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(t){i||iM(t);try{return new i(t)}catch(n){throw new Error('Cannot convert "'+t+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(t){e||rM(t);try{return new e(t)}catch(n){throw new Error('Cannot convert "'+t+'" to Complex')}}},{from:"boolean",to:"number",convert:function(t){return+t}},{from:"boolean",to:"BigNumber",convert:function(t){return n||eM(t),new n(+t)}},{from:"boolean",to:"Fraction",convert:function(t){return i||iM(t),new i(+t)}},{from:"boolean",to:"string",convert:function(t){return String(t)}},{from:"Array",to:"Matrix",convert:function(t){return r||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new r(t)}},{from:"Matrix",to:"Array",convert:function(t){return t.valueOf()}}]),u.onMismatch=(t,n,e)=>{var r=u.createError(t,n,e);if(["wrongType","mismatch"].includes(r.data.category)&&1===n.length&&se(n[0])&&e.some(t=>!t.params.includes(","))){var i=new TypeError("Function '".concat(t,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(t,")'."));throw i.data=r.data,i}throw r},u.onMismatch=(t,n,e)=>{var r=u.createError(t,n,e);if(["wrongType","mismatch"].includes(r.data.category)&&1===n.length&&se(n[0])&&e.some(t=>!t.params.includes(","))){var i=new TypeError("Function '".concat(t,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(t,")'."));throw i.data=r.data,i}throw r},u}));function eM(t){throw new Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function rM(t){throw new Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function iM(t){throw new Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}function uM(t,n,e){return t&&"function"==typeof t.map?t.map((function(t){return uM(t,n,e)})):n(t)}var MM="number",NM="number, number";function oM(t){return Math.abs(t)}function cM(t,n){return t+n}function aM(t,n){return t-n}function DM(t,n){return t*n}function sM(t){return-t}function TM(t){return t}function gM(t){return ki(t)}function lM(t){return t*t*t}function IM(t){return Math.exp(t)}function jM(t){return vi(t)}function yM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Parameters in function lcm must be integer numbers");if(0===t||0===n)return 0;for(var e,r=t*n;0!==n;)n=t%(e=n),t=e;return Math.abs(r/t)}function hM(t){return Li(t)}function zM(t){return Si(t)}function OM(t){return wi(t)}function AM(t){return t*t}function xM(t,n){var e,r,i,u=0,M=1,N=1,o=0;if(!Qi(t)||!Qi(n))throw new Error("Parameters in function xgcd must be integer numbers");for(;n;)i=t-(r=Math.floor(t/n))*n,e=u,u=M-r*u,M=e,e=N,N=o-r*N,o=e,t=n,n=i;return t<0?[-t,-M,-o]:[t,t?M:0,o]}function EM(t,n){return t*t<1&&n===1/0||t*t>1&&n===-1/0?0:Math.pow(t,n)}oM.signature=MM,cM.signature=NM,aM.signature=NM,DM.signature=NM,sM.signature=MM,TM.signature=MM,gM.signature=MM,lM.signature=MM,IM.signature=MM,jM.signature=MM,yM.signature=NM,hM.signature=MM,zM.signature=MM,OM.signature=MM,AM.signature=MM,xM.signature=NM,EM.signature=NM;function fM(t){return Pi(t)}function pM(t){return Math.atan(1/t)}function UM(t){return isFinite(t)?(Math.log((t+1)/t)+Math.log(t/(t-1)))/2:0}function dM(t){return Math.asin(1/t)}function CM(t){var n=1/t;return Math.log(n+Math.sqrt(n*n+1))}function QM(t){return Math.acos(1/t)}function wM(t){var n=1/t,e=Math.sqrt(n*n-1);return Math.log(e+n)}function SM(t){return Ji(t)}function LM(t){return Hi(t)}function kM(t){return 1/Math.tan(t)}function vM(t){var n=Math.exp(2*t);return(n+1)/(n-1)}function YM(t){return 1/Math.sin(t)}function mM(t){return 0===t?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(t)-Math.exp(-t)))*wi(t)}function FM(t){return 1/Math.cos(t)}function RM(t){return 2/(Math.exp(t)+Math.exp(-t))}function bM(t){return Xi(t)}fM.signature="number",pM.signature="number",UM.signature="number",dM.signature="number",CM.signature="number",QM.signature="number",wM.signature="number",SM.signature="number",LM.signature="number",kM.signature="number",vM.signature="number",YM.signature="number",mM.signature="number",FM.signature="number",RM.signature="number",bM.signature="number";var BM=xu("addScalar",["typed"],t=>{var{typed:n}=t;return n("addScalar",{"number, number":cM,"Complex, Complex":function(t,n){return t.add(n)},"BigNumber, BigNumber":function(t,n){return t.plus(n)},"Fraction, Fraction":function(t,n){return t.add(n)},"Unit, Unit":n.referToSelf(t=>(e,r)=>{if(null===e.value||void 0===e.value)throw new Error("Parameter x contains a unit with undefined value");if(null===r.value||void 0===r.value)throw new Error("Parameter y contains a unit with undefined value");if(!e.equalBase(r))throw new Error("Units do not match");var i=e.clone();return i.value=n.find(t,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i})})});var ZM="number, number";function VM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function bitAnd");return t&n}function WM(t){if(!Qi(t))throw new Error("Integer expected in function bitNot");return~t}function GM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function bitOr");return t|n}function PM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function bitXor");return t^n}function JM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function leftShift");return t<<n}function HM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function rightArithShift");return t>>n}function XM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function rightLogShift");return t>>>n}VM.signature=ZM,WM.signature="number",GM.signature=ZM,PM.signature=ZM,JM.signature=ZM,HM.signature=ZM,XM.signature=ZM;function KM(t,n){if(n<t)return 1;if(n===t)return n;var e=n+t>>1;return KM(t,e)*KM(e+1,n)}function qM(t,n){if(!Qi(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(!Qi(n)||n<0)throw new TypeError("Positive integer value expected in function combinations");if(n>t)throw new TypeError("k must be less than or equal to n");for(var e=t-n,r=1,i=2,u=n<e?n:e,M=n<e?e+1:n+1;M<=t;++M)for(r*=M;i<=u&&r%i==0;)r/=i,++i;return i<=u&&(r/=KM(i,u)),r}qM.signature="number, number";var _M=xu("conj",["typed"],t=>{var{typed:n}=t;return n("conj",{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":n.referToSelf(t=>n=>uM(n,t))})});function $M(t,n,e){if(null==e)return t.eq(n);if(t.eq(n))return!0;if(t.isNaN()||n.isNaN())return!1;if(t.isFinite()&&n.isFinite()){var r=t.minus(n).abs();if(r.isZero())return!0;var i=t.constructor.max(t.abs(),n.abs());return r.lte(i.times(e))}return!1}var tN=xu("compareUnits",["typed"],t=>{var{typed:n}=t;return{"Unit, Unit":n.referToSelf(t=>(e,r)=>{if(!e.equalBase(r))throw new Error("Cannot compare units with different base");return n.find(t,[e.valueType(),r.valueType()])(e.value,r.value)})}}),nN=xu("equalScalar",["typed","config"],t=>{var{typed:n,config:e}=t;return n("equalScalar",{"boolean, boolean":function(t,n){return t===n},"number, number":function(t,n){return Gi(t,n,e.epsilon)},"BigNumber, BigNumber":function(t,n){return t.eq(n)||$M(t,n,e.epsilon)},"Fraction, Fraction":function(t,n){return t.equals(n)},"Complex, Complex":function(t,n){return function(t,n,e){return Gi(t.re,n.re,e)&&Gi(t.im,n.im,e)}(t,n,e.epsilon)}},tN({typed:n}))});xu("equalScalar",["typed","config"],t=>{var{typed:n,config:e}=t;return n("equalScalar",{"number, number":function(t,n){return Gi(t,n,e.epsilon)}})}),Math.pow(2,53);xu("hex",["typed","format"],t=>{var{typed:n,format:e}=t;return n("hex",{"number | BigNumber":function(t){return e(t,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(t,n){return e(t,{notation:"hex",wordSize:n})}})});function eN(t){return t<0}function rN(t){return t>0}function iN(t){return 0===t}function uN(t){return Number.isNaN(t)}eN.signature="number",rN.signature="number",iN.signature="number",uN.signature="number";function MN(t){var n;if(Qi(t))return t<=0?isFinite(t)?1/0:NaN:t>171?1/0:KM(1,t-1);if(t<.5)return Math.PI/(Math.sin(Math.PI*t)*MN(1-t));if(t>=171.35)return 1/0;if(t>85){var e=t*t,r=e*t,i=r*t,u=i*t;return Math.sqrt(2*Math.PI/t)*Math.pow(t/Math.E,t)*(1+1/(12*t)+1/(288*e)-139/(51840*r)-571/(2488320*i)+163879/(209018880*u)+5246819/(75246796800*u*t))}--t,n=oN[0];for(var M=1;M<oN.length;++M)n+=oN[M]/(t+M);var N=t+NN+.5;return Math.sqrt(2*Math.PI)*Math.pow(N,t+.5)*Math.exp(-N)*n}MN.signature="number";var NN=4.7421875,oN=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],cN=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function aN(t){if(t<0)return NaN;if(0===t)return 1/0;if(!isFinite(t))return t;if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-aN(1-t);for(var n=(t-=1)+5+.5,e=cN[0],r=6;r>=1;r--)e+=cN[r]/(t+r);return.9189385332046728+(t+.5)*Math.log(n)-n+Math.log(e)}aN.signature="number";var DN=xu("multiplyScalar",["typed"],t=>{var{typed:n}=t;return n("multiplyScalar",{"number, number":DM,"Complex, Complex":function(t,n){return t.mul(n)},"BigNumber, BigNumber":function(t,n){return t.times(n)},"Fraction, Fraction":function(t,n){return t.mul(n)},"number | Fraction | BigNumber | Complex, Unit":(t,n)=>n.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,n)=>t.multiply(n)})});function sN(t){return!t}function TN(t,n){return!(!t&&!n)}function gN(t,n){return!!t!=!!n}function lN(t,n){return!(!t||!n)}sN.signature="number",TN.signature="number, number",gN.signature="number, number",lN.signature="number, number";xu("oct",["typed","format"],t=>{var{typed:n,format:e}=t;return n("oct",{"number | BigNumber":function(t){return e(t,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(t,n){return e(t,{notation:"oct",wordSize:n})}})});var IN=e(22),jN=e.n(IN);Date.now();var yN=xu("SparseMatrix",["typed","equalScalar","Matrix"],t=>{var{typed:n,equalScalar:e,Matrix:r}=t;function i(t,n){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(n&&!ce(n))throw new Error("Invalid datatype: "+n);if(De(t))!function(t,n,e){"SparseMatrix"===n.type?(t._values=n._values?We(n._values):void 0,t._index=We(n._index),t._ptr=We(n._ptr),t._size=We(n._size),t._datatype=e||n._datatype):u(t,n.valueOf(),e||n._datatype)}(this,t,n);else if(t&&ae(t.index)&&ae(t.ptr)&&ae(t.size))this._values=t.values,this._index=t.index,this._ptr=t.ptr,this._size=t.size,this._datatype=n||t.datatype;else if(ae(t))u(this,t,n);else{if(t)throw new TypeError("Unsupported type of data ("+Ve(t)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=n}}function u(t,r,i){t._values=[],t._index=[],t._ptr=[],t._datatype=i;var u=r.length,M=0,N=e,o=0;if(ce(i)&&(N=n.find(e,[i,i])||e,o=n.convert(0,i)),u>0){var c=0;do{t._ptr.push(t._index.length);for(var a=0;a<u;a++){var D=r[a];if(ae(D)){if(0===c&&M<D.length&&(M=D.length),c<D.length){var s=D[c];N(s,o)||(t._values.push(s),t._index.push(a))}}else 0===c&&M<1&&(M=1),N(D,o)||(t._values.push(D),t._index.push(a))}c++}while(c<M)}t._ptr.push(t._index.length),t._size=[u,M]}function M(t,n){if(!Ie(n))throw new TypeError("Invalid index");if(n.isScalar())return t.get(n.min());var e,r,u,M,N=n.size();if(N.length!==t._size.length)throw new Mu(N.length,t._size.length);var o=n.min(),c=n.max();for(e=0,r=t._size.length;e<r;e++)au(o[e],t._size[e]),au(c[e],t._size[e]);var a=t._values,D=t._index,s=t._ptr,T=n.dimension(0),g=n.dimension(1),l=[],I=[];T.forEach((function(t,n){I[t]=n[0],l[t]=!0}));var j=a?[]:void 0,y=[],h=[];return g.forEach((function(t){for(h.push(y.length),u=s[t],M=s[t+1];u<M;u++)e=D[u],!0===l[e]&&(y.push(I[e]),j&&j.push(a[u]))})),h.push(y.length),new i({values:j,index:y,ptr:h,size:N,datatype:t._datatype})}function N(t,n,e,r){if(!n||!0!==n.isIndex)throw new TypeError("Invalid index");var i,u=n.size(),M=n.isScalar();if(De(e)?(i=e.size(),e=e.toArray()):i=ou(e),M){if(0!==i.length)throw new TypeError("Scalar expected");t.set(n.min(),e,r)}else{if(1!==u.length&&2!==u.length)throw new Mu(u.length,t._size.length,"<");if(i.length<u.length){for(var N=0,o=0;1===u[N]&&1===i[N];)N++;for(;1===u[N];)o++,N++;e=lu(e,u.length,o,i)}if(!Pe(u,i))throw new Mu(u,i,">");if(1===u.length){n.dimension(0).forEach((function(n,i){au(n),t.set([n,0],e[i[0]],r)}))}else{var c=n.dimension(0),a=n.dimension(1);c.forEach((function(n,i){au(n),a.forEach((function(u,M){au(u),t.set([n,u],e[i[0]][M[0]],r)}))}))}}return t}function o(t,n,e,r){if(e-n==0)return e;for(var i=n;i<e;i++)if(r[i]===t)return i;return n}function c(t,n,e,r,i,u,M){i.splice(t,0,r),u.splice(t,0,n);for(var N=e+1;N<M.length;N++)M[N]++}function a(t,r,i,u){var M=u||0,N=e,o=0;ce(t._datatype)&&(N=n.find(e,[t._datatype,t._datatype])||e,o=n.convert(0,t._datatype),M=n.convert(M,t._datatype));var c,a,D,s=!N(M,o),T=t._size[0],g=t._size[1];if(i>g){for(a=g;a<i;a++)if(t._ptr[a]=t._values.length,s)for(c=0;c<T;c++)t._values.push(M),t._index.push(c);t._ptr[i]=t._values.length}else i<g&&(t._ptr.splice(i+1,g-i),t._values.splice(t._ptr[i],t._values.length),t._index.splice(t._ptr[i],t._index.length));if(g=i,r>T){if(s){var l=0;for(a=0;a<g;a++){t._ptr[a]=t._ptr[a]+l,D=t._ptr[a+1]+l;var I=0;for(c=T;c<r;c++,I++)t._values.splice(D+I,0,M),t._index.splice(D+I,0,c),l++}t._ptr[g]=t._values.length}}else if(r<T){var j=0;for(a=0;a<g;a++){t._ptr[a]=t._ptr[a]-j;var y=t._ptr[a],h=t._ptr[a+1]-j;for(D=y;D<h;D++)(c=t._index[D])>r-1&&(t._values.splice(D,1),t._index.splice(D,1),j++)}t._ptr[a]=t._values.length}return t._size[0]=r,t._size[1]=i,t}function D(t,n,e,r,i){var u,M,N=r[0],o=r[1],c=[];for(u=0;u<N;u++)for(c[u]=[],M=0;M<o;M++)c[u][M]=0;for(M=0;M<o;M++)for(var a=e[M],D=e[M+1],s=a;s<D;s++)c[u=n[s]][M]=t?i?We(t[s]):t[s]:1;return c}return i.prototype=new r,i.prototype.createSparseMatrix=function(t,n){return new i(t,n)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return ju(this._values,Ve)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(t,n){return new i(t,n)},i.prototype.density=function(){var t=this._size[0],n=this._size[1];return 0!==t&&0!==n?this._index.length/(t*n):0},i.prototype.subset=function(t,n,e){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return M(this,t);case 2:case 3:return N(this,t,n,e);default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.get=function(t){if(!ae(t))throw new TypeError("Array expected");if(t.length!==this._size.length)throw new Mu(t.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var n=t[0],e=t[1];au(n,this._size[0]),au(e,this._size[1]);var r=o(n,this._ptr[e],this._ptr[e+1],this._index);return r<this._ptr[e+1]&&this._index[r]===n?this._values[r]:0},i.prototype.set=function(t,r,i){if(!ae(t))throw new TypeError("Array expected");if(t.length!==this._size.length)throw new Mu(t.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var u=t[0],M=t[1],N=this._size[0],D=this._size[1],s=e,T=0;ce(this._datatype)&&(s=n.find(e,[this._datatype,this._datatype])||e,T=n.convert(0,this._datatype)),(u>N-1||M>D-1)&&(a(this,Math.max(u+1,N),Math.max(M+1,D),i),N=this._size[0],D=this._size[1]),au(u,N),au(M,D);var g=o(u,this._ptr[M],this._ptr[M+1],this._index);return g<this._ptr[M+1]&&this._index[g]===u?s(r,T)?function(t,n,e,r,i){e.splice(t,1),r.splice(t,1);for(var u=n+1;u<i.length;u++)i[u]--}(g,M,this._values,this._index,this._ptr):this._values[g]=r:s(r,T)||c(g,u,M,r,this._values,this._index,this._ptr),this},i.prototype.resize=function(t,n,e){if(!se(t))throw new TypeError("Array or Matrix expected");var r=t.valueOf().map(t=>Array.isArray(t)&&1===t.length?t[0]:t);if(2!==r.length)throw new Error("Only two dimensions matrix are supported");return r.forEach((function(t){if(!ie(t)||!Qi(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+eu(r)+")")})),a(e?this.clone():this,r[0],r[1],n)},i.prototype.reshape=function(t,n){if(!ae(t))throw new TypeError("Array expected");if(2!==t.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");t.forEach((function(n){if(!ie(n)||!Qi(n)||n<=-2||0===n)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+eu(t)+")")}));var e=this._size[0]*this._size[1];if(e!==(t=Tu(t,e))[0]*t[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var r=n?this.clone():this;if(this._size[0]===t[0]&&this._size[1]===t[1])return r;for(var i=[],u=0;u<r._ptr.length;u++)for(var M=0;M<r._ptr[u+1]-r._ptr[u];M++)i.push(u);for(var N=r._values.slice(),a=r._index.slice(),D=0;D<r._index.length;D++){var s=a[D],T=i[D],g=s*r._size[1]+T;i[D]=g%t[1],a[D]=Math.floor(g/t[1])}r._values.length=0,r._index.length=0,r._ptr.length=t[1]+1,r._size=t.slice();for(var l=0;l<r._ptr.length;l++)r._ptr[l]=0;for(var I=0;I<N.length;I++){var j=a[I],y=i[I],h=N[I];c(o(j,r._ptr[y],r._ptr[y+1],r._index),j,y,h,r._values,r._index,r._ptr)}return r},i.prototype.clone=function(){return new i({values:this._values?We(this._values):void 0,index:We(this._index),ptr:We(this._ptr),size:We(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(t,r){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var u=this,M=this._size[0],N=this._size[1],o=wu(t);return function(t,r,u,M,N,o,c){var a=[],D=[],s=[],T=e,g=0;ce(t._datatype)&&(T=n.find(e,[t._datatype,t._datatype])||e,g=n.convert(0,t._datatype));for(var l=function(t,n,e){t=o(t,n,e),T(t,g)||(a.push(t),D.push(n))},I=M;I<=N;I++){s.push(a.length);var j=t._ptr[I],y=t._ptr[I+1];if(c)for(var h=j;h<y;h++){var z=t._index[h];z>=r&&z<=u&&l(t._values[h],z-r,I-M)}else{for(var O={},A=j;A<y;A++){var x=t._index[A];O[x]=t._values[A]}for(var E=r;E<=u;E++){var f=E in O?O[E]:0;l(f,E-r,I-M)}}}return s.push(a.length),new i({values:a,index:D,ptr:s,size:[u-r+1,N-M+1]})}(this,0,M-1,0,N-1,(function(n,e,r){return 1===o?t(n):2===o?t(n,[e,r]):t(n,[e,r],u)}),r)},i.prototype.forEach=function(t,n){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var e=this._size[0],r=this._size[1],i=0;i<r;i++){var u=this._ptr[i],M=this._ptr[i+1];if(n)for(var N=u;N<M;N++){var o=this._index[N];t(this._values[N],[o,i],this)}else{for(var c={},a=u;a<M;a++){c[this._index[a]]=this._values[a]}for(var D=0;D<e;D++){t(D in c?c[D]:0,[D,i],this)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var t=this._size[1],n=0;n<t;n++)for(var e=this._ptr[n],r=this._ptr[n+1],i=e;i<r;i++){var u=this._index[i];yield{value:this._values[i],index:[u,n]}}},i.prototype.toArray=function(){return D(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return D(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(t){for(var n=this._size[0],e=this._size[1],r=this.density(),i="Sparse Matrix ["+eu(n,t)+" x "+eu(e,t)+"] density: "+eu(r,t)+"\n",u=0;u<e;u++)for(var M=this._ptr[u],N=this._ptr[u+1],o=M;o<N;o++){i+="\n ("+eu(this._index[o],t)+", "+eu(u,t)+") ==> "+(this._values?eu(this._values[o],t):"X")}return i},i.prototype.toString=function(){return eu(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(t){if(t){if(ue(t)&&(t=t.toNumber()),!ie(t)||!Qi(t))throw new TypeError("The parameter k must be an integer number")}else t=0;var n=t>0?t:0,e=t<0?-t:0,r=this._size[0],u=this._size[1],M=Math.min(r-e,u-n),N=[],o=[],c=[];c[0]=0;for(var a=n;a<u&&N.length<M;a++)for(var D=this._ptr[a],s=this._ptr[a+1],T=D;T<s;T++){var g=this._index[T];if(g===a-n+e){N.push(this._values[T]),o[N.length-1]=g-e;break}}return c.push(N.length),new i({values:N,index:o,ptr:c,size:[M,1]})},i.fromJSON=function(t){return new i(t)},i.diagonal=function(t,r,u,M,N){if(!ae(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(ue(t)&&(t=t.toNumber()),!ie(t)||!Qi(t)||t<1)throw new Error("Size values must be positive integers");return t})),u){if(ue(u)&&(u=u.toNumber()),!ie(u)||!Qi(u))throw new TypeError("The parameter k must be an integer number")}else u=0;var o=e,c=0;ce(N)&&(o=n.find(e,[N,N])||e,c=n.convert(0,N));var a,D=u>0?u:0,s=u<0?-u:0,T=t[0],g=t[1],l=Math.min(T-s,g-D);if(ae(r)){if(r.length!==l)throw new Error("Invalid value array length");a=function(t){return r[t]}}else if(De(r)){var I=r.size();if(1!==I.length||I[0]!==l)throw new Error("Invalid matrix length");a=function(t){return r.get([t])}}else a=function(){return r};for(var j=[],y=[],h=[],z=0;z<g;z++){h.push(j.length);var O=z-D;if(O>=0&&O<l){var A=a(O);o(A,c)||(y.push(O+s),j.push(A))}}return h.push(j.length),new i({values:j,index:y,ptr:h,size:[T,g]})},i.prototype.swapRows=function(t,n){if(!(ie(t)&&Qi(t)&&ie(n)&&Qi(n)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return au(t,this._size[0]),au(n,this._size[0]),i._swapRows(t,n,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(t,n,e,r,i){for(var u=r[t],M=r[t+1],N=u;N<M;N++)i(e[N],n[N])},i._swapRows=function(t,n,e,r,i,u){for(var M=0;M<e;M++){var N=u[M],c=u[M+1],a=o(t,N,c,i),D=o(n,N,c,i);if(a<c&&D<c&&i[a]===t&&i[D]===n){if(r){var s=r[a];r[a]=r[D],r[D]=s}}else if(a<c&&i[a]===t&&(D>=c||i[D]!==n)){var T=r?r[a]:void 0;i.splice(D,0,n),r&&r.splice(D,0,T),i.splice(D<=a?a+1:a,1),r&&r.splice(D<=a?a+1:a,1)}else if(D<c&&i[D]===n&&(a>=c||i[a]!==t)){var g=r?r[D]:void 0;i.splice(a,0,t),r&&r.splice(a,0,g),i.splice(a<=D?D+1:D,1),r&&r.splice(a<=D?D+1:D,1)}}},i},{isClass:!0});xu("bin",["typed","format"],t=>{var{typed:n,format:e}=t;return n("bin",{"number | BigNumber":function(t){return e(t,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(t,n){return e(t,{notation:"bin",wordSize:n})}})});var hN=xu("matrix",["typed","Matrix","DenseMatrix","SparseMatrix"],t=>{var{typed:n,Matrix:e,DenseMatrix:r,SparseMatrix:i}=t;return n("matrix",{"":function(){return u([])},string:function(t){return u([],t)},"string, string":function(t,n){return u([],t,n)},Array:function(t){return u(t)},Matrix:function(t){return u(t,t.storage())},"Array | Matrix, string":u,"Array | Matrix, string, string":u});function u(t,n,e){if("dense"===n||"default"===n||void 0===n)return new r(t,e);if("sparse"===n)return new i(t,e);throw new TypeError("Unknown matrix type "+JSON.stringify(n)+".")}});function zN(){throw new Error('No "matrix" implementation available')}var ON=xu("size",["typed","config","?matrix"],t=>{var{typed:n,config:e,matrix:r}=t;return n("size",{Matrix:function(t){return t.create(t.size())},Array:ou,string:function(t){return"Array"===e.matrix?[t.length]:r([t.length])},"number | Complex | BigNumber | Unit | boolean | null":function(t){return"Array"===e.matrix?[]:r?r([]):zN()}})}),AN=xu("matAlgo11xS0s",["typed","equalScalar"],t=>{var{typed:n,equalScalar:e}=t;return function(t,r,i,u){var M=t._values,N=t._index,o=t._ptr,c=t._size,a=t._datatype;if(!M)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var D,s=c[0],T=c[1],g=e,l=0,I=i;"string"==typeof a&&(D=a,g=n.find(e,[D,D]),l=n.convert(0,D),r=n.convert(r,D),I=n.find(i,[D,D]));for(var j=[],y=[],h=[],z=0;z<T;z++){h[z]=y.length;for(var O=o[z],A=o[z+1],x=O;x<A;x++){var E=N[x],f=u?I(r,M[x]):I(M[x],r);g(f,l)||(y.push(E),j.push(f))}}return h[T]=y.length,t.createSparseMatrix({values:j,index:y,ptr:h,size:[s,T],datatype:D})}}),xN=xu("matAlgo14xDs",["typed"],t=>{var{typed:n}=t;return function(t,e,r,i){var u,M=t._data,N=t._size,o=t._datatype,c=r;"string"==typeof o&&(u=o,e=n.convert(e,u),c=n.find(r,[u,u]));var a=N.length>0?function t(n,e,r,i,u,M,N){var o=[];if(e===r.length-1)for(var c=0;c<i;c++)o[c]=N?n(M,u[c]):n(u[c],M);else for(var a=0;a<i;a++)o[a]=t(n,e+1,r,r[e+1],u[a],M,N);return o}(c,0,N,N[0],M,e,i):[];return t.createDenseMatrix({data:a,size:We(N),datatype:u})}});xu("equal",["typed","equalScalar"],t=>{var{typed:n,equalScalar:e}=t;return n("equal",{"any, any":function(t,n){return null===t?null===n:null===n?null===t:void 0===t?void 0===n:void 0===n?void 0===t:e(t,n)}})});var EN=xu("ones",["typed","config","matrix","BigNumber"],t=>{var{typed:n,config:e,matrix:r,BigNumber:i}=t;return n("ones",{"":function(){return"Array"===e.matrix?u([]):u([],"default")},"...number | BigNumber | string":function(t){if("string"==typeof t[t.length-1]){var n=t.pop();return u(t,n)}return"Array"===e.matrix?u(t):u(t,"default")},Array:u,Matrix:function(t){var n=t.storage();return u(t.valueOf(),n)},"Array | Matrix, string":function(t,n){return u(t.valueOf(),n)}});function u(t,n){var e=function(t){var n=!1;return t.forEach((function(t,e,r){ue(t)&&(n=!0,r[e]=t.toNumber())})),n}(t)?new i(1):1;if(function(t){t.forEach((function(t){if("number"!=typeof t||!Qi(t)||t<0)throw new Error("Parameters in function ones must be positive integers")}))}(t),n){var u=r(n);return t.length>0?u.resize(t,e):u}var M=[];return t.length>0?Du(M,t,e):M}});function fN(t,n,e,r){if(!(this instanceof fN))throw new SyntaxError("Constructor must be called with the new operator");this.fn=t,this.count=n,this.min=e,this.max=r,this.message="Wrong number of arguments in function "+t+" ("+n+" provided, "+e+(null!=r?"-"+r:"")+" expected)",this.stack=(new Error).stack}fN.prototype=new Error,fN.prototype.constructor=Error,fN.prototype.name="ArgumentsError",fN.prototype.isArgumentsError=!0;xu("unequal",["typed","equalScalar"],t=>{var{typed:n,equalScalar:e}=t;return n("unequal",{"any, any":function(t,n){return null===t?null!==n:null===n?null!==t:void 0===t?void 0!==n:void 0===n?void 0!==t:!e(t,n)}})});uu.signature="any, any";var pN=xu("dot",["typed","addScalar","multiplyScalar","conj","size"],t=>{var{typed:n,addScalar:e,multiplyScalar:r,conj:i,size:u}=t;return n("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(t,u){var o=M(t,u),c=De(t)?t._data:t,a=De(t)?t._datatype||t.getDataType():void 0,D=De(u)?u._data:u,s=De(u)?u._datatype||u.getDataType():void 0,T=2===N(t).length,g=2===N(u).length,l=e,I=r;if(a&&s&&a===s&&"string"==typeof a&&"mixed"!==a){var j=a;l=n.find(e,[j,j]),I=n.find(r,[j,j])}if(!T&&!g){for(var y=I(i(c[0]),D[0]),h=1;h<o;h++)y=l(y,I(i(c[h]),D[h]));return y}if(!T&&g){for(var z=I(i(c[0]),D[0][0]),O=1;O<o;O++)z=l(z,I(i(c[O]),D[O][0]));return z}if(T&&!g){for(var A=I(i(c[0][0]),D[0]),x=1;x<o;x++)A=l(A,I(i(c[x][0]),D[x]));return A}if(T&&g){for(var E=I(i(c[0][0]),D[0][0]),f=1;f<o;f++)E=l(E,I(i(c[f][0]),D[f][0]));return E}},"SparseMatrix, SparseMatrix":function(t,n){M(t,n);var i=t._index,u=t._values,N=n._index,o=n._values,c=0,a=e,D=r,s=0,T=0;for(;s<i.length&&T<N.length;){var g=i[s],l=N[T];g<l?s++:g>l?T++:g===l&&(c=a(c,D(u[s],o[T])),s++,T++)}return c}});function M(t,n){var e,r,i=N(t),u=N(n);if(1===i.length)e=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(", ")+")");e=i[0]}if(1===u.length)r=u[0];else{if(2!==u.length||1!==u[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+u.join(", ")+")");r=u[0]}if(e!==r)throw new RangeError("Vectors must have equal length ("+e+" != "+r+")");if(0===e)throw new RangeError("Cannot calculate the dot product of empty vectors");return e}function N(t){return De(t)?t.size():u(t)}}),UN="number | BigNumber | Fraction | Matrix | Array";"".concat(UN,", ").concat(UN,", ...").concat(UN);var dN=xu("multiply",["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],t=>{var{typed:n,matrix:e,addScalar:r,multiplyScalar:i,equalScalar:u,dot:M}=t,N=AN({typed:n,equalScalar:u}),o=xN({typed:n});function c(t,n){switch(t.length){case 1:switch(n.length){case 1:if(t[0]!==n[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(t[0]!==n[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+t[0]+") must match Matrix rows ("+n[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+n.length+" dimensions)")}break;case 2:switch(n.length){case 1:if(t[1]!==n[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+t[1]+") must match Vector length ("+n[0]+")");break;case 2:if(t[1]!==n[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+t[1]+") must match Matrix B rows ("+n[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+n.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+t.length+" dimensions)")}}function a(t,e){if("dense"!==e.storage())throw new Error("Support for SparseMatrix not implemented");return function(t,e){var u,M=t._data,N=t._size,o=t._datatype||t.getDataType(),c=e._data,a=e._size,D=e._datatype||e.getDataType(),s=N[0],T=a[1],g=r,l=i;o&&D&&o===D&&"string"==typeof o&&"mixed"!==o&&(u=o,g=n.find(r,[u,u]),l=n.find(i,[u,u]));for(var I=[],j=0;j<T;j++){for(var y=l(M[0],c[0][j]),h=1;h<s;h++)y=g(y,l(M[h],c[h][j]));I[j]=y}return t.createDenseMatrix({data:I,size:[T],datatype:o===t._datatype&&D===e._datatype?u:void 0})}(t,e)}var D=n("_multiplyMatrixVector",{"DenseMatrix, any":function(t,e){var u,M=t._data,N=t._size,o=t._datatype||t.getDataType(),c=e._data,a=e._datatype||e.getDataType(),D=N[0],s=N[1],T=r,g=i;o&&a&&o===a&&"string"==typeof o&&"mixed"!==o&&(u=o,T=n.find(r,[u,u]),g=n.find(i,[u,u]));for(var l=[],I=0;I<D;I++){for(var j=M[I],y=g(j[0],c[0]),h=1;h<s;h++)y=T(y,g(j[h],c[h]));l[I]=y}return t.createDenseMatrix({data:l,size:[D],datatype:o===t._datatype&&a===e._datatype?u:void 0})},"SparseMatrix, any":function(t,e){var M=t._values,N=t._index,o=t._ptr,c=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var a,D=e._data,s=e._datatype||e.getDataType(),T=t._size[0],g=e._size[0],l=[],I=[],j=[],y=r,h=i,z=u,O=0;c&&s&&c===s&&"string"==typeof c&&"mixed"!==c&&(a=c,y=n.find(r,[a,a]),h=n.find(i,[a,a]),z=n.find(u,[a,a]),O=n.convert(0,a));var A=[],x=[];j[0]=0;for(var E=0;E<g;E++){var f=D[E];if(!z(f,O))for(var p=o[E],U=o[E+1],d=p;d<U;d++){var C=N[d];x[C]?A[C]=y(A[C],h(f,M[d])):(x[C]=!0,I.push(C),A[C]=h(f,M[d]))}}for(var Q=I.length,w=0;w<Q;w++){var S=I[w];l[w]=A[S]}return j[1]=I.length,t.createSparseMatrix({values:l,index:I,ptr:j,size:[T,1],datatype:c===t._datatype&&s===e._datatype?a:void 0})}}),s=n("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(t,e){var u,M=t._data,N=t._size,o=t._datatype||t.getDataType(),c=e._data,a=e._size,D=e._datatype||e.getDataType(),s=N[0],T=N[1],g=a[1],l=r,I=i;o&&D&&o===D&&"string"==typeof o&&"mixed"!==o&&"mixed"!==o&&(u=o,l=n.find(r,[u,u]),I=n.find(i,[u,u]));for(var j=[],y=0;y<s;y++){var h=M[y];j[y]=[];for(var z=0;z<g;z++){for(var O=I(h[0],c[0][z]),A=1;A<T;A++)O=l(O,I(h[A],c[A][z]));j[y][z]=O}}return t.createDenseMatrix({data:j,size:[s,g],datatype:o===t._datatype&&D===e._datatype?u:void 0})},"DenseMatrix, SparseMatrix":function(t,e){var M=t._data,N=t._size,o=t._datatype||t.getDataType(),c=e._values,a=e._index,D=e._ptr,s=e._size,T=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!c)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var g,l=N[0],I=s[1],j=r,y=i,h=u,z=0;o&&T&&o===T&&"string"==typeof o&&"mixed"!==o&&(g=o,j=n.find(r,[g,g]),y=n.find(i,[g,g]),h=n.find(u,[g,g]),z=n.convert(0,g));for(var O=[],A=[],x=[],E=e.createSparseMatrix({values:O,index:A,ptr:x,size:[l,I],datatype:o===t._datatype&&T===e._datatype?g:void 0}),f=0;f<I;f++){x[f]=A.length;var p=D[f],U=D[f+1];if(U>p)for(var d=0,C=0;C<l;C++){for(var Q=C+1,w=void 0,S=p;S<U;S++){var L=a[S];d!==Q?(w=y(M[C][L],c[S]),d=Q):w=j(w,y(M[C][L],c[S]))}d!==Q||h(w,z)||(A.push(C),O.push(w))}}return x[I]=A.length,E},"SparseMatrix, DenseMatrix":function(t,e){var M=t._values,N=t._index,o=t._ptr,c=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var a,D=e._data,s=e._datatype||e.getDataType(),T=t._size[0],g=e._size[0],l=e._size[1],I=r,j=i,y=u,h=0;c&&s&&c===s&&"string"==typeof c&&"mixed"!==c&&(a=c,I=n.find(r,[a,a]),j=n.find(i,[a,a]),y=n.find(u,[a,a]),h=n.convert(0,a));for(var z=[],O=[],A=[],x=t.createSparseMatrix({values:z,index:O,ptr:A,size:[T,l],datatype:c===t._datatype&&s===e._datatype?a:void 0}),E=[],f=[],p=0;p<l;p++){A[p]=O.length;for(var U=p+1,d=0;d<g;d++){var C=D[d][p];if(!y(C,h))for(var Q=o[d],w=o[d+1],S=Q;S<w;S++){var L=N[S];f[L]!==U?(f[L]=U,O.push(L),E[L]=j(C,M[S])):E[L]=I(E[L],j(C,M[S]))}}for(var k=A[p],v=O.length,Y=k;Y<v;Y++){var m=O[Y];z[Y]=E[m]}}return A[l]=O.length,x},"SparseMatrix, SparseMatrix":function(t,e){var u,M=t._values,N=t._index,o=t._ptr,c=t._datatype||void 0===t._data?t._datatype:t.getDataType(),a=e._values,D=e._index,s=e._ptr,T=e._datatype||void 0===e._data?e._datatype:e.getDataType(),g=t._size[0],l=e._size[1],I=M&&a,j=r,y=i;c&&T&&c===T&&"string"==typeof c&&"mixed"!==c&&(u=c,j=n.find(r,[u,u]),y=n.find(i,[u,u]));for(var h,z,O,A,x,E,f,p,U=I?[]:void 0,d=[],C=[],Q=t.createSparseMatrix({values:U,index:d,ptr:C,size:[g,l],datatype:c===t._datatype&&T===e._datatype?u:void 0}),w=I?[]:void 0,S=[],L=0;L<l;L++){C[L]=d.length;var k=L+1;for(x=s[L],E=s[L+1],A=x;A<E;A++)if(p=D[A],I)for(z=o[p],O=o[p+1],h=z;h<O;h++)f=N[h],S[f]!==k?(S[f]=k,d.push(f),w[f]=y(a[A],M[h])):w[f]=j(w[f],y(a[A],M[h]));else for(z=o[p],O=o[p+1],h=z;h<O;h++)f=N[h],S[f]!==k&&(S[f]=k,d.push(f));if(I)for(var v=C[L],Y=d.length,m=v;m<Y;m++){var F=d[m];U[m]=w[F]}}return C[l]=d.length,Q}});return n("multiply",i,{"Array, Array":n.referTo("Matrix, Matrix",t=>(n,r)=>{c(ou(n),ou(r));var i=t(e(n),e(r));return De(i)?i.valueOf():i}),"Matrix, Matrix":function(t,n){var e=t.size(),r=n.size();return c(e,r),1===e.length?1===r.length?function(t,n,e){if(0===e)throw new Error("Cannot multiply two empty vectors");return M(t,n)}(t,n,e[0]):a(t,n):1===r.length?D(t,n):s(t,n)},"Matrix, Array":n.referTo("Matrix,Matrix",t=>(n,r)=>t(n,e(r))),"Array, Matrix":n.referToSelf(t=>(n,r)=>t(e(n,r.storage()),r)),"SparseMatrix, any":function(t,n){return N(t,n,i,!1)},"DenseMatrix, any":function(t,n){return o(t,n,i,!1)},"any, SparseMatrix":function(t,n){return N(n,t,i,!0)},"any, DenseMatrix":function(t,n){return o(n,t,i,!0)},"Array, any":function(t,n){return o(e(t),n,i,!1).valueOf()},"any, Array":function(t,n){return o(e(n),t,i,!0).valueOf()},"any, any":i,"any, any, ...any":n.referToSelf(t=>(n,e,r)=>{for(var i=t(n,e),u=0;u<r.length;u++)i=t(i,r[u]);return i})})});e(17);var CN=fu({config:Ke}),QN=du({}),wN=mu({}),SN=Fu({}),LN=Ru({Matrix:SN}),kN=nM({BigNumber:CN,Complex:QN,DenseMatrix:LN,Fraction:wN}),vN=BM({typed:kN}),YN=_M({typed:kN}),mN=nN({config:Ke,typed:kN}),FN=DN({typed:kN}),RN=yN({Matrix:SN,equalScalar:mN,typed:kN}),bN=hN({DenseMatrix:LN,Matrix:SN,SparseMatrix:RN,typed:kN}),BN=ON({matrix:bN,config:Ke,typed:kN}),ZN=EN({BigNumber:CN,config:Ke,matrix:bN,typed:kN}),VN=pN({addScalar:vN,conj:YN,multiplyScalar:FN,size:BN,typed:kN}),WN=dN({addScalar:vN,dot:VN,equalScalar:mN,matrix:bN,multiplyScalar:FN,typed:kN});function GN(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,u=$n()(t);if(n&&e){var M=qN(t),N=XN(M,e,n),o=JN(t,N);u=$n()(o).pop()}if(r&&i){var c=[].concat(u).reverse(),a=qN(c),D=XN(a,i,r),s=1-D,T=JN(u,s);u=T[0]}return u}function PN(t,n){var e=t.x-n.x,r=t.y-n.y;return Math.sqrt(e*e+r*r)}function JN(t,n){switch(t.length){case 2:return function(t,n){var e=HN(t,n);return[[t[0],e],[e,$n()(t).pop()]]}(t,n);case 3:return function(t,n){var e=[t[0],t[1]],r=[t[1],t[2]],i=HN(e,n),u=HN(r,n),M=HN([i,u],n);return[[t[0],i,M],[M,u,t[2]]]}(t,n);case 4:return function(t,n){var e=[t[0],t[1]],r=[t[1],t[2]],i=[t[2],t[3]],u=HN(e,n),M=HN(r,n),N=HN(i,n),o=HN([u,M],n),c=HN([M,N],n),a=HN([o,c],n);return[[t[0],u,o,a],[a,c,N,t[3]]]}(t,n);default:return null}}function HN(t,n){var e=Xn()(t,1)[0],r=$n()(t).pop(),i=e.x+(r.x-e.x)*n;return{y:e.y+(r.y-e.y)*n,x:i}}function XN(t,n,e){for(var r=t.size(),i=function(t){switch(t){case 1:return WN(KN(1e3,1),bN([[1,0],[-1,1]]));case 2:return WN(KN(1e3,2),bN([[1,0,0],[-2,2,0],[1,-2,1]]));case 3:return WN(KN(1e3,3),bN([[1,0,0,0],[-3,3,0,0],[3,-6,3,0],[-1,3,-3,1]]));default:return null}}(Xn()(r,1)[0]-1),u=function(t,n){var e=-t.x,r=-t.y,i=[],u=[];n.forEach((function(t,n){switch(Xn()(n,2)[1]){case 0:i.push(t+e);break;case 1:u.push(t+r)}}));for(var M=[],N=0;N<i.length;N++)M.push(Math.sqrt(i[N]*i[N]+u[N]*u[N]));return M}(n,WN(i,t)),M=u.length-1,N=0;N<u.length;N++)if(u[N]>=e){M=N;break}return.001*M}function KN(t,n){var e=1/t,r=0,i=ZN(t+1,n+1).map((function(t,n){var i=null;switch(Xn()(n,2)[1]){case 0:i=1;break;case 1:i=r;break;case 2:i=r*r;break;case 3:i=r*r*r}return r+=e,i}));return bN(i)}function qN(t){var n=t.map((function(t){return[t.x,t.y]}));return bN(n)}function _N(t){if(3===t.length)throw new Error("bezierBoundingBox function supports only linear and cubic bezier curves for now");var n,e,r,i,u,M,N=2===t.length?(n=t,e=Xn()(n,2),r=e[0],i=e[1],u=[r.x,i.x],M=[r.y,i.y],{min:{x:Math.min.apply(0,u),y:Math.min.apply(0,M)},max:{x:Math.max.apply(0,u),y:Math.max.apply(0,M)}}):function(t){for(var n,e,r,i,u,M,N,o,c=Xn()(t,4),a=c[0],D=c[1],s=c[2],T=c[3],g=[],l=[],I=[],j=0;j<2;++j)if(0===j?(e=6*a.x-12*D.x+6*s.x,n=-3*a.x+9*D.x-9*s.x+3*T.x,r=3*D.x-3*a.x):(e=6*a.y-12*D.y+6*s.y,n=-3*a.y+9*D.y-9*s.y+3*T.y,r=3*D.y-3*a.y),Math.abs(n)<1e-12){if(Math.abs(e)<1e-12)continue;(i=-r/e)>0&&i<1&&g.push(i)}else(N=e*e-4*r*n)<0?Math.abs(N)<1e-12&&(i=-e/(2*n))>0&&i<1&&g.push(i):(o=Math.sqrt(N),(u=(-e+o)/(2*n))>0&&u<1&&g.push(u),(M=(-e-o)/(2*n))>0&&M<1&&g.push(M));var y,h=g.length;for(;h--;)i=g[h],y=1-i,l[h]=y*y*y*a.x+3*y*y*i*D.x+3*y*i*i*s.x+i*i*i*T.x,I[h]=y*y*y*a.y+3*y*y*i*D.y+3*y*i*i*s.y+i*i*i*T.y;return l.push(a.x,T.x),I.push(a.y,T.y),{min:{x:Math.min.apply(0,l),y:Math.min.apply(0,I)},max:{x:Math.max.apply(0,l),y:Math.max.apply(0,I)}}}(t),o=2===t.length?1:0;return[{x:N.min.x,y:N.min.y-o},{x:N.max.x,y:N.min.y-o},{x:N.max.x,y:N.max.y+o},{x:N.min.x,y:N.max.y+o}]}var $N=e(3),to=e.n($N),no=e(0),eo=e.n(no),ro=e(4),io=e.n(ro),uo=function(){function t(n){st()(this,t),It()(this,"ctx",void 0),It()(this,"playData",void 0),It()(this,"options",void 0),It()(this,"courtTypeConstants",void 0),this.ctx=n.ctx,this.playData=n.playData,this.options=n.options?n.options:{},this.courtTypeConstants=n.courtTypeConstants}return gt()(t,[{key:"apply",value:function(){this.ctx.save(),this.drawLogic(),this.ctx.restore()}},{key:"drawLogic",value:function(){}}]),t}();function Mo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var No=function(t){io()(e,t);var n=Mo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){this.original()&&(this.ctx.save(),this.drawLogic(),this.ctx.restore()),this.reflection()&&(this.ctx.save(),this.verticalFlipAndRotation(),this.drawLogic(),this.ctx.restore())}},{key:"original",value:function(){return!0}},{key:"reflection",value:function(){return!1}},{key:"verticalFlipAndRotation",value:function(){var t=this.courtTypeConstants.COURT_RECT_HEIGHT;this.ctx.scale(1,-1),this.ctx.translate(0,-Math.abs(t))}},{key:"setColor",value:function(t){var n="transparent"===this.options.lineColor?"transparent":t;this.ctx.strokeStyle=n,this.ctx.fillStyle=n}},{key:"courtCenter",get:function(){return{x:this.courtTypeConstants.COURT_RECT_WIDTH/2,y:this.courtTypeConstants.COURT_RECT_HEIGHT/2}}}]),e}(uo);function oo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var co=function(t){io()(e,t);var n=oo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No),ao=.1667,Do=1.5,so=2.4,To=.55,go=!1,lo=480,Io=460,jo="#C49463",yo=60.5,ho=127.28125,zo=60,Oo=1.41667,Ao=26,xo=.5,Eo=4,fo=6,po=5,Uo=3.58333,Co=5,Qo=37,wo=15,So=20,Lo=5,ko=2,vo=.5,Yo=1.5,mo=18,Fo=95,Ro=390,bo=330,Bo=90,Zo=2.5,Vo=13;function Wo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Go=function(t){io()(e,t);var n=Wo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"original",value:function(){return!1}},{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtCenter.x,y:zo},n={x:this.courtCenter.x,y:zo+yo},e="transparent"===this.options.lineColor?"transparent":jo;this.ctx.fillStyle=e,this.ctx.strokeStyle=e;var r=Math.PI/11,i=Math.PI-Math.PI/11;this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.x,n.y,Fo,r,i,!1);var u=Po(n,Fo,i),M=Po(n,Fo,r);this.ctx.moveTo(u.x,u.y),this.ctx.lineTo(t.x,t.y-Math.sqrt(18)),this.ctx.lineTo(M.x,M.y),this.ctx.lineTo(u.x,u.y),this.ctx.translate(t.x,t.y),this.ctx.rotate(Math.PI/4),this.ctx.moveTo(3,3),this.ctx.lineTo(3,Bo-3),this.ctx.lineTo(Bo-3,Bo-3),this.ctx.lineTo(Bo-3,3),this.ctx.lineTo(3,3),this.ctx.fill(),this.ctx.restore(),this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.x,n.y-Yo,mo/2,0,2*Math.PI,!0),this.ctx.stroke(),this.ctx.fill(),this.ctx.restore(),this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.x,t.y,Ao/2,0,2*Math.PI,!0),this.ctx.stroke(),this.ctx.fill(),this.ctx.restore(),this.ctx.save(),this.ctx.translate(t.x,t.y),this.ctx.rotate(Math.PI/4),this.ctx.beginPath(),this.ctx.arc(Bo,0,Vo,Math.PI/4,Math.PI+Math.PI/20,!1),this.ctx.stroke(),this.ctx.fill(),this.ctx.beginPath(),this.ctx.arc(Bo,Bo,Vo,0,2*Math.PI,!0),this.ctx.stroke(),this.ctx.fill(),this.ctx.beginPath(),this.ctx.arc(0,Bo,Vo,Math.PI/4,Math.PI+Math.PI/2.2,!0),this.ctx.stroke(),this.ctx.fill(),this.ctx.restore()}}]),e}(No);function Po(t,n,e){return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}}function Jo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ho=function(t){io()(e,t);var n=Jo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"original",value:function(){return!1}},{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this,n={x:this.courtCenter.x,y:zo};this.ctx.lineWidth=3*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.save(),this.ctx.translate(n.x,n.y),this.ctx.rotate(Math.PI/4),this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(Bo,0),this.ctx.stroke(),this.drawBaseSquare(Bo,0),this.drawBaseSquare(Bo+Zo/2,Bo-Zo/2),this.drawBaseSquare(Zo,Bo-Zo),this.ctx.beginPath(),this.ctx.lineTo(0,0),this.ctx.stroke(),this.ctx.restore(),[-1,1].forEach((function(e){t.ctx.save(),t.ctx.translate(n.x,n.y),t.ctx.rotate(e*(Math.PI/4)),t.ctx.beginPath(),t.ctx.moveTo(0,0),t.ctx.lineTo(e*bo,0),t.ctx.stroke(),t.ctx.restore()}));var e=Math.PI/8.1,r=Math.PI-Math.PI/8.1;this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.x,n.y+138,Ro-138,e,r,!1),this.ctx.stroke(),this.ctx.restore()}},{key:"drawBaseSquare",value:function(t,n){this.ctx.save(),this.ctx.lineCap="square",this.ctx.beginPath(),this.ctx.translate(t,n),this.ctx.moveTo(0,0),this.ctx.lineTo(0,Zo),this.ctx.lineTo(-Zo,Zo),this.ctx.lineTo(-Zo,0),this.ctx.lineTo(0,0),this.ctx.stroke(),this.ctx.fill(),this.ctx.restore()}}]),e}(No);function Xo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ko=function(t){io()(e,t);var n=Xo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"original",value:function(){return!1}},{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this,n={x:this.courtCenter.x,y:zo},e={x:n.x-Oo/2,y:n.y+Oo},r={x:n.x+Oo/2,y:n.y+Oo};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.lineTo(r.x,r.y-Oo/2),this.ctx.lineTo(n.x,n.y),this.ctx.lineTo(e.x,e.y-Oo/2),this.ctx.lineTo(e.x,e.y),this.ctx.stroke(),this.ctx.fill(),[-1,1].forEach((function(e){t.ctx.save(),t.ctx.translate(n.x,n.y+Oo/2),t.ctx.beginPath();var r=Oo/2+xo;t.ctx.moveTo(e*r,0),t.ctx.lineTo(e*r,Oo/2),t.ctx.lineTo(e*(r+Eo),Oo/2),t.ctx.lineTo(e*(r+Eo),Oo/2-fo),t.ctx.lineTo(e*r,Oo/2-fo),t.ctx.lineTo(e*r,0),t.ctx.lineTo(e*r,0),t.ctx.stroke(),t.ctx.restore()}));var i=n.y+Oo/2-fo+Oo/2;[-1,1].forEach((function(n){t.ctx.save(),t.ctx.translate(t.courtCenter.x,i-po),t.ctx.beginPath(),t.ctx.moveTo(0,0),t.ctx.lineTo(n*(Uo/2),0),t.ctx.lineTo(n*(Uo/2),po),t.ctx.stroke(),t.ctx.restore()})),[-1,1].forEach((function(e){t.ctx.save(),t.ctx.translate(t.courtCenter.x,n.y-Ao/2),t.ctx.beginPath(),t.ctx.arc(e*Qo,0,Co/2,0,2*Math.PI,!0),t.ctx.stroke(),t.ctx.restore()})),[-1,1].forEach((function(e){t.ctx.save(),t.ctx.translate(n.x,n.y),t.ctx.rotate(e*(Math.PI/4)),t.ctx.beginPath(),t.ctx.moveTo(e*Bo,-(wo+Lo)),t.ctx.lineTo(e*Bo,-wo),t.ctx.lineTo(e*(Bo-So),-wo),t.ctx.lineTo(e*(Bo-So),-(wo+Lo)),t.ctx.stroke(),t.ctx.restore()}))}}]),e}(No);function qo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var _o=function(t){io()(e,t);var n=qo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"original",value:function(){return!1}},{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtCenter.x,y:zo+yo};this.ctx.save(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.translate(t.x,t.y),this.ctx.moveTo(0,0),this.ctx.lineTo(ko/2,0),this.ctx.lineTo(ko/2,vo),this.ctx.lineTo(-ko/2,vo),this.ctx.lineTo(-ko/2,0),this.ctx.lineTo(0,0),this.ctx.stroke(),this.ctx.fill(),this.ctx.restore()}}]),e}(No);function $o(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var tc=function(t){io()(e,t);var n=$o(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){if(this.courtTypeConstants.BENCH_MARKING){var t={x:this.courtCenter.x-11,y:0},n={x:this.courtCenter.x-11,y:.5},e={x:this.courtCenter.x+11,y:0},r={x:this.courtCenter.x+11,y:.5};this.ctx.beginPath(),this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.stroke()}}}]),e}(No);function nc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ec=function(t){io()(e,t);var n=nc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=0,n=28,e=3,r=28,i={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:28},u={x:this.courtTypeConstants.COURT_RECT_WIDTH-3,y:28};this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(e,r),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(i.x,i.y),this.ctx.lineTo(u.x,u.y),this.ctx.stroke()}}]),e}(No);function rc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ic=function(t){io()(e,t);var n=rc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No);function uc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Mc=function(t){io()(e,t);var n=uc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){if(this.options.showHalfCourtCircle){this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,6,0,2*Math.PI,!0),this.courtTypeConstants.CENTER_INNER_CIRCLE&&this.ctx.arc(this.courtCenter.x,this.courtCenter.y,2,0,2*Math.PI,!0),this.ctx.stroke()}}}]),e}(No);function Nc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var oc=function(t){io()(e,t);var n=Nc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No);function cc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ac=function(t){io()(e,t);var n=cc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtCenter.x,y:19},n=this.courtTypeConstants.FREE_THROW_INNER_WIDTH/2;this.ctx.beginPath(),this.ctx.arc(t.x,t.y,n,0,Math.PI,!1),this.ctx.stroke(),this.courtTypeConstants.FREE_THROW_INNER_DASHED_CIRCLE&&(this.ctx.setLineDash([1,.5]),this.ctx.beginPath(),this.ctx.arc(t.x,t.y,n,0,Math.PI,!0),this.ctx.stroke())}}]),e}(No);function Dc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var sc=function(t){io()(e,t);var n=Dc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtCenter.x,y:5.25},n={x:t.x-3,y:4},e={x:t.x+3,y:4};this.ctx.beginPath(),this.ctx.moveTo(n.x,n.y),this.ctx.lineTo(e.x,e.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.arc(t.x,t.y,.75,0,2*Math.PI,!0),this.ctx.stroke()}}]),e}(No);function Tc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var gc=function(t){io()(e,t);var n=Tc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this.courtTypeConstants.FREE_THROW_INNER_WIDTH,n=this.courtTypeConstants.FREE_THROW_OUTER_WIDTH,e={x:this.courtCenter.x-t/2,y:0},r={x:this.courtCenter.x-n/2,y:0};this.ctx.beginPath(),this.ctx.rect(e.x,e.y,t,19),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.rect(r.x,r.y,n,19),this.ctx.stroke()}}]),e}(No);function lc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ic=function(t){io()(e,t);var n=lc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtCenter.x,y:5.25},n={x:this.courtCenter.x+4,y:4},e={x:this.courtCenter.x+4,y:5.25},r={x:this.courtCenter.x-4,y:4};this.ctx.beginPath(),this.ctx.moveTo(n.x,n.y),this.ctx.lineTo(e.x,e.y),this.ctx.arc(t.x,t.y,4,0,Math.PI,!1),this.ctx.lineTo(r.x,r.y),this.ctx.stroke()}}]),e}(No);function jc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var yc=function(t){io()(e,t);var n=jc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this.courtCenter.x-this.courtTypeConstants.HOOP_CORNER_DISTANCE,n=this.courtTypeConstants.COURT_RECT_WIDTH-t,e={x:t,y:0},r={x:t,y:this.courtTypeConstants.THREE_POINT_OFFSET_ORIGIN_Y_APPROX},i={x:n,y:0},u={x:this.courtCenter.x,y:5.25},M=Math.asin((this.courtTypeConstants.THREE_POINT_ASIN_APPROX-.75-.5)/this.courtTypeConstants.THREE_POINT_ARC_RADIUS),N=Math.PI-M;this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.arc(u.x,u.y,this.courtTypeConstants.THREE_POINT_ARC_RADIUS,N,M,!0),this.ctx.lineTo(i.x,i.y),this.ctx.stroke()}}]),e}(No),hc=.1667,zc=1.5,Oc=1,Ac=.33,xc=!0;function Ec(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var fc=function(t){io()(e,t);var n=Ec(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t=this,n=this.courtCenter.x,e=5.25,r={x:this.courtCenter.x,y:e+30},i=[{x:n-30*Math.cos(50*Math.PI/180),y:e+30*Math.sin(50*Math.PI/180)},r,{x:n+30*Math.cos(50*Math.PI/180),y:e+30*Math.sin(50*Math.PI/180)}];this.ctx.lineWidth=3*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.font="".concat(4,"px Helvetica"),i.forEach((function(n){t.ctx.beginPath(),t.ctx.arc(n.x,n.y,2,0,2*Math.PI,!0),t.ctx.stroke(),"transparent"!==t.options.lineColor&&(t.ctx.fillStyle="#001c4f",t.ctx.fill()),t.ctx.fillStyle=t.options.lineColor,t.ctx.fillText("4",n.x-1.1,n.y+1.4)}))}}]),e}(No),pc={drawLogic:function(){var t=this,n=this.courtTypeConstants.FREE_THROW_OUTER_WIDTH/2,e=this.courtCenter.x-n,r=this.courtCenter.x+n,i=this.courtCenter.x-5,u=this.courtCenter.x+5;[7,8,11,14].forEach((function(n){t.ctx.beginPath(),t.ctx.moveTo(e,n),t.ctx.lineTo(e-.667,n),t.ctx.moveTo(r,n),t.ctx.lineTo(r+.667,n),t.ctx.stroke()})),this.ctx.beginPath(),this.ctx.moveTo(i,13),this.ctx.lineTo(i+.5,13),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(u,13),this.ctx.lineTo(u-.5,13),this.ctx.stroke()}};function Uc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var dc=function(t){io()(e,t);var n=Uc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(dc.prototype,pc);var Cc=50,Qc=94,wc=22,Sc=23.6762,Lc=10,kc=14,vc=12,Yc=16,mc=!0,Fc=!0,Rc=!0;function bc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Bc=function(t){io()(e,t);var n=bc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this,n=this.courtTypeConstants.FREE_THROW_OUTER_WIDTH/2,e=this.courtCenter.x-n,r=this.courtCenter.x+n;[5.9,13.6,16.5].forEach((function(n){t.ctx.beginPath(),t.ctx.moveTo(e,n),t.ctx.lineTo(e-.333,n),t.ctx.moveTo(r,n),t.ctx.lineTo(r+.333,n),t.ctx.stroke()})),this.ctx.beginPath(),this.ctx.rect(e,8.8,-.333,1.9),this.ctx.fill(),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.rect(r,8.8,.333,1.9),this.ctx.fill(),this.ctx.stroke()}}]),e}(No),Zc=49.21,Vc=91.86,Wc=21.65,Gc=22.15,Pc=6,Jc=8,Hc=12,Xc=16.08,Kc=!1,qc=!1,_c=!1;function $c(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ta=function(t){io()(e,t);var n=$c(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(ta.prototype,pc);var na=50,ea=94,ra=22,ia=23.6762,ua=10,Ma=14,Na=12,oa=16,ca=!0,aa=!0,Da=!0,sa={drawLogic:function(){var t=this,n=this.courtTypeConstants.FREE_THROW_OUTER_WIDTH/2,e=this.courtCenter.x-n,r=this.courtCenter.x+n;[11,14,17].forEach((function(n){t.ctx.beginPath(),t.ctx.moveTo(e,n),t.ctx.lineTo(e-.667,n),t.ctx.moveTo(r,n),t.ctx.lineTo(r+.667,n),t.ctx.stroke()})),this.ctx.beginPath(),this.ctx.rect(e,7,-1.2,.8),this.ctx.fill(),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.rect(r,7,1.2,.8),this.ctx.fill(),this.ctx.stroke()}};function Ta(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ga=function(t){io()(e,t);var n=Ta(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(ga.prototype,sa);var la=50,Ia=94,ja=20.75,ya=20.75,ha=2,za=6,Oa=12,Aa=12,xa=!1,Ea=!1,fa=!1;function pa(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ua=function(t){io()(e,t);var n=pa(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(Ua.prototype,sa);var da=50,Ca=94,Qa=20.75,wa=20.75,Sa=2,La=6,ka=12,va=12,Ya=!1,ma=!1,Fa=!0;function Ra(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ba=function(t){io()(e,t);var n=Ra(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(ba.prototype,sa);var Ba=50,Za=84,Va=19.75,Wa=19.75,Ga=2,Pa=6,Ja=12,Ha=12,Xa=!1,Ka=!1,qa=!1;function _a(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var $a=function(t){io()(e,t);var n=_a(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign($a.prototype,sa);var tD=42,nD=74,eD=19.75,rD=19.75,iD=2,uD=6,MD=12,ND=12,oD=!1,cD=!1,aD=!1;function DD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var sD=function(t){io()(e,t);var n=DD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(sD.prototype,pc);var TD=50,gD=94,lD=21.65,ID=22.15,jD=6,yD=9,hD=12,zD=16,OD=!0,AD=!0,xD=!0;function ED(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var fD=function(t){io()(e,t);var n=ED(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No);function pD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var UD=function(t){io()(e,t);var n=pD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No);function dD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var CD=function(t){io()(e,t);var n=dD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=0,n=30,e={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:30};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t,n),this.ctx.lineTo(e.x,e.y),this.ctx.stroke()}}]),e}(No);function QD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var wD=function(t){io()(e,t);var n=QD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t=this.courtTypeConstants.END_ZONE_HEIGHT,n=String.fromCharCode(8202);this.ctx.fillStyle=this.options.lineColor,this.ctx.translate(20,t);for(var e=1;e<10;e++){var r="".concat(e<=5?e:10-e).concat(n,"0");this.ctx.translate(0,this.courtTypeConstants.END_ZONE_HEIGHT),this.ctx.save(),this.ctx.rotate(Math.PI/2),this.ctx.fillText(r,-6,0),this.ctx.translate(0,40-this.courtTypeConstants.COURT_RECT_WIDTH),this.ctx.rotate(Math.PI),this.ctx.fillText(r,-6,0),this.ctx.restore()}}}]),e}(No);function SD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var LD=function(t){io()(e,t);var n=SD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this,n=[3,53,this.courtTypeConstants.COURT_RECT_WIDTH-53-3,this.courtTypeConstants.COURT_RECT_WIDTH-3-3];this.ctx.save(),this.ctx.lineWidth=this.courtTypeConstants.COURT_LINE_WIDTH;for(var e=function(e){n.forEach((function(n){for(var r=0;r<4;r++){var i=3+3*r,u={x:n,y:e-i},M={x:n+3,y:e-i};t.ctx.beginPath(),t.ctx.moveTo(u.x,u.y),t.ctx.lineTo(M.x,M.y),t.ctx.stroke()}}))},r=this.courtTypeConstants.END_ZONE_HEIGHT+15;r<=this.courtCenter.y;r+=15)e(r);this.ctx.restore()}}]),e}(No);function kD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var vD=function(t){io()(e,t);var n=kD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){for(var t=this.courtTypeConstants.END_ZONE_HEIGHT;t<=this.courtCenter.y;t+=15){var n={x:0,y:t},e={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:t};this.ctx.beginPath(),this.ctx.lineWidth=t%30==0?2*this.courtTypeConstants.COURT_LINE_WIDTH:this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(n.x,n.y),this.ctx.lineTo(e.x,e.y),this.ctx.stroke()}}}]),e}(No),YD=.32,mD=1.5,FD=2,RD=.55,bD=!1,BD=160,ZD=360,VD=30;function WD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var GD=function(t){io()(e,t);var n=WD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.setColor("#000"),this.ctx.lineWidth=4*this.courtTypeConstants.COURT_LINE_WIDTH;var t=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH-this.courtTypeConstants.END_ZONE_LENGTH,n=(this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.FACE_OFF_SPOTS_DISTANCE)/2,e=[{x:0,y:this.courtCenter.y},{x:0,y:t}],r=[{x:n,y:0},{x:this.courtTypeConstants.COURT_RECT_WIDTH-n,y:0}],i=[{x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y},{x:this.courtTypeConstants.COURT_RECT_WIDTH,y:t}];this.ctx.beginPath(),this.ctx.moveTo(e[0].x,e[0].y),this.ctx.lineTo(e[1].x,e[1].y),this.ctx.bezierCurveTo(0,0,10,0,r[0].x,r[0].y),this.ctx.lineTo(r[1].x,r[1].y),this.ctx.bezierCurveTo(this.courtTypeConstants.COURT_RECT_WIDTH-10,0,this.courtTypeConstants.COURT_RECT_WIDTH,0,i[1].x,i[1].y),this.ctx.lineTo(i[0].x,i[0].y),this.ctx.stroke()}}]),e}(No);function PD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var JD=function(t){io()(e,t);var n=PD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_BLUE),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,15,0,2*Math.PI,!0),this.ctx.stroke()}}]),e}(No);function HD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var XD=function(t){io()(e,t);var n=HD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.setLineDash([2,1]),this.ctx.lineWidth=4*this.courtTypeConstants.COURT_LINE_WIDTH;var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No);function KD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var qD=function(t){io()(e,t);var n=KD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_BLUE),this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,1,0,2*Math.PI,!0),this.ctx.fill()}}]),e}(No);function _D(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var $D=function(t){io()(e,t);var n=_D(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this;this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH;var n=(this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.FACE_OFF_SPOTS_DISTANCE)/2,e=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH-this.courtTypeConstants.END_ZONE_LENGTH+22;[{x:n,y:e},{x:this.courtTypeConstants.COURT_RECT_WIDTH-n,y:e}].forEach((function(n){t.ctx.beginPath(),t.ctx.arc(n.x,n.y,t.courtTypeConstants.FACE_OFF_SPOT_RADIUS,0,2*Math.PI,!0),t.ctx.fill(),t.ctx.beginPath(),t.ctx.arc(n.x,n.y,t.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS,0,2*Math.PI,!0),t.ctx.stroke(),[{ox:n.x-t.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS,tx:n.x-(t.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS+1)},{ox:n.x+t.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS,tx:n.x+(t.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS+1)}].forEach((function(e){[n.y-1,n.y+1].forEach((function(n){t.ctx.beginPath(),t.ctx.moveTo(e.ox,n),t.ctx.lineTo(e.tx,n),t.ctx.stroke()}))}))}))}}]),e}(No);function ts(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ns=function(t){io()(e,t);var n=ts(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH;var t=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH-this.courtTypeConstants.END_ZONE_LENGTH;this.ctx.beginPath(),this.ctx.moveTo(0,t),this.ctx.lineTo(this.courtTypeConstants.COURT_RECT_WIDTH,t),this.ctx.stroke()}}]),e}(No);function es(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var rs=function(t){io()(e,t);var n=es(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_BLUE),this.ctx.lineWidth=4*this.courtTypeConstants.COURT_LINE_WIDTH;var t={x:0,y:this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH};this.ctx.beginPath(),this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke(),this.setColor(this.courtTypeConstants.LINE_COLOR_RED);var e=(this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.FACE_OFF_SPOTS_DISTANCE)/2,r=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH+5,i={x:e,y:r},u={x:this.courtTypeConstants.COURT_RECT_WIDTH-e,y:r};this.ctx.beginPath(),this.ctx.arc(i.x,i.y,this.courtTypeConstants.FACE_OFF_SPOT_RADIUS,0,2*Math.PI,!0),this.ctx.fill(),this.ctx.beginPath(),this.ctx.arc(u.x,u.y,this.courtTypeConstants.FACE_OFF_SPOT_RADIUS,0,2*Math.PI,!0),this.ctx.fill()}}]),e}(No);function is(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var us=function(t){io()(e,t);var n=is(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(0,this.courtCenter.y,10,-Math.PI/2,Math.PI/2,!1),this.ctx.stroke()}}]),e}(No),Ms=.1667,Ns=1.5,os=2,cs=.55,as=!0;function Ds(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ss=function(t){io()(e,t);var n=Ds(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH;var t=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH-this.courtTypeConstants.END_ZONE_LENGTH;this.ctx.beginPath(),this.ctx.moveTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,t),this.ctx.lineTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,t+this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,t+this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,t),this.ctx.stroke(),this.setColor("#000"),this.ctx.beginPath(),this.ctx.moveTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t),this.ctx.lineTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t-this.courtTypeConstants.GOAL_CAGE_DEPTH),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t-this.courtTypeConstants.GOAL_CAGE_DEPTH),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t),this.ctx.stroke()}}]),e}(No),Ts=85,gs=200,ls="#C8102E",Is="#0032A0",js=64,ys=25,hs=44,zs=.75,Os=15,As=6,xs=3,Es=4;function fs(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ps=function(t){io()(e,t);var n=fs(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH;var t=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH-this.courtTypeConstants.END_ZONE_LENGTH;this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,t,this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,0,Math.PI,!1),this.ctx.stroke(),this.setColor("#000"),this.ctx.beginPath(),this.ctx.moveTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t),this.ctx.lineTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t-this.courtTypeConstants.GOAL_CAGE_DEPTH),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t-this.courtTypeConstants.GOAL_CAGE_DEPTH),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t),this.ctx.stroke()}}]),e}(No),Us=100,ds=200,Cs="#C8102E",Qs="#0032A0",ws=58,Ss=29,Ls=44,ks=.75,vs=15,Ys=6,ms=3,Fs=5.8;function Rs(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var bs=function(t){io()(e,t);var n=Rs(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No);function Bs(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Zs=function(t){io()(e,t);var n=Bs(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y-this.courtTypeConstants.RESTRAINING_CENTER_OFFSET_Y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y-this.courtTypeConstants.RESTRAINING_CENTER_OFFSET_Y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No),Vs=.1667,Ws=1.5,Gs=1,Ps=.33,Js=!0;function Hs(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Xs=function(t){io()(e,t);var n=Hs(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke();var e=[{x:this.courtCenter.x-1,y:this.courtCenter.y-1},{x:this.courtCenter.x+1,y:this.courtCenter.y-1},{x:this.courtCenter.x+1,y:this.courtCenter.y+1},{x:this.courtCenter.x-1,y:this.courtCenter.y+1}];this.ctx.beginPath(),this.ctx.moveTo(e[0].x,e[0].y),this.ctx.lineTo(e[2].x,e[2].y),this.ctx.moveTo(e[1].x,e[1].y),this.ctx.lineTo(e[3].x,e[3].y),this.ctx.stroke()}}]),e}(No);function Ks(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var qs=function(t){io()(e,t);var n=Ks(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtTypeConstants.WING_OFFSET_X,y:0},n={x:this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y-this.courtTypeConstants.RESTRAINING_CENTER_OFFSET_Y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke();var e={x:this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.WING_OFFSET_X,y:0},r={x:this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y-this.courtTypeConstants.RESTRAINING_CENTER_OFFSET_Y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.stroke();var i={x:this.courtCenter.x,y:15};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(i.x-1,i.y),this.ctx.lineTo(i.x+1,i.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.arc(i.x,i.y,3,0,2*Math.PI,!0),this.ctx.stroke()}}]),e}(No);function _s(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var $s=function(t){io()(e,t);var n=_s(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y-10},n={x:this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke();var e={x:this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y-10},r={x:this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.stroke()}}]),e}(No),tT=60,nT=110,eT=10,rT=20;function iT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var uT=function(t){io()(e,t);var n=iT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:this.courtCenter.x-1.5,y:this.courtCenter.y},n={x:this.courtCenter.x+1.5,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,10,0,2*Math.PI,!0),this.ctx.stroke()}}]),e}(No);function MT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var NT=function(t){io()(e,t);var n=MT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this,n={x:this.courtCenter.x,y:this.courtCenter.y-this.courtTypeConstants.RESTRAINING_CENTER_OFFSET_Y-30};this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(n.x,n.y,2.84,0,2*Math.PI,!1),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.arc(n.x,n.y,15.97,0,Math.PI,!1),this.ctx.stroke();var e={x:n.x-15.97,y:n.y},r={x:n.x-2.84,y:n.y},i={x:n.x+15.97,y:n.y},u={x:n.x+2.84,y:n.y};this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.moveTo(i.x,i.y),this.ctx.lineTo(u.x,u.y),this.ctx.stroke();var M={x:n.x,y:n.y-2.84},N=Math.PI/4,o=Math.PI/2+Math.PI/4;this.ctx.beginPath(),this.ctx.arc(M.x,M.y,14.43,N,o,!1),this.ctx.stroke();var c=oT(M,14.43,o),a=oT(M,14.43,N),D=n.x-2.84,s=n.x+2.84;this.ctx.beginPath(),this.ctx.moveTo(c.x,c.y),this.ctx.lineTo(D,n.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(a.x,a.y),this.ctx.lineTo(s,n.y),this.ctx.stroke();var T={x:D-8.75,y:n.y},g={x:s+8.75,y:n.y};this.ctx.beginPath(),this.ctx.moveTo(T.x,T.y),this.ctx.lineTo(T.x,T.y+1),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(g.x,g.y),this.ctx.lineTo(g.x,g.y+1),this.ctx.stroke();var l=oT(M,14.43,Math.PI/2);this.ctx.beginPath(),this.ctx.moveTo(l.x,l.y-1),this.ctx.lineTo(l.x,l.y+1),this.ctx.stroke();for(var I=function(n){[1,-1].forEach((function(e){var r=Math.PI/2+Math.PI/10*e*n,i=oT(M,14.43,r);t.ctx.save(),t.ctx.translate(i.x,i.y),t.ctx.rotate(Math.PI/10*e*n),t.ctx.beginPath(),t.ctx.moveTo(0,-1),t.ctx.lineTo(0,1),t.ctx.stroke(),t.ctx.restore()}))},j=1;j<=3;j++)I(j);var y={x:T.x,y:T.y-5},h={x:g.x,y:g.y-5};this.ctx.beginPath(),this.ctx.arc(y.x,y.y,.5,0,2*Math.PI,!1),this.ctx.arc(h.x,h.y,.5,0,2*Math.PI,!1),this.ctx.fill();var z={x:n.x-1,y:n.y},O={x:n.x+1,y:n.y},A={x:n.x,y:n.y-1};this.ctx.beginPath(),this.ctx.moveTo(z.x,z.y),this.ctx.lineTo(O.x,O.y),this.ctx.lineTo(A.x,A.y),this.ctx.closePath(),this.ctx.stroke()}}]),e}(No);function oT(t,n,e){return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}}var cT=60,aT=130,DT=20;function sT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var TT=function(t){io()(e,t);var n=sT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No);function gT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var lT=function(t){io()(e,t);var n=gT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,this.courtTypeConstants.CENTER_CIRCLE_RADIUS,0,2*Math.PI,!0),this.ctx.stroke()}}]),e}(No);function IT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var jT=function(t){io()(e,t);var n=IT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No);function yT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var hT=function(t){io()(e,t);var n=yT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,.25,0,2*Math.PI,!0),this.ctx.fill()}}]),e}(No);function zT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var OT=function(t){io()(e,t);var n=zT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=0,n=0,e={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:0};this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(t,n,1,0,Math.PI/2,!1),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.arc(e.x,e.y,1,Math.PI,Math.PI/2,!0),this.ctx.stroke()}}]),e}(No);function AT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var xT=function(t){io()(e,t);var n=AT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtTypeConstants.PENALTY_SPOT_OFFSET_Y,this.courtTypeConstants.CENTER_CIRCLE_RADIUS,Math.PI/5,Math.PI-Math.PI/5,!1),this.ctx.stroke()}}]),e}(No);function ET(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var fT=function(t){io()(e,t);var n=ET(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.rect(this.courtCenter.x-this.courtTypeConstants.PENALTY_AREA.width/2,0,this.courtTypeConstants.PENALTY_AREA.width,this.courtTypeConstants.PENALTY_AREA.height),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.rect(this.courtCenter.x-this.courtTypeConstants.GOAL_AREA.width/2,0,this.courtTypeConstants.GOAL_AREA.width,this.courtTypeConstants.GOAL_AREA.height),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.rect(this.courtCenter.x-this.courtTypeConstants.GOAL.width/2,-this.courtTypeConstants.GOAL.height,this.courtTypeConstants.GOAL.width,this.courtTypeConstants.GOAL.height),this.ctx.stroke()}}]),e}(No);function pT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var UT=function(t){io()(e,t);var n=pT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtTypeConstants.PENALTY_SPOT_OFFSET_Y,.25,0,2*Math.PI,!1),this.ctx.fill()}}]),e}(No),dT=.1667,CT=1.5,QT=1,wT=.33,ST=!0,LT=60,kT=110,vT=10,YT=12,mT={width:44,height:18},FT={width:8,height:2.66},RT={width:20,height:6},bT=60,BT=110,ZT=10,VT=12,WT={width:44,height:18},GT={width:8,height:2.66},PT={width:20,height:6};function JT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var HT=function(t){io()(e,t);var n=JT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t=[{x:this.courtCenter.x-1,y:this.courtCenter.y-1},{x:this.courtCenter.x+1,y:this.courtCenter.y-1},{x:this.courtCenter.x+1,y:this.courtCenter.y+1},{x:this.courtCenter.x-1,y:this.courtCenter.y+1}];this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.lineTo(t[2].x,t[2].y),this.ctx.moveTo(t[1].x,t[1].y),this.ctx.lineTo(t[3].x,t[3].y),this.ctx.stroke()}}]),e}(No);function XT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var KT=function(t){io()(e,t);var n=XT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=11,n=0,e={x:this.courtTypeConstants.COURT_RECT_WIDTH-11,y:0};this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(t,n-1),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(e.x,e.y-1),this.ctx.stroke()}}]),e}(No);function qT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var _T=function(t){io()(e,t);var n=qT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.moveTo(this.courtCenter.x-.33,12),this.ctx.lineTo(this.courtCenter.x+.33,12),this.ctx.stroke()}}]),e}(No),$T=70,tg=115,ng=10,eg=12,rg={width:44,height:18},ig={width:8,height:2.66},ug={width:20,height:6};function Mg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ng=function(t){io()(e,t);var n=Mg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=11,n=0,e={x:this.courtTypeConstants.COURT_RECT_WIDTH-11,y:0};this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(t,n-1),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(e.x,e.y-1),this.ctx.stroke()}}]),e}(No);function og(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var cg=function(t){io()(e,t);var n=og(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.moveTo(this.courtCenter.x-.33,12),this.ctx.lineTo(this.courtCenter.x+.33,12),this.ctx.stroke()}}]),e}(No),ag=60,Dg=100,sg=10,Tg=12,gg={width:44,height:18},lg={width:8,height:2.66},Ig={width:20,height:6};function jg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var yg=function(t){io()(e,t);var n=jg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH;var t={x:0,y:this.courtTypeConstants.COURT_RECT_HEIGHT/3},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtTypeConstants.COURT_RECT_HEIGHT/3};this.ctx.beginPath(),this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No);function hg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var zg=function(t){io()(e,t);var n=hg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtTypeConstants.PENALTY_SPOT_OFFSET_Y,this.courtTypeConstants.CENTER_CIRCLE_RADIUS,Math.PI/12,Math.PI-Math.PI/12,!1),this.ctx.stroke()}}]),e}(No),Og=45,Ag=65,xg=8,Eg=10,fg={width:24,height:12},pg={width:6,height:2},Ug={width:8,height:4};function dg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Cg=function(t){io()(e,t);var n=dg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtTypeConstants.PENALTY_SPOT_OFFSET_Y,this.courtTypeConstants.CENTER_CIRCLE_RADIUS,Math.PI/6,Math.PI-Math.PI/6,!1),this.ctx.stroke()}}]),e}(No),Qg=55,wg=80,Sg=8,Lg=10,kg={width:36,height:14},vg={width:6.16,height:2.16},Yg={width:12,height:5};function mg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Fg=function(t){io()(e,t);var n=mg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y-9.8},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y-9.8};this.ctx.beginPath(),this.ctx.lineWidth=this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke();for(var e=.574,r=0;r<5;r++)this.ctx.beginPath(),this.ctx.moveTo(t.x-e,t.y),this.ctx.lineTo(t.x-e-.574,n.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(n.x+e,t.y),this.ctx.lineTo(n.x+e+.574,n.y),this.ctx.stroke(),e+=1.148}}]),e}(No);function Rg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var bg=function(t){io()(e,t);var n=Rg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No);function Bg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Zg=function(t){io()(e,t);var n=Bg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke(),this.ctx.beginPath()}}]),e}(No);function Vg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Wg,Gg,Pg,Jg,Hg,Xg,Kg,qg,_g,$g=function(t){io()(e,t);var n=Vg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this.courtTypeConstants.COURT_RECT_WIDTH;this.ctx.beginPath(),this.ctx.moveTo(0,-.574),this.ctx.lineTo(0,-1.148),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(t,-.574),this.ctx.lineTo(t,-1.148),this.ctx.stroke()}}]),e}(No),tl=.1667,nl=1.5,el=1,rl=.33,il=!0,ul=29.5,Ml=59.1,Nl=(Wg={},It()(Wg,rn,M),It()(Wg,qt,a),It()(Wg,$t,d),It()(Wg,en,w),It()(Wg,tn,m),It()(Wg,nn,V),It()(Wg,_t,nt),Wg),ol=(Xg={},It()(Xg,rn,It()({},pn,c)),It()(Xg,qt,(Gg={},It()(Gg,un,s),It()(Gg,Mn,g),It()(Gg,Nn,I),It()(Gg,on,y),It()(Gg,cn,z),It()(Gg,an,A),It()(Gg,Dn,E),It()(Gg,sn,p),Gg)),It()(Xg,$t,{}),It()(Xg,en,(Pg={},It()(Pg,En,L),It()(Pg,fn,v),Pg)),It()(Xg,tn,(Jg={},It()(Jg,In,R),It()(Jg,jn,B),Jg)),It()(Xg,nn,(Hg={},It()(Hg,hn,J),It()(Hg,zn,X),It()(Hg,On,q),It()(Hg,An,$),Hg)),It()(Xg,_t,{}),Xg),cl=(Kg={},It()(Kg,rn,N),It()(Kg,qt,D),It()(Kg,$t,C),It()(Kg,en,S),It()(Kg,tn,F),It()(Kg,nn,W),It()(Kg,_t,et),Kg),al=(qg={},It()(qg,pn,o),It()(qg,un,T),It()(qg,Mn,l),It()(qg,Nn,j),It()(qg,on,h),It()(qg,cn,O),It()(qg,an,x),It()(qg,Dn,f),It()(qg,sn,U),It()(qg,gn,Q),It()(qg,Tn,Q),It()(qg,En,k),It()(qg,fn,Y),It()(qg,In,b),It()(qg,jn,Z),It()(qg,yn,P),It()(qg,hn,H),It()(qg,zn,K),It()(qg,On,_),It()(qg,An,tt),It()(qg,xn,G),It()(qg,ln,rt),qg),Dl=(_g={},It()(_g,rn,{courtTypes:[pn]}),It()(_g,qt,{courtTypes:[un,Mn,Nn,on,cn,an,Dn,sn]}),It()(_g,$t,{courtTypes:[Tn]}),It()(_g,en,{courtTypes:[En,fn]}),It()(_g,tn,{courtTypes:[In,jn]}),It()(_g,nn,{courtTypes:[yn,hn,zn,On,An,xn]}),It()(_g,_t,{courtTypes:[ln]}),_g);function sl(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}var Tl=function(){function t(n,e,r){st()(this,t),this.ctx=n,this.playData=e,this.options=r}return gt()(t,[{key:"courtTypeConstants",get:function(){if(!cl[this.playData.sport])throw new Error("unknown sport type constants");if(!al[this.playData.court.type])throw new Error("unknown court type constants");return function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?sl(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):sl(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}({},cl[this.playData.sport],{},al[this.playData.court.type])}}]),t}();function gl(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function ll(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Il=function(t){io()(e,t);var n=ll(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.init(),this.ctx.save(),this.ctx.lineWidth=this.courtTypeConstants.COURT_LINE_WIDTH,this.setColor(),Object.values(this.courtTypeLayers).forEach((function(n){new n(t).apply()})),this.ctx.restore()}},{key:"init",value:function(){this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.setBackground(),this.setWatermark(),this.ctx.restore()}},{key:"setColor",value:function(){var t=this.options.lineColor||"#fff";this.ctx.strokeStyle=t,this.ctx.fillStyle=t}},{key:"setBackground",value:function(){this.staticData.backgroundOptions&&this.staticData.backgroundOptions[this.background]?(this.ctx.fillStyle=this.ctx.createPattern(this.staticData.backgroundOptions[this.background],"repeat"),this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)):0===this.background.indexOf("#")&&(this.ctx.save(),this.ctx.fillStyle=this.background,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore())}},{key:"setWatermark",value:function(){var t=this.options.watermark?this.staticData.watermark[this.options.watermark]:null;if(t){var n=t.width/t.height,e=this.frameWidth/5,r={width:e,height:e*t.height/t.width};n<1&&(r.width=e*t.width/t.height,r.height=e);var i=this.playData.court.courtRect.size.height>this.courtTypeConstants.COURT_RECT_HEIGHT?Math.abs(this.playData.court.courtRect.origin.y):0,u=(1+Math.abs(this.playData.court.courtRect.origin.x))*this.scale,M=(this.playData.court.courtRect.size.height-i-1)*this.scale-r.height;this.ctx.drawImage(t,0,0,t.width,t.height,u,M,r.width,r.height)}}},{key:"frameWidth",get:function(){return this.options.width}},{key:"scale",get:function(){return this.options.scale}},{key:"staticData",get:function(){return this.options.staticData}},{key:"courtTypeLayers",get:function(){if(!Nl[this.playData.sport])throw new Error("unknown sport type layer");return function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?gl(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):gl(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}({},Nl[this.playData.sport],{},(ol[this.playData.sport]||{})[this.playData.court.type]||{})}},{key:"background",get:function(){return this.options.background||this.playData.sport}}]),e}(Tl),jl=e(11),yl=e.n(jl),hl={drawLineFromControlPoints:function(){var t=this;this.ctx.save(),this.setLineOptions(),this.ctx.lineJoin="round",this.getProcessedLinePaths().forEach((function(n){t.ctx.save(),n.alpha&&t.setColor(n.alpha),t.ctx.beginPath();var e=n.controlPoints;t.ctx.moveTo(e[0].x,e[0].y),2===e.length&&("DRIBBLE"===(t.line||t.shape||{}).type&&(t.ctx.lineCap="round"),t.ctx.lineTo(e[1].x,e[1].y)),3===e.length&&t.ctx.quadraticCurveTo(e[1].x,e[1].y,e[2].x,e[2].y),4===e.length&&t.ctx.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y),t.ctx.stroke(),t.ctx.restore()})),this.ctx.restore()},drawArrowLineCap:function(t){var n=t||this.arrowTipPoint();this.ctx.save();var e=this.angleBetweenLastTwoPoints(),r=n,i={x:r.x-1.4/1.3,y:r.y},u={x:r.x-1.4-1.4/6,y:r.y-.7},M={x:r.x-1.4-1.4/6,y:r.y+.7};this.ctx.beginPath(),this.ctx.translate(r.x,r.y),this.ctx.rotate(e),this.ctx.translate(-r.x,-r.y),this.ctx.moveTo(i.x,i.y),this.ctx.lineTo(u.x,u.y),this.ctx.lineTo(r.x,r.y),this.ctx.lineTo(M.x,M.y),this.ctx.lineTo(i.x,i.y),this.ctx.fill(),this.ctx.stroke(),this.ctx.restore()},drawPerpendicularLineCap:function(){this.drawPerpendicularLineAtCourtPoint(this.arrowTipPoint(),this.angleBetweenLastTwoPoints())},drawPerpendicularLineAtCourtPoint:function(t,n){this.ctx.save();var e={x:t.x,y:t.y-1.5},r={x:t.x,y:t.y+1.5};this.ctx.beginPath(),this.ctx.translate(t.x,t.y),this.ctx.rotate(n),this.ctx.translate(-t.x,-t.y),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.fill(),this.ctx.stroke(),this.ctx.restore()},handOffLineCap:function(t){var n=this;this.ctx.save(),t.forEach((function(t){var e=t.controlPoints,r=n.calcMidPoint(e[0],e[e.length-1]),i=n.angleBetweenLastTwoPoints(),u=.5*Math.cos(i),M=.5*Math.sin(i),N={x:r.x+u,y:r.y+M},o={x:r.x-u,y:r.y-M};n.drawPerpendicularLineAtCourtPoint(N,i),n.drawPerpendicularLineAtCourtPoint(o,i),n.ctx.stroke()})),this.ctx.restore()},calcMidPoint:function(t,n){return{x:t.x+(n.x-t.x)/2,y:t.y+(n.y-t.y)/2}},angleBetweenLastTwoPoints:function(){var t=$n()(this.getProcessedLinePaths()).pop().controlPoints,n=t[t.length-1],e=t[t.length-2];return this.angleBetweenTwoPoints(e,n)},angleBetweenTwoPoints:function(t,n){var e=n.x-t.x,r=n.y-t.y;return Math.atan2(r,e)},arrowTipPoint:function(){var t=$n()(this.getProcessedLinePaths()).pop().controlPoints;return t[t.length-1]},setLineOptions:function(){}};function zl(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function Ol(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?zl(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):zl(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}function Al(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var xl=function(t){io()(e,t);var n=Al(e);function e(t,r){var i;return st()(this,e),(i=n.call(this,t)).line=r,It()(yl()(i),"lineWidth",void 0),It()(yl()(i),"debugMasking",void 0),It()(yl()(i),"startMaskSettings",void 0),It()(yl()(i),"endMaskSettings",void 0),i.lineWidth=t.lineWidth,i.debugMasking=!1,i.startMaskSettings=null,i.endMaskSettings=null,i}return gt()(e,[{key:"drawLineFromControlPoints",value:function(){}},{key:"drawArrowLineCap",value:function(t){}},{key:"handOffLineCap",value:function(t){}},{key:"drawPerpendicularLineCap",value:function(){}},{key:"angleBetweenLastTwoPoints",value:function(){return 0}}]),gt()(e,[{key:"drawLogic",value:function(){!this.options.animationGlobalProgress&&this.courtTypeConstants.LINE_MASKING&&(this.setLineMasking(),this.applyMasking()),this.setColor(),this.drawLineFromControlPoints(),this.drawLineCap()}},{key:"setColor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=!1;if(this.options.position){var e=this.line.originalData,r=e.playerPositionOrigin,i=e.playerPositionTerminus;r!==this.options.position&&i!==this.options.position||(n=!0)}var u=this.line.color,M=u.alpha,N=u.blue,o=u.green,c=u.red,a=n?0:Math.ceil(255*c),D=n?0:Math.ceil(255*o),s=n?255:Math.ceil(255*N),T="rgba(".concat(a,", ").concat(D,", ").concat(s,", ").concat(t||M,")");this.ctx.fillStyle=T,this.ctx.strokeStyle=T}},{key:"getProcessedLinePaths",value:function(){return this.line.getLineParts()}},{key:"applyMasking",value:function(){var t=this;this.line.getLineParts().forEach((function(n,e){var r=n.controlPoints;t.startMaskSettings&&(r=GN(r,t.startMaskSettings.radius,t.startMaskSettings.centerPoint),t.line.setLinePartsAdjustedAtIndex(e,Ol({},n,{controlPoints:r}))),t.endMaskSettings&&(r=GN(r,null,null,t.endMaskSettings.radius,t.endMaskSettings.centerPoint),t.line.setLinePartsAdjustedAtIndex(e,Ol({},n,{controlPoints:r})))}))}},{key:"setLineMasking",value:function(){if(this.line.playerPositionOrigin){var t=this.line.playerPositionOrigin,n=this.line.playerLineSequence;if(0===n){var e=this.playData.players.find((function(n){return n.position===t}));if(e){var r=e.possession?1.5:1;"HANDOFF"!==this.line.type||e.possession||(r=.7),this.startMaskSettings={centerPoint:e.location,radius:r}}}else if(t){var i=this.playData.lines.filter((function(e){return e.playerPositionOrigin===t&&e.playerLineSequence===n-1&&["PASS","HANDOFF"].indexOf(e.type)<0}));if(i.length){var u=Xn()(i,1)[0];if(u.lineParts.length){var M=$n()(u.lineParts).pop(),N=$n()(M.controlPoints).pop();this.startMaskSettings={centerPoint:N,radius:3}}}}}if(this.line.playerPositionTerminus&&"SCREEN"!==this.line.type){var o=3.7,c=$n()(this.line.getLineParts()).pop(),a=$n()(c.controlPoints).pop();["PASS","HANDOFF"].indexOf(this.line.type)>=0&&(o=1.75),this.endMaskSettings={centerPoint:a,radius:o}}this.showMaskingDebug()}},{key:"showMaskingDebug",value:function(){if(!1!==this.debugMasking){if(this.ctx.save(),this.ctx.lineWidth=.04,null!==this.startMaskSettings){var t=this.startMaskSettings.centerPoint,n=t.x,e=t.y;this.ctx.strokeStyle="green",this.ctx.moveTo(n,e),this.ctx.beginPath(),this.ctx.arc(n,e,this.startMaskSettings.radius,0,2*Math.PI,!0),this.ctx.stroke()}if(null!==this.endMaskSettings){var r=this.endMaskSettings.centerPoint,i=r.x,u=r.y;this.ctx.strokeStyle="red",this.ctx.moveTo(i,u),this.ctx.beginPath(),this.ctx.arc(i,u,this.endMaskSettings.radius,0,2*Math.PI,!0),this.ctx.stroke()}this.ctx.restore()}}},{key:"drawLineCap",value:function(){}}]),e}(uo);function El(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}Object.assign(xl.prototype,hl);var fl=function(t){io()(e,t);var n=El(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"allowDrawLineCap",value:function(){return!this.line.hideLineTip&&!(this.options.magnetMode&&!this.options.animationGlobalProgress)}}]),e}(xl);function pl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ul=function(t){io()(e,t);var n=pl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLineCap",value:function(){this.allowDrawLineCap()&&this.drawArrowLineCap()}}]),e}(fl),dl={convertLinePartsToDribble:function(t){var n=[];return t.forEach((function(e,r){var i=Array(4);e.controlPoints.forEach((function(t,n){i[n]=t}));for(var u=new te(i[0],i[1],i[2],i[3]),M=[],N=0,o=1/u.length;N<=1;)M.push({x:u.mx(N),y:u.my(N),time:N}),N+=o;for(var c=[],a=[],D=0;D<M.length;D++)a.push(M[D]),a.length>1&&(c.push(a),a=[M[D]]);c.forEach((function(e,i){var u=Xn()(e,2),M=u[0],N=u[1],o={x:1.2*(N.x-M.x),y:1.2*(N.y-M.y)},a=(M.x+N.x)/2,D=(M.y+N.y)/2,s={x:-o.y,y:o.x};i%2&&(s={x:o.y,y:-o.x});var T=[M,{x:a+s.x,y:D+s.y},N];1!==t.length&&r!==t.length-1||i===c.length-1&&(T=[M,N]),n.push({controlPoints:T,lpIndex:r})}))})),n}};function Cl(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function Ql(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var wl=function(t){io()(e,t);var n=Ql(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"convertLinePartsToDribble",value:function(t){return[]}},{key:"drawLineCap",value:function(){this.allowDrawLineCap()&&this.drawArrowLineCap()}},{key:"setLineOptions",value:function(){var t=this,n=$n()(this.line.getLineParts()),e=this.convertLinePartsToDribble(n);this.line.setLinePartsAdjusted([]),e.forEach((function(e){var r=e.controlPoints,i=e.lpIndex,u=Xn()(r,1)[0],M=n[i].alpha||t.line.color.alpha;if(t.options.animationGlobalProgress){var N=Xn()(t.line.animationKeyTimeChunks[i],2),o=N[0],c=N[1];yt.a.inRange(t.options.animationGlobalProgress,o,c)&&ht(t.options.animationGlobalProgress,o,c)>u.time&&(M=.1)}t.line.addLinePartAdjusted(function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?Cl(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Cl(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}({},e,{controlPoints:r,alpha:M}))}))}}]),e}(fl);function Sl(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function Ll(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}Object.assign(wl.prototype,dl);var kl=function(t){io()(e,t);var n=Ll(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLineCap",value:function(){this.handOffLineCap(this.line.baseLineParts())}},{key:"getProcessedLinePaths",value:function(){return this.line.getLineParts().map((function(t){var n=t.controlPoints;return function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?Sl(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Sl(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}({},t,{controlPoints:[n[0],n[n.length-1]]})}))}}]),e}(xl);function vl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Yl=function(t){io()(e,t);var n=vl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"setLineOptions",value:function(){this.ctx.setLineDash([1,.5])}},{key:"drawLineCap",value:function(){this.drawArrowLineCap()}}]),e}(xl);function ml(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Fl=function(t){io()(e,t);var n=ml(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLineCap",value:function(){this.allowDrawLineCap()&&this.drawPerpendicularLineCap()}}]),e}(fl);function Rl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var bl=function(t){io()(e,t);var n=Rl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLineCap",value:function(){if(this.allowDrawLineCap()){var t=this.line.lastLinePartControlPoint,n={x:.6,y:0},e=this.angleBetweenLastTwoPoints(),r={x:Math.cos(e)*n.x-Math.sin(e)*n.y,y:Math.sin(e)*n.x-Math.cos(e)*n.y},i={x:t.x+r.x,y:t.y+r.y};this.drawArrowLineCap(i)}}},{key:"setLineOptions",value:function(){this.ctx.lineWidth=.7*this.lineWidth}},{key:"drawLineFromControlPoints",value:function(){var t=this;this.ctx.save(),this.setLineOptions(),this.ctx.lineJoin="round",this.getProcessedLinePaths().forEach((function(n){t.ctx.save(),n.alpha&&t.setColor(n.alpha),t.ctx.beginPath();var e=n.controlPoints;[-.3,.3].forEach((function(n){var r=e[0].x-e[e.length-1].x,i=e[0].y-e[e.length-1].y,u=n/Math.pow(r*r+i*i,.5),M=-i*u,N=r*u,o=e.map((function(t){return{x:t.x+M,y:t.y+N}}));t.ctx.moveTo(o[0].x,o[0].y),2===e.length&&t.ctx.lineTo(o[1].x,o[1].y),3===e.length&&t.ctx.quadraticCurveTo(o[1].x,o[1].y,o[2].x,o[2].y),4===e.length&&t.ctx.bezierCurveTo(o[1].x,o[1].y,o[2].x,o[2].y,o[3].x,o[3].y),t.ctx.stroke()})),t.ctx.restore()})),this.ctx.restore()}}]),e}(fl);function Bl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Zl=function(t){io()(e,t);var n=Bl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.options.linesDisplay&&(this.ctx.save(),this.ctx.lineWidth=this.lineWidth,this.playData.lines.forEach((function(n){if(!(t.options.linesHiddenIds.indexOf(n.id)>=0)){var e="".concat(yt.a.capitalize(n.type),"LineLayer");it[e]&&new it[e](t,n).apply()}})),this.ctx.restore())}},{key:"lineWidth",get:function(){return this.courtTypeConstants.LINE_WIDTH}}]),e}(Tl);function Vl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Wl=function(t){io()(e,t);var n=Vl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.playData.players.length&&(this.ctx.save(),this.playData.players.forEach((function(n){if(!(t.options.playersHiddenPositions.findIndex((function(t){return parseInt(t)===parseInt(n.position)}))>=0)){var e=n.location,r=e.x,i=e.y;if(t.setPlayerPuckStyle(n),t.drawPlayerPuck(n),t.setPlayerLabel(n),t.staticData.playerHats&&t.staticData.playerHats.length){var u=t.options.playersMap.find((function(t){return t.position===n.position})),M=t.staticData.playerHats.find((function(t){return!!(null==u?void 0:u.playerHatKey)&&t.key===u.playerHatKey}));if(M){!0===M.reverse&&(t.ctx.save(),t.ctx.translate(2*r,0),t.ctx.scale(-1,1));var N=M.dX,o=M.dY;t.ctx.drawImage(M.image,r-(2-4*N),i-(1.4+2*t.radius+2.8*o),4,2.8),!0===M.reverse&&t.ctx.restore()}}}})),this.ctx.restore())}},{key:"setPlayerPuckStyle",value:function(t){var n=t.color,e=n.red,r=n.green,i=n.blue,u=n.alpha,M=0===e&&0===r&&0===i&&1===u,N=this.options.position&&t.position===this.options.position,o=N?0:Math.ceil(255*e),c=N?0:Math.ceil(255*r),a=N?255:Math.ceil(255*i),D="rgba(".concat(o,", ").concat(c,", ").concat(a,", ").concat(u,")");t.isDefender&&!N&&M&&(D="#bb271b"),t.possession&&M&&(D="#ff8000"),this.options.legacyPrintStyle&&(D="#000000",this.ctx.lineWidth=this.courtTypeConstants.LINE_WIDTH),this.ctx.fillStyle=D,this.ctx.strokeStyle=D}},{key:"drawPlayerPuck",value:function(t){var n=t.location,e=n.x,r=n.y;this.ctx.beginPath(),this.ctx.arc(e,r,this.radius,0,2*Math.PI,!0),this.options.legacyPrintStyle?t.possession&&this.ctx.stroke():this.ctx.fill()}},{key:"setPlayerLabel",value:function(t){var n=t.location,e=n.x,r=n.y;if(this.staticData.playerHeadshots&&"Headshot"===this.options.labelsOverrideType){var i=this.options.playersMap.find((function(n){return n.position===t.position})),u=this.staticData.playerHeadshots.find((function(t){return t.id===(null==i?void 0:i.teamPlayerId)}));if(this.ctx.save(),this.ctx.translate(e,r),u){this.ctx.save();var M=u.image.width<u.image.height,N=u.image.height<u.image.width,o=M?u.image.height/u.image.width:N?u.image.width/u.image.height:1,c=2*this.radius*(M?u.image.width/u.image.height:1)*o,a=2*this.radius*(N?u.image.height/u.image.width:1)*o,D=0-(N?c/2:this.radius),s=0-(M?a/2:this.radius);this.options.flipPlayerLabels&&this.ctx.rotate(Math.PI),this.ctx.arc(0,0,this.radius,0,2*Math.PI,!0),this.ctx.clip(),this.ctx.drawImage(u.image,D,s,c,a),this.ctx.restore()}if(this.ctx.beginPath(),this.ctx.lineWidth=this.courtTypeConstants.LINE_WIDTH,this.ctx.arc(0,0,this.radius,0,2*Math.PI,!0),this.ctx.stroke(),this.ctx.restore(),u)return}var T=t.color.alpha,g=(3-.5*t.textLabel.length)*(this.options.legacyPrintStyle?1.3:1)*this.playerScale,l=(1-.15*t.textLabel.length)*(this.options.legacyPrintStyle?1.4:1)*this.playerScale;if(T){this.ctx.fillStyle=this.options.legacyPrintStyle?"#000000":"#ffffff",this.ctx.textAlign="center",this.ctx.font="".concat(g,"px Helvetica"),this.options.mirror&&(this.ctx.save(),this.ctx.translate(2*e,0),this.ctx.scale(-1,1));var I=e,j=r;this.options.flipPlayerLabels&&(I=0,j=0,this.ctx.save(),this.ctx.translate(e,r),this.ctx.rotate(Math.PI)),this.ctx.fillText(t.textLabel,I,j+l),this.options.flipPlayerLabels&&this.ctx.restore(),this.options.mirror&&this.ctx.restore()}}},{key:"staticData",get:function(){return this.options.staticData}},{key:"playerScale",get:function(){return this.courtTypeConstants.PLAYER_TOKEN_SCALE*this.options.playerTokenScale}},{key:"radius",get:function(){return this.courtTypeConstants.PLAYER_TOKEN_RADIUS*this.playerScale}}]),e}(Tl);function Gl(t,n){var e=t.hideForStatic&&!n.inDrawingState?0:1;n.animationGlobalProgress&&(e=0,t.animations.map((function(t){var n=Xn()(t.keyTimes,2);return[n[0],n[1]]})).forEach((function(t){var r=Xn()(t,2),i=r[0],u=r[1],M=i-.03,N=i,o=u,c=u+.03;yt.a.inRange(n.animationGlobalProgress,M,N)&&(e=10*(.03-(N-n.animationGlobalProgress))),yt.a.inRange(n.animationGlobalProgress,i,u)&&(e=1),yt.a.inRange(n.animationGlobalProgress,o,c)&&(e=10*(c-n.animationGlobalProgress))})));return e}function Pl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Jl=function(t){io()(e,t);var n=Pl(e);function e(t,r){var i;return st()(this,e),i=n.call(this,t),It()(yl()(i),"shape",void 0),It()(yl()(i),"animationAlpha",void 0),i.shape=r,i.animationAlpha=Gl(r,t.options),i}return gt()(e,[{key:"drawLogic",value:function(){var t=this.shape,n=t.location,e=t.scale,r=t.angleRad;this.ctx.translate(n.x,n.y),this.ctx.rotate(r),this.ctx.scale(e.x,e.y),this.setLineWidth(),this.setColor(),this.drawShape(),this.drawShapeWrapPoints()}},{key:"setLineWidth",value:function(){this.ctx.lineWidth=this.courtTypeConstants.COURT_LINE_WIDTH}},{key:"setColor",value:function(){var t=this.shape.color,n=t.alpha,e=t.blue,r=t.green,i=t.red,u=Math.ceil(255*i),M=Math.ceil(255*r),N=Math.ceil(255*e);this.ctx.fillStyle="rgba(".concat(u,", ").concat(M,", ").concat(N,", ").concat(n*this.animationAlpha,")"),this.ctx.strokeStyle="rgba(".concat(u,", ").concat(M,", ").concat(N,", ").concat(n?this.animationAlpha:0,")")}},{key:"drawShapeWrapPoints",value:function(){}},{key:"drawShape",value:function(){this.ctx.save(),this.drawShapeLogic(),this.drawShapeBorder(),this.ctx.restore()}},{key:"drawShapeBorder",value:function(){this.shape.showBorder&&this.ctx.stroke()}},{key:"drawShapeLogic",value:function(){}},{key:"staticData",get:function(){return this.options.staticData}}]),e}(uo);function Hl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Xl=function(t){io()(e,t);var n=Hl(e);function e(t,r){return st()(this,e),n.call(this,t,r)}return gt()(e,[{key:"drawLineFromControlPoints",value:function(){}},{key:"drawArrowLineCap",value:function(t){}},{key:"handOffLineCap",value:function(t){}},{key:"drawPerpendicularLineCap",value:function(){}},{key:"angleBetweenLastTwoPoints",value:function(){return 0}}]),gt()(e,[{key:"setLineWidth",value:function(){this.ctx.lineWidth=this.courtTypeConstants.LINE_WIDTH}},{key:"getProcessedLinePaths",value:function(){return[this.shape.linePart]}},{key:"drawShapeLogic",value:function(){this.drawLine(),this.drawLineCap()}},{key:"drawLine",value:function(){}},{key:"drawLineCap",value:function(){}}]),e}(Jl);function Kl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}Object.assign(Xl.prototype,hl);var ql=function(t){io()(e,t);var n=Kl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLine",value:function(){this.drawLineFromControlPoints()}},{key:"drawLineCap",value:function(){this.drawArrowLineCap()}}]),e}(Xl);function _l(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var $l=function(t){io()(e,t);var n=_l(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"convertLinePartsToDribble",value:function(t){return[]}},{key:"drawLine",value:function(){this.drawLineFromControlPoints()}},{key:"drawLineCap",value:function(){this.drawArrowLineCap()}},{key:"getProcessedLinePaths",value:function(){return this.convertLinePartsToDribble($n()(this.shape.linePart?[this.shape.linePart]:[]))}}]),e}(Xl);function tI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}Object.assign($l.prototype,dl);var nI=function(t){io()(e,t);var n=tI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLine",value:function(){this.drawLineFromControlPoints()}},{key:"drawLineCap",value:function(){this.handOffLineCap(this.getProcessedLinePaths())}}]),e}(Xl);function eI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var rI=function(t){io()(e,t);var n=eI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLine",value:function(){this.drawLineFromControlPoints()}},{key:"drawLineCap",value:function(){this.drawArrowLineCap()}},{key:"setLineOptions",value:function(){this.ctx.setLineDash([1,.5])}}]),e}(Xl);function iI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var uI=function(t){io()(e,t);var n=iI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLine",value:function(){this.drawLineFromControlPoints()}},{key:"drawLineCap",value:function(){this.drawPerpendicularLineCap()}}]),e}(Xl);function MI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var NI=function(t){io()(e,t);var n=MI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.outerCircleRadius;this.ctx.beginPath(),this.ctx.arc(0,0,t,0,2*Math.PI),this.ctx.fill()}}]),e}(Jl);function oI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var cI=function(t){io()(e,t);var n=oI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape,n=t.color,e=t.outerCircleRadius;if(0!==n.alpha&&this.staticData.shapes&&this.staticData.shapes.length){var r=this.staticData.shapes.find((function(t){return"cone"===t.key}));r&&this.ctx.drawImage(r.image,-e/2,-e/2,e,e)}}}]),e}(Jl);function aI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var DI=function(t){io()(e,t);var n=aI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.shapeControlPoints;this.ctx.rotate(Math.PI),this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.lineTo(t[1].x,t[1].y),this.ctx.lineTo(t[2].x,t[2].y),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.fill()}}]),e}(Jl);function sI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var TI=function(t){io()(e,t);var n=sI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.outerCircleRadius;this.ctx.beginPath(),this.ctx.rect(-t/2,-t/2,t,t),this.ctx.fill()}}]),e}(Jl);function gI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var lI=function(t){io()(e,t);var n=gI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.shapeControlPoints;this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.lineTo(t[1].x,t[1].y),this.ctx.lineTo(t[2].x,t[2].y),this.ctx.lineTo(t[3].x,t[3].y),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.fill()}}]),e}(Jl);function II(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var jI=function(t){io()(e,t);var n=II(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.shapeControlPoints;this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.lineTo(t[1].x,t[1].y),this.ctx.lineTo(t[2].x,t[2].y),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.fill()}}]),e}(Jl);function yI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var hI=function(t){io()(e,t);var n=yI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.shapeControlPoints;this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.lineTo(t[0].x+1,t[0].y),this.ctx.lineTo(0,-1),this.ctx.lineTo(t[1].x-1,t[1].y),this.ctx.lineTo(t[1].x,t[1].y),this.ctx.lineTo(1,0),this.ctx.lineTo(t[2].x,t[2].y),this.ctx.lineTo(t[2].x-1,t[2].y),this.ctx.lineTo(0,1),this.ctx.lineTo(t[3].x+1,t[2].y),this.ctx.lineTo(t[3].x,t[3].y),this.ctx.lineTo(-1,0),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.fill()}}]),e}(Jl);function zI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var OI=function(t){io()(e,t);var n=zI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.ctx.save(),this.playData.shapes.forEach((function(n){var e=n.type.match("LINE.")?"".concat(yt.a.capitalize(n.type.replace("LINE.","")),"Line"):yt.a.capitalize(n.type),r="".concat(e,"ShapeLayer");ut[r]&&new ut[r](t,n).apply()})),this.ctx.restore()}}]),e}(Tl),AI=function(){function t(n){st()(this,t),It()(this,"originalData",void 0),It()(this,"adjustedData",void 0),this.originalData=JSON.parse(JSON.stringify(n)),this.adjustedData=JSON.parse(JSON.stringify(n))}return gt()(t,[{key:"_getAttrOriginal",value:function(t){return this.originalData[t]}},{key:"_getAttr",value:function(t){return this.adjustedData[t]}},{key:"_setAttr",value:function(t,n){this.adjustedData[t]=n}}]),t}();function xI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var EI={red:.502,green:.502,blue:.502,alpha:.35},fI=function(t){io()(e,t);var n=xI(e);function e(t){var r;return st()(this,e),r=n.call(this,t),It()(yl()(r),"internalCanvas",void 0),r.internalCanvas=document.createElement("canvas"),r}return gt()(e,[{key:"preProcessedTextForContext",value:function(){var t=this._getLines(),n=t.reduce((function(t,n){return t.width>n.width?t:n})).width;return{lines:t,box:{width:n+2*e.NOTE_WRAP_PADDING,height:t.length*this.lineHeight+2*e.NOTE_WRAP_PADDING-e.NOTE_LINE_HEIGHT_OFFSET}}}},{key:"_getLines",value:function(){this.internalCtx.font=this.fontComputed,this.internalCtx.textBaseline=this.textBaseline;for(var t=e.NOTE_WRAP_MAX_WIDTH-2*e.NOTE_WRAP_PADDING,n=[],r=this.text.split(" ").reduce((function(t,n){if(!n.match(/\n/))return t.push(n),t;for(var e=[],r="",i=0;i<n.length;i++){var u=n[i];"\n"!==u?r+=u:(r.length&&e.push(r),e.push(""),r="")}return r.length&&e.push(r),e.forEach((function(n,r){if(!n)return t.push("\n");t.push(n),e[r+1]&&t.push("\n")})),t}),[]),i=1;r.length>0;){var u=r.slice(0,i),M=this._getLineInfo(u);if(M.width<t&&i<=r.length&&!M.hasLineBreak)i++;else{1!==i&&i--;var N=r.splice(0,i),o=this._getLineInfo(N);n.push(o),i=1;var c=!r.some((function(t){return"\n"!==t}));o.width&&M.hasLineBreak&&!c&&r.splice(0,1)}}return n}},{key:"_getLineInfo",value:function(t){var n=this,e=0,r=!1,i=[];return t.forEach((function(u,M){if("\n"!==u){var N=$n()(u.matchAll(/(<player=(\d*)>)/gi)),o={text:u,width:N.length?n.internalCtx.measureText(u.replace(/<player=(\d*)>/,"")).width+2*n.playerTokenRadius:n.internalCtx.measureText(u).width};e+=o.width,M!==t.length-1&&(e+=n.internalCtx.measureText(" ").width),i.push(o)}else r=!0})),{words:i,width:e,hasLineBreak:r}}},{key:"noteWrapperContains",value:function(t){var n=t.x,e=t.y,r=this.preProcessedTextForContext().box,i=this.location,u={x:i.x+r.width,y:i.y},M=u.y+r.height;return i.x<=n&&n<=u.x&&i.y<=e&&e<=M}},{key:"id",get:function(){return this._getAttr("id")}},{key:"text",get:function(){return this._getAttr("text")}},{key:"location",get:function(){return this._getAttr("location")}},{key:"color",get:function(){return this._getAttr("color")||EI}},{key:"showBorder",get:function(){return this._getAttr("showBorder")}},{key:"animations",get:function(){return this._getAttr("animations")||[]}},{key:"hideForStatic",get:function(){return this._getAttr("hideForStatic")}},{key:"font",get:function(){return this._getAttr("font")||{bold:!1,italic:!1,underline:!1,strikethrough:!1,fontSize:12}}},{key:"fontSize",get:function(){return this.font.fontSize/10}},{key:"lineHeight",get:function(){return this.fontSize+e.NOTE_LINE_HEIGHT_OFFSET}},{key:"playerTokenRadius",get:function(){return this.fontSize/2}},{key:"fontComputed",get:function(){var t=[];return this.font.bold&&t.push("bold"),this.font.italic&&t.push("italic"),t.push("".concat(this.fontSize,"px")),t.push("Arial"),t.join(" ")}},{key:"textBaseline",get:function(){return"top"}},{key:"internalCtx",get:function(){return this.internalCanvas.getContext("2d")}}],[{key:"NOTE_WRAP_MAX_WIDTH",get:function(){return 40}},{key:"NOTE_WRAP_PADDING",get:function(){return.43}},{key:"NOTE_LINE_HEIGHT_OFFSET",get:function(){return.3}}]),e}(AI);function pI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var UI=function(t){io()(e,t);var n=pI(e);function e(){var t;st()(this,e);for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];return t=n.call.apply(n,[this].concat(i)),It()(yl()(t),"animationAlpha",void 0),t}return gt()(e,[{key:"apply",value:function(){var t=this;this.ctx.save(),this.playData.notes.forEach((function(n){t.ctx.save(),t.animationAlpha=Gl(n,t.options),t.setColor(n);var e=n.location;t.ctx.translate(e.x,e.y);var r=n.preProcessedTextForContext(),i=r.lines,u=r.box;t.setFont(n),t.drawBubble(n,u),t.drawText(n,i),t.ctx.restore()})),this.ctx.restore()}},{key:"setColor",value:function(t){if(void 0===this.animationAlpha)throw new Error("animationAlpha is not set");var n=t.color,e=n.alpha,r=n.blue,i=n.green,u=n.red,M=Math.ceil(255*u),N=Math.ceil(255*i),o=Math.ceil(255*r);this.ctx.fillStyle="rgba(".concat(M,", ").concat(N,", ").concat(o,", ").concat(e*this.animationAlpha,")"),this.ctx.strokeStyle="rgba(".concat(M,", ").concat(N,", ").concat(o,", ").concat(this.animationAlpha,")"),this.options.noteSelectedId===t.id&&(this.ctx.setLineDash([.5,.5]),this.ctx.strokeStyle="rgba(28, 127, 181, ".concat(this.animationAlpha,")"))}},{key:"setFont",value:function(t){this.ctx.font=t.fontComputed,this.ctx.textBaseline=t.textBaseline}},{key:"drawBubble",value:function(t,n){var e=n.width,r=n.height;this.ctx.lineWidth=this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.rect(0,0,e,r),this.ctx.fill(),(t.showBorder||this.options.noteSelectedId===t.id)&&this.ctx.stroke()}},{key:"drawText",value:function(t,n){var e=this;n.forEach((function(n,r){var i=n.words;e.ctx.save(),e.ctx.translate(fI.NOTE_WRAP_PADDING,fI.NOTE_WRAP_PADDING+t.lineHeight*r);var u=0;i.forEach((function(n,r){var M=$n()(n.text.matchAll(/(<player=(\d*)>)/gi));M.length&&0===M[0].index&&(e.drawPlayerToken(t,u,M[0][2]),u+=2*t.playerTokenRadius),e.ctx.fillStyle="rgba(0, 0, 0, ".concat(e.animationAlpha,")");var N=M.length?n.text.replace(/(<player=(\d*)>)/gi,""):n.text;e.ctx.fillText(N,u,0),u+=n.width,M.length&&(u-=2*t.playerTokenRadius),M.length&&M[0].index>0&&(e.drawPlayerToken(t,u,M[0][2]),u+=2*t.playerTokenRadius),r!==i.length-1&&(e.ctx.fillText(" ",u,0),u+=e.ctx.measureText(" ").width)})),(t.font.underline||t.font.strikethrough)&&(e.ctx.lineWidth=.07*t.fontSize,e.ctx.strokeStyle="rgba(0, 0, 0, ".concat(e.animationAlpha,")"),e.ctx.beginPath(),t.font.underline&&(e.ctx.moveTo(0,t.fontSize-fI.NOTE_LINE_HEIGHT_OFFSET/2),e.ctx.lineTo(u,t.fontSize-fI.NOTE_LINE_HEIGHT_OFFSET/2)),t.font.strikethrough&&(e.ctx.moveTo(0,t.lineHeight/2-fI.NOTE_LINE_HEIGHT_OFFSET/3),e.ctx.lineTo(u,t.lineHeight/2-fI.NOTE_LINE_HEIGHT_OFFSET/3)),e.ctx.stroke()),e.ctx.restore()}))}},{key:"drawPlayerToken",value:function(t,n,e){this.ctx.save(),this.ctx.translate(n+t.playerTokenRadius,0),this.ctx.beginPath(),this.ctx.strokeStyle="rgba(255, 255, 255, ".concat(this.animationAlpha,")"),this.ctx.fillStyle="rgba(243, 111, 33, ".concat(this.animationAlpha,")"),this.ctx.arc(0,t.playerTokenRadius,t.playerTokenRadius,0,2*Math.PI),this.ctx.fill(),this.ctx.stroke();var r=.8*t.fontSize;this.ctx.font="".concat(r,"px Arial");var i=-this.ctx.measureText(e).width/2,u=(2*t.playerTokenRadius-r)/2*(1+fI.NOTE_LINE_HEIGHT_OFFSET);this.ctx.fillStyle="rgba(255, 255, 255, ".concat(this.animationAlpha,")"),this.ctx.fillText(e,i,u),this.ctx.restore()}},{key:"scale",value:function(t){return t/this.options.scale}}]),e}(Tl);function dI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var CI=function(t){io()(e,t);var n=dI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.options.linesDisplay&&(this.ctx.save(),this.playData.lines.forEach((function(n){t.options.linesSelectedIds.includes(n.id)&&n.baseLineParts().forEach((function(n){t.ctx.save(),t.ctx.fillStyle="blue",n.controlPoints.forEach((function(n){t.ctx.beginPath(),t.ctx.arc(n.x,n.y,.4,0,2*Math.PI,!0),t.ctx.fill()})),t.ctx.restore()}))})),this.ctx.restore())}}]),e}(Tl);function QI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var wI=function(t){io()(e,t);var n=QI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.ctx.save(),this.ctx.fillStyle="blue",this.playData.shapes.forEach((function(n){var e=n.id,r=n.color,i=n.controlPointsTranslated;t.options.shapeSelectedId===e&&0!==r.alpha&&i.forEach((function(n){t.ctx.beginPath(),t.ctx.arc(n.x,n.y,.4,0,2*Math.PI,!0),t.ctx.fill()}))})),this.ctx.restore()}}]),e}(Tl);function SI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var LI=function(t){io()(e,t);var n=SI(e);function e(t){var r;return st()(this,e),r=n.call(this,t),It()(yl()(r),"lineParts",void 0),It()(yl()(r),"linePartsAdjusted",void 0),r.lineParts=t.lineParts,r.linePartsAdjusted=$n()(t.lineParts),r}return gt()(e,[{key:"baseLineParts",value:function(){return this.lineParts}},{key:"setLinePartsAdjusted",value:function(t){this.linePartsAdjusted=t}},{key:"setLinePartsAdjustedAtIndex",value:function(t,n){switch(t){case"fist":this.linePartsAdjusted[0]=n;break;case"last":this.linePartsAdjusted[this.linePartsAdjusted.length-1]=n;break;default:this.linePartsAdjusted[t]=n}}},{key:"setAnimationKeyTimesChunked",value:function(t){var n=this,e=[];if(this.animations[0].keyTimes.forEach((function(t,r){r&&e.push([n.animations[0].keyTimes[r-1],t])})),e.length!==this.getLineParts().length){var r=e,i=Xn()(r,1),u=Xn()(i[0],2),M=u[0],N=u[1],o=Xn()(t.animations,1)[0],c=o.keyTimes.indexOf(M),a=o.keyTimes.indexOf(N);if(c>=0&&a>=0){var D=o.keyTimes.slice(c,a+1);e=[],D.forEach((function(t,n){n&&e.push([D[n-1],t])}))}}this.animationKeyTimeChunks=e}},{key:"addLinePartAdjusted",value:function(t){this.linePartsAdjusted.push(t)}},{key:"getLineParts",value:function(){return this.linePartsAdjusted.length?this.linePartsAdjusted:this.lineParts}},{key:"id",get:function(){return this._getAttr("id")}},{key:"color",get:function(){return this._getAttr("color")},set:function(t){this._setAttr("color",t)}},{key:"type",get:function(){return this._getAttr("type")}},{key:"phase",get:function(){return this._getAttr("phase")}},{key:"playerPositionOrigin",get:function(){return this._getAttr("playerPositionOrigin")}},{key:"playerPositionTerminus",get:function(){return this._getAttr("playerPositionTerminus")}},{key:"playerLineSequence",get:function(){return this._getAttr("playerLineSequence")}},{key:"hideLineTip",get:function(){return this._getAttr("hideLineTip")}},{key:"animations",get:function(){return this._getAttr("animations")}},{key:"animationsByEndTime",get:function(){return this._getAttr("animations").map((function(t){return yt.a.last(t.keyTimes)}))}},{key:"animationKeyTimeChunks",get:function(){return this._getAttr("animationKeyTimeChunks")||[]},set:function(t){this._setAttr("animationKeyTimeChunks",t)}},{key:"lastAnimEndTime",get:function(){return yt.a.max(this.animationsByEndTime)}},{key:"firstLinePartControlPoint",get:function(){return this.lineParts[0].controlPoints[0]}},{key:"lastLinePartControlPoint",get:function(){return $n()($n()(this.lineParts).pop().controlPoints).pop()}}]),e}(AI);function kI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var vI=function(t){io()(e,t);var n=kI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"setPossession",value:function(t){var n=this;if(t.length){var e=this.possession?1:0;e+=t.filter((function(t){return t.playerPositionTerminus===n.position})).length,e-=t.filter((function(t){return t.playerPositionOrigin===n.position})).length,this.possession=e>0}}},{key:"id",get:function(){return this._getAttr("id")}},{key:"textOverride",get:function(){return this._getAttr("textOverride")},set:function(t){this._setAttr("textOverride",t)}},{key:"textLabel",get:function(){return this._getAttr("textOverride")||this.position}},{key:"isDefender",get:function(){return this.position.indexOf("x")>=0}},{key:"possession",get:function(){return this._getAttr("possession")},set:function(t){this._setAttr("possession",t)}},{key:"position",get:function(){return this._getAttr("position")}},{key:"location",get:function(){return this._getAttr("location")},set:function(t){this._setAttr("location",t)}},{key:"color",get:function(){return this._getAttr("color")}},{key:"animations",get:function(){return this._getAttr("animations")}},{key:"animationsByEndTime",get:function(){return this._getAttr("animations").map((function(t){return yt.a.last(t.keyTimes)}))}},{key:"lastAnimEndTime",get:function(){return yt.a.max(this.animationsByEndTime)}},{key:"lastAnimation",get:function(){return $n()(this.animations).pop()}},{key:"lastAnimationLastLinePartControlPoint",get:function(){return $n()($n()(this.lastAnimation.lineParts).pop().controlPoints).pop()}}]),e}(AI);function YI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var mI=function(t){io()(e,t);var n=YI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"rectWrapperContains",value:function(t){var n=Xn()(this.rectWrapPointsTranslated,4),e=n[0],r=n[1],i=n[2],u=n[3];return+[[e,t,r],[r,t,i],[i,t,u],[u,t,e]].reduce((function(t,n){var e=Xn()(n,3),r=e[0],i=e[1],u=e[2];return t+Math.abs(i.x*r.y-r.x*i.y+(u.x*i.y-i.x*u.y)+(r.x*u.y-u.x*r.y))/2}),0).toFixed(2)<=this.rectWrapAreaTranslated}},{key:"computeCenterForRect",value:function(t){var n=Xn()(t,4),e=n[0],r=n[1],i=n[2],u=n[3];return{x:(e.x+i.x)/2,y:(r.y+u.y)/2}}},{key:"computeShapeAreaForPointAtIndex",value:function(t,n){var e=Xn()(this.rectWrapPointsTranslated,3),r=e[0],i=e[1],u=e[2],M=this.computeRectWrapPointsTranslatedForPointAtIndex(t,n),N=Xn()(M,4),o=N[0],c=N[1],a=N[2],D=N[3];return{scale:{x:PN(o,c)*this.scale.x/PN(r,i),y:PN(c,a)*this.scale.y/PN(i,u)},location:this.computeCenterForRect([o,c,a,D])}}},{key:"computeRectWrapPointsTranslatedForPointAtIndex",value:function(t,n){var e=this,r=zt(t.x,t.y,this.location.x,this.location.y,-this.angle),i=this.rectWrapPointsTranslated.map((function(t){return zt(t.x,t.y,e.location.x,e.location.y,-e.angle)})).map((function(t,e){return n===e?r:t}));return 0===n&&(i[1].y=r.y,i[3].x=r.x),1===n&&(i[0].y=r.y,i[2].x=r.x),2===n&&(i[1].x=r.x,i[3].y=r.y),3===n&&(i[0].x=r.x,i[2].y=r.y),i.map((function(t){return zt(t.x,t.y,e.location.x,e.location.y,e.angle)}))}},{key:"revertPointTranslation",value:function(t){var n={x:t.x-this.location.x,y:t.y-this.location.y};return zt(n.x,n.y,0,0,-this.angle)}},{key:"id",get:function(){return this._getAttr("id")}},{key:"location",get:function(){return this._getAttr("location")}},{key:"scale",get:function(){return this._getAttr("scale")}},{key:"angle",get:function(){return this._getAttr("angle")||0}},{key:"angleRad",get:function(){return this.angle*Math.PI/180}},{key:"color",get:function(){return this._getAttr("color")}},{key:"type",get:function(){return this._getAttr("type")}},{key:"showBorder",get:function(){return this._getAttr("showBorder")}},{key:"outerCircleRadius",get:function(){return 10}},{key:"linePart",get:function(){return this._getAttr("linePart")}},{key:"animations",get:function(){return this._getAttr("animations")||[]}},{key:"hideForStatic",get:function(){return this._getAttr("hideForStatic")}},{key:"rectWrapPointsPure",get:function(){return[{x:-this.outerCircleRadius/2,y:-this.outerCircleRadius/2},{x:this.outerCircleRadius/2,y:-this.outerCircleRadius/2},{x:this.outerCircleRadius/2,y:this.outerCircleRadius/2},{x:-this.outerCircleRadius/2,y:this.outerCircleRadius/2}]}},{key:"rectWrapPointsTranslated",get:function(){var t=this;return this.rectWrapPointsPure.map((function(n){var e={x:n.x*t.scale.x,y:n.y*t.scale.y},r=zt(e.x,e.y,0,0,t.angle);return{x:r.x+t.location.x,y:r.y+t.location.y}}))}},{key:"controlPointsTranslated",get:function(){return this.rectWrapPointsTranslated}},{key:"rectWrapAreaTranslated",get:function(){var t=Xn()(this.rectWrapPointsTranslated,3),n=t[0],e=t[1],r=t[2];return+(PN(n,e)*PN(e,r)).toFixed(2)}}]),e}(AI);function FI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var RI=function(t){io()(e,t);var n=FI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"rectWrapPointsPure",get:function(){return _N(this.linePart.controlPoints)}},{key:"controlPointsTranslated",get:function(){var t=this;return this.linePart.controlPoints.map((function(n){var e={x:n.x*t.scale.x,y:n.y*t.scale.y},r=zt(e.x,e.y,0,0,t.angle);return{x:r.x+t.location.x,y:r.y+t.location.y}}))}},{key:"shapeControlPoints",get:function(){return[]}}]),e}(mI);function bI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var BI=function(t){io()(e,t);var n=bI(e);function e(){return st()(this,e),n.apply(this,arguments)}return e}(RI);function ZI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var VI=function(t){io()(e,t);var n=ZI(e);function e(){return st()(this,e),n.apply(this,arguments)}return e}(RI);function WI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var GI=function(t){io()(e,t);var n=WI(e);function e(){return st()(this,e),n.apply(this,arguments)}return e}(RI);function PI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var JI=function(t){io()(e,t);var n=PI(e);function e(){return st()(this,e),n.apply(this,arguments)}return e}(RI);function HI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var XI=function(t){io()(e,t);var n=HI(e);function e(){return st()(this,e),n.apply(this,arguments)}return e}(RI);function KI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var qI=function(t){io()(e,t);var n=KI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 5}},{key:"rectWrapPointsPure",get:function(){return[{x:-this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:this.outerCircleRadius},{x:-this.outerCircleRadius,y:this.outerCircleRadius}]}},{key:"shapeControlPoints",get:function(){return[]}}]),e}(mI);function _I(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var $I=function(t){io()(e,t);var n=_I(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 5}},{key:"shapeControlPoints",get:function(){return this.rectWrapPointsPure}}]),e}(mI);function tj(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var nj=function(t){io()(e,t);var n=tj(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 8}},{key:"shapeControlPoints",get:function(){return[{x:0,y:-this.outerCircleRadius},{x:-this.outerCircleRadius*Math.cos(220)/2,y:this.outerCircleRadius*Math.sin(240)},{x:this.outerCircleRadius*Math.cos(220)/2,y:this.outerCircleRadius*Math.sin(240)}]}},{key:"rectWrapPointsPure",get:function(){return[{x:-this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:this.outerCircleRadius},{x:-this.outerCircleRadius,y:this.outerCircleRadius}]}}]),e}(mI);function ej(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var rj=function(t){io()(e,t);var n=ej(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 10}},{key:"shapeControlPoints",get:function(){return this.rectWrapPointsPure}}]),e}(mI);function ij(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var uj=function(t){io()(e,t);var n=ij(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 10}},{key:"shapeControlPoints",get:function(){return this.rectWrapPointsPure}},{key:"rectWrapPointsPure",get:function(){return[{x:-this.outerCircleRadius,y:-.5},{x:this.outerCircleRadius,y:-.5},{x:this.outerCircleRadius,y:.5},{x:-this.outerCircleRadius,y:.5}]}}]),e}(mI);function Mj(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Nj=function(t){io()(e,t);var n=Mj(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 10}},{key:"shapeControlPoints",get:function(){return[{x:0,y:-this.outerCircleRadius},{x:this.outerCircleRadius*Math.cos(210),y:this.outerCircleRadius*Math.sin(210)},{x:-this.outerCircleRadius*Math.cos(210),y:this.outerCircleRadius*Math.sin(210)}]}},{key:"rectWrapPointsPure",get:function(){return[{x:-this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:this.outerCircleRadius},{x:-this.outerCircleRadius,y:this.outerCircleRadius}]}}]),e}(mI);function oj(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var cj=function(t){io()(e,t);var n=oj(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 10}},{key:"shapeControlPoints",get:function(){return this.rectWrapPointsPure}}]),e}(mI);function aj(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function Dj(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?aj(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):aj(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}var sj=function(){function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;st()(this,t),this.play=n,this.phase=e,this.animationGlobalProgress=r,It()(this,"ctx",void 0),It()(this,"animationGlobalProgressPrev",void 0),this.animationGlobalProgressPrev=r,this.ctx=null}return gt()(t,[{key:"draw",value:function(){if(!this.ctx)throw new Error("Canvas context is not provided. Please use setContext() method.");this.ctx.clearRect(0,0,this.frameWidth,this.frameHeight),this._init();var t=this.frameData,n=this.frameDataOptions;return new Il(this.ctx,t,n).apply(),new OI(this.ctx,t,n).apply(),new Zl(this.ctx,t,n).apply(),new Wl(this.ctx,t,n).apply(),new CI(this.ctx,t,n).apply(),new wI(this.ctx,t,n).apply(),new UI(this.ctx,t,n).apply(),this}},{key:"_init",value:function(){if(!this.ctx)throw new Error("Canvas context is not provided. Please use setContext() method.");this.ctx.canvas.width=this.frameWidth,this.ctx.canvas.height=this.frameHeight,this.ctx.scale(this.play.scale,this.play.scale),this.ctx.translate(-this.court.courtRect.origin.x,-this.court.courtRect.origin.y),this.play.options.mirror&&(this.ctx.scale(-1,1),this.ctx.translate(2*Math.abs(this.court.courtRect.origin.x)-this.court.courtRect.size.width,0))}},{key:"setContext",value:function(t){return this.ctx=t,this}},{key:"setPhase",value:function(t){return this.phase=t,this}},{key:"setAnimationGlobalProgress",value:function(t){return this.animationGlobalProgressPrev=this.animationGlobalProgress,this.animationGlobalProgress=t,this}},{key:"animationProgress",value:function(t,n){return ht(this.animationGlobalProgress,t,n)}},{key:"closestObjectToPoint",value:function(t,n){var e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3?arguments[3]:void 0,i=e?this.convertViewPointToCourtPoint(t):t;return"player"===n?this.closestPlayerToPoint(i,r):"shape"===n?this.closestShapeToPoint(i):"note"===n?this.closestNoteToPoint(i):"line"===n?this.closestLineToPoint(i,r):"lineVertex"===n?this.closestLineVertexToPoint(i,r):null}},{key:"closestLineToPoint",value:function(t,n){var e=this,r=this.lines.filter((function(t){return!n||n(t)})).reduce((function(n,r){return r.lineParts.forEach((function(i){for(var u=qn()(te,$n()(i.controlPoints)),M=1;M<=100;M++){var N=M/100,o=e.prepareCourtPoint({x:u.x(N),y:u.y(N)});n.push({object:r,objectPoint:o,distance:PN(o,t)})}})),n}),[]);return yt.a.minBy(r,"distance")}},{key:"closestLineVertexToPoint",value:function(t,n){var e=this,r=this.lines.filter((function(t){return!n||n(t)})).reduce((function(n,r){if(!r.id.length)return n;var i=e.prepareCourtPoint(r.firstLinePartControlPoint),u=e.prepareCourtPoint(r.lastLinePartControlPoint);return n.push({object:r,objectPoint:i,distance:PN(i,t)}),n.push({object:r,objectPoint:u,distance:PN(u,t)}),n}),[]);return yt.a.minBy(r,"distance")}},{key:"closestPlayerToPoint",value:function(t,n){var e=this,r=this.players.filter((function(t){return!n||n(t)})).reduce((function(n,r){var i=e.prepareCourtPoint(r.location);return n.push({object:r,objectPoint:i,distance:PN(i,t)}),n}),[]);return yt.a.minBy(r,"distance")}},{key:"closestShapeToPoint",value:function(t){var n=this,e=this.shapes.filter((function(n){return n.rectWrapperContains(t)})).reduce((function(e,r){var i=n.prepareCourtPoint(r.location);return e.push({object:r,objectPoint:i,distance:PN(i,t)}),e}),[]);return yt.a.minBy(e,"distance")}},{key:"closestNoteToPoint",value:function(t){var n=this,e=this.notes.filter((function(n){return n.noteWrapperContains(t)})).reduce((function(e,r){var i=n.prepareCourtPoint(r.location);return e.push({object:r,objectPoint:i,distance:PN(i,t)}),e}),[]);return e.length?yt.a.minBy(e,"distance"):null}},{key:"prepareCourtPoint",value:function(t){var n=this.play.options.mirror,e=this.play.playData.court.courtRect.size.width,r=this.play.playData.court.courtRect.origin;return{x:n?e+r.x-(t.x-r.x):t.x,y:t.y}}},{key:"convertViewPointToCourtPoint",value:function(t){var n=this.play.playData.court.courtRect.origin,e=n.x,r=n.y;return{x:t.x/this.play.scale+e,y:t.y/this.play.scale+r}}},{key:"sport",get:function(){var t=this.play.playData,n=t.court,e=t.sport;return e||([gn,Tn].includes(n.type)?$t:qt)}},{key:"court",get:function(){var t=this.play.playData.court;return Dj({},t,{type:t.type===gn?Tn:t.type})}},{key:"frameWidth",get:function(){return this.play.width}},{key:"frameHeight",get:function(){return this.play.height}},{key:"frameData",get:function(){return{sport:this.sport,court:this.court,lines:this.lines,players:this.players,shapes:this.shapes,notes:this.notes}}},{key:"frameDataOptions",get:function(){return Dj({},this.play.options,{staticData:this.play.staticData,scale:this.play.scale,animationGlobalProgress:this.animationGlobalProgress,playAnimationDuration:this.playAnimationDuration})}},{key:"playAnimationDuration",get:function(){return this.play.playData.lines.reduce((function(t,n){var e=new LI(n).lastAnimEndTime;return t>e?t:e}),0)}},{key:"lines",get:function(){return this.animationGlobalProgress?this.animationProgressLines:this.currentPhaseLines}},{key:"players",get:function(){return this.animationGlobalProgress?this.animationProgressPlayers:this.currentPhasePlayers}},{key:"shapes",get:function(){return this.play.playData.shapes?this.play.playData.shapes.filter((function(t){return void 0!==Mt[Ot(t.type)]})).map((function(t){return new(Mt[Ot(t.type)])(t)})):[]}},{key:"notes",get:function(){return this.play.playData.notes?this.play.playData.notes.filter((function(t){return!t.displayModes||t.displayModes.includes("onCourt")})).map((function(t){return new fI(t)})):[]}},{key:"currentPhasePlayers",get:function(){var t=this,n=this.currentPhaseLines,e=this.play.options,r=e.huddleMode,i=e.magnetMode,u=r||i?this.playDataLines:this.prevPhaseLines,M=u.filter((function(t){return["PASS","HANDOFF"].includes(t.type)}));return this.play.playData.players.map((function(e){var N=new vI(e);N.setPossession(M);var o=u.filter((function(e){return!r||!(t.phase<e.phase)&&!n.find((function(t){return t.id===e.id}))})).filter((function(t){return t.playerPositionOrigin===N.position&&t.playerPositionTerminus===N.position})),c=n.filter((function(t){return i&&t.playerPositionOrigin===N.position&&t.playerPositionTerminus===N.position})),a=c.length?c:o;if(a.length){var D=yt.a.maxBy(a,(function(t){return t.lastAnimEndTime}));if(D){var s=D.lastLinePartControlPoint;s&&(N.location=s)}}return N}))}},{key:"currentPhaseLines",get:function(){var t=this,n=this.play.playData.lines.filter((function(n){return n.phase===t.phase}));return this.play.options.huddleMode&&(n=yt.a.takeRight(n,2)),n.map((function(t){return new LI(t)}))}},{key:"animationProgressPlayers",get:function(){var t=this,n=this.prevAnimationLines.filter((function(t){return["PASS","HANDOFF","SHOT"].includes(t.type)}));return this.play.playData.players.map((function(e){var r=new vI(e);return r.setPossession(n),r.animations.length?(r.animations.forEach((function(n){var e=[];n.keyTimes.forEach((function(t,r){r&&e.push([n.keyTimes[r-1],t])})),e.forEach((function(e,i){var u=Xn()(e,2),M=u[0],N=u[1];if(yt.a.inRange(t.animationGlobalProgress,M,N)){var o=t.animationProgress(M,N),c=qn()(te,$n()(n.lineParts[i].controlPoints));r.location={x:c.x(o),y:c.y(o)}}}))})),t.animationGlobalProgress>=r.lastAnimEndTime&&(r.location=r.lastAnimationLastLinePartControlPoint),r):r}))}},{key:"animationProgressLines",get:function(){var t=this,n=this.play.options.linesDisplayOnMoveOnly;return this.play.playData.lines.map((function(n){var e=new LI(n);e.setAnimationKeyTimesChunked(t.play.playData.players.find((function(t){return t.position===e.playerPositionOrigin})));var r=[];return e.animationKeyTimeChunks.forEach((function(n,i){var u=Xn()(n,2),M=u[0],N=u[1];if(t.animationGlobalProgressPrev<N&&t.animationGlobalProgress>=N&&window.dispatchEvent(new CustomEvent("@luceosports/play-rendering:lineAnimationFinished",{detail:{id:e.id}})),yt.a.inRange(t.animationGlobalProgress,M,N)){if("DRIBBLE"===e.type)return r.push(Dj({},e.getLineParts()[i]));var o=JN(e.getLineParts()[i].controlPoints,t.animationProgress(M,N));r.push({controlPoints:o[0],alpha:.1}),r.push({controlPoints:o[1],alpha:e.color.alpha})}else t.animationGlobalProgress>N?r.push(Dj({},e.getLineParts()[i],{alpha:.1})):r.push(Dj({},e.getLineParts()[i]))})),e.setLinePartsAdjusted(r),t.animationGlobalProgress>e.lastAnimEndTime&&(e.color=Dj({},e.color,{alpha:.1})),e})).filter((function(e){var r=Xn()(e.animations,1)[0].keyTimes,i=Xn()(r,1)[0],u=r.reverse(),M=Xn()(u,1)[0],N=yt.a.inRange(t.animationGlobalProgress,i,M);return n?N:N||t.animationGlobalProgress>M||e.phase===t.phase}))}},{key:"playDataLines",get:function(){return this.play.playData.lines.map((function(t){return new LI(t)}))}},{key:"prevPhaseLines",get:function(){var t=this;return this.playDataLines.filter((function(n){return n.phase<t.phase}))}},{key:"prevAnimationLines",get:function(){var t=this;return this.playDataLines.filter((function(n){return t.animationGlobalProgress>=n.lastAnimEndTime}))}}]),t}(),Tj=function(){function t(n,e){st()(this,t),this.ctx=n,It()(this,"play",void 0),It()(this,"playBase",void 0),It()(this,"animationFrame",void 0),It()(this,"loopId",void 0),It()(this,"running",void 0),It()(this,"framesLoadTime",void 0),It()(this,"timeStart",void 0),It()(this,"timeElapsed",void 0),It()(this,"timeElapsedSaved",void 0),this.play=yt.a.cloneDeep(e),this.playBase=yt.a.cloneDeep(e),this.animationFrame=new sj(this.play,this.currentPlayPhase,this.globalProgress).setContext(this.ctx),this.loopId=null,this.running=!1,this.framesLoadTime=[],this.timeStart=null,this.timeElapsed=0,this.timeElapsedSaved=0}return gt()(t,[{key:"start",value:function(t,n){this.running=!0,this.loopId=requestAnimationFrame(this.drawFrame.bind(this,t,n))}},{key:"pause",value:function(){cancelAnimationFrame(this.loopId),this.running=!1,this.timeStart=null,this.timeElapsedSaved=this.timeElapsed}},{key:"setProgress",value:function(t){var n=this.countTimeElapsedFromProgress(t);return this.timeElapsed=n,this.timeElapsedSaved=n,this.refreshAnimationFrameProgress(),this}},{key:"refreshAnimationFrameProgress",value:function(){this.animationFrame.setPhase(this.currentPlayPhase).setAnimationGlobalProgress(this.globalProgress)}},{key:"drawPreviewFrame",value:function(){new sj(this.play,this.currentPlayPhase,this.globalProgress).setContext(this.ctx).draw()}},{key:"reset",value:function(){this.timeStart=null,this.timeElapsed=null,this.timeElapsedSaved=null,this.play=yt.a.cloneDeep(this.playBase)}},{key:"countTimeElapsedFromProgress",value:function(t){return 1e3*this.animationDuration*t}},{key:"drawFrame",value:function(t,n,e){if(this.running){if(this.globalProgress>=this.lastLineAnimationMax)return n(this.lastLineAnimationMax),this.reset(),cancelAnimationFrame(this.loopId),void setTimeout((function(){t()}),1e3);n(this.globalProgress),this.timeStart||(this.timeStart=e);var r=e-this.timeStart+(this.timeElapsedSaved||0)-(this.timeElapsed||0);this.framesLoadTime.push(r),this.timeElapsed=e-this.timeStart+(this.timeElapsedSaved||0),this.animationFrame.setPhase(this.currentPlayPhase).setAnimationGlobalProgress(this.globalProgress).draw(),requestAnimationFrame(this.drawFrame.bind(this,t,n))}}},{key:"animationDuration",get:function(){return this.play.playData.animationDuration/this.play.options.speed}},{key:"globalProgress",get:function(){return 100*(this.timeElapsed||0)/(1e3*this.animationDuration)/100}},{key:"currentPlayPhase",get:function(){var t=this,n=Object.entries(this.linesPhaseIntervals).find((function(n){var e=Xn()(n,2)[1];return yt.a.inRange(t.globalProgress,e.min,e.max)}));return parseInt(n?n[0]:Object.keys(this.linesPhaseIntervals).pop())}},{key:"linesPhaseIntervals",get:function(){var t={};return this.play.playData.lines.forEach((function(n){t[n.phase]||(t[n.phase]={min:0,max:0}),n.animations.forEach((function(e){var r=e.keyTimes,i=Xn()(r,1)[0],u=$n()(r).pop();(i<t[n.phase].min||!t[n.phase].min&&n.phase>1)&&(t[n.phase].min=i),u>t[n.phase].max&&(t[n.phase].max=u)}))})),t}},{key:"lastLineAnimationMax",get:function(){return this.play.playData.lines.reduce((function(t,n){var e=new LI(n);return t>e.lastAnimEndTime?t:e.lastAnimEndTime}),0)}}]),t}()}])}));
23
+ var qe,_e,$e=9e15,tr="0123456789abcdef",nr="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",er="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",rr={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-$e,maxE:$e,crypto:!1},ir=!0,ur="[DecimalError] Invalid argument: ",Mr="[object Decimal]",Nr=Math.floor,or=Math.pow,cr=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ar=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Dr=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,sr=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Tr=1e7,gr=nr.length-1,lr=er.length-1,Ir={toStringTag:Mr};function jr(t){var n,e,r,i=t.length-1,u="",M=t[0];if(i>0){for(u+=M,n=1;n<i;n++)(e=7-(r=t[n]+"").length)&&(u+=dr(e)),u+=r;(e=7-(r=(M=t[n])+"").length)&&(u+=dr(e))}else if(0===M)return"0";for(;M%10==0;)M/=10;return u+M}function yr(t,n,e){if(t!==~~t||t<n||t>e)throw Error(ur+t)}function hr(t,n,e,r){var i,u,M,N;for(u=t[0];u>=10;u/=10)--n;return--n<0?(n+=7,i=0):(i=Math.ceil((n+1)/7),n%=7),u=or(10,7-n),N=t[i]%u|0,null==r?n<3?(0==n?N=N/100|0:1==n&&(N=N/10|0),M=e<4&&99999==N||e>3&&49999==N||5e4==N||0==N):M=(e<4&&N+1==u||e>3&&N+1==u/2)&&(t[i+1]/u/100|0)==or(10,n-2)-1||(N==u/2||0==N)&&0==(t[i+1]/u/100|0):n<4?(0==n?N=N/1e3|0:1==n?N=N/100|0:2==n&&(N=N/10|0),M=(r||e<4)&&9999==N||!r&&e>3&&4999==N):M=((r||e<4)&&N+1==u||!r&&e>3&&N+1==u/2)&&(t[i+1]/u/1e3|0)==or(10,n-3)-1,M}function zr(t,n,e){for(var r,i,u=[0],M=0,N=t.length;M<N;){for(i=u.length;i--;)u[i]*=n;for(u[0]+=tr.indexOf(t.charAt(M++)),r=0;r<u.length;r++)u[r]>e-1&&(void 0===u[r+1]&&(u[r+1]=0),u[r+1]+=u[r]/e|0,u[r]%=e)}return u.reverse()}Ir.absoluteValue=Ir.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),Ar(t)},Ir.ceil=function(){return Ar(new this.constructor(this),this.e+1,2)},Ir.clampedTo=Ir.clamp=function(t,n){var e=this,r=e.constructor;if(t=new r(t),n=new r(n),!t.s||!n.s)return new r(NaN);if(t.gt(n))throw Error(ur+n);return e.cmp(t)<0?t:e.cmp(n)>0?n:new r(e)},Ir.comparedTo=Ir.cmp=function(t){var n,e,r,i,u=this,M=u.d,N=(t=new u.constructor(t)).d,o=u.s,c=t.s;if(!M||!N)return o&&c?o!==c?o:M===N?0:!M^o<0?1:-1:NaN;if(!M[0]||!N[0])return M[0]?o:N[0]?-c:0;if(o!==c)return o;if(u.e!==t.e)return u.e>t.e^o<0?1:-1;for(n=0,e=(r=M.length)<(i=N.length)?r:i;n<e;++n)if(M[n]!==N[n])return M[n]>N[n]^o<0?1:-1;return r===i?0:r>i^o<0?1:-1},Ir.cosine=Ir.cos=function(){var t,n,e=this,r=e.constructor;return e.d?e.d[0]?(t=r.precision,n=r.rounding,r.precision=t+Math.max(e.e,e.sd())+7,r.rounding=1,e=function(t,n){var e,r,i;if(n.isZero())return n;(r=n.d.length)<32?(e=Math.ceil(r/3),i=(1/Fr(4,e)).toString()):(e=16,i="2.3283064365386962890625e-10");t.precision+=e,n=mr(t,1,n.times(i),new t(1));for(var u=e;u--;){var M=n.times(n);n=M.times(M).minus(M).times(8).plus(1)}return t.precision-=e,n}(r,Rr(r,e)),r.precision=t,r.rounding=n,Ar(2==_e||3==_e?e.neg():e,t,n,!0)):new r(1):new r(NaN)},Ir.cubeRoot=Ir.cbrt=function(){var t,n,e,r,i,u,M,N,o,c,a=this,D=a.constructor;if(!a.isFinite()||a.isZero())return new D(a);for(ir=!1,(u=a.s*or(a.s*a,1/3))&&Math.abs(u)!=1/0?r=new D(u.toString()):(e=jr(a.d),(u=((t=a.e)-e.length+1)%3)&&(e+=1==u||-2==u?"0":"00"),u=or(e,1/3),t=Nr((t+1)/3)-(t%3==(t<0?-1:2)),(r=new D(e=u==1/0?"5e"+t:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+t)).s=a.s),M=(t=D.precision)+3;;)if(c=(o=(N=r).times(N).times(N)).plus(a),r=Or(c.plus(a).times(N),c.plus(o),M+2,1),jr(N.d).slice(0,M)===(e=jr(r.d)).slice(0,M)){if("9999"!=(e=e.slice(M-3,M+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(Ar(r,t+1,1),n=!r.times(r).times(r).eq(a));break}if(!i&&(Ar(N,t+1,0),N.times(N).times(N).eq(a))){r=N;break}M+=4,i=1}return ir=!0,Ar(r,t,D.rounding,n)},Ir.decimalPlaces=Ir.dp=function(){var t,n=this.d,e=NaN;if(n){if(e=7*((t=n.length-1)-Nr(this.e/7)),t=n[t])for(;t%10==0;t/=10)e--;e<0&&(e=0)}return e},Ir.dividedBy=Ir.div=function(t){return Or(this,new this.constructor(t))},Ir.dividedToIntegerBy=Ir.divToInt=function(t){var n=this.constructor;return Ar(Or(this,new n(t),0,1,1),n.precision,n.rounding)},Ir.equals=Ir.eq=function(t){return 0===this.cmp(t)},Ir.floor=function(){return Ar(new this.constructor(this),this.e+1,3)},Ir.greaterThan=Ir.gt=function(t){return this.cmp(t)>0},Ir.greaterThanOrEqualTo=Ir.gte=function(t){var n=this.cmp(t);return 1==n||0===n},Ir.hyperbolicCosine=Ir.cosh=function(){var t,n,e,r,i,u=this,M=u.constructor,N=new M(1);if(!u.isFinite())return new M(u.s?1/0:NaN);if(u.isZero())return N;e=M.precision,r=M.rounding,M.precision=e+Math.max(u.e,u.sd())+4,M.rounding=1,(i=u.d.length)<32?n=(1/Fr(4,t=Math.ceil(i/3))).toString():(t=16,n="2.3283064365386962890625e-10"),u=mr(M,1,u.times(n),new M(1),!0);for(var o,c=t,a=new M(8);c--;)o=u.times(u),u=N.minus(o.times(a.minus(o.times(a))));return Ar(u,M.precision=e,M.rounding=r,!0)},Ir.hyperbolicSine=Ir.sinh=function(){var t,n,e,r,i=this,u=i.constructor;if(!i.isFinite()||i.isZero())return new u(i);if(n=u.precision,e=u.rounding,u.precision=n+Math.max(i.e,i.sd())+4,u.rounding=1,(r=i.d.length)<3)i=mr(u,2,i,i,!0);else{t=(t=1.4*Math.sqrt(r))>16?16:0|t,i=mr(u,2,i=i.times(1/Fr(5,t)),i,!0);for(var M,N=new u(5),o=new u(16),c=new u(20);t--;)M=i.times(i),i=i.times(N.plus(M.times(o.times(M).plus(c))))}return u.precision=n,u.rounding=e,Ar(i,n,e,!0)},Ir.hyperbolicTangent=Ir.tanh=function(){var t,n,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(t=r.precision,n=r.rounding,r.precision=t+7,r.rounding=1,Or(e.sinh(),e.cosh(),r.precision=t,r.rounding=n)):new r(e.s)},Ir.inverseCosine=Ir.acos=function(){var t,n=this,e=n.constructor,r=n.abs().cmp(1),i=e.precision,u=e.rounding;return-1!==r?0===r?n.isNeg()?pr(e,i,u):new e(0):new e(NaN):n.isZero()?pr(e,i+4,u).times(.5):(e.precision=i+6,e.rounding=1,n=n.asin(),t=pr(e,i+4,u).times(.5),e.precision=i,e.rounding=u,t.minus(n))},Ir.inverseHyperbolicCosine=Ir.acosh=function(){var t,n,e=this,r=e.constructor;return e.lte(1)?new r(e.eq(1)?0:NaN):e.isFinite()?(t=r.precision,n=r.rounding,r.precision=t+Math.max(Math.abs(e.e),e.sd())+4,r.rounding=1,ir=!1,e=e.times(e).minus(1).sqrt().plus(e),ir=!0,r.precision=t,r.rounding=n,e.ln()):new r(e)},Ir.inverseHyperbolicSine=Ir.asinh=function(){var t,n,e=this,r=e.constructor;return!e.isFinite()||e.isZero()?new r(e):(t=r.precision,n=r.rounding,r.precision=t+2*Math.max(Math.abs(e.e),e.sd())+6,r.rounding=1,ir=!1,e=e.times(e).plus(1).sqrt().plus(e),ir=!0,r.precision=t,r.rounding=n,e.ln())},Ir.inverseHyperbolicTangent=Ir.atanh=function(){var t,n,e,r,i=this,u=i.constructor;return i.isFinite()?i.e>=0?new u(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=u.precision,n=u.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?Ar(new u(i),t,n,!0):(u.precision=e=r-i.e,i=Or(i.plus(1),new u(1).minus(i),e+t,1),u.precision=t+4,u.rounding=1,i=i.ln(),u.precision=t,u.rounding=n,i.times(.5))):new u(NaN)},Ir.inverseSine=Ir.asin=function(){var t,n,e,r,i=this,u=i.constructor;return i.isZero()?new u(i):(n=i.abs().cmp(1),e=u.precision,r=u.rounding,-1!==n?0===n?((t=pr(u,e+4,r).times(.5)).s=i.s,t):new u(NaN):(u.precision=e+6,u.rounding=1,i=i.div(new u(1).minus(i.times(i)).sqrt().plus(1)).atan(),u.precision=e,u.rounding=r,i.times(2)))},Ir.inverseTangent=Ir.atan=function(){var t,n,e,r,i,u,M,N,o,c=this,a=c.constructor,D=a.precision,s=a.rounding;if(c.isFinite()){if(c.isZero())return new a(c);if(c.abs().eq(1)&&D+4<=lr)return(M=pr(a,D+4,s).times(.25)).s=c.s,M}else{if(!c.s)return new a(NaN);if(D+4<=lr)return(M=pr(a,D+4,s).times(.5)).s=c.s,M}for(a.precision=N=D+10,a.rounding=1,t=e=Math.min(28,N/7+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(ir=!1,n=Math.ceil(N/7),r=1,o=c.times(c),M=new a(c),i=c;-1!==t;)if(i=i.times(o),u=M.minus(i.div(r+=2)),i=i.times(o),void 0!==(M=u.plus(i.div(r+=2))).d[n])for(t=n;M.d[t]===u.d[t]&&t--;);return e&&(M=M.times(2<<e-1)),ir=!0,Ar(M,a.precision=D,a.rounding=s,!0)},Ir.isFinite=function(){return!!this.d},Ir.isInteger=Ir.isInt=function(){return!!this.d&&Nr(this.e/7)>this.d.length-2},Ir.isNaN=function(){return!this.s},Ir.isNegative=Ir.isNeg=function(){return this.s<0},Ir.isPositive=Ir.isPos=function(){return this.s>0},Ir.isZero=function(){return!!this.d&&0===this.d[0]},Ir.lessThan=Ir.lt=function(t){return this.cmp(t)<0},Ir.lessThanOrEqualTo=Ir.lte=function(t){return this.cmp(t)<1},Ir.logarithm=Ir.log=function(t){var n,e,r,i,u,M,N,o,c=this.constructor,a=c.precision,D=c.rounding;if(null==t)t=new c(10),n=!0;else{if(e=(t=new c(t)).d,t.s<0||!e||!e[0]||t.eq(1))return new c(NaN);n=t.eq(10)}if(e=this.d,this.s<0||!e||!e[0]||this.eq(1))return new c(e&&!e[0]?-1/0:1!=this.s?NaN:e?0:1/0);if(n)if(e.length>1)u=!0;else{for(i=e[0];i%10==0;)i/=10;u=1!==i}if(ir=!1,M=Lr(this,N=a+5),r=n?fr(c,N+10):Lr(t,N),hr((o=Or(M,r,N,1)).d,i=a,D))do{if(M=Lr(this,N+=10),r=n?fr(c,N+10):Lr(t,N),o=Or(M,r,N,1),!u){+jr(o.d).slice(i+1,i+15)+1==1e14&&(o=Ar(o,a+1,0));break}}while(hr(o.d,i+=10,D));return ir=!0,Ar(o,a,D)},Ir.minus=Ir.sub=function(t){var n,e,r,i,u,M,N,o,c,a,D,s,T=this,g=T.constructor;if(t=new g(t),!T.d||!t.d)return T.s&&t.s?T.d?t.s=-t.s:t=new g(t.d||T.s!==t.s?T:NaN):t=new g(NaN),t;if(T.s!=t.s)return t.s=-t.s,T.plus(t);if(c=T.d,s=t.d,N=g.precision,o=g.rounding,!c[0]||!s[0]){if(s[0])t.s=-t.s;else{if(!c[0])return new g(3===o?-0:0);t=new g(T)}return ir?Ar(t,N,o):t}if(e=Nr(t.e/7),a=Nr(T.e/7),c=c.slice(),u=a-e){for((D=u<0)?(n=c,u=-u,M=s.length):(n=s,e=a,M=c.length),u>(r=Math.max(Math.ceil(N/7),M)+2)&&(u=r,n.length=1),n.reverse(),r=u;r--;)n.push(0);n.reverse()}else{for((D=(r=c.length)<(M=s.length))&&(M=r),r=0;r<M;r++)if(c[r]!=s[r]){D=c[r]<s[r];break}u=0}for(D&&(n=c,c=s,s=n,t.s=-t.s),M=c.length,r=s.length-M;r>0;--r)c[M++]=0;for(r=s.length;r>u;){if(c[--r]<s[r]){for(i=r;i&&0===c[--i];)c[i]=Tr-1;--c[i],c[r]+=Tr}c[r]-=s[r]}for(;0===c[--M];)c.pop();for(;0===c[0];c.shift())--e;return c[0]?(t.d=c,t.e=Er(c,e),ir?Ar(t,N,o):t):new g(3===o?-0:0)},Ir.modulo=Ir.mod=function(t){var n,e=this,r=e.constructor;return t=new r(t),!e.d||!t.s||t.d&&!t.d[0]?new r(NaN):!t.d||e.d&&!e.d[0]?Ar(new r(e),r.precision,r.rounding):(ir=!1,9==r.modulo?(n=Or(e,t.abs(),0,3,1)).s*=t.s:n=Or(e,t,0,r.modulo,1),n=n.times(t),ir=!0,e.minus(n))},Ir.naturalExponential=Ir.exp=function(){return Sr(this)},Ir.naturalLogarithm=Ir.ln=function(){return Lr(this)},Ir.negated=Ir.neg=function(){var t=new this.constructor(this);return t.s=-t.s,Ar(t)},Ir.plus=Ir.add=function(t){var n,e,r,i,u,M,N,o,c,a,D=this,s=D.constructor;if(t=new s(t),!D.d||!t.d)return D.s&&t.s?D.d||(t=new s(t.d||D.s===t.s?D:NaN)):t=new s(NaN),t;if(D.s!=t.s)return t.s=-t.s,D.minus(t);if(c=D.d,a=t.d,N=s.precision,o=s.rounding,!c[0]||!a[0])return a[0]||(t=new s(D)),ir?Ar(t,N,o):t;if(u=Nr(D.e/7),r=Nr(t.e/7),c=c.slice(),i=u-r){for(i<0?(e=c,i=-i,M=a.length):(e=a,r=u,M=c.length),i>(M=(u=Math.ceil(N/7))>M?u+1:M+1)&&(i=M,e.length=1),e.reverse();i--;)e.push(0);e.reverse()}for((M=c.length)-(i=a.length)<0&&(i=M,e=a,a=c,c=e),n=0;i;)n=(c[--i]=c[i]+a[i]+n)/Tr|0,c[i]%=Tr;for(n&&(c.unshift(n),++r),M=c.length;0==c[--M];)c.pop();return t.d=c,t.e=Er(c,r),ir?Ar(t,N,o):t},Ir.precision=Ir.sd=function(t){var n,e=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(ur+t);return e.d?(n=Ur(e.d),t&&e.e+1>n&&(n=e.e+1)):n=NaN,n},Ir.round=function(){var t=this,n=t.constructor;return Ar(new n(t),t.e+1,n.rounding)},Ir.sine=Ir.sin=function(){var t,n,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(t=r.precision,n=r.rounding,r.precision=t+Math.max(e.e,e.sd())+7,r.rounding=1,e=function(t,n){var e,r=n.d.length;if(r<3)return n.isZero()?n:mr(t,2,n,n);e=(e=1.4*Math.sqrt(r))>16?16:0|e,n=n.times(1/Fr(5,e)),n=mr(t,2,n,n);for(var i,u=new t(5),M=new t(16),N=new t(20);e--;)i=n.times(n),n=n.times(u.plus(i.times(M.times(i).minus(N))));return n}(r,Rr(r,e)),r.precision=t,r.rounding=n,Ar(_e>2?e.neg():e,t,n,!0)):new r(NaN)},Ir.squareRoot=Ir.sqrt=function(){var t,n,e,r,i,u,M=this,N=M.d,o=M.e,c=M.s,a=M.constructor;if(1!==c||!N||!N[0])return new a(!c||c<0&&(!N||N[0])?NaN:N?M:1/0);for(ir=!1,0==(c=Math.sqrt(+M))||c==1/0?(((n=jr(N)).length+o)%2==0&&(n+="0"),c=Math.sqrt(n),o=Nr((o+1)/2)-(o<0||o%2),r=new a(n=c==1/0?"5e"+o:(n=c.toExponential()).slice(0,n.indexOf("e")+1)+o)):r=new a(c.toString()),e=(o=a.precision)+3;;)if(r=(u=r).plus(Or(M,u,e+2,1)).times(.5),jr(u.d).slice(0,e)===(n=jr(r.d)).slice(0,e)){if("9999"!=(n=n.slice(e-3,e+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(Ar(r,o+1,1),t=!r.times(r).eq(M));break}if(!i&&(Ar(u,o+1,0),u.times(u).eq(M))){r=u;break}e+=4,i=1}return ir=!0,Ar(r,o,a.rounding,t)},Ir.tangent=Ir.tan=function(){var t,n,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(t=r.precision,n=r.rounding,r.precision=t+10,r.rounding=1,(e=e.sin()).s=1,e=Or(e,new r(1).minus(e.times(e)).sqrt(),t+10,0),r.precision=t,r.rounding=n,Ar(2==_e||4==_e?e.neg():e,t,n,!0)):new r(NaN)},Ir.times=Ir.mul=function(t){var n,e,r,i,u,M,N,o,c,a=this,D=a.constructor,s=a.d,T=(t=new D(t)).d;if(t.s*=a.s,!(s&&s[0]&&T&&T[0]))return new D(!t.s||s&&!s[0]&&!T||T&&!T[0]&&!s?NaN:s&&T?0*t.s:t.s/0);for(e=Nr(a.e/7)+Nr(t.e/7),(o=s.length)<(c=T.length)&&(u=s,s=T,T=u,M=o,o=c,c=M),u=[],r=M=o+c;r--;)u.push(0);for(r=c;--r>=0;){for(n=0,i=o+r;i>r;)N=u[i]+T[r]*s[i-r-1]+n,u[i--]=N%Tr|0,n=N/Tr|0;u[i]=(u[i]+n)%Tr|0}for(;!u[--M];)u.pop();return n?++e:u.shift(),t.d=u,t.e=Er(u,e),ir?Ar(t,D.precision,D.rounding):t},Ir.toBinary=function(t,n){return br(this,2,t,n)},Ir.toDecimalPlaces=Ir.toDP=function(t,n){var e=this,r=e.constructor;return e=new r(e),void 0===t?e:(yr(t,0,1e9),void 0===n?n=r.rounding:yr(n,0,8),Ar(e,t+e.e+1,n))},Ir.toExponential=function(t,n){var e,r=this,i=r.constructor;return void 0===t?e=xr(r,!0):(yr(t,0,1e9),void 0===n?n=i.rounding:yr(n,0,8),e=xr(r=Ar(new i(r),t+1,n),!0,t+1)),r.isNeg()&&!r.isZero()?"-"+e:e},Ir.toFixed=function(t,n){var e,r,i=this,u=i.constructor;return void 0===t?e=xr(i):(yr(t,0,1e9),void 0===n?n=u.rounding:yr(n,0,8),e=xr(r=Ar(new u(i),t+i.e+1,n),!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+e:e},Ir.toFraction=function(t){var n,e,r,i,u,M,N,o,c,a,D,s,T=this,g=T.d,l=T.constructor;if(!g)return new l(T);if(c=e=new l(1),r=o=new l(0),M=(u=(n=new l(r)).e=Ur(g)-T.e-1)%7,n.d[0]=or(10,M<0?7+M:M),null==t)t=u>0?n:c;else{if(!(N=new l(t)).isInt()||N.lt(c))throw Error(ur+N);t=N.gt(n)?u>0?n:c:N}for(ir=!1,N=new l(jr(g)),a=l.precision,l.precision=u=7*g.length*2;D=Or(N,n,0,1,1),1!=(i=e.plus(D.times(r))).cmp(t);)e=r,r=i,i=c,c=o.plus(D.times(i)),o=i,i=n,n=N.minus(D.times(i)),N=i;return i=Or(t.minus(e),r,0,1,1),o=o.plus(i.times(c)),e=e.plus(i.times(r)),o.s=c.s=T.s,s=Or(c,r,u,1).minus(T).abs().cmp(Or(o,e,u,1).minus(T).abs())<1?[c,r]:[o,e],l.precision=a,ir=!0,s},Ir.toHexadecimal=Ir.toHex=function(t,n){return br(this,16,t,n)},Ir.toNearest=function(t,n){var e=this,r=e.constructor;if(e=new r(e),null==t){if(!e.d)return e;t=new r(1),n=r.rounding}else{if(t=new r(t),void 0===n?n=r.rounding:yr(n,0,8),!e.d)return t.s?e:t;if(!t.d)return t.s&&(t.s=e.s),t}return t.d[0]?(ir=!1,e=Or(e,t,0,n,1).times(t),ir=!0,Ar(e)):(t.s=e.s,e=t),e},Ir.toNumber=function(){return+this},Ir.toOctal=function(t,n){return br(this,8,t,n)},Ir.toPower=Ir.pow=function(t){var n,e,r,i,u,M,N=this,o=N.constructor,c=+(t=new o(t));if(!(N.d&&t.d&&N.d[0]&&t.d[0]))return new o(or(+N,c));if((N=new o(N)).eq(1))return N;if(r=o.precision,u=o.rounding,t.eq(1))return Ar(N,r,u);if((n=Nr(t.e/7))>=t.d.length-1&&(e=c<0?-c:c)<=9007199254740991)return i=Cr(o,N,e,r),t.s<0?new o(1).div(i):Ar(i,r,u);if((M=N.s)<0){if(n<t.d.length-1)return new o(NaN);if(0==(1&t.d[n])&&(M=1),0==N.e&&1==N.d[0]&&1==N.d.length)return N.s=M,N}return(n=0!=(e=or(+N,c))&&isFinite(e)?new o(e+"").e:Nr(c*(Math.log("0."+jr(N.d))/Math.LN10+N.e+1)))>o.maxE+1||n<o.minE-1?new o(n>0?M/0:0):(ir=!1,o.rounding=N.s=1,e=Math.min(12,(n+"").length),(i=Sr(t.times(Lr(N,r+e)),r)).d&&hr((i=Ar(i,r+5,1)).d,r,u)&&(n=r+10,+jr((i=Ar(Sr(t.times(Lr(N,n+e)),n),n+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=Ar(i,r+1,0))),i.s=M,ir=!0,o.rounding=u,Ar(i,r,u))},Ir.toPrecision=function(t,n){var e,r=this,i=r.constructor;return void 0===t?e=xr(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(yr(t,1,1e9),void 0===n?n=i.rounding:yr(n,0,8),e=xr(r=Ar(new i(r),t,n),t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+e:e},Ir.toSignificantDigits=Ir.toSD=function(t,n){var e=this.constructor;return void 0===t?(t=e.precision,n=e.rounding):(yr(t,1,1e9),void 0===n?n=e.rounding:yr(n,0,8)),Ar(new e(this),t,n)},Ir.toString=function(){var t=this,n=t.constructor,e=xr(t,t.e<=n.toExpNeg||t.e>=n.toExpPos);return t.isNeg()&&!t.isZero()?"-"+e:e},Ir.truncated=Ir.trunc=function(){return Ar(new this.constructor(this),this.e+1,1)},Ir.valueOf=Ir.toJSON=function(){var t=this,n=t.constructor,e=xr(t,t.e<=n.toExpNeg||t.e>=n.toExpPos);return t.isNeg()?"-"+e:e};var Or=function(){function t(t,n,e){var r,i=0,u=t.length;for(t=t.slice();u--;)r=t[u]*n+i,t[u]=r%e|0,i=r/e|0;return i&&t.unshift(i),t}function n(t,n,e,r){var i,u;if(e!=r)u=e>r?1:-1;else for(i=u=0;i<e;i++)if(t[i]!=n[i]){u=t[i]>n[i]?1:-1;break}return u}function e(t,n,e,r){for(var i=0;e--;)t[e]-=i,i=t[e]<n[e]?1:0,t[e]=i*r+t[e]-n[e];for(;!t[0]&&t.length>1;)t.shift()}return function(r,i,u,M,N,o){var c,a,D,s,T,g,l,I,j,y,h,z,O,A,x,E,f,p,U,d,C=r.constructor,Q=r.s==i.s?1:-1,w=r.d,S=i.d;if(!(w&&w[0]&&S&&S[0]))return new C(r.s&&i.s&&(w?!S||w[0]!=S[0]:S)?w&&0==w[0]||!S?0*Q:Q/0:NaN);for(o?(T=1,a=r.e-i.e):(o=Tr,T=7,a=Nr(r.e/T)-Nr(i.e/T)),U=S.length,f=w.length,y=(j=new C(Q)).d=[],D=0;S[D]==(w[D]||0);D++);if(S[D]>(w[D]||0)&&a--,null==u?(A=u=C.precision,M=C.rounding):A=N?u+(r.e-i.e)+1:u,A<0)y.push(1),g=!0;else{if(A=A/T+2|0,D=0,1==U){for(s=0,S=S[0],A++;(D<f||s)&&A--;D++)x=s*o+(w[D]||0),y[D]=x/S|0,s=x%S|0;g=s||D<f}else{for((s=o/(S[0]+1)|0)>1&&(S=t(S,s,o),w=t(w,s,o),U=S.length,f=w.length),E=U,z=(h=w.slice(0,U)).length;z<U;)h[z++]=0;(d=S.slice()).unshift(0),p=S[0],S[1]>=o/2&&++p;do{s=0,(c=n(S,h,U,z))<0?(O=h[0],U!=z&&(O=O*o+(h[1]||0)),(s=O/p|0)>1?(s>=o&&(s=o-1),1==(c=n(l=t(S,s,o),h,I=l.length,z=h.length))&&(s--,e(l,U<I?d:S,I,o))):(0==s&&(c=s=1),l=S.slice()),(I=l.length)<z&&l.unshift(0),e(h,l,z,o),-1==c&&(c=n(S,h,U,z=h.length))<1&&(s++,e(h,U<z?d:S,z,o)),z=h.length):0===c&&(s++,h=[0]),y[D++]=s,c&&h[0]?h[z++]=w[E]||0:(h=[w[E]],z=1)}while((E++<f||void 0!==h[0])&&A--);g=void 0!==h[0]}y[0]||y.shift()}if(1==T)j.e=a,qe=g;else{for(D=1,s=y[0];s>=10;s/=10)D++;j.e=D+a*T-1,Ar(j,N?u+j.e+1:u,M,g)}return j}}();function Ar(t,n,e,r){var i,u,M,N,o,c,a,D,s,T=t.constructor;t:if(null!=n){if(!(D=t.d))return t;for(i=1,N=D[0];N>=10;N/=10)i++;if((u=n-i)<0)u+=7,M=n,o=(a=D[s=0])/or(10,i-M-1)%10|0;else if((s=Math.ceil((u+1)/7))>=(N=D.length)){if(!r)break t;for(;N++<=s;)D.push(0);a=o=0,i=1,M=(u%=7)-7+1}else{for(a=N=D[s],i=1;N>=10;N/=10)i++;o=(M=(u%=7)-7+i)<0?0:a/or(10,i-M-1)%10|0}if(r=r||n<0||void 0!==D[s+1]||(M<0?a:a%or(10,i-M-1)),c=e<4?(o||r)&&(0==e||e==(t.s<0?3:2)):o>5||5==o&&(4==e||r||6==e&&(u>0?M>0?a/or(10,i-M):0:D[s-1])%10&1||e==(t.s<0?8:7)),n<1||!D[0])return D.length=0,c?(n-=t.e+1,D[0]=or(10,(7-n%7)%7),t.e=-n||0):D[0]=t.e=0,t;if(0==u?(D.length=s,N=1,s--):(D.length=s+1,N=or(10,7-u),D[s]=M>0?(a/or(10,i-M)%or(10,M)|0)*N:0),c)for(;;){if(0==s){for(u=1,M=D[0];M>=10;M/=10)u++;for(M=D[0]+=N,N=1;M>=10;M/=10)N++;u!=N&&(t.e++,D[0]==Tr&&(D[0]=1));break}if(D[s]+=N,D[s]!=Tr)break;D[s--]=0,N=1}for(u=D.length;0===D[--u];)D.pop()}return ir&&(t.e>T.maxE?(t.d=null,t.e=NaN):t.e<T.minE&&(t.e=0,t.d=[0])),t}function xr(t,n,e){if(!t.isFinite())return kr(t);var r,i=t.e,u=jr(t.d),M=u.length;return n?(e&&(r=e-M)>0?u=u.charAt(0)+"."+u.slice(1)+dr(r):M>1&&(u=u.charAt(0)+"."+u.slice(1)),u=u+(t.e<0?"e":"e+")+t.e):i<0?(u="0."+dr(-i-1)+u,e&&(r=e-M)>0&&(u+=dr(r))):i>=M?(u+=dr(i+1-M),e&&(r=e-i-1)>0&&(u=u+"."+dr(r))):((r=i+1)<M&&(u=u.slice(0,r)+"."+u.slice(r)),e&&(r=e-M)>0&&(i+1===M&&(u+="."),u+=dr(r))),u}function Er(t,n){var e=t[0];for(n*=7;e>=10;e/=10)n++;return n}function fr(t,n,e){if(n>gr)throw ir=!0,e&&(t.precision=e),Error("[DecimalError] Precision limit exceeded");return Ar(new t(nr),n,1,!0)}function pr(t,n,e){if(n>lr)throw Error("[DecimalError] Precision limit exceeded");return Ar(new t(er),n,e,!0)}function Ur(t){var n=t.length-1,e=7*n+1;if(n=t[n]){for(;n%10==0;n/=10)e--;for(n=t[0];n>=10;n/=10)e++}return e}function dr(t){for(var n="";t--;)n+="0";return n}function Cr(t,n,e,r){var i,u=new t(1),M=Math.ceil(r/7+4);for(ir=!1;;){if(e%2&&Br((u=u.times(n)).d,M)&&(i=!0),0===(e=Nr(e/2))){e=u.d.length-1,i&&0===u.d[e]&&++u.d[e];break}Br((n=n.times(n)).d,M)}return ir=!0,u}function Qr(t){return 1&t.d[t.d.length-1]}function wr(t,n,e){for(var r,i=new t(n[0]),u=0;++u<n.length;){if(!(r=new t(n[u])).s){i=r;break}i[e](r)&&(i=r)}return i}function Sr(t,n){var e,r,i,u,M,N,o,c=0,a=0,D=0,s=t.constructor,T=s.rounding,g=s.precision;if(!t.d||!t.d[0]||t.e>17)return new s(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(null==n?(ir=!1,o=g):o=n,N=new s(.03125);t.e>-2;)t=t.times(N),D+=5;for(o+=r=Math.log(or(2,D))/Math.LN10*2+5|0,e=u=M=new s(1),s.precision=o;;){if(u=Ar(u.times(t),o,1),e=e.times(++a),jr((N=M.plus(Or(u,e,o,1))).d).slice(0,o)===jr(M.d).slice(0,o)){for(i=D;i--;)M=Ar(M.times(M),o,1);if(null!=n)return s.precision=g,M;if(!(c<3&&hr(M.d,o-r,T,c)))return Ar(M,s.precision=g,T,ir=!0);s.precision=o+=10,e=u=N=new s(1),a=0,c++}M=N}}function Lr(t,n){var e,r,i,u,M,N,o,c,a,D,s,T=1,g=t,l=g.d,I=g.constructor,j=I.rounding,y=I.precision;if(g.s<0||!l||!l[0]||!g.e&&1==l[0]&&1==l.length)return new I(l&&!l[0]?-1/0:1!=g.s?NaN:l?0:g);if(null==n?(ir=!1,a=y):a=n,I.precision=a+=10,r=(e=jr(l)).charAt(0),!(Math.abs(u=g.e)<15e14))return c=fr(I,a+2,y).times(u+""),g=Lr(new I(r+"."+e.slice(1)),a-10).plus(c),I.precision=y,null==n?Ar(g,y,j,ir=!0):g;for(;r<7&&1!=r||1==r&&e.charAt(1)>3;)r=(e=jr((g=g.times(t)).d)).charAt(0),T++;for(u=g.e,r>1?(g=new I("0."+e),u++):g=new I(r+"."+e.slice(1)),D=g,o=M=g=Or(g.minus(1),g.plus(1),a,1),s=Ar(g.times(g),a,1),i=3;;){if(M=Ar(M.times(s),a,1),jr((c=o.plus(Or(M,new I(i),a,1))).d).slice(0,a)===jr(o.d).slice(0,a)){if(o=o.times(2),0!==u&&(o=o.plus(fr(I,a+2,y).times(u+""))),o=Or(o,new I(T),a,1),null!=n)return I.precision=y,o;if(!hr(o.d,a-10,j,N))return Ar(o,I.precision=y,j,ir=!0);I.precision=a+=10,c=M=g=Or(D.minus(1),D.plus(1),a,1),s=Ar(g.times(g),a,1),i=N=1}o=c,i+=2}}function kr(t){return String(t.s*t.s/0)}function vr(t,n){var e,r,i;for((e=n.indexOf("."))>-1&&(n=n.replace(".","")),(r=n.search(/e/i))>0?(e<0&&(e=r),e+=+n.slice(r+1),n=n.substring(0,r)):e<0&&(e=n.length),r=0;48===n.charCodeAt(r);r++);for(i=n.length;48===n.charCodeAt(i-1);--i);if(n=n.slice(r,i)){if(i-=r,t.e=e=e-r-1,t.d=[],r=(e+1)%7,e<0&&(r+=7),r<i){for(r&&t.d.push(+n.slice(0,r)),i-=7;r<i;)t.d.push(+n.slice(r,r+=7));r=7-(n=n.slice(r)).length}else r-=i;for(;r--;)n+="0";t.d.push(+n),ir&&(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 Yr(t,n){var e,r,i,u,M,N,o,c,a;if(n.indexOf("_")>-1){if(n=n.replace(/(\d)_(?=\d)/g,"$1"),sr.test(n))return vr(t,n)}else if("Infinity"===n||"NaN"===n)return+n||(t.s=NaN),t.e=NaN,t.d=null,t;if(ar.test(n))e=16,n=n.toLowerCase();else if(cr.test(n))e=2;else{if(!Dr.test(n))throw Error(ur+n);e=8}for((u=n.search(/p/i))>0?(o=+n.slice(u+1),n=n.substring(2,u)):n=n.slice(2),M=(u=n.indexOf("."))>=0,r=t.constructor,M&&(u=(N=(n=n.replace(".","")).length)-u,i=Cr(r,new r(e),u,2*u)),u=a=(c=zr(n,e,Tr)).length-1;0===c[u];--u)c.pop();return u<0?new r(0*t.s):(t.e=Er(c,a),t.d=c,ir=!1,M&&(t=Or(t,i,4*N)),o&&(t=t.times(Math.abs(o)<54?or(2,o):di.pow(2,o))),ir=!0,t)}function mr(t,n,e,r,i){var u,M,N,o,c=t.precision,a=Math.ceil(c/7);for(ir=!1,o=e.times(e),N=new t(r);;){if(M=Or(N.times(o),new t(n++*n++),c,1),N=i?r.plus(M):r.minus(M),r=Or(M.times(o),new t(n++*n++),c,1),void 0!==(M=N.plus(r)).d[a]){for(u=a;M.d[u]===N.d[u]&&u--;);if(-1==u)break}u=N,N=r,r=M,M=u}return ir=!0,M.d.length=a+1,M}function Fr(t,n){for(var e=t;--n;)e*=t;return e}function Rr(t,n){var e,r=n.s<0,i=pr(t,t.precision,1),u=i.times(.5);if((n=n.abs()).lte(u))return _e=r?4:1,n;if((e=n.divToInt(i)).isZero())_e=r?3:2;else{if((n=n.minus(e.times(i))).lte(u))return _e=Qr(e)?r?2:3:r?4:1,n;_e=Qr(e)?r?1:4:r?3:2}return n.minus(i).abs()}function br(t,n,e,r){var i,u,M,N,o,c,a,D,s,T=t.constructor,g=void 0!==e;if(g?(yr(e,1,1e9),void 0===r?r=T.rounding:yr(r,0,8)):(e=T.precision,r=T.rounding),t.isFinite()){for(g?(i=2,16==n?e=4*e-3:8==n&&(e=3*e-2)):i=n,(M=(a=xr(t)).indexOf("."))>=0&&(a=a.replace(".",""),(s=new T(1)).e=a.length-M,s.d=zr(xr(s),10,i),s.e=s.d.length),u=o=(D=zr(a,10,i)).length;0==D[--o];)D.pop();if(D[0]){if(M<0?u--:((t=new T(t)).d=D,t.e=u,D=(t=Or(t,s,e,r,0,i)).d,u=t.e,c=qe),M=D[e],N=i/2,c=c||void 0!==D[e+1],c=r<4?(void 0!==M||c)&&(0===r||r===(t.s<0?3:2)):M>N||M===N&&(4===r||c||6===r&&1&D[e-1]||r===(t.s<0?8:7)),D.length=e,c)for(;++D[--e]>i-1;)D[e]=0,e||(++u,D.unshift(1));for(o=D.length;!D[o-1];--o);for(M=0,a="";M<o;M++)a+=tr.charAt(D[M]);if(g){if(o>1)if(16==n||8==n){for(M=16==n?4:3,--o;o%M;o++)a+="0";for(o=(D=zr(a,i,n)).length;!D[o-1];--o);for(M=1,a="1.";M<o;M++)a+=tr.charAt(D[M])}else a=a.charAt(0)+"."+a.slice(1);a=a+(u<0?"p":"p+")+u}else if(u<0){for(;++u;)a="0"+a;a="0."+a}else if(++u>o)for(u-=o;u--;)a+="0";else u<o&&(a=a.slice(0,u)+"."+a.slice(u))}else a=g?"0p+0":"0";a=(16==n?"0x":2==n?"0b":8==n?"0o":"")+a}else a=kr(t);return t.s<0?"-"+a:a}function Br(t,n){if(t.length>n)return t.length=n,!0}function Zr(t){return new this(t).abs()}function Vr(t){return new this(t).acos()}function Wr(t){return new this(t).acosh()}function Gr(t,n){return new this(t).plus(n)}function Pr(t){return new this(t).asin()}function Jr(t){return new this(t).asinh()}function Hr(t){return new this(t).atan()}function Xr(t){return new this(t).atanh()}function Kr(t,n){t=new this(t),n=new this(n);var e,r=this.precision,i=this.rounding,u=r+4;return t.s&&n.s?t.d||n.d?!n.d||t.isZero()?(e=n.s<0?pr(this,r,i):new this(0)).s=t.s:!t.d||n.isZero()?(e=pr(this,u,1).times(.5)).s=t.s:n.s<0?(this.precision=u,this.rounding=1,e=this.atan(Or(t,n,u,1)),n=pr(this,u,1),this.precision=r,this.rounding=i,e=t.s<0?e.minus(n):e.plus(n)):e=this.atan(Or(t,n,u,1)):(e=pr(this,u,1).times(n.s>0?.25:.75)).s=t.s:e=new this(NaN),e}function qr(t){return new this(t).cbrt()}function _r(t){return Ar(t=new this(t),t.e+1,2)}function $r(t,n,e){return new this(t).clamp(n,e)}function ti(t){if(!t||"object"!=typeof t)throw Error("[DecimalError] Object expected");var n,e,r,i=!0===t.defaults,u=["precision",1,1e9,"rounding",0,8,"toExpNeg",-$e,0,"toExpPos",0,$e,"maxE",0,$e,"minE",-$e,0,"modulo",0,9];for(n=0;n<u.length;n+=3)if(e=u[n],i&&(this[e]=rr[e]),void 0!==(r=t[e])){if(!(Nr(r)===r&&r>=u[n+1]&&r<=u[n+2]))throw Error(ur+e+": "+r);this[e]=r}if(e="crypto",i&&(this[e]=rr[e]),void 0!==(r=t[e])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(ur+e+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error("[DecimalError] crypto unavailable");this[e]=!0}else this[e]=!1}return this}function ni(t){return new this(t).cos()}function ei(t){return new this(t).cosh()}function ri(t,n){return new this(t).div(n)}function ii(t){return new this(t).exp()}function ui(t){return Ar(t=new this(t),t.e+1,3)}function Mi(){var t,n,e=new this(0);for(ir=!1,t=0;t<arguments.length;)if((n=new this(arguments[t++])).d)e.d&&(e=e.plus(n.times(n)));else{if(n.s)return ir=!0,new this(1/0);e=n}return ir=!0,e.sqrt()}function Ni(t){return t instanceof di||t&&t.toStringTag===Mr||!1}function oi(t){return new this(t).ln()}function ci(t,n){return new this(t).log(n)}function ai(t){return new this(t).log(2)}function Di(t){return new this(t).log(10)}function si(){return wr(this,arguments,"lt")}function Ti(){return wr(this,arguments,"gt")}function gi(t,n){return new this(t).mod(n)}function li(t,n){return new this(t).mul(n)}function Ii(t,n){return new this(t).pow(n)}function ji(t){var n,e,r,i,u=0,M=new this(1),N=[];if(void 0===t?t=this.precision:yr(t,1,1e9),r=Math.ceil(t/7),this.crypto)if(crypto.getRandomValues)for(n=crypto.getRandomValues(new Uint32Array(r));u<r;)(i=n[u])>=429e7?n[u]=crypto.getRandomValues(new Uint32Array(1))[0]:N[u++]=i%1e7;else{if(!crypto.randomBytes)throw Error("[DecimalError] crypto unavailable");for(n=crypto.randomBytes(r*=4);u<r;)(i=n[u]+(n[u+1]<<8)+(n[u+2]<<16)+((127&n[u+3])<<24))>=214e7?crypto.randomBytes(4).copy(n,u):(N.push(i%1e7),u+=4);u=r/4}else for(;u<r;)N[u++]=1e7*Math.random()|0;for(t%=7,(r=N[--u])&&t&&(i=or(10,7-t),N[u]=(r/i|0)*i);0===N[u];u--)N.pop();if(u<0)e=0,N=[0];else{for(e=-1;0===N[0];e-=7)N.shift();for(r=1,i=N[0];i>=10;i/=10)r++;r<7&&(e-=7-r)}return M.e=e,M.d=N,M}function yi(t){return Ar(t=new this(t),t.e+1,this.rounding)}function hi(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function zi(t){return new this(t).sin()}function Oi(t){return new this(t).sinh()}function Ai(t){return new this(t).sqrt()}function xi(t,n){return new this(t).sub(n)}function Ei(){var t=0,n=arguments,e=new this(n[t]);for(ir=!1;e.s&&++t<n.length;)e=e.plus(n[t]);return ir=!0,Ar(e,this.precision,this.rounding)}function fi(t){return new this(t).tan()}function pi(t){return new this(t).tanh()}function Ui(t){return Ar(t=new this(t),t.e+1,1)}Ir[Symbol.for("nodejs.util.inspect.custom")]=Ir.toString,Ir[Symbol.toStringTag]="Decimal";var di=Ir.constructor=function t(n){var e,r,i;function u(t){var n,e,r,i=this;if(!(i instanceof u))return new u(t);if(i.constructor=u,Ni(t))return i.s=t.s,void(ir?!t.d||t.e>u.maxE?(i.e=NaN,i.d=null):t.e<u.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"===(r=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(n=0,e=t;e>=10;e/=10)n++;return void(ir?n>u.maxE?(i.e=NaN,i.d=null):n<u.minE?(i.e=0,i.d=[0]):(i.e=n,i.d=[t]):(i.e=n,i.d=[t]))}return 0*t!=0?(t||(i.s=NaN),i.e=NaN,void(i.d=null)):vr(i,t.toString())}if("string"!==r)throw Error(ur+t);return 45===(e=t.charCodeAt(0))?(t=t.slice(1),i.s=-1):(43===e&&(t=t.slice(1)),i.s=1),sr.test(t)?vr(i,t):Yr(i,t)}if(u.prototype=Ir,u.ROUND_UP=0,u.ROUND_DOWN=1,u.ROUND_CEIL=2,u.ROUND_FLOOR=3,u.ROUND_HALF_UP=4,u.ROUND_HALF_DOWN=5,u.ROUND_HALF_EVEN=6,u.ROUND_HALF_CEIL=7,u.ROUND_HALF_FLOOR=8,u.EUCLID=9,u.config=u.set=ti,u.clone=t,u.isDecimal=Ni,u.abs=Zr,u.acos=Vr,u.acosh=Wr,u.add=Gr,u.asin=Pr,u.asinh=Jr,u.atan=Hr,u.atanh=Xr,u.atan2=Kr,u.cbrt=qr,u.ceil=_r,u.clamp=$r,u.cos=ni,u.cosh=ei,u.div=ri,u.exp=ii,u.floor=ui,u.hypot=Mi,u.ln=oi,u.log=ci,u.log10=Di,u.log2=ai,u.max=si,u.min=Ti,u.mod=gi,u.mul=li,u.pow=Ii,u.random=ji,u.round=yi,u.sign=hi,u.sin=zi,u.sinh=Oi,u.sqrt=Ai,u.sub=xi,u.sum=Ei,u.tan=fi,u.tanh=pi,u.trunc=Ui,void 0===n&&(n={}),n&&!0!==n.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<i.length;)n.hasOwnProperty(r=i[e++])||(n[r]=this[r]);return u.config(n),u}(rr);nr=new di(nr),er=new di(er);var Ci=di;function Qi(t){return"boolean"==typeof t||!!isFinite(t)&&t===Math.round(t)}var wi=Math.sign||function(t){return t>0?1:t<0?-1:0},Si=Math.log2||function(t){return Math.log(t)/Math.LN2},Li=Math.log10||function(t){return Math.log(t)/Math.LN10},ki=(Math.log1p,Math.cbrt||function(t){if(0===t)return t;var n,e=t<0;return e&&(t=-t),n=isFinite(t)?(t/((n=Math.exp(Math.log(t)/3))*n)+2*n)/3:t,e?-n:n}),vi=Math.expm1||function(t){return t>=2e-4||t<=-2e-4?Math.exp(t)-1:t+t*t/2+t*t*t/6};function Yi(t,n,e){var r={2:"0b",8:"0o",16:"0x"}[n],i="";if(e){if(e<1)throw new Error("size must be in greater than 0");if(!Qi(e))throw new Error("size must be an integer");if(t>2**(e-1)-1||t<-(2**(e-1)))throw new Error("Value must be in range [-2^".concat(e-1,", 2^").concat(e-1,"-1]"));if(!Qi(t))throw new Error("Value must be an integer");t<0&&(t+=2**e),i="i".concat(e)}var u="";return t<0&&(t=-t,u="-"),"".concat(u).concat(r).concat(t.toString(n)).concat(i)}function mi(t,n){if("function"==typeof n)return n(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var{notation:e,precision:r,wordSize:i}=Fi(n);switch(e){case"fixed":return bi(t,r);case"exponential":return Bi(t,r);case"engineering":return function(t,n){if(isNaN(t)||!isFinite(t))return String(t);var e=Zi(Ri(t),n),r=e.exponent,i=e.coefficients,u=r%3==0?r:r<0?r-3-r%3:r-r%3;if(ie(n))for(;n>i.length||r-u+1>i.length;)i.push(0);else for(var M=Math.abs(r-u)-(i.length-1),N=0;N<M;N++)i.push(0);var o=Math.abs(r-u),c=1;for(;o>0;)c++,o--;var a=i.slice(c).join(""),D=ie(n)&&a.length||a.match(/[1-9]/)?"."+a:"",s=i.slice(0,c).join("")+D+"e"+(r>=0?"+":"")+u.toString();return e.sign+s}(t,r);case"bin":return Yi(t,2,i);case"oct":return Yi(t,8,i);case"hex":return Yi(t,16,i);case"auto":return function(t,n,e){if(isNaN(t)||!isFinite(t))return String(t);var r=qi(null==e?void 0:e.lowerExp,-3),i=qi(null==e?void 0:e.upperExp,5),u=Ri(t),M=n?Zi(u,n):u;if(M.exponent<r||M.exponent>=i)return Bi(t,n);var N=M.coefficients,o=M.exponent;N.length<n&&(N=N.concat(Vi(n-N.length))),N=N.concat(Vi(o-N.length+1+(N.length<n?n-N.length:0))),N=Vi(-o).concat(N);var c=o>0?o:0;return c<N.length-1&&N.splice(c+1,0,"."),M.sign+N.join("")}(t,r,n).replace(/((\.\d*?)(0+))($|e)/,(function(){var t=arguments[2],n=arguments[4];return"."!==t?t+n:n}));default:throw new Error('Unknown notation "'+e+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Fi(t){var n,e,r="auto";if(void 0!==t)if(ie(t))n=t;else if(ue(t))n=t.toNumber();else{if(!xe(t))throw new Error("Unsupported type of options, number, BigNumber, or object expected");void 0!==t.precision&&(n=Ki(t.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),void 0!==t.wordSize&&(e=Ki(t.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),t.notation&&(r=t.notation)}return{notation:r,precision:n,wordSize:e}}function Ri(t){var n=String(t).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!n)throw new SyntaxError("Invalid number "+t);var e=n[1],r=n[2],i=parseFloat(n[4]||"0"),u=r.indexOf(".");i+=-1!==u?u-1:r.length-1;var M=r.replace(".","").replace(/^0*/,(function(t){return i-=t.length,""})).replace(/0*$/,"").split("").map((function(t){return parseInt(t)}));return 0===M.length&&(M.push(0),i++),{sign:e,coefficients:M,exponent:i}}function bi(t,n){if(isNaN(t)||!isFinite(t))return String(t);var e=Ri(t),r="number"==typeof n?Zi(e,e.exponent+1+n):e,i=r.coefficients,u=r.exponent+1,M=u+(n||0);return i.length<M&&(i=i.concat(Vi(M-i.length))),u<0&&(i=Vi(1-u).concat(i),u=1),u<i.length&&i.splice(u,0,0===u?"0.":"."),r.sign+i.join("")}function Bi(t,n){if(isNaN(t)||!isFinite(t))return String(t);var e=Ri(t),r=n?Zi(e,n):e,i=r.coefficients,u=r.exponent;i.length<n&&(i=i.concat(Vi(n-i.length)));var M=i.shift();return r.sign+M+(i.length>0?"."+i.join(""):"")+"e"+(u>=0?"+":"")+u}function Zi(t,n){for(var e={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},r=e.coefficients;n<=0;)r.unshift(0),e.exponent++,n++;if(r.length>n&&r.splice(n,r.length-n)[0]>=5){var i=n-1;for(r[i]++;10===r[i];)r.pop(),0===i&&(r.unshift(0),e.exponent++,i++),r[--i]++}return e}function Vi(t){for(var n=[],e=0;e<t;e++)n.push(0);return n}var Wi=Number.EPSILON||2220446049250313e-31;function Gi(t,n,e){if(null==e)return t===n;if(t===n)return!0;if(isNaN(t)||isNaN(n))return!1;if(isFinite(t)&&isFinite(n)){var r=Math.abs(t-n);return r<=Wi||r<=Math.max(Math.abs(t),Math.abs(n))*e}return!1}var Pi=Math.acosh||function(t){return Math.log(Math.sqrt(t*t-1)+t)},Ji=Math.asinh||function(t){return Math.log(Math.sqrt(t*t+1)+t)},Hi=Math.atanh||function(t){return Math.log((1+t)/(1-t))/2},Xi=(Math.cosh,Math.sinh||function(t){return(Math.exp(t)-Math.exp(-t))/2});Math.tanh;function Ki(t,n){return ie(t)?t:ue(t)?t.toNumber():void n()}function qi(t,n){return ie(t)?t:ue(t)?t.toNumber():n}function _i(t,n,e){var r=new(0,t.constructor)(2),i="";if(e){if(e<1)throw new Error("size must be in greater than 0");if(!Qi(e))throw new Error("size must be an integer");if(t.greaterThan(r.pow(e-1).sub(1))||t.lessThan(r.pow(e-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(e-1,", 2^").concat(e-1,"-1]"));if(!t.isInteger())throw new Error("Value must be an integer");t.lessThan(0)&&(t=t.add(r.pow(e))),i="i".concat(e)}switch(n){case 2:return"".concat(t.toBinary()).concat(i);case 8:return"".concat(t.toOctal()).concat(i);case 16:return"".concat(t.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(n," not supported "))}}function $i(t,n){if("function"==typeof n)return n(t);if(!t.isFinite())return t.isNaN()?"NaN":t.gt(0)?"Infinity":"-Infinity";var{notation:e,precision:r,wordSize:i}=Fi(n);switch(e){case"fixed":return function(t,n){return t.toFixed(n)}(t,r);case"exponential":return tu(t,r);case"engineering":return function(t,n){var e=t.e,r=e%3==0?e:e<0?e-3-e%3:e-e%3,i=t.mul(Math.pow(10,-r)).toPrecision(n);if(-1!==i.indexOf("e")){var u=t.constructor;i=new u(i).toFixed()}return i+"e"+(e>=0?"+":"")+r.toString()}(t,r);case"bin":return _i(t,2,i);case"oct":return _i(t,8,i);case"hex":return _i(t,16,i);case"auto":var u=nu(null==n?void 0:n.lowerExp,-3),M=nu(null==n?void 0:n.upperExp,5);if(t.isZero())return"0";var N=t.toSignificantDigits(r),o=N.e;return(o>=u&&o<M?N.toFixed():tu(t,r)).replace(/((\.\d*?)(0+))($|e)/,(function(){var t=arguments[2],n=arguments[4];return"."!==t?t+n:n}));default:throw new Error('Unknown notation "'+e+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function tu(t,n){return void 0!==n?t.toExponential(n-1):t.toExponential()}function nu(t,n){return ie(t)?t:ue(t)?t.toNumber():n}function eu(t,n){var e=function(t,n){if("number"==typeof t)return mi(t,n);if(ue(t))return $i(t,n);if(function(t){return t&&"object"==typeof t&&"number"==typeof t.s&&"number"==typeof t.n&&"number"==typeof t.d||!1}(t))return n&&"decimal"===n.fraction?t.toString():t.s*t.n+"/"+t.d;if(Array.isArray(t))return function t(n,e){if(Array.isArray(n)){for(var r="[",i=n.length,u=0;u<i;u++)0!==u&&(r+=", "),r+=t(n[u],e);return r+="]"}return eu(n,e)}(t,n);if(ce(t))return ru(t);if("function"==typeof t)return t.syntax?String(t.syntax):"function";if(t&&"object"==typeof t){return"function"==typeof t.format?t.format(n):t&&t.toString(n)!=={}.toString()?t.toString(n):"{"+Object.keys(t).map(e=>ru(e)+": "+eu(t[e],n)).join(", ")+"}"}return String(t)}(t,n);return n&&"object"==typeof n&&"truncate"in n&&e.length>n.truncate?e.substring(0,n.truncate-3)+"...":e}function ru(t){for(var n=String(t),e="",r=0;r<n.length;){var i=n.charAt(r);e+=i in iu?iu[i]:i,r++}return'"'+e+'"'}var iu={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"};function uu(t,n){if(!ce(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Ve(t)+", index: 0)");if(!ce(n))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Ve(n)+", index: 1)");return t===n?0:t>n?1:-1}function Mu(t,n,e){if(!(this instanceof Mu))throw new SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=n,this.relation=e,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(n)?"["+n.join(", ")+"]":n)+")",this.stack=(new Error).stack}function Nu(t,n,e){if(!(this instanceof Nu))throw new SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=n):(this.min=n,this.max=e),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 ou(t){for(var n=[];Array.isArray(t);)n.push(t.length),t=t[0];return n}function cu(t,n){if(0===n.length){if(Array.isArray(t))throw new Mu(t.length,0)}else!function t(n,e,r){var i,u=n.length;if(u!==e[r])throw new Mu(u,e[r]);if(r<e.length-1){var M=r+1;for(i=0;i<u;i++){var N=n[i];if(!Array.isArray(N))throw new Mu(e.length-1,e.length,"<");t(n[i],e,M)}}else for(i=0;i<u;i++)if(Array.isArray(n[i]))throw new Mu(e.length+1,e.length,">")}(t,n,0)}function au(t,n){if(void 0!==t){if(!ie(t)||!Qi(t))throw new TypeError("Index must be an integer (value: "+t+")");if(t<0||"number"==typeof n&&t>=n)throw new Nu(t,n)}}function Du(t,n,e){if(!Array.isArray(n))throw new TypeError("Array expected");if(0===n.length)throw new Error("Resizing to scalar is not supported");return n.forEach((function(t){if(!ie(t)||!Qi(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+eu(n)+")")})),(ie(t)||ue(t))&&(t=[t]),function t(n,e,r,i){var u,M,N=n.length,o=e[r],c=Math.min(N,o);if(n.length=o,r<e.length-1){var a=r+1;for(u=0;u<c;u++)M=n[u],Array.isArray(M)||(M=[M],n[u]=M),t(M,e,a,i);for(u=c;u<o;u++)M=[],n[u]=M,t(M,e,a,i)}else{for(u=0;u<c;u++)for(;Array.isArray(n[u]);)n[u]=n[u][0];for(u=c;u<o;u++)n[u]=i}}(t,n,0,void 0!==e?e:0),t}function su(t,n){var e=Iu(t),r=e.length;if(!Array.isArray(t)||!Array.isArray(n))throw new TypeError("Array expected");if(0===n.length)throw new Mu(0,r,"!=");var i=gu(n=Tu(n,r));if(r!==i)throw new Mu(i,r,"!=");try{return function(t,n){for(var e,r=t,i=n.length-1;i>0;i--){var u=n[i];e=[];for(var M=r.length/u,N=0;N<M;N++)e.push(r.slice(N*u,(N+1)*u));r=e}return r}(e,n)}catch(t){if(t instanceof Mu)throw new Mu(i,r,"!=");throw t}}function Tu(t,n){var e=gu(t),r=t.slice(),i=t.indexOf(-1);if(t.indexOf(-1,i+1)>=0)throw new Error("More than one wildcard in sizes");if(i>=0){if(!(n%e==0))throw new Error("Could not replace wildcard, since "+n+" is no multiple of "+-e);r[i]=-n/e}return r}function gu(t){return t.reduce((t,n)=>t*n,1)}function lu(t,n,e,r){var i=r||ou(t);if(e)for(var u=0;u<e;u++)t=[t],i.unshift(1);for(t=function t(n,e,r){var i,u;if(Array.isArray(n)){var M=r+1;for(i=0,u=n.length;i<u;i++)n[i]=t(n[i],e,M)}else for(var N=r;N<e;N++)n=[n];return n}(t,n,0);i.length<n;)i.push(1);return t}function Iu(t){if(!Array.isArray(t))return t;var n=[];return t.forEach((function t(e){Array.isArray(e)?e.forEach(t):n.push(e)})),n}function ju(t,n){for(var e,r=0,i=0;i<t.length;i++){var u=t[i],M=Array.isArray(u);if(0===i&&M&&(r=u.length),M&&u.length!==r)return;var N=M?ju(u,n):n(u);if(void 0===e)e=N;else if(e!==N)return"mixed"}return e}function yu(t,n,e,r){if(r<e){if(t.length!==n.length)throw new Mu(t.length,n.length);for(var i=[],u=0;u<t.length;u++)i[u]=yu(t[u],n[u],e,r+1);return i}return t.concat(n)}function hu(){var t=Array.prototype.slice.call(arguments,0,-1),n=Array.prototype.slice.call(arguments,-1);if(1===t.length)return t[0];if(t.length>1)return t.slice(1).reduce((function(t,e){return yu(t,e,n,0)}),t[0]);throw new Error("Wrong number of arguments in function concat")}function zu(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];for(var r=n.map(t=>t.length),i=Math.max(...r),u=new Array(i).fill(null),M=0;M<n.length;M++)for(var N=n[M],o=r[M],c=0;c<o;c++){var a=i-o+c;N[c]>u[a]&&(u[a]=N[c])}for(var D=0;D<n.length;D++)Ou(n[D],u);return u}function Ou(t,n){for(var e=n.length,r=t.length,i=0;i<r;i++){var u=e-r+i;if(t[i]<n[u]&&t[i]>1||t[i]>n[u])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(t,") not possible to broadcast dimension ").concat(r," with size ").concat(t[i]," to size ").concat(n[u]))}}function Au(t,n){var e=ou(t);if(Pe(e,n))return t;Ou(e,n);var r,i,u,M=zu(e,n),N=M.length,o=[...Array(N-e.length).fill(1),...e],c=function(t){return ee()([],t)}(t);e.length<N&&(e=ou(c=su(c,o)));for(var a=0;a<N;a++)e[a]<M[a]&&(r=c,i=M[a],u=a,e=ou(c=hu(...Array(i).fill(r),u)));return c}function xu(t,n,e,r){function i(r){var i=function(t,n){for(var e={},r=0;r<n.length;r++){var i=n[r],u=t[i];void 0!==u&&(e[i]=u)}return e}(r,n.map(Eu));return function(t,n,e){if(!n.filter(t=>!function(t){return t&&"?"===t[0]}(t)).every(t=>void 0!==e[t])){var r=n.filter(t=>void 0===e[t]);throw new Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(r.map(t=>'"'.concat(t,'"')).join(", "),"."))}}(t,n,r),e(i)}return i.isFactory=!0,i.fn=t,i.dependencies=n.slice().sort(),r&&(i.meta=r),i}function Eu(t){return t&&"?"===t[0]?t.slice(1):t}Mu.prototype=new RangeError,Mu.prototype.constructor=RangeError,Mu.prototype.name="DimensionError",Mu.prototype.isDimensionError=!0,Nu.prototype=new RangeError,Nu.prototype.constructor=RangeError,Nu.prototype.name="IndexError",Nu.prototype.isIndexError=!0;var fu=xu("BigNumber",["?on","config"],t=>{var{on:n,config:e}=t,r=Ci.clone({precision:e.precision,modulo:Ci.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(t){return new r(t.value)},n&&n("config",(function(t,n){t.precision!==n.precision&&r.config({precision:t.precision})})),r},{isClass:!0}),pu=e(10),Uu=e.n(pu),du=xu("Complex",[],()=>(Object.defineProperty(Uu.a,"name",{value:"Complex"}),Uu.a.prototype.constructor=Uu.a,Uu.a.prototype.type="Complex",Uu.a.prototype.isComplex=!0,Uu.a.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Uu.a.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Uu.a.prototype.format=function(t){var n=this.im,e=this.re,r=mi(this.re,t),i=mi(this.im,t),u=ie(t)?t:t?t.precision:null;if(null!==u){var M=Math.pow(10,-u);Math.abs(e/n)<M&&(e=0),Math.abs(n/e)<M&&(n=0)}return 0===n?r:0===e?1===n?"i":-1===n?"-i":i+"i":n<0?-1===n?r+" - i":r+" - "+i.substring(1)+"i":1===n?r+" + i":r+" + "+i+"i"},Uu.a.fromPolar=function(t){switch(arguments.length){case 1:var n=arguments[0];if("object"==typeof n)return Uu()(n);throw new TypeError("Input has to be an object with r and phi keys.");case 2:var e=arguments[0],r=arguments[1];if(ie(e)){if(oe(r)&&r.hasBase("ANGLE")&&(r=r.toNumber("rad")),ie(r))return new Uu.a({r:e,phi:r});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")}},Uu.a.prototype.valueOf=Uu.a.prototype.toString,Uu.a.fromJSON=function(t){return new Uu.a(t)},Uu.a.compare=function(t,n){return t.re>n.re?1:t.re<n.re?-1:t.im>n.im?1:t.im<n.im?-1:0},Uu.a),{isClass:!0});function Cu(t){var n=0,e=1,r=Object.create(null),i=Object.create(null),u=0,M=function(t){var M=i[t];if(M&&(delete r[M],delete i[t],--n,e===M)){if(!n)return u=0,void(e=1);for(;!Object.prototype.hasOwnProperty.call(r,++e););}};return t=Math.abs(t),{hit:function(N){var o=i[N],c=++u;if(r[c]=N,i[N]=c,!o){if(++n<=t)return;return N=r[e],M(N),N}if(delete r[o],e===o)for(;!Object.prototype.hasOwnProperty.call(r,++e););},delete:M,clear:function(){n=u=0,e=1,r=Object.create(null),i=Object.create(null)}}}function Qu(t){var{hasher:n,limit:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e=null==e?Number.POSITIVE_INFINITY:e,n=null==n?JSON.stringify:n,function r(){"object"!=typeof r.cache&&(r.cache={values:new Map,lru:Cu(e||Number.POSITIVE_INFINITY)});for(var i=[],u=0;u<arguments.length;u++)i[u]=arguments[u];var M=n(i);if(r.cache.values.has(M))return r.cache.lru.hit(M),r.cache.values.get(M);var N=t.apply(t,i);return r.cache.values.set(M,N),r.cache.values.delete(r.cache.lru.hit(M)),N}}function wu(t){return Object.keys(t.signatures||{}).reduce((function(t,n){var e=(n.match(/,/g)||[]).length+1;return Math.max(t,e)}),-1)}Qu((function(t){return new t(1).exp()}),{hasher:Lu}),Qu((function(t){return new t(1).plus(new t(5).sqrt()).div(2)}),{hasher:Lu});var Su=Qu((function(t){return t.acos(-1)}),{hasher:Lu});Qu((function(t){return Su(t).times(2)}),{hasher:Lu});function Lu(t){return t[0].precision}Math.PI,Math.PI,Math.E;ku("fineStructure",.0072973525693),ku("weakMixingAngle",.2229),ku("efimovFactor",22.7),ku("sackurTetrode",-1.16487052358);function ku(t,n){return xu(t,["config","BigNumber"],t=>{var{config:e,BigNumber:r}=t;return"BigNumber"===e.number?new r(n):n})}var vu=e(16),Yu=e.n(vu),mu=xu("Fraction",[],()=>(Object.defineProperty(Yu.a,"name",{value:"Fraction"}),Yu.a.prototype.constructor=Yu.a,Yu.a.prototype.type="Fraction",Yu.a.prototype.isFraction=!0,Yu.a.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Yu.a.fromJSON=function(t){return new Yu.a(t)},Yu.a),{isClass:!0}),Fu=xu("Matrix",[],()=>{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,n){throw new Error("Cannot invoke create on a Matrix interface")},t.prototype.subset=function(t,n,e){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,n,e){throw new Error("Cannot invoke set on a Matrix interface")},t.prototype.resize=function(t,n){throw new Error("Cannot invoke resize on a Matrix interface")},t.prototype.reshape=function(t,n){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,n){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[Symbol.iterator]=function(){throw new Error("Cannot iterate 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}),Ru=xu("DenseMatrix",["Matrix"],t=>{var{Matrix:n}=t;function e(t,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");if(n&&!ce(n))throw new Error("Invalid datatype: "+n);if(De(t))"DenseMatrix"===t.type?(this._data=We(t._data),this._size=We(t._size),this._datatype=n||t._datatype):(this._data=t.toArray(),this._size=t.size(),this._datatype=n||t._datatype);else if(t&&ae(t.data)&&ae(t.size))this._data=t.data,this._size=t.size,cu(this._data,this._size),this._datatype=n||t.datatype;else if(ae(t))this._data=N(t),this._size=ou(this._data),cu(this._data,this._size),this._datatype=n;else{if(t)throw new TypeError("Unsupported type of data ("+Ve(t)+")");this._data=[],this._size=[0],this._datatype=n}}function r(t,n){if(!Ie(n))throw new TypeError("Invalid index");if(n.isScalar())return t.get(n.min());var r=n.size();if(r.length!==t._size.length)throw new Mu(r.length,t._size.length);for(var i=n.min(),u=n.max(),M=0,N=t._size.length;M<N;M++)au(i[M],t._size[M]),au(u[M],t._size[M]);return new e(function t(n,e,r,i){var u=i===r-1,M=e.dimension(i);return u?M.map((function(t){return au(t,n.length),n[t]})).valueOf():M.map((function(u){au(u,n.length);var M=n[u];return t(M,e,r,i+1)})).valueOf()}(t._data,n,r.length,0),t._datatype)}function i(t,n,e,r){if(!n||!0!==n.isIndex)throw new TypeError("Invalid index");var i,u=n.size(),N=n.isScalar();if(De(e)?(i=e.size(),e=e.valueOf()):i=ou(e),N){if(0!==i.length)throw new TypeError("Scalar expected");t.set(n.min(),e,r)}else{if(!Pe(i,u))try{i=ou(e=0===i.length?Au([e],u):Au(e,u))}catch(t){}if(u.length<t._size.length)throw new Mu(u.length,t._size.length,"<");if(i.length<u.length){for(var o=0,c=0;1===u[o]&&1===i[o];)o++;for(;1===u[o];)c++,o++;e=lu(e,u.length,c,i)}if(!Pe(u,i))throw new Mu(u,i,">");M(t,n.max().map((function(t){return t+1})),r);var a=u.length;!function t(n,e,r,i,u){var M=u===i-1,N=e.dimension(u);M?N.forEach((function(t,e){au(t),n[t]=r[e[0]]})):N.forEach((function(M,N){au(M),t(n[M],e,r[N[0]],i,u+1)}))}(t._data,n,e,a,0)}return t}function u(t,n,e){if(0===n.length){for(var r=t._data;ae(r);)r=r[0];return r}return t._size=n.slice(0),t._data=Du(t._data,t._size,e),t}function M(t,n,e){for(var r=t._size.slice(0),i=!1;r.length<n.length;)r.push(0),i=!0;for(var M=0,N=n.length;M<N;M++)n[M]>r[M]&&(r[M]=n[M],i=!0);i&&u(t,r,e)}function N(t){return De(t)?N(t.valueOf()):ae(t)?t.map(N):t}return e.prototype=new n,e.prototype.createDenseMatrix=function(t,n){return new e(t,n)},Object.defineProperty(e,"name",{value:"DenseMatrix"}),e.prototype.constructor=e,e.prototype.type="DenseMatrix",e.prototype.isDenseMatrix=!0,e.prototype.getDataType=function(){return ju(this._data,Ve)},e.prototype.storage=function(){return"dense"},e.prototype.datatype=function(){return this._datatype},e.prototype.create=function(t,n){return new e(t,n)},e.prototype.subset=function(t,n,e){switch(arguments.length){case 1:return r(this,t);case 2:case 3:return i(this,t,n,e);default:throw new SyntaxError("Wrong number of arguments")}},e.prototype.get=function(t){if(!ae(t))throw new TypeError("Array expected");if(t.length!==this._size.length)throw new Mu(t.length,this._size.length);for(var n=0;n<t.length;n++)au(t[n],this._size[n]);for(var e=this._data,r=0,i=t.length;r<i;r++){var u=t[r];au(u,e.length),e=e[u]}return e},e.prototype.set=function(t,n,e){if(!ae(t))throw new TypeError("Array expected");if(t.length<this._size.length)throw new Mu(t.length,this._size.length,"<");var r,i,u;M(this,t.map((function(t){return t+1})),e);var N=this._data;for(r=0,i=t.length-1;r<i;r++)au(u=t[r],N.length),N=N[u];return au(u=t[t.length-1],N.length),N[u]=n,this},e.prototype.resize=function(t,n,e){if(!se(t))throw new TypeError("Array or Matrix expected");var r=t.valueOf().map(t=>Array.isArray(t)&&1===t.length?t[0]:t);return u(e?this.clone():this,r,n)},e.prototype.reshape=function(t,n){var e=n?this.clone():this;e._data=su(e._data,t);var r=e._size.reduce((t,n)=>t*n);return e._size=Tu(t,r),e},e.prototype.clone=function(){return new e({data:We(this._data),size:We(this._size),datatype:this._datatype})},e.prototype.size=function(){return this._size.slice(0)},e.prototype.map=function(t){var n=this,r=wu(t),i=function e(i,u){return ae(i)?i.map((function(t,n){return e(t,u.concat(n))})):1===r?t(i):2===r?t(i,u):t(i,u,n)}(this._data,[]);return new e(i,void 0!==this._datatype?ju(i,Ve):void 0)},e.prototype.forEach=function(t){var n=this;!function e(r,i){ae(r)?r.forEach((function(t,n){e(t,i.concat(n))})):t(r,i,n)}(this._data,[])},e.prototype[Symbol.iterator]=function*(){yield*function*t(n,e){if(ae(n))for(var r=0;r<n.length;r++)yield*t(n[r],e.concat(r));else yield{value:n,index:e}}(this._data,[])},e.prototype.rows=function(){var t=[];if(2!==this.size().length)throw new TypeError("Rows can only be returned for a 2D matrix.");var n=this._data;for(var r of n)t.push(new e([r],this._datatype));return t},e.prototype.columns=function(){var t=this,n=[],r=this.size();if(2!==r.length)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,u=function(r){var u=i.map(t=>[t[r]]);n.push(new e(u,t._datatype))},M=0;M<r[1];M++)u(M);return n},e.prototype.toArray=function(){return We(this._data)},e.prototype.valueOf=function(){return this._data},e.prototype.format=function(t){return eu(this._data,t)},e.prototype.toString=function(){return eu(this._data)},e.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},e.prototype.diagonal=function(t){if(t){if(ue(t)&&(t=t.toNumber()),!ie(t)||!Qi(t))throw new TypeError("The parameter k must be an integer number")}else t=0;for(var n=t>0?t:0,r=t<0?-t:0,i=this._size[0],u=this._size[1],M=Math.min(i-r,u-n),N=[],o=0;o<M;o++)N[o]=this._data[o+r][o+n];return new e({data:N,size:[M],datatype:this._datatype})},e.diagonal=function(t,n,r,i){if(!ae(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(ue(t)&&(t=t.toNumber()),!ie(t)||!Qi(t)||t<1)throw new Error("Size values must be positive integers");return t})),r){if(ue(r)&&(r=r.toNumber()),!ie(r)||!Qi(r))throw new TypeError("The parameter k must be an integer number")}else r=0;var u,M=r>0?r:0,N=r<0?-r:0,o=t[0],c=t[1],a=Math.min(o-N,c-M);if(ae(n)){if(n.length!==a)throw new Error("Invalid value array length");u=function(t){return n[t]}}else if(De(n)){var D=n.size();if(1!==D.length||D[0]!==a)throw new Error("Invalid matrix length");u=function(t){return n.get([t])}}else u=function(){return n};i||(i=ue(u(0))?u(0).mul(0):0);var s=[];if(t.length>0){s=Du(s,t,i);for(var T=0;T<a;T++)s[T+N][T+M]=u(T)}return new e({data:s,size:[o,c]})},e.fromJSON=function(t){return new e(t)},e.prototype.swapRows=function(t,n){if(!(ie(t)&&Qi(t)&&ie(n)&&Qi(n)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return au(t,this._size[0]),au(n,this._size[0]),e._swapRows(t,n,this._data),this},e._swapRows=function(t,n,e){var r=e[t];e[t]=e[n],e[n]=r},e},{isClass:!0});function bu(){return!0}function Bu(){return!1}function Zu(){}var Vu=function t(){function n(t){return"object"==typeof t&&null!==t&&t.constructor===Object}const e=[{name:"number",test:function(t){return"number"==typeof t}},{name:"string",test:function(t){return"string"==typeof t}},{name:"boolean",test:function(t){return"boolean"==typeof t}},{name:"Function",test:function(t){return"function"==typeof t}},{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:n},{name:"null",test:function(t){return null===t}},{name:"undefined",test:function(t){return void 0===t}}],r={name:"any",test:bu,isAny:!0};let i,u,M=0,N={createCount:0};function o(t){const n=i.get(t);if(n)return n;let e='Unknown type "'+t+'"';const r=t.toLowerCase();let M;for(M of u)if(M.toLowerCase()===r){e+='. Did you mean "'+M+'" ?';break}throw new TypeError(e)}function c(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any";const e=n?o(n).index:u.length,r=[];for(let n=0;n<t.length;++n){if(!t[n]||"string"!=typeof t[n].name||"function"!=typeof t[n].test)throw new TypeError("Object with properties {name: string, test: function} expected");const u=t[n].name;if(i.has(u))throw new TypeError('Duplicate type name "'+u+'"');r.push(u),i.set(u,{name:u,test:t[n].test,isAny:t[n].isAny,index:e+n,conversionsTo:[]})}const M=u.slice(e);u=u.slice(0,e).concat(r).concat(M);for(let t=e+r.length;t<u.length;++t)i.get(u[t]).index=t}function a(){i=new Map,u=[],M=0,c([r],!1)}function D(t){const n=u.filter(n=>{const e=i.get(n);return!e.isAny&&e.test(t)});return n.length?n:["any"]}function s(t){return t&&"function"==typeof t&&"_typedFunctionData"in t}function T(t,n,e){if(!s(t))throw new TypeError("Argument is not a typed-function.");const r=e&&e.exact,i=y(Array.isArray(n)?n.join(","):n),u=g(i);if(!r||u in t.signatures){const n=t._typedFunctionData.signatureMap.get(u);if(n)return n}const M=i.length;let N,o;if(r){let n;for(n in N=[],t.signatures)N.push(t._typedFunctionData.signatureMap.get(n))}else N=t._typedFunctionData.signatures;for(let t=0;t<M;++t){const n=i[t],e=[];let r;for(r of N){const i=A(r.params,t);if(i&&(!n.restParam||i.restParam)){if(!i.hasAny){const t=j(i);if(n.types.some(n=>!t.has(n.name)))continue}e.push(r)}}if(N=e,0===N.length)break}for(o of N)if(o.params.length<=M)return o;throw new TypeError("Signature not found (signature: "+(t.name||"unnamed")+"("+g(i,", ")+"))")}function g(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return t.map(t=>t.name).join(n)}function l(t){const n=0===t.indexOf("..."),e=(n?t.length>3?t.slice(3):"any":t).split("|").map(t=>o(t.trim()));let r=!1,i=n?"...":"";return{types:e.map((function(t){return r=t.isAny||r,i+=t.name+"|",{name:t.name,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:null,conversionIndex:-1}})),name:i.slice(0,-1),hasAny:r,hasConversion:!1,restParam:n}}function I(t){const n=function(t){if(0===t.length)return[];const n=t.map(o);t.length>1&&n.sort((t,n)=>t.index-n.index);let e=n[0].conversionsTo;if(1===t.length)return e;e=e.concat([]);const r=new Set(t);for(let t=1;t<n.length;++t){let i;for(i of n[t].conversionsTo)r.has(i.from)||(e.push(i),r.add(i.from))}return e}(t.types.map(t=>t.name));let e=t.hasAny,r=t.name;const i=n.map((function(t){const n=o(t.from);return e=n.isAny||e,r+="|"+t.from,{name:t.from,typeIndex:n.index,test:n.test,isAny:n.isAny,conversion:t,conversionIndex:t.index}}));return{types:t.types.concat(i),name:r,hasAny:e,hasConversion:i.length>0,restParam:t.restParam}}function j(t){return t.typeSet||(t.typeSet=new Set,t.types.forEach(n=>t.typeSet.add(n.name))),t.typeSet}function y(t){const n=[];if("string"!=typeof t)throw new TypeError("Signatures must be strings");const e=t.trim();if(""===e)return n;const r=e.split(",");for(let t=0;t<r.length;++t){const e=l(r[t].trim());if(e.restParam&&t!==r.length-1)throw new SyntaxError('Unexpected rest parameter "'+r[t]+'": only allowed for the last parameter');if(0===e.types.length)return null;n.push(e)}return n}function h(t){const n=b(t);return!!n&&n.restParam}function z(t){if(t&&0!==t.types.length){if(1===t.types.length)return o(t.types[0].name).test;if(2===t.types.length){const n=o(t.types[0].name).test,e=o(t.types[1].name).test;return function(t){return n(t)||e(t)}}{const n=t.types.map((function(t){return o(t.name).test}));return function(t){for(let e=0;e<n.length;e++)if(n[e](t))return!0;return!1}}}return bu}function O(t){let n,e,r;if(h(t)){n=R(t).map(z);const e=n.length,r=z(b(t)),i=function(t){for(let n=e;n<t.length;n++)if(!r(t[n]))return!1;return!0};return function(t){for(let e=0;e<n.length;e++)if(!n[e](t[e]))return!1;return i(t)&&t.length>=e+1}}return 0===t.length?function(t){return 0===t.length}:1===t.length?(e=z(t[0]),function(t){return e(t[0])&&1===t.length}):2===t.length?(e=z(t[0]),r=z(t[1]),function(t){return e(t[0])&&r(t[1])&&2===t.length}):(n=t.map(z),function(t){for(let e=0;e<n.length;e++)if(!n[e](t[e]))return!1;return t.length===n.length})}function A(t,n){return n<t.length?t[n]:h(t)?b(t):null}function x(t,n){const e=A(t,n);return e?j(e):new Set}function E(t){return null===t.conversion||void 0===t.conversion}function f(t,n){const e=new Set;return t.forEach(t=>{const r=x(t.params,n);let i;for(i of r)e.add(i)}),e.has("any")?["any"]:Array.from(e)}function p(t,n,e){let r,i;const u=t||"unnamed";let M,N=e;for(M=0;M<n.length;M++){const t=[];if(N.forEach(e=>{const r=z(A(e.params,M));(M<e.params.length||h(e.params))&&r(n[M])&&t.push(e)}),0===t.length){if(i=f(N,M),i.length>0){const t=D(n[M]);return r=new TypeError("Unexpected type of argument in function "+u+" (expected: "+i.join(" or ")+", actual: "+t.join(" | ")+", index: "+M+")"),r.data={category:"wrongType",fn:u,index:M,actual:t,expected:i},r}}else N=t}const o=N.map((function(t){return h(t.params)?1/0:t.params.length}));if(n.length<Math.min.apply(null,o))return i=f(N,M),r=new TypeError("Too few arguments in function "+u+" (expected: "+i.join(" or ")+", index: "+n.length+")"),r.data={category:"tooFewArgs",fn:u,index:n.length,expected:i},r;const c=Math.max.apply(null,o);if(n.length>c)return r=new TypeError("Too many arguments in function "+u+" (expected: "+c+", actual: "+n.length+")"),r.data={category:"tooManyArgs",fn:u,index:n.length,expectedLength:c},r;const a=[];for(let t=0;t<n.length;++t)a.push(D(n[t]).join("|"));return r=new TypeError('Arguments of type "'+a.join(", ")+'" do not match any of the defined signatures of function '+u+"."),r.data={category:"mismatch",actual:a},r}function U(t){let n=u.length+1;for(let e=0;e<t.types.length;e++)E(t.types[e])&&(n=Math.min(n,t.types[e].typeIndex));return n}function d(t){let n=M+1;for(let e=0;e<t.types.length;e++)E(t.types[e])||(n=Math.min(n,t.types[e].conversionIndex));return n}function C(t,n){if(t.hasAny){if(!n.hasAny)return 1}else if(n.hasAny)return-1;if(t.restParam){if(!n.restParam)return 1}else if(n.restParam)return-1;if(t.hasConversion){if(!n.hasConversion)return 1}else if(n.hasConversion)return-1;const e=U(t)-U(n);if(e<0)return-1;if(e>0)return 1;const r=d(t)-d(n);return r<0?-1:r>0?1:0}function Q(t,n){const e=t.params,r=n.params,i=b(e),u=b(r),M=h(e),N=h(r);if(M&&i.hasAny){if(!N||!u.hasAny)return 1}else if(N&&u.hasAny)return-1;let o,c=0,a=0;for(o of e)o.hasAny&&++c,o.hasConversion&&++a;let D=0,s=0;for(o of r)o.hasAny&&++D,o.hasConversion&&++s;if(c!==D)return c-D;if(M&&i.hasConversion){if(!N||!u.hasConversion)return 1}else if(N&&u.hasConversion)return-1;if(a!==s)return a-s;if(M){if(!N)return 1}else if(N)return-1;const T=(e.length-r.length)*(M?-1:1);if(0!==T)return T;const g=[];let l,I=0;for(let t=0;t<e.length;++t){const n=C(e[t],r[t]);g.push(n),I+=n}if(0!==I)return I;for(l of g)if(0!==l)return l;return 0}function w(t,n){let e=n;if(t.some(t=>t.hasConversion)){const r=h(t),i=t.map(S);e=function(){const t=[],e=r?arguments.length-1:arguments.length;for(let n=0;n<e;n++)t[n]=i[n](arguments[n]);return r&&(t[e]=arguments[e].map(i[e])),n.apply(this,t)}}let r=e;if(h(t)){const n=t.length-1;r=function(){return e.apply(this,B(arguments,0,n).concat([B(arguments,n)]))}}return r}function S(t){let n,e,r,i;const u=[],M=[];switch(t.types.forEach((function(t){t.conversion&&(u.push(o(t.conversion.from).test),M.push(t.conversion.convert))})),M.length){case 0:return function(t){return t};case 1:return n=u[0],r=M[0],function(t){return n(t)?r(t):t};case 2:return n=u[0],e=u[1],r=M[0],i=M[1],function(t){return n(t)?r(t):e(t)?i(t):t};default:return function(t){for(let n=0;n<M.length;n++)if(u[n](t))return M[n](t);return t}}}function L(t){return function t(n,e,r){if(e<n.length){const M=n[e];let N=[];if(M.restParam){const t=M.types.filter(E);t.length<M.types.length&&N.push({types:t,name:"..."+t.map(t=>t.name).join("|"),hasAny:t.some(t=>t.isAny),hasConversion:!1,restParam:!0}),N.push(M)}else N=M.types.map((function(t){return{types:[t],name:t.name,hasAny:t.isAny,hasConversion:t.conversion,restParam:!1}}));return i=N,u=function(i){return t(n,e+1,r.concat([i]))},Array.prototype.concat.apply([],i.map(u))}return[r];var i,u}(t,0,[])}function k(t,n){const e=Math.max(t.length,n.length);for(let r=0;r<e;r++){const e=x(t,r),i=x(n,r);let u,M=!1;for(u of i)if(e.has(u)){M=!0;break}if(!M)return!1}const r=t.length,i=n.length,u=h(t),M=h(n);return u?M?r===i:i>=r:M?r>=i:r===i}function v(t,n,e){const r=[];let i;for(i of t){let t=e[i];if("number"!=typeof t)throw new TypeError('No definition for referenced signature "'+i+'"');if(t=n[t],"function"!=typeof t)return!1;r.push(t)}return r}function Y(t,n,e){const r=function(t){return t.map(t=>G(t)?V(t.referToSelf.callback):W(t)?Z(t.referTo.references,t.referTo.callback):t)}(t),i=new Array(r.length).fill(!1);let u=!0;for(;u;){u=!1;let t=!0;for(let M=0;M<r.length;++M){if(i[M])continue;const N=r[M];if(G(N))r[M]=N.referToSelf.callback(e),r[M].referToSelf=N.referToSelf,i[M]=!0,t=!1;else if(W(N)){const e=v(N.referTo.references,r,n);e?(r[M]=N.referTo.callback.apply(this,e),r[M].referTo=N.referTo,i[M]=!0,t=!1):u=!0}}if(t&&u)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return r}function m(t,n){if(N.createCount++,0===Object.keys(n).length)throw new SyntaxError("No signatures provided");N.warnAgainstDeprecatedThis&&function(t){const n=/\bthis(\(|\.signatures\b)/;Object.keys(t).forEach(e=>{const r=t[e];if(n.test(r.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}(n);const e=[],r=[],i={},u=[];let M;for(M in n){if(!Object.prototype.hasOwnProperty.call(n,M))continue;const t=y(M);if(!t)continue;e.forEach((function(n){if(k(n,t))throw new TypeError('Conflicting signatures "'+g(n)+'" and "'+g(t)+'".')})),e.push(t);const N=r.length;r.push(n[M]);const o=t.map(I);let c;for(c of L(o)){const t=g(c);u.push({params:c,name:t,fn:N}),c.every(t=>!t.hasConversion)&&(i[t]=N)}}u.sort(Q);const o=Y(r,i,ut);let c;for(c in i)Object.prototype.hasOwnProperty.call(i,c)&&(i[c]=o[i[c]]);const a=[],D=new Map;for(c of u)D.has(c.name)||(c.fn=o[c.fn],a.push(c),D.set(c.name,c));const s=a[0]&&a[0].params.length<=2&&!h(a[0].params),T=a[1]&&a[1].params.length<=2&&!h(a[1].params),l=a[2]&&a[2].params.length<=2&&!h(a[2].params),j=a[3]&&a[3].params.length<=2&&!h(a[3].params),A=a[4]&&a[4].params.length<=2&&!h(a[4].params),x=a[5]&&a[5].params.length<=2&&!h(a[5].params),E=s&&T&&l&&j&&A&&x;for(let t=0;t<a.length;++t)a[t].test=O(a[t].params);const f=s?z(a[0].params[0]):Bu,p=T?z(a[1].params[0]):Bu,U=l?z(a[2].params[0]):Bu,d=j?z(a[3].params[0]):Bu,C=A?z(a[4].params[0]):Bu,S=x?z(a[5].params[0]):Bu,v=s?z(a[0].params[1]):Bu,m=T?z(a[1].params[1]):Bu,F=l?z(a[2].params[1]):Bu,R=j?z(a[3].params[1]):Bu,b=A?z(a[4].params[1]):Bu,B=x?z(a[5].params[1]):Bu;for(let t=0;t<a.length;++t)a[t].implementation=w(a[t].params,a[t].fn);const Z=s?a[0].implementation:Zu,V=T?a[1].implementation:Zu,W=l?a[2].implementation:Zu,G=j?a[3].implementation:Zu,P=A?a[4].implementation:Zu,J=x?a[5].implementation:Zu,H=s?a[0].params.length:-1,X=T?a[1].params.length:-1,K=l?a[2].params.length:-1,q=j?a[3].params.length:-1,_=A?a[4].params.length:-1,$=x?a[5].params.length:-1,tt=E?6:0,nt=a.length,et=a.map(t=>t.test),rt=a.map(t=>t.implementation),it=function(){for(let t=tt;t<nt;t++)if(et[t](arguments))return rt[t].apply(this,arguments);return N.onMismatch(t,arguments,a)};function ut(t,n){return arguments.length===H&&f(t)&&v(n)?Z.apply(this,arguments):arguments.length===X&&p(t)&&m(n)?V.apply(this,arguments):arguments.length===K&&U(t)&&F(n)?W.apply(this,arguments):arguments.length===q&&d(t)&&R(n)?G.apply(this,arguments):arguments.length===_&&C(t)&&b(n)?P.apply(this,arguments):arguments.length===$&&S(t)&&B(n)?J.apply(this,arguments):it.apply(this,arguments)}try{Object.defineProperty(ut,"name",{value:t})}catch(t){}return ut.signatures=i,ut._typedFunctionData={signatures:a,signatureMap:D},ut}function F(t,n,e){throw p(t,n,e)}function R(t){return B(t,0,t.length-1)}function b(t){return t[t.length-1]}function B(t,n,e){return Array.prototype.slice.call(t,n,e)}function Z(t,n){return{referTo:{references:t,callback:n}}}function V(t){if("function"!=typeof t)throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:t}}}function W(t){return t&&"object"==typeof t.referTo&&Array.isArray(t.referTo.references)&&"function"==typeof t.referTo.callback}function G(t){return t&&"object"==typeof t.referToSelf&&"function"==typeof t.referToSelf.callback}function P(t,n){if(!t)return n;if(n&&n!==t){const e=new Error("Function names do not match (expected: "+t+", actual: "+n+")");throw e.data={actual:n,expected:t},e}return t}function J(t){let n;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(s(t[e])||"string"==typeof t[e].signature)&&(n=P(n,t[e].name));return n}function H(t,n){let e;for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){if(e in t&&n[e]!==t[e]){const r=new Error('Signature "'+e+'" is defined twice');throw r.data={signature:e,sourceFunction:n[e],destFunction:t[e]},r}t[e]=n[e]}}a(),c(e);const X=N;function K(t){if(!t||"string"!=typeof t.from||"string"!=typeof t.to||"function"!=typeof t.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(t.to===t.from)throw new SyntaxError('Illegal to define conversion from "'+t.from+'" to itself.')}return N=function(t){const e="string"==typeof t,r=e?1:0;let i=e?t:"";const u={};for(let t=r;t<arguments.length;++t){const r=arguments[t];let M,N={};if("function"==typeof r?(M=r.name,"string"==typeof r.signature?N[r.signature]=r:s(r)&&(N=r.signatures)):n(r)&&(N=r,e||(M=J(r))),0===Object.keys(N).length){const n=new TypeError("Argument to 'typed' at index "+t+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw n.data={index:t,argument:r},n}e||(i=P(i,M)),H(u,N)}return m(i||"",u)},N.create=t,N.createCount=X.createCount,N.onMismatch=F,N.throwMismatchError=F,N.createError=p,N.clear=a,N.clearConversions=function(){let t;for(t of u)i.get(t).conversionsTo=[];M=0},N.addTypes=c,N._findType=o,N.referTo=function(){const t=R(arguments).map(t=>g(y(t))),n=b(arguments);if("function"!=typeof n)throw new TypeError("Callback function expected as last argument");return Z(t,n)},N.referToSelf=V,N.convert=function(t,n){const e=o(n);if(e.test(t))return t;const r=e.conversionsTo;if(0===r.length)throw new Error("There are no conversions to "+n+" defined.");for(let n=0;n<r.length;n++){if(o(r[n].from).test(t))return r[n].convert(t)}throw new Error("Cannot convert "+t+" to "+n)},N.findSignature=T,N.find=function(t,n,e){return T(t,n,e).implementation},N.isTypedFunction=s,N.warnAgainstDeprecatedThis=!0,N.addType=function(t,n){let e="any";!1!==n&&i.has("Object")&&(e="Object"),N.addTypes([t],e)},N.addConversion=function(t){K(t);const n=o(t.to);if(!n.conversionsTo.every((function(n){return n.from!==t.from})))throw new Error('There is already a conversion from "'+t.from+'" to "'+n.name+'"');n.conversionsTo.push({from:t.from,convert:t.convert,index:M++})},N.addConversions=function(t){t.forEach(N.addConversion)},N.removeConversion=function(t){K(t);const n=o(t.to),e=function(t,n){for(let e=0;e<t.length;e++)if(n(t[e]))return t[e]}(n.conversionsTo,n=>n.from===t.from);if(!e)throw new Error("Attempt to remove nonexistent conversion from "+t.from+" to "+t.to);if(e.convert!==t.convert)throw new Error("Conversion to remove does not match existing conversion");const r=n.conversionsTo.indexOf(e);n.conversionsTo.splice(r,1)},N.resolve=function(t,n){if(!s(t))throw new TypeError("Argument is not a typed-function.");const e=t._typedFunctionData.signatures;for(let t=0;t<e.length;++t)if(e[t].test(n))return e[t];return null},N}();function Wu(t,n){if(Hu(t)&&Pu(t,n))return t[n];if("function"==typeof t[n]&&Ju(t,n))throw new Error('Cannot access method "'+n+'" as a property');throw new Error('No access to property "'+n+'"')}function Gu(t,n,e){if(Hu(t)&&Pu(t,n))return t[n]=e,e;throw new Error('No access to property "'+n+'"')}function Pu(t,n){return!(!t||"object"!=typeof t)&&(!!Je(Xu,n)||!(n in Object.prototype)&&!(n in Function.prototype))}function Ju(t,n){return null!=t&&"function"==typeof t[n]&&(!(Je(t,n)&&Object.getPrototypeOf&&n in Object.getPrototypeOf(t))&&(!!Je(Ku,n)||!(n in Object.prototype)&&!(n in Function.prototype)))}function Hu(t){return"object"==typeof t&&t&&t.constructor===Object}var Xu={length:!0,name:!0},Ku={toString:!0,valueOf:!0,toLocaleString:!0};class qu{constructor(t){this.wrappedObject=t,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(t){return Wu(this.wrappedObject,t)}set(t,n){return Gu(this.wrappedObject,t,n),this}has(t){return n=this.wrappedObject,t in n;var n}entries(){return _u(this.keys(),t=>[t,this.get(t)])}forEach(t){for(var n of this.keys())t(this.get(n),n,this)}delete(t){delete this.wrappedObject[t]}clear(){for(var t of this.keys())this.delete(t)}get size(){return Object.keys(this.wrappedObject).length}}function _u(t,n){return{next:()=>{var e=t.next();return e.done?e:{value:n(e.value),done:!1}}}}function $u(t){return!!t&&(t instanceof Map||t instanceof qu||"function"==typeof t.set&&"function"==typeof t.get&&"function"==typeof t.keys&&"function"==typeof t.has)}var tM=function(){return tM=Vu.create,Vu},nM=xu("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],(function(t){var{BigNumber:n,Complex:e,DenseMatrix:r,Fraction:i}=t,u=tM();return u.clear(),u.addTypes([{name:"number",test:ie},{name:"Complex",test:Me},{name:"BigNumber",test:ue},{name:"Fraction",test:Ne},{name:"Unit",test:oe},{name:"identifier",test:t=>ce&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(t)},{name:"string",test:ce},{name:"Chain",test:Ze},{name:"Array",test:ae},{name:"Matrix",test:De},{name:"DenseMatrix",test:Te},{name:"SparseMatrix",test:ge},{name:"Range",test:le},{name:"Index",test:Ie},{name:"boolean",test:je},{name:"ResultSet",test:ye},{name:"Help",test:he},{name:"function",test:ze},{name:"Date",test:Oe},{name:"RegExp",test:Ae},{name:"null",test:Ee},{name:"undefined",test:fe},{name:"AccessorNode",test:pe},{name:"ArrayNode",test:Ue},{name:"AssignmentNode",test:de},{name:"BlockNode",test:Ce},{name:"ConditionalNode",test:Qe},{name:"ConstantNode",test:we},{name:"FunctionNode",test:Le},{name:"FunctionAssignmentNode",test:Se},{name:"IndexNode",test:ke},{name:"Node",test:ve},{name:"ObjectNode",test:Ye},{name:"OperatorNode",test:me},{name:"ParenthesisNode",test:Fe},{name:"RangeNode",test:Re},{name:"RelationalNode",test:be},{name:"SymbolNode",test:Be},{name:"Map",test:$u},{name:"Object",test:xe}]),u.addConversions([{from:"number",to:"BigNumber",convert:function(t){if(n||eM(t),t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)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 n(t)}},{from:"number",to:"Complex",convert:function(t){return e||rM(t),new e(t,0)}},{from:"BigNumber",to:"Complex",convert:function(t){return e||rM(t),new e(t.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(t){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 e||rM(t),new e(t.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(t){i||iM(t);var n=new i(t);if(n.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 n}},{from:"string",to:"number",convert:function(t){var n=Number(t);if(isNaN(n))throw new Error('Cannot convert "'+t+'" to a number');return n}},{from:"string",to:"BigNumber",convert:function(t){n||eM(t);try{return new n(t)}catch(n){throw new Error('Cannot convert "'+t+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(t){i||iM(t);try{return new i(t)}catch(n){throw new Error('Cannot convert "'+t+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(t){e||rM(t);try{return new e(t)}catch(n){throw new Error('Cannot convert "'+t+'" to Complex')}}},{from:"boolean",to:"number",convert:function(t){return+t}},{from:"boolean",to:"BigNumber",convert:function(t){return n||eM(t),new n(+t)}},{from:"boolean",to:"Fraction",convert:function(t){return i||iM(t),new i(+t)}},{from:"boolean",to:"string",convert:function(t){return String(t)}},{from:"Array",to:"Matrix",convert:function(t){return r||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new r(t)}},{from:"Matrix",to:"Array",convert:function(t){return t.valueOf()}}]),u.onMismatch=(t,n,e)=>{var r=u.createError(t,n,e);if(["wrongType","mismatch"].includes(r.data.category)&&1===n.length&&se(n[0])&&e.some(t=>!t.params.includes(","))){var i=new TypeError("Function '".concat(t,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(t,")'."));throw i.data=r.data,i}throw r},u.onMismatch=(t,n,e)=>{var r=u.createError(t,n,e);if(["wrongType","mismatch"].includes(r.data.category)&&1===n.length&&se(n[0])&&e.some(t=>!t.params.includes(","))){var i=new TypeError("Function '".concat(t,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(t,")'."));throw i.data=r.data,i}throw r},u}));function eM(t){throw new Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function rM(t){throw new Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function iM(t){throw new Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}function uM(t,n,e){return t&&"function"==typeof t.map?t.map((function(t){return uM(t,n,e)})):n(t)}var MM="number",NM="number, number";function oM(t){return Math.abs(t)}function cM(t,n){return t+n}function aM(t,n){return t-n}function DM(t,n){return t*n}function sM(t){return-t}function TM(t){return t}function gM(t){return ki(t)}function lM(t){return t*t*t}function IM(t){return Math.exp(t)}function jM(t){return vi(t)}function yM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Parameters in function lcm must be integer numbers");if(0===t||0===n)return 0;for(var e,r=t*n;0!==n;)n=t%(e=n),t=e;return Math.abs(r/t)}function hM(t){return Li(t)}function zM(t){return Si(t)}function OM(t){return wi(t)}function AM(t){return t*t}function xM(t,n){var e,r,i,u=0,M=1,N=1,o=0;if(!Qi(t)||!Qi(n))throw new Error("Parameters in function xgcd must be integer numbers");for(;n;)i=t-(r=Math.floor(t/n))*n,e=u,u=M-r*u,M=e,e=N,N=o-r*N,o=e,t=n,n=i;return t<0?[-t,-M,-o]:[t,t?M:0,o]}function EM(t,n){return t*t<1&&n===1/0||t*t>1&&n===-1/0?0:Math.pow(t,n)}oM.signature=MM,cM.signature=NM,aM.signature=NM,DM.signature=NM,sM.signature=MM,TM.signature=MM,gM.signature=MM,lM.signature=MM,IM.signature=MM,jM.signature=MM,yM.signature=NM,hM.signature=MM,zM.signature=MM,OM.signature=MM,AM.signature=MM,xM.signature=NM,EM.signature=NM;function fM(t){return Pi(t)}function pM(t){return Math.atan(1/t)}function UM(t){return isFinite(t)?(Math.log((t+1)/t)+Math.log(t/(t-1)))/2:0}function dM(t){return Math.asin(1/t)}function CM(t){var n=1/t;return Math.log(n+Math.sqrt(n*n+1))}function QM(t){return Math.acos(1/t)}function wM(t){var n=1/t,e=Math.sqrt(n*n-1);return Math.log(e+n)}function SM(t){return Ji(t)}function LM(t){return Hi(t)}function kM(t){return 1/Math.tan(t)}function vM(t){var n=Math.exp(2*t);return(n+1)/(n-1)}function YM(t){return 1/Math.sin(t)}function mM(t){return 0===t?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(t)-Math.exp(-t)))*wi(t)}function FM(t){return 1/Math.cos(t)}function RM(t){return 2/(Math.exp(t)+Math.exp(-t))}function bM(t){return Xi(t)}fM.signature="number",pM.signature="number",UM.signature="number",dM.signature="number",CM.signature="number",QM.signature="number",wM.signature="number",SM.signature="number",LM.signature="number",kM.signature="number",vM.signature="number",YM.signature="number",mM.signature="number",FM.signature="number",RM.signature="number",bM.signature="number";var BM=xu("addScalar",["typed"],t=>{var{typed:n}=t;return n("addScalar",{"number, number":cM,"Complex, Complex":function(t,n){return t.add(n)},"BigNumber, BigNumber":function(t,n){return t.plus(n)},"Fraction, Fraction":function(t,n){return t.add(n)},"Unit, Unit":n.referToSelf(t=>(e,r)=>{if(null===e.value||void 0===e.value)throw new Error("Parameter x contains a unit with undefined value");if(null===r.value||void 0===r.value)throw new Error("Parameter y contains a unit with undefined value");if(!e.equalBase(r))throw new Error("Units do not match");var i=e.clone();return i.value=n.find(t,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i})})});var ZM="number, number";function VM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function bitAnd");return t&n}function WM(t){if(!Qi(t))throw new Error("Integer expected in function bitNot");return~t}function GM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function bitOr");return t|n}function PM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function bitXor");return t^n}function JM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function leftShift");return t<<n}function HM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function rightArithShift");return t>>n}function XM(t,n){if(!Qi(t)||!Qi(n))throw new Error("Integers expected in function rightLogShift");return t>>>n}VM.signature=ZM,WM.signature="number",GM.signature=ZM,PM.signature=ZM,JM.signature=ZM,HM.signature=ZM,XM.signature=ZM;function KM(t,n){if(n<t)return 1;if(n===t)return n;var e=n+t>>1;return KM(t,e)*KM(e+1,n)}function qM(t,n){if(!Qi(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(!Qi(n)||n<0)throw new TypeError("Positive integer value expected in function combinations");if(n>t)throw new TypeError("k must be less than or equal to n");for(var e=t-n,r=1,i=2,u=n<e?n:e,M=n<e?e+1:n+1;M<=t;++M)for(r*=M;i<=u&&r%i==0;)r/=i,++i;return i<=u&&(r/=KM(i,u)),r}qM.signature="number, number";var _M=xu("conj",["typed"],t=>{var{typed:n}=t;return n("conj",{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":n.referToSelf(t=>n=>uM(n,t))})});function $M(t,n,e){if(null==e)return t.eq(n);if(t.eq(n))return!0;if(t.isNaN()||n.isNaN())return!1;if(t.isFinite()&&n.isFinite()){var r=t.minus(n).abs();if(r.isZero())return!0;var i=t.constructor.max(t.abs(),n.abs());return r.lte(i.times(e))}return!1}var tN=xu("compareUnits",["typed"],t=>{var{typed:n}=t;return{"Unit, Unit":n.referToSelf(t=>(e,r)=>{if(!e.equalBase(r))throw new Error("Cannot compare units with different base");return n.find(t,[e.valueType(),r.valueType()])(e.value,r.value)})}}),nN=xu("equalScalar",["typed","config"],t=>{var{typed:n,config:e}=t;return n("equalScalar",{"boolean, boolean":function(t,n){return t===n},"number, number":function(t,n){return Gi(t,n,e.epsilon)},"BigNumber, BigNumber":function(t,n){return t.eq(n)||$M(t,n,e.epsilon)},"Fraction, Fraction":function(t,n){return t.equals(n)},"Complex, Complex":function(t,n){return function(t,n,e){return Gi(t.re,n.re,e)&&Gi(t.im,n.im,e)}(t,n,e.epsilon)}},tN({typed:n}))});xu("equalScalar",["typed","config"],t=>{var{typed:n,config:e}=t;return n("equalScalar",{"number, number":function(t,n){return Gi(t,n,e.epsilon)}})}),Math.pow(2,53);xu("hex",["typed","format"],t=>{var{typed:n,format:e}=t;return n("hex",{"number | BigNumber":function(t){return e(t,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(t,n){return e(t,{notation:"hex",wordSize:n})}})});function eN(t){return t<0}function rN(t){return t>0}function iN(t){return 0===t}function uN(t){return Number.isNaN(t)}eN.signature="number",rN.signature="number",iN.signature="number",uN.signature="number";function MN(t){var n;if(Qi(t))return t<=0?isFinite(t)?1/0:NaN:t>171?1/0:KM(1,t-1);if(t<.5)return Math.PI/(Math.sin(Math.PI*t)*MN(1-t));if(t>=171.35)return 1/0;if(t>85){var e=t*t,r=e*t,i=r*t,u=i*t;return Math.sqrt(2*Math.PI/t)*Math.pow(t/Math.E,t)*(1+1/(12*t)+1/(288*e)-139/(51840*r)-571/(2488320*i)+163879/(209018880*u)+5246819/(75246796800*u*t))}--t,n=oN[0];for(var M=1;M<oN.length;++M)n+=oN[M]/(t+M);var N=t+NN+.5;return Math.sqrt(2*Math.PI)*Math.pow(N,t+.5)*Math.exp(-N)*n}MN.signature="number";var NN=4.7421875,oN=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],cN=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function aN(t){if(t<0)return NaN;if(0===t)return 1/0;if(!isFinite(t))return t;if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-aN(1-t);for(var n=(t-=1)+5+.5,e=cN[0],r=6;r>=1;r--)e+=cN[r]/(t+r);return.9189385332046728+(t+.5)*Math.log(n)-n+Math.log(e)}aN.signature="number";var DN=xu("multiplyScalar",["typed"],t=>{var{typed:n}=t;return n("multiplyScalar",{"number, number":DM,"Complex, Complex":function(t,n){return t.mul(n)},"BigNumber, BigNumber":function(t,n){return t.times(n)},"Fraction, Fraction":function(t,n){return t.mul(n)},"number | Fraction | BigNumber | Complex, Unit":(t,n)=>n.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,n)=>t.multiply(n)})});function sN(t){return!t}function TN(t,n){return!(!t&&!n)}function gN(t,n){return!!t!=!!n}function lN(t,n){return!(!t||!n)}sN.signature="number",TN.signature="number, number",gN.signature="number, number",lN.signature="number, number";xu("oct",["typed","format"],t=>{var{typed:n,format:e}=t;return n("oct",{"number | BigNumber":function(t){return e(t,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(t,n){return e(t,{notation:"oct",wordSize:n})}})});var IN=e(22),jN=e.n(IN);Date.now();var yN=xu("SparseMatrix",["typed","equalScalar","Matrix"],t=>{var{typed:n,equalScalar:e,Matrix:r}=t;function i(t,n){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(n&&!ce(n))throw new Error("Invalid datatype: "+n);if(De(t))!function(t,n,e){"SparseMatrix"===n.type?(t._values=n._values?We(n._values):void 0,t._index=We(n._index),t._ptr=We(n._ptr),t._size=We(n._size),t._datatype=e||n._datatype):u(t,n.valueOf(),e||n._datatype)}(this,t,n);else if(t&&ae(t.index)&&ae(t.ptr)&&ae(t.size))this._values=t.values,this._index=t.index,this._ptr=t.ptr,this._size=t.size,this._datatype=n||t.datatype;else if(ae(t))u(this,t,n);else{if(t)throw new TypeError("Unsupported type of data ("+Ve(t)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=n}}function u(t,r,i){t._values=[],t._index=[],t._ptr=[],t._datatype=i;var u=r.length,M=0,N=e,o=0;if(ce(i)&&(N=n.find(e,[i,i])||e,o=n.convert(0,i)),u>0){var c=0;do{t._ptr.push(t._index.length);for(var a=0;a<u;a++){var D=r[a];if(ae(D)){if(0===c&&M<D.length&&(M=D.length),c<D.length){var s=D[c];N(s,o)||(t._values.push(s),t._index.push(a))}}else 0===c&&M<1&&(M=1),N(D,o)||(t._values.push(D),t._index.push(a))}c++}while(c<M)}t._ptr.push(t._index.length),t._size=[u,M]}function M(t,n){if(!Ie(n))throw new TypeError("Invalid index");if(n.isScalar())return t.get(n.min());var e,r,u,M,N=n.size();if(N.length!==t._size.length)throw new Mu(N.length,t._size.length);var o=n.min(),c=n.max();for(e=0,r=t._size.length;e<r;e++)au(o[e],t._size[e]),au(c[e],t._size[e]);var a=t._values,D=t._index,s=t._ptr,T=n.dimension(0),g=n.dimension(1),l=[],I=[];T.forEach((function(t,n){I[t]=n[0],l[t]=!0}));var j=a?[]:void 0,y=[],h=[];return g.forEach((function(t){for(h.push(y.length),u=s[t],M=s[t+1];u<M;u++)e=D[u],!0===l[e]&&(y.push(I[e]),j&&j.push(a[u]))})),h.push(y.length),new i({values:j,index:y,ptr:h,size:N,datatype:t._datatype})}function N(t,n,e,r){if(!n||!0!==n.isIndex)throw new TypeError("Invalid index");var i,u=n.size(),M=n.isScalar();if(De(e)?(i=e.size(),e=e.toArray()):i=ou(e),M){if(0!==i.length)throw new TypeError("Scalar expected");t.set(n.min(),e,r)}else{if(1!==u.length&&2!==u.length)throw new Mu(u.length,t._size.length,"<");if(i.length<u.length){for(var N=0,o=0;1===u[N]&&1===i[N];)N++;for(;1===u[N];)o++,N++;e=lu(e,u.length,o,i)}if(!Pe(u,i))throw new Mu(u,i,">");if(1===u.length){n.dimension(0).forEach((function(n,i){au(n),t.set([n,0],e[i[0]],r)}))}else{var c=n.dimension(0),a=n.dimension(1);c.forEach((function(n,i){au(n),a.forEach((function(u,M){au(u),t.set([n,u],e[i[0]][M[0]],r)}))}))}}return t}function o(t,n,e,r){if(e-n==0)return e;for(var i=n;i<e;i++)if(r[i]===t)return i;return n}function c(t,n,e,r,i,u,M){i.splice(t,0,r),u.splice(t,0,n);for(var N=e+1;N<M.length;N++)M[N]++}function a(t,r,i,u){var M=u||0,N=e,o=0;ce(t._datatype)&&(N=n.find(e,[t._datatype,t._datatype])||e,o=n.convert(0,t._datatype),M=n.convert(M,t._datatype));var c,a,D,s=!N(M,o),T=t._size[0],g=t._size[1];if(i>g){for(a=g;a<i;a++)if(t._ptr[a]=t._values.length,s)for(c=0;c<T;c++)t._values.push(M),t._index.push(c);t._ptr[i]=t._values.length}else i<g&&(t._ptr.splice(i+1,g-i),t._values.splice(t._ptr[i],t._values.length),t._index.splice(t._ptr[i],t._index.length));if(g=i,r>T){if(s){var l=0;for(a=0;a<g;a++){t._ptr[a]=t._ptr[a]+l,D=t._ptr[a+1]+l;var I=0;for(c=T;c<r;c++,I++)t._values.splice(D+I,0,M),t._index.splice(D+I,0,c),l++}t._ptr[g]=t._values.length}}else if(r<T){var j=0;for(a=0;a<g;a++){t._ptr[a]=t._ptr[a]-j;var y=t._ptr[a],h=t._ptr[a+1]-j;for(D=y;D<h;D++)(c=t._index[D])>r-1&&(t._values.splice(D,1),t._index.splice(D,1),j++)}t._ptr[a]=t._values.length}return t._size[0]=r,t._size[1]=i,t}function D(t,n,e,r,i){var u,M,N=r[0],o=r[1],c=[];for(u=0;u<N;u++)for(c[u]=[],M=0;M<o;M++)c[u][M]=0;for(M=0;M<o;M++)for(var a=e[M],D=e[M+1],s=a;s<D;s++)c[u=n[s]][M]=t?i?We(t[s]):t[s]:1;return c}return i.prototype=new r,i.prototype.createSparseMatrix=function(t,n){return new i(t,n)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return ju(this._values,Ve)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(t,n){return new i(t,n)},i.prototype.density=function(){var t=this._size[0],n=this._size[1];return 0!==t&&0!==n?this._index.length/(t*n):0},i.prototype.subset=function(t,n,e){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return M(this,t);case 2:case 3:return N(this,t,n,e);default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.get=function(t){if(!ae(t))throw new TypeError("Array expected");if(t.length!==this._size.length)throw new Mu(t.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var n=t[0],e=t[1];au(n,this._size[0]),au(e,this._size[1]);var r=o(n,this._ptr[e],this._ptr[e+1],this._index);return r<this._ptr[e+1]&&this._index[r]===n?this._values[r]:0},i.prototype.set=function(t,r,i){if(!ae(t))throw new TypeError("Array expected");if(t.length!==this._size.length)throw new Mu(t.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var u=t[0],M=t[1],N=this._size[0],D=this._size[1],s=e,T=0;ce(this._datatype)&&(s=n.find(e,[this._datatype,this._datatype])||e,T=n.convert(0,this._datatype)),(u>N-1||M>D-1)&&(a(this,Math.max(u+1,N),Math.max(M+1,D),i),N=this._size[0],D=this._size[1]),au(u,N),au(M,D);var g=o(u,this._ptr[M],this._ptr[M+1],this._index);return g<this._ptr[M+1]&&this._index[g]===u?s(r,T)?function(t,n,e,r,i){e.splice(t,1),r.splice(t,1);for(var u=n+1;u<i.length;u++)i[u]--}(g,M,this._values,this._index,this._ptr):this._values[g]=r:s(r,T)||c(g,u,M,r,this._values,this._index,this._ptr),this},i.prototype.resize=function(t,n,e){if(!se(t))throw new TypeError("Array or Matrix expected");var r=t.valueOf().map(t=>Array.isArray(t)&&1===t.length?t[0]:t);if(2!==r.length)throw new Error("Only two dimensions matrix are supported");return r.forEach((function(t){if(!ie(t)||!Qi(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+eu(r)+")")})),a(e?this.clone():this,r[0],r[1],n)},i.prototype.reshape=function(t,n){if(!ae(t))throw new TypeError("Array expected");if(2!==t.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");t.forEach((function(n){if(!ie(n)||!Qi(n)||n<=-2||0===n)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+eu(t)+")")}));var e=this._size[0]*this._size[1];if(e!==(t=Tu(t,e))[0]*t[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var r=n?this.clone():this;if(this._size[0]===t[0]&&this._size[1]===t[1])return r;for(var i=[],u=0;u<r._ptr.length;u++)for(var M=0;M<r._ptr[u+1]-r._ptr[u];M++)i.push(u);for(var N=r._values.slice(),a=r._index.slice(),D=0;D<r._index.length;D++){var s=a[D],T=i[D],g=s*r._size[1]+T;i[D]=g%t[1],a[D]=Math.floor(g/t[1])}r._values.length=0,r._index.length=0,r._ptr.length=t[1]+1,r._size=t.slice();for(var l=0;l<r._ptr.length;l++)r._ptr[l]=0;for(var I=0;I<N.length;I++){var j=a[I],y=i[I],h=N[I];c(o(j,r._ptr[y],r._ptr[y+1],r._index),j,y,h,r._values,r._index,r._ptr)}return r},i.prototype.clone=function(){return new i({values:this._values?We(this._values):void 0,index:We(this._index),ptr:We(this._ptr),size:We(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(t,r){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var u=this,M=this._size[0],N=this._size[1],o=wu(t);return function(t,r,u,M,N,o,c){var a=[],D=[],s=[],T=e,g=0;ce(t._datatype)&&(T=n.find(e,[t._datatype,t._datatype])||e,g=n.convert(0,t._datatype));for(var l=function(t,n,e){t=o(t,n,e),T(t,g)||(a.push(t),D.push(n))},I=M;I<=N;I++){s.push(a.length);var j=t._ptr[I],y=t._ptr[I+1];if(c)for(var h=j;h<y;h++){var z=t._index[h];z>=r&&z<=u&&l(t._values[h],z-r,I-M)}else{for(var O={},A=j;A<y;A++){var x=t._index[A];O[x]=t._values[A]}for(var E=r;E<=u;E++){var f=E in O?O[E]:0;l(f,E-r,I-M)}}}return s.push(a.length),new i({values:a,index:D,ptr:s,size:[u-r+1,N-M+1]})}(this,0,M-1,0,N-1,(function(n,e,r){return 1===o?t(n):2===o?t(n,[e,r]):t(n,[e,r],u)}),r)},i.prototype.forEach=function(t,n){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var e=this._size[0],r=this._size[1],i=0;i<r;i++){var u=this._ptr[i],M=this._ptr[i+1];if(n)for(var N=u;N<M;N++){var o=this._index[N];t(this._values[N],[o,i],this)}else{for(var c={},a=u;a<M;a++){c[this._index[a]]=this._values[a]}for(var D=0;D<e;D++){t(D in c?c[D]:0,[D,i],this)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var t=this._size[1],n=0;n<t;n++)for(var e=this._ptr[n],r=this._ptr[n+1],i=e;i<r;i++){var u=this._index[i];yield{value:this._values[i],index:[u,n]}}},i.prototype.toArray=function(){return D(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return D(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(t){for(var n=this._size[0],e=this._size[1],r=this.density(),i="Sparse Matrix ["+eu(n,t)+" x "+eu(e,t)+"] density: "+eu(r,t)+"\n",u=0;u<e;u++)for(var M=this._ptr[u],N=this._ptr[u+1],o=M;o<N;o++){i+="\n ("+eu(this._index[o],t)+", "+eu(u,t)+") ==> "+(this._values?eu(this._values[o],t):"X")}return i},i.prototype.toString=function(){return eu(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(t){if(t){if(ue(t)&&(t=t.toNumber()),!ie(t)||!Qi(t))throw new TypeError("The parameter k must be an integer number")}else t=0;var n=t>0?t:0,e=t<0?-t:0,r=this._size[0],u=this._size[1],M=Math.min(r-e,u-n),N=[],o=[],c=[];c[0]=0;for(var a=n;a<u&&N.length<M;a++)for(var D=this._ptr[a],s=this._ptr[a+1],T=D;T<s;T++){var g=this._index[T];if(g===a-n+e){N.push(this._values[T]),o[N.length-1]=g-e;break}}return c.push(N.length),new i({values:N,index:o,ptr:c,size:[M,1]})},i.fromJSON=function(t){return new i(t)},i.diagonal=function(t,r,u,M,N){if(!ae(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(ue(t)&&(t=t.toNumber()),!ie(t)||!Qi(t)||t<1)throw new Error("Size values must be positive integers");return t})),u){if(ue(u)&&(u=u.toNumber()),!ie(u)||!Qi(u))throw new TypeError("The parameter k must be an integer number")}else u=0;var o=e,c=0;ce(N)&&(o=n.find(e,[N,N])||e,c=n.convert(0,N));var a,D=u>0?u:0,s=u<0?-u:0,T=t[0],g=t[1],l=Math.min(T-s,g-D);if(ae(r)){if(r.length!==l)throw new Error("Invalid value array length");a=function(t){return r[t]}}else if(De(r)){var I=r.size();if(1!==I.length||I[0]!==l)throw new Error("Invalid matrix length");a=function(t){return r.get([t])}}else a=function(){return r};for(var j=[],y=[],h=[],z=0;z<g;z++){h.push(j.length);var O=z-D;if(O>=0&&O<l){var A=a(O);o(A,c)||(y.push(O+s),j.push(A))}}return h.push(j.length),new i({values:j,index:y,ptr:h,size:[T,g]})},i.prototype.swapRows=function(t,n){if(!(ie(t)&&Qi(t)&&ie(n)&&Qi(n)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return au(t,this._size[0]),au(n,this._size[0]),i._swapRows(t,n,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(t,n,e,r,i){for(var u=r[t],M=r[t+1],N=u;N<M;N++)i(e[N],n[N])},i._swapRows=function(t,n,e,r,i,u){for(var M=0;M<e;M++){var N=u[M],c=u[M+1],a=o(t,N,c,i),D=o(n,N,c,i);if(a<c&&D<c&&i[a]===t&&i[D]===n){if(r){var s=r[a];r[a]=r[D],r[D]=s}}else if(a<c&&i[a]===t&&(D>=c||i[D]!==n)){var T=r?r[a]:void 0;i.splice(D,0,n),r&&r.splice(D,0,T),i.splice(D<=a?a+1:a,1),r&&r.splice(D<=a?a+1:a,1)}else if(D<c&&i[D]===n&&(a>=c||i[a]!==t)){var g=r?r[D]:void 0;i.splice(a,0,t),r&&r.splice(a,0,g),i.splice(a<=D?D+1:D,1),r&&r.splice(a<=D?D+1:D,1)}}},i},{isClass:!0});xu("bin",["typed","format"],t=>{var{typed:n,format:e}=t;return n("bin",{"number | BigNumber":function(t){return e(t,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(t,n){return e(t,{notation:"bin",wordSize:n})}})});var hN=xu("matrix",["typed","Matrix","DenseMatrix","SparseMatrix"],t=>{var{typed:n,Matrix:e,DenseMatrix:r,SparseMatrix:i}=t;return n("matrix",{"":function(){return u([])},string:function(t){return u([],t)},"string, string":function(t,n){return u([],t,n)},Array:function(t){return u(t)},Matrix:function(t){return u(t,t.storage())},"Array | Matrix, string":u,"Array | Matrix, string, string":u});function u(t,n,e){if("dense"===n||"default"===n||void 0===n)return new r(t,e);if("sparse"===n)return new i(t,e);throw new TypeError("Unknown matrix type "+JSON.stringify(n)+".")}});function zN(){throw new Error('No "matrix" implementation available')}var ON=xu("size",["typed","config","?matrix"],t=>{var{typed:n,config:e,matrix:r}=t;return n("size",{Matrix:function(t){return t.create(t.size())},Array:ou,string:function(t){return"Array"===e.matrix?[t.length]:r([t.length])},"number | Complex | BigNumber | Unit | boolean | null":function(t){return"Array"===e.matrix?[]:r?r([]):zN()}})}),AN=xu("matAlgo11xS0s",["typed","equalScalar"],t=>{var{typed:n,equalScalar:e}=t;return function(t,r,i,u){var M=t._values,N=t._index,o=t._ptr,c=t._size,a=t._datatype;if(!M)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var D,s=c[0],T=c[1],g=e,l=0,I=i;"string"==typeof a&&(D=a,g=n.find(e,[D,D]),l=n.convert(0,D),r=n.convert(r,D),I=n.find(i,[D,D]));for(var j=[],y=[],h=[],z=0;z<T;z++){h[z]=y.length;for(var O=o[z],A=o[z+1],x=O;x<A;x++){var E=N[x],f=u?I(r,M[x]):I(M[x],r);g(f,l)||(y.push(E),j.push(f))}}return h[T]=y.length,t.createSparseMatrix({values:j,index:y,ptr:h,size:[s,T],datatype:D})}}),xN=xu("matAlgo14xDs",["typed"],t=>{var{typed:n}=t;return function(t,e,r,i){var u,M=t._data,N=t._size,o=t._datatype,c=r;"string"==typeof o&&(u=o,e=n.convert(e,u),c=n.find(r,[u,u]));var a=N.length>0?function t(n,e,r,i,u,M,N){var o=[];if(e===r.length-1)for(var c=0;c<i;c++)o[c]=N?n(M,u[c]):n(u[c],M);else for(var a=0;a<i;a++)o[a]=t(n,e+1,r,r[e+1],u[a],M,N);return o}(c,0,N,N[0],M,e,i):[];return t.createDenseMatrix({data:a,size:We(N),datatype:u})}});xu("equal",["typed","equalScalar"],t=>{var{typed:n,equalScalar:e}=t;return n("equal",{"any, any":function(t,n){return null===t?null===n:null===n?null===t:void 0===t?void 0===n:void 0===n?void 0===t:e(t,n)}})});var EN=xu("ones",["typed","config","matrix","BigNumber"],t=>{var{typed:n,config:e,matrix:r,BigNumber:i}=t;return n("ones",{"":function(){return"Array"===e.matrix?u([]):u([],"default")},"...number | BigNumber | string":function(t){if("string"==typeof t[t.length-1]){var n=t.pop();return u(t,n)}return"Array"===e.matrix?u(t):u(t,"default")},Array:u,Matrix:function(t){var n=t.storage();return u(t.valueOf(),n)},"Array | Matrix, string":function(t,n){return u(t.valueOf(),n)}});function u(t,n){var e=function(t){var n=!1;return t.forEach((function(t,e,r){ue(t)&&(n=!0,r[e]=t.toNumber())})),n}(t)?new i(1):1;if(function(t){t.forEach((function(t){if("number"!=typeof t||!Qi(t)||t<0)throw new Error("Parameters in function ones must be positive integers")}))}(t),n){var u=r(n);return t.length>0?u.resize(t,e):u}var M=[];return t.length>0?Du(M,t,e):M}});function fN(t,n,e,r){if(!(this instanceof fN))throw new SyntaxError("Constructor must be called with the new operator");this.fn=t,this.count=n,this.min=e,this.max=r,this.message="Wrong number of arguments in function "+t+" ("+n+" provided, "+e+(null!=r?"-"+r:"")+" expected)",this.stack=(new Error).stack}fN.prototype=new Error,fN.prototype.constructor=Error,fN.prototype.name="ArgumentsError",fN.prototype.isArgumentsError=!0;xu("unequal",["typed","equalScalar"],t=>{var{typed:n,equalScalar:e}=t;return n("unequal",{"any, any":function(t,n){return null===t?null!==n:null===n?null!==t:void 0===t?void 0!==n:void 0===n?void 0!==t:!e(t,n)}})});uu.signature="any, any";var pN=xu("dot",["typed","addScalar","multiplyScalar","conj","size"],t=>{var{typed:n,addScalar:e,multiplyScalar:r,conj:i,size:u}=t;return n("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(t,u){var o=M(t,u),c=De(t)?t._data:t,a=De(t)?t._datatype||t.getDataType():void 0,D=De(u)?u._data:u,s=De(u)?u._datatype||u.getDataType():void 0,T=2===N(t).length,g=2===N(u).length,l=e,I=r;if(a&&s&&a===s&&"string"==typeof a&&"mixed"!==a){var j=a;l=n.find(e,[j,j]),I=n.find(r,[j,j])}if(!T&&!g){for(var y=I(i(c[0]),D[0]),h=1;h<o;h++)y=l(y,I(i(c[h]),D[h]));return y}if(!T&&g){for(var z=I(i(c[0]),D[0][0]),O=1;O<o;O++)z=l(z,I(i(c[O]),D[O][0]));return z}if(T&&!g){for(var A=I(i(c[0][0]),D[0]),x=1;x<o;x++)A=l(A,I(i(c[x][0]),D[x]));return A}if(T&&g){for(var E=I(i(c[0][0]),D[0][0]),f=1;f<o;f++)E=l(E,I(i(c[f][0]),D[f][0]));return E}},"SparseMatrix, SparseMatrix":function(t,n){M(t,n);var i=t._index,u=t._values,N=n._index,o=n._values,c=0,a=e,D=r,s=0,T=0;for(;s<i.length&&T<N.length;){var g=i[s],l=N[T];g<l?s++:g>l?T++:g===l&&(c=a(c,D(u[s],o[T])),s++,T++)}return c}});function M(t,n){var e,r,i=N(t),u=N(n);if(1===i.length)e=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(", ")+")");e=i[0]}if(1===u.length)r=u[0];else{if(2!==u.length||1!==u[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+u.join(", ")+")");r=u[0]}if(e!==r)throw new RangeError("Vectors must have equal length ("+e+" != "+r+")");if(0===e)throw new RangeError("Cannot calculate the dot product of empty vectors");return e}function N(t){return De(t)?t.size():u(t)}}),UN="number | BigNumber | Fraction | Matrix | Array";"".concat(UN,", ").concat(UN,", ...").concat(UN);var dN=xu("multiply",["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],t=>{var{typed:n,matrix:e,addScalar:r,multiplyScalar:i,equalScalar:u,dot:M}=t,N=AN({typed:n,equalScalar:u}),o=xN({typed:n});function c(t,n){switch(t.length){case 1:switch(n.length){case 1:if(t[0]!==n[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(t[0]!==n[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+t[0]+") must match Matrix rows ("+n[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+n.length+" dimensions)")}break;case 2:switch(n.length){case 1:if(t[1]!==n[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+t[1]+") must match Vector length ("+n[0]+")");break;case 2:if(t[1]!==n[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+t[1]+") must match Matrix B rows ("+n[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+n.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+t.length+" dimensions)")}}function a(t,e){if("dense"!==e.storage())throw new Error("Support for SparseMatrix not implemented");return function(t,e){var u,M=t._data,N=t._size,o=t._datatype||t.getDataType(),c=e._data,a=e._size,D=e._datatype||e.getDataType(),s=N[0],T=a[1],g=r,l=i;o&&D&&o===D&&"string"==typeof o&&"mixed"!==o&&(u=o,g=n.find(r,[u,u]),l=n.find(i,[u,u]));for(var I=[],j=0;j<T;j++){for(var y=l(M[0],c[0][j]),h=1;h<s;h++)y=g(y,l(M[h],c[h][j]));I[j]=y}return t.createDenseMatrix({data:I,size:[T],datatype:o===t._datatype&&D===e._datatype?u:void 0})}(t,e)}var D=n("_multiplyMatrixVector",{"DenseMatrix, any":function(t,e){var u,M=t._data,N=t._size,o=t._datatype||t.getDataType(),c=e._data,a=e._datatype||e.getDataType(),D=N[0],s=N[1],T=r,g=i;o&&a&&o===a&&"string"==typeof o&&"mixed"!==o&&(u=o,T=n.find(r,[u,u]),g=n.find(i,[u,u]));for(var l=[],I=0;I<D;I++){for(var j=M[I],y=g(j[0],c[0]),h=1;h<s;h++)y=T(y,g(j[h],c[h]));l[I]=y}return t.createDenseMatrix({data:l,size:[D],datatype:o===t._datatype&&a===e._datatype?u:void 0})},"SparseMatrix, any":function(t,e){var M=t._values,N=t._index,o=t._ptr,c=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var a,D=e._data,s=e._datatype||e.getDataType(),T=t._size[0],g=e._size[0],l=[],I=[],j=[],y=r,h=i,z=u,O=0;c&&s&&c===s&&"string"==typeof c&&"mixed"!==c&&(a=c,y=n.find(r,[a,a]),h=n.find(i,[a,a]),z=n.find(u,[a,a]),O=n.convert(0,a));var A=[],x=[];j[0]=0;for(var E=0;E<g;E++){var f=D[E];if(!z(f,O))for(var p=o[E],U=o[E+1],d=p;d<U;d++){var C=N[d];x[C]?A[C]=y(A[C],h(f,M[d])):(x[C]=!0,I.push(C),A[C]=h(f,M[d]))}}for(var Q=I.length,w=0;w<Q;w++){var S=I[w];l[w]=A[S]}return j[1]=I.length,t.createSparseMatrix({values:l,index:I,ptr:j,size:[T,1],datatype:c===t._datatype&&s===e._datatype?a:void 0})}}),s=n("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(t,e){var u,M=t._data,N=t._size,o=t._datatype||t.getDataType(),c=e._data,a=e._size,D=e._datatype||e.getDataType(),s=N[0],T=N[1],g=a[1],l=r,I=i;o&&D&&o===D&&"string"==typeof o&&"mixed"!==o&&"mixed"!==o&&(u=o,l=n.find(r,[u,u]),I=n.find(i,[u,u]));for(var j=[],y=0;y<s;y++){var h=M[y];j[y]=[];for(var z=0;z<g;z++){for(var O=I(h[0],c[0][z]),A=1;A<T;A++)O=l(O,I(h[A],c[A][z]));j[y][z]=O}}return t.createDenseMatrix({data:j,size:[s,g],datatype:o===t._datatype&&D===e._datatype?u:void 0})},"DenseMatrix, SparseMatrix":function(t,e){var M=t._data,N=t._size,o=t._datatype||t.getDataType(),c=e._values,a=e._index,D=e._ptr,s=e._size,T=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!c)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var g,l=N[0],I=s[1],j=r,y=i,h=u,z=0;o&&T&&o===T&&"string"==typeof o&&"mixed"!==o&&(g=o,j=n.find(r,[g,g]),y=n.find(i,[g,g]),h=n.find(u,[g,g]),z=n.convert(0,g));for(var O=[],A=[],x=[],E=e.createSparseMatrix({values:O,index:A,ptr:x,size:[l,I],datatype:o===t._datatype&&T===e._datatype?g:void 0}),f=0;f<I;f++){x[f]=A.length;var p=D[f],U=D[f+1];if(U>p)for(var d=0,C=0;C<l;C++){for(var Q=C+1,w=void 0,S=p;S<U;S++){var L=a[S];d!==Q?(w=y(M[C][L],c[S]),d=Q):w=j(w,y(M[C][L],c[S]))}d!==Q||h(w,z)||(A.push(C),O.push(w))}}return x[I]=A.length,E},"SparseMatrix, DenseMatrix":function(t,e){var M=t._values,N=t._index,o=t._ptr,c=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var a,D=e._data,s=e._datatype||e.getDataType(),T=t._size[0],g=e._size[0],l=e._size[1],I=r,j=i,y=u,h=0;c&&s&&c===s&&"string"==typeof c&&"mixed"!==c&&(a=c,I=n.find(r,[a,a]),j=n.find(i,[a,a]),y=n.find(u,[a,a]),h=n.convert(0,a));for(var z=[],O=[],A=[],x=t.createSparseMatrix({values:z,index:O,ptr:A,size:[T,l],datatype:c===t._datatype&&s===e._datatype?a:void 0}),E=[],f=[],p=0;p<l;p++){A[p]=O.length;for(var U=p+1,d=0;d<g;d++){var C=D[d][p];if(!y(C,h))for(var Q=o[d],w=o[d+1],S=Q;S<w;S++){var L=N[S];f[L]!==U?(f[L]=U,O.push(L),E[L]=j(C,M[S])):E[L]=I(E[L],j(C,M[S]))}}for(var k=A[p],v=O.length,Y=k;Y<v;Y++){var m=O[Y];z[Y]=E[m]}}return A[l]=O.length,x},"SparseMatrix, SparseMatrix":function(t,e){var u,M=t._values,N=t._index,o=t._ptr,c=t._datatype||void 0===t._data?t._datatype:t.getDataType(),a=e._values,D=e._index,s=e._ptr,T=e._datatype||void 0===e._data?e._datatype:e.getDataType(),g=t._size[0],l=e._size[1],I=M&&a,j=r,y=i;c&&T&&c===T&&"string"==typeof c&&"mixed"!==c&&(u=c,j=n.find(r,[u,u]),y=n.find(i,[u,u]));for(var h,z,O,A,x,E,f,p,U=I?[]:void 0,d=[],C=[],Q=t.createSparseMatrix({values:U,index:d,ptr:C,size:[g,l],datatype:c===t._datatype&&T===e._datatype?u:void 0}),w=I?[]:void 0,S=[],L=0;L<l;L++){C[L]=d.length;var k=L+1;for(x=s[L],E=s[L+1],A=x;A<E;A++)if(p=D[A],I)for(z=o[p],O=o[p+1],h=z;h<O;h++)f=N[h],S[f]!==k?(S[f]=k,d.push(f),w[f]=y(a[A],M[h])):w[f]=j(w[f],y(a[A],M[h]));else for(z=o[p],O=o[p+1],h=z;h<O;h++)f=N[h],S[f]!==k&&(S[f]=k,d.push(f));if(I)for(var v=C[L],Y=d.length,m=v;m<Y;m++){var F=d[m];U[m]=w[F]}}return C[l]=d.length,Q}});return n("multiply",i,{"Array, Array":n.referTo("Matrix, Matrix",t=>(n,r)=>{c(ou(n),ou(r));var i=t(e(n),e(r));return De(i)?i.valueOf():i}),"Matrix, Matrix":function(t,n){var e=t.size(),r=n.size();return c(e,r),1===e.length?1===r.length?function(t,n,e){if(0===e)throw new Error("Cannot multiply two empty vectors");return M(t,n)}(t,n,e[0]):a(t,n):1===r.length?D(t,n):s(t,n)},"Matrix, Array":n.referTo("Matrix,Matrix",t=>(n,r)=>t(n,e(r))),"Array, Matrix":n.referToSelf(t=>(n,r)=>t(e(n,r.storage()),r)),"SparseMatrix, any":function(t,n){return N(t,n,i,!1)},"DenseMatrix, any":function(t,n){return o(t,n,i,!1)},"any, SparseMatrix":function(t,n){return N(n,t,i,!0)},"any, DenseMatrix":function(t,n){return o(n,t,i,!0)},"Array, any":function(t,n){return o(e(t),n,i,!1).valueOf()},"any, Array":function(t,n){return o(e(n),t,i,!0).valueOf()},"any, any":i,"any, any, ...any":n.referToSelf(t=>(n,e,r)=>{for(var i=t(n,e),u=0;u<r.length;u++)i=t(i,r[u]);return i})})});e(17);var CN=fu({config:Ke}),QN=du({}),wN=mu({}),SN=Fu({}),LN=Ru({Matrix:SN}),kN=nM({BigNumber:CN,Complex:QN,DenseMatrix:LN,Fraction:wN}),vN=BM({typed:kN}),YN=_M({typed:kN}),mN=nN({config:Ke,typed:kN}),FN=DN({typed:kN}),RN=yN({Matrix:SN,equalScalar:mN,typed:kN}),bN=hN({DenseMatrix:LN,Matrix:SN,SparseMatrix:RN,typed:kN}),BN=ON({matrix:bN,config:Ke,typed:kN}),ZN=EN({BigNumber:CN,config:Ke,matrix:bN,typed:kN}),VN=pN({addScalar:vN,conj:YN,multiplyScalar:FN,size:BN,typed:kN}),WN=dN({addScalar:vN,dot:VN,equalScalar:mN,matrix:bN,multiplyScalar:FN,typed:kN});function GN(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,u=$n()(t);if(n&&e){var M=qN(t),N=XN(M,e,n),o=JN(t,N);u=$n()(o).pop()}if(r&&i){var c=[].concat(u).reverse(),a=qN(c),D=XN(a,i,r),s=1-D,T=JN(u,s);u=T[0]}return u}function PN(t,n){var e=t.x-n.x,r=t.y-n.y;return Math.sqrt(e*e+r*r)}function JN(t,n){switch(t.length){case 2:return function(t,n){var e=HN(t,n);return[[t[0],e],[e,$n()(t).pop()]]}(t,n);case 3:return function(t,n){var e=[t[0],t[1]],r=[t[1],t[2]],i=HN(e,n),u=HN(r,n),M=HN([i,u],n);return[[t[0],i,M],[M,u,t[2]]]}(t,n);case 4:return function(t,n){var e=[t[0],t[1]],r=[t[1],t[2]],i=[t[2],t[3]],u=HN(e,n),M=HN(r,n),N=HN(i,n),o=HN([u,M],n),c=HN([M,N],n),a=HN([o,c],n);return[[t[0],u,o,a],[a,c,N,t[3]]]}(t,n);default:return null}}function HN(t,n){var e=Xn()(t,1)[0],r=$n()(t).pop(),i=e.x+(r.x-e.x)*n;return{y:e.y+(r.y-e.y)*n,x:i}}function XN(t,n,e){for(var r=t.size(),i=function(t){switch(t){case 1:return WN(KN(1e3,1),bN([[1,0],[-1,1]]));case 2:return WN(KN(1e3,2),bN([[1,0,0],[-2,2,0],[1,-2,1]]));case 3:return WN(KN(1e3,3),bN([[1,0,0,0],[-3,3,0,0],[3,-6,3,0],[-1,3,-3,1]]));default:return null}}(Xn()(r,1)[0]-1),u=function(t,n){var e=-t.x,r=-t.y,i=[],u=[];n.forEach((function(t,n){switch(Xn()(n,2)[1]){case 0:i.push(t+e);break;case 1:u.push(t+r)}}));for(var M=[],N=0;N<i.length;N++)M.push(Math.sqrt(i[N]*i[N]+u[N]*u[N]));return M}(n,WN(i,t)),M=u.length-1,N=0;N<u.length;N++)if(u[N]>=e){M=N;break}return.001*M}function KN(t,n){var e=1/t,r=0,i=ZN(t+1,n+1).map((function(t,n){var i=null;switch(Xn()(n,2)[1]){case 0:i=1;break;case 1:i=r;break;case 2:i=r*r;break;case 3:i=r*r*r}return r+=e,i}));return bN(i)}function qN(t){var n=t.map((function(t){return[t.x,t.y]}));return bN(n)}function _N(t){if(3===t.length)throw new Error("bezierBoundingBox function supports only linear and cubic bezier curves for now");var n,e,r,i,u,M,N=2===t.length?(n=t,e=Xn()(n,2),r=e[0],i=e[1],u=[r.x,i.x],M=[r.y,i.y],{min:{x:Math.min.apply(0,u),y:Math.min.apply(0,M)},max:{x:Math.max.apply(0,u),y:Math.max.apply(0,M)}}):function(t){for(var n,e,r,i,u,M,N,o,c=Xn()(t,4),a=c[0],D=c[1],s=c[2],T=c[3],g=[],l=[],I=[],j=0;j<2;++j)if(0===j?(e=6*a.x-12*D.x+6*s.x,n=-3*a.x+9*D.x-9*s.x+3*T.x,r=3*D.x-3*a.x):(e=6*a.y-12*D.y+6*s.y,n=-3*a.y+9*D.y-9*s.y+3*T.y,r=3*D.y-3*a.y),Math.abs(n)<1e-12){if(Math.abs(e)<1e-12)continue;(i=-r/e)>0&&i<1&&g.push(i)}else(N=e*e-4*r*n)<0?Math.abs(N)<1e-12&&(i=-e/(2*n))>0&&i<1&&g.push(i):(o=Math.sqrt(N),(u=(-e+o)/(2*n))>0&&u<1&&g.push(u),(M=(-e-o)/(2*n))>0&&M<1&&g.push(M));var y,h=g.length;for(;h--;)i=g[h],y=1-i,l[h]=y*y*y*a.x+3*y*y*i*D.x+3*y*i*i*s.x+i*i*i*T.x,I[h]=y*y*y*a.y+3*y*y*i*D.y+3*y*i*i*s.y+i*i*i*T.y;return l.push(a.x,T.x),I.push(a.y,T.y),{min:{x:Math.min.apply(0,l),y:Math.min.apply(0,I)},max:{x:Math.max.apply(0,l),y:Math.max.apply(0,I)}}}(t),o=2===t.length?1:0;return[{x:N.min.x,y:N.min.y-o},{x:N.max.x,y:N.min.y-o},{x:N.max.x,y:N.max.y+o},{x:N.min.x,y:N.max.y+o}]}var $N=e(3),to=e.n($N),no=e(0),eo=e.n(no),ro=e(4),io=e.n(ro),uo=function(){function t(n){st()(this,t),It()(this,"ctx",void 0),It()(this,"playData",void 0),It()(this,"options",void 0),It()(this,"courtTypeConstants",void 0),this.ctx=n.ctx,this.playData=n.playData,this.options=n.options?n.options:{},this.courtTypeConstants=n.courtTypeConstants}return gt()(t,[{key:"apply",value:function(){this.ctx.save(),this.drawLogic(),this.ctx.restore()}},{key:"drawLogic",value:function(){}}]),t}();function Mo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var No=function(t){io()(e,t);var n=Mo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){this.original()&&(this.ctx.save(),this.drawLogic(),this.ctx.restore()),this.reflection()&&(this.ctx.save(),this.verticalFlipAndRotation(),this.drawLogic(),this.ctx.restore())}},{key:"original",value:function(){return!0}},{key:"reflection",value:function(){return!1}},{key:"verticalFlipAndRotation",value:function(){var t=this.courtTypeConstants.COURT_RECT_HEIGHT;this.ctx.scale(1,-1),this.ctx.translate(0,-Math.abs(t))}},{key:"setColor",value:function(t){var n="transparent"===this.options.lineColor?"transparent":t;this.ctx.strokeStyle=n,this.ctx.fillStyle=n}},{key:"courtCenter",get:function(){return{x:this.courtTypeConstants.COURT_RECT_WIDTH/2,y:this.courtTypeConstants.COURT_RECT_HEIGHT/2}}}]),e}(uo);function oo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var co=function(t){io()(e,t);var n=oo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No),ao=.1667,Do=1.5,so=2.4,To=.55,go=!1,lo=480,Io=460,jo="#C49463",yo=60.5,ho=127.28125,zo=60,Oo=1.41667,Ao=26,xo=.5,Eo=4,fo=6,po=5,Uo=3.58333,Co=5,Qo=37,wo=15,So=20,Lo=5,ko=2,vo=.5,Yo=1.5,mo=18,Fo=95,Ro=390,bo=330,Bo=90,Zo=2.5,Vo=13;function Wo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Go=function(t){io()(e,t);var n=Wo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"original",value:function(){return!1}},{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtCenter.x,y:zo},n={x:this.courtCenter.x,y:zo+yo},e="transparent"===this.options.lineColor?"transparent":jo;this.ctx.fillStyle=e,this.ctx.strokeStyle=e;var r=Math.PI/11,i=Math.PI-Math.PI/11;this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.x,n.y,Fo,r,i,!1);var u=Po(n,Fo,i),M=Po(n,Fo,r);this.ctx.moveTo(u.x,u.y),this.ctx.lineTo(t.x,t.y-Math.sqrt(18)),this.ctx.lineTo(M.x,M.y),this.ctx.lineTo(u.x,u.y),this.ctx.translate(t.x,t.y),this.ctx.rotate(Math.PI/4),this.ctx.moveTo(3,3),this.ctx.lineTo(3,Bo-3),this.ctx.lineTo(Bo-3,Bo-3),this.ctx.lineTo(Bo-3,3),this.ctx.lineTo(3,3),this.ctx.fill(),this.ctx.restore(),this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.x,n.y-Yo,mo/2,0,2*Math.PI,!0),this.ctx.stroke(),this.ctx.fill(),this.ctx.restore(),this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.x,t.y,Ao/2,0,2*Math.PI,!0),this.ctx.stroke(),this.ctx.fill(),this.ctx.restore(),this.ctx.save(),this.ctx.translate(t.x,t.y),this.ctx.rotate(Math.PI/4),this.ctx.beginPath(),this.ctx.arc(Bo,0,Vo,Math.PI/4,Math.PI+Math.PI/20,!1),this.ctx.stroke(),this.ctx.fill(),this.ctx.beginPath(),this.ctx.arc(Bo,Bo,Vo,0,2*Math.PI,!0),this.ctx.stroke(),this.ctx.fill(),this.ctx.beginPath(),this.ctx.arc(0,Bo,Vo,Math.PI/4,Math.PI+Math.PI/2.2,!0),this.ctx.stroke(),this.ctx.fill(),this.ctx.restore()}}]),e}(No);function Po(t,n,e){return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}}function Jo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ho=function(t){io()(e,t);var n=Jo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"original",value:function(){return!1}},{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this,n={x:this.courtCenter.x,y:zo};this.ctx.lineWidth=3*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.save(),this.ctx.translate(n.x,n.y),this.ctx.rotate(Math.PI/4),this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(Bo,0),this.ctx.stroke(),this.drawBaseSquare(Bo,0),this.drawBaseSquare(Bo+Zo/2,Bo-Zo/2),this.drawBaseSquare(Zo,Bo-Zo),this.ctx.beginPath(),this.ctx.lineTo(0,0),this.ctx.stroke(),this.ctx.restore(),[-1,1].forEach((function(e){t.ctx.save(),t.ctx.translate(n.x,n.y),t.ctx.rotate(e*(Math.PI/4)),t.ctx.beginPath(),t.ctx.moveTo(0,0),t.ctx.lineTo(e*bo,0),t.ctx.stroke(),t.ctx.restore()}));var e=Math.PI/8.1,r=Math.PI-Math.PI/8.1;this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.x,n.y+138,Ro-138,e,r,!1),this.ctx.stroke(),this.ctx.restore()}},{key:"drawBaseSquare",value:function(t,n){this.ctx.save(),this.ctx.lineCap="square",this.ctx.beginPath(),this.ctx.translate(t,n),this.ctx.moveTo(0,0),this.ctx.lineTo(0,Zo),this.ctx.lineTo(-Zo,Zo),this.ctx.lineTo(-Zo,0),this.ctx.lineTo(0,0),this.ctx.stroke(),this.ctx.fill(),this.ctx.restore()}}]),e}(No);function Xo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ko=function(t){io()(e,t);var n=Xo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"original",value:function(){return!1}},{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this,n={x:this.courtCenter.x,y:zo},e={x:n.x-Oo/2,y:n.y+Oo},r={x:n.x+Oo/2,y:n.y+Oo};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.lineTo(r.x,r.y-Oo/2),this.ctx.lineTo(n.x,n.y),this.ctx.lineTo(e.x,e.y-Oo/2),this.ctx.lineTo(e.x,e.y),this.ctx.stroke(),this.ctx.fill(),[-1,1].forEach((function(e){t.ctx.save(),t.ctx.translate(n.x,n.y+Oo/2),t.ctx.beginPath();var r=Oo/2+xo;t.ctx.moveTo(e*r,0),t.ctx.lineTo(e*r,Oo/2),t.ctx.lineTo(e*(r+Eo),Oo/2),t.ctx.lineTo(e*(r+Eo),Oo/2-fo),t.ctx.lineTo(e*r,Oo/2-fo),t.ctx.lineTo(e*r,0),t.ctx.lineTo(e*r,0),t.ctx.stroke(),t.ctx.restore()}));var i=n.y+Oo/2-fo+Oo/2;[-1,1].forEach((function(n){t.ctx.save(),t.ctx.translate(t.courtCenter.x,i-po),t.ctx.beginPath(),t.ctx.moveTo(0,0),t.ctx.lineTo(n*(Uo/2),0),t.ctx.lineTo(n*(Uo/2),po),t.ctx.stroke(),t.ctx.restore()})),[-1,1].forEach((function(e){t.ctx.save(),t.ctx.translate(t.courtCenter.x,n.y-Ao/2),t.ctx.beginPath(),t.ctx.arc(e*Qo,0,Co/2,0,2*Math.PI,!0),t.ctx.stroke(),t.ctx.restore()})),[-1,1].forEach((function(e){t.ctx.save(),t.ctx.translate(n.x,n.y),t.ctx.rotate(e*(Math.PI/4)),t.ctx.beginPath(),t.ctx.moveTo(e*Bo,-(wo+Lo)),t.ctx.lineTo(e*Bo,-wo),t.ctx.lineTo(e*(Bo-So),-wo),t.ctx.lineTo(e*(Bo-So),-(wo+Lo)),t.ctx.stroke(),t.ctx.restore()}))}}]),e}(No);function qo(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var _o=function(t){io()(e,t);var n=qo(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"original",value:function(){return!1}},{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtCenter.x,y:zo+yo};this.ctx.save(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.translate(t.x,t.y),this.ctx.moveTo(0,0),this.ctx.lineTo(ko/2,0),this.ctx.lineTo(ko/2,vo),this.ctx.lineTo(-ko/2,vo),this.ctx.lineTo(-ko/2,0),this.ctx.lineTo(0,0),this.ctx.stroke(),this.ctx.fill(),this.ctx.restore()}}]),e}(No);function $o(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var tc=function(t){io()(e,t);var n=$o(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){if(this.courtTypeConstants.BENCH_MARKING){var t={x:this.courtCenter.x-11,y:0},n={x:this.courtCenter.x-11,y:.5},e={x:this.courtCenter.x+11,y:0},r={x:this.courtCenter.x+11,y:.5};this.ctx.beginPath(),this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.stroke()}}}]),e}(No);function nc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ec=function(t){io()(e,t);var n=nc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=0,n=28,e=3,r=28,i={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:28},u={x:this.courtTypeConstants.COURT_RECT_WIDTH-3,y:28};this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(e,r),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(i.x,i.y),this.ctx.lineTo(u.x,u.y),this.ctx.stroke()}}]),e}(No);function rc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ic=function(t){io()(e,t);var n=rc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No);function uc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Mc=function(t){io()(e,t);var n=uc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){if(this.options.showHalfCourtCircle){this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,6,0,2*Math.PI,!0),this.courtTypeConstants.CENTER_INNER_CIRCLE&&this.ctx.arc(this.courtCenter.x,this.courtCenter.y,2,0,2*Math.PI,!0),this.ctx.stroke()}}}]),e}(No);function Nc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var oc=function(t){io()(e,t);var n=Nc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No);function cc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ac=function(t){io()(e,t);var n=cc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtCenter.x,y:19},n=this.courtTypeConstants.FREE_THROW_INNER_WIDTH/2;this.ctx.beginPath(),this.ctx.arc(t.x,t.y,n,0,Math.PI,!1),this.ctx.stroke(),this.courtTypeConstants.FREE_THROW_INNER_DASHED_CIRCLE&&(this.ctx.setLineDash([1,.5]),this.ctx.beginPath(),this.ctx.arc(t.x,t.y,n,0,Math.PI,!0),this.ctx.stroke())}}]),e}(No);function Dc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var sc=function(t){io()(e,t);var n=Dc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtCenter.x,y:5.25},n={x:t.x-3,y:4},e={x:t.x+3,y:4};this.ctx.beginPath(),this.ctx.moveTo(n.x,n.y),this.ctx.lineTo(e.x,e.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.arc(t.x,t.y,.75,0,2*Math.PI,!0),this.ctx.stroke()}}]),e}(No);function Tc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var gc=function(t){io()(e,t);var n=Tc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this.courtTypeConstants.FREE_THROW_INNER_WIDTH,n=this.courtTypeConstants.FREE_THROW_OUTER_WIDTH,e={x:this.courtCenter.x-t/2,y:0},r={x:this.courtCenter.x-n/2,y:0};this.ctx.beginPath(),this.ctx.rect(e.x,e.y,t,19),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.rect(r.x,r.y,n,19),this.ctx.stroke()}}]),e}(No);function lc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ic=function(t){io()(e,t);var n=lc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtCenter.x,y:5.25},n={x:this.courtCenter.x+4,y:4},e={x:this.courtCenter.x+4,y:5.25},r={x:this.courtCenter.x-4,y:4};this.ctx.beginPath(),this.ctx.moveTo(n.x,n.y),this.ctx.lineTo(e.x,e.y),this.ctx.arc(t.x,t.y,4,0,Math.PI,!1),this.ctx.lineTo(r.x,r.y),this.ctx.stroke()}}]),e}(No);function jc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var yc=function(t){io()(e,t);var n=jc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this.courtCenter.x-this.courtTypeConstants.HOOP_CORNER_DISTANCE,n=this.courtTypeConstants.COURT_RECT_WIDTH-t,e={x:t,y:0},r={x:t,y:this.courtTypeConstants.THREE_POINT_OFFSET_ORIGIN_Y_APPROX},i={x:n,y:0},u={x:this.courtCenter.x,y:5.25},M=Math.asin((this.courtTypeConstants.THREE_POINT_ASIN_APPROX-.75-.5)/this.courtTypeConstants.THREE_POINT_ARC_RADIUS),N=Math.PI-M;this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.arc(u.x,u.y,this.courtTypeConstants.THREE_POINT_ARC_RADIUS,N,M,!0),this.ctx.lineTo(i.x,i.y),this.ctx.stroke()}}]),e}(No),hc=.1667,zc=1.5,Oc=1,Ac=.33,xc=!0;function Ec(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var fc=function(t){io()(e,t);var n=Ec(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t=this,n=this.courtCenter.x,e=5.25,r={x:this.courtCenter.x,y:e+30},i=[{x:n-30*Math.cos(50*Math.PI/180),y:e+30*Math.sin(50*Math.PI/180)},r,{x:n+30*Math.cos(50*Math.PI/180),y:e+30*Math.sin(50*Math.PI/180)}];this.ctx.lineWidth=3*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.font="".concat(4,"px Helvetica"),i.forEach((function(n){t.ctx.beginPath(),t.ctx.arc(n.x,n.y,2,0,2*Math.PI,!0),t.ctx.stroke(),"transparent"!==t.options.lineColor&&(t.ctx.fillStyle="#001c4f",t.ctx.fill()),t.ctx.fillStyle=t.options.lineColor,t.ctx.fillText("4",n.x-1.1,n.y+1.4)}))}}]),e}(No),pc={drawLogic:function(){var t=this,n=this.courtTypeConstants.FREE_THROW_OUTER_WIDTH/2,e=this.courtCenter.x-n,r=this.courtCenter.x+n,i=this.courtCenter.x-5,u=this.courtCenter.x+5;[7,8,11,14].forEach((function(n){t.ctx.beginPath(),t.ctx.moveTo(e,n),t.ctx.lineTo(e-.667,n),t.ctx.moveTo(r,n),t.ctx.lineTo(r+.667,n),t.ctx.stroke()})),this.ctx.beginPath(),this.ctx.moveTo(i,13),this.ctx.lineTo(i+.5,13),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(u,13),this.ctx.lineTo(u-.5,13),this.ctx.stroke()}};function Uc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var dc=function(t){io()(e,t);var n=Uc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(dc.prototype,pc);var Cc=50,Qc=94,wc=22,Sc=23.6762,Lc=10,kc=14,vc=12,Yc=16,mc=!0,Fc=!0,Rc=!0;function bc(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Bc=function(t){io()(e,t);var n=bc(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this,n=this.courtTypeConstants.FREE_THROW_OUTER_WIDTH/2,e=this.courtCenter.x-n,r=this.courtCenter.x+n;[5.9,13.6,16.5].forEach((function(n){t.ctx.beginPath(),t.ctx.moveTo(e,n),t.ctx.lineTo(e-.333,n),t.ctx.moveTo(r,n),t.ctx.lineTo(r+.333,n),t.ctx.stroke()})),this.ctx.beginPath(),this.ctx.rect(e,8.8,-.333,1.9),this.ctx.fill(),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.rect(r,8.8,.333,1.9),this.ctx.fill(),this.ctx.stroke()}}]),e}(No),Zc=49.21,Vc=91.86,Wc=21.65,Gc=22.15,Pc=6,Jc=8,Hc=12,Xc=16.08,Kc=!1,qc=!1,_c=!1;function $c(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ta=function(t){io()(e,t);var n=$c(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(ta.prototype,pc);var na=50,ea=94,ra=22,ia=23.6762,ua=10,Ma=14,Na=12,oa=16,ca=!0,aa=!0,Da=!0,sa={drawLogic:function(){var t=this,n=this.courtTypeConstants.FREE_THROW_OUTER_WIDTH/2,e=this.courtCenter.x-n,r=this.courtCenter.x+n;[11,14,17].forEach((function(n){t.ctx.beginPath(),t.ctx.moveTo(e,n),t.ctx.lineTo(e-.667,n),t.ctx.moveTo(r,n),t.ctx.lineTo(r+.667,n),t.ctx.stroke()})),this.ctx.beginPath(),this.ctx.rect(e,7,-1.2,.8),this.ctx.fill(),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.rect(r,7,1.2,.8),this.ctx.fill(),this.ctx.stroke()}};function Ta(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ga=function(t){io()(e,t);var n=Ta(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(ga.prototype,sa);var la=50,Ia=94,ja=20.75,ya=20.75,ha=2,za=6,Oa=12,Aa=12,xa=!1,Ea=!1,fa=!1;function pa(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ua=function(t){io()(e,t);var n=pa(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(Ua.prototype,sa);var da=50,Ca=94,Qa=20.75,wa=20.75,Sa=2,La=6,ka=12,va=12,Ya=!1,ma=!1,Fa=!0;function Ra(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ba=function(t){io()(e,t);var n=Ra(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(ba.prototype,sa);var Ba=50,Za=84,Va=19.75,Wa=19.75,Ga=2,Pa=6,Ja=12,Ha=12,Xa=!1,Ka=!1,qa=!1;function _a(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var $a=function(t){io()(e,t);var n=_a(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign($a.prototype,sa);var tD=42,nD=74,eD=19.75,rD=19.75,iD=2,uD=6,MD=12,ND=12,oD=!1,cD=!1,aD=!1;function DD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var sD=function(t){io()(e,t);var n=DD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}}]),e}(No);Object.assign(sD.prototype,pc);var TD=50,gD=94,lD=21.65,ID=22.15,jD=6,yD=9,hD=12,zD=16,OD=!0,AD=!0,xD=!0;function ED(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var fD=function(t){io()(e,t);var n=ED(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No);function pD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var UD=function(t){io()(e,t);var n=pD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No);function dD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var CD=function(t){io()(e,t);var n=dD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=0,n=30,e={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:30};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t,n),this.ctx.lineTo(e.x,e.y),this.ctx.stroke()}}]),e}(No);function QD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var wD=function(t){io()(e,t);var n=QD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t=this.courtTypeConstants.END_ZONE_HEIGHT,n=String.fromCharCode(8202);this.ctx.fillStyle=this.options.lineColor,this.ctx.translate(20,t);for(var e=1;e<10;e++){var r="".concat(e<=5?e:10-e).concat(n,"0");this.ctx.translate(0,this.courtTypeConstants.END_ZONE_HEIGHT),this.ctx.save(),this.ctx.rotate(Math.PI/2),this.ctx.fillText(r,-6,0),this.ctx.translate(0,40-this.courtTypeConstants.COURT_RECT_WIDTH),this.ctx.rotate(Math.PI),this.ctx.fillText(r,-6,0),this.ctx.restore()}}}]),e}(No);function SD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var LD=function(t){io()(e,t);var n=SD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this,n=[3,53,this.courtTypeConstants.COURT_RECT_WIDTH-53-3,this.courtTypeConstants.COURT_RECT_WIDTH-3-3];this.ctx.save(),this.ctx.lineWidth=this.courtTypeConstants.COURT_LINE_WIDTH;for(var e=function(e){n.forEach((function(n){for(var r=0;r<4;r++){var i=3+3*r,u={x:n,y:e-i},M={x:n+3,y:e-i};t.ctx.beginPath(),t.ctx.moveTo(u.x,u.y),t.ctx.lineTo(M.x,M.y),t.ctx.stroke()}}))},r=this.courtTypeConstants.END_ZONE_HEIGHT+15;r<=this.courtCenter.y;r+=15)e(r);this.ctx.restore()}}]),e}(No);function kD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var vD=function(t){io()(e,t);var n=kD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){for(var t=this.courtTypeConstants.END_ZONE_HEIGHT;t<=this.courtCenter.y;t+=15){var n={x:0,y:t},e={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:t};this.ctx.beginPath(),this.ctx.lineWidth=t%30==0?2*this.courtTypeConstants.COURT_LINE_WIDTH:this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(n.x,n.y),this.ctx.lineTo(e.x,e.y),this.ctx.stroke()}}}]),e}(No),YD=.32,mD=1.5,FD=2,RD=.55,bD=!1,BD=160,ZD=360,VD=30;function WD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var GD=function(t){io()(e,t);var n=WD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.setColor("#000"),this.ctx.lineWidth=4*this.courtTypeConstants.COURT_LINE_WIDTH;var t=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH-this.courtTypeConstants.END_ZONE_LENGTH,n=(this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.FACE_OFF_SPOTS_DISTANCE)/2,e=[{x:0,y:this.courtCenter.y},{x:0,y:t}],r=[{x:n,y:0},{x:this.courtTypeConstants.COURT_RECT_WIDTH-n,y:0}],i=[{x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y},{x:this.courtTypeConstants.COURT_RECT_WIDTH,y:t}];this.ctx.beginPath(),this.ctx.moveTo(e[0].x,e[0].y),this.ctx.lineTo(e[1].x,e[1].y),this.ctx.bezierCurveTo(0,0,10,0,r[0].x,r[0].y),this.ctx.lineTo(r[1].x,r[1].y),this.ctx.bezierCurveTo(this.courtTypeConstants.COURT_RECT_WIDTH-10,0,this.courtTypeConstants.COURT_RECT_WIDTH,0,i[1].x,i[1].y),this.ctx.lineTo(i[0].x,i[0].y),this.ctx.stroke()}}]),e}(No);function PD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var JD=function(t){io()(e,t);var n=PD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_BLUE),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,15,0,2*Math.PI,!0),this.ctx.stroke()}}]),e}(No);function HD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var XD=function(t){io()(e,t);var n=HD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.setLineDash([2,1]),this.ctx.lineWidth=4*this.courtTypeConstants.COURT_LINE_WIDTH;var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No);function KD(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var qD=function(t){io()(e,t);var n=KD(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_BLUE),this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,1,0,2*Math.PI,!0),this.ctx.fill()}}]),e}(No);function _D(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var $D=function(t){io()(e,t);var n=_D(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this;this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH;var n=(this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.FACE_OFF_SPOTS_DISTANCE)/2,e=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH-this.courtTypeConstants.END_ZONE_LENGTH+22;[{x:n,y:e},{x:this.courtTypeConstants.COURT_RECT_WIDTH-n,y:e}].forEach((function(n){t.ctx.beginPath(),t.ctx.arc(n.x,n.y,t.courtTypeConstants.FACE_OFF_SPOT_RADIUS,0,2*Math.PI,!0),t.ctx.fill(),t.ctx.beginPath(),t.ctx.arc(n.x,n.y,t.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS,0,2*Math.PI,!0),t.ctx.stroke(),[{ox:n.x-t.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS,tx:n.x-(t.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS+1)},{ox:n.x+t.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS,tx:n.x+(t.courtTypeConstants.FACE_OFF_SPOT_CIRCLE_RADIUS+1)}].forEach((function(e){[n.y-1,n.y+1].forEach((function(n){t.ctx.beginPath(),t.ctx.moveTo(e.ox,n),t.ctx.lineTo(e.tx,n),t.ctx.stroke()}))}))}))}}]),e}(No);function ts(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ns=function(t){io()(e,t);var n=ts(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH;var t=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH-this.courtTypeConstants.END_ZONE_LENGTH;this.ctx.beginPath(),this.ctx.moveTo(0,t),this.ctx.lineTo(this.courtTypeConstants.COURT_RECT_WIDTH,t),this.ctx.stroke()}}]),e}(No);function es(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var rs=function(t){io()(e,t);var n=es(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_BLUE),this.ctx.lineWidth=4*this.courtTypeConstants.COURT_LINE_WIDTH;var t={x:0,y:this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH};this.ctx.beginPath(),this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke(),this.setColor(this.courtTypeConstants.LINE_COLOR_RED);var e=(this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.FACE_OFF_SPOTS_DISTANCE)/2,r=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH+5,i={x:e,y:r},u={x:this.courtTypeConstants.COURT_RECT_WIDTH-e,y:r};this.ctx.beginPath(),this.ctx.arc(i.x,i.y,this.courtTypeConstants.FACE_OFF_SPOT_RADIUS,0,2*Math.PI,!0),this.ctx.fill(),this.ctx.beginPath(),this.ctx.arc(u.x,u.y,this.courtTypeConstants.FACE_OFF_SPOT_RADIUS,0,2*Math.PI,!0),this.ctx.fill()}}]),e}(No);function is(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var us=function(t){io()(e,t);var n=is(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(0,this.courtCenter.y,10,-Math.PI/2,Math.PI/2,!1),this.ctx.stroke()}}]),e}(No),Ms=.1667,Ns=1.5,os=2,cs=.55,as=!0;function Ds(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ss=function(t){io()(e,t);var n=Ds(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH;var t=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH-this.courtTypeConstants.END_ZONE_LENGTH;this.ctx.beginPath(),this.ctx.moveTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,t),this.ctx.lineTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,t+this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,t+this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,t),this.ctx.stroke(),this.setColor("#000"),this.ctx.beginPath(),this.ctx.moveTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t),this.ctx.lineTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t-this.courtTypeConstants.GOAL_CAGE_DEPTH),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t-this.courtTypeConstants.GOAL_CAGE_DEPTH),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t),this.ctx.stroke()}}]),e}(No),Ts=85,gs=200,ls="#C8102E",Is="#0032A0",js=64,ys=25,hs=44,zs=.75,Os=15,As=6,xs=3,Es=4;function fs(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var ps=function(t){io()(e,t);var n=fs(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.setColor(this.courtTypeConstants.LINE_COLOR_RED),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH;var t=this.courtCenter.y-this.courtTypeConstants.NEUTRAL_ZONE_LENGTH-this.courtTypeConstants.END_ZONE_LENGTH;this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,t,this.courtTypeConstants.GOAL_CREASE_ARC_RADIUS,0,Math.PI,!1),this.ctx.stroke(),this.setColor("#000"),this.ctx.beginPath(),this.ctx.moveTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t),this.ctx.lineTo(this.courtCenter.x-this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t-this.courtTypeConstants.GOAL_CAGE_DEPTH),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t-this.courtTypeConstants.GOAL_CAGE_DEPTH),this.ctx.lineTo(this.courtCenter.x+this.courtTypeConstants.GOAL_CAGE_LENGTH/2,t),this.ctx.stroke()}}]),e}(No),Us=100,ds=200,Cs="#C8102E",Qs="#0032A0",ws=58,Ss=29,Ls=44,ks=.75,vs=15,Ys=6,ms=3,Fs=5.8;function Rs(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var bs=function(t){io()(e,t);var n=Rs(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No);function Bs(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Zs=function(t){io()(e,t);var n=Bs(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y-this.courtTypeConstants.RESTRAINING_CENTER_OFFSET_Y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y-this.courtTypeConstants.RESTRAINING_CENTER_OFFSET_Y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No),Vs=.1667,Ws=1.5,Gs=1,Ps=.33,Js=!0;function Hs(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Xs=function(t){io()(e,t);var n=Hs(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke();var e=[{x:this.courtCenter.x-1,y:this.courtCenter.y-1},{x:this.courtCenter.x+1,y:this.courtCenter.y-1},{x:this.courtCenter.x+1,y:this.courtCenter.y+1},{x:this.courtCenter.x-1,y:this.courtCenter.y+1}];this.ctx.beginPath(),this.ctx.moveTo(e[0].x,e[0].y),this.ctx.lineTo(e[2].x,e[2].y),this.ctx.moveTo(e[1].x,e[1].y),this.ctx.lineTo(e[3].x,e[3].y),this.ctx.stroke()}}]),e}(No);function Ks(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var qs=function(t){io()(e,t);var n=Ks(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtTypeConstants.WING_OFFSET_X,y:0},n={x:this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y-this.courtTypeConstants.RESTRAINING_CENTER_OFFSET_Y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke();var e={x:this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.WING_OFFSET_X,y:0},r={x:this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y-this.courtTypeConstants.RESTRAINING_CENTER_OFFSET_Y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.stroke();var i={x:this.courtCenter.x,y:15};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(i.x-1,i.y),this.ctx.lineTo(i.x+1,i.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.arc(i.x,i.y,3,0,2*Math.PI,!0),this.ctx.stroke()}}]),e}(No);function _s(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var $s=function(t){io()(e,t);var n=_s(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y-10},n={x:this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke();var e={x:this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y-10},r={x:this.courtTypeConstants.COURT_RECT_WIDTH-this.courtTypeConstants.WING_OFFSET_X,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.stroke()}}]),e}(No),tT=60,nT=110,eT=10,rT=20;function iT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var uT=function(t){io()(e,t);var n=iT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:this.courtCenter.x-1.5,y:this.courtCenter.y},n={x:this.courtCenter.x+1.5,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,10,0,2*Math.PI,!0),this.ctx.stroke()}}]),e}(No);function MT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var NT=function(t){io()(e,t);var n=MT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this,n={x:this.courtCenter.x,y:this.courtCenter.y-this.courtTypeConstants.RESTRAINING_CENTER_OFFSET_Y-30};this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(n.x,n.y,2.84,0,2*Math.PI,!1),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.arc(n.x,n.y,15.97,0,Math.PI,!1),this.ctx.stroke();var e={x:n.x-15.97,y:n.y},r={x:n.x-2.84,y:n.y},i={x:n.x+15.97,y:n.y},u={x:n.x+2.84,y:n.y};this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.moveTo(i.x,i.y),this.ctx.lineTo(u.x,u.y),this.ctx.stroke();var M={x:n.x,y:n.y-2.84},N=Math.PI/4,o=Math.PI/2+Math.PI/4;this.ctx.beginPath(),this.ctx.arc(M.x,M.y,14.43,N,o,!1),this.ctx.stroke();var c=oT(M,14.43,o),a=oT(M,14.43,N),D=n.x-2.84,s=n.x+2.84;this.ctx.beginPath(),this.ctx.moveTo(c.x,c.y),this.ctx.lineTo(D,n.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(a.x,a.y),this.ctx.lineTo(s,n.y),this.ctx.stroke();var T={x:D-8.75,y:n.y},g={x:s+8.75,y:n.y};this.ctx.beginPath(),this.ctx.moveTo(T.x,T.y),this.ctx.lineTo(T.x,T.y+1),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(g.x,g.y),this.ctx.lineTo(g.x,g.y+1),this.ctx.stroke();var l=oT(M,14.43,Math.PI/2);this.ctx.beginPath(),this.ctx.moveTo(l.x,l.y-1),this.ctx.lineTo(l.x,l.y+1),this.ctx.stroke();for(var I=function(n){[1,-1].forEach((function(e){var r=Math.PI/2+Math.PI/10*e*n,i=oT(M,14.43,r);t.ctx.save(),t.ctx.translate(i.x,i.y),t.ctx.rotate(Math.PI/10*e*n),t.ctx.beginPath(),t.ctx.moveTo(0,-1),t.ctx.lineTo(0,1),t.ctx.stroke(),t.ctx.restore()}))},j=1;j<=3;j++)I(j);var y={x:T.x,y:T.y-5},h={x:g.x,y:g.y-5};this.ctx.beginPath(),this.ctx.arc(y.x,y.y,.5,0,2*Math.PI,!1),this.ctx.arc(h.x,h.y,.5,0,2*Math.PI,!1),this.ctx.fill();var z={x:n.x-1,y:n.y},O={x:n.x+1,y:n.y},A={x:n.x,y:n.y-1};this.ctx.beginPath(),this.ctx.moveTo(z.x,z.y),this.ctx.lineTo(O.x,O.y),this.ctx.lineTo(A.x,A.y),this.ctx.closePath(),this.ctx.stroke()}}]),e}(No);function oT(t,n,e){return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}}var cT=60,aT=130,DT=20;function sT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var TT=function(t){io()(e,t);var n=sT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No);function gT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var lT=function(t){io()(e,t);var n=gT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,this.courtTypeConstants.CENTER_CIRCLE_RADIUS,0,2*Math.PI,!0),this.ctx.stroke()}}]),e}(No);function IT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var jT=function(t){io()(e,t);var n=IT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No);function yT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var hT=function(t){io()(e,t);var n=yT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtCenter.y,.25,0,2*Math.PI,!0),this.ctx.fill()}}]),e}(No);function zT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var OT=function(t){io()(e,t);var n=zT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=0,n=0,e={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:0};this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(t,n,1,0,Math.PI/2,!1),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.arc(e.x,e.y,1,Math.PI,Math.PI/2,!0),this.ctx.stroke()}}]),e}(No);function AT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var xT=function(t){io()(e,t);var n=AT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtTypeConstants.PENALTY_SPOT_OFFSET_Y,this.courtTypeConstants.CENTER_CIRCLE_RADIUS,Math.PI/5,Math.PI-Math.PI/5,!1),this.ctx.stroke()}}]),e}(No);function ET(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var fT=function(t){io()(e,t);var n=ET(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.rect(this.courtCenter.x-this.courtTypeConstants.PENALTY_AREA.width/2,0,this.courtTypeConstants.PENALTY_AREA.width,this.courtTypeConstants.PENALTY_AREA.height),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.rect(this.courtCenter.x-this.courtTypeConstants.GOAL_AREA.width/2,0,this.courtTypeConstants.GOAL_AREA.width,this.courtTypeConstants.GOAL_AREA.height),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.rect(this.courtCenter.x-this.courtTypeConstants.GOAL.width/2,-this.courtTypeConstants.GOAL.height,this.courtTypeConstants.GOAL.width,this.courtTypeConstants.GOAL.height),this.ctx.stroke()}}]),e}(No);function pT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var UT=function(t){io()(e,t);var n=pT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtTypeConstants.PENALTY_SPOT_OFFSET_Y,.25,0,2*Math.PI,!1),this.ctx.fill()}}]),e}(No),dT=.1667,CT=1.5,QT=1,wT=.33,ST=!0,LT=60,kT=110,vT=10,YT=12,mT={width:44,height:18},FT={width:8,height:2.66},RT={width:20,height:6},bT=60,BT=110,ZT=10,VT=12,WT={width:44,height:18},GT={width:8,height:2.66},PT={width:20,height:6};function JT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var HT=function(t){io()(e,t);var n=JT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t=[{x:this.courtCenter.x-1,y:this.courtCenter.y-1},{x:this.courtCenter.x+1,y:this.courtCenter.y-1},{x:this.courtCenter.x+1,y:this.courtCenter.y+1},{x:this.courtCenter.x-1,y:this.courtCenter.y+1}];this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.lineTo(t[2].x,t[2].y),this.ctx.moveTo(t[1].x,t[1].y),this.ctx.lineTo(t[3].x,t[3].y),this.ctx.stroke()}}]),e}(No);function XT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var KT=function(t){io()(e,t);var n=XT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=11,n=0,e={x:this.courtTypeConstants.COURT_RECT_WIDTH-11,y:0};this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(t,n-1),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(e.x,e.y-1),this.ctx.stroke()}}]),e}(No);function qT(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var _T=function(t){io()(e,t);var n=qT(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.moveTo(this.courtCenter.x-.33,12),this.ctx.lineTo(this.courtCenter.x+.33,12),this.ctx.stroke()}}]),e}(No),$T=70,tg=115,ng=10,eg=12,rg={width:44,height:18},ig={width:8,height:2.66},ug={width:20,height:6};function Mg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ng=function(t){io()(e,t);var n=Mg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=11,n=0,e={x:this.courtTypeConstants.COURT_RECT_WIDTH-11,y:0};this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(t,n-1),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(e.x,e.y-1),this.ctx.stroke()}}]),e}(No);function og(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var cg=function(t){io()(e,t);var n=og(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.moveTo(this.courtCenter.x-.33,12),this.ctx.lineTo(this.courtCenter.x+.33,12),this.ctx.stroke()}}]),e}(No),ag=60,Dg=100,sg=10,Tg=12,gg={width:44,height:18},lg={width:8,height:2.66},Ig={width:20,height:6};function jg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var yg=function(t){io()(e,t);var n=jg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH;var t={x:0,y:this.courtTypeConstants.COURT_RECT_HEIGHT/3},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtTypeConstants.COURT_RECT_HEIGHT/3};this.ctx.beginPath(),this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke()}}]),e}(No);function hg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var zg=function(t){io()(e,t);var n=hg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtTypeConstants.PENALTY_SPOT_OFFSET_Y,this.courtTypeConstants.CENTER_CIRCLE_RADIUS,Math.PI/12,Math.PI-Math.PI/12,!1),this.ctx.stroke()}}]),e}(No),Og=45,Ag=65,xg=8,Eg=10,fg={width:24,height:12},pg={width:6,height:2},Ug={width:8,height:4};function dg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Cg=function(t){io()(e,t);var n=dg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.arc(this.courtCenter.x,this.courtTypeConstants.PENALTY_SPOT_OFFSET_Y,this.courtTypeConstants.CENTER_CIRCLE_RADIUS,Math.PI/6,Math.PI-Math.PI/6,!1),this.ctx.stroke()}}]),e}(No),Qg=55,wg=80,Sg=8,Lg=10,kg={width:36,height:14},vg={width:6.16,height:2.16},Yg={width:12,height:5};function mg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Fg=function(t){io()(e,t);var n=mg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y-9.8},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y-9.8};this.ctx.beginPath(),this.ctx.lineWidth=this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke();for(var e=.574,r=0;r<5;r++)this.ctx.beginPath(),this.ctx.moveTo(t.x-e,t.y),this.ctx.lineTo(t.x-e-.574,n.y),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(n.x+e,t.y),this.ctx.lineTo(n.x+e+.574,n.y),this.ctx.stroke(),e+=1.148}}]),e}(No);function Rg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var bg=function(t){io()(e,t);var n=Rg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.rect(0,0,this.courtTypeConstants.COURT_RECT_WIDTH,this.courtTypeConstants.COURT_RECT_HEIGHT),this.ctx.stroke()}}]),e}(No);function Bg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Zg=function(t){io()(e,t);var n=Bg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLogic",value:function(){var t={x:0,y:this.courtCenter.y},n={x:this.courtTypeConstants.COURT_RECT_WIDTH,y:this.courtCenter.y};this.ctx.beginPath(),this.ctx.lineWidth=2*this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(n.x,n.y),this.ctx.stroke(),this.ctx.beginPath()}}]),e}(No);function Vg(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Wg,Gg,Pg,Jg,Hg,Xg,Kg,qg,_g,$g=function(t){io()(e,t);var n=Vg(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"reflection",value:function(){return!0}},{key:"drawLogic",value:function(){var t=this.courtTypeConstants.COURT_RECT_WIDTH;this.ctx.beginPath(),this.ctx.moveTo(0,-.574),this.ctx.lineTo(0,-1.148),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(t,-.574),this.ctx.lineTo(t,-1.148),this.ctx.stroke()}}]),e}(No),tl=.1667,nl=1.5,el=1,rl=.33,il=!0,ul=29.5,Ml=59.1,Nl=(Wg={},It()(Wg,rn,M),It()(Wg,qt,a),It()(Wg,$t,d),It()(Wg,en,w),It()(Wg,tn,m),It()(Wg,nn,V),It()(Wg,_t,nt),Wg),ol=(Xg={},It()(Xg,rn,It()({},pn,c)),It()(Xg,qt,(Gg={},It()(Gg,un,s),It()(Gg,Mn,g),It()(Gg,Nn,I),It()(Gg,on,y),It()(Gg,cn,z),It()(Gg,an,A),It()(Gg,Dn,E),It()(Gg,sn,p),Gg)),It()(Xg,$t,{}),It()(Xg,en,(Pg={},It()(Pg,En,L),It()(Pg,fn,v),Pg)),It()(Xg,tn,(Jg={},It()(Jg,In,R),It()(Jg,jn,B),Jg)),It()(Xg,nn,(Hg={},It()(Hg,hn,J),It()(Hg,zn,X),It()(Hg,On,q),It()(Hg,An,$),Hg)),It()(Xg,_t,{}),Xg),cl=(Kg={},It()(Kg,rn,N),It()(Kg,qt,D),It()(Kg,$t,C),It()(Kg,en,S),It()(Kg,tn,F),It()(Kg,nn,W),It()(Kg,_t,et),Kg),al=(qg={},It()(qg,pn,o),It()(qg,un,T),It()(qg,Mn,l),It()(qg,Nn,j),It()(qg,on,h),It()(qg,cn,O),It()(qg,an,x),It()(qg,Dn,f),It()(qg,sn,U),It()(qg,gn,Q),It()(qg,Tn,Q),It()(qg,En,k),It()(qg,fn,Y),It()(qg,In,b),It()(qg,jn,Z),It()(qg,yn,P),It()(qg,hn,H),It()(qg,zn,K),It()(qg,On,_),It()(qg,An,tt),It()(qg,xn,G),It()(qg,ln,rt),qg),Dl=(_g={},It()(_g,rn,{courtTypes:[pn]}),It()(_g,qt,{courtTypes:[un,Mn,Nn,on,cn,an,Dn,sn]}),It()(_g,$t,{courtTypes:[Tn]}),It()(_g,en,{courtTypes:[En,fn]}),It()(_g,tn,{courtTypes:[In,jn]}),It()(_g,nn,{courtTypes:[yn,hn,zn,On,An,xn]}),It()(_g,_t,{courtTypes:[ln]}),_g);function sl(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}var Tl=function(){function t(n,e,r){st()(this,t),this.ctx=n,this.playData=e,this.options=r}return gt()(t,[{key:"courtTypeConstants",get:function(){if(!cl[this.playData.sport])throw new Error("unknown sport type constants");if(!al[this.playData.court.type])throw new Error("unknown court type constants");return function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?sl(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):sl(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}({},cl[this.playData.sport],{},al[this.playData.court.type])}}]),t}();function gl(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function ll(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Il=function(t){io()(e,t);var n=ll(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.init(),this.ctx.save(),this.ctx.lineWidth=this.courtTypeConstants.COURT_LINE_WIDTH,this.setColor(),Object.values(this.courtTypeLayers).forEach((function(n){new n(t).apply()})),this.ctx.restore()}},{key:"init",value:function(){this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.setBackground(),this.setWatermark(),this.ctx.restore()}},{key:"setColor",value:function(){var t=this.options.lineColor||"#fff";this.ctx.strokeStyle=t,this.ctx.fillStyle=t}},{key:"setBackground",value:function(){this.staticData.backgroundOptions&&this.staticData.backgroundOptions[this.background]?(this.ctx.fillStyle=this.ctx.createPattern(this.staticData.backgroundOptions[this.background],"repeat"),this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)):0===this.background.indexOf("#")&&(this.ctx.save(),this.ctx.fillStyle=this.background,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore())}},{key:"setWatermark",value:function(){var t=this.options.watermark?this.staticData.watermark[this.options.watermark]:null;if(t){var n=t.width/t.height,e=this.frameWidth/5,r={width:e,height:e*t.height/t.width};n<1&&(r.width=e*t.width/t.height,r.height=e);var i=this.playData.court.courtRect.size.height>this.courtTypeConstants.COURT_RECT_HEIGHT?Math.abs(this.playData.court.courtRect.origin.y):0,u=(1+Math.abs(this.playData.court.courtRect.origin.x))*this.scale,M=(this.playData.court.courtRect.size.height-i-1)*this.scale-r.height;this.ctx.drawImage(t,0,0,t.width,t.height,u,M,r.width,r.height)}}},{key:"frameWidth",get:function(){return this.options.width}},{key:"scale",get:function(){return this.options.scale}},{key:"staticData",get:function(){return this.options.staticData}},{key:"courtTypeLayers",get:function(){if(!Nl[this.playData.sport])throw new Error("unknown sport type layer");return function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?gl(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):gl(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}({},Nl[this.playData.sport],{},(ol[this.playData.sport]||{})[this.playData.court.type]||{})}},{key:"background",get:function(){return this.options.background||this.playData.sport}}]),e}(Tl),jl=e(11),yl=e.n(jl),hl={drawLineFromControlPoints:function(){var t=this;this.ctx.save(),this.setLineOptions(),this.ctx.lineJoin="round",this.getProcessedLinePaths().forEach((function(n){t.ctx.save(),n.alpha&&t.setColor(n.alpha),t.ctx.beginPath();var e=n.controlPoints;t.ctx.moveTo(e[0].x,e[0].y),2===e.length&&("DRIBBLE"===(t.line||t.shape||{}).type&&(t.ctx.lineCap="round"),t.ctx.lineTo(e[1].x,e[1].y)),3===e.length&&t.ctx.quadraticCurveTo(e[1].x,e[1].y,e[2].x,e[2].y),4===e.length&&t.ctx.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y),t.ctx.stroke(),t.ctx.restore()})),this.ctx.restore()},drawArrowLineCap:function(t){var n=t||this.arrowTipPoint();this.ctx.save();var e=this.angleBetweenLastTwoPoints(),r=n,i={x:r.x-1.4/1.3,y:r.y},u={x:r.x-1.4-1.4/6,y:r.y-.7},M={x:r.x-1.4-1.4/6,y:r.y+.7};this.ctx.beginPath(),this.ctx.translate(r.x,r.y),this.ctx.rotate(e),this.ctx.translate(-r.x,-r.y),this.ctx.moveTo(i.x,i.y),this.ctx.lineTo(u.x,u.y),this.ctx.lineTo(r.x,r.y),this.ctx.lineTo(M.x,M.y),this.ctx.lineTo(i.x,i.y),this.ctx.fill(),this.ctx.stroke(),this.ctx.restore()},drawPerpendicularLineCap:function(){this.drawPerpendicularLineAtCourtPoint(this.arrowTipPoint(),this.angleBetweenLastTwoPoints())},drawPerpendicularLineAtCourtPoint:function(t,n){this.ctx.save();var e={x:t.x,y:t.y-1.5},r={x:t.x,y:t.y+1.5};this.ctx.beginPath(),this.ctx.translate(t.x,t.y),this.ctx.rotate(n),this.ctx.translate(-t.x,-t.y),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(r.x,r.y),this.ctx.fill(),this.ctx.stroke(),this.ctx.restore()},handOffLineCap:function(t){var n=this;this.ctx.save(),t.forEach((function(t){var e=t.controlPoints,r=n.calcMidPoint(e[0],e[e.length-1]),i=n.angleBetweenLastTwoPoints(),u=.5*Math.cos(i),M=.5*Math.sin(i),N={x:r.x+u,y:r.y+M},o={x:r.x-u,y:r.y-M};n.drawPerpendicularLineAtCourtPoint(N,i),n.drawPerpendicularLineAtCourtPoint(o,i),n.ctx.stroke()})),this.ctx.restore()},calcMidPoint:function(t,n){return{x:t.x+(n.x-t.x)/2,y:t.y+(n.y-t.y)/2}},angleBetweenLastTwoPoints:function(){var t=$n()(this.getProcessedLinePaths()).pop().controlPoints,n=t[t.length-1],e=t[t.length-2];return this.angleBetweenTwoPoints(e,n)},angleBetweenTwoPoints:function(t,n){var e=n.x-t.x,r=n.y-t.y;return Math.atan2(r,e)},arrowTipPoint:function(){var t=$n()(this.getProcessedLinePaths()).pop().controlPoints;return t[t.length-1]},setLineOptions:function(){}};function zl(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function Ol(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?zl(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):zl(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}function Al(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var xl=function(t){io()(e,t);var n=Al(e);function e(t,r){var i;return st()(this,e),(i=n.call(this,t)).line=r,It()(yl()(i),"lineWidth",void 0),It()(yl()(i),"debugMasking",void 0),It()(yl()(i),"startMaskSettings",void 0),It()(yl()(i),"endMaskSettings",void 0),i.lineWidth=t.lineWidth,i.debugMasking=!1,i.startMaskSettings=null,i.endMaskSettings=null,i}return gt()(e,[{key:"drawLineFromControlPoints",value:function(){}},{key:"drawArrowLineCap",value:function(t){}},{key:"handOffLineCap",value:function(t){}},{key:"drawPerpendicularLineCap",value:function(){}},{key:"angleBetweenLastTwoPoints",value:function(){return 0}}]),gt()(e,[{key:"drawLogic",value:function(){!this.options.animationGlobalProgress&&this.courtTypeConstants.LINE_MASKING&&(this.setLineMasking(),this.applyMasking()),this.setColor(),this.drawLineFromControlPoints(),this.drawLineCap()}},{key:"setColor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=!1;if(this.options.position){var e=this.line.originalData,r=e.playerPositionOrigin,i=e.playerPositionTerminus;r!==this.options.position&&i!==this.options.position||(n=!0)}var u=this.line.color,M=u.alpha,N=u.blue,o=u.green,c=u.red,a=n?0:Math.ceil(255*c),D=n?0:Math.ceil(255*o),s=n?255:Math.ceil(255*N),T="rgba(".concat(a,", ").concat(D,", ").concat(s,", ").concat(t||M,")");this.ctx.fillStyle=T,this.ctx.strokeStyle=T}},{key:"getProcessedLinePaths",value:function(){return this.line.getLineParts()}},{key:"applyMasking",value:function(){var t=this;this.line.getLineParts().forEach((function(n,e){var r=n.controlPoints;t.startMaskSettings&&(r=GN(r,t.startMaskSettings.radius,t.startMaskSettings.centerPoint),t.line.setLinePartsAdjustedAtIndex(e,Ol({},n,{controlPoints:r}))),t.endMaskSettings&&(r=GN(r,null,null,t.endMaskSettings.radius,t.endMaskSettings.centerPoint),t.line.setLinePartsAdjustedAtIndex(e,Ol({},n,{controlPoints:r})))}))}},{key:"setLineMasking",value:function(){if(this.line.playerPositionOrigin){var t=this.line.playerPositionOrigin,n=this.line.playerLineSequence;if(0===n){var e=this.playData.players.find((function(n){return n.position===t}));if(e){var r=e.possession?1.5:1;"HANDOFF"!==this.line.type||e.possession||(r=.7),this.startMaskSettings={centerPoint:e.location,radius:r}}}else if(t){var i=this.playData.lines.filter((function(e){return e.playerPositionOrigin===t&&e.playerLineSequence===n-1&&["PASS","HANDOFF"].indexOf(e.type)<0}));if(i.length){var u=Xn()(i,1)[0];if(u.lineParts.length){var M=$n()(u.lineParts).pop(),N=$n()(M.controlPoints).pop();this.startMaskSettings={centerPoint:N,radius:3}}}}}if(this.line.playerPositionTerminus&&"SCREEN"!==this.line.type){var o=3.7,c=$n()(this.line.getLineParts()).pop(),a=$n()(c.controlPoints).pop();["PASS","HANDOFF"].indexOf(this.line.type)>=0&&(o=1.75),this.endMaskSettings={centerPoint:a,radius:o}}this.showMaskingDebug()}},{key:"showMaskingDebug",value:function(){if(!1!==this.debugMasking){if(this.ctx.save(),this.ctx.lineWidth=.04,null!==this.startMaskSettings){var t=this.startMaskSettings.centerPoint,n=t.x,e=t.y;this.ctx.strokeStyle="green",this.ctx.moveTo(n,e),this.ctx.beginPath(),this.ctx.arc(n,e,this.startMaskSettings.radius,0,2*Math.PI,!0),this.ctx.stroke()}if(null!==this.endMaskSettings){var r=this.endMaskSettings.centerPoint,i=r.x,u=r.y;this.ctx.strokeStyle="red",this.ctx.moveTo(i,u),this.ctx.beginPath(),this.ctx.arc(i,u,this.endMaskSettings.radius,0,2*Math.PI,!0),this.ctx.stroke()}this.ctx.restore()}}},{key:"drawLineCap",value:function(){}}]),e}(uo);function El(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}Object.assign(xl.prototype,hl);var fl=function(t){io()(e,t);var n=El(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"allowDrawLineCap",value:function(){return!this.line.hideLineTip&&!(this.options.magnetMode&&!this.options.animationGlobalProgress)}}]),e}(xl);function pl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Ul=function(t){io()(e,t);var n=pl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLineCap",value:function(){this.allowDrawLineCap()&&this.drawArrowLineCap()}}]),e}(fl),dl={convertLinePartsToDribble:function(t){var n=[];return t.forEach((function(e,r){var i=Array(4);e.controlPoints.forEach((function(t,n){i[n]=t}));for(var u=new te(i[0],i[1],i[2],i[3]),M=[],N=0,o=1/u.length;N<=1;)M.push({x:u.mx(N),y:u.my(N),time:N}),N+=o;for(var c=[],a=[],D=0;D<M.length;D++)a.push(M[D]),a.length>1&&(c.push(a),a=[M[D]]);c.forEach((function(e,i){var u=Xn()(e,2),M=u[0],N=u[1],o={x:1.2*(N.x-M.x),y:1.2*(N.y-M.y)},a=(M.x+N.x)/2,D=(M.y+N.y)/2,s={x:-o.y,y:o.x};i%2&&(s={x:o.y,y:-o.x});var T=[M,{x:a+s.x,y:D+s.y},N];1!==t.length&&r!==t.length-1||i===c.length-1&&(T=[M,N]),n.push({controlPoints:T,lpIndex:r})}))})),n}};function Cl(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function Ql(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var wl=function(t){io()(e,t);var n=Ql(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"convertLinePartsToDribble",value:function(t){return[]}},{key:"drawLineCap",value:function(){this.allowDrawLineCap()&&this.drawArrowLineCap()}},{key:"setLineOptions",value:function(){var t=this,n=$n()(this.line.getLineParts()),e=this.convertLinePartsToDribble(n);this.line.setLinePartsAdjusted([]),e.forEach((function(e){var r=e.controlPoints,i=e.lpIndex,u=Xn()(r,1)[0],M=n[i].alpha||t.line.color.alpha;if(t.options.animationGlobalProgress){var N=Xn()(t.line.animationKeyTimeChunks[i],2),o=N[0],c=N[1];yt.a.inRange(t.options.animationGlobalProgress,o,c)&&ht(t.options.animationGlobalProgress,o,c)>u.time&&(M=.1)}t.line.addLinePartAdjusted(function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?Cl(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Cl(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}({},e,{controlPoints:r,alpha:M}))}))}}]),e}(fl);function Sl(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function Ll(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}Object.assign(wl.prototype,dl);var kl=function(t){io()(e,t);var n=Ll(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLineCap",value:function(){this.handOffLineCap(this.line.baseLineParts())}},{key:"getProcessedLinePaths",value:function(){return this.line.getLineParts().map((function(t){var n=t.controlPoints;return function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?Sl(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Sl(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}({},t,{controlPoints:[n[0],n[n.length-1]]})}))}}]),e}(xl);function vl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Yl=function(t){io()(e,t);var n=vl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"setLineOptions",value:function(){this.ctx.setLineDash([1,.5])}},{key:"drawLineCap",value:function(){this.drawArrowLineCap()}}]),e}(xl);function ml(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Fl=function(t){io()(e,t);var n=ml(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLineCap",value:function(){this.allowDrawLineCap()&&this.drawPerpendicularLineCap()}}]),e}(fl);function Rl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var bl=function(t){io()(e,t);var n=Rl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLineCap",value:function(){if(this.allowDrawLineCap()){var t=this.line.lastLinePartControlPoint,n={x:.6,y:0},e=this.angleBetweenLastTwoPoints(),r={x:Math.cos(e)*n.x-Math.sin(e)*n.y,y:Math.sin(e)*n.x-Math.cos(e)*n.y},i={x:t.x+r.x,y:t.y+r.y};this.drawArrowLineCap(i)}}},{key:"setLineOptions",value:function(){this.ctx.lineWidth=.7*this.lineWidth}},{key:"drawLineFromControlPoints",value:function(){var t=this;this.ctx.save(),this.setLineOptions(),this.ctx.lineJoin="round",this.getProcessedLinePaths().forEach((function(n){t.ctx.save(),n.alpha&&t.setColor(n.alpha),t.ctx.beginPath();var e=n.controlPoints;[-.3,.3].forEach((function(n){var r=e[0].x-e[e.length-1].x,i=e[0].y-e[e.length-1].y,u=n/Math.pow(r*r+i*i,.5),M=-i*u,N=r*u,o=e.map((function(t){return{x:t.x+M,y:t.y+N}}));t.ctx.moveTo(o[0].x,o[0].y),2===e.length&&t.ctx.lineTo(o[1].x,o[1].y),3===e.length&&t.ctx.quadraticCurveTo(o[1].x,o[1].y,o[2].x,o[2].y),4===e.length&&t.ctx.bezierCurveTo(o[1].x,o[1].y,o[2].x,o[2].y,o[3].x,o[3].y),t.ctx.stroke()})),t.ctx.restore()})),this.ctx.restore()}}]),e}(fl);function Bl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Zl=function(t){io()(e,t);var n=Bl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.options.linesDisplay&&(this.ctx.save(),this.ctx.lineWidth=this.lineWidth,this.playData.lines.forEach((function(n){if(!(t.options.linesHiddenIds.indexOf(n.id)>=0)){var e="".concat(yt.a.capitalize(n.type),"LineLayer");it[e]&&new it[e](t,n).apply()}})),this.ctx.restore())}},{key:"lineWidth",get:function(){return this.courtTypeConstants.LINE_WIDTH}}]),e}(Tl);function Vl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Wl=function(t){io()(e,t);var n=Vl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.playData.players.length&&(this.ctx.save(),this.playData.players.forEach((function(n){if(!(t.options.playersHiddenPositions.findIndex((function(t){return parseInt(t)===parseInt(n.position)}))>=0)){var e=n.location,r=e.x,i=e.y;if(t.setPlayerPuckStyle(n),t.drawPlayerPuck(n),t.setPlayerLabel(n),t.staticData.playerHats&&t.staticData.playerHats.length){var u=t.options.playersMap.find((function(t){return t.position===n.position})),M=t.staticData.playerHats.find((function(t){return!!(null==u?void 0:u.playerHatKey)&&t.key===u.playerHatKey}));if(M){!0===M.reverse&&(t.ctx.save(),t.ctx.translate(2*r,0),t.ctx.scale(-1,1));var N=M.dX,o=M.dY;t.ctx.drawImage(M.image,r-(2-4*N),i-(1.4+2*t.radius+2.8*o),4,2.8),!0===M.reverse&&t.ctx.restore()}}}})),this.ctx.restore())}},{key:"setPlayerPuckStyle",value:function(t){var n=t.color,e=n.red,r=n.green,i=n.blue,u=n.alpha,M=0===e&&0===r&&0===i&&1===u,N=this.options.position&&t.position===this.options.position,o=N?0:Math.ceil(255*e),c=N?0:Math.ceil(255*r),a=N?255:Math.ceil(255*i),D="rgba(".concat(o,", ").concat(c,", ").concat(a,", ").concat(u,")");t.isDefender&&!N&&M&&(D="#bb271b"),t.possession&&M&&(D="#ff8000"),this.options.legacyPrintStyle&&(D="#000000",this.ctx.lineWidth=this.courtTypeConstants.LINE_WIDTH),this.ctx.fillStyle=D,this.ctx.strokeStyle=D}},{key:"drawPlayerPuck",value:function(t){var n=t.location,e=n.x,r=n.y;this.ctx.beginPath(),this.ctx.arc(e,r,this.radius,0,2*Math.PI,!0),this.options.legacyPrintStyle?t.possession&&this.ctx.stroke():this.ctx.fill()}},{key:"setPlayerLabel",value:function(t){var n=t.location,e=n.x,r=n.y;if(this.staticData.playerHeadshots&&"Headshot"===this.options.labelsOverrideType){var i=this.options.playersMap.find((function(n){return n.position===t.position})),u=this.staticData.playerHeadshots.find((function(t){return t.id===(null==i?void 0:i.teamPlayerId)}));if(this.ctx.save(),this.ctx.translate(e,r),u){this.ctx.save();var M=u.image.width<u.image.height,N=u.image.height<u.image.width,o=M?u.image.height/u.image.width:N?u.image.width/u.image.height:1,c=2*this.radius*(M?u.image.width/u.image.height:1)*o,a=2*this.radius*(N?u.image.height/u.image.width:1)*o,D=0-(N?c/2:this.radius),s=0-(M?a/2:this.radius);this.options.flipPlayerLabels&&this.ctx.rotate(Math.PI),this.ctx.arc(0,0,this.radius,0,2*Math.PI,!0),this.ctx.clip(),this.ctx.drawImage(u.image,D,s,c,a),this.ctx.restore()}if(this.ctx.beginPath(),this.ctx.lineWidth=this.courtTypeConstants.LINE_WIDTH,this.ctx.arc(0,0,this.radius,0,2*Math.PI,!0),this.ctx.stroke(),this.ctx.restore(),u)return}var T=t.color.alpha,g=(3-.5*t.textLabel.length)*(this.options.legacyPrintStyle?1.3:1)*this.playerScale,l=(1-.15*t.textLabel.length)*(this.options.legacyPrintStyle?1.4:1)*this.playerScale;if(T){this.ctx.fillStyle=this.options.legacyPrintStyle?"#000000":"#ffffff",this.ctx.textAlign="center",this.ctx.font="".concat(g,"px Helvetica"),this.options.mirror&&(this.ctx.save(),this.ctx.translate(2*e,0),this.ctx.scale(-1,1));var I=e,j=r;this.options.flipPlayerLabels&&(I=0,j=0,this.ctx.save(),this.ctx.translate(e,r),this.ctx.rotate(Math.PI)),this.ctx.fillText(t.textLabel,I,j+l),this.options.flipPlayerLabels&&this.ctx.restore(),this.options.mirror&&this.ctx.restore()}}},{key:"staticData",get:function(){return this.options.staticData}},{key:"playerScale",get:function(){return this.courtTypeConstants.PLAYER_TOKEN_SCALE*this.options.playerTokenScale}},{key:"radius",get:function(){return this.courtTypeConstants.PLAYER_TOKEN_RADIUS*this.playerScale}}]),e}(Tl);function Gl(t,n){var e=t.hideForStatic&&!n.inDrawingState?0:1;n.animationGlobalProgress&&(e=0,t.animations.map((function(t){var n=Xn()(t.keyTimes,2);return[n[0],n[1]]})).forEach((function(t){var r=Xn()(t,2),i=r[0],u=r[1],M=i-.03,N=i,o=u,c=u+.03;yt.a.inRange(n.animationGlobalProgress,M,N)&&(e=10*(.03-(N-n.animationGlobalProgress))),yt.a.inRange(n.animationGlobalProgress,i,u)&&(e=1),yt.a.inRange(n.animationGlobalProgress,o,c)&&(e=10*(c-n.animationGlobalProgress))})));return e}function Pl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Jl=function(t){io()(e,t);var n=Pl(e);function e(t,r){var i;return st()(this,e),i=n.call(this,t),It()(yl()(i),"shape",void 0),It()(yl()(i),"animationAlpha",void 0),i.shape=r,i.animationAlpha=Gl(r,t.options),i}return gt()(e,[{key:"drawLogic",value:function(){var t=this.shape,n=t.location,e=t.scale,r=t.angleRad;this.ctx.translate(n.x,n.y),this.ctx.rotate(r),this.ctx.scale(e.x,e.y),this.setLineWidth(),this.setColor(),this.drawShape(),this.drawShapeWrapPoints()}},{key:"setLineWidth",value:function(){this.ctx.lineWidth=this.courtTypeConstants.COURT_LINE_WIDTH}},{key:"setColor",value:function(){var t=this.shape.color,n=t.alpha,e=t.blue,r=t.green,i=t.red,u=Math.ceil(255*i),M=Math.ceil(255*r),N=Math.ceil(255*e);this.ctx.fillStyle="rgba(".concat(u,", ").concat(M,", ").concat(N,", ").concat(n*this.animationAlpha,")"),this.ctx.strokeStyle="rgba(".concat(u,", ").concat(M,", ").concat(N,", ").concat(n?this.animationAlpha:0,")")}},{key:"drawShapeWrapPoints",value:function(){}},{key:"drawShape",value:function(){this.ctx.save(),this.drawShapeLogic(),this.drawShapeBorder(),this.ctx.restore()}},{key:"drawShapeBorder",value:function(){this.shape.showBorder&&this.ctx.stroke()}},{key:"drawShapeLogic",value:function(){}},{key:"staticData",get:function(){return this.options.staticData}}]),e}(uo);function Hl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Xl=function(t){io()(e,t);var n=Hl(e);function e(t,r){return st()(this,e),n.call(this,t,r)}return gt()(e,[{key:"drawLineFromControlPoints",value:function(){}},{key:"drawArrowLineCap",value:function(t){}},{key:"handOffLineCap",value:function(t){}},{key:"drawPerpendicularLineCap",value:function(){}},{key:"angleBetweenLastTwoPoints",value:function(){return 0}}]),gt()(e,[{key:"setLineWidth",value:function(){this.ctx.lineWidth=this.courtTypeConstants.LINE_WIDTH}},{key:"getProcessedLinePaths",value:function(){return[this.shape.linePart]}},{key:"drawShapeLogic",value:function(){this.drawLine(),this.drawLineCap()}},{key:"drawLine",value:function(){}},{key:"drawLineCap",value:function(){}}]),e}(Jl);function Kl(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}Object.assign(Xl.prototype,hl);var ql=function(t){io()(e,t);var n=Kl(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLine",value:function(){this.drawLineFromControlPoints()}},{key:"drawLineCap",value:function(){this.drawArrowLineCap()}}]),e}(Xl);function _l(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var $l=function(t){io()(e,t);var n=_l(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"convertLinePartsToDribble",value:function(t){return[]}},{key:"drawLine",value:function(){this.drawLineFromControlPoints()}},{key:"drawLineCap",value:function(){this.drawArrowLineCap()}},{key:"getProcessedLinePaths",value:function(){return this.convertLinePartsToDribble($n()(this.shape.linePart?[this.shape.linePart]:[]))}}]),e}(Xl);function tI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}Object.assign($l.prototype,dl);var nI=function(t){io()(e,t);var n=tI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLine",value:function(){this.drawLineFromControlPoints()}},{key:"drawLineCap",value:function(){this.handOffLineCap(this.getProcessedLinePaths())}}]),e}(Xl);function eI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var rI=function(t){io()(e,t);var n=eI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLine",value:function(){this.drawLineFromControlPoints()}},{key:"drawLineCap",value:function(){this.drawArrowLineCap()}},{key:"setLineOptions",value:function(){this.ctx.setLineDash([1,.5])}}]),e}(Xl);function iI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var uI=function(t){io()(e,t);var n=iI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawLine",value:function(){this.drawLineFromControlPoints()}},{key:"drawLineCap",value:function(){this.drawPerpendicularLineCap()}}]),e}(Xl);function MI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var NI=function(t){io()(e,t);var n=MI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.outerCircleRadius;this.ctx.beginPath(),this.ctx.arc(0,0,t,0,2*Math.PI),this.ctx.fill()}}]),e}(Jl);function oI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var cI=function(t){io()(e,t);var n=oI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape,n=t.color,e=t.outerCircleRadius;if(0!==n.alpha&&this.staticData.shapes&&this.staticData.shapes.length){var r=this.staticData.shapes.find((function(t){return"cone"===t.key}));r&&(this.ctx.globalAlpha=this.animationAlpha,this.ctx.drawImage(r.image,-e/2,-e/2,e,e))}}}]),e}(Jl);function aI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var DI=function(t){io()(e,t);var n=aI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.shapeControlPoints;this.ctx.rotate(Math.PI),this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.lineTo(t[1].x,t[1].y),this.ctx.lineTo(t[2].x,t[2].y),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.fill()}}]),e}(Jl);function sI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var TI=function(t){io()(e,t);var n=sI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.outerCircleRadius;this.ctx.beginPath(),this.ctx.rect(-t/2,-t/2,t,t),this.ctx.fill()}}]),e}(Jl);function gI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var lI=function(t){io()(e,t);var n=gI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.shapeControlPoints;this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.lineTo(t[1].x,t[1].y),this.ctx.lineTo(t[2].x,t[2].y),this.ctx.lineTo(t[3].x,t[3].y),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.fill()}}]),e}(Jl);function II(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var jI=function(t){io()(e,t);var n=II(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.shapeControlPoints;this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.lineTo(t[1].x,t[1].y),this.ctx.lineTo(t[2].x,t[2].y),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.fill()}}]),e}(Jl);function yI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var hI=function(t){io()(e,t);var n=yI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"drawShapeLogic",value:function(){var t=this.shape.shapeControlPoints;this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.lineTo(t[0].x+1,t[0].y),this.ctx.lineTo(0,-1),this.ctx.lineTo(t[1].x-1,t[1].y),this.ctx.lineTo(t[1].x,t[1].y),this.ctx.lineTo(1,0),this.ctx.lineTo(t[2].x,t[2].y),this.ctx.lineTo(t[2].x-1,t[2].y),this.ctx.lineTo(0,1),this.ctx.lineTo(t[3].x+1,t[2].y),this.ctx.lineTo(t[3].x,t[3].y),this.ctx.lineTo(-1,0),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.fill()}}]),e}(Jl);function zI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var OI=function(t){io()(e,t);var n=zI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.ctx.save(),this.playData.shapes.forEach((function(n){var e=n.type.match("LINE.")?"".concat(yt.a.capitalize(n.type.replace("LINE.","")),"Line"):yt.a.capitalize(n.type),r="".concat(e,"ShapeLayer");ut[r]&&new ut[r](t,n).apply()})),this.ctx.restore()}}]),e}(Tl),AI=function(){function t(n){st()(this,t),It()(this,"originalData",void 0),It()(this,"adjustedData",void 0),this.originalData=JSON.parse(JSON.stringify(n)),this.adjustedData=JSON.parse(JSON.stringify(n))}return gt()(t,[{key:"_getAttrOriginal",value:function(t){return this.originalData[t]}},{key:"_getAttr",value:function(t){return this.adjustedData[t]}},{key:"_setAttr",value:function(t,n){this.adjustedData[t]=n}}]),t}();function xI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var EI={red:.502,green:.502,blue:.502,alpha:.35},fI=function(t){io()(e,t);var n=xI(e);function e(t){var r;return st()(this,e),r=n.call(this,t),It()(yl()(r),"internalCanvas",void 0),r.internalCanvas=document.createElement("canvas"),r}return gt()(e,[{key:"preProcessedTextForContext",value:function(){var t=this._getLines(),n=t.reduce((function(t,n){return t.width>n.width?t:n})).width;return{lines:t,box:{width:n+2*e.NOTE_WRAP_PADDING,height:t.length*this.lineHeight+2*e.NOTE_WRAP_PADDING-e.NOTE_LINE_HEIGHT_OFFSET}}}},{key:"_getLines",value:function(){this.internalCtx.font=this.fontComputed,this.internalCtx.textBaseline=this.textBaseline;for(var t=e.NOTE_WRAP_MAX_WIDTH-2*e.NOTE_WRAP_PADDING,n=[],r=this.text.split(" ").reduce((function(t,n){if(!n.match(/\n/))return t.push(n),t;for(var e=[],r="",i=0;i<n.length;i++){var u=n[i];"\n"!==u?r+=u:(r.length&&e.push(r),e.push(""),r="")}return r.length&&e.push(r),e.forEach((function(n,r){if(!n)return t.push("\n");t.push(n),e[r+1]&&t.push("\n")})),t}),[]),i=1;r.length>0;){var u=r.slice(0,i),M=this._getLineInfo(u);if(M.width<t&&i<=r.length&&!M.hasLineBreak)i++;else{1!==i&&i--;var N=r.splice(0,i),o=this._getLineInfo(N);n.push(o),i=1;var c=!r.some((function(t){return"\n"!==t}));o.width&&M.hasLineBreak&&!c&&r.splice(0,1)}}return n}},{key:"_getLineInfo",value:function(t){var n=this,e=0,r=!1,i=[];return t.forEach((function(u,M){if("\n"!==u){var N=$n()(u.matchAll(/(<player=(\d*)>)/gi)),o={text:u,width:N.length?n.internalCtx.measureText(u.replace(/<player=(\d*)>/,"")).width+2*n.playerTokenRadius:n.internalCtx.measureText(u).width};e+=o.width,M!==t.length-1&&(e+=n.internalCtx.measureText(" ").width),i.push(o)}else r=!0})),{words:i,width:e,hasLineBreak:r}}},{key:"noteWrapperContains",value:function(t){var n=t.x,e=t.y,r=this.preProcessedTextForContext().box,i=this.location,u={x:i.x+r.width,y:i.y},M=u.y+r.height;return i.x<=n&&n<=u.x&&i.y<=e&&e<=M}},{key:"id",get:function(){return this._getAttr("id")}},{key:"text",get:function(){return this._getAttr("text")}},{key:"location",get:function(){return this._getAttr("location")}},{key:"color",get:function(){return this._getAttr("color")||EI}},{key:"showBorder",get:function(){return this._getAttr("showBorder")}},{key:"animations",get:function(){return this._getAttr("animations")||[]}},{key:"hideForStatic",get:function(){return this._getAttr("hideForStatic")}},{key:"font",get:function(){return this._getAttr("font")||{bold:!1,italic:!1,underline:!1,strikethrough:!1,fontSize:12}}},{key:"fontSize",get:function(){return this.font.fontSize/10}},{key:"lineHeight",get:function(){return this.fontSize+e.NOTE_LINE_HEIGHT_OFFSET}},{key:"playerTokenRadius",get:function(){return this.fontSize/2}},{key:"fontComputed",get:function(){var t=[];return this.font.bold&&t.push("bold"),this.font.italic&&t.push("italic"),t.push("".concat(this.fontSize,"px")),t.push("Arial"),t.join(" ")}},{key:"textBaseline",get:function(){return"top"}},{key:"internalCtx",get:function(){return this.internalCanvas.getContext("2d")}}],[{key:"NOTE_WRAP_MAX_WIDTH",get:function(){return 40}},{key:"NOTE_WRAP_PADDING",get:function(){return.43}},{key:"NOTE_LINE_HEIGHT_OFFSET",get:function(){return.3}}]),e}(AI);function pI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var UI=function(t){io()(e,t);var n=pI(e);function e(){var t;st()(this,e);for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];return t=n.call.apply(n,[this].concat(i)),It()(yl()(t),"animationAlpha",void 0),t}return gt()(e,[{key:"apply",value:function(){var t=this;this.ctx.save(),this.playData.notes.forEach((function(n){t.ctx.save(),t.animationAlpha=Gl(n,t.options),t.setColor(n);var e=n.location;t.ctx.translate(e.x,e.y);var r=n.preProcessedTextForContext(),i=r.lines,u=r.box;t.setFont(n),t.drawBubble(n,u),t.drawText(n,i),t.ctx.restore()})),this.ctx.restore()}},{key:"setColor",value:function(t){if(void 0===this.animationAlpha)throw new Error("animationAlpha is not set");var n=t.color,e=n.alpha,r=n.blue,i=n.green,u=n.red,M=Math.ceil(255*u),N=Math.ceil(255*i),o=Math.ceil(255*r);this.ctx.fillStyle="rgba(".concat(M,", ").concat(N,", ").concat(o,", ").concat(e*this.animationAlpha,")"),this.ctx.strokeStyle="rgba(".concat(M,", ").concat(N,", ").concat(o,", ").concat(this.animationAlpha,")"),this.options.noteSelectedId===t.id&&(this.ctx.setLineDash([.5,.5]),this.ctx.strokeStyle="rgba(28, 127, 181, ".concat(this.animationAlpha,")"))}},{key:"setFont",value:function(t){this.ctx.font=t.fontComputed,this.ctx.textBaseline=t.textBaseline}},{key:"drawBubble",value:function(t,n){var e=n.width,r=n.height;this.ctx.lineWidth=this.courtTypeConstants.COURT_LINE_WIDTH,this.ctx.beginPath(),this.ctx.rect(0,0,e,r),this.ctx.fill(),(t.showBorder||this.options.noteSelectedId===t.id)&&this.ctx.stroke()}},{key:"drawText",value:function(t,n){var e=this;n.forEach((function(n,r){var i=n.words;e.ctx.save(),e.ctx.translate(fI.NOTE_WRAP_PADDING,fI.NOTE_WRAP_PADDING+t.lineHeight*r);var u=0;i.forEach((function(n,r){var M=$n()(n.text.matchAll(/(<player=(\d*)>)/gi));M.length&&0===M[0].index&&(e.drawPlayerToken(t,u,M[0][2]),u+=2*t.playerTokenRadius),e.ctx.fillStyle="rgba(0, 0, 0, ".concat(e.animationAlpha,")");var N=M.length?n.text.replace(/(<player=(\d*)>)/gi,""):n.text;e.ctx.fillText(N,u,0),u+=n.width,M.length&&(u-=2*t.playerTokenRadius),M.length&&M[0].index>0&&(e.drawPlayerToken(t,u,M[0][2]),u+=2*t.playerTokenRadius),r!==i.length-1&&(e.ctx.fillText(" ",u,0),u+=e.ctx.measureText(" ").width)})),(t.font.underline||t.font.strikethrough)&&(e.ctx.lineWidth=.07*t.fontSize,e.ctx.strokeStyle="rgba(0, 0, 0, ".concat(e.animationAlpha,")"),e.ctx.beginPath(),t.font.underline&&(e.ctx.moveTo(0,t.fontSize-fI.NOTE_LINE_HEIGHT_OFFSET/2),e.ctx.lineTo(u,t.fontSize-fI.NOTE_LINE_HEIGHT_OFFSET/2)),t.font.strikethrough&&(e.ctx.moveTo(0,t.lineHeight/2-fI.NOTE_LINE_HEIGHT_OFFSET/3),e.ctx.lineTo(u,t.lineHeight/2-fI.NOTE_LINE_HEIGHT_OFFSET/3)),e.ctx.stroke()),e.ctx.restore()}))}},{key:"drawPlayerToken",value:function(t,n,e){this.ctx.save(),this.ctx.translate(n+t.playerTokenRadius,0),this.ctx.beginPath(),this.ctx.strokeStyle="rgba(255, 255, 255, ".concat(this.animationAlpha,")"),this.ctx.fillStyle="rgba(243, 111, 33, ".concat(this.animationAlpha,")"),this.ctx.arc(0,t.playerTokenRadius,t.playerTokenRadius,0,2*Math.PI),this.ctx.fill(),this.ctx.stroke();var r=.8*t.fontSize;this.ctx.font="".concat(r,"px Arial");var i=-this.ctx.measureText(e).width/2,u=(2*t.playerTokenRadius-r)/2*(1+fI.NOTE_LINE_HEIGHT_OFFSET);this.ctx.fillStyle="rgba(255, 255, 255, ".concat(this.animationAlpha,")"),this.ctx.fillText(e,i,u),this.ctx.restore()}},{key:"scale",value:function(t){return t/this.options.scale}}]),e}(Tl);function dI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var CI=function(t){io()(e,t);var n=dI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.options.linesDisplay&&(this.ctx.save(),this.playData.lines.forEach((function(n){t.options.linesSelectedIds.includes(n.id)&&n.baseLineParts().forEach((function(n){t.ctx.save(),t.ctx.fillStyle="blue",n.controlPoints.forEach((function(n){t.ctx.beginPath(),t.ctx.arc(n.x,n.y,.4,0,2*Math.PI,!0),t.ctx.fill()})),t.ctx.restore()}))})),this.ctx.restore())}}]),e}(Tl);function QI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var wI=function(t){io()(e,t);var n=QI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"apply",value:function(){var t=this;this.ctx.save(),this.ctx.fillStyle="blue",this.playData.shapes.forEach((function(n){var e=n.id,r=n.color,i=n.controlPointsTranslated;t.options.shapeSelectedId===e&&0!==r.alpha&&i.forEach((function(n){t.ctx.beginPath(),t.ctx.arc(n.x,n.y,.4,0,2*Math.PI,!0),t.ctx.fill()}))})),this.ctx.restore()}}]),e}(Tl);function SI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var LI=function(t){io()(e,t);var n=SI(e);function e(t){var r;return st()(this,e),r=n.call(this,t),It()(yl()(r),"lineParts",void 0),It()(yl()(r),"linePartsAdjusted",void 0),r.lineParts=t.lineParts,r.linePartsAdjusted=$n()(t.lineParts),r}return gt()(e,[{key:"baseLineParts",value:function(){return this.lineParts}},{key:"setLinePartsAdjusted",value:function(t){this.linePartsAdjusted=t}},{key:"setLinePartsAdjustedAtIndex",value:function(t,n){switch(t){case"fist":this.linePartsAdjusted[0]=n;break;case"last":this.linePartsAdjusted[this.linePartsAdjusted.length-1]=n;break;default:this.linePartsAdjusted[t]=n}}},{key:"setAnimationKeyTimesChunked",value:function(t){var n=this,e=[];if(this.animations[0].keyTimes.forEach((function(t,r){r&&e.push([n.animations[0].keyTimes[r-1],t])})),e.length!==this.getLineParts().length){var r=e,i=Xn()(r,1),u=Xn()(i[0],2),M=u[0],N=u[1],o=Xn()(t.animations,1)[0],c=o.keyTimes.indexOf(M),a=o.keyTimes.indexOf(N);if(c>=0&&a>=0){var D=o.keyTimes.slice(c,a+1);e=[],D.forEach((function(t,n){n&&e.push([D[n-1],t])}))}}this.animationKeyTimeChunks=e}},{key:"addLinePartAdjusted",value:function(t){this.linePartsAdjusted.push(t)}},{key:"getLineParts",value:function(){return this.linePartsAdjusted.length?this.linePartsAdjusted:this.lineParts}},{key:"id",get:function(){return this._getAttr("id")}},{key:"color",get:function(){return this._getAttr("color")},set:function(t){this._setAttr("color",t)}},{key:"type",get:function(){return this._getAttr("type")}},{key:"phase",get:function(){return this._getAttr("phase")}},{key:"playerPositionOrigin",get:function(){return this._getAttr("playerPositionOrigin")}},{key:"playerPositionTerminus",get:function(){return this._getAttr("playerPositionTerminus")}},{key:"playerLineSequence",get:function(){return this._getAttr("playerLineSequence")}},{key:"hideLineTip",get:function(){return this._getAttr("hideLineTip")}},{key:"animations",get:function(){return this._getAttr("animations")}},{key:"animationsByEndTime",get:function(){return this._getAttr("animations").map((function(t){return yt.a.last(t.keyTimes)}))}},{key:"animationKeyTimeChunks",get:function(){return this._getAttr("animationKeyTimeChunks")||[]},set:function(t){this._setAttr("animationKeyTimeChunks",t)}},{key:"lastAnimEndTime",get:function(){return yt.a.max(this.animationsByEndTime)}},{key:"firstLinePartControlPoint",get:function(){return this.lineParts[0].controlPoints[0]}},{key:"lastLinePartControlPoint",get:function(){return $n()($n()(this.lineParts).pop().controlPoints).pop()}}]),e}(AI);function kI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var vI=function(t){io()(e,t);var n=kI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"setPossession",value:function(t){var n=this;if(t.length){var e=this.possession?1:0;e+=t.filter((function(t){return t.playerPositionTerminus===n.position})).length,e-=t.filter((function(t){return t.playerPositionOrigin===n.position})).length,this.possession=e>0}}},{key:"id",get:function(){return this._getAttr("id")}},{key:"textOverride",get:function(){return this._getAttr("textOverride")},set:function(t){this._setAttr("textOverride",t)}},{key:"textLabel",get:function(){return this._getAttr("textOverride")||this.position}},{key:"isDefender",get:function(){return this.position.indexOf("x")>=0}},{key:"possession",get:function(){return this._getAttr("possession")},set:function(t){this._setAttr("possession",t)}},{key:"position",get:function(){return this._getAttr("position")}},{key:"location",get:function(){return this._getAttr("location")},set:function(t){this._setAttr("location",t)}},{key:"color",get:function(){return this._getAttr("color")}},{key:"animations",get:function(){return this._getAttr("animations")}},{key:"animationsByEndTime",get:function(){return this._getAttr("animations").map((function(t){return yt.a.last(t.keyTimes)}))}},{key:"lastAnimEndTime",get:function(){return yt.a.max(this.animationsByEndTime)}},{key:"lastAnimation",get:function(){return $n()(this.animations).pop()}},{key:"lastAnimationLastLinePartControlPoint",get:function(){return $n()($n()(this.lastAnimation.lineParts).pop().controlPoints).pop()}}]),e}(AI);function YI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var mI=function(t){io()(e,t);var n=YI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"rectWrapperContains",value:function(t){var n=Xn()(this.rectWrapPointsTranslated,4),e=n[0],r=n[1],i=n[2],u=n[3];return+[[e,t,r],[r,t,i],[i,t,u],[u,t,e]].reduce((function(t,n){var e=Xn()(n,3),r=e[0],i=e[1],u=e[2];return t+Math.abs(i.x*r.y-r.x*i.y+(u.x*i.y-i.x*u.y)+(r.x*u.y-u.x*r.y))/2}),0).toFixed(2)<=this.rectWrapAreaTranslated}},{key:"computeCenterForRect",value:function(t){var n=Xn()(t,4),e=n[0],r=n[1],i=n[2],u=n[3];return{x:(e.x+i.x)/2,y:(r.y+u.y)/2}}},{key:"computeShapeAreaForPointAtIndex",value:function(t,n){var e=Xn()(this.rectWrapPointsTranslated,3),r=e[0],i=e[1],u=e[2],M=this.computeRectWrapPointsTranslatedForPointAtIndex(t,n),N=Xn()(M,4),o=N[0],c=N[1],a=N[2],D=N[3];return{scale:{x:PN(o,c)*this.scale.x/PN(r,i),y:PN(c,a)*this.scale.y/PN(i,u)},location:this.computeCenterForRect([o,c,a,D])}}},{key:"computeRectWrapPointsTranslatedForPointAtIndex",value:function(t,n){var e=this,r=zt(t.x,t.y,this.location.x,this.location.y,-this.angle),i=this.rectWrapPointsTranslated.map((function(t){return zt(t.x,t.y,e.location.x,e.location.y,-e.angle)})).map((function(t,e){return n===e?r:t}));return 0===n&&(i[1].y=r.y,i[3].x=r.x),1===n&&(i[0].y=r.y,i[2].x=r.x),2===n&&(i[1].x=r.x,i[3].y=r.y),3===n&&(i[0].x=r.x,i[2].y=r.y),i.map((function(t){return zt(t.x,t.y,e.location.x,e.location.y,e.angle)}))}},{key:"revertPointTranslation",value:function(t){var n={x:t.x-this.location.x,y:t.y-this.location.y};return zt(n.x,n.y,0,0,-this.angle)}},{key:"id",get:function(){return this._getAttr("id")}},{key:"location",get:function(){return this._getAttr("location")}},{key:"scale",get:function(){return this._getAttr("scale")}},{key:"angle",get:function(){return this._getAttr("angle")||0}},{key:"angleRad",get:function(){return this.angle*Math.PI/180}},{key:"color",get:function(){return this._getAttr("color")}},{key:"type",get:function(){return this._getAttr("type")}},{key:"showBorder",get:function(){return this._getAttr("showBorder")}},{key:"outerCircleRadius",get:function(){return 10}},{key:"linePart",get:function(){return this._getAttr("linePart")}},{key:"animations",get:function(){return this._getAttr("animations")||[]}},{key:"hideForStatic",get:function(){return this._getAttr("hideForStatic")}},{key:"rectWrapPointsPure",get:function(){return[{x:-this.outerCircleRadius/2,y:-this.outerCircleRadius/2},{x:this.outerCircleRadius/2,y:-this.outerCircleRadius/2},{x:this.outerCircleRadius/2,y:this.outerCircleRadius/2},{x:-this.outerCircleRadius/2,y:this.outerCircleRadius/2}]}},{key:"rectWrapPointsTranslated",get:function(){var t=this;return this.rectWrapPointsPure.map((function(n){var e={x:n.x*t.scale.x,y:n.y*t.scale.y},r=zt(e.x,e.y,0,0,t.angle);return{x:r.x+t.location.x,y:r.y+t.location.y}}))}},{key:"controlPointsTranslated",get:function(){return this.rectWrapPointsTranslated}},{key:"rectWrapAreaTranslated",get:function(){var t=Xn()(this.rectWrapPointsTranslated,3),n=t[0],e=t[1],r=t[2];return+(PN(n,e)*PN(e,r)).toFixed(2)}}]),e}(AI);function FI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var RI=function(t){io()(e,t);var n=FI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"rectWrapPointsPure",get:function(){return _N(this.linePart.controlPoints)}},{key:"controlPointsTranslated",get:function(){var t=this;return this.linePart.controlPoints.map((function(n){var e={x:n.x*t.scale.x,y:n.y*t.scale.y},r=zt(e.x,e.y,0,0,t.angle);return{x:r.x+t.location.x,y:r.y+t.location.y}}))}},{key:"shapeControlPoints",get:function(){return[]}}]),e}(mI);function bI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var BI=function(t){io()(e,t);var n=bI(e);function e(){return st()(this,e),n.apply(this,arguments)}return e}(RI);function ZI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var VI=function(t){io()(e,t);var n=ZI(e);function e(){return st()(this,e),n.apply(this,arguments)}return e}(RI);function WI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var GI=function(t){io()(e,t);var n=WI(e);function e(){return st()(this,e),n.apply(this,arguments)}return e}(RI);function PI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var JI=function(t){io()(e,t);var n=PI(e);function e(){return st()(this,e),n.apply(this,arguments)}return e}(RI);function HI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var XI=function(t){io()(e,t);var n=HI(e);function e(){return st()(this,e),n.apply(this,arguments)}return e}(RI);function KI(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var qI=function(t){io()(e,t);var n=KI(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 5}},{key:"rectWrapPointsPure",get:function(){return[{x:-this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:this.outerCircleRadius},{x:-this.outerCircleRadius,y:this.outerCircleRadius}]}},{key:"shapeControlPoints",get:function(){return[]}}]),e}(mI);function _I(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var $I=function(t){io()(e,t);var n=_I(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 5}},{key:"shapeControlPoints",get:function(){return this.rectWrapPointsPure}}]),e}(mI);function tj(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var nj=function(t){io()(e,t);var n=tj(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 8}},{key:"shapeControlPoints",get:function(){return[{x:0,y:-this.outerCircleRadius},{x:-this.outerCircleRadius*Math.cos(220)/2,y:this.outerCircleRadius*Math.sin(240)},{x:this.outerCircleRadius*Math.cos(220)/2,y:this.outerCircleRadius*Math.sin(240)}]}},{key:"rectWrapPointsPure",get:function(){return[{x:-this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:this.outerCircleRadius},{x:-this.outerCircleRadius,y:this.outerCircleRadius}]}}]),e}(mI);function ej(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var rj=function(t){io()(e,t);var n=ej(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 10}},{key:"shapeControlPoints",get:function(){return this.rectWrapPointsPure}}]),e}(mI);function ij(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var uj=function(t){io()(e,t);var n=ij(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 10}},{key:"shapeControlPoints",get:function(){return this.rectWrapPointsPure}},{key:"rectWrapPointsPure",get:function(){return[{x:-this.outerCircleRadius,y:-.5},{x:this.outerCircleRadius,y:-.5},{x:this.outerCircleRadius,y:.5},{x:-this.outerCircleRadius,y:.5}]}}]),e}(mI);function Mj(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var Nj=function(t){io()(e,t);var n=Mj(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 10}},{key:"shapeControlPoints",get:function(){return[{x:0,y:-this.outerCircleRadius},{x:this.outerCircleRadius*Math.cos(210),y:this.outerCircleRadius*Math.sin(210)},{x:-this.outerCircleRadius*Math.cos(210),y:this.outerCircleRadius*Math.sin(210)}]}},{key:"rectWrapPointsPure",get:function(){return[{x:-this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:-this.outerCircleRadius},{x:this.outerCircleRadius,y:this.outerCircleRadius},{x:-this.outerCircleRadius,y:this.outerCircleRadius}]}}]),e}(mI);function oj(t){var n=function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}();return function(){var e,r=eo()(t);if(n){var i=eo()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return to()(this,e)}}var cj=function(t){io()(e,t);var n=oj(e);function e(){return st()(this,e),n.apply(this,arguments)}return gt()(e,[{key:"outerCircleRadius",get:function(){return 10}},{key:"shapeControlPoints",get:function(){return this.rectWrapPointsPure}}]),e}(mI);function aj(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function Dj(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?aj(Object(e),!0).forEach((function(n){It()(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):aj(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}var sj=function(){function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;st()(this,t),this.play=n,this.phase=e,this.animationGlobalProgress=r,It()(this,"ctx",void 0),It()(this,"animationGlobalProgressPrev",void 0),this.animationGlobalProgressPrev=r,this.ctx=null}return gt()(t,[{key:"draw",value:function(){if(!this.ctx)throw new Error("Canvas context is not provided. Please use setContext() method.");this.ctx.clearRect(0,0,this.frameWidth,this.frameHeight),this._init();var t=this.frameData,n=this.frameDataOptions;return new Il(this.ctx,t,n).apply(),new OI(this.ctx,t,n).apply(),new Zl(this.ctx,t,n).apply(),new Wl(this.ctx,t,n).apply(),new CI(this.ctx,t,n).apply(),new wI(this.ctx,t,n).apply(),new UI(this.ctx,t,n).apply(),this}},{key:"_init",value:function(){if(!this.ctx)throw new Error("Canvas context is not provided. Please use setContext() method.");this.ctx.canvas.width=this.frameWidth,this.ctx.canvas.height=this.frameHeight,this.ctx.scale(this.play.scale,this.play.scale),this.ctx.translate(-this.court.courtRect.origin.x,-this.court.courtRect.origin.y),this.play.options.mirror&&(this.ctx.scale(-1,1),this.ctx.translate(2*Math.abs(this.court.courtRect.origin.x)-this.court.courtRect.size.width,0))}},{key:"setContext",value:function(t){return this.ctx=t,this}},{key:"setPhase",value:function(t){return this.phase=t,this}},{key:"setAnimationGlobalProgress",value:function(t){return this.animationGlobalProgressPrev=this.animationGlobalProgress,this.animationGlobalProgress=t,this}},{key:"animationProgress",value:function(t,n){return ht(this.animationGlobalProgress,t,n)}},{key:"closestObjectToPoint",value:function(t,n){var e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3?arguments[3]:void 0,i=e?this.convertViewPointToCourtPoint(t):t;return"player"===n?this.closestPlayerToPoint(i,r):"shape"===n?this.closestShapeToPoint(i):"note"===n?this.closestNoteToPoint(i):"line"===n?this.closestLineToPoint(i,r):"lineVertex"===n?this.closestLineVertexToPoint(i,r):null}},{key:"closestLineToPoint",value:function(t,n){var e=this,r=this.lines.filter((function(t){return!n||n(t)})).reduce((function(n,r){return r.lineParts.forEach((function(i){for(var u=qn()(te,$n()(i.controlPoints)),M=1;M<=100;M++){var N=M/100,o=e.prepareCourtPoint({x:u.x(N),y:u.y(N)});n.push({object:r,objectPoint:o,distance:PN(o,t)})}})),n}),[]);return yt.a.minBy(r,"distance")}},{key:"closestLineVertexToPoint",value:function(t,n){var e=this,r=this.lines.filter((function(t){return!n||n(t)})).reduce((function(n,r){if(!r.id.length)return n;var i=e.prepareCourtPoint(r.firstLinePartControlPoint),u=e.prepareCourtPoint(r.lastLinePartControlPoint);return n.push({object:r,objectPoint:i,distance:PN(i,t)}),n.push({object:r,objectPoint:u,distance:PN(u,t)}),n}),[]);return yt.a.minBy(r,"distance")}},{key:"closestPlayerToPoint",value:function(t,n){var e=this,r=this.players.filter((function(t){return!n||n(t)})).reduce((function(n,r){var i=e.prepareCourtPoint(r.location);return n.push({object:r,objectPoint:i,distance:PN(i,t)}),n}),[]);return yt.a.minBy(r,"distance")}},{key:"closestShapeToPoint",value:function(t){var n=this,e=this.shapes.filter((function(n){return n.rectWrapperContains(t)})).reduce((function(e,r){var i=n.prepareCourtPoint(r.location);return e.push({object:r,objectPoint:i,distance:PN(i,t)}),e}),[]);return yt.a.minBy(e,"distance")}},{key:"closestNoteToPoint",value:function(t){var n=this,e=this.notes.filter((function(n){return n.noteWrapperContains(t)})).reduce((function(e,r){var i=n.prepareCourtPoint(r.location);return e.push({object:r,objectPoint:i,distance:PN(i,t)}),e}),[]);return e.length?yt.a.minBy(e,"distance"):null}},{key:"prepareCourtPoint",value:function(t){var n=this.play.options.mirror,e=this.play.playData.court.courtRect.size.width,r=this.play.playData.court.courtRect.origin;return{x:n?e+r.x-(t.x-r.x):t.x,y:t.y}}},{key:"convertViewPointToCourtPoint",value:function(t){var n=this.play.playData.court.courtRect.origin,e=n.x,r=n.y;return{x:t.x/this.play.scale+e,y:t.y/this.play.scale+r}}},{key:"sport",get:function(){var t=this.play.playData,n=t.court,e=t.sport;return e||([gn,Tn].includes(n.type)?$t:qt)}},{key:"court",get:function(){var t=this.play.playData.court;return Dj({},t,{type:t.type===gn?Tn:t.type})}},{key:"frameWidth",get:function(){return this.play.width}},{key:"frameHeight",get:function(){return this.play.height}},{key:"frameData",get:function(){return{sport:this.sport,court:this.court,lines:this.lines,players:this.players,shapes:this.shapes,notes:this.notes}}},{key:"frameDataOptions",get:function(){return Dj({},this.play.options,{staticData:this.play.staticData,scale:this.play.scale,animationGlobalProgress:this.animationGlobalProgress,playAnimationDuration:this.playAnimationDuration})}},{key:"playAnimationDuration",get:function(){return this.play.playData.lines.reduce((function(t,n){var e=new LI(n).lastAnimEndTime;return t>e?t:e}),0)}},{key:"lines",get:function(){return this.animationGlobalProgress?this.animationProgressLines:this.currentPhaseLines}},{key:"players",get:function(){return this.animationGlobalProgress?this.animationProgressPlayers:this.currentPhasePlayers}},{key:"shapes",get:function(){return this.play.playData.shapes?this.play.playData.shapes.filter((function(t){return void 0!==Mt[Ot(t.type)]})).map((function(t){return new(Mt[Ot(t.type)])(t)})):[]}},{key:"notes",get:function(){return this.play.playData.notes?this.play.playData.notes.filter((function(t){return!t.displayModes||t.displayModes.includes("onCourt")})).map((function(t){return new fI(t)})):[]}},{key:"currentPhasePlayers",get:function(){var t=this,n=this.currentPhaseLines,e=this.play.options,r=e.huddleMode,i=e.magnetMode,u=r||i?this.playDataLines:this.prevPhaseLines,M=u.filter((function(t){return["PASS","HANDOFF"].includes(t.type)}));return this.play.playData.players.map((function(e){var N=new vI(e);N.setPossession(M);var o=u.filter((function(e){return!r||!(t.phase<e.phase)&&!n.find((function(t){return t.id===e.id}))})).filter((function(t){return t.playerPositionOrigin===N.position&&t.playerPositionTerminus===N.position})),c=n.filter((function(t){return i&&t.playerPositionOrigin===N.position&&t.playerPositionTerminus===N.position})),a=c.length?c:o;if(a.length){var D=yt.a.maxBy(a,(function(t){return t.lastAnimEndTime}));if(D){var s=D.lastLinePartControlPoint;s&&(N.location=s)}}return N}))}},{key:"currentPhaseLines",get:function(){var t=this,n=this.play.playData.lines.filter((function(n){return n.phase===t.phase}));return this.play.options.huddleMode&&(n=yt.a.takeRight(n,2)),n.map((function(t){return new LI(t)}))}},{key:"animationProgressPlayers",get:function(){var t=this,n=this.prevAnimationLines.filter((function(t){return["PASS","HANDOFF","SHOT"].includes(t.type)}));return this.play.playData.players.map((function(e){var r=new vI(e);return r.setPossession(n),r.animations.length?(r.animations.forEach((function(n){var e=[];n.keyTimes.forEach((function(t,r){r&&e.push([n.keyTimes[r-1],t])})),e.forEach((function(e,i){var u=Xn()(e,2),M=u[0],N=u[1];if(yt.a.inRange(t.animationGlobalProgress,M,N)){var o=t.animationProgress(M,N),c=qn()(te,$n()(n.lineParts[i].controlPoints));r.location={x:c.x(o),y:c.y(o)}}}))})),t.animationGlobalProgress>=r.lastAnimEndTime&&(r.location=r.lastAnimationLastLinePartControlPoint),r):r}))}},{key:"animationProgressLines",get:function(){var t=this,n=this.play.options.linesDisplayOnMoveOnly;return this.play.playData.lines.map((function(n){var e=new LI(n);e.setAnimationKeyTimesChunked(t.play.playData.players.find((function(t){return t.position===e.playerPositionOrigin})));var r=[];return e.animationKeyTimeChunks.forEach((function(n,i){var u=Xn()(n,2),M=u[0],N=u[1];if(t.animationGlobalProgressPrev<N&&t.animationGlobalProgress>=N&&window.dispatchEvent(new CustomEvent("@luceosports/play-rendering:lineAnimationFinished",{detail:{id:e.id}})),yt.a.inRange(t.animationGlobalProgress,M,N)){if("DRIBBLE"===e.type)return r.push(Dj({},e.getLineParts()[i]));var o=JN(e.getLineParts()[i].controlPoints,t.animationProgress(M,N));r.push({controlPoints:o[0],alpha:.1}),r.push({controlPoints:o[1],alpha:e.color.alpha})}else t.animationGlobalProgress>N?r.push(Dj({},e.getLineParts()[i],{alpha:.1})):r.push(Dj({},e.getLineParts()[i]))})),e.setLinePartsAdjusted(r),t.animationGlobalProgress>e.lastAnimEndTime&&(e.color=Dj({},e.color,{alpha:.1})),e})).filter((function(e){var r=Xn()(e.animations,1)[0].keyTimes,i=Xn()(r,1)[0],u=r.reverse(),M=Xn()(u,1)[0],N=yt.a.inRange(t.animationGlobalProgress,i,M);return n?N:N||t.animationGlobalProgress>M||e.phase===t.phase}))}},{key:"playDataLines",get:function(){return this.play.playData.lines.map((function(t){return new LI(t)}))}},{key:"prevPhaseLines",get:function(){var t=this;return this.playDataLines.filter((function(n){return n.phase<t.phase}))}},{key:"prevAnimationLines",get:function(){var t=this;return this.playDataLines.filter((function(n){return t.animationGlobalProgress>=n.lastAnimEndTime}))}}]),t}(),Tj=function(){function t(n,e){st()(this,t),this.ctx=n,It()(this,"play",void 0),It()(this,"playBase",void 0),It()(this,"animationFrame",void 0),It()(this,"loopId",void 0),It()(this,"running",void 0),It()(this,"framesLoadTime",void 0),It()(this,"timeStart",void 0),It()(this,"timeElapsed",void 0),It()(this,"timeElapsedSaved",void 0),this.play=yt.a.cloneDeep(e),this.playBase=yt.a.cloneDeep(e),this.animationFrame=new sj(this.play,this.currentPlayPhase,this.globalProgress).setContext(this.ctx),this.loopId=null,this.running=!1,this.framesLoadTime=[],this.timeStart=null,this.timeElapsed=0,this.timeElapsedSaved=0}return gt()(t,[{key:"start",value:function(t,n){this.running=!0,this.loopId=requestAnimationFrame(this.drawFrame.bind(this,t,n))}},{key:"pause",value:function(){cancelAnimationFrame(this.loopId),this.running=!1,this.timeStart=null,this.timeElapsedSaved=this.timeElapsed}},{key:"setProgress",value:function(t){var n=this.countTimeElapsedFromProgress(t);return this.timeElapsed=n,this.timeElapsedSaved=n,this.refreshAnimationFrameProgress(),this}},{key:"refreshAnimationFrameProgress",value:function(){this.animationFrame.setPhase(this.currentPlayPhase).setAnimationGlobalProgress(this.globalProgress)}},{key:"drawPreviewFrame",value:function(){new sj(this.play,this.currentPlayPhase,this.globalProgress).setContext(this.ctx).draw()}},{key:"reset",value:function(){this.timeStart=null,this.timeElapsed=null,this.timeElapsedSaved=null,this.play=yt.a.cloneDeep(this.playBase)}},{key:"countTimeElapsedFromProgress",value:function(t){return 1e3*this.animationDuration*t}},{key:"drawFrame",value:function(t,n,e){if(this.running){if(this.globalProgress>=this.lastLineAnimationMax)return n(this.lastLineAnimationMax),this.reset(),cancelAnimationFrame(this.loopId),void setTimeout((function(){t()}),1e3);n(this.globalProgress),this.timeStart||(this.timeStart=e);var r=e-this.timeStart+(this.timeElapsedSaved||0)-(this.timeElapsed||0);this.framesLoadTime.push(r),this.timeElapsed=e-this.timeStart+(this.timeElapsedSaved||0),this.animationFrame.setPhase(this.currentPlayPhase).setAnimationGlobalProgress(this.globalProgress).draw(),requestAnimationFrame(this.drawFrame.bind(this,t,n))}}},{key:"animationDuration",get:function(){return this.play.playData.animationDuration/this.play.options.speed}},{key:"globalProgress",get:function(){return 100*(this.timeElapsed||0)/(1e3*this.animationDuration)/100}},{key:"currentPlayPhase",get:function(){var t=this,n=Object.entries(this.linesPhaseIntervals).find((function(n){var e=Xn()(n,2)[1];return yt.a.inRange(t.globalProgress,e.min,e.max)}));return parseInt(n?n[0]:Object.keys(this.linesPhaseIntervals).pop())}},{key:"linesPhaseIntervals",get:function(){var t={};return this.play.playData.lines.forEach((function(n){t[n.phase]||(t[n.phase]={min:0,max:0}),n.animations.forEach((function(e){var r=e.keyTimes,i=Xn()(r,1)[0],u=$n()(r).pop();(i<t[n.phase].min||!t[n.phase].min&&n.phase>1)&&(t[n.phase].min=i),u>t[n.phase].max&&(t[n.phase].max=u)}))})),t}},{key:"lastLineAnimationMax",get:function(){return this.play.playData.lines.reduce((function(t,n){var e=new LI(n);return t>e.lastAnimEndTime?t:e.lastAnimEndTime}),0)}}]),t}()}])}));
24
24
  //# sourceMappingURL=play-rendering.js.map