Files
svgedit/dist/editor/extensions/ext-server_opensave/ext-server_opensave.js
2020-09-12 01:27:47 +02:00

11 lines
138 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var check=function(t){return t&&t.Math==Math&&t},e=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof t&&t)||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},n=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),i={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,s={f:o&&!i.call({1:2},1)?function propertyIsEnumerable(t){var e=o(this,t);return!!e&&e.enumerable}:i},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},l={}.toString,classofRaw=function(t){return l.call(t).slice(8,-1)},u="".split,h=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?u.call(t,""):Object(t)}:Object,requireObjectCoercible=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},toIndexedObject=function(t){return h(requireObjectCoercible(t))},isObject=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!isObject(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!isObject(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!isObject(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")},p={}.hasOwnProperty,has=function(t,e){return p.call(t,e)},d=e.document,v=isObject(d)&&isObject(d.createElement),documentCreateElement=function(t){return v?d.createElement(t):{}},g=!n&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),b=Object.getOwnPropertyDescriptor,_={f:n?b:function getOwnPropertyDescriptor(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),g)try{return b(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!s.f.call(t,e),t[e])}},anObject=function(t){if(!isObject(t))throw TypeError(String(t)+" is not an object");return t},w=Object.defineProperty,P={f:n?w:function defineProperty(t,e,n){if(anObject(t),e=toPrimitive(e,!0),anObject(n),g)try{return w(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},C=n?function(t,e,n){return P.f(t,e,createPropertyDescriptor(1,n))}:function(t,e,n){return t[e]=n,t},setGlobal=function(t,n){try{C(e,t,n)}catch(i){e[t]=n}return n},k=e["__core-js_shared__"]||setGlobal("__core-js_shared__",{}),E=Function.toString;"function"!=typeof k.inspectSource&&(k.inspectSource=function(t){return E.call(t)});var S,T,A,O=k.inspectSource,M=e.WeakMap,V="function"==typeof M&&/native code/.test(O(M)),B=createCommonjsModule((function(t){(t.exports=function(t,e){return k[t]||(k[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),R=0,I=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++R+I).toString(36)},j=B("keys"),sharedKey=function(t){return j[t]||(j[t]=uid(t))},N={},D=e.WeakMap;if(V){var L=new D,G=L.get,z=L.has,W=L.set;S=function(t,e){return W.call(L,t,e),e},T=function(t){return G.call(L,t)||{}},A=function(t){return z.call(L,t)}}else{var X=sharedKey("state");N[X]=!0,S=function(t,e){return C(t,X,e),e},T=function(t){return has(t,X)?t[X]:{}},A=function(t){return has(t,X)}}var $,U,q={set:S,get:T,has:A,enforce:function(t){return A(t)?T(t):S(t,{})},getterFor:function(t){return function(e){var n;if(!isObject(e)||(n=T(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},H=createCommonjsModule((function(t){var n=q.get,i=q.enforce,o=String(String).split("String");(t.exports=function(t,n,s,l){var u=!!l&&!!l.unsafe,h=!!l&&!!l.enumerable,p=!!l&&!!l.noTargetGet;"function"==typeof s&&("string"!=typeof n||has(s,"name")||C(s,"name",n),i(s).source=o.join("string"==typeof n?n:"")),t!==e?(u?!p&&t[n]&&(h=!0):delete t[n],h?t[n]=s:C(t,n,s)):h?t[n]=s:setGlobal(n,s)})(Function.prototype,"toString",(function toString(){return"function"==typeof this&&n(this).source||O(this)}))})),Y=e,aFunction=function(t){return"function"==typeof t?t:void 0},getBuiltIn=function(t,n){return arguments.length<2?aFunction(Y[t])||aFunction(e[t]):Y[t]&&Y[t][n]||e[t]&&e[t][n]},Q=Math.ceil,Z=Math.floor,toInteger=function(t){return isNaN(t=+t)?0:(t>0?Z:Q)(t)},J=Math.min,toLength=function(t){return t>0?J(toInteger(t),9007199254740991):0},K=Math.max,tt=Math.min,toAbsoluteIndex=function(t,e){var n=toInteger(t);return n<0?K(n+e,0):tt(n,e)},createMethod=function(t){return function(e,n,i){var o,s=toIndexedObject(e),l=toLength(s.length),u=toAbsoluteIndex(i,l);if(t&&n!=n){for(;l>u;)if((o=s[u++])!=o)return!0}else for(;l>u;u++)if((t||u in s)&&s[u]===n)return t||u||0;return!t&&-1}},et={includes:createMethod(!0),indexOf:createMethod(!1)},rt=et.indexOf,objectKeysInternal=function(t,e){var n,i=toIndexedObject(t),o=0,s=[];for(n in i)!has(N,n)&&has(i,n)&&s.push(n);for(;e.length>o;)has(i,n=e[o++])&&(~rt(s,n)||s.push(n));return s},nt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],at=nt.concat("length","prototype"),it={f:Object.getOwnPropertyNames||function getOwnPropertyNames(t){return objectKeysInternal(t,at)}},ot={f:Object.getOwnPropertySymbols},st=getBuiltIn("Reflect","ownKeys")||function ownKeys(t){var e=it.f(anObject(t)),n=ot.f;return n?e.concat(n(t)):e},copyConstructorProperties=function(t,e){for(var n=st(e),i=P.f,o=_.f,s=0;s<n.length;s++){var l=n[s];has(t,l)||i(t,l,o(e,l))}},lt=/#|\.prototype\./,isForced=function(t,e){var n=ct[ut(t)];return n==ft||n!=ht&&("function"==typeof e?fails(e):!!e)},ut=isForced.normalize=function(t){return String(t).replace(lt,".").toLowerCase()},ct=isForced.data={},ht=isForced.NATIVE="N",ft=isForced.POLYFILL="P",pt=isForced,dt=_.f,_export=function(t,n){var i,o,s,l,u,h=t.target,p=t.global,d=t.stat;if(i=p?e:d?e[h]||setGlobal(h,{}):(e[h]||{}).prototype)for(o in n){if(l=n[o],s=t.noTargetGet?(u=dt(i,o))&&u.value:i[o],!pt(p?o:h+(d?".":"#")+o,t.forced)&&void 0!==s){if(typeof l==typeof s)continue;copyConstructorProperties(l,s)}(t.sham||s&&s.sham)&&C(l,"sham",!0),H(i,o,l,t)}},vt=Array.isArray||function isArray(t){return"Array"==classofRaw(t)},toObject=function(t){return Object(requireObjectCoercible(t))},createProperty=function(t,e,n){var i=toPrimitive(e);i in t?P.f(t,i,createPropertyDescriptor(0,n)):t[i]=n},yt=!!Object.getOwnPropertySymbols&&!fails((function(){return!String(Symbol())})),gt=yt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,mt=B("wks"),bt=e.Symbol,_t=gt?bt:bt&&bt.withoutSetter||uid,wellKnownSymbol=function(t){return has(mt,t)||(yt&&has(bt,t)?mt[t]=bt[t]:mt[t]=_t("Symbol."+t)),mt[t]},xt=wellKnownSymbol("species"),arraySpeciesCreate=function(t,e){var n;return vt(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!vt(n.prototype)?isObject(n)&&null===(n=n[xt])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},wt=getBuiltIn("navigator","userAgent")||"",Pt=e.process,Ct=Pt&&Pt.versions,kt=Ct&&Ct.v8;kt?U=($=kt.split("."))[0]+$[1]:wt&&(!($=wt.match(/Edge\/(\d+)/))||$[1]>=74)&&($=wt.match(/Chrome\/(\d+)/))&&(U=$[1]);var Et=U&&+U,St=wellKnownSymbol("species"),arrayMethodHasSpeciesSupport=function(t){return Et>=51||!fails((function(){var e=[];return(e.constructor={})[St]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Tt=wellKnownSymbol("isConcatSpreadable"),At=Et>=51||!fails((function(){var t=[];return t[Tt]=!1,t.concat()[0]!==t})),Ot=arrayMethodHasSpeciesSupport("concat"),isConcatSpreadable=function(t){if(!isObject(t))return!1;var e=t[Tt];return void 0!==e?!!e:vt(t)};_export({target:"Array",proto:!0,forced:!At||!Ot},{concat:function concat(t){var e,n,i,o,s,l=toObject(this),u=arraySpeciesCreate(l,0),h=0;for(e=-1,i=arguments.length;e<i;e++)if(isConcatSpreadable(s=-1===e?l:arguments[e])){if(h+(o=toLength(s.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<o;n++,h++)n in s&&createProperty(u,h,s[n])}else{if(h>=9007199254740991)throw TypeError("Maximum allowed index exceeded");createProperty(u,h++,s)}return u.length=h,u}});var arrayMethodIsStrict=function(t,e){var n=[][t];return!!n&&fails((function(){n.call(null,e||function(){throw 1},1)}))},Mt=[].join,Vt=h!=Object,Bt=arrayMethodIsStrict("join",",");_export({target:"Array",proto:!0,forced:Vt||!Bt},{join:function join(t){return Mt.call(toIndexedObject(this),void 0===t?",":t)}});var Rt={};Rt[wellKnownSymbol("toStringTag")]="z";var It="[object z]"===String(Rt),jt=wellKnownSymbol("toStringTag"),Nt="Arguments"==classofRaw(function(){return arguments}()),Dt=It?classofRaw:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),jt))?n:Nt?classofRaw(e):"Object"==(i=classofRaw(e))&&"function"==typeof e.callee?"Arguments":i},Lt=It?{}.toString:function toString(){return"[object "+Dt(this)+"]"};It||H(Object.prototype,"toString",Lt,{unsafe:!0});var Ft=e.Promise,Gt=P.f,zt=wellKnownSymbol("toStringTag"),setToStringTag=function(t,e,n){t&&!has(t=n?t:t.prototype,zt)&&Gt(t,zt,{configurable:!0,value:e})},Wt=wellKnownSymbol("species"),aFunction$1=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},Xt={},$t=wellKnownSymbol("iterator"),Ut=Array.prototype,functionBindContext=function(t,e,n){if(aFunction$1(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,o){return t.call(e,n,i,o)}}return function(){return t.apply(e,arguments)}},qt=wellKnownSymbol("iterator"),callWithSafeIterationClosing=function(t,e,n,i){try{return i?e(anObject(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&anObject(o.call(t)),e}},Ht=createCommonjsModule((function(t){var Result=function(t,e){this.stopped=t,this.result=e};(t.exports=function(t,e,n,i,o){var s,l,u,h,p,d,v,g,b=functionBindContext(e,n,i?2:1);if(o)s=t;else{if("function"!=typeof(l=function(t){if(null!=t)return t[qt]||t["@@iterator"]||Xt[Dt(t)]}(t)))throw TypeError("Target is not iterable");if(void 0!==(g=l)&&(Xt.Array===g||Ut[$t]===g)){for(u=0,h=toLength(t.length);h>u;u++)if((p=i?b(anObject(v=t[u])[0],v[1]):b(t[u]))&&p instanceof Result)return p;return new Result(!1)}s=l.call(t)}for(d=s.next;!(v=d.call(s)).done;)if("object"==typeof(p=callWithSafeIterationClosing(s,b,v.value,i))&&p&&p instanceof Result)return p;return new Result(!1)}).stop=function(t){return new Result(!0,t)}})),Yt=wellKnownSymbol("iterator"),Qt=!1;try{var Zt=0,Jt={next:function(){return{done:!!Zt++}},return:function(){Qt=!0}};Jt[Yt]=function(){return this},Array.from(Jt,(function(){throw 2}))}catch(t){}var Kt,te,ee,re=wellKnownSymbol("species"),speciesConstructor=function(t,e){var n,i=anObject(t).constructor;return void 0===i||null==(n=anObject(i)[re])?e:aFunction$1(n)},ne=getBuiltIn("document","documentElement"),ae=/(iphone|ipod|ipad).*applewebkit/i.test(wt),ie=e.location,oe=e.setImmediate,se=e.clearImmediate,le=e.process,ue=e.MessageChannel,ce=e.Dispatch,he=0,fe={},run=function(t){if(fe.hasOwnProperty(t)){var e=fe[t];delete fe[t],e()}},runner=function(t){return function(){run(t)}},listener=function(t){run(t.data)},post=function(t){e.postMessage(t+"",ie.protocol+"//"+ie.host)};oe&&se||(oe=function setImmediate(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return fe[++he]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},Kt(he),he},se=function clearImmediate(t){delete fe[t]},"process"==classofRaw(le)?Kt=function(t){le.nextTick(runner(t))}:ce&&ce.now?Kt=function(t){ce.now(runner(t))}:ue&&!ae?(ee=(te=new ue).port2,te.port1.onmessage=listener,Kt=functionBindContext(ee.postMessage,ee,1)):!e.addEventListener||"function"!=typeof postMessage||e.importScripts||fails(post)||"file:"===ie.protocol?Kt="onreadystatechange"in documentCreateElement("script")?function(t){ne.appendChild(documentCreateElement("script")).onreadystatechange=function(){ne.removeChild(this),run(t)}}:function(t){setTimeout(runner(t),0)}:(Kt=post,e.addEventListener("message",listener,!1)));var pe,de,ve,ye,ge,me,be,_e,xe={set:oe,clear:se},we=_.f,Pe=xe.set,Ce=e.MutationObserver||e.WebKitMutationObserver,ke=e.process,Ee=e.Promise,Se="process"==classofRaw(ke),Te=we(e,"queueMicrotask"),Ae=Te&&Te.value;Ae||(pe=function(){var t,e;for(Se&&(t=ke.domain)&&t.exit();de;){e=de.fn,de=de.next;try{e()}catch(t){throw de?ye():ve=void 0,t}}ve=void 0,t&&t.enter()},Se?ye=function(){ke.nextTick(pe)}:Ce&&!ae?(ge=!0,me=document.createTextNode(""),new Ce(pe).observe(me,{characterData:!0}),ye=function(){me.data=ge=!ge}):Ee&&Ee.resolve?(be=Ee.resolve(void 0),_e=be.then,ye=function(){_e.call(be,pe)}):ye=function(){Pe.call(e,pe)});var Oe,Me,Ve,Be,Re=Ae||function(t){var e={fn:t,next:void 0};ve&&(ve.next=e),de||(de=e,ye()),ve=e},PromiseCapability=function(t){var e,n;this.promise=new t((function(t,i){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=i})),this.resolve=aFunction$1(e),this.reject=aFunction$1(n)},Ie={f:function(t){return new PromiseCapability(t)}},promiseResolve=function(t,e){if(anObject(t),isObject(e)&&e.constructor===t)return e;var n=Ie.f(t);return(0,n.resolve)(e),n.promise},perform=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},je=xe.set,Ne=wellKnownSymbol("species"),De="Promise",Le=q.get,Fe=q.set,Ge=q.getterFor(De),ze=Ft,We=e.TypeError,Xe=e.document,$e=e.process,Ue=getBuiltIn("fetch"),qe=Ie.f,He=qe,Ye="process"==classofRaw($e),Qe=!!(Xe&&Xe.createEvent&&e.dispatchEvent),Ze=pt(De,(function(){if(!(O(ze)!==String(ze))){if(66===Et)return!0;if(!Ye&&"function"!=typeof PromiseRejectionEvent)return!0}if(Et>=51&&/native code/.test(ze))return!1;var t=ze.resolve(1),FakePromise=function(t){t((function(){}),(function(){}))};return(t.constructor={})[Ne]=FakePromise,!(t.then((function(){}))instanceof FakePromise)})),Je=Ze||!function(t,e){if(!e&&!Qt)return!1;var n=!1;try{var i={};i[Yt]=function(){return{next:function(){return{done:n=!0}}}},t(i)}catch(t){}return n}((function(t){ze.all(t).catch((function(){}))})),isThenable=function(t){var e;return!(!isObject(t)||"function"!=typeof(e=t.then))&&e},notify$1=function(t,e,n){if(!e.notified){e.notified=!0;var i=e.reactions;Re((function(){for(var o=e.value,s=1==e.state,l=0;i.length>l;){var u,h,p,d=i[l++],v=s?d.ok:d.fail,g=d.resolve,b=d.reject,_=d.domain;try{v?(s||(2===e.rejection&&onHandleUnhandled(t,e),e.rejection=1),!0===v?u=o:(_&&_.enter(),u=v(o),_&&(_.exit(),p=!0)),u===d.promise?b(We("Promise-chain cycle")):(h=isThenable(u))?h.call(u,g,b):g(u)):b(o)}catch(t){_&&!p&&_.exit(),b(t)}}e.reactions=[],e.notified=!1,n&&!e.rejection&&onUnhandled(t,e)}))}},dispatchEvent=function(t,n,i){var o,s;Qe?((o=Xe.createEvent("Event")).promise=n,o.reason=i,o.initEvent(t,!1,!0),e.dispatchEvent(o)):o={promise:n,reason:i},(s=e["on"+t])?s(o):"unhandledrejection"===t&&function(t,n){var i=e.console;i&&i.error&&(1===arguments.length?i.error(t):i.error(t,n))}("Unhandled promise rejection",i)},onUnhandled=function(t,n){je.call(e,(function(){var e,i=n.value;if(isUnhandled(n)&&(e=perform((function(){Ye?$e.emit("unhandledRejection",i,t):dispatchEvent("unhandledrejection",t,i)})),n.rejection=Ye||isUnhandled(n)?2:1,e.error))throw e.value}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t,n){je.call(e,(function(){Ye?$e.emit("rejectionHandled",t):dispatchEvent("rejectionhandled",t,n.value)}))},bind=function(t,e,n,i){return function(o){t(e,n,o,i)}},internalReject=function(t,e,n,i){e.done||(e.done=!0,i&&(e=i),e.value=n,e.state=2,notify$1(t,e,!0))},internalResolve=function(t,e,n,i){if(!e.done){e.done=!0,i&&(e=i);try{if(t===n)throw We("Promise can't be resolved itself");var o=isThenable(n);o?Re((function(){var i={done:!1};try{o.call(n,bind(internalResolve,t,i,e),bind(internalReject,t,i,e))}catch(n){internalReject(t,i,n,e)}})):(e.value=n,e.state=1,notify$1(t,e,!1))}catch(n){internalReject(t,{done:!1},n,e)}}};Ze&&(ze=function Promise(t){!function(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation")}(this,ze,De),aFunction$1(t),Oe.call(this);var e=Le(this);try{t(bind(internalResolve,this,e),bind(internalReject,this,e))}catch(t){internalReject(this,e,t)}},(Oe=function Promise(t){Fe(this,{type:De,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=function(t,e,n){for(var i in e)H(t,i,e[i],n);return t}(ze.prototype,{then:function then(t,e){var n=Ge(this),i=qe(speciesConstructor(this,ze));return i.ok="function"!=typeof t||t,i.fail="function"==typeof e&&e,i.domain=Ye?$e.domain:void 0,n.parent=!0,n.reactions.push(i),0!=n.state&&notify$1(this,n,!1),i.promise},catch:function(t){return this.then(void 0,t)}}),Me=function(){var t=new Oe,e=Le(t);this.promise=t,this.resolve=bind(internalResolve,t,e),this.reject=bind(internalReject,t,e)},Ie.f=qe=function(t){return t===ze||t===Ve?new Me(t):He(t)},"function"==typeof Ft&&(Be=Ft.prototype.then,H(Ft.prototype,"then",(function then(t,e){var n=this;return new ze((function(t,e){Be.call(n,t,e)})).then(t,e)}),{unsafe:!0}),"function"==typeof Ue&&_export({global:!0,enumerable:!0,forced:!0},{fetch:function fetch(t){return promiseResolve(ze,Ue.apply(e,arguments))}}))),_export({global:!0,wrap:!0,forced:Ze},{Promise:ze}),setToStringTag(ze,De,!1),function(t){var e=getBuiltIn(t),i=P.f;n&&e&&!e[Wt]&&i(e,Wt,{configurable:!0,get:function(){return this}})}(De),Ve=getBuiltIn(De),_export({target:De,stat:!0,forced:Ze},{reject:function reject(t){var e=qe(this);return e.reject.call(void 0,t),e.promise}}),_export({target:De,stat:!0,forced:Ze},{resolve:function resolve(t){return promiseResolve(this,t)}}),_export({target:De,stat:!0,forced:Je},{all:function all(t){var e=this,n=qe(e),i=n.resolve,o=n.reject,s=perform((function(){var n=aFunction$1(e.resolve),s=[],l=0,u=1;Ht(t,(function(t){var h=l++,p=!1;s.push(void 0),u++,n.call(e,t).then((function(t){p||(p=!0,s[h]=t,--u||i(s))}),o)})),--u||i(s)}));return s.error&&o(s.value),n.promise},race:function race(t){var e=this,n=qe(e),i=n.reject,o=perform((function(){var o=aFunction$1(e.resolve);Ht(t,(function(t){o.call(e,t).then(n.resolve,i)}))}));return o.error&&i(o.value),n.promise}});var regexpFlags=function(){var t=anObject(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 RE(t,e){return RegExp(t,e)}var Ke,tr,er={UNSUPPORTED_Y:fails((function(){var t=RE("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),BROKEN_CARET:fails((function(){var t=RE("^r","gy");return t.lastIndex=2,null!=t.exec("str")}))},rr=RegExp.prototype.exec,nr=String.prototype.replace,ar=rr,ir=(Ke=/a/,tr=/b*/g,rr.call(Ke,"a"),rr.call(tr,"a"),0!==Ke.lastIndex||0!==tr.lastIndex),or=er.UNSUPPORTED_Y||er.BROKEN_CARET,sr=void 0!==/()??/.exec("")[1];(ir||sr||or)&&(ar=function exec(t){var e,n,i,o,s=this,l=or&&s.sticky,u=regexpFlags.call(s),h=s.source,p=0,d=t;return l&&(-1===(u=u.replace("y","")).indexOf("g")&&(u+="g"),d=String(t).slice(s.lastIndex),s.lastIndex>0&&(!s.multiline||s.multiline&&"\n"!==t[s.lastIndex-1])&&(h="(?: "+h+")",d=" "+d,p++),n=new RegExp("^(?:"+h+")",u)),sr&&(n=new RegExp("^"+h+"$(?!\\s)",u)),ir&&(e=s.lastIndex),i=rr.call(l?n:s,d),l?i?(i.input=i.input.slice(p),i[0]=i[0].slice(p),i.index=s.lastIndex,s.lastIndex+=i[0].length):s.lastIndex=0:ir&&i&&(s.lastIndex=s.global?i.index+i[0].length:e),sr&&i&&i.length>1&&nr.call(i[0],n,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i});var lr=ar;_export({target:"RegExp",proto:!0,forced:/./.exec!==lr},{exec:lr});var ur=wellKnownSymbol("species"),cr=!fails((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),hr="$0"==="a".replace(/./,"$0"),fr=wellKnownSymbol("replace"),pr=!!/./[fr]&&""===/./[fr]("a","$0"),dr=!fails((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),fixRegexpWellKnownSymbolLogic=function(t,e,n,i){var o=wellKnownSymbol(t),s=!fails((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),l=s&&!fails((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[ur]=function(){return n},n.flags="",n[o]=/./[o]),n.exec=function(){return e=!0,null},n[o](""),!e}));if(!s||!l||"replace"===t&&(!cr||!hr||pr)||"split"===t&&!dr){var u=/./[o],h=n(o,""[t],(function(t,e,n,i,o){return e.exec===lr?s&&!o?{done:!0,value:u.call(e,n,i)}:{done:!0,value:t.call(n,e,i)}:{done:!1}}),{REPLACE_KEEPS_$0:hr,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:pr}),p=h[0],d=h[1];H(String.prototype,t,p),H(RegExp.prototype,o,2==e?function(t,e){return d.call(t,this,e)}:function(t){return d.call(t,this)})}i&&C(RegExp.prototype[o],"sham",!0)},createMethod$1=function(t){return function(e,n){var i,o,s=String(requireObjectCoercible(e)),l=toInteger(n),u=s.length;return l<0||l>=u?t?"":void 0:(i=s.charCodeAt(l))<55296||i>56319||l+1===u||(o=s.charCodeAt(l+1))<56320||o>57343?t?s.charAt(l):i:t?s.slice(l,l+2):o-56320+(i-55296<<10)+65536}},vr={codeAt:createMethod$1(!1),charAt:createMethod$1(!0)},yr=vr.charAt,advanceStringIndex=function(t,e,n){return e+(n?yr(t,e).length:1)},regexpExecAbstract=function(t,e){var n=t.exec;if("function"==typeof n){var i=n.call(t,e);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==classofRaw(t))throw TypeError("RegExp#exec called on incompatible receiver");return lr.call(t,e)},gr=Math.max,mr=Math.min,br=Math.floor,_r=/\$([$&'`]|\d\d?|<[^>]*>)/g,xr=/\$([$&'`]|\d\d?)/g;fixRegexpWellKnownSymbolLogic("replace",2,(function(t,e,n,i){var o=i.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,s=i.REPLACE_KEEPS_$0,l=o?"$":"$0";return[function replace(n,i){var o=requireObjectCoercible(this),s=null==n?void 0:n[t];return void 0!==s?s.call(n,o,i):e.call(String(o),n,i)},function(t,i){if(!o&&s||"string"==typeof i&&-1===i.indexOf(l)){var u=n(e,t,this,i);if(u.done)return u.value}var h=anObject(t),p=String(this),d="function"==typeof i;d||(i=String(i));var v=h.global;if(v){var g=h.unicode;h.lastIndex=0}for(var b=[];;){var _=regexpExecAbstract(h,p);if(null===_)break;if(b.push(_),!v)break;""===String(_[0])&&(h.lastIndex=advanceStringIndex(p,toLength(h.lastIndex),g))}for(var w,P="",C=0,k=0;k<b.length;k++){_=b[k];for(var E=String(_[0]),S=gr(mr(toInteger(_.index),p.length),0),T=[],A=1;A<_.length;A++)T.push(void 0===(w=_[A])?w:String(w));var O=_.groups;if(d){var M=[E].concat(T,S,p);void 0!==O&&M.push(O);var V=String(i.apply(void 0,M))}else V=getSubstitution(E,p,S,T,O,i);S>=C&&(P+=p.slice(C,S)+V,C=S+E.length)}return P+p.slice(C)}];function getSubstitution(t,n,i,o,s,l){var u=i+t.length,h=o.length,p=xr;return void 0!==s&&(s=toObject(s),p=_r),e.call(l,p,(function(e,l){var p;switch(l.charAt(0)){case"$":return"$";case"&":return t;case"`":return n.slice(0,i);case"'":return n.slice(u);case"<":p=s[l.slice(1,-1)];break;default:var d=+l;if(0===d)return e;if(d>h){var v=br(d/10);return 0===v?e:v<=h?void 0===o[v-1]?l.charAt(1):o[v-1]+l.charAt(1):e}p=o[d-1]}return void 0===p?"":p}))}}));var wr="\t\n\v\f\r    \u2028\u2029\ufeff",Pr="["+wr+"]",Cr=RegExp("^"+Pr+Pr+"*"),kr=RegExp(Pr+Pr+"*$"),createMethod$2=function(t){return function(e){var n=String(requireObjectCoercible(e));return 1&t&&(n=n.replace(Cr,"")),2&t&&(n=n.replace(kr,"")),n}},Er={start:createMethod$2(1),end:createMethod$2(2),trim:createMethod$2(3)},Sr=Er.trim;_export({target:"String",proto:!0,forced:function(t){return fails((function(){return!!wr[t]()||"…"!="…"[t]()||wr[t].name!==t}))}("trim")},{trim:function trim(){return Sr(this)}});var Tr,Ar=Object.keys||function keys(t){return objectKeysInternal(t,nt)},Or=n?Object.defineProperties:function defineProperties(t,e){anObject(t);for(var n,i=Ar(e),o=i.length,s=0;o>s;)P.f(t,n=i[s++],e[n]);return t},Mr=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"<\/script>"},NullProtoObject=function(){try{Tr=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;NullProtoObject=Tr?function(t){t.write(scriptTag("")),t.close();var e=t.parentWindow.Object;return t=null,e}(Tr):((e=documentCreateElement("iframe")).style.display="none",ne.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F);for(var n=nt.length;n--;)delete NullProtoObject.prototype[nt[n]];return NullProtoObject()};N[Mr]=!0;var Vr=Object.create||function create(t,e){var n;return null!==t?(EmptyConstructor.prototype=anObject(t),n=new EmptyConstructor,EmptyConstructor.prototype=null,n[Mr]=t):n=NullProtoObject(),void 0===e?n:Or(n,e)},Br=it.f,Rr={}.toString,Ir="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],jr={f:function getOwnPropertyNames(t){return Ir&&"[object Window]"==Rr.call(t)?function(t){try{return Br(t)}catch(t){return Ir.slice()}}(t):Br(toIndexedObject(t))}},Nr={f:wellKnownSymbol},Dr=P.f,defineWellKnownSymbol=function(t){var e=Y.Symbol||(Y.Symbol={});has(e,t)||Dr(e,t,{value:Nr.f(t)})},Lr=[].push,createMethod$3=function(t){var e=1==t,n=2==t,i=3==t,o=4==t,s=6==t,l=5==t||s;return function(u,p,d,v){for(var g,b,_=toObject(u),w=h(_),P=functionBindContext(p,d,3),C=toLength(w.length),k=0,E=v||arraySpeciesCreate,S=e?E(u,C):n?E(u,0):void 0;C>k;k++)if((l||k in w)&&(b=P(g=w[k],k,_),t))if(e)S[k]=b;else if(b)switch(t){case 3:return!0;case 5:return g;case 6:return k;case 2:Lr.call(S,g)}else if(o)return!1;return s?-1:i||o?o:S}},Fr={forEach:createMethod$3(0),map:createMethod$3(1),filter:createMethod$3(2),some:createMethod$3(3),every:createMethod$3(4),find:createMethod$3(5),findIndex:createMethod$3(6)},Gr=Fr.forEach,zr=sharedKey("hidden"),Wr=wellKnownSymbol("toPrimitive"),Xr=q.set,$r=q.getterFor("Symbol"),Ur=Object.prototype,qr=e.Symbol,Hr=getBuiltIn("JSON","stringify"),Yr=_.f,Qr=P.f,Zr=jr.f,Jr=s.f,Kr=B("symbols"),tn=B("op-symbols"),en=B("string-to-symbol-registry"),rn=B("symbol-to-string-registry"),nn=B("wks"),an=e.QObject,on=!an||!an.prototype||!an.prototype.findChild,sn=n&&fails((function(){return 7!=Vr(Qr({},"a",{get:function(){return Qr(this,"a",{value:7}).a}})).a}))?function(t,e,n){var i=Yr(Ur,e);i&&delete Ur[e],Qr(t,e,n),i&&t!==Ur&&Qr(Ur,e,i)}:Qr,wrap=function(t,e){var i=Kr[t]=Vr(qr.prototype);return Xr(i,{type:"Symbol",tag:t,description:e}),n||(i.description=e),i},ln=gt?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof qr},un=function defineProperty(t,e,n){t===Ur&&un(tn,e,n),anObject(t);var i=toPrimitive(e,!0);return anObject(n),has(Kr,i)?(n.enumerable?(has(t,zr)&&t[zr][i]&&(t[zr][i]=!1),n=Vr(n,{enumerable:createPropertyDescriptor(0,!1)})):(has(t,zr)||Qr(t,zr,createPropertyDescriptor(1,{})),t[zr][i]=!0),sn(t,i,n)):Qr(t,i,n)},cn=function defineProperties(t,e){anObject(t);var i=toIndexedObject(e),o=Ar(i).concat(dn(i));return Gr(o,(function(e){n&&!hn.call(i,e)||un(t,e,i[e])})),t},hn=function propertyIsEnumerable(t){var e=toPrimitive(t,!0),n=Jr.call(this,e);return!(this===Ur&&has(Kr,e)&&!has(tn,e))&&(!(n||!has(this,e)||!has(Kr,e)||has(this,zr)&&this[zr][e])||n)},fn=function getOwnPropertyDescriptor(t,e){var n=toIndexedObject(t),i=toPrimitive(e,!0);if(n!==Ur||!has(Kr,i)||has(tn,i)){var o=Yr(n,i);return!o||!has(Kr,i)||has(n,zr)&&n[zr][i]||(o.enumerable=!0),o}},pn=function getOwnPropertyNames(t){var e=Zr(toIndexedObject(t)),n=[];return Gr(e,(function(t){has(Kr,t)||has(N,t)||n.push(t)})),n},dn=function getOwnPropertySymbols(t){var e=t===Ur,n=Zr(e?tn:toIndexedObject(t)),i=[];return Gr(n,(function(t){!has(Kr,t)||e&&!has(Ur,t)||i.push(Kr[t])})),i};if(yt||(H((qr=function Symbol(){if(this instanceof qr)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=uid(t),setter=function(t){this===Ur&&setter.call(tn,t),has(this,zr)&&has(this[zr],e)&&(this[zr][e]=!1),sn(this,e,createPropertyDescriptor(1,t))};return n&&on&&sn(Ur,e,{configurable:!0,set:setter}),wrap(e,t)}).prototype,"toString",(function toString(){return $r(this).tag})),H(qr,"withoutSetter",(function(t){return wrap(uid(t),t)})),s.f=hn,P.f=un,_.f=fn,it.f=jr.f=pn,ot.f=dn,Nr.f=function(t){return wrap(wellKnownSymbol(t),t)},n&&(Qr(qr.prototype,"description",{configurable:!0,get:function description(){return $r(this).description}}),H(Ur,"propertyIsEnumerable",hn,{unsafe:!0}))),_export({global:!0,wrap:!0,forced:!yt,sham:!yt},{Symbol:qr}),Gr(Ar(nn),(function(t){defineWellKnownSymbol(t)})),_export({target:"Symbol",stat:!0,forced:!yt},{for:function(t){var e=String(t);if(has(en,e))return en[e];var n=qr(e);return en[e]=n,rn[n]=e,n},keyFor:function keyFor(t){if(!ln(t))throw TypeError(t+" is not a symbol");if(has(rn,t))return rn[t]},useSetter:function(){on=!0},useSimple:function(){on=!1}}),_export({target:"Object",stat:!0,forced:!yt,sham:!n},{create:function create(t,e){return void 0===e?Vr(t):cn(Vr(t),e)},defineProperty:un,defineProperties:cn,getOwnPropertyDescriptor:fn}),_export({target:"Object",stat:!0,forced:!yt},{getOwnPropertyNames:pn,getOwnPropertySymbols:dn}),_export({target:"Object",stat:!0,forced:fails((function(){ot.f(1)}))},{getOwnPropertySymbols:function getOwnPropertySymbols(t){return ot.f(toObject(t))}}),Hr){var vn=!yt||fails((function(){var t=qr();return"[null]"!=Hr([t])||"{}"!=Hr({a:t})||"{}"!=Hr(Object(t))}));_export({target:"JSON",stat:!0,forced:vn},{stringify:function stringify(t,e,n){for(var i,o=[t],s=1;arguments.length>s;)o.push(arguments[s++]);if(i=e,(isObject(e)||void 0!==t)&&!ln(t))return vt(e)||(e=function(t,e){if("function"==typeof i&&(e=i.call(this,t,e)),!ln(e))return e}),o[1]=e,Hr.apply(null,o)}})}qr.prototype[Wr]||C(qr.prototype,Wr,qr.prototype.valueOf),setToStringTag(qr,"Symbol"),N[zr]=!0;var yn=P.f,gn=e.Symbol;if(n&&"function"==typeof gn&&(!("description"in gn.prototype)||void 0!==gn().description)){var mn={},bn=function Symbol(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof bn?new gn(t):void 0===t?gn():gn(t);return""===t&&(mn[e]=!0),e};copyConstructorProperties(bn,gn);var _n=bn.prototype=gn.prototype;_n.constructor=bn;var xn=_n.toString,wn="Symbol(test)"==String(gn("test")),Pn=/^Symbol\((.*)\)[^)]+$/;yn(_n,"description",{configurable:!0,get:function description(){var t=isObject(this)?this.valueOf():this,e=xn.call(t);if(has(mn,t))return"";var n=wn?e.slice(7,-1):e.replace(Pn,"$1");return""===n?void 0:n}}),_export({global:!0,forced:!0},{Symbol:bn})}defineWellKnownSymbol("asyncIterator"),defineWellKnownSymbol("iterator"),defineWellKnownSymbol("toStringTag");var Cn=Object.defineProperty,kn={},thrower=function(t){throw t},arrayMethodUsesToLength=function(t,e){if(has(kn,t))return kn[t];e||(e={});var i=[][t],o=!!has(e,"ACCESSORS")&&e.ACCESSORS,s=has(e,0)?e[0]:thrower,l=has(e,1)?e[1]:void 0;return kn[t]=!!i&&!fails((function(){if(o&&!n)return!0;var t={length:-1};o?Cn(t,1,{enumerable:!0,get:thrower}):t[1]=1,i.call(t,s,l)}))},En=Fr.forEach,Sn=arrayMethodIsStrict("forEach"),Tn=arrayMethodUsesToLength("forEach"),An=Sn&&Tn?[].forEach:function forEach(t){return En(this,t,arguments.length>1?arguments[1]:void 0)};_export({target:"Array",proto:!0,forced:[].forEach!=An},{forEach:An});var On=wellKnownSymbol("unscopables"),Mn=Array.prototype;null==Mn[On]&&P.f(Mn,On,{configurable:!0,value:Vr(null)});var Vn,Bn,Rn,addToUnscopables=function(t){Mn[On][t]=!0},In=!fails((function(){function F(){}return F.prototype.constructor=null,Object.getPrototypeOf(new F)!==F.prototype})),jn=sharedKey("IE_PROTO"),Nn=Object.prototype,Dn=In?Object.getPrototypeOf:function(t){return t=toObject(t),has(t,jn)?t[jn]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Nn:null},Ln=wellKnownSymbol("iterator"),Fn=!1;[].keys&&("next"in(Rn=[].keys())?(Bn=Dn(Dn(Rn)))!==Object.prototype&&(Vn=Bn):Fn=!0),null==Vn&&(Vn={}),has(Vn,Ln)||C(Vn,Ln,(function(){return this}));var Gn={IteratorPrototype:Vn,BUGGY_SAFARI_ITERATORS:Fn},zn=Gn.IteratorPrototype,returnThis$1=function(){return this},Wn=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),e=n instanceof Array}catch(t){}return function setPrototypeOf(n,i){return anObject(n),function(t){if(!isObject(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(i),e?t.call(n,i):n.__proto__=i,n}}():void 0),Xn=Gn.IteratorPrototype,$n=Gn.BUGGY_SAFARI_ITERATORS,Un=wellKnownSymbol("iterator"),returnThis$2=function(){return this},defineIterator=function(t,e,n,i,o,s,l){!function(t,e,n){var i=e+" Iterator";t.prototype=Vr(zn,{next:createPropertyDescriptor(1,n)}),setToStringTag(t,i,!1),Xt[i]=returnThis$1}(n,e,i);var u,h,p,getIterationMethod=function(t){if(t===o&&_)return _;if(!$n&&t in g)return g[t];switch(t){case"keys":return function keys(){return new n(this,t)};case"values":return function values(){return new n(this,t)};case"entries":return function entries(){return new n(this,t)}}return function(){return new n(this)}},d=e+" Iterator",v=!1,g=t.prototype,b=g[Un]||g["@@iterator"]||o&&g[o],_=!$n&&b||getIterationMethod(o),w="Array"==e&&g.entries||b;if(w&&(u=Dn(w.call(new t)),Xn!==Object.prototype&&u.next&&(Dn(u)!==Xn&&(Wn?Wn(u,Xn):"function"!=typeof u[Un]&&C(u,Un,returnThis$2)),setToStringTag(u,d,!0))),"values"==o&&b&&"values"!==b.name&&(v=!0,_=function values(){return b.call(this)}),g[Un]!==_&&C(g,Un,_),Xt[e]=_,o)if(h={values:getIterationMethod("values"),keys:s?_:getIterationMethod("keys"),entries:getIterationMethod("entries")},l)for(p in h)($n||v||!(p in g))&&H(g,p,h[p]);else _export({target:e,proto:!0,forced:$n||v},h);return h},qn=q.set,Hn=q.getterFor("Array Iterator"),Yn=defineIterator(Array,"Array",(function(t,e){qn(this,{type:"Array Iterator",target:toIndexedObject(t),index:0,kind:e})}),(function(){var t=Hn(this),e=t.target,n=t.kind,i=t.index++;return!e||i>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:i,done:!1}:"values"==n?{value:e[i],done:!1}:{value:[i,e[i]],done:!1}}),"values");Xt.Arguments=Xt.Array,addToUnscopables("keys"),addToUnscopables("values"),addToUnscopables("entries");var Qn=[].reverse,Zn=[1,2];_export({target:"Array",proto:!0,forced:String(Zn)===String(Zn.reverse())},{reverse:function reverse(){return vt(this)&&(this.length=this.length),Qn.call(this)}});var Jn=arrayMethodHasSpeciesSupport("slice"),Kn=arrayMethodUsesToLength("slice",{ACCESSORS:!0,0:0,1:2}),ta=wellKnownSymbol("species"),ea=[].slice,ra=Math.max;_export({target:"Array",proto:!0,forced:!Jn||!Kn},{slice:function slice(t,e){var n,i,o,s=toIndexedObject(this),l=toLength(s.length),u=toAbsoluteIndex(t,l),h=toAbsoluteIndex(void 0===e?l:e,l);if(vt(s)&&("function"!=typeof(n=s.constructor)||n!==Array&&!vt(n.prototype)?isObject(n)&&null===(n=n[ta])&&(n=void 0):n=void 0,n===Array||void 0===n))return ea.call(s,u,h);for(i=new(void 0===n?Array:n)(ra(h-u,0)),o=0;u<h;u++,o++)u in s&&createProperty(i,o,s[u]);return i.length=o,i}});var na=Date.prototype,aa=na.toString,ia=na.getTime;new Date(NaN)+""!="Invalid Date"&&H(na,"toString",(function toString(){var t=ia.call(this);return t==t?aa.call(this):"Invalid Date"}));var oa=P.f,sa=Function.prototype,la=sa.toString,ua=/^\s*function ([^ (]*)/;n&&!("name"in sa)&&oa(sa,"name",{configurable:!0,get:function(){try{return la.call(this).match(ua)[1]}catch(t){return""}}}),setToStringTag(e.JSON,"JSON",!0),setToStringTag(Math,"Math",!0),_export({target:"Object",stat:!0,sham:!n},{create:Vr}),_export({target:"Object",stat:!0,forced:!n,sham:!n},{defineProperty:P.f});var ca=fails((function(){Dn(1)}));_export({target:"Object",stat:!0,forced:ca,sham:!In},{getPrototypeOf:function getPrototypeOf(t){return Dn(toObject(t))}}),_export({target:"Object",stat:!0},{setPrototypeOf:Wn});var ha=RegExp.prototype,fa=ha.toString,pa=fails((function(){return"/a/b"!=fa.call({source:"a",flags:"b"})})),da="toString"!=fa.name;(pa||da)&&H(RegExp.prototype,"toString",(function toString(){var t=anObject(this),e=String(t.source),n=t.flags;return"/"+e+"/"+String(void 0===n&&t instanceof RegExp&&!("flags"in ha)?regexpFlags.call(t):n)}),{unsafe:!0});var va=vr.charAt,ya=q.set,ga=q.getterFor("String Iterator");defineIterator(String,"String",(function(t){ya(this,{type:"String Iterator",string:String(t),index:0})}),(function next(){var t,e=ga(this),n=e.string,i=e.index;return i>=n.length?{value:void 0,done:!0}:(t=va(n,i),e.index+=t.length,{value:t,done:!1})}));var ma={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0};for(var ba in ma){var _a=e[ba],xa=_a&&_a.prototype;if(xa&&xa.forEach!==An)try{C(xa,"forEach",An)}catch(t){xa.forEach=An}}var wa=wellKnownSymbol("iterator"),Pa=wellKnownSymbol("toStringTag"),Ca=Yn.values;for(var ka in ma){var Ea=e[ka],Sa=Ea&&Ea.prototype;if(Sa){if(Sa[wa]!==Ca)try{C(Sa,wa,Ca)}catch(t){Sa[wa]=Ca}if(Sa[Pa]||C(Sa,Pa,ka),ma[ka])for(var Ta in Yn)if(Sa[Ta]!==Yn[Ta])try{C(Sa,Ta,Yn[Ta])}catch(t){Sa[Ta]=Yn[Ta]}}}function _typeof(t){return(_typeof="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})(t)}function asyncGeneratorStep(t,e,n,i,o,s,l){try{var u=t[s](l),h=u.value}catch(t){return void n(t)}u.done?e(h):Promise.resolve(h).then(i,o)}function _asyncToGenerator(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var s=t.apply(e,n);function _next(t){asyncGeneratorStep(s,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(s,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,e){return t.__proto__=e,t})(t,e)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function _construct(t,e,n){return(_construct=_isNativeReflectConstruct()?Reflect.construct:function _construct(t,e,n){var i=[null];i.push.apply(i,e);var o=new(Function.bind.apply(t,i));return n&&_setPrototypeOf(o,n.prototype),o}).apply(null,arguments)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _possibleConstructorReturn(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?_assertThisInitialized(t):e}function _createSuper(t){var e=_isNativeReflectConstruct();return function _createSuperInternal(){var n,i=_getPrototypeOf(t);if(e){var o=_getPrototypeOf(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return _possibleConstructorReturn(this,n)}}function _get(t,e,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,e,n){var i=function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}(t,e);if(i){var o=Object.getOwnPropertyDescriptor(i,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function _slicedToArray(t,e){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],i=!0,o=!1,s=void 0;try{for(var l,u=t[Symbol.iterator]();!(i=(l=u.next()).done)&&(n.push(l.value),!e||n.length!==e);i=!0);}catch(t){o=!0,s=t}finally{try{i||null==u.return||u.return()}finally{if(o)throw s}}return n}(t,e)||_unsupportedIterableToArray(t,e)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}createCommonjsModule((function(t){var e=function(t){var e,n=Object.prototype,i=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function define(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{define({},"")}catch(t){define=function define(t,e,n){return t[e]=n}}function wrap(t,e,n,i){var o=e&&e.prototype instanceof Generator?e:Generator,s=Object.create(o.prototype),l=new Context(i||[]);return s._invoke=function makeInvokeMethod(t,e,n){var i=h;return function invoke(o,s){if(i===d)throw new Error("Generator is already running");if(i===v){if("throw"===o)throw s;return doneResult()}for(n.method=o,n.arg=s;;){var l=n.delegate;if(l){var u=maybeInvokeDelegate(l,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===h)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=d;var b=tryCatch(t,e,n);if("normal"===b.type){if(i=n.done?v:p,b.arg===g)continue;return{value:b.arg,done:n.done}}"throw"===b.type&&(i=v,n.method="throw",n.arg=b.arg)}}}(t,n,l),s}function tryCatch(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var h="suspendedStart",p="suspendedYield",d="executing",v="completed",g={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var b={};b[s]=function(){return this};var _=Object.getPrototypeOf,w=_&&_(_(values([])));w&&w!==n&&i.call(w,s)&&(b=w);var P=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(b);function defineIteratorMethods(t){["next","throw","return"].forEach((function(e){define(t,e,(function(t){return this._invoke(e,t)}))}))}function AsyncIterator(t,e){var n;this._invoke=function enqueue(o,s){function callInvokeWithMethodAndArg(){return new e((function(n,l){!function invoke(n,o,s,l){var u=tryCatch(t[n],t,o);if("throw"!==u.type){var h=u.arg,p=h.value;return p&&"object"===_typeof(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){invoke("next",t,s,l)}),(function(t){invoke("throw",t,s,l)})):e.resolve(p).then((function(t){h.value=t,s(h)}),(function(t){return invoke("throw",t,s,l)}))}l(u.arg)}(o,s,n,l)}))}return n=n?n.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,n){var i=t.iterator[n.method];if(i===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,maybeInvokeDelegate(t,n),"throw"===n.method))return g;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var o=tryCatch(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,l=function next(){for(;++o<t.length;)if(i.call(t,o))return next.value=t[o],next.done=!1,next;return next.value=e,next.done=!0,next};return l.next=l}}return{next:doneResult}}function doneResult(){return{value:e,done:!0}}return GeneratorFunction.prototype=P.constructor=GeneratorFunctionPrototype,GeneratorFunctionPrototype.constructor=GeneratorFunction,GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(P),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),AsyncIterator.prototype[l]=function(){return this},t.AsyncIterator=AsyncIterator,t.async=function(e,n,i,o,s){void 0===s&&(s=Promise);var l=new AsyncIterator(wrap(e,n,i,o),s);return t.isGeneratorFunction(n)?l:l.next().then((function(t){return t.done?t.value:l.next()}))},defineIteratorMethods(P),define(P,u,"Generator"),P[s]=function(){return this},P.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function next(){for(;e.length;){var n=e.pop();if(n in t)return next.value=n,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(resetTryEntry),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var n=this;function handle(i,o){return l.type="throw",l.arg=t,n.next=i,o&&(n.method="next",n.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],l=s.completion;if("root"===s.tryLoc)return handle("end");if(s.tryLoc<=this.prev){var u=i.call(s,"catchLoc"),h=i.call(s,"finallyLoc");if(u&&h){if(this.prev<s.catchLoc)return handle(s.catchLoc,!0);if(this.prev<s.finallyLoc)return handle(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return handle(s.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return handle(s.finallyLoc)}}}},abrupt:function abrupt(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var s=o;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var l=s?s.completion:{};return l.type=t,l.arg=e,s?(this.method="next",this.next=s.finallyLoc,g):this.complete(l)},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),resetTryEntry(n),g}},catch:function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,n,i){return this.delegate={iterator:values(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));var Aa=Fr.every,Oa=arrayMethodIsStrict("every"),Ma=arrayMethodUsesToLength("every");_export({target:"Array",proto:!0,forced:!Oa||!Ma},{every:function every(t){return Aa(this,t,arguments.length>1?arguments[1]:void 0)}});_export({target:"Array",proto:!0},{fill:function fill(t){for(var e=toObject(this),n=toLength(e.length),i=arguments.length,o=toAbsoluteIndex(i>1?arguments[1]:void 0,n),s=i>2?arguments[2]:void 0,l=void 0===s?n:toAbsoluteIndex(s,n);l>o;)e[o++]=t;return e}}),addToUnscopables("fill");var Va=Fr.filter,Ba=arrayMethodHasSpeciesSupport("filter"),Ra=arrayMethodUsesToLength("filter");_export({target:"Array",proto:!0,forced:!Ba||!Ra},{filter:function filter(t){return Va(this,t,arguments.length>1?arguments[1]:void 0)}});var Ia=et.includes,ja=arrayMethodUsesToLength("indexOf",{ACCESSORS:!0,1:0});_export({target:"Array",proto:!0,forced:!ja},{includes:function includes(t){return Ia(this,t,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables("includes");var Na=et.indexOf,Da=[].indexOf,La=!!Da&&1/[1].indexOf(1,-0)<0,Fa=arrayMethodIsStrict("indexOf"),Ga=arrayMethodUsesToLength("indexOf",{ACCESSORS:!0,1:0});_export({target:"Array",proto:!0,forced:La||!Fa||!Ga},{indexOf:function indexOf(t){return La?Da.apply(this,arguments)||0:Na(this,t,arguments.length>1?arguments[1]:void 0)}});var za=Fr.map,Wa=arrayMethodHasSpeciesSupport("map"),Xa=arrayMethodUsesToLength("map");_export({target:"Array",proto:!0,forced:!Wa||!Xa},{map:function map(t){return za(this,t,arguments.length>1?arguments[1]:void 0)}});var inheritIfRequired=function(t,e,n){var i,o;return Wn&&"function"==typeof(i=e.constructor)&&i!==n&&isObject(o=i.prototype)&&o!==n.prototype&&Wn(t,o),t},$a=it.f,Ua=_.f,qa=P.f,Ha=Er.trim,Ya=e.Number,Qa=Ya.prototype,Za="Number"==classofRaw(Vr(Qa)),toNumber=function(t){var e,n,i,o,s,l,u,h,p=toPrimitive(t,!1);if("string"==typeof p&&p.length>2)if(43===(e=(p=Ha(p)).charCodeAt(0))||45===e){if(88===(n=p.charCodeAt(2))||120===n)return NaN}else if(48===e){switch(p.charCodeAt(1)){case 66:case 98:i=2,o=49;break;case 79:case 111:i=8,o=55;break;default:return+p}for(l=(s=p.slice(2)).length,u=0;u<l;u++)if((h=s.charCodeAt(u))<48||h>o)return NaN;return parseInt(s,i)}return+p};if(pt("Number",!Ya(" 0o1")||!Ya("0b1")||Ya("+0x1"))){for(var Ja,Ka=function Number(t){var e=arguments.length<1?0:t,n=this;return n instanceof Ka&&(Za?fails((function(){Qa.valueOf.call(n)})):"Number"!=classofRaw(n))?inheritIfRequired(new Ya(toNumber(e)),n,Ka):toNumber(e)},ti=n?$a(Ya):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),ei=0;ti.length>ei;ei++)has(Ya,Ja=ti[ei])&&!has(Ka,Ja)&&qa(Ka,Ja,Ua(Ya,Ja));Ka.prototype=Qa,Qa.constructor=Ka,H(e,"Number",Ka)}var ri=Er.trim,ni=e.parseFloat,ai=1/ni(wr+"-0")!=-1/0?function parseFloat(t){var e=ri(String(t)),n=ni(e);return 0===n&&"-"==e.charAt(0)?-0:n}:ni;_export({target:"Number",stat:!0,forced:Number.parseFloat!=ai},{parseFloat:ai});var ii=Er.trim,oi=e.parseInt,si=/^[+-]?0[Xx]/,li=8!==oi(wr+"08")||22!==oi(wr+"0x16")?function parseInt(t,e){var n=ii(String(t));return oi(n,e>>>0||(si.test(n)?16:10))}:oi;_export({target:"Number",stat:!0,forced:Number.parseInt!=li},{parseInt:li});var ui=Object.assign,ci=Object.defineProperty,hi=!ui||fails((function(){if(n&&1!==ui({b:1},ui(ci({},"a",{enumerable:!0,get:function(){ci(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},i=Symbol(),o="abcdefghijklmnopqrst";return t[i]=7,o.split("").forEach((function(t){e[t]=t})),7!=ui({},t)[i]||Ar(ui({},e)).join("")!=o}))?function assign(t,e){for(var i=toObject(t),o=arguments.length,l=1,u=ot.f,p=s.f;o>l;)for(var d,v=h(arguments[l++]),g=u?Ar(v).concat(u(v)):Ar(v),b=g.length,_=0;b>_;)d=g[_++],n&&!p.call(v,d)||(i[d]=v[d]);return i}:ui;_export({target:"Object",stat:!0,forced:Object.assign!==hi},{assign:hi});var fi=s.f,createMethod$4=function(t){return function(e){for(var i,o=toIndexedObject(e),s=Ar(o),l=s.length,u=0,h=[];l>u;)i=s[u++],n&&!fi.call(o,i)||h.push(t?[i,o[i]]:o[i]);return h}},pi={entries:createMethod$4(!0),values:createMethod$4(!1)}.entries;_export({target:"Object",stat:!0},{entries:function entries(t){return pi(t)}});var di,vi=wellKnownSymbol("match"),isRegexp=function(t){var e;return isObject(t)&&(void 0!==(e=t[vi])?!!e:"RegExp"==classofRaw(t))},notARegexp=function(t){if(isRegexp(t))throw TypeError("The method doesn't accept regular expressions");return t},yi=wellKnownSymbol("match"),correctIsRegexpLogic=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[yi]=!1,"/./"[t](e)}catch(t){}}return!1},gi=_.f,mi="".endsWith,bi=Math.min,_i=correctIsRegexpLogic("endsWith"),xi=!(_i||(di=gi(String.prototype,"endsWith"),!di||di.writable));_export({target:"String",proto:!0,forced:!xi&&!_i},{endsWith:function endsWith(t){var e=String(requireObjectCoercible(this));notARegexp(t);var n=arguments.length>1?arguments[1]:void 0,i=toLength(e.length),o=void 0===n?i:bi(toLength(n),i),s=String(t);return mi?mi.call(e,s,o):e.slice(o-s.length,o)===s}}),_export({target:"String",proto:!0,forced:!correctIsRegexpLogic("includes")},{includes:function includes(t){return!!~String(requireObjectCoercible(this)).indexOf(notARegexp(t),arguments.length>1?arguments[1]:void 0)}}),fixRegexpWellKnownSymbolLogic("match",1,(function(t,e,n){return[function match(e){var n=requireObjectCoercible(this),i=null==e?void 0:e[t];return void 0!==i?i.call(e,n):new RegExp(e)[t](String(n))},function(t){var i=n(e,t,this);if(i.done)return i.value;var o=anObject(t),s=String(this);if(!o.global)return regexpExecAbstract(o,s);var l=o.unicode;o.lastIndex=0;for(var u,h=[],p=0;null!==(u=regexpExecAbstract(o,s));){var d=String(u[0]);h[p]=d,""===d&&(o.lastIndex=advanceStringIndex(s,toLength(o.lastIndex),l)),p++}return 0===p?null:h}]}));var wi=[].push,Pi=Math.min,Ci=!fails((function(){return!RegExp(4294967295,"y")}));fixRegexpWellKnownSymbolLogic("split",2,(function(t,e,n){var i;return i="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,n){var i=String(requireObjectCoercible(this)),o=void 0===n?4294967295:n>>>0;if(0===o)return[];if(void 0===t)return[i];if(!isRegexp(t))return e.call(i,t,o);for(var s,l,u,h=[],p=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),d=0,v=new RegExp(t.source,p+"g");(s=lr.call(v,i))&&!((l=v.lastIndex)>d&&(h.push(i.slice(d,s.index)),s.length>1&&s.index<i.length&&wi.apply(h,s.slice(1)),u=s[0].length,d=l,h.length>=o));)v.lastIndex===s.index&&v.lastIndex++;return d===i.length?!u&&v.test("")||h.push(""):h.push(i.slice(d)),h.length>o?h.slice(0,o):h}:"0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:e.call(this,t,n)}:e,[function split(e,n){var o=requireObjectCoercible(this),s=null==e?void 0:e[t];return void 0!==s?s.call(e,o,n):i.call(String(o),e,n)},function(t,o){var s=n(i,t,this,o,i!==e);if(s.done)return s.value;var l=anObject(t),u=String(this),h=speciesConstructor(l,RegExp),p=l.unicode,d=(l.ignoreCase?"i":"")+(l.multiline?"m":"")+(l.unicode?"u":"")+(Ci?"y":"g"),v=new h(Ci?l:"^(?:"+l.source+")",d),g=void 0===o?4294967295:o>>>0;if(0===g)return[];if(0===u.length)return null===regexpExecAbstract(v,u)?[u]:[];for(var b=0,_=0,w=[];_<u.length;){v.lastIndex=Ci?_:0;var P,C=regexpExecAbstract(v,Ci?u:u.slice(_));if(null===C||(P=Pi(toLength(v.lastIndex+(Ci?0:_)),u.length))===b)_=advanceStringIndex(u,_,p);else{if(w.push(u.slice(b,_)),w.length===g)return w;for(var k=1;k<=C.length-1;k++)if(w.push(C[k]),w.length===g)return w;_=b=P}}return w.push(u.slice(b)),w}]}),!Ci);var ki=_.f,Ei="".startsWith,Si=Math.min,Ti=correctIsRegexpLogic("startsWith"),Ai=!Ti&&!!function(){var t=ki(String.prototype,"startsWith");return t&&!t.writable}();_export({target:"String",proto:!0,forced:!Ai&&!Ti},{startsWith:function startsWith(t){var e=String(requireObjectCoercible(this));notARegexp(t);var n=toLength(Si(arguments.length>1?arguments[1]:void 0,e.length)),i=String(t);return Ei?Ei.call(e,i,n):e.slice(n,n+i.length)===i}});var flattenIntoArray=function(t,e,n,i,o,s,l,u){for(var h,p=o,d=0,v=!!l&&functionBindContext(l,u,3);d<i;){if(d in n){if(h=v?v(n[d],d,e):n[d],s>0&&vt(h))p=flattenIntoArray(t,e,h,toLength(h.length),p,s-1)-1;else{if(p>=9007199254740991)throw TypeError("Exceed the acceptable array length");t[p]=h}p++}d++}return p},Oi=flattenIntoArray;_export({target:"Array",proto:!0},{flatMap:function flatMap(t){var e,n=toObject(this),i=toLength(n.length);return aFunction$1(t),(e=arraySpeciesCreate(n,0)).length=Oi(e,n,n,i,0,1,t,arguments.length>1?arguments[1]:void 0),e}}),addToUnscopables("flatMap");var Mi=fails((function(){Ar(1)}));_export({target:"Object",stat:!0,forced:Mi},{keys:function keys(t){return Ar(toObject(t))}});
/**
* For parsing color values.
* @module RGBColor
* @author Stoyan Stefanov <sstoo@gmail.com>
* @see https://www.phpied.com/rgb-color-parser-in-javascript/
* @license MIT
*/
var Vi={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"},Bi=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function process(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return n.map((function(t){return Number.parseInt(t)}))}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function process(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return n.map((function(t){return Number.parseInt(t,16)}))}},{re:/^(\w)(\w)(\w)$/,example:["#fb0","f0f"],process:function process(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return n.map((function(t){return Number.parseInt(t+t,16)}))}}],Ri=function(){function RGBColor(t){var e=this;_classCallCheck(this,RGBColor),this.ok=!1,"#"===t.charAt(0)&&(t=t.substr(1,6)),(t=(t=t.replace(/ /g,"")).toLowerCase())in Vi&&(t=Vi[t]),Bi.forEach((function(n){var i=n.re,o=n.process,s=i.exec(t);if(s){var l=_slicedToArray(o.apply(void 0,_toConsumableArray(s)),3),u=l[0],h=l[1],p=l[2];Object.assign(e,{r:u,g:h,b:p}),e.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}return _createClass(RGBColor,[{key:"toRGB",value:function toRGB(){return"rgb("+this.r+", "+this.g+", "+this.b+")"}},{key:"toHex",value:function toHex(){var t=this.r.toString(16),e=this.g.toString(16),n=this.b.toString(16);return 1===t.length&&(t="0"+t),1===e.length&&(e="0"+e),1===n.length&&(n="0"+n),"#"+t+e+n}}],[{key:"getHelpXML",value:function getHelpXML(){var t=[].concat(_toConsumableArray(Bi.flatMap((function(t){return t.example}))),_toConsumableArray(Object.keys(Vi))),e=document.createElement("ul");return e.setAttribute("id","rgbcolor-examples"),e.append.apply(e,_toConsumableArray(t.map((function(t){try{var e=document.createElement("li"),n=new RGBColor(t),i=document.createElement("div");i.style.cssText="\n margin: 3px;\n border: 1px solid black;\n background: ".concat(n.toHex(),";\n color: ").concat(n.toHex(),";"),i.append("test");var o=" ".concat(t," -> ").concat(n.toRGB()," -> ").concat(n.toHex());return e.append(i,o),e}catch(t){return""}})))),e}}]),RGBColor}();function _typeof$1(t){return(_typeof$1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Ii=[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],ji=[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 processCanvasRGBA(t,e,n,i,o,s){if(!(isNaN(s)||s<1)){s|=0;var l=function getImageDataFromCanvas(t,e,n,i,o){if("string"==typeof t&&(t=document.getElementById(t)),!t||"object"!==_typeof$1(t)||!("getContext"in t))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var s=t.getContext("2d");try{return s.getImageData(e,n,i,o)}catch(t){throw new Error("unable to access image data: "+t)}}(t,e,n,i,o);l=function processImageDataRGBA(t,e,n,i,o,s){var l,u,h,p,d,v,g,b,_,w,P,C,k,E,S,T,A,O,M,V,B,R,I,j,N,D=t.data,L=2*s+1,G=i-1,z=o-1,W=s+1,X=W*(W+1)/2,$=new Ni,U=$;for(h=1;h<L;h++)U=U.next=new Ni,h===W&&(N=U);U.next=$;var q=null,H=null;g=v=0;var Y=Ii[s],Q=ji[s];for(u=0;u<o;u++){for(T=A=O=M=b=_=w=P=0,C=W*(V=D[v]),k=W*(B=D[v+1]),E=W*(R=D[v+2]),S=W*(I=D[v+3]),b+=X*V,_+=X*B,w+=X*R,P+=X*I,U=$,h=0;h<W;h++)U.r=V,U.g=B,U.b=R,U.a=I,U=U.next;for(h=1;h<W;h++)p=v+((G<h?G:h)<<2),b+=(U.r=V=D[p])*(j=W-h),_+=(U.g=B=D[p+1])*j,w+=(U.b=R=D[p+2])*j,P+=(U.a=I=D[p+3])*j,T+=V,A+=B,O+=R,M+=I,U=U.next;for(q=$,H=N,l=0;l<i;l++)D[v+3]=I=P*Y>>Q,0!==I?(I=255/I,D[v]=(b*Y>>Q)*I,D[v+1]=(_*Y>>Q)*I,D[v+2]=(w*Y>>Q)*I):D[v]=D[v+1]=D[v+2]=0,b-=C,_-=k,w-=E,P-=S,C-=q.r,k-=q.g,E-=q.b,S-=q.a,p=g+((p=l+s+1)<G?p:G)<<2,b+=T+=q.r=D[p],_+=A+=q.g=D[p+1],w+=O+=q.b=D[p+2],P+=M+=q.a=D[p+3],q=q.next,C+=V=H.r,k+=B=H.g,E+=R=H.b,S+=I=H.a,T-=V,A-=B,O-=R,M-=I,H=H.next,v+=4;g+=i}for(l=0;l<i;l++){for(A=O=M=T=_=w=P=b=0,C=W*(V=D[v=l<<2]),k=W*(B=D[v+1]),E=W*(R=D[v+2]),S=W*(I=D[v+3]),b+=X*V,_+=X*B,w+=X*R,P+=X*I,U=$,h=0;h<W;h++)U.r=V,U.g=B,U.b=R,U.a=I,U=U.next;for(d=i,h=1;h<=s;h++)v=d+l<<2,b+=(U.r=V=D[v])*(j=W-h),_+=(U.g=B=D[v+1])*j,w+=(U.b=R=D[v+2])*j,P+=(U.a=I=D[v+3])*j,T+=V,A+=B,O+=R,M+=I,U=U.next,h<z&&(d+=i);for(v=l,q=$,H=N,u=0;u<o;u++)D[(p=v<<2)+3]=I=P*Y>>Q,I>0?(I=255/I,D[p]=(b*Y>>Q)*I,D[p+1]=(_*Y>>Q)*I,D[p+2]=(w*Y>>Q)*I):D[p]=D[p+1]=D[p+2]=0,b-=C,_-=k,w-=E,P-=S,C-=q.r,k-=q.g,E-=q.b,S-=q.a,p=l+((p=u+W)<z?p:z)*i<<2,b+=T+=q.r=D[p],_+=A+=q.g=D[p+1],w+=O+=q.b=D[p+2],P+=M+=q.a=D[p+3],q=q.next,C+=V=H.r,k+=B=H.g,E+=R=H.b,S+=I=H.a,T-=V,A-=B,O-=R,M-=I,H=H.next,v+=i}return t}(l,0,0,i,o,s),t.getContext("2d").putImageData(l,e,n)}}var Ni=function BlurStack(){!function _classCallCheck$1(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,BlurStack),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null},Di=function isNullish(t){return null==t},Li=function canvg(t,e,n){if(Di(t)&&Di(e)&&Di(n)){var i=document.querySelectorAll("svg");return Promise.all(_toConsumableArray(i).map((function(t){var e=document.createElement("canvas");e.width=t.clientWidth,e.height=t.clientHeight,t.before(e),t.remove();var n=document.createElement("div");return n.append(t),canvg(e,n.innerHTML)})))}"string"==typeof t&&(t=document.getElementById(t)),Di(t.svg)||t.svg.stop();var o=function build(t){var e={opts:t,FRAMERATE:30,MAX_VIRTUAL_PIXELS:3e4,log:function(t){}};!0===e.opts.log&&"undefined"!=typeof console&&(e.log=function(t){console.log(t)});e.init=function(t){var n=0;e.UniqueId=function(){return"canvg"+ ++n},e.Definitions={},e.Styles={},e.Animations=[],e.Images=[],e.ctx=t,e.ViewPort={viewPorts:[],Clear:function Clear(){this.viewPorts=[]},SetCurrent:function SetCurrent(t,e){this.viewPorts.push({width:t,height:e})},RemoveCurrent:function RemoveCurrent(){this.viewPorts.pop()},Current:function Current(){return this.viewPorts[this.viewPorts.length-1]},width:function width(){return this.Current().width},height:function height(){return this.Current().height},ComputeSize:function ComputeSize(t){return Di(t)||"number"!=typeof t?"x"===t?this.width():"y"===t?this.height():Math.sqrt(Math.pow(this.width(),2)+Math.pow(this.height(),2))/Math.sqrt(2):t}}},e.init(),e.ImagesLoaded=function(){return e.Images.every((function(t){return t.loaded}))},e.trim=function(t){return t.replace(/^\s+|\s+$/g,"")},e.compressSpaces=function(t){return t.replace(/\s+/gm," ")},e.ajax=function(t,e){var n=window.XMLHttpRequest?new XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");return e?new Promise((function(e,i){n.open("GET",t,!0).addEventListener("load",(function(){e(n.responseText)})),n.send(null)})):(n.open("GET",t,!1),n.send(null),n.responseText)},e.parseXml=function(t){if(window.DOMParser)return(new DOMParser).parseFromString(t,"text/xml");t=t.replace(/<!DOCTYPE svg[^>]*>/,"");var e=new window.ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e};var n={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"};e.Property=function(){function Property(t,e){_classCallCheck(this,Property),this.name=t,this.value=e}return _createClass(Property,[{key:"getValue",value:function getValue(){return this.value}},{key:"hasValue",value:function hasValue(){return!Di(this.value)&&""!==this.value}},{key:"numValue",value:function numValue(){if(!this.hasValue())return 0;var t=Number.parseFloat(this.value);return String(this.value).endsWith("%")&&(t/=100),t}},{key:"valueOrDefault",value:function valueOrDefault(t){return this.hasValue()?this.value:t}},{key:"numValueOrDefault",value:function numValueOrDefault(t){return this.hasValue()?this.numValue():t}},{key:"addOpacity",value:function addOpacity(t){var n=this.value;if(!Di(t.value)&&""!==t.value&&"string"==typeof this.value){var i=new Ri(this.value);i.ok&&(n="rgba("+i.r+", "+i.g+", "+i.b+", "+t.numValue()+")")}return new e.Property(this.name,n)}},{key:"getDefinition",value:function getDefinition(){var t=this.value.match(/#([^)'"]+)/);return t&&(t=t[1]),t||(t=this.value),e.Definitions[t]}},{key:"isUrlDefinition",value:function isUrlDefinition(){return this.value.startsWith("url(")}},{key:"getFillStyleDefinition",value:function getFillStyleDefinition(t,n){var i=this.getDefinition();if(!Di(i)&&i.createGradient)return i.createGradient(e.ctx,t,n);if(!Di(i)&&i.createPattern){if(i.getHrefAttribute().hasValue()){var o=i.attribute("patternTransform");i=i.getHrefAttribute().getDefinition(),o.hasValue()&&(i.attribute("patternTransform",!0).value=o.value)}return i.createPattern(e.ctx,t)}return null}},{key:"getDPI",value:function getDPI(t){return 96}},{key:"getEM",value:function getEM(t){var n=12,i=new e.Property("fontSize",e.Font.Parse(e.ctx.font).fontSize);return i.hasValue()&&(n=i.toPixels(t)),n}},{key:"getUnits",value:function getUnits(){return String(this.value).replace(/[\d.-]/g,"")}},{key:"toPixels",value:function toPixels(t,n){if(!this.hasValue())return 0;var i=String(this.value);if(i.endsWith("em"))return this.numValue()*this.getEM(t);if(i.endsWith("ex"))return this.numValue()*this.getEM(t)/2;if(i.endsWith("px"))return this.numValue();if(i.endsWith("pt"))return this.numValue()*this.getDPI(t)*(1/72);if(i.endsWith("pc"))return 15*this.numValue();if(i.endsWith("cm"))return this.numValue()*this.getDPI(t)/2.54;if(i.endsWith("mm"))return this.numValue()*this.getDPI(t)/25.4;if(i.endsWith("in"))return this.numValue()*this.getDPI(t);if(i.endsWith("%"))return this.numValue()*e.ViewPort.ComputeSize(t);var o=this.numValue();return n&&o<1?o*e.ViewPort.ComputeSize(t):o}},{key:"toMilliseconds",value:function toMilliseconds(){if(!this.hasValue())return 0;var t=String(this.value);return t.endsWith("ms")?this.numValue():t.endsWith("s")?1e3*this.numValue():this.numValue()}},{key:"toRadians",value:function toRadians(){if(!this.hasValue())return 0;var t=String(this.value);return t.endsWith("deg")?this.numValue()*(Math.PI/180):t.endsWith("grad")?this.numValue()*(Math.PI/200):t.endsWith("rad")?this.numValue():this.numValue()*(Math.PI/180)}},{key:"toTextBaseline",value:function toTextBaseline(){return this.hasValue()?n[this.value]:null}}]),Property}(),e.Font={Styles:"normal|italic|oblique|inherit",Variants:"normal|small-caps|inherit",Weights:"normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit",CreateFont:function CreateFont(t,n,i,o,s,l){var u=Di(l)?this.CreateFont("","","","","",e.ctx.font):this.Parse(l);return{fontFamily:s||u.fontFamily,fontSize:o||u.fontSize,fontStyle:t||u.fontStyle,fontWeight:i||u.fontWeight,fontVariant:n||u.fontVariant,toString:function toString(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}},Parse:function Parse(t){var n=this,i={},o=e.trim(e.compressSpaces(t||"")).split(" "),s={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},l="";return o.forEach((function(t){!s.fontStyle&&n.Styles.includes(t)?("inherit"!==t&&(i.fontStyle=t),s.fontStyle=!0):!s.fontVariant&&n.Variants.includes(t)?("inherit"!==t&&(i.fontVariant=t),s.fontStyle=s.fontVariant=!0):!s.fontWeight&&n.Weights.includes(t)?("inherit"!==t&&(i.fontWeight=t),s.fontStyle=s.fontVariant=s.fontWeight=!0):s.fontSize?"inherit"!==t&&(l+=t):("inherit"!==t&&(i.fontSize=t.split("/")[0]),s.fontStyle=s.fontVariant=s.fontWeight=s.fontSize=!0)})),""!==l&&(i.fontFamily=l),i}},e.ToNumberArray=function(t){return e.trim(e.compressSpaces((t||"").replace(/,/g," "))).split(" ").map((function(t){return Number.parseFloat(t)}))},e.Point=function(){function _class(t,e){_classCallCheck(this,_class),this.x=t,this.y=e}return _createClass(_class,[{key:"angleTo",value:function angleTo(t){return Math.atan2(t.y-this.y,t.x-this.x)}},{key:"applyTransform",value:function applyTransform(t){var e=this.x*t[0]+this.y*t[2]+t[4],n=this.x*t[1]+this.y*t[3]+t[5];this.x=e,this.y=n}}]),_class}(),e.CreatePoint=function(t){var n=e.ToNumberArray(t);return new e.Point(n[0],n[1])},e.CreatePath=function(t){for(var n=e.ToNumberArray(t),i=[],o=0;o<n.length;o+=2)i.push(new e.Point(n[o],n[o+1]));return i},e.BoundingBox=function(){function _class2(t,e,n,i){_classCallCheck(this,_class2),this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(t,e),this.addPoint(n,i)}return _createClass(_class2,[{key:"x",value:function x(){return this.x1}},{key:"y",value:function y(){return this.y1}},{key:"width",value:function width(){return this.x2-this.x1}},{key:"height",value:function height(){return this.y2-this.y1}},{key:"addPoint",value:function addPoint(t,e){Di(t)||((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),t<this.x1&&(this.x1=t),t>this.x2&&(this.x2=t)),Di(e)||((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))}},{key:"addX",value:function addX(t){this.addPoint(t,null)}},{key:"addY",value:function addY(t){this.addPoint(null,t)}},{key:"addBoundingBox",value:function addBoundingBox(t){this.addPoint(t.x1,t.y1),this.addPoint(t.x2,t.y2)}},{key:"addQuadraticCurve",value:function addQuadraticCurve(t,e,n,i,o,s){var l=t+2/3*(n-t),u=e+2/3*(i-e),h=l+1/3*(o-t),p=u+1/3*(s-e);this.addBezierCurve(t,e,l,h,u,p,o,s)}},{key:"addBezierCurve",value:function addBezierCurve(t,e,n,i,o,s,l,u){var h=this,p=[t,e],d=[n,i],v=[o,s],g=[l,u];this.addPoint(p[0],p[1]),this.addPoint(g[0],g[1]);for(var b=function _loop(t){var e=function f(e){return Math.pow(1-e,3)*p[t]+3*Math.pow(1-e,2)*e*d[t]+3*(1-e)*Math.pow(e,2)*v[t]+Math.pow(e,3)*g[t]},n=6*p[t]-12*d[t]+6*v[t],i=-3*p[t]+9*d[t]-9*v[t]+3*g[t],o=3*d[t]-3*p[t];if(0===i){if(0===n)return"continue";var s=-o/n;return s>0&&s<1&&(0===t&&h.addX(e(s)),1===t&&h.addY(e(s))),"continue"}var l=Math.pow(n,2)-4*o*i;if(l<0)return"continue";var u=(-n+Math.sqrt(l))/(2*i);u>0&&u<1&&(0===t&&h.addX(e(u)),1===t&&h.addY(e(u)));var b=(-n-Math.sqrt(l))/(2*i);b>0&&b<1&&(0===t&&h.addX(e(b)),1===t&&h.addY(e(b)))},_=0;_<=1;_++)b(_)}},{key:"isPointInBox",value:function isPointInBox(t,e){return this.x1<=t&&t<=this.x2&&this.y1<=e&&e<=this.y2}}]),_class2}(),e.Transform=function(){function _class3(t){var n=this;_classCallCheck(this,_class3),this.Type={translate:function translate(t){_classCallCheck(this,translate),this.p=e.CreatePoint(t),this.apply=function(t){t.translate(this.p.x||0,this.p.y||0)},this.unapply=function(t){t.translate(-1*this.p.x||0,-1*this.p.y||0)},this.applyToPoint=function(t){t.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0])}},rotate:function rotate(t){_classCallCheck(this,rotate);var n=e.ToNumberArray(t);this.angle=new e.Property("angle",n[0]),this.cx=n[1]||0,this.cy=n[2]||0,this.apply=function(t){t.translate(this.cx,this.cy),t.rotate(this.angle.toRadians()),t.translate(-this.cx,-this.cy)},this.unapply=function(t){t.translate(this.cx,this.cy),t.rotate(-1*this.angle.toRadians()),t.translate(-this.cx,-this.cy)},this.applyToPoint=function(t){var e=this.angle.toRadians();t.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0]),t.applyTransform([Math.cos(e),Math.sin(e),-Math.sin(e),Math.cos(e),0,0]),t.applyTransform([1,0,0,1,-this.p.x||0,-this.p.y||0])}},scale:function scale(t){_classCallCheck(this,scale),this.p=e.CreatePoint(t),this.apply=function(t){t.scale(this.p.x||1,this.p.y||this.p.x||1)},this.unapply=function(t){t.scale(1/this.p.x||1,1/this.p.y||this.p.x||1)},this.applyToPoint=function(t){t.applyTransform([this.p.x||0,0,0,this.p.y||0,0,0])}},matrix:function matrix(t){_classCallCheck(this,matrix),this.m=e.ToNumberArray(t),this.apply=function(t){t.transform(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5])},this.applyToPoint=function(t){t.applyTransform(this.m)}}},Object.assign(this.Type,{SkewBase:function(t){_inherits(SkewBase,t);var n=_createSuper(SkewBase);function SkewBase(t){var i;return _classCallCheck(this,SkewBase),(i=n.call(this,t)).angle=new e.Property("angle",t),i}return SkewBase}(this.Type.matrix)}),Object.assign(this.Type,{skewX:function(t){_inherits(skewX,t);var e=_createSuper(skewX);function skewX(t){var n;return _classCallCheck(this,skewX),(n=e.call(this,t)).m=[1,0,Math.tan(n.angle.toRadians()),1,0,0],n}return skewX}(this.Type.SkewBase),skewY:function(t){_inherits(skewY,t);var e=_createSuper(skewY);function skewY(t){var n;return _classCallCheck(this,skewY),(n=e.call(this,t)).m=[1,Math.tan(n.angle.toRadians()),0,1,0,0],n}return skewY}(this.Type.SkewBase)});var i=e.trim(e.compressSpaces(t)).replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/);this.transforms=i.map((function(t){var i=e.trim(t.split("(")[0]),o=t.split("(")[1].replace(")",""),s=new n.Type[i](o);return s.type=i,s}))}return _createClass(_class3,[{key:"apply",value:function apply(t){this.transforms.forEach((function(e){e.apply(t)}))}},{key:"unapply",value:function unapply(t){for(var e=this.transforms.length-1;e>=0;e--)this.transforms[e].unapply(t)}},{key:"applyToPoint",value:function applyToPoint(t){this.transforms.forEach((function(e){e.applyToPoint(t)}))}}]),_class3}(),e.AspectRatio=function(t,n,i,o,s,l,u,h,p,d){var v=(n=(n=e.compressSpaces(n)).replace(/^defer\s/,"")).split(" ")[0]||"xMidYMid",g=n.split(" ")[1]||"meet",b=i/o,_=s/l,w=Math.min(b,_),P=Math.max(b,_);"meet"===g&&(o*=w,l*=w),"slice"===g&&(o*=P,l*=P),p=new e.Property("refX",p),d=new e.Property("refY",d),p.hasValue()&&d.hasValue()?t.translate(-w*p.toPixels("x"),-w*d.toPixels("y")):(v.startsWith("xMid")&&("meet"===g&&w===_||"slice"===g&&P===_)&&t.translate(i/2-o/2,0),v.endsWith("YMid")&&("meet"===g&&w===b||"slice"===g&&P===b)&&t.translate(0,s/2-l/2),v.startsWith("xMax")&&("meet"===g&&w===_||"slice"===g&&P===_)&&t.translate(i-o,0),v.endsWith("YMax")&&("meet"===g&&w===b||"slice"===g&&P===b)&&t.translate(0,s-l)),"none"===v?t.scale(b,_):"meet"===g?t.scale(w,w):"slice"===g&&t.scale(P,P),t.translate(Di(u)?0:-u,Di(h)?0:-h)},e.Element={},e.EmptyProperty=new e.Property("EMPTY",""),e.Element.ElementBase=function(){function _class4(t){var n=this;if(_classCallCheck(this,_class4),this.captureTextNodes=arguments[1],this.attributes={},this.styles={},this.children=[],!Di(t)&&1===t.nodeType){_toConsumableArray(t.childNodes).forEach((function(t){if(1===t.nodeType&&n.addChild(t,!0),n.captureTextNodes&&(3===t.nodeType||4===t.nodeType)){var i=t.nodeValue||t.text||"";""!==e.trim(e.compressSpaces(i))&&n.addChild(new e.Element.tspan(t),!1)}})),_toConsumableArray(t.attributes).forEach((function(t){var i=t.nodeName,o=t.nodeValue;n.attributes[i]=new e.Property(i,o)}));var i=e.Styles[t.nodeName];if(Di(i)||Object.entries(i).forEach((function(t){var e=_slicedToArray(t,2),i=e[0],o=e[1];n.styles[i]=o})),this.attribute("class").hasValue())e.compressSpaces(this.attribute("class").value).split(" ").forEach((function(o){i=e.Styles["."+o],Di(i)||Object.entries(i).forEach((function(t){var e=_slicedToArray(t,2),i=e[0],o=e[1];n.styles[i]=o})),i=e.Styles[t.nodeName+"."+o],Di(i)||Object.entries(i).forEach((function(t){var e=_slicedToArray(t,2),i=e[0],o=e[1];n.styles[i]=o}))}));if(this.attribute("id").hasValue()){var o=e.Styles["#"+this.attribute("id").value];Di(o)||Object.entries(o).forEach((function(t){var e=_slicedToArray(t,2),i=e[0],o=e[1];n.styles[i]=o}))}if(this.attribute("style").hasValue())this.attribute("style").value.split(";").forEach((function(t){if(""!==e.trim(t)){var i=t.split(":"),o=i.name,s=i.value;o=e.trim(o),s=e.trim(s),n.styles[o]=new e.Property(o,s)}}));this.attribute("id").hasValue()&&Di(e.Definitions[this.attribute("id").value])&&(e.Definitions[this.attribute("id").value]=this)}}return _createClass(_class4,[{key:"attribute",value:function attribute(t,n){var i=this.attributes[t];return Di(i)?(!0===n&&(i=new e.Property(t,""),this.attributes[t]=i),i||e.EmptyProperty):i}},{key:"getHrefAttribute",value:function getHrefAttribute(){for(var t in this.attributes)if(t.endsWith(":href"))return this.attributes[t];return e.EmptyProperty}},{key:"style",value:function style(t,n,i){var o=this.styles[t];if(!Di(o))return o;var s=this.attribute(t);if(!Di(s)&&s.hasValue())return this.styles[t]=s,s;if(!0!==i){var l=this.parent;if(!Di(l)){var u=l.style(t);if(!Di(u)&&u.hasValue())return u}}return!0===n&&(o=new e.Property(t,""),this.styles[t]=o),o||e.EmptyProperty}},{key:"render",value:function render(t){if("none"!==this.style("display").value&&"hidden"!==this.style("visibility").value){if(t.save(),this.attribute("mask").hasValue()){var e=this.attribute("mask").getDefinition();Di(e)||e.apply(t,this)}else if(this.style("filter").hasValue()){var n=this.style("filter").getDefinition();Di(n)||n.apply(t,this)}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}}},{key:"setContext",value:function setContext(t){}},{key:"clearContext",value:function clearContext(t){}},{key:"renderChildren",value:function renderChildren(t){this.children.forEach((function(e){e.render(t)}))}},{key:"addChild",value:function addChild(t,n){var i=n?e.CreateElement(t):t;i.parent=this,"title"!==i.type&&this.children.push(i)}}]),_class4}(),e.Element.RenderedElementBase=function(t){_inherits(_class5,t);var n=_createSuper(_class5);function _class5(){return _classCallCheck(this,_class5),n.apply(this,arguments)}return _createClass(_class5,[{key:"setContext",value:function setContext(t){if(this.style("fill").isUrlDefinition()){var n=this.style("fill").getFillStyleDefinition(this,this.style("fill-opacity"));Di(n)||(t.fillStyle=n)}else if(this.style("fill").hasValue()){var i=this.style("fill");"currentColor"===i.value&&(i.value=this.style("color").value),t.fillStyle="none"===i.value?"rgba(0,0,0,0)":i.value}if(this.style("fill-opacity").hasValue()){var o=new e.Property("fill",t.fillStyle);o=o.addOpacity(this.style("fill-opacity")),t.fillStyle=o.value}if(this.style("stroke").isUrlDefinition()){var s=this.style("stroke").getFillStyleDefinition(this,this.style("stroke-opacity"));Di(s)||(t.strokeStyle=s)}else if(this.style("stroke").hasValue()){var l=this.style("stroke");"currentColor"===l.value&&(l.value=this.style("color").value),t.strokeStyle="none"===l.value?"rgba(0,0,0,0)":l.value}if(this.style("stroke-opacity").hasValue()){var u=new e.Property("stroke",t.strokeStyle);u=u.addOpacity(this.style("stroke-opacity")),t.strokeStyle=u.value}if(this.style("stroke-width").hasValue()){var h=this.style("stroke-width").toPixels();t.lineWidth=0===h?.001:h}if(this.style("stroke-linecap").hasValue()&&(t.lineCap=this.style("stroke-linecap").value),this.style("stroke-linejoin").hasValue()&&(t.lineJoin=this.style("stroke-linejoin").value),this.style("stroke-miterlimit").hasValue()&&(t.miterLimit=this.style("stroke-miterlimit").value),this.style("stroke-dasharray").hasValue()&&"none"!==this.style("stroke-dasharray").value){var p=e.ToNumberArray(this.style("stroke-dasharray").value);void 0!==t.setLineDash?t.setLineDash(p):void 0!==t.webkitLineDash?t.webkitLineDash=p:void 0===t.mozDash||1===p.length&&0===p[0]||(t.mozDash=p);var d=this.style("stroke-dashoffset").numValueOrDefault(1);void 0!==t.lineDashOffset?t.lineDashOffset=d:void 0!==t.webkitLineDashOffset?t.webkitLineDashOffset=d:void 0!==t.mozDashOffset&&(t.mozDashOffset=d)}(void 0!==t.font&&(t.font=e.Font.CreateFont(this.style("font-style").value,this.style("font-variant").value,this.style("font-weight").value,this.style("font-size").hasValue()?this.style("font-size").toPixels()+"px":"",this.style("font-family").value).toString()),this.attribute("transform").hasValue())&&new e.Transform(this.attribute("transform").value).apply(t);if(this.style("clip-path",!1,!0).hasValue()){var v=this.style("clip-path",!1,!0).getDefinition();Di(v)||v.apply(t)}this.style("opacity").hasValue()&&(t.globalAlpha=this.style("opacity").numValue())}}]),_class5}(e.Element.ElementBase),e.Element.PathElementBase=function(t){_inherits(_class6,t);var n=_createSuper(_class6);function _class6(){return _classCallCheck(this,_class6),n.apply(this,arguments)}return _createClass(_class6,[{key:"path",value:function path(t){return Di(t)||t.beginPath(),new e.BoundingBox}},{key:"renderChildren",value:function renderChildren(t){this.path(t),e.Mouse.checkPath(this,t),""!==t.fillStyle&&("inherit"!==this.style("fill-rule").valueOrDefault("inherit")?t.fill(this.style("fill-rule").value):t.fill()),""!==t.strokeStyle&&t.stroke();var n=this.getMarkers();if(!Di(n)){if(this.style("marker-start").isUrlDefinition())this.style("marker-start").getDefinition().render(t,n[0][0],n[0][1]);if(this.style("marker-mid").isUrlDefinition())for(var i=this.style("marker-mid").getDefinition(),o=1;o<n.length-1;o++)i.render(t,n[o][0],n[o][1]);if(this.style("marker-end").isUrlDefinition())this.style("marker-end").getDefinition().render(t,n[n.length-1][0],n[n.length-1][1])}}},{key:"getBoundingBox",value:function getBoundingBox(){return this.path()}},{key:"getMarkers",value:function getMarkers(){return null}}]),_class6}(e.Element.RenderedElementBase),e.Element.svg=function(t){_inherits(_class7,t);var n=_createSuper(_class7);function _class7(){return _classCallCheck(this,_class7),n.apply(this,arguments)}return _createClass(_class7,[{key:"clearContext",value:function clearContext(t){_get(_getPrototypeOf(_class7.prototype),"clearContext",this).call(this,t),e.ViewPort.RemoveCurrent()}},{key:"setContext",value:function setContext(t){t.strokeStyle="rgba(0,0,0,0)",t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4,void 0!==t.font&&void 0!==window.getComputedStyle&&(t.font=window.getComputedStyle(t.canvas).getPropertyValue("font")),_get(_getPrototypeOf(_class7.prototype),"setContext",this).call(this,t),this.attribute("x").hasValue()||(this.attribute("x",!0).value=0),this.attribute("y").hasValue()||(this.attribute("y",!0).value=0),t.translate(this.attribute("x").toPixels("x"),this.attribute("y").toPixels("y"));var n=e.ViewPort.width(),i=e.ViewPort.height();if(this.attribute("width").hasValue()||(this.attribute("width",!0).value="100%"),this.attribute("height").hasValue()||(this.attribute("height",!0).value="100%"),void 0===this.root){n=this.attribute("width").toPixels("x"),i=this.attribute("height").toPixels("y");var o=0,s=0;this.attribute("refX").hasValue()&&this.attribute("refY").hasValue()&&(o=-this.attribute("refX").toPixels("x"),s=-this.attribute("refY").toPixels("y")),"visible"!==this.attribute("overflow").valueOrDefault("hidden")&&(t.beginPath(),t.moveTo(o,s),t.lineTo(n,s),t.lineTo(n,i),t.lineTo(o,i),t.closePath(),t.clip())}if(e.ViewPort.SetCurrent(n,i),this.attribute("viewBox").hasValue()){var l=e.ToNumberArray(this.attribute("viewBox").value),u=l[0],h=l[1];n=l[2],i=l[3],e.AspectRatio(t,this.attribute("preserveAspectRatio").value,e.ViewPort.width(),n,e.ViewPort.height(),i,u,h,this.attribute("refX").value,this.attribute("refY").value),e.ViewPort.RemoveCurrent(),e.ViewPort.SetCurrent(l[2],l[3])}}}]),_class7}(e.Element.RenderedElementBase),e.Element.rect=function(t){_inherits(_class8,t);var n=_createSuper(_class8);function _class8(){return _classCallCheck(this,_class8),n.apply(this,arguments)}return _createClass(_class8,[{key:"path",value:function path(t){var n=this.attribute("x").toPixels("x"),i=this.attribute("y").toPixels("y"),o=this.attribute("width").toPixels("x"),s=this.attribute("height").toPixels("y"),l=this.attribute("rx").toPixels("x"),u=this.attribute("ry").toPixels("y");return this.attribute("rx").hasValue()&&!this.attribute("ry").hasValue()&&(u=l),this.attribute("ry").hasValue()&&!this.attribute("rx").hasValue()&&(l=u),l=Math.min(l,o/2),u=Math.min(u,s/2),Di(t)||(t.beginPath(),t.moveTo(n+l,i),t.lineTo(n+o-l,i),t.quadraticCurveTo(n+o,i,n+o,i+u),t.lineTo(n+o,i+s-u),t.quadraticCurveTo(n+o,i+s,n+o-l,i+s),t.lineTo(n+l,i+s),t.quadraticCurveTo(n,i+s,n,i+s-u),t.lineTo(n,i+u),t.quadraticCurveTo(n,i,n+l,i),t.closePath()),new e.BoundingBox(n,i,n+o,i+s)}}]),_class8}(e.Element.PathElementBase),e.Element.circle=function(t){_inherits(_class9,t);var n=_createSuper(_class9);function _class9(){return _classCallCheck(this,_class9),n.apply(this,arguments)}return _createClass(_class9,[{key:"path",value:function path(t){var n=this.attribute("cx").toPixels("x"),i=this.attribute("cy").toPixels("y"),o=this.attribute("r").toPixels();return Di(t)||(t.beginPath(),t.arc(n,i,o,0,2*Math.PI,!0),t.closePath()),new e.BoundingBox(n-o,i-o,n+o,i+o)}}]),_class9}(e.Element.PathElementBase);var i=(Math.sqrt(2)-1)/3*4;function imGet(t,e,n,i,o,s){return t[n*i*4+4*e+s]}function imSet(t,e,n,i,o,s,l){t[n*i*4+4*e+s]=l}return e.Element.ellipse=function(t){_inherits(_class10,t);var n=_createSuper(_class10);function _class10(){return _classCallCheck(this,_class10),n.apply(this,arguments)}return _createClass(_class10,[{key:"path",value:function path(t){var n=this.attribute("rx").toPixels("x"),o=this.attribute("ry").toPixels("y"),s=this.attribute("cx").toPixels("x"),l=this.attribute("cy").toPixels("y");return Di(t)||(t.beginPath(),t.moveTo(s,l-o),t.bezierCurveTo(s+i*n,l-o,s+n,l-i*o,s+n,l),t.bezierCurveTo(s+n,l+i*o,s+i*n,l+o,s,l+o),t.bezierCurveTo(s-i*n,l+o,s-n,l+i*o,s-n,l),t.bezierCurveTo(s-n,l-i*o,s-i*n,l-o,s,l-o),t.closePath()),new e.BoundingBox(s-n,l-o,s+n,l+o)}}]),_class10}(e.Element.PathElementBase),e.Element.line=function(t){_inherits(_class11,t);var n=_createSuper(_class11);function _class11(){return _classCallCheck(this,_class11),n.apply(this,arguments)}return _createClass(_class11,[{key:"getPoints",value:function getPoints(){return[new e.Point(this.attribute("x1").toPixels("x"),this.attribute("y1").toPixels("y")),new e.Point(this.attribute("x2").toPixels("x"),this.attribute("y2").toPixels("y"))]}},{key:"path",value:function path(t){var n=this.getPoints();return Di(t)||(t.beginPath(),t.moveTo(n[0].x,n[0].y),t.lineTo(n[1].x,n[1].y)),new e.BoundingBox(n[0].x,n[0].y,n[1].x,n[1].y)}},{key:"getMarkers",value:function getMarkers(){var t=this.getPoints(),e=t[0].angleTo(t[1]);return[[t[0],e],[t[1],e]]}}]),_class11}(e.Element.PathElementBase),e.Element.polyline=function(t){_inherits(_class12,t);var n=_createSuper(_class12);function _class12(t){var i;return _classCallCheck(this,_class12),(i=n.call(this,t)).points=e.CreatePath(i.attribute("points").value),i}return _createClass(_class12,[{key:"path",value:function path(t){var n=this.points[0],i=n.x,o=n.y,s=new e.BoundingBox(i,o);Di(t)||(t.beginPath(),t.moveTo(i,o));for(var l=1;l<this.points.length;l++){var u=this.points[l],h=u.x,p=u.y;s.addPoint(h,p),Di(t)||t.lineTo(h,p)}return s}},{key:"getMarkers",value:function getMarkers(){for(var t=[],e=0;e<this.points.length-1;e++)t.push([this.points[e],this.points[e].angleTo(this.points[e+1])]);return t.push([this.points[this.points.length-1],t[t.length-1][1]]),t}}]),_class12}(e.Element.PathElementBase),e.Element.polygon=function(t){_inherits(_class13,t);var e=_createSuper(_class13);function _class13(){return _classCallCheck(this,_class13),e.apply(this,arguments)}return _createClass(_class13,[{key:"path",value:function path(t){var e=_get(_getPrototypeOf(_class13.prototype),"path",this).call(this,t);return Di(t)||(t.lineTo(this.points[0].x,this.points[0].y),t.closePath()),e}}]),_class13}(e.Element.polyline),e.Element.path=function(t){_inherits(_class14,t);var n=_createSuper(_class14);function _class14(t){var i;_classCallCheck(this,_class14);var o=(i=n.call(this,t)).attribute("d").value.replace(/,/gm," ").replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2").replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2").replace(/([MmZzLlHhVvCcSsQqTtAa])(\S)/gm,"$1 $2").replace(/(\S)([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2").replace(/(\d)([+-])/gm,"$1 $2").replace(/(\.\d*)(\.)/gm,"$1 $2").replace(/([Aa](\s+\d+)(\s+\d+)(\s+\d+))\s+([01])\s*([01])/gm,"$1 $5 $6 ");return o=e.compressSpaces(o),o=e.trim(o),i.PathParser={tokens:o.split(" "),reset:function reset(){this.i=-1,this.command="",this.previousCommand="",this.start=new e.Point(0,0),this.control=new e.Point(0,0),this.current=new e.Point(0,0),this.points=[],this.angles=[]},isEnd:function isEnd(){return this.i>=this.tokens.length-1},isCommandOrEnd:function isCommandOrEnd(){return!!this.isEnd()||!Di(this.tokens[this.i+1].match(/^[A-Za-z]$/))},isRelativeCommand:function isRelativeCommand(){switch(this.command){case"m":case"l":case"h":case"v":case"c":case"s":case"q":case"t":case"a":case"z":return!0}return!1},getToken:function getToken(){return this.i++,this.tokens[this.i]},getScalar:function getScalar(){return Number.parseFloat(this.getToken())},nextCommand:function nextCommand(){this.previousCommand=this.command,this.command=this.getToken()},getPoint:function getPoint(){var t=new e.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(t)},getAsControlPoint:function getAsControlPoint(){var t=this.getPoint();return this.control=t,t},getAsCurrentPoint:function getAsCurrentPoint(){var t=this.getPoint();return this.current=t,t},getReflectedControlPoint:function getReflectedControlPoint(){return"c"!==this.previousCommand.toLowerCase()&&"s"!==this.previousCommand.toLowerCase()&&"q"!==this.previousCommand.toLowerCase()&&"t"!==this.previousCommand.toLowerCase()?this.current:new e.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)},makeAbsolute:function makeAbsolute(t){return this.isRelativeCommand()&&(t.x+=this.current.x,t.y+=this.current.y),t},addMarker:function addMarker(t,e,n){!Di(n)&&this.angles.length>0&&Di(this.angles[this.angles.length-1])&&(this.angles[this.angles.length-1]=this.points[this.points.length-1].angleTo(n)),this.addMarkerAngle(t,Di(e)?null:e.angleTo(t))},addMarkerAngle:function addMarkerAngle(t,e){this.points.push(t),this.angles.push(e)},getMarkerPoints:function getMarkerPoints(){return this.points},getMarkerAngles:function getMarkerAngles(){for(var t=0;t<this.angles.length;t++)if(Di(this.angles[t]))for(var e=t+1;e<this.angles.length;e++)if(!Di(this.angles[e])){this.angles[t]=this.angles[e];break}return this.angles}},i}return _createClass(_class14,[{key:"path",value:function path(t){var n=this.PathParser;n.reset();var i=new e.BoundingBox;for(Di(t)||t.beginPath();!n.isEnd();)switch(n.nextCommand(),n.command){case"M":case"m":var o=n.getAsCurrentPoint();for(n.addMarker(o),i.addPoint(o.x,o.y),Di(t)||t.moveTo(o.x,o.y),n.start=n.current;!n.isCommandOrEnd();){var s=n.getAsCurrentPoint();n.addMarker(s,n.start),i.addPoint(s.x,s.y),Di(t)||t.lineTo(s.x,s.y)}break;case"L":case"l":for(;!n.isCommandOrEnd();){var l=n.current,u=n.getAsCurrentPoint();n.addMarker(u,l),i.addPoint(u.x,u.y),Di(t)||t.lineTo(u.x,u.y)}break;case"H":case"h":for(;!n.isCommandOrEnd();){var h=new e.Point((n.isRelativeCommand()?n.current.x:0)+n.getScalar(),n.current.y);n.addMarker(h,n.current),n.current=h,i.addPoint(n.current.x,n.current.y),Di(t)||t.lineTo(n.current.x,n.current.y)}break;case"V":case"v":for(;!n.isCommandOrEnd();){var p=new e.Point(n.current.x,(n.isRelativeCommand()?n.current.y:0)+n.getScalar());n.addMarker(p,n.current),n.current=p,i.addPoint(n.current.x,n.current.y),Di(t)||t.lineTo(n.current.x,n.current.y)}break;case"C":case"c":for(;!n.isCommandOrEnd();){var d=n.current,v=n.getPoint(),g=n.getAsControlPoint(),b=n.getAsCurrentPoint();n.addMarker(b,g,v),i.addBezierCurve(d.x,d.y,v.x,v.y,g.x,g.y,b.x,b.y),Di(t)||t.bezierCurveTo(v.x,v.y,g.x,g.y,b.x,b.y)}break;case"S":case"s":for(;!n.isCommandOrEnd();){var _=n.current,w=n.getReflectedControlPoint(),P=n.getAsControlPoint(),C=n.getAsCurrentPoint();n.addMarker(C,P,w),i.addBezierCurve(_.x,_.y,w.x,w.y,P.x,P.y,C.x,C.y),Di(t)||t.bezierCurveTo(w.x,w.y,P.x,P.y,C.x,C.y)}break;case"Q":case"q":for(;!n.isCommandOrEnd();){var k=n.current,E=n.getAsControlPoint(),S=n.getAsCurrentPoint();n.addMarker(S,E,E),i.addQuadraticCurve(k.x,k.y,E.x,E.y,S.x,S.y),Di(t)||t.quadraticCurveTo(E.x,E.y,S.x,S.y)}break;case"T":case"t":for(;!n.isCommandOrEnd();){var T=n.current,A=n.getReflectedControlPoint();n.control=A;var O=n.getAsCurrentPoint();n.addMarker(O,A,A),i.addQuadraticCurve(T.x,T.y,A.x,A.y,O.x,O.y),Di(t)||t.quadraticCurveTo(A.x,A.y,O.x,O.y)}break;case"A":case"a":for(var M=function _loop2(){var o=n.current,s=n.getScalar(),l=n.getScalar(),u=n.getScalar()*(Math.PI/180),h=n.getScalar(),p=n.getScalar(),d=n.getAsCurrentPoint(),v=new e.Point(Math.cos(u)*(o.x-d.x)/2+Math.sin(u)*(o.y-d.y)/2,-Math.sin(u)*(o.x-d.x)/2+Math.cos(u)*(o.y-d.y)/2),g=Math.pow(v.x,2)/Math.pow(s,2)+Math.pow(v.y,2)/Math.pow(l,2);g>1&&(s*=Math.sqrt(g),l*=Math.sqrt(g));var b=(h===p?-1:1)*Math.sqrt((Math.pow(s,2)*Math.pow(l,2)-Math.pow(s,2)*Math.pow(v.y,2)-Math.pow(l,2)*Math.pow(v.x,2))/(Math.pow(s,2)*Math.pow(v.y,2)+Math.pow(l,2)*Math.pow(v.x,2)));isNaN(b)&&(b=0);var _=new e.Point(b*s*v.y/l,b*-l*v.x/s),w=new e.Point((o.x+d.x)/2+Math.cos(u)*_.x-Math.sin(u)*_.y,(o.y+d.y)/2+Math.sin(u)*_.x+Math.cos(u)*_.y),P=function m(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))},C=function r(t,e){return(t[0]*e[0]+t[1]*e[1])/(P(t)*P(e))},k=function a(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(C(t,e))},E=k([1,0],[(v.x-_.x)/s,(v.y-_.y)/l]),S=[(v.x-_.x)/s,(v.y-_.y)/l],T=[(-v.x-_.x)/s,(-v.y-_.y)/l],A=k(S,T);C(S,T)<=-1&&(A=Math.PI),C(S,T)>=1&&(A=0);var O=1-p?1:-1,M=E+O*(A/2),V=new e.Point(w.x+s*Math.cos(M),w.y+l*Math.sin(M));if(n.addMarkerAngle(V,M-O*Math.PI/2),n.addMarkerAngle(d,M-O*Math.PI),i.addPoint(d.x,d.y),!Di(t)){var B=s>l?s:l,R=s>l?1:s/l,I=s>l?l/s:1;t.translate(w.x,w.y),t.rotate(u),t.scale(R,I),t.arc(0,0,B,E,E+A,1-p),t.scale(1/R,1/I),t.rotate(-u),t.translate(-w.x,-w.y)}};!n.isCommandOrEnd();)M();break;case"Z":case"z":Di(t)||t.closePath(),n.current=n.start}return i}},{key:"getMarkers",value:function getMarkers(){var t=this.PathParser.getMarkerPoints(),e=this.PathParser.getMarkerAngles();return t.map((function(t,n){return[t,e[n]]}))}}]),_class14}(e.Element.PathElementBase),e.Element.pattern=function(t){_inherits(_class15,t);var n=_createSuper(_class15);function _class15(){return _classCallCheck(this,_class15),n.apply(this,arguments)}return _createClass(_class15,[{key:"createPattern",value:function createPattern(t,n){var i=this.attribute("width").toPixels("x",!0),o=this.attribute("height").toPixels("y",!0),s=new e.Element.svg;s.attributes.viewBox=new e.Property("viewBox",this.attribute("viewBox").value),s.attributes.width=new e.Property("width",i+"px"),s.attributes.height=new e.Property("height",o+"px"),s.attributes.transform=new e.Property("transform",this.attribute("patternTransform").value),s.children=this.children;var l=document.createElement("canvas");l.width=i,l.height=o;var u=l.getContext("2d");this.attribute("x").hasValue()&&this.attribute("y").hasValue()&&u.translate(this.attribute("x").toPixels("x",!0),this.attribute("y").toPixels("y",!0));for(var h=-1;h<=1;h++)for(var p=-1;p<=1;p++)u.save(),u.translate(h*l.width,p*l.height),s.render(u),u.restore();return t.createPattern(l,"repeat")}}]),_class15}(e.Element.ElementBase),e.Element.marker=function(t){_inherits(_class16,t);var n=_createSuper(_class16);function _class16(){return _classCallCheck(this,_class16),n.apply(this,arguments)}return _createClass(_class16,[{key:"render",value:function render(t,n,i){t.translate(n.x,n.y),"auto"===this.attribute("orient").valueOrDefault("auto")&&t.rotate(i),"strokeWidth"===this.attribute("markerUnits").valueOrDefault("strokeWidth")&&t.scale(t.lineWidth,t.lineWidth),t.save();var o=new e.Element.svg;o.attributes.viewBox=new e.Property("viewBox",this.attribute("viewBox").value),o.attributes.refX=new e.Property("refX",this.attribute("refX").value),o.attributes.refY=new e.Property("refY",this.attribute("refY").value),o.attributes.width=new e.Property("width",this.attribute("markerWidth").value),o.attributes.height=new e.Property("height",this.attribute("markerHeight").value),o.attributes.fill=new e.Property("fill",this.attribute("fill").valueOrDefault("black")),o.attributes.stroke=new e.Property("stroke",this.attribute("stroke").valueOrDefault("none")),o.children=this.children,o.render(t),t.restore(),"strokeWidth"===this.attribute("markerUnits").valueOrDefault("strokeWidth")&&t.scale(1/t.lineWidth,1/t.lineWidth),"auto"===this.attribute("orient").valueOrDefault("auto")&&t.rotate(-i),t.translate(-n.x,-n.y)}}]),_class16}(e.Element.ElementBase),e.Element.defs=function(t){_inherits(_class17,t);var e=_createSuper(_class17);function _class17(){return _classCallCheck(this,_class17),e.apply(this,arguments)}return _createClass(_class17,[{key:"render",value:function render(t){}}]),_class17}(e.Element.ElementBase),e.Element.GradientBase=function(t){_inherits(_class18,t);var n=_createSuper(_class18);function _class18(t){var e;return _classCallCheck(this,_class18),(e=n.call(this,t)).gradientUnits=e.attribute("gradientUnits").valueOrDefault("objectBoundingBox"),e.stops=[],e.children.forEach((function(t){"stop"===t.type&&e.stops.push(t)})),e}return _createClass(_class18,[{key:"getGradient",value:function getGradient(){}},{key:"createGradient",value:function createGradient(t,n,i){var o=this.getHrefAttribute().hasValue()?this.getHrefAttribute().getDefinition():this,s=function addParentOpacity(t){return i.hasValue()?new e.Property("color",t).addOpacity(i).value:t},l=this.getGradient(t,n);if(Di(l))return s(o.stops[o.stops.length-1].color);if(o.stops.forEach((function(t){var e=t.offset,n=t.color;l.addColorStop(e,s(n))})),this.attribute("gradientTransform").hasValue()){var u=e.ViewPort.viewPorts[0],h=new e.Element.rect;h.attributes.x=new e.Property("x",-e.MAX_VIRTUAL_PIXELS/3),h.attributes.y=new e.Property("y",-e.MAX_VIRTUAL_PIXELS/3),h.attributes.width=new e.Property("width",e.MAX_VIRTUAL_PIXELS),h.attributes.height=new e.Property("height",e.MAX_VIRTUAL_PIXELS);var p=new e.Element.g;p.attributes.transform=new e.Property("transform",this.attribute("gradientTransform").value),p.children=[h];var d=new e.Element.svg;d.attributes.x=new e.Property("x",0),d.attributes.y=new e.Property("y",0),d.attributes.width=new e.Property("width",u.width),d.attributes.height=new e.Property("height",u.height),d.children=[p];var v=document.createElement("canvas");v.width=u.width,v.height=u.height;var g=v.getContext("2d");return g.fillStyle=l,d.render(g),g.createPattern(v,"no-repeat")}return l}}]),_class18}(e.Element.ElementBase),e.Element.linearGradient=function(t){_inherits(_class19,t);var e=_createSuper(_class19);function _class19(){return _classCallCheck(this,_class19),e.apply(this,arguments)}return _createClass(_class19,[{key:"getGradient",value:function getGradient(t,e){var n="objectBoundingBox"===this.gradientUnits&&e.getBoundingBox,i=n?e.getBoundingBox():null;this.attribute("x1").hasValue()||this.attribute("y1").hasValue()||this.attribute("x2").hasValue()||this.attribute("y2").hasValue()||(this.attribute("x1",!0).value=0,this.attribute("y1",!0).value=0,this.attribute("x2",!0).value=1,this.attribute("y2",!0).value=0);var o=n?i.x()+i.width()*this.attribute("x1").numValue():this.attribute("x1").toPixels("x"),s=n?i.y()+i.height()*this.attribute("y1").numValue():this.attribute("y1").toPixels("y"),l=n?i.x()+i.width()*this.attribute("x2").numValue():this.attribute("x2").toPixels("x"),u=n?i.y()+i.height()*this.attribute("y2").numValue():this.attribute("y2").toPixels("y");return o===l&&s===u?null:t.createLinearGradient(o,s,l,u)}}]),_class19}(e.Element.GradientBase),e.Element.radialGradient=function(t){_inherits(_class20,t);var e=_createSuper(_class20);function _class20(){return _classCallCheck(this,_class20),e.apply(this,arguments)}return _createClass(_class20,[{key:"getGradient",value:function getGradient(t,e){var n="objectBoundingBox"===this.gradientUnits&&e.getBoundingBox,i=n?e.getBoundingBox():null;this.attribute("cx").hasValue()||(this.attribute("cx",!0).value="50%"),this.attribute("cy").hasValue()||(this.attribute("cy",!0).value="50%"),this.attribute("r").hasValue()||(this.attribute("r",!0).value="50%");var o=n?i.x()+i.width()*this.attribute("cx").numValue():this.attribute("cx").toPixels("x"),s=n?i.y()+i.height()*this.attribute("cy").numValue():this.attribute("cy").toPixels("y"),l=o,u=s;this.attribute("fx").hasValue()&&(l=n?i.x()+i.width()*this.attribute("fx").numValue():this.attribute("fx").toPixels("x")),this.attribute("fy").hasValue()&&(u=n?i.y()+i.height()*this.attribute("fy").numValue():this.attribute("fy").toPixels("y"));var h=n?(i.width()+i.height())/2*this.attribute("r").numValue():this.attribute("r").toPixels();return t.createRadialGradient(l,u,0,o,s,h)}}]),_class20}(e.Element.GradientBase),e.Element.stop=function(t){_inherits(_class21,t);var e=_createSuper(_class21);function _class21(t){var n;_classCallCheck(this,_class21),(n=e.call(this,t)).offset=n.attribute("offset").numValue(),n.offset<0&&(n.offset=0),n.offset>1&&(n.offset=1);var i=n.style("stop-color");return n.style("stop-opacity").hasValue()&&(i=i.addOpacity(n.style("stop-opacity"))),n.color=i.value,n}return _class21}(e.Element.ElementBase),e.Element.AnimateBase=function(t){_inherits(_class22,t);var n=_createSuper(_class22);function _class22(t){var i;return _classCallCheck(this,_class22),i=n.call(this,t),e.Animations.push(_assertThisInitialized(i)),i.duration=0,i.begin=i.attribute("begin").toMilliseconds(),i.maxDuration=i.begin+i.attribute("dur").toMilliseconds(),i.initialValue=null,i.initialUnits="",i.removed=!1,i.from=i.attribute("from"),i.to=i.attribute("to"),i.values=i.attribute("values"),i.values.hasValue()&&(i.values.value=i.values.value.split(";")),i}return _createClass(_class22,[{key:"getProperty",value:function getProperty(){var t=this.attribute("attributeType").value,e=this.attribute("attributeName").value;return"CSS"===t?this.parent.style(e,!0):this.parent.attribute(e,!0)}},{key:"calcValue",value:function calcValue(){return""}},{key:"update",value:function update(t){if(Di(this.initialValue)&&(this.initialValue=this.getProperty().value,this.initialUnits=this.getProperty().getUnits()),this.duration>this.maxDuration){if("indefinite"===this.attribute("repeatCount").value||"indefinite"===this.attribute("repeatDur").value)this.duration=0;else if("freeze"!==this.attribute("fill").valueOrDefault("remove")||this.frozen){if("remove"===this.attribute("fill").valueOrDefault("remove")&&!this.removed)return this.removed=!0,this.getProperty().value=this.parent.animationFrozen?this.parent.animationFrozenValue:this.initialValue,!0}else this.frozen=!0,this.parent.animationFrozen=!0,this.parent.animationFrozenValue=this.getProperty().value;return!1}this.duration+=t;var e=!1;if(this.begin<this.duration){var n=this.calcValue();if(this.attribute("type").hasValue())n=this.attribute("type").value+"("+n+")";this.getProperty().value=n,e=!0}return e}},{key:"progress",value:function progress(){var t={progress:(this.duration-this.begin)/(this.maxDuration-this.begin)};if(this.values.hasValue()){var n=t.progress*(this.values.value.length-1),i=Math.floor(n),o=Math.ceil(n);t.from=new e.Property("from",Number.parseFloat(this.values.value[i])),t.to=new e.Property("to",Number.parseFloat(this.values.value[o])),t.progress=(n-i)/(o-i)}else t.from=this.from,t.to=this.to;return t}}]),_class22}(e.Element.ElementBase),e.Element.animate=function(t){_inherits(_class23,t);var e=_createSuper(_class23);function _class23(){return _classCallCheck(this,_class23),e.apply(this,arguments)}return _createClass(_class23,[{key:"calcValue",value:function calcValue(){var t=this.progress();return t.from.numValue()+(t.to.numValue()-t.from.numValue())*t.progress+this.initialUnits}}]),_class23}(e.Element.AnimateBase),e.Element.animateColor=function(t){_inherits(_class24,t);var e=_createSuper(_class24);function _class24(){return _classCallCheck(this,_class24),e.apply(this,arguments)}return _createClass(_class24,[{key:"calcValue",value:function calcValue(){var t=this.progress(),e=new Ri(t.from.value),n=new Ri(t.to.value);if(e.ok&&n.ok){var i=e.r+(n.r-e.r)*t.progress,o=e.g+(n.g-e.g)*t.progress,s=e.b+(n.b-e.b)*t.progress;return"rgb("+Number.parseInt(i)+","+Number.parseInt(o)+","+Number.parseInt(s)+")"}return this.attribute("from").value}}]),_class24}(e.Element.AnimateBase),e.Element.animateTransform=function(t){_inherits(_class25,t);var n=_createSuper(_class25);function _class25(){return _classCallCheck(this,_class25),n.apply(this,arguments)}return _createClass(_class25,[{key:"calcValue",value:function calcValue(){var t=this.progress(),n=e.ToNumberArray(t.from.value),i=e.ToNumberArray(t.to.value),o="";return n.forEach((function(e,n){o+=e+(i[n]-e)*t.progress+" "})),o}}]),_class25}(e.Element.animate),e.Element.font=function(t){_inherits(_class26,t);var n=_createSuper(_class26);function _class26(t){var i;return _classCallCheck(this,_class26),(i=n.call(this,t)).horizAdvX=i.attribute("horiz-adv-x").numValue(),i.isRTL=!1,i.isArabic=!1,i.fontFace=null,i.missingGlyph=null,i.glyphs=[],i.children.forEach((function(t){"font-face"===t.type?(i.fontFace=t,t.style("font-family").hasValue()&&(e.Definitions[t.style("font-family").value]=_assertThisInitialized(i))):"missing-glyph"===t.type?i.missingGlyph=t:"glyph"===t.type&&(""!==t.arabicForm?(i.isRTL=!0,i.isArabic=!0,void 0===i.glyphs[t.unicode]&&(i.glyphs[t.unicode]=[]),i.glyphs[t.unicode][t.arabicForm]=t):i.glyphs[t.unicode]=t)})),i}return _class26}(e.Element.ElementBase),e.Element.fontface=function(t){_inherits(_class27,t);var e=_createSuper(_class27);function _class27(t){var n;return _classCallCheck(this,_class27),(n=e.call(this,t)).ascent=n.attribute("ascent").value,n.descent=n.attribute("descent").value,n.unitsPerEm=n.attribute("units-per-em").numValue(),n}return _class27}(e.Element.ElementBase),e.Element.missingglyph=function(t){_inherits(_class28,t);var e=_createSuper(_class28);function _class28(t){var n;return _classCallCheck(this,_class28),(n=e.call(this,t)).horizAdvX=0,n}return _class28}(e.Element.path),e.Element.glyph=function(t){_inherits(_class29,t);var e=_createSuper(_class29);function _class29(t){var n;return _classCallCheck(this,_class29),(n=e.call(this,t)).horizAdvX=n.attribute("horiz-adv-x").numValue(),n.unicode=n.attribute("unicode").value,n.arabicForm=n.attribute("arabic-form").value,n}return _class29}(e.Element.path),e.Element.text=function(t){_inherits(_class30,t);var n=_createSuper(_class30);function _class30(t){return _classCallCheck(this,_class30),n.call(this,t,!0)}return _createClass(_class30,[{key:"setContext",value:function setContext(t){_get(_getPrototypeOf(_class30.prototype),"setContext",this).call(this,t);var e=this.style("dominant-baseline").toTextBaseline();Di(e)&&(e=this.style("alignment-baseline").toTextBaseline()),Di(e)||(t.textBaseline=e)}},{key:"getBoundingBox",value:function getBoundingBox(){var t=this.attribute("x").toPixels("x"),n=this.attribute("y").toPixels("y"),i=this.parent.style("font-size").numValueOrDefault(e.Font.Parse(e.ctx.font).fontSize);return new e.BoundingBox(t,n-i,t+Math.floor(2*i/3)*this.children[0].getText().length,n)}},{key:"renderChildren",value:function renderChildren(t){var e=this;this.x=this.attribute("x").toPixels("x"),this.y=this.attribute("y").toPixels("y"),this.x+=this.getAnchorDelta(t,this,0),this.children.forEach((function(n,i){e.renderChild(t,e,i)}))}},{key:"getAnchorDelta",value:function getAnchorDelta(t,e,n){var i=this.style("text-anchor").valueOrDefault("start");if("start"!==i){for(var o=0,s=n;s<e.children.length;s++){var l=e.children[s];if(s>n&&l.attribute("x").hasValue())break;o+=l.measureTextRecursive(t)}return-1*("end"===i?o:o/2)}return 0}},{key:"renderChild",value:function renderChild(t,e,n){var i=e.children[n];i.attribute("x").hasValue()?(i.x=i.attribute("x").toPixels("x")+this.getAnchorDelta(t,e,n),i.attribute("dx").hasValue()&&(i.x+=i.attribute("dx").toPixels("x"))):(this.attribute("dx").hasValue()&&(this.x+=this.attribute("dx").toPixels("x")),i.attribute("dx").hasValue()&&(this.x+=i.attribute("dx").toPixels("x")),i.x=this.x),this.x=i.x+i.measureText(t),i.attribute("y").hasValue()?(i.y=i.attribute("y").toPixels("y"),i.attribute("dy").hasValue()&&(i.y+=i.attribute("dy").toPixels("y"))):(this.attribute("dy").hasValue()&&(this.y+=this.attribute("dy").toPixels("y")),i.attribute("dy").hasValue()&&(this.y+=i.attribute("dy").toPixels("y")),i.y=this.y),this.y=i.y,i.render(t);for(var o=0;o<i.children.length;o++)this.renderChild(t,i,o)}}]),_class30}(e.Element.RenderedElementBase),e.Element.TextElementBase=function(t){_inherits(_class31,t);var n=_createSuper(_class31);function _class31(){return _classCallCheck(this,_class31),n.apply(this,arguments)}return _createClass(_class31,[{key:"getGlyph",value:function getGlyph(t,e,n){var i=e[n],o=null;if(t.isArabic){var s="isolated";(0===n||" "===e[n-1])&&n<e.length-2&&" "!==e[n+1]&&(s="terminal"),n>0&&" "!==e[n-1]&&n<e.length-2&&" "!==e[n+1]&&(s="medial"),n>0&&" "!==e[n-1]&&(n===e.length-1||" "===e[n+1])&&(s="initial"),void 0!==t.glyphs[i]&&(o=t.glyphs[i][s],Di(o)&&"glyph"===t.glyphs[i].type&&(o=t.glyphs[i]))}else o=t.glyphs[i];return Di(o)&&(o=t.missingGlyph),o}},{key:"renderChildren",value:function renderChildren(t){var n=this.parent.style("font-family").getDefinition();if(Di(n))""!==t.fillStyle&&t.fillText(e.compressSpaces(this.getText()),this.x,this.y),""!==t.strokeStyle&&t.strokeText(e.compressSpaces(this.getText()),this.x,this.y);else{var i=this.parent.style("font-size").numValueOrDefault(e.Font.Parse(e.ctx.font).fontSize),o=this.parent.style("font-style").valueOrDefault(e.Font.Parse(e.ctx.font).fontStyle),s=this.getText();n.isRTL&&(s=s.split("").reverse().join(""));for(var l=e.ToNumberArray(this.parent.attribute("dx").value),u=0;u<s.length;u++){var h=this.getGlyph(n,s,u),p=i/n.fontFace.unitsPerEm;t.translate(this.x,this.y),t.scale(p,-p);var d=t.lineWidth;t.lineWidth=t.lineWidth*n.fontFace.unitsPerEm/i,"italic"===o&&t.transform(1,0,.4,1,0,0),h.render(t),"italic"===o&&t.transform(1,0,-.4,1,0,0),t.lineWidth=d,t.scale(1/p,-1/p),t.translate(-this.x,-this.y),this.x+=i*(h.horizAdvX||n.horizAdvX)/n.fontFace.unitsPerEm,void 0===l[u]||isNaN(l[u])||(this.x+=l[u])}}}},{key:"getText",value:function getText(){}},{key:"measureTextRecursive",value:function measureTextRecursive(t){var e=this.measureText(t);return this.children.forEach((function(n){e+=n.measureTextRecursive(t)})),e}},{key:"measureText",value:function measureText(t){var n=this.parent.style("font-family").getDefinition();if(!Di(n)){var i=this.parent.style("font-size").numValueOrDefault(e.Font.Parse(e.ctx.font).fontSize),o=0,s=this.getText();n.isRTL&&(s=s.split("").reverse().join(""));for(var l=e.ToNumberArray(this.parent.attribute("dx").value),u=0;u<s.length;u++){o+=(this.getGlyph(n,s,u).horizAdvX||n.horizAdvX)*i/n.fontFace.unitsPerEm,void 0===l[u]||isNaN(l[u])||(o+=l[u])}return o}var h=e.compressSpaces(this.getText());if(!t.measureText)return 10*h.length;t.save(),this.setContext(t);var p=t.measureText(h).width;return t.restore(),p}}]),_class31}(e.Element.RenderedElementBase),e.Element.tspan=function(t){_inherits(_class32,t);var e=_createSuper(_class32);function _class32(t){var n;return _classCallCheck(this,_class32),(n=e.call(this,t,!0)).text=t.nodeValue||t.text||"",n}return _createClass(_class32,[{key:"getText",value:function getText(){return this.text}}]),_class32}(e.Element.TextElementBase),e.Element.tref=function(t){_inherits(_class33,t);var e=_createSuper(_class33);function _class33(){return _classCallCheck(this,_class33),e.apply(this,arguments)}return _createClass(_class33,[{key:"getText",value:function getText(){var t=this.getHrefAttribute().getDefinition();if(!Di(t))return t.children[0].getText()}}]),_class33}(e.Element.TextElementBase),e.Element.a=function(t){_inherits(_class34,t);var n=_createSuper(_class34);function _class34(t){var e;return _classCallCheck(this,_class34),(e=n.call(this,t)).hasText=!0,_toConsumableArray(t.childNodes).forEach((function(t){3!==t.nodeType&&(e.hasText=!1)})),e.text=e.hasText?t.childNodes[0].nodeValue:"",e}return _createClass(_class34,[{key:"getText",value:function getText(){return this.text}},{key:"renderChildren",value:function renderChildren(t){if(this.hasText){_get(_getPrototypeOf(_class34.prototype),"renderChildren",this).call(this,t);var n=new e.Property("fontSize",e.Font.Parse(e.ctx.font).fontSize);e.Mouse.checkBoundingBox(this,new e.BoundingBox(this.x,this.y-n.toPixels("y"),this.x+this.measureText(t),this.y))}else{var i=new e.Element.g;i.children=this.children,i.parent=this,i.render(t)}}},{key:"onclick",value:function onclick(){window.open(this.getHrefAttribute().value)}},{key:"onmousemove",value:function onmousemove(){e.ctx.canvas.style.cursor="pointer"}}]),_class34}(e.Element.TextElementBase),e.Element.image=function(t){_inherits(_class35,t);var n=_createSuper(_class35);function _class35(t){var i;_classCallCheck(this,_class35);var o=(i=n.call(this,t)).getHrefAttribute().value;return""===o?_possibleConstructorReturn(i):(i._isSvg=o.match(/\.svg$/),e.Images.push(_assertThisInitialized(i)),i.loaded=!1,i._isSvg?e.ajax(o,!0).then((function(t){i.img=t,i.loaded=!0})).catch((function(t){i.erred=!0,console.error("Ajax error for canvg",t)})):(i.img=document.createElement("img"),!0===e.opts.useCORS&&(i.img.crossOrigin="Anonymous"),i.img.addEventListener("load",(function(){i.loaded=!0})),i.img.addEventListener("error",(function(){e.log('ERROR: image "'+o+'" not found'),i.loaded=!0})),i.img.src=o),i)}return _createClass(_class35,[{key:"renderChildren",value:function renderChildren(t){var n=this.attribute("x").toPixels("x"),i=this.attribute("y").toPixels("y"),o=this.attribute("width").toPixels("x"),s=this.attribute("height").toPixels("y");0!==o&&0!==s&&(t.save(),this._isSvg?t.drawSvg(this.img,n,i,o,s):(t.translate(n,i),e.AspectRatio(t,this.attribute("preserveAspectRatio").value,o,this.img.width,s,this.img.height,0,0),t.drawImage(this.img,0,0)),t.restore())}},{key:"getBoundingBox",value:function getBoundingBox(){var t=this.attribute("x").toPixels("x"),n=this.attribute("y").toPixels("y"),i=this.attribute("width").toPixels("x"),o=this.attribute("height").toPixels("y");return new e.BoundingBox(t,n,t+i,n+o)}}]),_class35}(e.Element.RenderedElementBase),e.Element.g=function(t){_inherits(_class36,t);var n=_createSuper(_class36);function _class36(){return _classCallCheck(this,_class36),n.apply(this,arguments)}return _createClass(_class36,[{key:"getBoundingBox",value:function getBoundingBox(){var t=new e.BoundingBox;return this.children.forEach((function(e){t.addBoundingBox(e.getBoundingBox())})),t}}]),_class36}(e.Element.RenderedElementBase),e.Element.symbol=function(t){_inherits(_class37,t);var e=_createSuper(_class37);function _class37(){return _classCallCheck(this,_class37),e.apply(this,arguments)}return _createClass(_class37,[{key:"render",value:function render(t){}}]),_class37}(e.Element.RenderedElementBase),e.Element.style=function(t){_inherits(_class38,t);var n=_createSuper(_class38);function _class38(t){var i;_classCallCheck(this,_class38),i=n.call(this,t);var o="";return _toConsumableArray(t.childNodes).forEach((function(t){var e=t.nodeValue;o+=e})),o=o.replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^\s*\/\/.*)/gm,""),(o=e.compressSpaces(o)).split("}").forEach((function(t){if(""!==e.trim(t)){var n=_slicedToArray(t.split("{"),2),i=n[0],o=n[1];i=i.split(","),o=o.split(";"),i.forEach((function(t){if(""!==(t=e.trim(t))){var n={};if(o.forEach((function(t){var i=t.indexOf(":"),o=t.substr(0,i),s=t.substr(i+1,t.length-i);Di(o)||Di(s)||(n[e.trim(o)]=new e.Property(e.trim(o),e.trim(s)))})),e.Styles[t]=n,"@font-face"===t){var i=n["font-family"].value.replace(/"/g,"");n.src.value.split(",").forEach((function(t){if(t.includes('format("svg")')){var n=t.indexOf("url"),o=t.indexOf(")",n),s=t.substr(n+5,o-n-6);_toConsumableArray(e.parseXml(e.ajax(s)).getElementsByTagName("font")).forEach((function(t){t=e.CreateElement(t),e.Definitions[i]=t}))}}))}}}))}})),i}return _class38}(e.Element.ElementBase),e.Element.use=function(t){_inherits(_class39,t);var n=_createSuper(_class39);function _class39(t){var e;return _classCallCheck(this,_class39),(e=n.call(this,t))._el=e.getHrefAttribute().getDefinition(),e}return _createClass(_class39,[{key:"setContext",value:function setContext(t){_get(_getPrototypeOf(_class39.prototype),"setContext",this).call(this,t),this.attribute("x").hasValue()&&t.translate(this.attribute("x").toPixels("x"),0),this.attribute("y").hasValue()&&t.translate(0,this.attribute("y").toPixels("y"))}},{key:"path",value:function path(t){var e=this._el;Di(e)||e.path(t)}},{key:"getBoundingBox",value:function getBoundingBox(){var t=this._el;if(!Di(t))return t.getBoundingBox()}},{key:"renderChildren",value:function renderChildren(t){var n=this._el;if(!Di(n)){var i=n;"symbol"===n.type&&((i=new e.Element.svg).type="svg",i.attributes.viewBox=new e.Property("viewBox",n.attribute("viewBox").value),i.attributes.preserveAspectRatio=new e.Property("preserveAspectRatio",n.attribute("preserveAspectRatio").value),i.attributes.overflow=new e.Property("overflow",n.attribute("overflow").value),i.children=n.children),"svg"===i.type&&(this.attribute("width").hasValue()&&(i.attributes.width=new e.Property("width",this.attribute("width").value)),this.attribute("height").hasValue()&&(i.attributes.height=new e.Property("height",this.attribute("height").value)));var o=i.parent;i.parent=null,i.render(t),i.parent=o}}}]),_class39}(e.Element.RenderedElementBase),e.Element.mask=function(t){_inherits(_class40,t);var n=_createSuper(_class40);function _class40(){return _classCallCheck(this,_class40),n.apply(this,arguments)}return _createClass(_class40,[{key:"apply",value:function apply(t,n){var i=this.attribute("x").toPixels("x"),o=this.attribute("y").toPixels("y"),s=this.attribute("width").toPixels("x"),l=this.attribute("height").toPixels("y");if(0===s&&0===l){var u=new e.BoundingBox;this.children.forEach((function(t){u.addBoundingBox(t.getBoundingBox())})),i=Math.floor(u.x1),o=Math.floor(u.y1),s=Math.floor(u.width()),l=Math.floor(u.height())}var h=n.attribute("mask").value;n.attribute("mask").value="";var p=document.createElement("canvas");p.width=i+s,p.height=o+l;var d=p.getContext("2d");this.renderChildren(d);var v=document.createElement("canvas");v.width=i+s,v.height=o+l;var g=v.getContext("2d");n.render(g),g.globalCompositeOperation="destination-in",g.fillStyle=d.createPattern(p,"no-repeat"),g.fillRect(0,0,i+s,o+l),t.fillStyle=g.createPattern(v,"no-repeat"),t.fillRect(0,0,i+s,o+l),n.attribute("mask").value=h}},{key:"render",value:function render(t){}}]),_class40}(e.Element.ElementBase),e.Element.clipPath=function(t){_inherits(_class41,t);var n=_createSuper(_class41);function _class41(){return _classCallCheck(this,_class41),n.apply(this,arguments)}return _createClass(_class41,[{key:"apply",value:function apply(t){this.children.forEach((function(n){if(void 0!==n.path){var i=null;n.attribute("transform").hasValue()&&(i=new e.Transform(n.attribute("transform").value)).apply(t),n.path(t),t.clip(),i&&i.unapply(t)}}))}},{key:"render",value:function render(t){}}]),_class41}(e.Element.ElementBase),e.Element.filter=function(t){_inherits(_class42,t);var e=_createSuper(_class42);function _class42(){return _classCallCheck(this,_class42),e.apply(this,arguments)}return _createClass(_class42,[{key:"apply",value:function apply(t,e){var n=e.getBoundingBox(),i=Math.floor(n.x1),o=Math.floor(n.y1),s=Math.floor(n.width()),l=Math.floor(n.height()),u=e.style("filter").value;e.style("filter").value="";var h=0,p=0;this.children.forEach((function(t){var e=t.extraFilterDistance||0;h=Math.max(h,e),p=Math.max(p,e)}));var d=document.createElement("canvas");d.width=s+2*h,d.height=l+2*p;var v=d.getContext("2d");v.translate(-i+h,-o+p),e.render(v),this.children.forEach((function(t){t.apply(v,0,0,s+2*h,l+2*p)})),t.drawImage(d,0,0,s+2*h,l+2*p,i-h,o-p,s+2*h,l+2*p),e.style("filter",!0).value=u}},{key:"render",value:function render(t){}}]),_class42}(e.Element.ElementBase),e.Element.feMorphology=function(t){_inherits(_class43,t);var e=_createSuper(_class43);function _class43(){return _classCallCheck(this,_class43),e.apply(this,arguments)}return _createClass(_class43,[{key:"apply",value:function apply(t,e,n,i,o){}}]),_class43}(e.Element.ElementBase),e.Element.feComposite=function(t){_inherits(_class44,t);var e=_createSuper(_class44);function _class44(){return _classCallCheck(this,_class44),e.apply(this,arguments)}return _createClass(_class44,[{key:"apply",value:function apply(t,e,n,i,o){}}]),_class44}(e.Element.ElementBase),e.Element.feColorMatrix=function(t){_inherits(_class45,t);var n=_createSuper(_class45);function _class45(t){var i;_classCallCheck(this,_class45),i=n.call(this,t);var o=e.ToNumberArray(i.attribute("values").value);switch(i.attribute("type").valueOrDefault("matrix")){case"saturate":var s=o[0];o=[.213+.787*s,.715-.715*s,.072-.072*s,0,0,.213-.213*s,.715+.285*s,.072-.072*s,0,0,.213-.213*s,.715-.715*s,.072+.928*s,0,0,0,0,0,1,0,0,0,0,0,1];break;case"hueRotate":var l=o[0]*Math.PI/180,u=function c(t,e,n){return t+Math.cos(l)*e+Math.sin(l)*n};o=[u(.213,.787,-.213),u(.715,-.715,-.715),u(.072,-.072,.928),0,0,u(.213,-.213,.143),u(.715,.285,.14),u(.072,-.072,-.283),0,0,u(.213,-.213,-.787),u(.715,-.715,.715),u(.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break;case"luminanceToAlpha":o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1]}return i.matrix=o,i._m=function(t,e){var n=o[t];return n*(n<0?e-255:e)},i}return _createClass(_class45,[{key:"apply",value:function apply(t,e,n,i,o){for(var s=this._m,l=t.getImageData(0,0,i,o),u=0;u<o;u++)for(var h=0;h<i;h++){var p=imGet(l.data,h,u,i,o,0),d=imGet(l.data,h,u,i,o,1),v=imGet(l.data,h,u,i,o,2),g=imGet(l.data,h,u,i,o,3);imSet(l.data,h,u,i,o,0,s(0,p)+s(1,d)+s(2,v)+s(3,g)+s(4,1)),imSet(l.data,h,u,i,o,1,s(5,p)+s(6,d)+s(7,v)+s(8,g)+s(9,1)),imSet(l.data,h,u,i,o,2,s(10,p)+s(11,d)+s(12,v)+s(13,g)+s(14,1)),imSet(l.data,h,u,i,o,3,s(15,p)+s(16,d)+s(17,v)+s(18,g)+s(19,1))}t.clearRect(0,0,i,o),t.putImageData(l,0,0)}}]),_class45}(e.Element.ElementBase),e.Element.feGaussianBlur=function(t){_inherits(_class46,t);var n=_createSuper(_class46);function _class46(t){var e;return _classCallCheck(this,_class46),(e=n.call(this,t)).blurRadius=Math.floor(e.attribute("stdDeviation").numValue()),e.extraFilterDistance=e.blurRadius,e}return _createClass(_class46,[{key:"apply",value:function apply(t,n,i,o,s){t.canvas.id=e.UniqueId(),t.canvas.style.display="none",document.body.append(t.canvas),processCanvasRGBA(t.canvas,n,i,o,s,this.blurRadius),t.canvas.remove()}}]),_class46}(e.Element.ElementBase),e.Element.title=function(t){_inherits(_class47,t);var e=_createSuper(_class47);function _class47(t){return _classCallCheck(this,_class47),e.call(this)}return _class47}(e.Element.ElementBase),e.Element.desc=function(t){_inherits(_class48,t);var e=_createSuper(_class48);function _class48(t){return _classCallCheck(this,_class48),e.call(this)}return _class48}(e.Element.ElementBase),e.Element.MISSING=function(t){_inherits(_class49,t);var n=_createSuper(_class49);function _class49(t){var i;return _classCallCheck(this,_class49),i=n.call(this),e.log("ERROR: Element '"+t.nodeName+"' not yet implemented."),i}return _class49}(e.Element.ElementBase),e.CreateElement=function(t){var n,i=t.nodeName.replace(/^[^:]+:/,"").replace(/-/g,"");return(n=void 0!==e.Element[i]?new e.Element[i](t):new e.Element.MISSING(t)).type=t.nodeName,n},e.load=function(){var t=_asyncToGenerator(regeneratorRuntime.mark((function _callee(t,n){var i;return regeneratorRuntime.wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,e.ajax(n,!0);case 2:return i=o.sent,o.abrupt("return",e.loadXml(t,i));case 4:case"end":return o.stop()}}),_callee)})));return function(e,n){return t.apply(this,arguments)}}(),e.loadXml=function(t,n){return e.loadXmlDoc(t,e.parseXml(n))},e.loadXmlDoc=function(t,n){var i;e.init(t);var o=function mapXY(e){for(var n=t.canvas;n;)e.x-=n.offsetLeft,e.y-=n.offsetTop,n=n.offsetParent;return window.scrollX&&(e.x+=window.scrollX),window.scrollY&&(e.y+=window.scrollY),e};!0!==e.opts.ignoreMouse&&(t.canvas.addEventListener("click",(function(t){var n=Di(t)?[event.clientX,event.clientY]:[t.clientX,t.clientY],i=o(_construct(e.Point,n)),s=i.x,l=i.y;e.Mouse.onclick(s,l)})),t.canvas.addEventListener("mousemove",(function(t){var n=Di(t)?[event.clientX,event.clientY]:[t.clientX,t.clientY],i=o(_construct(e.Point,n)),s=i.x,l=i.y;e.Mouse.onmousemove(s,l)})));var s=e.CreateElement(n.documentElement);s.root=!0;var l=!0,u=function draw(i){e.ViewPort.Clear(),t.canvas.parentNode&&e.ViewPort.SetCurrent(t.canvas.parentNode.clientWidth,t.canvas.parentNode.clientHeight),!0!==e.opts.ignoreDimensions&&(s.style("width").hasValue()&&(t.canvas.width=s.style("width").toPixels("x"),t.canvas.style.width=t.canvas.width+"px"),s.style("height").hasValue()&&(t.canvas.height=s.style("height").toPixels("y"),t.canvas.style.height=t.canvas.height+"px"));var o=t.canvas.clientWidth||t.canvas.width,u=t.canvas.clientHeight||t.canvas.height;if(!0===e.opts.ignoreDimensions&&s.style("width").hasValue()&&s.style("height").hasValue()&&(o=s.style("width").toPixels("x"),u=s.style("height").toPixels("y")),e.ViewPort.SetCurrent(o,u),Di(e.opts.offsetX)||(s.attribute("x",!0).value=e.opts.offsetX),Di(e.opts.offsetY)||(s.attribute("y",!0).value=e.opts.offsetY),!Di(e.opts.scaleWidth)||!Di(e.opts.scaleHeight)){var h=e.ToNumberArray(s.attribute("viewBox").value),p=null,d=null;Di(e.opts.scaleWidth)||(s.attribute("width").hasValue()?p=s.attribute("width").toPixels("x")/e.opts.scaleWidth:isNaN(h[2])||(p=h[2]/e.opts.scaleWidth)),Di(e.opts.scaleHeight)||(s.attribute("height").hasValue()?d=s.attribute("height").toPixels("y")/e.opts.scaleHeight:isNaN(h[3])||(d=h[3]/e.opts.scaleHeight)),Di(p)&&(p=d),Di(d)&&(d=p),s.attribute("width",!0).value=e.opts.scaleWidth,s.attribute("height",!0).value=e.opts.scaleHeight,s.attribute("viewBox",!0).value="0 0 "+o*p+" "+u*d,s.attribute("preserveAspectRatio",!0).value="none"}!0!==e.opts.ignoreClear&&t.clearRect(0,0,o,u),s.render(t),l&&(l=!1,i(n))},h=!0;return e.intervalID=setInterval((function(){var t=!1;h&&e.ImagesLoaded()&&(h=!1,t=!0),!0!==e.opts.ignoreMouse&&(t=t||e.Mouse.hasEvents()),!0!==e.opts.ignoreAnimation&&e.Animations.forEach((function(n){var i=n.update(1e3/e.FRAMERATE);t=t||i})),"function"==typeof e.opts.forceRedraw&&!0===e.opts.forceRedraw()&&(t=!0),t&&(u(i),e.Mouse.runEvents())}),1e3/e.FRAMERATE),new Promise((function(t,n){if(e.ImagesLoaded())return h=!1,void u(t);i=t}))},e.stop=function(){e.intervalID&&clearInterval(e.intervalID)},e.Mouse={events:[],hasEvents:function hasEvents(){return 0!==this.events.length},onclick:function onclick(t,e){this.events.push({type:"onclick",x:t,y:e,run:function run(t){t.onclick&&t.onclick()}})},onmousemove:function onmousemove(t,e){this.events.push({type:"onmousemove",x:t,y:e,run:function run(t){t.onmousemove&&t.onmousemove()}})},eventElements:[],checkPath:function checkPath(t,e){var n=this;this.events.forEach((function(i,o){var s=i.x,l=i.y;e.isPointInPath&&e.isPointInPath(s,l)&&(n.eventElements[o]=t)}))},checkBoundingBox:function checkBoundingBox(t,e){var n=this;this.events.forEach((function(i,o){var s=i.x,l=i.y;e.isPointInBox(s,l)&&(n.eventElements[o]=t)}))},runEvents:function runEvents(){var t=this;e.ctx.canvas.style.cursor="",this.events.forEach((function(e,n){for(var i=t.eventElements[n];i;)e.run(i),i=i.parent})),this.events=[],this.eventElements=[]}},e}(n||{});1===t.childNodes.length&&"OBJECT"===t.childNodes[0].nodeName||(t.svg=o);var s=t.getContext("2d");return void 0!==e.documentElement?o.loadXmlDoc(s,e):"<"===e.substr(0,1)?o.loadXml(s,e):o.load(s,e)};function __variableDynamicImportRuntime0__(t){switch(t){case"./locale/en.js":return Promise.resolve().then((function(){return zi}));case"./locale/zh-CN.js":return Promise.resolve().then((function(){return Wi}));default:return Promise.reject(new Error("Unknown variable dynamic import: "+t))}}"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(t,e,n,i,o){Li(this.canvas,t,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:e,offsetY:n,scaleWidth:i,scaleHeight:o})});var Fi=function(){var t=_asyncToGenerator(regeneratorRuntime.mark((function _callee(t){var e;return regeneratorRuntime.wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,__variableDynamicImportRuntime0__("./locale/".concat(t,".js"));case 3:e=n.sent,n.next=12;break;case 6:return n.prev=6,n.t0=n.catch(0),console.error("Missing translation (".concat(t,") - using 'en'")),n.next=11,Promise.resolve().then((function(){return zi}));case 11:e=n.sent;case 12:return n.abrupt("return",e.default);case 13:case"end":return n.stop()}}),_callee,null,[[0,6]])})));return function loadExtensionTranslation(e){return t.apply(this,arguments)}}(),Gi={name:"server_opensave",init:function init(t){var e=this;return _asyncToGenerator(regeneratorRuntime.mark((function _callee6(){var n,i,o,s,l,u,h,p,d,v,g,b,_,w,P,C,k,E,S,T,A,O,M,V;return regeneratorRuntime.wrap((function _callee6$(B){for(;;)switch(B.prev=B.next){case 0:return V=function _rebuildInput(t){t.empty();var e=n('<input type="file" name="svg_file">').appendTo(t);function submit(){return _submit.apply(this,arguments)}function _submit(){return(_submit=_asyncToGenerator(regeneratorRuntime.mark((function _callee5(){return regeneratorRuntime.wrap((function _callee5$(e){for(;;)switch(e.prev=e.next){case 0:return t.submit(),V(t),e.next=4,n.process_cancel(l.uploading);case 4:k=!0,n("#dialog_box").hide();case 6:case"end":return e.stop()}}),_callee5)})))).apply(this,arguments)}t[0]===A[0]?e.change(_asyncToGenerator(regeneratorRuntime.mark((function _callee3(){return regeneratorRuntime.wrap((function _callee3$(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.openPrep();case 2:if(e.sent){e.next=6;break}return V(t),e.abrupt("return");case 6:return e.next=8,submit();case 8:case"end":return e.stop()}}),_callee3)})))):e.change(_asyncToGenerator(regeneratorRuntime.mark((function _callee4(){return regeneratorRuntime.wrap((function _callee4$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,submit();case 2:case"end":return t.stop()}}),_callee4)}))))},w=function _clientDownloadSuppor(t,e,i){return!p&&!d&&(!(""!==n("<a>")[0].download)&&(n("<a>hidden</a>").attr({download:(t||"image")+e,href:i}).css("display","none").appendTo("body")[0].click(),!0))},_=function _xhtmlEscape(t){return t.replace(/&(?!amp;)/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")},b=function _getFileNameFromTitle(){return g.getDocumentTitle().trim().replace(/[/\\:*?"<>|]/g,"_")},n=t.$,i=t.decode64,o=t.encode64,s=e,B.next=8,Fi(s.curPrefs.lang);case 8:if(l=B.sent,u=s.curConfig,h=u.extPath,p=u.avoidClientSide,d=u.avoidClientSideDownload,v=u.avoidClientSideOpen,g=s.canvas,P=h+"filesave.php",C=h+"filesave.php",k=!1,n('<iframe name="output_frame" title="'.concat(l.hiddenframe,'"\n style="width: 0; height: 0;" src="data:text/html;base64,PGh0bWw+"/>')).appendTo("body"),s.setCustomHandlers({save:function save(t,e){var i='<?xml version="1.0" encoding="UTF-8"?>\n'+e,s=b();w(s,".svg","data:image/svg+xml;charset=UTF-8;base64,"+o(i))||n("<form>").attr({method:"post",action:P,target:"output_frame"}).append('\n <input type="hidden" name="output_svg" value="'.concat(_(i),'">\n <input type="hidden" name="filename" value="').concat(_(s),'">\n ')).appendTo("body").submit().remove()},exportPDF:function exportPDF(t,e){var i=b(),o=e.output;w(i,".pdf",o)||n("<form>").attr({method:"post",action:C,target:"output_frame"}).append('\n <input type="hidden" name="output_img" value="'.concat(o,'">\n <input type="hidden" name="mime" value="application/pdf">\n <input type="hidden" name="filename" value="').concat(_(i),'">\n ')).appendTo("body").submit().remove()},exportImage:function exportImage(t,e){return _asyncToGenerator(regeneratorRuntime.mark((function _callee2(){var t,i,o,s,l,u,h,p,d;return regeneratorRuntime.wrap((function _callee2$(v){for(;;)switch(v.prev=v.next){case 0:return t=e.issues,i=e.mimeType,o=e.quality,n("#export_canvas").length||n("<canvas>",{id:"export_canvas"}).hide().appendTo("body"),(s=n("#export_canvas")[0]).width=g.contentW,s.height=g.contentH,v.next=7,Li(s,e.svg);case 7:if(l=o?s.toDataURL(i,o):s.toDataURL(i),h="",t.length&&(u="\n • ",h+="\n\n\n • "+t.join(u)),!h.length){v.next=13;break}return v.next=13,n.alert(h);case 13:if(p=b(),d="."+e.type.toLowerCase(),!w(p,d,l)){v.next=17;break}return v.abrupt("return");case 17:n("<form>").attr({method:"post",action:C,target:"output_frame"}).append('\n <input type="hidden" name="output_img" value="'.concat(l,'">\n <input type="hidden" name="mime" value="').concat(i,'">\n <input type="hidden" name="filename" value="').concat(_(p),'">\n ')).appendTo("body").submit().remove();case 18:case"end":return v.stop()}}),_callee2)})))()}}),!window.FileReader||v){B.next=16;break}return B.abrupt("return");case 16:E=h+"fileopen.php?type=load_svg",S=h+"fileopen.php?type=import_svg",T=h+"fileopen.php?type=import_img",s.processFile=function(t,e){var o;if(k)k=!1;else switch(n("#dialog_box").hide(),"import_img"!==e&&(o=i(t)),e){case"load_svg":g.clear(),g.setSvgString(o),s.updateCanvas();break;case"import_svg":g.importSvgString(o),s.updateCanvas();break;case"import_img":g.setGoodImage(t)}},(A=n("<form>")).attr({enctype:"multipart/form-data",method:"post",action:E,target:"output_frame"}),O=A.clone().attr("action",S),M=A.clone().attr("action",T),V(A),V(O),V(M),n("#tool_open").show().prepend(A),n("#tool_import").show().prepend(O),n("#tool_image").prepend(M);case 30:case"end":return B.stop()}}),_callee6)})))()}},zi=Object.freeze({__proto__:null,default:{uploading:"Uploading...",hiddenframe:"Opensave frame to store hidden values"}}),Wi=Object.freeze({__proto__:null,default:{uploading:"正在上传...",hiddenframe:"Opensave frame to store hidden values"}});export default Gi;
//# sourceMappingURL=ext-server_opensave.js.map