/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var er=function(e,t){return(er=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,n){h.__proto__=n}||function(h,n){for(var p in n)Object.prototype.hasOwnProperty.call(n,p)&&(h[p]=n[p])})(e,t)};function tr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function h(){this.constructor=e}er(e,t),e.prototype=t===null?Object.create(t):(h.prototype=t.prototype,new h)}function sr(e){var t="";Array.isArray(e)||(e=[e]);for(var h=0;he.phi1&&(e.phi2-=2*Z),e.sweepFlag===1&&e.phi2n)return[];if(n===0)return[[e*h/(e*e+t*t),t*h/(e*e+t*t)]];var p=Math.sqrt(n);return[[(e*h+t*p)/(e*e+t*t),(t*h-e*p)/(e*e+t*t)],[(e*h-t*p)/(e*e+t*t),(t*h+e*p)/(e*e+t*t)]]}var d,X=Math.PI/180;function k(e,t,h){return(1-h)*e+h*t}function G(e,t,h,n){return e+Math.cos(n/180*Z)*t+Math.sin(n/180*Z)*h}function J(e,t,h,n){var p=1e-6,l=t-e,_=h-t,r=3*l+3*(n-h)-6*_,s=6*(_-l),i=3*l;return Math.abs(r)O&&(a.sweepFlag=+!a.sweepFlag),a}))}function _(){return function(r){var s={};for(var i in r)s[i]=r[i];return s}}e.ROUND=function(r){function s(i){return Math.round(i*r)/r}return r===void 0&&(r=1e13),U(r),function(i){return i.x1!==void 0&&(i.x1=s(i.x1)),i.y1!==void 0&&(i.y1=s(i.y1)),i.x2!==void 0&&(i.x2=s(i.x2)),i.y2!==void 0&&(i.y2=s(i.y2)),i.x!==void 0&&(i.x=s(i.x)),i.y!==void 0&&(i.y=s(i.y)),i.rX!==void 0&&(i.rX=s(i.rX)),i.rY!==void 0&&(i.rY=s(i.rY)),i}},e.TO_ABS=t,e.TO_REL=function(){return p((function(r,s,i){return r.relative||(r.x1!==void 0&&(r.x1-=s),r.y1!==void 0&&(r.y1-=i),r.x2!==void 0&&(r.x2-=s),r.y2!==void 0&&(r.y2-=i),r.x!==void 0&&(r.x-=s),r.y!==void 0&&(r.y-=i),r.relative=!0),r}))},e.NORMALIZE_HVZ=function(r,s,i){return r===void 0&&(r=!0),s===void 0&&(s=!0),i===void 0&&(i=!0),p((function(o,y,u,a,T){if(isNaN(a)&&!(o.type&c.MOVE_TO))throw new Error("path must start with moveto");return s&&o.type&c.HORIZ_LINE_TO&&(o.type=c.LINE_TO,o.y=o.relative?0:u),i&&o.type&c.VERT_LINE_TO&&(o.type=c.LINE_TO,o.x=o.relative?0:y),r&&o.type&c.CLOSE_PATH&&(o.type=c.LINE_TO,o.x=o.relative?a-y:a,o.y=o.relative?T-u:T),o.type&c.ARC&&(o.rX===0||o.rY===0)&&(o.type=c.LINE_TO,delete o.rX,delete o.rY,delete o.xRot,delete o.lArcFlag,delete o.sweepFlag),o}))},e.NORMALIZE_ST=h,e.QT_TO_C=n,e.INFO=p,e.SANITIZE=function(r){r===void 0&&(r=0),U(r);var s=NaN,i=NaN,o=NaN,y=NaN;return p((function(u,a,T,m,C){var x=Math.abs,g=!1,N=0,f=0;if(u.type&c.SMOOTH_CURVE_TO&&(N=isNaN(s)?0:a-s,f=isNaN(i)?0:T-i),u.type&(c.CURVE_TO|c.SMOOTH_CURVE_TO)?(s=u.relative?a+u.x2:u.x2,i=u.relative?T+u.y2:u.y2):(s=NaN,i=NaN),u.type&c.SMOOTH_QUAD_TO?(o=isNaN(o)?a:2*a-o,y=isNaN(y)?T:2*T-y):u.type&c.QUAD_TO?(o=u.relative?a+u.x1:u.x1,y=u.relative?T+u.y1:u.y2):(o=NaN,y=NaN),u.type&c.LINE_COMMANDS||u.type&c.ARC&&(u.rX===0||u.rY===0||!u.lArcFlag)||u.type&c.CURVE_TO||u.type&c.SMOOTH_CURVE_TO||u.type&c.QUAD_TO||u.type&c.SMOOTH_QUAD_TO){var I=u.x===void 0?0:u.relative?u.x:u.x-a,v=u.y===void 0?0:u.relative?u.y:u.y-T;N=isNaN(o)?u.x1===void 0?N:u.relative?u.x:u.x1-a:o-a,f=isNaN(y)?u.y1===void 0?f:u.relative?u.y:u.y1-T:y-T;var O=u.x2===void 0?0:u.relative?u.x:u.x2-a,M=u.y2===void 0?0:u.relative?u.y:u.y2-T;x(I)<=r&&x(v)<=r&&x(N)<=r&&x(f)<=r&&x(O)<=r&&x(M)<=r&&(g=!0)}return u.type&c.CLOSE_PATH&&x(a-m)<=r&&x(T-C)<=r&&(g=!0),g?[]:u}))},e.MATRIX=l,e.ROTATE=function(r,s,i){s===void 0&&(s=0),i===void 0&&(i=0),U(r,s,i);var o=Math.sin(r),y=Math.cos(r);return l(y,o,-o,y,s-s*y+i*o,i-s*o-i*y)},e.TRANSLATE=function(r,s){return s===void 0&&(s=0),U(r,s),l(1,0,0,1,r,s)},e.SCALE=function(r,s){return s===void 0&&(s=r),U(r,s),l(r,0,0,s,0,0)},e.SKEW_X=function(r){return U(r),l(1,0,Math.atan(r),1,0,0)},e.SKEW_Y=function(r){return U(r),l(1,Math.atan(r),0,1,0,0)},e.X_AXIS_SYMMETRY=function(r){return r===void 0&&(r=0),U(r),l(-1,0,0,1,r,0)},e.Y_AXIS_SYMMETRY=function(r){return r===void 0&&(r=0),U(r),l(1,0,0,-1,0,r)},e.A_TO_C=function(){return p((function(r,s,i){return c.ARC===r.type?(function(o,y,u){var a,T,m,C;o.cX||j(o,y,u);for(var x=Math.min(o.phi1,o.phi2),g=Math.max(o.phi1,o.phi2)-x,N=Math.ceil(g/90),f=new Array(N),I=y,v=u,O=0;Oy.maxX&&(y.maxX=A),Ay.maxY&&(y.maxY=A),AE&&C($(a,m.x1,m.x2,m.x,E));for(var f=0,I=J(T,m.y1,m.y2,m.y);fE&&x($(T,m.y1,m.y2,m.y,E))}if(m.type&c.ARC){C(m.x),x(m.y),j(m,a,T);for(var v=m.xRot/180*Math.PI,O=Math.cos(v)*m.rX,M=Math.sin(v)*m.rX,R=-Math.sin(v)*m.rY,P=Math.cos(v)*m.rY,S=m.phi1m.phi2?[m.phi2+360,m.phi1+360]:[m.phi2,m.phi1],H=S[0],Q=S[1],F=function(A){var w=A[0],q=A[1],W=180*Math.atan2(q,w)/Math.PI;return WH&&EH&&Eo)throw new SyntaxError('Expected positive number, got "'+o+'" at index "'+_+'"')}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+_+'"')}this.curArgs.push(o),this.curArgs.length===cr[this.curCommandType]&&(c.HORIZ_LINE_TO===this.curCommandType?l({type:c.HORIZ_LINE_TO,relative:this.curCommandRelative,x:o}):c.VERT_LINE_TO===this.curCommandType?l({type:c.VERT_LINE_TO,relative:this.curCommandRelative,y:o}):this.curCommandType===c.MOVE_TO||this.curCommandType===c.LINE_TO||this.curCommandType===c.SMOOTH_QUAD_TO?(l({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),c.MOVE_TO===this.curCommandType&&(this.curCommandType=c.LINE_TO)):this.curCommandType===c.CURVE_TO?l({type:c.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===c.SMOOTH_CURVE_TO?l({type:c.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===c.QUAD_TO?l({type:c.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===c.ARC&&l({type:c.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!ar(r))if(r===","&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if(r!=="+"&&r!=="-"&&r!==".")if(i)this.curNumber=r,this.curNumberHasDecimal=!1;else{if(this.curArgs.length!==0)throw new SyntaxError("Unterminated command at index "+_+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+r+'" at index '+_+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,r!=="z"&&r!=="Z")if(r==="h"||r==="H")this.curCommandType=c.HORIZ_LINE_TO,this.curCommandRelative=r==="h";else if(r==="v"||r==="V")this.curCommandType=c.VERT_LINE_TO,this.curCommandRelative=r==="v";else if(r==="m"||r==="M")this.curCommandType=c.MOVE_TO,this.curCommandRelative=r==="m";else if(r==="l"||r==="L")this.curCommandType=c.LINE_TO,this.curCommandRelative=r==="l";else if(r==="c"||r==="C")this.curCommandType=c.CURVE_TO,this.curCommandRelative=r==="c";else if(r==="s"||r==="S")this.curCommandType=c.SMOOTH_CURVE_TO,this.curCommandRelative=r==="s";else if(r==="q"||r==="Q")this.curCommandType=c.QUAD_TO,this.curCommandRelative=r==="q";else if(r==="t"||r==="T")this.curCommandType=c.SMOOTH_QUAD_TO,this.curCommandRelative=r==="t";else{if(r!=="a"&&r!=="A")throw new SyntaxError('Unexpected character "'+r+'" at index '+_+".");this.curCommandType=c.ARC,this.curCommandRelative=r==="a"}else n.push({type:c.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=r,this.curNumberHasDecimal=r==="."}else this.curNumber+=r,this.curNumberHasDecimal=!0;else this.curNumber+=r;else this.curNumber+=r,this.curNumberHasExp=!0;else this.curNumber+=r,this.curNumberHasExpDigits=this.curNumberHasExp}return n},t.prototype.transform=function(h){return Object.create(this,{parse:{value:function(n,p){p===void 0&&(p=[]);for(var l=0,_=Object.getPrototypeOf(this).parse.call(this,n);l<_.length;l++){var r=_[l],s=h(r);Array.isArray(s)?p.push.apply(p,s):p.push(s)}return p}}})},t})(ir),c=(function(e){function t(h){var n=e.call(this)||this;return n.commands=typeof h=="string"?t.parse(h):h,n}return tr(t,e),t.prototype.encode=function(){return t.encode(this.commands)},t.prototype.getBounds=function(){var h=d.CALCULATE_BOUNDS();return this.transform(h),h},t.prototype.transform=function(h){for(var n=[],p=0,l=this.commands;p