!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).canvg={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t,e){return t(e={exports:{}},e.exports),e.exports}var n=function(t){return t&&t.Math==Math&&t},i=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||Function("return this")(),o=function(t){try{return!!t()}catch(t){return!0}},a=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),u={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,c={f:s&&!u.call({1:2},1)?function(t){var e=s(this,t);return!!e&&e.enumerable}:u},l=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},f={}.toString,h=function(t){return f.call(t).slice(8,-1)},p="".split,g=o((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==h(t)?p.call(t,""):Object(t)}:Object,y=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},v=function(t){return g(y(t))},d=function(t){return"object"==typeof t?null!==t:"function"==typeof t},m=function(t,e){if(!d(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!d(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!d(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!d(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},x={}.hasOwnProperty,b=function(t,e){return x.call(t,e)},w=i.document,S=d(w)&&d(w.createElement),k=function(t){return S?w.createElement(t):{}},P=!a&&!o((function(){return 7!=Object.defineProperty(k("div"),"a",{get:function(){return 7}}).a})),R=Object.getOwnPropertyDescriptor,A={f:a?R:function(t,e){if(t=v(t),e=m(e,!0),P)try{return R(t,e)}catch(t){}if(b(t,e))return l(!c.f.call(t,e),t[e])}},E=function(t){if(!d(t))throw TypeError(String(t)+" is not an object");return t},C=Object.defineProperty,T={f:a?C:function(t,e,r){if(E(t),e=m(e,!0),E(r),P)try{return C(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},O=a?function(t,e,r){return T.f(t,e,l(1,r))}:function(t,e,r){return t[e]=r,t},M=function(t,e){try{O(i,t,e)}catch(r){i[t]=e}return e},D=i["__core-js_shared__"]||M("__core-js_shared__",{}),V=Function.toString;"function"!=typeof D.inspectSource&&(D.inspectSource=function(t){return V.call(t)});var N,I,L,j=D.inspectSource,z=i.WeakMap,B="function"==typeof z&&/native code/.test(j(z)),F=r((function(t){(t.exports=function(t,e){return D[t]||(D[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.4",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),_=0,$=Math.random(),G=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++_+$).toString(36)},q=F("keys"),U=function(t){return q[t]||(q[t]=G(t))},W={},H=i.WeakMap;if(B){var X=new H,Y=X.get,Q=X.has,Z=X.set;N=function(t,e){return Z.call(X,t,e),e},I=function(t){return Y.call(X,t)||{}},L=function(t){return Q.call(X,t)}}else{var K=U("state");W[K]=!0,N=function(t,e){return O(t,K,e),e},I=function(t){return b(t,K)?t[K]:{}},L=function(t){return b(t,K)}}var J,tt,et={set:N,get:I,has:L,enforce:function(t){return L(t)?I(t):N(t,{})},getterFor:function(t){return function(e){var r;if(!d(e)||(r=I(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},rt=r((function(t){var e=et.get,r=et.enforce,n=String(String).split("String");(t.exports=function(t,e,o,a){var u=!!a&&!!a.unsafe,s=!!a&&!!a.enumerable,c=!!a&&!!a.noTargetGet;"function"==typeof o&&("string"!=typeof e||b(o,"name")||O(o,"name",e),r(o).source=n.join("string"==typeof e?e:"")),t!==i?(u?!c&&t[e]&&(s=!0):delete t[e],s?t[e]=o:O(t,e,o)):s?t[e]=o:M(e,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||j(this)}))})),nt=i,it=function(t){return"function"==typeof t?t:void 0},ot=function(t,e){return arguments.length<2?it(nt[t])||it(i[t]):nt[t]&&nt[t][e]||i[t]&&i[t][e]},at=Math.ceil,ut=Math.floor,st=function(t){return isNaN(t=+t)?0:(t>0?ut:at)(t)},ct=Math.min,lt=function(t){return t>0?ct(st(t),9007199254740991):0},ft=Math.max,ht=Math.min,pt=function(t,e){var r=st(t);return r<0?ft(r+e,0):ht(r,e)},gt=function(t){return function(e,r,n){var i,o=v(e),a=lt(o.length),u=pt(n,a);if(t&&r!=r){for(;a>u;)if((i=o[u++])!=i)return!0}else for(;a>u;u++)if((t||u in o)&&o[u]===r)return t||u||0;return!t&&-1}},yt={includes:gt(!0),indexOf:gt(!1)},vt=yt.indexOf,dt=function(t,e){var r,n=v(t),i=0,o=[];for(r in n)!b(W,r)&&b(n,r)&&o.push(r);for(;e.length>i;)b(n,r=e[i++])&&(~vt(o,r)||o.push(r));return o},mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],xt=mt.concat("length","prototype"),bt={f:Object.getOwnPropertyNames||function(t){return dt(t,xt)}},wt={f:Object.getOwnPropertySymbols},St=ot("Reflect","ownKeys")||function(t){var e=bt.f(E(t)),r=wt.f;return r?e.concat(r(t)):e},kt=function(t,e){for(var r=St(e),n=T.f,i=A.f,o=0;om;m++)if((a||m in y)&&(h=v(f=y[m],m,p),t))if(e)b[m]=h;else if(h)switch(t){case 3:return!0;case 5:return f;case 6:return m;case 2:Ut.call(b,f)}else if(i)return!1;return o?-1:n||i?i:b}},Ht={forEach:Wt(0),map:Wt(1),filter:Wt(2),some:Wt(3),every:Wt(4),find:Wt(5),findIndex:Wt(6)},Xt=ot("navigator","userAgent")||"",Yt=i.process,Qt=Yt&&Yt.versions,Zt=Qt&&Qt.v8;Zt?tt=(J=Zt.split("."))[0]+J[1]:Xt&&(!(J=Xt.match(/Edge\/(\d+)/))||J[1]>=74)&&(J=Xt.match(/Chrome\/(\d+)/))&&(tt=J[1]);var Kt=tt&&+tt,Jt=$t("species"),te=function(t){return Kt>=51||!o((function(){var e=[];return(e.constructor={})[Jt]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},ee=Object.defineProperty,re={},ne=function(t){throw t},ie=function(t,e){if(b(re,t))return re[t];e||(e={});var r=[][t],n=!!b(e,"ACCESSORS")&&e.ACCESSORS,i=b(e,0)?e[0]:ne,u=b(e,1)?e[1]:void 0;return re[t]=!!r&&!o((function(){if(n&&!a)return!0;var t={length:-1};n?ee(t,1,{enumerable:!0,get:ne}):t[1]=1,r.call(t,i,u)}))},oe=Ht.map,ae=te("map"),ue=ie("map");Dt({target:"Array",proto:!0,forced:!ae||!ue},{map:function(t){return oe(this,t,arguments.length>1?arguments[1]:void 0)}});var se=function(){var t=E(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e};function ce(t,e){return RegExp(t,e)}var le,fe,he={UNSUPPORTED_Y:o((function(){var t=ce("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),BROKEN_CARET:o((function(){var t=ce("^r","gy");return t.lastIndex=2,null!=t.exec("str")}))},pe=RegExp.prototype.exec,ge=String.prototype.replace,ye=pe,ve=(le=/a/,fe=/b*/g,pe.call(le,"a"),pe.call(fe,"a"),0!==le.lastIndex||0!==fe.lastIndex),de=he.UNSUPPORTED_Y||he.BROKEN_CARET,me=void 0!==/()??/.exec("")[1];(ve||me||de)&&(ye=function(t){var e,r,n,i,o=this,a=de&&o.sticky,u=se.call(o),s=o.source,c=0,l=t;return a&&(-1===(u=u.replace("y","")).indexOf("g")&&(u+="g"),l=String(t).slice(o.lastIndex),o.lastIndex>0&&(!o.multiline||o.multiline&&"\n"!==t[o.lastIndex-1])&&(s="(?: "+s+")",l=" "+l,c++),r=new RegExp("^(?:"+s+")",u)),me&&(r=new RegExp("^"+s+"$(?!\\s)",u)),ve&&(e=o.lastIndex),n=pe.call(a?r:o,l),a?n?(n.input=n.input.slice(c),n[0]=n[0].slice(c),n.index=o.lastIndex,o.lastIndex+=n[0].length):o.lastIndex=0:ve&&n&&(o.lastIndex=o.global?n.index+n[0].length:e),me&&n&&n.length>1&&ge.call(n[0],r,(function(){for(i=1;i")})),Se="$0"==="a".replace(/./,"$0"),ke=$t("replace"),Pe=!!/./[ke]&&""===/./[ke]("a","$0"),Re=!o((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var r="ab".split(t);return 2!==r.length||"a"!==r[0]||"b"!==r[1]})),Ae=function(t,e,r,n){var i=$t(t),a=!o((function(){var e={};return e[i]=function(){return 7},7!=""[t](e)})),u=a&&!o((function(){var e=!1,r=/a/;return"split"===t&&((r={}).constructor={},r.constructor[be]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return e=!0,null},r[i](""),!e}));if(!a||!u||"replace"===t&&(!we||!Se||Pe)||"split"===t&&!Re){var s=/./[i],c=r(i,""[t],(function(t,e,r,n,i){return e.exec===xe?a&&!i?{done:!0,value:s.call(e,r,n)}:{done:!0,value:t.call(r,e,n)}:{done:!1}}),{REPLACE_KEEPS_$0:Se,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:Pe}),l=c[0],f=c[1];rt(String.prototype,t,l),rt(RegExp.prototype,i,2==e?function(t,e){return f.call(t,this,e)}:function(t){return f.call(t,this)})}n&&O(RegExp.prototype[i],"sham",!0)},Ee=function(t){return function(e,r){var n,i,o=String(y(e)),a=st(r),u=o.length;return a<0||a>=u?t?"":void 0:(n=o.charCodeAt(a))<55296||n>56319||a+1===u||(i=o.charCodeAt(a+1))<56320||i>57343?t?o.charAt(a):n:t?o.slice(a,a+2):i-56320+(n-55296<<10)+65536}},Ce={codeAt:Ee(!1),charAt:Ee(!0)},Te=Ce.charAt,Oe=function(t,e,r){return e+(r?Te(t,e).length:1)},Me=function(t,e){var r=t.exec;if("function"==typeof r){var n=r.call(t,e);if("object"!=typeof n)throw TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==h(t))throw TypeError("RegExp#exec called on incompatible receiver");return xe.call(t,e)};Ae("match",1,(function(t,e,r){return[function(e){var r=y(this),n=null==e?void 0:e[t];return void 0!==n?n.call(e,r):new RegExp(e)[t](String(r))},function(t){var n=r(e,t,this);if(n.done)return n.value;var i=E(t),o=String(this);if(!i.global)return Me(i,o);var a=i.unicode;i.lastIndex=0;for(var u,s=[],c=0;null!==(u=Me(i,o));){var l=String(u[0]);s[c]=l,""===l&&(i.lastIndex=Oe(o,lt(i.lastIndex),a)),c++}return 0===c?null:s}]}));var De=Math.max,Ve=Math.min,Ne=Math.floor,Ie=/\$([$&'`]|\d\d?|<[^>]*>)/g,Le=/\$([$&'`]|\d\d?)/g;Ae("replace",2,(function(t,e,r,n){var i=n.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,o=n.REPLACE_KEEPS_$0,a=i?"$":"$0";return[function(r,n){var i=y(this),o=null==r?void 0:r[t];return void 0!==o?o.call(r,i,n):e.call(String(i),r,n)},function(t,n){if(!i&&o||"string"==typeof n&&-1===n.indexOf(a)){var s=r(e,t,this,n);if(s.done)return s.value}var c=E(t),l=String(this),f="function"==typeof n;f||(n=String(n));var h=c.global;if(h){var p=c.unicode;c.lastIndex=0}for(var g=[];;){var y=Me(c,l);if(null===y)break;if(g.push(y),!h)break;""===String(y[0])&&(c.lastIndex=Oe(l,lt(c.lastIndex),p))}for(var v,d="",m=0,x=0;x=m&&(d+=l.slice(m,w)+A,m=w+b.length)}return d+l.slice(m)}];function u(t,r,n,i,o,a){var u=n+t.length,s=i.length,c=Le;return void 0!==o&&(o=It(o),c=Ie),e.call(a,c,(function(e,a){var c;switch(a.charAt(0)){case"$":return"$";case"&":return t;case"`":return r.slice(0,n);case"'":return r.slice(u);case"<":c=o[a.slice(1,-1)];break;default:var l=+a;if(0===l)return e;if(l>s){var f=Ne(l/10);return 0===f?e:f<=s?void 0===i[f-1]?a.charAt(1):i[f-1]+a.charAt(1):e}c=i[l-1]}return void 0===c?"":c}))}}));var je,ze=$t("match"),Be=function(t){var e;return d(t)&&(void 0!==(e=t[ze])?!!e:"RegExp"==h(t))},Fe=function(t){if(Be(t))throw TypeError("The method doesn't accept regular expressions");return t},_e=$t("match"),$e=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[_e]=!1,"/./"[t](e)}catch(t){}}return!1},Ge=A.f,qe="".startsWith,Ue=Math.min,We=$e("startsWith"),He=!(We||(je=Ge(String.prototype,"startsWith"),!je||je.writable));function Xe(t){return t.replace(/(?!\u3000)\s+/gm," ")}function Ye(t){return t.replace(/^[\n \t]+/,"")}function Qe(t){return t.replace(/[\n \t]+$/,"")}function Ze(t){return((t||"").match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm)||[]).map(parseFloat)}Dt({target:"String",proto:!0,forced:!He&&!We},{startsWith:function(t){var e=String(y(this));Fe(t);var r=lt(Ue(arguments.length>1?arguments[1]:void 0,e.length)),n=String(t);return qe?qe.call(e,n,r):e.slice(r,r+n.length)===n}});var Ke=/^[A-Z-]+$/;function Je(t){return Ke.test(t)?t.toLowerCase():t}function tr(t){var e=t.match(/url\(('([^']+)'|"([^"]+)"|([^'"\)]+))\)/)||[];return e[2]||e[3]||e[4]}function er(t){if(!t.startsWith("rgb"))return t;var e=3;return t.replace(/\d+(\.\d+)?/g,(function(t,r){return e--&&r?String(Math.round(parseFloat(t))):t}))}var rr=function(t,e){var r=[][t];return!!r&&o((function(){r.call(null,e||function(){throw 1},1)}))},nr=[].join,ir=g!=Object,or=rr("join",",");Dt({target:"Array",proto:!0,forced:ir||!or},{join:function(t){return nr.call(v(this),void 0===t?",":t)}});var ar=function(t){if(Array.isArray(t))return t};var ur=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=t[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}};var sr=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r~\.\[:]+)/g,gr=/(\.[^\s\+>~\.\[:]+)/g,yr=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,vr=/(:[\w-]+\([^\)]*\))/gi,dr=/(:[^\s\+>~\.\[:]+)/g,mr=/([^\s\+>~\.\[:]+)/g;function xr(t,e){var r=t.match(e);return r?[t.replace(e," "),r.length]:[t,0]}function br(t){var e=[0,0,0],r=t.replace(/:not\(([^\)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),n=0,i=xr(r,hr),o=fr(i,2);r=o[0],n=o[1],e[1]+=n;var a=xr(r,pr),u=fr(a,2);r=u[0],n=u[1],e[0]+=n;var s=xr(r,gr),c=fr(s,2);r=c[0],n=c[1],e[1]+=n;var l=xr(r,yr),f=fr(l,2);r=f[0],n=f[1],e[2]+=n;var h=xr(r,vr),p=fr(h,2);r=p[0],n=p[1],e[1]+=n;var g=xr(r,dr),y=fr(g,2);r=y[0],n=y[1],e[1]+=n;var v=xr(r=r.replace(/[\*\s\+>~]/g," ").replace(/[#\.]/g," "),mr),d=fr(v,2);return r=d[0],n=d[1],e[2]+=n,e.join("")}function wr(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))}function Sr(t,e){return(t[0]*e[0]+t[1]*e[1])/(wr(t)*wr(e))}function kr(t,e){return(t[0]*e[1]o;)T.f(t,r=n[o++],e[r]);return t},Nr=ot("document","documentElement"),Ir=U("IE_PROTO"),Lr=function(){},jr=function(t){return"