svg2pdf.js 42.5 KB
/**
 * Modules in this bundle
 * @license
 *
 * svg2pdf.js:
 *   license: MIT (http://opensource.org/licenses/MIT)
 *   author: yFiles for HTML Support Team <yfileshtml@yworks.com>
 *   homepage: https://github.com/yWorks/svg2pdf.js#readme
 *   version: 1.2.0
 *
 * svgpath:
 *   license: MIT (http://opensource.org/licenses/MIT)
 *   homepage: https://github.com/fontello/svgpath#readme
 *   version: 2.2.1
 *
 * This header is generated by licensify (https://github.com/twada/licensify)
 */
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.svg2pdf=t()}}(function(){var t;return function t(e,r,a){function i(s,o){if(!r[s]){if(!e[s]){var h="function"==typeof require&&require;if(!o&&h)return h(s,!0);if(n)return n(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[s]={exports:{}};e[s][0].call(u.exports,function(t){var r=e[s][1][t];return i(r||t)},u,u.exports,t,e,r,a)}return r[s].exports}for(var n="function"==typeof require&&require,s=0;s<a.length;s++)i(a[s]);return i}({1:[function(t,e,r){"use strict";e.exports=t("./lib/svgpath")},{"./lib/svgpath":6}],2:[function(t,e,r){"use strict";function a(t,e,r,a){var i=t*a-e*r<0?-1:1,n=Math.sqrt(t*t+e*e),s=Math.sqrt(t*t+e*e),o=t*r+e*a,h=o/(n*s);return h>1&&(h=1),h<-1&&(h=-1),i*Math.acos(h)}function i(t,e,r,i,n,o,h,c,u,f){var l=f*(t-r)/2+u*(e-i)/2,d=-u*(t-r)/2+f*(e-i)/2,g=h*h,p=c*c,x=l*l,b=d*d,m=g*p-g*b-p*x;m<0&&(m=0),m/=g*b+p*x,m=Math.sqrt(m)*(n===o?-1:1);var v=m*h/c*d,y=m*-c/h*l,k=f*v-u*y+(t+r)/2,M=u*v+f*y+(e+i)/2,w=(l-v)/h,A=(d-y)/c,S=(-l-v)/h,F=(-d-y)/c,C=a(1,0,w,A),I=a(w,A,S,F);return 0===o&&I>0&&(I-=s),1===o&&I<0&&(I+=s),[k,M,C,I]}function n(t,e){var r=4/3*Math.tan(e/4),a=Math.cos(t),i=Math.sin(t),n=Math.cos(t+e),s=Math.sin(t+e);return[a,i,a-i*r,i+a*r,n+s*r,s-n*r,n,s]}var s=2*Math.PI;e.exports=function(t,e,r,a,o,h,c,u,f){var l=Math.sin(f*s/360),d=Math.cos(f*s/360),g=d*(t-r)/2+l*(e-a)/2,p=-l*(t-r)/2+d*(e-a)/2;if(0===g&&0===p)return[];if(0===c||0===u)return[];c=Math.abs(c),u=Math.abs(u);var x=g*g/(c*c)+p*p/(u*u);x>1&&(c*=Math.sqrt(x),u*=Math.sqrt(x));var b=i(t,e,r,a,o,h,c,u,l,d),m=[],v=b[2],y=b[3],k=Math.max(Math.ceil(Math.abs(y)/(s/4)),1);y/=k;for(var M=0;M<k;M++)m.push(n(v,y)),v+=y;return m.map(function(t){for(var e=0;e<t.length;e+=2){var r=t[e+0],a=t[e+1];r*=c,a*=u;var i=d*r-l*a,n=l*r+d*a;t[e+0]=i+b[0],t[e+1]=n+b[1]}return t})}},{}],3:[function(t,e,r){"use strict";function a(t,e,r){if(!(this instanceof a))return new a(t,e,r);this.rx=t,this.ry=e,this.ax=r}var i=Math.PI/180;a.prototype.transform=function(t){var e=Math.cos(this.ax*i),r=Math.sin(this.ax*i),a=[this.rx*(t[0]*e+t[2]*r),this.rx*(t[1]*e+t[3]*r),this.ry*(-t[0]*r+t[2]*e),this.ry*(-t[1]*r+t[3]*e)],n=a[0]*a[0]+a[2]*a[2],s=a[1]*a[1]+a[3]*a[3],o=((a[0]-a[3])*(a[0]-a[3])+(a[2]+a[1])*(a[2]+a[1]))*((a[0]+a[3])*(a[0]+a[3])+(a[2]-a[1])*(a[2]-a[1])),h=(n+s)/2;if(o<1e-10*h)return this.rx=this.ry=Math.sqrt(h),this.ax=0,this;var c=a[0]*a[1]+a[2]*a[3];o=Math.sqrt(o);var u=h+o/2,f=h-o/2;return this.ax=Math.abs(c)<1e-10&&Math.abs(u-s)<1e-10?90:180*Math.atan(Math.abs(c)>Math.abs(u-s)?(u-n)/c:c/(u-s))/Math.PI,this.ax>=0?(this.rx=Math.sqrt(u),this.ry=Math.sqrt(f)):(this.ax+=90,this.rx=Math.sqrt(f),this.ry=Math.sqrt(u)),this},a.prototype.isDegenerate=function(){return this.rx<1e-10*this.ry||this.ry<1e-10*this.rx},e.exports=a},{}],4:[function(t,e,r){"use strict";function a(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}function i(){if(!(this instanceof i))return new i;this.queue=[],this.cache=null}i.prototype.matrix=function(t){return 1===t[0]&&0===t[1]&&0===t[2]&&1===t[3]&&0===t[4]&&0===t[5]?this:(this.cache=null,this.queue.push(t),this)},i.prototype.translate=function(t,e){return 0===t&&0===e||(this.cache=null,this.queue.push([1,0,0,1,t,e])),this},i.prototype.scale=function(t,e){return 1===t&&1===e||(this.cache=null,this.queue.push([t,0,0,e,0,0])),this},i.prototype.rotate=function(t,e,r){var a,i,n;return 0!==t&&(this.translate(e,r),a=t*Math.PI/180,i=Math.cos(a),n=Math.sin(a),this.queue.push([i,n,-n,i,0,0]),this.cache=null,this.translate(-e,-r)),this},i.prototype.skewX=function(t){return 0!==t&&(this.cache=null,this.queue.push([1,0,Math.tan(t*Math.PI/180),1,0,0])),this},i.prototype.skewY=function(t){return 0!==t&&(this.cache=null,this.queue.push([1,Math.tan(t*Math.PI/180),0,1,0,0])),this},i.prototype.toArray=function(){if(this.cache)return this.cache;if(!this.queue.length)return this.cache=[1,0,0,1,0,0],this.cache;if(this.cache=this.queue[0],1===this.queue.length)return this.cache;for(var t=1;t<this.queue.length;t++)this.cache=a(this.cache,this.queue[t]);return this.cache},i.prototype.calc=function(t,e,r){var a;return this.queue.length?(this.cache||(this.cache=this.toArray()),a=this.cache,[t*a[0]+e*a[2]+(r?0:a[4]),t*a[1]+e*a[3]+(r?0:a[5])]):[t,e]},e.exports=i},{}],5:[function(t,e,r){"use strict";function a(t){return 10===t||13===t||8232===t||8233===t||32===t||9===t||11===t||12===t||160===t||t>=5760&&d.indexOf(t)>=0}function i(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return!0}return!1}function n(t){return t>=48&&t<=57}function s(t){return t>=48&&t<=57||43===t||45===t||46===t}function o(t){this.index=0,this.path=t,this.max=t.length,this.result=[],this.param=0,this.err="",this.segmentStart=0,this.data=[]}function h(t){for(;t.index<t.max&&a(t.path.charCodeAt(t.index));)t.index++}function c(t){var e,r=t.index,a=r,i=t.max,s=!1,o=!1,h=!1,c=!1;if(a>=i)return void(t.err="SvgPath: missed param (at pos "+a+")");if(e=t.path.charCodeAt(a),43!==e&&45!==e||(a++,e=a<i?t.path.charCodeAt(a):0),!n(e)&&46!==e)return void(t.err="SvgPath: param should start with 0..9 or `.` (at pos "+a+")");if(46!==e){if(s=48===e,a++,e=a<i?t.path.charCodeAt(a):0,s&&a<i&&e&&n(e))return void(t.err="SvgPath: numbers started with `0` such as `09` are ilegal (at pos "+r+")");for(;a<i&&n(t.path.charCodeAt(a));)a++,o=!0;e=a<i?t.path.charCodeAt(a):0}if(46===e){for(c=!0,a++;n(t.path.charCodeAt(a));)a++,h=!0;e=a<i?t.path.charCodeAt(a):0}if(101===e||69===e){if(c&&!o&&!h)return void(t.err="SvgPath: invalid float exponent (at pos "+a+")");if(a++,e=a<i?t.path.charCodeAt(a):0,43!==e&&45!==e||a++,!(a<i&&n(t.path.charCodeAt(a))))return void(t.err="SvgPath: invalid float exponent (at pos "+a+")");for(;a<i&&n(t.path.charCodeAt(a));)a++}t.index=a,t.param=parseFloat(t.path.slice(r,a))+0}function u(t){var e,r;e=t.path[t.segmentStart],r=e.toLowerCase();var a=t.data;if("m"===r&&a.length>2&&(t.result.push([e,a[0],a[1]]),a=a.slice(2),r="l",e="m"===e?"l":"L"),"r"===r)t.result.push([e].concat(a));else for(;a.length>=l[r]&&(t.result.push([e].concat(a.splice(0,l[r]))),l[r]););}function f(t){var e,r,a,n,o=t.max;if(t.segmentStart=t.index,e=t.path.charCodeAt(t.index),!i(e))return void(t.err="SvgPath: bad command "+t.path[t.index]+" (at pos "+t.index+")");if(a=l[t.path[t.index].toLowerCase()],t.index++,h(t),t.data=[],!a)return void u(t);for(r=!1;;){for(n=a;n>0;n--){if(c(t),t.err.length)return;t.data.push(t.param),h(t),r=!1,t.index<o&&44===t.path.charCodeAt(t.index)&&(t.index++,h(t),r=!0)}if(!r){if(t.index>=t.max)break;if(!s(t.path.charCodeAt(t.index)))break}}u(t)}var l={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},d=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];e.exports=function(t){var e=new o(t),r=e.max;for(h(e);e.index<r&&!e.err.length;)f(e);return e.err.length?e.result=[]:e.result.length&&("mM".indexOf(e.result[0][0])<0?(e.err="SvgPath: string should start with `M` or `m`",e.result=[]):e.result[0][0]="M"),{err:e.err,segments:e.result}}},{}],6:[function(t,e,r){"use strict";function a(t){if(!(this instanceof a))return new a(t);var e=i(t);this.segments=e.segments,this.err=e.err,this.__stack=[]}var i=t("./path_parse"),n=t("./transform_parse"),s=t("./matrix"),o=t("./a2c"),h=t("./ellipse");a.prototype.__matrix=function(t){var e,r=this;t.queue.length&&this.iterate(function(a,i,n,s){var o,c,u,f;switch(a[0]){case"v":o=t.calc(0,a[1],!0),c=0===o[0]?["v",o[1]]:["l",o[0],o[1]];break;case"V":o=t.calc(n,a[1],!1),c=o[0]===t.calc(n,s,!1)[0]?["V",o[1]]:["L",o[0],o[1]];break;case"h":o=t.calc(a[1],0,!0),c=0===o[1]?["h",o[0]]:["l",o[0],o[1]];break;case"H":o=t.calc(a[1],s,!1),c=o[1]===t.calc(n,s,!1)[1]?["H",o[0]]:["L",o[0],o[1]];break;case"a":case"A":var l=t.toArray(),d=h(a[1],a[2],a[3]).transform(l);if(l[0]*l[3]-l[1]*l[2]<0&&(a[5]=a[5]?"0":"1"),o=t.calc(a[6],a[7],"a"===a[0]),"A"===a[0]&&a[6]===n&&a[7]===s||"a"===a[0]&&0===a[6]&&0===a[7]){c=["a"===a[0]?"l":"L",o[0],o[1]];break}c=d.isDegenerate()?["a"===a[0]?"l":"L",o[0],o[1]]:[a[0],d.rx,d.ry,d.ax,a[4],a[5],o[0],o[1]];break;case"m":f=i>0,o=t.calc(a[1],a[2],f),c=["m",o[0],o[1]];break;default:for(u=a[0],c=[u],f=u.toLowerCase()===u,e=1;e<a.length;e+=2)o=t.calc(a[e],a[e+1],f),c.push(o[0],o[1])}r.segments[i]=c},!0)},a.prototype.__evaluateStack=function(){var t,e;if(this.__stack.length){if(1===this.__stack.length)return this.__matrix(this.__stack[0]),void(this.__stack=[]);for(t=s(),e=this.__stack.length;--e>=0;)t.matrix(this.__stack[e].toArray());this.__matrix(t),this.__stack=[]}},a.prototype.toString=function(){var t,e,r=[];this.__evaluateStack();for(var a=0;a<this.segments.length;a++)e=this.segments[a][0],t=a>0&&"m"!==e&&"M"!==e&&e===this.segments[a-1][0],r=r.concat(t?this.segments[a].slice(1):this.segments[a]);return r.join(" ").replace(/ ?([achlmqrstvz]) ?/gi,"$1").replace(/ \-/g,"-").replace(/zm/g,"z m")},a.prototype.translate=function(t,e){return this.__stack.push(s().translate(t,e||0)),this},a.prototype.scale=function(t,e){return this.__stack.push(s().scale(t,e||0===e?e:t)),this},a.prototype.rotate=function(t,e,r){return this.__stack.push(s().rotate(t,e||0,r||0)),this},a.prototype.skewX=function(t){return this.__stack.push(s().skewX(t)),this},a.prototype.skewY=function(t){return this.__stack.push(s().skewY(t)),this},a.prototype.matrix=function(t){return this.__stack.push(s().matrix(t)),this},a.prototype.transform=function(t){return t.trim()?(this.__stack.push(n(t)),this):this},a.prototype.round=function(t){var e,r=0,a=0,i=0,n=0;return t=t||0,this.__evaluateStack(),this.segments.forEach(function(s){var o=s[0].toLowerCase()===s[0];switch(s[0]){case"H":case"h":return o&&(s[1]+=i),i=s[1]-s[1].toFixed(t),void(s[1]=+s[1].toFixed(t));case"V":case"v":return o&&(s[1]+=n),n=s[1]-s[1].toFixed(t),void(s[1]=+s[1].toFixed(t));case"Z":case"z":return i=r,void(n=a);case"M":case"m":return o&&(s[1]+=i,s[2]+=n),i=s[1]-s[1].toFixed(t),n=s[2]-s[2].toFixed(t),r=i,a=n,s[1]=+s[1].toFixed(t),void(s[2]=+s[2].toFixed(t));case"A":case"a":return o&&(s[6]+=i,s[7]+=n),i=s[6]-s[6].toFixed(t),n=s[7]-s[7].toFixed(t),s[1]=+s[1].toFixed(t),s[2]=+s[2].toFixed(t),s[3]=+s[3].toFixed(t+2),s[6]=+s[6].toFixed(t),void(s[7]=+s[7].toFixed(t));default:return e=s.length,o&&(s[e-2]+=i,s[e-1]+=n),i=s[e-2]-s[e-2].toFixed(t),n=s[e-1]-s[e-1].toFixed(t),void s.forEach(function(e,r){r&&(s[r]=+s[r].toFixed(t))})}}),this},a.prototype.iterate=function(t,e){var r,a,i,n=this.segments,s={},o=!1,h=0,c=0,u=0,f=0;if(e||this.__evaluateStack(),n.forEach(function(e,r){var a=t(e,r,h,c);Array.isArray(a)&&(s[r]=a,o=!0);var i=e[0]===e[0].toLowerCase();switch(e[0]){case"m":case"M":return h=e[1]+(i?h:0),c=e[2]+(i?c:0),u=h,void(f=c);case"h":case"H":return void(h=e[1]+(i?h:0));case"v":case"V":return void(c=e[1]+(i?c:0));case"z":case"Z":return h=u,void(c=f);default:h=e[e.length-2]+(i?h:0),c=e[e.length-1]+(i?c:0)}}),!o)return this;for(i=[],r=0;r<n.length;r++)if(void 0!==s[r])for(a=0;a<s[r].length;a++)i.push(s[r][a]);else i.push(n[r]);return this.segments=i,this},a.prototype.abs=function(){return this.iterate(function(t,e,r,a){var i,n=t[0],s=n.toUpperCase();if(n!==s)switch(t[0]=s,n){case"v":return void(t[1]+=a);case"a":return t[6]+=r,void(t[7]+=a);default:for(i=1;i<t.length;i++)t[i]+=i%2?r:a}},!0),this},a.prototype.rel=function(){return this.iterate(function(t,e,r,a){var i,n=t[0],s=n.toLowerCase();if(n!==s&&(0!==e||"M"!==n))switch(t[0]=s,n){case"V":return void(t[1]-=a);case"A":return t[6]-=r,void(t[7]-=a);default:for(i=1;i<t.length;i++)t[i]-=i%2?r:a}},!0),this},a.prototype.unarc=function(){return this.iterate(function(t,e,r,a){var i,n,s,h=[],c=t[0];return"A"!==c&&"a"!==c?null:("a"===c?(n=r+t[6],s=a+t[7]):(n=t[6],s=t[7]),i=o(r,a,n,s,t[4],t[5],t[1],t[2],t[3]),0===i.length?[["a"===t[0]?"l":"L",t[6],t[7]]]:(i.forEach(function(t){h.push(["C",t[2],t[3],t[4],t[5],t[6],t[7]])}),h))}),this},a.prototype.unshort=function(){var t,e,r,a,i,n=this.segments;return this.iterate(function(s,o,h,c){var u,f=s[0],l=f.toUpperCase();o&&("T"===l?(u="t"===f,r=n[o-1],"Q"===r[0]?(t=r[1]-h,e=r[2]-c):"q"===r[0]?(t=r[1]-r[3],e=r[2]-r[4]):(t=0,e=0),a=-t,i=-e,u||(a+=h,i+=c),n[o]=[u?"q":"Q",a,i,s[1],s[2]]):"S"===l&&(u="s"===f,r=n[o-1],"C"===r[0]?(t=r[3]-h,e=r[4]-c):"c"===r[0]?(t=r[3]-r[5],e=r[4]-r[6]):(t=0,e=0),a=-t,i=-e,u||(a+=h,i+=c),n[o]=[u?"c":"C",a,i,s[1],s[2],s[3],s[4]]))}),this},e.exports=a},{"./a2c":2,"./ellipse":3,"./matrix":4,"./path_parse":5,"./transform_parse":7}],7:[function(t,e,r){"use strict";var a=t("./matrix"),i={matrix:!0,scale:!0,rotate:!0,translate:!0,skewX:!0,skewY:!0},n=/\s*(matrix|translate|scale|rotate|skewX|skewY)\s*\(\s*(.+?)\s*\)[\s,]*/,s=/[\s,]+/;e.exports=function(t){var e,r,o=new a;return t.split(n).forEach(function(t){if(t.length){if(void 0!==i[t])return void(e=t);switch(r=t.split(s).map(function(t){return+t||0}),e){case"matrix":return void(6===r.length&&o.matrix(r));case"scale":return void(1===r.length?o.scale(r[0],r[0]):2===r.length&&o.scale(r[0],r[1]));case"rotate":return void(1===r.length?o.rotate(r[0],0,0):3===r.length&&o.rotate(r[0],r[1],r[2]));case"translate":return void(1===r.length?o.translate(r[0],0):2===r.length&&o.translate(r[0],r[1]));case"skewX":return void(1===r.length&&o.skewX(r[0]));case"skewY":return void(1===r.length&&o.skewY(r[0]))}}}),o}},{"./matrix":4}],8:[function(e,r,a){/**
 * A class to parse color values
 * @author Stoyan Stefanov <sstoo@gmail.com>
 * @link   http://www.phpied.com/rgb-color-parser-in-javascript/
 * @license Use it if you like it
 */
!function(e){function a(t){this.ok=!1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=t.replace(/ /g,""),t=t.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",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"};for(var r in e)t==r&&(t=e[r]);for(var i=[{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:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^(\w{1})(\w{1})(\w{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)]}}],n=0;n<i.length;n++){var s=i[n].re,o=i[n].process,h=s.exec(t);if(h){var c=o(h);this.r=c[0],this.g=c[1],this.b=c[2],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.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),r=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==r.length&&(r="0"+r),"#"+t+e+r},this.getHelpXML=function(){for(var t=new Array,r=0;r<i.length;r++)for(var n=i[r].example,s=0;s<n.length;s++)t[t.length]=n[s];for(var o in e)t[t.length]=o;var h=document.createElement("ul");h.setAttribute("id","rgbcolor-examples");for(var r=0;r<t.length;r++)try{var c=document.createElement("li"),u=new a(t[r]),f=document.createElement("div");f.style.cssText="margin: 3px; border: 1px solid black; background:"+u.toHex()+"; color:"+u.toHex(),f.appendChild(document.createTextNode("test"));var l=document.createTextNode(" "+t[r]+" -> "+u.toRGB()+" -> "+u.toHex());c.appendChild(f),c.appendChild(l),h.appendChild(c)}catch(t){}return h}}"function"==typeof t&&t.amd?t(function(){return a}):void 0!==r&&r.exports?r.exports=a:e.RGBColor=a}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this)},{}],9:[function(e,r,a){!function(a){function i(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]}function n(t,e){return i([e[0]-t[0],e[1]-t[1]])}function s(t,e){return[t[0]+e[0],t[1]+e[1]]}function o(){this.markers=[]}function h(t,e,r){this.id=t,this.anchor=e,this.angle=r}function c(t,e,r,a,i,n){var s,o,h=e[0],c=e[1],u=e[2],f=e[3],l=i/u,d=n/f,g=t.getAttribute("preserveAspectRatio");if(g){var p=g.split(" ");s=p[0],o=p[1]||"meet"}else s="xMidYMid",o="meet";"none"!==s&&("meet"===o?l=d=Math.min(l,d):"slice"===o&&(l=d=Math.max(l,d)));var x=r-h*l,b=a-c*d;s.indexOf("xMid")>=0?x+=(i-u*l)/2:s.indexOf("xMax")>=0&&(x+=i-u*l),s.indexOf("yMid")>=0?b+=(n-f*d)/2:s.indexOf("yMax")>=0&&(b+=n-f*d);var v=new m.Matrix(1,0,0,1,x,b),y=new m.Matrix(l,0,0,d,0,0);return m.matrixMult(y,v)}function u(t,e){if(0===t.length)return 0;var r=e.fontFamily;return R(r)(t,e.fontFamily,e.fontSize+"px",e.fontStyle,e.fontWeight)}function f(t,e){var r=e.textAnchor;if("start"===r)return 0;var a=u(t,e),i=0;switch(r){case"end":i=a;break;case"middle":i=a/2}return i}function l(t,e,r){this.texts=[],this.tSpans=[],this.textAnchor=t,this.originX=e,this.originY=r}function d(t,e){var r;return(r=t&&t.toString().match(/^([\-0-9.]+)em$/))?parseFloat(r[1])*e:(r=t&&t.toString().match(/^([\-0-9.]+)(px|)$/),r?parseFloat(r[1]):0)}function g(t,e,r){var a=M(t,"font-family");a&&(r.fontFamily=a),e&&e.ok&&(r.fill=e);var i=M(t,"font-weight");i&&(r.fontWeight=i);var n=M(t,"font-style");n&&(r.fontStyle=n);var s=M(t,"font-size");s&&(r.fontSize=parseFloat(s));var o=M(t,"text-anchor");o&&(r.textAnchor=o)}function p(t,e){if(t.fontFamily!==e.fontFamily&&m.setFont(t.fontFamily),t.fill!==e.fill&&t.fill.ok){var r=t.fill;m.setTextColor(r.r,r.g,r.b)}var a="";t.fontWeight!==e.fontWeight&&"bold"===t.fontWeight&&(a="bold"),t.fontStyle!==e.fontStyle&&"italic"===t.fontStyle&&(a+="italic"),""!==a&&m.setFontType(a),t.fontSize!==e.fontSize&&m.setFontSize(t.fontSize)}var x,b,m,v=/url\(["']?#([^"']+)["']?\)/,y="http://www.w3.org/2000/svg",k=function(t){var e=t.getAttribute("d");b&&(e=b(e).unshort().unarc().abs().toString(),t.setAttribute("d",e));var r=t.pathSegList;if(r)return r;r=[];for(var a,i=/([a-df-zA-DF-Z])([^a-df-zA-DF-Z]*)/g;a=i.exec(e);){var n=E(a[2]),s=a[1],o="zZ".indexOf(s)>=0?0:"hHvV".indexOf(s)>=0?1:"mMlLtT".indexOf(s)>=0?2:"sSqQ".indexOf(s)>=0?4:"aA".indexOf(s)>=0?7:"cC".indexOf(s)>=0?6:-1,h=0;do{var c={pathSegTypeAsLetter:s};switch(s){case"h":case"H":c.x=n[h];break;case"v":case"V":c.y=n[h];break;case"c":case"C":c.x1=n[h+o-6],c.y1=n[h+o-5];case"s":case"S":c.x2=n[h+o-4],c.y2=n[h+o-3];case"t":case"T":case"l":case"L":case"m":case"M":c.x=n[h+o-2],c.y=n[h+o-1];break;case"q":case"Q":c.x1=n[h],c.y1=n[h+1],c.x=n[h+2],c.y=n[h+3];break;case"a":case"A":throw new Error("Cannot convert Arcs without SvgPath package")}r.push(c),"m"===s?s="l":"M"===s&&(s="L"),h+=o}while(h<n.length)}return r.getItem=function(t){return this[t]},r.numberOfItems=r.length,r},M=function(t,e,r){return r=r||e,t.getAttribute(e)||t.style[r]},w=function(t,e){return e.split(",").indexOf(t.tagName.toLowerCase())>=0},A=function(t,e){for(var r=[],a=0;a<t.childNodes.length;a++){var i=t.childNodes[a];"#"!==i.nodeName.charAt(0)&&r.push(i)}for(a=0;a<r.length;a++)e(a,r[a])},S=function(t,e){return Math.atan2(e[1]-t[1],e[0]-t[0])},F=function(t,e){var r=e[0]-t[0],a=e[1]-t[1];return[t[0]+2*r,t[1]+2*a]},C=function(t,e){return[2/3*(e[0]-t[0])+t[0],2/3*(e[1]-t[1])+t[1]]},I=function(t,e,r,a,i){var n=r.getItem(t-1);return t>0&&("C"===n.pathSegTypeAsLetter||"S"===n.pathSegTypeAsLetter)?F([n.x2,n.y2],e):t>0&&("c"===n.pathSegTypeAsLetter||"s"===n.pathSegTypeAsLetter)?F([n.x2+a,n.y2+i],e):[e[0],e[1]]},_=function(t){this.prefix=t,this.id=0,this.nextChild=function(){return new _("_"+this.id+++"_"+this.get())},this.get=function(){return this.prefix}},L=function(){this.fillMode=null,this.strokeMode=null,this.color=null,this.fill=null,this.fillOpacity=1,this.fontFamily=null,this.fontSize=16,this.fontStyle=null,this.fontWeight=null,this.opacity=1,this.stroke=null,this.strokeDasharray=null,this.strokeDashoffset=null,this.strokeLinecap=null,this.strokeLinejoin=null,this.strokeMiterlimit=4,this.strokeOpacity=1,this.strokeWidth=1,this.textAnchor=null,this.visibility=null};L.default=function(){var t=new L;return t.fillMode="F",t.strokeMode="",t.color=new x("rgb(0, 0, 0)"),t.fill=new x("rgb(0, 0, 0)"),t.fillOpacity=1,t.fontFamily="times",t.fontSize=16,t.fontStyle="normal",t.fontWeight="normal",t.opacity=1,t.stroke=null,t.strokeDasharray=null,t.strokeDashoffset=null,t.strokeLinecap="butt",t.strokeLinejoin="miter",t.strokeMiterlimit=4,t.strokeOpacity=1,t.strokeWidth=1,t.textAnchor="start",t.visibility="visible",t},L.prototype.clone=function(){var t=new L;return t.fillMode=this.fillMode,t.strokeMode=this.strokeMode,t.color=this.color,t.fill=this.fill,t.fillOpacity=this.fillOpacity,t.fontFamily=this.fontFamily,t.fontSize=this.fontSize,t.fontStyle=this.fontStyle,t.fontWeight=this.fontWeight,t.opacity=this.opacity,t.stroke=this.stroke,t.strokeDasharray=this.strokeDasharray,t.strokeDashoffset=this.strokeDashoffset,t.strokeLinecap=this.strokeLinecap,t.strokeLinejoin=this.strokeLinejoin,t.strokeMiterlimit=this.strokeMiterlimit,t.strokeOpacity=this.strokeOpacity,t.strokeWidth=this.strokeWidth,t.textAnchor=this.textAnchor,t.visibility=this.visibility,t},o.prototype.addMarker=function(t){this.markers.push(t)},o.prototype.draw=function(t,e){for(var r=0;r<this.markers.length;r++){var a,i=this.markers[r],n=i.angle,s=i.anchor,o=Math.cos(n),h=Math.sin(n);a=new m.Matrix(o,h,-h,o,s[0],s[1]),a=m.matrixMult(new m.Matrix(e.strokeWidth,0,0,e.strokeWidth,0,0),a),a=m.matrixMult(a,t),m.saveGraphicsState(),m.setLineWidth(1),m.doFormObject(i.id,a),m.restoreGraphicsState()}};var O=function(t,e){for(var r=/_\d+_/;!e[t]&&r.exec(t);)t=t.replace(r,"");return e[t]},T=function(t){return t.replace(/[\n\s\r]+/," ").trim()},q=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e},N=function(t){var e,r,a,i=m.unitMatrix;if(w(t,"svg,g"))if(r=parseFloat(t.getAttribute("x"))||0,a=parseFloat(t.getAttribute("y"))||0,e=t.getAttribute("viewBox")){var n=parseFloat(t.getAttribute("width")),s=parseFloat(t.getAttribute("height"));i=c(t,E(e),r,a,n,s)}else i=new m.Matrix(1,0,0,1,r,a);else if(w(t,"marker"))if(r=parseFloat(t.getAttribute("refX"))||0,a=parseFloat(t.getAttribute("refY"))||0,e=t.getAttribute("viewBox")){var o=E(e);o[0]=o[1]=0,i=c(t,o,0,0,t.getAttribute("markerWidth"),t.getAttribute("markerHeight")),i=m.matrixMult(new m.Matrix(1,0,0,1,-r,-a),i)}else i=new m.Matrix(1,0,0,1,-r,-a);var h=t.getAttribute("transform");return h?m.matrixMult(i,z(h)):i},P=function(t){for(var e=E(t),r=[],a=0;a<e.length-1;a+=2){var i=e[a],n=e[a+1];r.push([i,n])}return r},z=function(t){if(!t)return m.unitMatrix;for(var e,r=/^\s*matrix\(([^\)]+)\)\s*/,a=/^\s*translate\(([^\)]+)\)\s*/,i=/^\s*rotate\(([^\)]+)\)\s*/,n=/^\s*scale\(([^\)]+)\)\s*/,s=/^\s*skewX\(([^\)]+)\)\s*/,o=/^\s*skewY\(([^\)]+)\)\s*/,h=m.unitMatrix;t.length>0;){var c=r.exec(t);if(c&&(e=E(c[1]),h=m.matrixMult(new m.Matrix(e[0],e[1],e[2],e[3],e[4],e[5]),h),t=t.substr(c[0].length)),c=i.exec(t)){e=E(c[1]);var u=Math.PI*e[0]/180;if(h=m.matrixMult(new m.Matrix(Math.cos(u),Math.sin(u),-Math.sin(u),Math.cos(u),0,0),h),e[1]&&e[2]){var f=new m.Matrix(1,0,0,1,e[1],e[2]),l=new m.Matrix(1,0,0,1,-e[1],-e[2]);h=m.matrixMult(l,m.matrixMult(h,f))}t=t.substr(c[0].length)}c=a.exec(t),c&&(e=E(c[1]),h=m.matrixMult(new m.Matrix(1,0,0,1,e[0],e[1]||0),h),t=t.substr(c[0].length)),c=n.exec(t),c&&(e=E(c[1]),e[1]||(e[1]=e[0]),h=m.matrixMult(new m.Matrix(e[0],0,0,e[1],0,0),h),t=t.substr(c[0].length)),c=s.exec(t),c&&(e=parseFloat(c[1]),h=m.matrixMult(new m.Matrix(1,0,Math.tan(e),1,0,0),h),t=t.substr(c[0].length)),c=o.exec(t),c&&(e=parseFloat(c[1]),h=m.matrixMult(new m.Matrix(1,Math.tan(e),0,1,0,0),h),t=t.substr(c[0].length))}return h},E=function(t){for(var e,r=[],a=/[+-]?(?:(?:\d+\.?\d*)|(?:\d*\.?\d+))(?:[eE][+-]?\d+)?/g;e=a.exec(t);)r.push(parseFloat(e[0]));return r},j=function(t){var e=/\s*rgba\(((?:[^,\)]*,){3}[^,\)]*)\)\s*/.exec(t);if(e){var r=E(e[1]),a=new x("rgb("+r.slice(0,3).join(",")+")");return a.a=r[3],a}return new x(t)},D=function(t,e){var r=t[0],a=t[1];return[e.a*r+e.c*a+e.e,e.b*r+e.d*a+e.f]},G=function(t){if("none"===M(t,"display"))return[0,0,0,0];var e,r,a,i,n,s,o,h,c=parseFloat;if(w(t,"polygon")){var u=P(t.getAttribute("points"));for(r=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY,e=0;e<u.length;e++){var f=u[e];r=Math.min(r,f[0]),i=Math.max(i,f[0]),a=Math.min(a,f[1]),n=Math.max(n,f[1])}h=[r,a,i-r,n-a]}else if(w(t,"path")){var l=k(t);r=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;var d,g,p,x,b,m,v,y=0,S=0;for(e=0;e<l.numberOfItems;e++){var F=l.getItem(e),_=F.pathSegTypeAsLetter;switch(_){case"H":p=F.x,x=S;break;case"h":p=F.x+y,x=S;break;case"V":p=y,x=F.y;break;case"v":p=y,x=F.y+S;break;case"C":b=[F.x1,F.y1],m=[F.x2,F.y2],v=[F.x,F.y];break;case"c":b=[F.x1+y,F.y1+S],m=[F.x2+y,F.y2+S],v=[F.x+y,F.y+S];break;case"S":b=I(e,[y,S],l,d,g),m=[F.x2,F.y2],v=[F.x,F.y];break;case"s":b=I(e,[y,S],l,d,g),m=[F.x2+y,F.y2+S],v=[F.x+y,F.y+S];break;case"Q":c=[F.x1,F.y1],b=C([y,S],c),m=C([F.x,F.y],c),v=[F.x,F.y];break;case"q":c=[F.x1+y,F.y1+S],b=C([y,S],c),m=C([y+F.x,S+F.y],c),v=[F.x+y,F.y+S];break;case"T":b=I(e,[y,S],l,d,g),b=C([y,S],c),m=C([F.x,F.y],c),v=[F.x,F.y];break;case"t":c=I(e,[y,S],l,d,g),b=C([y,S],c),m=C([y+F.x,S+F.y],c),v=[F.x+y,F.y+S]}"sScCqQtT".indexOf(_)>=0&&(d=y,g=S),"MLCSQT".indexOf(_)>=0?(y=F.x,S=F.y):"mlcsqt".indexOf(_)>=0?(y=F.x+y,S=F.y+S):"zZ".indexOf(_)<0&&(y=p,S=x),"CSQTcsqt".indexOf(_)>=0?(r=Math.min(r,y,b[0],m[0],v[0]),i=Math.max(i,y,b[0],m[0],v[0]),a=Math.min(a,S,b[1],m[1],v[1]),n=Math.max(n,S,b[1],m[1],v[1])):(r=Math.min(r,y),i=Math.max(i,y),a=Math.min(a,S),n=Math.max(n,S))}h=[r,a,i-r,n-a]}else{if(w(t,"svg"))return s=t.getAttribute("viewBox"),s&&(o=E(s)),[c(t.getAttribute("x"))||o&&o[0]||0,c(t.getAttribute("y"))||o&&o[1]||0,c(t.getAttribute("width"))||o&&o[2]||0,c(t.getAttribute("height"))||o&&o[3]||0];if(w(t,"g"))h=[0,0,0,0],A(t,function(t,e){var r=G(e);h=[Math.min(h[0],r[0]),Math.min(h[1],r[1]),Math.max(h[0]+h[2],r[0]+r[2])-Math.min(h[0],r[0]),Math.max(h[1]+h[3],r[1]+r[3])-Math.min(h[1],r[1])]});else{if(w(t,"marker"))return s=t.getAttribute("viewBox"),s&&(o=E(s)),[o&&o[0]||0,o&&o[1]||0,o&&o[2]||c(t.getAttribute("marker-width"))||0,o&&o[3]||c(t.getAttribute("marker-height"))||0];if(w(t,"pattern"))return[c(t.getAttribute("x"))||0,c(t.getAttribute("y"))||0,c(t.getAttribute("width"))||0,c(t.getAttribute("height"))||0];var L=c(t.getAttribute("x1"))||c(t.getAttribute("x"))||c(t.getAttribute("cx")-c(t.getAttribute("r")))||0,O=c(t.getAttribute("x2"))||L+c(t.getAttribute("width"))||c(t.getAttribute("cx"))+c(t.getAttribute("r"))||0,T=c(t.getAttribute("y1"))||c(t.getAttribute("y"))||c(t.getAttribute("cy"))-c(t.getAttribute("r"))||0,q=c(t.getAttribute("y2"))||T+c(t.getAttribute("height"))||c(t.getAttribute("cy"))+c(t.getAttribute("r"))||0;h=[Math.min(L,O),Math.min(T,q),Math.max(L,O)-Math.min(L,O),Math.max(T,q)-Math.min(T,q)]}}if(!w(t,"marker,svg,g")){var N=M(t,"stroke-width")||1;return M(t,"stroke-miterlimit")&&(N*=.5/Math.sin(Math.PI/12)),[h[0]-N,h[1]-N,h[2]+2*N,h[3]+2*N]}return h},W=function(t,e,r,a,i,c,u){var f,l,d=P(t.getAttribute("points")),g=[{op:"m",c:D(d[0],e)}];for(f=1;f<d.length;f++){var p=d[f],x=D(p,e);g.push({op:"l",c:x})}g.push({op:"h"}),m.path(g,r,a,i);var b=t.getAttribute("marker-end"),y=t.getAttribute("marker-start"),k=t.getAttribute("marker-mid");if(y||k||b){var M=g.length,w=new o;if(y&&(y=c.get()+v.exec(y)[1],l=s(n(g[0].c,g[1].c),n(g[M-2].c,g[0].c)),w.addMarker(new h(y,g[0].c,Math.atan2(l[1],l[0])))),k){k=c.get()+v.exec(k)[1];var A,S=n(g[0].c,g[1].c);for(f=1;f<g.length-2;f++)A=n(g[f].c,g[f+1].c),l=s(S,A),w.addMarker(new h(k,g[f].c,Math.atan2(l[1],l[0]))),S=A;A=n(g[M-2].c,g[0].c),l=s(S,A),w.addMarker(new h(k,g[M-2].c,Math.atan2(l[1],l[0])))}b&&(b=c.get()+v.exec(b)[1],l=s(n(g[0].c,g[1].c),n(g[M-2].c,g[0].c)),w.addMarker(new h(b,g[0].c,Math.atan2(l[1],l[0])))),w.draw(m.unitMatrix,u)}},Y=function(t,e){var r=t.getAttribute("xlink:href")||t.getAttribute("href");if(0===r.indexOf("data:image/svg+xml;base64,")){var a=atob(r.substr("data:image/svg+xml;base64,".length)),i=new DOMParser,n=i.parseFromString(a,"image/svg+xml").firstElementChild;return void at(n,m.unitMatrix,{},e,!1,L.default())}var s=parseFloat(t.getAttribute("width")),o=parseFloat(t.getAttribute("height")),h=parseFloat(t.getAttribute("x")||0),c=parseFloat(t.getAttribute("y")||0);try{m.addImage(r,"jpeg",h,c,s,o)}catch(t){"object"==typeof console&&console.warn&&console.warn('svg2pdfjs: Images with external resource link are not supported! ("'+r+'")')}},V=function(t,e,r,a,c,u,f){var l=k(t),d=t.getAttribute("marker-end"),g=t.getAttribute("marker-start"),p=t.getAttribute("marker-mid");d&&(d=r.get()+v.exec(d)[1]),g&&(g=r.get()+v.exec(g)[1]),p&&(p=r.get()+v.exec(p)[1]);var x=function(t,e){for(var r,a,c,u,f,x,b,m,v,y,k=0,M=0,w=k,A=M,F=[],_=new o,L=[0,0],O=0;O<l.numberOfItems;O++){var T=l.getItem(O),q=T.pathSegTypeAsLetter;switch(q){case"M":w=k,A=M,f=[T.x,T.y],v="m";break;case"m":w=k,A=M,f=[T.x+k,T.y+M],v="m";break;case"L":f=[T.x,T.y],v="l";break;case"l":f=[T.x+k,T.y+M],v="l";break;case"H":f=[T.x,M],v="l",c=T.x,u=M;break;case"h":f=[T.x+k,M],v="l",c=T.x+k,u=M;break;case"V":f=[k,T.y],v="l",c=k,u=T.y;break;case"v":f=[k,T.y+M],v="l",c=k,u=T.y+M;break;case"C":b=[T.x1,T.y1],m=[T.x2,T.y2],f=[T.x,T.y];break;case"c":b=[T.x1+k,T.y1+M],m=[T.x2+k,T.y2+M],f=[T.x+k,T.y+M];break;case"S":b=I(O,[k,M],l,r,a),m=[T.x2,T.y2],f=[T.x,T.y];break;case"s":b=I(O,[k,M],l,r,a),m=[T.x2+k,T.y2+M],f=[T.x+k,T.y+M];break;case"Q":x=[T.x1,T.y1],b=C([k,M],x),m=C([T.x,T.y],x),f=[T.x,T.y];break;case"q":x=[T.x1+k,T.y1+M],b=C([k,M],x),m=C([k+T.x,M+T.y],x),f=[T.x+k,T.y+M];break;case"T":b=I(O,[k,M],l,r,a),b=C([k,M],x),m=C([T.x,T.y],x),f=[T.x,T.y];break;case"t":x=I(O,[k,M],l,r,a),b=C([k,M],x),m=C([k+T.x,M+T.y],x),f=[T.x+k,T.y+M];break;case"Z":case"z":k=w,M=A,F.push({op:"h"})}var N=g&&(1===O||"mM".indexOf(q)<0&&"mM".indexOf(l.getItem(O-1).pathSegTypeAsLetter)>=0),P=d&&(O===l.numberOfItems-1||"mM".indexOf(q)<0&&"mM".indexOf(l.getItem(O+1).pathSegTypeAsLetter)>=0),z=p&&O>0&&!(1===O&&"mM".indexOf(l.getItem(O-1).pathSegTypeAsLetter)>=0);if("sScCqQtT".indexOf(q)>=0)N&&_.addMarker(new h(g,[k,M],S([k,M],b))),P&&_.addMarker(new h(d,f,S(m,f))),z&&(y=n([k,M],b),y="mM".indexOf(l.getItem(O-1).pathSegTypeAsLetter)>=0?y:i(s(L,y)),_.addMarker(new h(p,[k,M],Math.atan2(y[1],y[0])))),L=n(m,f),r=k,a=M,b=D(b,e),m=D(m,e),x=D(f,e),F.push({op:"c",c:[b[0],b[1],m[0],m[1],x[0],x[1]]});else if("lLhHvVmM".indexOf(q)>=0){if(y=n([k,M],f),N&&_.addMarker(new h(g,[k,M],Math.atan2(y[1],y[0]))),P&&_.addMarker(new h(d,f,Math.atan2(y[1],y[0]))),z){var E="mM".indexOf(q)>=0?L:"mM".indexOf(l.getItem(O-1).pathSegTypeAsLetter)>=0?y:i(s(L,y));_.addMarker(new h(p,[k,M],Math.atan2(E[1],E[0])))}L=y,x=D(f,e),F.push({op:v,c:x})}"MLCSQT".indexOf(q)>=0?(k=T.x,M=T.y):"mlcsqt".indexOf(q)>=0?(k=T.x+k,M=T.y+M):"zZ".indexOf(q)<0&&(k=c,M=u)}return{lines:F,markers:_}}(0,e);x.lines.length>0&&m.path(x.lines,a,c,u),(d||g||p)&&x.markers.draw(e,f)},H=function(t,e,r){var a=t.getAttribute("href")||t.getAttribute("xlink:href");if(a){var i=m.getFormObject(r.get()+a.substring(1)),n=t.getAttribute("x")||0,s=t.getAttribute("y")||0,o=t.getAttribute("width")||i.width,h=t.getAttribute("height")||i.height,c=new m.Matrix(o/i.width||0,0,0,h/i.height||0,n,s);c=m.matrixMult(c,e),m.doFormObject(r.get()+a.substring(1),c)}},B=function(t,e,r,a){var i=D([parseFloat(t.getAttribute("x1")||0),parseFloat(t.getAttribute("y1")||0)],e),n=D([parseFloat(t.getAttribute("x2")||0),parseFloat(t.getAttribute("y2")||0)],e);"D"===a.strokeMode&&m.line(i[0],i[1],n[0],n[1]);var s=t.getAttribute("marker-start"),c=t.getAttribute("marker-end");if(s||c){var u=new o,f=S(i,n);s&&u.addMarker(new h(r.get()+v.exec(s)[1],i,f)),c&&u.addMarker(new h(r.get()+v.exec(c)[1],n,f)),u.draw(m.unitMatrix,a)}},X=function(t,e,r,a){m.roundedRect(parseFloat(t.getAttribute("x"))||0,parseFloat(t.getAttribute("y"))||0,parseFloat(t.getAttribute("width")),parseFloat(t.getAttribute("height")),parseFloat(t.getAttribute("rx"))||0,parseFloat(t.getAttribute("ry"))||0,e,r,a)},Q=function(t,e,r,a){m.ellipse(parseFloat(t.getAttribute("cx"))||0,parseFloat(t.getAttribute("cy"))||0,parseFloat(t.getAttribute("rx")),parseFloat(t.getAttribute("ry")),e,r,a)},U=function(t,e,r,a){var i=parseFloat(t.getAttribute("r"))||0;m.ellipse(parseFloat(t.getAttribute("cx"))||0,parseFloat(t.getAttribute("cy"))||0,i,i,e,r,a)},Z=function(t,e){switch(M(t,"text-transform")){case"uppercase":return e.toUpperCase();case"lowercase":return e.toLowerCase();default:return e}},R=function(){function t(t,e,r,a,i){var n=document.createElement("canvas"),s=n.getContext("2d");return s.font=[a,i,r,e].join(" "),s.measureText(t).width}function e(t,e,r,a,i){var n=document.createElementNS(y,"text");n.setAttribute("font-family",e),n.setAttribute("font-size",r),n.setAttribute("font-style",a),n.setAttribute("font-weight",i),n.appendChild(document.createTextNode(t));var s=document.createElementNS(y,"svg");s.appendChild(n),s.setAttribute("visibility","hidden"),document.body.appendChild(s);var o=n.getBBox().width;return document.body.removeChild(s),o}var r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789!\"$%&/()=?'\\+*-_.:,;^}][{#~|<>",a={};return function(i){var n=a[i];if(!n){var s=t(r,i,"16px","normal","normal"),o=e(r,i,"16px","normal","normal");n=Math.abs(s-o)<.1?t:e,a[i]=n}return n}}();l.prototype.add=function(t,e){this.texts.push(e),this.tSpans.push(t)},l.prototype.put=function(t,e){var r,a,i=[],n=[],s=[],o=this.originX,h=this.originY,c=o,f=o;for(r=0;r<this.tSpans.length;r++){a=this.tSpans[r];var l=s[r]=e.clone(),b=M(a,"fill");g(a,b&&new x(b),l);var v=o,y=h,k=a.getAttribute("dx");null!==k&&(v+=d(k,l.fontSize));var w=a.getAttribute("dy");null!==w&&(y+=d(w,l.fontSize)),i[r]=v,n[r]=y,o=v+u(this.texts[r],l)+u(".",l),h=y,c=Math.min(c,v),f=Math.max(f,o)}var A;switch(this.textAnchor){case"start":A=0;break;case"middle":A=(f-c)/2;break;case"end":A=f-c}for(r=0;r<this.tSpans.length;r++){a=this.tSpans[r];"hidden"!==(M(a,"visibility")||e.visibility)&&(m.saveGraphicsState(),p(s[r],e),m.text(i[r]-A,n[r],this.texts[r],void 0,t),m.restoreGraphicsState())}return[o,h]};var $=function(t,e,r,a,i){m.saveGraphicsState();var n,s,o=0,h=m.getFontSize(),c=d(t.getAttribute("x"),h),u=d(t.getAttribute("y"),h);n=d(t.getAttribute("dx"),h),s=d(t.getAttribute("dy"),h);var g=i.visibility;if(0===t.childElementCount){var p=Z(t,T(t.textContent));o=f(p,i),"visible"===g&&m.text(c+n-o,u+s,p,void 0,e)}else{var x=new l(i.textAnchor,c+n,u+s);A(t,function(r,a){if(a.textContent&&!w(a,"title,desc,metadata")){var n,s=a.getAttribute("x");if(null!==s){var o=d(s,h);n=x.put(e,i),x=new l(a.getAttribute("text-anchor")||i.textAnchor,o,n[1])}var c=a.getAttribute("y");if(null!==c){var u=d(c,h);n=x.put(e,i),x=new l(a.getAttribute("text-anchor")||i.textAnchor,n[0],u)}p=Z(t,T(a.textContent)),x.add(a,p)}}),x.put(e,i)}m.restoreGraphicsState()},J=function(t,e,r,a,i,n){A(t,function(t,s){"defs"===s.tagName.toLowerCase()&&(at(s,e,r,a,i,n),s.parentNode.removeChild(s))})},K=function(t,e,r,a,i,n){var s=a.nextChild(),o=q(r);J(t,e,o,s,i,n),tt(t,e,o,s,i,n)},tt=function(t,e,r,a,i,n){A(t,function(t,s){at(s,e,r,a,i,n)})},et=function(t,e,r,a,i){var n,s=[],o=0,h=!1;A(t,function(t,e){if("stop"===e.tagName.toLowerCase()){var r=new x(M(e,"stop-color"));s.push({offset:parseFloat(e.getAttribute("offset")),color:[r.r,r.g,r.b]});var a=M(e,"stop-opacity");a&&1!=a&&(o+=parseFloat(a),h=!0)}}),h&&(n=new m.GState({opacity:o/s.length}));var c=new m.ShadingPattern(e,r,s,n),u=i.get()+t.getAttribute("id");m.addShadingPattern(u,c),a[u]=t},rt=function(t,e,r,a){var i=r.get()+t.getAttribute("id");e[i]=t;var n=G(t),s=new m.TilingPattern([n[0],n[1],n[0]+n[2],n[1]+n[3]],n[2],n[3],null,N(t));m.beginTilingPattern(s),tt(t,m.unitMatrix,e,r,!1,a),m.endTilingPattern(i,s)},at=function(t,e,r,a,i,n){var s=n;if(n=n.clone(),"none"!==M(t,"display")){if("hidden"!==(n.visibility=M(t,"visibility")||n.visibility)||w(t,"svg,g,marker,a,pattern,defs,text")){var o,h,c=!1,u=null,f="inherit",l="inherit",d=null,b=null,y=i&&!w(t,"lineargradient,radialgradient,pattern");if(y?(o=N(t),h=G(t),m.beginFormObject(h[0],h[1],h[2],h[3],o),o=m.unitMatrix,i=!1):(o=m.matrixMult(N(t),e),m.saveGraphicsState()),w(t,"g,path,rect,text,ellipse,line,circle,polygon")){var k=M(t,"fill");if(k){var A=v.exec(k);if(A){d=a.get()+A[1];var S=O(d,r);if(S&&w(S,"lineargradient,radialgradient")){var F=o;if(!S.hasAttribute("gradientUnits")||"objectboundingbox"===S.getAttribute("gradientUnits").toLowerCase()){h||(h=G(t)),F=new m.Matrix(h[2],0,0,h[3],h[0],h[1]);var C=N(t);F=m.matrixMult(F,C)}var I=z(S.getAttribute("gradientTransform"));b=m.matrixMult(I,F),f=""}else if(S&&w(S,"pattern")){var _,L,T,q,P;b={};var D=m.unitMatrix;S.hasAttribute("patternUnits")&&"objectboundingbox"!==S.getAttribute("patternUnits").toLowerCase()||(h||(h=G(t)),D=new m.Matrix(1,0,0,1,h[0],h[1]),_=G(S),P=_[0]*h[0],L=_[1]*h[1],T=_[2]*h[2],q=_[3]*h[3],b.boundingBox=[P,L,P+T,L+q],b.xStep=T,b.yStep=q);var Z=m.unitMatrix;S.hasAttribute("patternContentUnits")&&"objectboundingbox"===S.getAttribute("patternContentUnits").toLowerCase()&&(h||(h=G(t)),Z=new m.Matrix(h[2],0,0,h[3],0,0),_=b.boundingBox||G(S),P=_[0]/h[0],L=_[1]/h[1],T=_[2]/h[2],q=_[3]/h[3],b.boundingBox=[P,L,P+T,L+q],b.xStep=T,b.yStep=q),b.matrix=m.matrixMult(m.matrixMult(Z,D),o),f="F"}else d=S=null,function(){u=new x("rgb(0, 0, 0)"),c=!0,f="F"}()}else u=j(k),u.ok?(c=!0,f="F"):f=""}var R=1,at=1,it=M(t,"fill-opacity");it&&(R*=parseFloat(it)),u&&"number"==typeof u.a&&(R*=u.a);var nt=M(t,"stroke-opacity");nt&&(at*=parseFloat(nt)),dt&&"number"==typeof dt.a&&(at*=dt.a);var st=M(t,"opacity");if(st){var ot=parseFloat(st);at*=ot,R*=ot}var ht=R<1,ct=at<1;if(ht||ct){var ut={};ht&&(ut.opacity=R),ct&&(ut["stroke-opacity"]=at),m.setGState(new m.GState(ut))}}if(w(t,"g,path,rect,ellipse,line,circle,polygon")){c&&(n.fill=u,m.setFillColor(u.r,u.g,u.b));var ft=M(t,"stroke");if(ft){var lt=M(t,"stroke-width");void 0!==lt&&""!==lt&&(lt=Math.abs(parseFloat(lt)),n.strokeWidth=lt,m.setLineWidth(lt));var dt=new x(ft);dt.ok&&(n.color=dt,m.setDrawColor(dt.r,dt.g,dt.b),l=0!==lt?"D":"");var gt=M(t,"stroke-linecap");gt&&m.setLineCap(n.strokeLinecap=gt);var pt=M(t,"stroke-linejoin");pt&&m.setLineJoin(n.strokeLinejoin=pt);var xt=M(t,"stroke-dasharray");if(xt){xt=E(xt);var bt=parseInt(M(t,"stroke-dashoffset"))||0;n.strokeDasharray=xt,n.strokeDashoffset=bt,m.setLineDashPattern(xt,bt)}var mt=M(t,"stroke-miterlimit");void 0!==mt&&""!==mt&&m.setLineMiterLimit(n.strokeMiterlimit=parseFloat(mt))}}f=n.fillMode="inherit"===f?n.fillMode:f,l=n.strokeMode="inherit"===l?n.strokeMode:l;var vt=f+l;switch(g(t,u,n),p(n,s),t.tagName.toLowerCase()){case"svg":K(t,o,r,a,i,n);break;case"g":J(t,o,r,a,i,n);case"a":case"marker":tt(t,o,r,a,i,n);break;case"defs":tt(t,o,r,a,!0,n);break;case"use":H(t,o,a);break;case"line":B(t,o,a,n);break;case"rect":m.setCurrentTransformationMatrix(o),X(t,vt,d,b);break;case"ellipse":m.setCurrentTransformationMatrix(o),Q(t,vt,d,b);break;case"circle":m.setCurrentTransformationMatrix(o),U(t,vt,d,b);break;case"text":$(t,o,0,0,n);break;case"path":V(t,o,a,vt,d,b,n);break;case"polygon":W(t,o,vt,d,b,a,n);break;case"image":m.setCurrentTransformationMatrix(o),Y(t,a);break;case"lineargradient":et(t,"axial",[t.getAttribute("x1")||0,t.getAttribute("y1")||0,t.getAttribute("x2")||1,t.getAttribute("y2")||0],r,a);break;case"radialgradient":et(t,"radial",[t.getAttribute("fx")||t.getAttribute("cx")||.5,t.getAttribute("fy")||t.getAttribute("cy")||.5,0,t.getAttribute("cx")||.5,t.getAttribute("cy")||.5,t.getAttribute("r")||.5],r,a);break;case"pattern":rt(t,r,a,n)}y?m.endFormObject(a.get()+t.getAttribute("id")):m.restoreGraphicsState()}}},it=function(t,e,r){m=e;var a=r.scale||1,i=r.xOffset||0,n=r.yOffset||0;m.saveGraphicsState(),m.setCurrentTransformationMatrix(new m.Matrix(a,0,0,a,i,n));var s=L.default();m.setLineWidth(s.strokeWidth);var o=s.fill;return m.setFillColor(o.r,o.g,o.b),m.setFont(s.fontFamily),m.setFontSize(s.fontSize),at(t.cloneNode(!0),m.unitMatrix,{},new _(""),!1,s),m.restoreGraphicsState(),m};"function"==typeof t&&t.amd?t(["./rgbcolor","SvgPath"],function(t,e){return x=t,b=e,it}):void 0!==r&&r.exports?(x=e("./rgbcolor.js"),b=e("SvgPath"),r.exports=it):(b=a.SvgPath,x=a.RGBColor,a.svg2pdf=it,a.svgElementToPdf=it)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this)},{"./rgbcolor.js":8,SvgPath:1}]},{},[9])(9)});
//# sourceMappingURL=svg2pdf.min.js.map