g2o-canvas
Version:
g2o Canvas View
41 lines • 110 kB
JavaScript
System.register(["g2o","g2o-svg"],(function(t){"use strict";var e,i,r;return{setters:[function(t){e=t.GraphicsBoard},function(t){i=t.SVGViewFactory,r=t.SVGViewDOM}],execute:function(){t("initBoard",(function(t,i={}){const s=new pe,n=new r,a=new de;return new e(t,s,n,a,i)}));var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var a={exports:{}},o={exports:{}};(function(){var t,e,i,r,s,n;"undefined"!=typeof performance&&null!==performance&&performance.now?o.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(o.exports=function(){return(t()-s)/1e6},e=process.hrtime,r=(t=function(){var t;return 1e9*(t=e())[0]+t[1]})(),n=1e9*process.uptime(),s=r-n):Date.now?(o.exports=function(){return Date.now()-i},i=Date.now()):(o.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(s);for(var h=o.exports,l="undefined"==typeof window?s:window,c=["moz","webkit"],u="AnimationFrame",g=l["request"+u],d=l["cancel"+u]||l["cancelRequest"+u],p=0;!g&&p<c.length;p++)g=l[c[p]+"Request"+u],d=l[c[p]+"Cancel"+u]||l[c[p]+"CancelRequest"+u];if(!g||!d){var f=0,y=0,m=[],x=1e3/60;g=function(t){if(0===m.length){var e=h(),i=Math.max(0,x-(e-f));f=i+e,setTimeout((function(){var t=m.slice(0);m.length=0;for(var e=0;e<t.length;e++)if(!t[e].cancelled)try{t[e].callback(f)}catch(t){setTimeout((function(){throw t}),0)}}),Math.round(i))}return m.push({handle:++y,callback:t,cancelled:!1}),y},d=function(t){for(var e=0;e<m.length;e++)m[e].handle===t&&(m[e].cancelled=!0)}}a.exports=function(t){return g.call(l,t)},a.exports.cancel=function(){d.apply(l,arguments)},a.exports.polyfill=function(t){t||(t=l),t.requestAnimationFrame=g,t.cancelAnimationFrame=d};var b=n(a.exports),v=function(t){this.ok=!1,this.alpha=1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=(t=t.replace(/ /g,"")).toLowerCase();var e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};t=e[t]||t;for(var i=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],r=0;r<i.length;r++){var s=i[r].re,n=i[r].process,a=s.exec(t);if(a){var o=n(a);this.r=o[0],this.g=o[1],this.b=o[2],o.length>3&&(this.alpha=o[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),i=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==i.length&&(i="0"+i),"#"+t+e+i},this.getHelpXML=function(){for(var t=new Array,r=0;r<i.length;r++)for(var s=i[r].example,n=0;n<s.length;n++)t[t.length]=s[n];for(var a in e)t[t.length]=a;var o=document.createElement("ul");o.setAttribute("id","rgbcolor-examples");for(r=0;r<t.length;r++)try{var h=document.createElement("li"),l=new RGBColor(t[r]),c=document.createElement("div");c.style.cssText="margin: 3px; border: 1px solid black; background:"+l.toHex()+"; color:"+l.toHex(),c.appendChild(document.createTextNode("test"));var u=document.createTextNode(" "+t[r]+" -> "+l.toRGB()+" -> "+l.toHex());h.appendChild(c),h.appendChild(u),o.appendChild(h)}catch(t){}return o}},w=n(v),T=function(t,e){return(T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};function S(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}T(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function A(t,e){var i=t[0],r=t[1];return[i*Math.cos(e)-r*Math.sin(e),i*Math.sin(e)+r*Math.cos(e)]}function C(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=0;i<t.length;i++)if("number"!=typeof t[i])throw new Error("assertNumbers arguments["+i+"] is not a number. "+typeof t[i]+" == typeof "+t[i]);return!0}var P=Math.PI;function E(t,e,i){t.lArcFlag=0===t.lArcFlag?0:1,t.sweepFlag=0===t.sweepFlag?0:1;var r=t.rX,s=t.rY,n=t.x,a=t.y;r=Math.abs(t.rX),s=Math.abs(t.rY);var o=A([(e-n)/2,(i-a)/2],-t.xRot/180*P),h=o[0],l=o[1],c=Math.pow(h,2)/Math.pow(r,2)+Math.pow(l,2)/Math.pow(s,2);1<c&&(r*=Math.sqrt(c),s*=Math.sqrt(c)),t.rX=r,t.rY=s;var u=Math.pow(r,2)*Math.pow(l,2)+Math.pow(s,2)*Math.pow(h,2),g=(t.lArcFlag!==t.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(s,2)-u)/u)),d=r*l/s*g,p=-s*h/r*g,f=A([d,p],t.xRot/180*P);t.cX=f[0]+(e+n)/2,t.cY=f[1]+(i+a)/2,t.phi1=Math.atan2((l-p)/s,(h-d)/r),t.phi2=Math.atan2((-l-p)/s,(-h-d)/r),0===t.sweepFlag&&t.phi2>t.phi1&&(t.phi2-=2*P),1===t.sweepFlag&&t.phi2<t.phi1&&(t.phi2+=2*P),t.phi1*=180/P,t.phi2*=180/P}function O(t,e,i){C(t,e,i);var r=t*t+e*e-i*i;if(0>r)return[];if(0===r)return[[t*i/(t*t+e*e),e*i/(t*t+e*e)]];var s=Math.sqrt(r);return[[(t*i+e*s)/(t*t+e*e),(e*i-t*s)/(t*t+e*e)],[(t*i-e*s)/(t*t+e*e),(e*i+t*s)/(t*t+e*e)]]}var N,M=Math.PI/180;function V(t,e,i){return(1-i)*t+i*e}function _(t,e,i,r){return t+Math.cos(r/180*P)*e+Math.sin(r/180*P)*i}function R(t,e,i,r){var s=1e-6,n=e-t,a=i-e,o=3*n+3*(r-i)-6*a,h=6*(a-n),l=3*n;return Math.abs(o)<s?[-l/h]:function(t,e,i){var r=t*t/4-e;if(r<-i)return[];if(r<=i)return[-t/2];var s=Math.sqrt(r);return[-t/2-s,-t/2+s]}(h/o,l/o,s)}function k(t,e,i,r,s){var n=1-s;return t*(n*n*n)+e*(3*n*n*s)+i*(3*n*s*s)+r*(s*s*s)}!function(t){function e(){return s((function(t,e,i){return t.relative&&(void 0!==t.x1&&(t.x1+=e),void 0!==t.y1&&(t.y1+=i),void 0!==t.x2&&(t.x2+=e),void 0!==t.y2&&(t.y2+=i),void 0!==t.x&&(t.x+=e),void 0!==t.y&&(t.y+=i),t.relative=!1),t}))}function i(){var t=NaN,e=NaN,i=NaN,r=NaN;return s((function(s,n,a){return s.type&H.SMOOTH_CURVE_TO&&(s.type=H.CURVE_TO,t=isNaN(t)?n:t,e=isNaN(e)?a:e,s.x1=s.relative?n-t:2*n-t,s.y1=s.relative?a-e:2*a-e),s.type&H.CURVE_TO?(t=s.relative?n+s.x2:s.x2,e=s.relative?a+s.y2:s.y2):(t=NaN,e=NaN),s.type&H.SMOOTH_QUAD_TO&&(s.type=H.QUAD_TO,i=isNaN(i)?n:i,r=isNaN(r)?a:r,s.x1=s.relative?n-i:2*n-i,s.y1=s.relative?a-r:2*a-r),s.type&H.QUAD_TO?(i=s.relative?n+s.x1:s.x1,r=s.relative?a+s.y1:s.y1):(i=NaN,r=NaN),s}))}function r(){var t=NaN,e=NaN;return s((function(i,r,s){if(i.type&H.SMOOTH_QUAD_TO&&(i.type=H.QUAD_TO,t=isNaN(t)?r:t,e=isNaN(e)?s:e,i.x1=i.relative?r-t:2*r-t,i.y1=i.relative?s-e:2*s-e),i.type&H.QUAD_TO){t=i.relative?r+i.x1:i.x1,e=i.relative?s+i.y1:i.y1;var n=i.x1,a=i.y1;i.type=H.CURVE_TO,i.x1=((i.relative?0:r)+2*n)/3,i.y1=((i.relative?0:s)+2*a)/3,i.x2=(i.x+2*n)/3,i.y2=(i.y+2*a)/3}else t=NaN,e=NaN;return i}))}function s(t){var e=0,i=0,r=NaN,s=NaN;return function(n){if(isNaN(r)&&!(n.type&H.MOVE_TO))throw new Error("path must start with moveto");var a=t(n,e,i,r,s);return n.type&H.CLOSE_PATH&&(e=r,i=s),void 0!==n.x&&(e=n.relative?e+n.x:n.x),void 0!==n.y&&(i=n.relative?i+n.y:n.y),n.type&H.MOVE_TO&&(r=e,s=i),a}}function n(t,e,i,r,n,a){return C(t,e,i,r,n,a),s((function(s,o,h,l){var c=s.x1,u=s.x2,g=s.relative&&!isNaN(l),d=void 0!==s.x?s.x:g?0:o,p=void 0!==s.y?s.y:g?0:h;function f(t){return t*t}s.type&H.HORIZ_LINE_TO&&0!==e&&(s.type=H.LINE_TO,s.y=s.relative?0:h),s.type&H.VERT_LINE_TO&&0!==i&&(s.type=H.LINE_TO,s.x=s.relative?0:o),void 0!==s.x&&(s.x=s.x*t+p*i+(g?0:n)),void 0!==s.y&&(s.y=d*e+s.y*r+(g?0:a)),void 0!==s.x1&&(s.x1=s.x1*t+s.y1*i+(g?0:n)),void 0!==s.y1&&(s.y1=c*e+s.y1*r+(g?0:a)),void 0!==s.x2&&(s.x2=s.x2*t+s.y2*i+(g?0:n)),void 0!==s.y2&&(s.y2=u*e+s.y2*r+(g?0:a));var y=t*r-e*i;if(void 0!==s.xRot&&(1!==t||0!==e||0!==i||1!==r))if(0===y)delete s.rX,delete s.rY,delete s.xRot,delete s.lArcFlag,delete s.sweepFlag,s.type=H.LINE_TO;else{var m=s.xRot*Math.PI/180,x=Math.sin(m),b=Math.cos(m),v=1/f(s.rX),w=1/f(s.rY),T=f(b)*v+f(x)*w,S=2*x*b*(v-w),A=f(x)*v+f(b)*w,C=T*r*r-S*e*r+A*e*e,P=S*(t*r+e*i)-2*(T*i*r+A*t*e),E=T*i*i-S*t*i+A*t*t,O=(Math.atan2(P,C-E)+Math.PI)%Math.PI/2,N=Math.sin(O),M=Math.cos(O);s.rX=Math.abs(y)/Math.sqrt(C*f(M)+P*N*M+E*f(N)),s.rY=Math.abs(y)/Math.sqrt(C*f(N)-P*N*M+E*f(M)),s.xRot=180*O/Math.PI}return void 0!==s.sweepFlag&&0>y&&(s.sweepFlag=+!s.sweepFlag),s}))}t.ROUND=function(t){function e(e){return Math.round(e*t)/t}return void 0===t&&(t=1e13),C(t),function(t){return void 0!==t.x1&&(t.x1=e(t.x1)),void 0!==t.y1&&(t.y1=e(t.y1)),void 0!==t.x2&&(t.x2=e(t.x2)),void 0!==t.y2&&(t.y2=e(t.y2)),void 0!==t.x&&(t.x=e(t.x)),void 0!==t.y&&(t.y=e(t.y)),void 0!==t.rX&&(t.rX=e(t.rX)),void 0!==t.rY&&(t.rY=e(t.rY)),t}},t.TO_ABS=e,t.TO_REL=function(){return s((function(t,e,i){return t.relative||(void 0!==t.x1&&(t.x1-=e),void 0!==t.y1&&(t.y1-=i),void 0!==t.x2&&(t.x2-=e),void 0!==t.y2&&(t.y2-=i),void 0!==t.x&&(t.x-=e),void 0!==t.y&&(t.y-=i),t.relative=!0),t}))},t.NORMALIZE_HVZ=function(t,e,i){return void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=!0),s((function(r,s,n,a,o){if(isNaN(a)&&!(r.type&H.MOVE_TO))throw new Error("path must start with moveto");return e&&r.type&H.HORIZ_LINE_TO&&(r.type=H.LINE_TO,r.y=r.relative?0:n),i&&r.type&H.VERT_LINE_TO&&(r.type=H.LINE_TO,r.x=r.relative?0:s),t&&r.type&H.CLOSE_PATH&&(r.type=H.LINE_TO,r.x=r.relative?a-s:a,r.y=r.relative?o-n:o),r.type&H.ARC&&(0===r.rX||0===r.rY)&&(r.type=H.LINE_TO,delete r.rX,delete r.rY,delete r.xRot,delete r.lArcFlag,delete r.sweepFlag),r}))},t.NORMALIZE_ST=i,t.QT_TO_C=r,t.INFO=s,t.SANITIZE=function(t){void 0===t&&(t=0),C(t);var e=NaN,i=NaN,r=NaN,n=NaN;return s((function(s,a,o,h,l){var c=Math.abs,u=!1,g=0,d=0;if(s.type&H.SMOOTH_CURVE_TO&&(g=isNaN(e)?0:a-e,d=isNaN(i)?0:o-i),s.type&(H.CURVE_TO|H.SMOOTH_CURVE_TO)?(e=s.relative?a+s.x2:s.x2,i=s.relative?o+s.y2:s.y2):(e=NaN,i=NaN),s.type&H.SMOOTH_QUAD_TO?(r=isNaN(r)?a:2*a-r,n=isNaN(n)?o:2*o-n):s.type&H.QUAD_TO?(r=s.relative?a+s.x1:s.x1,n=s.relative?o+s.y1:s.y2):(r=NaN,n=NaN),s.type&H.LINE_COMMANDS||s.type&H.ARC&&(0===s.rX||0===s.rY||!s.lArcFlag)||s.type&H.CURVE_TO||s.type&H.SMOOTH_CURVE_TO||s.type&H.QUAD_TO||s.type&H.SMOOTH_QUAD_TO){var p=void 0===s.x?0:s.relative?s.x:s.x-a,f=void 0===s.y?0:s.relative?s.y:s.y-o;g=isNaN(r)?void 0===s.x1?g:s.relative?s.x:s.x1-a:r-a,d=isNaN(n)?void 0===s.y1?d:s.relative?s.y:s.y1-o:n-o;var y=void 0===s.x2?0:s.relative?s.x:s.x2-a,m=void 0===s.y2?0:s.relative?s.y:s.y2-o;c(p)<=t&&c(f)<=t&&c(g)<=t&&c(d)<=t&&c(y)<=t&&c(m)<=t&&(u=!0)}return s.type&H.CLOSE_PATH&&c(a-h)<=t&&c(o-l)<=t&&(u=!0),u?[]:s}))},t.MATRIX=n,t.ROTATE=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),C(t,e,i);var r=Math.sin(t),s=Math.cos(t);return n(s,r,-r,s,e-e*s+i*r,i-e*r-i*s)},t.TRANSLATE=function(t,e){return void 0===e&&(e=0),C(t,e),n(1,0,0,1,t,e)},t.SCALE=function(t,e){return void 0===e&&(e=t),C(t,e),n(t,0,0,e,0,0)},t.SKEW_X=function(t){return C(t),n(1,0,Math.atan(t),1,0,0)},t.SKEW_Y=function(t){return C(t),n(1,Math.atan(t),0,1,0,0)},t.X_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),C(t),n(-1,0,0,1,t,0)},t.Y_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),C(t),n(1,0,0,-1,0,t)},t.A_TO_C=function(){return s((function(t,e,i){return H.ARC===t.type?function(t,e,i){var r,s,n,a;t.cX||E(t,e,i);for(var o=Math.min(t.phi1,t.phi2),h=Math.max(t.phi1,t.phi2)-o,l=Math.ceil(h/90),c=new Array(l),u=e,g=i,d=0;d<l;d++){var p=V(t.phi1,t.phi2,d/l),f=V(t.phi1,t.phi2,(d+1)/l),y=f-p,m=4/3*Math.tan(y*M/4),x=[Math.cos(p*M)-m*Math.sin(p*M),Math.sin(p*M)+m*Math.cos(p*M)],b=x[0],v=x[1],w=[Math.cos(f*M),Math.sin(f*M)],T=w[0],S=w[1],C=[T+m*Math.sin(f*M),S-m*Math.cos(f*M)],P=C[0],O=C[1];c[d]={relative:t.relative,type:H.CURVE_TO};var N=function(e,i){var r=A([e*t.rX,i*t.rY],t.xRot),s=r[0],n=r[1];return[t.cX+s,t.cY+n]};r=N(b,v),c[d].x1=r[0],c[d].y1=r[1],s=N(P,O),c[d].x2=s[0],c[d].y2=s[1],n=N(T,S),c[d].x=n[0],c[d].y=n[1],t.relative&&(c[d].x1-=u,c[d].y1-=g,c[d].x2-=u,c[d].y2-=g,c[d].x-=u,c[d].y-=g),u=(a=[c[d].x,c[d].y])[0],g=a[1]}return c}(t,t.relative?0:e,t.relative?0:i):t}))},t.ANNOTATE_ARCS=function(){return s((function(t,e,i){return t.relative&&(e=0,i=0),H.ARC===t.type&&E(t,e,i),t}))},t.CLONE=function(){return function(t){var e={};for(var i in t)e[i]=t[i];return e}},t.CALCULATE_BOUNDS=function(){var t=e(),n=r(),a=i(),o=s((function(e,i,r){var s=a(n(t(function(t){var e={};for(var i in t)e[i]=t[i];return e}(e))));function h(t){t>o.maxX&&(o.maxX=t),t<o.minX&&(o.minX=t)}function l(t){t>o.maxY&&(o.maxY=t),t<o.minY&&(o.minY=t)}if(s.type&H.DRAWING_COMMANDS&&(h(i),l(r)),s.type&H.HORIZ_LINE_TO&&h(s.x),s.type&H.VERT_LINE_TO&&l(s.y),s.type&H.LINE_TO&&(h(s.x),l(s.y)),s.type&H.CURVE_TO){h(s.x),l(s.y);for(var c=0,u=R(i,s.x1,s.x2,s.x);c<u.length;c++)0<(N=u[c])&&1>N&&h(k(i,s.x1,s.x2,s.x,N));for(var g=0,d=R(r,s.y1,s.y2,s.y);g<d.length;g++)0<(N=d[g])&&1>N&&l(k(r,s.y1,s.y2,s.y,N))}if(s.type&H.ARC){h(s.x),l(s.y),E(s,i,r);for(var p=s.xRot/180*Math.PI,f=Math.cos(p)*s.rX,y=Math.sin(p)*s.rX,m=-Math.sin(p)*s.rY,x=Math.cos(p)*s.rY,b=s.phi1<s.phi2?[s.phi1,s.phi2]:-180>s.phi2?[s.phi2+360,s.phi1+360]:[s.phi2,s.phi1],v=b[0],w=b[1],T=function(t){var e=t[0],i=t[1],r=180*Math.atan2(i,e)/Math.PI;return r<v?r+360:r},S=0,A=O(m,-f,0).map(T);S<A.length;S++)(N=A[S])>v&&N<w&&h(_(s.cX,f,m,N));for(var C=0,P=O(x,-y,0).map(T);C<P.length;C++){var N;(N=P[C])>v&&N<w&&l(_(s.cY,y,x,N))}}return e}));return o.minX=1/0,o.maxX=-1/0,o.minY=1/0,o.maxY=-1/0,o}}(N||(N={}));var I,L=function(){function t(){}return t.prototype.round=function(t){return this.transform(N.ROUND(t))},t.prototype.toAbs=function(){return this.transform(N.TO_ABS())},t.prototype.toRel=function(){return this.transform(N.TO_REL())},t.prototype.normalizeHVZ=function(t,e,i){return this.transform(N.NORMALIZE_HVZ(t,e,i))},t.prototype.normalizeST=function(){return this.transform(N.NORMALIZE_ST())},t.prototype.qtToC=function(){return this.transform(N.QT_TO_C())},t.prototype.aToC=function(){return this.transform(N.A_TO_C())},t.prototype.sanitize=function(t){return this.transform(N.SANITIZE(t))},t.prototype.translate=function(t,e){return this.transform(N.TRANSLATE(t,e))},t.prototype.scale=function(t,e){return this.transform(N.SCALE(t,e))},t.prototype.rotate=function(t,e,i){return this.transform(N.ROTATE(t,e,i))},t.prototype.matrix=function(t,e,i,r,s,n){return this.transform(N.MATRIX(t,e,i,r,s,n))},t.prototype.skewX=function(t){return this.transform(N.SKEW_X(t))},t.prototype.skewY=function(t){return this.transform(N.SKEW_Y(t))},t.prototype.xSymmetry=function(t){return this.transform(N.X_AXIS_SYMMETRY(t))},t.prototype.ySymmetry=function(t){return this.transform(N.Y_AXIS_SYMMETRY(t))},t.prototype.annotateArcs=function(){return this.transform(N.ANNOTATE_ARCS())},t}(),D=function(t){return" "===t||"\t"===t||"\r"===t||"\n"===t},B=function(t){return"0".charCodeAt(0)<=t.charCodeAt(0)&&t.charCodeAt(0)<="9".charCodeAt(0)},z=function(t){function e(){var e=t.call(this)||this;return e.curNumber="",e.curCommandType=-1,e.curCommandRelative=!1,e.canParseCommandOrComma=!0,e.curNumberHasExp=!1,e.curNumberHasExpDigits=!1,e.curNumberHasDecimal=!1,e.curArgs=[],e}return S(e,t),e.prototype.finish=function(t){if(void 0===t&&(t=[]),this.parse(" ",t),0!==this.curArgs.length||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return t},e.prototype.parse=function(t,e){var i=this;void 0===e&&(e=[]);for(var r=function(t){e.push(t),i.curArgs.length=0,i.canParseCommandOrComma=!0},s=0;s<t.length;s++){var n=t[s],a=!(this.curCommandType!==H.ARC||3!==this.curArgs.length&&4!==this.curArgs.length||1!==this.curNumber.length||"0"!==this.curNumber&&"1"!==this.curNumber),o=B(n)&&("0"===this.curNumber&&"0"===n||a);if(!B(n)||o)if("e"!==n&&"E"!==n)if("-"!==n&&"+"!==n||!this.curNumberHasExp||this.curNumberHasExpDigits)if("."!==n||this.curNumberHasExp||this.curNumberHasDecimal||a){if(this.curNumber&&-1!==this.curCommandType){var h=Number(this.curNumber);if(isNaN(h))throw new SyntaxError("Invalid number ending at "+s);if(this.curCommandType===H.ARC)if(0===this.curArgs.length||1===this.curArgs.length){if(0>h)throw new SyntaxError('Expected positive number, got "'+h+'" at index "'+s+'"')}else if((3===this.curArgs.length||4===this.curArgs.length)&&"0"!==this.curNumber&&"1"!==this.curNumber)throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+s+'"');this.curArgs.push(h),this.curArgs.length===U[this.curCommandType]&&(H.HORIZ_LINE_TO===this.curCommandType?r({type:H.HORIZ_LINE_TO,relative:this.curCommandRelative,x:h}):H.VERT_LINE_TO===this.curCommandType?r({type:H.VERT_LINE_TO,relative:this.curCommandRelative,y:h}):this.curCommandType===H.MOVE_TO||this.curCommandType===H.LINE_TO||this.curCommandType===H.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),H.MOVE_TO===this.curCommandType&&(this.curCommandType=H.LINE_TO)):this.curCommandType===H.CURVE_TO?r({type:H.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===H.SMOOTH_CURVE_TO?r({type:H.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===H.QUAD_TO?r({type:H.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===H.ARC&&r({type:H.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(!D(n))if(","===n&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if("+"!==n&&"-"!==n&&"."!==n)if(o)this.curNumber=n,this.curNumberHasDecimal=!1;else{if(0!==this.curArgs.length)throw new SyntaxError("Unterminated command at index "+s+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+n+'" at index '+s+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,"z"!==n&&"Z"!==n)if("h"===n||"H"===n)this.curCommandType=H.HORIZ_LINE_TO,this.curCommandRelative="h"===n;else if("v"===n||"V"===n)this.curCommandType=H.VERT_LINE_TO,this.curCommandRelative="v"===n;else if("m"===n||"M"===n)this.curCommandType=H.MOVE_TO,this.curCommandRelative="m"===n;else if("l"===n||"L"===n)this.curCommandType=H.LINE_TO,this.curCommandRelative="l"===n;else if("c"===n||"C"===n)this.curCommandType=H.CURVE_TO,this.curCommandRelative="c"===n;else if("s"===n||"S"===n)this.curCommandType=H.SMOOTH_CURVE_TO,this.curCommandRelative="s"===n;else if("q"===n||"Q"===n)this.curCommandType=H.QUAD_TO,this.curCommandRelative="q"===n;else if("t"===n||"T"===n)this.curCommandType=H.SMOOTH_QUAD_TO,this.curCommandRelative="t"===n;else{if("a"!==n&&"A"!==n)throw new SyntaxError('Unexpected character "'+n+'" at index '+s+".");this.curCommandType=H.ARC,this.curCommandRelative="a"===n}else e.push({type:H.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=n,this.curNumberHasDecimal="."===n}else this.curNumber+=n,this.curNumberHasDecimal=!0;else this.curNumber+=n;else this.curNumber+=n,this.curNumberHasExp=!0;else this.curNumber+=n,this.curNumberHasExpDigits=this.curNumberHasExp}return e},e.prototype.transform=function(t){return Object.create(this,{parse:{value:function(e,i){void 0===i&&(i=[]);for(var r=0,s=Object.getPrototypeOf(this).parse.call(this,e);r<s.length;r++){var n=s[r],a=t(n);Array.isArray(a)?i.push.apply(i,a):i.push(a)}return i}}})},e}(L),H=function(t){function e(i){var r=t.call(this)||this;return r.commands="string"==typeof i?e.parse(i):i,r}return S(e,t),e.prototype.encode=function(){return e.encode(this.commands)},e.prototype.getBounds=function(){var t=N.CALCULATE_BOUNDS();return this.transform(t),t},e.prototype.transform=function(t){for(var e=[],i=0,r=this.commands;i<r.length;i++){var s=t(r[i]);Array.isArray(s)?e.push.apply(e,s):e.push(s)}return this.commands=e,this},e.encode=function(t){return function(t){var e="";Array.isArray(t)||(t=[t]);for(var i=0;i<t.length;i++){var r=t[i];if(r.type===H.CLOSE_PATH)e+="z";else if(r.type===H.HORIZ_LINE_TO)e+=(r.relative?"h":"H")+r.x;else if(r.type===H.VERT_LINE_TO)e+=(r.relative?"v":"V")+r.y;else if(r.type===H.MOVE_TO)e+=(r.relative?"m":"M")+r.x+" "+r.y;else if(r.type===H.LINE_TO)e+=(r.relative?"l":"L")+r.x+" "+r.y;else if(r.type===H.CURVE_TO)e+=(r.relative?"c":"C")+r.x1+" "+r.y1+" "+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===H.SMOOTH_CURVE_TO)e+=(r.relative?"s":"S")+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===H.QUAD_TO)e+=(r.relative?"q":"Q")+r.x1+" "+r.y1+" "+r.x+" "+r.y;else if(r.type===H.SMOOTH_QUAD_TO)e+=(r.relative?"t":"T")+r.x+" "+r.y;else{if(r.type!==H.ARC)throw new Error('Unexpected command type "'+r.type+'" at index '+i+".");e+=(r.relative?"a":"A")+r.rX+" "+r.rY+" "+r.xRot+" "+ +r.lArcFlag+" "+ +r.sweepFlag+" "+r.x+" "+r.y}}return e}(t)},e.parse=function(t){var e=new z,i=[];return e.parse(t,i),e.finish(i),i},e.CLOSE_PATH=1,e.MOVE_TO=2,e.HORIZ_LINE_TO=4,e.VERT_LINE_TO=8,e.LINE_TO=16,e.CURVE_TO=32,e.SMOOTH_CURVE_TO=64,e.QUAD_TO=128,e.SMOOTH_QUAD_TO=256,e.ARC=512,e.LINE_COMMANDS=e.LINE_TO|e.HORIZ_LINE_TO|e.VERT_LINE_TO,e.DRAWING_COMMANDS=e.HORIZ_LINE_TO|e.VERT_LINE_TO|e.LINE_TO|e.CURVE_TO|e.SMOOTH_CURVE_TO|e.QUAD_TO|e.SMOOTH_QUAD_TO|e.ARC,e}(L),U=((I={})[H.MOVE_TO]=2,I[H.LINE_TO]=2,I[H.HORIZ_LINE_TO]=1,I[H.VERT_LINE_TO]=1,I[H.CLOSE_PATH]=0,I[H.QUAD_TO]=4,I[H.SMOOTH_QUAD_TO]=2,I[H.CURVE_TO]=6,I[H.SMOOTH_CURVE_TO]=4,I[H.ARC]=7,I);function F(t){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},F(t)}
/**
* StackBlur - a fast almost Gaussian Blur For Canvas
*
* In case you find this class useful - especially in commercial projects -
* I am not totally unhappy for a small donation to my PayPal account
* mario@quasimondo.de
*
* Or support me on flattr:
* {@link https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript}.
*
* @module StackBlur
* @author Mario Klingemann
* Contact: mario@quasimondo.com
* Website: {@link http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html}
* Twitter: @quasimondo
*
* @copyright (c) 2010 Mario Klingemann
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
var X=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Y=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function q(t,e,i,r,s,n){if(!(isNaN(n)||n<1)){n|=0;var a=function(t,e,i,r,s){if("string"==typeof t&&(t=document.getElementById(t)),!t||"object"!==F(t)||!("getContext"in t))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var n=t.getContext("2d");try{return n.getImageData(e,i,r,s)}catch(t){throw new Error("unable to access image data: "+t)}}(t,e,i,r,s);a=function(t,e,i,r,s,n){for(var a,o=t.data,h=2*n+1,l=r-1,c=s-1,u=n+1,g=u*(u+1)/2,d=new W,p=d,f=1;f<h;f++)p=p.next=new W,f===u&&(a=p);p.next=d;for(var y=null,m=null,x=0,b=0,v=X[n],w=Y[n],T=0;T<s;T++){p=d;for(var S=o[b],A=o[b+1],C=o[b+2],P=o[b+3],E=0;E<u;E++)p.r=S,p.g=A,p.b=C,p.a=P,p=p.next;for(var O=0,N=0,M=0,V=0,_=u*S,R=u*A,k=u*C,I=u*P,L=g*S,D=g*A,B=g*C,z=g*P,H=1;H<u;H++){var U=b+((l<H?l:H)<<2),F=o[U],q=o[U+1],Q=o[U+2],G=o[U+3],$=u-H;L+=(p.r=F)*$,D+=(p.g=q)*$,B+=(p.b=Q)*$,z+=(p.a=G)*$,O+=F,N+=q,M+=Q,V+=G,p=p.next}y=d,m=a;for(var Z=0;Z<r;Z++){var j=z*v>>>w;if(o[b+3]=j,0!==j){var K=255/j;o[b]=(L*v>>>w)*K,o[b+1]=(D*v>>>w)*K,o[b+2]=(B*v>>>w)*K}else o[b]=o[b+1]=o[b+2]=0;L-=_,D-=R,B-=k,z-=I,_-=y.r,R-=y.g,k-=y.b,I-=y.a;var J=Z+n+1;J=x+(J<l?J:l)<<2,L+=O+=y.r=o[J],D+=N+=y.g=o[J+1],B+=M+=y.b=o[J+2],z+=V+=y.a=o[J+3],y=y.next;var tt=m,et=tt.r,it=tt.g,rt=tt.b,st=tt.a;_+=et,R+=it,k+=rt,I+=st,O-=et,N-=it,M-=rt,V-=st,m=m.next,b+=4}x+=r}for(var nt=0;nt<r;nt++){var at=o[b=nt<<2],ot=o[b+1],ht=o[b+2],lt=o[b+3],ct=u*at,ut=u*ot,gt=u*ht,dt=u*lt,pt=g*at,ft=g*ot,yt=g*ht,mt=g*lt;p=d;for(var xt=0;xt<u;xt++)p.r=at,p.g=ot,p.b=ht,p.a=lt,p=p.next;for(var bt=r,vt=0,wt=0,Tt=0,St=0,At=1;At<=n;At++){b=bt+nt<<2;var Ct=u-At;pt+=(p.r=at=o[b])*Ct,ft+=(p.g=ot=o[b+1])*Ct,yt+=(p.b=ht=o[b+2])*Ct,mt+=(p.a=lt=o[b+3])*Ct,St+=at,vt+=ot,wt+=ht,Tt+=lt,p=p.next,At<c&&(bt+=r)}b=nt,y=d,m=a;for(var Pt=0;Pt<s;Pt++){var Et=b<<2;o[Et+3]=lt=mt*v>>>w,lt>0?(lt=255/lt,o[Et]=(pt*v>>>w)*lt,o[Et+1]=(ft*v>>>w)*lt,o[Et+2]=(yt*v>>>w)*lt):o[Et]=o[Et+1]=o[Et+2]=0,pt-=ct,ft-=ut,yt-=gt,mt-=dt,ct-=y.r,ut-=y.g,gt-=y.b,dt-=y.a,Et=nt+((Et=Pt+u)<c?Et:c)*r<<2,pt+=St+=y.r=o[Et],ft+=vt+=y.g=o[Et+1],yt+=wt+=y.b=o[Et+2],mt+=Tt+=y.a=o[Et+3],y=y.next,ct+=at=m.r,ut+=ot=m.g,gt+=ht=m.b,dt+=lt=m.a,St-=at,vt-=ot,wt-=ht,Tt-=lt,m=m.next,b+=r}}return t}(a,0,0,r,s,n),t.getContext("2d").putImageData(a,e,i)}}var W=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null};function Q(t){return t.replace(/(?!\u3000)\s+/gm," ")}function G(t){const e=t.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return e?e.map(parseFloat):[]}const $=/^[A-Z-]+$/;function Z(t){const e=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(t);return e&&(e[2]||e[3]||e[4])||""}const j=/(\[[^\]]+\])/g,K=/(#[^\s+>~.[:]+)/g,J=/(\.[^\s+>~.[:]+)/g,tt=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,et=/(:[\w-]+\([^)]*\))/gi,it=/(:[^\s+>~.[:]+)/g,rt=/([^\s+>~.[:]+)/g;function st(t,e){const i=e.exec(t);return i?[t.replace(e," "),i.length]:[t,0]}const nt=1e-8;function at(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))}function ot(t,e){return(t[0]*e[0]+t[1]*e[1])/(at(t)*at(e))}function ht(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(ot(t,e))}function lt(t){return t*t*t}function ct(t){return 3*t*t*(1-t)}function ut(t){return 3*t*(1-t)*(1-t)}function gt(t){return(1-t)*(1-t)*(1-t)}function dt(t){return t*t}function pt(t){return 2*t*(1-t)}function ft(t){return(1-t)*(1-t)}class yt{static empty(t){return new yt(t,"EMPTY","")}split(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:" ";const{document:e,name:i}=this;return Q(this.getString()).trim().split(t).map((t=>new yt(e,i,t)))}hasValue(t){const e=this.value;return null!==e&&""!==e&&(t||0!==e)&&void 0!==e}isString(t){const{value:e}=this,i="string"==typeof e;return i&&t?t.test(e):i}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;const t=this.getString();switch(!0){case t.endsWith("px"):case/^[0-9]+$/.test(t):return!0;default:return!1}}setValue(t){return this.value=t,this}getValue(t){return void 0===t||this.hasValue()?this.value:t}getNumber(t){if(!this.hasValue())return void 0===t?0:parseFloat(t);const{value:e}=this;let i=parseFloat(e);return this.isString(/%$/)&&(i/=100),i}getString(t){return void 0===t||this.hasValue()?void 0===this.value?"":String(this.value):String(t)}getColor(t){let e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=function(t){if(!t.startsWith("rgb"))return t;let e=3;return t.replace(/\d+(\.\d+)?/g,((t,i)=>e--&&i?String(Math.round(parseFloat(t))):t))}(e),this.value=e),e}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasValue())return 0;const[i,r]="boolean"==typeof t?[void 0,t]:[t],{viewPort:s}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(s.computeSize("x"),s.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(s.computeSize("x"),s.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*s.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*s.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return 15*this.getNumber();case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case this.isString(/%$/)&&r:return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*s.computeSize(i);default:{const t=this.getNumber();return e&&t<1?t*s.computeSize(i):t}}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():1e3*this.getNumber():0}getRadians(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}getDefinition(){const t=this.getString(),e=/#([^)'"]+)/.exec(t),i=(null==e?void 0:e[1])||t;return this.document.definitions[i]}getFillStyleDefinition(t,e){let i=this.getDefinition();if(!i)return null;if("function"==typeof i.createGradient&&"getBoundingBox"in t)return i.createGradient(this.document.ctx,t,e);if("function"==typeof i.createPattern){if(i.getHrefAttribute().hasValue()){const t=i.getAttribute("patternTransform");i=i.getHrefAttribute().getDefinition(),i&&t.hasValue()&&i.getAttribute("patternTransform",!0).setValue(t.value)}if(i)return i.createPattern(this.document.ctx,t,e)}return null}getTextBaseline(){if(!this.hasValue())return null;const t=this.getString();return yt.textBaselineMapping[t]||null}addOpacity(t){let e=this.getColor();const i=e.length;let r=0;for(let t=0;t<i&&(","===e[t]&&r++,3!==r);t++);if(t.hasValue()&&this.isString()&&3!==r){const i=new w(e);i.ok&&(i.alpha=t.getNumber(),e=i.toRGBA())}return new yt(this.document,this.name,e)}constructor(t,e,i){this.document=t,this.name=e,this.value=i,this.isNormalizedColor=!1}}yt.textBaselineMapping={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};class mt{clear(){this.viewPorts=[]}setCurrent(t,e){this.viewPorts.push({width:t,height:e})}removeCurrent(){this.viewPorts.pop()}getRoot(){const[t]=this.viewPorts;return t||xt()}getCurrent(){const{viewPorts:t}=this,e=t[t.length-1];return e||xt()}get width(){return this.getCurrent().width}get height(){return this.getCurrent().height}computeSize(t){return"number"==typeof t?t:"x"===t?this.width:"y"===t?this.height:Math.sqrt(Math.pow(this.width,2)+Math.pow(this.height,2))/Math.sqrt(2)}constructor(){this.viewPorts=[]}}function xt(){return{width:mt.DEFAULT_VIEWPORT_WIDTH,height:mt.DEFAULT_VIEWPORT_HEIGHT}}mt.DEFAULT_VIEWPORT_WIDTH=800,mt.DEFAULT_VIEWPORT_HEIGHT=600;class bt{static parse(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const[i=e,r=e]=G(t);return new bt(i,r)}static parseScale(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const[i=e,r=i]=G(t);return new bt(i,r)}static parsePath(t){const e=G(t),i=e.length,r=[];for(let t=0;t<i;t+=2)r.push(new bt(e[t],e[t+1]));return r}angleTo(t){return Math.atan2(t.y-this.y,t.x-this.x)}applyTransform(t){const{x:e,y:i}=this,r=e*t[0]+i*t[2]+t[4],s=e*t[1]+i*t[3]+t[5];this.x=r,this.y=s}constructor(t,e){this.x=t,this.y=e}}class vt{isWorking(){return this.working}start(){if(this.working)return;const{screen:t,onClick:e,onMouseMove:i}=this,r=t.ctx.canvas;r.onclick=e,r.onmousemove=i,this.working=!0}stop(){if(!this.working)return;const t=this.screen.ctx.canvas;this.working=!1,t.onclick=null,t.onmousemove=null}hasEvents(){return this.working&&this.events.length>0}runEvents(){if(!this.working)return;const{screen:t,events:e,eventElements:i}=this,{style:r}=t.ctx.canvas;let s;r&&(r.cursor=""),e.forEach(((t,e)=>{let{run:r}=t;for(s=i[e];s;)r(s),s=s.parent})),this.events=[],this.eventElements=[]}checkPath(t,e){if(!this.working||!e)return;const{events:i,eventElements:r}=this;i.forEach(((i,s)=>{let{x:n,y:a}=i;!r[s]&&e.isPointInPath&&e.isPointInPath(n,a)&&(r[s]=t)}))}checkBoundingBox(t,e){if(!this.working||!e)return;const{events:i,eventElements:r}=this;i.forEach(((i,s)=>{let{x:n,y:a}=i;!r[s]&&e.isPointInBox(n,a)&&(r[s]=t)}))}mapXY(t,e){const{window:i,ctx:r}=this.screen,s=new bt(t,e);let n=r.canvas;for(;n;)s.x-=n.offsetLeft,s.y-=n.offsetTop,n=n.offsetParent;return(null==i?void 0:i.scrollX)&&(s.x+=i.scrollX),(null==i?void 0:i.scrollY)&&(s.y+=i.scrollY),s}onClick(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onclick",x:e,y:i,run(t){t.onClick&&t.onClick()}})}onMouseMove(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onmousemove",x:e,y:i,run(t){t.onMouseMove&&t.onMouseMove()}})}constructor(t){this.screen=t,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}}const wt="undefined"!=typeof window?window:null,Tt="undefined"!=typeof fetch?fetch.bind(void 0):void 0;class St{wait(t){this.waits.push(t)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;const t=this.waits.every((t=>t()));return t&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=t,t}setDefaults(t){t.strokeStyle="rgba(0,0,0,0)",t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4}setViewBox(t){let{document:e,ctx:i,aspectRatio:r,width:s,desiredWidth:n,height:a,desiredHeight:o,minX:h=0,minY:l=0,refX:c,refY:u,clip:g=!1,clipX:d=0,clipY:p=0}=t;const f=Q(r).replace(/^defer\s/,""),[y,m]=f.split(" "),x=y||"xMidYMid",b=m||"meet",v=s/n,w=a/o,T=Math.min(v,w),S=Math.max(v,w);let A=n,C=o;"meet"===b&&(A*=T,C*=T),"slice"===b&&(A*=S,C*=S);const P=new yt(e,"refX",c),E=new yt(e,"refY",u),O=P.hasValue()&&E.hasValue();if(O&&i.translate(-T*P.getPixels("x"),-T*E.getPixels("y")),g){const t=T*d,e=T*p;i.beginPath(),i.moveTo(t,e),i.lineTo(s,e),i.lineTo(s,a),i.lineTo(t,a),i.closePath(),i.clip()}if(!O){const t="meet"===b&&T===w,e="slice"===b&&S===w,r="meet"===b&&T===v,n="slice"===b&&S===v;x.startsWith("xMid")&&(t||e)&&i.translate(s/2-A/2,0),x.endsWith("YMid")&&(r||n)&&i.translate(0,a/2-C/2),x.startsWith("xMax")&&(t||e)&&i.translate(s-A,0),x.endsWith("YMax")&&(r||n)&&i.translate(0,a-C)}switch(!0){case"none"===x:i.scale(v,w);break;case"meet"===b:i.scale(T,T);break;case"slice"===b:i.scale(S,S)}i.translate(-h,-l)}start(t){let{enableRedraw:e=!1,ignoreMouse:i=!1,ignoreAnimation:r=!1,ignoreDimensions:s=!1,ignoreClear:n=!1,forceRedraw:a,scaleWidth:o,scaleHeight:h,offsetX:l,offsetY:c}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{mouse:u}=this,g=1e3/St.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=g,this.readyPromise=new Promise((t=>{this.resolveReady=t})),this.isReady()&&this.render(t,s,n,o,h,l,c),!e)return;let d=Date.now(),p=d,f=0;const y=()=>{d=Date.now(),f=d-p,f>=g&&(p=d-f%g,this.shouldUpdate(r,a)&&(this.render(t,s,n,o,h,l,c),u.runEvents())),this.intervalId=b(y)};i||u.start(),this.intervalId=b(y)}stop(){this.intervalId&&(b.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(t,e){if(!t){const{frameDuration:t}=this;if(this.animations.reduce(((e,i)=>i.update(t)||e),!1))return!0}return!("function"!=typeof e||!e())||(!(this.isReadyLock||!this.isReady())||!!this.mouse.hasEvents())}render(t,e,i,r,s,n,a){const{viewPort:o,ctx:h,isFirstRender:l}=this,c=h.canvas;o.clear(),c.width&&c.height&&o.setCurrent(c.width,c.height);const u=t.getStyle("width"),g=t.getStyle("height");!e&&(l||"number"!=typeof r&&"number"!=typeof s)&&(u.hasValue()&&(c.width=u.getPixels("x"),c.style&&(c.style.width="".concat(c.width,"px"))),g.hasValue()&&(c.height=g.getPixels("y"),c.style&&(c.style.height="".concat(c.height,"px"))));let d=c.clientWidth||c.width,p=c.clientHeight||c.height;if(e&&u.hasValue()&&g.hasValue()&&(d=u.getPixels("x"),p=g.getPixels("y")),o.setCurrent(d,p),"number"==typeof n&&t.getAttribute("x",!0).setValue(n),"number"==typeof a&&t.getAttribute("y",!0).setValue(a),"number"==typeof r||"number"==typeof s){const e=G(t.getAttribute("viewBox").getString());let i=0,n=0;if("number"==typeof r){const s=t.getStyle("width");s.hasValue()?i=s.getPixels("x")/r:e[2]&&!isNaN(e[2])&&(i=e[2]/r)}if("number"==typeof s){const i=t.getStyle("height");i.hasValue()?n=i.getPixels("y")/s:e[3]&&!isNaN(e[3])&&(n=e[3]/s)}i||(i=n),n||(n=i),t.getAttribute("width",!0).setValue(r),t.getAttribute("height",!0).setValue(s);const a=t.getStyle("transform",!0,!0);a.setValue("".concat(a.getString()," scale(").concat(1/i,", ").concat(1/n,")"))}i||h.clearRect(0,0,d,p),t.render(h),l&&(this.isFirstRender=!1)}constructor(t,{fetch:e=Tt,window:i=wt}={}){if(this.ctx=t,this.viewPort=new mt,this.mouse=new vt(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=i,!e)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=e}}St.defaultWindow=wt,St.defaultFetch=Tt,St.FRAMERATE=30,St.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch:At}=St,Ct="undefined"!=typeof DOMParser?DOMParser:void 0;class Pt{async parse(t){return t.startsWith("<")?this.parseFromString(t):this.load(t)}parseFromString(t){const e=new this.DOMParser;try{return this.checkDocument(e.parseFromString(t,"image/svg+xml"))}catch(i){return this.checkDocument(e.parseFromString(t,"text/xml"))}}checkDocument(t){const e=t.getElementsByTagName("parsererror")[0];if(e)throw new Error(e.textContent||"Unknown parse error");return t}async load(t){const e=await this.fetch(t),i=await e.text();return this.parseFromString(i)}constructor({fetch:t=At,DOMParser:e=Ct}={}){if(!t)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");if(!e)throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");this.fetch=t,this.DOMParser=e}}class Et{apply(t){const{originX:e,originY:i,matrix:r}=this,s=e.getPixels("x"),n=i.getPixels("y");t.translate(s,n),t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),t.translate(-s,-n)}unapply(t){const{originX:e,originY:i,matrix:r}=this,s=r[0],n=r[2],a=r[4],o=r[1],h=r[3],l=r[5],c=1/(s*(1*h-0*l)-n*(1*o-0*l)+a*(0*o-0*h)),u=e.getPixels("x"),g=i.getPixels("y");t.translate(u,g),t.transform(c*(1*h-0*l),c*(0*l-1*o),c*(0*a-1*n),c*(1*s-0*a),c*(n*l-a*h),c*(a*o-s*l)),t.translate(-u,-g)}applyToPoint(t){t.applyTransform(this.matrix)}constructor(t,e,i){this.type="matrix",this.matrix=function(t){const e=G(t);return[e[0]||0,e[1]||0,e[2]||0,e[3]||0,e[4]||0,e[5]||0]}(e),this.originX=i[0],this.originY=i[1]}}class Ot extends Et{constructor(t,e,i){super(t,e,i),this.type="skew",this.angle=new yt(t,"angle",e)}}class Nt{static fromElement(t,e){const i=e.getStyle("transform",!1,!0);if(i.hasValue()){const[r,s=r]=e.getStyle("transform-origin",!1,!0).split();if(r&&s){const e=[r,s];return new Nt(t,i.getString(),e)}}return null}apply(t){this.transforms.forEach((e=>e.apply(t)))}unapply(t){this.transforms.forEach((e=>e.unapply(t)))}applyToPoint(t){this.transforms.forEach((e=>e.applyToPoint(t)))}constructor(t,e,i){this.document=t,this.transforms=[];Q(e).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/).forEach((t=>{if("none"===t)return;const[e,r]=function(t){const[e="",i=""]=t.split("(");return[e.trim(),i.trim().replace(")","")]}(t),s=Nt.transformTypes[e];s&&this.transforms.push(new s(this.document,r,i))}))}}Nt.transformTypes={translate:class{apply(t){const{x:e,y:i}=this.point;t.translate(e||0,i||0)}unapply(t){const{x:e,y:i}=this.point;t.translate(-1*e||0,-1*i||0)}applyToPoint(t){const{x:e,y:i}=this.point;t.applyTransform([1,0,0,1,e||0,i||0])}constructor(t,e){this.type="translate",this.point=bt.parse(e)}},rotate:class{apply(t){const{cx:e,cy:i,originX:r,originY:s,angle:n}=this,a=e+r.getPixels("x"),o=i+s.getPixels("y");t.translate(a,o),t.rotate(n.getRadians()),t.translate(-a,-o)}unapply(t){const{cx:e,cy:i,originX:r,originY:s,angle:n}=this,a=e+r.getPixels("x"),o=i+s.getPixels("y");t.translate(a,o),t.rotate(-1*n.getRadians()),t.translate(-a,-o)}applyToPoint(t){const{cx:e,cy:i,angle:r}=this,s=r.getRadians();t.applyTransform([1,0,0,1,e||0,i||0]),t.applyTransform([Math.cos(s),Math.sin(s),-Math.sin(s),Math.cos(s),0,0]),t.applyTransform([1,0,0,1,-e||0,-i||0])}constructor(t,e,i){this.type="rotate";const r=G(e);this.angle=new yt(t,"angle",r[0]),this.originX=i[0],this.originY=i[1],this.cx=r[1]||0,this.cy=r[2]||0}},scale:class{apply(t){const{scale:{x:e,y:i},originX:r,originY:s}=this,n=r.getPixels("x"),a=s.getPixels("y");t.translate(n,a),t.scale(e,i||e),t.translate(-n,-a)}unapply(t){const{scale:{x:e,y:i},originX:r,originY:s}=this,n=r.getPixels("x"),a=s.getPixels("y");t.translate(n,a),t.scale(1/e,1/i||e),t.translate(-n,-a)}applyToPoint(t){const{x:e,y:i}=this.scale;t.applyTransform([e||0,0,0,i||0,0,0])}constructor(t,e,i){this.type="scale";const r=bt.parseScale(e);0!==r.x&&0!==r.y||(r.x=nt,r.y=nt),this.scale=r,this.originX=i[0],this.originY=i[1]}},matrix:Et,skewX:class extends Ot{constructor(t,e,i){super(t,e,i),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}},skewY:class extends Ot{constructor(t,e,i){super(t,e,i),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}};class Mt{getAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.attributes[t];if(!i&&e){const e=new yt(this.document,t,"");return this.attributes[t]=e,e}return i||yt.empty(this.document)}getHrefAttribute(){let t;for(const e in this.attributes)if("href"===e||e.endsWith(":href")){t=this.attributes[e];break}return t||yt.empty(this.document)}getStyle(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=this.styles[t];if(r)return r;const s=this.getAttribute(t);if(s.hasValue())return this.styles[t]=s,s;if(!i){const{parent:e}=this;if(e){const i=e.getStyle(t);if(i.hasValue())return i}}if(e){const e=new yt(this.document,t,"");return this.styles[t]=e,e}return yt.empty(this.document)}render(t){if("none"!==this.getStyle("display").getString()&&"hidden"!==this.getStyle("visibility").getString()){if(t.save(),this.getStyle("mask").hasValue()){const e=this.getStyle("mask").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else if("none"!==this.getStyle("filter").getValue("none")){const e=this.getStyle("filter").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}}setContext(t){}applyEffects(t){const e=Nt.fromElement(this.document,this);e&&e.apply(t);const i=this.getStyle("clip-path",!1,!0);if(i.hasValue()){const e=i.getDefinition();e&&e.apply(t)}}clearContext(t){}renderChildren(t){this.children.forEach((e=>{e.render(t)}))}addChild(t){const e=t instanceof Mt?t:this.document.createElement(t);e.parent=this,Mt.ignoreChildTypes.includes(e.type)||this.children.push(e)}matchesSelector(t){var e;const{node:i}=this;if("function"==typeof i.matches)return i.matches(t);const r=null===(e=i.getAttribute)||void 0===e?void 0:e.call(i,"class");return!(!r||""===r)&&r.split(" ").some((e=>".".concat(e)===t))}addStylesFromStyleDefinition(){const{styles:t,stylesSpecificity:e}=this.document;let i;for(const r in t)if(!r.startsWith("@")&&this.matchesSelector(r)){const s=t[r],n=e[r];if(s)for(const t in s){let e=this.stylesSpecificity[t];void 0===e&&(e="000"),n&&n>=e&&(i=s[t],i&&(this.styles[t]=i),this.stylesSpecificity[t]=n)}}}removeStyles(t,e){return e.reduce(((e,i)=>{const r=t.getStyle(i);if(!r.hasValue())return e;const s=r.getStr